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FOKGFyZ3NbMV0pICYmIHBhcnNlSW50KGlmcmFtZS5zdHlsZS5taW5IZWlnaHQpID4gcGFyc2VJbnQoYXJnc1sxXSkpIHsKICAgICAgICAgICAgaWZyYW1lLnN0eWxlLm1pbkhlaWdodCA9IGFyZ3NbMV0gKyAicHgiOwogICAgICAgICAgfQogICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAiY29sbGFwc2VFcnJvclBhZ2UiOgogICAgICAgICAgaWYgKGlmcmFtZS5jbGllbnRIZWlnaHQgPiB3aW5kb3cuaW5uZXJIZWlnaHQpIHsKICAgICAgICAgICAgaWZyYW1lLnN0eWxlLmhlaWdodCA9IHdpbmRvdy5pbm5lckhlaWdodCArICJweCI7CiAgICAgICAgICB9CiAgICAgICAgICBicmVhazsKICAgICAgICBjYXNlICJyZWxvYWRQYWdlIjoKICAgICAgICAgIHdpbmRvdy5sb2NhdGlvbi5yZWxvYWQoKTsKICAgICAgICAgIGJyZWFrOwogICAgICAgIGNhc2UgImxvYWRTY3JpcHQiOgogICAgICAgICAgaWYoICF3aW5kb3cuaXNQZXJtaXR0ZWQoZS5vcmlnaW4sIFsnam90Zm9ybS5jb20nLCAnam90Zm9ybS5wcm8nXSkgKSB7IGJyZWFrOyB9CiAgICAgICAgICB2YXIgc3JjID0gYXJnc1sxXTsKICAgICAgICAgIGlmIChhcmdzLmxlbmd0aCA+IDMpIHsKICAgICAgICAgICAgICBzcmMgPSBhcmdzWzFdICsgJzonICsgYXJnc1syXTsKICAgICAgICAgIH0KICAgICAgICAgIHZhciBzY3JpcHQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgIHNjcmlwdC5zcmMgPSBzcmM7CiAgICAgICAgICBzY3JpcHQudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnOwogICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChzY3JpcHQpOwogICAgICAgICAgYnJlYWs7CiAgICAgICAgY2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