From 8274f0533ebf7b2a41222df39d8affef338f25e2 Mon Sep 17 00:00:00 2001 From: johnman Date: Fri, 8 Mar 2024 12:57:17 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20built-on?= =?UTF-8?q?-openfin/container-starter@b21cdc46b9d8bf4c3bbdc71e575449ecd92a?= =?UTF-8?q?9251=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manifest.fin.json | 84 +++---- .../create-window/app.fin.json | 54 ++--- .../create-window/manifest.fin.json | 68 +++--- .../integration-excel/manifest.fin.json | 216 ++++++++--------- .../second.manifest.fin.json | 44 ++-- .../manifest.fin.json | 92 +++---- .../second.manifest.fin.json | 46 ++-- .../manifest.fin.json | 26 +- .../platform.fin.json | 22 +- .../manifest.fin.json | 200 ++++++++------- .../manifest.fin.json | 96 ++++---- .../second.manifest.fin.json | 100 ++++---- .../manifest.fin.json | 68 +++--- .../use-logging-apis/js/app.bundle.js | 29 ++- .../use-logging-apis/manifest.fin.json | 48 ++-- .../js/dialog.bundle.js | 29 ++- .../manifest.fin.json | 228 +++++++++--------- .../manifest.fin.json | 68 +++--- .../use-popup-window-modal/manifest.fin.json | 68 +++--- .../manifest.fin.json | 68 +++--- .../manifest.fin.json | 68 +++--- .../use-preloads-basic/manifest.fin.json | 106 ++++---- .../manifest.fin.json | 82 +++---- .../use-security-realms/app.fin.json | 36 +-- .../use-security-realms/manifest.fin.json | 88 +++---- .../use-security-realms/uat/app.fin.json | 66 ++--- .../use-security-realms/uat/manifest.fin.json | 88 +++---- .../use-window-options/html/app.html | 17 +- .../use-window-options/html/preview.html | 92 ++++++- .../use-window-options/js/app.bundle.js | 57 ++--- .../use-window-options/manifest.fin.json | 36 +-- 31 files changed, 1253 insertions(+), 1137 deletions(-) diff --git a/dev/john/update-window-options/container-platform-starter/manifest.fin.json b/dev/john/update-window-options/container-platform-starter/manifest.fin.json index 15811ca4..1f0bab0f 100644 --- a/dev/john/update-window-options/container-platform-starter/manifest.fin.json +++ b/dev/john/update-window-options/container-platform-starter/manifest.fin.json @@ -1,43 +1,43 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "enableBeforeUnload": true, - "uuid": "container-platform-starter", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/container-platform-starter/favicon.ico", - "autoShow": false, - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/container-platform-starter/html/provider.html" - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "row", - "content": [ - { - "type": "stack", - "content": [ - { - "type": "component", - "title": "view1", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/views/platform/of-info/index.html", - "name": "view1", - "componentName": "view" - } - } - ] - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "enableBeforeUnload": true, + "uuid": "container-platform-starter", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/container-platform-starter/favicon.ico", + "autoShow": false, + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/container-platform-starter/html/provider.html" + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "row", + "content": [ + { + "type": "stack", + "content": [ + { + "type": "component", + "title": "view1", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/views/platform/of-info/index.html", + "name": "view1", + "componentName": "view" + } + } + ] + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/create-window/app.fin.json b/dev/john/update-window-options/create-window/app.fin.json index 16b90f0c..3e30aab9 100644 --- a/dev/john/update-window-options/create-window/app.fin.json +++ b/dev/john/update-window-options/create-window/app.fin.json @@ -1,28 +1,28 @@ { - "devtools_port": 9090, - "startup_app": { - "name": "OpenMultipleWindows", - "description": "OpenMultipleWindows", - "url": "http://www.google.com", - "showTaskbarIcon": true, - "taskbarIcon": "http://cdn.openfin.co/hyperblotter/favicon.ico", - "icon": "http://cdn.openfin.co/hyperblotter/favicon.ico", - "uuid": "OpenMultipleWindows", - "autoShow": true, - "contextMenu": true, - "defaultHeight": 500, - "defaultwidth": 500, - "frame": true, - "defaultCentered": true, - "resizable": true - }, - "runtime": { - "arguments": "--enable-crash-reporting --no-sandbox", - "version": "34.118.78.77" - }, - "shortcut": { - "company": "OpenFin", - "description": "Openfin openfin application window Sample", - "name": "Openfin application window" - } -} \ No newline at end of file + "devtools_port": 9090, + "startup_app": { + "name": "OpenMultipleWindows", + "description": "OpenMultipleWindows", + "url": "http://www.google.com", + "showTaskbarIcon": true, + "taskbarIcon": "http://cdn.openfin.co/hyperblotter/favicon.ico", + "icon": "http://cdn.openfin.co/hyperblotter/favicon.ico", + "uuid": "OpenMultipleWindows", + "autoShow": true, + "contextMenu": true, + "defaultHeight": 500, + "defaultwidth": 500, + "frame": true, + "defaultCentered": true, + "resizable": true + }, + "runtime": { + "arguments": "--enable-crash-reporting --no-sandbox", + "version": "34.118.78.80" + }, + "shortcut": { + "company": "OpenFin", + "description": "Openfin openfin application window Sample", + "name": "Openfin application window" + } +} diff --git a/dev/john/update-window-options/create-window/manifest.fin.json b/dev/john/update-window-options/create-window/manifest.fin.json index 53eb94e8..b851d00c 100644 --- a/dev/john/update-window-options/create-window/manifest.fin.json +++ b/dev/john/update-window-options/create-window/manifest.fin.json @@ -1,35 +1,35 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-open-windows", - "autoShow": true, - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/create-window/favicon.ico" - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/create-window/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-open-windows", + "autoShow": true, + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/create-window/favicon.ico" + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/create-window/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/integration-excel/manifest.fin.json b/dev/john/update-window-options/integration-excel/manifest.fin.json index 8a7aa10e..db3edbae 100644 --- a/dev/john/update-window-options/integration-excel/manifest.fin.json +++ b/dev/john/update-window-options/integration-excel/manifest.fin.json @@ -1,111 +1,107 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "integration-excel", - "applicationIcon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/favicon.ico", - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/provider/provider.html", - "autoShow": false, - "permissions": { - "System": { - "launchExternalProcess": true, - "downloadAsset": true, - "openUrlWithBrowser": { - "enabled": true, - "protocols": [ - "mailto" - ] - } - } - } - }, - "snapshot": { - "windows": [ - { - "defaultWidth": 600, - "defaultHeight": 600, - "defaultLeft": 0, - "defaultTop": 0, - "saveWindowState": false, - "backgroundThrottling": true, - "layout": { - "content": [ - { - "type": "column", - "id": "mainRow", - "isClosable": true, - "reorderEnabled": true, - "title": "", - "content": [ - { - "type": "stack", - "width": 100, - "isClosable": true, - "reorderEnabled": true, - "title": "", - "activeItemIndex": 0, - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/views/excel.html", - "name": "excel-view", - "fdc3InteropApi": "1.2", - "interop": { - "currentContextGroup": "green" - }, - "permissions": { - "System": { - "launchExternalProcess": true, - "downloadAsset": true, - "openUrlWithBrowser": { - "enabled": true, - "protocols": [ - "mailto" - ] - } - } - } - }, - "isClosable": true, - "reorderEnabled": true, - "title": "view" - } - ] - }, - { - "type": "stack", - "width": 100, - "isClosable": true, - "reorderEnabled": true, - "title": "", - "activeItemIndex": 0, - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/views/fdc3monitor.html", - "name": "fdc3-view", - "fdc3InteropApi": "1.2", - "interop": { - "currentContextGroup": "green" - } - }, - "isClosable": true, - "reorderEnabled": true, - "title": "view" - } - ] - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "integration-excel", + "applicationIcon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/favicon.ico", + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/provider/provider.html", + "autoShow": false, + "permissions": { + "System": { + "launchExternalProcess": true, + "downloadAsset": true, + "openUrlWithBrowser": { + "enabled": true, + "protocols": ["mailto"] + } + } + } + }, + "snapshot": { + "windows": [ + { + "defaultWidth": 600, + "defaultHeight": 600, + "defaultLeft": 0, + "defaultTop": 0, + "saveWindowState": false, + "backgroundThrottling": true, + "layout": { + "content": [ + { + "type": "column", + "id": "mainRow", + "isClosable": true, + "reorderEnabled": true, + "title": "", + "content": [ + { + "type": "stack", + "width": 100, + "isClosable": true, + "reorderEnabled": true, + "title": "", + "activeItemIndex": 0, + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/views/excel.html", + "name": "excel-view", + "fdc3InteropApi": "1.2", + "interop": { + "currentContextGroup": "green" + }, + "permissions": { + "System": { + "launchExternalProcess": true, + "downloadAsset": true, + "openUrlWithBrowser": { + "enabled": true, + "protocols": ["mailto"] + } + } + } + }, + "isClosable": true, + "reorderEnabled": true, + "title": "view" + } + ] + }, + { + "type": "stack", + "width": 100, + "isClosable": true, + "reorderEnabled": true, + "title": "", + "activeItemIndex": 0, + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/views/fdc3monitor.html", + "name": "fdc3-view", + "fdc3InteropApi": "1.2", + "interop": { + "currentContextGroup": "green" + } + }, + "isClosable": true, + "reorderEnabled": true, + "title": "view" + } + ] + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/integration-excel/second.manifest.fin.json b/dev/john/update-window-options/integration-excel/second.manifest.fin.json index d04853ed..b04a71ae 100644 --- a/dev/john/update-window-options/integration-excel/second.manifest.fin.json +++ b/dev/john/update-window-options/integration-excel/second.manifest.fin.json @@ -1,24 +1,22 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "integration-excel-tray", - "applicationIcon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/favicon.ico", - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/provider/provider-tray.html", - "autoShow": false, - "permissions": { - "System": { - "launchExternalProcess": true, - "downloadAsset": true, - "openUrlWithBrowser": { - "enabled": true, - "protocols": [ - "mailto" - ] - } - } - } - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "integration-excel-tray", + "applicationIcon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/favicon.ico", + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/integration-excel/provider/provider-tray.html", + "autoShow": false, + "permissions": { + "System": { + "launchExternalProcess": true, + "downloadAsset": true, + "openUrlWithBrowser": { + "enabled": true, + "protocols": ["mailto"] + } + } + } + } +} diff --git a/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/manifest.fin.json b/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/manifest.fin.json index 3f707db7..254ae2cd 100644 --- a/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/manifest.fin.json +++ b/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/manifest.fin.json @@ -1,47 +1,47 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77", - "autoShow": false - }, - "platform": { - "uuid": "how-to-use-a-manifest-create-a-single-page-platform", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/favicon.ico", - "defaultWindowOptions": { - "stylesheetUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/window-override.css" - } - }, - "snapshot": { - "windows": [ - { - "defaultWidth": 800, - "defaultHeight": 600, - "defaultCentered": true, - "saveWindowState": true, - "backgroundThrottling": true, - "layout": { - "content": [ - { - "type": "stack", - "width": 100, - "isClosable": false, - "reorderEnabled": false, - "hasHeaders": false, - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/style/style.html" - }, - "title": "view" - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80", + "autoShow": false + }, + "platform": { + "uuid": "how-to-use-a-manifest-create-a-single-page-platform", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/favicon.ico", + "defaultWindowOptions": { + "stylesheetUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/window-override.css" + } + }, + "snapshot": { + "windows": [ + { + "defaultWidth": 800, + "defaultHeight": 600, + "defaultCentered": true, + "saveWindowState": true, + "backgroundThrottling": true, + "layout": { + "content": [ + { + "type": "stack", + "width": 100, + "isClosable": false, + "reorderEnabled": false, + "hasHeaders": false, + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/style/style.html" + }, + "title": "view" + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/second.manifest.fin.json b/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/second.manifest.fin.json index 91bbb767..7162656c 100644 --- a/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/second.manifest.fin.json +++ b/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/second.manifest.fin.json @@ -1,24 +1,24 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77", - "autoShow": false - }, - "platform": { - "uuid": "second-how-to-use-a-manifest-create-a-single-page-platform", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/favicon.ico" - }, - "snapshot": { - "windows": [ - { - "defaultWidth": 800, - "defaultHeight": 600, - "defaultCentered": true, - "saveWindowState": true, - "backgroundThrottling": false, - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/style/style.html" - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80", + "autoShow": false + }, + "platform": { + "uuid": "second-how-to-use-a-manifest-create-a-single-page-platform", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-a-manifest-create-a-single-page-platform/favicon.ico" + }, + "snapshot": { + "windows": [ + { + "defaultWidth": 800, + "defaultHeight": 600, + "defaultCentered": true, + "saveWindowState": true, + "backgroundThrottling": false, + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/style/style.html" + } + ] + } +} diff --git a/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/manifest.fin.json b/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/manifest.fin.json index 8c813234..013f7b51 100644 --- a/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/manifest.fin.json +++ b/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/manifest.fin.json @@ -1,14 +1,14 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "version": "34.118.78.77", - "arguments": "--v=1" - }, - "startup_app": { - "name": "issue-commands-to-platform", - "uuid": "issue-commands-to-platform", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/html/window.html", - "autoShow": true, - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/favicon.ico" - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "version": "34.118.78.80", + "arguments": "--v=1" + }, + "startup_app": { + "name": "issue-commands-to-platform", + "uuid": "issue-commands-to-platform", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/html/window.html", + "autoShow": true, + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/favicon.ico" + } +} diff --git a/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/platform.fin.json b/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/platform.fin.json index ede2778c..cf87a8b5 100644 --- a/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/platform.fin.json +++ b/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/platform.fin.json @@ -1,12 +1,12 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-channel-api-issue-commands-to-a-platform", - "autoShow": true, - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/html/provider.html", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/favicon.ico" - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-channel-api-issue-commands-to-a-platform", + "autoShow": true, + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/html/provider.html", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-channel-api-issue-commands-to-a-platform/favicon.ico" + } +} diff --git a/dev/john/update-window-options/use-content-creation-rules/manifest.fin.json b/dev/john/update-window-options/use-content-creation-rules/manifest.fin.json index 674251bd..87aa10d3 100644 --- a/dev/john/update-window-options/use-content-creation-rules/manifest.fin.json +++ b/dev/john/update-window-options/use-content-creation-rules/manifest.fin.json @@ -1,107 +1,95 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "shortcut": { - "company": "OpenFin", - "description": "Content Creation Rules", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", - "name": "Content Creation Rules" - }, - "platform": { - "uuid": "use-content-creation-rules", - "name": "use-content-creation-rules", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", - "autoShow": false, - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/platform-provider.html", - "waitForPageLoad": false, - "defaultWindowOptions": { - "waitForPageLoad": false, - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/default-platform-window.html", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", - "contextMenu": true, - "defaultWidth": 600, - "defaultHeight": 600, - "defaultLeft": 0, - "defaultTop": 0, - "saveWindowState": false, - "backgroundThrottling": true, - "minHeight": 445, - "minWidth": 308 - }, - "defaultViewOptions": { - "contentCreation": { - "rules": [ - { - "behavior": "view", - "match": [ - "*://*.google.com/*" - ] - }, - { - "behavior": "view", - "match": [ - "*://*.examples.com/category/business/*" - ] - }, - { - "behavior": "window", - "match": [ - "*://*.bing.com/*" - ] - }, - { - "behavior": "window", - "match": [ - "*://*.examples.com/category/education/*" - ] - }, - { - "behavior": "browser", - "match": [ - "*://*.microsoft.com/*" - ] - }, - { - "behavior": "block", - "match": [ - "*://*.apple.com/*" - ] - } - ] - } - }, - "commands": [ - { - "command": "stack.nextTab", - "keys": "Ctrl+Tab" - } - ] - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "name": "component_A1", - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "shortcut": { + "company": "OpenFin", + "description": "Content Creation Rules", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", + "name": "Content Creation Rules" + }, + "platform": { + "uuid": "use-content-creation-rules", + "name": "use-content-creation-rules", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", + "autoShow": false, + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/platform-provider.html", + "waitForPageLoad": false, + "defaultWindowOptions": { + "waitForPageLoad": false, + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/default-platform-window.html", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/favicon.ico", + "contextMenu": true, + "defaultWidth": 600, + "defaultHeight": 600, + "defaultLeft": 0, + "defaultTop": 0, + "saveWindowState": false, + "backgroundThrottling": true, + "minHeight": 445, + "minWidth": 308 + }, + "defaultViewOptions": { + "contentCreation": { + "rules": [ + { + "behavior": "view", + "match": ["*://*.google.com/*"] + }, + { + "behavior": "view", + "match": ["*://*.examples.com/category/business/*"] + }, + { + "behavior": "window", + "match": ["*://*.bing.com/*"] + }, + { + "behavior": "window", + "match": ["*://*.examples.com/category/education/*"] + }, + { + "behavior": "browser", + "match": ["*://*.microsoft.com/*"] + }, + { + "behavior": "block", + "match": ["*://*.apple.com/*"] + } + ] + } + }, + "commands": [ + { + "command": "stack.nextTab", + "keys": "Ctrl+Tab" + } + ] + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "name": "component_A1", + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-content-creation-rules/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-interop-setup-multi-platform-interop/manifest.fin.json b/dev/john/update-window-options/use-interop-setup-multi-platform-interop/manifest.fin.json index a6766a03..b466a088 100644 --- a/dev/john/update-window-options/use-interop-setup-multi-platform-interop/manifest.fin.json +++ b/dev/john/update-window-options/use-interop-setup-multi-platform-interop/manifest.fin.json @@ -1,49 +1,49 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "platform-1", - "icon": "https://openfin.github.io/golden-prototype/favicon.ico", - "autoShow": false, - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/provider.html", - "apiDiagnostics": false, - "defaultWindowOptions": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/window.html", - "contextMenu": true, - "defaultWidth": 600, - "defaultHeight": 600, - "defaultLeft": 0, - "defaultTop": 0, - "saveWindowState": false, - "showBackgroundImages": true, - "backgroundThrottling": true, - "minHeight": 445, - "minWidth": 354 - } - }, - "snapshot": { - "windows": [ - { - "name": "window1", - "layout": { - "content": [ - { - "type": "row", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "url": "https://samples.openfin.co/dev-extensions/extensions/v1.0.0/interop/interop-api/context/interop-broadcast-view.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "platform-1", + "icon": "https://openfin.github.io/golden-prototype/favicon.ico", + "autoShow": false, + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/provider.html", + "apiDiagnostics": false, + "defaultWindowOptions": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/window.html", + "contextMenu": true, + "defaultWidth": 600, + "defaultHeight": 600, + "defaultLeft": 0, + "defaultTop": 0, + "saveWindowState": false, + "showBackgroundImages": true, + "backgroundThrottling": true, + "minHeight": 445, + "minWidth": 354 + } + }, + "snapshot": { + "windows": [ + { + "name": "window1", + "layout": { + "content": [ + { + "type": "row", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "url": "https://samples.openfin.co/dev-extensions/extensions/v1.0.0/interop/interop-api/context/interop-broadcast-view.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-interop-setup-multi-platform-interop/second.manifest.fin.json b/dev/john/update-window-options/use-interop-setup-multi-platform-interop/second.manifest.fin.json index b24c6358..eb1eb161 100644 --- a/dev/john/update-window-options/use-interop-setup-multi-platform-interop/second.manifest.fin.json +++ b/dev/john/update-window-options/use-interop-setup-multi-platform-interop/second.manifest.fin.json @@ -1,51 +1,51 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "platform-2", - "icon": "https://openfin.github.io/golden-prototype/favicon.ico", - "autoShow": false, - "apiDiagnostics": false, - "defaultWindowOptions": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/window.html", - "contextMenu": true, - "defaultWidth": 600, - "defaultHeight": 600, - "defaultLeft": 0, - "defaultTop": 0, - "saveWindowState": false, - "showBackgroundImages": true, - "backgroundThrottling": true, - "minHeight": 445, - "minWidth": 354 - }, - "defaultViewOptions": { - "fdc3InteropApi": "1.2" - } - }, - "snapshot": { - "windows": [ - { - "name": "view", - "layout": { - "content": [ - { - "type": "row", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "url": "https://samples.openfin.co/dev-extensions/extensions/v1.0.0/interop/fdc3/context/fdc3-broadcast-view.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "platform-2", + "icon": "https://openfin.github.io/golden-prototype/favicon.ico", + "autoShow": false, + "apiDiagnostics": false, + "defaultWindowOptions": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-interop-setup-multi-platform-interop/html/window.html", + "contextMenu": true, + "defaultWidth": 600, + "defaultHeight": 600, + "defaultLeft": 0, + "defaultTop": 0, + "saveWindowState": false, + "showBackgroundImages": true, + "backgroundThrottling": true, + "minHeight": 445, + "minWidth": 354 + }, + "defaultViewOptions": { + "fdc3InteropApi": "1.2" + } + }, + "snapshot": { + "windows": [ + { + "name": "view", + "layout": { + "content": [ + { + "type": "row", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "url": "https://samples.openfin.co/dev-extensions/extensions/v1.0.0/interop/fdc3/context/fdc3-broadcast-view.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-launch-external-process/manifest.fin.json b/dev/john/update-window-options/use-launch-external-process/manifest.fin.json index 30c33a07..f703f272 100644 --- a/dev/john/update-window-options/use-launch-external-process/manifest.fin.json +++ b/dev/john/update-window-options/use-launch-external-process/manifest.fin.json @@ -1,35 +1,35 @@ { - "runtime": { - "version": "34.118.78.77" - }, - "startup_app": { - "name": "launch-app-asset", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-launch-external-process/app.html", - "uuid": "launch-app-asset", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/images/icon-blue.png", - "autoShow": true, - "saveWindowState": true, - "permissions": { - "System": { - "launchExternalProcess": true, - "terminateExternalProcess": true, - "downloadAsset": true - } - } - }, - "appAssets": [ - { - "src": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-launch-external-process/assets/openfin-dotnet-example.zip", - "version": "3.1", - "alias": "of-dotnet-example", - "target": "DotNetCore.exe", - "mandatory": true - } - ], - "shortcut": { - "company": "OpenFin", - "description": "Launch App Asset", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/images/icon-blue.png", - "name": "Launch App Asset" - } -} \ No newline at end of file + "runtime": { + "version": "34.118.78.80" + }, + "startup_app": { + "name": "launch-app-asset", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-launch-external-process/app.html", + "uuid": "launch-app-asset", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/images/icon-blue.png", + "autoShow": true, + "saveWindowState": true, + "permissions": { + "System": { + "launchExternalProcess": true, + "terminateExternalProcess": true, + "downloadAsset": true + } + } + }, + "appAssets": [ + { + "src": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-launch-external-process/assets/openfin-dotnet-example.zip", + "version": "3.1", + "alias": "of-dotnet-example", + "target": "DotNetCore.exe", + "mandatory": true + } + ], + "shortcut": { + "company": "OpenFin", + "description": "Launch App Asset", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/common/images/icon-blue.png", + "name": "Launch App Asset" + } +} diff --git a/dev/john/update-window-options/use-logging-apis/js/app.bundle.js b/dev/john/update-window-options/use-logging-apis/js/app.bundle.js index 9940a698..1f0f3847 100644 --- a/dev/john/update-window-options/use-logging-apis/js/app.bundle.js +++ b/dev/john/update-window-options/use-logging-apis/js/app.bundle.js @@ -12992,7 +12992,7 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; -var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_throwIfLayoutManagerNotInitialized; +var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_getLayoutManagerSpy, _LayoutModule_throwIfLayoutManagerNotInitialized; Object.defineProperty(Factory$2, "__esModule", { value: true }); Factory$2.LayoutModule = void 0; const base_1$5 = base; @@ -13064,10 +13064,31 @@ class LayoutModule extends base_1$5.Base { // in single-layout case, we return the undocumented layoutManager type (deprecate with CORE-1081) const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...this.fin.me.identity }; const layoutManager = await this.wire.environment.resolveLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), layoutIdentity); - return Object.assign(this.wrapSync(layoutIdentity), { layoutManager }); + return __classPrivateFieldGet$4(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity, layoutManager); } return this.wrapSync(this.fin.me.identity); }; + _LayoutModule_getLayoutManagerSpy.set(this, (layoutIdentity, layoutManager) => { + const msg = '[Layout] You are using a deprecated property `layoutManager` - it will throw if you access it starting in v37.'; + const managerProxy = new Proxy(layoutManager, { + get(target, key) { + console.warn(`[Layout-mgr-proxy] accessing ${key.toString()}`); + console.warn(msg); + return target[key]; + } + }); + const layout = Object.assign(this.wrapSync(layoutIdentity), { layoutManager: managerProxy }); + const layoutProxy = new Proxy(layout, { + get(target, key) { + if (key === 'layoutManager') { + console.warn(`[Layout-proxy] accessing ${key.toString()}`); + console.warn(msg); + } + return target[key]; + } + }); + return layoutProxy; + }); /** * Returns the layout manager for the current window * @returns @@ -13181,7 +13202,7 @@ class LayoutModule extends base_1$5.Base { } } Factory$2.LayoutModule = LayoutModule; -_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized(method) { +_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized(method) { if (!__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f")) { throw new Error(`You must call init before using the API ${method}`); } @@ -35135,4 +35156,4 @@ async function createLogDropDown(parentElement) { /******/ })() ; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmJ1bmRsZS5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQWE7O0FBRWIsOENBQTZDLEVBQUUsYUFBYSxFQUFDOztBQUU3RCxpQkFBaUIsbUJBQU8sQ0FBQyxtREFBUTtBQUNqQyxpQkFBaUIsbUJBQU8sQ0FBQyxtREFBUTs7QUFFakMsc0hBQXNILHFCQUFNLG1CQUFtQixxQkFBTTs7QUFFcko7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQSxtREFBbUQsMEJBQTBCO0FBQzdFLDJCQUEyQixzQkFBc0IscUJBQXFCLG1CQUFtQjtBQUN6RjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsVUFBVSw4QkFBOEIsS0FBSywwQkFBMEIsb0JBQW9CLDRCQUE0QjtBQUN2SCxJQUFJLDBCQUEwQixnRkFBZ0Ysb0NB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tcbmJhc2UuUmVwbHkgPSBiYXNlLkVtaXR0ZXJCYXNlID0gYmFzZS5CYXNlID0gdm9pZCAwO1xuY29uc3QgcHJvbWlzZXNfMSA9IHByb21pc2VzO1xuY2xhc3MgQmFzZSB7XG4gICAgLyoqXG4gICAgICogQGludGVybmFsXG4gICAgICovXG4gICAgY29uc3RydWN0b3Iod2lyZSkge1xuICAgICAgICB0aGlzLmlzTm9kZUVudmlyb25tZW50ID0gKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5lbnZpcm9ubWVudC5jb25zdHJ1Y3Rvci5uYW1lID09PSAnTm9kZUVudmlyb25tZW50JztcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5pc09wZW5GaW5FbnZpcm9ubWVudCA9ICgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuZW52aXJvbm1lbnQuY29uc3RydWN0b3IubmFtZSA9PT0gJ09wZW5GaW5FbnZpcm9ubWVudCc7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuaXNCcm93c2VyRW52aXJvbm1lbnQgPSAoKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLmVudmlyb25tZW50LmNvbnN0cnVjdG9yLm5hbWUgPT09ICdCcm93c2VyRW52aXJvbm1lbnQnO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLndpcmUgPSB3aXJlO1xuICAgIH1cbiAgICBnZXQgZmluKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLmdldEZpbigpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBQcm92aWRlcyBhY2Nlc3MgdG8gdGhlIE9wZW5GaW4gcmVwcmVzZW50YXRpb24gb2YgdGhlIGN1cnJlbnQgY29kZSBjb250ZXh0ICh1c3VhbGx5IGEgZG9jdW1lbnRcbiAgICAgKiBzdWNoIGFzIGEge0BsaW5rIE9wZW5GaW4uVmlld30gb3Ige0BsaW5rIE9wZW5GaW4uV2luZ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ICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIHVuZG9TdWJzY3JpcHRpb24oZW1pdHRlcik7XG4gICAgICAgICAgICAgICAgdGhpcy5kZWxldGVFbWl0dGVySWZOb3RoaW5nUmVnaXN0ZXJlZChlbWl0dGVyKTtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmRlcmVnaXN0ZXJFdmVudExpc3RlbmVyID0gYXN5bmMgKGV2ZW50VHlwZSwgb3B0aW9ucyA9IHt9KSA9PiB7XG4gICAgICAgICAgICBpZiAodGhpcy5oYXNFbWl0dGVyKCkpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBydW50aW1lRXZlbnQgPSB7XG4gICAgICAgICAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHksXG4gICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcDogb3B0aW9ucy50aW1lc3RhbXAgfHwgRGF0ZS5ub3coKSxcbiAgICAgICAgICAgICAgICAgICAgdG9waWM6IHRoaXMudG9waWMsXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IGV2ZW50VHlwZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3Vuc3Vic2NyaWJlLXRvLWRlc2t0b3AtZXZlbnQnLCBydW50aW1lRXZlbnQpLmNhdGNoKCgpID0+IG51bGwpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGVtaXR0ZXIgPSB0aGlzLmdldE9yQ3JlYXRlRW1pdHRlcigpO1xuICAgICAgICAgICAgICAgIHJldHVybiBlbWl0dGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gVGhpcyB3aWxsIG9ubHkgYmUgcmVhY2hlZCBpZiB1bnN1YnNjcmliZSBmcm9tIGV2ZW50IHRoYXQgZG9lcyBub3QgZXhpc3QgYnV0IGRvIG5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GwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5pc1ZpZXcpIHtcblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgYXJlIG5vdCBpbiBhIFZpZXcgY29udGV4dCcpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjb25zdCB7IHV1aWQsIG5hbWUgfSA9IHRoaXMud2lyZS5tZTtcblx0ICAgICAgICByZXR1cm4gdGhpcy53cmFwKHsgdXVpZCwgbmFtZSB9KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogU3luY2hyb25vdXNseSByZXR1cm5zIGEgVmlldyBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50IHZpZXdcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuXHQgICAgICogY29uc29sZS5sb2codmlldyk7XG5cdCAgICAgKlxuXHQgICAgICogYGBgXG5cdCAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgKi9cblx0ICAgIGdldEN1cnJlbnRTeW5jKCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd2aWV3LWdldC1jdXJyZW50LXN5bmMnKS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5pc1ZpZXcpIHtcblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgYXJlIG5vdCBpbiBhIFZpZXcgY29udGV4dCcpO1xuXHQgICAgICAg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biAgICAgICAgICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLFxuICAgICAgICAgICAgICAgICAgICBtZXRhOiBpbnN0YW5jZU9wdGlvbnNcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGN1c3RvbUNvbnN1bXB0aW9uT3B0aW9uc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLnN0cmF0ZWd5LmV4cG9zZU1ldGEoaW5zdGFuY2VPcHRpb25zLCBleHBvc2VkUHJvcHMpO1xuICAgICAgICB9O1xuICAgIH1cbiAgICA7XG59XG5hcGlFeHBvc2VyLkFwaUV4cG9zZXIgPSBBcGlFeHBvc2VyO1xuXG52YXIgc3RyYXRlZ2llcyA9IHt9O1xuXG52YXIgb3BlbmZpbkNoYW5uZWxzID0ge307XG5cbnZhciBjaGFubmVsc0NvbnN1bWVyID0ge307XG5cbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShjaGFubmVsc0NvbnN1bWVyLCBcIl9fZXNNb2R1bGVcIiwgeyB2YWx1ZTogdHJ1ZSB9KTtcbmNoYW5uZWxzQ29uc3VtZXIuQ2hhbm5lbHNDb25zdW1lciA9IHZvaWQgMDtcbmNsYXNzIENoYW5uZWxzQ29uc3VtZXIge1xuICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZVxuICAgIGNvbnN0cnVjdG9yKGNoYW5uZWwpIHtcbiAgICAgICAgdGhpcy5jaGFubmVsID0gY2hhbm5lbDtcbiAgICAgICAgdGhpcy5nZXRFeHBvc2VkRnVuY3Rpb25zID0gYXN5bmMgKG9wdGlvbnMpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHsgaWQgfSA9IG9wdGlvbnM7XG4gICAgICAgICAgICBjb25zdCB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lzdHM6IHRydWVcbiAgICAgICAgICogY29uc29sZS5sb2coYFRoZSBlbnRpdHkgZXhpc3RzOiAke2V4aXN0c31gKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmV4aXN0cyA9ICgpID0+IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkZSh0aGlzLCBfTGF5b3V0Tm9kZV9jbGllbnQsIFwiZlwiKS5leGlzdHModGhpcy5lbnRpdHlJZCk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXRyaWV2ZXMgdGhlIHBhcmVudCBvZiB0aGUgVGFiU3RhY2sgb3IgQ29sdW1uT3JSb3dcbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogLy8gUmV0cmlldmVzIHRoZSBwYXJlbnQgQ29sdW1uT3JSb3dcbiAgICAgICAgICogY29uc3QgY29sdW1uT3JSb3cgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICpcbiAgICAgICAgICogLy8gdW5kZWZpbmVkIGlmIGVudGl0eSBpcyB0aGUgcm9vdCBpdGVtXG4gICAgICAgICAqIGxldCBwYXJlbnQgPSBhd2FpdCBjb2x1bW5PclJvdy5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogLy8gb3JcbiAgICAgICAgICogbGV0IHBhcmVudCA9IGF3YWl0IHN0YWNrLmdldFBhcmVudCgpO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoa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tcbiAgICB9XG59XG5sYXlvdXRFbnRpdGllcy5UYWJTdGFjayA9IFRhYlN0YWNrO1xuX1RhYlN0YWNrX2NsaWVudCA9IG5ldyBXZWFrTWFwKCk7XG4vKipcbiAqIEEgQ29sdW1uT3JSb3cgaXMgdXNlZCB0byBtYW5hZ2UgdGhlIHN0YXRlIG9mIENvbHVtbiBhbmQgUm93cyB3aXRoaW4gYW4gT3BlbkZpbiBMYXlvdXQuXG4gKi9cbmNsYXNzIENvbHVtbk9yUm93IGV4dGVuZHMgTGF5b3V0Tm9kZSB7XG4gICAgLyoqXG4gICAgICogQGludGVybmFsXG4gICAgICovXG4gICAgY29uc3RydWN0b3IoY2xpZW50LCBlbnRpdHlJZCwgdHlwZSkge1xuICAgICAgICBzdXBlcihjbGllbnQsIGVudGl0eUlkKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBpZ25vcmVcbiAgICAgICAgICogQGludGVybmFsXG4gICAgICAgICAqIEFwaUNsaWVudCBmb3Ige0BsaW5rIExheW91dEVudGl0aWVzQ29udHJvbGxlcn1cbiAgICAgICAgICovXG4gICAgICAgIF9Db2x1bW5PclJvd19jbGllbnQuc2V0KHRoaXMsIHZvaWQgMCk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXRyaWV2ZXMgdGhlIGNvbnRlbnQgYXJyYXkgb2YgdGhlIENvbHVtbk9yUm93XG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGlmICghZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcuJyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3Qgc3RhY2sgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFN0YWNrKCk7XG4gICAgICAgICAqIC8vIFJldHJpZXZlcyB0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Q29udGVudHNFdmVudHMgZXZlbnQgbmFtZXNwYWNlfS5cbiAgICAgKi9cbiAgICBleGVjdXRlSmF2YVNjcmlwdChjb2RlKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmVcbiAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdleGVjdXRlLWphdmFzY3JpcHQtaW4td2luZG93JywgeyAuLi50aGlzLmlkZW50aXR5LCBjb2RlIH0pXG4gICAgICAgICAgICAudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHpvb20gbGV2ZWwgb2YgdGhlIFdlYkNvbnRlbnRzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBWaWV3OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gZ2V0Wm9vbUxldmVsKCkge1xuICAgICAqICAgICBjb25zdCB2aWV3ID0gYXdhaXQgZmluLlZpZXcuZ2V0Q3VycmVudCgpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgdmlldy5nZXRab29tTGV2ZWwoKTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBnZXRab29tTGV2ZWwoKS50aGVuKHpvb21MZXZlbCA9PiBjb25zb2xlLmxvZyh6b29tTGV2ZWwpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVXaW4oKSB7XG4gICAgICogICAgIGNvbnN0IGFwcCA9IGF3YWl0IGZpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG4gICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcbiAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm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B0aGUgcHJvdG9jb2wgcHJlZml4IHN1Y2ggYXMgaHR0cDovLyBvciBodHRwczovLy5cbiAgICAgKiBAcGFyYW0gdXJsIC0gVGhlIFVSTCB0byBuYXZpZ2F0ZSB0aGUgV2ViQ29udGVudHMgdG8uXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIFZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcbiAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZScsXG4gICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuICAgICAqICAgICB9KTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBjcmVhdGVWaWV3KClcbiAgICAgKiAgICAgLnRoZW4odmlldyA9PiB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2V4YW1wbGUuY29tJykpXG4gICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCduYXZpZ2F0aW9uIGNvbXBsZXRlJykpXG4gICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBuYXZpZ2F0ZSgpIHtcbiAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCB3aW4ubmF2aWdhdGUoJ2h0dHBzOi8vY2Ru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uICAgIHJlbG9hZChpZ25vcmVDYWNoZSA9IGZhbHNlKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmVcbiAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdyZWxvYWQtd2luZG93Jywge1xuICAgICAgICAgICAgaWdub3JlQ2FjaGUsXG4gICAgICAgICAgICAuLi50aGlzLmlkZW50aXR5XG4gICAgICAgIH0pXG4gICAgICAgICAgICAudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBQcmludHMgdGhlIFdlYkNvbnRlbnRzLlxuICAgICAqIEBwYXJhbSBvcHRpb25zIFByaW50ZXIgT3B0aW9uc1xuICAgICAqXG4gICAgICogTm90ZTogV2hlbiBgc2lsZW50YCBpcyBzZXQgdG8gYHRydWVgLCB0aGUgQVBJIHdpbGwgcGljayB0aGUgc3lzdGVtJ3MgZGVmYXVsdCBwcmludGVyIGlmIGRldmljZU5hbWVcbiAgICAgKiBpcyBlbXB0eSBhbmQgdGhlIGRlZmF1bHQgc2V0dGluZ3MgZm9yIHByaW50aW5nLlxuICAgICAqXG4gICAgICogVXNlIHRoZSBDU1Mgc3R5bGUgYHBhZ2UtYnJlYWstYmVmb3JlOiBhbHdheXM7YCB0byBmb3JjZSBwcmludCB0byBhIG5ldyBwYWdlLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogdmlldy5wcmludCh7IHNpbGVudDogZmFsc2UsIGRldmljZU5hbWU6ICdzeXN0ZW0tcHJpbnRlci1uYW1lJyB9KS50aGVuKCgpID0+IHtcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ3ByaW50IGNhbGwgaGFzIGJlZW4gc2VudCB0byB0aGUgc3lzdGVtJyk7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3Ncb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lIHRoZSBzZWxlY3Rpb24gaW50byBhIG5vcm1hbCBzZWxlY3Rpb24uXG4gICAgICogKiBhY3RpdmF0ZVNlbGVjdGlvbiAtIEZvY3VzIGFuZCBjbGljayB0aGUgc2VsZWN0aW9uIG5vZGUuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIFZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCB2aWV3ID0gZmluLlZpZXcuZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKlxuICAgICAqIHZpZXcuYWRkTGlzdGVuZXIoJ2ZvdW5kLWluLXBhZ2UnLCAoZXZlbnQpID0+IHtcbiAgICAgKiAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICogICAgICAgICB2aWV3LnN0b3BGaW5kSW5QYWdlKCdjbGVhclNlbGVjdGlvbicpO1xuICAgICAqICAgICB9LCA1MDAwKTtcbiAgICAgKiB9KTtcbiAgICAgKlxuICAgICAqIHZpZXcuZmluZEluUGFnZSgnYScpLnRoZW4ocmVzdWx0cyA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHJlc3VsdHMpO1xuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd2luID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogd2luLmFkZExpc3RlbmVyKCdmb3VuZC1pbi1wYWdlJywgKGV2ZW50KSA9PiB7XG4gICAgICogICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAqICAgICAgICAgd2luLnN0b3BGaW5kSW5QYWdlKCdjbGVhclNlbGVjdGlvbicpO1xuICAgICAqICAgICB9LCA1MDAwKTtcbiAgICAgKiB9KTtcbiAgICAgKlxuICAgICAqIHdpbi5maW5kSW5QYWdlKCdhJykudGhlbihyZXN1bHRzID0+IHtcbiAgICAgKiAgICAgY29uc29sZS5sb2cocm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7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByaW50ZXIpO1xuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH0pO1xuICAgICAqICAgICB9KVxuICAgICAqICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgKiAgICAgfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCB3aW4gPSBmaW4uV2luZG93LmdldEN1cnJlbnRTeW5jKCk7XG4gICAgICpcbiAgICAgKiB3aW4uZ2V0UHJpbnRlcnMoKVxuICAgICAqICAgICAudGhlbigocHJpbnRlcnMpID0+IHtcbiAgICAgKiAgICAgICAgIHByaW50ZXJzLmZvckVhY2goKHByaW50ZXIpID0+IHtcbiAgICAgKiAgICAgICAgICAgICBpZiAocHJpbnRlci5pc0RlZmF1bHQpIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocHJpbnRlcik7XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfSk7XG4gICAgICogICAgIH0pXG4gICAgICogICAgIC5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xuICAgICAqICAgICB9KTtcbiAgICAgKiBgYGBcbiAgICAgKiBAcmVtYXJrc1xuICAgICAqIGBXZWJDb250ZW50c2AgcmVmZXJzIHRvIHNoYXJlZCBmdW5jdGlvbmFsaXR5IGJldHdlZW4ge0BsaW5rIE9wZW5GaW4uV2luZG93fSBhbmQge0BsaW5rIE9wZW5GaW4uVmlld30uXG4gICAgICogV2UgZG8gbm90IGV4cG9zZSBhbiBleHBsaWNpdCBzdXBlcmNsYXNzIGZvciB0aGlzIGZ1bmN0aW9uYWxpdHksIGJ1dCBpdCBkb2VzIGhhdmUgaXRzIG93blxuICAgICAqIHtAbGluayBPcGVuRmluLldlYkNvbnRlbnRzRXZlbnRzIGV2ZW50IG5hbWVzcGFjZX0uXG4gICAgICovXG4gICAgZ2V0UHJpbnRlcnMoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXByaW50ZXJzJywgeyAuLi50aGlzLmlkZW50aXR5IH0pLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiBwYXlsb2FkLmRhdGEpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBHaXZlcyBmb2N1cyB0byB0aGUgV2ViQ29udGVudHMuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gZm9jdXNXaW5kb3coKSB7XG4gICAgICogICAgIGNvbnN0IGFwcCA9IGF3YWl0IGZpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG4gICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcbiAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuZm9jdXMuaHRtbCcsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuICAgICAqICAgICB9KTtcbiAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLmZvY3VzKCk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZm9jdXNXaW5kb3coKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdXaW5kb3cgZm9jdXNlZCcpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaG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wnKTtcbiAgICAgKlxuICAgICAqICAgICBjb25zdCBzaGFyZWRXb3JrZXJzID0gYXdhaXQgdmlldy5nZXRTaGFyZWRXb3JrZXJzKCk7XG4gICAgICogICAgIGF3YWl0IHZpZXcuaW5zcGVjdFNoYXJlZFdvcmtlckJ5SWQoc2hhcmVkV29ya2Vyc1swXS5pZCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgY29uc3Qgd2luT3B0aW9uID0ge1xuICAgICAqICAgICAgICAgbmFtZTonY2hpbGQnLFxuICAgICAqICAgICAgICAgZGVmYXVsdFdpZHRoOiAzMDAsXG4gICAgICogICAgICAgICBkZWZhdWx0SGVpZ2h0OiAzMDAsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwOi8vbWRuLmdpdGh1Yi5pby9zaW1wbGUtc2hhcmVkLXdvcmtlci9pbmRleDIuaHRtbCcsXG4gICAgICogICAgICAgICBmcmFtZTogdHJ1ZSxcbiAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG4gICAgICogICAgIH07XG4gICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuY3JlYXRlKHdpbk9wdGlvbik7XG4gICAgICogICAgIGNvbnN0IHNoYXJlZFdvcmtlcnMgPSBhd2FpdCB3aW4uZ2V0U2hhcmVkV29ya2VycygpO1xuICAgICAqICAgICBhd2FpdCB3aW4uaW5zcGVjdFNoYXJlZFdvcmtlckJ5SWQoc2hhcmVkV29ya2Vyc1swXS5pZCk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaGFyZWQgZnVuY3Rpb25hbGl0eSBiZXR3ZWVuIHtAbGluayBPcGVuRmluLldpbmRvd30gYW5kIHtAbGluayBPcGVuRmluLlZpZXd9LlxuICAgICAqIFdlIGRvIG5vdCBleHBvc2UgYW4gZXhwbGlj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AgICAgICAgLy8gc2V0Q29sb3IocGF5bG9hZC5kYXRhLnZhbHVlKTtcbiAgICAgKiAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqIH07XG4gICAgICpcbiAgICAgKiBhd2FpdCBmaW4ubWUuc2hvd1BvcHVwV2luZG93KHtcbiAgICAgKiAgICAgaW5pdGlhbE9wdGlvbnM6IHtcbiAgICAgKiAgICAgICAgIGZyYW1lOiBmYWxzZVxuICAgICAqICAgICB9LFxuICAgICAqICAgICB1cmw6ICc8bXlfcG9wdXBfdXJsPicsXG4gICAgICogICAgIHJlc3VsdERpc3BhdGNoQmVoYXZpb3I6ICdub25lJyxcbiAgICAgKiAgICAgYmx1ckJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqICAgICBmb2N1czogdHJ1ZSxcbiAgICAgKiAgICAgaGVpZ2h0OiAzMDAsXG4gICAgICogICAgIHdpZHRoOiAzMDAsXG4gICAgICogICAgIHg6IDAsXG4gICAgICogICAgIHk6IDAsXG4gICAgICogICAgIG9uUG9wdXBSZXN1bHQ6IHBvcHVwUmVzdWx0Q2FsbGJhY2tcbiAgICAgKiB9KTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFNhbWUgYXMgYWJvdmUgYnV0IHVzaW5nIGFuIGV4aXN0aW5nIHdpbmRvdyBhcyBhIHBvcHVwOlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBwb3B1cFJlc3VsdENhbGxiYWNrID0gKHBheWxvYWQpID0+IHtcbiAgICAgKiAgICAgICAgaWYgKHBheWxvYWQucmVzdWx0ID09PSAnY2xpY2tlZCcpIHtcbiAgICAgKiAgICAgICAgICAgIGlmIChwYXlsb2FkLmRhdGEudG9waWMgPT09ICdjb2xvci1jaGFuZ2VkJykge1xuICAgICAqICAgICAgICAgICAgICAgIC8vIGRvIHNvbWV0aGluZyBsaWtlXG4gICAgICogICAgICAgICAgICAgICAgLy8gc2V0Q29sb3IocGF5bG9hZ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ICAgICAgY29uc3QgcG9wdXBXaW5kb3cgPSB0aGlzLmZpbi5XaW5kb3cud3JhcFN5bmMoeyB1dWlkOiB0aGlzLmZpbi5tZS51dWlkLCBuYW1lOiBwb3B1cE5hbWUgfSk7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IG9wdGlvbnMub25Qb3B1cFJlYWR5KHBvcHVwV2luZG93KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgU29tZXRoaW5nIHdlbnQgd3JvbmcgZHVyaW5nIG9uUG9wdXBSZWFkeSBleGVjdXRpb246ICR7ZXJyb3J9YCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCB0eXBpbmcgKGludGVybmFsKVxuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgYXdhaXQgdGhpcy5vbmNlKCdwb3B1cC1yZWFkeScsIHJlYWR5TGlzdGVuZXIpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHsgcGF5bG9hZDogdHJ5Q3JlYXRlUGF5bG9hZCB9ID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3RyeS1jcmVhdGUtcG9wdXAtd2luZG93Jywge1xuICAgICAgICAgICAgb3B0aW9uczoge1xuICAgICAgICAgICAgICAgIC4uLm9wdGlvbnMsXG4gICAgICAgICAgICAgICAgLy8gSW50ZXJuYWwgdXNlIG9ubHkuXG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgICAgIGhhc1Jlc3VsdENhbGxiYWNrOiAhIW9wdGlvbnM/Lm9uUG9wdXBSZXN1bHQsXG4gICAgICAgICAgICAgICAgaGFzUmVhZHlDYWxsYmFjazogISFvcHRpb25zPy5vblBvcHVwUmVhZHlcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAuLi50aGlzLmlkZW50aXR5XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCB7IGRhdGE6IHsgd2lsbE9wZW4sIG9wdGlvbnM6IHBvcHVwT3B0aW9ucyB9IH0gPSB0cnlDcmVhdGVQYXlsb2FkO1xuICAgICAgICBpZiAod2lsbE9wZW4pIHtcbiAgICAgICAgICAgIC8vIFNvbHZlIHRoZSBpc3N1ZSB3aGVyZSBJbnRlcm9wIGluIGEgcG9wdXAgd2luZG93IHdpdGggbm9uIGNyb3NzLW9yaWdpbiB1cmwgaXMgbm90IHdvcmtpbmcoY29yZS0xMDc2KS5cbiAgICAgICAgICAgIGF3YWl0IHRoaXMuZmluLldpbmRvdy5jcmVhdGUocG9wdXBPcHRpb25zLmluaXRpYWxPcHRpb25zKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBub3JtYWxpemVQb3B1cFJlc3VsdCA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICBjb25zdCB7IG5hbWUsIHV1aWQsIHJlc3VsdCwgZGF0YSB9ID0gcGF5bG9hZDtcbiAgICAgICAgICAgIGNvbnN0IHBvcHVwUmVzdWx0ID0ge1xuICAgICAgICAgICAgICAgIGlkZW50aXR5OiB7XG4gICAgICAgICAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHV1aWRcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHJlc3VsdFxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgcG9wdXBSZXN1bHQuZGF0YSA9IGRhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcG9wdXBSZXN1bHQ7XG4gICAgICAgIH07XG4gICAgICAgIGlmIChvcHRpb25zPy5vblBvcHVwUmVzdWx0KSB7XG4gICAgICAgICAgICBjb25zdCBkaXNwYXRjaFJlc3Vs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gICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgY29uc3Qgd2luT3B0aW9uID0ge1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTond2luT3B0aW9uTmFtZScsXG5cdCAgICAgICAgICogICAgICAgICBkZWZhdWx0V2lkdGg6IDMwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGRlZmF1bHRIZWlnaHQ6IDMwMCxcblx0ICAgICAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuY3JlYXRlLmh0bWwnLFxuXHQgICAgICAgICAqICAgICAgICAgZnJhbWU6IHRydWUsXG5cdCAgICAgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICAgICAqICAgICB9O1xuXHQgICAgICAgICAqICAgICBjb25zdCBuZXdXaW5kb3cgPSBhd2FpdCBmaW4uV2luZG93LmNyZWF0ZSh3aW5PcHRpb24pO1xuXHQgICAgICAgICAqICAgICB2aWV3LmF0dGFjaChuZXdXaW5kb3cuaWRlbnRpdHkpO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGF0dGFjaFZpZXcoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnVmlldyBhdHRhY2hlZCB0byBuZXcgd2luZG93LicpKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmF0dGFjaCA9IGFzeW5jICh0YXJnZXQpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2F0dGFjaC12aWV3JywgeyB0YXJnZXQsIC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBEZXN0cm95cyB0aGUgY3VycmVudCB2aWV3XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogY29uc3QgdmlldyA9IGZpbi5WaWV3LndyYXBTeW5jKHsgdXVpZDogJ3ZpZXdVdWlkJywgbmFtZTogJ3ZpZXdOYW1lJyB9KTtcblx0ICAgICAgICAgKiB2aWV3LmRlc3Ryb3koKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5kZXN0cm95ID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZGVzdHJveS12aWV3JywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogU2hvd3MgdGhlIGN1cnJlbnQgdmlldyBpZiBpdCBpcyBjdXJyZW50bHkgaGlkZGVuLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lU2hvdycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBoaWRlQW5kU2hvd1ZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwgb3B0aW9uLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcuaGlkZSgpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZyhcIlZpZXcgaGlkZGVuLlwiKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2aWV3LnNob3coKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coXCJWaWV3IHNob3duLlwiKTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICp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4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lU2V0Qm91bmRzJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIHNob3dWaWV3QXQoKSB7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5zaG93QXQoe1xuXHQgICAgICAgICAqICAgICAgICAgdG9wOiAxMDAsXG5cdCAgICAgICAgICogICAgICAgICBsZWZ0OiAxMDAsXG5cdCAgICAgICAgICogICAgICAgICB3aWR0aDogMzAwLFxuXHQgICAgICAgICAqICAgICAgICAgaGVpZ2h0OiAzMDBcblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogc2hvd1ZpZXdBdCgpXG5cdCAgICAgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdWaWV3IHNldCB0byBuZXcgYm91bmRzIGFuZCBzaG93bi4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5zaG93QXQgPSBhc3luYyAoYm91bmRzKSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzaG93LXZpZXctYXQnLCB7IGJvdW5kcywgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEhpZGVzIHRoZSBjdXJyZW50IHZpZXcgaWYgaXQgaXMgY3VycmVudGx5IHZpc2libGUuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVIaWRlJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGhpZGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcuaGlkZSgpO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGhpZGVWaWV3KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgaGlkZGVuLicpKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmhpZGUgPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdoaWRlLXZpZXcnLCB7IC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBTZXRzIHRoZSBib3VuZHMgKHRvcCwgbGVmdCwgd2lkdGgsIGhlaWdodCkgb2YgdGhlIHZpZXcgcmVsYXRpdmUgdG8gaXRzIHdpbmRvdy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZW1hcmtzIFZpZXcgcG9zaXRpb24gaXMgcmVsYXRpdmUgdG8gdGhlIGJvdW5kcyBvZiB0aGUgd2luZG93LlxuXHQgICAgICAgICAqICh7dG9wOiAwLCBsZWZ0OiAwfSByZXByZXNlbnRzIHRoZSB0b3AgbGVmdCBjb3JuZXIgb2YgdGhlIHdpbmRvdylcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZVNldEJvdW5kcycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBzZXRWaWV3Qm91bmRzKCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcuc2V0Qm91bmRzKHtcblx0ICAgICAgICAgKiAgICAgICAgIHRvcDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgbGVmdDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgd2lkdGg6IDMwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGhlaWdodDogMzAwXG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIHNldFZpZXdCb3VuZHMoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnVmlldyBzZXQgdG8gbmV3IGJvdW5kcy4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5zZXRCb3VuZHMgPSBhc3luYyAoYm91bmRzKSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzZXQtdmlldy1ib3VuZHMnLCB7IGJvdW5kcywgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEdldHMgdGhlIGJvdW5kcyAodG9wLCBsZWZ0LCB3aWR0aCwgaGVpZ2h0KSBvZiB0aGUgdmlldyByZWxhdGl2ZSB0byBpdHMgd2luZG93LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJlbWFya3MgVmlldyBwb3NpdGlvbiBpcyByZWxhdGl2ZSB0byB0aGUgYm91bmRzIG9mIHRoZSB3aW5kb3cuXG5cdCAgICAgICAgICogKHt0b3A6IDAsIGxlZnQ6IDB9IHJlcHJlc2VudHMgdGhlIHRvcCBsZWZ0IGNvcm5lciBvZiB0aGUgd2luZG93KVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGNvbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICBuYW1lOiAndmlld05hbWVTZXRCb3VuZHMnLFxuXHQgICAgICAgICAqICAgICB0YXJnZXQ6IGZpbi5tZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqIH0pO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhd2FpdCB2aWV3LnNldEJvdW5kcyh7XG5cdCAgICAgICAgICogICAgIHRvcDogMTAwLFxuXHQgICAgICAgICAqICAgICBsZWZ0OiAxMDAsXG5cdCAgICAgICAgICogICAgIHdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgIGhlaWdodDogMzAwXG5cdCAgICAgICAgICogfSk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBjb25zb2xlLmxvZyhhd2FpdCB2aWV3LmdldEJvdW5kcygpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5nZXRCb3VuZHMgPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIGNvbnN0IGFjayA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtdmlldy1ib3VuZHMnLCB7IC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgICAgIHJldHVybiBhY2sucGF5bG9hZC5kYXRhO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogR2V0cyB0aGUgVmlldydzIGluZm8uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVHZXRJbmZvJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFZpZXdJbmZvKCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHJldHVybiB2aWV3LmdldEluZm8oKTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBnZXRWaWV3SW5mbygpXG5cdCAgICAgICAgICogICAgIC50aGVuKChpbmZvKSA9PiBjb25zb2xlLmxvZygnVmlldyBpbmZvIGZldGNoZWQuJywgaW5mbykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0SW5mbyA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgYWNrID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC12aWV3LWluZm8nLCB7IC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgICAgIHJldHVybiBhY2sucGF5bG9hZC5kYXRhO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogUmV0cmlldmVzIHRoZSBsYXlvdXQgZm9yIHRoZSB3aW5kb3cgdGhlIHZpZXcgaXMgYXR0YWNoZWQgdG8uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogICAgIC8vZ2V0IHRoZSBjdXJyZW50IFZpZXdcblx0ICAgICAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICAvL2dldCBhIHJlZmVyZW5jZSB0byB0aGUgTGF5b3V0IGZvciB0aGUgV2luZG93IHRoZSB2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zLmlkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcChsYXlvdXRJZGVudGl0eSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgY2F0Y2ggKGUpIHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGFsbG93ZWRFcnJvcnMgPSBbXG5cdCAgICAgICAgICAgICAgICAgICAgJ05vIGFjdGlvbiByZWdpc3RlcmVkIGF0IHRhcmdldCBmb3InLFxuXHQgICAgICAgICAgICAgICAgICAgICdnZXRMYXlvdXRJZGVudGl0eUZvclZpZXdPclRocm93IGlzIG5vdCBhIGZ1bmN0aW9uJ1xuXHQgICAgICAgICAgICAgICAgXTtcblx0ICAgICAgICAgICAgICAgIGlmICghYWxsb3dlZEVycm9ycy5zb21lKChtKSA9PiBlLm1lc3NhZ2UuaW5jbHVkZXMobSkpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIC8vIGZhbGxiYWNrIGxvZ2ljIGZvciBtaXNzaW5nIGVuZHBvaW50XG5cdCAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maW4uUGxhdGZvcm0uTGF5b3V0LndyYXAobGF5b3V0V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogR2V0cyB0aGUgVmlldydzIG9wdGlvbnMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVHZXRPcHRpb25zJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFZpZXdPcHRpb25zKCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBmaW4uVmlldy53cmFwU3luYyh7IHV1aWQ6IG1lLmlkZW50aXR5LnV1aWQsIG5hbWU6ICd2aWV3TmFtZUdldE9wdGlvbnMnIH0pO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gdmlldy5nZXRPcHRpb25zKCk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogZ2V0Vmlld09wdGlvbnMoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoaW5mbykgPT4gY29uc29sZS5sb2coJ1ZpZXcgb3B0aW9ucyBmZXRjaGVkLicsIGluZm8pKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmdldE9wdGlvbnMgPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXZpZXctb3B0aW9ucycsIHsgLi4udGhpcy5pZGVudGl0eSB9KS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFVwZGF0ZXMgdGhlIHZpZXcncyBvcHRpb25zLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9nb29nbGUuY29tJyxcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZVVwZGF0ZU9wdGlvbnMnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gdXBkYXRlVmlld09wdGlvbnMoKSB7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwgb3B0aW9uLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGNvbnN0IG5ld09wdGlvbnMgPSB7IGF1dG9SZXNpemU6IHtcblx0ICAgICAgICAgKiAgICAgICAgIHdpZHRoOiB0cnVlLFxuXHQgICAgICAgICAqICAgICAgICAgaG9yaXpvbnRhbDogdHJ1ZVxuXHQgICAgICAgICAqICAgICB9fTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIHZpZXcudXBkYXRlT3B0aW9ucyhuZXdPcHRpb25zKTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiB1cGRhdGVWaWV3T3B0aW9ucygpXG5cdCAgICAgICAgICogICAgIC50aGVuKHBheWxvYWQgPT4gY29uc29sZS5sb2coJ1ZpZXcgb3B0aW9ucyB1cGRhdGVkOiAnLCBwYXlsb2FkKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy51cGRhdGVPcHRpb25zID0gYXN5bmMgKG9wdGlvbnMpID0+IHtcblx0ICAgICAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd1cGRhdGUtdmlldy1vcHRpb25zJywgeyBvcHRpb25zLCAuLi50aGlzLmlkZW50aXR5IH0pLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFJldHJpZXZlcyB0aGUgd2luZG93IHRoZSB2aWV3IGlzIGN1cnJlbnRseSBhdHRhY2hlZCB0by5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBjb25zdCB2aWV3ID0gZmluLlZpZXcud3JhcFN5bmMoeyB1dWlkOiAndmlld1V1aWQnLCBuYW1lOiAndmlld05hbWUnIH0pO1xuXHQgICAgICAgICAqIHZpZXcuZ2V0Q3VycmVudFdpbmRvdygpXG5cdCAgICAgICAgICogICAgIC50aGVuKHdpbiA9PiBjb25zb2xlLmxvZygnY3VycmVudCB3aW5kb3cnLCB3aW4pKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpOylcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5nZXRDdXJyZW50V2luZG93ID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCB7IHBheWxvYWQ6IHsgZGF0YSB9IH0gPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXZpZXctd2luZG93JywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICByZXR1cm4gbmV3IHdpbmRvd18xLl9XaW5kb3codGhpcy53aXJlLCBkYXRhKTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAg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AgICAqIGBgYFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0Q3VycmVudFN0YWNrID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1nZXQtY3VycmVudC1zdGFjaycpLmNhdGNoKCgpID0+IHtcblx0ICAgICAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGxheW91dFdpbmRvdyA9IGF3YWl0IHRoaXMuZ2V0Q3VycmVudFdpbmRvdygpO1xuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvdmlkZXJDaGFubmVsQ2xpZW50ID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfVmlld19wcm92aWRlckNoYW5uZWxDbGllbnQsIFwiZlwiKS5nZXRWYWx1ZSgpO1xuXHQgICAgICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgbGF5b3V0X2VudGl0aWVzXzEuTGF5b3V0Tm9kZS5uZXdMYXlvdXRFbnRpdGllc0NsaWVudChwcm92aWRlckNoYW5uZWxDbGllbnQsIGxheW91dF9jb25zdGFudHNfMS5MQVlPVVRfQ09OVFJPTExFUl9JRCwgbGF5b3V0V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IHN0YWNrRGVmaW5pdGlvbiA9IChhd2FpdCBjbGllbnQuZ2V0U3RhY2tCeVZpZXcodGhpcy5pZGVudGl0eSkpO1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIGxheW91dF9lbnRpdGllc18xLkxheW91dE5vZGUuZ2V0RW50aXR5KHN0YWNrRGVmaW5pdGlvbiwgY2xpZW50KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICA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ICAgICAgICBjb25zdCB1cmwgPSAnaHR0cHM6Ly9leGFtcGxlLmNvbSc7XG5cdCAgICAgICAgICogICAgICAgICBjb25zdCBlbGVtZW50SWQgPSAndmlldy1jb250YWluZXInO1xuXHQgICAgICAgICAqICAgICAgICAgY29uc3QgZWxlbWVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGVsZW1lbnRJZCk7XG5cdCAgICAgICAgICogICAgICAgICBjb25zdCB2aWV3ID0gYXdhaXQgZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgICAgICBuYW1lOiAnbXktdmlldycsXG5cdCAgICAgICAgICogICAgICAgICAgICAgdXJsLFxuXHQgICAgICAgICAqICAgICAgICAgICAgIHRhcmdldDogZmluLm1lLmlkZW50aXR5XG5cdCAgICAgICAgICogICAgICAgICB9KTtcblx0ICAgICAgICAgKiAgICAgICAgIGF3YWl0IHZpZXcubmF2aWdhdGUodXJsKTtcblx0ICAgICAgICAgKiAgICAgICAgIGF3YWl0IHZpZXcuYmluZFRvRWxlbWVudChlbGVtZW50KTtcblx0ICAgICAgICAgKiAgICAgfVxuXHQgICAgICAgICAqICAgICBjcmVhdGVBbmRBdHRhY2hWaWV3KCkuY2F0Y2goY29uc29sZS5lcnJvcik7XG5cdCAgICAgICAgICogPC9zY3JpcHQ+XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5iaW5kVG9FbGVtZW50ID0gYXN5bmMgKGVsZW1lbnQpID0+IHtcblx0ICAgICAgICAgICAgaWYgKCFlbGVtZW50KSB7XG5cdCAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0VsZW1lbnQgbm90IGZvdW5kLicpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNvbnN0IG9uQ2hhbmdlID0gYXN5bmMgKGJvdW5kcykgPT4gdGhpcy5zZXRCb3VuZHMoYm91bmRzKTtcblx0ICAgICAgICAg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XRpb25cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRXaW5kb3coKSB7XG5cdCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLnN0YXJ0KHtcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLUFwcGxpY2F0aW9uLmdldFdpbmRvdy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGdldFdpbmRvdygpLnRoZW4od2luID0+IHtcblx0ICAgICAqICAgICB3aW4uc2hvd0F0KDAsIDQwMCk7XG5cdCAgICAgKiAgICAgd2luLmZsYXNoKCk7XG5cdCAgICAgKiB9KS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgZ2V0V2luZG93KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdhcHBsaWNhdGlvbi1nZXQtd2luZG93JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAg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2hhbmdlIG1pZ2h0IG9ubHkgYmUgdmlzaWJsZSBhZnRlciB0aGUgY2FjaGUgaXMgcmVtb3ZlZCBvciB0aGVcblx0ICAgICAqIHV1aWQgb3Igc2hvcnRjdXQubmFtZSBpcyBjaGFuZ2VkLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKlxuXHQgICAgICogYGBganNcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBmaW4uQXBwbGljYXRpb24uZ2V0Q3VycmVudFN5bmMoKTtcblx0ICAgICAqICAgICBjb25zdCBhcHBOYW1lID0gJ015IEFwcCc7XG5cdCAgICAgKiAgICAgY29uc3QganVtcExpc3RDb25maWcgPSBbIC8vIGFycmF5IG9mIEp1bXBMaXN0IGNhdGVnb3JpZXNcblx0ICAgICAqICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgLy8gaGFzIG5vIG5hbWUgYW5kIG5vIHR5cGUgc28gYHR5cGVgIGlzIGFzc3VtZWQgdG8gYmUgXCJ0YXNrc1wiXG5cdCAgICAgKiAgICAgICAgICAgICBpdGVtczogWyAvLyBhcnJheSBvZiBKdW1wTGlzdCBpdGVtc1xuXHQgICAgICogICAgICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICd0YXNrJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICB0aXRsZTogYExhdW5jaCAke2FwcE5hbWV9YCxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogYFJ1bnMgJHthcHBOYW1lfSB3aXRoIHRoZSBkZWZhdWx0IGNvbmZpZ3VyYXRpb25gLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vYXBwL21hbmlmZXN0Lmpzb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL2FwcC9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9LFxuXHQgICAgICogICAgICAgICAgICAgeyB0eXBlOiAnc2VwYXJhdG9yJyB9LFxuXHQgICAgICogICAgICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICd0YXNrJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICB0aXRsZTogYFJlc3RvcmUgJHthcHBOYW1lfWAsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246ICdSZXN0b3JlIHRvIGxhc3QgY29uZmlndXJhdGlvbicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVlcExpbms6ICdmaW5zOi8vcGF0aC50by9hcHAvbWFuaWZlc3QuanNvbj8kJHVzZS1sYXN0LWNvbmZpZ3VyYXRpb249dHJ1ZScsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvblBhdGg6ICdodHRwczovL3BhdGgudG8vYXBwL2ljb24uaWNvJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uSW5kZXg6IDBcblx0ICAgICAqICAgICAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgICAgICBdXG5cdCAgICAgKiAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIG5hbWU6ICdUb29scycsXG5cdCAgICAgKiAgICAgICAgICAgICBpdGVtczogWyAvLyBhcnJheSBvZiBKdW1wTGlzdCBpdGVtc1xuXHQgICAgICogICAgICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICd0YXNrJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICB0aXRsZTogJ1Rvb2wgQScsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246ICdSdW5zIFRvb2wgQScsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVlcExpbms6ICdmaW5zOi8vcGF0aC50by90b29sLWEvbWFuaWZlc3QuanNvbicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvblBhdGg6ICdodHRwczovL3BhdGgudG8vdG9vbC1hL2ljb24uaWNvJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uSW5kZXg6IDBcblx0ICAgICAqICAgICAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdHlwZTogJ3Rhc2snLFxuXHQgICAgICogICAgICAgICAgICAgICAgIHRpdGxlOiAnVG9vbCBCJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogJ1J1bnMgVG9vbCBCJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZWVwTGluazogJ2ZpbnM6Ly9wYXRoLnRvL3Rvb2wtYi9tYW5pZmVzdC5qc29uJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uUGF0aDogJ2h0dHBzOi8vcGF0aC50by90b29sLWIvaWNvbi5pY28nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25JbmRleDogMFxuXHQgICAgICogICAgICAgICAgICAgfV1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIF07XG5cdCAgICAgKlxuXHQgICAgICogICAgIGFwcC5zZXRKdW1wTGlzdChqdW1wTGlzdENvbmZpZykudGhlbigoKSA9PiBjb25zb2xlLmxvZygnSnVtcExpc3QgYXBwbGllZCcpKS5jYXRjaChlID0+IGNvbnNvbGUubG9nKGBKdW1wTGlzdCBmYWlsZWQgdG8gYXBwbHk6ICR7ZS50b1N0cmluZygpfWApKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICpcblx0ICAgICAqIFRvIGhhbmRsZSBkZWVwbGluayBhcmdzOlxuXHQgICAgICogYGBganNcblx0ICAgICAqICAgICBmdW5jdGlvbiBoYW5kbGVVc2VMYXN0Q29uZmlndXJhdGlvbigpIHtcblx0ICAgICAqICAgICAgICAgLy8gdGhpcyBoYW5kbGVyIGlzIGNhbGxlZCB3aGVuIHRoZSBhcHAgaXMgYmVpbmcgbGF1bmNoZWRcblx0ICAgICAqICAgICAgICAgYXBwLm9uKCdydW4tcmVxdWVzdGVkJywgZXZlbnQgPT4ge1xuXHQgICAgICogICAgICAgICAgICAgaWYoZXZlbnQudXNlckFwcENvbmZpZ0FyZ3NbJ3VzZS1sYXN0LWNvbmZpZ3VyYXRpb24nXSkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIC8vIHlvdXIgbG9naWMgaGVyZVxuXHQgICAgICogICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgLy8gdGhpcyBoYW5kbGVyIGlzIGNhbGxlZCB3aGVuIHRoZSBhcHAgd2FzIGFscmVhZHkgcnVubmluZyB3aGVuIHRoZSBsYXVuY2ggd2FzIHJlcXVlc3RlZFxuXHQgICAgICogICAgICAgICBmaW4uZGVza3RvcC5tYWluKGZ1bmN0aW9uKGFyZ3MpIHtcblx0ICAgICAqICAgICAgICAgICAgIGlmKGFyZ3MgJiYgYXJnc1sndXNlLWxhc3QtY29uZmlndXJhdGlvbiddKSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgLy8geW91ciBsb2dpYyBoZXJlXG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH0pO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBhc3luYyBzZXRKdW1wTGlzdChqdW1wTGlzdENhdGVnb3JpZXMpIHtcblx0ICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc2V0LWp1bXAtbGlzdCcsIHsgY29uZmlnOiBqdW1wTGlzdENhdGVnb3JpZXMsIC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIEFkZHMgYSBjdXN0b21pemFibGUgaWNvbi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cdCAgICAgKiAgICAgICAgIFwidXVpZFwiOiAnQXBwLTInLFxuXHQgICAgICogICAgICAgICBcIm1hbmlmZXN0VXJsXCI6ICdodHRwOi8vbG9jYWxob3N0OjU1NTUvYXBwMi5qc29uJyxcblx0ICAgICAqICAgICB9LFxuXHQgICAgICogICAgIHtcblx0ICAgICAqICAgICAgICAgXCJ1dWlkXCI6ICdBcHAtMycsXG5cdCAgICAgKiAgICAgICAgIFwibWFuaWZlc3RVcmxcIjogJ2h0dHA6Ly9sb2NhbGhvc3Q6NTU1NS9hcHAzLmpzb24nLFxuXHQgICAgICogICAgIH1cblx0ICAgICAqIF1cblx0ICAgICAqXG5cdCAgICAgKiBmaW4uQXBwbGljYXRpb24uc3RhcnRNYW55TWFuaWZlc3RzKGFwcGxpY2F0aW9uSW5mb0FycmF5KVxuXHQgICAgICogICAgIC50aGVuKCgpID0+IHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ1JWTSBoYXMgZmluaXNoZWQgbGF1bmNoaW5nIHRoZSBhcHBsaWNhdGlvbiBsaXN0LicpO1xuXHQgICAgICogICAgIH0pXG5cdCAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcblx0ICAgICAqICAgICB9KVxuXHQgICAgICogYGBgXG5cdCAgICAgKlxuXHQgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICovXG5cdCAgICBhc3luYyBzdGFydE1hbnlNYW5pZmVzdHMoYXBwbGljYXRpb25zLCBvcHRzKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdydW4tYXBwbGljYXRpb25zJywgeyBhcHBsaWNhdGlvbnMsIG9wdHMgfSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBBc3luY2hyb25vdXNseSByZXR1cm5zIGFuIEFwcGxpY2F0aW9uI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sIG90aGVyd2lzZSB3aGVuIGEgY2hpbGQgd2luZG93IGlzIGNyZWF0ZWQsIHBhZ2UgaXMgbm90IGxvYWRlZFxuXHQgICAgICAgICAgICBjb25zdCBwYWdlUmVzcG9uc2UgPSBuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4ge1xuXHQgICAgICAgICAgICAgICAgLy8gVE9ETzogZml4IHR5cGluZyAoaW50ZXJuYWwpXG5cdCAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG5cdCAgICAgICAgICAgICAgICB0aGlzLm9uKENPTlNUUlVDVE9SX0NCX1RPUElDLCBmdW5jdGlvbiBmaXJlQ29uc3RydWN0b3IocmVzcG9uc2UpIHtcblx0ICAgICAgICAgICAgICAgICAgICBsZXQgY2JQYXlsb2FkO1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgc3VjY2VzcyB9ID0gcmVzcG9uc2U7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VEYXRhID0gcmVzcG9uc2UuZGF0YTtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCB7IG1lc3NhZ2UgfSA9IHJlc3BvbnNlRGF0YTtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAoc3VjY2Vzcykge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBjYlBheWxvYWQgPSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBodHRwUmVzcG9uc2VDb2RlOiByZXNwb25zZURhdGEuaHR0cFJlc3BvbnNlQ29kZSxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwaUluamVjdGVkOiByZXNwb25zZURhdGEuYXBpSW5qZWN0ZWRcblx0ICAgICAgICAgICAgICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNiUGF5bG9hZCA9IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IHJlc3BvbnNlRGF0YS5tZXNzYWdlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0d29ya0Vycm9yQ29kZTogcmVzcG9uc2VEYXRhLm5ldHdvcmtFcnJvckNvZGUsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFjazogcmVzcG9uc2VEYXRhLnN0YWNrXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlTGlzdGVuZXIoQ09OU1RSVUNUT1JfQ0JfVE9QSUMsIGZpcmVDb25zdHJ1Y3Rvcik7XG5cdCAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNiUGF5bG9hZCxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2Vzc1xuXHQgICAgICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAvLyBzZXQgZGVmYXVsdHM6XG5cdCAgICAgICAgICAgIGlmIChvcHRpb25zLndhaXRGb3JQYWdlTG9hZCA9PT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICBvcHRpb25zLndhaXRGb3JQYWdlTG9hZCA9IGZhbHNlO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGlmIChvcHRpb25zLmF1dG9TaG93ID09PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgIG9wdGlvbnMuYXV0b1Nob3cgPSB0cnVlO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICgwLCB3YXJuaW5nc18xLmhhbmRsZURlcHJlY2F0ZWRXYXJuaW5ncykob3B0aW9ucyk7XG5cdCAgICAgICAgICAgIGNvbnN0IHdpbmRvd0NyZWF0aW9uID0gdGhpcy53aXJlLmVudmlyb25tZW50LmNyZWF0ZUNoaWxkQ29udGVudCh7IGVudGl0eVR5cGU6ICd3aW5kb3cnLCBvcHRpb25zIH0pO1xuXHQgICAgICAgICAgICBQcm9taXNlLmFsbChbcGFnZVJlc3BvbnNlLCB3aW5kb3dDcmVhdGlvbl0pXG5cdCAgICAgICAgICAgICAgICAudGhlbigocmVzb2x2ZWRBcnIpID0+IHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IHBhZ2VSZXNvbHZlID0gcmVzb2x2ZWRBcnJbMF07XG5cdCAgICAgICAgICAgICAgICBpZiAocGFnZVJlc29sdmUuc3VjY2Vzcykge1xuXHQgICAgICAgICAgICAgICAgICAgIHJlc29sdmUodGhpcyk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgICAgICAgICByZWplY3QocGFnZVJlc29sdmUpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIGlzIHRvIGVuZm9yY2UgYSA1LjAgY29udHJhY3QgdGhhdCB0aGUgY2hpbGQncyBtYWluIGZ1bmN0aW9uXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gd2lsbCBub3QgZmlyZSBiZWZvcmUgdGhlIHBhcmVudCdzIHN1Y2Nlc3MgY2FsbGJhY2sgb24gY3JlYXRpb24uXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gaWYgdGhlIGNoaWxkIHdpbmRvdyBpcyBub3QgYWNjZXNzaWJsZSAoQ09SUykgdGhpcyBjb250cmFjdCBkb2VzXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gbm90IGhvbGQuXG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3Qgd2ViV2luZG93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dmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5ibHVyLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLmJsdXIoKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBibHVyV2luZG93KCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnQmx1cmVkIFdpbmRvdycpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYmx1cigpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2JsdXItd2luZG93JywgdGhpcy5pZGVudGl0eSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBCcmluZ3MgdGhlIHdpbmRvdyB0byB0aGUgZnJvbnQgb2YgdGhlIHdpbmRvdyBzdGFjay5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIEJyaW5nV2luZG93VG9Gcm9udCgpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmJyaW5nVG9Gcm9udC5odG1sJyxcblx0ICAgICAqIC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C43LFxuXHQgICAgICogICAgICAgICAgICAgZHVyYXRpb246IDUwMFxuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICBwb3NpdGlvbjoge1xuXHQgICAgICogICAgICAgICAgICAgdG9wOiAxMDAsXG5cdCAgICAgKiAgICAgICAgICAgICBsZWZ0OiAxMDAsXG5cdCAgICAgKiAgICAgICAgICAgICBkdXJhdGlvbjogNTAwLFxuXHQgICAgICogICAgICAgICAgICAgcmVsYXRpdmU6IHRydWVcblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIH07XG5cdCAgICAgKiAgICAgY29uc3Qgb3B0aW9ucyA9IHtcblx0ICAgICAqICAgICAgICAgaW50ZXJydXB0OiB0cnVlLFxuXHQgICAgICogICAgICAgICB0d2VlbjogJ2Vhc2UtaW4nXG5cdCAgICAgKiAgICAgfTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgKiAgICAgcmV0dXJuIHdpbi5hbmltYXRlKHRyYW5zaXRpb25zLCBvcHRpb25zKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBhbmltYXRlV2luZG93KClcblx0ICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnQW5pbWF0aW9uIGRvbmUnKSlcblx0ICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUuZXJyb3IoZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYW5pbWF0ZSh0cmFuc2l0aW9ucywgb3B0aW9ucykge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmVcblx0ICAgICAgICAgICAgLnNlbmRBY3Rpb24oJ2FuaW1hdGUtd2luZG93Jywge1xuXHQgICAgICAgICAgICB0cmFuc2l0aW9ucyxcblx0ICAgICAgICAgICAgb3B0aW9ucyxcblx0ICAgICAgICAgICAgLi4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hcChsYXlvdXRJZGVudGl0eSA/PyB0aGlzLmlkZW50aXR5KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogR2V0cyB0aGUgY3VycmVudCBzZXR0aW5ncyBvZiB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gZ2V0V2luZG93T3B0aW9ucygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldE9wdGlvbnMuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uZ2V0T3B0aW9ucygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGdldFdpbmRvd09wdGlvbnMoKS50aGVuKG9wdHMgPT4gY29uc29sZS5sb2cob3B0cykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRPcHRpb25zKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXdpbmRvdy1vcHRpb25zJywgdGhpcy5pZGVudGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB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x0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShuZXcgYXBwbGljYXRpb25fMS5BcHBsaWNhdGlvbih0aGlzLndpcmUsIHRoaXMuaWRlbnRpdHkpKTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogR2V0cyB0aGUgcGFyZW50IHdpbmRvdy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFBhcmVudFdpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldFBhcmVudFdpbmRvdy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHdpbi5nZXRQYXJlbnRXaW5kb3coKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBnZXRQYXJlbnRXaW5kb3coKS50aGVuKHBhcmVudFdpbmRvdyA9PiBjb25zb2xlLmxvZyhwYXJlbnRXaW5kb3cpKS5jYXRjaChlcnIgPT4gY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b2xpY3kpIHBvbGljeSByZXF1aXJlbWVudHMuXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIEluamVjdGluZyBjb250ZW50IGludG8gYW4gZW1wdHkgd2luZG93OlxuXHQgICAgICpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAoYXN5bmMgKCk9PiB7XG5cdCAgICAgKiAgICAgdHJ5IHtcblx0ICAgICAqICAgICAgICAgY29uc3Qgd2luTmFtZSA9IGBjaGlsZC13aW5kb3ctJHtEYXRlLm5vdygpfWA7XG5cdCAgICAgKiAgICAgICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuY3JlYXRlKHtcblx0ICAgICAqICAgICAgICAgICAgIG5hbWU6IHdpbk5hbWUsXG5cdCAgICAgKiAgICAgICAgICAgICB1cmw6ICdhYm91dDpibGFuaydcblx0ICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgIHdpbi5nZXRXZWJXaW5kb3coKS5kb2N1bWVudC53cml0ZSgnPGgxPkhlbGxvIFdvcmxkPC9oMT4nKTtcblx0ICAgICAqICAgICB9IGNhdGNoIChlcnIpIHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5lcnJvcihlcnIpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pKCk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqXG5cdCAgICAgKiBDbG9uaW5nIERPTSBlbGVtZW50cyBmcm9tIHRoZSBwYXJlbnQgd2luZG93IChpbiB0aGlzIGV4YW1wbGUgd2UgY2xvbmUgYW4gYGgzYCBlbGVtZW50IGZyb20gdGhlIHBhcmVudCB3aW5kb3cpOlxuXHQgICAgICogYGBganNcblx0ICAgICAqIChhc3luYyAoKT0+IHtcblx0ICAgICAqICAgICB0cnkge1xuXHQgICAgICogICAgICAgICBjb25zdCBjdXJyZW50V2luZG93ID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICA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2FpdCBmaW4uV2luZG93LmNyZWF0ZSh7XG5cdCAgICAgKiAgICAgICAgICAgICBuYW1lOiBgY2hpbGQtd2luZG93LSR7RGF0ZS5ub3coKX1gLFxuXHQgICAgICogICAgICAgICAgICAgdXJsOiAnYWJvdXQ6YmxhbmsnXG5cdCAgICAgKiAgICAgICAgIH0pO1xuXHQgICAgICogICAgICAgICBjb25zdCB0ZW1wbGF0ZSA9IGh0bWxgXG5cdCAgICAgKiAgICAgICAgICAgICA8ZGl2PlxuXHQgICAgICogICAgICAgICAgICAgICAgIDxzcGFuPkNsaWNrIGhlcmU6IDwvc3Bhbj5cblx0ICAgICAqICAgICAgICAgICAgICAgICA8YnV0dG9uIEBjbGljaz0keygpPT4gY29uc29sZS5sb2coJ0hlbGxvIFdvcmxkIScpfT5sb2cgdG8gdGhlIGNvbnNvbGU8L2J1dHRvbj5cblx0ICAgICAqICAgICAgICAgICAgIDwvZGl2PmA7XG5cdCAgICAgKiAgICAgICAgIHJlbmRlcih0ZW1wbGF0ZSwgd2luLmdldFdlYldpbmRvdygpLmRvY3VtZW50LmJvZHkpO1xuXHQgICAgICpcblx0ICAgICAqICAgICB9IGNhdGNoIChlcnIpIHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5lcnJvcihlcnIpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pKCk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgZ2V0V2ViV2luZG93KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd3aW5kb3ctZ2V0LXdlYi13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICByZXR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Zpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG5cdCAgICAgKiAgICAgICAgIG5hbWU6ICdteUFwcCcsXG5cdCAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG5cdCAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuaXNTaG93aW5nLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLmlzU2hvd2luZygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGlzV2luZG93U2hvd2luZygpLnRoZW4oYm9vbCA9PiBjb25zb2xlLmxvZyhib29sKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGlzU2hvd2luZygpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2lzLXdpbmRvdy1zaG93aW5nJywgdGhpcy5pZGVudGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIE1heGltaXplcyB0aGUgd2luZG93XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBhc3luYyBmdW5jdGlvbiBtYXhXaW5kb3coKSB7XG5cdCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLnN0YXJ0KHtcblx0ICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5tYXhpbWl6ZS5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHdpbi5tYXhpbWl6ZSgpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIG1heFdpbmRvdygpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ01heGltaXplZCB3aW5kb3cnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIG1heGltaXplKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignbWF4aW1pemUtd2luZG93JywgdGhpcy5pZGVudGl0eSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBNaW5pbWl6ZXMgdGhlIHdpbmRvdy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIG1pbldpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm1pbmltaXplKCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogbWluV2luZG93KCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnTWluaW1pemVkIHdpbmRvdycpKS5jYXRja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AqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93Lm1vdmVUby5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIG1vdmVUbyhsZWZ0LCB0b3ApIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm1vdmVUbyhsZWZ0LCB0b3ApXG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogbW92ZVRvKDU4MCwgMzAwKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdNb3ZlZCcpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSlcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBtb3ZlVG8obGVmdCwgdG9wLCBwb3NpdGlvbmluZ09wdGlvbnMpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdtb3ZlLXdpbmRvdycsIHtcblx0ICAgICAgICAgICAgbGVmdCxcblx0ICAgICAgICAgICAgdG9wLFxuXHQgICAgICAgICAgICBwb3NpdGlvbmluZ09wdGlvbnMsXG5cdCAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHlcblx0ICAgICAgICB9KV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VkIHRvIGZvciBhcHBsaWNhdGlvbuKAmXMgbWFpbiB3aW5kb3dcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LnNob3dBdC5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIHNob3dBdChsZWZ0LCB0b3ApIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLnNob3dBdChsZWZ0LCB0b3ApXG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogc2hvd0F0KDU4MCwgMzAwKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdTaG93aW5nIGF0JykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBzaG93QXQobGVmdCwgdG9wLCBmb3JjZSA9IGZhbHNlKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZVxuXHQgICAgICAgICAgICAuc2VuZEFjdGlvbignc2hvdy1hdC13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xuXHQgICAgICogICAgIHsgdHlwZTogJ3NlcGFyYXRvcicgfSxcblx0ICAgICAqICAgICB7XG5cdCAgICAgKiAgICAgICAgIGxhYmVsOiAnTWVudSBJdGVtIDInLFxuXHQgICAgICogICAgICAgICB0eXBlOiAnY2hlY2tib3gnLFxuXHQgICAgICogICAgICAgICBjaGVja2VkOiB0cnVlLFxuXHQgICAgICogICAgICAgICBkYXRhOiAnVGhlIHVzZXIgY2xpY2tlZCB0aGUgY2hlY2tib3gnXG5cdCAgICAgKiAgICAgfSxcblx0ICAgICAqICAgICB7XG5cdCAgICAgKiAgICAgICAgIGxhYmVsOiAnc2VlIG1vcmUnLFxuXHQgICAgICogICAgICAgICBlbmFibGVkOiBmYWxzZSxcblx0ICAgICAqICAgICAgICAgc3VibWVudTogW1xuXHQgICAgICogICAgICAgICAgICAgeyBsYWJlbDogJ3N1Ym1lbnUgMScsIGRhdGE6ICdoZWxsbyBmcm9tIHN1Ym1lbnUnIH1cblx0ICAgICAqICAgICAgICAgXVxuXHQgICAgICogICAgIH1cblx0ICAgICAqIF1cblx0ICAgICAqIGZpbi5tZS5zaG93UG9wdXBNZW51KHsgdGVtcGxhdGUgfSkudGhlbihyID0+IHtcblx0ICAgICAqICAgICBpZiAoci5yZXN1bHQgPT09ICdjbG9zZWQnKSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKCdub3RoaW5nIGhhcHBlbmVkJyk7XG5cdCAgICAgKiAgICAgfSBlbHNlIHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5sb2coci5kYXRhKVxuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pXG5cdCAgICAgKiBgYGBcblx0ICAgICAqXG5cdCAgICAgKiBPdmVycmlkaW5nIHRoZSBidWlsdCBpbiBjb250ZXh0IG1lbnUgKG90ZSB0aGF0IHRoaXMgY2FuIGJlIGRvbmUgcGVyIGVsZW1lbnQgb3IgZG9jdW1lbnQgd2lkZSk6XG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignY29udGV4dG1lbnUnLCBlID0+IHtcblx0ICAgICAqICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG5cdCAgICAgKiAgICAgY29uc3QgdGVtcGxhdGUgPSBbXG5cdCAgICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIGxhYmVsOiAnTWVudSBJdGVtIDEnLFxuXHQgICAgICogICAgICAgICAgICAgZGF0YTogJ2hlbGxvIGZyb20gaXRlbSAxJ1xuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICB7IHR5cGU6ICdzZXBhcmF0b3InIH0sXG5cdCAgICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIGxhYmVsOiAnTWVudSBJdGVtIDInLFxuXHQgICAgICogICAgICAgICAgICAgdHlwZTogJ2NoZWNrYm94Jyxcblx0ICAgICAqICAgICAgICAgICAgIGNoZWNrZWQ6IHRydWUsXG5cdCAgICAgKiAgICAgICAgICAgICBkYXRhOiAnVGhlIHVzZXIgY2xpY2tlZCB0aGUgY2hlY2tib3gnXG5cdCAgICAgKiAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIGxhYmVsOiAnc2VlIG1vcmUnLFxuXHQgICAgICogICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsXG5cdCAgICAgKiAgICAgICAgICAgICBzdWJtZW51OiBbXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgeyBsYWJlbDogJ3N1Ym1lbnUgMScsIGRhdGE6ICdoZWxsbyBmcm9tIHN1Ym1lbnUnIH1cblx0ICAgICAqICAgICAgICAgICAgIF1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIF1cblx0ICAgICAqICAgICBmaW4ubWUuc2hvd1BvcHVwTWVudSh7IHRlbXBsYXRlLCB4OiBlLngsIHk6IGUueSB9KS50aGVuKHIgPT4ge1xuXHQgICAgICogICAgICAgICBpZiAoci5yZXN1bHQgPT09ICdjbG9zZWQnKSB7XG5cdCAgICAgKiAgICAgICAgICAgICBjb25zb2xlLmxvZygnbm90aGluZyBoYXBwZW5lZCcpO1xuXHQgICAgICogICAgICAgICB9IGVsc2Uge1xuXHQgICAgICogICAgICAgICAgICAgY29uc29sZS5sb2coci5kYXRhKVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgfSlcblx0ICAgICAqIH0pXG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgc2hvd1BvcHVwTWVudShvcHRpb25zKSB7XG5cdCAgICAgICAgY29uc3QgeyBwYXlsb2FkIH0gPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc2hvdy1wb3B1cC1tZW51JywgeyBvcHRpb25zLCAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIHJldHVybiBwYXlsb2FkLmRhdGE7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIENsb3NlcyB0aGUgd2luZG93J3MgcG9wdXAgbWVudSwgaWYgb25lIGV4aXN0cy5cblx0ICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAqXG5cdCAgICAgKiBAcmVtYXJrcyBPbmx5IG9uZSBwb3B1cCBtZW51IHdpbGwgZXZlciBiZSBzaG93aW5nIGF0IGEgdGltZS4gQ2FsbGluZyBgc2hvd1BvcHVwTWVudWAgd2lsbCBhdXRvbWF0aWNhbGx5IGNsb3NlXG5cdCAgICAgKiBhbnkgZXhpc3RpbmcgcG9wdXAgbWVudS5cblx0ICAgICAqXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIFRoaXMgY291bGQgYmUgdXNlZCB0byBjbG9zZSBhIHBvcHVwIG1lbnUgaWYgdGhlIHVzZXIncyBtb3VzZSBsZWF2ZXMgYW4gZWxlbWVudCBmb3IgZXhhbXBsZS5cblx0ICAgICAqXG5c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c3RydWN0b3Iod2lyZSkge1xuICAgICAgICBzdXBlcih3aXJlLCAnc3lzdGVtJyk7XG4gICAgfVxuICAgIHNlbmRFeHRlcm5hbFByb2Nlc3NSZXF1ZXN0KGFjdGlvbiwgb3B0aW9ucykge1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgZXhpdEV2ZW50S2V5ID0gJ2V4dGVybmFsLXByb2Nlc3MtZXhpdGVkJztcbiAgICAgICAgICAgIGxldCBwcm9jZXNzVXVpZDtcbiAgICAgICAgICAgIGxldCBleGl0UGF5bG9hZDtcbiAgICAgICAgICAgIGxldCBleHRlcm5hbFByb2Nlc3NFeGl0SGFuZGxlcjtcbiAgICAgICAgICAgIGxldCBvZldpbmRvdztcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygb3B0aW9ucy5saXN0ZW5lciA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGF0YSA9IHBheWxvYWQgfHwge307XG4gICAgICAgICAgICAgICAgICAgIGV4aXRQYXlsb2FkID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdG9waWM6ICdleGl0ZWQnLFxuICAgICAgICAgICAgICAgICAgICAgICAgdXVpZDogZGF0YS5wcm9jZXNzVXVpZCB8fCAnJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4aXRDb2RlOiBkYXRhLmV4aXRDb2RlIHx8IDBcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3NVdWlkID09PSBwYXlsb2FkLnByb2Nlc3NVdWlkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmxpc3RlbmVyKGV4aXRQYXlsb2FkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9mV2luZG93LnJlbW92ZUxpc3RlbmVyKGV4aXRFdmVudEtleSwgZXh0ZXJuYWxQcm9jZXNzRXhpdEhhbmRsZXIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAvLyB3aW5kb3cgY29uc3RydWN0b3IgZXhwZWN0cyB0aGUgbmFtZSBpcyBub3QgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLndpcmUubWUubmFtZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLndpcmUubWUubmFtZSA9IHRoaXMud2lyZS5tZS51dWlkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBvZldpbmRvdyA9IG5ldyB3aW5kb3dfMS5fV2luZG93KHRoaXMud2lyZSwgdGhpcy53aXJlLm1lKTtcbiAgICAgICAgICAgICAgICBvZldpbmRvdy5vbihleGl0RXZlbnRLZXksIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMud2lyZVxuICAgICAgICAgICAgICAgIC5zZW5kQWN0aW9uKGFjdGlvbiwgb3B0aW9ucylcbiAgICAgICAgICAgICAgICAudGhlbigoeyBwYXlsb2FkIH0pID0+IHtcbiAgICAgICAgICAgICAgICBwcm9jZXNzVXVpZCA9IHBheWxvYWQuZGF0YS51dWlkO1xuICAgICAgICAgICAgICAgIHJlc29sdmUocGF5bG9hZC5kYXRhKTtcbiAgICAgICAgICAgICAgICBpZiAoZXhpdFBheWxvYWQgJiYgcHJvY2Vzc1V1aWQgPT09IGV4aXRQYXlsb2FkLnV1aWQpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5saXN0ZW5lcihleGl0UGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgICAgIG9mV2luZG93LnJlbW92ZUxpc3RlbmVyKGV4aXRFdmVudEtleSw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xcbiAgICAgKi9cbiAgICBhc3luYyBnZXRBbGxQcm9jZXNzSW5mbygpIHtcbiAgICAgICAgY29uc3QgeyBwYXlsb2FkOiB7IGRhdGEgfSB9ID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1hbGwtcHJvY2Vzcy1pbmZvJywgdGhpcy5pZGVudGl0eSk7XG4gICAgICAgIHJldHVybiBkYXRhO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXRyaWV2ZXMgdGhlIFByb3h5IHNldHRpbmdzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGZpbi5TeXN0ZW0uZ2V0UHJveHlTZXR0aW5ncygpLnRoZW4oUHJveHlTZXR0aW5nID0+IGNvbnNvbGUubG9nKFByb3h5U2V0dGluZykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcbiAgICAgKlxuICAgICAqIC8vVGhpcyByZXNwb25zZSBoYXMgdGhlIGZvbGxvd2luZyBzaGFwZTpcbiAgICAgKiB7XG4gICAgICogICAgIGNvbmZpZzoge1xuICAgICAqICAgICAgICAgcHJveHlBZGRyZXNzOiBcInByb3h5QWRkcmVzc1wiLCAvL3RoZSBjb25maWd1cmVkIFByb3h5IEFkZHJlc3NcbiAgICAgKiAgICAgICAgIHByb3h5UG9ydDogMCwgLy90aGUgY29uZmlndXJlZCBQcm94eSBwb3J0XG4gICAgICogICAgICAgICB0eXBlOiBcInN5c3RlbVwiIC8vUHJveHkgVHlwZVxuICAgICAqICAgICB9LFxuICAgICAqICAgICBzeXN0ZW06IHtcbiAgICAgKiAgICAgICAgIGF1dG9Db25maWdVcmw6IFwiXCIsXG4gICAgICogICAgICAgICBieXBhc3M6IFwiXCIsXG4gICAgICogICAgICAgICBlbmFibGVkOiBmYWxzZSxcbiAgICAgKiAgICAgICAgIHByb3h5OiBcIlwiXG4gICAgICogICAgIH1cbiAgICAgKiB9XG4gICAgICogYGB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y93aWxsIGRlZmF1bHQgdG8gdGhlIG9uZSBtZW50aW9uZWQgYnkgYXBwQXNzZXRzLnRhcmdldFxuICAgICAqICAgICAvL0lmIHRoZSB0aGUgcGF0aCBiZWxvdyByZWZlcnMgdG8gYSBzcGVjaWZpYyBwYXRoIGl0IHdpbGwgb3ZlcnJpZGUgdGhpcyBkZWZhdWx0XG4gICAgICogICAgIGFsaWFzOiAnbXlBcHAnLFxuICAgICAqICAgICBsaXN0ZW5lcjogKHJlc3VsdCkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ3RoZSBleGl0IGNvZGUnLCByZXN1bHQuZXhpdENvZGUpO1xuICAgICAqICAgICB9XG4gICAgICogfSkudGhlbihwcm9jZXNzSWRlbnRpdHkgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhwcm9jZXNzSWRlbnRpdHkpO1xuICAgICAqIH0pLmNhdGNoKGVycm9yID0+IHtcbiAgICAgKiAgICAgY29uc29sZS5sb2coZXJyb3IpO1xuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogRXhhbXBsZSB1c2luZyBhbiBhbGlhcyBidXQgb3ZlcnJpZGluZyB0aGUgYXJndW1lbnRzOlxuICAgICAqXG4gICAgICogYGBganNvblxuICAgICAqIFwiYXBwQXNzZXRzXCI6IFtcbiAgICAgKiAgICAge1xuICAgICAqICAgICAgICAgXCJzcmNcIjogXCJleGUuemlwXCIsXG4gICAgICogICAgICAgICBcImFsaWFzXCI6IFwibXlBcHBcIixcbiAgICAgKiAgICAgICAgIFwidmVyc2lvblwiOiBcIjQuMTIuOFwiLFxuICAgICAqICAgICAgICAgXCJ0YXJnZXRcIjogXCJteUFwcC5leGVcIixcbiAgICAgKiAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjIGRcIlxuICAgICAqICAgICB9LFxuICAgICAqIF1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogLy8gIElmICdhcmd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ICogd2luLmFkZExpc3RlbmVyKCdmaWxlLWRvd25sb2FkLWNvbXBsZXRlZCcsIChldnQpID0+IHtcbiAgICAgKiAgICAgaWYgKGV2dC5zdGF0ZSA9PT0gJ2NvbXBsZXRlZCcpIHtcbiAgICAgKiAgICAgICAgIGZpbi5TeXN0ZW0ubGF1bmNoRXh0ZXJuYWxQcm9jZXNzKHtcbiAgICAgKiAgICAgICAgICAgICBmaWxlVXVpZDogZXZ0LmZpbGVVdWlkLFxuICAgICAqICAgICAgICAgICAgIGFyZ3VtZW50czogJycsXG4gICAgICogICAgICAgICAgICAgbGlzdGVuZXI6IChyZXN1bHQpID0+IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ3RoZSBleGl0IGNvZGUnLCByZXN1bHQuZXhpdENvZGUpO1xuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH0pLnRoZW4ocHJvY2Vzc0lkZW50aXR5ID0+IHtcbiAgICAgKiAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcm9jZXNzSWRlbnRpdHkpO1xuICAgICAqICAgICAgICAgfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycm9yKTtcbiAgICAgKiAgICAgICAgIH0pO1xuICAgICAqICAgICB9XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBMYXVuY2hpbmcgYXNzZXRzIHNwZWNpZmllZCBpbiB0aGUgYXBwIG1hbmlmZXN0OlxuICAgICAqXG4gICAgICogU2FtcGxlIGFwcEFzc2V0cyBzZWN0aW9uIGluIGFwcC5qc29uXG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJhcHBBc3NldHNcIjogW1xuICAgICAqICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgIFwic3JjXCI6IFwiaHR0cDovL2ZpbGVzYW1wbGVzLmNvbS9leGUuemlwXCIsXG4gICAgICogICAgICAgICAgICAgXCJhbGlhc1wiOiBcIm15QXBwXCIsXG4gICAgICogICAgICAgICAgICAgXCJ2ZXJzaW9uXCI6IFwiNC4xMi44XCIsXG4gICAgICogICAgICAgICAgICAgXCJ0YXJnZXRcIjogXCJteUFwcC5leGVcIixcbiAgICAgKiAgICAgICAgICAgICBcImFyZ3NcIjogXCJhIGIgYyBkXCJcbiAgICAgKiAgICAgICAgIH0sXG4gICAgICogICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgXCJzcmNcIjogXCJodHRwOi8vZXhhbXBsZXMuY29tL2V4ZS56aXBcIixcbiAgICAgKiAgICAgICAgICAgICBcImFsaWFzXCI6IFwibXlBcHAyXCIsXG4gICAgICogICAgICAgICAgICAgXCJ2ZXJzaW9uXCI6IFwiNS4xMi44XCIsXG4gICAgICogICAgICAgICAgICAgXCJ0YXJnZXRcIjogXCJteUFwcDIuZXhlXCIsXG4gICAgICogICAgICAgICAgICAgXCJhcmdzXCI6IFwiYSBiIGNcIlxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICBdXG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBUaGlzIHBlcm1pc3Npb24gYWxsb3dzIGZvciBsYXVuY2hpbmcgb2YgYWxsIGFzc2V0cyBzcGVjaWZpZWQgaW4gdGhlIGFib3ZlIGFwcEFzc2V0cyBzZWN0aW9uLiAoXCJteUFwcFwiIGFuZCBcIm15QXBwMlwiKTpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImFzc2V0c1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBhbGxvd3MgZm9yIGxhdW5jaGluZyBvZiBfb25seV8gdGhlIFwibXlBcHBcIiBhc3NldCBpbiB0aGUgYWJvdmUgYXBwQXNzZXRzIHNlY3Rpb24sIGFzIGRlZmluZWQgaW4gYHNyY1J1bGVzYDpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJhc3NldHNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwic3JjUnVsZXNcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIio6Ly9maWxlc2FtcGxlcy5jb20vKlwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJhbGxvd1wiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCI8YWxsX3VybHM+XCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImJsb2NrXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogTGF1bmNoaW5nIGRvd25sb2FkZWQgZmlsZXM6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiZG93bmxvYWRzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogVGhpcyBwZXJtaXNzaW9uIGFsbG93cyB0byBsYXVuY2ggYWxsIHRoZSBleGVjdXRhYmxlczpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJleGVjdXRhYmxlc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqXG4gICAgICogVGhpcyBwZXJtaXNzaW9uIG9ubHkgYWxsb3dzIGxhdW5jaGluZyBvZiBleGVjdXRhYmxlcyB3aG9zZSBmaWxlIHBhdGhzIG1hdGNoIHRoZSBjb3JyZXNwb25kaW5nIGBwYXRoUnVsZXNgOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImV4ZWN1dGFibGVzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgICAgICBcInBhdGhSdWxlc1wiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiL1dpbmRvd3MvU3lzdGVtMzIvKi5leGVcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwiYWxsb3dcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiKi5leGVcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwiYmxvY2tcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgbGF1bmNoRXh0ZXJuYWxQcm9jZXNzKG9wdGlvbnMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuc2VuZEV4dGVybmFsUHJvY2Vzc1JlcXVlc3QoJ2xhdW5jaC1leHRlcm5hbC1wcm9jZXNzJywgb3B0aW9ucyk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIE1vbml0b3JzIGEgcnVubmluZyBwcm9jZXNzLiBBIHBpZCBmb3IgdGhlIHByb2Nlc3MgbXVzdCBiZSBpbmNsdWRlZCBpbiBvcHRpb25zLlxuICAgICAqIDxicj4gQSB1dWlkIG1heSBiZSBvcHRpb25hbGx5IHByb3ZpZGVkLiBJZiBub3QgcHJvdmlkZWQsIE9wZW5GaW4gd2lsbCBjcmVhdGUgYSB1dWlkIGZvciB0aGUgbmV3IHByb2Nlc3MuXG4gICAgICpcbiAgICAgKiBAcmVtYXJrcyBJZiBhbiB1bnVzZWQgdXVpZCBpcyBwcm92aWRlZCBpbiBvcHRpb25zLCBpdCB3aWxsIGJlIHVzZWQuIElmIG5vIHV1aWQgaXMgcHJvdmlkZWQsIE9wZWZpbkZpbiB3aWxsIGFzc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xXaXRoQnJvd3Nlci5odG1sJylcbiAgICAgKiAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnT3BlbmVkIFVSTCcpKVxuICAgICAqIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGFtcGxlIG9mIHBlcm1pc3Npb24gZGVmaW5pdGlvbiB0byBlbmFibGUgbm9uLWRlZmF1bHQgcHJvdG9jb2xzOlxuICAgICAqXG4gICAgICogTm90ZTogcGVybWlzc2lvbiBkZWZpbml0aW9uIHNob3VsZCBiZSBzcGVjaWZpZWQgaW4gYW4gYXBwIG1hbmlmZXN0IGZpbGUgaWYgdGhlcmUgaXMgbm8gRE9TIHNldHRpbmdzLlxuICAgICAqIE90aGVyd2lzZSBpdCBoYXMgdG8gYmUgc3BlY2lmaWVkIGluIGJvdGggRE9TIGFuZCBhcHAgbWFuaWZlc3QgZmlsZXMuXG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJvcGVuVXJsV2l0aEJyb3dzZXJcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJwcm90b2NvbHNcIjogWyBcIm1zdGVhbXNcIiwgXCJzbGFja1wiXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgb3BlblVybFdpdGhCcm93c2VyKHVybCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ29wZW4tdXJsLXdpdGgtYnJvd3NlcicsIHsgdXJsIH0pLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcbiAgICB9XG4gICAgLyoqXG4g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PSAocHJvZ3Jlc3MpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHAgPSB7XG4gICAgICAgICAgICAgICAgZG93bmxvYWRlZEJ5dGVzOiBwcm9ncmVzcy5kb3dubG9hZGVkQnl0ZXMsXG4gICAgICAgICAgICAgICAgdG90YWxCeXRlczogcHJvZ3Jlc3MudG90YWxCeXRlc1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHByb2dyZXNzTGlzdGVuZXIocCk7XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGNsZWFuTGlzdGVuZXJzID0gKCkgPT4ge1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLnJlbW92ZUxpc3RlbmVyKGRsUHJvZ3Jlc3NLZXksIGRsUHJvZ3Jlc3MpO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBkbEVycm9yID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgIGNsZWFuTGlzdGVuZXJzKCk7XG4gICAgICAgICAgICBjb25zdCB7IHJlYXNvbiwgZXJyOiBlcnJvciB9ID0gcGF5bG9hZDtcbiAgICAgICAgICAgIHJlamVjdChuZXcgdHJhbnNwb3J0X2Vycm9yc18xJDEuUnVudGltZUVycm9yKHsgcmVhc29uLCBlcnJvciB9LCBjYWxsU2l0ZSkpO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBkbENvbXBsZXRlID0gKCkgPT4ge1xuICAgICAgICAgICAgY2xlYW5MaXN0ZW5lcnMoKTtcbiAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgfTtcbiAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwoW1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLm9uKG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ICAgICAgICAvLyBub2RlLmpzIGVudmlyb25tZW50IG5vdCBzdXBwb3J0ZWRcbiAgICAgICAgICAgIGlmICh0aGlzLndpcmUuZW52aXJvbm1lbnQuY29uc3RydWN0b3IubmFtZSA9PT0gJ05vZGVFbnZpcm9ubWVudCcpIHtcbiAgICAgICAgICAgICAgICByZWplY3QobmV3IHRyYW5zcG9ydF9lcnJvcnNfMSQxLk5vdFN1cHBvcnRlZEVycm9yKCdkb3dubG9hZFJ1bnRpbWUgb25seSBzdXBwb3J0ZWQgaW4gYW4gT3BlbkZpbiBSZW5kZXIgcHJvY2VzcycpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBkb3dubG9hZElkID0gdGhpcy53aXJlLmVudmlyb25tZW50LmdldE5leHRNZXNzYWdlSWQoKS50b1N0cmluZygpO1xuICAgICAgICAgICAgY29uc3QgZGxQcm9ncmVzc0tleSA9IGBydW50aW1lLWRvd25sb2FkLXByb2dyZXNzLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICAgICAgY29uc3QgZGxFcnJvcktleSA9IGBydW50aW1lLWRvd25sb2FkLWVycm9yLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICAgICAgY29uc3QgZGxDb21wbGV0ZUtleSA9IGBydW50aW1lLWRvd25sb2FkLWNvbXBsZXRlLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICAgICAgY29uc3QgZGxQcm9ncmVzcyA9IChwcm9ncmVzcykgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25sb2FkZWRCeXRlczogcHJvZ3Jlc3MuZG93bmxvYWRlZEJ5dGVzLFxuICAgICAgICAgICAgICAgICAgICB0b3RhbEJ5dGVzOiBwcm9ncmVzcy50b3RhbEJ5dGVzXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBwcm9ncmVzc0xpc3RlbmVyKHApO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IGNsZWFuTGlzdGVuZXJzID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUxpc3RlbmVyKGRsUHJvZ3Jlc3NLZXksIGRsUHJvZ3Jlc3MpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IGRsRXJyb3IgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgIGNsZWFuTGlzdGVuZXJzKCk7XG4gICAgICAgICAgICAgICAgY29uc3QgeyByZWFzb24sIGVycjogZXJyb3IgfSA9IHBheWxvYWQ7XG4gICAgICAgICAgICAgICAgcmVqZWN0KG5ldyB0cmFuc3BvcnRfZXJyb3JzXzEkMS5SdW50aW1lRXJyb3IoeyByZWFzb24sIGVycm9yIH0sIGNhbGxzaXRlcykpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNvbnN0IGRsQ29tcGxldGUgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgY2xlYW5MaXN0ZW5lcnMoKTtcbiAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLm9uKGRsUHJvZ3Jlc3NLZXksIGRsUHJvZ3Jlc3MpO1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLm9uY2UoZGxFcnJvcktleSwgZGxFcnJvcik7XG4gICAgICAgICAgICAvLyBUT0RPOiBmaXggaW50ZXJuYWwgdHlwZXNcbiAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgIHRoaXMub25jZShkbENvbXBsZXRlS2V5LCBkbENvbXBsZXRlKTtcbiAgICAgICAgICAgIGNvbnN0IGRvd25sb2FkT3B0aW9ucyA9IE9iamVjdC5hc3NpZ24ob3B0aW9ucywgeyBkb3dubG9hZElkIH0pO1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2Rvd25sb2FkLXJ1bnRpbWUnLCBkb3dubG9hZE9wdGlvbnMpLmNhdGNoKChlcnIpID0+IHtcbiAgICAgICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1xuICAgICAgICAgICAgICAgIHJlamVjdChlcnIpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBEb3dubG9hZCBwcmVsb2FkIHNjcmlwdHMgZnJvbSBnaXZlbiBVUkxzXG4gICAgICogQHBhcmFtIHNjcmlwdHMgLSBVUkxzIG9mIHByZWxvYWQgc2NyaXB0cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBzY3JpcHRzID0gW1xuICAgICAqICAgICB7IHVybDogJ2h0dHA6Ly8uLi4vcHJlbG9hZC5qcycgfSxcbiAgICAgKiAgICAgeyB1cmw6ICdodHRwOi8vLi4uL3ByZWxvYWQyLmpzJyB9XG4gICAgICogXTtcbiAgICAgKlxuICAgICAqIGZpbi5TeXN0ZW0uZG93bmxvYWRQcmVsb2FkU2NyaXB0cyhzY3JpcHRzKS50aGVuKHJlc3VsdHMgPT4ge1xuICAgICAqICAgICByZXN1bHRzLmZvckVhY2goKHt1cmwsIHN1Y2Nlc3MsIGVycm9yfSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHt1cmx9YCk7XG4gICAgICogICAgICAgICBjb25zb2x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UFDSElORVwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfRFdPUkRcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfUVdPUkRcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IDEzMTA4MTQ2NjcxMzM0MTEyLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfTE9DQUxfTUFDSElORVwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfUVdPUkRcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfU1pcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IFwiRm9vQmFyQmF6XCIsXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9MT0NBTF9NQUNISU5FXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19TWlwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19FWFBBTkRfU1pcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IFwiQzpcXFVzZXJcXEpvaG5Eb2VcXEFwcERhdGFcXExvY2FsXCIsXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9DVVJSRU5UX1VTRVJcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX0VYUEFORF9TWlwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19NVUxUSV9TWlxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogW1xuICAgICAqICAgICAgICAgXCJGb29cIixcbiAgICAgKiAgICAgICAgIFwiQmFyXCIsXG4gICAgICogICAgICAgICBcIkJhelwiXG4gICAgICogICAgIF0sXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9DVVJSRU5UX1VTRVJcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX01VTFRJX1NaXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX0JJTkFSWVxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YToge1xuICAgICAqICAgICAgICAgZGF0YTogW1xuICAgICAqICAgICAgICAgICAgIDI1NSxcbiAgICAgKiAgICAgICAgICAgICAyNTUsXG4gICAgICogICAgICAgICAgICAgMCxcbiAgICAgKiAgICAgICAgICAgICA0MyxcbiAgICAgKiAgICAgICAgICAgICA1NSxcbiAgICAgKiAgICAgICAgICAgICAwLFxuICAgICAqICAgICAgICAgICAgIDAsXG4gICAgICogICAgICAgICAgICAgMjU1LFxuICAgICAqICAgICAgICAgICAgIDI1NVxuICAgICAqICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgIHR5cGU6IFwiQnVmZmVyXCJcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0NVUlJFTlRfVVNFUlwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfQklOQVJZXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIHJlYWRSZWdpc3RyeVZhbHVlKHJvb3RLZXksIHN1YmtleSwgdmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMud2lyZVxuICAgICAgICAgICAgLnNlb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vIGRvbid0IGV4cG9zZSwgYW5hbHl0aWNzLW9ubHkgY2FsbFxuICAgICAgICB9KTtcbiAgICAgICAgY29uc3QgU3lzdGVtU2h1dGRvd25FdmVudE5hbWUgPSAnc3lzdGVtLXNodXRkb3duJztcbiAgICAgICAgY29uc3QgU3lzdGVtU2h1dGRvd25IYW5kbGVkRXZlbnROYW1lID0gJ3N5c3RlbS1zaHV0ZG93bi1oYW5kbGVkJztcbiAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lIH0gPSB0aGlzLndpcmUubWU7XG4gICAgICAgIGNvbnN0IHNodXRkb3duSGFuZGxlciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBwcm9jZWVkID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIG5vdGlmeSBjb3JlIHRoYXQgdGhlIGFwcCBpcyByZWFkeSBmb3Igc2h1dGRvd25cbiAgICAgICAgICAgICAgICB0aGlzLndpcmUuZW52aXJvbm1lbnQucmFpc2VFdmVudChgYXBwbGljYXRpb24vJHtTeXN0ZW1TaHV0ZG93bkhhbmRsZWRFdmVudE5hbWV9YCwge1xuICAgICAgICAgICAgICAgICAgICB1dWlkLFxuICAgICAgICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICAgICAgICB0b3BpYzogJ2FwcGxpY2F0aW9uJ1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGhhbmRsZXIoeyBwcm9jZWVkIH0pO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLm9uKFN5c3RlbVNodXRkb3duRXZlbnROYW1lLCBzaHV0ZG93bkhhbmRsZXIpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTaWduYWxzIHRoZSBSVk0gdG8gcGVyZm9ybSBhIGhlYWx0aCBjaGVjayBhbmQgcmV0dXJucyB0aGUgcmVzdWx0cyBhcyBqc29uLlxuICAgICAqXG4gICAgICogQHJlbWFya3MgUmVxd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BsZSBhcGkgY2FsbHMgZ2V0dGluZyBkdXBsaWNhdGVkIGV2ZW50c1xuICAgICAgICAgICAgY29uc3QgaWQgPSB0aGlzLndpcmUuZW52aXJvbm1lbnQuZ2V0TmV4dE1lc3NhZ2VJZCgpLnRvU3RyaW5nKCk7XG4gICAgICAgICAgICBzZW5kT3B0cy5hcHBWZXJzaW9uSWQgPSBpZDtcbiAgICAgICAgICAgIGNvbnN0IHN1cHBvcnRlZEV2ZW50cyA9IFtcbiAgICAgICAgICAgICAgICBBcHBWZXJzaW9uQ29tcGxldGVFdmVudE5hbWUsXG4gICAgICAgICAgICAgICAgQXBwVmVyc2lvblByb2dyZXNzRXZlbnROYW1lLFxuICAgICAgICAgICAgICAgIFJ1bnRpbWVTdGF0dXNFdmVudE5hbWUsXG4gICAgICAgICAgICAgICAgQXBwVmVyc2lvbkVycm9yRXZlbnROYW1lXG4gICAgICAgICAgICBdO1xuICAgICAgICAgICAgY29uc3QgY2xlYW5FdmVudFBheWxvYWQgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gZG8gdHlwZSBjYXN0aW5ncyBiZWxvdyB0byBtYWtlIHN1cmUgdGhlIHJldHVybiB0eXBlIGlzIGNvcnJlY3QuXG4gICAgICAgICAgICAgICAgY29uc3QgeyBhcHBWZXJzaW9uSWQsIHRvcGljLCB0eXBlOiB0eXBlV2l0aElkLCAuLi5yZXN0IH0gPSBwYXlsb2FkO1xuICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBzdXBwb3J0ZWRFdmVudHMuZmluZCgoeCkgPT4gdHlwZVdpdGhJZC5pbmNsdWRlcyh4KSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgLi4ucmVzdCxcbiAgICAgICAgICAgICAgICAgICAgdHlwZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29uc3QgYXBwVmV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mVyc2lvbjogJzEuMCcsXG4gICAgICogICAgICAgICAgICAgYWxsb3dlZDogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICByZWplY3Rpb25Db2RlOiAnJ1xuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9KTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiByZWdpc3RlclVzYWdlKCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnU3VjY2Vzc2Z1bGx5IHJlZ2lzdGVyZWQgY29tcG9uZW50IGFwcGxpY2F0aW9uJykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyByZWdpc3RlclVzYWdlKHsgZGF0YSwgdHlwZSB9KSB7XG4gICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdyZWdpc3Rlci11c2FnZScsIHsgZGF0YSwgdHlwZSB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhbiBhcnJheSB3aXRoIGFsbCBwcmludGVycyBvZiB0aGUgY2FsbGVyIGFuZCBub3QgYWxsIHRoZSBwcmludGVycyBvbiB0aGUgZGVza3RvcC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldFByaW50ZXJzKClcbiAgICAgKiAgICAgLnRoZW4oKHByaW50ZXJzKSA9PiB7XG4gICAgICogICAgICAgICBwcmludGVycy5mb3JFYWNoKChwcmludGVyKSA9PiB7XG4gICAgICogICAgICAgICAgICAgaWYgKHByaW50ZXIuaXNEZWZhdWx0KSB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByaW50ZXIpO1xuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH0pO1xuICAgICAqICAgICB9KVxuICAgICAqICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAqICAgICAgICA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uICAgICAqICAgICB9XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgdXBkYXRlUHJvY2Vzc0xvZ2dpbmdPcHRpb25zKG9wdGlvbnMpIHtcbiAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3N5c3RlbS11cGRhdGUtcHJvY2Vzcy1sb2dnaW5nLW9wdGlvbnMnLCB7IG9wdGlvbnMgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgZG9tYWluIHNldHRpbmdzIGZvciB0aGUgY3VycmVudCBhcHBsaWNhdGlvbi5cbiAgICAgKiBJbml0aWFsIHNldHRpbmdzIGFyZSBjb25maWd1cmVkIHdpdGggdGhlIGRlZmF1bHREb21haW5TZXR0aW5ncyBhcHBsaWNhdGlvbiBvcHRpb24gdmlhIG1hbmlmZXN0LlxuICAgICAqIERvbWFpbiBzZXR0aW5ncyBjYW4gYmUgb3ZlcndyaXR0ZW4gZHVyaW5nIHJ1bnRpbWUgd2l0aCBTeXN0ZW0uc2V0RG9tYWluU2V0dGluZ3MuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IGRvbWFpblNldHRpbmdzID0gYXdhaXQgZmluLlN5c3RlbS5nZXREb21haW5TZXR0aW5ncygpO1xuICAgICAqIC8vIHtcbiAgICAgKiAvLyAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiaHR0cHM6Ly9vcGVuZmluLmNvXCJcbiAgICAgKiAvLyAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgIFwib3B0aW9uc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiZG93bmxvYWRTZXR0aW5nc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCI8YWxsX3VybHM+XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcInByb21wdFwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqIC8vICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgfVxuICAgICAqIC8vICAgICBdXG4gICAgICogLy8gfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldERvbWFpblNldHRpbmdzKCkge1xuICAgICAgICBjb25zdCB7IHBheWxvYWQ6IHsgZGF0YSB9IH0gPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWRvbWFpbi1zZXR0aW5ncycsIHRoaXMuaWRlbnRpdHkpO1xuICAgICAgICByZXR1cm4gZGF0YTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogU2V0cyB0aGUgZG9tYWluIHNldHRpbmdzIGZvciB0aGUgY3VycmVudCBhcHBsaWNhdGlvbi5cbiAgICAgKiBAcGFyYW0gZG9tYWluU2V0dGluZ3MgLSBkb21haW4gc2V0dGluZ3Mgb2JqZWN0XG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IGRvbWFpblNldHRpbmdzID0gYXdhaXQgZmluLlN5c3RlbS5nZXREb21haW5TZXR0aW5ncygpO1xuICAgICAqIC8vIHtcbiAgICAgKiAvLyAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiaHR0cHM6Ly9vcGVuZmluLmNvXCJcbiAgICAgKiAvLyAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgIFwib3B0aW9uc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiZG93bmxvYWRTZXR0aW5nc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCI8YWxsX3VybHM+XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcInByb21wdFwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqIC8vICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgfVxuICAgICAqIC8vICAgICBdXG4gICAgICogLy8gfVxuICAgICAqXG4gICAgICogLy8gVmFsaWQgcnVsZSBiZWhhdmlvcnMgYXJlICdwcm9tcHQnIGFuZCAnbm8tcHJvbXB0J1xuICAgICAqIGRvbWFpblNldHRpbmdzLnJ1bGVzWzBdLm9wdGlvbnMuZG93bmxvYWRTZXR0aW5ncy5ydWxlc1swXS5iZWhhdmlvciA9ICduby1wcm9tcHQnO1xuICAgICAqXG4gICAgICogYXdhaXQgZmluLlN5c3RlbS5zZXREb21haW5TZXR0aW5ncyhkb21haW5TZXR0aW5ncyk7XG4gICAgICpcbiAgICAgKiBjb25zdCBuZXdEb21haW5TZXR0aW5ncyA9IGF3YWl0IGZpbi5TeXN0ZW0uZ2V0RG9tYWluU2V0dGluZ3MoKTtcbiAgICAgKiAvLyB7XG4gICAgICogLy8gICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm9wdGlvbnNcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImRvd25sb2FkU2V0dGluZ3NcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJuby1wcm9tcHRcIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgXVxuICAgICAqIC8vIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBzZXREb21haW5TZXR0aW5ncyhkb21haW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ICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIHByb3ZpZGVyLmJlZm9yZUFjdGlvbigoYWN0aW9uLCBwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgLy9UaGUgcGF5bG9hZCBjYW4gYmUgYWx0ZXJlZCBoZXJlIGJlZm9yZSBoYW5kbGluZyB0aGUgYWN0aW9uLlxuICAgICAqICAgICAgICAgcGF5bG9hZC5yZWNlaXZlZCA9IERhdGUubm93KCk7XG4gICAgICogICAgICAgICByZXR1cm4gcGF5bG9hZDtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogQ2hhbm5lbCBDbGllbnQ6XG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY29ubmVjdCgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBjbGllbnQucmVnaXN0ZXIoJ2NsaWVudC1hY3Rpb24nLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHBheWxvYWQsIGlkZW50aXR5KTtcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiAgICAgY2xpZW50LmJlZm9yZUFjdGlvbigoYWN0aW9uLCBwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgLy9UaGUgcGF5bG9hZCBjYW4gYmUgYWx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GVyLnJlZ2lzdGVyKCdwcm92aWRlci1hY3Rpb24nLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHBheWxvYWQpO1xuICAgICAqICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBY3Rpb24gZXJyb3InKTtcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiAgICAgcHJvdmlkZXIub25FcnJvcigoYWN0aW9uLCBlcnJvciwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKCd1bmNhdWdodCBFeGNlcHRpb24gaW4gYWN0aW9uOicsIGFjdGlvbik7XG4gICAgICogICAgICAgICBjb25zb2xlLmVycm9yKGVycm9yKTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogQ2hhbm5lbCBDbGllbnQ6XG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY29ubmVjdCgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBjbGllbnQucmVnaXN0ZXIoJ2NsaWVudC1hY3Rpb24nLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHBheWxvYWQpO1xuICAgICAqICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBY3Rpb24gZXJyb3InKTtcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiAgICAgY2xpZW50Lm9uRXJyb3IoKGFjdGlvbiwgZXJyb3IsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndW5jYXVnaHQgRXhjZXB0aW9uIGluIGFjdGlvbjonLCBhY3Rpb24pO1xuICAgICAqICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvcik7XG4gICAgICogICAgIH0pO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgb25FcnJvcihmdW5jKSB7XG4gICAgICAgIGlmICh0aGlzLmVycm9yTWlkZGxld2FyZSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBbHJlYWR5IHJlZ2lzdGVyZWQgZXJyb3IgbWlkZGxld2FyZScpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuZXJyb3JNaWRkbGV3YXJlID0gZnVuYztcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmVnaXN0ZXIgbWlkZGxld2FyZSB0aGF0IGZpcmVzIGFmdGVyIHRoZSBhY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqXG4gICAgICogQHJlbWFya3MgSWYgdGhlIGFjdGlvbiBkb2VzIG5vdCByZXR1cm4gdGhlIHBheWxvYWQsIHRoZW4gdGhlIGFmdGVyQWN0aW9uIHdpbGwgbm90IGhhdmUgYWNjZXNzIHRvIHRoZSBwYXlsb2FkIG9iamVjdC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBDaGFubmVsIFByb3ZpZGVyOlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBwcm92aWRlciA9IGF3YWl0IGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY3JlYXRlKCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IHByb3ZpZGVyLnJlZ2lzdGVyKCdwcm92aWRlci1hY3Rpb24nLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiAgICAgYXdhaXQgcHJvdmlkZXIuYWZ0ZXJBY3Rpb24oKGFjdGlvbiwgcGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIC8vdGhlIHBheWxvYWQgY2FuIGJlIGFsdGVyZWQgaGVyZSBhZnRlciBoYW5kbGluZyB0aGUgYWN0aW9uIGJ1dCBiZWZvcmUgc2VuZGluZyBhbiBhY2tub3dsZWRnZW1lbnQuXG4gICAgICogICAgICAgICBwYXlsb2FkLnNlbnQgPSBkYXRlLm5vdygpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHBheWxvYWQ7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNvbm5lY3QoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgYXdhaXQgY2xpZW50LnJlZ2lzdGVyKCdjbGllbnQtYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGF3YWl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cbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogQ2hhbm5lbCBDbGllbnQ6XG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY29ubmVjdCgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBjbGllbnQuc2V0RGVmYXVsdEFjdGlvbigoYWN0aW9uLCBwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coYFByb3ZpZGVyIHdpdGggaWRlbnRpdHkgJHtKU09OLnN0cmluZ2lmeShpZGVudGl0eSl9IGhhcyBhdHRlbXB0ZWQgdG8gZGlzcGF0Y2ggdW5yZWdpc3RlcmVkIGFjdGlvbjogJHthY3Rpb259LmApO1xuICAgICAqXG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqL1xuICAgIHNldERlZmF1bHRBY3Rpb24oZnVuYykge1xuICAgICAgICBpZiAodGhpcy5kZWZhdWx0QWN0aW9uKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2RlZmF1bHQgYWN0aW9uIGNhbiBvbmx5IGJlIHNldCBvbmNlJyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmRlZmF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biAgICAgKlxuICAgICAqICAgICAgICByZXR1cm4geyBlY2hvOiBwYXlsb2FkIH07XG4gICAgICogICAgfSk7XG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNvbm5lY3QoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgYXdhaXQgY2xpZW50LnJlZ2lzdGVyKCdjbGllbnQtYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgIGNvbnNvbGUubG9nKCdBY3Rpb24gZGlzcGF0Y2hlZCBieSBjbGllbnQ6ICcsIGlkZW50aXR5KTtcbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ1BheWxvYWQgc2VudCBpbiBkaXNwYXRjaDogJywgcGF5bG9hZCk7XG4gICAgICpcbiAgICAgKiAgICAgICAgcmV0dXJuIHsgZWNobzogcGF5bG9hZCB9O1xuICAgICAqICAgIH0pO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgcmVnaXN0ZXIodG9waWMsIGxpc3RlbmVyKSB7XG4gICAgICAgIGlmICh0aGlzLnN1YnNjcmlwdGlvbnMuaGFzKHRvcGljKSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBTdWJzY3JpcHRpb24gYWxyZWFkeSByZWdpc3RlcmVkIGZvciBhY3Rpb246ICR7dG9waWN9LiBVbnN1YnNjcmliZSBiZWZvcmUgYWRkaW5nIG5ldyBzdWJzY3JpcHRpb25gKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuc3Vic2NyaXB0aW9ucy5zZXQodG9waWM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AgICBpZiAocmVzb2x2ZSAmJiByZWplY3QpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlc3BvbnNlTWFwLmRlbGV0ZShtZXNzYWdlSWQpO1xuICAgICAgICAgICAgICAgIGlmIChzdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUocGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdDb3VsZCBub3QgZmluZCBpZCBpbiByZXNwb25zZU1hcC4nKTtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlcXVlc3QuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGFzeW5jIChlKSA9PiB7XG4gICAgICAgICAgICBsZXQgeyBkYXRhIH0gPSBlO1xuICAgICAgICAgICAgaWYgKGUuZGF0YSBpbnN0YW5jZW9mIEFycmF5QnVmZmVyKSB7XG4gICAgICAgICAgICAgICAgZGF0YSA9IG5ldyBUZXh0RGVjb2RlcigpLmRlY29kZShlLmRhdGEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgeyBtZXNzYWdlSWQsIGFjdGlvbiwgcGF5bG9hZCB9ID0gSlNPTi5wYXJzZShkYXRhKTtcbiAgICAgICAgICAgIGlmIChfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGIodGhpcywgX1JUQ0VuZHBvaW50X3Byb2Nlc3NBY3Rpb24sIFwiZlwiKSkge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcyA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkYih0aGlzLCBfUlRDRW5kcG9pbnRfcHJvY2Vzc0FjdGlvbiwgXCJmXCIpLmNhbGwodGhpcywgYWN0aW9uLCBwYXlsb2FkLCBlbmRwb2ludElkZW50aXR5KTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ydGMuY2hhbm5lbHMucmVzcG9uc2Uuc2VuZChKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXlsb2FkOiByZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIFJUQ0RhdGFDaGFubmVsIGlzIG9wZW4gYmVmb3JlIHNlbmRpbmcsIGVycm9yIGdldHMgc3dhbGxvd2VkIGhlcmUgaW4gdGhlIGNhc2Ugd2hlcmVcbiAgICAgICAgICAgICAgICAgICAgLy8gY2xpZW50IGRpc3BhdGNoZWQgdGhlbiBjbG9zZWQgb3IgZGlzY29ubmVjdGVkIGJlZm9yZSB0aGUgZGlzcGF0Y2ggcmVzb2x2ZXMuXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnJ0Yy5jaGFubmVscy5yZXNwb25zZS5yZWFkeVN0YXRlID09PSAnb3BlbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnNlbmQoSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VJZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogKDAsIGVycm9yc18xJDEuZXJyb3JUb1BPSk8pK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Y2lsaXRhdGVzIE9mZmVyIGFuZCBBbnN3ZXIgZXhjaGFuZ2UgcmVxdWlyZWQgZm9yIGVzdGFibGlzaGluZyBSVEMgY29ubmVjdGlvbnMuXG4qL1xuY2xhc3MgUlRDSUNFTWFuYWdlciBleHRlbmRzIGJhc2VfMSRpLkVtaXR0ZXJCYXNlIHtcbiAgICBjb25zdHJ1Y3Rvcih3aXJlKSB7XG4gICAgICAgIHN1cGVyKHdpcmUsICdjaGFubmVsJyk7XG4gICAgICAgIHRoaXMuZW5zdXJlQ2hhbm5lbE9wZW5lZCA9IChjaGFubmVsKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChjaGFubmVsLnJlYWR5U3RhdGUgPT09ICdvcGVuJykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNoYW5uZWwucmVhZHlTdGF0ZSA9PT0gJ2Nvbm5lY3RpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxpc3RlbmVyID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbC5yZW1vdmVFdmVudExpc3RlbmVyKCdvcGVuJywgbGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBjaGFubmVsLmFkZEV2ZW50TGlzdGVuZXIoJ29wZW4nLCBsaXN0ZW5lcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QobmV3IEVycm9yKCdUaGlzIENoYW5uZWwgaGFzIGFscmVhZHkgY2xvc2VkJykpO1xuICAgICAgICAgICAgICAgIH1cbiAgIC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AgICAqIGNvbnN0IHByb3ZpZGVyID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jcmVhdGUoJ29wZW5maW4nKTtcbiAgICAgKiBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNvbm5lY3QoJ29wZW5maW4nKTtcbiAgICAgKiBjb25zdCBjbGllbnRJbmZvID0gYXdhaXQgcHJvdmlkZXIuZ2V0QWxsQ2xpZW50SW5mbygpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coY2xpZW50SW5mbyk7XG4gICAgICpcbiAgICAgKiAvLyBbXG4gICAgICogLy8gICAge1xuICAgICAqIC8vICAgICAgICBcInV1aWRcIjogXCJvcGVuZmluXCIsXG4gICAgICogLy8gICAgICAgIFwibmFtZVwiOiBcIm9wZW5maW4tdmlld1wiLFxuICAgICAqIC8vICAgICAgICBcImVuZHBvaW50SWRcIjogXCI2ZDRjN2NhOC00YTc0LTQ2MzQtODdmOC03NjA1NTgyMjk2MTNcIixcbiAgICAgKiAvLyAgICAgICAgXCJlbnRpdHlUeXBlXCI6IFwidmlld1wiLFxuICAgICAqIC8vICAgICAgICBcInVybFwiOiBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgfSxcbiAgICAgKiAvLyAgICB7XG4gICAgICogLy8gICAgICAgIFwidXVpZFwiOiBcIm9wZW5maW4yXCIsXG4gICAgICogLy8gICAgICAgIFwibmFtZVwiOiBcIm9wZW5maW4tdmlldzJcIixcbiAgICAgKiAvLyAgICAgICAgXCJlbmRwb2ludElkXCI6IFwiNHo1ZDhhYjktMmI4MS0zNjkxLTkxZXgtMTQyMTc5MzgyNTExXCIsXG4gICAgICogLy8gICAgICAgIFwiZW50aXR5VHlwZVwiOiBcInZpZXdcIixcbiAgICAgKiAvLyAgICAgICAgXCJ1cmxcIjogXCJodHRwczovL2V4YW1wbGUuY29tXCJcbiAg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9jb2xzO1xuICAgICAgICAgICAgaWYgKCFzdXBwb3J0ZWQubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBObyB2YWxpZCBwcm90b2NvbHMgd2VyZSBwYXNzZWQgaW4uIEFjY2VwdGVkIHZhbHVlcyBhcmU6ICR7dGhpcy5Qcm90b2NvbHNJblByZWZlcmVuY2VPcmRlci5qb2luKCcsICcpfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzdXBwb3J0ZWQ7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuZ2V0Q29tcGF0aWJsZVByb3RvY29scyA9IChwcm92aWRlclByb3RvY29scywgY2xpZW50T2ZmZXIpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHN1cHBvcnRlZCA9IGNsaWVudE9mZmVyLnN1cHBvcnRlZFByb3RvY29scy5maWx0ZXIoKGNsaWVudFByb3RvY29sKSA9PiBwcm92aWRlclByb3RvY29scy5zb21lKChwcm92aWRlclByb3RvY29sKSA9PiBwcm92aWRlclByb3RvY29sLnR5cGUgPT09IGNsaWVudFByb3RvY29sLnR5cGUgJiZcbiAgICAgICAgICAgICAgICBjbGllbnRQcm90b2NvbC52ZXJzaW9uID49IHByb3ZpZGVyUHJvdG9jb2wubWluaW11bVZlcnNpb24gJiZcbiAgICAgICAgICAgICAgICBwcm92aWRlclByb3RvY29sLnZlcnNpb24gPj0gKGNsaWVudFByb3RvY29sLm1pbmltdW1WZXJzaW9uID8/IDApKSk7XG4gICAgICAgICAgICByZXR1cm4gc3VwcG9ydGVkLnNsaWNlKDAsIGNsaWVudE9mZmVyLm1heFByb3RvY29scyk7XG4gICAgICAgIH07XG4gICAgfVxufVxucHJvdG9jb2xNYW5hZ2VyLlByb3RvY29sTWFuYWdlciA9IFByb3RvY29sTWFuYWdlcjtcblxudmFyIHN0cmF0ZWd5ID0ge307XG5cbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShzdHJhd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Byb3RvY29sTWFuYWdlci5nZXRDbGllbnRQcm90b2NvbHMob3B0aW9ucz8ucHJvdG9jb2xzKTtcbiAgICAgICAgbGV0IHJ0Y1BhY2tldDtcbiAgICAgICAgY29uc3Qgc3VwcG9ydGVkUHJvdG9jb2xzID0gYXdhaXQgUHJvbWlzZS5hbGwocHJvdG9jb2xzLm1hcChhc3luYyAodHlwZSkgPT4ge1xuICAgICAgICAgICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAncnRjJzoge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB7IHJ0Y0NsaWVudCwgY2hhbm5lbHMsIG9mZmVyLCBydGNDb25uZWN0aW9uSWQsIGNoYW5uZWxzT3BlbmVkIH0gPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDgodGhpcywgX0Nvbm5lY3Rpb25NYW5hZ2VyX3J0Y0Nvbm5lY3Rpb25NYW5hZ2VyLCBcImZcIikuc3RhcnRDbGllbnRPZmZlcigpO1xuICAgICAgICAgICAgICAgICAgICBydGNQYWNrZXQgPSB7IHJ0Y0NsaWVudCwgY2hhbm5lbHMsIGNoYW5uZWxzT3BlbmVkIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAncnRjJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHN0cmF0ZWd5XzIuUlRDSW5mby52ZXJzaW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogeyBvZmZlciwgcnRjQ29ubmVjdGlvbklkIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2FzZSAnY2xhc3NpYyc6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7IHR5cGU6ICdjbGFzc2ljJywgdmVyc2lvbjogc3RyYXRlZ3lfMS5DbGFzc2ljSW5mby52ZXJzaW9uIH07XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgwLCBleGhhdXN0aXZlXzEuZXhoYXVzdGl2ZUNoZWNrKSh0eXBlLCBbJ3J0YycsICdjbGFzc2ljJ10pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KSk7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBvZmZlcjoge1xuICAgICAgICAgICAgICAgIHN1cHBvcnRlZFByb3RvY29scyxcbiAgICAgICAgICAgICAgICBtYXhQcm90b2NvbHM6IDJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBydGM6IHJ0Y1BhY2tldFxuICAgICAgICB9O1xuICAgIH1cbiAgICBhc3luYyBjcmVhdGVDbGllbnRTdHJhdGVneShydGNQYWNrZXQsIHJvdXRpbmdJbmZvKSB7XG4gICAgICAgIGlmICghcm91dGluZ0luZm8uZW5kcG9pbnRJZCkge1xuICAgICAgICAgICAgcm91dGluZ0luZm8uZW5kcG9pbnRJZCA9IHRoaXMud2lyZS5lbnZpcm9ubWVudC5nZXROZXh0TWVzc2FnZUlkKCk7XG4gICAgICAgICAgICAvLyBGb3IgTmV3IENsaWVudHMgY29ubmVjdGluZyB0byBPbGQgUHJvdmlkZXJzLiBUbyBwcmV2ZW50IG11bHRpLWRpc3BhdGNoaW5nIGFuZCBwdWJsaXNoaW5nLCB3ZSBkZWxldGUgcHJldmlvdXNseS1jb25uZWN0ZWRcbiAgICAgICAgICAgIC8vIGNsaWVudHMgdGhhdCBhcmUgaW4gdGhlIHNhbWUgY29udGV4dCBhcyB0aGUgbmV3bHktY29ubmVjdGVkIGNsaWVudC5cbiAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkOCh0aGlzLCBfQ29ubmVjdGlvbk1hbmFnZXJfbWVzc2FnZVJlY2VpdmVyLCBcImZcIikuY2hlY2tGb3JQcmV2aW91c0NsaWVudENvbm5lY3Rpb24ocm91dGluZ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ICAgICAgY29uc3QgeyBhbnN3ZXI6IHJ0Y0Fuc3dlciwgcnRjQ2xpZW50LCBjaGFubmVscyB9ID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQ4KHRoaXMsIF9Db25uZWN0aW9uTWFuYWdlcl9ydGNDb25uZWN0aW9uTWFuYWdlciwgXCJmXCIpLmNyZWF0ZVByb3ZpZGVyQW5zd2VyKHByb3RvY29sVG9Vc2UucGF5bG9hZC5ydGNDb25uZWN0aW9uSWQsIHByb3RvY29sVG9Vc2UucGF5bG9hZC5vZmZlcik7XG4gICAgICAgICAgICAgICAgICAgIGFuc3dlci5zdXBwb3J0ZWRQcm90b2NvbHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAncnRjJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHN0cmF0ZWd5XzIuUlRDSW5mby52ZXJzaW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuc3dlcjogcnRjQW5zd2VyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBhbnN3ZXIuZW5kcG9pbnRQYXlsb2FkUHJvbWlzZSA9IGFuc3dlci5lbmRwb2ludFBheWxvYWRQcm9taXNlLnRoZW4oKGVuZHBvaW50UGF5bG9hZCkgPT4gY2hhbm5lbHMudGhlbigocmVzb2x2ZWRDaGFubmVscykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuLi5lbmRwb2ludFBheWxvYWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcnRjOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0Y0NsaWVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbHM6IHJlc29sdmVkQ2hhbm5lbHNcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBhbnN3ZXIuc3VwcG9ydGVkUHJvdG9jb2xzLnB1c2goeyB0eXBlOiAnY2xhc3NpYycsIHZlcnNpb246IHN0cmF0ZWd5XzEuQ2xhc3NpY0luZm8udmVyc2lvbiB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFuc3dlcjtcbiAgICAgICAgICAgIH0sIFByb21pc2UucmVzb2x2ZShjbGllbnRBbnN3ZXIpKTtcbiAgICAgICAgICAgIC8vIE5lZWQgdG8gYXMgY2FzdCBoZXJlLlxuICAgICAgICAgICAgY2xpZW50QW5zd2VyLmVuZHBvaW50UGF5bG9hZFByb21pc2UudGhlbigoZW5kcG9pbnRQYXlsb2FkKSA9PiBzdHJhdGVneS5hZGRFbmRwb2ludChjbGllbnRJZGVudGl0eS5lbmRwb2ludElkLCBlbmRwb2ludFBheWxvYWQpKTtcbiAgICAgICAgICAgIGFja1RvU2VuZGVyLnBheWxvYWQucGF5bG9hZC5yZXN1bHQgPSByZXM7XG4gICAgICAgICAgICBhY2tUb1NlbmRlci5wYXlsb2FkLnBheWxvYWQuYW5zd2VyID0gY2xpZW50QW5zd2VyO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kUmF3KGFja1RvU2VuZGVyKTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgYWNrVG9TZW5kZXIucGF5bG9hZC5zdWNjZXNzID0gZmFsc2U7XG4gICAgICAgICAgICBhY2tUb1NlbmRlci5wYXlsb2FkLnJlYXNvbiA9IGUubWVzc2FnZTtcbiAgICAgICAg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KlxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIG9uQ2hhbm5lbERpc2Nvbm5lY3QobGlzdGVuZXIpIHtcbiAgICAgICAgYXdhaXQgdGhpcy5vbignZGlzY29ubmVjdGVkJywgbGlzdGVuZXIpO1xuICAgIH1cbiAgICBhc3luYyBzYWZlQ29ubmVjdChjaGFubmVsTmFtZSwgc2hvdWxkV2FpdCwgY29ubmVjdFBheWxvYWQpIHtcbiAgICAgICAgY29uc3QgcmV0cnlJbmZvID0geyBjb3VudDogMCB9O1xuICAgICAgICAvKiBlc2xpbnQtZGlzYWJsZSBuby1hd2FpdC1pbi1sb29wLCBuby1jb25zdGFudC1jb25kaXRpb24gKi9cbiAgICAgICAgZG8ge1xuICAgICAgICAgICAgLy8gc2V0dXAgYSBsaXN0ZW5lciBhbmQgYSBjb25uZWN0ZWQgcHJvbWlzZSB0byBhd2FpdCBpbiBjYXNlIHdlIGNvbm5lY3QgYmVmb3JlIHRoZSBjaGFubmVsIGlzIHJlYWR5XG4gICAgICAgICAgICBsZXQgY29ubmVjdGVkTGlzdGVuZXIgPSAoKSA9PiB1bmRlZmluZWQ7XG4gICAgICAgICAgICBjb25zdCBjb25uZWN0ZWRQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHtcbiAgICAgICAgICAgICAgICBjb25uZWN0ZWRMaXN0ZW5lciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaGFubmVsTmFtZSA9PT0gcGF5bG9hZC5jaGFubmVsTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh0cnVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQ3KHRoaXMsIF9DaGFubmVsX2ludGVybmFsRW1pdHRlciwgXCJmXCIpLm9uKCdjb25uZWN0ZWQnLCBjb25uZ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XMud2lyZS5zZW5kQWN0aW9uKCdjb25uZWN0LXRvLWNoYW5uZWwnLCBjb25uZWN0UGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgLy8gU2F2ZSBtZXNzYWdlSWQgZnJvbSB0aGUgZmlyc3QgY29ubmVjdGlvbiBhdHRlbXB0XG4gICAgICAgICAgICAgICAgcmV0cnlJbmZvLm9yaWdpbmFsTWVzc2FnZUlkID0gc2VudE1lc3NhZ2VQcm9taXNlLm1lc3NhZ2VJZDtcbiAgICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSBhd2FpdCBzZW50TWVzc2FnZVByb21pc2U7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdC5wYXlsb2FkLmRhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWVycm9yLm1lc3NhZ2UuaW5jbHVkZXMoJ2ludGVybmFsLW5hY2snKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOb3QgYW4gaW50ZXJuYWwgbmFjaywgYnJlYWsgdGhlIGxvb3BcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzaG91bGRXYWl0ICYmIHJldHJ5SW5mby5jb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB3YWl0aW5nIG9uIHRoZSBuZXh0IGl0ZXJhdGlvbiwgd2FybiB0aGUgdXNlclxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYE5vIGNoYW5uZWwgZm91bmQgZm9yIGNoYW5uZWxOYW1lOiAke2NoYW5uZWxOYW1lfS4gV2FpdGluZyBmb3IgY29ubmVjdGlvbi4uLmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZpbmFsbHkge1xuICAgICAgICAgICAgICAgIHJ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IGhlcmUgLSB3ZSBjYW4gY29ubmVjdCBhZ2FpbiB3aGljaCB3aWxsIHJldHVybiBhIHByb21pc2VcbiAgICAgKiAgICAgICAgLy8gdGhhdCB3aWxsIHJlc29sdmUgaWYvd2hlbiB0aGUgY2hhbm5lbCBpcyByZS1jcmVhdGVkLlxuICAgICAqICAgICAgICBtYWtlQ2xpZW50KGNoYW5uZWxJbmZvLmNoYW5uZWxOYW1lKTtcbiAgICAgKiAgICB9KVxuICAgICAqXG4gICAgICogICAgY2xpZW50QnVzLnJlZ2lzdGVyKCd0b3BpYycsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAvLyByZWdpc3RlciBhIGNhbGxiYWNrIGZvciBhIHRvcGljIHRvIHdoaWNoIHRoZSBjaGFubmVsIHByb3ZpZGVyIGNhbiBkaXNwYXRjaCBhbiBhY3Rpb25cbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ0FjdGlvbiBkaXNwYXRjaGVkIGJ5IHByb3ZpZGVyOiAnLCBKU09OLnN0cmluZ2lmeShpZGVudGl0eSkpO1xuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnUGF5bG9hZCBzZW50IGluIGRpc3BhdGNoOiAnLCBKU09OLnN0cmluZ2lmeShwYXlsb2FkKSk7XG4gICAgICogICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgIH07XG4gICAgICogICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogbWFrZUNsaWVudCgnY2hhbm5lbE5hbWUnKVxuICAgICAqIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdDb25uZWN0ZWQnKSlcbiAgICAgKiAuY2F0Y2goY29uc29sZS5lcnJvcik7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgY29ubmVjdChjaGFubmVsTmFtZSwgb3B0aW9ucyA9IHt9KSB7XG4gICAgICAgIC8vIE1ha2Ugc3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yBhbiBlcnJvclxuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnQ2xpZW50IGNvbm5lY3Rpb24gcmVxdWVzdCBpZGVudGl0eTogJywgSlNPTi5zdHJpbmdpZnkoaWRlbnRpdHkpKTtcbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ0NsaWVudCBjb25uZWN0aW9uIHJlcXVlc3QgcGF5bG9hZDogJywgSlNPTi5zdHJpbmdpZnkocGF5bG9hZCkpO1xuICAgICAqICAgIH0pO1xuICAgICAqXG4gICAgICogICAgcHJvdmlkZXJCdXMucmVnaXN0ZXIoJ3RvcGljJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgIC8vIHJlZ2lzdGVyIGEgY2FsbGJhY2sgZm9yIGEgJ3RvcGljJyB0byB3aGljaCBjbGllbnRzIGNhbiBkaXNwYXRjaCBhbiBhY3Rpb25cbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ0FjdGlvbiBkaXNwYXRjaGVkIGJ5IGNsaWVudDogJywgSlNPTi5zdHJpbmdpZnkoaWRlbnRpdHkpKTtcbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ1BheWxvYWQgc2VudCBpbiBkaXNwYXRjaDogJywgSlNPTi5zdHJpbmdpZnkocGF5bG9hZCkpO1xuICAgICAqICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICB9O1xuICAgICAqICAgIH0pO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgY3JlYXRlKGNoYW5uZWxOYW1lLCBvcHRpb25zKSB7XG4gICAgICAgIGlmICghY2hhbm5lbE5hbWUpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUGxlYXNlIHByb3ZpZGUgYSBjaGFubmVsTmFtZSB0byBjcmVhdGUgYSBjaGFubmVsJyk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc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tcbiAgICAgKlxuICAgICAqIC8vIHN1YnNjcmliZSB0byB3aWxkY2FyZFxuICAgICAqIGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLnN1YnNjcmliZSh7IHV1aWQ6ICcqJyB9LCAndG9waWMnLCBzdWJfbXNnID0+IGNvbnNvbGUubG9nKHN1Yl9tc2cpKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdTdWJzY3JpYmVkIHRvIConKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIHN1YnNjcmliZShzb3VyY2UsIHRvcGljLCBsaXN0ZW5lcikge1xuICAgICAgICBjb25zdCBzdWJLZXkgPSB0aGlzLmNyZWF0ZVN1YnNjcmlwdGlvbktleShzb3VyY2UudXVpZCwgc291cmNlLm5hbWUgfHwgJyonLCB0b3BpYyk7XG4gICAgICAgIGNvbnN0IHNlbmRTdWJzY3JpcHRpb24gPSAoKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3N1YnNjcmliZScsIHtcbiAgICAgICAgICAgICAgICBzb3VyY2VVdWlkOiBzb3VyY2UudXVpZCxcbiAgICAgICAgICAgICAgICBzb3VyY2VXaW5kb3dOYW1lOiBzb3VyY2UubmFtZSB8fCAnKicsXG4gICAgICAgICAgICAgICAgdG9waWMsXG4gICAgICAgICAgICAgICAgZGVzdGluYXRpb25XaW5kb3dOYW1lOiB0aGlzLm1lLm5hbWVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBhbHJlYWR5U3Vic2NyaWJlZCA9ICgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5lbWl0dGVyLm9uKHN1YktleSwgbGlzdGVuZXIpO1xuICAgICAgICByZXR1cm4gdGhpcy5yZWZDb3VudGVyLmFjdE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nNjcmlwdGlvbiA9ICgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigndW5zdWJzY3JpYmUnLCB7XG4gICAgICAgICAgICAgICAgc291cmNlVXVpZDogc291cmNlLnV1aWQsXG4gICAgICAgICAgICAgICAgc291cmNlV2luZG93TmFtZSxcbiAgICAgICAgICAgICAgICB0b3BpYyxcbiAgICAgICAgICAgICAgICBkZXN0aW5hdGlvbldpbmRvd05hbWU6IHRoaXMubWUubmFtZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGRvbnRTZW5kVW5zdWJzY3JpcHRpb24gPSAoKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHIpID0+IHIpLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5lbWl0dGVyLnJlbW92ZUxpc3RlbmVyKHN1YktleSwgbGlzdGVuZXIpO1xuICAgICAgICByZXR1cm4gdGhpcy5yZWZDb3VudGVyLmFjdE9uTGFzdChzdWJLZXksIHNlbmRVbnN1YnNjcmlwdGlvbiwgZG9udFNlbmRVbnN1YnNjcmlwdGlvbik7XG4gICAgfVxuICAgIHByb2Nlc3NNZXNzYWdlKG1lc3NhZ2UpIHtcbiAgICAgICAgY29uc3QgeyBwYXlsb2FkOiB7IG1lc3NhZ2U6IHBheWxvYWRNZXNzYWdlLCBzb3VyY2VXaW5kb3dOYW1lLCBzb3VyY2VVdWlkLCB0b3BpYyB9IH0gPSBtZXNzYWdlO1xuICAgICAgICBjb25zdCBrZXlzID0gW1xuICAgICAgICAgICAgdGhpcy5jcmVhdGVTdWJzY3JpcHRpb25LZXkoc291cmNlVXVpZCwgc291cmNlV2luZG93TmFtZSwgdG9waWMpLFxuICAgICAgICAgICAgdGhpcy5jcmVhdGVTdWJzY3JpcHRpb25LZXkoc291cmNlVXVpZCwgJyonLCB0b3BpYyksXG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YXN5bmMgZnVuY3Rpb24gZ2V0SW5mbygpIHtcbiAgICAgKiAgICAgY29uc3QgZnJtID0gYXdhaXQgZmluLkZyYW1lLmdldEN1cnJlbnQoKTtcbiAgICAgKiAgICAgcmV0dXJuIGF3YWl0IGZybS5nZXRJbmZvKCk7XG4gICAgICogfVxuICAgICAqIGdldEluZm8oKS50aGVuKGluZm8gPT4gY29uc29sZS5sb2coaW5mbykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBnZXRJbmZvKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1mcmFtZS1pbmZvJywgdGhpcy5pZGVudGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSBmcmFtZSBpbmZvIG9iamVjdCByZXByZXNlbnRpbmcgdGhlIHdpbmRvdyB0aGF0IHRoZSByZWZlcmVuY2VkIGlmcmFtZSBpc1xuICAgICAqIGN1cnJlbnRseSBlbWJlZGRlZCBpbi5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRQYXJlbnRXaW5kb3coKSB7XG4gICAgICogICAgIGNvbnN0IGZybSA9IGF3YWl0IGZpbi5GcmFtZS5nZXRDdXJyZW50KCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCBmcm0uZ2V0UGFyZW50V2luZG93KCk7XG4gICAgICogfVxuICAgICAqIGdldFBhcmVudFdpbmRvdygpLnRoZW4od2luSW5mbyA9PiBjb25zb2xlLmxvZyh3aW5JbmZvKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldFBhcmVudFdpbmRvdygpIHtcbiAgICAgICAgcmV0dXJ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gICogY29uc3QgaW5mbyA9IGF3YWl0IGZybS5nZXRJbmZvKCk7XG4gICAgICogY29uc29sZS5sb2coaW5mbyk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgd3JhcFN5bmMoaWRlbnRpdHkpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2ZyYW1lLXdyYXAtc3luYycpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEkMi52YWxpZGF0ZUlkZW50aXR5KShpZGVudGl0eSk7XG4gICAgICAgIGlmIChlcnJvck1zZykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yTXNnKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IEluc3RhbmNlXzEkMy5fRnJhbWUodGhpcy53aXJlLCBpZGVudGl0eSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEFzeW5jaHJvbm91c2x5IHJldHVybnMgYSByZWZlcmVuY2UgdG8gdGhlIGN1cnJlbnQgZnJhbWVcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uRnJhbWUuZ2V0Q3VycmVudCgpXG4gICAgICogLnRoZW4oZnJtID0+IGNvbnNvbGUubG9nKCdjdXJyZW50IGZyYW1lJykpXG4gICAgICogLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBnZXRDdXJyZW50KCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignZnJhbWUtZ2V0LWN1cnJlbnQnKS5jYXRjaCgoZSkgPT4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B0YXJnZXQgPSBpZGVudGl0eSB8fCB0aGlzLmlkZW50aXR5O1xuICAgICAgICAgICAgY29uc3QgeyB1dWlkIH0gPSB0YXJnZXQ7XG4gICAgICAgICAgICBpZiAoIWNsaWVudE1hcC5oYXModXVpZCkpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBjbGllbnRQcm9taXNlID0gX19jbGFzc1ByaXZhdGVGaWVsZEdldCQ2KHRoaXMsIF9QbGF0Zm9ybV9jb25uZWN0VG9Qcm92aWRlciwgXCJmXCIpLmNhbGwodGhpcywgdXVpZCk7XG4gICAgICAgICAgICAgICAgY2xpZW50TWFwLnNldCh1dWlkLCBjbGllbnRQcm9taXNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHdlIHNldCBpdCBhYm92ZVxuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1ub24tbnVsbC1hc3NlcnRpb25cbiAgICAgICAgICAgIHJldHVybiBjbGllbnRNYXAuZ2V0KHV1aWQpO1xuICAgICAgICB9O1xuICAgICAgICBfUGxhdGZvcm1fY29ubmVjdFRvUHJvdmlkZXIuc2V0KHRoaXMsIGFzeW5jICh1dWlkKSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNoYW5uZWxOYW1lID0gYGN1c3RvbS1mcmFtZS0ke3V1aWR9YDtcbiAgICAgICAgICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLl9jaGFubmVsLmNvbm5lY3QoY2hhbm5lbE5hbWUsIHsgd2FpdDogZmFsc2UgfSk7XG4gICAgICAgICAgICAgICAgY2xpZW50Lm9uRGlzY29ubmVjdGlvbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNsaWVudE1hcC5kZWxldGUodXVpZCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNsaWV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dmlldyB3aWxsIG5vdyBzaG93IGluIHRoZSBjdXJyZW50IHdpbmRvd1xuICAgICAqIGF3YWl0IHBsYXRmb3JtLmNyZWF0ZVZpZXcodmlld09wdGlvbnMsIHdpbmRvd0lkZW50aXR5KTtcbiAgICAgKlxuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy53cmFwU3luYyh7IHV1aWQ6IHdpbmRvd0lkZW50aXR5LnV1aWQsIG5hbWU6ICd5YWhvb192aWV3JyB9KTtcbiAgICAgKiAvLyByZXBhcmVudCBgZXhhbXBsZV92aWV3YCB3aGVuIGEgdmlldyBpbiB0aGUgbmV3IHdpbmRvdyBpcyBzaG93blxuICAgICAqIHZpZXcub24oJ3Nob3duJywgYXN5bmMgKCkgPT4ge1xuICAgICAqICAgICBsZXQgdmlld0lkZW50aXR5ID0geyB1dWlkOiB3aW5kb3dJZGVudGl0eS51dWlkLCBuYW1lOiAnZXhhbXBsZV92aWV3J307XG4gICAgICogICAgIGxldCB0YXJnZXQgPSB7dXVpZDogd2luZG93SWRlbnRpdHkudXVpZCwgbmFtZTogJ3Rlc3Rfd2luJ307XG4gICAgICogICAgIHBsYXRmb3JtLmNyZWF0ZVZpZXcodmlld09wdGlvbnMsIHRhcmdldCk7XG4gICAgICogfSk7XG4gICAgICpcbiAgICAgKiAvLyBjcmVhdGUgYSBuZXcgd2luZG93XG4gICAgICogYXdhaXQgcGxhdGZvcm0uY3JlYXRlV2luZG93KHtcbiAgICAgKiAgICAgbmFtZTogXCJ0ZXN0X3dpblwiLFxuICAgICAqICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3lhaG9vX3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3lhaG9vLmNvbSdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICBdXG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKGNvbnNvbGUubG9nKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBjcmVhdGVWaWV3KHZpZXdPcHRpb25zLCB0YXJnZXQsIHRhcmdldFZpZXcpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3BsYXRmb3JtLWNyZWF0ZS12aWV3JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICB9KTtcbiAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgdGhpcy5nZXRDbGllbnQoKTtcbiAgICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBjbGllbnQuZGlzcGF0Y2goJ2NyZWF0ZS12aWV3Jywge1xuICAgICAgICAgICAgdGFyZ2V0LFxuICAgICAgICAgICAgb3B0czogdmlld09wdGlvbnMsXG4gICAgICAgICAgICB0YXJnZXRWaWV3XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAoIXJlc3BvbnNlIHx8ICgwLCB2YWxpZGF0ZV8xJDEudmFsaWRhdGVJZGVud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XN0b20gV2luZG93LlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqXG4gICAgICogVGhlIGV4YW1wbGUgYmVsb3cgd2lsbCBjcmVhdGUgYSBEZWZhdWx0IFdpbmRvdyB3aGljaCB1c2VzIE9wZW5GaW4gZGVmYXVsdCBXaW5kb3cgVUkuPGJyPlxuICAgICAqIFRoZSBXaW5kb3cgY29udGFpbnMgdHdvIFZpZXdzIGluIGEgc3RhY2sgTGF5b3V0OlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBwbGF0Zm9ybSA9IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh7XG4gICAgICogICAgIGxheW91dDoge1xuICAgICAqICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndGVzdF92aWV3XzEnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9jYW5hcnkvUGxhdGZvcm0uaHRtbCdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndGVzdF92aWV3XzInLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9jYW5hcnkvUGxhdGZvcm0uaHRtbCdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICBdXG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKGNvbnNvbGUubG9nKTtcbiAgICAgKiBgYGBcbiAgICAgKiBUaGUgRGVmYXVsdCBXaW5kb3cncyBkZXNpZ24gY2FuIGJlIGN1c3RvbWl6ZWQgYnkgc3BlY2lmeWluZyB0aGUgYHN0eWxlc2hlZXRVcmxgIHByb3BlcnR5IGluIHRoZSBtYW5pZmVzdDpcbiAgICAgKlxuICAgICAqIGBgYGpzb25cbiAgICAgKiB7XG4gICAgICogICAgIHBsYXRmb3JtOiB7XG4gICAgICogICAgICAgICBkZWZhdWx0V2luZG93T3B0aW9uczoge1xuICAgICAqICAgICAgICAgICAgIHN0eWxlc2hlZXRVcmw6ICdzb21lLXVybC5jc3MnLFxuICAgICAqICAgICAgICAgICAgIC4uLlxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqIEZvciBhIGxpc3Qgb2YgY29tbW9uIExheW91dCBDU1MgY2xhc3N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ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXCJzdGFja1wiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXCJjb21wb25lbnRcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6IFwidmlld1wiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBcImFwcCAjMVwiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXCJodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9jYW5hcnkvUGxhdGZvcm0uaHRtbFwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwiY29tcG9uZW50XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiBcInZpZXdcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogXCJhcHAgIzJcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWxcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgcGxhdGZvcm0uY3JlYXRlV2luZG93KHdpbmRvd0NvbmZpZyk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBIZXJlJ3MgYW4gZXhhbXBsZSBvZiBhIG1pbmltYWxpc3QgQ3VzdG9tIFBsYXRmb3JtIFdpbmRvdyBpbXBsZW1lbnRhdGlvbjpcbiAgICAgKiBgYGBodG1sXG4gICAgICogPGh0bWw+XG4gICAgICogICAgIDxoZWFkPlxuICAgICAqICAgICAgICAgPG1ldGEgY2hhcnNldD1cInV0Zi04XCI+XG4gICAgICogICAgICAgICA8bWV0YSBuYW1lPVwidmlld3BvcnRcIiBjb250ZW50PVwid2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTFcIj5cbiAgICAgKiAgICAgICAgIDxsaW5rIHJlbD1cInN0eWxlc2hlZXRcIiB0eXBlPVwidGV4dC9jc3NcIiBocmVmPVwiLi9zdHlsZXMuY3NzXCI+XG4gICAgICogICAgIDwvaGVhZD5cbiAgICAgKiAgICAgPGJvZHk+XG4gICAgICogICAgICAgICA8ZGl2IGlkPVwib2YtZnJhbWUtbWFpblwiPlxuICAgICAqICAgICAgICAgICAgIDxkaXYgaWQ9XCJ0aXRsZS1iYXJcIj5cbiAgICAgKiAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRpdGxlLWJhci1kcmFnZ2FibGVcIj5c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gYSB1cmwgb3IgZmlsZXBhdGguXG4gICAgICogQHBhcmFtIG9wdGlvbnMgT3B0aW9uYWwgcGFyYW1ldGVycyB0byBzcGVjaWZ5IHdoZXRoZXIgZXhpc3Rpbmcgd2luZG93cyBzaG91bGQgYmUgY2xvc2VkLlxuICAgICAqXG4gICAgICogQHJlbWFya3MgV2lsbCBjcmVhdGUgYW55IHdpbmRvd3MgYW5kIHZpZXdzIHRoYXQgYXJlIG5vdCBydW5uaW5nIGJ1dCBhcmUgcGFzc2VkIGluIHRoZSBzbmFwc2hvdCBvYmplY3QuIEFueSBWaWV3XG4gICAgICogc3BlY2lmaWVkIGluIHRoZSBzbmFwc2hvdCBpcyBhc3NpZ25lZCBhIHJhbmRvbWx5IGdlbmVyYXRlZCBuYW1lIHRvIGF2b2lkIGNvbGxpc2lvbnMuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogLy8gR2V0IGEgd3JhcHBlZCBsYXlvdXQgcGxhdGZvcm0gaW5zdGFuY2VcbiAgICAgKiBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50KCk7XG4gICAgICpcbiAgICAgKiBjb25zdCBzbmFwc2hvdCA9IHtcbiAgICAgKiAgICAgd2luZG93czogW1xuICAgICAqICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgIGxheW91dDoge1xuICAgICAqICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29tcG9uZW50X1gnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3Lm9wZW5maW4uY28nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29tcG9uZW50X1knLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZW1iZWQtd2ViL2NoYXJ0Lmh0bWwnXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIF1cbiAgICAgKiB9XG4gICAgICpcbiAgICAg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N0X3ZpZXdfMycsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwczovL29wZW5maW4uY28nXG4gICAgICogICAgIH0sIHdpbklkKTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVXaW5kb3dXaXRoVHdvVmlld3MoKSB7XG4gICAgICogICAgIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqICAgICByZXR1cm4gcGxhdGZvcm0uY3JlYXRlV2luZG93KHtcbiAgICAgKiAgICAgICAgIGxheW91dDoge1xuICAgICAqICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndGVzdF92aWV3XzEnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9leGFtcGxlLmNvbSdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18yJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8veWFob28uY29tJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9KTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW5kb3dXaXRoVHdvVmlld3MoKTtcbiAgICAgKiAvLyAuLi4geW91IHdpbGwgbm93IHNlZSBhIG5ldyB3aW5kb3cgd2l0aCB0d28gdmlld3MgaW4gaXRcbiAgICAgKlxuICAgICAqIC8vIHdlIHRha2UgYSBzbmFwc2hvdCBvZiB0aGUgY3VycmVudCBzdGF0ZSBvZiB0aGUgYXBwLCBiZWZvcmUgY2hhbmdpbmcgaXRcbiAgICAgKiBjb25zdCBzbmFwc2hvdE9mSW5pdGlhbEFwcFN0YXRlID0gYXdhaXQgcGxhdGZvcm0uZ2V0U25hcHNob3QoKTtcbiAgICAgKlxuICAgICAqIC8vIG5vdyBsZXQncyBjaGFuZ2UgdGhlIHN0YXRlIG9mIHRoZSBhcHA6XG4gICAgICogYXdhaXQgYWRkVmlld1RvV2luZG93KHdpbi5pZGVudGl0eSk7XG4gICAgICogLy8gLi4uIHRoZSB3aW5kb3cgbm93IGhhcyB0aHJlZSB2aWV3cyBpbiBpdFx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AgICogcGxhdGZvcm0uc2V0V2luZG93Q29udGV4dChjb250ZXh0RGF0YSkgLy8gY29udGV4dENoYW5nZUhhbmRsZXIgd2lsbCBsb2cgdGhlIG5ldyBjb250ZXh0XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBUbyBsaXN0ZW4gdG8gYSB3aW5kb3cncyBjb250ZXh0IHVwZGF0ZXMsIHVzZSB0aGUgYGNvbnRleHQtY2hhbmdlZGAgZXZlbnQ6XG4gICAgICogYGBganNcbiAgICAgKiAvLyBGcm9tIGEgd2luZG93XG4gICAgICogY29uc3QgY29udGV4dENoYW5nZUhhbmRsZXIgPSAoeyBjb250ZXh0IH0pID0+IHtcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ1RoaXMgd2luZG93XFwncyBjb250ZXh0IGhhcyBjaGFuZ2VkLiBOZXcgY29udGV4dCBkYXRhOicsIGNvbnRleHQpO1xuICAgICAqICAgICAvLyByZWFjdCB0byBuZXcgY29udGV4dCBkYXRhIGhlcmVcbiAgICAgKiB9XG4gICAgICogYXdhaXQgZmluLm1lLm9uKCdjb250ZXh0LWNoYW5nZWQnLCBjb250ZXh0Q2hhbmdlSGFuZGxlcik7XG4gICAgICpcbiAgICAgKiBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIGNvbnN0IGNvbnRleHREYXRhID0ge1xuICAgICAqICAgICBzZWN1cml0eTogJ1NUT0NLJyxcbiAgICAgKiAgICAgY3VycmVudFZpZXc6ICdkZXRhaWxlZCdcbiAgICAgKiB9XG4gICAgICogcGxhdGZvcm0uc2V0V2luZG93Q29udGV4dChjb250ZXh0RGF0YSkgLy8gY29udGV4dENoYW5nZUhhbmRsZXIgd2lsbCBsb2cgdGhlIG5ldyBjb250ZXh0XG4gICAgICogYGBgXG4gICAgICogQGV4cGVyaW1lbnRhbFxuICAgICAqL1xuICAgIGFzeW5jIHNldFdpbmRvd0NvbnRle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Y2VzIGEgUGxhdGZvcm0gd2luZG93J3MgbGF5b3V0IHdpdGggYSBuZXcgbGF5b3V0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcmVtYXJrcyBBbnkgdmlld3MgdGhhdCB3ZXJlIGluIHRoZSBvbGQgbGF5b3V0IGJ1dCBub3QgdGhlIG5ldyBsYXlvdXQgd2lsbCBiZSBkZXN0cm95ZWQuIFZpZXdzIHdpbGwgYmUgYXNzaWduZWQgYSByYW5kb21seSBnZW5lcmF0ZWQgbmFtZSB0byBhdm9pZCBjb2xsaXNpb25zLlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBsZXQgd2luZG93SWRlbnRpdHk7XG4gICAgICAgICAqIGlmIChmaW4ubWUuaXNXaW5kb3cpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gZmluLm1lLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2UgaWYgKGZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gKGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50V2luZG93KCkpLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2Uge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcgb3IgV2luZG93Jyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gZmluLlBsYXRmb3JtLkxheW91dC53cmFwU3luYyh3aW5kb3dJZGVudGl0eSk7XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IG5ld0xheW91dCA9IHtcbiAgICAgICAgICogICAgIGNvbnRlbnQ6IFtcbiAgICAgICAgICogICAgICAgICB7XG4gICAgICAgICAqICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICAgICAqICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgICAgICogICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ25ld19jb21wb25lbnRfQTEnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQWZmaW5pdHk6ICdwc18xJyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly93d3cuZXhhbXBsZS5jb20nXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICogICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ25ld19jb21wb25lbnRfQTInLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2VtYmVkLXdlYi9jaGFydC5odG1sJ1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICogICAgICAgICAgICAgXVxuICAgICAgICAgKiAgICAgICAgIH1cbiAgICAgICAgICogICAgIF1cbiAgICAgICAgICogfTtcbiAgICAgICAgICpcbiAgICAgICAgICogbGF5b3V0LnJlcGxhY2UobmV3TGF5b3V0KTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLnJlcGxhY2UgPSBhc3luYyAobGF5b3V0KSA9PiB7XG4gICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LXJlcGxhY2UnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLnBsYXRmb3JtLmdldENsaWVudCgpO1xuICAgICAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdyZXBsYWNlLWxheW91dCcsIHtcbiAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuaWRlbnRpdHksXG4gICAgICAgICAgICAgICAgb3B0czogeyBsYXlvdXQgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXBsYWNlcyB0aGUgc3BlY2lmaWVkIHZpZXcgd2l0aCBhIHZpZXcgd2l0aCB0aGUgcHJvdmlkZWQgY29uZmlndXJhdGlvbi5cbiAgICAgICAgICpcbiAgICAgICAgICogQHJlbWFya3MgVGhlIG9sZCB2aWV3IGlzIHN0cmlwcGVkIG9mIGl0cyBsaXN0ZW5lcnMgYW5kIGVpdGhlciBjbG9zZWQgb3IgYXR0YWNoZWQgdG8gdGhlIHByb3ZpZGVyIHdpbmRvd1xuICAgICAgICAgKiBkZXBlbmRpbmcgb24gYGRldGFjaE9uQ2xvc2VgIHZpZXcgb3B0aW9uLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0gdmlld1RvUmVwbGFjZSBJZGVudGl0eSBvZiB0aGUgdmlldyB0byBiZSByZXBsYWNlZFxuICAgICAgICAgKiBAcGFyYW0gbmV3VmlldyBDcmVhdGlvbiBvcHRpb25zIG9mIHRoZSBuZXcgdmlldy5cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogbGV0IGN1cnJlbnRXaW5kb3c7XG4gICAgICAgICAqIGlmIChmaW4ubWUuaXNXaW5kb3cpIHtcbiAgICAgICAgICogICAgIGN1cnJlbnRXaW5kb3cgPSBmaW4ubWU7XG4gICAgICAgICAqIH0gZWxzZSBpZiAoZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgY3VycmVudFdpbmRvdyA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50V2luZG93KCk7XG4gICAgICAgICAqIH0gZWxzZSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldyBvciBXaW5kb3cnKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBsYXlvdXQgPSBmaW4uUGxhdGZvcm0uTGF5b3V0LndyYXBTeW5jKGN1cnJlbnRXaW5kb3cuaWRlbnRpdHkpO1xuICAgICAgICAgKiBjb25zdCB2aWV3VG9SZXBsYWNlID0gKGF3YWl0IGN1cnJlbnRXaW5kb3cuZ2V0Q3VycmVudFZpZXdzKCkpWzBdO1xuICAgICAgICAgKiBjb25zdCBuZXdWaWV3Q29uZmlnID0ge3VybDogJ2h0dHBzOi8vZXhhbXBsZS5jb20nfTtcbiAgICAgICAgICogYXdhaXQgbGF5b3V0LnJlcGxhY2VWaWV3KHZpZXdUb1JlcGxhY2UuaWRlbnRpdHksIG5ld1ZpZXdDb25maWcpO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMucmVwbGFjZVZpZXcgPSBhc3luYyAodmlld1RvUmVwbGFjZSwgbmV3VmlldykgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2x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1dpbmRvdykge1xuICAgICAgICAgKiAgICAgd2luZG93SWRlbnRpdHkgPSBmaW4ubWUuaWRlbnRpdHk7XG4gICAgICAgICAqIH0gZWxzZSBpZiAoZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgd2luZG93SWRlbnRpdHkgPSAoYXdhaXQgZmluLm1lLmdldEN1cnJlbnRXaW5kb3coKSkuaWRlbnRpdHk7XG4gICAgICAgICAqIH0gZWxzZSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldyBvciBXaW5kb3cnKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBsYXlvdXQgPSBmaW4uUGxhdGZvcm0uTGF5b3V0LndyYXBTeW5jKHdpbmRvd0lkZW50aXR5KTtcbiAgICAgICAgICogYXdhaXQgbGF5b3V0LmFwcGx5UHJlc2V0KHsgcHJlc2V0VHlwZTogJ2dyaWQnIH0pO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyB3YWl0IDUgc2Vjb25kcyB1bnRpbCB5b3UgY2hhbmdlIHRoZSBsYXlvdXQgZnJvbSBncmlkIHRvIHRhYnNcbiAgICAgICAgICogYXdhaXQgbmV3IFByb21pc2UgKHJlcyA9PiBzZXRUaW1lb3V0KHJlcywgNTAwMCkpO1xuICAgICAgICAgKiBhd2FpdCBsYXlvdXQuYXBwbHlQcmVzZXQoeyBwcmVzZXRUeXBlOiAndGFicycgfSk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5hcHBseVByZXNldCA9IGFzeW5jIChvcHRpb25zKSA9PiB7XG4gICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LWFwcGx5LXByZXNldCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlXG4gICAgICAgICAgICB9K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G9uIHRoZSBET00gZWxlbWVudCByZXByZXNlbnRpbmcgdGhlIGxheW91dC1jb250YWluZXIuXG4gICAgICAgICAqIEluIG9yZGVyIHRvIGNhcHR1cmUgdGhlIHJlbGV2YW50IGV2ZW50cyBkdXJpbmcgTGF5b3V0IGluaXRpYXRpb24sIHNldCB1cCB0aGUgbGlzdGVuZXJzIG9uIHRoZSBET00gZWxlbWVudCBwcmlvciB0byBjYWxsaW5nIGBpbml0YC5cbiAgICAgICAgICogQHBhcmFtIG9wdGlvbnMgLSBMYXlvdXQgaW5pdCBvcHRpb25zLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIC8vIElmIG5vIG9wdGlvbnMgYXJlIGluY2x1ZGVkLCB0aGUgbGF5b3V0IGluIHRoZSB3aW5kb3cgb3B0aW9ucyBpcyBpbml0aWFsaXplZCBpbiBhbiBlbGVtZW50IHdpdGggdGhlIGlkIGBsYXlvdXQtY29udGFpbmVyYFxuICAgICAgICAgKiBjb25zdCBsYXlvdXQgPSBhd2FpdCBmaW4uUGxhdGZvcm0uTGF5b3V0LmluaXQoKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqIDxicj5cbiAgICAgICAgICpcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogY29uc3QgY29udGFpbmVySWQgPSAnbXktY3VzdG9tLWNvbnRhaW5lci1pZCc7XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IG15TGF5b3V0Q29udGFpbmVyID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoY29udGFpbmVySWQpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBteUxheW91dENvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCd0YWItY3JlYXRlZCcsIGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAqICAgICBjb25zdCB7IHRhYlNlbGVjdG9yIH0gPSBldmVudC5kZXRhaWw7XG4gICAgICAgICAqICAgICBjb25zdCB0YWJFbGVtZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQodGFiU2VsZWN0b3IpO1xuICAgICAgICAgKiAgICAgY29uc3QgZXhpc3RpbmdDb2xvciA9IHRhYkVsZW1lbnQuc3R5bGUuYmFja2dyb3VuZENvbG9yO1xuICAgICAgICAgKiAgICAgdGFiRWxlbWVudC5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSBcInJlZFwiO1xuICAgICAgICAgKiAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAqICAgICAgICAgdGFiRWxlbWVudC5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSBleGlzdGluZ0NvbG9yO1xuICAgICAgICAgKiAgICAgfSwgMjAwMCk7XG4gICAgICAgICAqIH0pO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyBpbml0aWFsaXplIHRoZSBsYXlvdXQgaW50byBhbiBleGlzdGluZyBIVE1MIGVsZW1lbnQgd2l0aCB0aGUgZGl2IGBteS1jdXN0b20tY29udGFpbmVyLWlkYFxuICAgICAgICAgKiAvLyB0aGUgd2luZG93IG11c3QgaGF2ZSBiZWVuIGNyZWF0ZWQgd2l0aCBhIGxheW91dCBpbiBpdHMgd2luZG93IG9wdGlvbnNcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gYXdhaXQgZmluLlBsYXRmb3JtLkxheW91dC5pbml0KHsgY29udGFpbmVySWQgfSk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5pbml0ID0gYXN5bmMgKG9wdGlvbnMgPSB7fSkgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1pbml0JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgICAgIH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gICAgICogICAgICAgICAgICAgICAgIGhlaWdodDogMTAsXG4gICAgICogICAgICAgICAgICAgICAgIHdpZHRoOiAxMFxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgfSk7XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdQbGF0Zm9ybSBpcyBydW5uaW5nJywgcGxhdGZvcm0pO1xuICAgICAqIH0gY2F0Y2goZSkge1xuICAgICAqICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgICAqIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBzdGFydChwbGF0Zm9ybU9wdGlvbnMpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3BsYXRmb3JtLXN0YXJ0JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICB9KTtcbiAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWFzeW5jLXByb21pc2UtZXhlY3V0b3JcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGFzeW5jIChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29uc3QgeyB1dWlkIH0gPSBwbGF0Zm9ybU9wdGlvbnM7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvciB1c2luZyBwcml2YXRlIHZhcmlhYmxlLlxuICAgICAgICAgICAgICAgIGNvbnN0IGFwcCA9IGF3YWl0IHRoaXMuZmluLkFwcGxpY2F0aW9uLl9jcmVhdGUoeyAuLi5wbGF0Zm9ybU9wdGlvbnMsIGlzUGxhdGZvcm1Db250cm9sbGVyOiB0cnVlIH0pO1xuICAgICAgICAgICAgICAgIC8vIFRPRE86IGZpeCB0eXBpbmcgKGludGVybmFsKVxuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3J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wZSwgdXVpZCwgbmFtZSksIHtcblx0ICAgICAgICAgICAgICAgIGludGVyb3A6IGZhbGxiYWNrSW50ZXJvcCxcblx0ICAgICAgICAgICAgICAgIGlzT3BlbkZpbjogdHJ1ZVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICBjYXNlICdpZnJhbWUnOlxuXHQgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmFzc2lnbihuZXcgZnJhbWVfMS5fRnJhbWUod2lyZSwgeyB1dWlkLCBuYW1lIH0pLCBnZXRCYXNlTWUoZW50aXR5VHlwZSwgdXVpZCwgbmFtZSksIHtcblx0ICAgICAgICAgICAgICAgIGludGVyb3A6IGZhbGxiYWNrSW50ZXJvcCxcblx0ICAgICAgICAgICAgICAgIGlzT3BlbkZpbjogdHJ1ZVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICBjYXNlICdleHRlcm5hbCBjb25uZWN0aW9uJzpcblx0ICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5hc3NpZ24obmV3IGV4dGVybmFsX2FwcGxpY2F0aW9uXzEuRXh0ZXJuYWxBcHBsaWNhdGlvbih3aXJlLCB7IHV1aWQgfSksIGdldEJhc2VNZShlbnRpdHlUeXBlLCB1dWlkLCBuYW1lKSwge1xuXHQgICAgICAgICAgICAgICAgaW50ZXJvcDogZmFsbGJhY2tJbnRlcm9wLFxuXHQgICAgICAgICAgICAgICAgaXNPcGVuRmluOiBmYWxzZVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICBkZWZhdWx0OlxuXHQgICAgICAgICAgICByZXR1cm4ge1xuXHQgICAgICAgICAgICAgICAgLi4uZ2V0QmFzZU1lKGVudGl0eVR5cGUsIHV1aWQsIG5hbWUpLFxuXHQgICAgICAgICAgICAgICAgLi4udW5zdXBwb3J0ZWRFdmVudEJhc2UsXG5cdCAgICAgICAgICAgICAgICBpbnRlcm9wOiB1bnN1cHBvcnRlZEludGVyb3AsXG5cdCAgICAgICAgICAgICAgICBpc09w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FYWNoKChjbGllbnQpID0+IHtcblx0ICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXVudXNlZC1leHByZXNzaW9uc1xuXHQgICAgICAgICAgICBjbGllbnQuY29udGV4dEhhbmRsZXJzLmdldChjb250ZXh0LnR5cGUpPy5mb3JFYWNoKChoYW5kbGVySWQpID0+IHtcblx0ICAgICAgICAgICAgICAgIHRoaXMucHJvdmlkZXIuZGlzcGF0Y2goY2xpZW50LmNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgaWYgKGNsaWVudC5nbG9iYWxIYW5kbGVyKSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudC5jbGllbnRJZGVudGl0eSwgY2xpZW50Lmdsb2JhbEhhbmRsZXIsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdCAgICBnZXRDbGllbnRTdGF0ZShpZCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLmNsaWVudHMuZ2V0KGlkLmVuZHBvaW50SWQpO1xuXHQgICAgfVxuXHQgICAgYXN5bmMgaGFuZGxlckFkZGVkKHBheWxvYWQsIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgeyBoYW5kbGVySWQsIGNvbnRleHRUeXBlIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN1YnNjcmlwdGlvblN0YXRlID0gdGhpcy5nZXRDbGllbnRTdGF0ZShjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKCFjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSkge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENsaWVudCB3aXRoIElkZW50aXR5OiAke2NsaWVudElkZW50aXR5LnV1aWR9IC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ICAgICBpZiAoY3VycmVudENvbnRleHQpIHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGN1cnJlbnRDb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKGdsb2JhbERpc3BhdGNoUHJvbWlzZXMpO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIGhhbmRsZXJSZW1vdmVkKHBheWxvYWQsIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgeyBoYW5kbGVySWQgfSA9IHBheWxvYWQ7XG5cdCAgICAgICAgY29uc3QgY2xpZW50ID0gdGhpcy5jbGllbnRzLmdldChjbGllbnRJZGVudGl0eS5lbmRwb2ludElkKTtcblx0ICAgICAgICBpZiAoY2xpZW50KSB7XG5cdCAgICAgICAgICAgIEFycmF5LmZyb20oY2xpZW50LmNvbnRleHRIYW5kbGVycykuZm9yRWFjaCgoWywgaGFuZGxlcnNdKSA9PiB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBpbmRleCA9IGhhbmRsZXJzLmluZGV4T2YoaGFuZGxlcklkKTtcblx0ICAgICAgICAgICAgICAgIGlmIChpbmRleCA+IC0xKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgaGFuZGxlcnMuc3BsaWNlKGluZGV4LCAxKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGlmIChjbGllbnQuZ2xvYmFsSGFuZGxlciA9PT0gaGFuZGxlcklkKSB7XG5cdCAgICAgICAgICAgICAgICBjbGllbnQuZ2xvYmFsSGFuZGxlciA9IHVuZGVmaW5lZDtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAg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ICAgICAgICB0aGlzLnJlZ2lzdGVyTGlzdGVuZXJzKCk7XG5cdCAgICAgICAgdGhpcy5jb250ZXh0QnlDb250ZXh0VHlwZSA9IG5ldyBNYXAoKTtcblx0ICAgICAgICB0aGlzLmxhc3RDb250ZXh0ID0gdW5kZWZpbmVkO1xuXHQgICAgICAgIHRoaXMucHJvdmlkZXIub25Db25uZWN0aW9uKChjbGllbnRJZGVudGl0eSkgPT4gdGhpcy5yZWdpc3Rlck5ld0NsaWVudChjbGllbnRJZGVudGl0eSkpO1xuXHQgICAgICAgIHRoaXMucHJvdmlkZXIub25EaXNjb25uZWN0aW9uKGFzeW5jIChjbGllbnRJZGVudGl0eSkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCB7IGVuZHBvaW50SWQgfSA9IGNsaWVudElkZW50aXR5O1xuXHQgICAgICAgICAgICBpZiAodGhpcy5jbGllbnRzLmhhcyhlbmRwb2ludElkKSkge1xuXHQgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5oYW5kbGVDbGllbnREaXNjb25uZWN0aW5nKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBpZiAoKGF3YWl0IHRoaXMucHJvdmlkZXIuZ2V0QWxsQ2xpZW50SW5mbygpKS5sZW5ndGggPT09IDApIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMucHJvdmlkZXIuZGVzdHJveSgpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdCAgICBnZXRDbGllbnRTdGF0ZShpZCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLmNsaWVudHMuZ2V0KGlkLmVuZHBvaW50SWQpO1xuXHQgICAgfVxuXHQgICAgcmVnaXN0ZXJMaXN0ZW5lcnMoKSB7XG5cdCAgICAgICAgdGhpcy5wcm92aWRlci5yZWdpc3RlcignYnJvYWRjYXN0JywgdGhpcy5icm9hZGNhc3QuYmluZCh0aGlzKSk7XG5cdCA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QgICAgICAgIH1cblx0ICAgICAgICB0aGlzLmNvbnRleHRCeUNvbnRleHRUeXBlLnNldChjb250ZXh0LnR5cGUsIGNvbnRleHQpO1xuXHQgICAgICAgIHRoaXMubGFzdENvbnRleHQgPSBjb250ZXh0O1xuXHQgICAgICAgIEFycmF5LmZyb20odGhpcy5jbGllbnRzLnZhbHVlcygpKS5mb3JFYWNoKChjdXJyQ2xpZW50U3RhdGUpID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgaGFuZGxlcklkc0ZvckNvbnRleHRUeXBlID0gY3VyckNsaWVudFN0YXRlLmhhbmRsZXJJZHNCeUNvbnRleHRUeXBlcy5nZXQoY29udGV4dC50eXBlKTtcblx0ICAgICAgICAgICAgaWYgKGhhbmRsZXJJZHNGb3JDb250ZXh0VHlwZSkge1xuXHQgICAgICAgICAgICAgICAgaGFuZGxlcklkc0ZvckNvbnRleHRUeXBlLmZvckVhY2goKGhhbmRsZXJJZCkgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgIHRoaXMucHJvdmlkZXIuZGlzcGF0Y2goY3VyckNsaWVudFN0YXRlLmNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgaWYgKGN1cnJDbGllbnRTdGF0ZS5nbG9iYWxIYW5kbGVyKSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGN1cnJDbGllbnRTdGF0ZS5jbGllbnRJZGVudGl0eSwgY3VyckNsaWVudFN0YXRlLmdsb2JhbEhhbmRsZXIsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdCAgICBnZXRDdXJyZW50Q29udGV4dChwYXlsb2FkLCBzZW5kZXJDbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IHsgY29udGV4dFR5cGU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ICAgICBjb25zdCB7IGNsaWVudElkZW50aXR5LCBjbGllbnRJZGVudGl0eTogeyBlbmRwb2ludElkIH0sIG9uVW5zdWJzY3JpYmVIYW5kbGVySWQgfSA9IG90aGVyQ2xpZW50U3RhdGU7XG5cdCAgICAgICAgICAgICAgICBpZiAoZW5kcG9pbnRJZCAhPT0gcmVtb3ZpbmdDbGllbnRJZGVudGl0eS5lbmRwb2ludElkICYmIG9uVW5zdWJzY3JpYmVIYW5kbGVySWQpIHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudElkZW50aXR5LCBvblVuc3Vic2NyaWJlSGFuZGxlcklkLCBjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwoZGlzcGF0Y2hQcm9taXNlcyk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGBQcm9ibGVtIHdoZW4gYXR0ZW1wdGluZyB0byBkaXNwYXRjaCB0byBvblVuc3Vic2NyaWJlSGFuZGxlcnMuIEVycm9yOiAke2Vycm9yfSBSZW1vdmluZyBDbGllbnQ6ICR7aGFuZGxlcklkfS4gdXVpZDogJHtyZW1vdmluZ0NsaWVudElkZW50aXR5LnV1aWR9LiBuYW1lOiAke3JlbW92aW5nQ2xpZW50SWRlbnRpdHkubmFtZX0uIGVuZHBvaW50SWQ6ICR7cmVtb3ZpbmdDbGllbnRJZGVudGl0eS5lbmRwb2ludElkfWApO1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICA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50SWRlbnRpdHkpO1xuXHQgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHVuc3ViUHJvbWlzZXMpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvci5tZXNzYWdlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBpZiAoZ2xvYmFsSGFuZGxlcklkKSB7XG5cdCAgICAgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMuY29udGV4dEhhbmRsZXJSZW1vdmVkKHsgaGFuZGxlcklkOiBnbG9iYWxIYW5kbGVySWQgfSwgY2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvci5tZXNzYWdlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIGFzeW5jIGhhbmRsZUNsaWVudERpc2Nvbm5lY3RpbmcoZGlzY29ubmVjdGluZ0NsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgYXdhaXQgdGhpcy51bnN1YnNjcmliZUFsbChkaXNjb25uZWN0aW5nQ2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgIHRoaXMucmVtb3ZlQ2xpZW50KGRpc2Nvbm5lY3RpbmdDbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgYXdhaXQgdGhpcy5maXJlT25EaXNjb25uZWN0Rm9yT3RoZXJDbGllbnRzKGRpc2Nvbm5lY3RpbmdDbGllbnRJZGVudGl0eSk7XG5cdCAgICB9XG5cdCAgICByZWdpc3Rlck5ld0NsaWVudChjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGlmICghdGhpcy5jbGllbnRzLmhhcyhjbGllbnRJZGVudGl0eS5lbmRwb2ludElkKSkge1xuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSA9IHtcblx0ICAgICAgICAgICAgICAgIGNsaWVudElkZW50aXR5LFxuXHQgICAgICAgICAgICAgICAgaGFuZGxlcklkc0J5Q29udGV4dFR5cGVzOiBuZXcgTWFwKCksXG5cdCAgICAgICAgICAgICAgICBnbG9iYWxIYW5kbGVyOiB1bmRlZmluZWQsXG5cdCAgICAgICAgICAgICAgICBvbkFkZENvbnRleHRMaXN0ZW5lckhhbmRsZXJJZDogdW5kZWZpbmVkLFxuXHQgICAgICAgICAgICAgICAgb25VbnN1YnNjcmliZUhhbmRsZXJJZDogdW5kZWZpbmVkLFxuXHQgICAgICAgICAgICAgICAgb25EaXNjb25uZWN0SGFuZGxlcklkOiB1bmRlZmluZWRcblx0ICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgdGhpcy5jbGllbnRzLnNldChjbGllbnRJZGVudGl0eS5lbmRwb2ludElkLCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSk7XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgYXN5bmMgZ2V0Q29ubmVjdGVkQ2xpZW50cygpIHtcblx0ICAgICAgICBjb25zdCBhbGxDbGllbnRJbmZvID0gYXdhaXQgdGhpcy5wcm92aWRlci5nZXRBbGxDbGllbnRJbmZvKCk7XG5cdCAgICAgICAgcmV0dXJuIEFycmF5LmZyb20odGhpcy5jbGllbnRzLnZhbHVlcygpKS5maWx0ZXIoKGNsaWVudFN0YXRlKSA9PiB7XG5cdCAgICAgICAgICAgIGNvbnN0IHsgdXVpZCwgbmFtZSB9ID0gY2xpZW50U3RhdGUuY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lci5odG1sXCIsXG5cdCAqICAgICAgICAgIFwiaW50ZXJvcEJyb2tlckNvbmZpZ3VyYXRpb25cIjoge1xuXHQgKiAgICAgICAgICAgICAgXCJjb250ZXh0R3JvdXBzXCI6IFtcblx0ICogICAgICAgICAgICAgICAgICB7XG5cdCAqICAgICAgICAgICAgICAgICAgICAgIFwiaWRcIjogXCJncmVlblwiLFxuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImRpc3BsYXlNZXRhZGF0YVwiOiB7XG5cdCAqICAgICAgICAgICAgICAgICAgICAgICAgICBcImNvbG9yXCI6IFwiIzAwQ0M4OFwiLFxuXHQgKiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJuYW1lXCI6IFwiZ3JlZW5cIlxuXHQgKiAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAqICAgICAgICAgICAgICAgICAgfSxcblx0ICogICAgICAgICAgICAgICAgICB7XG5cdCAqICAgICAgICAgICAgICAgICAgICAgIFwiaWRcIjogXCJwdXJwbGVcIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgXCJkaXNwbGF5TWV0YWRhdGFcIjoge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJjb2xvclwiOiBcIiM4QzYxRkZcIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiBcInB1cnBsZVwiXG5cdCAqICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICogICAgICAgICAgICAgICAgICB9LFxuXHQgKiAgICAgICAgICAgICAgXVxuXHQgKiAgICAgICAgICB9XG5cdCAqICAgICAgfVxuXHQgKiB9XG5cdCAqIGBgYFxuXHQgKlxuXHQgKiBCeSBkZWZhdWx0IHRoZSBJbnRlcm9wIEJyb2tlciBsb2dzIGFsbCBhY3Rpb25zIHRvIHRoZSBjb25zb2xlLiBZb3UgY2FuIGRpc2FibGUgdGhpcyBieSB1c2luZyB0aGUgbG9nZ2luZyBvcHRpb24gaW4gYGludGVyb3BCcm9rZXJDb25ma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IHtcblx0ICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdiZWZvcmUgZ2V0U25hcHNob3QnKVxuXHQgKiAgICAgICAgICAgICAgICAgY29uc3Qgc25hcHNob3QgPSBhd2FpdCBzdXBlci5nZXRTbmFwc2hvdCgpO1xuXHQgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2FmdGVyIGdldFNuYXBzaG90Jylcblx0ICogICAgICAgICAgICAgICAgIHJldHVybiBzbmFwc2hvdDtcblx0ICogICAgICAgICAgICAgfVxuXHQgKlxuXHQgKiAgICAgICAgICAgICBhc3luYyBhcHBseVNuYXBzaG90KHsgc25hcHNob3QsIG9wdGlvbnMgfSkge1xuXHQgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2JlZm9yZSBhcHBseVNuYXBzaG90Jylcblx0ICogICAgICAgICAgICAgICAgIGNvbnN0IG9yaWdpbmFsUHJvbWlzZSA9IHN1cGVyLmFwcGx5U25hcHNob3QoeyBzbmFwc2hvdCwgb3B0aW9ucyB9KTtcblx0ICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdhZnRlciBhcHBseVNuYXBzaG90Jylcblx0ICpcblx0ICogICAgICAgICAgICAgICAgIHJldHVybiBvcmlnaW5hbFByb21pc2U7XG5cdCAqICAgICAgICAgICAgIH1cblx0ICogICAgICAgICB9O1xuXHQgKiAgICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoKTtcblx0ICogICAgIH0sXG5cdCAqICAgICBpbnRlcm9wT3ZlcnJpZGU6IGFzeW5jIChJbnRlcm9wQnJva2VyKSA9PiB7XG5cdCAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICogICAgICAgICAgICAgYXN5bmMgam9pbkNvbnRleHRHcm91cChjaGFubmVsTmFtZSA9ICdkZWZhdWx0JywgdGFyZ2V0KSB7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLm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YW5hbHl0aWNzLW9ubHkgY2FsbFxuXHQgICAgICAgIH0pO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN0YXRlID0gdGhpcy5nZXRDbGllbnRTdGF0ZShjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKGNsaWVudFN0YXRlICYmIGNsaWVudFN0YXRlLmNvbnRleHRHcm91cElkKSB7XG5cdCAgICAgICAgICAgIGNvbnN0IHsgY29udGV4dEdyb3VwSWQgfSA9IGNsaWVudFN0YXRlO1xuXHQgICAgICAgICAgICBpZiAoIXRoaXMuY29udGV4dEdyb3Vwc0J5SWQuaGFzKGNvbnRleHRHcm91cElkKSkge1xuXHQgICAgICAgICAgICAgICAgLy8gVGhlb3JldGljYWxseSBub3QgcG9zc2libGUuXG5cdCAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENsaWVudCBoYXMgYSBjb250ZXh0IGdyb3VwIHRoYXQgaXNuJ3QgaW4gdGhlIGNvbnRleHQgZ3JvdXAgbWFwcGluZzogJHtjb250ZXh0R3JvdXBJZH0uYCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dEludGVncml0eUNoZWNrUmVzdWx0ID0gSW50ZXJvcEJyb2tlci5jaGVja0NvbnRleHRJbnRlZ3JpdHkoY29udGV4dCk7XG5cdCAgICAgICAgICAgIGlmIChjb250ZXh0SW50ZWdyaXR5Q2hlY2tSZXN1bHQuaXNWYWxpZCA9PT0gZmFsc2UpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgRmFpbGVkIHRvIHNldCBDb250ZXh0IC0gYmFkIENvbnRleHQuIFJlYXNvbjogJHtjb250ZXh0SW50ZWdyaXR5Q2hlY2tSZXN1bHQucmVhc29ufS4gQ29udGV4dDogJHtKU09OLnN0cmluZ2lmeShjb250ZXh0KX1gKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLW5vbi1udWxsLWFzc2VydGlvblxuXHQgICAgICAgICAgICBjb25zdCBjb250ZXh0R3JvdXBTdGF0ZSA9IHRoaXMuY29udGV4dEdyb3Vwc0J5SWQuZ2V0KGNvbnRleHRHcm91cElkKTtcblx0ICAgICAgICAgICAgY29uc3QgYnJvYWRjYXN0ZWRDb250ZXh0VHlwZSA9IGNvbnRleHQudHlwZTtcblx0ICAgICAgICAgICAgY29udGV4dEdyb3VwU3RhdGUuc2V0KGJyb2FkY2FzdGVkQ29udGV4dFR5cGUsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICB0aGlzLmxhc3RDb250ZXh0TWFwLnNldChjb250ZXh0R3JvdXBJZCwgYnJvYWRjYXN0ZWRDb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgIGNvbnN0IGNsaWVudHNJblNhbWVDb250ZXh0R3JvdXAgPSBBcnJheS5mcm9tKHRoaXMuaW50ZXJvcENsaWVudHMudmFsdWVzKCkpLmZpbHRlcigoY29ubmVjdGVkQ2xpZW50KSA9PiBjb25uZWN0ZWRDbGllbnQuY29udGV4dEdyb3VwSWQgPT09IGNvbnRleHRHcm91cElkKTtcblx0ICAgICAgICAgICAgY2xpZW50c0luU2FtZUNvbnRleHRHcm91cC5mb3JFYWNoKChjbGllbnQpID0+IHtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgWywgaGFuZGxlckluZm9dIG9mIGNsaWVudC5jb250ZXh0SGFuZGxlcnMpIHtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAoSW50ZXJvcEJyb2tlci5pc0NvbnRleHRUeXBlQ29tcGF0aWJsZShicm9hZGNhc3RlZENvbnRleHRUeXBlLCBoYW5kbGVySW5mby5jb250ZXh0VHlwZSkpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnQuY2xpZW50SWRlbn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ICR7dGFyZ2V0Lm5hbWV9YCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgZm9yIChjb25zdCBjb25uZWN0aW9uIG9mIGFsbENvbm5lY3Rpb25zKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcHJvbWlzZXMucHVzaCh0aGlzLmFkZENsaWVudFRvQ29udGV4dEdyb3VwKHsgY29udGV4dEdyb3VwSWQgfSwgY29ubmVjdGlvbikpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgLy8gTm8gdGFyZ2V0IHByb3ZpZGVkLCBhZGQgdGhlIHNlbmRlciB0byB0aGUgY29udGV4dCBncm91cC5cblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy5hZGRDbGllbnRUb0NvbnRleHRHcm91cCh7IGNvbnRleHRHcm91cElkIH0sIHNlbmRlcklkZW50aXR5KTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvLyBhZGRDbGllbnRUb0NvbnRleHRHcm91cCBkb2VzIHRoZSBhY3R1YWwgYWRkaXRpb24gb2YgdGhlIGNsaWVudCB0byB0aGUgQ29udGV4dCBHcm91cFxuXHQgICAgLyoqXG5cdCAgICAgKiBIZWxwZXIgZnVuY3Rpb24gZm9yIHtAbGluayBJbnRlcm9wQnJva2VyI2pvaW5Db250ZXh0R3JvdXAgSW50ZXJvcEJyb2tlci5qb2luQ29udGV4dEdyb3VwfS4gRG9lcyB0aGUgd29yayB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mby5pZCA9PT0gY29udGV4dEdyb3VwSWQpKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQXR0ZW1wdGluZyB0byBqb2luIGEgY29udGV4dCBncm91cCB0aGF0IGRvZXMgbm90IGV4aXN0OiAke2NvbnRleHRHcm91cElkfS4gWW91IG1heSBvbmx5IGpvaW4gZXhpc3RpbmcgY29udGV4dCBncm91cHMuYCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGNvbnN0IG9sZENvbnRleHRHcm91cElkID0gY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUuY29udGV4dEdyb3VwSWQ7XG5cdCAgICAgICAgaWYgKG9sZENvbnRleHRHcm91cElkICE9PSBjb250ZXh0R3JvdXBJZCkge1xuXHQgICAgICAgICAgICBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZS5jb250ZXh0R3JvdXBJZCA9IGNvbnRleHRHcm91cElkO1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLnNldEN1cnJlbnRDb250ZXh0R3JvdXBJbkNsaWVudE9wdGlvbnMoY2xpZW50SWRlbnRpdHksIGNvbnRleHRHcm91cElkKTtcblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dEdyb3VwTWFwID0gdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5nZXQoY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICBmb3IgKGNvbnN0IFssIGhhbmRsZXJJbmZvXSBvZiBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZS5jb250ZXh0SGFuZGxlcnMpIHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IHsgY29udGV4dFR5cGUsIGhhbmRsZXJJZCB9ID0gaGFuZGxlckluZm87XG5cdCAgICAgICAgICAgICAgICBpZiAoY29udGV4dFR5cGUgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFNlbmQgdGhpcyBzaW5nbGUgaGFuZGxlciBhbGwgb2YgdGhlIGNvbnRleHQsIGJlY2F1c2UgaXQgYWNjZXB0cyBhbGwuXG5cdCAgICAgICAgICAgICAgICAgICAgY29udGV4dEdyb3VwTWFwLmZvckVhY2goKGNvbnRleHQsIF8pID0+IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNvbnRleHRHcm91cE1hcC5oYXMoY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgY29udGV4dEZvclR5cGUgPSBjb250ZXh0R3JvdXBNYXAuZ2V0KGNvbnRleHRUeXBlKTtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAoY29udGV4dEZvclR5cGUpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0Rm9yVHlwZSk7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLy8gUmVtb3ZlcyB0aGUgdGFyZ2V0IGZyb20gaXRzIGNvbnRleHQgZ3JvdXAuIFNpbWlsYXIgc3RydWN0dXJlIHRvIGpvaW5Db250ZXh0R3JvdXAuXG5cdCAgICAvKipcblx0ICAgICAqIFJlbW92ZXMgdGhlIHNwZWNpZmllZCB0YXJnZXQgZnJvbSBhIGNvbnRleHQgZ3JvdXAuXG5cdCAgICAgKiBJZiBubyB0YXJnZXQgaXMgc3BlY2lmaWVkLCBpdCByZW1vdmVzIHRoZSBzZW5kZXIgZnJvbSB0aGVpciBjb250ZXh0IGdyb3VwLlxu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LlxuXHQgICAgICAgICAgICBpZiAoSW50ZXJvcEJyb2tlci5oYXNFbmRwb2ludElkKHRhcmdldCkpIHtcblx0ICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVtb3ZlQ2xpZW50RnJvbUNvbnRleHRHcm91cCh0YXJnZXQpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAvLyBTYW5pdHkgY2hlY2sgaGVyZSBpbiBjYXNlIGEgc2luZ2xlIGFwcCBoYXMgbXVsdGlwbGUgY29ubmVjdGlvbnNcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGFsbENvbm5lY3Rpb25zID0gdGhpcy5jaGFubmVsLmNvbm5lY3Rpb25zLmZpbHRlcigoeCkgPT4geC51dWlkID09PSB0YXJnZXQudXVpZCAmJiB4Lm5hbWUgPT09IHRhcmdldC5uYW1lKTtcblx0ICAgICAgICAgICAgICAgIGlmICghYWxsQ29ubmVjdGlvbnMubGVuZ3RoKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBObyBjb25uZWN0aW9uIGZvdW5kIGZvciBnaXZlbiBJZGVudGl0eSAke3RhcmdldC51dWlkfSAke3RhcmdldC5uYW1lfWApO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgaWYgKGFsbENvbm5lY3Rpb25zLmxlbmd0aCA+IDEpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYE1vcmUgdGhhbiBvbmUgY29ubmVjdGlvbiBmb3VuZCBmb3IgaWRlbnRpdHkgJHt0YXJnZXQudXVpZH0gJHt0YXJnZXQubmFtZX1gKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNvbnN0IHByb21pc2VzID0gW107XG5cdCAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGNvbm5lY3Rpb24gb2YgYWxsQ29ubmVjdGlvbn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mRsZXJJbmZvTWFwKSB7XG5cdCAgICAgICAgICAgICAgICBuZXdIYW5kbGVySW5mb01hcC5zZXQoaGFuZGxlcklkLCB7IGlzUmVhZHk6IGZhbHNlLCBwZW5kaW5nSW50ZW50czogW2ludGVudF0gfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNvbnN0IGhhbmRsZXJJbmZvID0gdGFyZ2V0SW5mby5nZXQoaGFuZGxlcklkKTtcblx0ICAgICAgICAgICAgaWYgKCFoYW5kbGVySW5mbykge1xuXHQgICAgICAgICAgICAgICAgdGFyZ2V0SW5mby5zZXQoaGFuZGxlcklkLCB7IGlzUmVhZHk6IGZhbHNlLCBwZW5kaW5nSW50ZW50czogW2ludGVudF0gfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5wZW5kaW5nSW50ZW50cy5wdXNoKGludGVudCk7XG5cdCAgICAgICAgICAgICAgICBpZiAoaGFuZGxlckluZm8uY2xpZW50SWRlbnRpdHkgJiYgaGFuZGxlckluZm8uaXNSZWFkeSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgY2xpZW50SWRlbnRpdHksIHBlbmRpbmdJbnRlbnRzIH0gPSBoYW5kbGVySW5mbztcblx0ICAgICAgICAgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnRlbnRUb1NlbmQgPSBwZW5kaW5nSW50ZW50c1twZW5kaW5nSW50ZW50cy5sZW5ndGggLSAxXTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5pbnZva2VJbnRlbnRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGludGVudFRvU2VuZCk7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZXJJbmZv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7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBJZDogJ29wZW5maW4tYXBwJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnN0YW5jZUlkOiAnM0Q1NEQ0NTZEOUhUMCdcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICogICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoKTtcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBhc3luYyBpbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KSB7XG5cdCAgICAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCB0aGlzLmdldFByb3ZpZGVyKCk7XG5cdCAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgYXdhaXQgcHJvdmlkZXIuZGlzcGF0Y2goY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICBjb25zb2xlLmVycm9yKGBFcnJvciBpbnZva2luZyBjb250ZXh0IGhhbmRsZXIgJHtoYW5kbGVySWR9IGZvciBjb250ZXh0IHR5cGUgJHtjb250ZXh0LnR5cGV9IGluIGNsaWVudCAke2NsaWVudElkZW50aXR5LnV1aWR9LyR7Y2xpZW50SWRlbnRpdHkubmFtZX0vJHtjbGllbnRJZGVudGl0eS5lbmRwb2ludElkfWAsIGVycm9yKTtcblx0IC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AgICogICAgICAgICAgICAgICAgIHJldHVybiBzdXBlci5pbnZva2VJbnRlbnRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgLi4uaW50ZW50LFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAuLi5jb250ZXh0LFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dE1ldGFkYXRhOiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcElkOiAnb3BlbmZpbi1hcHAnLFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnN0YW5jZUlkOiAnM0Q1NEQ0NTZEOUhUMCdcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBpbnRlbnQpIHtcblx0ICAgICAgICBjb25zdCBwcm92aWRlciA9IGF3YWl0IHRoaXMuZ2V0UHJvdmlkZXIoKTtcblx0ICAgICAgICBhd2FpdCBwcm92aWRlci5kaXNwYXRjaChjbGllbnRJZGVudGl0eSwgaGF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92ZXJyaWRlOiBhc3luYyAoSW50ZXJvcEJyb2tlciwgLi4uYXJncykgPT4ge1xuXHQgICAgICogICAgICAgICBjbGFzcyBPdmVycmlkZSBleHRlbmRzIEludGVyb3BCcm9rZXIge1xuXHQgICAgICogICAgICAgICAgICAgYXN5bmMgaGFuZGxlRmlyZWRJbnRlbnQoaW50ZW50KSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgc3VwZXIuc2V0SW50ZW50VGFyZ2V0KGludGVudCwgeyB1dWlkOiAncGxhdGZvcm0tdXVpZCcsIG5hbWU6ICdpbnRlbnQtdmlldycgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgcGxhdGZvcm0gPSBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudFN5bmMoKTtcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCB3aW4gPSBmaW4uV2luZG93LndyYXBTeW5jKHsgbmFtZTogJ2ZvbycsIHV1aWQ6ICdwbGF0Zm9ybS11dWlkJyB9KTtcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCBjcmVhdGVkVmlldyA9IGF3YWl0IHBsYXRmb3JtLmNyZWF0ZVZpZXcoeyB1cmw6ICdodHRwOi8vb3BlbmZpbi5jbycsIG5hbWU6ICdpbnRlbnQtdmlldycgfSwgd2luLmlkZW50aXR5KTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgYWxsQ2xpZW50SW5mbyA9IGF3YWl0IHN1cGVyLmdldEFsbENsaWVudEluZm8oKTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgaW5mb0ZvclRhcmdldCA9IGFsbENsaWVudEluZm8uZmluZCgoY2xpZW50SW5mbykgPT4ge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xpZW50SW5mby51dWlkID09PSAncGxhdGZvcm0tdXVpZCcgJiYgY2xpZW50SW5mby5uYW1lID09PSAnaW50ZW50LXZpZXcnO1xuXHQgICAgICogICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICpcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCBzb3VyY2UgPSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGFwcElkOiAnaW50ZW50LXZpZXcnLFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBpbnN0YW5jZUlkOiBpbmZvRm9yVGFyZ2V0LmVuZHBvaW50SWRcblx0ICAgICAqICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIHJldHVybiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgaW50ZW50OiBpbnRlbnQubmFtZVxuXHQgICAgICogICAgICAgICAgICAgICAgIH1cblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSguLi5hcmdzKTtcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBhc3luYyBnZXRBbGxDbGllbnRJbmZvKCkge1xuXHQgICAgICAgIGNvbnN0IHByb3ZpZGVyID0gYXdhaXQgdGhpcy5nZXRQcm92aWRlcigpO1xuXHQgICAgICAgIHJldHVybiBwcm92aWRlci5nZXRBbGxDbGllbnRJbmZvKCk7XG5cdCAgICB9XG5cdCAgICAvKlxuXHQgICAgU25hcHNob3QgQVBJc1xuXHQgICAgKi9cblx0ICAgIC8vIFVzZWQgdG8gc2F2ZSBpbnRlcm9wIGJyb2tlciBzdGF0ZSBpbiBzbmFwc2hvdHNcblx0ICAgIGRlY29yYXRlU25hcHNob3Qoc25hcHNob3QpIHtcblx0ICAgICAgICByZXR1cm4geyAuLi5zbmFwc2hvdCwgaW50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Gdyb3VwQ29udGV4dHMgPSBjb250ZXh0R3JvdXBTdGF0ZXNbY29udGV4dEdyb3VwSWRdO1xuXHQgICAgICAgICAgICAgICAgZm9yIChjb25zdCBbLCBjb250ZXh0XSBvZiBPYmplY3QuZW50cmllcyhncm91cENvbnRleHRzKSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnRleHRIYW5kbGVycy5mb3JFYWNoKChjb250ZXh0SGFuZGxlcikgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGhhbmRsZXJJZCwgY29udGV4dFR5cGUgfSA9IGNvbnRleHRIYW5kbGVyO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBpZiAoSW50ZXJvcEJyb2tlci5pc0NvbnRleHRUeXBlQ29tcGF0aWJsZShjb250ZXh0LnR5cGUsIGNvbnRleHRUeXBlKSkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdCAgICAvLyBVc2VkIHRvIHN0b3JlIGNvbnRleHQgZ3JvdXAgc3RhdGUgaW4gc25hcHNob3RzXG5cdCAgICBnZXRDb250ZXh0R3JvdXBTdGF0ZXMoKSB7XG5cdCAgICAgICAgcmV0dXJuIEludGVyb3BCcm9rZXIudG9PYmplY3QodGhpcy5jb250ZXh0R3JvdXBzQnlJZCk7XG5cdCAgICB9XG5cdCAgICAvLyBVc2VkIHRvIHJlaHlkcmF0ZSB0aGUgY29udGV4dCBzdGF0ZSBmcm9tIGEgc25hcHNob3Rcblx0ICAgIHJlaHlkcmF0ZUNvbnRleHRHcm91cFN0YXRlcyhpbmNvbWluZ0NvbnRleHRHcm91cFN0YXRlcykge1xuXHQgICAgICAgIGNvbnN0IGNvbnRleHRHcm91cFN0YXRlcyA9IE9iamVjdC5lbnRyaWVzKGluY29taW5nQ29udGV4dEdyb3VwU3RhdGVzKTtcblx0ICAgICAgICBmb3IgKGNvbnN0IFtjb250ZXh0R3JvdXBJZCwgY29udGV4dHNdIG9mIGNvbnRleHRHcm91cFN0YXRlcykge1xuXHQgICAgICAgICAgICBjb25zdCBjb250ZXh0T2JqZWN0cyA9IE9iamVjdC5lbnRyaWVzKGNvbnRleHRzKTtcblx0ICAgICAgICAgICAgZm9yIChjb25zdCBbY29udGV4dFR5cGUsIGNvbnRleHRdIG9mIGNvbnRleHRPYmplY3RzKSB7XG5cdCAgICAgICAgICAgICAgICBpZiAodGhpcy5jb250ZXh0R3JvdXBzQnlJZC5oYXMoY29udGV4dEdyb3VwSWQpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgY3VycmVudENvbnRleHRHcm91cFN0YXRlID0gdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5nZXQoY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRDb250ZXh0R3JvdXBTdGF0ZS5zZXQoY29udGV4dFR5cGUsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBsb2dpYyB3aWxsIGNoYW5nZSB3aGVuIGR5bmFtaWMgY29udGV4dCBncm91cCBjcmVhdGlvbiBjb21lcyBpbi5cblx0ICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYEF0dGVtcHRpbmcgdG8gc2V0IGEgY29udGV4dCBncm91cCB0aGF0IGlzbid0IGluIHRoZSBjb250ZXh0IGdyb3VwIG1hcHBpbmcuIFNraXBwaW5nIGNvbnRleHQgZ3JvdXAgcmVoeWRyYXRpb24gZm9yOiA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AgICAgICAgICAgICAgY29udGV4dEdyb3VwTWFwLmZvckVhY2goKGNvbnRleHQsIF8pID0+IHtcblx0ICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgZWxzZSBpZiAoY29udGV4dEdyb3VwTWFwLmhhcyhjb250ZXh0VHlwZSkpIHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGNvbnRleHRGb3JUeXBlID0gY29udGV4dEdyb3VwTWFwLmdldChjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgICAgICBpZiAoY29udGV4dEZvclR5cGUpIHtcblx0ICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHRGb3JUeXBlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBjbGFzcy1tZXRob2RzLXVzZS10aGlzXG5cdCAgICBhc3luYyBpbnRlbnRIYW5kbGVyUmVnaXN0ZXJlZChwYXlsb2FkLCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IHsgaGFuZGxlcklkIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudEludGVudEluZm8gPSB0aGlzLmludGVudENsaWVudE1hcC5nZXQoY2xpZW50SWRlbnRpdHkubmFtZSk7XG5cdCAgICAgICAgY29uc3QgaGFuZGxlckluZm8gPSBjbGllbnRJbnRlbnRJbmZvPy5nZXQoaGFuZGxlcklkKTtcblx0ICAgICAgICBpZiAoIWNsaWVudEludGVudEluZm8pIHtcblx0ICAgICAgICAgICAgdGhpcy5pbnRlbnRDbGllbnRNYXAuc2V0KGNsaWVudElkZW50aXR5Lm5hbWUsIG5ldyBNYXAoKSk7XG5cdCAgICAgICAgICAgIGNvbnN0IG5ld0hhbmRsZXJJbmZvTWFwID0gdGhpcy5pbnRlbnRDbGllbnRNYXAuZ2V0KGNsaWVudElkZW50aXR5Lm5hbWUpO1xuXHQgICAgICAgICAgICBpZiAobmV3SGFuZGxlckluZm9NYXApIHtcblx0ICAgICAgICAgICAgICAgIG5ld0hhbmRsZXJJbmZvTWFwLnNldChoYW5kbGVySWQsIHsgaXNSZWFkeTogdHJ1ZSwgcGVuZGluZ0ludGVudHM6IFtdLCBjbGllbnRJZGVudGl0eSB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIGlmICghaGFuZGxlckluZm8pIHtcblx0ICAgICAgICAgICAgY2xpZW50SW50ZW50SW5mby5zZXQoaGFuZGxlcklkLCB7IGlzUmVhZHk6IHRydWUsIHBlbmRpbmdJbnRlbnRzOiBbXSwgY2xpZW50SWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICBjb25zdCB7IHBlbmRpbmdJbnRlbnRzIH0gPSBoYW5kbGVySW5mbztcblx0ICAgICAgICAgICAgaGFuZGxlckluZm8uY2xpZW50SWRlbnRpdHkgPSBjbGllbnRJZGVudGl0eTtcblx0ICAgICAgICAgICAgaGFuZGxlckluZm8uaXNSZWFkeSA9IHRydWU7XG5cdCAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICBpZiAocGVuZGluZ0ludGVudHMubGVuZ3RoID4gMCkge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludGVudFRvU2VuZCA9IHBlbmRpbmdJbnRlbnRzW3BlbmRpbmdJbnRlbnRzLmxlbmd0aCAtIDFdO1xuXHQgICAgICAgICAgICAgICAgICAgIGF3YWl0IHR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B7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdObyBjb250ZXh0IHN1cHBsaWVkJyB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAodHlwZW9mIGNvbnRleHQgIT09ICdvYmplY3QnKSB7XG5cdCAgICAgICAgICAgIHJldHVybiB7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdDb250ZXh0IG11c3QgYmUgYW4gT2JqZWN0JyB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoIWNvbnRleHQudHlwZSkge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnQ29udGV4dCBtdXN0IGhhdmUgYSB0eXBlIHByb3BlcnR5JyB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoY29udGV4dC5pZCAmJiB0eXBlb2YgY29udGV4dC5pZCAhPT0gJ29iamVjdCcpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHtcblx0ICAgICAgICAgICAgICAgIGlzVmFsaWQ6IGZhbHNlLFxuXHQgICAgICAgICAgICAgICAgcmVhc29uOiAnQ29udGV4dCBpZCBtdXN0IGJlIGFuIE9iamVjdCBwb3B1bGF0ZWQgd2l0aCBrZXktdmFsdWUgaWRlbnRpZmllcnMgKGlmIHNldCknXG5cdCAgICAgICAgICAgIH07XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChjb250ZXh0LmlkKSB7XG5cdCAgICAgICAgICAgIGNvbnN0IHsgaWQgfSA9IGNvbnRleHQ7XG5cdCAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyhpZCk7XG5cdCAgICAgICAgICAgIGxldCBmb3VuZEJhZElkZW50aWZpZXIgPSBmYWxzZTtcblx0ICAgICAgICAgICAgaWYgKCFrZXlzLmxlbmd0aCkge1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRle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nRpdHlJbmZvLmVudGl0eVR5cGUgPT09ICd2aWV3Jykge1xuXHQgICAgICAgICAgICBlbnRpdHkgPSBhd2FpdCB0aGlzLmZpbi5WaWV3LndyYXAoY2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIGlmIChlbnRpdHlJbmZvLmVudGl0eVR5cGUgPT09ICd3aW5kb3cnKSB7XG5cdCAgICAgICAgICAgIGVudGl0eSA9IGF3YWl0IHRoaXMuZmluLldpbmRvdy53cmFwKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGVudGl0eSkge1xuXHQgICAgICAgICAgICBhd2FpdCBlbnRpdHkudXBkYXRlT3B0aW9ucyh7XG5cdCAgICAgICAgICAgICAgICBpbnRlcm9wOiB7XG5cdCAgICAgICAgICAgICAgICAgICAgY3VycmVudENvbnRleHRHcm91cDogY29udGV4dEdyb3VwSWRcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICBjb25zb2xlLndhcm4oYFNldHRpbmcgQ3VycmVudCBDb250ZXh0IEdyb3VwOiBFbnRpdHkgd2l0aCBpZGVudGl0eSAke2NsaWVudElkZW50aXR5LnV1aWR9LCAke2NsaWVudElkZW50aXR5Lm5hbWV9IGlzIG5vdCBhIHdpbmRvdyBvciB2aWV3LiBJdCBpcyBhICR7ZW50aXR5SW5mby5lbnRpdHlUeXBlfSBpbnN0ZWFkLmApO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIGFzeW5jIHNldHVwQ2hhbm5lbFByb3ZpZGVyKCkge1xuXHQgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgIGNvbnN0IGNoYW5uZWwgPSBhd2FpdCB0aGlzLmdldFByb3ZpZGVyKCk7XG5cdCAgICAgICAgICAgIHRoaXMuY2hhbm5lbCA9IGNoYW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AgIGNvbnN0IGNsaWVudFN1YnNjcmlwdGlvblN0YXRlID0ge1xuXHQgICAgICAgICAgICAgICAgY29udGV4dEdyb3VwSWQ6IHVuZGVmaW5lZCxcblx0ICAgICAgICAgICAgICAgIGNvbnRleHRIYW5kbGVyczogbmV3IE1hcCgpLFxuXHQgICAgICAgICAgICAgICAgY2xpZW50SWRlbnRpdHlcblx0ICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgLy8gT25seSBhbGxvdyB0aGUgY2xpZW50IHRvIGpvaW4gYSBjb250ZXh0R3JvdXAgdGhhdCBhY3R1YWxseSBleGlzdHMuXG5cdCAgICAgICAgICAgIGlmIChwYXlsb2FkPy5jdXJyZW50Q29udGV4dEdyb3VwICYmIHRoaXMuY29udGV4dEdyb3Vwc0J5SWQuaGFzKHBheWxvYWQuY3VycmVudENvbnRleHRHcm91cCkpIHtcblx0ICAgICAgICAgICAgICAgIGNsaWVudFN1YnNjcmlwdGlvblN0YXRlLmNvbnRleHRHcm91cElkID0gcGF5bG9hZD8uY3VycmVudENvbnRleHRHcm91cDtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB0aGlzLmludGVyb3BDbGllbnRzLnNldChjbGllbnRJZGVudGl0eS5lbmRwb2ludElkLCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSk7XG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgY2hhbm5lbC5vbkRpc2Nvbm5lY3Rpb24oKGNsaWVudElkZW50aXR5KSA9PiB7XG5cdCAgICAgICAgICAgIHRoaXMuaW50ZXJvcENsaWVudHMuZGVsZXRlKGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQpO1xuXHQgICAgICAgICAgICBjb25zdCB0YXJnZXRJbmZvID0gdGhpcy5pbnRlbnRDbGllbnRNYXAuZ2V0KGNsaWVudElkZW50aXR5Lm5hbWUpO1xuXHQgICAgICAgICAgICBpZiAodGFyZ2V0SW5mbyAmJiBjbGllbnRJZGVudGl0eS51dWlkID09PSB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bnQgZW50aXR5LlxuICAgICAqXG4gICAgICogQHJlbWFya3MgVGhlIGVudGl0eSBtdXN0IGJlIHBhcnQgb2YgYSBjb250ZXh0IGdyb3VwIGluIG9yZGVyIHNldCBhIGNvbnRleHQuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gY29udGV4dCAtIE5ldyBjb250ZXh0IHRvIHNldC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBzZXRJbnN0cnVtZW50Q29udGV4dCA9IGFzeW5jICh0aWNrZXIpID0+IHtcbiAgICAgKiAgICAgZmluLm1lLmludGVyb3Auc2V0Q29udGV4dCh7dHlwZTogJ2luc3RydW1lbnQnLCBpZDoge3RpY2tlcn19KVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFRoZSB1c2VyIGNsaWNrcyBhbiBpbnN0cnVtZW50IG9mIGludGVyZXN0LiBXZSB3YW50IHRvIHNldCB0aGF0IEluc3RydW1lbnQgY29udGV4dCBzbyB0aGF0IHRoZSByZXN0IG9mIG91ciB3b3JrZmxvdyB1cGRhdGVzIHdpdGggaW5mb3JtYXRpb24gZm9yIHRoYXQgaW5zdHJ1bWVudFxuICAgICAqIGluc3RydW1lbnRFbGVtZW50Lm9uKCdjbGljaycsIChldnQpID0+IHtcbiAgICAgKiAgICAgc2V0SW5zdHJ1bWVudENvbnRleHQoZXZ0LnRpY2tlcilcbiAgICAgKiB9KVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIHNldENvbnRleHQoY29udGV4dCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignaW50ZXJvcC1jbGllbnQtc2V0LWNvbnRleHQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDIodGhpcywgX0ludGVyb3BDbGllbnRfY2xpZW50UHJvbWlzZSwgXCJmXCIpO1xuICAgICAgICByZXR1cm4gY2xpZW50LmRpc3BhdGNoKCdzZXRDb250ZXh0JywgeyBjb250ZXh0IH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBBZGQgYSBjb250ZXh0IGhhbmRsZXIgZm9yIGluY29taW5nIGNvbnRleHQuIElmIGFuIGVudGl0eSBpcyBwYXJ0IG9mIGEgY29udGV4dCBncm91cCwgYW5kIHRoZW4gc2V0cyBpdHMgY29udGV4dCBoYW5kbGVyLFxuICAgICAqIGl0IHdpbGwgcmVjZWl2ZSBhbGwgb2YgaXRzIGRlY2xhcmVkIGNvbnRleHRzLlxuICAgICAqXG4gICAgICogQHBhcmFtIGhhbmRsZXIgLSBIYW5kbGVyIGZvciBpbmNvbWluZyBjb250ZXh0LlxuICAgICAqIEBwYXJhbSBjb250ZXh0VHlwZSAtIFRoZSB0eXBlIG9mIGNvbnRleHQgeW91IHdpc2ggdG8gaGFuZGxlLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGZ1bmN0aW9uIGhhbmRsZUluY29taW5nQ29udGV4dChjb250ZXh0SW5mbykge1xuICAgICAqICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBjb250ZXh0SW5mbztcbiAgICAgKiAgICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICogICAgICAgICBjYXNlICdpbnN0cnVtZW50JzpcbiAgICAgKiAgICAgICAgICAgICBoYW5kbGVJbnN0cnVtZW50Q29udGV4dChjb250ZXh0SW5mbyk7XG4gICAgICogICAgICAgICAgICAgYnJlYWs7XG4gICAgICogICAgICAgICBjYXNlICdjb3VudHJ5JzpcbiAgICAgKiAgICAgICAgICAgICBoYW5kbGVDb3VudHJ5Q29udGV4dChjb250ZXh0SW5mbyk7XG4gICAgICogICAgICAgICAgICAgYnJlYWs7XG4gICAgIC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GVha3MuICBUaGlzIGZlYXR1cmUgaXMgZXhwZXJpbWVudGFsOlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBmdW5jdGlvbiBoYW5kbGVJbnN0cnVtZW50Q29udGV4dChjb250ZXh0SW5mbykge1xuICAgICAqICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBjb250ZXh0SW5mbztcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ2NvbnRleHRJbmZvIGZvciBpbnN0cnVtZW50JywgY29udGV4dEluZm8pXG4gICAgICogfVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gaGFuZGxlQ291bnRyeUNvbnRleHQoY29udGV4dEluZm8pIHtcbiAgICAgKiAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gY29udGV4dEluZm87XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdjb250ZXh0SW5mbyBmb3IgY291bnRyeScsIGNvbnRleHRJbmZvKVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqXG4gICAgICogZmluLm1lLmludGVyb3AuYWRkQ29udGV4dEhhbmRsZXIoaGFuZGxlSW5zdHJ1bWVudENvbnRleHQsICdpbnN0cnVtZW50JylcbiAgICAgKiBmaW4ubWUuaW50ZXJvcC5hZGRDb250ZXh0SGFuZGxlcihoYW5kbGVDb3VudHJ5Q29udGV4dCwgJ2NvdW50cnknKVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGFkZENvbnRleHRIYW5kbGVyKGhhbmRsZXIsIGNvbnRleHRUeXBlKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdpbnRlcm9wLWNsaWVudC1hZGQtY29udGV4dC1oYW5kbGVyJykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZSwgYW5hbHl0aWNzLW9ubHkgY2FsbFxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKHR5cGVvZiBoYW5kbGVyICE9PSAnZnVuY3Rpb24nKS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5kbGVySWQpO1xuICAgICAgICBjbGllbnQucmVnaXN0ZXIoaGFuZGxlcklkLCB3cmFwcGVkSGFuZGxlcik7XG4gICAgICAgIGF3YWl0IGNsaWVudC5kaXNwYXRjaCgnY29udGV4dEhhbmRsZXJSZWdpc3RlcmVkJywgeyBoYW5kbGVySWQsIGNvbnRleHRUeXBlIH0pO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdW5zdWJzY3JpYmU6IGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgICAgICBjbGllbnQucmVtb3ZlKGhhbmRsZXJJZCk7XG4gICAgICAgICAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdyZW1vdmVDb250ZXh0SGFuZGxlcicsIHsgaGFuZGxlcklkIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgIH1cbiAgICAvKlxuICAgIFBsYXRmb3JtIFdpbmRvdyBBUElzXG4gICAgKi9cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBJbnRlcm9wLUJyb2tlci1kZWZpbmVkIGNvbnRleHQgZ3JvdXBzIGF2YWlsYWJsZSBmb3IgYW4gZW50aXR5IHRvIGpvaW4uXG4gICAgICogVXNlZCBieSBQbGF0Zm9ybSBXaW5kb3dzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGZpbi5tZS5pbnRlcm9wLmdldENvbnRleHRHcm91cHMoKVxuICAgICAqICAgICAgICAgLnRoZW4oY29udGV4dEdyb3VwcyA9PiB7XG4gICAgICogICAgICAgICAgICAgY29udGV4dEdyb3Vwcy5mb3JFYWNoKGNvbnRleHRHcm91cCA9PiB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGNvbnRleHRHcm91cC5kaXNwbGF5TWV0YWRhdGEubmFtZSlcbiAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coY29udGV4dEdyb3VwLmRpc3BsYXlNZX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BJbnRlbnRIYW5kbGVyKShoYW5kbGVyLCBoYW5kbGVySWQpO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYXdhaXQgY2xpZW50LnJlZ2lzdGVyKGhhbmRsZXJJZCwgd3JhcHBlZEhhbmRsZXIpO1xuICAgICAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdpbnRlbnRIYW5kbGVyUmVnaXN0ZXJlZCcsIHsgaGFuZGxlcklkLCAuLi5vcHRpb25zIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdVbmFibGUgdG8gcmVnaXN0ZXIgaW50ZW50IGhhbmRsZXInKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdW5zdWJzY3JpYmU6IGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgICAgICBjbGllbnQucmVtb3ZlKGhhbmRsZXJJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEdldHMgdGhlIGxhc3QgY29udGV4dCBvZiB0aGUgQ29udGV4dCBHcm91cCBjdXJyZW50bHkgc3Vic2NyaWJlZCB0by4gSXQgdGFrZXMgYW4gb3B0aW9uYWwgQ29udGV4dCBUeXBlIGFuZCByZXR1cm5zIHRoZVxuICAgICAqIGxhc3QgY29udGV4dCBvZiB0aGF0IHR5cGUuXG4gICAgICogQHBhcmFtIGNvbnRleHRUeXBlXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogYXdhaXQgZmluLm1lLmludGVyb3Auam9pbkNvbnRleHRHcm91cCgneWVsbG93Jyk7XG4gICAgICogYXdhaXQgZmluLm1lLmludGVyb3Auc2V0Q29udGV4dCh7IHR5cGU6ICdpbnN0cnVtZW50JywgaWQ6IHsgdGlja2VyOiAnRk9PJyB9fSk7XG4gICAgICogY29uc3Q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rZXIgPSBlbGVtZW50LmlubmVyVGV4dDtcbiAgICAgKlxuICAgICAqICAgICBjb25zdCBjb250ZXh0ID0ge1xuICAgICAqICAgICAgICAgdHlwZTogJ2ZkYzMuaW5zdHJ1bWVudCcsXG4gICAgICogICAgICAgICBpZDoge1xuICAgICAqICAgICAgICAgICAgIHRpY2tlclxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICpcbiAgICAgKiAgICAgY29uc3QgaW50ZW50UmVzb2x1dGlvbiA9IGF3YWl0IGZpbi5tZS5pbnRlcm9wLmZpcmVJbnRlbnRGb3JDb250ZXh0KGNvbnRleHQpO1xuICAgICAqIH0pXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZmlyZUludGVudEZvckNvbnRleHQoY29udGV4dCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignaW50ZXJvcC1jbGllbnQtZmlyZS1pbnRlbnQtZm9yLWNvbnRleHQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDIodGhpcywgX0ludGVyb3BDbGllbnRfY2xpZW50UHJvbWlzZSwgXCJmXCIpO1xuICAgICAgICByZXR1cm4gY2xpZW50LmRpc3BhdGNoKCdmaXJlSW50ZW50Rm9yQ29udGV4dCcsIGNvbnRleHQpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBKb2luIHRoZSBjdXJyZW50IGVudGl0eSB0byBzZXNzaW9uIGNvbnRleHQgZ3JvdXAgYHNlc3Npb25Db250ZXh0R3JvdXBJZGAgYW5kIHJldHVybiBhIHNlc3Npb25Db250ZXh0R3JvdXAgaW5zdGFuY2UuXG4gICAgICogSWYgdGhlIHNlc3Npb25Db250ZXh0R3JvdXAgZG9lc24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dGlvbihsaXN0ZW5lcikge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignaW50ZXJvcC1jbGllbnQtYWRkLW9uZGlzY29ubmVjdGlvbi1saXN0ZW5lcicpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJldHVybiBjbGllbnQub25EaXNjb25uZWN0aW9uKChldmVudCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyB1dWlkIH0gPSBldmVudDtcbiAgICAgICAgICAgIGxpc3RlbmVyKHsgdHlwZTogJ2ludGVyb3AtYnJva2VyJywgdG9waWM6ICdkaXNjb25uZWN0ZWQnLCBicm9rZXJOYW1lOiB1dWlkIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQGludGVybmFsXG4gICAgICpcbiAgICAgKiBVc2VkIHRvIGZlcnJ5IGZkYzMtb25seSBjYWxscyBmcm9tIHRoZSBmZGMzIHNoaW0gdG8gdGhlIEludGVyb3AgQnJva2VyXG4gICAgICovXG4gICAgc3RhdGljIGFzeW5jIGZlcnJ5RmRjM0NhbGwoaW50ZXJvcENsaWVudCwgYWN0aW9uLCBwYXlsb2FkKSB7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMihpbnRlcm9wQ2xpZW50LCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJldHVybiBjbGllbnQuZGlzcGF0Y2goYWN0aW9uLCBwYXlsb2FkIHx8IG51bGwpO1xuICAgIH1cbn1cbkludGVyb3BDb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XplZC4gQXdhaXQgdGhpcyBvYmplY3QncyByZWFkeSgpIG1ldGhvZC5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBfU25hcHNob3RTb3VyY2Vfc2V0VXBDb25uZWN0aW9uTGlzdGVuZXIuc2V0KHRoaXMsIGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGNoYW5uZWxOYW1lID0gKDAsIHV0aWxzXzEkMS5nZXRTbmFwc2hvdFNvdXJjZUNoYW5uZWxOYW1lKSh0aGlzLmlkZW50aXR5KTtcbiAgICAgICAgICAgIGxldCByZXNvbHZlO1xuICAgICAgICAgICAgbGV0IHJlamVjdDtcbiAgICAgICAgICAgIGNvbnN0IGV2ZW50RmlyZWQgPSBuZXcgUHJvbWlzZSgoeSwgbikgPT4ge1xuICAgICAgICAgICAgICAgIHJlc29sdmUgPSB5O1xuICAgICAgICAgICAgICAgIHJlamVjdCA9IG47XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMSh0aGlzLCBfU25hcHNob3RTb3VyY2VfZ2V0Q29ubmVjdGlvbiwgXCJmXCIpLmNhbGwodGhpcykuZXZlbnRGaXJlZCA9IGV2ZW50RmlyZWQ7XG4gICAgICAgICAgICBjb25zdCBsaXN0ZW5lciA9IGFzeW5jIChlKSA9PiB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2hhbm5lbE5hbWUgPT09IGNoYW5uZWxOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwucmVtb3ZlTGlzdGVuZXIoJ2Nvbm5lY3RlZCcsIGxpc3RlbmVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgIC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9IHtcbiAgICAgKiAgICAgYXN5bmMgZ2V0U25hcHNob3QoKSB7IHJldHVybiAnZm9vJyB9LFxuICAgICAqICAgICBhc3luYyBhcHBseVNuYXBzaG90KHNuYXBzaG90KSB7XG4gICAgICogICAgICAgY29uc29sZS5sb2coc25hcHNob3QpO1xuICAgICAqICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICogICAgIH1cbiAgICAgKiB9XG4gICAgICogYXdhaXQgZmluLlNuYXBzaG90U291cmNlLmluaXQoc25hcHNob3RQcm92aWRlcik7XG4gICAgICpcbiAgICAgKiB0cnkge1xuICAgICAqICAgYXdhaXQgc25hcHNob3RTb3VyY2UucmVhZHkoKTtcbiAgICAgKiAgIGF3YWl0IHNuYXBzaG90U291cmNlLmFwcGx5U25hcHNob3QoJ2ZvbycpO1xuICAgICAqIH0gY2F0Y2ggKGVycikge1xuICAgICAqICAgY29uc29sZS5sb2coZXJyKVxuICAgICAqIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyByZWFkeSgpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NuYXBzaG90LXNvdXJjZS1yZWFkeScpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1hc3luYy1wcm9taXNlLWV4ZWN1dG9yXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICAvLyBJZiBnZXRDbGllbnQgd2FzIGFscmVhZHkgY2FsbGVkIGJlZm9yZSB0aGlzLCBkbyB3ZSBoYXZlIGEgdGltaW5nIGlzc3VlIHdoZXJlIHRoZSBjaGFubmVsIG1pZ2h0IGhhdmUgYmVlbiBjcmVhdGVkIGJ1dCB3ZSBtaXNzZWQgdGhlIGV2ZW50IGJ1dCB0aGlzIHN0aWxsIGZh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ICAgICAgIHJldHVybiBib3VuZHM7XG4gICAgICogICAgICB9LFxuICAgICAqICAgICBhc3luYyBhcHBseVNuYXBzaG90KHNuYXBzaG90KSB7XG4gICAgICogICAgICAgYXdhaXQgZmluLm1lLnNldEJvdW5kcyhzbmFwc2hvdCk7XG4gICAgICogICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICAgKiAgICAgfVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGF3YWl0IGZpbi5TbmFwc2hvdFNvdXJjZS5pbml0KHNuYXBzaG90UHJvdmlkZXIpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICovXG4gICAgYXN5bmMgaW5pdChwcm92aWRlcikge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignc25hcHNob3Qtc291cmNlLWluaXQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAodHlwZW9mIHByb3ZpZGVyICE9PSAnb2JqZWN0JyB8fFxuICAgICAgICAgICAgdHlwZW9mIHByb3ZpZGVyLmdldFNuYXBzaG90ICE9PSAnZnVuY3Rpb24nIHx8XG4gICAgICAgICAgICB0eXBlb2YgcHJvdmlkZXIuYXBwbHlTbmFwc2hvdCAhPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd5b3UgbXVzdCBwYXNzIGluIGEgdmFsaWQgU25hcHNob3RQcm92aWRlcicpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGNoYW5uZWwgPSBhd2FpdCB0aGlzLmZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY3JlYXRlKCgwLCB1dGlsc18xLmdldFNuYXBzaG90U291cmNlQ2hhbm5lbE5hbWUpKHRoaXMuZmluLm1lKSk7XG4gICAgICAgIGNoYW5uZWwucmVnaXN0ZX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1bnRpbWVlcnJvciBjb25zdHJ1Y3RvciB3aWxsIG5vdCBlbmQgd2VsbC5cbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkYXRhLnJlYXNvbiA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgICAgaGFuZGxlTmFjayhkYXRhKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybignUmVjZWl2ZWQgaW52YWxpZCByZXNwb25zZSBmcm9tIGNvcmUnLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgaGFuZGxlTmFjayh7IHJlYXNvbjogJ2ludmFsaWQgcmVzcG9uc2Ugc2hhcGUnIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKCFkYXRhLnBheWxvYWQuc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soZGF0YS5wYXlsb2FkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHJlc29sdmUuY2FsbChudWxsLCBkYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMud2lyZUxpc3RlbmVycy5kZWxldGUoaWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cbn1cbnRyYW5zcG9ydC5UcmFuc3BvcnQgPSBUcmFuc3BvcnQ7XG5fVHJhbnNwb3J0X3dpcmUgPSBuZXcgV2Vha01hcCgpLCBfVHJhbnNwb3J0X2ZpbiA9IG5ldyBXZWFrTWFwKCk7XG5cbnZhciBtb2NrRW52aXJvbm1lbnQgPSB7fTtcblxuT2JqZWN0LmRlZmluZVByb3BlcnR5KG1vY2tFbnZpcm9ubWVudCwgXCJ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HJldHVybiB0aGlzO1xuXG4gICAgICBpZiAobGlzdCA9PT0gbGlzdGVuZXIgfHwgbGlzdC5saXN0ZW5lciA9PT0gbGlzdGVuZXIpIHtcbiAgICAgICAgaWYgKC0tdGhpcy5fZXZlbnRzQ291bnQgPT09IDApXG4gICAgICAgICAgdGhpcy5fZXZlbnRzID0gT2JqZWN0LmNyZWF0ZShudWxsKTtcbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgZGVsZXRlIGV2ZW50c1t0eXBlXTtcbiAgICAgICAgICBpZiAoZXZlbnRzLnJlbW92ZUxpc3RlbmVyKVxuICAgICAgICAgICAgdGhpcy5lbWl0KCdyZW1vdmVMaXN0ZW5lcicsIHR5cGUsIGxpc3QubGlzdGVuZXIgfHwgbGlzdGVuZXIpO1xuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKHR5cGVvZiBsaXN0ICE9PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgIHBvc2l0aW9uID0gLTE7XG5cbiAgICAgICAgZm9yIChpID0gbGlzdC5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xuICAgICAgICAgIGlmIChsaXN0W2ldID09PSBsaXN0ZW5lciB8fCBsaXN0W2ldLmxpc3RlbmVyID09PSBsaXN0ZW5lcikge1xuICAgICAgICAgICAgb3JpZ2luYWxMaXN0ZW5lciA9IGxpc3RbaV0ubGlzdGVuZXI7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IGk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocG9zaXRpb24gPCAwKVxuICAgICAgICAgIHJldHVybiB0aGlzO1xuXG4gICAgICAgIGlmIChwb3NpdGlvbiA9PT0gMClcbiAgICAgICAgICBsaXN0LnNoaWZ0KCk7XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgIHNwbGljZU9uZShsaXN0LCBwb3NpdGlvbik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobGlzdC5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4gICAgdmFyIGluZGV4ID0gLTEsXG4gICAgICAgIGxlbmd0aCA9IGFycmF5Lmxlbmd0aCxcbiAgICAgICAgcmVzSW5kZXggPSAwLFxuICAgICAgICByZXN1bHQgPSBbXTtcblxuICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICB2YXIgdmFsdWUgPSBhcnJheVtpbmRleF07XG4gICAgICBpZiAodmFsdWUgPT09IHBsYWNlaG9sZGVyIHx8IHZhbHVlID09PSBQTEFDRUhPTERFUikge1xuICAgICAgICBhcnJheVtpbmRleF0gPSBQTEFDRUhPTERFUjtcbiAgICAgICAgcmVzdWx0W3Jlc0luZGV4KytdID0gaW5kZXg7XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cblxuICAvKipcbiAgICogQ29udmVydHMgYHNldGAgdG8gYW4gYXJyYXkgb2YgaXRzIHZhbHVlcy5cbiAgICpcbiAgICogQHByaXZhdGVcbiAgICogQHBhcmFtIHtPYmplY3R9IHNldCBUaGUgc2V0IHRvIGNvbnZlcnQuXG4gICAqIEByZXR1cm5zIHtBcnJheX0gUmV0dXJucyB0aGUgdmFsdWVzLlxuICAgKi9cbiAgZnVuY3Rpb24gc2V0VG9BcnJheShzZXQpIHtcbiAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgcmVzdWx0ID0gQXJyYXkoc2V0LnNpemUpO1xuXG4gICAgc2V0LmZvckVhY2goZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgIHJlc3VsdFsrK2luZGV4XSA9IHZhbHVlO1xuICAgIH0pO1xuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cblxuICAvKipcbiAgICogQ29udmVydHMgYHNldGAgdG8gaXRzIHZhbHVlLXZhbHVlIHBhaXJzLlxuICAgKlxuICAgKiBAcHJpdmF0ZVxuICAgKiBAcGFyYW0ge09iamVjdH0gc2V0IFRoZSBzZXQgdG8gY29udmVydC5cbiAgICogQHJldHVybnMge0Fyc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1xuXG4gICAgICBpZiAoIWlzQXJyIHx8ICghaXNSaWdodCAmJiBhcnJMZW5ndGggPT0gbGVuZ3RoICYmIHRha2VDb3VudCA9PSBsZW5ndGgpKSB7XG4gICAgICAgIHJldHVybiBiYXNlV3JhcHBlclZhbHVlKGFycmF5LCB0aGlzLl9fYWN0aW9uc19fKTtcbiAgICAgIH1cbiAgICAgIHZhciByZXN1bHQgPSBbXTtcblxuICAgICAgb3V0ZXI6XG4gICAgICB3aGlsZSAobGVuZ3RoLS0gJiYgcmVzSW5kZXggPCB0YWtlQ291bnQpIHtcbiAgICAgICAgaW5kZXggKz0gZGlyO1xuXG4gICAgICAgIHZhciBpdGVySW5kZXggPSAtMSxcbiAgICAgICAgICAgIHZhbHVlID0gYXJyYXlbaW5kZXhdO1xuXG4gICAgICAgIHdoaWxlICgrK2l0ZXJJbmRleCA8IGl0ZXJMZW5ndGgpIHtcbiAgICAgICAgICB2YXIgZGF0YSA9IGl0ZXJhdGVlc1tpdGVySW5kZXhdLFxuICAgICAgICAgICAgICBpdGVyYXRlZSA9IGRhdGEuaXRlcmF0ZWUsXG4gICAgICAgICAgICAgIHR5cGUgPSBkYXRhLnR5cGUsXG4gICAgICAgICAgICAgIGNvbXB1dGVkID0gaXRlcmF0ZWUodmFsdWUpO1xuXG4gICAgICAgICAgaWYgKHR5cGUgPT0gTEFaWV9NQVBfRkxBRykge1xuICAgICAgICAgICAgdmFsdWUgPSBjb21wdXRlZDtcbiAgICAgICAgICB9IGVsc2UgaWYgKCFjb21wdXRlZCkge1xuICAgICAgICAgICAgaWYgKHR5cGUgPT0gTEFaWV9GSUxURVJfRkxBRykge1xuICAgICAgICAgICAgICBjb250aW51ZSBvdXRlcjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGJyZWFrIG91dGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXN1bHRbcmVzSW5kZXgrK10gPSB2YWx1Z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duUHJvcGVydHkuY2FsbCh2YWx1ZSwga2V5KSkgJiZcbiAgICAgICAgICAgICEoc2tpcEluZGV4ZXMgJiYgKFxuICAgICAgICAgICAgICAgLy8gU2FmYXJpIDkgaGFzIGVudW1lcmFibGUgYGFyZ3VtZW50cy5sZW5ndGhgIGluIHN0cmljdCBtb2RlLlxuICAgICAgICAgICAgICAga2V5ID09ICdsZW5ndGgnIHx8XG4gICAgICAgICAgICAgICAvLyBOb2RlLmpzIDAuMTAgaGFzIGVudW1lcmFibGUgbm9uLWluZGV4IHByb3BlcnRpZXMgb24gYnVmZmVycy5cbiAgICAgICAgICAgICAgIChpc0J1ZmYgJiYgKGtleSA9PSAnb2Zmc2V0JyB8fCBrZXkgPT0gJ3BhcmVudCcpKSB8fFxuICAgICAgICAgICAgICAgLy8gUGhhbnRvbUpTIDIgaGFzIGVudW1lcmFibGUgbm9uLWluZGV4IHByb3BlcnRpZXMgb24gdHlwZWQgYXJyYXlzLlxuICAgICAgICAgICAgICAgKGlzVHlwZSAmJiAoa2V5ID09ICdidWZmZXInIHx8IGtleSA9PSAnYnl0ZUxlbmd0aCcgfHwga2V5ID09ICdieXRlT2Zmc2V0JykpIHx8XG4gICAgICAgICAgICAgICAvLyBTa2lwIGluZGV4IHByb3BlcnRpZXMuXG4gICAgICAgICAgICAgICBpc0luZGV4KGtleSwgbGVuZ3RoKVxuICAgICAgICAgICAgKSkpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEEgc3BlY2lhbGl6ZWQgdmVyc2lvbiBvZiBgXy5zYW1wbGVgIGZvciBhcnJheXMuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBzYW1wbGUuXG4gICAgICogQHJldHVybnMgeyp9IFJldHVybnM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A6IDA7XG4gICAgICAgIGlmICghKHNlZW5cbiAgICAgICAgICAgICAgPyBjYWNoZUhhcyhzZWVuLCBjb21wdXRlZClcbiAgICAgICAgICAgICAgOiBpbmNsdWRlcyhyZXN1bHQsIGNvbXB1dGVkLCBjb21wYXJhdG9yKVxuICAgICAgICAgICAgKSkge1xuICAgICAgICAgIG90aEluZGV4ID0gb3RoTGVuZ3RoO1xuICAgICAgICAgIHdoaWxlICgtLW90aEluZGV4KSB7XG4gICAgICAgICAgICB2YXIgY2FjaGUgPSBjYWNoZXNbb3RoSW5kZXhdO1xuICAgICAgICAgICAgaWYgKCEoY2FjaGVcbiAgICAgICAgICAgICAgICAgID8gY2FjaGVIYXMoY2FjaGUsIGNvbXB1dGVkKVxuICAgICAgICAgICAgICAgICAgOiBpbmNsdWRlcyhhcnJheXNbb3RoSW5kZXhdLCBjb21wdXRlZCwgY29tcGFyYXRvcikpXG4gICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgIGNvbnRpbnVlIG91dGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc2Vlbikge1xuICAgICAgICAgICAgc2Vlbi5wdXNoKGNvbXB1dGVkKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0LnB1c2godmFsdWUpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmludmVydGAgYW5kIGBfLmludmVydEJ5YCB3aGljaCBpbnZlcnRzXG4gICAgICogYG9iamVjdGAgd2l0aCB2YWx1ZXMgdHJhbnNmb3JtZWQgYnkgYGl0ZXJhdGVlYCBhbmQgc2V0IGJ5IGBzZXR0ZXJgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8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jdCkpIHtcbiAgICAgICAgaWYgKGhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBrZXkpICYmIGtleSAhPSAnY29uc3RydWN0b3InKSB7XG4gICAgICAgICAgcmVzdWx0LnB1c2goa2V5KTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBUaGUgYmFzZSBpbXBsZW1lbnRhdGlvbiBvZiBgXy5rZXlzSW5gIHdoaWNoIGRvZXNuJ3QgdHJlYXQgc3BhcnNlIGFycmF5cyBhcyBkZW5zZS5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgb2JqZWN0IHRvIHF1ZXJ5LlxuICAgICAqIEByZXR1cm5zIHtBcnJheX0gUmV0dXJucyB0aGUgYXJyYXkgb2YgcHJvcGVydHkgbmFtZXMuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZUtleXNJbihvYmplY3QpIHtcbiAgICAgIGlmICghaXNPYmplY3Qob2JqZWN0KSkge1xuICAgICAgICByZXR1cm4gbmF0aXZlS2V5c0luKG9iamVjdCk7XG4gICAgICB9XG4gICAgICB2YXIgaXNQcm90byA9IGlzUHJvdG90eXBlKG9iamVjdCksXG4gICAgICAgICAgcmVzdWx0ID0gW107XG5cbiAgICAgIGZvciAodmFyIGtleSBpbiBvYmplY3QpIHtcbiAgICAgICAgaWYgKCEoa2V5ID09ICdjb25zdHJ1Y3RvcicgJiYgKGlzUHJvdG8gfHwgIWhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBrZXkpKSkpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmx0YCB3aGlja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IGNhY2hlSGFzO1xuICAgICAgICBzZWVuID0gbmV3IFNldENhY2hlO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIHNlZW4gPSBpdGVyYXRlZSA/IFtdIDogcmVzdWx0O1xuICAgICAgfVxuICAgICAgb3V0ZXI6XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIgdmFsdWUgPSBhcnJheVtpbmRleF0sXG4gICAgICAgICAgICBjb21wdXRlZCA9IGl0ZXJhdGVlID8gaXRlcmF0ZWUodmFsdWUpIDogdmFsdWU7XG5cbiAgICAgICAgdmFsdWUgPSAoY29tcGFyYXRvciB8fCB2YWx1ZSAhPT0gMCkgPyB2YWx1ZSA6IDA7XG4gICAgICAgIGlmIChpc0NvbW1vbiAmJiBjb21wdXRlZCA9PT0gY29tcHV0ZWQpIHtcbiAgICAgICAgICB2YXIgc2VlbkluZGV4ID0gc2Vlbi5sZW5ndGg7XG4gICAgICAgICAgd2hpbGUgKHNlZW5JbmRleC0tKSB7XG4gICAgICAgICAgICBpZiAoc2VlbltzZWVuSW5kZXhdID09PSBjb21wdXRlZCkge1xuICAgICAgICAgICAgICBjb250aW51ZSBvdXRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGl0ZXJhdGVlKSB7XG4gICAgICAgICAgICBzZWVuLnB1c2goY29tcHV0ZWQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQucHVzaCh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoIWluY2x1ZGVzKHNlZW4sIGNvbXB1dGVkLCBjb21wYXJhdG9yKSkge1xuICAgICAgICAgIGlmIChzZWVuICE9PSByZXN1bHQpIHtcbiAgICAgICAgICAgIHNlZW4ucHVzaChjb21wdXRlZCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlc3VsdC5wdXNoKHZhbHVlKTtcbiAgICAgICAgfVxuICA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gdmFsdWVgLlxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGNvbXBhcmVBc2NlbmRpbmcodmFsdWUsIG90aGVyKSB7XG4gICAgICBpZiAodmFsdWUgIT09IG90aGVyKSB7XG4gICAgICAgIHZhciB2YWxJc0RlZmluZWQgPSB2YWx1ZSAhPT0gdW5kZWZpbmVkLFxuICAgICAgICAgICAgdmFsSXNOdWxsID0gdmFsdWUgPT09IG51bGwsXG4gICAgICAgICAgICB2YWxJc1JlZmxleGl2ZSA9IHZhbHVlID09PSB2YWx1ZSxcbiAgICAgICAgICAgIHZhbElzU3ltYm9sID0gaXNTeW1ib2wodmFsdWUpO1xuXG4gICAgICAgIHZhciBvdGhJc0RlZmluZWQgPSBvdGhlciAhPT0gdW5kZWZpbmVkLFxuICAgICAgICAgICAgb3RoSXNOdWxsID0gb3RoZXIgPT09IG51bGwsXG4gICAgICAgICAgICBvdGhJc1JlZmxleGl2ZSA9IG90aGVyID09PSBvdGhlcixcbiAgICAgICAgICAgIG90aElzU3ltYm9sID0gaXNTeW1ib2wob3RoZXIpO1xuXG4gICAgICAgIGlmICgoIW90aElzTnVsbCAmJiAhb3RoSXNTeW1ib2wgJiYgIXZhbElzU3ltYm9sICYmIHZhbHVlID4gb3RoZXIpIHx8XG4gICAgICAgICAgICAodmFsSXNTeW1ib2wgJiYgb3RoSXNEZWZpbmVkICYmIG90aElzUmVmbGV4aXZlICYmICFvdGhJc051bGwgJiYgIW90aElzU3ltYm9sKSB8fFxuICAgICAgICAgICAgKHZhbElzTnVsbCAmJiBvdGhJc0RlZmluZWQgJiYgb3RoSXNSZWZsZXhpdmUpIHx8XG4gICAgICAgICAgICAoIXZhbElzRGVmaW5lZCAmJiBvdGhJc1JlZmxleGl2ZSkgfHxcbiAgICAgICAgICAgICF2YWxJc1JlZmxleGl2ZSkge1xuICAgICAgICAgIHJldHVybiAxO1xuICAgICAgICB9XG4gICAgICAgIGlmICgoIXZhbElzTnVsbCAmJiAhdmFsSXNTeW1ib2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IG9iamVjdCwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGlzTmV3ID0gIW9iamVjdDtcbiAgICAgIG9iamVjdCB8fCAob2JqZWN0ID0ge30pO1xuXG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBsZW5ndGggPSBwcm9wcy5sZW5ndGg7XG5cbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgIHZhciBrZXkgPSBwcm9wc1tpbmRleF07XG5cbiAgICAgICAgdmFyIG5ld1ZhbHVlID0gY3VzdG9taXplclxuICAgICAgICAgID8gY3VzdG9taXplcihvYmplY3Rba2V5XSwgc291cmNlW2tleV0sIGtleSwgb2JqZWN0LCBzb3VyY2UpXG4gICAgICAgICAgOiB1bmRlZmluZWQ7XG5cbiAgICAgICAgaWYgKG5ld1ZhbHVlID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBuZXdWYWx1ZSA9IHNvdXJjZVtrZXldO1xuICAgICAgICB9XG4gICAgICAgIGlmIChpc05ldykge1xuICAgICAgICAgIGJhc2VBc3NpZ25WYWx1ZShvYmplY3QsIGtleSwgbmV3VmFsdWUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGFzc2lnblZhbHVlKG9iamVjdCwga2V5LCBuZXdWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29waWVzIG93biBzeW1ib2xzIG9mIGBzb3VyY2VgIHRvIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc291cmNlIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIGZyb20uXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvYmplY3Q9e31dIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIHRvLlxuICAgICAqIEByZXR1cm5zIHtP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Z3RoID0gb3RoZXIubGVuZ3RoO1xuXG4gICAgICBpZiAoYXJyTGVuZ3RoICE9IG90aExlbmd0aCAmJiAhKGlzUGFydGlhbCAmJiBvdGhMZW5ndGggPiBhcnJMZW5ndGgpKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cbiAgICAgIC8vIENoZWNrIHRoYXQgY3ljbGljIHZhbHVlcyBhcmUgZXF1YWwuXG4gICAgICB2YXIgYXJyU3RhY2tlZCA9IHN0YWNrLmdldChhcnJheSk7XG4gICAgICB2YXIgb3RoU3RhY2tlZCA9IHN0YWNrLmdldChvdGhlcik7XG4gICAgICBpZiAoYXJyU3RhY2tlZCAmJiBvdGhTdGFja2VkKSB7XG4gICAgICAgIHJldHVybiBhcnJTdGFja2VkID09IG90aGVyICYmIG90aFN0YWNrZWQgPT0gYXJyYXk7XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICByZXN1bHQgPSB0cnVlLFxuICAgICAgICAgIHNlZW4gPSAoYml0bWFzayAmIENPTVBBUkVfVU5PUkRFUkVEX0ZMQUcpID8gbmV3IFNldENhY2hlIDogdW5kZWZpbmVkO1xuXG4gICAgICBzdGFjay5zZXQoYXJyYXksIG90aGVyKTtcbiAgICAgIHN0YWNrLnNldChvdGhlciwgYXJyYXkpO1xuXG4gICAgICAvLyBJZ25vcmUgbm9uLWluZGV4IHByb3BlcnRpZXMuXG4gICAgICB3aGlsZSAoKytpbmRleCA8IGFyckxlbmd0aCkge1xuICAgICAgICB2YXIgYXJyVmFsdWUgPSBhcnJheVtpbmRleF0sXG4gICAgICAgICAgICBvdGhWYWx1ZSA9IG90aGVyW2luZGV4XTtcblxuICAgICAgICBpZiAoY3VzdG9taXplcikge1xuICAgICAgICAgIHZhciBjb21wYXJlZCA9IGlzUGFydGlhbFxuICAgICAgICAgICAgPyBjdXN0b21pemVyKG90aFZhbHVlLCBhcnJWYWx1ZSwgaW5kZXgsIG90aGVyLCBhcnJheSwgc3RhY2spXG4gICAgICAgICAgICA6IGN1c3RvbWl6ZXIoYXJyVmFsdWUsIG90aFZhbHVlLCBpbmRleCwgYXJyYXksIG90aGVyLCBzdGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvbXBhcmVkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBpZiAoY29tcGFyZWQpIHtcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICAvLyBSZWN1cnNpdmVseSBjb21wYXJlIGFycmF5cyAoc3VzY2VwdGlibGUgdG8gY2FsbCBzdGFjayBsaW1pdHMpLlxuICAgICAgICBpZiAoc2Vlbikge1xuICAgICAgICAgIGlmICghYXJyYXlTb21lKG90aGVyLCBmdW5jdGlvbihvdGhWYWx1ZSwgb3RoSW5kZXgpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWNhY2hlSGFzKHNlZW4sIG90aEluZGV4KSAmJlxuICAgICAgICAgICAgICAgICAgICAoYXJyVmFsdWUgPT09IG90aFZhbHVlIHx8IGVxdWFsRnVuYyhhcnJWYWx1ZSwgb3RoVmFsdWUsIGJpdG1hc2ssIGN1c3RvbWl6ZXIsIHN0YWNrKSkpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiBzZWVuLnB1c2gob3RoSW5kZXgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSkpIHtcbiAgICAgICAgICAgIHJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKCEoXG4gICAgICAgICAgICAgIGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fFxuICAgICAgICAgICAgICAgIGVxdWFsRnVuYyhhcnJWYWx1ZSwgb3RoVmFsdWUsIGJpdG1hc2ssIGN1c3RvbWl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XG4gICAgICAgICAgY29udmVydCB8fCAoY29udmVydCA9IHNldFRvQXJyYXkpO1xuXG4gICAgICAgICAgaWYgKG9iamVjdC5zaXplICE9IG90aGVyLnNpemUgJiYgIWlzUGFydGlhbCkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgICAvLyBBc3N1bWUgY3ljbGljIHZhbHVlcyBhcmUgZXF1YWwuXG4gICAgICAgICAgdmFyIHN0YWNrZWQgPSBzdGFjay5nZXQob2JqZWN0KTtcbiAgICAgICAgICBpZiAoc3RhY2tlZCkge1xuICAgICAgICAgICAgcmV0dXJuIHN0YWNrZWQgPT0gb3RoZXI7XG4gICAgICAgICAgfVxuICAgICAgICAgIGJpdG1hc2sgfD0gQ09NUEFSRV9VTk9SREVSRURfRkxBRztcblxuICAgICAgICAgIC8vIFJlY3Vyc2l2ZWx5IGNvbXBhcmUgb2JqZWN0cyAoc3VzY2VwdGlibGUgdG8gY2FsbCBzdGFjayBsaW1pdHMpLlxuICAgICAgICAgIHN0YWNrLnNldChvYmplY3QsIG90aGVyKTtcbiAgICAgICAgICB2YXIgcmVzdWx0ID0gZXF1YWxBcnJheXMoY29udmVydChvYmplY3QpLCBjb252ZXJ0KG90aGVyKSwgYml0bWFzaywgY3VzdG9taXplciwgZXF1YWxGdW5jLCBzdGFjayk7XG4gICAgICAgICAgc3RhY2tbJ2RlbGV0ZSddKG9iamVjdCk7XG4gICAgICAgICAgcmV0dXJuIHJlc3VsdDtcblxuICAgICAgICBjYXNlIHN5bWJvbFRhZzpcbiAgICAgICAgICBpZiAoc3ltYm9sVmFsdWVPZikge1xuICAgICAgICAgICAgcmV0dXJuIHN5bWJvbFZhbHVlT2YuY2FsbChvYmplY3QpID09IHN5bWJvbFZhbHVlT2YuY2FsbChvdGhlcik7XG4gICAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEEgc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pbmRleCA8IG9iakxlbmd0aCkge1xuICAgICAgICBrZXkgPSBvYmpQcm9wc1tpbmRleF07XG4gICAgICAgIHZhciBvYmpWYWx1ZSA9IG9iamVjdFtrZXldLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltrZXldO1xuXG4gICAgICAgIGlmIChjdXN0b21pemVyKSB7XG4gICAgICAgICAgdmFyIGNvbXBhcmVkID0gaXNQYXJ0aWFsXG4gICAgICAgICAgICA/IGN1c3RvbWl6ZXIob3RoVmFsdWUsIG9ialZhbHVlLCBrZXksIG90aGVyLCBvYmplY3QsIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKG9ialZhbHVlLCBvdGhWYWx1ZSwga2V5LCBvYmplY3QsIG90aGVyLCBzdGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBvYmplY3RzIChzdXNjZXB0aWJsZSB0byBjYWxsIHN0YWNrIGxpbWl0cykuXG4gICAgICAgIGlmICghKGNvbXBhcmVkID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgPyAob2JqVmFsdWUgPT09IG90aFZhbHVlIHx8IGVxdWFsRnVuYyhvYmpWYWx1ZSwgb3RoVmFsdWUsIGJpdG1hc2ssIGN1c3RvbWl6ZXIsIHN0YWNrKSlcbiAgICAgICAgICAgICAgOiBjb21wYXJlZFxuICAgICAgICAgICAgKSkge1xuICAgICAgICAgIHJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIHNraXBDdG9yIHx8IChza2lwQ3RvciA9IGtleSA9PSAnY29uc3RydWN0b3InKTtcbiAgICAgIH1cbiAgICAgIGlmIChyZXN1bHQgJiYgIXNraXBDdG9yKSB7XG4gICAgICAgIHZhciBvYmpDdG9yID0gb2JqZWN0LmNvbnN0cnVjdG9yLFxuICAgICAgICAgICAgb3RoQ3RvciA9IG90aGVyLmNvbnN0cnVjdG9yO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0gey4uLip9IFt2YWx1ZXNdIFRoZSB2YWx1ZXMgdG8gY29uY2F0ZW5hdGUuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBuZXcgY29uY2F0ZW5hdGVkIGFycmF5LlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMV07XG4gICAgICogdmFyIG90aGVyID0gXy5jb25jYXQoYXJyYXksIDIsIFszXSwgW1s0XV0pO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2cob3RoZXIpO1xuICAgICAqIC8vID0+IFsxLCAyLCAzLCBbNF1dXG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhhcnJheSk7XG4gICAgICogLy8gPT4gWzFdXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29uY2F0KCkge1xuICAgICAgdmFyIGxlbmd0aCA9IGFyZ3VtZW50cy5sZW5ndGg7XG4gICAgICBpZiAoIWxlbmd0aCkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICB2YXIgYXJncyA9IEFycmF5KGxlbmd0aCAtIDEpLFxuICAgICAgICAgIGFycmF5ID0gYXJndW1lbnRzWzBdLFxuICAgICAgICAgIGluZGV4ID0gbGVuZ3RoO1xuXG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICBhcmdzW2luZGV4IC0gMV0gPSBhcmd1bWVudHNbaW5kZXhdO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGFycmF5UHVzaChpc0FycmF5KGFycmF5KSA/IGNvcHlBcnJheShhcnJheSkgOiBbYXJyYXldLCBiYXNlRmxhdHRlbihhcmdzLCAxKSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ3JlYXRlcyBhbiBhcnJheSBvZiBgYXJyYXlgIHZhbHVlcyBub3QgaW5jbHVkZWQgaW4gdGhlIG90aGVyIGdpdmVuIGFycmF5c1xuICAgICAqIHVzaW5nIFtgU2FtZVZhbHVlWm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NlY29uZCBvZiBkZWJvdW5jZWQgY2FsbHMuXG4gICAgICogdmFyIGRlYm91bmNlZCA9IF8uZGVib3VuY2UoYmF0Y2hMb2csIDI1MCwgeyAnbWF4V2FpdCc6IDEwMDAgfSk7XG4gICAgICogdmFyIHNvdXJjZSA9IG5ldyBFdmVudFNvdXJjZSgnL3N0cmVhbScpO1xuICAgICAqIGpRdWVyeShzb3VyY2UpLm9uKCdtZXNzYWdlJywgZGVib3VuY2VkKTtcbiAgICAgKlxuICAgICAqIC8vIENhbmNlbCB0aGUgdHJhaWxpbmcgZGVib3VuY2VkIGludm9jYXRpb24uXG4gICAgICogalF1ZXJ5KHdpbmRvdykub24oJ3BvcHN0YXRlJywgZGVib3VuY2VkLmNhbmNlbCk7XG4gICAgICovXG4gICAgZnVuY3Rpb24gZGVib3VuY2UoZnVuYywgd2FpdCwgb3B0aW9ucykge1xuICAgICAgdmFyIGxhc3RBcmdzLFxuICAgICAgICAgIGxhc3RUaGlzLFxuICAgICAgICAgIG1heFdhaXQsXG4gICAgICAgICAgcmVzdWx0LFxuICAgICAgICAgIHRpbWVySWQsXG4gICAgICAgICAgbGFzdENhbGxUaW1lLFxuICAgICAgICAgIGxhc3RJbnZva2VUaW1lID0gMCxcbiAgICAgICAgICBsZWFkaW5nID0gZmFsc2UsXG4gICAgICAgICAgbWF4aW5nID0gZmFsc2UsXG4gICAgICAgICAgdHJhaWxpbmcgPSB0cnVlO1xuXG4gICAgICBpZiAodHlwZW9mIGZ1bmMgIT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKEZVTkNfRVJST1JfVEVYVCk7XG4gICAgICB9XG4gICAgICB3YWl0ID0gdG9OdW1iZXIod2FpdCkgfHwgMDtcbiAgICAgIGlmIChpc09iamVjdChvcHRpb25zKSkge1xuICAgICAgICBsZWFkaW5nID0gISFvcHRpb25zLmxlYWRpbmc7XG4gICAgICAgIG1heGluZyA9ICdtYXhXYWl0JyBpbiBvc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4cGlyZWQoKSB7XG4gICAgICAgIHZhciB0aW1lID0gbm93KCk7XG4gICAgICAgIGlmIChzaG91bGRJbnZva2UodGltZSkpIHtcbiAgICAgICAgICByZXR1cm4gdHJhaWxpbmdFZGdlKHRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIC8vIFJlc3RhcnQgdGhlIHRpbWVyLlxuICAgICAgICB0aW1lcklkID0gc2V0VGltZW91dCh0aW1lckV4cGlyZWQsIHJlbWFpbmluZ1dhaXQodGltZSkpO1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiB0cmFpbGluZ0VkZ2UodGltZSkge1xuICAgICAgICB0aW1lcklkID0gdW5kZWZpbmVkO1xuXG4gICAgICAgIC8vIE9ubHkgaW52b2tlIGlmIHdlIGhhdmUgYGxhc3RBcmdzYCB3aGljaCBtZWFucyBgZnVuY2AgaGFzIGJlZW5cbiAgICAgICAgLy8gZGVib3VuY2VkIGF0IGxlYXN0IG9uY2UuXG4gICAgICAgIGlmICh0cmFpbGluZyAmJiBsYXN0QXJncykge1xuICAgICAgICAgIHJldHVybiBpbnZva2VGdW5jKHRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGxhc3RBcmdzID0gbGFzdFRoaXMgPSB1bmRlZmluZWQ7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICB9XG5cbiAgICAgIGZ1bmN0aW9uIGNhbmNlbCgpIHtcbiAgICAgICAgaWYgKHRpbWVySWQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lcklkKTtcbiAgICAgICAgfVxuICAgICAgICBsYXN0SW52b2tlVGltZSA9IDA7XG4gICAgICAgIGxhc3RBcmdzID0gbGFzdENhbGxUaW1lID0gbGFzdFRoaXMgPSB0aW1lcklkID0gdW5kZWZpbmVkO1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBmbHVzaCgpIHtcbiAgICAgICAgcmV0dXJuIHRpbWVySWQgPT09IHVuZGVmaW5lZCA/IHJlc3VsdCA6IHRyYWlsaW5nRWRnZShub3coKSk7XG4gICAgICB9XG5cbiAgICAgIGZ1bmN0aW9uIGRlYm91bmNlZCgpIHtcbiAgICAgICAgdmFyIHRpbWUgPSBub3coKSxcbiAgICAgICAgICAgIGlzSW52b2tpbmcgPSBzaG91bGRJbnZva2UodGltZSk7XG5cbiAgICAgICAgbGFzdEFyZ3MgPSBhcmd1bWVudHM7XG4gICAgICAgIGxhc3RUaGlzID0gdGhpcztcbiAgICAgICAgbGFzdENhbGxUaW1lID0gdGltZTtcblxuICAgICAgICBpZiAoaXNJbnZva2luZykge1xuICAgICAgICAgIGlmICh0aW1lcklkID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBsZWFkaW5nRWRnZShsYXN0Q2FsbFRpbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAobWF4aW5nKSB7XG4gICAgICAgICAgICAvLyBIYW5kbGUgaW52b2NhdGlvbnMgaW4gYSB0aWdodCBsb29wLlxuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVySWQpO1xuICAgICAgICAgICAgdGltZXJJZCA9IHNldFRpbWVvdXQodGltZXJFeHBpcmVkLCB3YWl0KTtcbiAgICAgICAgICAgIHJldHVybiBpbnZva2VGdW5jKGxhc3RDYWxsVGltZSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aW1lcklkID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICB0aW1lcklkID0gc2V0VGltZW91dCh0aW1lckV4cGlyZWQsIHdhaXQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICB9XG4gICAgICBkZWJvdW5jZWQuY2FuY2VsID0gY2FuY2VsO1xuICAgICAgZGVib3VuY2VkLmZsdXNoID0gZmx1c2g7XG4gICAgICByZXR1cm4gZGVib3VuY2VkO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIERlZmVycyBpbnZ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8fCBpc0FycmF5TGlrZShzb3VyY2UpKSB7XG4gICAgICAgIGNvcHlPYmplY3Qoc291cmNlLCBrZXlzKHNvdXJjZSksIG9iamVjdCk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cbiAgICAgIGZvciAodmFyIGtleSBpbiBzb3VyY2UpIHtcbiAgICAgICAgaWYgKGhhc093blByb3BlcnR5LmNhbGwoc291cmNlLCBrZXkpKSB7XG4gICAgICAgICAgYXNzaWduVmFsdWUob2JqZWN0LCBrZXksIHNvdXJjZVtrZXldKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0pO1xuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgaXMgbGlrZSBgXy5hc3NpZ25gIGV4Y2VwdCB0aGF0IGl0IGl0ZXJhdGVzIG92ZXIgb3duIGFuZFxuICAgICAqIGluaGVyaXRlZCBzb3VyY2UgcHJvcGVydGllcy5cbiAgICAgKlxuICAgICAqICoqTm90ZToqKiBUaGlzIG1ldGhvZCBtdXRhdGVzIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMC4wXG4gICAgICogQGFsaWFzIGV4dGVuZFxuICAgICAqIEBjYXRlZ29yeSBPYmplY3RcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBkZXN0aW5hdGlvbiBvYmplY3QuXG4gICAgICogQHBhcmFtIHsuLi5PYmplY3R9IFtzb3VyY2VzXSBUaGUgc291cmNlIG9iamVjdHMuXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKiBAc2VlIF8uYXNzaWduXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIGZ1bmN0aW9uIEZvbygpIHtcbiAgICAgKiAgIHRoaXMuYSA9IDE7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gQmFyKCkge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IHNvdXJjZSA9IChpc0V2YWx1YXRpbmcgPyBzb3VyY2UucmVwbGFjZShyZUVtcHR5U3RyaW5nTGVhZGluZywgJycpIDogc291cmNlKVxuICAgICAgICAucmVwbGFjZShyZUVtcHR5U3RyaW5nTWlkZGxlLCAnJDEnKVxuICAgICAgICAucmVwbGFjZShyZUVtcHR5U3RyaW5nVHJhaWxpbmcsICckMTsnKTtcblxuICAgICAgLy8gRnJhbWUgY29kZSBhcyB0aGUgZnVuY3Rpb24gYm9keS5cbiAgICAgIHNvdXJjZSA9ICdmdW5jdGlvbignICsgKHZhcmlhYmxlIHx8ICdvYmonKSArICcpIHtcXG4nICtcbiAgICAgICAgKHZhcmlhYmxlXG4gICAgICAgICAgPyAnJ1xuICAgICAgICAgIDogJ29iaiB8fCAob2JqID0ge30pO1xcbidcbiAgICAgICAgKSArXG4gICAgICAgIFwidmFyIF9fdCwgX19wID0gJydcIiArXG4gICAgICAgIChpc0VzY2FwaW5nXG4gICAgICAgICAgID8gJywgX19lID0gXy5lc2NhcGUnXG4gICAgICAgICAgIDogJydcbiAgICAgICAgKSArXG4gICAgICAgIChpc0V2YWx1YXRpbmdcbiAgICAgICAgICA/ICcsIF9faiA9IEFycmF5LnByb3RvdHlwZS5qb2luO1xcbicgK1xuICAgICAgICAgICAgXCJmdW5jdGlvbiBwcmludCgpIHsgX19wICs9IF9fai5jYWxsKGFyZ3VtZW50cywgJycpIH1cXG5cIlxuICAgICAgICAgIDogJztcXG4nXG4gICAgICAgICkgK1xuICAgICAgICBzb3VyY2UgK1xuICAgICAgICAncmV0dXJuIF9fcFxcbn0nO1xuXG4gICAgICB2YXIgcmVzdWx0ID0gYXR0ZW1wdChmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIEZ1bmN0aW9uKGltcG9ydHNLZXlzLCBzb3VyY2VVUkwgKyAncmV0dXJuICcgKyBzb3VyY2UpXG4gICAgICAgICAgLmFwcGx5KHVuZGVmaW5lZCwgaW1wb3J0c1ZhbHVl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IHtcbiAgICAgICAgICBvYmplY3QucHJvdG90eXBlW21ldGhvZE5hbWVdID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgY2hhaW5BbGwgPSB0aGlzLl9fY2hhaW5fXztcbiAgICAgICAgICAgIGlmIChjaGFpbiB8fCBjaGFpbkFsbCkge1xuICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gb2JqZWN0KHRoaXMuX193cmFwcGVkX18pLFxuICAgICAgICAgICAgICAgICAgYWN0aW9ucyA9IHJlc3VsdC5fX2FjdGlvbnNfXyA9IGNvcHlBcnJheSh0aGlzLl9fYWN0aW9uc19fKTtcblxuICAgICAgICAgICAgICBhY3Rpb25zLnB1c2goeyAnZnVuYyc6IGZ1bmMsICdhcmdzJzogYXJndW1lbnRzLCAndGhpc0FyZyc6IG9iamVjdCB9KTtcbiAgICAgICAgICAgICAgcmVzdWx0Ll9fY2hhaW5fXyA9IGNoYWluQWxsO1xuICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZ1bmMuYXBwbHkob2JqZWN0LCBhcnJheVB1c2goW3RoaXMudmFsdWUoKV0sIGFyZ3VtZW50cykpO1xuICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgIH0pO1xuXG4gICAgICByZXR1cm4gb2JqZWN0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldmVydHMgdGhlIGBfYCB2YXJpYWJsZSB0byBpdHMgcHJldmlvdXMgdmFsdWUgYW5kIHJldHVybnMgYSByZWZlcmVuY2UgdG9cbiAgICAgKiB0aGUgYGxvZGFzaGAgZnVuY3Rpb24uXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgVXRpbFxuICAgICAqIEByZXR1cm5zIHtGdW5jdGlvbn0gUmV0dXJucyB0aGUgY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odCgwLCAtNCwgLTEpO1xuICAgICAqIC8vID0+IFstMywgLTIsIC0xLCAwXVxuICAgICAqXG4gICAgICogXy5yYW5nZVJpZ2h0KDEsIDQsIDApO1xuICAgICAqIC8vID0+IFsxLCAxLCAxXVxuICAgICAqXG4gICAgICogXy5yYW5nZVJpZ2h0KDApO1xuICAgICAqIC8vID0+IFtdXG4gICAgICovXG4gICAgdmFyIHJhbmdlUmlnaHQgPSBjcmVhdGVSYW5nZSh0cnVlKTtcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYSBuZXcgZW1wdHkgYXJyYXkuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAc2luY2UgNC4xMy4wXG4gICAgICogQGNhdGVnb3J5IFV0aWxcbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIG5ldyBlbXB0eSBhcnJheS5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIGFycmF5cyA9IF8udGltZXMoMiwgXy5zdHViQXJyYXkpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzKTtcbiAgICAgKiAvLyA9PiBbW10sIFtdXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzWzBdID09PSBhcnJheXNbMV0pO1xuICAgICAqIC8vID0+IGZhbHNlXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkFycmF5KCkge1xuICAgICAgcmV0dXJuIFtdO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYGZhbHNlYC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjEzLjBcbiAgICAgKiBAY2F0ZWdvcnkgVXRpbFxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBSZXR1cm5zIGBmYWxzZWAuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udGltZXMoMiwgXy5zdHViRmFsc2UpO1xuICAgICAqIC8vID0+IFtmYWxzZSwgZmFsc2VdXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkZhbHNlKCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYSBuZXcgZW1wdHkgb2JqZWN0LlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgbmV3IGVtcHR5IG9iamVjdC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIG9iamVjdHMgPSBfLnRpbWVzKDIsIF8uc3R1Yk9iamVjdCk7XG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhvYmplY3RzKTtcbiAgICAgKiAvLyA9PiBbe30sIHt9XVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2cob2JqZWN0c1swXSA9PT0gb2JqZWN0c1sxXSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViT2JqZWN0KCkge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge3N0cmluZ30gUmV0dXJucyB0aGUgZW1wdHkgc3RyaW5nLlxuICAgICAqIEBleGFtcGxlXG4g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AgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICB1bmRvU3Vic2NyaXB0aW9uKGVtaXR0ZXIpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVsZXRlRW1pdHRlcklmTm90aGluZ1JlZ2lzdGVyZWQoZW1pdHRlcik7XG4gICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5kZXJlZ2lzdGVyRXZlbnRMaXN0ZW5lciA9IGFzeW5jIChldmVudFR5cGUsIG9wdGlvbnMgPSB7fSkgPT4ge1xuICAgICAgICAgICAgaWYgKHRoaXMuaGFzRW1pdHRlcigpKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgcnVudGltZUV2ZW50ID0ge1xuICAgICAgICAgICAgICAgICAgICAuLi50aGlzLmlkZW50aXR5LFxuICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXA6IG9wdGlvbnMudGltZXN0YW1wIHx8IERhdGUubm93KCksXG4gICAgICAgICAgICAgICAgICAgIHRvcGljOiB0aGlzLnRvcGljLFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiBldmVudFR5cGVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCd1bnN1YnNjcmliZS10by1kZXNrdG9wLWV2ZW50JywgcnVudGltZUV2ZW50KS5jYXRjaCgoKSA9PiBudWxsKTtcbiAgICAgICAgICAgICAgICBjb25zdCBlbWl0dGVyID0gdGhpcy5nZXRPckNyZWF0ZUVtaXR0ZXIoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1pdHRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFRoaXMgd2lsbCBvbmx5IGJlIHJlYWNoZWQgaWYgdW5zdWJzY3JpYmUgZnJvbSBldmVudCB0aGF0IGRvZXMgbm90IGV4aXN0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5hbWU6ICd2aWV3TmFtZUNyZWF0ZScsXG5cdCAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBjcmVhdGVWaWV3KClcblx0ICAgICAqICAgICAudGhlbigoY3JlYXRlZFZpZXcpID0+IHtcblx0ICAgICAqICAgICAgICAgdmlldyA9IGNyZWF0ZWRWaWV3O1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicsIHZpZXcpO1xuXHQgICAgICogICAgICAgICB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAqICAgICB9KVxuXHQgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqIE5vdGUgdGhhdCBjcmVhdGVkIHZpZXdzIG5lZWRzIHRvIG5hdmlnYXRlIHNvbWV3aGVyZSBmb3IgdGhlbSB0byBhY3R1YWxseSByZW5kZXIgYSB3ZWJzaXRlLlxuXHQgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICovXG5cdCAgICBhc3luYyBjcmVhdGUob3B0aW9ucykge1xuXHQgICAgICAgIGNvbnN0IHsgdXVpZCB9ID0gdGhpcy53aXJlLm1lO1xuXHQgICAgICAgIGlmICghb3B0aW9ucy5uYW1lIHx8IHR5cGVvZiBvcHRpb25zLm5hbWUgIT09ICdzdHJpbmcnKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUGxlYXNlIHByb3ZpZ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0aGlzLndpcmUubWUuaXNWaWV3KSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBWaWV3IGNvbnRleHQnKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lIH0gPSB0aGlzLndpcmUubWU7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud3JhcCh7IHV1aWQsIG5hbWUgfSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFN5bmNocm9ub3VzbHkgcmV0dXJucyBhIFZpZXcgb2JqZWN0IHRoYXQgcmVwcmVzZW50cyB0aGUgY3VycmVudCB2aWV3XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBjb25zdCB2aWV3ID0gZmluLlZpZXcuZ2V0Q3VycmVudFN5bmMoKTtcblx0ICAgICAqIGNvbnNvbGUubG9nKHZpZXcpO1xuXHQgICAgICpcblx0ICAgICAqIGBgYFxuXHQgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICovXG5cdCAgICBnZXRDdXJyZW50U3luYygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1nZXQtY3VycmVudC1zeW5jJykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgaWYgKCF0aGlzLndpcmUubWUuaXNWaWV3KSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBWaWV3IGNvbnRleHQnKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lIH0gPSB0aG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ogQGlnbm9yZVxuICAgICAgICAgKiBAaW50ZXJuYWxcbiAgICAgICAgICogQXBpQ2xpZW50IGZvciB7QGxpbmsgTGF5b3V0RW50aXRpZXNDb250cm9sbGVyfVxuICAgICAgICAgKi9cbiAgICAgICAgX0xheW91dE5vZGVfY2xpZW50LnNldCh0aGlzLCB2b2lkIDApO1xuICAgICAgICAvKipcbiAgICAgICAgICogQ2hlY2tzIGlmIHRoZSBUYWJTdGFjayBvciBDb2x1bW5PclJvdyBpcyB0aGUgcm9vdCBjb250ZW50IGl0ZW1cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgaXNSb290ID0gYXdhaXQgc3RhY2suaXNSb290KCk7XG4gICAgICAgICAqIC8vIFRoZSBUYWJTdGFjayBpcyByb290OiBmYWxzZVxuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIFRhYlN0YWNrIGlzIHJvb3Q6ICR7aXNSb290fWApO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyBSZXRyaWV2ZXMgdGhlIHBhcmVudCBDb2x1bW5PclJvd1xuICAgICAgICAgKiBjb25zdCBwYXJlbnQgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogY29uc3QgcGFyZW50SXNSb290ID0gYXdhaXQgcGFyZW50LmlzUm9vdCgpO1xuICAgICAgICAgKiAvLyBUaGUgcGFyZW50IENvbHVtbk9yUm93IGlzIHJvb3Q6IHRydWVcbiAgICAgICAgICogY29uc29sZS5sb2coYFRoZSBwYXJlbnQgQ29sdW1uT3JSb3cgaXMgcm9vdDogJHtwYXJlbnRJc1Jvb3R9YCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5pc1Jvb3QgPSAoKSA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGUodGhpcywgX0xheW91dE5vZGVfY2xpZW50LCBcImZcIikuaXNSb290KHRoaXMuZW50aXR5SWQpO1xuICAgICAgICAvKipcbiAgICAgICAgICogQ2hlY2tzIGlmIHRoZSBUYWJTdGFjayBvciBDb2x1bW5PclJvdyBleGlzdHNcbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogLy8gUmV0cmlldmVzIHRoZSBwYXJlbnQgQ29sdW1uT3JSb3dcbiAgICAgICAgICogY29uc3QgY29sdW1uT3JSb3cgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogbGV0IGV4aXN0cyA9IGF3YWl0IHN0YWNrLmV4aXN0cygpO1xuICAgICAgICAgKiAvLyBvclxuICAgICAgICAgKiBsZXQgZXhpc3RzID0gYXdhaXQgY29sdW1uT3JSb3cuZXhpc3RzKCk7XG4gICAgICAgICAqIC8vIFRoZSBlbnRpdHkgZXhpc3RzOiB0cnVlXG4gICAgICAgICAqIGNvbnNvbGUubG9nKGBUaGUgZW50aXR5IGV4aXN0czogJHtleGlzdHN9YCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leGlzdHMgPSAoKSA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGUodGhpcywgX0xheW91dE5vZGVfY2xpZW50LCBcImZcIikuZXhpc3RzKHRoaXMuZW50aXR5SWQpO1xuICAgICAgICAvKipcbiAgICAgICAgICogUmV0cmlldmVzIHRoZSBwYXJlbnQgb2YgdGhlIFRhYlN0YWNrIG9yIENvbHVtbk9yUm93XG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGlmICghZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcuJyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3Qgc3RhY2sgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFN0YWNrKCk7XG4gICAgICAgICAqIC8vIFJldHJpZXZlcyB0aGUgcGFyZW50IENvbHVtbk9yUm93XG4gICAgICAgICAqIGNvbnN0IGNvbHVtbk9yUm93ID0gYXdhaXQgc3RhY2suZ2V0UGFyZW50KCk7XG4gICAgICAgICAqXG4gICAgICAgICAqIC8vIHVuZGVmaW5lZCBpZiBlbnRpdHkgaXMgdGhlIHJvb3QgaXRlbVxuICAgICAgICAgKiBsZXQgcGFyZW50ID0gYXdhaXQgY29sdW1uT3JSb3cuZ2V0UGFyZW50KCk7XG4gICAgICAgICAqIC8vIG9yXG4gICAgICAgICAqIGxldCBwYXJlbnQgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmdldFBhcmVudCA9IGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHBhcmVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkZSh0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gICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgY29sdW1uT3JSb3cgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogLy8gUG9zc2libGUgcG9zaXRpb24gaW5wdXRzOiAncmlnaHQnIHwgJ2xlZnQnIHwgJ3RvcCcgfCAnYm90dG9tJ1xuICAgICAgICAgKiBsZXQgcmlnaHRTdGFja3MgPSBhd2FpdCBjb2x1bW5PclJvdy5nZXRBZGphY2VudFN0YWNrcygncmlnaHQnKTtcbiAgICAgICAgICogbGV0IGxlZnRTdGFja3MgPSBhd2FpdCBjb2x1bW5PclJvdy5nZXRBZGphY2VudFN0YWNrcygnbGVmdCcpO1xuICAgICAgICAgKiAvLyBvclxuICAgICAgICAgKiBsZXQgcmlnaHRTdGFja3MgPSBhd2FpdCBzdGFjay5nZXRBZGphY2VudFN0YWNrcygncmlnaHQnKTtcbiAgICAgICAgICogbGV0IGxlZnRTdGFja3MgPSBhd2FpdCBzdGFjay5nZXRBZGphY2VudFN0YWNrcygnbGVmdCcpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIGVudGl0eSBoYXMgJHtyaWdodFN0YWNrcy5sZW5ndGh9IHN0YWNrcyB0byB0aGUgcmlnaHQsIGFuZCAke2xlZnRTdGFja3MubGVuZ3RofSBzdGFja3MgdG8gdGhlIGxlZnRgKTtcbiAgICAgICAgICpcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqIE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tAbGluayBUYWJTdGFja30uXG4gICAgICAgICAqXG4gICAgICAgICAqIEByZW1hcmtzIFRocm93cyBhbiBleGNlcHRpb24gaWYgdGhlIHZpZXcgaWRlbnRpdHkgZG9lcyBub3QgZXhpc3Qgb3Igd2FzIGFscmVhZHkgZGVzdHJveWVkLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0gdmlldyAtIElkZW50aXR5IG9mIHRoZSB2aWV3IHRvIHJlbW92ZS5cbiAgICAgICAgICogQHRocm93cyBJZiB0aGUgdmlldyBkb2VzIG5vdCBleGlzdCBvciBkb2VzIG5vdCBiZWxvbmcgdG8gdGhlIHN0YWNrLlxuICAgICAgICAgKiBAdGhyb3dzIElmIHRoZSB7QGxpbmsgVGFiU3RhY2t9IGhhcyBiZWVuIGRlc3Ryb3llZC5cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgZ29vZ2xlVmlld0lkZW50aXR5ID0gYXdhaXQgc3RhY2suYWRkVmlldyh7IG5hbWU6ICdnb29nbGUtdmlldycsIHVybDogJ2h0dHA6Ly9nb29nbGUuY29tLycgfSk7XG4gICAgICAgICAqXG4gICAgICAgICAqIGF3YWl0IHN0YWNrLnJlbW92ZVZpZXcoZ29vZ2xlVmlld0lkZW50aXR5KTtcbiAgICAgICAgICpcbiAgICAgICAgICogdHJ5IHtcbiAgICAgICAgICogICAgIGF3YWl0IHN0YWNrLnJlbW92ZVZpZXcoZ29vZ2xlVmlld0lkZW50aXR5KTtcbiAgICAgICAgICogfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICogICAgIC8vIFRyaWVkIHRvIHJlbW92ZSBhIHZpZXcgKCdnb29nbGUtdmlldycpIHdoaWNoIGRvZXMgbm90IGJlbG9uZyB0byB0aGUgc3RhY2suXG4gICAgICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICAgICAqIH1cbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLnJlbW92ZVZpZXcgPSBhc3luYyAodmlldykgPT4ge1xuICAgICAgICAgICAgYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9UYWJTdGFja19jbGllbnQsIFwiZlwiKS5yZW1vdmVWaWV3RnJvbVN0YWNrKHRoaXMuZW50aXR5SWQsIHZpZXcpO1xuICAgICAgICB9O1xuICAgICAgICAvKipcbiAgICAgICAgICogU2V0cyB0aGUgYWN0aXZlIHZpZXcgb2YgdGhlIHtAbGluayBUYWJTdGFja30gd2l0aG91dCBmb2N1c2luZyBpdC5cbiAgICAgICAgICogQHBhcmFtIHZpZXcgLSBJZGVudGl0eSBvZiB0aGUgdmlldyB0byBhY3RpdmF0ZS5cbiAgICAgICAgICogQHJldHVybnMgUHJvbWlzZSB3aGljaCByZXNvbHZlcyB3aXRoIHZvaWQgb25jZSB0aGUgdmlldyBoYXMgYmVlbiBhY3RpdmF0ZWQuXG4gICAgICAgICAqIEB0aHJvd3MgSWYgdGhlIHtAbGluayBUYWJTdGFja30gaGFzIGJlZW4gZGVzdHJveWVkLlxuICAgICAgICAgKiBAdGhyb3dzIElmIHRoZSB2aWV3IGRvZXMgbm90IGV4aXN0LlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBDaGFuZ2UgdGhlIGFjdGl2ZSB0YWIgb2YgYSBrbm93biBWaWV3J3MgVGFiU3RhY2s6XG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGNvbnN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G8gbWFuYWdlIHRoZSBzdGF0ZSBvZiBDb2x1bW4gYW5kIFJvd3Mgd2l0aGluIGFuIE9wZW5GaW4gTGF5b3V0LlxuICovXG5jbGFzcyBDb2x1bW5PclJvdyBleHRlbmRzIExheW91dE5vZGUge1xuICAgIC8qKlxuICAgICAqIEBpbnRlcm5hbFxuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKGNsaWVudCwgZW50aXR5SWQsIHR5cGUpIHtcbiAgICAgICAgc3VwZXIoY2xpZW50LCBlbnRpdHlJZCk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAaWdub3JlXG4gICAgICAgICAqIEBpbnRlcm5hbFxuICAgICAgICAgKiBBcGlDbGllbnQgZm9yIHtAbGluayBMYXlvdXRFbnRpdGllc0NvbnRyb2xsZXJ9XG4gICAgICAgICAqL1xuICAgICAgICBfQ29sdW1uT3JSb3dfY2xpZW50LnNldCh0aGlzLCB2b2lkIDApO1xuICAgICAgICAvKipcbiAgICAgICAgICogUmV0cmlldmVzIHRoZSBjb250ZW50IGFycmF5IG9mIHRoZSBDb2x1bW5PclJvd1xuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBpZiAoIWZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3LicpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IHN0YWNrID0gYXdhaXQgZmluLm1lLmdldEN1cnJlbnRTdGFjaygpO1xuICAgICAgICAgKiAvLyBSZXRyaWV2ZXMgdGhlIHBhcmVudCBDb2x1bW5PclJvd1xuICAgICAgICAgKiBjb25zdCBjb2x1bW5PclJvdyA9IGF3YWl0IHN0YWNrLmdldFBhcmVudCgpO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyByZXR1cm5zIFtUYWJTdGFja11cbiAgICAgICAgICogY29uc3QgY29udGVudEFycmF5ID0gYXdhaXQgY29sdW1uT3JSb3cuZ2V0Q29udGVudCgpO1xuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIENvbHVtbk9yUm93IGhhcyAke2NvbnRlbnRBcnJheS5sZW5ndGh9IGl0ZW0ocylgKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmdldENvbnRlbnQgPSBhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBjb250ZW50SXRlbUVudGl0aWVzID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9Db2x1bW5PclJvd19jbGllbnQsIFwiZlwiKS5nZXRDb250ZW50KHRoaXMuZW50aXR5SWQpO1xuICAgICAgICAgICAgcmV0dXJuIGNvbnRlbnRJdGVtRW50aXRpZXMubWFwKChlbnRpdHkpID0+IExheW91dE5vZGUuZ2V0RW50aXR5KGVudGl0eSwgX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9Db2x1bW5PclJvd19jbGllbnQsIFwiZlwiKSkpO1xuICAgICAgICB9O1xuICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0JGModGhpcywgX0NvbHVtbk9yUm93X2NsaWVudCwgY2xpZW50LCBcImZcIik7XG4gICAgICAgIHRoaXMudHlwZSA9IHR5cGU7XG4gICAgfVxufVxubGF5b3V0RW50aXRpZXMuQ29sdW1uT3JSb3cgPSBDb2x1bW5PclJvdztcbl9Db2x1bW5PclJvd19jbGllbnQgPSBuZXcgV2Vha01hcCgpO1xuXG52YXIgbGF5b3V0X2NvbnN0YW50cyA9IHt9O1xuXG5PYmplY3QuZGVmaW5lUHJvcGVydHkobGF5b3V0X2NvbnN0YW50cywgXCJfX2VzTW9kdWxlXCIsIHsgdmFsdWU6IHRydWUgfSk7XG5sYXlvdXRfY29uc3RhbnRzLkRFRkFVTFRfTE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W5jb2RlZCBpbWFnZSBvZiBhbGwgb3IgcGFydCBvZiB0aGUgV2ViQ29udGVudHMuXG4gICAgICogQHBhcmFtIG9wdGlvbnMgT3B0aW9ucyBmb3IgdGhlIGNhcHR1cmVQYWdlIGNhbGwuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogLy8gUE5HIGltYWdlIG9mIGEgZnVsbCB2aXNpYmxlIFZpZXdcbiAgICAgKiBjb25zb2xlLmxvZyhhd2FpdCB2aWV3LmNhcHR1cmVQYWdlKCkpO1xuICAgICAqXG4gICAgICogLy8gTG93LXF1YWxpdHkgSlBFRyBpbWFnZSBvZiBhIGRlZmluZWQgdmlzaWJsZSBhcmVhIG9mIHRoZSB2aWV3XG4gICAgICogY29uc3Qgb3B0aW9ucyA9IHtcbiAgICAgKiAgICAgYXJlYToge1xuICAgICAqICAgICAgICAgaGVpZ2h0OiAxMDAsXG4gICAgICogICAgICAgICB3aWR0aDogMTAwLFxuICAgICAqICAgICAgICAgeDogMTAsXG4gICAgICogICAgICAgICB5OiAxMCxcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgZm9ybWF0OiAnanBnJyxcbiAgICAgKiAgICAgcXVhbGl0eTogMjBcbiAgICAgKiB9XG4gICAgICogY29uc29sZS5sb2coYXdhaXQgdmlldy5jYXB0dXJlUGFnZShvcHRpb25zKSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCB3bmQgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqIC8vIFBORyBpbWFnZSBvZiBhIGZ1bGwgdmlzaWJsZSB3aW5kb3dcbiAgICAgKiBjb25zb2xlLmxvZyh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ycsIHsgLi4udGhpcy5pZGVudGl0eSwgY29kZSB9KVxuICAgICAgICAgICAgLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiBwYXlsb2FkLmRhdGEpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSB6b29tIGxldmVsIG9mIHRoZSBXZWJDb250ZW50cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFpvb21MZXZlbCgpIHtcbiAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmdldEN1cnJlbnQoKTtcbiAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHZpZXcuZ2V0Wm9vbUxldmVsKCk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZ2V0Wm9vbUxldmVsKCkudGhlbih6b29tTGV2ZWwgPT4gY29uc29sZS5sb2coem9vbUxldmVsKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luKCkge1xuICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcbiAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldFpvb21MZXZlbC5odG1sJyxcbiAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG4gICAgICogICAgIH0pO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuIC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c6XG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBzZXRab29tTGV2ZWwobnVtYmVyKSB7XG4gICAgICogICAgIGNvbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5nZXRDdXJyZW50KCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCB2aWV3LnNldFpvb21MZXZlbChudW1iZXIpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIHNldFpvb21MZXZlbCg0KS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdTZXR0aW5nIGEgIHpvb20gbGV2ZWwnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luKCkge1xuICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcbiAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LnNldFpvb21MZXZlbC5odG1sJyxcbiAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG4gICAgICogICAgIH0pO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIHNldFpvb21MZXZlbChudW1iZXIpIHtcbiAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgY3JlYXRlV2luKCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uc2V0Wm9vbUxldmVsKG51bWJlcik7XG4gICAgICogfVxuICAgICAqXG4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QGxpbmsgT3BlbkZpbi5WaWV3fS5cbiAgICAgKiBXZSBkbyBub3QgZXhwb3NlIGFuIGV4cGxpY2l0IHN1cGVyY2xhc3MgZm9yIHRoaXMgZnVuY3Rpb25hbGl0eSwgYnV0IGl0IGRvZXMgaGF2ZSBpdHMgb3duXG4gICAgICoge0BsaW5rIE9wZW5GaW4uV2ViQ29udGVudHNFdmVudHMgZXZlbnQgbmFtZXNwYWNlfS5cbiAgICAgKi9cbiAgICBzdG9wRmluZEluUGFnZShhY3Rpb24pIHtcbiAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzdG9wLWZpbmQtaW4tcGFnZScsIHsgLi4udGhpcy5pZGVudGl0eSwgYWN0aW9uIH0pLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhbiBhcnJheSB3aXRoIGFsbCBzeXN0ZW0gcHJpbnRlcnNcbiAgICAgKiBAZGVwcmVjYXRlZCB1c2UgU3lzdGVtLmdldFByaW50ZXJzIGluc3RlYWRcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogdmlldy5nZXRQcmludGVycygpXG4gICAgICogICAgIC50aGVuKChwcmludGVycykgPT4ge1xuICAgICAqICAgICAgICAgcHJpbnRlcnMuZm9yRWFjaCgocHJpbnRlcikgPT4ge1xuICAgICAqICAgICAgICAgICAgIGlmIChwcmludGVyLmlzRGVmYXVsdCkge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcmludGVyKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfSlcbiAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICogICAgIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd2luID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogd2luLmdldFByaW50ZXJzKClcbiAgICAgKiAgICAgLnRoZW4oKHByaW50ZXJzKSA9PiB7XG4gICAgICogICAgICAgICBwcmludGVycy5mb3JFYWNoKChwcmludGVyKSA9PiB7XG4gICAgICogICAgICAgICAgICAgaWYgKHByaW50ZXIuaXNEZWZhdWx0KSB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByaW50ZXIpO1xuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH0pO1xuICAgICAqICAgICB9KVxuICAgICAqICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgKiAgICAgfSk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaGFyZWQgZnVuY3Rpb25hbGl0eSBiZXR3ZWVuIHtAbGluayBPcGVuRmluLldpbmRvd30gYW5kIHtAbGluayBPcGVuRmluLlZpZXd9LlxuICAgICAqIFdlIGRvIG5vdCBleHBvc2UgYW4gZXhwbGljaXQgc3VwZXJjbGFzcyBmb3IgdGhpcyBmdW5jdGlvbmFsaXR5LCBidXQgaXQgZG9lcyBoYXZlIGl0cyBvd25cbiAgICAgKiB7QGxpbmsgT3BlbkZpbi5XZWJDb250ZW50c0V2ZW50cyBldmVudCBuYW1lc3BhY2V9LlxuICAgICAqL1xuICAgIGdldFByaW50ZXJzKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1wcmludGVycycsIHsgLi4udGhpcy5pZGVudGl0eS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AgfVxuICAgIC8qKlxuICAgICAqIFJldHJpZXZlcyBpbmZvcm1hdGlvbiBvbiBhbGwgU2hhcmVkIFdvcmtlcnMuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIFZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmNyZWF0ZSh7XG4gICAgICogICAgICAgICBuYW1lOiAndmlld05hbWUnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiBmaW4ubWUuaWRlbnRpdHksXG4gICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHA6Ly9tZG4uZ2l0aHViLmlvL3NpbXBsZS1zaGFyZWQtd29ya2VyL2luZGV4Mi5odG1sJyk7XG4gICAgICpcbiAgICAgKiAgICAgY29uc3Qgc2hhcmVkV29ya2VycyA9IGF3YWl0IHZpZXcuZ2V0U2hhcmVkV29ya2VycygpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIGNvbnN0IHdpbk9wdGlvbiA9IHtcbiAgICAgKiAgICAgICAgIG5hbWU6J2NoaWxkJyxcbiAgICAgKiAgICAgICAgIGRlZmF1bHRXaWR0aDogMzAwLFxuICAgICAqICAgICAgICAgZGVmYXVsdEhlaWdodDogMzAwLFxuICAgICAqICAgICAgICAgdXJsOiAnaHR0cDovL21kbi5naXRodWIuaW8vc2ltcGxlLXNoYXJlZC13b3JrZXIvaW5kZXgyLmh0bWwnLFxuICAgICAqICAgICAgICAgZnJhbWU6IHRydWUsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuICAgICAqICAgICB9O1xuICAgICAqICAgICBjb25zdCB3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1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGluaXRpYWxPcHRpb25zOiB7XG4gICAgICogICAgICAgICBmcmFtZTogZmFsc2VcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgdXJsOiAnPG15X3BvcHVwX3VybD4nLFxuICAgICAqICAgICByZXN1bHREaXNwYXRjaEJlaGF2aW9yOiAnbm9uZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwLFxuICAgICAqICAgICBvblBvcHVwUmVzdWx0OiBwb3B1cFJlc3VsdENhbGxiYWNrXG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBTYW1lIGFzIGFib3ZlIGJ1dCB1c2luZyBhbiBleGlzdGluZyB3aW5kb3cgYXMgYSBwb3B1cDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcG9wdXBSZXN1bHRDYWxsYmFjayA9IChwYXlsb2FkKSA9PiB7XG4gICAgICogICAgICAgIGlmIChwYXlsb2FkLnJlc3VsdCA9PT0gJ2NsaWNrZWQnKSB7XG4gICAgICogICAgICAgICAgICBpZiAocGF5bG9hZC5kYXRhLnRvcGljID09PSAnY29sb3ItY2hhbmdlZCcpIHtcbiAgICAgKiAgICAgICAgICAgICAgICAvLyBkbyBzb21ldGhpbmcgbGlrZVxuICAgICAqICAgICAgICAgICAgICAgIC8vIHNldENvbG9yKHBheWxvYWQuZGF0YS52YWx1ZSk7XG4gICAgICogICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiB9O1xuICAgICAqXG4gICAgICogYXdhaXQgZmluLm1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGluaXRpYWxPcHRpb25z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mw6ICc8bXlfcG9wdXBfdXJsPicsXG4gICAgICogICAgIHJlc3VsdERpc3BhdGNoQmVoYXZpb3I6ICdjbG9zZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ21vZGFsJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwXG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBQYXNzIGRhdGEgdG8gYSBwb3B1cCB3aW5kb3cgdGhhdCBpcyBhdmFpbGFibGUgd2hlbiB0aGUgcG9wdXAgaXMgc2hvd24uXG4gICAgICpcbiAgICAgKiBOb3RlOiB0aGlzIGlzIGp1c3Qgb25lIGV4YW1wbGUgZm9yIGEgdXNlIG9mIGBhZGRpdGlvbmFsT3B0aW9uc2AsIGl0IGNhbiBiZSB1c2VkIHRvIHVwZGF0ZSBhbnkgdXBkYXRhYmxlXG4gICAgICogd2luZG93IG9wdGlvbnMgd2hlbiBjcmVhdGluZyBvciBzaG93aW5nIGFuIGV4aXN0aW5nIHdpbmRvdyBhcyBhIHBvcHVwLlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCByZXN1bHQgPSBhd2FpdCBmaW4ubWUuc2hvd1BvcHVwV2luZG93KHtcbiAgICAgKiAgICAgYWRkaXRpb25hbE9wdGlvbnM6IHtcbiAgICAgKiAgICAgICAgIGN1c3RvbURhdGE6IHtcbiAgICAgKiAgICAgICAgICAgICBmb286ICdiYXInXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0sXG4gICAgICogICAgIHVybDogJzxteV9wb3B1cF91cmw+JyxcbiAgICAgKiAgICAgcmVzdWx0RGlzcGF0Y2hCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgYmx1ckJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqIC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bmRvdyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFNvbWV0aGluZyB3ZW50IHdyb25nIGR1cmluZyBvblBvcHVwUmVhZHkgZXhlY3V0aW9uOiAke2Vycm9yfWApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvLyBUT0RPOiBmaXggdHlwaW5nIChpbnRlcm5hbClcbiAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgIGF3YWl0IHRoaXMub25jZSgncG9wdXAtcmVhZHknLCByZWFkeUxpc3RlbmVyKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCB7IHBheWxvYWQ6IHRyeUNyZWF0ZVBheWxvYWQgfSA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCd0cnktY3JlYXRlLXBvcHVwLXdpbmRvdycsIHtcbiAgICAgICAgICAgIG9wdGlvbnM6IHtcbiAgICAgICAgICAgICAgICAuLi5vcHRpb25zLFxuICAgICAgICAgICAgICAgIC8vIEludGVybmFsIHVzZSBvbmx5LlxuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgICAgICBoYXNSZXN1bHRDYWxsYmFjazogISFvcHRpb25zPy5vblBvcHVwUmVzdWx0LFxuICAgICAgICAgICAgICAgIGhhc1JlYWR5Q2FsbGJhY2s6ICEhb3B0aW9ucz8ub25Qb3B1cFJlYWR5XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLi4udGhpcy5pZGVudGl0eVxuICAgICAgICB9KTtcbiAgICAgICAgY29uc3QgeyBkYXRhOiB7IHdpbGxPcGVuLCBvcHRpb25zOiBwb3B1cE9wdGlvbnMgfSB9ID0gdHJ5Q3JlYXRlUGF5bG9hZDtcbiAgICAgICAgaWYgKHdpbGxPcGVuKSB7XG4gICAgICAgICAgICAvLyBTb2x2ZSB0aGUgaXNzdWUgd2hlcmUgSW50ZXJvcCBpbiBhIHBvcHVwIHdpbmRvdyB3aXRoIG5vbiBjcm9zcy1vcmlnaW4gdXJsIGlzIG5vdCB3b3JraW5nKGNvcmUtMTA3NikuXG4gICAgICAgICAgICBhd2FpdCB0aGlzLmZpbi5XaW5kb3cuY3JlYXRlKHBvcHVwT3B0aW9ucy5pbml0aWFsT3B0aW9ucyk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3Qgbm9ybWFsaXplUG9wdXBSZXN1bHQgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyBuYW1lLCB1dWlkLCByZXN1bHQsIGRhdGEgfSA9IHBheWxvYWQ7XG4gICAgICAgICAgICBjb25zdCBwb3B1cFJlc3VsdCA9IHtcbiAgICAgICAgICAgICAgICBpZGVudGl0eToge1xuICAgICAgICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICAgICAgICB1dWlkXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICByZXN1bHRcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoZGF0YSkge1xuICAgICAgICAgICAgICAgIHBvcHVwUmVzdWx0LmRhdGEgPSBkYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHBvcHVwUmVzdWx0O1xuICAgICAgICB9O1xuICAgICAgICBpZiAob3B0aW9ucz8ub25Qb3B1cFJlc3VsdCkge1xuICAgICAgICAgICAgY29uc3QgZGlzcGF0Y2hSZXN1bHRMaXN0ZW5lciA9IGFzeW5jIChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgYXdhaXQgb3B0aW9ucy5vblBvcHVwUmVzdWx0KG5vcm1hbGl6ZVBvcHVwUmVzdWx0KHBheWxvYWQpKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCB0ZWFyZG93bkxpc3R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GFwcGxpY2F0aW9uLlxuXHQgICAgICAgICAqIFRoaXMgZGV0YWNoZXMgdGhlIHZpZXcgZnJvbSBpdHMgY3VycmVudCB3aW5kb3csIGFuZCBzZXRzIHRoZSB2aWV3IHRvIGJlIGRlc3Ryb3llZCB3aGVuIGl0cyBuZXcgd2luZG93IGNsb3Nlcy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZUF0dGFjaCcsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBhdHRhY2hWaWV3KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGNvbnN0IHdpbk9wdGlvbiA9IHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6J3dpbk9wdGlvbk5hbWUnLFxuXHQgICAgICAgICAqICAgICAgICAgZGVmYXVsdFdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICBkZWZhdWx0SGVpZ2h0OiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmNyZWF0ZS5odG1sJyxcblx0ICAgICAgICAgKiAgICAgICAgIGZyYW1lOiB0cnVlLFxuXHQgICAgICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAgICAgKiAgICAgfTtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbmV3V2luZG93ID0gYXdhaXQgZmluLldpbmRvdy5jcmVhdGUod2luT3B0aW9uKTtcblx0ICAgICAgICAgKiAgICAgdmlldy5hdHRhY2gobmV3V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhdHRhY2hWaWV3KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgYXR0YWNoZWQgdG8gbmV3IHdpbmRvdy4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5hdHRhY2ggPSBhc3luYyAodGFyZ2V0KSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdhdHRhY2gtdmlldycsIHsgdGFyZ2V0LCAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogRGVzdHJveXMgdGhlIGN1cnJlbnQgdmlld1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy53cmFwU3luYyh7IHV1aWQ6ICd2aWV3VXVpZCcsIG5hbWU6ICd2aWV3TmFtZScgfSk7XG5cdCAgICAgICAgICogdmlldy5kZXN0cm95KCk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZGVzdHJveSA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2Rlc3Ryb3ktdmlldycsIHsgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFNob3dzIHRoZSBjdXJyZW50IHZpZXcgaWYgaXQgaXMgY3VycmVudGx5IGhpZGRlbi5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZVNob3cnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gaGlkZUFuZFNob3dWaWV3KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsIG9wdGlvbi4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LmhpZGUoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coXCJWaWV3IGhpZGRlbi5cIik7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmlldy5zaG93KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKFwiVmlldyBzaG93bi5cIik7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogaGlkZUFuZFNob3dWaWV3KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgaGlkZGVuIGFuZCBzaG93bi4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgIC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6ICd2aWV3TmFtZVNldEJvdW5kcycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBzaG93Vmlld0F0KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcuc2hvd0F0KHtcblx0ICAgICAgICAgKiAgICAgICAgIHRvcDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgbGVmdDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgd2lkdGg6IDMwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGhlaWdodDogMzAwXG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIHNob3dWaWV3QXQoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnVmlldyBzZXQgdG8gbmV3IGJvdW5kcyBhbmQgc2hvd24uJykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuc2hvd0F0ID0gYXN5bmMgKGJvdW5kcykgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc2hvdy12aWV3LWF0JywgeyBib3VuZHMsIC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBIaWRlcyB0aGUgY3VycmVudCB2aWV3IGlmIGl0IGlzIGN1cnJlbnRseSB2aXNpYmxlLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lSGlkZScsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBoaWRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LmhpZGUoKTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBoaWRlVmlldygpXG5cdCAgICAgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdWaWV3IGhpZGRlbi4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5oaWRlID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignaGlkZS12aWV3JywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogU2V0cyB0aGUgYm91bmRzICh0b3AsIGxlZnQsIHdpZHRoLCBoZWlnaHQpIG9mIHRoZSB2aWV3IHJlbGF0aXZlIHRvIGl0cyB3aW5kb3cuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmVtYXJrcyBWaWV3IHBvc2l0aW9uIGlzIHJlbGF0aXZlIHRvIHRoZSBib3VuZHMgb2YgdGhlIHdpbmRvdy5cblx0ICAgICAgICAgKiAoe3RvcDogMCwgbGVmdDogMH0gcmVwcmVzZW50cyB0aGUgdG9wIGxlZnQgY29ybmVyIG9mIHRoZSB3aW5kb3cpXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVTZXRCb3VuZHMnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gc2V0Vmlld0JvdW5kcygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LnNldEJvdW5kcyh7XG5cdCAgICAgICAgICogICAgICAgICB0b3A6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGxlZnQ6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIHdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICBoZWlnaHQ6IDMwMFxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBzZXRWaWV3Qm91bmRzKClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgc2V0IHRvIG5ldyBib3VuZHMuJykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuc2V0Qm91bmRzID0gYXN5bmMgKGJvdW5kcykgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc2V0LXZpZXctYm91bmRzJywgeyBib3VuZHMsIC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBHZXRzIHRoZSBib3VuZHMgKHRvcCwgbGVmdCwgd2lkdGgsIGhlaWdodCkgb2YgdGhlIHZpZXcgcmVsYXRpdmUgdG8gaXRzIHdpbmRvdy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZW1hcmtzIFZpZXcgcG9zaXRpb24gaXMgcmVsYXRpdmUgdG8gdGhlIGJvdW5kcyBvZiB0aGUgd2luZG93LlxuXHQgICAgICAgICAqICh7dG9wOiAwLCBsZWZ0OiAwfSByZXByZXNlbnRzIHRoZSB0b3AgbGVmdCBjb3JuZXIgb2YgdGhlIHdpbmRvdylcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBjb25zdCB2aWV3ID0gYXdhaXQgZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgbmFtZTogJ3ZpZXdOYW1lU2V0Qm91bmRzJyxcblx0ICAgICAgICAgKiAgICAgdGFyZ2V0OiBmaW4ubWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiB9KTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXdhaXQgdmlldy5zZXRCb3VuZHMoe1xuXHQgICAgICAgICAqICAgICB0b3A6IDEwMCxcblx0ICAgICAgICAgKiAgICAgbGVmdDogMTAwLFxuXHQgICAgICAgICAqICAgICB3aWR0aDogMzAwLFxuXHQgICAgICAgICAqICAgICBoZWlnaHQ6IDMwMFxuXHQgICAgICAgICAqIH0pO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogY29uc29sZS5sb2coYXdhaXQgdmlldy5nZXRCb3VuZHMoKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0Qm91bmRzID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCBhY2sgPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXZpZXctYm91bmRzJywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICByZXR1cm4gYWNrLnBheWxvYWQuZGF0YTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEdldHMgdGhlIFZpZXcncyBpbmZvLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lR2V0SW5mbycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRWaWV3SW5mbygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICByZXR1cm4gdmlldy5nZXRJbmZvKCk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogZ2V0Vmlld0luZm8oKVxuXHQgICAgICAgICAqICAgICAudGhlbigoaW5mbykgPT4gY29uc29sZS5sb2coJ1ZpZXcgaW5mbyBmZXRjaGVkLicsIGluZm8pKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmdldEluZm8gPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIGNvbnN0IGFjayA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtdmlldy1pbmZvJywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICByZXR1cm4gYWNrLnBheWxvYWQuZGF0YTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFJldHJpZXZlcyB0aGUgbGF5b3V0IGZvciB0aGUgd2luZG93IHRoZSB2aWV3IGlzIGF0dGFjaGVkIHRvLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqICAgICAvL2dldCB0aGUgY3VycmVudCBWaWV3XG5cdCAgICAgICAgICogICAgIGNvbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgLy9nZXQgYSByZWZlcmVuY2UgdG8gdGhlIExheW91dCBmb3IgdGhlIFdpbmRvdyB0aGUgdmlldyBpcyBwYXJ0IG9mXG5cdCAgICAgICAgICogICAgIGNvbnN0IGxheW91dCA9IGF3YWl0IHZpZXcuZ2V0UGFyZW50TGF5b3V0KCk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0UGFyZW50TGF5b3V0ID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1nZXQtcGFyZW50LWxheW91dCcsIHsgLi4udGhpcy5pZGVudGl0eSB9KS5jYXRjaCgoKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAvLyBkb24ndCBleHBvc2Vcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGNvbnN0IGxheW91dFdpbmRvdyA9IGF3YWl0IHRoaXMuZ2V0Q3VycmVudFdpbmRvdygpO1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvdmlkZXJDaGFubmVsQ2xpZW50ID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfVmlld19wcm92aWRlckNoYW5uZWxDbGllbnQsIFwiZlwiKS5nZXRWYWx1ZSgpO1xuXHQgICAgICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgbGF5b3V0X2VudGl0aWVzXzEuTGF5b3V0Tm9kZS5uZXdMYXlvdXRFbnRpdGllc0NsaWVudChwcm92aWRlckNoYW5uZWxDbGllbnQsIGxheW91dF9jb25zdGFudHNfMS5MQVlPVVRfQ09OVFJPTExFUl9JRCwgbGF5b3V0V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGxheW91dElkZW50aXR5ID0gYXdhaXQgY2xpZW50LmdldExheW91dElkZW50aXR5Rm9yVmlld09yVGhyb3codGhpcy5pZGVudGl0eSk7XG5cdCAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maW4uUGxhdGZvcm0uTGF5b3V0LndyYXAobGF5b3V0SWRlbnRpdHkpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBhbGxvd2VkRXJyb3JzID0gW1xuXHQgICAgICAgICAgICAgICAgICAgICdObyBhY3Rpb24gcmVnaXN0ZXJlZCBhdCB0YXJnZXQgZm9yJyxcblx0ICAgICAgICAgICAgICAgICAgICAnZ2V0TGF5b3V0SWRlbnRpdHlGb3JWaWV3T3JUaHJvdyBpcyBub3QgYSBmdW5jdGlvbidcblx0ICAgICAgICAgICAgICAgIF07XG5cdCAgICAgICAgICAgICAgICBpZiAoIWFsbG93ZWRFcnJvcnMuc29tZSgobSkgPT4gZS5tZXNzYWdlLmluY2x1ZGVzKG0pKSkge1xuXHQgICAgICAgICAgICAgICAgICAgIHRocm93IGU7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAvLyBmYWxsYmFjayBsb2dpYyBmb3IgbWlzc2luZyBlbmRwb2ludFxuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmluLlBsYXRmb3JtLkxheW91dC53cmFwKGxheW91dFdpbmRvdy5pZGVudGl0eSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEdldHMgdGhlIFZpZXcncyBvcHRpb25zLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lR2V0T3B0aW9ucycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRWaWV3T3B0aW9ucygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gZmluLlZpZXcud3JhcFN5bmMoeyB1dWlkOiBtZS5pZGVudGl0eS51dWlkLCBuYW1lOiAndmlld05hbWVHZXRPcHRpb25zJyB9KTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIHZpZXcuZ2V0T3B0aW9ucygpO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGdldFZpZXdPcHRpb25zKClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKGluZm8pID0+IGNvbnNvbGUubG9nKCdWaWV3IG9wdGlvbnMgZmV0Y2hlZC4nLCBpbmZvKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5nZXRPcHRpb25zID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC12aWV3LW9wdGlvbnMnLCB7IC4uLnRoaXMuaWRlbnRpdHkgfSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBVcGRhdGVzIHRoZSB2aWV3J3Mgb3B0aW9ucy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vZ29vZ2xlLmNvbScsXG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVVcGRhdGVPcHRpb25zJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIHVwZGF0ZVZpZXdPcHRpb25zKCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsIG9wdGlvbi4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBjb25zdCBuZXdPcHRpb25zID0geyBhdXRvUmVzaXplOiB7XG5cdCAgICAgICAgICogICAgICAgICB3aWR0aDogdHJ1ZSxcblx0ICAgICAgICAgKiAgICAgICAgIGhvcml6b250YWw6IHRydWVcblx0ICAgICAgICAgKiAgICAgfX07XG5cdCAgICAgICAgICogICAgIHJldHVybiB2aWV3LnVwZGF0ZU9wdGlvbnMobmV3T3B0aW9ucyk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogdXBkYXRlVmlld09wdGlvbnMoKVxuXHQgICAgICAgICAqICAgICAudGhlbihwYXlsb2FkID0+IGNvbnNvbGUubG9nKCdWaWV3IG9wdGlvbnMgdXBkYXRlZDogJywgcGF5bG9hZCkpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMudXBkYXRlT3B0aW9ucyA9IGFzeW5jIChvcHRpb25zKSA9PiB7XG5cdCAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigndXBkYXRlLXZpZXctb3B0aW9ucycsIHsgb3B0aW9ucywgLi4udGhpcy5pZGVudGl0eSB9KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBSZXRyaWV2ZXMgdGhlIHdpbmRvdyB0aGUgdmlldyBpcyBjdXJyZW50bHkgYXR0YWNoZWQgdG8uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKi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cdCAgICAgICAgICogICAgICAgICAgICAgbmFtZTogJ215LXZpZXcnLFxuXHQgICAgICAgICAqICAgICAgICAgICAgIHVybCxcblx0ICAgICAgICAgKiAgICAgICAgICAgICB0YXJnZXQ6IGZpbi5tZS5pZGVudGl0eVxuXHQgICAgICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgICAgICogICAgICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKHVybCk7XG5cdCAgICAgICAgICogICAgICAgICBhd2FpdCB2aWV3LmJpbmRUb0VsZW1lbnQoZWxlbWVudCk7XG5cdCAgICAgICAgICogICAgIH1cblx0ICAgICAgICAgKiAgICAgY3JlYXRlQW5kQXR0YWNoVmlldygpLmNhdGNoKGNvbnNvbGUuZXJyb3IpO1xuXHQgICAgICAgICAqIDwvc2NyaXB0PlxuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuYmluZFRvRWxlbWVudCA9IGFzeW5jIChlbGVtZW50KSA9PiB7XG5cdCAgICAgICAgICAgIGlmICghZWxlbWVudCkge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdFbGVtZW50IG5vdCBmb3VuZC4nKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjb25zdCBvbkNoYW5nZSA9IGFzeW5jIChib3VuZHMpID0+IHRoaXMuc2V0Qm91bmRzKGJvdW5kcyk7XG5cdCAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuZW52aXJvbm1lbnQub2JzZXJ2ZUJvdW5kcyhlbGVtZW50LCBvbkNoYW5nZSk7XG5cdCAgICAgICAgfTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogRm9jdXNlcyB0aGUgdmlld1xuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogY29uc3QgdmlldyA9IGZpbi5WaWV3LndyYXBTeW5jKHsgdXVpZDogJ3Z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gICogICAgIGNvbnN0IGp1bXBMaXN0Q29uZmlnID0gWyAvLyBhcnJheSBvZiBKdW1wTGlzdCBjYXRlZ29yaWVzXG5cdCAgICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIC8vIGhhcyBubyBuYW1lIGFuZCBubyB0eXBlIHNvIGB0eXBlYCBpcyBhc3N1bWVkIHRvIGJlIFwidGFza3NcIlxuXHQgICAgICogICAgICAgICAgICAgaXRlbXM6IFsgLy8gYXJyYXkgb2YgSnVtcExpc3QgaXRlbXNcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6IGBMYXVuY2ggJHthcHBOYW1lfWAsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246IGBSdW5zICR7YXBwTmFtZX0gd2l0aCB0aGUgZGVmYXVsdCBjb25maWd1cmF0aW9uYCxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZWVwTGluazogJ2ZpbnM6Ly9wYXRoLnRvL2FwcC9tYW5pZmVzdC5qc29uJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uUGF0aDogJ2h0dHBzOi8vcGF0aC50by9hcHAvaWNvbi5pY28nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25JbmRleDogMFxuXHQgICAgICogICAgICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgICAgIHsgdHlwZTogJ3NlcGFyYXRvcicgfSxcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6IGBSZXN0b3JlICR7YXBwTmFtZX1gLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiAnUmVzdG9yZSB0byBsYXN0IGNvbmZpZ3VyYXRpb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vYXBwL21hbmlmZXN0Lmpzb24/JCR1c2UtbGFzdC1jb25maWd1cmF0aW9uPXRydWUnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL2FwcC9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9LFxuXHQgICAgICogICAgICAgICAgICAgXVxuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBuYW1lOiAnVG9vbHMnLFxuXHQgICAgICogICAgICAgICAgICAgaXRlbXM6IFsgLy8gYXJyYXkgb2YgSnVtcExpc3QgaXRlbXNcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6ICdUb29sIEEnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiAnUnVucyBUb29sIEEnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vdG9vbC1hL21hbmlmZXN0Lmpzb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL3Rvb2wtYS9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9LFxuXHQgICAgICogICAgICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICd0YXNrJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICB0aXRsZTogJ1Rvb2wgQicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246ICdSdW5zIFRvb2wgQicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVlcExpbms6ICdmaW5zOi8vcGF0aC50by90b29sLWIvbWFuaWZlc3QuanNvbicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvblBhdGg6ICdodHRwczovL3BhdGgudG8vdG9vbC1iL2ljb24uaWNvJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uSW5kZXg6IDBcblx0ICAgICAqICAgICAgICAgICAgIH1dXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICBdO1xuXHQgICAgICpcblx0ICAgICAqICAgICBhcHAuc2V0SnVtcExpc3QoanVtcExpc3RDb25maWcpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ0p1bXBMaXN0IGFwcGxpZWQnKSkuY2F0Y2goZSA9PiBjb25zb2xlLmxvZyhgSnVtcExpc3QgZmFpbGVkIHRvIGFwcGx5OiAke2UudG9TdHJpbmcoKX1gKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqXG5cdCAgICAgKiBUbyBoYW5kbGUgZGVlcGxpbmsgYXJnczpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAgICAgZnVuY3Rpb24gaGFuZGxlVXNlTGFzdENvbmZpZ3VyYXRpb24oKSB7XG5cdCAgICAgKiAgICAgICAgIC8vIHRoaXMgaGFuZGxlciBpcyBjYWxsZWQgd2hlbiB0aGUgYXBwIGlzIGJlaW5nIGxhdW5jaGVkXG5cdCAgICAgKiAgICAgICAgIGFwcC5vbigncnVuLXJlcXVlc3RlZCcsIGV2ZW50ID0+IHtcblx0ICAgICAqICAgICAgICAgICAgIGlmKGV2ZW50LnVzZXJBcHBDb25maWdBcmdzWyd1c2UtbGFzdC1jb25maWd1cmF0aW9uJ10pIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAvLyB5b3VyIGxvZ2ljIGhlcmVcblx0ICAgICAqICAgICAgICAgICA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N0IHJlc3BvbnNlRGF0YSA9IHJlc3BvbnNlLmRhdGE7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgeyBtZXNzYWdlIH0gPSByZXNwb25zZURhdGE7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKHN1Y2Nlc3MpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY2JQYXlsb2FkID0ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHR0cFJlc3BvbnNlQ29kZTogcmVzcG9uc2VEYXRhLmh0dHBSZXNwb25zZUNvZGUsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlJbmplY3RlZDogcmVzcG9uc2VEYXRhLmFwaUluamVjdGVkXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBjYlBheWxvYWQgPSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiByZXNwb25zZURhdGEubWVzc2FnZSxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldHdvcmtFcnJvckNvZGU6IHJlc3BvbnNlRGF0YS5uZXR3b3JrRXJyb3JDb2RlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2s6IHJlc3BvbnNlRGF0YS5zdGFja1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUxpc3RlbmVyKENPTlNUUlVDVE9SX0NCX1RPUElDLCBmaXJlQ29uc3RydWN0b3IpO1xuXHQgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoe1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICBjYlBheWxvYWQsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3Ncblx0ICAgICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgLy8gc2V0IGRlZmF1bHRzOlxuXHQgICAgICAgICAgICBpZiAob3B0aW9ucy53YWl0Rm9yUGFnZUxvYWQgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgb3B0aW9ucy53YWl0Rm9yUGFnZUxvYWQgPSBmYWxzZTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBpZiAob3B0aW9ucy5hdXRvU2hvdyA9PT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICBvcHRpb25zLmF1dG9TaG93ID0gdHJ1ZTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAoMCwgd2FybmluZ3NfMS5oYW5kbGVEZXByZWNhdGVkV2FybmluZ3MpKG9wdGlvbnMpO1xuXHQgICAgICAgICAgICBjb25zdCB3aW5kb3dDcmVhdGlvbiA9IHRoaXMud2lyZS5lbnZpcm9ubWVudC5jcmVhdGVDaGlsZENvbnRlbnQoeyBlbnRpdHlUeXBlOiAnd2luZG93Jywgb3B0aW9ucyB9KTtcblx0ICAgICAgICAgICAgUHJvbWlzZS5hbGwoW3BhZ2VSZXNwb25zZSwgd2luZG93Q3JlYXRpb25dKVxuXHQgICAgICAgICAgICAgICAgLnRoZW4oKHJlc29sdmVkQXJyKSA9PiB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBwYWdlUmVzb2x2ZSA9IHJlc29sdmVkQXJyWzBdO1xuXHQgICAgICAgICAgICAgICAgaWYgKHBhZ2VSZXNvbHZlLnN1Y2Nlc3MpIHtcblx0ICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHRoaXMpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcmVqZWN0KHBhZ2VSZXNvbHZlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBpcyB0byBlbmZvcmNlIGEgNS4wIGNvbnRyYWN0IHRoYXQgdGhlIGNoaWxkJ3MgbWFpbiBmdW5jdGlvblxuXHQgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgbm90IGZpcmUgYmVmb3JlIHRoZSBwYXJlbnQncyBzdWNjZXNzIGNhbGxiYWNrIG9uIGNyZWF0aW9uLlxuXHQgICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBjaGlsZCB3aW5kb3cgaXMgbm90IGFjY2Vzc2libGUgKENPUlMpIHRoaXMgY29udHJhY3QgZG9lc1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIG5vdCBob2xkLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IHdlYldpbmRvdyA9IHRoaXMuZ2V0V2ViV2luZG93KCk7XG5cdCAgICAgICAgICAgICAgICAgICAgd2ViV2luZG93LmZpbi5fX2ludGVybmFsXy5vcGVuZXJTdWNjZXNzQ0JDYWxsZWQoKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gY29tbW9uIGZvciBtYWluIHdpbmRvd3MsIHdlIGRvIG5vdCB3YW50IHRvIGV4cG9zZSB0aGlzIGVycm9yLiBoZXJlIGp1c3QgdG8gaGF2ZSBhIGRlYnVnIHRhcmdldC5cblx0ICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmVycm9yKGUpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KVxuXHQgICAgICAgICAgICAgICAgLmNhdGNoKHJlamVjdCk7XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdC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yb250JywgdGhpcy5pZGVudGl0eSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBQZXJmb3JtcyB0aGUgc3BlY2lmaWVkIHdpbmRvdyB0cmFuc2l0aW9ucy5cblx0ICAgICAqIEBwYXJhbSB0cmFuc2l0aW9ucyAtIERlc2NyaWJlcyB0aGUgYW5pbWF0aW9ucyB0byBwZXJmb3JtLiBTZWUgdGhlIHR1dG9yaWFsLlxuXHQgICAgICogQHBhcmFtIG9wdGlvbnMgLSBPcHRpb25zIGZvciB0aGUgYW5pbWF0aW9uLiBTZWUgdGhlIHR1dG9yaWFsLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGFuaW1hdGVXaW5kb3coKSB7XG5cdCAgICAgKiAgICAgY29uc3QgdHJhbnNpdGlvbnMgPSB7XG5cdCAgICAgKiAgICAgICAgIG9wYWNpdHk6IHtcblx0ICAgICAqICAgICAgICAgICAgIG9wYWNpdHk6IDAuNyxcblx0ICAgICAqICAgICAgICAgICAgIGR1cmF0aW9uOiA1MDBcblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgcG9zaXRpb246IHtcblx0ICAgICAqICAgICAgICAgICAgIHRvcDogMTAwLFxuXHQgICAgICogICAgICAgICAgICAgbGVmdDogMTAwLFxuXHQgICAgICogICAgICAgICAgICAgZHVyYXRpb246IDUwMCxcblx0ICAgICAqICAgICAgICAgICAgIHJlbGF0aXZlOiB0cnVlXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICB9O1xuXHQgICAgICogICAgIGNvbnN0IG9wdGlvbnMgPSB7XG5cdCAgICAgKiAgICAgICAgIGludGVycnVwdDogdHJ1ZSxcblx0ICAgICAqICAgICAgICAgdHdlZW46ICdlYXNlLWluJ1xuXHQgICAgICogICAgIH07XG5cdCAgICAgKlxuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICogICAgIHJldHVybiB3aW4uYW5pbWF0ZSh0cmFuc2l0aW9ucywgb3B0aW9ucyk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogYW5pbWF0ZVdpbmRvdygpXG5cdCAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ0FuaW1hdGlvbiBkb25lJykpXG5cdCAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmVycm9yKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFuaW1hdGUodHJhbnNpdGlvbnMsIG9wdGlvbnMpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdhbmltYXRlLXdpbmRvdycsIHtcblx0ICAgICAgICAgICAgdHJhbnNpdGlvbnMsXG5cdCAgICAgICAgICAgIG9wdGlvbnMsXG5cdCAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHlcblx0ICAgICAgICB9KVxuXHQgICAgICAgICAgICAudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBIaWRlcyB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gaGlkZVdpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY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YW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldEluZm8uaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uZ2V0SW5mbygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGdldEluZm8oKS50aGVuKGluZm8gPT4gY29uc29sZS5sb2coaW5mbykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRJbmZvKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXdpbmRvdy1pbmZvJywgdGhpcy5pZGVudGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFJldHJpZXZlcyB0aGUgd2luZG93J3MgTGF5b3V0XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAgICAgLy9nZXQgdGhlIGN1cnJlbnQgd2luZG93XG5cdCAgICAgKiAgICAgY29uc3Qgd2luZG93ID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgKlxuXHQgICAgICogICAgIC8vZ2V0IHRoZSBsYXlvdXQgZm9yIHRoZSB3aW5kb3dcblx0ICAgICAqICAgICBjb25zdCBsYXlvdXQgPSBhd2FpdCB3aW5kb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dCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLnN0YXJ0KHtcblx0ICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5nZXRQYXJlbnRXaW5kb3cuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uZ2V0UGFyZW50V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogZ2V0UGFyZW50V2luZG93KCkudGhlbihwYXJlbnRXaW5kb3cgPT4gY29uc29sZS5sb2cocGFyZW50V2luZG93KSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGdldFBhcmVudFdpbmRvdygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignd2luZG93LWdldC1wYXJlbnQtd2luZG93JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShuZXcgYXBwbGljYXRpb25fMS5BcHBsaWNhdGlvbih0aGlzLndpcmUsIHRoa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nIHRvIHRoZSBjb25zb2xlPC9idXR0b24+XG5cdCAgICAgKiAgICAgICAgICAgICA8L2Rpdj5gO1xuXHQgICAgICogICAgICAgICByZW5kZXIodGVtcGxhdGUsIHdpbi5nZXRXZWJXaW5kb3coKS5kb2N1bWVudC5ib2R5KTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgfSBjYXRjaCAoZXJyKSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyKTtcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KSgpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGdldFdlYldpbmRvdygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignd2luZG93LWdldC13ZWItd2luZG93JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5lbnZpcm9ubWVudC5nZXRXZWJXaW5kb3codGhpcy5pZGVudGl0eSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIERldGVybWluZXMgaWYgdGhlIHdpbmRvdyBpcyBhIG1haW4gd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogY29uc3Qgd25kID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuXHQgICAgICogY29uc3QgaXNNYWluV25kID0gd25kLmlzTWFpbldpbmRvdygpO1xuXHQgICAgICogY29uc29sZS5sb2coJ0lzIHRoaXMgYSBtYWluIHdpbmRvdz8gJyArIGlzTWFpblduZCk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgaXNNYWluV2luZG93KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd3aW5kb3ctaXMtbWFpbi13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICByZXR1cm4gdGhpcy5tZS51dWlkID09PSB0aGlzLm1lLm5hbWU7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIERldGVybWluZXMgaWYgdGhlIHdpbmRvdyBpcyBjdXJyZW50bHkgc2hvd2luZy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGlzV2luZG93U2hvd2luZygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmlzU2hvd2luZy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHdpbi5pc1Nob3dpbmcoKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBpc1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GhlIGNoYW5nZSBpbiB0aGUgdG9wIHBvc2l0aW9uIG9mIHRoZSB3aW5kb3dcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93Lm1vdmVCeS5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIG1vdmVCeShsZWZ0LCB0b3ApIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm1vdmVCeShsZWZ0LCB0b3ApO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIG1vdmVCeSg1ODAsIDMwMCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnTW92ZWQnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIG1vdmVCeShkZWx0YUxlZnQsIGRlbHRhVG9wLCBwb3NpdGlvbmluZ09wdGlvbnMpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC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pb25zKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZVxuXHQgICAgICAgICAgICAuc2VuZEFjdGlvbigncmVzaXplLXdpbmRvdycsIHtcblx0ICAgICAgICAgICAgd2lkdGg6IE1hdGguZmxvb3Iod2lkdGgpLFxuXHQgICAgICAgICAgICBoZWlnaHQ6IE1hdGguZmxvb3IoaGVpZ2h0KSxcblx0ICAgICAgICAgICAgYW5jaG9yLFxuXHQgICAgICAgICAgICBwb3NpdGlvbmluZ09wdGlvbnMsXG5cdCAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHlcblx0ICAgICAgICB9KVxuXHQgICAgICAgICAgICAudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBSZXN0b3JlcyB0aGUgd2luZG93IHRvIGl0cyBub3JtYWwgc3RhdGUgKGkuZS4sIHVubWluaW1pemVkLCB1bm1heGltaXplZCkuXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVXaW4oKSB7XG5cdCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLnN0YXJ0KHtcblx0ICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5yZXN0b3JlLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICog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gKiAgICAgICAgIHN1Ym1lbnU6IFtcblx0ICAgICAqICAgICAgICAgICAgIHsgbGFiZWw6ICdzdWJtZW51IDEnLCBkYXRhOiAnaGVsbG8gZnJvbSBzdWJtZW51JyB9XG5cdCAgICAgKiAgICAgICAgIF1cblx0ICAgICAqICAgICB9XG5cdCAgICAgKiBdXG5cdCAgICAgKiBmaW4ubWUuc2hvd1BvcHVwTWVudSh7IHRlbXBsYXRlIH0pLnRoZW4ociA9PiB7XG5cdCAgICAgKiAgICAgaWYgKHIucmVzdWx0ID09PSAnY2xvc2VkJykge1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmxvZygnbm90aGluZyBoYXBwZW5lZCcpO1xuXHQgICAgICogICAgIH0gZWxzZSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHIuZGF0YSlcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KVxuXHQgICAgICogYGBgXG5cdCAgICAgKlxuXHQgICAgICogT3ZlcnJpZGluZyB0aGUgYnVpbHQgaW4gY29udGV4dCBtZW51IChvdGUgdGhhdCB0aGlzIGNhbiBiZSBkb25lIHBlciBlbGVtZW50IG9yIGRvY3VtZW50IHdpZGUpOlxuXHQgICAgICogYGBganNcblx0ICAgICAqIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NvbnRleHRtZW51JywgZSA9PiB7XG5cdCAgICAgKiAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuXHQgICAgICogICAgIGNvbnN0IHRlbXBsYXRlID0gW1xuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ01lbnUgSXRlbSAxJyxcblx0ICAgICAqICAgICAgICAgICAgIGRhdGE6ICdoZWxsbyBmcm9tIGl0ZW0gMSdcblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgeyB0eXBlOiAnc2VwYXJhdG9yJyB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ01lbnUgSXRlbSAyJyxcblx0ICAgICAqICAgICAgICAgICAgIHR5cGU6ICdjaGVja2JveCcsXG5cdCAgICAgKiAgICAgICAgICAgICBjaGVja2VkOiB0cnVlLFxuXHQgICAgICogICAgICAgICAgICAgZGF0YTogJ1RoZSB1c2VyIGNsaWNrZWQgdGhlIGNoZWNrYm94J1xuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ3NlZSBtb3JlJyxcblx0ICAgICAqICAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLFxuXHQgICAgICogICAgICAgICAgICAgc3VibWVudTogW1xuXHQgICAgICogICAgICAgICAgICAgICAgIHsgbGFiZWw6ICdzdWJtZW51IDEnLCBkYXRhOiAnaGVsbG8gZnJvbSBzdWJtZW51JyB9XG5cdCAgICAgKiAgICAgICAgICAgICBdXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICBdXG5cdCAgICAgKiAgICAgZmluLm1lLnNob3dQb3B1cE1lbnUoeyB0ZW1wbGF0ZSwgeDogZS54LCB5OiBlLnkgfSkudGhlbihyID0+IHtcblx0ICAgICAqICAgICAgICAgaWYgKHIucmVzdWx0ID09PSAnY2xvc2VkJykge1xuXHQgICAgICogICAgICAgICAgICAgY29uc29sZS5sb2coJ25vdGhpbmcgaGFwcGVuZWQnKTtcblx0ICAgICAqICAgICAgICAgfSBlbHNlIHtcblx0ICAgICAqICAgICAgICAgICAgIGNvbnNvbGUubG9nKHIuZGF0YSlcblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIH0pXG5cdCAgICAgKiB9KVxuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIHNob3dQb3B1cE1lbnUob3B0aW9ucykge1xuXHQgICAgICAgIGNvbnN0IHsgcGF5bG9hZCB9ID0gYXdhaXQgdGhpcy53aXJlLnN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lZCBpbiB0aGVpciBwYWdlIGNvbnRleHQsIHNldCBgY29udGVudGAgdG8gYHNjcmVlbnNob3RgLlxuXHQgICAgICovXG5cdCAgICBhc3luYyBwcmludChvcHRpb25zID0geyBjb250ZW50OiAnc2VsZicgfSkge1xuXHQgICAgICAgIHN3aXRjaCAob3B0aW9ucy5jb250ZW50KSB7XG5cdCAgICAgICAgICAgIGNhc2UgdW5kZWZpbmVkOlxuXHQgICAgICAgICAgICBjYXNlICdzZWxmJzpcblx0ICAgICAgICAgICAgICAgIHJldHVybiBzdXBlci5wcmludChvcHRpb25zKTtcblx0ICAgICAgICAgICAgY2FzZSAnc2NyZWVuc2hvdCc6XG5cdCAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3ByaW50LXNjcmVlbnNob3QnLCB0aGlzLmlkZW50aXR5KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICAgICAgICAgIGNhc2UgJ3ZpZXdzJzpcblx0ICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigncHJpbnQtdmlld3MnLCB7IC4uLnRoaXMuaWRlbnRpdHksIG9wdGlvbnMgfSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgICAgICAgICBkZWZhdWx0OlxuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdH1cblx0SW5zdGFuY2UkNy5fV2luZG93ID0gX1dpbmRvdztcblx0cmV0dXJuIEluc3RhbmNlJDc7XG59XG5cbnZhciBoYXNSZXF1aXJlZEZhY3RvcnkkMTtcblxuZnVuY3Rpb24gcmVxdWlyZUZhY3RvcnkkMSAoKSB7XG5cdGlmIChoYXNSZXF1aXJlZEZhY3RvcnkkMSkgcmV0dXJuIEZhY3RvcnkkODtcblx0aGFzUmVxdWlyZWRGYWN0b3J5JDEgPSAxO1xuXHRPYmplY3QuZGV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gICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LndyYXBTeW5jLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKiBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqIGxldCB3aW4gPSBmaW4uV2luZG93LndyYXBTeW5jKHsgdXVpZDogJ2FwcC0xJywgbmFtZTogJ215QXBwJyB9KTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICB3cmFwU3luYyhpZGVudGl0eSkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd3aW5kb3ctd3JhcC1zeW5jJykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgY29uc3QgZXJyb3JNc2cgPSAoMCwgdmFsaWRhdGVfMS52YWxpZGF0ZUlkZW50aXR5KShpZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKGVycm9yTXNnKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldy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bCBmYWlsc1xuXHQgICAgICAgIH0pO1xuXHQgICAgICAgIGlmICghdGhpcy53aXJlLm1lLmlzV2luZG93KSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBXaW5kb3cgY29udGV4dCcpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjb25zdCB7IHV1aWQsIG5hbWUgfSA9IHRoaXMud2lyZS5tZTtcblx0ICAgICAgICByZXR1cm4gdGhpcy53cmFwKHsgdXVpZCwgbmFtZSB9KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogU3luY2hyb25vdXNseSByZXR1cm5zIGEgV2luZG93IG9iamVjdCB0aGF0IHJlcHJlc2VudHMgdGhlIGN1cnJlbnQgd2luZG93XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBjb25zdCB3bmQgPSBmaW4uV2luZG93LmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiBjb25zdCBpbmZvID0gYXdhaXQgd25kLmdldEluZm8oKTtcblx0ICAgICAqIGNvbnNvbGUubG9nKGluZm8pO1xuXHQgICAgICpcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRDdXJyZW50U3luYygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWN1cnJlbnQtd2luZG93LXN5bmMnKS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5pc1dpbmRvdykge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1lvdSBhcmUgbm90IGluIGEg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AodHlwZW9mIG9wdGlvbnMubGlzdGVuZXIgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgICBleHRlcm5hbFByb2Nlc3NFeGl0SGFuZGxlciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhdGEgPSBwYXlsb2FkIHx8IHt9O1xuICAgICAgICAgICAgICAgICAgICBleGl0UGF5bG9hZCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvcGljOiAnZXhpdGVkJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHV1aWQ6IGRhdGEucHJvY2Vzc1V1aWQgfHwgJycsXG4gICAgICAgICAgICAgICAgICAgICAgICBleGl0Q29kZTogZGF0YS5leGl0Q29kZSB8fCAwXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzVXVpZCA9PT0gcGF5bG9hZC5wcm9jZXNzVXVpZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5saXN0ZW5lcihleGl0UGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBvZldpbmRvdy5yZW1vdmVMaXN0ZW5lcihleGl0RXZlbnRLZXksIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgLy8gd2luZG93IGNvbnN0cnVjdG9yIGV4cGVjdHMgdGhlIG5hbWUgaXMgbm90IHVuZGVmaW5lZFxuICAgICAgICAgICAgICAgIGlmICghdGhpcy53aXJlLm1lLm5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy53aXJlLm1lLm5hbWUgPSB0aGlzLndpcmUubWUudXVpZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb2ZXaW5kb3cgPSBuZXcgd2luZG93XzEuX1dpbmRvdyh0aGlzLndpcmUsIHRoaXMud2lyZS5tZSk7XG4gICAgICAgICAgICAgICAgb2ZXaW5kb3cub24oZXhpdEV2ZW50S2V5LCBleHRlcm5hbFByb2Nlc3NFeGl0SGFuZGxlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLndpcmVcbiAgICAgICAgICAgICAgICAuc2VuZEFjdGlvbihhY3Rpb24sIG9wdGlvbnMpXG4gICAgICAgICAgICAgICAgLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiB7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc1V1aWQgPSBwYXlsb2FkLmRhdGEudXVpZDtcbiAgICAgICAgICAgICAgICByZXNvbHZlKHBheWxvYWQuZGF0YSk7XG4gICAgICAgICAgICAgICAgaWYgKGV4aXRQYXlsb2FkICYmIHByb2Nlc3NVdWlkID09PSBleGl0UGF5bG9hZC51dWlkKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMubGlzdGVuZXIoZXhpdFBheWxvYWQpO1xuICAgICAgICAgICAgICAgICAgICBvZldpbmRvdy5yZW1vdmVMaXN0ZW5lcihleGl0RXZlbnRLZXksIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKG9mV2luZG93KSB7XG4gICAgICAgICAgICAgICAgICAgIG9mV2luZG93LnJlbW92ZUxpc3RlbmVyKGV4aXRFdmVudEtleSwgZXh0ZXJuYWxQcm9jZXNzRXhpdEhhbmRsZXIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQWRkcyBhIGxpc3RlbmVyIHRvIHRoZSBlbmQgb2YgdGhlIGxpc3RlbmVycyBhcnJ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GF3YWl0IGZpbi5TeXN0ZW0uZ2V0TG9nTGlzdCgpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgZmluLlN5c3RlbS5nZXRMb2cobG9nc1swXSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZ2V0TG9nKCkudGhlbihsb2cgPT4gY29uc29sZS5sb2cobG9nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldExvZyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1sb2cnLCBvcHRpb25zKS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhIHVuaXF1ZSBpZGVudGlmaWVyIChVVUlEKSBwcm92aWRlZCBieSB0aGUgbWFjaGluZS5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldE1hY2hpbmVJZCgpLnRoZW4oaWQgPT4gY29uc29sZS5sb2coaWQpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0TWFjaGluZUlkKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1tYWNoaW5lLWlkJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIG1pbmltdW0gKGluY2x1c2l2ZSkgbG9nZ2luZyBsZXZlbCB0aGF0IGlzIGN1cnJlbnRseSBiZWluZyB3cml0dGVuIHRvIHRoZSBsb2cuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXR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qICAgICBjb25maWc6IHtcbiAgICAgKiAgICAgICAgIHByb3h5QWRkcmVzczogXCJwcm94eUFkZHJlc3NcIiwgLy90aGUgY29uZmlndXJlZCBQcm94eSBBZGRyZXNzXG4gICAgICogICAgICAgICBwcm94eVBvcnQ6IDAsIC8vdGhlIGNvbmZpZ3VyZWQgUHJveHkgcG9ydFxuICAgICAqICAgICAgICAgdHlwZTogXCJzeXN0ZW1cIiAvL1Byb3h5IFR5cGVcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgc3lzdGVtOiB7XG4gICAgICogICAgICAgICBhdXRvQ29uZmlnVXJsOiBcIlwiLFxuICAgICAqICAgICAgICAgYnlwYXNzOiBcIlwiLFxuICAgICAqICAgICAgICAgZW5hYmxlZDogZmFsc2UsXG4gICAgICogICAgICAgICBwcm94eTogXCJcIlxuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldFByb3h5U2V0dGluZ3MoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXByb3h5LXNldHRpbmdzJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgaW5mb3JtYXRpb24gYWJvdXQgdGhlIHJ1bm5pbmcgUnVudGltZSBpbiBhbiBvYmplY3QuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRSdW50aW1lSW5mbygpLnRoZW4oUnVudGltZUluZm8gPT4gY29uc29sZS5sb2coUnVudGltZUluZm8pKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0UnVudGltZUluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXJ1bnRpbWUtaW5m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ZXNzOlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmxhdW5jaEV4dGVybmFsUHJvY2Vzcyh7XG4gICAgICogICAgIHBhdGg6ICdjbWQuZXhlJyxcbiAgICAgKiAgICAgY3dkOiAnYzpcXFxcdGVtcCcsXG4gICAgICogICAgIGFyZ3VtZW50czogJycsXG4gICAgICogICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGFtcGxlIHVzaW5nIGFuIGFsaWFzIGZyb20gYXBwLmpzb24gYXBwQXNzZXRzIHByb3BlcnR5OlxuICAgICAqXG4gICAgICogYGBganNvblxuICAgICAqIFwiYXBwQXNzZXRzXCI6IFtcbiAgICAgKiAgICAge1xuICAgICAqICAgICAgICAgXCJzcmNcIjogXCJleGUuemlwXCIsXG4gICAgICogICAgICAgICBcImFsaWFzXCI6IFwibXlBcHBcIixcbiAgICAgKiAgICAgICAgIFwidmVyc2lvblwiOiBcIjQuMTIuOFwiLFxuICAgICAqICAgICAgICAgXCJ0YXJnZXRcIjogXCJteUFwcC5leGVcIixcbiAgICAgKiAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjIGRcIlxuICAgICAqICAgICB9LFxuICAgICAqIF1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogLy8gIFdoZW4gY2FsbGVkLCBpZiBubyBhcmd1bWVudHMgYX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ICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBJdCBpcyBwb3NzaWJsZSB0byBsYXVuY2ggZmlsZXMgdGhhdCBoYXZlIGJlZW4gZG93bmxvYWRlZCBieSB0aGUgdXNlciBieSBsaXN0ZW5pbmcgdG8gdGhlIHdpbmRvd1xuICAgICAqIGBmaWxlLWRvd25sb2FkLWNvbXBsZXRlZGAgZXZlbnQgYW5kIHVzaW5nIHRoZSBgZmlsZVV1aWRgIHByb3ZpZGVkIGJ5IHRoZSBldmVudDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd2luID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIHdpbi5hZGRMaXN0ZW5lcignZmlsZS1kb3dubG9hZC1jb21wbGV0ZWQnLCAoZXZ0KSA9PiB7XG4gICAgICogICAgIGlmIChldnQuc3RhdGUgPT09ICdjb21wbGV0ZWQnKSB7XG4gICAgICogICAgICAgICBmaW4uU3lzdGVtLmxhdW5jaEV4dGVybmFsUHJvY2Vzcyh7XG4gICAgICogICAgICAgICAgICAgZmlsZVV1aWQ6IGV2dC5maWxlVXVpZCxcbiAgICAgKiAgICAgICAgICAgICBhcmd1bWVudHM6ICcnLFxuICAgICAqICAgICAgICAgICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCd0aGUgZXhpdCBjb2RlJywgcmVzdWx0LmV4aXRDb2RlKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgICAgICAgICAgY29uc29sZS5sb2cocHJvY2Vzc0lkZW50aXR5KTtcbiAgICAgKiAgICAgICAgIH0pLmNhdGNoKGVycm9yID0+IHtcbiAgICAgKiAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfVxuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogTGF1bmNoaW5nIGFzc2V0cyBzcGVjaWZpZWQgaW4gdGhlIGFwcCBtYW5pZmVzdDpcbiAgICAgKlxuICAgICAqIFNhbXBsZSBhcHBBc3NldHMgc2VjdGlvbiBpbiBhcHAuanNvblxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwiYXBwQXNzZXRzXCI6IFtcbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICBcInNyY1wiOiBcImh0dHA6Ly9maWxlc2FtcGxlcy5jb20vZXhlLnppcFwiLFxuICAgICAqICAgICAgICAgICAgIFwiYWxpYXNcIjogXCJteUFwcFwiLFxuICAgICAqICAgICAgICAgICAgIFwidmVyc2lvblwiOiBcIjQuMTIuOFwiLFxuICAgICAqICAgICAgICAgICAgIFwidGFyZ2V0XCI6IFwibXlBcHAuZXhlXCIsXG4gICAgICogICAgICAgICAgICAgXCJhcmdzXCI6IFwiYSBiIGMgZFwiXG4gICAgICogICAgICAgICB9LFxuICAgICAqICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgIFwic3JjXCI6IFwiaHR0cDovL2V4YW1wbGVzLmNvbS9leGUuemlwXCIsXG4gICAgICogICAgICAgICAgICAgXCJhbGlhc1wiOiBcIm15QXBwMlwiLFxuICAgICAqICAgICAgICAgICAgIFwidmVyc2lvblwiOiBcIjUuMTIuOFwiLFxuICAgICAqICAgICAgICAgICAgIFwidGFyZ2V0XCI6IFwibXlBcHAyLmV4ZVwiLFxuICAgICAqICAgICAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjXCJcbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgXVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogVGhpcyBwZXJtaXNzaW9uIGFsbG93cyBmb3IgbGF1bmNoaW5nIG9mIGFsbCBhc3NldHMgc3BlY2lmaWVkIGluIHRoZSBhYm92ZSBhcHBBc3NldHMgc2VjdGlvbi4gKFwibXlBcHBcIiBhbmQgXCJteUFwcDJcIik6XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJhc3NldHNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBUaGlzIHBlcm1pc3Npb24gYWxsb3dzIGZvciBsYXVuY2hpbmcgb2YgX29ubHlfIHRoZSBcIm15QXBwXCIgYXNzZXQgaW4gdGhlIGFib3ZlIGFwcEFzc2V0cyBzZWN0aW9uLCBhcyBkZWZpbmVkIGluIGBzcmNSdWxlc2A6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiYXNzZXRzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgICAgICBcInNyY1J1bGVzXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIqOi8vZmlsZXNhbXBsZXMuY29tLypcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwiYWxsb3dcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJibG9ja1wiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIExhdW5jaGluZyBkb3dubG9hZGVkIGZpbGVzOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImRvd25sb2Fkc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBhbGxvd3MgdG8gbGF1bmNoIGFsbCB0aGUgZXhlY3V0YWJsZXM6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiZXhlY3V0YWJsZXNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBvbmx5IGFsbG93cyBsYXVuY2hpbmcgb2YgZXhlY3V0YWJsZXMgd2hvc2UgZmlsZSBwYXRocyBtYXRjaCB0aGUgY29ycmVzcG9uZGluZyBgcGF0aFJ1bGVzYDpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJleGVjdXRhYmxlc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJwYXRoUnVsZXNcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIi9XaW5kb3dzL1N5c3RlbTMyLyouZXhlXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImFsbG93XCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiouZXhlXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImJsb2NrXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGxhdW5jaEV4dGVybmFsUHJvY2VzcyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNlbmRFeHRlcm5hbFByb2Nlc3NSZXF1ZXN0KCdsYXVuY2gtZXh0ZXJuYWwtcHJvY2VzcycsIG9wdGlvbnMpO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lzIHJlc3RyaWN0ZWQgYnkgZGVmYXVsdCBhbmQgbXVzdCBiZSBlbmFibGVkIHZpYVxuICAgICAqIDxhIGhyZWY9XCJodHRwczovL2RldmVsb3BlcnMub3BlbmZpbi5jby9kb2NzL2FwaS1zZWN1cml0eVwiPkFQSSBzZWN1cml0eSBzZXR0aW5nczwvYT4uXG4gICAgICogQHBhcmFtIGFwcEFzc2V0IEFwcCBhc3NldCBvYmplY3RcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBkb3dubG9hZEFzc2V0KCkge1xuICAgICAqICAgICBjb25zdCBhcHBBc3NldCA9IHtcbiAgICAgKiAgICAgICAgIHNyYzogYCR7IGxvY2F0aW9uLm9yaWdpbiB9L2Fzc2V0cy56aXBgLFxuICAgICAqICAgICAgICAgYWxpYXM6ICdkaXJBcHAnLFxuICAgICAqICAgICAgICAgdmVyc2lvbjogJzEuMjMuMjQnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiAnYXNzZXRzL3J1bi5iYXQnXG4gICAgICogICAgIH07XG4gICAgICpcbiAgICAgKiAgICAgcmV0dXJuIGZpbi5TeXN0ZW0uZG93bmxvYWRBc3NldChhcHBBc3NldCwgKHByb2dyZXNzID0+IHtcbiAgICAgKiAgICAgLy9QcmludCBwcm9ncmVzcyBhcyB3ZSBkb3dubG9hZCB0aGUgYXNzZXQuXG4gICAgICogICAgICAgICBjb25zdCBkb3dubG9hZGVkUGVyY2VudCA9IE1hdGguZmxvb3IoKHByb2dyZXNzLmRvd25sb2FkZWRCeXRlcyAvIHByb2dyZXNzLnRvdGFsQnl0ZXMpICogMTAwKTtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGBEb3dubG9hZGVkICR7ZG93bmxvYWRlZFBlcmNlbnR9JWApO1xuICAgICAqICAgICB9KSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZG93bmxvYWRBc3NldCgpXG4gICAgICog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U2l0ZSA9IHRyYW5zcG9ydF9lcnJvcnNfMSQxLlJ1bnRpbWVFcnJvci5nZXRDYWxsU2l0ZSgpO1xuICAgICAgICBjb25zdCBkb3dubG9hZElkID0gdGhpcy53aXJlLmVudmlyb25tZW50LmdldE5leHRNZXNzYWdlSWQoKS50b1N0cmluZygpO1xuICAgICAgICBjb25zdCBkbFByb2dyZXNzS2V5ID0gYGFzc2V0LWRvd25sb2FkLXByb2dyZXNzLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbEVycm9yS2V5ID0gYGFzc2V0LWRvd25sb2FkLWVycm9yLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbENvbXBsZXRlS2V5ID0gYGFzc2V0LWRvd25sb2FkLWNvbXBsZXRlLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbFByb2dyZXNzID0gKHByb2dyZXNzKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBwID0ge1xuICAgICAgICAgICAgICAgIGRvd25sb2FkZWRCeXRlczogcHJvZ3Jlc3MuZG93bmxvYWRlZEJ5dGVzLFxuICAgICAgICAgICAgICAgIHRvdGFsQnl0ZXM6IHByb2dyZXNzLnRvdGFsQnl0ZXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwcm9ncmVzc0xpc3RlbmVyKHApO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBjbGVhbkxpc3RlbmVycyA9ICgpID0+IHtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5yZW1vdmVMaXN0ZW5lcihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgfTtcbiAgICAgICAgY29uc3QgZGxFcnJvciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1x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zcy0ke2Rvd25sb2FkSWR9YDtcbiAgICAgICAgICAgIGNvbnN0IGRsRXJyb3JLZXkgPSBgcnVudGltZS1kb3dubG9hZC1lcnJvci0ke2Rvd25sb2FkSWR9YDtcbiAgICAgICAgICAgIGNvbnN0IGRsQ29tcGxldGVLZXkgPSBgcnVudGltZS1kb3dubG9hZC1jb21wbGV0ZS0ke2Rvd25sb2FkSWR9YDtcbiAgICAgICAgICAgIGNvbnN0IGRsUHJvZ3Jlc3MgPSAocHJvZ3Jlc3MpID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBwID0ge1xuICAgICAgICAgICAgICAgICAgICBkb3dubG9hZGVkQnl0ZXM6IHByb2dyZXNzLmRvd25sb2FkZWRCeXRlcyxcbiAgICAgICAgICAgICAgICAgICAgdG90YWxCeXRlczogcHJvZ3Jlc3MudG90YWxCeXRlc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcHJvZ3Jlc3NMaXN0ZW5lcihwKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBjbGVhbkxpc3RlbmVycyA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBUT0RPOiBmaXggaW50ZXJuYWwgdHlwZXNcbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVMaXN0ZW5lcihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBkbEVycm9yID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1xuICAgICAgICAgICAgICAgIGNvbnN0IHsgcmVhc29uLCBlcnI6IGVycm9yIH0gPSBwYXlsb2FkO1xuICAgICAgICAgICAgICAgIHJlamVjdChuZXcgdHJhbnNwb3J0X2Vycm9yc18xJDEuUnVudGltZUVycm9yKHsgcmVhc29uLCBlcnJvciB9LCBjYWxsc2l0ZXMpKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBkbENvbXBsZXRlID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIGNsZWFuTGlzdGVuZXJzKCk7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5vbihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5vbmNlKGRsRXJyb3JLZXksIGRsRXJyb3IpO1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLm9uY2UoZGxDb21wbGV0ZUtleSwgZGxDb21wbGV0ZSk7XG4gICAgICAgICAgICBjb25zdCBkb3dubG9hZE9wdGlvbnMgPSBPYmplY3QuYXNzaWduKG9wdGlvbnMsIHsgZG93bmxvYWRJZCB9KTtcbiAgICAgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdkb3dubG9hZC1ydW50aW1lJywgZG93bmxvYWRPcHRpb25zKS5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgY2xlYW5MaXN0ZW5lcnMoKTtcbiAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogRG93bmxvYWQgcHJlbG9hZCBzY3JpcHRzIGZyb20gZ2l2ZW4gVVJMc1xuICAgICAqIEBw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cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldEFsbEV4dGVybmFsQXBwbGljYXRpb25zKClcbiAgICAgKiAudGhlbihleHRlcm5hbEFwcHMgPT4gY29uc29sZS5sb2coJ1RvdGFsIGV4dGVybmFsIGFwcHM6ICcgKyBleHRlcm5hbEFwcHMubGVuZ3RoKSlcbiAgICAgKiAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldEFsbEV4dGVybmFsQXBwbGljYXRpb25zKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1hbGwtZXh0ZXJuYWwtYXBwbGljYXRpb25zJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHJpZXZlcyBhcHAgYXNzZXQgaW5mb3JtYXRpb24uXG4gICAgICogQHBhcmFtIG9wdGlvbnNcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldEFwcEFzc2V0SW5mbyh7YWxpYXM6J3Byb2NleHAnfSkudGhlbihhc3NldEluZm8gPT4gY29uc29sZS5sb2coYXNzZXRJbmZvKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldEFwcEFzc2V0SW5mbyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWFwcC1hc3NldC1pbmZvJywgb3B0aW9ucykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEdldCBhZGRpdGlvbmFsIGluZm8gb2YgY29va2llcy5cbiAgICA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Ly9tc2RuLm1pY3Jvc29mdC5jb20vZW4tdXMvbGlicmFyeS93aW5kb3dzL2Rlc2t0b3AvbXM2ODEzODIodj12cy44NSkuYXNweCBoZXJlfSBmb3IgV2luZG93J3MgZXJyb3IgY29kZSBkZWZpbml0aW9ucy5cbiAgICAgKlxuICAgICAqIEV4YW1wbGUgcGF5bG9hZHMgb2YgZGlmZmVyZW50IHJlZ2lzdHJ5IHR5cGVzOlxuICAgICAqXG4gICAgICogU2VlIGxpc3Qgb2YgdHlwZXMge0BsaW5rIGh0dHBzOi8vbXNkbi5taWNyb3NvZnQuY29tL2VuLXVzL2xpYnJhcnkvd2luZG93cy9kZXNrdG9wL21zNzI0ODg0KHY9dnMuODUpLmFzcHggaGVyZX0uXG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIC8vIFJFR19EV09SRFxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogMSxcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0xPQ0FMX01BQ0hJTkVcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX0RXT1JEXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX1FXT1JEXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiAxMzEwODE0NjY3MTMzNDExMixcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0xPQ0FMX01BQ0hJTkVcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX1FXT1JEXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX1NaXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiBcIkZvb0JhckJhelwiLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfTE9DQUxfTUFDSElORVwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfU1pcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfRVhQQU5EX1NaXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiBcIkM6XFxVc2VyXFxKb2huRG9lXFxBcHBEYXRhXFxMb2NhbFwiLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfQ1VSUkVOVF9VU0VSXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19FWFBBTkRfU1pcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfTVVMVElfU1pcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IFtcbiAgICAgKiAgICAgICAgIFwiRm9vXCIsXG4gICAgICogICAgICAgICBcIkJhclwiLFxuICAgICAqICAgICAgICAgXCJCYXpcIlxuICAgICAqICAgICBdLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfQ1VSUkVOVF9VU0VSXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19NVUxUSV9TWlwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19CSU5BUllcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IHtcbiAgICAgKiAgICAgICAgIGRhdGE6IFtcbiAgICAgKiAgICAgICAgICAgICAyNTUsXG4gICAgICogICAgICAgICAgICAgMjU1LFxuICAgICAqICAgICAgICAgICAgIDAsXG4gICAgICogICAgICAgICAgICAgNDMsXG4gICAgICogICAgICAgICAgICAgNTUsXG4gICAgICogICAgICAgICAgICAgMCxcbiAgICAgKiAgICAgICAgICAgICAwLFxuICAgICAqICAgICAgICAgICAgIDI1NSxcbiAgICAgKiAgICAgICAgICAgICAyNTVcbiAgICAgKiAgICAgICAgIF0sXG4gICAgICogICAgICAgICB0eXBlOiBcIkJ1ZmZlclwiXG4gICAgICogICAgIH0sXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9DVVJSRU5UX1VTRVJcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX0JJTkFSWVwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICByZWFkUmVnaXN0cnlWYWx1ZShyb290S2V5LCBzdWJrZXksIHZhbHVlKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmVcbiAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdyZWFkLXJlZ2lzdHJ5LXZhbHVlJywge1xuICAgICAgICAgICAgcm9vdEtleSxcbiAgICAgICAgICAgIHN1YmtleSxcbiAgICAgICAgICAgIHZhbHVlXG4gICAgICAgIH0pXG4gICAgICAgICAgICAudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFRoaXMgZnVuY3Rpb24gY2FsbCB3aWxsIHJlZ2lzdGVyIGEgdW5pcXVlIGlkIGFuZCBwcm9kdWNlIGEgdG9rZW4uXG4gICAgICogVGhlIHRva2VuIGNhbiBiZSB1c2VkIHRvIGJyb2tlciBhbiBleHRlcm5hbCBjb25uZWN0aW9uLlxuICAgICAqIEBwYXJhbSB1dWlkIC0gQSBVVUlEIGZvciB0aGUgcmVtb3RlIGNvbm5lY3Rpb24uXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5y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pdHRlciA9IG5ldyBldmVudHNfMSQ2LkV2ZW50RW1pdHRlcigpO1xuICAgICAgICAgICAgc3Vic2NyaWJlKGxhdW5jaEVtaXR0ZXIpO1xuICAgICAgICAgICAgY29uc3QgQXBwVmVyc2lvblByb2dyZXNzRXZlbnROYW1lID0gJ2FwcC12ZXJzaW9uLXByb2dyZXNzJztcbiAgICAgICAgICAgIGNvbnN0IFJ1bnRpbWVTdGF0dXNFdmVudE5hbWUgPSAncnVudGltZS1zdGF0dXMnO1xuICAgICAgICAgICAgY29uc3QgQXBwVmVyc2lvbkNvbXBsZXRlRXZlbnROYW1lID0gJ2FwcC12ZXJzaW9uLWNvbXBsZXRlJztcbiAgICAgICAgICAgIGNvbnN0IEFwcFZlcnNpb25FcnJvckV2ZW50TmFtZSA9ICdhcHAtdmVyc2lvbi1lcnJvcic7XG4gICAgICAgICAgICAvLyBhZGQgaWQgdG8gYXZvaWQgbXVsdGlwbGUgYXBpIGNhbGxzIGdldHRpbmcgZHVwbGljYXRlZCBldmVudHNcbiAgICAgICAgICAgIGNvbnN0IGlkID0gdGhpcy53aXJlLmVudmlyb25tZW50LmdldE5leHRNZXNzYWdlSWQoKS50b1N0cmluZygpO1xuICAgICAgICAgICAgc2VuZE9wdHMuYXBwVmVyc2lvbklkID0gaWQ7XG4gICAgICAgICAgICBjb25zdCBzdXBwb3J0ZWRFdmVudHMgPSBbXG4gICAgICAgICAgICAgICAgQXBwVmVyc2lvbkNvbXBsZXRlRXZlbnROYW1lLFxuICAgICAgICAgICAgICAgIEFwcFZlcnNpb25Qcm9ncmVzc0V2ZW50TmFtZSxcbiAgICAgICAgICAgICAgICBSdW50aW1lU3RhdHVzRXZlbnROYW1lLFxuICAgICAgICAgICAgICAgIEFwcFZlcnNpb25FcnJvckV2ZW50TmFtZVxuICAgICAgICAgICAgXTtcbiAgICAgICAgICAgIGNvbnN0IGNsZWFuRXZlbnRQYXlsb2FkID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgICAg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nMgb2YgdGhlIGNhbGxlciBhbmQgbm90IGFsbCB0aGUgcHJpbnRlcnMgb24gdGhlIGRlc2t0b3AuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRQcmludGVycygpXG4gICAgICogICAgIC50aGVuKChwcmludGVycykgPT4ge1xuICAgICAqICAgICAgICAgcHJpbnRlcnMuZm9yRWFjaCgocHJpbnRlcikgPT4ge1xuICAgICAqICAgICAgICAgICAgIGlmIChwcmludGVyLmlzRGVmYXVsdCkge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcmludGVyKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfSlcbiAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICogICAgIH0pO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldFByaW50ZXJzKCkge1xuICAgICAgICBjb25zdCB7IHBheWxvYWQgfSA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzeXN0ZW0tZ2V0LXByaW50ZXJzJyk7XG4gICAgICAgIHJldHVybiBwYXlsb2FkLmRhdGE7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFVwZGF0ZXMgUHJvY2VzcyBMb2dnaW5nIHZhbHVlczogcGVyaW9kaWMgaW50ZXJ2YWwgYW5kIG91dGxpZXIgZGV0ZWN0aW9uIGVudHJpZXMgYW5kIGludGVydmFsLlxuICAgICAqIEBwYXJhbSBvcHRpb25zIFByb2Nlc3MgTG9nZ2luZyB1cGRhdGFibGUgb3B0aW9ucy5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIFdoZW4gZW5hYmxpbmcgdmVyYm9zZSBtb2RlLCBhZGRpdGlvbmFsIHByb2Nlc3MgaW5mb3JtYXR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zdGVtLnNldERvbWFpblNldHRpbmdzLlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBkb21haW5TZXR0aW5ncyA9IGF3YWl0IGZpbi5TeXN0ZW0uZ2V0RG9tYWluU2V0dGluZ3MoKTtcbiAgICAgKiAvLyB7XG4gICAgICogLy8gICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm9wdGlvbnNcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImRvd25sb2FkU2V0dGluZ3NcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJwcm9tcHRcIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgXVxuICAgICAqIC8vIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBnZXREb21haW5TZXR0aW5ncygpIHtcbiAgICAgICAgY29uc3QgeyBwYXlsb2FkOiB7IGRhdGEgfSB9ID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1kb21haW4tc2V0dGluZ3MnLCB0aGlzLmlkZW50aXR5KTtcbiAgICAgICAgcmV0dXJuIGRhdGE7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNldHMgdGhlIGRvbWFpbiBzZXR0aW5ncyBmb3IgdGhlIGN1cnJlbnQgYXBwbGljYXRpb24uXG4gICAgICogQHBhcmFtIGRvbWFpblNldHRpbmdzIC0gZG9tYWluIHNldHRpbmdzIG9iamVjdFxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBkb21haW5TZXR0aW5ncyA9IGF3YWl0IGZpbi5TeXN0ZW0uZ2V0RG9tYWluU2V0dGluZ3MoKTtcbiAgICAgKiAvLyB7XG4gICAgICogLy8gICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm9wdGlvbnNcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImRvd25sb2FkU2V0dGluZ3NcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJwcm9tcHRcIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgXVxuICAgICAqIC8vIH1cbiAgICAgKlxuICAgICAqIC8vIFZhbGlkIHJ1bGUgYmVoYXZpb3JzIGFyZSAncHJvbXB0JyBhbmQgJ25vLXByb21wdCdcbiAgICAgKiBkb21haW5TZXR0aW5ncy5ydWxlc1swXS5vcHRpb25zLmRvd25sb2FkU2V0dGluZ3MucnVsZXNbMF0uYmVoYXZpb3IgPSAnbm8tcHJvbXB0JztcbiAgICAgKlxuICAgICAqIGF3YWl0IGZpbi5TeXN0ZW0uc2V0RG9tYWluU2V0dGluZ3MoZG9tYWluU2V0dGluZ3MpO1xuICAgICAqXG4gICAgICogY29uc3QgbmV3RG9tYWluU2V0dGluZ3MgPSBhd2FpdCBmaW4uU3lzdGVtLmdldERvbWFpblNldHRpbmdzKCk7XG4gICAgICogLy8ge1xuICAgICAqIC8vICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJodHRwczovL29wZW5maW4uY29cIlxuICAgICAqIC8vICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJkb3dubG9hZFNldHRpbmdzXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIjxhbGxfdXJscz5cIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwibm8tcHJvbXB0XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogLy8gICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICB9XG4gICAgICogLy8gICAgIF1cbiAgICAgKiAvLyB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgc2V0RG9tYWluU2V0dGluZ3MoZG9tYWluU2V0dGluZ3MpIHtcbiAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NldC1kb21haW4tc2V0dGluZ3MnLCB7IGRvbWFpblNldHRpbmdzLCAuLi50aGlzLmlkZW50aXR5IH0pO1xuICAgIH1cbn1cbnN5c3RlbS5TeXN0ZW0gPSBTeXN0ZW07XG5cbnZhciBpbnRlcmFwcGJ1cyA9IHt9O1xuXG52YXIgcmVmQ291bnRlciA9IHt9O1xuXG5PYmplY3QuZGVmaW5lUHJvcGVydHkocmVmQ291bnRlciwgXCJfX2VzTW9kdWxlXCIsIHsgdmFsdWU6IHRydWUgfSk7XG5yZWZDb3VudGVyLlJlZkNvdW50ZXIgPSB2b2lkIDA7XG5jbGFzcyBSZWZDb3VudGVyIHtcbiAgICBjb25zdHJ1Y3RvcigpIHtcbiAgICAgICAgdGhpcy50b3BpY1JlZk1hcCA9IG5ldyBNYXAoKTtcbiAgICB9XG4gICAgLy8gcmV0dXJucyB0aGUgcmVmIGNvdW50IGFmdGVyIGluY3JlbWVudGluZ1xuICAgIGluY1JlZkNvdW50KGtleSkge1xuICAgICAgICBjb25zdCByZWZDb3VudCA9IHRoaXMudG9waWNSZWZNYXAuZ2V0KGtleSk7XG4gICAgICAgIGxldCByZXR1cm5Db3VudDtcbiAgICAgICAgaWYgKCFyZWZDb3VudCkge1xuICAgICAgICAgICAgdGhpcy50b3BpY1JlZk1hcC5zZXQoa2V5LCAxKTtcbiAgICAgICAgICAgIHJldHVybkNvdW50ID0gMTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIGNvbnN0IG5ld1JlZkNvdW50ID0gcmVmQ291bnQgKyAxO1xuICAgICAgICAgICAgcmV0dXJuQ291bnQgPSBuZXdSZWZDb3VudDtcbiAgICAgICAgICAgIHRoaXMudG9waWNSZWZNYXAuc2V0KGtleSwgbmV3UmVmQ291bnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXR1cm5Db3VudDtcbiAgICB9XG4gICAgLy8gcmV0dXJucyB0aGUgcmVmIGNvdW50IGFmdGVyIGRlY3JlbWVudGluZywgb3IgLTEgaWYgdGhlIGtleSBhbHJlYWR5IGhhZCBubyByZWZlcmVuY2VzXG4gICAgZGVjUmVmQ291bnQoa2V5KSB7XG4gICAgICAgIGNvbnN0IHJlZkNvdW50ID0gdGhpcy50b3BpY1JlZk1hcC5nZXQoa2V5KTtcbiAgICAgICAgbGV0IHJldHVybkNvdW50O1xuICAgICAgICBpZiAocmVmQ291bnQpIHtcbiAgICAgICAgICAgIGNvbnN0IG5ld1JlZkNvdW50ID0gcmVmQ291bnQgLSAxO1xuICAgICAgICAgICAgdGhpcy50b3BpY1JlZk1hcC5zZXQoa2V5LCBuZXdSZWZDb3VudCk7XG4gICAgICAgICAgICByZXR1cm5Db3VudCA9IG5ld1JlZkNvdW50O1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuQ291bnQgPSAtMTtcbiAgICAgICA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gICAgfVxuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZWdpc3RlciBtaWRkbGV3YXJlIHRoYXQgZmlyZXMgYmVmb3JlIHRoZSBhY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIENoYW5uZWwgUHJvdmlkZXI6XG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IHByb3ZpZGVyID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jcmVhdGUoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgcHJvdmlkZXIucmVnaXN0ZXIoJ3Byb3ZpZGVyLWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCwgaWRlbnRpdHkpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBwcm92aWRlci5iZWZvcmVBY3Rpb24oKGFjdGlvbiwgcGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIC8vVGhlIHBheWxvYWQgY2FuIGJlIGFsdGVyZWQgaGVyZSBiZWZvcmUgaGFuZGxpbmcgdGhlIGFjdGlvbi5cbiAgICAgKiAgICAgICAgIHBheWxvYWQucmVjZWl2ZWQgPSBEYXRlLm5vdygpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHBheWxvYWQ7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG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AgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0FscmVhZHkgcmVnaXN0ZXJlZCBiZWZvcmVBY3Rpb24gbWlkZGxld2FyZScpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucHJlQWN0aW9uID0gcmVzdWx0T3JQYXlsb2FkKGZ1bmMpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZWdpc3RlciBhbiBlcnJvciBoYW5kbGVyLiBUaGlzIGlzIGNhbGxlZCBiZWZvcmUgcmVzcG9uZGluZyBvbiBhbnkgZXJyb3IuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqXG4gICAgICogQ2hhbm5lbCBQcm92aWRlcjpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNyZWF0ZSgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBwcm92aWRlci5yZWdpc3RlcigncHJvdmlkZXItYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhwYXlsb2FkKTtcbiAgICAgKiAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWN0aW9uIGVycm9yJyk7XG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIHByb3ZpZGVyLm9uRXJyb3IoKGFjdGlvbiwgZXJyb3IsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndW5jYXVnaHQgRXhjZXB0aW9uIGluIGFjdGlvbjonLCBhY3Rpb24pO1xuICAgICAqICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvcik7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNvbm5lY3QoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgY2xpZW50LnJlZ2lzdGVyKCdjbGllbnQtYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhwYXlsb2FkKTtcbiAgICAgKiAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWN0aW9uIGVycm9yJyk7XG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGNsaWVudC5vbkVycm9yKChhY3Rpb24sIGVycm9yLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ3VuY2F1Z2h0IEV4Y2VwdGlvbiBpbiBhY3Rpb246JywgYWN0aW9uKTtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IpO1xuICAgICAqICAgICB9KTtcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIG9uRXJyb3IoZnVuYykge1xuICAgICAgICBpZiAodGhpcy5lcnJvck1pZGRsZXdhcmUpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWxyZWFkeSByZWdpc3RlcmVkIGVycm9yIG1pZGRsZXdhcmUnKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmVycm9yTWlkZGxld2Fy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ID0gZGF0ZS5ub3coKTtcbiAgICAgKiAgICAgICAgIHJldHVybiBwYXlsb2FkO1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBjbGllbnQuYWZ0ZXJBY3Rpb24oKGFjdGlvbiwgcGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIC8vdGhlIHBheWxvYWQgY2FuIGJlIGFsdGVyZWQgaGVyZSBhZnRlciBoYW5kbGluZyB0aGUgYWN0aW9uIGJ1dCBiZWZvcmUgc2VuZGluZyBhbiBhY2tub3dsZWRnZW1lbnQuXG4gICAgICogICAgICAgICBwYXlsb2FkLnNlbnQgPSBkYXRlLm5vdygpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHBheWxvYWQ7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhZnRlckFjdGlvbihmdW5jKSB7XG4gICAgICAgIGlmICh0aGlzLnBvc3RBY3Rpb24pIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWxyZWFkeSByZWd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VuZCBhbiBhY3Rpb24gdG8gYSBzcGVjaWZpYyBjbGllbnQuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogQ2hhbm5lbCBQcm92aWRlcjpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNyZWF0ZSgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBwcm92aWRlci5yZWdpc3RlcigncHJvdmlkZXItYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgIGNvbnNvbGUubG9nKCdBY3Rpb24gZGlzcGF0Y2hlZCBieSBjbGllbnQ6ICcsIGlkZW50aXR5KTtcbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ1BheWxvYWQgc2VudCBpbiBkaXNwYXRjaDogJywgcGF5bG9hZCk7XG4gICAgICpcbiAgICAgKiAgICAgICAgcmV0dXJuIHsgZWNobzogcGF5bG9hZCB9O1xuICAgICAqICAgIH0pO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnQWN0aW9uIGRpc3BhdGNoZWQgYnkgY2xpZW50OiAnLCBpZGVudGl0eS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FubmVscy5yZXNwb25zZS5jbG9zZSgpO1xuICAgICAgICAgICAgdGhpcy5ydGMucnRjQ2xpZW50LmNsb3NlKCk7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoZSkgPT4ge1xuICAgICAgICAgICAgbGV0IHsgZGF0YSB9ID0gZTtcbiAgICAgICAgICAgIGlmIChlLmRhdGEgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcikge1xuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgVGV4dERlY29kZXIoKS5kZWNvZGUoZS5kYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgbWVzc2FnZUlkLCBwYXlsb2FkLCBzdWNjZXNzLCBlcnJvciB9ID0gSlNPTi5wYXJzZShkYXRhKTtcbiAgICAgICAgICAgIGNvbnN0IHsgcmVzb2x2ZSwgcmVqZWN0IH0gPSB0aGlzLnJlc3BvbnNlTWFwLmdldChtZXNzYWdlSWQpID8/IHt9O1xuICAgICAgICAgICAgaWYgKHJlc29sdmUgJiYgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNwb25zZU1hcC5kZWxldGUobWVzc2FnZUlkKTtcbiAgICAgICAgICAgICAgICBpZiAoc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHBheWxvYWQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnQ291bGQgbm90IGZpbmQgaWQgaW4gcmVzcG9uc2VNYXAuJyk7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLnJ0Yy5jaGFubmVscy5yZXF1ZXN0LmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBhc3luYyAoZSkgPT4ge1xuICAgICAgICAgICAgbGV0IHsgZGF0YSB9ID0gZTtcbiAgICAgICAgICAgIGlmIChlLmRhdGEgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcikge1xuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgVGV4dERlY29kZXIoKS5kZWNvZGUoZS5kYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgbWVzc2FnZUlkLCBhY3Rpb24sIHBheWxvYWQgfSA9IEpTT04ucGFyc2UoZGF0YSk7XG4gICAgICAgICAgICBpZiAoX19jbGFzc1ByaXZhdGVGaWVsZEdldCRiKHRoaXMsIF9SVENFbmRwb2ludF9wcm9jZXNzQWN0aW9uLCBcImZcIikpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXMgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGIodGhpcywgX1JUQ0VuZHBvaW50X3Byb2Nlc3NBY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMsIGFjdGlvbiwgcGF5bG9hZCwgZW5kcG9pbnRJZGVudGl0eSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnNlbmQoSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogcmVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiBSVENEYXRhQ2hhbm5lbCBpcyBvcGVuIGJlZm9yZSBzZW5kaW5nLCBlcnJvciBnZXRzIHN3YWxsb3dlZCBoZXJlIGluIHRoZSBjYXNlIHdoZXJlXG4gICAgICAgICAgICAgICAgICAgIC8vIGNsaWVudCBkaXNwYXRjaGVkIHRoZW4gY2xvc2VkIG9yIGRpc2Nvbm5lY3RlZCBiZWZvcmUgdGhlIGRpc3BhdGNoIHJlc29sdmVzLlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5ydGMuY2hhbm5lbHMucmVzcG9uc2UucmVhZHlTdGF0ZSA9PT0gJ29wZW4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJ0Yy5jaGFubmVscy5yZXNwb25zZS5zZW5kKEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICgwLCBlcnJvcnNfMSQxLmVycm9yVG9QT0pPKShlcnJvciksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiBSVENEYXRhQ2hhbm5lbCBpcyBvcGVuIGZvciBzYW1lIHJlYXNvbiBhcyBjYXRjaCBibG9jayBhYm92ZS5cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnJlYWR5U3RhdGUgPT09ICdvcGVuJykge1xuICAgICAgICAgICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnNlbmQoSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAg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AgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChjaGFubmVsLnJlYWR5U3RhdGUgPT09ICdjb25uZWN0aW5nJykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0ZW5lciA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWwucmVtb3ZlRXZlbnRMaXN0ZW5lcignb3BlbicsIGxpc3RlbmVyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgY2hhbm5lbC5hZGRFdmVudExpc3RlbmVyKCdvcGVuJywgbGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcignVGhpcyBDaGFubmVsIGhhcyBhbHJlYWR5IGNsb3NlZCcpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfTtcbiAgICB9XG4gICAgc3RhdGljIGNyZWF0ZURhdGFDaGFubmVsUHJvbWlzZShsYWJlbCwgcnRjQ2xpZW50KSB7XG4gICAgICAgIGxldCByZXNvbHZlcjtcbiAgICAgICAgY29uc3QgcHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7XG4gICAgICAgICAgICByZXNvbHZlciA9IHJlc29sdmU7XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBsaXN0ZW5lciA9IChlKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBvcGVuTGlzdGVuZXIgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgZS5jaGFubmVsLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ29wZW4nLCBvcGVuTGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgIHJlc29sdmVyKG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biAgICAgKiAvLyAgICAgICAgXCJ1cmxcIjogXCJodHRwczovL29wZW5maW4uY29cIlxuICAgICAqIC8vICAgIH0sXG4gICAgICogLy8gICAge1xuICAgICAqIC8vICAgICAgICBcInV1aWRcIjogXCJvcGVuZmluMlwiLFxuICAgICAqIC8vICAgICAgICBcIm5hbWVcIjogXCJvcGVuZmluLXZpZXcyXCIsXG4gICAgICogLy8gICAgICAgIFwiZW5kcG9pbnRJZFwiOiBcIjR6NWQ4YWI5LTJiODEtMzY5MS05MWV4LTE0MjE3OTM4MjUxMVwiLFxuICAgICAqIC8vICAgICAgICBcImVudGl0eVR5cGVcIjogXCJ2aWV3XCIsXG4gICAgICogLy8gICAgICAgIFwidXJsXCI6IFwiaHR0cHM6Ly9leGFtcGxlLmNvbVwiXG4gICAgICogLy8gICAgfVxuICAgICAqIC8vXVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldEFsbENsaWVudEluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmNvbm5lY3Rpb25zLm1hcCgoY2xpZW50SW5mbykgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lLCBlbmRwb2ludElkLCBlbnRpdHlUeXBlLCBjb25uZWN0aW9uVXJsIH0gPSBjbGllbnRJbmZvO1xuICAgICAgICAgICAgcmV0dXJuIHsgdXVpZCwgbmFtZSwgZW5kcG9pbnRJZCwgZW50aXR5VHlwZSwgY29ubmVjdGlvblVybCB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgY2hlY2tGb3JDbGllbnRDb25uZWN0aW9uKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIGlmICghdGhpcy5pc0NsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgVGhpcyBhY3Rpb24gd2FzIHNlbnQgZnJvbSBhIGNsaWVudCB0aGF0IGlzIG5vdCBjb25uZWN0ZWQgdG8gdGhlIHByb3ZpZGVyLlxuICAgICAgICAgICAgICAgICAgICBDbGllbnQgSWRlbnRpdHk6IHt1dWlkOiAke2NsaWVudElkZW50aXR5LnV1aWR9LCBuYW1lOiAke2NsaWVudElkZW50aXR5Lm5hbWV9LCBlbmRwb2ludElkOiAke2NsaWVudElkZW50aXR5LmVuZHBvaW50SWR9fWApO1xuICAgICAgICB9XG4gICAgfVxuICAgIGlzQ2xpZW50Q29ubmVjdGVkKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIGlmIChDaGFubmVsUHJvdmlkZXIuY2xpZW50SWRlbnRpdHlJbmNsdWRlc0VuZHBvaW50SWQoY2xpZW50SWRlbnRpdHkpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb25uZWN0aW9ucy5zb21lKChpZGVudGl0eSkgPT4ge1xuICAgICAgICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICAgICAgLy8gTWlnaHQgYmUgcmVkdW5kYW50IHRvIGNoZWNrIGZvciB1dWlkIGFuZCBuYW1lIGhlcmUgYWZ0ZXIgd2UgZ2V0IGFuIGVuZHBvaW50SWQgbWF0Y2gsIGJ1dCBqdXN0IGluIGNhc2VcbiAgICAgICAgICAgICAgICBpZGVudGl0eS5lbmRwb2ludElkID09PSBjbGllbnRJZGVudGl0eS5lbmRwb2ludElkICYmXG4gICAgICAgICAgICAgICAgICAgIGlkZW50aXR5LnV1aWQgPT09IGNsaWVudElkZW50aXR5LnV1aWQgJiZcbiAgICAgICAgICAgICAgICAgICAgaWRlbnRpdHkubmFtZSA9PT0gY2xpZW50SWRlbnRpdHkubmFtZSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5pc0xlZ2FjeUNsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSk7XG4gICAgfVxuICAgIGlzTGVnYWN5Q2xpZW50Q29ubmVjdGVkKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIHJldH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HNJblByZWZlcmVuY2VPcmRlci5qb2luKCcsICcpfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzdXBwb3J0ZWQ7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuZ2V0UHJvdmlkZXJQcm90b2NvbHMgPSAocHJvdG9jb2xzKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzdXBwb3J0ZWQgPSBwcm90b2NvbHNcbiAgICAgICAgICAgICAgICA/IHRoaXMuUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXIuZmlsdGVyKCh4KSA9PiBwcm90b2NvbHMuaW5jbHVkZXMoeCkpXG4gICAgICAgICAgICAgICAgOiB0aGlzLkRlZmF1bHRQcm92aWRlclByb3RvY29scztcbiAgICAgICAgICAgIGlmICghc3VwcG9ydGVkLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgTm8gdmFsaWQgcHJvdG9jb2xzIHdlcmUgcGFzc2VkIGluLiBBY2NlcHRlZCB2YWx1ZXMgYXJlOiAke3RoaXMuUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXIuam9pbignLCAnKX0uYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gc3VwcG9ydGVkO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmdldENvbXBhdGlibGVQcm90b2NvbHMgPSAocHJvdmlkZXJQcm90b2NvbHMsIGNsaWVudE9mZmVyKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzdXBwb3J0ZWQgPSBjbGllbnRPZmZlci5zdXBwb3J0ZWRQcm90b2NvbHMuZmlsdGVyKChjbGllbnRQcm90b2NvbCkgPT4gcHJvdmlkZXJQcm90b2NvbHMuc29tZSgocHJvdmlkZXJQcm90b2NvbCkgPT4gcHJvdmlkZXJQcm90b2NvbC50eXBlID09PSBjbGllbnRQcm90b2NvbC50eXBlICYmXG4gICAgICAgICAgICAgICAgY2xpZW50UHJ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GFubmVsc09wZW5lZCB9O1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3J0YycsXG4gICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBzdHJhdGVneV8yLlJUQ0luZm8udmVyc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IHsgb2ZmZXIsIHJ0Y0Nvbm5lY3Rpb25JZCB9XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhc2UgJ2NsYXNzaWMnOlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4geyB0eXBlOiAnY2xhc3NpYycsIHZlcnNpb246IHN0cmF0ZWd5XzEuQ2xhc3NpY0luZm8udmVyc2lvbiB9O1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAoMCwgZXhoYXVzdGl2ZV8xLmV4aGF1c3RpdmVDaGVjaykodHlwZSwgWydydGMnLCAnY2xhc3NpYyddKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSkpO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgb2ZmZXI6IHtcbiAgICAgICAgICAgICAgICBzdXBwb3J0ZWRQcm90b2NvbHMsXG4gICAgICAgICAgICAgICAgbWF4UHJvdG9jb2xzOiAyXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcnRjOiBydGNQYWNrZXRcbiAgICAgICAgfTtcbiAgICB9XG4gICAgYXN5bmMgY3JlYXRlQ2xpZW50U3RyYXRlZ3kocnRjUGFja2V0LCByb3V0aW5nSW5mbykge1xuICAgICAgICBpZiAoIXJvdXRpbmdJbmZvLmVuZHBvaW50SWQpIHtcbiAgICAgICAgICAgIHJvdXRpbmdJbmZvLmVuZHBvaW50SWQgPSB0aGlzLndpcmUuZW52aXJvbm1lbnQuZ2V0TmV4dE1lc3NhZ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c3VwcG9ydGVkUHJvdG9jb2xzOiBbXSxcbiAgICAgICAgICAgICAgICBlbmRwb2ludFBheWxvYWRQcm9taXNlOiBQcm9taXNlLnJlc29sdmUoeyBlbmRwb2ludElkZW50aXR5OiBjbGllbnRJZGVudGl0eSB9KVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNsaWVudEFuc3dlciA9IGF3YWl0IG92ZXJsYXBwaW5nUHJvdG9jb2xzLnJlZHVjZShhc3luYyAoYWNjdW1QLCBwcm90b2NvbFRvVXNlKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyID0gYXdhaXQgYWNjdW1QO1xuICAgICAgICAgICAgICAgIGlmIChwcm90b2NvbFRvVXNlLnR5cGUgPT09ICdydGMnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgYW5zd2VyOiBydGNBbnN3ZXIsIHJ0Y0NsaWVudCwgY2hhbm5lbHMgfSA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkOCh0aGlzLCBfQ29ubmVjdGlvbk1hbmFnZXJfcnRjQ29ubmVjdGlvbk1hbmFnZXIsIFwiZlwiKS5jcmVhdGVQcm92aWRlckFuc3dlcihwcm90b2NvbFRvVXNlLnBheWxvYWQucnRjQ29ubmVjdGlvbklkLCBwcm90b2NvbFRvVXNlLnBheWxvYWQub2ZmZXIpO1xuICAgICAgICAgICAgICAgICAgICBhbnN3ZXIuc3VwcG9ydGVkUHJvdG9jb2xzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3J0YycsXG4gICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBzdHJhdGVneV8yLlJUQ0luZm8udmVyc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnN3ZXI6IHJ0Y0Fuc3dlclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgYW5zd2VyLmVuZHBvaW50UGF5bG9hZFByb21pc2UgPSBhbnN3ZXIuZW5kcG9pbnRQYXlsb2FkUHJvbWlzZS50aGVuKChlbmRwb2ludFBheWxvYWQpID0+IGNoYW5uZWxzLnRoZW4oKHJlc29sdmVkQ2hhbm5lbHMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uZW5kcG9pbnRQYXlsb2FkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0Yzoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydGNDbGllbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxzOiByZXNvbHZlZENoYW5uZWxzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYW5zd2VyLnN1cHBvcnRlZFByb3RvY29scy5wdXNoKHsgdHlwZTogJ2NsYXNzaWMnLCB2ZXJzaW9uOiBzdHJhdGVneV8xLkNsYXNzaWNJbmZvLnZlcnNpb24gfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBhbnN3ZXI7XG4gICAgICAgICAgICB9LCBQcm9taXNlLnJlc29sdmUoY2xpZW50QW5zd2VyKSk7XG4gICAgICAgICAgICAvLyBOZWVkIHRvIGFzIGNhc3QgaGVyZS5cbiAgICAgICAgICAgIGNsaWVudEFuc3dlci5lbmRwb2ludFBheWxvYWRQcm9taXNlLnRoZW4oKGVuZHBvaW50UGF5bG9hZCkgPT4gc3RyYXRlZ3kuYWRkRW5kcG9pbnQoY2xpZW50SWRlbnRp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vYWQpID0+IGNvbnNvbGUubG9nKGNoYW5uZWxQYXlsb2FkKTsgLy8gc2VlIHJldHVybiB2YWx1ZSBiZWxvd1xuICAgICAqXG4gICAgICogZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5vbkNoYW5uZWxDb25uZWN0KGxpc3RlbmVyKTtcbiAgICAgKlxuICAgICAqIC8vIGV4YW1wbGUgc2hhcGVcbiAgICAgKiB7XG4gICAgICogICAgIFwidG9waWNcIjogXCJjaGFubmVsXCIsXG4gICAgICogICAgIFwidHlwZVwiOiBcImNvbm5lY3RlZFwiLFxuICAgICAqICAgICBcInV1aWRcIjogXCJPcGVuZmluUE9DXCIsXG4gICAgICogICAgIFwibmFtZVwiOiBcIk9wZW5maW5QT0NcIixcbiAgICAgKiAgICAgXCJjaGFubmVsTmFtZVwiOiBcImNvdW50ZXJcIixcbiAgICAgKiAgICAgXCJjaGFubmVsSWRcIjogXCJPcGVuZmluUE9DL09wZW5maW5QT0MvY291bnRlclwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgb25DaGFubmVsQ29ubmVjdChsaXN0ZW5lcikge1xuICAgICAgICBhd2FpdCB0aGlzLm9uKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIExpc3RlbiBmb3IgY2hhbm5lbCBkaXNjb25uZWN0aW9ucy5cbiAgICAgKlxuICAgICAqIEBwYXJhbSBsaXN0ZW5lciAtIGNhbGxiYWNrIHRvIGV4ZWN1dGUuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBsaXN0ZW5lciA9IChjaGFubmVsUGF5bG9hZCkgPT4gY29uc29sZS5sb2coY2hhbm5lbFBheWxvYWQpOyAvLyBzZWUgcmV0dXJuIHZhbHVlIGJlbG93XG4gICAgICpcbiAgICAgKiBmaW4uSW50ZXJBcHBs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ID0gKCkgPT4gdW5kZWZpbmVkO1xuICAgICAgICAgICAgY29uc3QgY29ubmVjdGVkUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7XG4gICAgICAgICAgICAgICAgY29ubmVjdGVkTGlzdGVuZXIgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2hhbm5lbE5hbWUgPT09IHBheWxvYWQuY2hhbm5lbE5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUodHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkNyh0aGlzLCBfQ2hhbm5lbF9pbnRlcm5hbEVtaXR0ZXIsIFwiZlwiKS5vbignY29ubmVjdGVkJywgY29ubmVjdGVkTGlzdGVuZXIpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGlmIChyZXRyeUluZm8uY291bnQgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdhaXQgYmVmb3JlIHJldHJ5aW5nXG4gICAgICAgICAgICAgICAgICAgIC8vIERlbGF5IHJldHVybnMgZmFsc2UgY29ubmVjdGVkUHJvbWlzZSByZXR1cm5zIHRydWUgc28gd2UgY2FuIGtub3cgaWYgYSByZXRyeSBpcyBkdWUgdG8gY29ubmVjdGVkIGV2ZW50XG4gICAgICAgICAgICAgICAgICAgIHJldHJ5SW5mby5nb3RDb25uZWN0ZWRFdmVudCA9IGF3YWl0IFByb21pc2UucmFjZShbcmV0cnlEZWxheShyZXRyeUluZm8uY291bnQpLCBjb25uZWN0ZWRQcm9taXNlXSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdjb25uZWN0LXRvLWNoYW5uZWwnLCB7IC4uLmNvbm5lY3RQYXlsb2FkLCByZXRyeUluZm8gfSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIGxvZyBvbmx5IGlmIHRoZXJlIHdhcyBhIHJldHJ5XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGBTdWNjZXNzZnVsbHkgY29ubmVjdGVkIHRvIGNoYW5uZWxOYW1lOiAke2NoYW5uZWxOYW1lfWApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0LnBheWxvYWQuZGF0YTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gU2VuZCByZXRyeUluZm8gdG8gdGhlIGNvcmUgZm9yIGRlYnVnIGxvZyBpbmNsdXNpb25cbiAgICAgICAgICAgICAgICBjb25zdCBzZW50TWVzc2FnZVByb21pc2UgPSB0aGlzLndpcmUuc2VuZEFjdGlvbignY29ubmVjdC10by1jaGFubmVsJywgY29ubmVjdFBheWxvYWQpO1xuICAgICAgICAgICAgICAgIC8vIFNhdmUgbWVzc2FnZUlkIGZyb20gdGhlIGZpcnN0IGNvbm5lY3Rpb24gYXR0ZW1wdFxuICAgICAgICAgICAgICAgIHJldHJ5SW5mby5vcmlnaW5hbE1lc3NhZ2VJZCA9IHNlbnRNZXNzYWdlUHJvbWlzZS5tZXNzYWdlSWQ7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gYXdhaXQgc2VudE1lc3NhZ2VQcm9taXNlO1xuICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQucGF5bG9hZC5kYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFlcnJvci5tZXNzYWdlLmluY2x1ZGVzKCdpbnRlcm5hbC1uYWNrJykpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gTm90IGFuIGludGVybmFsIG5hY2ssIGJyZWFrIHRoZSBsb29wXG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoc2hvdWxkV2FpdCAmJiByZXRyeUluZm8uY291bnQgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gc3RhcnQgd2FpdGluZyBvbiB0aGUgbmV4dCBpdGVyYXRpb24sIHdhcm4gdGhlIHVzZXJcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBObyBjaGFubmVsIGZvdW5kIGZvciBjaGFubmVsTmFtZTogJHtjaGFubmVsTmFtZX0uIFdhaXRpbmcgZm9yIGNvbm5lY3Rpb24uLi5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICByZXRyeUluZm8uY291bnQgKz0gMTtcbiAgICAgICAgICAgICAgICAvLyBpbiBjYXNlIG9mIG90aGVyIGVycm9ycywgcmVtb3ZlIG91ciBsaXN0ZW5lclxuICAgICAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkNyh0aGlzLCBfQ2hhbm5lbF9pbnRlcm5hbEVtaXR0ZXIsIFwiZlwiKS5yZW1vdmVMaXN0ZW5lcignY29ubmVjdGVkJywgY29ubmVjdGVkTGlzdGVuZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IHdoaWxlIChzaG91bGRXYWl0KTsgLy8gSWYgd2UncmUgd2FpdGluZyB3ZSByZXRyeSB0aGUgYWJvdmUgbG9vcFxuICAgICAgICAvLyBTaG91bGQgd2FpdCB3YXMgZmFsc2UsIG5vIGNoYW5uZWwgd2FzIGZvdW5kLlxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYE5vIGNoYW5uZWwgZm91bmQgZm9yIGNoYW5uZWxOYW1lOiAke2NoYW5uZWxOYW1lfS5gKTtcbiAgICAgICAgLyogZXNsaW50LWVuYWJsZSBuby1hd2FpdC1pbi1sb29wLC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gICAvLyBJdCBpcyB0aGUgY2xpZW50J3MgcmVzcG9uc2liaWxpdHkgdG8gaGFuZGxlIGVuZHBvaW50IGRpc2Nvbm5lY3Rpb24gdG8gdGhlIHByb3ZpZGVyLlxuICAgICAgICAvLyBJZiB0aGUgZW5kcG9pbnQgZGllcywgdGhlIGNsaWVudCB3aWxsIGZvcmNlIGEgZGlzY29ubmVjdGlvbiB0aHJvdWdoIHRoZSBjb3JlLlxuICAgICAgICAvLyBUaGUgcHJvdmlkZXIgZG9lcyBub3QgY2FyZSBhYm91dCBlbmRwb2ludCBkaXNjb25uZWN0aW9uLlxuICAgICAgICBzdHJhdGVneS5vbkVuZHBvaW50RGlzY29ubmVjdChyb3V0aW5nSW5mby5jaGFubmVsSWQsIGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgY2hhbm5lbC5zZW5kRGlzY29ubmVjdEFjdGlvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBTb21ldGhpbmcgd2VudCB3cm9uZyBkdXJpbmcgZGlzY29ubmVjdCBmb3IgY2xpZW50IHdpdGggdXVpZDogJHtyb3V0aW5nSW5mby51dWlkfSAvIG5hbWU6ICR7cm91dGluZ0luZm8ubmFtZX0gLyBlbmRwb2ludElkOiAke3JvdXRpbmdJbmZvLmVuZHBvaW50SWR9LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7XG4gICAgICAgICAgICAgICAgY2xpZW50XzEuQ2hhbm5lbENsaWVudC5oYW5kbGVQcm92aWRlckRpc2Nvbm5lY3Qocm91dGluZ0luZm8pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGNoYW5uZWw7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIENyZWF0ZSBhIG5ldyBjaGFubmVsLlxuICA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iAgICAgKiAqIGBDb21tYW5kT3JDb250cm9sKzBgXG4gICAgICogKiBgQ29tbWFuZE9yQ29udHJvbCs9YFxuICAgICAqICogYENvbW1hbmRPckNvbnRyb2wrUGx1c2BcbiAgICAgKiAqIGBDb21tYW5kT3JDb250cm9sKy1gXG4gICAgICogKiBgQ29tbWFuZE9yQ29udHJvbCtfYFxuICAgICAqICogYENvbW1hbmRPckNvbnRyb2wrU2hpZnQrSWBcbiAgICAgKiAqIGBGNWBcbiAgICAgKiAqIGBDb21tYW5kT3JDb250cm9sK1JgXG4gICAgICogKiBgU2hpZnQrRjVgXG4gICAgICogKiBgQ29tbWFuZE9yQ29udHJvbCtTaGlmdCtSYFxuICAgICAqXG4gICAgICogUmFpc2VzIHRoZSBgcmVnaXN0ZXJlZGAgZXZlbnQuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgaG90a2V5ID0gJ0NvbW1hbmRPckNvbnRyb2wrWCc7XG4gICAgICpcbiAgICAgKiBmaW4uR2xvYmFsSG90a2V5LnJlZ2lzdGVyKGhvdGtleSwgKCkgPT4ge1xuICAgICAqIGNvbnNvbGUubG9nKGAke2hvdGtleX0gcHJlc3NlZGApO1xuICAgICAqIH0pXG4gICAgICogLnRoZW4oKCkgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZygnU3VjY2VzcycpO1xuICAgICAqIH0pXG4gICAgICogLmNhdGNoKGVyciA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdFcnJvciByZWdpc3RlcmluZyB0aGUgaG90a2V5JywgZXJyKTtcbiAgICAgKiB9KTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyByZWdpc3Rlcihob3RrZXksIGxpc3RlbmVyKSB7XG4gICAgICAgIC8vIFRPRE86IGZpeCB0eXBpbmcgKGhvdGtleSBldmVudHMgYXJlIG5vdCB0eXBlZClcbiAgICAgICAgLy8gQHRzLWV4cGVjdC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gICAgICAgICBjb25zdCBjaGFubmVsTmFtZSA9IGBjdXN0b20tZnJhbWUtJHt1dWlkfWA7XG4gICAgICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgdGhpcy5fY2hhbm5lbC5jb25uZWN0KGNoYW5uZWxOYW1lLCB7IHdhaXQ6IGZhbHNlIH0pO1xuICAgICAgICAgICAgICAgIGNsaWVudC5vbkRpc2Nvbm5lY3Rpb24oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjbGllbnRNYXAuZGVsZXRlKHV1aWQpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJldHVybiBjbGllbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGNsaWVudE1hcC5kZWxldGUodXVpZCk7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdUaGUgdGFyZ2V0ZWQgUGxhdGZvcm0gaXMgbm90IGN1cnJlbnRseSBydW5uaW5nLiBMaXN0ZW4gZm9yIGFwcGxpY2F0aW9uLXN0YXJ0ZWQgZXZlbnQgZm9yIHRoZSBnaXZlbiBVdWlkLicpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBkZXByZWNhdGVkIChyZW5hbWVkKVxuICAgICAgICAgKiBAaWdub3JlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmxhdW5jaExlZ2FjeU1hbmlmZXN0ID0gdGhpcy5sYXVuY2hDb250ZW50TWFuaWZlc3Q7XG4gICAgICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEkMS52YWxpZGF0ZUlkZW50aXR5KShpZGVudGl0eSk7XG4gICAgICAgIGlmIChlcnJvck1zZykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yTXNnKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9j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3IHdpbmRvd1xuICAgICAqIGF3YWl0IHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh7XG4gICAgICogICAgIG5hbWU6IFwidGVzdF93aW5cIixcbiAgICAgKiAgICAgbGF5b3V0OiB7XG4gICAgICogICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAqICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd5YWhvb192aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly95YWhvby5jb20nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgXVxuICAgICAqICAgICB9XG4gICAgICogfSkudGhlbihjb25zb2xlLmxvZyk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgY3JlYXRlVmlldyh2aWV3T3B0aW9ucywgdGFyZ2V0LCB0YXJnZXRWaWV3KSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdwbGF0Zm9ybS1jcmVhdGUtdmlldycsIHRoaXMuaWRlbnRpdHkpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICA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aGUgc3RhbmRhcmQgY2xvc2UsIG1heGltaXplIGFuZCBtaW5pbWl6ZSBidXR0b25zLFxuICAgICAqIGFuZCB3aWxsIGF1dG9tYXRpY2FsbHkgcmVuZGVyIHRoZSBXaW5kb3cncyBsYXlvdXQgaWYgb25lIGlzIHNwZWNpZmllZC5cbiAgICAgKlxuICAgICAqIEZvciBkZWVwZXIgY3VzdG9taXphdGlvbiwgeW91IGNhbiBicmluZyB5b3VyIG93biBXaW5kb3cgY29kZSBpbnRvIGEgUGxhdGZvcm0uIFRoaXMgaXMgY2FsbGVkIGEgQ3VzdG9tIFdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKlxuICAgICAqIFRoZSBleGFtcGxlIGJlbG93IHdpbGwgY3JlYXRlIGEgRGVmYXVsdCBXaW5kb3cgd2hpY2ggdXNlcyBPcGVuRmluIGRlZmF1bHQgV2luZG93IFVJLjxicj5cbiAgICAgKiBUaGUgV2luZG93IGNvbnRhaW5zIHR3byBWaWV3cyBpbiBhIHN0YWNrIExheW91dDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcGxhdGZvcm0gPSBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKiBwbGF0Zm9ybS5jcmVhdGVXaW5kb3coe1xuICAgICAqICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18xJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWwnXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18yJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWwnXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgXVxuICAgICAqICAgICB9XG4gICAgICogfSkudGhlbihjb25zb2xlLmxvZyk7XG4gICAgICogYGBgXG4gICAgICogVGhlIERlZmF1bHQgV2luZG93J3MgZGVzaWduIGNhbiBiZSBjdXN0b21pemVkIGJ5IHNwZWNpZnlpbmcgdGhlIGBzdHlsZXNoZWV0VXJsYCBwcm9wZXJ0eSBpbiB0aGUg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AgY29uc3QgcGxhdGZvcm0gPSBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKiAgICAgY29uc3Qgd2luZG93Q29uZmlnID1cbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICB1cmw6IFwiaHR0cHM6Ly93d3cubXktZG9tYWluLmNvbS9teS1jdXN0b20td2luZG93Lmh0bWxcIiwgLy8gaGVyZSB3ZSBwb2ludCB0byB3aGVyZSB0aGUgQ3VzdG9tIEZyYW1lIGlzIGhvc3RlZC5cbiAgICAgKiAgICAgICAgICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwic3RhY2tcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwiY29tcG9uZW50XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiBcInZpZXdcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogXCJhcHAgIzFcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWxcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBcImNvbXBvbmVudFwiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogXCJ2aWV3XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFwiYXBwICMyXCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcImh0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L2NhbmFyeS9QbGF0Zm9ybS5odG1sXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh3aW5kb3dDb25maWcpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogSGVyZSdzIGFuIGV4YW1wbGUgb2YgYSBtaW5pbWFsaXN0IEN1c3RvbSBQbGF0Zm9ybSBXaW5kb3cgaW1wbGVtZW50YXRpb246XG4gICAgICogYGBgaHRtbFxuICAgICAqIDxodG1sPlxuICAgICAqICAgICA8aGVhZD5cbiAgICAgKiAgICAgICAgIDxtZXRhIGNoYXJzZXQ9XCJ1dGYtOFwiPlxuICAgICAqICAgICAgICAgPG1ldGEgbmFtZT1cInZpZXdwb3J0XCIgY29udGVudD1cIndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xXCI+XG4gICAgICogICAgICAgICA8bGluayByZWw9XCJzdHlsZXNoZWV0XCIgdHlwZT1cInRleHQvY3NzXCIgaHJlZj1cIi4vc3R5bGVzLmNzc1wiPlxuICAgICAqICAgICA8L2hlYWQ+XG4gICAgICogICAgIDxib2R5PlxuICAgICAqICAgICAgICAgPGRpdiBpZD1cIm9mLWZyYW1lLW1haW5cIj5cbiAgICAgKiAgICAgICAgICAgICA8ZGl2IGlkPVwidGl0bGUtYmFyXCI+XG4gICAgICogICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0aXRsZS1iYXItZHJhZ2dhYmxlXCI+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwidGl0bGVcIj4gVGhpcyBpcyBhIGN1c3RvbSBmcmFtZSEgPC9kaXY+XG4gICAgICogICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAqICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwiYnV0dG9ucy13cmFwcGVyXCI+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiYnV0dG9uXCIgaWQ9XCJtaW5pbWl6ZS1idXR0b25cIj48L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJidXR0b25cIiBpZD1cImV4cGFuZC1idXR0b25cIj48L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJidXR0b25cIiBpZD1cImNsb3NlLWJ1dHRvblwiPjwvZGl2PlxuICAgICAqICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICA8ZGl2IGlkPVwibGF5b3V0LWNvbnRhaW5lclwiPjwvZGl2PiA8IS0tIE9wZW5GaW4gbGF5b3V0IHdvdWxkIGJlIGluamVjdGVkIGhlcmUgLS0+XG4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4gICAgICogICAgIHdpbmRvd3M6IFtcbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NvbXBvbmVudF9YJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3d3dy5vcGVuZmluLmNvJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NvbXBvbmVudF9ZJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2VtYmVkLXdlYi9jaGFydC5odG1sJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICBdXG4gICAgICogfVxuICAgICAqXG4gICAgICogcGxhdGZvcm0uYXBwbHlTbmFwc2hvdChzbmFwc2hvdCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBJbiBwbGFjZSBvZiBhIHNuYXBzaG90IG9iamVjdCwgYGFwcGx5U25hcHNob3RgIGNhbiB0YWtlIGEgdXJsIG9yIGZpbGVwYXRoIGFuZCB0byByZXRyaWV2ZSBhIEpTT04gc25hcHNob3QuXG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKiBwbGF0Zm9ybS5hcHBseVNuYXBzaG90KCdodHRwczovL2FwaS5qc29uYmluLmlvL2IvNWU2ZjkwM2VmNDMzMWU2ODFmYzEyMzFkLzEnKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIE9wdGlvbmFsbHksIGBhcHBseVNuYXBzaG90YCBjYW4gY2xvc2UgZXhpc3Rpbmcgd2luZG93cyBhbmQgcmVzdG9yZSBhIFBsYXRmb3JtIHRvIGEgcHJldmlvdXNseSBzYXZlZCBzdGF0ZS5cbiAgICAgKiBUaGlzIGlzIGFjY29tcGxpc2hlZCBieSBwcm92aWRpbmcgYHsgY2xvc2VFeGlzdGluZ1dpbmRvd3M6IHRydWUgfWAgYXMgYW4gb3B0aW9uLlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiAvLyBHZXQgYSB3cmFwcGVkIGxheW91dCBwbGF0Zm9ybSBpbnN0YW5jZVxuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGFkZFZpZXdUb1dpbmRvdyh3aW5JZCkge1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgcGxhdGZvcm0uY3JlYXRlVmlldyh7XG4gICAgICogICAgICAgICBuYW1lOiAndGVzdF92aWV3XzMnLFxuICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9vcGVuZmluLmNvJ1xuICAgICAqICAgICB9LCB3aW5JZCk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luZG93V2l0aFR3b1ZpZXdzKCkge1xuICAgICAqICAgICBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50KCk7XG4gICAgICpcbiAgICAgKiAgICAgcmV0dXJuIHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh7XG4gICAgICogICAgICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18xJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vZXhhbXBsZS5jb20nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0ZXN0X3ZpZXdfMicsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3lhaG9vLmNvbSdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogY29uc3Qgd2luID0gYXdhaXQgY3JlYXRlV2luZG93V2l0aFR3b1ZpZXdzKCk7XG4gICAgICogLy8gLi4uIHlvdSB3aWxsIG5vdyBzZWUgYSBuZXcgd2luZG93IHdpdGggdHdvIHZpZXdzIGluIGl0XG4gICAgICpcbiAg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0Lic7XG4gICAgICAgIGxldCBzbmFwc2hvdDtcbiAgICAgICAgaWYgKHR5cGVvZiByZXF1ZXN0ZWRTbmFwc2hvdCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgIC8vIEZldGNoIGFuZCBwYXJzZSBzbmFwc2hvdFxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHRoaXMuX2NoYW5uZWwud2lyZS5zZW5kQWN0aW9uKCdnZXQtYXBwbGljYXRpb24tbWFuaWZlc3QnLCB7XG4gICAgICAgICAgICAgICAgICAgIG1hbmlmZXN0VXJsOiByZXF1ZXN0ZWRTbmFwc2hvdFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHNuYXBzaG90ID0gcmVzcG9uc2UucGF5bG9hZC5kYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgJHtlcnJNc2d9OiAke2Vycn1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHNuYXBzaG90ID0gcmVxdWVzdGVkU25hcHNob3Q7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFzbmFwc2hvdC53aW5kb3dzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyTXNnKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLmdldENsaWVudCgpO1xuICAgICAgICBhd2FpdCBjbGllbnQuZGlzcGF0Y2goJ2FwcGx5LXNuYXBzaG90Jywge1xuICAgICAgICAgICAgc25hcHNob3QsXG4gICAgICAgICAgICBvcHRpb25zXG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICB9XG4gICAgLyoqXG4gICAgICogRmV0Y2hlcyBhIEpTT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NvbnRyb2xsZXJ9XG4gICAgICAgICAqL1xuICAgICAgICBfTGF5b3V0X2xheW91dENsaWVudC5zZXQodGhpcywgbmV3IGxhenlfMS5MYXp5KGFzeW5jICgpID0+IGxheW91dF9lbnRpdGllc18xLkxheW91dE5vZGUubmV3TGF5b3V0RW50aXRpZXNDbGllbnQoYXdhaXQgdGhpcy5wbGF0Zm9ybS5nZXRDbGllbnQoKSwgbGF5b3V0X2NvbnN0YW50c18xJDEuTEFZT1VUX0NPTlRST0xMRVJfSUQsIHRoaXMuaWRlbnRpdHkpKSk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXBsYWNlcyBhIFBsYXRmb3JtIHdpbmRvdydzIGxheW91dCB3aXRoIGEgbmV3IGxheW91dC5cbiAgICAgICAgICpcbiAgICAgICAgICogQHJlbWFya3MgQW55IHZpZXdzIHRoYXQgd2VyZSBpbiB0aGUgb2xkIGxheW91dCBidXQgbm90IHRoZSBuZXcgbGF5b3V0IHdpbGwgYmUgZGVzdHJveWVkLiBWaWV3cyB3aWxsIGJlIGFzc2lnbmVkIGEgcmFuZG9tbHkgZ2VuZXJhdGVkIG5hbWUgdG8gYXZvaWQgY29sbGlzaW9ucy5cbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogbGV0IHdpbmRvd0lkZW50aXR5O1xuICAgICAgICAgKiBpZiAoZmluLm1lLmlzV2luZG93KSB7XG4gICAgICAgICAqICAgICB3aW5kb3dJZGVudGl0eSA9IGZpbi5tZS5pZGVudGl0eTtcbiAgICAgICAgICogfSBlbHNlIGlmIChmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB3aW5kb3dJZGVudGl0eSA9IChhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFdpbmRvdygpKS5pZGVudGl0eTtcbiAgICAgICAgICogfSBlbHNlIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3IG9yIFdpbmRvdycpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IGxheW91dCA9IGZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcFN5bmMod2luZG93SWRlbnRpdHkpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBuZXdMYXlvdXQgPSB7XG4gICAgICAgICAqICAgICBjb250ZW50OiBbXG4gICAgICAgICAqICAgICAgICAge1xuICAgICAgICAgKiAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAgICAgKiAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICAgICAqICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICduZXdfY29tcG9uZW50X0ExJyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0FmZmluaXR5OiAncHNfMScsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3LmV4YW1wbGUuY29tJ1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICogICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAqICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICduZXdfY29tcG9uZW50X0EyJyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9lbWJlZC13ZWIvY2hhcnQuaHRtbCdcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAqICAgICAgICAgICAgIF1cbiAgICAgICAgICogICAgICAgICB9XG4gICAgICAgICAqICAgICBdXG4gICAgICAgICAqIH07XG4gICAgICAgICAqXG4gICAgICAgICAqIGxheW91dC5yZXBsYWNlKG5ld0xheW91dCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5yZXBsYWNlID0gYXN5bmMgKGxheW91dCkgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1yZXBsYWNlJykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgdGhpcy5wbGF0Zm9ybS5nZXRDbGllbnQoKTtcbiAgICAgICAgICAgIGF3YWl0IGNsaWVudC5kaXNwYXRjaCgncmVwbGFjZS1sYXlvdXQnLCB7XG4gICAgICAgICAgICAgICAgdGFyZ2V0OiB0aGlzLmlkZW50aXR5LFxuICAgICAgICAgICAgICAgIG9wdHM6IHsgbGF5b3V0IH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICAvKipcbiAgICAgICAgICogUmVwbGFjZXMgdGhlIHNwZWNpZmllZCB2aWV3IHdpdGggYSB2aWV3IHdpdGggdGhlIHByb3ZpZGVkIGNvbmZpZ3VyYXRpb24uXG4gICAgICAgICAqXG4gICAgICAgICA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nkgb2JqZWN0IHdpdGggYHByZXNldFR5cGVgIHByb3BlcnR5IHRoYXQgc2V0cyB3aGljaCBwcmVzZXQgbGF5b3V0IGFycmFuZ2VtZW50IHRvIHVzZS5cbiAgICAgICAgICogVGhlIHByZXNldCBvcHRpb25zIGFyZSBgY29sdW1uc2AsIGBncmlkYCwgYHJvd3NgLCBhbmQgYHRhYnNgLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBsZXQgd2luZG93SWRlbnRpdHk7XG4gICAgICAgICAqIGlmIChmaW4ubWUuaXNXaW5kb3cpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gZmluLm1lLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2UgaWYgKGZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gKGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50V2luZG93KCkpLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2Uge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcgb3IgV2luZG93Jyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gZmluLlBsYXRmb3JtLkxheW91dC53cmFwU3luYyh3aW5kb3dJZGVudGl0eSk7XG4gICAgICAgICAqIGF3YWl0IGxheW91dC5hcHBseVByZXNldCh7IHByZXNldFR5cGU6ICdncmlkJyB9KTtcbiAgICAgICAgICpcbiAgICAgICAgICogLy8gd2FpdCA1IHNlY29uZHMgdW50aWwgeW91IGNoYW5nZSB0aGUgbGF5b3V0IGZyb20gZ3JpZCB0byB0YWJzXG4gICAgICAgICAqIGF3YWl0IG5ldyBQcm9taXNlIChyZXMgPT4gc2V0VGltZW91dChyZXMsIDUwMDApKTtcbiAgICAgICAgICogYXdhaXQgbGF5b3V0LmFwcGx5UHJlc2V0KHsgcHJlc2V0VHlwZTogJ3RhYnMnIH0pO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuYXBwbHlQcmVzZXQgPSBhc3luYyAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1hcHBseS1wcmVzZXQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLnBsYXRmb3JtLmdldENsaWVudCgpO1xuICAgICAgICAgICAgY29uc3QgeyBwcmVzZXRUeXBlIH0gPSBvcHRpb25zO1xuICAgICAgICAgICAgaWYgKCFwcmVzZXRUeXBlIHx8ICEoMCwgY29tbW9uX3V0aWxzXzEuaXNWYWxpZFByZXNldFR5cGUpKHByZXNldFR5cGUpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgYXBwbHkgcHJlc2V0IGxheW91dCwgcGxlYXNlIGluY2x1ZGUgYW4gYXBwbGljYWJsZSBwcmVzZXRUeXBlIHByb3BlcnR5IGluIHRoZSBQcmVzZXRMYXlvdXRPcHRpb25zLicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdhcHBseS1wcmVzZXQtbGF5b3V0Jywge1xuICAgICAgICAgICAgICAgIHRhcmdldDogdGhpcy5pZGVudGl0eSxcbiAgICAgICAgICAgICAgICBvcHRzOiB7IHByZXNldFR5cGUgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEudmFsaWRhdGVJZGVudGl0eSkoaWRlbnRpdHkpO1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4uUGxhdGZvcm0uTGF5b3V0LmluaXQoKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqIDxicj5cbiAgICAgICAgICpcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogY29uc3QgY29udGFpbmVySWQgPSAnbXktY3VzdG9tLWNvbnRhaW5lci1pZCc7XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IG15TGF5b3V0Q29udGFpbmVyID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoY29udGFpbmVySWQpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBteUxheW91dENvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCd0YWItY3JlYXRlZCcsIGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAqICAgICBjb25zdCB7IHRhYlNlbGVjdG9yIH0gPSBldmVudC5kZXRhaWw7XG4gICAgICAgICAqICAgICBjb25zdCB0YWJFbGVtZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQodGFiU2VsZWN0b3IpO1xuICAgICAgICAgKiAgICAgY29uc3QgZXhpc3RpbmdDb2xvciA9IHRhYkVsZW1lbnQuc3R5bGUuYmFja2dyb3VuZENvbG9yO1xuICAgICAgICAgKiAgICAgdGFiRWxlbWVudC5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSBcInJlZFwiO1xuICAgICAgICAgKiAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAqICAgICAgICAgdGFiRWxlbWVudC5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSBleGlzdGluZ0NvbG9yO1xuICAgICAgICAgKiAgICAgfSwgMjAwMCk7XG4gICAgICAgICAqIH0pO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyBpbml0aWFsaXplIHRoZSBsYXlvdXQgaW50byBhbiBleGlzdGluZyBIVE1MIGVsZW1lbnQgd2l0aCB0aGUgZGl2IGBteS1jdXN0b20tY29udGFpbmVyLWlkYFxuICAgICAg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hZ2VyLCBcImZcIiksIGxheW91dElkZW50aXR5KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCQ0KHRoaXMsIF9MYXlvdXRNb2R1bGVfZ2V0TGF5b3V0TWFuYWdlclNweSwgXCJmXCIpLmNhbGwodGhpcywgbGF5b3V0SWRlbnRpdHksIGxheW91dE1hbmFnZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMud3JhcFN5bmModGhpcy5maW4ubWUuaWRlbnRpdHkpO1xuICAgICAgICB9O1xuICAgICAgICBfTGF5b3V0TW9kdWxlX2dldExheW91dE1hbmFnZXJTcHkuc2V0KHRoaXMsIChsYXlvdXRJZGVudGl0eSwgbGF5b3V0TWFuYWdlcikgPT4ge1xuICAgICAgICAgICAgY29uc3QgbXNnID0gJ1tMYXlvdXRdIFlvdSBhcmUgdXNpbmcgYSBkZXByZWNhdGVkIHByb3BlcnR5IGBsYXlvdXRNYW5hZ2VyYCAtIGl0IHdpbGwgdGhyb3cgaWYgeW91IGFjY2VzcyBpdCBzdGFydGluZyBpbiB2MzcuJztcbiAgICAgICAgICAgIGNvbnN0IG1hbmFnZXJQcm94eSA9IG5ldyBQcm94eShsYXlvdXRNYW5hZ2VyLCB7XG4gICAgICAgICAgICAgICAgZ2V0KHRhcmdldCwga2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgW0xheW91dC1tZ3ItcHJveHldIGFjY2Vzc2luZyAke2tleS50b1N0cmluZygpfWApO1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4obXNnKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRhcmdldFtrZXldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgbGF5b3V0ID0gT2JqZWN0LmFzc2lnbih0aGlzLndyYXBTeW5jKGxheW91dElkZW50aXR5KSwgeyBsYXlvdXRNYW5hZ2VyOiBtYW5hZ2VyUHJveHkgfSk7XG4gICAgICAgICAgICBjb25zdCBsYXlvdXRQcm94eSA9IG5ldyBQcm94eShsYXlvdXQsIHtcbiAgICAgICAgICAgICAgICBnZXQodGFyZ2V0LCBrZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gJ2xheW91dE1hbmFnZXInKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYFtMYXlvdXQtcHJveHldIGFjY2Vzc2luZyAke2tleS50b1N0cmluZygpfWApO1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKG1zZyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRhcmdldFtrZXldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIGxheW91dFByb3h5O1xuICAgICAgICB9KTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIFJldHVybnMgdGhlIGxheW91dCBtYW5hZ2VyIGZvciB0aGUgY3VycmVudCB3aW5kb3dcbiAgICAgICAgICogQHJldHVybnNcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZ2V0Q3VycmVudExheW91dE1hbmFnZXJTeW5jID0gKCkgPT4ge1xuICAgICAgICAgICAgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQ0KHRoaXMsIF9MYXlvdXRNb2R1bGVfaW5zdGFuY2VzLCBcIm1cIiwgX0xheW91dE1vZHVsZV90aHJvd0lmTGF5b3V0TWFuYWdlck5vdEluaXRpYWxpemVkKS5jYWxsKHRoaXMsIGBmaW4uUGxhdGZvcm0uTGF5b3V0LmdldEN1cnJlbnRMYXlvdXRNYW5hZ2VyU3luYygpYCk7XG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yIFVzZXIgbWF5IGhhdmUgaW1wbGVtZW50ZWQgdGhla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LyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBuZXcgSW5zdGFuY2VfMSQyLkxheW91dChpZGVudGl0eSwgdGhpcy53aXJlKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQXN5bmNocm9ub3VzbHkgcmV0dXJucyBhIExheW91dCBvYmplY3QgdGhhdCByZXByZXNlbnRzIGEgV2luZG93J3MgbGF5b3V0LlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IGxheW91dCA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5MYXlvdXQuZ2V0Q3VycmVudCgpO1xuICAgICAqIC8vIFVzZSB3cmFwcGVkIGluc3RhbmNlIHRvIGNvbnRyb2wgbGF5b3V0LCBlLmcuOlxuICAgICAqIGNvbnN0IGxheW91dENvbmZpZyA9IGF3YWl0IGxheW91dC5nZXRDb25maWcoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBnZXRDdXJyZW50KCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LWdldC1jdXJyZW50JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKCF0aGlzLmZpbi5tZS5pc1dpbmRvdykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgYXJlIG5vdCBpbiBhIFdpbmRvdyBjb250ZXh0LiAgT25seSBXaW5kb3dzIGNhbiBoYXZlIGEgTGF5b3V0LicpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHsgdXVpZCwgbmFtZSB9ID0gdGhpcy5maW4ubWU7XG4gICAgICAgIHJldHVybiB0aGlzLndyYXAoeyB1dWlkLCBuYW1lIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTeW5jaHJvbm91c2x5IHJldHVybnMgYSBMYXl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ByZXR1cm4gdGhpcy53cmFwU3luYyh7IHV1aWQ6IHRoaXMud2lyZS5tZS51dWlkIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGFuZCBzdGFydHMgYSBQbGF0Zm9ybSBhbmQgcmV0dXJucyBhIHdyYXBwZWQgYW5kIHJ1bm5pbmcgUGxhdGZvcm0gaW5zdGFuY2UuIFRoZSB3cmFwcGVkIFBsYXRmb3JtIG1ldGhvZHMgY2FuXG4gICAgICogYmUgdXNlZCB0byBsYXVuY2ggY29udGVudCBpbnRvIHRoZSBwbGF0Zm9ybS4gIFByb21pc2Ugd2lsbCByZWplY3QgaWYgdGhlIHBsYXRmb3JtIGlzIGFscmVhZHkgcnVubmluZy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiB0cnkge1xuICAgICAqICAgICBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5zdGFydCh7XG4gICAgICogICAgICAgICB1dWlkOiAncGxhdGZvcm0tMScsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogZmFsc2UsXG4gICAgICogICAgICAgICBkZWZhdWx0V2luZG93T3B0aW9uczoge1xuICAgICAqICAgICAgICAgICAgIHN0eWxlc2hlZXRVcmw6ICdjc3Mtc2hlZXQtdXJsJyxcbiAgICAgKiAgICAgICAgICAgICBjb3JuZXJSb3VuZGluZzoge1xuICAgICAqICAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwLFxuICAgICAqICAgICAgICAgICAgICAgICB3aWR0aDogMTBcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0pO1xuICAgICAqICAgICBjb25zb2xlLmxvZygnUGxhdGZvcm0gaXMgcnVubmluZycsIHBsYXRmb3JtKTtcbiAgICAgKiB9IGNhdGNoKGUpIHtcbiAgICAgKiAgICAgY29uc29sZS5lcnJvcihlKTtcbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgc3RhcnQocGxhdGZvcm1PcHRpb25zKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdwbGF0Zm9ybS1zdGFydCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1hc3luYy1wcm9taXNlLWV4ZWN1dG9yXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShhc3luYyAocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHsgdXVpZCB9ID0gcGxhdGZvcm1PcHRpb25zO1xuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3IgdXNpbmcgcHJpdmF0ZSB2YXJpYWJsZS5cbiAgICAgICAgICAgICAgICBjb25zdCBhcHAgPSBhd2FpdCB0aGlzLmZpbi5BcHBsaWNhdGlvbi5fY3JlYXRlKHsgLi4ucGxhdGZvcm1PcHRpb25zLCBpc1BsYXRmb3JtQ29udHJvbGxlcjogdHJ1ZSB9KTtcbiAgICAgICAgICAgICAgICAvLyBUT0RPOiBmaXggdHlwaW5nIChpbnRlcm5hbClcbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgYXBwLm9uY2UoJ3BsYXRmb3JtLWFwaS1yZWFkeScsICgpID0+IHJlc29sdmUodGhpcy53cmFwU3luYyh7IHV1aWQgfSkpKTtcbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yIHVzaW5nIHByaXZhdGUgdmFyaWFibGUuXG4gICAgICAgICAgICAgICAgYXBwLl9ydW4oeyB1dWlkIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAg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1xuICAgICAqICAgICBjb25zb2xlLmxvZygnUGxhdGZvcm0gaXMgcnVubmluZywgd3JhcHBlZCBwbGF0Zm9ybTogJywgcGxhdGZvcm0pO1xuICAgICAqIH0gY2F0Y2goZSkge1xuICAgICAqICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgICAqIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBzdGFydEZyb21NYW5pZmVzdChtYW5pZmVzdFVybCwgb3B0cykge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigncGxhdGZvcm0tc3RhcnQtZnJvbS1tYW5pZmVzdCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1hc3luYy1wcm9taXNlLWV4ZWN1dG9yXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShhc3luYyAocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3IgdXNpbmcgcHJpdmF0ZSB2YXJpYWJsZS5cbiAgICAgICAgICAgICAgICBjb25zdCBhcHAgPSBhd2FpdCB0aGlzLmZpbi5BcHBsaWNhdGlvbi5fY3JlYXRlRnJvbU1hbmlmZXN0KG1hbmlmZXN0VXJsKTtcbiAgICAgICAgICAgICAgICAvLyBUT0RPOiBmaXggdHlwaW5nIChpbnRlcm5hbClcbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgYXBwLm9uY2UoJ3BsYXRmb3JtLWFwaS1yZWFkeScsICgpID0+IHJlc29sdmUodGhpcy53cmFwU3luYyh7IHV1aWQ6IGFwcC5pZGVudGl0eS51dWlkIH0pKSk7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvciB1c2luZ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NvbnNvbGUud2FybihtZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LmdldCguLi5hcmdzKTtcbiAgICAgICAgfSxcbiAgICAgICAgc2V0OiAoLi4uYXJncykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihtZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LnNldCguLi5hcmdzKTtcbiAgICAgICAgfSxcbiAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOiAoLi4uYXJncykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihtZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvciguLi5hcmdzKTtcbiAgICAgICAgfSxcbiAgICAgICAgb3duS2V5czogKC4uLmFyZ3MpID0+IHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICAgICAgICBjb25zb2xlLndhcm4obWVzc2FnZSk7XG4gICAgICAgICAgICByZXR1cm4gUmVmbGVjdC5vd25LZXlzKC4uLmFyZ3MpO1xuICAgICAgICB9XG4gICAgfSk7XG59XG5pbmFjY2Vzc2libGVPYmplY3QuY3JlYXRlV2FybmluZ09iamVjdCA9IGNyZWF0ZVdhcm5pbmdPYmplY3Q7XG5cbnZhciBJbnRlcm9wQnJva2VyID0ge307XG5cbnZhciBTZXNzaW9uQ29udGV4dEdyb3VwQnJva2VyID0ge307XG5cbnZhciBoYXNSZXF1aXJlZFNlc3Npb25Db250ZXh0R3JvdXBCcm9rZXI7XG5cbmZ1bmN0aW9uIHJlcXVpcmVTZXNzaW9uQ29udGV4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ICB9XG5cdCAgICAgICAgY29uc3QgY2xpZW50U3RhdGUgPSB0aGlzLmdldENsaWVudFN0YXRlKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICBpZiAoIWNsaWVudFN0YXRlKSB7XG5cdCAgICAgICAgICAgIC8vIFRoaXMgc2hvdWxkbid0IGdldCBoaXQuXG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2xpZW50IHdpdGggSWRlbnRpdHk6ICR7Y2xpZW50SWRlbnRpdHkudXVpZH0gJHtjbGllbnRJZGVudGl0eS5uYW1lfSBub3QgaW4gU2Vzc2lvbiBDbGllbnQgU3RhdGUgTWFwYCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIC8vIHNldCB0aGUgY29udGV4dFxuXHQgICAgICAgIHRoaXMuY29udGV4dEdyb3VwTWFwLnNldChjb250ZXh0LnR5cGUsIGNvbnRleHQpO1xuXHQgICAgICAgIHRoaXMubGFzdENvbnRleHQgPSBjb250ZXh0O1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN1YnNjcmlwdGlvblN0YXRlcyA9IEFycmF5LmZyb20odGhpcy5jbGllbnRzLnZhbHVlcygpKTtcblx0ICAgICAgICBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZXMuZm9yRWFjaCgoY2xpZW50KSA9PiB7XG5cdCAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby11bnVzZWQtZXhwcmVzc2lvbnNcblx0ICAgICAgICAgICAgY2xpZW50LmNvbnRleHRIYW5kbGVycy5nZXQoY29udGV4dC50eXBlKT8uZm9yRWFjaCgoaGFuZGxlcklkKSA9PiB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudC5jbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGlmIChjbGllbnQuZ2xvYmFsSGFu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aGFuZGxlcklkXSk7XG5cdCAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRDb250ZXh0ID0gdGhpcy5jb250ZXh0R3JvdXBNYXAuZ2V0KGNvbnRleHRUeXBlKTtcblx0ICAgICAgICAgICAgaWYgKGN1cnJlbnRDb250ZXh0KSB7XG5cdCAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGN1cnJlbnRDb250ZXh0KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUuZ2xvYmFsSGFuZGxlciA9IGhhbmRsZXJJZDtcblx0ICAgICAgICAgICAgY29uc3QgZ2xvYmFsRGlzcGF0Y2hQcm9taXNlcyA9IFsuLi50aGlzLmNvbnRleHRHcm91cE1hcC5rZXlzKCldLm1hcChhc3luYyAoY3VycmVudENvbnRleHRUeXBlKSA9PiB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBjdXJyZW50Q29udGV4dCA9IHRoaXMuY29udGV4dEdyb3VwTWFwLmdldChjdXJyZW50Q29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRDb250ZXh0KSB7XG5cdCAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5wcm92aWRlci5kaXNwYXRjaChjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjdXJyZW50Q29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICBhd2FpdCBQcm9taXNlLmFsbChnbG9iYWxEaXNwYXRjaFByb21pc2VzKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICBoYW5kbGVyUmVtb3ZlZChwYXlsb2FkLCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IHsgaGFuZGxlcklkIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudCA9IHRoaXMuY2xpZW50cy5nZXQoY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCk7XG5cdCAgICAgICAgaWYgKGNsaWVudCkge1xuXHQgICAgICAgICAgICBBcnJheS5mcm9tKGNsaWVudC5jb250ZXh0SGFuZGxlcnMpLmZvckVhY2goKFssIGhhbmRsZXJzXSkgPT4ge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgaW5kZXggPSBoYW5kbGVycy5pbmRleE9mKGhhbmRsZXJJZCk7XG5cdCAgICAgICAgICAgICAgICBpZiAoaW5kZXggPiAtMSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGhhbmRsZXJzLnNwbGljZShpbmRleCwgMSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICBpZiAoY2xpZW50Lmdsb2JhbEhhbmRsZXIgPT09IGhhbmRsZXJJZCkge1xuXHQgICAgICAgICAgICAgICAgY2xpZW50Lmdsb2JhbEhhbmRsZXIgPSB1bmRlZmluZWQ7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNvbnNvbGUud2FybihgVHJ5aW5nIHRvIHJlbW92ZSBhIGhhbmRsZXIgZnJvbSBhIGNsaWVudCB0aGF0IGlzbid0IG1hcHBlZC4gaGFuZGxlcklkOiAke2hhbmRsZXJJZH0uIGNsaWVudElkZW50aXR5OiAke2NsaWVudElkZW50aXR5fWApO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIHJlZ2lzdGVyTmV3Q2xpZW50KGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgaWYgKCF0aGlzLmNsaWVudHMuaGFzKGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQpKSB7XG5cdCAgICAgICAgIC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Qcml2YXRlIENoYW5uZWxgKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHRUeXBlICE9PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgY29uc3QgY3VycmVudENvbnRleHQgPSB0aGlzLmNvbnRleHRCeUNvbnRleHRUeXBlLmdldChjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgIGlmIChjdXJyZW50Q29udGV4dClcblx0ICAgICAgICAgICAgICAgIHJldHVybiBjdXJyZW50Q29udGV4dDtcblx0ICAgICAgICAgICAgcmV0dXJuIG51bGw7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIHJldHVybiB0aGlzLmxhc3RDb250ZXh0ID8gdGhpcy5sYXN0Q29udGV4dCA6IG51bGw7XG5cdCAgICB9XG5cdCAgICBjb250ZXh0SGFuZGxlckFkZGVkKHBheWxvYWQsIHNlbmRlckNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgeyBoYW5kbGVySWQsIGNvbnRleHRUeXBlIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IHNlbmRlckNsaWVudFN0YXRlID0gdGhpcy5nZXRDbGllbnRTdGF0ZShzZW5kZXJDbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKCFzZW5kZXJDbGllbnRTdGF0ZSkge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENsaWVudCB3aXRoIElkZW50aXR5OiAke3NlbmRlckNsaWVudElkZW50aXR5LnV1aWR9ICR7c2VuZGVyQ2xpZW50SWRlbnRpdHkubmFtZX0sIHRyaWVkIHRvIGNhbGwgYWRkQ29udGV4dExpc3RlbmVyLCBpcyBub3QgY29ubmVjdGVkIHRvIHRoaXMgUHJpdmF0ZSBDaGFubmVsYCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChjb250ZXh0VHlwZSkge1xuXHQgICAgICAgICAgICBjb25zdCBjdXJyZW50SGFuZGxlcnNMa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bnN1YnNjcmliZSBoYW5kbGVycyBhcmUgaGl0IGJlZm9yZSBhbnl0aGluZyBlbHNlIGhhcHBlbnMuXG5cdCAgICAgICAgY29uc3QgeyBoYW5kbGVySWQgfSA9IHBheWxvYWQ7XG5cdCAgICAgICAgY29uc3QgcmVtb3ZpbmdDbGllbnRTdGF0ZSA9IHRoaXMuZ2V0Q2xpZW50U3RhdGUocmVtb3ZpbmdDbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKHJlbW92aW5nQ2xpZW50U3RhdGUpIHtcblx0ICAgICAgICAgICAgbGV0IGNvbnRleHRUeXBlO1xuXHQgICAgICAgICAgICBpZiAocmVtb3ZpbmdDbGllbnRTdGF0ZS5nbG9iYWxIYW5kbGVyID09PSBoYW5kbGVySWQpIHtcblx0ICAgICAgICAgICAgICAgIHJlbW92aW5nQ2xpZW50U3RhdGUuZ2xvYmFsSGFuZGxlciA9IHVuZGVmaW5lZDtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgW2N1cnJDb250ZXh0VHlwZSwgaGFuZGxlcnNJZHNdIG9mIHJlbW92aW5nQ2xpZW50U3RhdGUuaGFuZGxlcklkc0J5Q29udGV4dFR5cGVzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgaW5kZXggPSBoYW5kbGVyc0lkcy5pbmRleE9mKGhhbmRsZXJJZCk7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKGluZGV4ID4gLTEpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlcnNJZHMuc3BsaWNlKGluZGV4LCAxKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFR5cGUgPSBjdXJyQ29udGV4dFR5cGU7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIC8v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Bjb25zdCB7IGVuZHBvaW50SWQgfSA9IGNsaWVudElkZW50aXR5O1xuXHQgICAgICAgIGNvbnN0IHN0YXRlID0gdGhpcy5jbGllbnRzLmdldChlbmRwb2ludElkKTtcblx0ICAgICAgICBpZiAoc3RhdGUpIHtcblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dFR5cGVIYW5kbGVySWRzID0gQXJyYXkuZnJvbShzdGF0ZS5oYW5kbGVySWRzQnlDb250ZXh0VHlwZXMudmFsdWVzKCkpLmZsYXQoKTtcblx0ICAgICAgICAgICAgY29uc3QgZ2xvYmFsSGFuZGxlcklkID0gc3RhdGUuZ2xvYmFsSGFuZGxlcjtcblx0ICAgICAgICAgICAgaWYgKGNvbnRleHRUeXBlSGFuZGxlcklkcy5sZW5ndGggPiAwKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCB1bnN1YlByb21pc2VzID0gY29udGV4dFR5cGVIYW5kbGVySWRzLm1hcChhc3luYyAoaGFuZGxlcklkKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29udGV4dEhhbmRsZXJSZW1vdmVkKHsgaGFuZGxlcklkIH0sIGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCBQcm9taXNlLmFsbCh1bnN1YlByb21pc2VzKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgaWYgKGdsb2JhbEhhbmRsZXJJZCkge1xuXHQgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlz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cblx0ICAgICAgICBkaXNwbGF5TWV0YWRhdGE6IHtcblx0ICAgICAgICAgICAgY29sb3I6ICcjOEM2MUZGJyxcblx0ICAgICAgICAgICAgbmFtZTogJ3B1cnBsZSdcblx0ICAgICAgICB9XG5cdCAgICB9LFxuXHQgICAge1xuXHQgICAgICAgIGlkOiAnb3JhbmdlJyxcblx0ICAgICAgICBkaXNwbGF5TWV0YWRhdGE6IHtcblx0ICAgICAgICAgICAgY29sb3I6ICcjRkY4QzRDJyxcblx0ICAgICAgICAgICAgbmFtZTogJ29yYW5nZSdcblx0ICAgICAgICB9XG5cdCAgICB9LFxuXHQgICAge1xuXHQgICAgICAgIGlkOiAncmVkJyxcblx0ICAgICAgICBkaXNwbGF5TWV0YWRhdGE6IHtcblx0ICAgICAgICAgICAgY29sb3I6ICcjRkY1RTYwJyxcblx0ICAgICAgICAgICAgbmFtZTogJ3JlZCdcblx0ICAgICAgICB9XG5cdCAgICB9LFxuXHQgICAge1xuXHQgICAgICAgIGlkOiAncGluaycsXG5cdCAgICAgICAgZGlzcGxheU1ldGFkYXRhOiB7XG5cdCAgICAgICAgICAgIGNvbG9yOiAnI0ZGOEZCOCcsXG5cdCAgICAgICAgICAgIG5hbWU6ICdwaW5rJ1xuXHQgICAgICAgIH1cblx0ICAgIH0sXG5cdCAgICB7XG5cdCAgICAgICAgaWQ6ICd5ZWxsb3cnLFxuXHQgICAgICAgIGRpc3BsYXlNZXRhZGF0YToge1xuXHQgICAgICAgICAgICBjb2xvcjogJyNFOUZGOEYnLFxuXHQgICAgICAgICAgICBuYW1lOiAneWVsbG93J1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0XTtcblx0LyoqXG5cdCAqIHtAbGluayBodHRwczovL2RldmVsb3BlcnMub3BlbmZpbi5jby9vZi1kb2NzL2RvY3MvZW5hYmxlLWNvbG9yLWxpbmtpbmd9XG5cdCAqXG5cdCAqIFRoZSBJbnRlcm9wIEJyb2tlciBpcyByZXNwb25zaWJsZSBmb3Iga2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VyIGBwbGF0Zm9ybWAgb3B0aW9ucyBpbiB5b3VyIG1hbmlmZXN0LiBUaGlzIGlzIHRoZSBwcmVmZXJyZWQgbWV0aG9kLlxuXHQgKiBgYGBqc1xuXHQgKiB7XG5cdCAqICAgICAgXCJydW50aW1lXCI6IHtcblx0ICogICAgICAgICAgXCJhcmd1bWVudHNcIjogXCItLXY9MSAtLWluc3BlY3RcIixcblx0ICogICAgICAgICAgXCJ2ZXJzaW9uXCI6IFwiYWxwaGEtdjE5XCJcblx0ICogICAgICB9LFxuXHQgKiAgICAgIFwicGxhdGZvcm1cIjoge1xuXHQgKiAgICAgICAgICBcInV1aWRcIjogXCJwbGF0Zm9ybV9jdXN0b21pemF0aW9uX2xvY2FsXCIsXG5cdCAqICAgICAgICAgIFwiYXBwbGljYXRpb25JY29uXCI6IFwiaHR0cHM6Ly9vcGVuZmluLmdpdGh1Yi5pby9nb2xkZW4tcHJvdG90eXBlL2Zhdmljb24uaWNvXCIsXG5cdCAqICAgICAgICAgIFwiYXV0b1Nob3dcIjogZmFsc2UsXG5cdCAqICAgICAgICAgIFwicHJvdmlkZXJVcmxcIjogXCJodHRwOi8vbG9jYWxob3N0OjU1NTUvcHJvdmlkZXIuaHRtbFwiLFxuXHQgKiAgICAgICAgICBcImludGVyb3BCcm9rZXJDb25maWd1cmF0aW9uXCI6IHtcblx0ICogICAgICAgICAgICAgIFwiY29udGV4dEdyb3Vwc1wiOiBbXG5cdCAqICAgICAgICAgICAgICAgICAge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IFwiZ3JlZW5cIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgXCJkaXNwbGF5TWV0YWRhdGFcIjoge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJjb2xvclwiOiBcIiMwMENDODhcIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiBcImdyZWVuXCJcblx0ICogICAgICAgICAgICAgICAgICAgICAgfVxuXHQgKiAgICAgICAgICAgICAgICAgIH0sXG5cdCAqICAgICAgICAgICAgICAgICAge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IFwicHVycGxlXCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgIFwiZGlzcGxheU1ldGFkYXRhXCI6IHtcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwiY29sb3JcIjogXCIjOEM2MUZGXCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgICAgICBcIm5hbWVcIjogXCJwdXJwbGVcIlxuXHQgKiAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAqICAgICAgICAgICAgICAgICAgfSxcblx0ICogICAgICAgICAgICAgIF1cblx0ICogICAgICAgICAgfVxuXHQgKiAgICAgIH1cblx0ICogfVxuXHQgKiBgYGBcblx0ICpcblx0ICogQnkgZGVmYXVsdCB0aGUgSW50ZXJvcCBCcm9rZXIgbG9ncyBhbGwgYWN0aW9ucyB0byB0aGUgY29uc29sZS4gWW91IGNhbiBkaXNhYmxlIHRoaXMgYnkgdXNpbmcgdGhlIGxvZ2dpbmcgb3B0aW9uIGluIGBpbnRlcm9wQnJva2VyQ29uZmlndXJhdGlvbmA6XG5cdCAqIGBgYGpzXG5cdCAqIHtcblx0ICogICAgICBcInJ1bnRpbWVcIjoge1xuXHQgKiAgICAgICAgICBcImFyZ3VtZW50c1wiOiBcIi0tdj0xIC0taW5zcGVjdFwiLFxuXHQgKiAgICAgICAgICBcInZlcnNpb25cIjogXCJhbHBoYS12MTlcIlxuXHQgKiAgICAgIH0sXG5cdCAqICAgICAgXCJwbGF0Zm9ybVwiOiB7XG5cdCAqICAgICAgICAgIFwidXVpZFwiOiBcInBsYXRmb3JtX2N1c3RvbWl6YXRpb25fbG9jYWxcIixcblx0ICogICAgICAgICAgXCJhcHBsaWNhdGlvbkljb25cIjogXCJodHRwczovL29wZW5maW4uZ2l0aHViLmlvL2dvbGRlbi1wcm90b3R5cGUvZmF2aWNvbi5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5cdCAqICAgICAgICAgICAgICAgICBjb25zdCBvcmlnaW5hbFByb21pc2UgPSBzdXBlci5hcHBseVNuYXBzaG90KHsgc25hcHNob3QsIG9wdGlvbnMgfSk7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYWZ0ZXIgYXBwbHlTbmFwc2hvdCcpXG5cdCAqXG5cdCAqICAgICAgICAgICAgICAgICByZXR1cm4gb3JpZ2luYWxQcm9taXNlO1xuXHQgKiAgICAgICAgICAgICB9XG5cdCAqICAgICAgICAgfTtcblx0ICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAqICAgICB9LFxuXHQgKiAgICAgaW50ZXJvcE92ZXJyaWRlOiBhc3luYyAoSW50ZXJvcEJyb2tlcikgPT4ge1xuXHQgKiAgICAgICAgIGNsYXNzIE92ZXJyaWRlIGV4dGVuZHMgSW50ZXJvcEJyb2tlciB7XG5cdCAqICAgICAgICAgICAgIGFzeW5jIGpvaW5Db250ZXh0R3JvdXAoY2hhbm5lbE5hbWUgPSAnZGVmYXVsdCcsIHRhcmdldCkge1xuXHQgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2JlZm9yZSBzdXBlciBqb2luQ29udGV4dEdyb3VwJylcblx0ICogICAgICAgICAgICAgICAgIHN1cGVyLmpvaW5Db250ZXh0R3JvdXAoY2hhbm5lbE5hbWUsIHRhcmdldCk7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYWZ0ZXIgc3VwZXIgam9pbkNvbnRleHRHcm91cCcpXG5cdCAqICAgICAgICAgICAgIH1cblx0ICogICAgICAgICB9XG5cdCAqXG5cdCAqICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoKTtcblx0ICogICB9XG5cdCAqIH0pO1xuXHQgKiBgYGBcblx0ICpcblx0ICogLS0tXG5cdCAqXG5cdCAqL1xuXHRsZXQgSW50ZXJvcEJyb2tlciQxID0gY2xhc3MgSW50ZXJvcEJyb2t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HBvc3NpYmxlLlxuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBDbGllbnQgaGFzIGEgY29udGV4dCBncm91cCB0aGF0IGlzbid0IGluIHRoZSBjb250ZXh0IGdyb3VwIG1hcHBpbmc6ICR7Y29udGV4dEdyb3VwSWR9LmApO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNvbnN0IGNvbnRleHRJbnRlZ3JpdHlDaGVja1Jlc3VsdCA9IEludGVyb3BCcm9rZXIuY2hlY2tDb250ZXh0SW50ZWdyaXR5KGNvbnRleHQpO1xuXHQgICAgICAgICAgICBpZiAoY29udGV4dEludGVncml0eUNoZWNrUmVzdWx0LmlzVmFsaWQgPT09IGZhbHNlKSB7XG5cdCAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYEZhaWxlZCB0byBzZXQgQ29udGV4dCAtIGJhZCBDb250ZXh0LiBSZWFzb246ICR7Y29udGV4dEludGVncml0eUNoZWNrUmVzdWx0LnJlYXNvbn0uIENvbnRleHQ6ICR7SlNPTi5zdHJpbmdpZnkoY29udGV4dCl9YCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1ub24tbnVsbC1hc3NlcnRpb25cblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dEdyb3VwU3RhdGUgPSB0aGlzLmNvbnRleHRHcm91cHNCeUlkLmdldChjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgIGNvbnN0IGJyb2FkY2FzdGVkQ29udGV4dFR5cGUgPSBjb250ZXh0LnR5cGU7XG5cdCAgICAgICAgICAgIGNvbnRleHRHcm91cFN0YXRlLnNldChicm9hZGNhc3RlZENvbnRleHRUeXBlLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgdGhpcy5sYXN0Q29udGV4dE1hcC5zZXQoY29udGV4dEdyb3VwSWQsIGJyb2FkY2FzdGVkQ29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRzSW5TYW1lQ29udGV4dEdyb3VwID0gQXJyYXkuZnJvbSh0aGlzLmludGVyb3BDbGllbnRzLnZhbHVlcygpKS5maWx0ZXIoKGNvbm5lY3RlZENsaWVudCkgPT4gY29ubmVjdGVkQ2xpZW50LmNvbnRleHRHcm91cElkID09PSBjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgIGNsaWVudHNJblNhbWVDb250ZXh0R3JvdXAuZm9yRWFjaCgoY2xpZW50KSA9PiB7XG5cdCAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IFssIGhhbmRsZXJJbmZvXSBvZiBjbGllbnQuY29udGV4dEhhbmRsZXJzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKEludGVyb3BCcm9rZXIuaXNDb250ZXh0VHlwZUNvbXBhdGlibGUoYnJvYWRjYXN0ZWRDb250ZXh0VHlwZSwgaGFuZGxlckluZm8uY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50LmNsaWVudElkZW50aXR5LCBoYW5kbGVySW5mby5oYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2UgaWYgKGNsaWVudFN0YXRlKSB7XG5cdCAgICAgICAgICAgIC8vIENsaWVudCBoYXMgbm90IGpvaW5lZCBhbnkgY29udGV4dCBncm91cCBiZWhhdmlvci5cblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgbXVzdCBqb2luIGEgY29udGV4dCBncm91cCBiZWZvcmUgeW91IGNhbiBzZXQgY29udGV4dC4nKTtcblx0ICAgICAgICB9XG5cdCAgICAg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lm5hbWUpO1xuXHQgICAgICAgICAgICAgICAgaWYgKCFhbGxDb25uZWN0aW9ucy5sZW5ndGgpIHtcblx0ICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYEdpdmVuIElkZW50aXR5ICR7dGFyZ2V0LnV1aWR9ICR7dGFyZ2V0Lm5hbWV9IGlzIG5vdCBjb25uZWN0ZWQgdG8gdGhlIEludGVyb3AgQnJva2VyLmApO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgaWYgKGFsbENvbm5lY3Rpb25zLmxlbmd0aCA+IDEpIHtcblx0ICAgICAgICAgICAgICAgICAgICAvLyBTaG91bGQgZmlndXJlIG91dCBob3cgd2Ugd2FudCB0byBoYW5kbGUgdGhpcyBzaXR1YXRpb24uIEluIHRoZSBtZWFudGltZSwganVzdCBjaGFuZ2UgY29udGV4dCBncm91cCBmb3IgYWxsIGNvbm5lY3Rpb25zLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgTW9yZSB0aGFuIG9uZSBjb25uZWN0aW9uIGZvdW5kIGZvciBpZGVudGl0eSAke3RhcmdldC51dWlkfSAke3RhcmdldC5uYW1lfWApO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgY29ubmVjdGlvbiBvZiBhbGxDb25uZWN0aW9ucykge1xuXHQgICAgICAgICAgICAgICAgICAgIHByb21pc2VzLnB1c2godGhpcy5hZGRDbGllbnRUb0NvbnRleHRHcm91cCh7IGNvbnRleHRHcm91cElkIH0sIGNvbm5lY3Rpb24pKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHByb21pc2VzKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICA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U3Vic2NyaXB0aW9uU3RhdGUuY29udGV4dEdyb3VwSWQgPSBjb250ZXh0R3JvdXBJZDtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy5zZXRDdXJyZW50Q29udGV4dEdyb3VwSW5DbGllbnRPcHRpb25zKGNsaWVudElkZW50aXR5LCBjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgIGNvbnN0IGNvbnRleHRHcm91cE1hcCA9IHRoaXMuY29udGV4dEdyb3Vwc0J5SWQuZ2V0KGNvbnRleHRHcm91cElkKTtcblx0ICAgICAgICAgICAgZm9yIChjb25zdCBbLCBoYW5kbGVySW5mb10gb2YgY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUuY29udGV4dEhhbmRsZXJzKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCB7IGNvbnRleHRUeXBlLCBoYW5kbGVySWQgfSA9IGhhbmRsZXJJbmZvO1xuXHQgICAgICAgICAgICAgICAgaWYgKGNvbnRleHRUeXBlID09PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgICAgICAvLyBTZW5kIHRoaXMgc2luZ2xlIGhhbmRsZXIgYWxsIG9mIHRoZSBjb250ZXh0LCBiZWNhdXNlIGl0IGFjY2VwdHMgYWxsLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnRleHRHcm91cE1hcC5mb3JFYWNoKChjb250ZXh0LCBfKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBlbHNlIGlmIChjb250ZXh0R3JvdXBNYXAuaGFzKGNvbnRleHRUeXBlKSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNvbnRleHRGb3JUeXBlID0gY29udGV4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+IHgudXVpZCA9PT0gdGFyZ2V0LnV1aWQgJiYgeC5uYW1lID09PSB0YXJnZXQubmFtZSk7XG5cdCAgICAgICAgICAgICAgICBpZiAoIWFsbENvbm5lY3Rpb25zLmxlbmd0aCkge1xuXHQgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgTm8gY29ubmVjdGlvbiBmb3VuZCBmb3IgZ2l2ZW4gSWRlbnRpdHkgJHt0YXJnZXQudXVpZH0gJHt0YXJnZXQubmFtZX1gKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGlmIChhbGxDb25uZWN0aW9ucy5sZW5ndGggPiAxKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBNb3JlIHRoYW4gb25lIGNvbm5lY3Rpb24gZm91bmQgZm9yIGlkZW50aXR5ICR7dGFyZ2V0LnV1aWR9ICR7dGFyZ2V0Lm5hbWV9YCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgZm9yIChjb25zdCBjb25uZWN0aW9uIG9mIGFsbENvbm5lY3Rpb25zKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcHJvbWlzZXMucHVzaCh0aGlzLnJlbW92ZUNsaWVudEZyb21Db250ZXh0R3JvdXAoY29ubmVjdGlvbikpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgLy8gTm8gdGFyZ2V0IHByb3ZpZGVkLC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AgICAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICAgICAqICAgICAgICAgICAgIGFzeW5jIGhhbmRsZUZpcmVkSW50ZW50KGludGVudCkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHN1cGVyLnNldEludGVudFRhcmdldChpbnRlbnQsIHsgdXVpZDogJ3BsYXRmb3JtLXV1aWQnLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0pO1xuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgd2luID0gZmluLldpbmRvdy53cmFwU3luYyh7IG5hbWU6ICdmb28nLCB1dWlkOiAncGxhdGZvcm0tdXVpZCcgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgY3JlYXRlZFZpZXcgPSBhd2FpdCBwbGF0Zm9ybS5jcmVhdGVWaWV3KHsgdXJsOiAnaHR0cDovL29wZW5maW4uY28nLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0sIHdpbi5pZGVudGl0eSk7XG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSgpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBjbGFzcy1tZXRob2RzLXVzZS10aGlzXG5cdCAgICBhc3luYyBoYW5kbGVGaXJlZEludGVudChpbnRlbnQsIGNsaWVudElkZW50aXR5IC8vIFRPRE8oQ09SRS04MTEpOiByZW1vdmUgaW5saW5lIGludGVyc2VjdGVkIHR5cGVcblx0ICAgICkge1xuXHQgICAgICAgIGNvbnN0IH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bnRdIH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgaGFuZGxlckluZm8ucGVuZGluZ0ludGVudHMucHVzaChpbnRlbnQpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGhhbmRsZXJJbmZvLmNsaWVudElkZW50aXR5ICYmIGhhbmRsZXJJbmZvLmlzUmVhZHkpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGNsaWVudElkZW50aXR5LCBwZW5kaW5nSW50ZW50cyB9ID0gaGFuZGxlckluZm87XG5cdCAgICAgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50ZW50VG9TZW5kID0gcGVuZGluZ0ludGVudHNbcGVuZGluZ0ludGVudHMubGVuZ3RoIC0gMV07XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMuaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBpbnRlbnRUb1NlbmQpO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5wZW5kaW5nSW50ZW50cyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihgRXJyb3IgaW52b2tpbmcgaW50ZW50IGhhbmRsZXIgZm9yIGNsaWVudCAke2NsaWVudElkZW50aXR5LnV1aWR9LyR7Y2xpZW50SWRlbnRpdHkubmFtZX0vJHtjbGllbnRJZGVudGl0eS5lbmRwb2ludElkfWApO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5pc1JlYWR5ID0gZmFsc2U7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgIC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HQgICAgICAgIHRocm93IG5ldyBFcnJvcih1dGlsc18xLkJST0tFUl9FUlJPUlMuZmlyZUludGVudEZvckNvbnRleHQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBQcm92aWRlcyB0aGUgaWRlbnRpdHkgb2YgYW55IEludGVyb3AgQ2xpZW50IHRoYXQgZGlzY29ubmVjdHMgZnJvbSB0aGUgSW50ZXJvcCBCcm9rZXIuIEl0IGlzIG1lYW50IHRvIGJlIG92ZXJyaWRlbi5cblx0ICAgICAqIEBwYXJhbSBjbGllbnRJZGVudGl0eVxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogZmluLlBsYXRmb3JtLmluaXQoe1xuXHQgICAgICogICAgIGludGVyb3BPdmVycmlkZTogYXN5bmMgKEludGVyb3BCcm9rZXIpID0+IHtcblx0ICAgICAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICAgICAqICAgICAgICAgICAgIGFzeW5jIGNsaWVudERpc2Nvbm5lY3RlZChjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IHsgdXVpZCwgbmFtZSB9ID0gY2xpZW50SWRlbnRpdHk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coYENsaWVudCB3aXRoIGlkZW50aXR5ICR7dXVpZH0vJHtuYW1lfSBoYXMgYmVlbiBkaXNjb25uZWN0ZWRgKTtcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGNsYXNzLW1ldG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l0eSBhbmQgaGFuZGxlcklkXG5cdCAgICAgKiBAcGFyYW0gY2xpZW50SWRlbnRpdHlcblx0ICAgICAqIEBwYXJhbSBoYW5kbGVySWRcblx0ICAgICAqIEBwYXJhbSBjb250ZXh0XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBmaW4uUGxhdGZvcm0uaW5pdCh7XG5cdCAgICAgKiAgICAgaW50ZXJvcE92ZXJyaWRlOiBhc3luYyAoSW50ZXJvcEJyb2tlcikgPT4ge1xuXHQgICAgICogICAgICAgICBjbGFzcyBPdmVycmlkZSBleHRlbmRzIEludGVyb3BCcm9rZXIge1xuXHQgICAgICogICAgICAgICAgICAgYXN5bmMgaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHJldHVybiBzdXBlci5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIC4uLmNvbnRleHQsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRNZXRhZGF0YToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwSWQ6ICdvcGVuZmluLWFwcCcsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogJzNENTRENDU2RDlIVDAnXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIC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aGVuIHdvdWxkIHlvdSBuZWVkIHRvIGNhbGxcblx0ICAgICAqIHN1cGVyLmludm9rZUludGVudEhhbmRsZXIgcGFzc2luZyBpdCB0aGlzIG5ldyBJbnRlbnQgb2JqZWN0IGFsb25nIHdpdGggdGhlIGNsaWVudElkZW50aXR5IGFuZCBoYW5kbGVySWRcblx0ICAgICAqIEBwYXJhbSBDbGllbnRJZGVudGl0eVxuXHQgICAgICogQHBhcmFtIGhhbmRsZXJJZFxuXHQgICAgICogQHBhcmFtIGNvbnRleHRcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGZpbi5QbGF0Zm9ybS5pbml0KHtcblx0ICAgICAqICAgICBpbnRlcm9wT3ZlcnJpZGU6IGFzeW5jIChJbnRlcm9wQnJva2VyKSA9PiB7XG5cdCAgICAgKiAgICAgICAgIGNsYXNzIE92ZXJyaWRlIGV4dGVuZHMgSW50ZXJvcEJyb2tlciB7XG5cdCAgICAgKiAgICAgICAgICAgICBhc3luYyBpbnZva2VJbnRlbnRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCB7IGNvbnRleHQgfSA9IGludGVudDtcblx0ICAgICAqICAgICAgICAgICAgICAgICByZXR1cm4gc3VwZXIuaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIC4uLmludGVudCxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgY29udGV4dDoge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgLi4uY29udGV4dCxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRNZXRhZGF0YToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBJZDogJ29wZW5maW4tYXBwJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogJzNENTRENDU2RDlIVDAnXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSgpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIGludm9rZUludGVudEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgaW50ZW50KSB7XG5cdCAgICAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCB0aGlzLmdldFByb3ZpZGVyKCk7XG5cdCAgICAgICAgYXdhaXQgcHJvdmlkZXIuZGlzcGF0Y2goY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgaW50ZW50KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogUmVzcG9uc2libGUgZm9yIHJlc29sdmluZyBmZGMzLmdldEluZm8gZm9yIEZEQzMgMi4wXG5cdCAgICAgKiBXb3VsZCBuZWVkIHRvIHJldHVybiB0aGUgb3B0aW9uYWxGZWF0dXJlcyBhbmQgYXBwTWV0YWRhdGEgZm9yIHRoZSB7QGxpbmsgaHR0cHM6Ly9mZGMzLmZpbm9zLm9yZy9kb2NzL2FwaS9yZWYvTWV0YWRhdGEjaW1wbGVtZW50YXRpb25tZXRhZGF0YSBJbXBsZW1lbnRhdGlvbk1ldGFkYXRhfS5cblx0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IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgd2luID0gZmluLldpbmRvdy53cmFwU3luYyh7IG5hbWU6ICdmb28nLCB1dWlkOiAncGxhdGZvcm0tdXVpZCcgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgY3JlYXRlZFZpZXcgPSBhd2FpdCBwbGF0Zm9ybS5jcmVhdGVWaWV3KHsgdXJsOiAnaHR0cDovL29wZW5maW4uY28nLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0sIHdpbi5pZGVudGl0eSk7XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IGFsbENsaWVudEluZm8gPSBhd2FpdCBzdXBlci5nZXRBbGxDbGllbnRJbmZvKCk7XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IGluZm9Gb3JUYXJnZXQgPSBhbGxDbGllbnRJbmZvLmZpbmQoKGNsaWVudEluZm8pID0+IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsaWVudEluZm8udXVpZCA9PT0gJ3BsYXRmb3JtLXV1aWQnICYmIGNsaWVudEluZm8ubmFtZSA9PT0gJ2ludGVudC12aWV3Jztcblx0ICAgICAqICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgc291cmNlID0ge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBhcHBJZDogJ2ludGVudC12aWV3Jyxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogaW5mb0ZvclRhcmdldC5lbmRwb2ludElkXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfVxuXHQgICAgICpcblx0ICAgICAqICAgICAgICAgICAgICAgICByZXR1cm4ge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBzb3VyY2UsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGludGVudDogaW50ZW50Lm5hbWVcblx0ICAgICAqICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoLi4uYXJncyk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgZ2V0QWxsQ2xpZW50SW5mbygpIHtcblx0ICAgICAgICBjb25zdCBwcm92aWRlciA9IGF3YWl0IHRoaXMuZ2V0UHJvdmlkZXIoKTtcblx0ICAgICAgICByZXR1cm4gcHJvdmlkZXIuZ2V0QWxsQ2xpZW50SW5mbygpO1xuXHQgICAgfVxuXHQgICAgLypcblx0ICAgIFNuYXBzaG90IEFQSXNcblx0ICAgICovXG5cdCAgICAvLyBVc2VkIHRvIHNhdmUgaW50ZXJvcCBicm9rZXIgc3RhdGUgaW4gc25hcHNob3RzXG5cdCAgICBkZWNvcmF0ZVNuYXBzaG90KHNuYXBzaG90KSB7XG5cdCAgICAgICAgcmV0dXJuIHsgLi4uc25hcHNob3QsIGludGVyb3BTbmFwc2hvdERldGFpbHM6IHsgY29udGV4dEdyb3VwU3RhdGVzOiB0aGlzLmdldENvbnRleHRHcm91cFN0YXRlcygpIH0gfTtcblx0ICAgIH1cblx0ICAgIC8vIFVzZWQgdG8gcmVzdG9yZSBpbnRlcm9wIGJyb2tlciBzdGF0ZSBpbiBzbmFwc2hvdHMuXG5cdCAgICBhcHBseVNuYXBzaG90KHNuYXBzaG90LCBvcHRpb25zKSB7XG5cdCAgICAgICAgY29uc3QgY29udGV4dEdyb3VwU3RhdGVzID0gc25hcHNob3Q/LmludGVyb3BTbmFwc2hvdERldGFpbHM/LmNvbnRleHRHcm91cFN0YXRlcztcblx0ICAgICAgICBpZiAoY29udGV4dEdyb3VwU3RhdGVzKSB7XG5cdCAgICAgICAgICAgIGlmICghb3B0aW9ucz8uY2xvc2VFeGlzdGluZ1dpbmRvd3MpIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMudXBkYXRlRXhpc3RpbmdDbGllbnRzKGNvbnRleHRHcm91cFN0YXRlcyk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgdGhpcy5yZWh5ZHJhdGVDb250ZXh0R3JvdXBTdGF0ZXMoY29udGV4dEdyb3VwU3RhdGVzKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICB1cGRhdGVFeGlzdGluZ0NsaWVudHMoY29udGV4dEdyb3VwU3RhdGVzKSB7XG5cdCAgICAgICAgY29uc3QgY2xpZW50cyA9IHRoaXMuaW50ZXJvcENsaWVudHM7XG5cdCAgICAgICAgY2xpZW50cy5mb3JFYWNoKChzdWJTdGF0ZSkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCB7IGNsaWVudElkZW50aXR5LCBjb250ZXh0R3JvdXBJZCwgY29udGV4dEhhbmRsZXJzIH0gPSBzdWJTdGF0ZTtcblx0ICAgICAgICAgICAgaWYgKGNvbnRleHRHcm91cElkKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBncm91cENvbnRleHRzID0gY29udGV4dEdyb3VwU3RhdGVzW2NvbnRleHRHcm91cElkXTtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgWywgY29udGV4dF0gb2YgT2JqZWN0LmVudHJpZXMoZ3JvdXBDb250ZXh0cykpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb250ZXh0SGFuZGxlcnMuZm9yRWFjaCgoY29udGV4dEhhbmRsZXIpID0+IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgeyBoYW5kbGVySWQsIGNvbnRleHRUeXBlIH0gPSBjb250ZXh0SGFuZGxlcjtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEludGVyb3BCcm9rZXIuaXNDb250ZXh0VHlwZUNvbXBhdGlibGUoY29udGV4dC50eXBlLCBjb250ZXh0VHlwZSkpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgLy8gVXNlZCB0byBzdG9yZSBjb250ZXh0IGdyb3VwIHN0YXRlIGluIHNuYXBzaG90c1xuXHQgICAgZ2V0Q29udGV4dEdyb3VwU3RhdGVzKCkge1xuXHQgICAgICAgIHJldHVybiBJbnRlcm9wQnJva2VyLnRvT2JqZWN0KHRoaXMuY29udGV4dEdyb3Vwc0J5SWQpO1xuXHQgICAgfVxuXHQgICAgLy8gVXNlZCB0byByZWh5ZHJhdGUgdGhlIGNvbnRleHQgc3RhdGUgZnJvbSBhIHNuYXBzaG90XG5cdCAgICByZWh5ZHJhdGVDb250ZXh0R3JvdXBTdGF0ZXMoaW5jb21pbmdDb250ZXh0R3JvdXBTdGF0ZXMpIHtcblx0ICAgICAgICBjb25zdCBjb250ZXh0R3JvdXBTdGF0ZXMgPSBPYmplY3QuZW50cmllcyhpbmNvbWluZ0NvbnRleHRHcm91cFN0YXRlcyk7XG5cdCAgICAgICAgZm9yIChjb25zdCBbY29udGV4dEdyb3VwSWQsIGNvbnRleHRzXSBvZiBjb250ZXh0R3JvdXBTdGF0ZXMpIHtcblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dE9iamVjdHMgPSBPYmplY3QuZW50cmllcyhjb250ZXh0cyk7XG5cdCAgICAgICAgICAgIGZvciAoY29uc3QgW2NvbnRleHRUeXBlLCBjb250ZXh0XSBvZiBjb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GNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgaGFuZGxlckluZm8gPSB7IGNvbnRleHRUeXBlLCBoYW5kbGVySWQgfTtcblx0ICAgICAgICBjb25zdCBjbGllbnRTdGF0ZSA9IHRoaXMuZ2V0Q2xpZW50U3RhdGUoY2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgIGNsaWVudFN0YXRlPy5jb250ZXh0SGFuZGxlcnMuc2V0KGhhbmRsZXJJZCwgaGFuZGxlckluZm8pO1xuXHQgICAgICAgIGlmIChjbGllbnRTdGF0ZSAmJiBjbGllbnRTdGF0ZS5jb250ZXh0R3JvdXBJZCkge1xuXHQgICAgICAgICAgICBjb25zdCB7IGNvbnRleHRHcm91cElkIH0gPSBjbGllbnRTdGF0ZTtcblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dEdyb3VwTWFwID0gdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5nZXQoY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICBpZiAoY29udGV4dFR5cGUgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgLy8gU2VuZCB0aGlzIHNpbmdsZSBoYW5kbGVyIGFsbCBvZiB0aGUgY29udGV4dCwgYmVjYXVzZSBpdCBhY2NlcHRzIGFsbC5cblx0ICAgICAgICAgICAgICAgIGNvbnRleHRHcm91cE1hcC5mb3JFYWNoKChjb250ZXh0LCBfKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGVsc2UgaWYgKGNvbnRleHRHcm91cE1hcC5oYXMoY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBjb250ZXh0Rm9yVHlwZSA9IGNvbnRle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ydWUsIHBlbmRpbmdJbnRlbnRzOiBbXSwgY2xpZW50SWRlbnRpdHkgfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSBpZiAoIWhhbmRsZXJJbmZvKSB7XG5cdCAgICAgICAgICAgIGNsaWVudEludGVudEluZm8uc2V0KGhhbmRsZXJJZCwgeyBpc1JlYWR5OiB0cnVlLCBwZW5kaW5nSW50ZW50czogW10sIGNsaWVudElkZW50aXR5IH0pO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgY29uc3QgeyBwZW5kaW5nSW50ZW50cyB9ID0gaGFuZGxlckluZm87XG5cdCAgICAgICAgICAgIGhhbmRsZXJJbmZvLmNsaWVudElkZW50aXR5ID0gY2xpZW50SWRlbnRpdHk7XG5cdCAgICAgICAgICAgIGhhbmRsZXJJbmZvLmlzUmVhZHkgPSB0cnVlO1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgaWYgKHBlbmRpbmdJbnRlbnRzLmxlbmd0aCA+IDApIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnRlbnRUb1NlbmQgPSBwZW5kaW5nSW50ZW50c1twZW5kaW5nSW50ZW50cy5sZW5ndGggLSAxXTtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmludm9rZUludGVudEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgaW50ZW50VG9TZW5kKTtcblx0ICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5wZW5kaW5nSW50ZW50cyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihgRXJyb3IgaW52b2tpbmcgaW50ZW50IGhhbmRsZXI6ICR7aGFuZGxlcklkfS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GdldENvbnRleHRHcm91cFN0YXRlcy4gU2VyaWFsaXplcyB0aGUgY29udGV4dEdyb3VwU3RhdGVzIG9iamVjdCBzbyB3ZSBjYW4gc3RvcmUgaXQuXG5cdCAgICBzdGF0aWMgdG9PYmplY3QobWFwKSB7XG5cdCAgICAgICAgY29uc3Qgb2JqZWN0RnJvbU1hcCA9IE9iamVjdC5mcm9tRW50cmllcyhtYXApO1xuXHQgICAgICAgIGNvbnN0IG5ld09iamVjdCA9IHt9O1xuXHQgICAgICAgIE9iamVjdC5lbnRyaWVzKG9iamVjdEZyb21NYXApLmZvckVhY2goKFtjb250ZXh0R3JvdXBJZCwgY29udGV4dE1hcF0pID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgbmV3Q29udGV4dE9iamVjdCA9IE9iamVjdC5mcm9tRW50cmllcyhjb250ZXh0TWFwKTtcblx0ICAgICAgICAgICAgbmV3T2JqZWN0W2NvbnRleHRHcm91cElkXSA9IG5ld0NvbnRleHRPYmplY3Q7XG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIG5ld09iamVjdDtcblx0ICAgIH1cblx0ICAgIHN0YXRpYyBjaGVja0NvbnRleHRJbnRlZ3JpdHkoY29udGV4dCkge1xuXHQgICAgICAgIGlmICghY29udGV4dCkge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnTm8gY29udGV4dCBzdXBwbGllZCcgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKHR5cGVvZiBjb250ZXh0ICE9PSAnb2JqZWN0Jykge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnQ29udGV4dCBtdXN0IGJlIGFuIE9iamVjdCcgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKCFjb250ZXh0LnR5cGUpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRleHQgbXVzdCBoYXZlIGEgdHlwZSBwcm9wZXJ0eScgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHQuaWQgJiYgdHlwZW9mIGNvbnRleHQuaWQgIT09ICdvYmplY3QnKSB7XG5cdCAgICAgICAgICAgIHJldHVybiB7XG5cdCAgICAgICAgICAgICAgICBpc1ZhbGlkOiBmYWxzZSxcblx0ICAgICAgICAgICAgICAgIHJlYXNvbjogJ0NvbnRleHQgaWQgbXVzdCBiZSBhbiBPYmplY3QgcG9wdWxhdGVkIHdpdGgga2V5LXZhbHVlIGlkZW50aWZpZXJzIChpZiBzZXQpJ1xuXHQgICAgICAgICAgICB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoY29udGV4dC5pZCkge1xuXHQgICAgICAgICAgICBjb25zdCB7IGlkIH0gPSBjb250ZXh0O1xuXHQgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXMoaWQpO1xuXHQgICAgICAgICAgICBsZXQgZm91bmRCYWRJZGVudGlmaWVyID0gZmFsc2U7XG5cdCAgICAgICAgICAgIGlmICgha2V5cy5sZW5ndGgpIHtcblx0ICAgICAgICAgICAgICAgIHJldHVybiB7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdDb250ZXh0IGlkIG11c3QgaGF2ZSBhdCBsZWFzdCBvbmUga2V5LXZhbHVlIGlkZW50aWZpZXInIH07XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAga2V5cy5mb3JFYWNoKChrZXkpID0+IHtcblx0ICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yga2V5ICE9PSAnc3RyaW5nJyB8fCB0eXBlb2YgaWRba2V5XSAhPT0gJ3N0cmluZycpIHtcblx0ICAgICAgICAgICAgICAgICAgICBmb3VuZEJhZElkZW50aWZpZXIgPSB0cnVlO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KTtcblx0IC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AgICAgICAgYXdhaXQgZW50aXR5LnVwZGF0ZU9wdGlvbnMoe1xuXHQgICAgICAgICAgICAgICAgaW50ZXJvcDoge1xuXHQgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRDb250ZXh0R3JvdXA6IGNvbnRleHRHcm91cElkXG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgY29uc29sZS53YXJuKGBTZXR0aW5nIEN1cnJlbnQgQ29udGV4dCBHcm91cDogRW50aXR5IHdpdGggaWRlbnRpdHkgJHtjbGllbnRJZGVudGl0eS51dWlkfSwgJHtjbGllbnRJZGVudGl0eS5uYW1lfSBpcyBub3QgYSB3aW5kb3cgb3Igdmlldy4gSXQgaXMgYSAke2VudGl0eUluZm8uZW50aXR5VHlwZX0gaW5zdGVhZC5gKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICBhc3luYyBzZXR1cENoYW5uZWxQcm92aWRlcigpIHtcblx0ICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICBjb25zdCBjaGFubmVsID0gYXdhaXQgdGhpcy5nZXRQcm92aWRlcigpO1xuXHQgICAgICAgICAgICB0aGlzLmNoYW5uZWwgPSBjaGFubmVsO1xuXHQgICAgICAgICAgICB0aGlzLndpcmVDaGFubmVsKGNoYW5uZWwpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBFcnJvciBzZXR0aW5nIHVwIEludGVyb3AgQnJva2VyIENoYW5uZWwgUHJvdmlkZXI6ICR7ZXJyb3J9YCk7XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLy8gU2V0dXAgQ2hhbm5lbCBDb25uZWN0aW9uIExvZ2ljXG5cdCAgICB3aXJlQ2hhbm5lbChjaGFubmVsKSB7XG5cdCAgICAgICAgY2hhbm5lbC5vbkNvbm5lY3Rpb24oYXN5bmMgKGNsaWVudElkZW50aXR5LCAvLyBUT0RPKENPUkUtODExKTogcmVtb3ZlIGlubGluZSBpbnRlcnNlY3RlZCB0eXBlXG5cdCAgICAgICAgcGF5bG9hZCkgPT4ge1xuXHQgICAgICAgICAgICBpZiAoIShhd2FpdCB0aGlzLmlzQ29ubmVjdGlvbkF1dGhvcml6ZWQoY2xpZW50SWRlbnRpdHksIHBheWxvYWQpKSkge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBDb25uZWN0aW9uIG5vdCBhdXRob3JpemVkIGZvciAke2NsaWVudElkZW50aXR5LnV1aWR9LCAke2NsaWVudElkZW50aXR5Lm5hbWV9YCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgaWYgKCFjbGllbnRJZGVudGl0eS5lbmRwb2ludElkKSB7XG5cdCAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1ZlcnNpb24gdG9vIG9sZCB0byBiZSBjb21wYXRpYmxlIHdpdGggSW50ZXJvcC4gUGxlYXNlIHVwZ3JhZGUgeW91ciBydW50aW1lIHRvIGEgbW9yZSByZWNlbnQgdmVyc2lvbi4nKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSA9IHtcblx0ICAgICAgICAgICAgICAgIGNvbnRleHRHcm91cElkOiB1bmRlZmluZWQsXG5cdCAgICAgICAgICAgICAgICBjb250ZXh0SGFuZGxlcnM6IG5ldyBNYXAoKSxcblx0ICAgICAgICAgICAgICAgIGNsaWVudElkZW50aXR5XG5cdCAgICAgICAgICAgIH07XG5cdCAgICAgICAgICAgIC8vIE9ubHkgYWxsb3cgdGhlIGNsaWVudCB0byBqb2luIGEgY29udGV4dEdyb3VwIHRoYXQgYWN0dWFsbHkgZXhpc3RzLlxuXHQgICAgICAgICAgICBpZiAocGF5bG9hZD8uY3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mVjdFN5bmMgSW50ZXJvcC5jb25uZWN0U3luY30uXG4gKlxuICogLS0tXG4gKlxuICogIyMjIyMgSW50ZXJvcCBtZXRob2RzIGludGVuZGVkIGZvciBWaWV3c1xuICpcbiAqXG4gKiAqKkNvbnRleHQgR3JvdXBzIEFQSSoqXG4gKiAgKiB7QGxpbmsgSW50ZXJvcENsaWVudCNhZGRDb250ZXh0SGFuZGxlciBhZGRDb250ZXh0SGFuZGxlcihoYW5kbGVyLCBjb250ZXh0VHlwZT8pfVxuICogICoge0BsaW5rIEludGVyb3BDbGllbnQjc2V0Q29udGV4dCBzZXRDb250ZXh0KGNvbnRleHQpfVxuICogICoge0BsaW5rIEludGVyb3BDbGllbnQjZ2V0Q3VycmVudENvbnRleHQgZ2V0Q3VycmVudENvbnRleHQoY29udGV4dFR5cGU/KX1cbiAqICAqIHtAbGluayBJbnRlcm9wQ2xpZW50I2pvaW5TZXNzaW9uQ29udGV4dEdyb3VwIGpvaW5TZXNzaW9uQ29udGV4dEdyb3VwKHNlc3Npb25Db250ZXh0R3JvdXBJZCl9XG4gKlxuICpcbiAqICoqSW50ZW50cyBBUEkqKlxuICogICoge0BsaW5rIEludGVyb3BDbGllbnQjZmlyZUludGVudCBmaXJlSW50ZW50KGludGVudCl9XG4gKiAgKiB7QGxpbmsgSW50ZXJvcENsaWVudCNyZWdpc3RlckludGVudEhhbmRsZXIgcmVnaXN0ZXJJbnRlbnRIYW5kbGVyKGludGVudEhhbmRsZXIsIGludGVudE5hbWUpfVxuICogICoge0BsaW5rIEludGVyb3BDbGllbnQjZ2V0SW5mb0ZvckludGVudCBnZXRJbmZvRm9ySW50ZW50KGluZm9Gb3JJbnRlbnRPcHRpb25zKX1cbiAqICAqIHtAbGluayBJbnRlcm9wQ2xpZW50I2dldEluZm9Gb3JJbnRlbnRzQnlDb250ZXh0IGdldEluZm9Gb3JJbnRlbnRzQnlDb250ZXh0KGNvbnRleHQpfVxuICogICoge0BsaW5rIEludGVyb3BDbGllbnQjZ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GFuZGxlciBmb3IgaW5jb21pbmcgY29udGV4dC5cbiAgICAgKiBAcGFyYW0gY29udGV4dFR5cGUgLSBUaGUgdHlwZSBvZiBjb250ZXh0IHlvdSB3aXNoIHRvIGhhbmRsZS5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmdW5jdGlvbiBoYW5kbGVJbmNvbWluZ0NvbnRleHQoY29udGV4dEluZm8pIHtcbiAgICAgKiAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gY29udGV4dEluZm87XG4gICAgICogICAgIHN3aXRjaCAodHlwZSkge1xuICAgICAqICAgICAgICAgY2FzZSAnaW5zdHJ1bWVudCc6XG4gICAgICogICAgICAgICAgICAgaGFuZGxlSW5zdHJ1bWVudENvbnRleHQoY29udGV4dEluZm8pO1xuICAgICAqICAgICAgICAgICAgIGJyZWFrO1xuICAgICAqICAgICAgICAgY2FzZSAnY291bnRyeSc6XG4gICAgICogICAgICAgICAgICAgaGFuZGxlQ291bnRyeUNvbnRleHQoY29udGV4dEluZm8pO1xuICAgICAqICAgICAgICAgICAgIGJyZWFrO1xuICAgICAqXG4gICAgICogICAgICAgICBkZWZhdWx0OlxuICAgICAqICAgICAgICAgICAgIGJyZWFrO1xuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBoYW5kbGVJbnN0cnVtZW50Q29udGV4dChjb250ZXh0SW5mbykge1xuICAgICAqICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBjb250ZXh0SW5mbztcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ2NvbnRleHRJbmZvIGZvciBpbnN0cnVtZW50JywgY29udGV4dEluZm8pXG4gICAgICogfVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gaGFuZGxlQ291bnRyeUNvbnRleHQoY29udGV4dEluZm8pIHtcbiAgICAgKiAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gY29udGV4dEluZ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cbiAgICB9XG4gICAgLypcbiAgICBQbGF0Zm9ybSBXaW5kb3cgQVBJc1xuICAgICovXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgSW50ZXJvcC1Ccm9rZXItZGVmaW5lZCBjb250ZXh0IGdyb3VwcyBhdmFpbGFibGUgZm9yIGFuIGVudGl0eSB0byBqb2luLlxuICAgICAqIFVzZWQgYnkgUGxhdGZvcm0gV2luZG93cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4ubWUuaW50ZXJvcC5nZXRDb250ZXh0R3JvdXBzKClcbiAgICAgKiAgICAgICAgIC50aGVuKGNvbnRleHRHcm91cHMgPT4ge1xuICAgICAqICAgICAgICAgICAgIGNvbnRleHRHcm91cHMuZm9yRWFjaChjb250ZXh0R3JvdXAgPT4ge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhjb250ZXh0R3JvdXAuZGlzcGxheU1ldGFkYXRhLm5hbWUpXG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGNvbnRleHRHcm91cC5kaXNwbGF5TWV0YWRhdGEuY29sb3IpXG4gICAgICogICAgICAgICAgICAgfSlcbiAgICAgKiAgICAgICAgIH0pXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0Q29udGV4dEdyb3VwcygpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2ludGVyb3AtY2xpZW50LWdldC1jb250ZXh0LWdyb3VwcycpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJ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LlxuICAgICAqXG4gICAgICogQHBhcmFtIGNvbnRleHRHcm91cElkIC0gSWQgb2YgdGhlIGNvbnRleHQgZ3JvdXAuXG4gICAgICogQHBhcmFtIHRhcmdldCAtIElkZW50aXR5IG9mIHRoZSBlbnRpdHkgeW91IHdpc2ggdG8gam9pbiB0byBhIGNvbnRleHQgZ3JvdXAuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogam9pblZpZXdUb0NvbnRleHRHcm91cCA9IGFzeW5jIChjb250ZXh0R3JvdXBJZCwgdmlldykgPT4ge1xuICAgICAqICAgICBhd2FpdCBmaW4ubWUuaW50ZXJvcC5qb2luQ29udGV4dEdyb3VwKGNvbnRleHRHcm91cElkLCB2aWV3KTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBnZXRMYXN0Rm9jdXNlZFZpZXcoKVxuICAgICAqICAgICAudGhlbihsYXN0Rm9jdXNlZFZpZXdJZGVudGl0eSA9PiB7XG4gICAgICogICAgICAgICBqb2luVmlld1RvQ29udGV4dEdyb3VwKCdyZWQnLCBsYXN0Rm9jdXNlZFZpZXdJZGVudGl0eSlcbiAgICAgKiAgICAgfSlcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBqb2luQ29udGV4dEdyb3VwKGNvbnRleHRHcm91cElkLCB0YXJnZXQpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2ludGVyb3AtY2xpZW50LWpvaW4tY29udGV4dC1ncm91cCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIGlmICghY29udG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CcpXG4gICAgICogICAgIC50aGVuKGNsaWVudHNJbkNvbnRleHRHcm91cCA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhjbGllbnRzSW5Db250ZXh0R3JvdXApXG4gICAgICogICAgIH0pXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0QWxsQ2xpZW50c0luQ29udGV4dEdyb3VwKGNvbnRleHRHcm91cElkKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdpbnRlcm9wLWNsaWVudC1nZXQtYWxsLWNsaWVudHMtaW4tY29udGV4dC1ncm91cCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIGlmICghY29udGV4dEdyb3VwSWQpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTm8gY29udGV4dEdyb3VwSWQgc3BlY2lmaWVkIGZvciBnZXRBbGxDbGllbnRzSW5Db250ZXh0R3JvdXAuJyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGNsaWVudC5kaXNwYXRjaCgnZ2V0QWxsQ2xpZW50c0luQ29udGV4dEdyb3VwJywgeyBjb250ZXh0R3JvdXBJZCB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogR2V0cyBkaXNwbGF5IGluZm8gZm9yIGEgY29udGV4dCBncm91cFxuICAgICAqXG4gICAgICogQHJlbWFya3MgVXNlZCBieSBQbGF0Zm9ybSBXaW5kb3dzLlxuICAgICAqIEBwYXJhbSBjb250ZXh0R3JvdXBJZCAtIFRoZSBpZCBvZiBjb250ZXh0IGdyb3VwIHlvdSB3aXNoIH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W5jdGlvbi5cbiAgICAgKlxuICAgICAqIEBwYXJhbSBjb250ZXh0XG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogdGlja2VyRWxlbWVudC5vbignY2xpY2snLCAoZWxlbWVudCkgPT4ge1xuICAgICAqICAgICBjb25zdCB0aWNrZXIgPSBlbGVtZW50LmlubmVyVGV4dDtcbiAgICAgKlxuICAgICAqICAgICBjb25zdCBjb250ZXh0ID0ge1xuICAgICAqICAgICAgICAgdHlwZTogJ2ZkYzMuaW5zdHJ1bWVudCcsXG4gICAgICogICAgICAgICBpZDoge1xuICAgICAqICAgICAgICAgICAgIHRpY2tlclxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICpcbiAgICAgKiAgICAgY29uc3QgaW50ZW50c0luZm8gPSBhd2FpdCBmaW4ubWUuaW50ZXJvcC5nZXRJbmZvRm9ySW50ZW50QnlDb250ZXh0KGNvbnRleHQpO1xuICAgICAqIH0pXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0SW5mb0ZvckludGVudHNCeUNvbnRleHQoY29udGV4dCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignaW50ZXJvcC1jbGllbnQtZ2V0LWluZm8tZm9yLWludGVudHMtYnktY29udGV4dCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJldHVybiBjbGllbnQuZGlzcGF0Y2goJ2dldEluZm9Gb3JJbnRlbnRzQnlDb250ZXh0JywgY29udGV4dCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNlb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GNsaWVudC5vbkRpc2Nvbm5lY3Rpb24oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2dldENvbm5lY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMpLmNsaWVudFByb21pc2UgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2dldENvbm5lY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMpLmV2ZW50RmlyZWQgPSBudWxsO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJldHVybiBjbGllbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMSh0aGlzLCBfU25hcHNob3RTb3VyY2VfZ2V0Q29ubmVjdGlvbiwgXCJmXCIpLmNhbGwodGhpcykuY2xpZW50UHJvbWlzZSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVGhlIHRhcmdldGVkIFNuYXBzaG90U291cmNlIGlzIG5vdCBjdXJyZW50bHkgaW5pdGlhbGl6ZWQuIEF3YWl0IHRoaXMgb2JqZWN0J3MgcmVhZHkoKSBtZXRob2QuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgX1NuYXBzaG90U291cmNlX3NldFVwQ29ubmVjdGlvbkxpc3RlbmVyLnNldCh0aGlzLCBhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBjaGFubmVsTmFtZSA9ICgwLCB1dGlsc18xJDEuZ2V0U25hcHNob3RTb3VyY2VDaGFubmVsTmFtZSkodGhpcy5pZGVudGl0eSk7XG4gICAgICAgICAgICBsZXQgcmVzb2x2ZTtcbiAgICAgICAgICAgIGxldCByZWplY3Q7XG4gICAgICAgICAgICBjb25zdCBldmVudEZpcmVkID0gbmV3IFByb21pc2UoKHksIG4pID0+IHtcbiAgICAgICAgICAgICAgICByZXNvbHZlID0geTtcbiAgICAgICAgICAgICAgICByZWplY3QgPSBuO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2dldENvbm5lY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMpLmV2ZW50RmlyZWQgPSBldmVudEZpcmVkO1xuICAgICAgICAgICAgY29uc3QgbGlzdGVuZXIgPSBhc3luYyAoZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlLmNoYW5uZWxOYW1lID09PSBjaGFubmVsTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5maW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLnJlbW92ZUxpc3RlbmVyKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgYXdhaXQgdGhpcy5maW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLm9uKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgICAgIH0pO1xuICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2lkZW50aXR5LCBpZCwgXCJmXCIpO1xuICAgIH1cbiAgICBnZXQgaWRlbnRpdHkoKSB7XG4gICAgICAgIHJldHVybiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2lkZW50aXR5LCBcImZcIik7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIE1ldGhvZCB0byBkZXRlcm1pbmUgaWYgdGhlIFNuYXBzaG90U291cmNlIGhhcyBiZWVuIGluaXRpYWxpemVkLlxuICAgICAqXG4gICAgICogQHJlbWFya3MgVXNlIHdoZW4gdGhlIHBhcmVudCBhcHBsaWNhdGlvbiBpcyBzdGFydGluZyB1cCB0byBlbnN1cmUgdGhlIFNuYXBzaG90U291cmNlIGlzIGFibGUgdG8gYWNjZXB0IGFuZFxuICAgICAqIGFwcGx5IGEgc25hcHNob3QgdXNpbmcgdGhlIHtAbGluayBTbmFwc2hvdFNvdXJjZSNhcHBseVNuYXBzaG90IGFwcGx5U25hcHNob3R9IG1ldGhvZC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBsZXQgc25hcHNob3RTb3VyY2UgPSBmaW4uU25hcHNob3RTb3VyY2Uud3JhcFN5bmMoZmluLm1lKTtcbiAgICAgKlxuICAgICAqIGNvbnN0IHNuYXBzaG90UHJvdmlkZXIgPSB7XG4gICAgICogICAgIGFzeW5jIGdldFNuYXBzaG90KCkgeyByZXR1cm4gJ2ZvbycgfSxcbiAgICAgKiAgICAgYXN5bmMgYXBwbHlTbmFwc2hvdChzbmFwc2hvdCkge1xuICAgICAqICAgICAgIGNvbnNvbGUubG9nKHNuYXBzaG90KTtcbiAgICAgKiAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqIGF3YWl0IGZpbi5TbmFwc2hvdFNvdXJjZS5pbml0KHNuYXBzaG90UHJvdmlkZXIpO1xuICAgICAqXG4gICAgICogdHJ5IHtcbiAgICAgKiAgIGF3YWl0IHNuYXBzaG90U291cmNlLnJlYWR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aW1lb3V0IGFuZCByZWplY3QoKT9cbiAgICB9XG4gICAgLy8gVGhpcyBtZXRob2QgZXhlY3V0ZXMgbWVzc2FnZSBoYW5kbGVycyB1bnRpbCB0aGUgX29uZV8gdGhhdCBoYW5kbGVzIHRoZSBtZXNzYWdlIChyZXR1cm5zIHRydXRoeSkgaGFzIHJ1blxuICAgIG9ubWVzc2FnZShkYXRhKSB7XG4gICAgICAgIGZvciAoY29uc3QgaCBvZiB0aGlzLm1lc3NhZ2VIYW5kbGVycykge1xuICAgICAgICAgICAgaC5jYWxsKG51bGwsIGRhdGEpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGhhbmRsZU1lc3NhZ2UoZGF0YSkge1xuICAgICAgICBjb25zdCBpZCA9IGRhdGEuY29ycmVsYXRpb25JZCB8fCBOYU47XG4gICAgICAgIGlmICghKCdjb3JyZWxhdGlvbklkJyBpbiBkYXRhKSkge1xuICAgICAgICAgICAgaWYgKHRoaXMudW5jb3JyZWxhdGVkTGlzdGVuZXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnVuY29ycmVsYXRlZExpc3RlbmVyLmNhbGwobnVsbCwgZGF0YSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLnVuY29ycmVsYXRlZExpc3RlbmVyID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGVtcHR5IGJsb2NrXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKCF0aGlzLndpcmVMaXN0ZW5lcnMuaGFzKGlkKSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy8gV2UganVzdCBjaGVja2VkIGZvciBleGlzdGVuY2UgYWJvdmVcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tbm9uLW51bGwtYXNzZXJ0aW9uXG4gICAgICAgICAgICBjb25zdCB7IHJlc29sdmUsIGhhbmRsZU5hY2sgfSA9IHRoaXMud2lyZUxpc3RlbmVycy5nZXQoaWQpO1xuICAgICAgICAgICAgaWYgKGRhdGEuYWN0aW9uICE9PSAnYWNrJykge1xuICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soeyByZWFzb246ICdEaWQgbm90IHJlY2VpdmUgYWNrIGFjdGlvbicsIGVycm9yOiAoMCwgZXJyb3JzXzEuZXJyb3JUb1BPSk8pKG5ldyB0cmFuc3BvcnRfZXJyb3JzXzEuTm9BY2tFcnJvcihkYXRhLmFjdGlvbikpIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoISgncGF5bG9hZCcgaW4gZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAvLyBJJ20gbm90IHN1cmUgd2hlbiB0aGlzIGNvZGUgd291bGQgYWN0dWFsbHkgcnVuLCBidXQgcGFzc2luZyBpbiBzb21ldGhpbmcgdGhhdCBkb2Vlc24ndCBoYXZlIGEgcmVhc29uIHRvIHRoZSBydW50aW1lZXJyb3IgY29uc3RydWN0b3Igd2lsbCBub3QgZW5kIHdlbGwuXG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZGF0YS5yZWFzb24gPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soZGF0YSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oJ1JlY2VpdmVkIGludmFsaWQgcmVzcG9uc2UgZnJvbSBjb3JlJywgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soeyByZWFzb246ICdpbnZhbGlkIHJlc3BvbnNlIHNoYXBlJyB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgIC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BkYXRhLml0ZXJhdGVlLFxuICAgICAgICAgICAgICB0eXBlID0gZGF0YS50eXBlLFxuICAgICAgICAgICAgICBjb21wdXRlZCA9IGl0ZXJhdGVlKHZhbHVlKTtcblxuICAgICAgICAgIGlmICh0eXBlID09IExBWllfTUFQX0ZMQUcpIHtcbiAgICAgICAgICAgIHZhbHVlID0gY29tcHV0ZWQ7XG4gICAgICAgICAgfSBlbHNlIGlmICghY29tcHV0ZWQpIHtcbiAgICAgICAgICAgIGlmICh0eXBlID09IExBWllfRklMVEVSX0ZMQUcpIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBicmVhayBvdXRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmVzdWx0W3Jlc0luZGV4KytdID0gdmFsdWU7XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8vIEVuc3VyZSBgTGF6eVdyYXBwZXJgIGlzIGFuIGluc3RhbmNlIG9mIGBiYXNlTG9kYXNoYC5cbiAgICBMYXp5V3JhcHBlci5wcm90b3R5cGUgPSBiYXNlQ3JlYXRlKGJhc2VMb2Rhc2gucHJvdG90eXBlKTtcbiAgICBMYXp5V3JhcHBlci5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBMYXp5V3JhcHBlcjtcblxuICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi9cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYSBoYXNoIG9iamVjdC5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQGNvbnN0cnVjdG9yXG4gICAgICogQHBhcmFtIHtBcnJheX0gW2VudHJpZXNdIFRoZSBrZXktdmFsdWUgcGFpcnMgd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gICAgICA/IG5ldyBTZXRDYWNoZShvdGhJbmRleCAmJiBhcnJheSlcbiAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgIH1cbiAgICAgIGFycmF5ID0gYXJyYXlzWzBdO1xuXG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBzZWVuID0gY2FjaGVzWzBdO1xuXG4gICAgICBvdXRlcjpcbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoICYmIHJlc3VsdC5sZW5ndGggPCBtYXhMZW5ndGgpIHtcbiAgICAgICAgdmFyIHZhbHVlID0gYXJyYXlbaW5kZXhdLFxuICAgICAgICAgICAgY29tcHV0ZWQgPSBpdGVyYXRlZSA/IGl0ZXJhdGVlKHZhbHVlKSA6IHZhbHVlO1xuXG4gICAgICAgIHZhbHVlID0gKGNvbXBhcmF0b3IgfHwgdmFsdWUgIT09IDApID8gdmFsdWUgOiAwO1xuICAgICAgICBpZiAoIShzZWVuXG4gICAgICAgICAgICAgID8gY2FjaGVIYXMoc2VlbiwgY29tcHV0ZWQpXG4gICAgICAgICAgICAgIDogaW5jbHVkZXMocmVzdWx0LCBjb21wdXRlZCwgY29tcGFyYXRvcilcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICBvdGhJbmRleCA9IG90aExlbmd0aDtcbiAgICAgICAgICB3aGlsZSAoLS1vdGhJbmRleCkge1xuICAgICAgICAgICAgdmFyIGNhY2hlID0gY2FjaGVzW290aEluZGV4XTtcbiAgICAgICAgICAgIGlmICghKGNhY2hlXG4gICAgICAgICAgICAgICAgICA/IGNhY2hlSGFzKGNhY2hlLCBjb21wdXRlZClcbiAgICAgICAgICAgICAgICAgIDogaW5jbHVkZXMoYXJyYXlzW290aEluZGV4XSwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICBjb250aW51ZSBvdXRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICA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nLFxuICAgICAgICAgIGlzU2FtZVRhZyA9IG9ialRhZyA9PSBvdGhUYWc7XG5cbiAgICAgIGlmIChpc1NhbWVUYWcgJiYgaXNCdWZmZXIob2JqZWN0KSkge1xuICAgICAgICBpZiAoIWlzQnVmZmVyKG90aGVyKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBvYmpJc0FyciA9IHRydWU7XG4gICAgICAgIG9iaklzT2JqID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBpZiAoaXNTYW1lVGFnICYmICFvYmpJc09iaikge1xuICAgICAgICBzdGFjayB8fCAoc3RhY2sgPSBuZXcgU3RhY2spO1xuICAgICAgICByZXR1cm4gKG9iaklzQXJyIHx8IGlzVHlwZWRBcnJheShvYmplY3QpKVxuICAgICAgICAgID8gZXF1YWxBcnJheXMob2JqZWN0LCBvdGhlciwgYml0bWFzaywgY3VzdG9taXplciwgZXF1YWxGdW5jLCBzdGFjaylcbiAgICAgICAgICA6IGVxdWFsQnlUYWcob2JqZWN0LCBvdGhlciwgb2JqVGFnLCBiaXRtYXNrLCBjdXN0b21pemVyLCBlcXVhbEZ1bmMsIHN0YWNrKTtcbiAgICAgIH1cbiAgICAgIGlmICghKGJpdG1hc2sgJiBDT01QQVJFX1BBUlRJQUxfRkxBRykpIHtcbiAgICAgICAgdmFyIG9iaklzV3JhcHBlZCA9IG9iaklzT2JqICYmIGhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCAnX193cmFwcGVkX18nKSxcbiAgICAgICAgICAgIG90aElzV3JhcHBlZCA9IG90aElzT2JqICYmIGhhc093blByb3BlcnR5LmNhbGwob3RoZXIsICdfX3dyYXBwZWRfXycpO1xuXG4gICAgICAgIGlmIChvYmpJc1dyYXBwZWQgfHwgb3RoSXNXcmFwcGVkKSB7XG4gICAgICAgICAgdmFyIG9ialVud3JhcHBlZCA9IG9iaklzV3JhcHBlZCA/IG9iamVjdC52YWx1ZSgpIDogb2JqZWN0LF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bZGF0YVswXV1cbiAgICAgICAgICAgICAgOiAhKGRhdGFbMF0gaW4gb2JqZWN0KVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICBkYXRhID0gbWF0Y2hEYXRhW2luZGV4XTtcbiAgICAgICAgdmFyIGtleSA9IGRhdGFbMF0sXG4gICAgICAgICAgICBvYmpWYWx1ZSA9IG9iamVjdFtrZXldLFxuICAgICAgICAgICAgc3JjVmFsdWUgPSBkYXRhWzFdO1xuXG4gICAgICAgIGlmIChub0N1c3RvbWl6ZXIgJiYgZGF0YVsyXSkge1xuICAgICAgICAgIGlmIChvYmpWYWx1ZSA9PT0gdW5kZWZpbmVkICYmICEoa2V5IGluIG9iamVjdCkpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdmFyIHN0YWNrID0gbmV3IFN0YWNrO1xuICAgICAgICAgIGlmIChjdXN0b21pemVyKSB7XG4gICAgICAgICAgICB2YXIgcmVzdWx0ID0gY3VzdG9taXplcihvYmpWYWx1ZSwgc3JjVmFsdWUsIGtleSwgb2JqZWN0LCBzb3VyY2UsIHN0YWNrKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKCEocmVzdWx0ID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICA/IGJhc2VJc0VxdWFsKHNyY1ZhbHVlLCBvYmpWYWx1ZSwgQ09NUEFSRV9QQVJUSUFMX0ZMQUcgfCBDT01QQVJFX1VOT1JERVJFRF9GTEFHLCBjdXN0b21pemVyLCBzdGFjaylcbiAgICAgICAgICAgICAgICA6IHJlc3VsdFxuICAgICAgICAgICAgICApKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gIC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gICogQHBhcmFtIHtudW1iZXJbXX0gaW5kZXhlcyBUaGUgaW5kZXhlcyBvZiBlbGVtZW50cyB0byByZW1vdmUuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIGBhcnJheWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZVB1bGxBdChhcnJheSwgaW5kZXhlcykge1xuICAgICAgdmFyIGxlbmd0aCA9IGFycmF5ID8gaW5kZXhlcy5sZW5ndGggOiAwLFxuICAgICAgICAgIGxhc3RJbmRleCA9IGxlbmd0aCAtIDE7XG5cbiAgICAgIHdoaWxlIChsZW5ndGgtLSkge1xuICAgICAgICB2YXIgaW5kZXggPSBpbmRleGVzW2xlbmd0aF07XG4gICAgICAgIGlmIChsZW5ndGggPT0gbGFzdEluZGV4IHx8IGluZGV4ICE9PSBwcmV2aW91cykge1xuICAgICAgICAgIHZhciBwcmV2aW91cyA9IGluZGV4O1xuICAgICAgICAgIGlmIChpc0luZGV4KGluZGV4KSkge1xuICAgICAgICAgICAgc3BsaWNlLmNhbGwoYXJyYXksIGluZGV4LCAxKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYmFzZVVuc2V0KGFycmF5LCBpbmRleCk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gYXJyYXk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ucmFuZG9tYCB3aXRob3V0IHN1cHBvcnQgZm9yIHJldHVybmluZ1xuICAgICAqIGZsb2F0aW5nLXBvaW50IG51bWJlcnMuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsb3dlciBUaGUgbG93ZXIgYm91bmQuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHVwcGVyIFRoZSB1cHBlciBib3VuZC5cbiAgICAgKiBAcmV0dXJucyB7bnVtY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W5kZXhdID0gcGFydGlhbHNbcmlnaHRJbmRleF07XG4gICAgICB9XG4gICAgICB3aGlsZSAoKytob2xkZXJzSW5kZXggPCBob2xkZXJzTGVuZ3RoKSB7XG4gICAgICAgIGlmIChpc1VuY3VycmllZCB8fCBhcmdzSW5kZXggPCBhcmdzTGVuZ3RoKSB7XG4gICAgICAgICAgcmVzdWx0W29mZnNldCArIGhvbGRlcnNbaG9sZGVyc0luZGV4XV0gPSBhcmdzW2FyZ3NJbmRleCsrXTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb3BpZXMgdGhlIHZhbHVlcyBvZiBgc291cmNlYCB0byBgYXJyYXlgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge0FycmF5fSBzb3VyY2UgVGhlIGFycmF5IHRvIGNvcHkgdmFsdWVzIGZyb20uXG4gICAgICogQHBhcmFtIHtBcnJheX0gW2FycmF5PVtdXSBUaGUgYXJyYXkgdG8gY29weSB2YWx1ZXMgdG8uXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIGBhcnJheWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29weUFycmF5KHNvdXJjZSwgYXJyYXkpIHtcbiAgICAgIHZhciBpbmRleCA9IC0xLFxuICAgICAgICAgIGxlbmd0aCA9IHNvdXJjZS5sZW5ndGg7XG5cbiAgICAgIGFycmF5IHx8IChhcnJheSA9IEFycmF5KGxlbmd0aCkpO1xuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgYXJyYXlbaW5kZXhdID0gc291cmNlW2luZGV4XTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBhcnJheTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb3BpZXMgcHJvcGVydGllcyBvZiBgc291cmNlYCB0byBgb2JqZWN0YC5cbiAgICAgKlxu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GVyKCkge1xuICAgICAgICB2YXIgbGVuZ3RoID0gYXJndW1lbnRzLmxlbmd0aCxcbiAgICAgICAgICAgIGFyZ3MgPSBBcnJheShsZW5ndGgpLFxuICAgICAgICAgICAgaW5kZXggPSBsZW5ndGgsXG4gICAgICAgICAgICBwbGFjZWhvbGRlciA9IGdldEhvbGRlcih3cmFwcGVyKTtcblxuICAgICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICAgIGFyZ3NbaW5kZXhdID0gYXJndW1lbnRzW2luZGV4XTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaG9sZGVycyA9IChsZW5ndGggPCAzICYmIGFyZ3NbMF0gIT09IHBsYWNlaG9sZGVyICYmIGFyZ3NbbGVuZ3RoIC0gMV0gIT09IHBsYWNlaG9sZGVyKVxuICAgICAgICAgID8gW11cbiAgICAgICAgICA6IHJlcGxhY2VIb2xkZXJzKGFyZ3MsIHBsYWNlaG9sZGVyKTtcblxuICAgICAgICBsZW5ndGggLT0gaG9sZGVycy5sZW5ndGg7XG4gICAgICAgIGlmIChsZW5ndGggPCBhcml0eSkge1xuICAgICAgICAgIHJldHVybiBjcmVhdGVSZWN1cnJ5KFxuICAgICAgICAgICAgZnVuYywgYml0bWFzaywgY3JlYXRlSHlicmlkLCB3cmFwcGVyLnBsYWNlaG9sZGVyLCB1bmRlZmluZWQsXG4gICAgICAgICAgICBhcmdzLCBob2xkZXJzLCB1bmRlZmluZWQsIHVuZGVmaW5lZCwgYXJpdHkgLSBsZW5ndGgpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBmbiA9ICh0aGlzICYmIHRoaXMgIT09IHJvb3QgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgICAgIHJldHVybiBhcHBseShmbiwgdGhpcywgYXJncyk7XG4gICAgICB9XG4gICAgICByZXR1cm4gd3JhcHBlcjtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVz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8vIFNoaWZ0IHdpdGggZXhwb25lbnRpYWwgbm90YXRpb24gdG8gYXZvaWQgZmxvYXRpbmctcG9pbnQgaXNzdWVzLlxuICAgICAgICAgIC8vIFNlZSBbTUROXShodHRwczovL21kbi5pby9yb3VuZCNFeGFtcGxlcykgZm9yIG1vcmUgZGV0YWlscy5cbiAgICAgICAgICB2YXIgcGFpciA9ICh0b1N0cmluZyhudW1iZXIpICsgJ2UnKS5zcGxpdCgnZScpLFxuICAgICAgICAgICAgICB2YWx1ZSA9IGZ1bmMocGFpclswXSArICdlJyArICgrcGFpclsxXSArIHByZWNpc2lvbikpO1xuXG4gICAgICAgICAgcGFpciA9ICh0b1N0cmluZyh2YWx1ZSkgKyAnZScpLnNwbGl0KCdlJyk7XG4gICAgICAgICAgcmV0dXJuICsocGFpclswXSArICdlJyArICgrcGFpclsxXSAtIHByZWNpc2lvbikpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmdW5jKG51bWJlcik7XG4gICAgICB9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYSBzZXQgb2JqZWN0IG9mIGB2YWx1ZXNgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge0FycmF5fSB2YWx1ZXMgVGhlIHZhbHVlcyB0byBhZGQgdG8gdGhlIHNldC5cbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBSZXR1cm5zIHRoZSBuZXcgc2V0LlxuICAgICAqL1xuICAgIHZhciBjcmVhdGVTZXQgPSAhKFNldCAmJiAoMSAvIHNldFRvQXJyYXkobmV3IFNldChbLC0wXSkpWzFdKSA9PSBJTkZJTklUWSkgPyBub29wIDogZnVuY3Rpb24odmFsdWVzKSB7XG4gICAgICByZXR1cm4gbmV3IFNldCh2YWx1ZXMpO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgYF8udG9QYWlyc2Agb3IgYF8udG9QYWlyc0luYCBmdW5jdGlvb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gc3RhY2suc2V0KGFycmF5LCBvdGhlcik7XG4gICAgICBzdGFjay5zZXQob3RoZXIsIGFycmF5KTtcblxuICAgICAgLy8gSWdub3JlIG5vbi1pbmRleCBwcm9wZXJ0aWVzLlxuICAgICAgd2hpbGUgKCsraW5kZXggPCBhcnJMZW5ndGgpIHtcbiAgICAgICAgdmFyIGFyclZhbHVlID0gYXJyYXlbaW5kZXhdLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltpbmRleF07XG5cbiAgICAgICAgaWYgKGN1c3RvbWl6ZXIpIHtcbiAgICAgICAgICB2YXIgY29tcGFyZWQgPSBpc1BhcnRpYWxcbiAgICAgICAgICAgID8gY3VzdG9taXplcihvdGhWYWx1ZSwgYXJyVmFsdWUsIGluZGV4LCBvdGhlciwgYXJyYXksIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKGFyclZhbHVlLCBvdGhWYWx1ZSwgaW5kZXgsIGFycmF5LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wYXJlZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKGNvbXBhcmVkKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBhcnJheXMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICBpZiAoIWFycmF5U29tZShvdGhlciwgZnVuY3Rpb24ob3RoVmFsdWUsIG90aEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFjYWNoZUhhcyhzZWVuLCBvdGhJbmRleCkgJiZcbiAgICAgICAgICAgICAgICAgICAgKGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gc2Vlbi5wdXNoKG90aEluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0pKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmICghKFxuICAgICAgICAgICAgICBhcnJWYWx1ZSA9PT0gb3RoVmFsdWUgfHxcbiAgICAgICAgICAgICAgICBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaylcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgc3RhY2tbJ2RlbGV0ZSddKGFycmF5KTtcbiAgICAgIHN0YWNrWydkZWxldGUnXShvdGhlcik7XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEEgc3BlY2lhbGl6ZWQgdmVyc2lvbiBvZiBgYmFzZUlzRXF1YWxEZWVwYCBmb3IgY29tcGFyaW5nIG9iamVjdHMgb2ZcbiAgICAgKiB0aGUgc2FtZSBgdG9TdHJpbmdUYWdgLlxuICAgICAqXG4gICAgICogKipOb3RlOioqIFRoaXMgZnVuY3Rpb24gb25seSBzdXBwb3J0cyBjb21wYXJpbmcgdmFsdWVzIHdpdGggdGFncyBvZlxuICAgICAqIGBCb29sZWFuYCwgYERhdGVgLCBgRXJyb3JgLCBgTnVtYmVyYCwgYFJlZ0V4cGAsIG9yIGBTdHJpbmdgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH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IC8vIGFzIGVxdWFsLiBTZWUgaHR0cDovL3d3dy5lY21hLWludGVybmF0aW9uYWwub3JnL2VjbWEtMjYyLzcuMC8jc2VjLXJlZ2V4cC5wcm90b3R5cGUudG9zdHJpbmdcbiAgICAgICAgICAvLyBmb3IgbW9yZSBkZXRhaWxzLlxuICAgICAgICAgIHJldHVybiBvYmplY3QgPT0gKG90aGVyICsgJycpO1xuXG4gICAgICAgIGNhc2UgbWFwVGFnOlxuICAgICAgICAgIHZhciBjb252ZXJ0ID0gbWFwVG9BcnJheTtcblxuICAgICAgICBjYXNlIHNldFRhZzpcbiAgICAgICAgICB2YXIgaXNQYXJ0aWFsID0gYml0bWFzayAmIENPTVBBUkVfUEFSVElBTF9GTEFHO1xuICAgICAgICAgIGNvbnZlcnQgfHwgKGNvbnZlcnQgPSBzZXRUb0FycmF5KTtcblxuICAgICAgICAgIGlmIChvYmplY3Quc2l6ZSAhPSBvdGhlci5zaXplICYmICFpc1BhcnRpYWwpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gQXNzdW1lIGN5Y2xpYyB2YWx1ZXMgYXJlIGVxdWFsLlxuICAgICAgICAgIHZhciBzdGFja2VkID0gc3RhY2suZ2V0KG9iamVjdCk7XG4gICAgICAgICAgaWYgKHN0YWNrZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBzdGFja2VkID09IG90aGVyO1xuICAgICAgICAgIH1cbiAgICAgICAgICBiaXRtYXNrIHw9IENPTVBBUkVfVU5PUkRFUkVEX0ZMQUc7XG5cbiAgICAgICAgICAvLyBSZWN1cnNpdmVseSBjb21wYXJlIG9iamVjdHMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgICBzdGFjay5zZXQob2JqZWN0LCBvdGhlcik7XG4gICAgICAgICAgdmFyIHJlc3VsdCA9IGVxdWFsQXJyYXlzKGNvbnZlcnQob2JqZWN0KSwgY29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gMDtcblxuICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc3RhbXAgPSBuYXRpdmVOb3coKSxcbiAgICAgICAgICAgIHJlbWFpbmluZyA9IEhPVF9TUEFOIC0gKHN0YW1wIC0gbGFzdENhbGxlZCk7XG5cbiAgICAgICAgbGFzdENhbGxlZCA9IHN0YW1wO1xuICAgICAgICBpZiAocmVtYWluaW5nID4gMCkge1xuICAgICAgICAgIGlmICgrK2NvdW50ID49IEhPVF9DT1VOVCkge1xuICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50c1swXTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY291bnQgPSAwO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmdW5jLmFwcGx5KHVuZGVmaW5lZCwgYXJndW1lbnRzKTtcbiAgICAgIH07XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQSBzcGVjaWFsaXplZCB2ZXJzaW9uIG9mIGBfLnNodWZmbGVgIHdoaWNoIG11dGF0ZXMgYW5kIHNldHMgdGhlIHNpemUgb2YgYGFycmF5YC5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtBcnJheX0gYXJyYXkgVGhlIGFycmF5IHRvIHNodWZmbGUuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IFtzaXplPWFycmF5Lmxlbmd0aF0gVGhlIHNpemUgb2YgYGFycmF5YC5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgYGFycmF5YC5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzaHVmZmxlU2VsZihhcnJheSwgc2l6ZSkge1xuICAgICAgdmFyIGluZGV4ID0gLTEsXG4gICAgICAgICAgbGVuZ3RoID0gYXJyYXkubGVuZ3RoLFxuICAgICAgICAgIGxhc3RJbmRleCA9IGxlbmd0aCAtIDE7XG5cbiAgICAgIHNpemUgPSBzaXplID09PSB1bmRlZm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kIGVsZW1lbnRzLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMiwgMywgNF07XG4gICAgICogdmFyIGV2ZW5zID0gXy5yZW1vdmUoYXJyYXksIGZ1bmN0aW9uKG4pIHtcbiAgICAgKiAgIHJldHVybiBuICUgMiA9PSAwO1xuICAgICAqIH0pO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAzXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coZXZlbnMpO1xuICAgICAqIC8vID0+IFsyLCA0XVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHJlbW92ZShhcnJheSwgcHJlZGljYXRlKSB7XG4gICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICBpZiAoIShhcnJheSAmJiBhcnJheS5sZW5ndGgpKSB7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBpbmRleGVzID0gW10sXG4gICAgICAgICAgbGVuZ3RoID0gYXJyYXkubGVuZ3RoO1xuXG4gICAgICBwcmVkaWNhdGUgPSBnZXRJdGVyYXRlZShwcmVkaWNhdGUsIDMpO1xuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgdmFyIHZhbHVlID0gYXJyYXlbaW5kZXhdO1xuICAgICAgICBpZiAocHJlZGljYXRlKHZhbHVlLCBpbmRleCwgYXJyYXkpKSB7XG4gICAgICAgICAgcmVzdWx0LnB1c2godmFsdWUpO1xuICAgICAgICAgIGluZGV4ZXMucHVzaChpbmRleCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGJhc2VQdWxsQXQoYXJyYXksIGluZGV4ZXMpO1xuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXZlcnNlcyBgYXJyYXlg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xdWVuY2Ugd2l0aG91dCBleHBsaWNpdCBjaGFpbmluZy5cbiAgICAgKiBfKHVzZXJzKS5oZWFkKCk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknLCAnYWdlJzogMzYgfVxuICAgICAqXG4gICAgICogLy8gQSBzZXF1ZW5jZSB3aXRoIGV4cGxpY2l0IGNoYWluaW5nLlxuICAgICAqIF8odXNlcnMpXG4gICAgICogICAuY2hhaW4oKVxuICAgICAqICAgLmhlYWQoKVxuICAgICAqICAgLnBpY2soJ3VzZXInKVxuICAgICAqICAgLnZhbHVlKCk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknIH1cbiAgICAgKi9cbiAgICBmdW5jdGlvbiB3cmFwcGVyQ2hhaW4oKSB7XG4gICAgICByZXR1cm4gY2hhaW4odGhpcyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRXhlY3V0ZXMgdGhlIGNoYWluIHNlcXVlbmNlIGFuZCByZXR1cm5zIHRoZSB3cmFwcGVkIHJlc3VsdC5cbiAgICAgKlxuICAgICAqIEBuYW1lIGNvbW1pdFxuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDMuMi4wXG4gICAgICogQGNhdGVnb3J5IFNlcVxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgdGhlIG5ldyBgbG9kYXNoYCB3cmFwcGVyIGluc3RhbmNlLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMl07XG4gICAgICogdmFyIHdyYXBwZWQgPSBfKGFycmF5KS5wdXNoKDMpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAyXVxuICAgICAqXG4gICAgICogd3JhcHBlZCA9IHdyYXBwZWQuY29tbWl0KCk7XG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAyL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XJncyA9IGxhc3RUaGlzID0gdW5kZWZpbmVkO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBjYW5jZWwoKSB7XG4gICAgICAgIGlmICh0aW1lcklkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBjbGVhclRpbWVvdXQodGltZXJJZCk7XG4gICAgICAgIH1cbiAgICAgICAgbGFzdEludm9rZVRpbWUgPSAwO1xuICAgICAgICBsYXN0QXJncyA9IGxhc3RDYWxsVGltZSA9IGxhc3RUaGlzID0gdGltZXJJZCA9IHVuZGVmaW5lZDtcbiAgICAgIH1cblxuICAgICAgZnVuY3Rpb24gZmx1c2goKSB7XG4gICAgICAgIHJldHVybiB0aW1lcklkID09PSB1bmRlZmluZWQgPyByZXN1bHQgOiB0cmFpbGluZ0VkZ2Uobm93KCkpO1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBkZWJvdW5jZWQoKSB7XG4gICAgICAgIHZhciB0aW1lID0gbm93KCksXG4gICAgICAgICAgICBpc0ludm9raW5nID0gc2hvdWxkSW52b2tlKHRpbWUpO1xuXG4gICAgICAgIGxhc3RBcmdzID0gYXJndW1lbnRzO1xuICAgICAgICBsYXN0VGhpcyA9IHRoaXM7XG4gICAgICAgIGxhc3RDYWxsVGltZSA9IHRpbWU7XG5cbiAgICAgICAgaWYgKGlzSW52b2tpbmcpIHtcbiAgICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4gbGVhZGluZ0VkZ2UobGFzdENhbGxUaW1lKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG1heGluZykge1xuICAgICAgICAgICAgLy8gSGFuZGxlIGludm9jYXRpb25zIGluIGEgdGlnaHQgbG9vcC5cbiAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lcklkKTtcbiAgICAgICAgICAgIHRpbWVySWQgPSBzZXRUaW1lb3V0KHRp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cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjQuMFxuICAgICAqIEBjYXRlZ29yeSBMYW5nXG4gICAgICogQHBhcmFtIHsqfSB2YWx1ZSBUaGUgdmFsdWUgdG8gaW5zcGVjdC5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIGNhc3QgYXJyYXkuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8uY2FzdEFycmF5KDEpO1xuICAgICAqIC8vID0+IFsxXVxuICAgICAqXG4gICAgICogXy5jYXN0QXJyYXkoeyAnYSc6IDEgfSk7XG4gICAgICogLy8gPT4gW3sgJ2EnOiAxIH1dXG4gICAgICpcbiAgICAgKiBfLmNhc3RBcnJheSgnYWJjJyk7XG4gICAgICogLy8gPT4gWydhYmMnXVxuICAgICAqXG4gICAgICogXy5jYXN0QXJyYXkobnVsbCk7XG4gICAgICogLy8gPT4gW251bGxdXG4gICAgICpcbiAgICAgKiBfLmNhc3RBcnJheSh1bmRlZmluZWQpO1xuICAgICAqIC8vID0+IFt1bmRlZmluZWRdXG4gICAgICpcbiAgICAgKiBfLmNhc3RBcnJheSgpO1xuICAgICAqIC8vID0+IFtdXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMiwgM107XG4gICAgICogY29uc29sZS5sb2coXy5jYXN0QXJyYXkoYXJyYXkpID09PSBhcnJheSk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGNhc3RBcnJheSgpIHtcbiAgICAgIGlmICghYXJndW1lbnRzLmxlbmd0aCkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICB2YXIgdmFsdWUgPSBhcmd1bWVudHNbMF07XG4gICAgICByZXR1cm4gaXNBcnJheSh2YWx1ZSkgPyB2YWx1ZSA6IFt2YWx1ZV07XG4gICAgfVxuXG4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VxuICAgICAqXG4gICAgICogXy5pc09iamVjdChfLm5vb3ApO1xuICAgICAqIC8vID0+IHRydWVcbiAgICAgKlxuICAgICAqIF8uaXNPYmplY3QobnVsbCk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBpc09iamVjdCh2YWx1ZSkge1xuICAgICAgdmFyIHR5cGUgPSB0eXBlb2YgdmFsdWU7XG4gICAgICByZXR1cm4gdmFsdWUgIT0gbnVsbCAmJiAodHlwZSA9PSAnb2JqZWN0JyB8fCB0eXBlID09ICdmdW5jdGlvbicpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENoZWNrcyBpZiBgdmFsdWVgIGlzIG9iamVjdC1saWtlLiBBIHZhbHVlIGlzIG9iamVjdC1saWtlIGlmIGl0J3Mgbm90IGBudWxsYFxuICAgICAqIGFuZCBoYXMgYSBgdHlwZW9mYCByZXN1bHQgb2YgXCJvYmplY3RcIi5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjAuMFxuICAgICAqIEBjYXRlZ29yeSBMYW5nXG4gICAgICogQHBhcmFtIHsqfSB2YWx1ZSBUaGUgdmFsdWUgdG8gY2hlY2suXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFJldHVybnMgYHRydWVgIGlmIGB2YWx1ZWAgaXMgb2JqZWN0LWxpa2UsIGVsc2UgYGZhbHNlYC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy5pc09iamVjdExpa2Uoe30pO1xuICAgICAqIC8vID0+IHRydWVcbiAgICAgKlxuICAgICAqIF8uaXNPYmplY3RMaWtlKFsxLCAyLCAzXSk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqXG4gICAgICogXy5pc09iamVjdExpa2UoXy5ub29wKTtcbiAgICAgKiAvLyA9PiBmYWxzZVxuICAgICAqXG4gICAgICogXy5pc09iamVjdExp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XG4gICAgLyoqXG4gICAgICogQ29udmVydHMgYHZhbHVlYCB0byBhIG51bWJlci5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjAuMFxuICAgICAqIEBjYXRlZ29yeSBMYW5nXG4gICAgICogQHBhcmFtIHsqfSB2YWx1ZSBUaGUgdmFsdWUgdG8gcHJvY2Vzcy5cbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfSBSZXR1cm5zIHRoZSBudW1iZXIuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udG9OdW1iZXIoMy4yKTtcbiAgICAgKiAvLyA9PiAzLjJcbiAgICAgKlxuICAgICAqIF8udG9OdW1iZXIoTnVtYmVyLk1JTl9WQUxVRSk7XG4gICAgICogLy8gPT4gNWUtMzI0XG4gICAgICpcbiAgICAgKiBfLnRvTnVtYmVyKEluZmluaXR5KTtcbiAgICAgKiAvLyA9PiBJbmZpbml0eVxuICAgICAqXG4gICAgICogXy50b051bWJlcignMy4yJyk7XG4gICAgICogLy8gPT4gMy4yXG4gICAgICovXG4gICAgZnVuY3Rpb24gdG9OdW1iZXIodmFsdWUpIHtcbiAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT0gJ251bWJlcicpIHtcbiAgICAgICAgcmV0dXJuIHZhbHVlO1xuICAgICAgfVxuICAgICAgaWYgKGlzU3ltYm9sKHZhbHVlKSkge1xuICAgICAgICByZXR1cm4gTkFOO1xuICAgICAgfVxuICAgICAgaWYgKGlzT2JqZWN0KHZhbHVlKSkge1xuICAgICAgICB2YXIgb3RoZXIgPSB0eXBlb2YgdmFsdWUudmFsdWVPZiA9PSAnZnVuY3Rpb24nID8gdmFsdWUudmFsdWVPZigpIDogdmFsdWU7XG4gICAgICAgIHZhbHVlID0gaXNPYmplY3Qob3RoZXIpID8gKG90aGVyICsgJycpIDogb3RoZXI7XG4gICAgICB9XG4gICAgICBpZiAodHlwZW9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mluZWQ7XG4gICAgICB9XG4gICAgICBpZiAoZmxvYXRpbmcgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBpZiAodHlwZW9mIHVwcGVyID09ICdib29sZWFuJykge1xuICAgICAgICAgIGZsb2F0aW5nID0gdXBwZXI7XG4gICAgICAgICAgdXBwZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodHlwZW9mIGxvd2VyID09ICdib29sZWFuJykge1xuICAgICAgICAgIGZsb2F0aW5nID0gbG93ZXI7XG4gICAgICAgICAgbG93ZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGlmIChsb3dlciA9PT0gdW5kZWZpbmVkICYmIHVwcGVyID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgbG93ZXIgPSAwO1xuICAgICAgICB1cHBlciA9IDE7XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgbG93ZXIgPSB0b0Zpbml0ZShsb3dlcik7XG4gICAgICAgIGlmICh1cHBlciA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgdXBwZXIgPSBsb3dlcjtcbiAgICAgICAgICBsb3dlciA9IDA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdXBwZXIgPSB0b0Zpbml0ZSh1cHBlcik7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGlmIChsb3dlciA+IHVwcGVyKSB7XG4gICAgICAgIHZhciB0ZW1wID0gbG93ZXI7XG4gICAgICAgIGxvd2VyID0gdXBwZXI7XG4gICAgICAgIHVwcGVyID0gdGVtcDtcbiAgICAgIH1cbiAgICAgIGlmIChmbG9hdGluZyB8fCBsb3dlciAlIDEgfHwgdXBwZXIgJSAxKSB7XG4gICAgICAgIHZhciByYW5kID0gbmF0aXZlUmFuZG9tKCk7XG4gICAgICAgIHJldHVybiBuYXRpdmVNaW4obG93ZXIgKyAocmFuZCAqICh1cHBlciAtIGxvd2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zaW9uO1xuICAgICAgfVxuICAgICAgc3RyaW5nID0gdG9TdHJpbmcoc3RyaW5nKTtcblxuICAgICAgdmFyIHN0ckxlbmd0aCA9IHN0cmluZy5sZW5ndGg7XG4gICAgICBpZiAoaGFzVW5pY29kZShzdHJpbmcpKSB7XG4gICAgICAgIHZhciBzdHJTeW1ib2xzID0gc3RyaW5nVG9BcnJheShzdHJpbmcpO1xuICAgICAgICBzdHJMZW5ndGggPSBzdHJTeW1ib2xzLmxlbmd0aDtcbiAgICAgIH1cbiAgICAgIGlmIChsZW5ndGggPj0gc3RyTGVuZ3RoKSB7XG4gICAgICAgIHJldHVybiBzdHJpbmc7XG4gICAgICB9XG4gICAgICB2YXIgZW5kID0gbGVuZ3RoIC0gc3RyaW5nU2l6ZShvbWlzc2lvbik7XG4gICAgICBpZiAoZW5kIDwgMSkge1xuICAgICAgICByZXR1cm4gb21pc3Npb247XG4gICAgICB9XG4gICAgICB2YXIgcmVzdWx0ID0gc3RyU3ltYm9sc1xuICAgICAgICA/IGNhc3RTbGljZShzdHJTeW1ib2xzLCAwLCBlbmQpLmpvaW4oJycpXG4gICAgICAgIDogc3RyaW5nLnNsaWNlKDAsIGVuZCk7XG5cbiAgICAgIGlmIChzZXBhcmF0b3IgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICByZXR1cm4gcmVzdWx0ICsgb21pc3Npb247XG4gICAgICB9XG4gICAgICBpZiAoc3RyU3ltYm9scykge1xuICAgICAgICBlbmQgKz0gKHJlc3VsdC5sZW5ndGggLSBlbmQpO1xuICAgICAgfVxuICAgICAgaWYgKGlzUmVnRXhwKHNlcGFyYXRvcikpIHtcbiAgICAgICAgaWYgKHN0cmluZy5zbGljZShlbmQpLnNlYXJjaChzZXBhcmF0b3IpKSB7XG4gICAgICAgICAgdmFyIG1hdGNoLFxuICAgICAgICAgICAgICBzdWJzdHJpbmcgPSByZXN1bHQ7XG5cbiAgICAgICAgICBpZiAoIXNlcGFyYXRvci5nbG9iYWwpIHtcbi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vbkVsZW1lbnQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwib3B0aW9uXCIpO1xuXHRcdGxvZ0VsZW1lbnQuaWQgPSBsb2cuZGF0ZTtcblx0XHRsb2dFbGVtZW50LnRleHRDb250ZW50ID0gbG9nLm5hbWU7XG5cdFx0bG9nRWxlbWVudC52YWx1ZSA9IGxvZy5uYW1lO1xuXHRcdHBhcmVudEVsZW1lbnQuYXBwZW5kKGxvZ0VsZW1lbnQpO1xuXHR9XG59XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/dev/john/update-window-options/use-logging-apis/manifest.fin.json b/dev/john/update-window-options/use-logging-apis/manifest.fin.json index 83d16227..c8a4493b 100644 --- a/dev/john/update-window-options/use-logging-apis/manifest.fin.json +++ b/dev/john/update-window-options/use-logging-apis/manifest.fin.json @@ -1,25 +1,25 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", - "startup_app": { - "name": "use-application-logging", - "uuid": "use-application-logging", - "description": "An example of using application logging", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis/html/app.html", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis/favicon.ico", - "autoShow": true, - "defaultWidth": 1200, - "defaultHeight": 800, - "defaultCentered": true, - "minWidth": 800, - "minHeight": 400, - "enableAppLogging": true, - "logManagement": { - "enabled": true, - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis" - } - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", + "startup_app": { + "name": "use-application-logging", + "uuid": "use-application-logging", + "description": "An example of using application logging", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis/html/app.html", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis/favicon.ico", + "autoShow": true, + "defaultWidth": 1200, + "defaultHeight": 800, + "defaultCentered": true, + "minWidth": 800, + "minHeight": 400, + "enableAppLogging": true, + "logManagement": { + "enabled": true, + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-logging-apis" + } + } +} diff --git a/dev/john/update-window-options/use-platform-warn-before-closing-dialog/js/dialog.bundle.js b/dev/john/update-window-options/use-platform-warn-before-closing-dialog/js/dialog.bundle.js index a43b896b..a570aea7 100644 --- a/dev/john/update-window-options/use-platform-warn-before-closing-dialog/js/dialog.bundle.js +++ b/dev/john/update-window-options/use-platform-warn-before-closing-dialog/js/dialog.bundle.js @@ -12992,7 +12992,7 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; -var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_throwIfLayoutManagerNotInitialized; +var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_getLayoutManagerSpy, _LayoutModule_throwIfLayoutManagerNotInitialized; Object.defineProperty(Factory$2, "__esModule", { value: true }); Factory$2.LayoutModule = void 0; const base_1$5 = base; @@ -13064,10 +13064,31 @@ class LayoutModule extends base_1$5.Base { // in single-layout case, we return the undocumented layoutManager type (deprecate with CORE-1081) const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...this.fin.me.identity }; const layoutManager = await this.wire.environment.resolveLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), layoutIdentity); - return Object.assign(this.wrapSync(layoutIdentity), { layoutManager }); + return __classPrivateFieldGet$4(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity, layoutManager); } return this.wrapSync(this.fin.me.identity); }; + _LayoutModule_getLayoutManagerSpy.set(this, (layoutIdentity, layoutManager) => { + const msg = '[Layout] You are using a deprecated property `layoutManager` - it will throw if you access it starting in v37.'; + const managerProxy = new Proxy(layoutManager, { + get(target, key) { + console.warn(`[Layout-mgr-proxy] accessing ${key.toString()}`); + console.warn(msg); + return target[key]; + } + }); + const layout = Object.assign(this.wrapSync(layoutIdentity), { layoutManager: managerProxy }); + const layoutProxy = new Proxy(layout, { + get(target, key) { + if (key === 'layoutManager') { + console.warn(`[Layout-proxy] accessing ${key.toString()}`); + console.warn(msg); + } + return target[key]; + } + }); + return layoutProxy; + }); /** * Returns the layout manager for the current window * @returns @@ -13181,7 +13202,7 @@ class LayoutModule extends base_1$5.Base { } } Factory$2.LayoutModule = LayoutModule; -_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized(method) { +_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized(method) { if (!__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f")) { throw new Error(`You must call init before using the API ${method}`); } @@ -35113,4 +35134,4 @@ async function handleClose(userDecision) { /******/ })() ; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLmJ1bmRsZS5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQWE7O0FBRWIsOENBQTZDLEVBQUUsYUFBYSxFQUFDOztBQUU3RCxpQkFBaUIsbUJBQU8sQ0FBQyxzREFBUTtBQUNqQyxpQkFBaUIsbUJBQU8sQ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cbmNsYXNzIEJhc2Uge1xuICAgIC8qKlxuICAgICAqIEBpbnRlcm5hbFxuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKHdpcmUpIHtcbiAgICAgICAgdGhpcy5pc05vZGVFbnZpcm9ubWVudCA9ICgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuZW52aXJvbm1lbnQuY29uc3RydWN0b3IubmFtZSA9PT0gJ05vZGVFbnZpcm9ubWVudCc7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuaXNPcGVuRmluRW52aXJvbm1lbnQgPSAoKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLmVudmlyb25tZW50LmNvbnN0cnVjdG9yLm5hbWUgPT09ICdPcGVuRmluRW52aXJvbm1lbnQnO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmlzQnJvd3NlckVudmlyb25tZW50ID0gKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5lbnZpcm9ubWVudC5jb25zdHJ1Y3Rvci5uYW1lID09PSAnQnJvd3NlckVudmlyb25tZW50JztcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy53aXJlID0gd2lyZTtcbiAgICB9XG4gICAgZ2V0IGZpbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5nZXRGaW4oKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUHJvdmlkZXMgYWNjZXNzIHRvIHRoZSBPcGVuRmluIHJlcHJlc2VudGF0aW9uIG9mIHRoZSBjdXJyZW50IGNvZGUgY29udGV4dCAodXN1YWxseSBhIGRvY3VtZW50XG4gICAgICogc3VjaCBhcyBhIHtAbGluayBPcGVuRmluLlZpZXd9IG9yIHtAbGluayBPcGVuRmluLldpbmRvd30pLCBhcyB3ZWxsIGFzIHRvIHRoZSBjdXJyZW50IGBJbnRlcm9wYCBjb250ZXh0LlxuICAgICAqXG4gICAgICogVXNlZnVsIGZvciBkZWJ1Z2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XR0ZXIpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVsZXRlRW1pdHRlcklmTm90aGluZ1JlZ2lzdGVyZWQoZW1pdHRlcik7XG4gICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5kZXJlZ2lzdGVyRXZlbnRMaXN0ZW5lciA9IGFzeW5jIChldmVudFR5cGUsIG9wdGlvbnMgPSB7fSkgPT4ge1xuICAgICAgICAgICAgaWYgKHRoaXMuaGFzRW1pdHRlcigpKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgcnVudGltZUV2ZW50ID0ge1xuICAgICAgICAgICAgICAgICAgICAuLi50aGlzLmlkZW50aXR5LFxuICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXA6IG9wdGlvbnMudGltZXN0YW1wIHx8IERhdGUubm93KCksXG4gICAgICAgICAgICAgICAgICAgIHRvcGljOiB0aGlzLnRvcGljLFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiBldmVudFR5cGVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCd1bnN1YnNjcmliZS10by1kZXNrdG9wLWV2ZW50JywgcnVudGltZUV2ZW50KS5jYXRjaCgoKSA9PiBudWxsKTtcbiAgICAgICAgICAgICAgICBjb25zdCBlbWl0dGVyID0gdGhpcy5nZXRPckNyZWF0ZUVtaXR0ZXIoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1pdHRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFRoaXMgd2lsbCBvbmx5IGJlIHJlYWNoZWQgaWYgdW5zdWJzY3JpYmUgZnJvbSBldmVudCB0aGF0IGRvZXMgbm90IGV4aXN0IGJ1dCBkbyBub3Qgd2FudCB0byBlcnJvciBoZXJlXG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4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gICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEudmFsaWRhdGVJZGVudGl0eSkoaWRlbnRpdHkpO1xuXHQgICAgICAgIGlmIChlcnJvck1zZykge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyb3JNc2cpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICByZXR1cm4gbmV3IGluZGV4XzEuVmlldyh0aGlzLndpcmUsIGlkZW50aXR5KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogQXN5bmNocm9ub3VzbHkgcmV0dXJucyBhIFZpZXcgb2JqZWN0IHRoYXQgcmVwcmVzZW50cyB0aGUgY3VycmVudCB2aWV3XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBmaW4uVmlldy5nZXRDdXJyZW50KClcblx0ICAgICAqICAgICAudGhlbih2aWV3ID0+IGNvbnNvbGUubG9nKCdjdXJyZW50IHZpZXcnLCB2aWV3KSlcblx0ICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICpcblx0ICAgICAqIGBgYFxuXHQgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICovXG5cdCAgICBnZXRDdXJyZW50KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd2aWV3LWdldC1jdXJyZW50JykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgaWYgKCF0aGlzLndpcmUubWUuaXNWaWV3KSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBWaW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aXRpZXNDb250cm9sbGVyfVxuICAgICAgICAgKi9cbiAgICAgICAgX0xheW91dE5vZGVfY2xpZW50LnNldCh0aGlzLCB2b2lkIDApO1xuICAgICAgICAvKipcbiAgICAgICAgICogQ2hlY2tzIGlmIHRoZSBUYWJTdGFjayBvciBDb2x1bW5PclJvdyBpcyB0aGUgcm9vdCBjb250ZW50IGl0ZW1cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgaXNSb290ID0gYXdhaXQgc3RhY2suaXNSb290KCk7XG4gICAgICAgICAqIC8vIFRoZSBUYWJTdGFjayBpcyByb290OiBmYWxzZVxuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIFRhYlN0YWNrIGlzIHJvb3Q6ICR7aXNSb290fWApO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyBSZXRyaWV2ZXMgdGhlIHBhcmVudCBDb2x1bW5PclJvd1xuICAgICAgICAgKiBjb25zdCBwYXJlbnQgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogY29uc3QgcGFyZW50SXNSb290ID0gYXdhaXQgcGFyZW50LmlzUm9vdCgpO1xuICAgICAgICAgKiAvLyBUaGUgcGFyZW50IENvbHVtbk9yUm93IGlzIHJvb3Q6IHRydWVcbiAgICAgICAgICogY29uc29sZS5sb2coYFRoZSBwYXJlbnQgQ29sdW1uT3JSb3cgaXMgcm9vdDogJHtwYXJlbnRJc1Jvb3R9YCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5pc1Jvb3QgPSAoKSA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGUodGhpcywgX0xheW91dE5vZGVfY2xpZW50LCBcImZcIikuaXNSb290KHRoaXMuZW50aXR5SWQpO1xuICAgICAgICAvKipcbiAgICAgICAgICogQ2hlY2tzIGlmIHRoZSBUYWJTdGFjayBvciBDb2x1bW5PclJvdyBleGlzdHNcbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogLy8gUmV0cmlldmVzIHRoZSBwYXJlbnQgQ29sdW1uT3JSb3dcbiAgICAgICAgICogY29uc3QgY29sdW1uT3JSb3cgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogbGV0IGV4aXN0cyA9IGF3YWl0IHN0YWNrLmV4aXN0cygpO1xuICAgICAgICAgKiAvLyBvclxuICAgICAgICAgKiBsZXQgZXhpc3RzID0gYXdhaXQgY29sdW1uT3JSb3cuZXhpc3RzKCk7XG4gICAgICAgICAqIC8vIFRoZSBlbnRpdHkgZXhpc3RzOiB0cnVlXG4gICAgICAgICAqIGNvbnNvbGUubG9nKGBUaGUgZW50aXR5IGV4aXN0czogJHtleGlzdHN9YCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leGlzdHMgPSAoKSA9PiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGUodGhpcywgX0xheW91dE5vZGVfY2xpZW50LCBcImZcIikuZXhpc3RzKHRoaXMuZW50aXR5SWQpO1xuICAgICAgICAvKipcbiAgICAgICAgICogUmV0cmlldmVzIHRoZSBwYXJlbnQgb2YgdGhlIFRhYlN0YWNrIG9yIENvbHVtbk9yUm93XG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGlmICghZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcuJyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3Qgc3RhY2sgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFN0YWNrKCk7XG4gICAgICAgICAqIC8vIFJldHJpZXZlcyB0aGUgcGFyZW50IENvbHVtbk9yUm93XG4gICAgICAgICAqIGNvbnN0IGNvbHVtbk9yUm93ID0gYXdhaXQgc3RhY2suZ2V0UGFyZW50KCk7XG4gICAgICAgICAqXG4gICAgICAgICAqIC8vIHVuZGVmaW5lZCBpZiBlbnRpdHkgaXMgdGhlIHJvb3QgaXRlbVxuICAgICAgICAgKiBsZXQgcGFyZW50ID0gYXdhaXQgY29sdW1uT3JSb3cuZ2V0UGFyZW50KCk7XG4gICAgICAgICAqIC8vIG9yXG4gICAgICAgICAqIGxldCBwYXJlbnQgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmdldFBhcmVudCA9IGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHBhcmVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkZSh0aGlzLCBfTGF5b3V0Tm9kZV9jbGllbnQsIFwiZlwiKS5nZXRQYXJlbnQodGhpcy5lbnRpdHlJZCk7XG4gICAgICAgICAg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7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgY29sdW1uT3JSb3cgPSBhd2FpdCBzdGFjay5nZXRQYXJlbnQoKTtcbiAgICAgICAgICogLy8gUG9zc2libGUgcG9zaXRpb24gaW5wdXRzOiAncmlnaHQnIHwgJ2xlZnQnIHwgJ3RvcCcgfCAnYm90dG9tJ1xuICAgICAgICAgKiBsZXQgcmlnaHRTdGFja3MgPSBhd2FpdCBjb2x1bW5PclJvdy5nZXRBZGphY2VudFN0YWNrcygncmlnaHQnKTtcbiAgICAgICAgICogbGV0IGxlZnRTdGFja3MgPSBhd2FpdCBjb2x1bW5PclJvdy5nZXRBZGphY2VudFN0YWNrcygnbGVmdCcpO1xuICAgICAgICAgKiAvLyBvclxuICAgICAgICAgKiBsZXQgcmlnaHRTdGFja3MgPSBhd2FpdCBzdGFjay5nZXRBZGphY2VudFN0YWNrcygncmlnaHQnKTtcbiAgICAgICAgICogbGV0IGxlZnRTdGFja3MgPSBhd2FpdCBzdGFjay5nZXRBZGphY2VudFN0YWNrcygnbGVmdCcpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIGVudGl0eSBoYXMgJHtyaWdodFN0YWNrcy5sZW5ndGh9IHN0YWNrcyB0byB0aGUgcmlnaHQsIGFuZCAke2xlZnRTdGFja3MubGVuZ3RofSBzdGFja3MgdG8gdGhlIGxlZnRgKTtcbiAgICAgICAgICpcbiAgICAgICAgICogYGBgXG4gICAgICAgICAqIEBleHBlcmltZW50YWxcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZ2V0QWRqYWNlbnRTdGFja3MgPSBhc3luYyAoZWRnZSkg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HZpZXcgaWRlbnRpdHkgZG9lcyBub3QgZXhpc3Qgb3Igd2FzIGFscmVhZHkgZGVzdHJveWVkLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0gdmlldyAtIElkZW50aXR5IG9mIHRoZSB2aWV3IHRvIHJlbW92ZS5cbiAgICAgICAgICogQHRocm93cyBJZiB0aGUgdmlldyBkb2VzIG5vdCBleGlzdCBvciBkb2VzIG5vdCBiZWxvbmcgdG8gdGhlIHN0YWNrLlxuICAgICAgICAgKiBAdGhyb3dzIElmIHRoZSB7QGxpbmsgVGFiU3RhY2t9IGhhcyBiZWVuIGRlc3Ryb3llZC5cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50U3RhY2soKTtcbiAgICAgICAgICogY29uc3QgZ29vZ2xlVmlld0lkZW50aXR5ID0gYXdhaXQgc3RhY2suYWRkVmlldyh7IG5hbWU6ICdnb29nbGUtdmlldycsIHVybDogJ2h0dHA6Ly9nb29nbGUuY29tLycgfSk7XG4gICAgICAgICAqXG4gICAgICAgICAqIGF3YWl0IHN0YWNrLnJlbW92ZVZpZXcoZ29vZ2xlVmlld0lkZW50aXR5KTtcbiAgICAgICAgICpcbiAgICAgICAgICogdHJ5IHtcbiAgICAgICAgICogICAgIGF3YWl0IHN0YWNrLnJlbW92ZVZpZXcoZ29vZ2xlVmlld0lkZW50aXR5KTtcbiAgICAgICAgICogfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICogICAgIC8vIFRyaWVkIHRvIHJlbW92ZSBhIHZpZX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ICovXG5jbGFzcyBDb2x1bW5PclJvdyBleHRlbmRzIExheW91dE5vZGUge1xuICAgIC8qKlxuICAgICAqIEBpbnRlcm5hbFxuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKGNsaWVudCwgZW50aXR5SWQsIHR5cGUpIHtcbiAgICAgICAgc3VwZXIoY2xpZW50LCBlbnRpdHlJZCk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAaWdub3JlXG4gICAgICAgICAqIEBpbnRlcm5hbFxuICAgICAgICAgKiBBcGlDbGllbnQgZm9yIHtAbGluayBMYXlvdXRFbnRpdGllc0NvbnRyb2xsZXJ9XG4gICAgICAgICAqL1xuICAgICAgICBfQ29sdW1uT3JSb3dfY2xpZW50LnNldCh0aGlzLCB2b2lkIDApO1xuICAgICAgICAvKipcbiAgICAgICAgICogUmV0cmlldmVzIHRoZSBjb250ZW50IGFycmF5IG9mIHRoZSBDb2x1bW5PclJvd1xuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBpZiAoIWZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3LicpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IHN0YWNrID0gYXdhaXQgZmluLm1lLmdldEN1cnJlbnRTdGFjaygpO1xuICAgICAgICAgKiAvLyBSZXRyaWV2ZXMgdGhlIHBhcmVudCBDb2x1bW5PclJvd1xuICAgICAgICAgKiBjb25zdCBjb2x1bW5PclJvdyA9IGF3YWl0IHN0YWNrLmdldFBhcmVudCgpO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyByZXR1cm5zIFtUYWJTdGFja11cbiAgICAgICAgICogY29uc3QgY29udGVudEFycmF5ID0gYXdhaXQgY29sdW1uT3JSb3cuZ2V0Q29udGVudCgpO1xu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gT3B0aW9ucyBmb3IgdGhlIGNhcHR1cmVQYWdlIGNhbGwuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogLy8gUE5HIGltYWdlIG9mIGEgZnVsbCB2aXNpYmxlIFZpZXdcbiAgICAgKiBjb25zb2xlLmxvZyhhd2FpdCB2aWV3LmNhcHR1cmVQYWdlKCkpO1xuICAgICAqXG4gICAgICogLy8gTG93LXF1YWxpdHkgSlBFRyBpbWFnZSBvZiBhIGRlZmluZWQgdmlzaWJsZSBhcmVhIG9mIHRoZSB2aWV3XG4gICAgICogY29uc3Qgb3B0aW9ucyA9IHtcbiAgICAgKiAgICAgYXJlYToge1xuICAgICAqICAgICAgICAgaGVpZ2h0OiAxMDAsXG4gICAgICogICAgICAgICB3aWR0aDogMTAwLFxuICAgICAqICAgICAgICAgeDogMTAsXG4gICAgICogICAgICAgICB5OiAxMCxcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgZm9ybWF0OiAnanBnJyxcbiAgICAgKiAgICAgcXVhbGl0eTogMjBcbiAgICAgKiB9XG4gICAgICogY29uc29sZS5sb2coYXdhaXQgdmlldy5jYXB0dXJlUGFnZShvcHRpb25zKSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBXaW5kb3c6XG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCB3bmQgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqIC8vIFBORyBpbWFnZSBvZiBhIGZ1bGwgdmlzaWJsZSB3aW5kb3dcbiAgICAgKiBjb25zb2xlLmxvZyhhd2FpdCB3bmQuY2FwdHVyZVBhZ2UoKSk7XG4gICAgICpcbiAgICAgKiAvLyBMb3ctcXVhbGl0eSBKUEVHIGltYWdlIG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2FkLmRhdGEpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSB6b29tIGxldmVsIG9mIHRoZSBXZWJDb250ZW50cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFpvb21MZXZlbCgpIHtcbiAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmdldEN1cnJlbnQoKTtcbiAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHZpZXcuZ2V0Wm9vbUxldmVsKCk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZ2V0Wm9vbUxldmVsKCkudGhlbih6b29tTGV2ZWwgPT4gY29uc29sZS5sb2coem9vbUxldmVsKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luKCkge1xuICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcbiAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldFpvb21MZXZlbC5odG1sJyxcbiAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG4gICAgICogICAgIH0pO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFpvb21MZXZlbCgpIHtcbiAgICAgKiAgICAgY29uc3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vbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5nZXRDdXJyZW50KCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCB2aWV3LnNldFpvb21MZXZlbChudW1iZXIpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIHNldFpvb21MZXZlbCg0KS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdTZXR0aW5nIGEgIHpvb20gbGV2ZWwnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luKCkge1xuICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcbiAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG4gICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LnNldFpvb21MZXZlbC5odG1sJyxcbiAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG4gICAgICogICAgIH0pO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIHNldFpvb21MZXZlbChudW1iZXIpIHtcbiAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgY3JlYXRlV2luKCk7XG4gICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uc2V0Wm9vbUxldmVsKG51bWJlcik7XG4gICAgICogfVxuICAgICAqXG4gICAgICogc2V0Wm9vbUxldmVsKDQpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1NldHRpbmcgYSAgem9vbSBsZXZlbCcpKS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TtcbiAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG4gICAgICogICAgICAgICBuYW1lOiAndmlld05hbWUnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcbiAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cbiAgICAgKiAgICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogY3JlYXRlVmlldygpXG4gICAgICogICAgIC50aGVuKHZpZXcgPT4gdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9leGFtcGxlLmNvbScpKVxuICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnbmF2aWdhdGlvbiBjb21wbGV0ZScpKVxuICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogYXN5bmMgZnVuY3Rpb24gbmF2aWdhdGUoKSB7XG4gICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm5hdmlnYXRlKCdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93Lm5hdmlnYXRlLmh0bWwnKTtcbiAgICAgKiB9XG4gICAgICogbmF2aWdhdGUoKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdOYXZpZ2F0ZSB0byB0dXRvcmlhbCcpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICogQGV4cGVyaW1lbnRhbFxuICAgICAqIEByZW1hcmtzXG4gICAgICogYFdlYkNvbnRlbnRzYCByZWZl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MgZm9yIHRoaXMgZnVuY3Rpb25hbGl0eSwgYnV0IGl0IGRvZXMgaGF2ZSBpdHMgb3duXG4gICAgICoge0BsaW5rIE9wZW5GaW4uV2ViQ29udGVudHNFdmVudHMgZXZlbnQgbmFtZXNwYWNlfS5cbiAgICAgKi9cbiAgICBzdG9wRmluZEluUGFnZShhY3Rpb24pIHtcbiAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzdG9wLWZpbmQtaW4tcGFnZScsIHsgLi4udGhpcy5pZGVudGl0eSwgYWN0aW9uIH0pLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhbiBhcnJheSB3aXRoIGFsbCBzeXN0ZW0gcHJpbnRlcnNcbiAgICAgKiBAZGVwcmVjYXRlZCB1c2UgU3lzdGVtLmdldFByaW50ZXJzIGluc3RlYWRcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogVmlldzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogdmlldy5nZXRQcmludGVycygpXG4gICAgICogICAgIC50aGVuKChwcmludGVycykgPT4ge1xuICAgICAqICAgICAgICAgcHJpbnRlcnMuZm9yRWFjaCgocHJpbnRlcikgPT4ge1xuICAgICAqICAgICAgICAgICAgIGlmIChwcmludGVyLmlzRGVmYXVsdCkge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcmludGVyKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfSlcbiAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICogICAgIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd2luID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqXG4gICAgICogd2luLmdldFByaW50ZXJzKClcbiAgICAgKiAgICAgLnRoZW4oKHByaW50ZXJzKSA9PiB7XG4gICAgICogICAgICAgICBwcmludGVycy5mb3JFYWNoKChwcmludGVyKSA9PiB7XG4gICAgICogICAgICAgICAgICAgaWYgKHByaW50ZXIuaXNEZWZhdWx0KSB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByaW50ZXIpO1xuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH0pO1xuICAgICAqICAgICB9KVxuICAgICAqICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgKiAgICAgfSk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaGFyZWQgZnVuY3Rpb25hbGl0eSBiZXR3ZWVuIHtAbGluayBPcGVuRmluLldpbmRvd30gYW5kIHtAbGluayBPcGVuRmluLlZpZXd9LlxuICAgICAqIFdlIGRvIG5vdCBleHBvc2UgYW4gZXhwbGljaXQgc3VwZXJjbGFzcyBmb3IgdGhpcyBmdW5jdGlvbmFsaXR5LCBidXQgaXQgZG9lcyBoYXZlIGl0cyBvd25cbiAgICAgKiB7QGxpbmsgT3BlbkZpbi5XZWJDb250ZW50c0V2ZW50cyBldmVudCBuYW1lc3BhY2V9LlxuICAgICAqL1xuICAgIGdldFByaW50ZXJzKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1wcmludGVycycsIHsgLi4udGhpcy5pZGVudGl0eSB9KS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogR2l2ZXMg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gICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIFZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmNyZWF0ZSh7XG4gICAgICogICAgICAgICBuYW1lOiAndmlld05hbWUnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiBmaW4ubWUuaWRlbnRpdHksXG4gICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHA6Ly9tZG4uZ2l0aHViLmlvL3NpbXBsZS1zaGFyZWQtd29ya2VyL2luZGV4Mi5odG1sJyk7XG4gICAgICpcbiAgICAgKiAgICAgY29uc3Qgc2hhcmVkV29ya2VycyA9IGF3YWl0IHZpZXcuZ2V0U2hhcmVkV29ya2VycygpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIGNvbnN0IHdpbk9wdGlvbiA9IHtcbiAgICAgKiAgICAgICAgIG5hbWU6J2NoaWxkJyxcbiAgICAgKiAgICAgICAgIGRlZmF1bHRXaWR0aDogMzAwLFxuICAgICAqICAgICAgICAgZGVmYXVsdEhlaWdodDogMzAwLFxuICAgICAqICAgICAgICAgdXJsOiAnaHR0cDovL21kbi5naXRodWIuaW8vc2ltcGxlLXNoYXJlZC13b3JrZXIvaW5kZXgyLmh0bWwnLFxuICAgICAqICAgICAgICAgZnJhbWU6IHRydWUsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuICAgICAqICAgICB9O1xuICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBmaW4uV2luZG93LmNyZWF0ZSh3aW5PcHRpb24pO1xuICAgICAqICAgICBjb25zdCBzaGFyZWRXb3JrZXJ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c2VcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgdXJsOiAnPG15X3BvcHVwX3VybD4nLFxuICAgICAqICAgICByZXN1bHREaXNwYXRjaEJlaGF2aW9yOiAnbm9uZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwLFxuICAgICAqICAgICBvblBvcHVwUmVzdWx0OiBwb3B1cFJlc3VsdENhbGxiYWNrXG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBTYW1lIGFzIGFib3ZlIGJ1dCB1c2luZyBhbiBleGlzdGluZyB3aW5kb3cgYXMgYSBwb3B1cDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcG9wdXBSZXN1bHRDYWxsYmFjayA9IChwYXlsb2FkKSA9PiB7XG4gICAgICogICAgICAgIGlmIChwYXlsb2FkLnJlc3VsdCA9PT0gJ2NsaWNrZWQnKSB7XG4gICAgICogICAgICAgICAgICBpZiAocGF5bG9hZC5kYXRhLnRvcGljID09PSAnY29sb3ItY2hhbmdlZCcpIHtcbiAgICAgKiAgICAgICAgICAgICAgICAvLyBkbyBzb21ldGhpbmcgbGlrZVxuICAgICAqICAgICAgICAgICAgICAgIC8vIHNldENvbG9yKHBheWxvYWQuZGF0YS52YWx1ZSk7XG4gICAgICogICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiB9O1xuICAgICAqXG4gICAgICogYXdhaXQgZmluLm1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGluaXRpYWxPcHRpb25zOiB7XG4gICAgICogICAgICAgICBmcmFtZTogZmFsc2VcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgbmFtZTogJ215LXBvcHVwJ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ogICAgIGJsdXJCZWhhdmlvcjogJ21vZGFsJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwXG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBQYXNzIGRhdGEgdG8gYSBwb3B1cCB3aW5kb3cgdGhhdCBpcyBhdmFpbGFibGUgd2hlbiB0aGUgcG9wdXAgaXMgc2hvd24uXG4gICAgICpcbiAgICAgKiBOb3RlOiB0aGlzIGlzIGp1c3Qgb25lIGV4YW1wbGUgZm9yIGEgdXNlIG9mIGBhZGRpdGlvbmFsT3B0aW9uc2AsIGl0IGNhbiBiZSB1c2VkIHRvIHVwZGF0ZSBhbnkgdXBkYXRhYmxlXG4gICAgICogd2luZG93IG9wdGlvbnMgd2hlbiBjcmVhdGluZyBvciBzaG93aW5nIGFuIGV4aXN0aW5nIHdpbmRvdyBhcyBhIHBvcHVwLlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCByZXN1bHQgPSBhd2FpdCBmaW4ubWUuc2hvd1BvcHVwV2luZG93KHtcbiAgICAgKiAgICAgYWRkaXRpb25hbE9wdGlvbnM6IHtcbiAgICAgKiAgICAgICAgIGN1c3RvbURhdGE6IHtcbiAgICAgKiAgICAgICAgICAgICBmb286ICdiYXInXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0sXG4gICAgICogICAgIHVybDogJzxteV9wb3B1cF91cmw+JyxcbiAgICAgKiAgICAgcmVzdWx0RGlzcGF0Y2hCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgYmx1ckJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqICAgICBmb2N1czogdHJ1ZSxcbiAgICAgKiAgICAgaGVpZ2h0OiAzMDAsXG4gICAgICogICAgIHdpZHRoOiAzMDAsXG4gICAgICogICAgIHg6IDAsXG4gICAgICogICAgIHk6IDBcbiAgICAgKiB9KTtcbiAgICAgKlxuICAgICAqIC8vIEFjY2VzcyBmcm9tIHRoZSBwb3B1cCB3aW5kb3cgY29udGV4dCBsaWtlIHNvOlxuICAgICAqIGNvbnN0IHsgY3VzdG9tRGF0YSB9ID0gYXdhaXQgZmluLm1lLmdldE9wdGlvbnMoKTtcbiAgICAgKiBjb25zdCB7IGZvbyB9ID0gY3VzdG9tRGF0YTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIEV4ZWN1dGUgYSBjYWxsYmFjayBvbiB0aGUgcG9wdXAncyBPcGVuRmluIHdpbmRvdyB3aGVuIHRoZSBwb3B1cCBpcyBzaG93bjpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcG9wdXBXaW5kb3dDYWxsYmFjayA9IGFzeW5jICh3aW4pID0+IHtcbiAgICAgKiAgICAgYXdhaXQgd2luLmZsYXNoKCk7XG4gICAgICogfTtcbiAgICAgKlxuICAgICAqIGNvbnN0IHJlc3VsdCA9IGF3YWl0IGZpbi5tZS5zaG93UG9wdXBXaW5kb3coe1xuICAgICAqICAgICB1cmw6ICc8bXlfcG9wdXBfdXJsPicsXG4gICAgICogICAgIHJlc3VsdERpc3BhdGNoQmVoYXZpb3I6ICdjbG9zZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwLFxuICAgICAqICAgICBvblBvcHVwUmVhZHk6IHBvcHVwV2luZG93Q2FsbGJhY2s7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaGFyZWQgZnVuY3Rpb25hbGl0eSBiZXR3ZWVuIHtAbGluayBPcGVuRmluLldpbmRvd30gYW5kIHtAbGluayBPcGVuRmluLlZpZXd9LlxuICAgICAqIFdlIGRvIG5vdCBleHBvc2UgYW4gZXhwbGljaXQgc3VwZXJjbGFzcyBmb3IgdGhpcyBmdW5jdGlvbmFsaXR5LCBidXQgaXQgZG9lcyBoYXZlIGl0cyBvd25cbiAgICAgKiB7QGxpbmsgT3BlbkZpbi5XZWJDb250ZW50c0V2ZW50cyBldmVudCBuYW1lc3BhY2V9LlxuICAgICAqL1xuICAgIGFzeW5jIHNob3dQb3B1cFdpbmRvdyhvcHRpb25zKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKGAke3RoaXMuZW50aXR5VHlwZX0tc2hvdy1wb3B1cC13aW5kb3dgLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoKSA9PiB7XG4gICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcbiAgICAgICAgfSk7XG4gICAgICAgIGlmIChvcHRpb25zPy5vblBvcHVwUmVhZHkpIHtcbiAgICAgICAgICAgIGNvbnN0IHJlYWR5TGlzdGVuZXIgPSBhc3luYyAoeyBwb3B1cE5hbWUgfSkgPT4ge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHBvcHVwV2luZG93ID0gdGhpcy5maW4uV2luZG93LndyYXBTeW5jKHsgdXVpZDogdGhpcy5maW4ubWUudXVpZCwgbmFtZTogcG9wdXBOYW1lIH0pO1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCBvcHRpb25zLm9uUG9wdXBSZWFkeShwb3B1cFdpbmRvdyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB0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dyB3aXRoIG5vbiBjcm9zcy1vcmlnaW4gdXJsIGlzIG5vdCB3b3JraW5nKGNvcmUtMTA3NikuXG4gICAgICAgICAgICBhd2FpdCB0aGlzLmZpbi5XaW5kb3cuY3JlYXRlKHBvcHVwT3B0aW9ucy5pbml0aWFsT3B0aW9ucyk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3Qgbm9ybWFsaXplUG9wdXBSZXN1bHQgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyBuYW1lLCB1dWlkLCByZXN1bHQsIGRhdGEgfSA9IHBheWxvYWQ7XG4gICAgICAgICAgICBjb25zdCBwb3B1cFJlc3VsdCA9IHtcbiAgICAgICAgICAgICAgICBpZGVudGl0eToge1xuICAgICAgICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICAgICAgICB1dWlkXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICByZXN1bHRcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoZGF0YSkge1xuICAgICAgICAgICAgICAgIHBvcHVwUmVzdWx0LmRhdGEgPSBkYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHBvcHVwUmVzdWx0O1xuICAgICAgICB9O1xuICAgICAgICBpZiAob3B0aW9ucz8ub25Qb3B1cFJlc3VsdCkge1xuICAgICAgICAgICAgY29uc3QgZGlzcGF0Y2hSZXN1bHRMaXN0ZW5lciA9IGFzeW5jIChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgYXdhaXQgb3B0aW9ucy5vblBvcHVwUmVzdWx0KG5vcm1hbGl6ZVBvcHVwUmVzdWx0KHBheWxvYWQpKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCB0ZWFyZG93bkxpc3RlbmVyID0gYXN5bmMgKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIFRPRE86IGZpeCB0eXBpbmcgKGludGVybmFsKVxuICAgICA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5kb3csIGFuZCBzZXRzIHRoZSB2aWV3IHRvIGJlIGRlc3Ryb3llZCB3aGVuIGl0cyBuZXcgd2luZG93IGNsb3Nlcy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZUF0dGFjaCcsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBhdHRhY2hWaWV3KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGNvbnN0IHdpbk9wdGlvbiA9IHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6J3dpbk9wdGlvbk5hbWUnLFxuXHQgICAgICAgICAqICAgICAgICAgZGVmYXVsdFdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICBkZWZhdWx0SGVpZ2h0OiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmNyZWF0ZS5odG1sJyxcblx0ICAgICAgICAgKiAgICAgICAgIGZyYW1lOiB0cnVlLFxuXHQgICAgICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAgICAgKiAgICAgfTtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbmV3V2luZG93ID0gYXdhaXQgZmluLldpbmRvdy5jcmVhdGUod2luT3B0aW9uKTtcblx0ICAgICAgICAgKiAgICAgdmlldy5hdHRhY2gobmV3V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhdHRhY2hWaWV3KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgYXR0YWNoZWQgdG8gbmV3IHdpbmRvdy4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5hdHRhY2ggPSBhc3luYyAodGFyZ2V0KSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdhdHRhY2gtdmlldycsIHsgdGFyZ2V0LCAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogRGVzdHJveXMgdGhlIGN1cnJlbnQgdmlld1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGNvbnN0IHZpZXcgPSBmaW4uVmlldy53cmFwU3luYyh7IHV1aWQ6ICd2aWV3VXVpZCcsIG5hbWU6ICd2aWV3TmFtZScgfSk7XG5cdCAgICAgICAgICogdmlldy5kZXN0cm95KCk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZGVzdHJveSA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2Rlc3Ryb3ktdmlldycsIHsgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFNob3dzIHRoZSBjdXJyZW50IHZpZXcgaWYgaXQgaXMgY3VycmVudGx5IGhpZGRlbi5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZVNob3cnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gaGlkZUFuZFNob3dWaWV3KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsIG9wdGlvbi4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LmhpZGUoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coXCJWaWV3IGhpZGRlbi5cIik7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmlldy5zaG93KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKFwiVmlldyBzaG93bi5cIik7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogaGlkZUFuZFNob3dWaWV3KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgaGlkZGVuIGFuZCBzaG93bi4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5zaG93ID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvb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AgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBzaG93Vmlld0F0KCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcuc2hvd0F0KHtcblx0ICAgICAgICAgKiAgICAgICAgIHRvcDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgbGVmdDogMTAwLFxuXHQgICAgICAgICAqICAgICAgICAgd2lkdGg6IDMwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGhlaWdodDogMzAwXG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIHNob3dWaWV3QXQoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnVmlldyBzZXQgdG8gbmV3IGJvdW5kcyBhbmQgc2hvd24uJykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuc2hvd0F0ID0gYXN5bmMgKGJvdW5kcykgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc2hvdy12aWV3LWF0JywgeyBib3VuZHMsIC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBIaWRlcyB0aGUgY3VycmVudCB2aWV3IGlmIGl0IGlzIGN1cnJlbnRseSB2aXNpYmxlLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lSGlkZScsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBoaWRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LmhpZGUoKTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBoaWRlVmlldygpXG5cdCAgICAgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdWaWV3IGhpZGRlbi4nKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5oaWRlID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignaGlkZS12aWV3JywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogU2V0cyB0aGUgYm91bmRzICh0b3AsIGxlZnQsIHdpZHRoLCBoZWlnaHQpIG9mIHRoZSB2aWV3IHJlbGF0aXZlIHRvIGl0cyB3aW5kb3cuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmVtYXJrcyBWaWV3IHBvc2l0aW9uIGlzIHJlbGF0aXZlIHRvIHRoZSBib3VuZHMgb2YgdGhlIHdpbmRvdy5cblx0ICAgICAgICAgKiAoe3RvcDogMCwgbGVmdDogMH0gcmVwcmVzZW50cyB0aGUgdG9wIGxlZnQgY29ybmVyIG9mIHRoZSB3aW5kb3cpXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVTZXRCb3VuZHMnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gc2V0Vmlld0JvdW5kcygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LnNldEJvdW5kcyh7XG5cdCAgICAgICAgICogICAgICAgICB0b3A6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGxlZnQ6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIHdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICBoZWlnaHQ6IDMwMFxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9X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WUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiB9KTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXdhaXQgdmlldy5zZXRCb3VuZHMoe1xuXHQgICAgICAgICAqICAgICB0b3A6IDEwMCxcblx0ICAgICAgICAgKiAgICAgbGVmdDogMTAwLFxuXHQgICAgICAgICAqICAgICB3aWR0aDogMzAwLFxuXHQgICAgICAgICAqICAgICBoZWlnaHQ6IDMwMFxuXHQgICAgICAgICAqIH0pO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogY29uc29sZS5sb2coYXdhaXQgdmlldy5nZXRCb3VuZHMoKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0Qm91bmRzID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCBhY2sgPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXZpZXctYm91bmRzJywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICByZXR1cm4gYWNrLnBheWxvYWQuZGF0YTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEdldHMgdGhlIFZpZXcncyBpbmZvLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lR2V0SW5mbycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRWaWV3SW5mbygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICByZXR1cm4gdmlldy5nZXRJbmZvKCk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogZ2V0Vmlld0luZm8oKVxuXHQgICAgICAgICAqICAgICAudGhlbigoaW5mbykgPT4gY29uc29sZS5sb2coJ1ZpZXcgaW5mbyBmZXRjaGVkLicsIGluZm8pKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmdldEluZm8gPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIGNvbnN0IGFjayA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtdmlldy1pbmZvJywgeyAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICByZXR1cm4gYWNrLnBheWxvYWQuZGF0YTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIFJldHJpZXZlcyB0aGUgbGF5b3V0IGZvciB0aGUgd2luZG93IHRoZSB2aWV3IGlzIGF0dGFjaGVkIHRvLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqICAgICAvL2dldCB0aGUgY3VycmVudCBWaWV3XG5cdCAgICAgICAgICogICAgIGNvbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgLy9nZXQgYSByZWZlcmVuY2UgdG8gdGhlIExheW91dCBmb3IgdGhlIFdpbmRvdyB0aGUgdmlldyBpcyBwYXJ0IG9mXG5cdCAgICAgICAgICogICAgIGNvbnN0IGxheW91dCA9IGF3YWl0IHZpZXcuZ2V0UGFyZW50TGF5b3V0KCk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0UGFyZW50TGF5b3V0ID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1nZXQtcGFyZW50LWxheW91dCcsIHsgLi4udGhpcy5pZGVudGl0eSB9KS5jYXRjaCgoKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAvLyBkb24ndCBleHBvc2Vcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGNvbnN0IGxheW91dFdpbmRvdyA9IGF3YWl0IHRoaXMuZ2V0Q3VycmVudFdpbmRvdygpO1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvdmlkZXJDaGFubmVsQ2xpZW50ID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCh0aGlzLCBfVmlld19wcm92aWRlckNoYW5uZWxDbGllbnQsIFwiZlwiKS5nZXRWYWx1ZSgpO1xuXHQgICAgICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgbGF5b3V0X2VudGl0aWVzXzEuTGF5b3V0Tm9kZS5uZXdMYXlvdXRFbnRpdGllc0NsaWVudChwcm92aWRlckNoYW5uZWxDbGllbnQsIGxheW91dF9jb25zdGFudHNfMS5MQVlPVVRfQ09OVFJPTExFUl9JRCwgbGF5b3V0V2luZG93LmlkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGxheW91dElkZW50aXR5ID0gYXdhaXQgY2xpZW50LmdldExheW91dElkZW50aXR5Rm9yVmlld09yVGhyb3codGhpcy5pZGVudGl0eSk7XG5cdCAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maW4uUGxhdGZvcm0uTGF5b3V0LndyYXAobGF5b3V0SWRlbnRpdHkpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBhbGxvd2VkRXJyb3JzID0gW1xuXHQgICAgICAgICAgICAgICAgICAgICdObyBhY3Rpb24gcmVnaXN0ZXJlZCBhdCB0YXJnZXQgZm9yJyxcblx0ICAgICAgICAgICAgICAgICAgICAnZ2V0TGF5b3V0SWRlbnRpdHlGb3JWaWV3T3JUaHJvdyBpcyBub3QgYSBmdW5jdGlvbidcblx0ICAgICAgICAgICAgICAgIF07XG5cdCAgICAgICAgICAgICAgICBpZiAoIWFsbG93ZWRFcnJvcnMuc29tZSgobSkgPT4gZS5tZXNzYWdlLmluY2x1ZGVzKG0pKSkge1xuXHQgICAgICAgICAgICAgICAgICAgIHRocm93IGU7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAvLyBmYWxsYmFjayBsb2dpYyBmb3IgbWlzc2luZyBlbmRwb2ludFxuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmluLlBsYXRmb3JtLkxheW91dC53cmFwKGxheW91dFdpbmRvdy5pZGVudGl0eSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEdldHMgdGhlIFZpZXcncyBvcHRpb25zLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKiBgYGBqc1xuXHQgICAgICAgICAqIGxldCB2aWV3O1xuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIGNvbnN0IG1lID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgICAgICogICAgIHJldHVybiBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lR2V0T3B0aW9ucycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBnZXRWaWV3T3B0aW9ucygpIHtcblx0ICAgICAgICAgKi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WQuZGF0YSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBVcGRhdGVzIHRoZSB2aWV3J3Mgb3B0aW9ucy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vZ29vZ2xlLmNvbScsXG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVVcGRhdGVPcHRpb25zJyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIHVwZGF0ZVZpZXdPcHRpb25zKCkge1xuXHQgICAgICAgICAqICAgICB2aWV3ID0gYXdhaXQgY3JlYXRlVmlldygpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBjcmVhdGVkLicpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHBzOi8vZ29vZ2xlLmNvbScpO1xuXHQgICAgICAgICAqICAgICBjb25zb2xlLmxvZygnVmlldyBuYXZpZ2F0ZWQgdG8gZ2l2ZW4gdXJsIG9wdGlvbi4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBjb25zdCBuZXdPcHRpb25zID0geyBhdXRvUmVzaXplOiB7XG5cdCAgICAgICAgICogICAgICAgICB3aWR0aDogdHJ1ZSxcblx0ICAgICAgICAgKiAgICAgICAgIGhvcml6b250YWw6IHRydWVcblx0ICAgICAgICAgKiAgICAgfX07XG5cdCAgICAgICAgICogICAgIHJldHVybiB2aWV3LnVwZGF0ZU9wdGlvbnMobmV3T3B0aW9ucyk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogdXBkYXRlVmlld09wdGlvbnMoKVxuXHQgICAgICAgICAqICAgICAudGhlbihwYXlsb2FkID0+IGNvbnNvbGUubG9nKCdWaWV3IG9wdGlvbnMgdXBkYXRlZDogJywgcGF5bG9hZCkpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMudXBkYXRlT3B0aW9ucyA9IGFzeW5jIChvcHRpb25zKSA9PiB7XG5cdCAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigndXBkYXRlLXZpZXctb3B0aW9ucycsIHsgb3B0aW9ucywgLi4udGhpcy5pZGVudGl0eSB9KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBSZXRyaWV2ZXMgdGhlIHdpbmRvdyB0aGUgdmlldyBpcyBjdXJyZW50bHkgYXR0YWNoZWQgdG8uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogY29uc3QgdmlldyA9IGZpbi5WaWV3LndyYXBTeW5j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jb25uZWN0IHRoZSBlbGVtZW50IHJlc2l6ZSBvYnNlcnZlci5cblx0ICAgICAgICAgKiBAaW50ZXJuYWxcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICogQHJlbWFya3MgVmlldyB3aWxsIHJlc2l6ZSBhY2NvcmRpbmdseSB3aGVuIHRoZSBlbGVtZW50IGlzIHJlc2l6ZWQuIElmIHRoZSBlbGVtZW50IGlzIHJlcG9zaXRpb25lZCBpbiB0aGUgRE9NIHRoZSB2aWV3IHdpbGwgbm90IGJlIHJlcG9zaXRpb25lZCwgdG8gaGFuZGxlIHRoaXMgY2FzZSBjYWxsIGBiaW5kVG9FbGVtZW50YCBhZ2FpbiBvbmNlIHRoZSBlbGVtZW50IGNoYW5nZXMgcG9zaXRpb24uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGh0bWxcblx0ICAgICAgICAgKiA8ZGl2IGlkPVwidmlldy1jb250YWluZXJcIj48L2Rpdj5cblx0ICAgICAgICAgKiA8c2NyaXB0PlxuXHQgICAgICAgICAqICAgICBhc3luYyBmdW5jdGlvbiBjcmVhdGVBbmRBdHRhY2hWaWV3KCkge1xuXHQgICAgICAgICAqICAgICAgICAgY29uc3QgdXJsID0gJ2h0dHBzOi8vZXhhbXBsZS5jb20nO1xuXHQgICAgICAgICAqICAgICAgICAgY29uc3QgZWxlbWVudElkID0gJ3ZpZXctY29udGFpbmVyJztcblx0ICAgICAgICAgKiAgICAgICAgIGNvbnN0IGVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChlbGVtZW50SWQpO1xuXHQgICAgICAgICAqICAgICAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICAgICAgbmFtZTogJ215LXZpZXcnLFxuXHQgICAgICAgICAqICAgICAgICAgICAgIHVybCxcblx0ICAgICAgICAgKiAgICAgICAgICAgICB0YXJnZXQ6IGZpbi5tZS5pZGVudGl0eVxuXHQgICAgICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgICAgICogICAgICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKHVybCk7XG5cdCAgICAgICAgICogICAgICAgICBhd2FpdCB2aWV3LmJpbmRUb0VsZW1lbnQoZWxlbWVudCk7XG5cdCAgICAgICAgICogICAgIH1cblx0ICAgICAgICAgKiAgICAgY3JlYXRlQW5kQXR0YWNoVmlldygpLmNhdGNoKGNvbnNvbGUuZXJyb3IpO1xuXHQgICAgICAgICAqIDwvc2NyaXB0PlxuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuYmluZFRvRWxlbWVudCA9IGFzeW5jIChlbGVtZW50KSA9PiB7XG5cdCAgICAgICAgICAgIGlmICghZWxlbWVudCkge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdFbGVtZW50IG5vdCBmb3VuZC4nKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjb25zdCBvbkNoYW5nZSA9IGFzeW5jIChib3VuZHMpID0+IHRoaXMuc2V0Qm91bmRzKGJvdW5kcyk7XG5cdCAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuZW52aXJvbm1lbnQub2JzZXJ2ZUJvdW5kcyhlbGVtZW50LCBvbkNoYW5nZSk7XG5cdCAgICAgICAgfTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogRm9jdXNlcyB0aGUgdmlld1xuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogY29uc3QgdmlldyA9IGZpbi5WaWV3LndyYXBTeW5jKHsgdXVpZDogJ3ZpZXdVdWlkJywgbmFtZTogJ3ZpZXdOYW1lJyB9KTtcblx0ICAgICAqIGF3YWl0IHZpZXcuZm9jdXMoKTtcblx0ICAgICA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0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFBhcmVudFV1aWQoKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBnZXRQYXJlbnRVdWlkKCkudGhlbihwYXJlbnRVdWlkID0+IGNvbnNvbGUubG9nKHBhcmVudFV1aWQpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgZ2V0UGFyZW50VXVpZCgpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1wYXJlbnQtYXBwbGljYXRpb24nLCB0aGlzLmlkZW50aXR5KS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogUmV0cmlldmVzIGN1cnJlbnQgYXBwbGljYXRpb24ncyBzaG9ydGN1dCBjb25maWd1cmF0aW9uLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKlxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFNob3J0Y3V0cygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24ud3JhcCh7IHV1aWQ6ICd0ZXN0YXBwJyB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFNob3J0Y3V0cygpO1xuXHQgICAgICogfVxuXHQgICAgICogZ2V0U2hvcnRjdXRzKCkudGhlbihjb25maWcgPT4gY29uc29sZS5sb2coY29uZmlnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGdldFNob3J0Y3V0cygpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbm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ICAgKiAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgIC8vIGhhcyBubyBuYW1lIGFuZCBubyB0eXBlIHNvIGB0eXBlYCBpcyBhc3N1bWVkIHRvIGJlIFwidGFza3NcIlxuXHQgICAgICogICAgICAgICAgICAgaXRlbXM6IFsgLy8gYXJyYXkgb2YgSnVtcExpc3QgaXRlbXNcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6IGBMYXVuY2ggJHthcHBOYW1lfWAsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246IGBSdW5zICR7YXBwTmFtZX0gd2l0aCB0aGUgZGVmYXVsdCBjb25maWd1cmF0aW9uYCxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZWVwTGluazogJ2ZpbnM6Ly9wYXRoLnRvL2FwcC9tYW5pZmVzdC5qc29uJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uUGF0aDogJ2h0dHBzOi8vcGF0aC50by9hcHAvaWNvbi5pY28nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25JbmRleDogMFxuXHQgICAgICogICAgICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgICAgIHsgdHlwZTogJ3NlcGFyYXRvcicgfSxcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6IGBSZXN0b3JlICR7YXBwTmFtZX1gLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiAnUmVzdG9yZSB0byBsYXN0IGNvbmZpZ3VyYXRpb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vYXBwL21hbmlmZXN0Lmpzb24/JCR1c2UtbGFzdC1jb25maWd1cmF0aW9uPXRydWUnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL2FwcC9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9LFxuXHQgICAgICogICAgICAgICAgICAgXVxuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBuYW1lOiAnVG9vbHMnLFxuXHQgICAgICogICAgICAgICAgICAgaXRlbXM6IFsgLy8gYXJyYXkgb2YgSnVtcExpc3QgaXRlbXNcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6ICdUb29sIEEnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiAnUnVucyBUb29sIEEnLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vdG9vbC1hL21hbmlmZXN0Lmpzb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL3Rvb2wtYS9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9LFxuXHQgICAgICogICAgICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICd0YXNrJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICB0aXRsZTogJ1Rvb2wgQicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246ICdSdW5zIFRvb2wgQicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgZGVlcExpbms6ICdmaW5zOi8vcGF0aC50by90b29sLWIvbWFuaWZlc3QuanNvbicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvblBhdGg6ICdodHRwczovL3BhdGgudG8vdG9vbC1iL2ljb24uaWNvJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uSW5kZXg6IDBcblx0ICAgICAqICAgICAgICAgICAgIH1dXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICBdO1xuXHQgICAgICpcblx0ICAgICAqICAgICBhcHAuc2V0SnVtcExpc3QoanVtcExpc3RDb25maWcpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ0p1bXBMaXN0IGFwcGxpZWQnKSkuY2F0Y2goZSA9PiBjb25zb2xlLmxvZyhgSnVtcExpc3QgZmFpbGVkIHRvIGFwcGx5OiAke2UudG9TdHJpbmcoKX1gKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqXG5cdCAgICAgKiBUbyBoYW5kbGUgZGVlcGxpbmsgYXJnczpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAgICAgZnVuY3Rpb24gaGFuZGxlVXNlTGFzdENvbmZpZ3VyYXRpb24oKSB7XG5cdCAgICAgKiAgICAgICAgIC8vIHRoaXMgaGFuZGxlciBpcyBjYWxsZWQgd2hlbiB0aGUgYXBwIGlzIGJlaW5nIGxhdW5jaGVkXG5cdCAgICAgKiAgICAgICAgIGFwcC5vbigncnVuLXJlcXVlc3RlZCcsIGV2ZW50ID0+IHtcblx0ICAgICAqICAgICAgICAgICAgIGlmKGV2ZW50LnVzZXJBcHBDb25maWdBcmdzWyd1c2UtbGFzdC1jb25maWd1cmF0aW9uJ10pIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAvLyB5b3VyIGxvZ2ljIGhlcmVcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgIC8vIHRoaXMgaGFuZGxlciBpcyBjYWxsZWQgd2hl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GUgYXBwbGljYXRpb24gbGlzdC4nKTtcblx0ICAgICAqICAgICB9KVxuXHQgICAgICogICAgIC5jYXRjaCgoZXJyKSA9PiB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG5cdCAgICAgKiAgICAgfSlcblx0ICAgICAqIGBgYFxuXHQgICAgICpcblx0ICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgc3RhcnRNYW55TWFuaWZlc3RzKGFwcGxpY2F0aW9ucywgb3B0cykge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigncnVuLWFwcGxpY2F0aW9ucycsIHsgYXBwbGljYXRpb25zLCBvcHRzIH0pLnRoZW4oKCkgPT4gdW5kZWZpbmVkKTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogQXN5bmNocm9ub3VzbHkgcmV0dXJucyBhbiBBcHBsaWNhdGlvbiBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50IGFwcGxpY2F0aW9uXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gaXNDdXJyZW50QXBwUnVubmluZyAoKSB7XG5cdCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLmdldEN1cnJlbnQoKTtcblx0ICAgICAqICAgICByZXR1cm4gYXBwLmlzUnVubmluZygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGlzQ3VycmVudEFwcFJ1bm5pbmcoKS50aGVuKHJ1bm5pbmcgPT4ge1xuXHQgICAgICogICAgIGNvbnNvbGUubG9nKGBDdXJyZW50IGFwcCBpcyBydW5uaW5nOiAke3J1bm5pbmd9YCk7XG5cdCAgICAgKiB9KS5jYXRjaChlcnIgPT4ge1xuXHQgICAgICogICAgIGNv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H0gPSByZXNwb25zZURhdGE7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKHN1Y2Nlc3MpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY2JQYXlsb2FkID0ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHR0cFJlc3BvbnNlQ29kZTogcmVzcG9uc2VEYXRhLmh0dHBSZXNwb25zZUNvZGUsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlJbmplY3RlZDogcmVzcG9uc2VEYXRhLmFwaUluamVjdGVkXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBjYlBheWxvYWQgPSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiByZXNwb25zZURhdGEubWVzc2FnZSxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldHdvcmtFcnJvckNvZGU6IHJlc3BvbnNlRGF0YS5uZXR3b3JrRXJyb3JDb2RlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2s6IHJlc3BvbnNlRGF0YS5zdGFja1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUxpc3RlbmVyKENPTlNUUlVDVE9SX0NCX1RPUElDLCBmaXJlQ29uc3RydWN0b3IpO1xuXHQgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoe1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICBjYlBheWxvYWQsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3Ncblx0ICAgICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgLy8gc2V0IGRlZmF1bHRzOlxuXHQgICAgICAgICAgICBpZiAob3B0aW9ucy53YWl0Rm9yUGFnZUxvYWQgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgb3B0aW9ucy53YWl0Rm9yUGFnZUxvYWQgPSBmYWxzZTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBpZiAob3B0aW9ucy5hdXRvU2hvdyA9PT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICBvcHRpb25zLmF1dG9TaG93ID0gdHJ1ZTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAoMCwgd2FybmluZ3NfMS5oYW5kbGVEZXByZWNhdGVkV2FybmluZ3MpKG9wdGlvbnMpO1xuXHQgICAgICAgICAgICBjb25zdCB3aW5kb3dDcmVhdGlvbiA9IHRoaXMud2lyZS5lbnZpcm9ubWVudC5jcmVhdGVDaGlsZENvbnRlbnQoeyBlbnRpdHlUeXBlOiAnd2luZG93Jywgb3B0aW9ucyB9KTtcblx0ICAgICAgICAgICAgUHJvbWlzZS5hbGwoW3BhZ2VSZXNwb25zZSwgd2luZG93Q3JlYXRpb25dKVxuXHQgICAgICAgICAgICAgICAgLnRoZW4oKHJlc29sdmVkQXJyKSA9PiB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBwYWdlUmVzb2x2ZSA9IHJlc29sdmVkQXJyWzBdO1xuXHQgICAgICAgICAgICAgICAgaWYgKHBhZ2VSZXNvbHZlLnN1Y2Nlc3MpIHtcblx0ICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHRoaXMpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcmVqZWN0KHBhZ2VSZXNvbHZlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBpcyB0byBlbmZvcmNlIGEgNS4wIGNvbnRyYWN0IHRoYXQgdGhlIGNoaWxkJ3MgbWFpbiBmdW5jdGlvblxuXHQgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgbm90IGZpcmUgYmVmb3JlIHRoZSBwYXJlbnQncyBzdWNjZXNzIGNhbGxiYWNrIG9uIGNyZWF0aW9uLlxuXHQgICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBjaGlsZCB3aW5kb3cgaXMgbm90IGFjY2Vzc2libGUgKENPUlMpIHRoaXMgY29udHJhY3QgZG9lc1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIG5vdCBob2xkLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IHdlYldpbmRvdyA9IHRoaXMuZ2V0V2ViV2luZG93KCk7XG5cdCAgICAgICAgICAgICAgICAgICAgd2ViV2luZG93LmZpbi5fX2ludGVybmFsXy5vcGVuZXJTdWNjZXNzQ0JDYWxsZWQoKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gY29tbW9uIGZvciBtYWluIHdpbmRvd3MsIHdlIGRvIG5vdCB3YW50IHRvIGV4cG9zZSB0aGlzIGVycm9yLiBoZXJlIGp1c3QgdG8gaGF2ZSBhIGRlYnVnIHRhcmdldC5cblx0ICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmVycm9yKGUpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KVxuXHQgICAgICAgICAgICAgICAgLmNhdGNoKHJlamVjdCk7XG5cdCAgICAgICAgfSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFJldHJpZXZlcyBhbiBhcnJheSBvZiBmcmFtZSBpbmZvIG9iamVjdHMgcmVwcmVzZW50aW5nIH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iBQZXJmb3JtcyB0aGUgc3BlY2lmaWVkIHdpbmRvdyB0cmFuc2l0aW9ucy5cblx0ICAgICAqIEBwYXJhbSB0cmFuc2l0aW9ucyAtIERlc2NyaWJlcyB0aGUgYW5pbWF0aW9ucyB0byBwZXJmb3JtLiBTZWUgdGhlIHR1dG9yaWFsLlxuXHQgICAgICogQHBhcmFtIG9wdGlvbnMgLSBPcHRpb25zIGZvciB0aGUgYW5pbWF0aW9uLiBTZWUgdGhlIHR1dG9yaWFsLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGFuaW1hdGVXaW5kb3coKSB7XG5cdCAgICAgKiAgICAgY29uc3QgdHJhbnNpdGlvbnMgPSB7XG5cdCAgICAgKiAgICAgICAgIG9wYWNpdHk6IHtcblx0ICAgICAqICAgICAgICAgICAgIG9wYWNpdHk6IDAuNyxcblx0ICAgICAqICAgICAgICAgICAgIGR1cmF0aW9uOiA1MDBcblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgcG9zaXRpb246IHtcblx0ICAgICAqICAgICAgICAgICAgIHRvcDogMTAwLFxuXHQgICAgICogICAgICAgICAgICAgbGVmdDogMTAwLFxuXHQgICAgICogICAgICAgICAgICAgZHVyYXRpb246IDUwMCxcblx0ICAgICAqICAgICAgICAgICAgIHJlbGF0aXZlOiB0cnVlXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICB9O1xuXHQgICAgICogICAgIGNvbnN0IG9wdGlvbnMgPSB7XG5cdCAgICAgKiAgICAgICAgIGludGVycnVwdDogdHJ1ZSxcblx0ICAgICAqICAgICAgICAgdHdlZW46ICdlYXNlLWluJ1xuXHQgICAgICogICAgIH07XG5cdCAgICAgKlxuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICogICAgIHJldHVybiB3aW4uYW5pbWF0ZSh0cmFuc2l0aW9ucywgb3B0aW9ucyk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogYW5pbWF0ZVdpbmRvdygpXG5cdCAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ0FuaW1hdGlvbiBkb25lJykpXG5cdCAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmVycm9yKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFuaW1hdGUodHJhbnNpdGlvbnMsIG9wdGlvbnMpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdhbmltYXRlLXdpbmRvdycsIHtcblx0ICAgICAgICAgICAgdHJhbnNpdGlvbnMsXG5cdCAgICAgICAgICAgIG9wdGlvbnMsXG5cdCAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHlcblx0ICAgICAgICB9KVxuXHQgICAgICAgICAgICAudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBIaWRlcyB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gaGlkZVdpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmhpZGUuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9T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ScsXG5cdCAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuc3RvcEZsYXNoaW5nLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLnN0b3BGbGFzaGluZygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIHN0b3BXaW5kb3dGbGFzaGluZygpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ0FwcGxpY2F0aW9uIHdpbmRvdyBmbGFzaGluZycpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgc3RvcEZsYXNoaW5nKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignc3RvcC1mbGFzaC13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIEdldHMgYW4gaW5mb3JtYXRpb24gb2JqZWN0IGZvciB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gZ2V0SW5mbygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldEluZm8uaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uZ2V0SW5mbygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGdldEluZm8oKS50aGVuKGluZm8gPT4gY29uc29sZS5sb2coaW5mbykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRJbmZvKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXdpbmRvdy1pbmZvJywgdGhpcy5pZGVudGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFJldHJpZXZlcyB0aGUgd2luZG93J3MgTGF5b3V0XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAgICAgLy9nZXQgdGhlIGN1cnJlbnQgd2luZG93XG5cdCAgICAgKiAgICAgY29uc3Qgd2luZG93ID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG5cdCAgICAgKlxuXHQgICAgICogICAgIC8vZ2V0IHRoZSBsYXlvdXQgZm9yIHRoZSB3aW5kb3dcblx0ICAgICAqICAgICBjb25zdCBsYXlvdXQgPSBhd2FpdCB3aW5kb3cuZ2V0TGF5b3V0KCk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAqL1xuXHQgICAgY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mFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5nZXRQYXJlbnRXaW5kb3cuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uZ2V0UGFyZW50V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogZ2V0UGFyZW50V2luZG93KCkudGhlbihwYXJlbnRXaW5kb3cgPT4gY29uc29sZS5sb2cocGFyZW50V2luZG93KSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGdldFBhcmVudFdpbmRvdygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignd2luZG93LWdldC1wYXJlbnQtd2luZG93JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShuZXcgYXBwbGljYXRpb25fMS5BcHBsaWNhdGlvbih0aGlzLndpcmUsIHRoaXMuaWRlbnRpdHkpKS50aGVuKChhcHApID0+IGFwcC5nZXRXaW5kb3coKSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICA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lhIGEgbGlicmFyeSAoaW4gdGhpcyBleGFtcGxlIHdlIGFyZSB1c2luZyB0aGUgW2xpdC1odG1sXShodHRwczovL2xpdC1odG1sLnBvbHltZXItcHJvamVjdC5vcmcvKVxuXHQgICAgICogdGVtcGxhdGUgbGlicmFyeSB0byByZW5kZXIgY29udGVudCBvbiBhIGJsYW5rIGNoaWxkIHdpbmRvdy4gWW91IGFyZSBub3QgZ29pbmcgdG8gYmUgYWJsZSB0byBjb3B5IHBhc3RlIHRoaXMgZXhhbXBsZSB3aXRob3V0XG5cdCAgICAgKiBjb25maWd1cmluZyB0aGUgcHJvamVjdCBjb3JyZWN0bHkgYnV0IHRoaXMgd291bGQgZGVtb25zdHJhdGUgc29tZSB0ZW1wbGF0aW5nIG9wdGlvbnMgYXZhaWxhYmxlKTpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAoYXN5bmMgKCk9PiB7XG5cdCAgICAgKiAgICAgdHJ5IHtcblx0ICAgICAqICAgICAgICAgY29uc3Qgd2luID0gYXdhaXQgZmluLldpbmRvdy5jcmVhdGUoe1xuXHQgICAgICogICAgICAgICAgICAgbmFtZTogYGNoaWxkLXdpbmRvdy0ke0RhdGUubm93KCl9YCxcblx0ICAgICAqICAgICAgICAgICAgIHVybDogJ2Fib3V0OmJsYW5rJ1xuXHQgICAgICogICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgY29uc3QgdGVtcGxhdGUgPSBodG1sYFxuXHQgICAgICogICAgICAgICAgICAgPGRpdj5cblx0ICAgICAqICAgICAgICAgICAgICAgICA8c3Bhbj5DbGljayBoZXJlOiA8L3NwYW4+XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgPGJ1dHRvbiBAY2xpY2s9JHsoKT0+IGNvbnNvbGUubG9nKCdIZWxsbyBXb3JsZCEnKX0+bG9nIHRvIHRoZSBjb25zb2xlPC9idXR0b24+XG5cdCAgICAgKiAgICAgICAgICAgICA8L2Rpdj5gO1xuXHQgICAgICogICAgICAgICByZW5kZXIodGVtcGxhdGUsIHdpbi5nZXRXZWJXaW5kb3coKS5kb2N1bWVudC5ib2R5KTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgfSBjYXRjaCAoZXJyKSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyKTtcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KSgpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGdldFdlYldpbmRvdygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignd2luZG93LWdldC13ZWItd2luZG93JywgdGhpcy5pZGVudGl0eSkuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5lbnZpcm9ubWVudC5nZXRXZWJXaW5kb3codGhpcy5pZGVudGl0eSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIERldGVybWluZXMgaWYgdGhlIHdpbmRvdyBpcyBhIG1haW4gd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogY29uc3Qgd25kID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuXHQgICAgICogY29uc3QgaXNNYWluV25kID0gd25kLmlzTWFpbldpbmRvdygpO1xuXHQgICAgICogY29uc29sZS5sb2coJ0lzIHRoaXMgYSBtYWluIHdpbmRvdz8gJyArIGlzTWFpblduZCk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgaXNNYWluV2luZG93KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd3aW5kb3ctaXMtbWFpbi13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICByZXR1cm4gdGhpcy5tZS51dWlkID09PSB0aGlzLm1lLm5hbWU7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIERldGVybWluZXMgaWYgdGhlIHdpbmRvdyBpcyBjdXJyZW50bHkgc2hvd2luZy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGlzV2luZG93U2hvd2luZygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmlzU2hvd2luZy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiAgICAgcmV0dXJuIGF3YWl0IHdpbi5pc1Nob3dpbmcoKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBpc1dpbmRvd1Nob3dpbmcoKS50aGVuKGJvb2wgPT4gY29uc29sZS5sb2coYm9vbCkpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxv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bXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93Lm1vdmVCeS5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIG1vdmVCeShsZWZ0LCB0b3ApIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm1vdmVCeShsZWZ0LCB0b3ApO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIG1vdmVCeSg1ODAsIDMwMCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnTW92ZWQnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIG1vdmVCeShkZWx0YUxlZnQsIGRlbHRhVG9wLCBwb3NpdGlvbmluZ09wdGlvbnMpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdtb3ZlLXdpbmRvdy1ieScsIHtcblx0ICAgICAgICAgICAgZGVsdGFMZWZ0LFxuXHQgICAgICAgICAg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ICAgICogYXN5bmMgZnVuY3Rpb24gc2V0QXNGb3JlZ3JvdW5kKCkge1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGNyZWF0ZVdpbigpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uc2V0QXNGb3JlZ3JvdW5kKClcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBzZXRBc0ZvcmVncm91bmQoKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdJbiB0aGUgZm9yZWdyb3VuZCcpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgc2V0QXNGb3JlZ3JvdW5kKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignc2V0LWZvcmVncm91bmQtd2luZG93JywgdGhpcy5pZGVudGl0eSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBTZXRzIHRoZSB3aW5kb3cncyBzaXplIGFuZCBwb3NpdGlvbi5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LnNldEJvdW5kcy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0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naGVsbG8gZnJvbSBzdWJtZW51JyB9XG5cdCAgICAgKiAgICAgICAgIF1cblx0ICAgICAqICAgICB9XG5cdCAgICAgKiBdXG5cdCAgICAgKiBmaW4ubWUuc2hvd1BvcHVwTWVudSh7IHRlbXBsYXRlIH0pLnRoZW4ociA9PiB7XG5cdCAgICAgKiAgICAgaWYgKHIucmVzdWx0ID09PSAnY2xvc2VkJykge1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmxvZygnbm90aGluZyBoYXBwZW5lZCcpO1xuXHQgICAgICogICAgIH0gZWxzZSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHIuZGF0YSlcblx0ICAgICAqICAgICB9XG5cdCAgICAgKiB9KVxuXHQgICAgICogYGBgXG5cdCAgICAgKlxuXHQgICAgICogT3ZlcnJpZGluZyB0aGUgYnVpbHQgaW4gY29udGV4dCBtZW51IChvdGUgdGhhdCB0aGlzIGNhbiBiZSBkb25lIHBlciBlbGVtZW50IG9yIGRvY3VtZW50IHdpZGUpOlxuXHQgICAgICogYGBganNcblx0ICAgICAqIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NvbnRleHRtZW51JywgZSA9PiB7XG5cdCAgICAgKiAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuXHQgICAgICogICAgIGNvbnN0IHRlbXBsYXRlID0gW1xuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ01lbnUgSXRlbSAxJyxcblx0ICAgICAqICAgICAgICAgICAgIGRhdGE6ICdoZWxsbyBmcm9tIGl0ZW0gMSdcblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgeyB0eXBlOiAnc2VwYXJhdG9yJyB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ01lbnUgSXRlbSAyJyxcblx0ICAgICAqICAgICAgICAgICAgIHR5cGU6ICdjaGVja2JveCcsXG5cdCAgICAgKiAgICAgICAgICAgICBjaGVja2VkOiB0cnVlLFxuXHQgICAgICogICAgICAgICAgICAgZGF0YTogJ1RoZSB1c2VyIGNsaWNrZWQgdGhlIGNoZWNrYm94J1xuXHQgICAgICogICAgICAgICB9LFxuXHQgICAgICogICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICBsYWJlbDogJ3NlZSBtb3JlJyxcblx0ICAgICAqICAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLFxuXHQgICAgICogICAgICAgICAgICAgc3VibWVudTogW1xuXHQgICAgICogICAgICAgICAgICAgICAgIHsgbGFiZWw6ICdzdWJtZW51IDEnLCBkYXRhOiAnaGVsbG8gZnJvbSBzdWJtZW51JyB9XG5cdCAgICAgKiAgICAgICAgICAgICBdXG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICBdXG5cdCAgICAgKiAgICAgZmluLm1lLnNob3dQb3B1cE1lbnUoeyB0ZW1wbGF0ZSwgeDogZS54LCB5OiBlLnkgfSkudGhlbihyID0+IHtcblx0ICAgICAqICAgICAgICAgaWYgKHIucmVzdWx0ID09PSAnY2xvc2VkJykge1xuXHQgICAgICogICAgICAgICAgICAgY29uc29sZS5sb2coJ25vdGhpbmcgaGFwcGVuZWQnKTtcblx0ICAgICAqICAgICAgICAgfSBlbHNlIHtcblx0ICAgICAqICAgICAgICAgICAgIGNvbnNvbGUubG9nKHIuZGF0YSlcblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgIH0pXG5cdCAgICAgKiB9KVxuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIHNob3dQb3B1cE1lbnUob3B0aW9ucykge1xuXHQgICAgICAgIGNvbnN0IHsgcGF5bG9hZCB9ID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3Nob3ctcG9wdXAtbWVudScsIHsgb3B0aW9ucywgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgIC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AgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LndyYXBTeW5jLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKiBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqIGxldCB3aW4gPSBmaW4uV2luZG93LndyYXBTeW5jKHsgdXVpZDogJ2FwcC0xJywgbmFtZTogJ215QXBwJyB9KTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICB3cmFwU3luYyhpZGVudGl0eSkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCd3aW5kb3ctd3JhcC1zeW5jJykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3NlIHRoaXMgZXJyb3IsIGp1c3QgY29udGludWUgaWYgdGhpcyBhbmFseXRpY3Mtb25seSBjYWxsIGZhaWxzXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgY29uc3QgZXJyb3JNc2cgPSAoMCwgdmFsaWRhdGVfMS52YWxpZGF0ZUlkZW50aXR5KShpZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKGVycm9yTXNnKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlcnJvck1zZyk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIHJldHVybiBuZXcgSW5zdGFuY2VfMS5fV2luZG93KHRo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gICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBXaW5kb3cgY29udGV4dCcpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjb25zdCB7IHV1aWQsIG5hbWUgfSA9IHRoaXMud2lyZS5tZTtcblx0ICAgICAgICByZXR1cm4gdGhpcy53cmFwKHsgdXVpZCwgbmFtZSB9KTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogU3luY2hyb25vdXNseSByZXR1cm5zIGEgV2luZG93IG9iamVjdCB0aGF0IHJlcHJlc2VudHMgdGhlIGN1cnJlbnQgd2luZG93XG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBjb25zdCB3bmQgPSBmaW4uV2luZG93LmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiBjb25zdCBpbmZvID0gYXdhaXQgd25kLmdldEluZm8oKTtcblx0ICAgICAqIGNvbnNvbGUubG9nKGluZm8pO1xuXHQgICAgICpcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRDdXJyZW50U3luYygpIHtcblx0ICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWN1cnJlbnQtd2luZG93LXN5bmMnKS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5pc1dpbmRvdykge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1lvdSBhcmUgbm90IGluIGEgV2luZG93IGNvbnRleHQnKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lIH0gPSB0aGlzLndpcm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c3NFeGl0SGFuZGxlciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhdGEgPSBwYXlsb2FkIHx8IHt9O1xuICAgICAgICAgICAgICAgICAgICBleGl0UGF5bG9hZCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvcGljOiAnZXhpdGVkJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHV1aWQ6IGRhdGEucHJvY2Vzc1V1aWQgfHwgJycsXG4gICAgICAgICAgICAgICAgICAgICAgICBleGl0Q29kZTogZGF0YS5leGl0Q29kZSB8fCAwXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzVXVpZCA9PT0gcGF5bG9hZC5wcm9jZXNzVXVpZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5saXN0ZW5lcihleGl0UGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBvZldpbmRvdy5yZW1vdmVMaXN0ZW5lcihleGl0RXZlbnRLZXksIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgLy8gd2luZG93IGNvbnN0cnVjdG9yIGV4cGVjdHMgdGhlIG5hbWUgaXMgbm90IHVuZGVmaW5lZFxuICAgICAgICAgICAgICAgIGlmICghdGhpcy53aXJlLm1lLm5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy53aXJlLm1lLm5hbWUgPSB0aGlzLndpcmUubWUudXVpZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb2ZXaW5kb3cgPSBuZXcgd2luZG93XzEuX1dpbmRvdyh0aGlzLndpcmUsIHRoaXMud2lyZS5tZSk7XG4gICAgICAgICAgICAgICAgb2ZXaW5kb3cub24oZXhpdEV2ZW50S2V5LCBleHRlcm5hbFByb2Nlc3NFeGl0SGFuZGxlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLndpcmVcbiAgICAgICAgICAgICAgICAuc2VuZEFjdGlvbihhY3Rpb24sIG9wdGlvbnMpXG4gICAgICAgICAgICAgICAgLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiB7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc1V1aWQgPSBwYXlsb2FkLmRhdGEudXVpZDtcbiAgICAgICAgICAgICAgICByZXNvbHZlKHBheWxvYWQuZGF0YSk7XG4gICAgICAgICAgICAgICAgaWYgKGV4aXRQYXlsb2FkICYmIHByb2Nlc3NVdWlkID09PSBleGl0UGF5bG9hZC51dWlkKSB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMubGlzdGVuZXIoZXhpdFBheWxvYWQpO1xuICAgICAgICAgICAgICAgICAgICBvZldpbmRvdy5yZW1vdmVMaXN0ZW5lcihleGl0RXZlbnRLZXksIGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKG9mV2luZG93KSB7XG4gICAgICAgICAgICAgICAgICAgIG9mV2luZG93LnJlbW92ZUxpc3RlbmVyKGV4aXRFdmVudEtleSwgZXh0ZXJuYWxQcm9jZXNzRXhpdEhhbmRsZXIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQWRkcyBhIGxpc3RlbmVyIHRvIHRoZSBlbmQgb2YgdGhlIGxpc3RlbmVycyBhcnJheSBmb3IgdGhlIHNwZWNpZmllZCBldmVudC5cbiAgICAgKiBAcGFyYW0gZXZlbnRUeXBlICAtIFRoZSB0eXBlIG9mIHRoZ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XRMb2cobG9nc1swXSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZ2V0TG9nKCkudGhlbihsb2cgPT4gY29uc29sZS5sb2cobG9nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldExvZyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbigndmlldy1sb2cnLCBvcHRpb25zKS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhIHVuaXF1ZSBpZGVudGlmaWVyIChVVUlEKSBwcm92aWRlZCBieSB0aGUgbWFjaGluZS5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldE1hY2hpbmVJZCgpLnRoZW4oaWQgPT4gY29uc29sZS5sb2coaWQpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0TWFjaGluZUlkKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1tYWNoaW5lLWlkJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIG1pbmltdW0gKGluY2x1c2l2ZSkgbG9nZ2luZyBsZXZlbCB0aGF0IGlzIGN1cnJlbnRseSBiZWluZyB3cml0dGVuIHRvIHRoZSBsb2cuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRNaW5Mb2dMZXZlbCgpLnRoZW4obGV2ZWwgPT4gY29uc29sZS5sb2cobGV2ZWwpKS5jYXRjaChlcnIgPT4gY29uc29sZS5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XJlZCBQcm94eSBBZGRyZXNzXG4gICAgICogICAgICAgICBwcm94eVBvcnQ6IDAsIC8vdGhlIGNvbmZpZ3VyZWQgUHJveHkgcG9ydFxuICAgICAqICAgICAgICAgdHlwZTogXCJzeXN0ZW1cIiAvL1Byb3h5IFR5cGVcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgc3lzdGVtOiB7XG4gICAgICogICAgICAgICBhdXRvQ29uZmlnVXJsOiBcIlwiLFxuICAgICAqICAgICAgICAgYnlwYXNzOiBcIlwiLFxuICAgICAqICAgICAgICAgZW5hYmxlZDogZmFsc2UsXG4gICAgICogICAgICAgICBwcm94eTogXCJcIlxuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldFByb3h5U2V0dGluZ3MoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXByb3h5LXNldHRpbmdzJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgaW5mb3JtYXRpb24gYWJvdXQgdGhlIHJ1bm5pbmcgUnVudGltZSBpbiBhbiBvYmplY3QuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRSdW50aW1lSW5mbygpLnRoZW4oUnVudGltZUluZm8gPT4gY29uc29sZS5sb2coUnVudGltZUluZm8pKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0UnVudGltZUluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXJ1bnRpbWUtaW5mbycpLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiBwYXlsb2FkLmRhdGEpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXR1c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ICAgICogICAgIHBhdGg6ICdjbWQuZXhlJyxcbiAgICAgKiAgICAgY3dkOiAnYzpcXFxcdGVtcCcsXG4gICAgICogICAgIGFyZ3VtZW50czogJycsXG4gICAgICogICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGFtcGxlIHVzaW5nIGFuIGFsaWFzIGZyb20gYXBwLmpzb24gYXBwQXNzZXRzIHByb3BlcnR5OlxuICAgICAqXG4gICAgICogYGBganNvblxuICAgICAqIFwiYXBwQXNzZXRzXCI6IFtcbiAgICAgKiAgICAge1xuICAgICAqICAgICAgICAgXCJzcmNcIjogXCJleGUuemlwXCIsXG4gICAgICogICAgICAgICBcImFsaWFzXCI6IFwibXlBcHBcIixcbiAgICAgKiAgICAgICAgIFwidmVyc2lvblwiOiBcIjQuMTIuOFwiLFxuICAgICAqICAgICAgICAgXCJ0YXJnZXRcIjogXCJteUFwcC5leGVcIixcbiAgICAgKiAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjIGRcIlxuICAgICAqICAgICB9LFxuICAgICAqIF1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogLy8gIFdoZW4gY2FsbGVkLCBpZiBubyBhcmd1bWVudHMgYXJlIHBhc3NlZCB0aGVuIHRoZSBhcmd1bWVudHMgKGlmIGFueSlcbiAgICAgKiAvLyAgYXJlIHRha2VuIGZyb20gdGhlICdh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0aGlzIGluZm9ybWF0aW9uIGFzIHBhcnQgb2YgdGhlIGRlZmF1bHQgY29uZmlndXJhdGlvbnMgZm9yIGFzc2V0cyBpbiBhbiBhcHBsaWNhdGlvbidzIG1hbmlmZXN0XG4gICAgICogd2lsbCBiZSBhZGRlZCBpbiBhIGZ1dHVyZSBSVk0gdXBkYXRlOlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmxhdW5jaEV4dGVybmFsUHJvY2Vzcyh7XG4gICAgICogICAgIHBhdGg6ICdDOlxcXFxVc2Vyc1xcXFxFeGFtcGxlVXNlclxcXFxBcHBEYXRhXFxcXExvY2FsXFxcXE9wZW5GaW5cXFxcT3BlbkZpblJWTS5leGUnLFxuICAgICAqICAgICBhcmd1bWVudHM6ICctLXZlcnNpb24nLFxuICAgICAqICAgICBjZXJ0aWZpY2F0ZToge1xuICAgICAqICAgICAgICAgdHJ1c3RlZDogdHJ1ZSxcbiAgICAgKiAgICAgICAgIHN1YmplY3Q6ICdPPU9wZW5GaW4gSU5DLiwgTD1OZXcgWW9yaywgUz1OWSwgQz1VUycsXG4gICAgICogICAgICAgICB0aHVtYnByaW50OiAn4oCOM2MgYTUgMjggMTkgODMgMDUgZmUgNjkgODggZTYgOGYgNGIgM2EgYWYgYzUgYzUgMWIgMDcgODAgNWInXG4gICAgICogICAgIH0sXG4gICAgICogICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBJdCBpcyBwb3NzaWJsZSB0byBsYXVuY2ggZmlsZXMgdGhhdCBoYXZlIGJlZW4gZG93bmxvYWRlZCBieSB0aGUgdXNlciBieSBsaXN0ZW5pbmcgdG8gdGhlIHdpbmRvd1xuICAgICAqIGBmaWxlLWRvd25sb2FkLWNvbXBsZXRlZGAgZXZlbnQgYW5kIHVzaW5nIHRoZSBgZmlsZVV1aWRgIHByb3ZpZGVkIGJ5IHRoZSBldmVudDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd2luID0gZmluLldpbmRvdy5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIHdpbi5hZGRMaXN0ZW5lcignZmlsZS1kb3dubG9hZC1jb21wbGV0ZWQnLCAoZXZ0KSA9PiB7XG4gICAgICogICAgIGlmIChldnQuc3RhdGUgPT09ICdjb21wbGV0ZWQnKSB7XG4gICAgICogICAgICAgICBmaW4uU3lzdGVtLmxhdW5jaEV4dGVybmFsUHJvY2Vzcyh7XG4gICAgICogICAgICAgICAgICAgZmlsZVV1aWQ6IGV2dC5maWxlVXVpZCxcbiAgICAgKiAgICAgICAgICAgICBhcmd1bWVudHM6ICcnLFxuICAgICAqICAgICAgICAgICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCd0aGUgZXhpdCBjb2RlJywgcmVzdWx0LmV4aXRDb2RlKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgICAgICAgICAgY29uc29sZS5sb2cocHJvY2Vzc0lkZW50aXR5KTtcbiAgICAgKiAgICAgICAgIH0pLmNhdGNoKGVycm9yID0+IHtcbiAgICAgKiAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfVxuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogTGF1bmNoaW5nIGFzc2V0cyBzcGVjaWZpZWQgaW4gdGhlIGFwcCBtYW5pZmVzdDpcbiAgICAgKlxuICAgICAqIFNhbXBsZSBhcHBBc3NldHMgc2VjdGlvbiBpbiBhcHAuanNvblxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwiYXBwQXNzZXRzXCI6IFtcbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICBcInNyY1wiOiBcImh0dHA6Ly9maWxlc2FtcGxlcy5jb20vZXhlLnppcFwiLFxuICAgICAqICAgICAgICAgICAgIFwiYWxpYXNcIjogXCJteUFwcFwiLFxuICAgICAqICAgICAgICAgICAgIFwidmVyc2lvblwiOiBcIjQuMTIuOFwiLFxuICAgICAqICAgICAgICAgICAgIFwidGFyZ2V0XCI6IFwibXlBcHAuZXhlXCIsXG4gICAgICogICAgICAgICAgICAgXCJhcmdzXCI6IFwiYSBiIGMgZFwiXG4gICAgICogICAgICAgICB9LFxuICAgICAqICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgIFwic3JjXCI6IFwiaHR0cDovL2V4YW1wbGVzLmNvbS9leGUuemlwXCIsXG4gICAgICogICAgICAgICAgICAgXCJhbGlhc1wiOiBcIm15QXBwMlwiLFxuICAgICAqICAgICAgICAgICAgIFwidmVyc2lvblwiOiBcIjUuMTIuOFwiLFxuICAgICAqICAgICAgICAgICAgIFwidGFyZ2V0XCI6IFwibXlBcHAyLmV4ZVwiLFxuICAgICAqICAgICAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjXCJcbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgXVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogVGhpcyBwZXJtaXNzaW9uIGFsbG93cyBmb3IgbGF1bmNoaW5nIG9mIGFsbCBhc3NldHMgc3BlY2lmaWVkIGluIHRoZSBhYm92ZSBhcHBBc3NldHMgc2VjdGlvbi4gKFwibXlBcHBcIiBhbmQgXCJteUFwcDJcIik6XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJhc3NldHNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBUaGlzIHBlcm1pc3Npb24gYWxsb3dzIGZvciBsYXVuY2hpbmcgb2YgX29ubHlfIHRoZSBcIm15QXBwXCIgYXNzZXQgaW4gdGhlIGFib3ZlIGFwcEFzc2V0cyBzZWN0aW9uLCBhcyBkZWZpbmVkIGluIGBzcmNSdWxlc2A6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiYXNzZXRzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgICAgICBcInNyY1J1bGVzXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIqOi8vZmlsZXNhbXBsZXMuY29tLypcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwiYWxsb3dcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJibG9ja1wiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIExhdW5jaGluZyBkb3dubG9hZGVkIGZpbGVzOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImRvd25sb2Fkc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBhbGxvd3MgdG8gbGF1bmNoIGFsbCB0aGUgZXhlY3V0YWJsZXM6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiZXhlY3V0YWJsZXNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBvbmx5IGFsbG93cyBsYXVuY2hpbmcgb2YgZXhlY3V0YWJsZXMgd2hvc2UgZmlsZSBwYXRocyBtYXRjaCB0aGUgY29ycmVzcG9uZGluZyBgcGF0aFJ1bGVzYDpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJleGVjdXRhYmxlc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJwYXRoUnVsZXNcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIi9XaW5kb3dzL1N5c3RlbTMyLyouZXhlXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImFsbG93XCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiouZXhlXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImJsb2NrXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGxhdW5jaEV4dGVybmFsUHJvY2VzcyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNlbmRFeHRlcm5hbFByb2Nlc3NSZXF1ZXN0KCdsYXVuY2gtZXh0ZXJuYWwtcHJvY2VzcycsIG9wdGlvbnMpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBNb25pdG9ycyBhIHJ1bm5pbmcgcHJvY2Vzcy4gQSBwaWQgZm9yIHRoZSBw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HRwczovL2RldmVsb3BlcnMub3BlbmZpbi5jby9kb2NzL2FwaS1zZWN1cml0eVwiPkFQSSBzZWN1cml0eSBzZXR0aW5nczwvYT4uXG4gICAgICogQHBhcmFtIGFwcEFzc2V0IEFwcCBhc3NldCBvYmplY3RcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBhc3luYyBmdW5jdGlvbiBkb3dubG9hZEFzc2V0KCkge1xuICAgICAqICAgICBjb25zdCBhcHBBc3NldCA9IHtcbiAgICAgKiAgICAgICAgIHNyYzogYCR7IGxvY2F0aW9uLm9yaWdpbiB9L2Fzc2V0cy56aXBgLFxuICAgICAqICAgICAgICAgYWxpYXM6ICdkaXJBcHAnLFxuICAgICAqICAgICAgICAgdmVyc2lvbjogJzEuMjMuMjQnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiAnYXNzZXRzL3J1bi5iYXQnXG4gICAgICogICAgIH07XG4gICAgICpcbiAgICAgKiAgICAgcmV0dXJuIGZpbi5TeXN0ZW0uZG93bmxvYWRBc3NldChhcHBBc3NldCwgKHByb2dyZXNzID0+IHtcbiAgICAgKiAgICAgLy9QcmludCBwcm9ncmVzcyBhcyB3ZSBkb3dubG9hZCB0aGUgYXNzZXQuXG4gICAgICogICAgICAgICBjb25zdCBkb3dubG9hZGVkUGVyY2VudCA9IE1hdGguZmxvb3IoKHByb2dyZXNzLmRvd25sb2FkZWRCeXRlcyAvIHByb2dyZXNzLnRvdGFsQnl0ZXMpICogMTAwKTtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGBEb3dubG9hZGVkICR7ZG93bmxvYWRlZFBlcmNlbnR9JWApO1xuICAgICAqICAgICB9KSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZG93bmxvYWRBc3NldCgpXG4gICAgICogLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1N1Y2Nlc3MnKSlcbiAgICAgKiAuY2F0Y2goZXJyID0+IGNvbnNvbGUuZX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25zdCBkb3dubG9hZElkID0gdGhpcy53aXJlLmVudmlyb25tZW50LmdldE5leHRNZXNzYWdlSWQoKS50b1N0cmluZygpO1xuICAgICAgICBjb25zdCBkbFByb2dyZXNzS2V5ID0gYGFzc2V0LWRvd25sb2FkLXByb2dyZXNzLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbEVycm9yS2V5ID0gYGFzc2V0LWRvd25sb2FkLWVycm9yLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbENvbXBsZXRlS2V5ID0gYGFzc2V0LWRvd25sb2FkLWNvbXBsZXRlLSR7ZG93bmxvYWRJZH1gO1xuICAgICAgICBjb25zdCBkbFByb2dyZXNzID0gKHByb2dyZXNzKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBwID0ge1xuICAgICAgICAgICAgICAgIGRvd25sb2FkZWRCeXRlczogcHJvZ3Jlc3MuZG93bmxvYWRlZEJ5dGVzLFxuICAgICAgICAgICAgICAgIHRvdGFsQnl0ZXM6IHByb2dyZXNzLnRvdGFsQnl0ZXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwcm9ncmVzc0xpc3RlbmVyKHApO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBjbGVhbkxpc3RlbmVycyA9ICgpID0+IHtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5yZW1vdmVMaXN0ZW5lcihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgfTtcbiAgICAgICAgY29uc3QgZGxFcnJvciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1xuICAgICAgICAgICAgY29uc3QgeyByZWFzb24sIGVycjogZXJyb3IgfSA9IHBheWxvYWQ7XG4gICAgICAgICAgICByZWplY3QobmV3IHR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nJvci0ke2Rvd25sb2FkSWR9YDtcbiAgICAgICAgICAgIGNvbnN0IGRsQ29tcGxldGVLZXkgPSBgcnVudGltZS1kb3dubG9hZC1jb21wbGV0ZS0ke2Rvd25sb2FkSWR9YDtcbiAgICAgICAgICAgIGNvbnN0IGRsUHJvZ3Jlc3MgPSAocHJvZ3Jlc3MpID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBwID0ge1xuICAgICAgICAgICAgICAgICAgICBkb3dubG9hZGVkQnl0ZXM6IHByb2dyZXNzLmRvd25sb2FkZWRCeXRlcyxcbiAgICAgICAgICAgICAgICAgICAgdG90YWxCeXRlczogcHJvZ3Jlc3MudG90YWxCeXRlc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcHJvZ3Jlc3NMaXN0ZW5lcihwKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBjbGVhbkxpc3RlbmVycyA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBUT0RPOiBmaXggaW50ZXJuYWwgdHlwZXNcbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVMaXN0ZW5lcihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBkbEVycm9yID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1xuICAgICAgICAgICAgICAgIGNvbnN0IHsgcmVhc29uLCBlcnI6IGVycm9yIH0gPSBwYXlsb2FkO1xuICAgICAgICAgICAgICAgIHJlamVjdChuZXcgdHJhbnNwb3J0X2Vycm9yc18xJDEuUnVudGltZUVycm9yKHsgcmVhc29uLCBlcnJvciB9LCBjYWxsc2l0ZXMpKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBkbENvbXBsZXRlID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIGNsZWFuTGlzdGVuZXJzKCk7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5vbihkbFByb2dyZXNzS2V5LCBkbFByb2dyZXNzKTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5vbmNlKGRsRXJyb3JLZXksIGRsRXJyb3IpO1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICB0aGlzLm9uY2UoZGxDb21wbGV0ZUtleSwgZGxDb21wbGV0ZSk7XG4gICAgICAgICAgICBjb25zdCBkb3dubG9hZE9wdGlvbnMgPSBPYmplY3QuYXNzaWduKG9wdGlvbnMsIHsgZG93bmxvYWRJZCB9KTtcbiAgICAgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdkb3dubG9hZC1ydW50aW1lJywgZG93bmxvYWRPcHRpb25zKS5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgY2xlYW5MaXN0ZW5lcnMoKTtcbiAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogRG93bmxvYWQgcHJlbG9hZCBzY3JpcHRzIGZyb20gZ2l2ZW4gVVJMc1xuICAgICAqIEBwYXJhbSBzY3JpcHRzIC0gVVJMcyBvZiBwcmVsb2FkIHNjcmlwdHMuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAg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QXBwbGljYXRpb25zKClcbiAgICAgKiAudGhlbihleHRlcm5hbEFwcHMgPT4gY29uc29sZS5sb2coJ1RvdGFsIGV4dGVybmFsIGFwcHM6ICcgKyBleHRlcm5hbEFwcHMubGVuZ3RoKSlcbiAgICAgKiAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldEFsbEV4dGVybmFsQXBwbGljYXRpb25zKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1hbGwtZXh0ZXJuYWwtYXBwbGljYXRpb25zJykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHJpZXZlcyBhcHAgYXNzZXQgaW5mb3JtYXRpb24uXG4gICAgICogQHBhcmFtIG9wdGlvbnNcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldEFwcEFzc2V0SW5mbyh7YWxpYXM6J3Byb2NleHAnfSkudGhlbihhc3NldEluZm8gPT4gY29uc29sZS5sb2coYXNzZXRJbmZvKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldEFwcEFzc2V0SW5mbyhvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWFwcC1hc3NldC1pbmZvJywgb3B0aW9ucykudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEdldCBhZGRpdGlvbmFsIGluZm8gb2YgY29va2llcy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldENvb2tpZXMoe25hbWU6ICdteUNv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XNweCBoZXJlfSBmb3IgV2luZG93J3MgZXJyb3IgY29kZSBkZWZpbml0aW9ucy5cbiAgICAgKlxuICAgICAqIEV4YW1wbGUgcGF5bG9hZHMgb2YgZGlmZmVyZW50IHJlZ2lzdHJ5IHR5cGVzOlxuICAgICAqXG4gICAgICogU2VlIGxpc3Qgb2YgdHlwZXMge0BsaW5rIGh0dHBzOi8vbXNkbi5taWNyb3NvZnQuY29tL2VuLXVzL2xpYnJhcnkvd2luZG93cy9kZXNrdG9wL21zNzI0ODg0KHY9dnMuODUpLmFzcHggaGVyZX0uXG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIC8vIFJFR19EV09SRFxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogMSxcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0xPQ0FMX01BQ0hJTkVcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX0RXT1JEXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX1FXT1JEXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiAxMzEwODE0NjY3MTMzNDExMixcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0xPQ0FMX01BQ0hJTkVcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX1FXT1JEXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX1NaXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiBcIkZvb0JhckJhelwiLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfTE9DQUxfTUFDSElORVwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfU1pcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfRVhQQU5EX1NaXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiBcIkM6XFxVc2VyXFxKb2huRG9lXFxBcHBEYXRhXFxMb2NhbFwiLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfQ1VSUkVOVF9VU0VSXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19FWFBBTkRfU1pcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfTVVMVElfU1pcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IFtcbiAgICAgKiAgICAgICAgIFwiRm9vXCIsXG4gICAgICogICAgICAgICBcIkJhclwiLFxuICAgICAqICAgICAgICAgXCJCYXpcIlxuICAgICAqICAgICBdLFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfQ1VSUkVOVF9VU0VSXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19NVUxUSV9TWlwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19CSU5BUllcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IHtcbiAgICAgKiAgICAgICAgIGRhdGE6IFtcbiAgICAgKiAgICAgICAgICAgICAyNTUsXG4gICAgICogICAgICAgICAgICAgMjU1LFxuICAgICAqICAgICAgICAgICAgIDAsXG4gICAgICogICAgICAgICAgICAgNDMsXG4gICAgICogICAgICAgICAgICAgNTUsXG4gICAgICogICAgICAgICAgICAgMCxcbiAgICAgKiAgICAgICAgICAgICAwLFxuICAgICAqICAgICAgICAgICAgIDI1NSxcbiAgICAgKiAgICAgICAgICAgICAyNTVcbiAgICAgKiAgICAgICAgIF0sXG4gICAgICogICAgICAgICB0eXBlOiBcIkJ1ZmZlclwiXG4gICAgICogICAgIH0sXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9DVVJSRU5UX1VTRVJcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX0JJTkFSWVwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICByZWFkUmVnaXN0cnlWYWx1ZShyb290S2V5LCBzdWJrZXksIHZhbHVlKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmVcbiAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdyZWFkLXJlZ2lzdHJ5LXZhbHVlJywge1xuICAgICAgICAgICAgcm9vdEtleSxcbiAgICAgICAgICAgIHN1YmtleSxcbiAgICAgICAgICAgIHZhbHVlXG4gICAgICAgIH0pXG4gICAgICAgICAgICAudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFRoaXMgZnVuY3Rpb24gY2FsbCB3aWxsIHJlZ2lzdGVyIGEgdW5pcXVlIGlkIGFuZCBwcm9kdWNlIGEgdG9rZW4uXG4gICAgICogVGhlIHRva2VuIGNhbiBiZSB1c2VkIHRvIGJyb2tlciBhbiBleHRlcm5hbCBjb25uZWN0aW9uLlxuICAgICAqIEBwYXJhbSB1dWlkIC0gQSBVVUlEIGZvciB0aGUgcmVtb3RlIGNvbm5lY3Rpb24uXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5yZWdpc3RlckV4dGVybmFsQ29ubmVjdGlvbihcInJlbW90ZS1jb25uZWN0aW9uLXV1aWRcIikudGhlbihjb25uID0+IGNvbnNvbG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N0ZW0uZ2V0Q3VycmVudCgpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgZmluLlN5c3RlbS5yZWdpc3RlclVzYWdlKHtcbiAgICAgKiAgICAgICAgIHR5cGU6ICd3b3Jrc3BhY2UtbGljZW5zaW5nJyxcbiAgICAgKiAgICAgICAgIC8vIGV4YW1wbGUgdmFsdWVzIGZvciB0aGUgZm9sbG93aW5nIGRhdGEgb2JqZWN0XG4gICAgICogICAgICAgICBkYXRhOiB7XG4gICAgICogICAgICAgICAgICAgYXBpVmVyc2lvbjogJzEuMCcsXG4gICAgICogICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ2hvbWUnLFxuICAgICAqICAgICAgICAgICAgIGNvbXBvbmVudFZlcnNpb246ICcxLjAnLFxuICAgICAqICAgICAgICAgICAgIGFsbG93ZWQ6IHRydWUsXG4gICAgICogICAgICAgICAgICAgcmVqZWN0aW9uQ29kZTogJydcbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogcmVnaXN0ZXJVc2FnZSgpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1N1Y2Nlc3NmdWxseSByZWdpc3RlcmVkIGNvbXBvbmVudCBhcHBsaWNhdGlvbicpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgcmVnaXN0ZXJVc2FnZSh7IGRhdGEsIHR5cGUgfSkge1xuICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbigncmVnaXN0ZXItdXNhZ2UnLCB7IGRhdGEsIHR5cGUgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYW4gYXJyYXkgd2l0aCBhbGwgcHJpbnRlcnMgb2YgdGhlIGNhbGxlciBhbmQgbm90IGFsbCB0aGUgcHJpbnRlcnMgb24gdGhlIGRlc2t0b3AuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRQcmludGVycygpXG4gICAgICogICAgIC50aGVuKChwcmludGVycykgPT4ge1xuICAgICAqICAgICAgICAgcHJpbnRlcnMuZm9yRWFjaCgocHJpbnRlcikgPT4ge1xuICAgICAqICAgICAgICAgICAgIGlmIChwcmludGVyLmlzRGVmYXVsdCkge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcmludGVyKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfSlcbiAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICogICAgIH0pO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldFByaW50ZXJzKCkge1xuICAgICAgICBjb25zdCB7IHBheWxvYWQgfSA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzeXN0ZW0tZ2V0LXByaW50ZXJzJyk7XG4gICAgICAgIHJldHVybiBwYXlsb2FkLmRhdGE7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFVwZGF0ZXMgUHJvY2VzcyBMb2dnaW5nIHZhbHVlczogcGVyaW9kaWMgaW50ZXJ2YWwgYW5kIG91dGxpZXIgZGV0ZWN0aW9uIGVudHJpZXMgYW5kIGludGVydmFsLlxuICAgICAqIEBwYXJhbSBvcHRpb25zIFByb2Nlc3MgTG9nZ2luZyB1cGRhdGFibGUgb3B0aW9ucy5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIFdoZW4gZW5hYmxpbmcgdmVyYm9zZSBtb2RlLCBhZGRpdGlvbmFsIHByb2Nlc3MgaW5mb3JtYXRpb24gaXMgbG9nZ2VkIHRvIHRoZSBkZWJ1Zy5sb2c6XG4gICAgICpcbiAgICAgKiAxLiBQZXJpb2RpY2FsbHkgcHJv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0aW5ncyA9IGF3YWl0IGZpbi5TeXN0ZW0uZ2V0RG9tYWluU2V0dGluZ3MoKTtcbiAgICAgKiAvLyB7XG4gICAgICogLy8gICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm9wdGlvbnNcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImRvd25sb2FkU2V0dGluZ3NcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJwcm9tcHRcIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgXVxuICAgICAqIC8vIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBnZXREb21haW5TZXR0aW5ncygpIHtcbiAgICAgICAgY29uc3QgeyBwYXlsb2FkOiB7IGRhdGEgfSB9ID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC1kb21haW4tc2V0dGluZ3MnLCB0aGlzLmlkZW50aXR5KTtcbiAgICAgICAgcmV0dXJuIGRhdGE7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNldHMgdGhlIGRvbWFpbiBzZXR0aW5ncyBmb3IgdGhlIGN1cnJlbnQgYXBwbGljYXRpb24uXG4gICAgICogQHBhcmFtIGRvbWFpblNldHRpbmdzIC0gZG9tYWluIHNldHRpbmdzIG9iamVjdFxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBkb21haW5TZXR0aW5ncyA9IGF3YWl0IGZpbi5TeXN0ZW0uZ2V0RG9tYWluU2V0dGluZ3MoKTtcbiAgICAgKiAvLyB7XG4gICAgICogLy8gICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImh0dHBzOi8vb3BlbmZpbi5jb1wiXG4gICAgICogLy8gICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm9wdGlvbnNcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICBcImRvd25sb2FkU2V0dGluZ3NcIjoge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPGFsbF91cmxzPlwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJwcm9tcHRcIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgXVxuICAgICAqIC8vIH1cbiAgICAgKlxuICAgICAqIC8vIFZhbGlkIHJ1bGUgYmVoYXZpb3JzIGFyZSAncHJvbXB0JyBhbmQgJ25vLXByb21wdCdcbiAgICAgKiBkb21haW5TZXR0aW5ncy5ydWxlc1swXS5vcHRpb25zLmRvd25sb2FkU2V0dGluZ3MucnVsZXNbMF0uYmVoYXZpb3IgPSAnbm8tcHJvbXB0JztcbiAgICAgKlxuICAgICAqIGF3YWl0IGZpbi5TeXN0ZW0uc2V0RG9tYWluU2V0dGluZ3MoZG9tYWluU2V0dGluZ3MpO1xuICAgICAqXG4gICAgICogY29uc3QgbmV3RG9tYWluU2V0dGluZ3MgPSBhd2FpdCBmaW4uU3lzdGVtLmdldERvbWFpblNldHRpbmdzKCk7XG4gICAgICogLy8ge1xuICAgICAqIC8vICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJodHRwczovL29wZW5maW4uY29cIlxuICAgICAqIC8vICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJkb3dubG9hZFNldHRpbmdzXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIjxhbGxfdXJscz5cIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwibm8tcHJvbXB0XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogLy8gICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICB9XG4gICAgICogLy8gICAgIF1cbiAgICAgKiAvLyB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgc2V0RG9tYWluU2V0dGluZ3MoZG9tYWluU2V0dGluZ3MpIHtcbiAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NldC1kb21haW4tc2V0dGluZ3MnLCB7IGRvbWFpblNldHRpbmdzLCAuLi50aGlzLmlkZW50aXR5IH0pO1xuICAgIH1cbn1cbnN5c3RlbS5TeXN0ZW0gPSBTeXN0ZW07XG5cbnZhciBpbnRlcmFwcGJ1cyA9IHt9O1xuXG52YXIgcmVmQ291bnRlciA9IHt9O1xuXG5PYmplY3QuZGVmaW5lUHJvcGVydHkocmVmQ291bnRlciwgXCJfX2VzTW9kdWxlXCIsIHsgdmFsdWU6IHRydWUgfSk7XG5yZWZDb3VudGVyLlJlZkNvdW50ZXIgPSB2b2lkIDA7XG5jbGFzcyBSZWZDb3VudGVyIHtcbiAgICBjb25zdHJ1Y3RvcigpIHtcbiAgICAgICAgdGhpcy50b3BpY1JlZk1hcCA9IG5ldyBNYXAoKTtcbiAgICB9XG4gICAgLy8gcmV0dXJucyB0aGUgcmVmIGNvdW50IGFmdGVyIGluY3JlbWVudGluZ1xuICAgIGluY1JlZkNvdW50KGtleSkge1xuICAgICAgICBjb25zdCByZWZDb3VudCA9IHRoaXMudG9waWNSZWZNYXAuZ2V0KGtleSk7XG4gICAgICAgIGxldCByZXR1cm5Db3VudDtcbiAgICAgICAgaWYgKCFyZWZDb3VudCkge1xuICAgICAgICAgICAgdGhpcy50b3BpY1JlZk1hcC5zZXQoa2V5LCAxKTtcbiAgICAgICAgICAgIHJldHVybkNvdW50ID0gMTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIGNvbnN0IG5ld1JlZkNvdW50ID0gcmVmQ291bnQgKyAxO1xuICAgICAgICAgICAgcmV0dXJuQ291bnQgPSBuZXdSZWZDb3VudDtcbiAgICAgICAgICAgIHRoaXMudG9waWNSZWZNYXAuc2V0KGtleSwgbmV3UmVmQ291bnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXR1cm5Db3VudDtcbiAgICB9XG4gICAgLy8gcmV0dXJucyB0aGUgcmVmIGNvdW50IGFmdGVyIGRlY3JlbWVudGluZywgb3IgLTEgaWYgdGhlIGtleSBhbHJlYWR5IGhhZCBubyByZWZlcmVuY2VzXG4gICAgZGVjUmVmQ291bnQoa2V5KSB7XG4gICAgICAgIGNvbnN0IHJlZkNvdW50ID0gdGhpcy50b3BpY1JlZk1hcC5nZXQoa2V5KTtcbiAgICAgICAgbGV0IHJldHVybkNvdW50O1xuICAgICAgICBpZiAocmVmQ291bnQpIHtcbiAgICAgICAgICAgIGNvbnN0IG5ld1JlZkNvdW50ID0gcmVmQ291bnQgLSAxO1xuICAgICAgICAgICAgdGhpcy50b3BpY1JlZk1hcC5zZXQoa2V5LCBuZXdSZWZDb3VudCk7XG4gICAgICAgICAgICByZXR1cm5Db3VudCA9IG5ld1JlZkNvdW50O1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuQ291bnQgPSAtMTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmV0dXJuQ291bnQ7XG4gICAgfVxuICAgIC8vIEV4ZWN1dGUgZmlyc3RBY3Rpb24gaWYg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SBhY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIENoYW5uZWwgUHJvdmlkZXI6XG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IHByb3ZpZGVyID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jcmVhdGUoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgcHJvdmlkZXIucmVnaXN0ZXIoJ3Byb3ZpZGVyLWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCwgaWRlbnRpdHkpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBwcm92aWRlci5iZWZvcmVBY3Rpb24oKGFjdGlvbiwgcGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIC8vVGhlIHBheWxvYWQgY2FuIGJlIGFsdGVyZWQgaGVyZSBiZWZvcmUgaGFuZGxpbmcgdGhlIGFjdGlvbi5cbiAgICAgKiAgICAgICAgIHBheWxvYWQucmVjZWl2ZWQgPSBEYXRlLm5vdygpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHBheWxvYWQ7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlv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1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucHJlQWN0aW9uID0gcmVzdWx0T3JQYXlsb2FkKGZ1bmMpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZWdpc3RlciBhbiBlcnJvciBoYW5kbGVyLiBUaGlzIGlzIGNhbGxlZCBiZWZvcmUgcmVzcG9uZGluZyBvbiBhbnkgZXJyb3IuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZnVuY1xuICAgICAqXG4gICAgICogQ2hhbm5lbCBQcm92aWRlcjpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNyZWF0ZSgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBwcm92aWRlci5yZWdpc3RlcigncHJvdmlkZXItYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhwYXlsb2FkKTtcbiAgICAgKiAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWN0aW9uIGVycm9yJyk7XG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIHByb3ZpZGVyLm9uRXJyb3IoKGFjdGlvbiwgZXJyb3IsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndW5jYXVnaHQgRXhjZXB0aW9uIGluIGFjdGlvbjonLCBhY3Rpb24pO1xuICAgICAqICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvcik7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIENoYW5uZWwgQ2xpZW50OlxuICAgICAqIGBgYGpzXG4gICAgICogKGFzeW5jICgpPT4ge1xuICAgICAqICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNvbm5lY3QoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgY2xpZW50LnJlZ2lzdGVyKCdjbGllbnQtYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhwYXlsb2FkKTtcbiAgICAgKiAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWN0aW9uIGVycm9yJyk7XG4gICAgICogICAgICAgICByZXR1cm4ge1xuICAgICAqICAgICAgICAgICAgIGVjaG86IHBheWxvYWRcbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGNsaWVudC5vbkVycm9yKChhY3Rpb24sIGVycm9yLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ3VuY2F1Z2h0IEV4Y2VwdGlvbiBpbiBhY3Rpb246JywgYWN0aW9uKTtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IpO1xuICAgICAqICAgICB9KTtcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIG9uRXJyb3IoZnVuYykge1xuICAgICAgICBpZiAodGhpcy5lcnJvck1pZGRsZXdhcmUpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWxyZWFkeSByZWdpc3RlcmVkIGVycm9yIG1pZGRsZXdhcmUnKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmVycm9yTWlkZGxld2FyZSA9IGZ1bmM7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJlZ2lzdGVyIG1pZGRsZXdhcmUgdGhhdCBmaXJlcyBhZn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gICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBjbGllbnQuYWZ0ZXJBY3Rpb24oKGFjdGlvbiwgcGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIC8vdGhlIHBheWxvYWQgY2FuIGJlIGFsdGVyZWQgaGVyZSBhZnRlciBoYW5kbGluZyB0aGUgYWN0aW9uIGJ1dCBiZWZvcmUgc2VuZGluZyBhbiBhY2tub3dsZWRnZW1lbnQuXG4gICAgICogICAgICAgICBwYXlsb2FkLnNlbnQgPSBkYXRlLm5vdygpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHBheWxvYWQ7XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhZnRlckFjdGlvbihmdW5jKSB7XG4gICAgICAgIGlmICh0aGlzLnBvc3RBY3Rpb24pIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWxyZWFkeSByZWdpc3RlcmVkIGFmdGVyQWN0aW9uIG1pZGRsZXdhcmUnKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnBvc3RBY3Rpb24g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ICAgICogQ2hhbm5lbCBQcm92aWRlcjpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLmNyZWF0ZSgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBwcm92aWRlci5yZWdpc3RlcigncHJvdmlkZXItYWN0aW9uJywgKHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgIGNvbnNvbGUubG9nKCdBY3Rpb24gZGlzcGF0Y2hlZCBieSBjbGllbnQ6ICcsIGlkZW50aXR5KTtcbiAgICAgKiAgICAgICAgY29uc29sZS5sb2coJ1BheWxvYWQgc2VudCBpbiBkaXNwYXRjaDogJywgcGF5bG9hZCk7XG4gICAgICpcbiAgICAgKiAgICAgICAgcmV0dXJuIHsgZWNobzogcGF5bG9hZCB9O1xuICAgICAqICAgIH0pO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnQWN0aW9uIGRpc3BhdGNoZWQgYnkgY2xpZW50OiAnLCBpZGVudGl0eSk7XG4gICAgICogICAgICAgIGNvbnNvbGUubG9nKCdQYXlsb2FkIHNlbnQgaW4gZGlzcGF0Y2g6ICcsIHBheWxvYWQpO1xu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mluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCwgaWRlbnRpdHkpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBjb25zdCBwcm92aWRlclJlc3BvbnNlID0gYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdwcm92aWRlci1hY3Rpb24nLCB7IG1lc3NhZ2U6ICdIZWxsbyBGcm9tIHRoZSBjbGllbnQnfSk7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb3ZpZGVyUmVzcG9uc2UpO1xuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZGlzcGF0Y2goYWN0aW9uLCBwYXlsb2FkKSB7XG4gICAgICAgIGlmIChfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGQodGhpcywgX0NoYW5uZWxDbGllbnRfc3RyYXRlZ3ksIFwiZlwiKS5pc0VuZHBvaW50Q29ubmVjdGVkKHRoaXMucHJvdmlkZXJJZGVudGl0eS5jaGFubmVsSWQpKSB7XG4gICAgICAgICAgICByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCRkKHRoaXMsIF9DaGFubmVsQ2xpZW50X3N0cmF0ZWd5LCBcImZcIikuc2VuZCh0aGlzLnByb3ZpZGVySWRlbnRpdHkuY2hhbm5lbElkLCBhY3Rpb24sIHBheWxvYWQpO1xuICAgICAgICB9XG4gICAgICAgIHRocm93IG5ldyBFcnJvcignVGhlIGNsaWVudCB5b3UgY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IH07XG4gICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoZSkgPT4ge1xuICAgICAgICAgICAgbGV0IHsgZGF0YSB9ID0gZTtcbiAgICAgICAgICAgIGlmIChlLmRhdGEgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcikge1xuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgVGV4dERlY29kZXIoKS5kZWNvZGUoZS5kYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgbWVzc2FnZUlkLCBwYXlsb2FkLCBzdWNjZXNzLCBlcnJvciB9ID0gSlNPTi5wYXJzZShkYXRhKTtcbiAgICAgICAgICAgIGNvbnN0IHsgcmVzb2x2ZSwgcmVqZWN0IH0gPSB0aGlzLnJlc3BvbnNlTWFwLmdldChtZXNzYWdlSWQpID8/IHt9O1xuICAgICAgICAgICAgaWYgKHJlc29sdmUgJiYgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNwb25zZU1hcC5kZWxldGUobWVzc2FnZUlkKTtcbiAgICAgICAgICAgICAgICBpZiAoc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHBheWxvYWQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnQ291bGQgbm90IGZpbmQgaWQgaW4gcmVzcG9uc2VNYXAuJyk7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLnJ0Yy5jaGFubmVscy5yZXF1ZXN0LmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBhc3luYyAoZSkgPT4ge1xuICAgICAgICAgICAgbGV0IHsgZGF0YSB9ID0gZTtcbiAgICAgICAgICAgIGlmIChlLmRhdGEgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcikge1xuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgVGV4dERlY29kZXIoKS5kZWNvZGUoZS5kYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgbWVzc2FnZUlkLCBhY3Rpb24sIHBheWxvYWQgfSA9IEpTT04ucGFyc2UoZGF0YSk7XG4gICAgICAgICAgICBpZiAoX19jbGFzc1ByaXZhdGVGaWVsZEdldCRiKHRoaXMsIF9SVENFbmRwb2ludF9wcm9jZXNzQWN0aW9uLCBcImZcIikpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXMgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JGIodGhpcywgX1JUQ0VuZHBvaW50X3Byb2Nlc3NBY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMsIGFjdGlvbiwgcGF5bG9hZCwgZW5kcG9pbnRJZGVudGl0eSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnNlbmQoSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogcmVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiBSVENEYXRhQ2hhbm5lbCBpcyBvcGVuIGJlZm9yZSBzZW5kaW5nLCBlcnJvciBnZXRzIHN3YWxsb3dlZCBoZXJlIGluIHRoZSBjYXNlIHdoZXJlXG4gICAgICAgICAgICAgICAgICAgIC8vIGNsaWVudCBkaXNwYXRjaGVkIHRoZW4gY2xvc2VkIG9yIGRpc2Nvbm5lY3RlZCBiZWZvcmUgdGhlIGRpc3BhdGNoIHJlc29sdmVzLlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5ydGMuY2hhbm5lbHMucmVzcG9uc2UucmVhZHlTdGF0ZSA9PT0gJ29wZW4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJ0Yy5jaGFubmVscy5yZXNwb25zZS5zZW5kKEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICgwLCBlcnJvcnNfMSQxLmVycm9yVG9QT0pPKShlcnJvciksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiBSVENEYXRhQ2hhbm5lbCBpcyBvcGVuIGZvciBzYW1lIHJlYXNvbiBhcyBjYXRjaCBibG9jayBhYm92ZS5cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnJlYWR5U3RhdGUgPT09ICdvcGVuJykge1xuICAgICAgICAgICAgICAgIHRoaXMucnRjLmNoYW5uZWxzLnJlc3BvbnNlLnNlbmQoSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlSWQsXG4gICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGZhbHNlLFxuICAgICAgICAgICAgICAgIC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RhdGUgPT09ICdjb25uZWN0aW5nJykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0ZW5lciA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWwucmVtb3ZlRXZlbnRMaXN0ZW5lcignb3BlbicsIGxpc3RlbmVyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgY2hhbm5lbC5hZGRFdmVudExpc3RlbmVyKCdvcGVuJywgbGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcignVGhpcyBDaGFubmVsIGhhcyBhbHJlYWR5IGNsb3NlZCcpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfTtcbiAgICB9XG4gICAgc3RhdGljIGNyZWF0ZURhdGFDaGFubmVsUHJvbWlzZShsYWJlbCwgcnRjQ2xpZW50KSB7XG4gICAgICAgIGxldCByZXNvbHZlcjtcbiAgICAgICAgY29uc3QgcHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7XG4gICAgICAgICAgICByZXNvbHZlciA9IHJlc29sdmU7XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBsaXN0ZW5lciA9IChlKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBvcGVuTGlzdGVuZXIgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgZS5jaGFubmVsLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ29wZW4nLCBvcGVuTGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgIHJlc29sdmVyKGUuY2hhbm5lbCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgaWYgKGUuY2hhbm5lbC5sYWJlbCA9PT0gbGFiZWwpIH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gICAge1xuICAgICAqIC8vICAgICAgICBcInV1aWRcIjogXCJvcGVuZmluMlwiLFxuICAgICAqIC8vICAgICAgICBcIm5hbWVcIjogXCJvcGVuZmluLXZpZXcyXCIsXG4gICAgICogLy8gICAgICAgIFwiZW5kcG9pbnRJZFwiOiBcIjR6NWQ4YWI5LTJiODEtMzY5MS05MWV4LTE0MjE3OTM4MjUxMVwiLFxuICAgICAqIC8vICAgICAgICBcImVudGl0eVR5cGVcIjogXCJ2aWV3XCIsXG4gICAgICogLy8gICAgICAgIFwidXJsXCI6IFwiaHR0cHM6Ly9leGFtcGxlLmNvbVwiXG4gICAgICogLy8gICAgfVxuICAgICAqIC8vXVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldEFsbENsaWVudEluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmNvbm5lY3Rpb25zLm1hcCgoY2xpZW50SW5mbykgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lLCBlbmRwb2ludElkLCBlbnRpdHlUeXBlLCBjb25uZWN0aW9uVXJsIH0gPSBjbGllbnRJbmZvO1xuICAgICAgICAgICAgcmV0dXJuIHsgdXVpZCwgbmFtZSwgZW5kcG9pbnRJZCwgZW50aXR5VHlwZSwgY29ubmVjdGlvblVybCB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgY2hlY2tGb3JDbGllbnRDb25uZWN0aW9uKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIGlmICghdGhpcy5pc0NsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgVGhpcyBhY3Rpb24gd2FzIHNlbnQgZnJvbSBhIGNsaWVudCB0aGF0IGlzIG5vdCBjb25uZWN0ZWQgdG8gdGhlIHByb3ZpZGVyLlxuICAgICAgICAgICAgICAgICAgICBDbGllbnQgSWRlbnRpdHk6IHt1dWlkOiAke2NsaWVudElkZW50aXR5LnV1aWR9LCBuYW1lOiAke2NsaWVudElkZW50aXR5Lm5hbWV9LCBlbmRwb2ludElkOiAke2NsaWVudElkZW50aXR5LmVuZHBvaW50SWR9fWApO1xuICAgICAgICB9XG4gICAgfVxuICAgIGlzQ2xpZW50Q29ubmVjdGVkKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIGlmIChDaGFubmVsUHJvdmlkZXIuY2xpZW50SWRlbnRpdHlJbmNsdWRlc0VuZHBvaW50SWQoY2xpZW50SWRlbnRpdHkpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb25uZWN0aW9ucy5zb21lKChpZGVudGl0eSkgPT4ge1xuICAgICAgICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICAgICAgLy8gTWlnaHQgYmUgcmVkdW5kYW50IHRvIGNoZWNrIGZvciB1dWlkIGFuZCBuYW1lIGhlcmUgYWZ0ZXIgd2UgZ2V0IGFuIGVuZHBvaW50SWQgbWF0Y2gsIGJ1dCBqdXN0IGluIGNhc2VcbiAgICAgICAgICAgICAgICBpZGVudGl0eS5lbmRwb2ludElkID09PSBjbGllbnRJZGVudGl0eS5lbmRwb2ludElkICYmXG4gICAgICAgICAgICAgICAgICAgIGlkZW50aXR5LnV1aWQgPT09IGNsaWVudElkZW50aXR5LnV1aWQgJiZcbiAgICAgICAgICAgICAgICAgICAgaWRlbnRpdHkubmFtZSA9PT0gY2xpZW50SWRlbnRpdHkubmFtZSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5pc0xlZ2FjeUNsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSk7XG4gICAgfVxuICAgIGlzTGVnYWN5Q2xpZW50Q29ubmVjdGVkKGNsaWVudElkZW50aXR5KSB7XG4gICAgICAgIHJldHVybiB0aGlzLmNvbm5lY3Rpb25zLnNvbWUoKGlkZW50aXR5KSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gaWRlbnRpdHkudX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J0ZWQ7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuZ2V0UHJvdmlkZXJQcm90b2NvbHMgPSAocHJvdG9jb2xzKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzdXBwb3J0ZWQgPSBwcm90b2NvbHNcbiAgICAgICAgICAgICAgICA/IHRoaXMuUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXIuZmlsdGVyKCh4KSA9PiBwcm90b2NvbHMuaW5jbHVkZXMoeCkpXG4gICAgICAgICAgICAgICAgOiB0aGlzLkRlZmF1bHRQcm92aWRlclByb3RvY29scztcbiAgICAgICAgICAgIGlmICghc3VwcG9ydGVkLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgTm8gdmFsaWQgcHJvdG9jb2xzIHdlcmUgcGFzc2VkIGluLiBBY2NlcHRlZCB2YWx1ZXMgYXJlOiAke3RoaXMuUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXIuam9pbignLCAnKX0uYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gc3VwcG9ydGVkO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmdldENvbXBhdGlibGVQcm90b2NvbHMgPSAocHJvdmlkZXJQcm90b2NvbHMsIGNsaWVudE9mZmVyKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzdXBwb3J0ZWQgPSBjbGllbnRPZmZlci5zdXBwb3J0ZWRQcm90b2NvbHMuZmlsdGVyKChjbGllbnRQcm90b2NvbCkgPT4gcHJvdmlkZXJQcm90b2NvbHMuc29tZSgocHJvdmlkZXJQcm90b2NvbCkgPT4gcHJvdmlkZXJQcm90b2NvbC50eXBlID09PSBjbGllbnRQcm90b2NvbC50eXBlICYmXG4gICAgICAgICAgICAgICAgY2xpZW50UHJvdG9jb2wudmVyc2lvbiA+PSBwcm92aWRlclByb3RvY29sLm1pbmltdW1WZXJzaW9uICYmXG4gICAgICAgICAgICAgICAgcHJvdml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0YycsXG4gICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBzdHJhdGVneV8yLlJUQ0luZm8udmVyc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IHsgb2ZmZXIsIHJ0Y0Nvbm5lY3Rpb25JZCB9XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhc2UgJ2NsYXNzaWMnOlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4geyB0eXBlOiAnY2xhc3NpYycsIHZlcnNpb246IHN0cmF0ZWd5XzEuQ2xhc3NpY0luZm8udmVyc2lvbiB9O1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAoMCwgZXhoYXVzdGl2ZV8xLmV4aGF1c3RpdmVDaGVjaykodHlwZSwgWydydGMnLCAnY2xhc3NpYyddKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSkpO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgb2ZmZXI6IHtcbiAgICAgICAgICAgICAgICBzdXBwb3J0ZWRQcm90b2NvbHMsXG4gICAgICAgICAgICAgICAgbWF4UHJvdG9jb2xzOiAyXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcnRjOiBydGNQYWNrZXRcbiAgICAgICAgfTtcbiAgICB9XG4gICAgYXN5bmMgY3JlYXRlQ2xpZW50U3RyYXRlZ3kocnRjUGFja2V0LCByb3V0aW5nSW5mbykge1xuICAgICAgICBpZiAoIXJvdXRpbmdJbmZvLmVuZHBvaW50SWQpIHtcbiAgICAgICAgICAgIHJvdXRpbmdJbmZvLmVuZHBvaW50SWQgPSB0aGlzLndpcmUuZW52aXJvbm1lbnQuZ2V0TmV4dE1lc3NhZ2VJZCgpO1xuICAgICAgICAgICAgLy8gRm9yIE5ldyBDbGllbnRzIGNvbm5lY3RpbmcgdG8gT2xkIFByb3ZpZGVycy4gVG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nJlc29sdmUoeyBlbmRwb2ludElkZW50aXR5OiBjbGllbnRJZGVudGl0eSB9KVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGNsaWVudEFuc3dlciA9IGF3YWl0IG92ZXJsYXBwaW5nUHJvdG9jb2xzLnJlZHVjZShhc3luYyAoYWNjdW1QLCBwcm90b2NvbFRvVXNlKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgYW5zd2VyID0gYXdhaXQgYWNjdW1QO1xuICAgICAgICAgICAgICAgIGlmIChwcm90b2NvbFRvVXNlLnR5cGUgPT09ICdydGMnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgYW5zd2VyOiBydGNBbnN3ZXIsIHJ0Y0NsaWVudCwgY2hhbm5lbHMgfSA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkOCh0aGlzLCBfQ29ubmVjdGlvbk1hbmFnZXJfcnRjQ29ubmVjdGlvbk1hbmFnZXIsIFwiZlwiKS5jcmVhdGVQcm92aWRlckFuc3dlcihwcm90b2NvbFRvVXNlLnBheWxvYWQucnRjQ29ubmVjdGlvbklkLCBwcm90b2NvbFRvVXNlLnBheWxvYWQub2ZmZXIpO1xuICAgICAgICAgICAgICAgICAgICBhbnN3ZXIuc3VwcG9ydGVkUHJvdG9jb2xzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3J0YycsXG4gICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBzdHJhdGVneV8yLlJUQ0luZm8udmVyc2lvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnN3ZXI6IHJ0Y0Fuc3dlclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgYW5zd2VyLmVuZHBvaW50UGF5bG9hZFByb21pc2UgPSBhbnN3ZXIuZW5kcG9pbnRQYXlsb2FkUHJvbWlzZS50aGVuKChlbmRwb2ludFBheWxvYWQpID0+IGNoYW5uZWxzLnRoZW4oKHJlc29sdmVkQ2hhbm5lbHMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uZW5kcG9pbnRQYXlsb2FkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0Yzoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydGNDbGllbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxzOiByZXNvbHZlZENoYW5uZWxzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYW5zd2VyLnN1cHBvcnRlZFByb3RvY29scy5wdXNoKHsgdHlwZTogJ2NsYXNzaWMnLCB2ZXJzaW9uOiBzdHJhdGVneV8xLkNsYXNzaWNJbmZvLnZlcnNpb24gfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBhbnN3ZXI7XG4gICAgICAgICAgICB9LCBQcm9taXNlLnJlc29sdmUoY2xpZW50QW5zd2VyKSk7XG4gICAgICAgICAgICAvLyBOZWVkIHRvIGFzIGNhc3QgaGVyZS5cbiAgICAgICAgICAgIGNsaWVudEFuc3dlci5lbmRwb2ludFBheWxvYWRQcm9taXNlLnRoZW4oKGVuZHBvaW50UGF5bG9hZCkgPT4gc3RyYXRlZ3kuYWRkRW5kcG9pbnQoY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCwgZW5kcG9pbnRQYXlsb2FkKSk7XG4gICAgICAgICAgICBhY2tUb1NlbmRlci5wYXlsb2FkLnBheW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XG4gICAgICogZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5vbkNoYW5uZWxDb25uZWN0KGxpc3RlbmVyKTtcbiAgICAgKlxuICAgICAqIC8vIGV4YW1wbGUgc2hhcGVcbiAgICAgKiB7XG4gICAgICogICAgIFwidG9waWNcIjogXCJjaGFubmVsXCIsXG4gICAgICogICAgIFwidHlwZVwiOiBcImNvbm5lY3RlZFwiLFxuICAgICAqICAgICBcInV1aWRcIjogXCJPcGVuZmluUE9DXCIsXG4gICAgICogICAgIFwibmFtZVwiOiBcIk9wZW5maW5QT0NcIixcbiAgICAgKiAgICAgXCJjaGFubmVsTmFtZVwiOiBcImNvdW50ZXJcIixcbiAgICAgKiAgICAgXCJjaGFubmVsSWRcIjogXCJPcGVuZmluUE9DL09wZW5maW5QT0MvY291bnRlclwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgb25DaGFubmVsQ29ubmVjdChsaXN0ZW5lcikge1xuICAgICAgICBhd2FpdCB0aGlzLm9uKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIExpc3RlbiBmb3IgY2hhbm5lbCBkaXNjb25uZWN0aW9ucy5cbiAgICAgKlxuICAgICAqIEBwYXJhbSBsaXN0ZW5lciAtIGNhbGxiYWNrIHRvIGV4ZWN1dGUuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBsaXN0ZW5lciA9IChjaGFubmVsUGF5bG9hZCkgPT4gY29uc29sZS5sb2coY2hhbm5lbFBheWxvYWQpOyAvLyBzZWUgcmV0dXJuIHZhbHVlIGJlbG93XG4gICAgICpcbiAgICAgKiBmaW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLm9uQ2hhbm5lbERpc2Nvbm5lY3QobGlzdGVuZXIpO1xuICAgICAqXG4gICAgICogLy8gZ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XNvbHZlKSA9PiB7XG4gICAgICAgICAgICAgICAgY29ubmVjdGVkTGlzdGVuZXIgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2hhbm5lbE5hbWUgPT09IHBheWxvYWQuY2hhbm5lbE5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUodHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkNyh0aGlzLCBfQ2hhbm5lbF9pbnRlcm5hbEVtaXR0ZXIsIFwiZlwiKS5vbignY29ubmVjdGVkJywgY29ubmVjdGVkTGlzdGVuZXIpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGlmIChyZXRyeUluZm8uY291bnQgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdhaXQgYmVmb3JlIHJldHJ5aW5nXG4gICAgICAgICAgICAgICAgICAgIC8vIERlbGF5IHJldHVybnMgZmFsc2UgY29ubmVjdGVkUHJvbWlzZSByZXR1cm5zIHRydWUgc28gd2UgY2FuIGtub3cgaWYgYSByZXRyeSBpcyBkdWUgdG8gY29ubmVjdGVkIGV2ZW50XG4gICAgICAgICAgICAgICAgICAgIHJldHJ5SW5mby5nb3RDb25uZWN0ZWRFdmVudCA9IGF3YWl0IFByb21pc2UucmFjZShbcmV0cnlEZWxheShyZXRyeUluZm8uY291bnQpLCBjb25uZWN0ZWRQcm9taXNlXSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdjb25uZWN0LXRvLWNoYW5uZWwnLCB7IC4uLmNvbm5lY3RQYXlsb2FkLCByZXRyeUluZm8gfSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIGxvZyBvbmx5IGlmIHRoZXJlIHdhcyBhIHJldHJ5XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGBTdWNjZXNzZnVsbHkgY29ubmVjdGVkIHRvIGNoYW5uZWxOYW1lOiAke2NoYW5uZWxOYW1lfWApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0LnBheWxvYWQuZGF0YTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gU2VuZCByZXRyeUluZm8gdG8gdGhlIGNvcmUgZm9yIGRlYnVnIGxvZyBpbmNsdXNpb25cbiAgICAgICAgICAgICAgICBjb25zdCBzZW50TWVzc2FnZVByb21pc2UgPSB0aGlzLndpcmUuc2VuZEFjdGlvbignY29ubmVjdC10by1jaGFubmVsJywgY29ubmVjdFBheWxvYWQpO1xuICAgICAgICAgICAgICAgIC8vIFNhdmUgbWVzc2FnZUlkIGZyb20gdGhlIGZpcnN0IGNvbm5lY3Rpb24gYXR0ZW1wdFxuICAgICAgICAgICAgICAgIHJldHJ5SW5mby5vcmlnaW5hbE1lc3NhZ2VJZCA9IHNlbnRNZXNzYWdlUHJvbWlzZS5tZXNzYWdlSWQ7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gYXdhaXQgc2VudE1lc3NhZ2VQcm9taXNlO1xuICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQucGF5bG9hZC5kYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFlcnJvci5tZXNzYWdlLmluY2x1ZGVzKCdpbnRlcm5hbC1uYWNrJykpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gTm90IGFuIGludGVybmFsIG5hY2ssIGJyZWFrIHRoZSBsb29wXG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoc2hvdWxkV2FpdCAmJiByZXRyeUluZm8uY291bnQgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gc3RhcnQgd2FpdGluZyBvbiB0aGUgbmV4dCBpdGVyYXRpb24sIHdhcm4gdGhlIHVzZXJcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBObyBjaGFubmVsIGZvdW5kIGZvciBjaGFubmVsTmFtZTogJHtjaGFubmVsTmFtZX0uIFdhaXRpbmcgZm9yIGNvbm5lY3Rpb24uLi5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICByZXRyeUluZm8uY291bnQgKz0gMTtcbiAgICAgICAgICAgICAgICAvLyBpbiBjYXNlIG9mIG90aGVyIGVycm9ycywgcmVtb3ZlIG91ciBsaXN0ZW5lclxuICAgICAgICAgICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkNyh0aGlzLCBfQ2hhbm5lbF9pbnRlcm5hbEVtaXR0ZXIsIFwiZlwiKS5yZW1vdmVMaXN0ZW5lcignY29ubmVjdGVkJywgY29ubmVjdGVkTGlzdGVuZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IHdoaWxlIChzaG91bGRXYWl0KTsgLy8gSWYgd2UncmUgd2FpdGluZyB3ZSByZXRyeSB0aGUgYWJvdmUgbG9vcFxuICAgICAgICAvLyBTaG91bGQgd2FpdCB3YXMgZmFsc2UsIG5vIGNoYW5uZWwgd2FzIGZvdW5kLlxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYE5vIGNoYW5uZWwgZm91bmQgZm9yIGNoYW5uZWxOYW1lOiAke2NoYW5uZWxOYW1lfS5gKTtcbiAgICAgICAgLyogZXNsaW50LWVuYWJsZSBuby1hd2FpdC1pbi1sb29wLCBuby1jb25zdGFudC1jb25kaXRpb24gKi9cbiAgICB9XG4gICAgLyoqXG4gICAgICogQ29ubmVjdCB0byBhIGNoYW5uZWwuIElmIH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Rpb24gdG8gdGhlIHByb3ZpZGVyLlxuICAgICAgICAvLyBJZiB0aGUgZW5kcG9pbnQgZGllcywgdGhlIGNsaWVudCB3aWxsIGZvcmNlIGEgZGlzY29ubmVjdGlvbiB0aHJvdWdoIHRoZSBjb3JlLlxuICAgICAgICAvLyBUaGUgcHJvdmlkZXIgZG9lcyBub3QgY2FyZSBhYm91dCBlbmRwb2ludCBkaXNjb25uZWN0aW9uLlxuICAgICAgICBzdHJhdGVneS5vbkVuZHBvaW50RGlzY29ubmVjdChyb3V0aW5nSW5mby5jaGFubmVsSWQsIGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgY2hhbm5lbC5zZW5kRGlzY29ubmVjdEFjdGlvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBTb21ldGhpbmcgd2VudCB3cm9uZyBkdXJpbmcgZGlzY29ubmVjdCBmb3IgY2xpZW50IHdpdGggdXVpZDogJHtyb3V0aW5nSW5mby51dWlkfSAvIG5hbWU6ICR7cm91dGluZ0luZm8ubmFtZX0gLyBlbmRwb2ludElkOiAke3JvdXRpbmdJbmZvLmVuZHBvaW50SWR9LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7XG4gICAgICAgICAgICAgICAgY2xpZW50XzEuQ2hhbm5lbENsaWVudC5oYW5kbGVQcm92aWRlckRpc2Nvbm5lY3Qocm91dGluZ0luZm8pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGNoYW5uZWw7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIENyZWF0ZSBhIG5ldyBjaGFubmVsLlxuICAgICAqIFlvdSBtdXN0IHByb3ZpZGUgYSB1bmlxdWUgY2hhbm5lbE5hbWUuIElmIGEgY2hhbm5lbE5hbWUgaXMgbm90IH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0sICdmb28nLCBsaXN0ZW5lcilcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICB1bnN1YnNjcmliZShzb3VyY2UsIHRvcGljLCBsaXN0ZW5lcikge1xuICAgICAgICBjb25zdCBzb3VyY2VXaW5kb3dOYW1lID0gc291cmNlLm5hbWUgfHwgJyonO1xuICAgICAgICBjb25zdCBzdWJLZXkgPSB0aGlzLmNyZWF0ZVN1YnNjcmlwdGlvbktleShzb3VyY2UudXVpZCwgc291cmNlV2luZG93TmFtZSwgdG9waWMpO1xuICAgICAgICBjb25zdCBzZW5kVW5zdWJzY3JpcHRpb24gPSAoKSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3Vuc3Vic2NyaWJlJywge1xuICAgICAgICAgICAgICAgIHNvdXJjZVV1aWQ6IHNvdXJjZS51dWlkLFxuICAgICAgICAgICAgICAgIHNvdXJjZVdpbmRvd05hbWUsXG4gICAgICAgICAgICAgICAgdG9waWMsXG4gICAgICAgICAgICAgICAgZGVzdGluYXRpb25XaW5kb3dOYW1lOiB0aGlzLm1lLm5hbWVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICBjb25zdCBkb250U2VuZFVuc3Vic2NyaXB0aW9uID0gKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyKSA9PiByKS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuZW1pdHRlci5yZW1vdmVMaXN0ZW5lcihzdWJLZXksIGxpc3RlbmVyKTtcbiAgICAgICAgcmV0dXJuIHRoaXMucmVmQ291bnRlci5hY3RPbkxhc3Qoc3ViS2V5LCBzZW5kVW5zdWJzY3JpcHRpb24sIGRvbnRTZW5kVW5zdWJzY3JpcHRpb24pO1xuICAgIH1cbiAgICBwcm9jZXNzTWVzc2FnZShtZXNzYWdlKSB7XG4gICAgICAgIGNvbnN0IHsgcG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1hbmRPckNvbnRyb2wrUGx1c2BcbiAgICAgKiAqIGBDb21tYW5kT3JDb250cm9sKy1gXG4gICAgICogKiBgQ29tbWFuZE9yQ29udHJvbCtfYFxuICAgICAqICogYENvbW1hbmRPckNvbnRyb2wrU2hpZnQrSWBcbiAgICAgKiAqIGBGNWBcbiAgICAgKiAqIGBDb21tYW5kT3JDb250cm9sK1JgXG4gICAgICogKiBgU2hpZnQrRjVgXG4gICAgICogKiBgQ29tbWFuZE9yQ29udHJvbCtTaGlmdCtSYFxuICAgICAqXG4gICAgICogUmFpc2VzIHRoZSBgcmVnaXN0ZXJlZGAgZXZlbnQuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgaG90a2V5ID0gJ0NvbW1hbmRPckNvbnRyb2wrWCc7XG4gICAgICpcbiAgICAgKiBmaW4uR2xvYmFsSG90a2V5LnJlZ2lzdGVyKGhvdGtleSwgKCkgPT4ge1xuICAgICAqIGNvbnNvbGUubG9nKGAke2hvdGtleX0gcHJlc3NlZGApO1xuICAgICAqIH0pXG4gICAgICogLnRoZW4oKCkgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZygnU3VjY2VzcycpO1xuICAgICAqIH0pXG4gICAgICogLmNhdGNoKGVyciA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdFcnJvciByZWdpc3RlcmluZyB0aGUgaG90a2V5JywgZXJyKTtcbiAgICAgKiB9KTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyByZWdpc3Rlcihob3RrZXksIGxpc3RlbmVyKSB7XG4gICAgICAgIC8vIFRPRE86IGZpeCB0eXBpbmcgKGhvdGtleSBldmVudHMgYXJlIG5vdCB0eXBlZClcbiAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICBhd2FpdCB0aGlzLm9uKGhvdGtleSwgbGlzdGVuZXIpO1xuICAgICAgICBhd2FpdCB0aGlzLndpcmU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gY2xpZW50ID0gYXdhaXQgdGhpcy5fY2hhbm5lbC5jb25uZWN0KGNoYW5uZWxOYW1lLCB7IHdhaXQ6IGZhbHNlIH0pO1xuICAgICAgICAgICAgICAgIGNsaWVudC5vbkRpc2Nvbm5lY3Rpb24oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjbGllbnRNYXAuZGVsZXRlKHV1aWQpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJldHVybiBjbGllbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGNsaWVudE1hcC5kZWxldGUodXVpZCk7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdUaGUgdGFyZ2V0ZWQgUGxhdGZvcm0gaXMgbm90IGN1cnJlbnRseSBydW5uaW5nLiBMaXN0ZW4gZm9yIGFwcGxpY2F0aW9uLXN0YXJ0ZWQgZXZlbnQgZm9yIHRoZSBnaXZlbiBVdWlkLicpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBkZXByZWNhdGVkIChyZW5hbWVkKVxuICAgICAgICAgKiBAaWdub3JlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmxhdW5jaExlZ2FjeU1hbmlmZXN0ID0gdGhpcy5sYXVuY2hDb250ZW50TWFuaWZlc3Q7XG4gICAgICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEkMS52YWxpZGF0ZUlkZW50aXR5KShpZGVudGl0eSk7XG4gICAgICAgIGlmIChlcnJvck1zZykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yTXNnKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9jaGFubmVsID0gY2hhbm5lbDtcbiAgICAgICAgdGhpcy5pZGVudGl0eSA9IHsgdXVpZDogaWRlbnRpdHkudXVpZCB9O1xuICAg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F93aW5cIixcbiAgICAgKiAgICAgbGF5b3V0OiB7XG4gICAgICogICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAqICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd5YWhvb192aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly95YWhvby5jb20nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgXVxuICAgICAqICAgICB9XG4gICAgICogfSkudGhlbihjb25zb2xlLmxvZyk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgY3JlYXRlVmlldyh2aWV3T3B0aW9ucywgdGFyZ2V0LCB0YXJnZXRWaWV3KSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdwbGF0Zm9ybS1jcmVhdGUtdmlldycsIHRoaXMuaWRlbnRpdHkpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IHRoaXMuZ2V0Q2xpZW50KCk7XG4gICAgICAgIGNvbnN0IHJlc3BvbnNlID0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9tYXRpY2FsbHkgcmVuZGVyIHRoZSBXaW5kb3cncyBsYXlvdXQgaWYgb25lIGlzIHNwZWNpZmllZC5cbiAgICAgKlxuICAgICAqIEZvciBkZWVwZXIgY3VzdG9taXphdGlvbiwgeW91IGNhbiBicmluZyB5b3VyIG93biBXaW5kb3cgY29kZSBpbnRvIGEgUGxhdGZvcm0uIFRoaXMgaXMgY2FsbGVkIGEgQ3VzdG9tIFdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKlxuICAgICAqIFRoZSBleGFtcGxlIGJlbG93IHdpbGwgY3JlYXRlIGEgRGVmYXVsdCBXaW5kb3cgd2hpY2ggdXNlcyBPcGVuRmluIGRlZmF1bHQgV2luZG93IFVJLjxicj5cbiAgICAgKiBUaGUgV2luZG93IGNvbnRhaW5zIHR3byBWaWV3cyBpbiBhIHN0YWNrIExheW91dDpcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcGxhdGZvcm0gPSBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKiBwbGF0Zm9ybS5jcmVhdGVXaW5kb3coe1xuICAgICAqICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18xJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWwnXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18yJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWwnXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgXVxuICAgICAqICAgICB9XG4gICAgICogfSkudGhlbihjb25zb2xlLmxvZyk7XG4gICAgICogYGBgXG4gICAgICogVGhlIERlZmF1bHQgV2luZG93J3MgZGVzaWduIGNhbiBiZSBjdXN0b21pemVkIGJ5IHNwZWNpZnlpbmcgdGhlIGBzdHlsZXNoZWV0VXJsYCBwcm9wZXJ0eSBpbiB0aGUgbWFuaWZlc3Q6XG4gICAgICpcbiAgICAgKiBgYGBqc29uXG4gICAgICoge1xuICAgICAqICAgICBwbGF0Zm9ybToge1xuICAgICAqIC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2luZG93Q29uZmlnID1cbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICB1cmw6IFwiaHR0cHM6Ly93d3cubXktZG9tYWluLmNvbS9teS1jdXN0b20td2luZG93Lmh0bWxcIiwgLy8gaGVyZSB3ZSBwb2ludCB0byB3aGVyZSB0aGUgQ3VzdG9tIEZyYW1lIGlzIGhvc3RlZC5cbiAgICAgKiAgICAgICAgICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwic3RhY2tcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwiY29tcG9uZW50XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiBcInZpZXdcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogXCJhcHAgIzFcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvY2FuYXJ5L1BsYXRmb3JtLmh0bWxcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBcImNvbXBvbmVudFwiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogXCJ2aWV3XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFwiYXBwICMyXCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcImh0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L2NhbmFyeS9QbGF0Zm9ybS5odG1sXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH07XG4gICAgICogICAgIHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh3aW5kb3dDb25maWcpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogSGVyZSdzIGFuIGV4YW1wbGUgb2YgYSBtaW5pbWFsaXN0IEN1c3RvbSBQbGF0Zm9ybSBXaW5kb3cgaW1wbGVtZW50YXRpb246XG4gICAgICogYGBgaHRtbFxuICAgICAqIDxodG1sPlxuICAgICAqICAgICA8aGVhZD5cbiAgICAgKiAgICAgICAgIDxtZXRhIGNoYXJzZXQ9XCJ1dGYtOFwiPlxuICAgICAqICAgICAgICAgPG1ldGEgbmFtZT1cInZpZXdwb3J0XCIgY29udGVudD1cIndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xXCI+XG4gICAgICogICAgICAgICA8bGluayByZWw9XCJzdHlsZXNoZWV0XCIgdHlwZT1cInRleHQvY3NzXCIgaHJlZj1cIi4vc3R5bGVzLmNzc1wiPlxuICAgICAqICAgICA8L2hlYWQ+XG4gICAgICogICAgIDxib2R5PlxuICAgICAqICAgICAgICAgPGRpdiBpZD1cIm9mLWZyYW1lLW1haW5cIj5cbiAgICAgKiAgICAgICAgICAgICA8ZGl2IGlkPVwidGl0bGUtYmFyXCI+XG4gICAgICogICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0aXRsZS1iYXItZHJhZ2dhYmxlXCI+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwidGl0bGVcIj4gVGhpcyBpcyBhIGN1c3RvbSBmcmFtZSEgPC9kaXY+XG4gICAgICogICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAqICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwiYnV0dG9ucy13cmFwcGVyXCI+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiYnV0dG9uXCIgaWQ9XCJtaW5pbWl6ZS1idXR0b25cIj48L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJidXR0b25cIiBpZD1cImV4cGFuZC1idXR0b25cIj48L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJidXR0b25cIiBpZD1cImNsb3NlLWJ1dHRvblwiPjwvZGl2PlxuICAgICAqICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICA8ZGl2IGlkPVwibGF5b3V0LWNvbnRhaW5lclwiPjwvZGl2PiA8IS0tIE9wZW5GaW4gbGF5b3V0IHdvdWxkIGJlIGluamVjdGVkIGhlcmUgLS0+XG4gICAgICogICAgICAgICAgICAgPHNjcmlwdCBzcmM9XCIuL2N1c3RvbS1mcmFtZS5qc1wiPjwvc2NyaXB0PlxuICAgICAqICAgIC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AgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NvbXBvbmVudF9YJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3d3dy5vcGVuZmluLmNvJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NvbXBvbmVudF9ZJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2VtYmVkLXdlYi9jaGFydC5odG1sJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICBdXG4gICAgICogfVxuICAgICAqXG4gICAgICogcGxhdGZvcm0uYXBwbHlTbmFwc2hvdChzbmFwc2hvdCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBJbiBwbGFjZSBvZiBhIHNuYXBzaG90IG9iamVjdCwgYGFwcGx5U25hcHNob3RgIGNhbiB0YWtlIGEgdXJsIG9yIGZpbGVwYXRoIGFuZCB0byByZXRyaWV2ZSBhIEpTT04gc25hcHNob3QuXG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKiBwbGF0Zm9ybS5hcHBseVNuYXBzaG90KCdodHRwczovL2FwaS5qc29uYmluLmlvL2IvNWU2ZjkwM2VmNDMzMWU2ODFmYzEyMzFkLzEnKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIE9wdGlvbmFsbHksIGBhcHBseVNuYXBzaG90YCBjYW4gY2xvc2UgZXhpc3Rpbmcgd2luZG93cyBhbmQgcmVzdG9yZSBhIFBsYXRmb3JtIHRvIGEgcHJldmlvdXNseSBzYXZlZCBzdGF0ZS5cbiAgICAgKiBUaGlzIGlzIGFjY29tcGxpc2hlZCBieSBwcm92aWRpbmcgYHsgY2xvc2VFeGlzdGluZ1dpbmRvd3M6IHRydWUgfWAgYXMgYW4gb3B0aW9uLlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiAvLyBHZXQgYSB3cmFwcGVkIGxheW91dCBwbGF0Zm9ybSBpbnN0YW5jZVxuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGFkZFZpZXdUb1dpbmRvdyh3aW5JZCkge1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgcGxhdGZvcm0uY3JlYXRlVmlldyh7XG4gICAgICogICAgICAgICBuYW1lOiAndGVzdF92aWV3XzMnLFxuICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9vcGVuZmluLmNvJ1xuICAgICAqICAgICB9LCB3aW5JZCk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luZG93V2l0aFR3b1ZpZXdzKCkge1xuICAgICAqICAgICBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50KCk7XG4gICAgICpcbiAgICAgKiAgICAgcmV0dXJuIHBsYXRmb3JtLmNyZWF0ZVdpbmRvdyh7XG4gICAgICogICAgICAgICBsYXlvdXQ6IHtcbiAgICAgKiAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdGFjaycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnY29tcG9uZW50JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Rlc3Rfdmlld18xJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vZXhhbXBsZS5jb20nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0ZXN0X3ZpZXdfMicsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3lhaG9vLmNvbSdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogY29uc3Qgd2luID0gYXdhaXQgY3JlYXRlV2luZG93V2l0aFR3b1ZpZXdzKCk7XG4gICAgICogLy8gLi4uIHlvdSB3aWxsIG5vdyBzZWUgYSBuZXcgd2luZG93IHdpdGggdHdvIHZpZXdzIGluIGl0XG4gICAgICpcbiAgICAgKiAvLyB3ZSB0YWtlIGEgc25hcHNob3Qgb2YgdGhlIGN1cnJlbnQgc3RhdGUgb2YgdGhlIGFwcCwgYmVmb3JlI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gJ3N0cmluZycpIHtcbiAgICAgICAgICAgIC8vIEZldGNoIGFuZCBwYXJzZSBzbmFwc2hvdFxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHRoaXMuX2NoYW5uZWwud2lyZS5zZW5kQWN0aW9uKCdnZXQtYXBwbGljYXRpb24tbWFuaWZlc3QnLCB7XG4gICAgICAgICAgICAgICAgICAgIG1hbmlmZXN0VXJsOiByZXF1ZXN0ZWRTbmFwc2hvdFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHNuYXBzaG90ID0gcmVzcG9uc2UucGF5bG9hZC5kYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgJHtlcnJNc2d9OiAke2Vycn1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHNuYXBzaG90ID0gcmVxdWVzdGVkU25hcHNob3Q7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFzbmFwc2hvdC53aW5kb3dzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyTXNnKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLmdldENsaWVudCgpO1xuICAgICAgICBhd2FpdCBjbGllbnQuZGlzcGF0Y2goJ2FwcGx5LXNuYXBzaG90Jywge1xuICAgICAgICAgICAgc25hcHNob3QsXG4gICAgICAgICAgICBvcHRpb25zXG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICB9XG4gICAgLyoqXG4gICAgICogRmV0Y2hlcyBhIEpTT04gbWFuaWZlc3QgdXNpbmcgdGhlIGJyb3dzZXIgcHJvY2VzcyBhbmQgcmV0dXJucyBhIEphdmFzY3JpcHQgb2JqZWN0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5MYXp5KGFzeW5jICgpID0+IGxheW91dF9lbnRpdGllc18xLkxheW91dE5vZGUubmV3TGF5b3V0RW50aXRpZXNDbGllbnQoYXdhaXQgdGhpcy5wbGF0Zm9ybS5nZXRDbGllbnQoKSwgbGF5b3V0X2NvbnN0YW50c18xJDEuTEFZT1VUX0NPTlRST0xMRVJfSUQsIHRoaXMuaWRlbnRpdHkpKSk7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXBsYWNlcyBhIFBsYXRmb3JtIHdpbmRvdydzIGxheW91dCB3aXRoIGEgbmV3IGxheW91dC5cbiAgICAgICAgICpcbiAgICAgICAgICogQHJlbWFya3MgQW55IHZpZXdzIHRoYXQgd2VyZSBpbiB0aGUgb2xkIGxheW91dCBidXQgbm90IHRoZSBuZXcgbGF5b3V0IHdpbGwgYmUgZGVzdHJveWVkLiBWaWV3cyB3aWxsIGJlIGFzc2lnbmVkIGEgcmFuZG9tbHkgZ2VuZXJhdGVkIG5hbWUgdG8gYXZvaWQgY29sbGlzaW9ucy5cbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogbGV0IHdpbmRvd0lkZW50aXR5O1xuICAgICAgICAgKiBpZiAoZmluLm1lLmlzV2luZG93KSB7XG4gICAgICAgICAqICAgICB3aW5kb3dJZGVudGl0eSA9IGZpbi5tZS5pZGVudGl0eTtcbiAgICAgICAgICogfSBlbHNlIGlmIChmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB3aW5kb3dJZGVudGl0eSA9IChhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFdpbmRvdygpKS5pZGVudGl0eTtcbiAgICAgICAgICogfSBlbHNlIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3IG9yIFdpbmRvdycpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IGxheW91dCA9IGZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcFN5bmMod2luZG93SWRlbnRpdHkpO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBuZXdMYXlvdXQgPSB7XG4gICAgICAgICAqICAgICBjb250ZW50OiBbXG4gICAgICAgICAqICAgICAgICAge1xuICAgICAgICAgKiAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAgICAgKiAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICAgICAqICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICduZXdfY29tcG9uZW50X0ExJyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0FmZmluaXR5OiAncHNfMScsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3LmV4YW1wbGUuY29tJ1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICogICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAqICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICduZXdfY29tcG9uZW50X0EyJyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9lbWJlZC13ZWIvY2hhcnQuaHRtbCdcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAqICAgICAgICAgICAgIF1cbiAgICAgICAgICogICAgICAgICB9XG4gICAgICAgICAqICAgICBdXG4gICAgICAgICAqIH07XG4gICAgICAgICAqXG4gICAgICAgICAqIGxheW91dC5yZXBsYWNlKG5ld0xheW91dCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5yZXBsYWNlID0gYXN5bmMgKGxheW91dCkgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1yZXBsYWNlJykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgdGhpcy5wbGF0Zm9ybS5nZXRDbGllbnQoKTtcbiAgICAgICAgICAgIGF3YWl0IGNsaWVudC5kaXNwYXRjaCgncmVwbGFjZS1sYXlvdXQnLCB7XG4gICAgICAgICAgICAgICAgdGFyZ2V0OiB0aGlzLmlkZW50aXR5LFxuICAgICAgICAgICAgICAgIG9wdHM6IHsgbGF5b3V0IH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICAvKipcbiAgICAgICAgICogUmVwbGFjZXMgdGhlIHNwZWNpZmllZCB2aWV3IHdpdGggYSB2aWV3IHdpdGggdGhlIHByb3ZpZGVkIGNvbmZpZ3VyYXRpb24uXG4gICAgICAgICAqXG4gICAgICAgICAqIEByZW1hcmtzIFRoZSBvbGQgdmlldyBpcyBzdHJpcHBlZCBvZiBpdHMgbGlzdGVuZXJzIGFuZCBlaXRoZXIgY2xvc2VkIG9yIGF0dGFjaGVkIHRvIHRoZSBwcm92aWRlciB3aW5kb3dcbiAgICAgICAgICogZGVwZW5kaW5nIG9uIGBkZXRhY2hPbkNsb3NlYCB2aWV3IG9wdGlvbi5cbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIHZpZXdUb1JlcGxhY2UgSWRlbnRpdHkgb2YgdGhlIHZpZXcgdG8gYmUgcmVwbGFjZWRcbiAgICAgICAgICogQHBhcmFtIG5ld1ZpZXcgQ3JlYXRpb24gb3B0aW9ucyBvZiB0aGUgbmV3IHZpZXcuXG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGxldCBjdXJyZW50V2luZG93O1xuICAgICAgICAgKiBpZiAoZmluLm1lLmlzV2luZG93KSB7XG4gICAgICAgICAqICAgICBjdXJyZW50V2luZG93ID0gZmluLm1lO1xuICAgICAgICAgKiB9IGVsc2UgaWYgKGZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIGN1cnJlbnRXaW5kb3cgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFdpbmRvdygpO1xuICAgICAgICAgKiB9IGVsc2Uge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcgb3IgV2luZG93Jyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gZmluLlBsYXRmb3JtLkxheW91dC53cmFwU3luYyhjdXJyZW50V2luZG93LmlkZW50aXR5KTtcbiAgICAgICAgICogY29uc3Qgdmlld1RvUmVwbGFjZSA9IChhd2FpdCBjdXJyZW50V2luZG93LmdldEN1cnJlbnRWaWV3cygpKVswXTtcbiAgICAgICAgICogY29uc3QgbmV3Vmlld0NvbmZpZyA9IHt1cmw6ICdodHRwczovL2V4YW1wbGUuY29tJ307XG4gICAgICAg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uZ2VtZW50IHRvIHVzZS5cbiAgICAgICAgICogVGhlIHByZXNldCBvcHRpb25zIGFyZSBgY29sdW1uc2AsIGBncmlkYCwgYHJvd3NgLCBhbmQgYHRhYnNgLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBsZXQgd2luZG93SWRlbnRpdHk7XG4gICAgICAgICAqIGlmIChmaW4ubWUuaXNXaW5kb3cpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gZmluLm1lLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2UgaWYgKGZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gKGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50V2luZG93KCkpLmlkZW50aXR5O1xuICAgICAgICAgKiB9IGVsc2Uge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcgb3IgV2luZG93Jyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gZmluLlBsYXRmb3JtLkxheW91dC53cmFwU3luYyh3aW5kb3dJZGVudGl0eSk7XG4gICAgICAgICAqIGF3YWl0IGxheW91dC5hcHBseVByZXNldCh7IHByZXNldFR5cGU6ICdncmlkJyB9KTtcbiAgICAgICAgICpcbiAgICAgICAgICogLy8gd2FpdCA1IHNlY29uZHMgdW50aWwgeW91IGNoYW5nZSB0aGUgbGF5b3V0IGZyb20gZ3JpZCB0byB0YWJzXG4gICAgICAgICAqIGF3YWl0IG5ldyBQcm9taXNlIChyZXMgPT4gc2V0VGltZW91dChyZXMsIDUwMDApKTtcbiAgICAgICAgICogYXdhaXQgbGF5b3V0LmFwcGx5UHJlc2V0KHsgcHJlc2V0VHlwZTogJ3RhYnMnIH0pO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuYXBwbHlQcmVzZXQgPSBhc3luYyAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1hcHBseS1wcmVzZXQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLnBsYXRmb3JtLmdldENsaWVudCgpO1xuICAgICAgICAgICAgY29uc3QgeyBwcmVzZXRUeXBlIH0gPSBvcHRpb25zO1xuICAgICAgICAgICAgaWYgKCFwcmVzZXRUeXBlIHx8ICEoMCwgY29tbW9uX3V0aWxzXzEuaXNWYWxpZFByZXNldFR5cGUpKHByZXNldFR5cGUpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgYXBwbHkgcHJlc2V0IGxheW91dCwgcGxlYXNlIGluY2x1ZGUgYW4gYXBwbGljYWJsZSBwcmVzZXRUeXBlIHByb3BlcnR5IGluIHRoZSBQcmVzZXRMYXlvdXRPcHRpb25zLicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdhcHBseS1wcmVzZXQtbGF5b3V0Jywge1xuICAgICAgICAgICAgICAgIHRhcmdldDogdGhpcy5pZGVudGl0eSxcbiAgICAgICAgICAgICAgICBvcHRzOiB7IHByZXNldFR5cGUgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGVycm9yTXNnID0gKDAsIHZhbGlkYXRlXzEudmFsaWRhdGVJZGVudGl0eSkoaWRlbnRpdHkpO1xuICAgICAgICBpZiAoZXJyb3JNc2cpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlcnJvck1zZyk7XG4gICAgICAgIH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RhaW5lcklkID0gJ215LWN1c3RvbS1jb250YWluZXItaWQnO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBteUxheW91dENvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGNvbnRhaW5lcklkKTtcbiAgICAgICAgICpcbiAgICAgICAgICogbXlMYXlvdXRDb250YWluZXIuYWRkRXZlbnRMaXN0ZW5lcigndGFiLWNyZWF0ZWQnLCBmdW5jdGlvbihldmVudCkge1xuICAgICAgICAgKiAgICAgY29uc3QgeyB0YWJTZWxlY3RvciB9ID0gZXZlbnQuZGV0YWlsO1xuICAgICAgICAgKiAgICAgY29uc3QgdGFiRWxlbWVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRhYlNlbGVjdG9yKTtcbiAgICAgICAgICogICAgIGNvbnN0IGV4aXN0aW5nQ29sb3IgPSB0YWJFbGVtZW50LnN0eWxlLmJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICogICAgIHRhYkVsZW1lbnQuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gXCJyZWRcIjtcbiAgICAgICAgICogICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgKiAgICAgICAgIHRhYkVsZW1lbnQuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gZXhpc3RpbmdDb2xvcjtcbiAgICAgICAgICogICAgIH0sIDIwMDApO1xuICAgICAgICAgKiB9KTtcbiAgICAgICAgICpcbiAgICAgICAgICogLy8gaW5pdGlhbGl6ZSB0aGUgbGF5b3V0IGludG8gYW4gZXhpc3RpbmcgSFRNTCBlbGVtZW50IHdpdGggdGhlIGRpdiBgbXktY3VzdG9tLWNvbnRhaW5lci1pZGBcbiAgICAgICAgICogLy8gdGhlIHdpbmRvdyBtdXN0IGhhdmUgYmVlbiBjcmVhdGVkIHdpdGggYSBsYXlvdXQgaW4gaXRzIHdpbmRvdyBvcHRpb25zXG4gICAgICAgICAqIGNvbnN0IGxheW91dCA9IG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dHk7XG4gICAgICogfSBlbHNlIGlmIChmaW4ubWUuaXNWaWV3KSB7XG4gICAgICogICAgIHdpbmRvd0lkZW50aXR5ID0gKGF3YWl0IGZpbi5tZS5nZXRDdXJyZW50V2luZG93KCkpLmlkZW50aXR5O1xuICAgICAqIH0gZWxzZSB7XG4gICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3IG9yIFdpbmRvdycpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGNvbnN0IGxheW91dCA9IGZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcFN5bmMod2luZG93SWRlbnRpdHkpO1xuICAgICAqIC8vIFVzZSB3cmFwcGVkIGluc3RhbmNlIHRvIGNvbnRyb2wgbGF5b3V0LCBlLmcuOlxuICAgICAqIGNvbnN0IGxheW91dENvbmZpZyA9IGF3YWl0IGxheW91dC5nZXRDb25maWcoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICB3cmFwU3luYyhpZGVudGl0eSkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LXdyYXAtc3luYycpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBuZXcgSW5zdGFuY2VfMSQyLkxheW91dChpZGVudGl0eSwgdGhpcy53aXJlKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQXN5bmNocm9ub3VzbHkgcmV0dXJucyBhIExheW91dCBvYmplY3QgdGhhdCByZXByZXNlbnRzIGEgV2luZG93J3MgbGF5b3V0LlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IGxheW91dCA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5MYXlvdXQuZ2V0Q3VycmVudCgpO1xuICAgICAqIC8vIFVzZSB3cmFwcGVkIGluc3Rh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gICBjb25zdCBwbGF0Zm9ybSA9IGF3YWl0IGZpbi5QbGF0Zm9ybS5zdGFydCh7XG4gICAgICogICAgICAgICB1dWlkOiAncGxhdGZvcm0tMScsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogZmFsc2UsXG4gICAgICogICAgICAgICBkZWZhdWx0V2luZG93T3B0aW9uczoge1xuICAgICAqICAgICAgICAgICAgIHN0eWxlc2hlZXRVcmw6ICdjc3Mtc2hlZXQtdXJsJyxcbiAgICAgKiAgICAgICAgICAgICBjb3JuZXJSb3VuZGluZzoge1xuICAgICAqICAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwLFxuICAgICAqICAgICAgICAgICAgICAgICB3aWR0aDogMTBcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0pO1xuICAgICAqICAgICBjb25zb2xlLmxvZygnUGxhdGZvcm0gaXMgcnVubmluZycsIHBsYXRmb3JtKTtcbiAgICAgKiB9IGNhdGNoKGUpIHtcbiAgICAgKiAgICAgY29uc29sZS5lcnJvcihlKTtcbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgc3RhcnQocGxhdGZvcm1PcHRpb25zKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdwbGF0Zm9ybS1zdGFydCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1hc3luYy1wcm9taXNlLWV4ZWN1dG9yXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShhc3luYyAocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHsgdXVpZCB9ID0gcGxhdGZvcm1PcHRpb25zO1xuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJy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NyaXB0b3I6IGhhbmRsZSxcbiAgICAgICAgZ2V0UHJvdG90eXBlT2Y6IGhhbmRsZSxcbiAgICAgICAgaGFzOiBoYW5kbGUsXG4gICAgICAgIGlzRXh0ZW5zaWJsZTogaGFuZGxlLFxuICAgICAgICBvd25LZXlzOiBoYW5kbGUsXG4gICAgICAgIHByZXZlbnRFeHRlbnNpb25zOiBoYW5kbGUsXG4gICAgICAgIHNldDogaGFuZGxlLFxuICAgICAgICBzZXRQcm90b3R5cGVPZjogaGFuZGxlXG4gICAgfSk7XG59XG5pbmFjY2Vzc2libGVPYmplY3QuY3JlYXRlVW51c2FibGVPYmplY3QgPSBjcmVhdGVVbnVzYWJsZU9iamVjdDtcbmZ1bmN0aW9uIGNyZWF0ZVdhcm5pbmdPYmplY3QobWVzc2FnZSwgb2JqKSB7XG4gICAgcmV0dXJuIG5ldyBQcm94eShvYmosIHtcbiAgICAgICAgZ2V0OiAoLi4uYXJncykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihtZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LmdldCguLi5hcmdzKTtcbiAgICAgICAgfSxcbiAgICAgICAgc2V0OiAoLi4uYXJncykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihtZXNzYWdlKTtcbiAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LnNldCguLi5hcmdzKTtcbiAgICAgICAgfSxcbiAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOiAoLi4uYXJncykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihtZXNzY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IGNvbnRleHQpO1xuXHQgICAgICAgIHRoaXMubGFzdENvbnRleHQgPSBjb250ZXh0O1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN1YnNjcmlwdGlvblN0YXRlcyA9IEFycmF5LmZyb20odGhpcy5jbGllbnRzLnZhbHVlcygpKTtcblx0ICAgICAgICBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZXMuZm9yRWFjaCgoY2xpZW50KSA9PiB7XG5cdCAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby11bnVzZWQtZXhwcmVzc2lvbnNcblx0ICAgICAgICAgICAgY2xpZW50LmNvbnRleHRIYW5kbGVycy5nZXQoY29udGV4dC50eXBlKT8uZm9yRWFjaCgoaGFuZGxlcklkKSA9PiB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudC5jbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGlmIChjbGllbnQuZ2xvYmFsSGFuZGxlcikge1xuXHQgICAgICAgICAgICAgICAgdGhpcy5wcm92aWRlci5kaXNwYXRjaChjbGllbnQuY2xpZW50SWRlbnRpdHksIGNsaWVudC5nbG9iYWxIYW5kbGVyLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgZ2V0Q2xpZW50U3RhdGUoaWQpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy5jbGllbnRzLmdldChpZC5lbmRwb2ludElkKTtcblx0ICAgIH1cblx0ICAgIGFzeW5jIGhhbmRsZXJBZGRlZChwYXlsb2FkLCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IHsgaGFuZGxlcklkLCBjb250ZXh0VHlwZSB9ID0gcGF5bG9hZDtcblx0ICAgICAgICBjb25zdCBjbGllbnRTdWJzY3Jpc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2hQcm9taXNlcyA9IFsuLi50aGlzLmNvbnRleHRHcm91cE1hcC5rZXlzKCldLm1hcChhc3luYyAoY3VycmVudENvbnRleHRUeXBlKSA9PiB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBjdXJyZW50Q29udGV4dCA9IHRoaXMuY29udGV4dEdyb3VwTWFwLmdldChjdXJyZW50Q29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRDb250ZXh0KSB7XG5cdCAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5wcm92aWRlci5kaXNwYXRjaChjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjdXJyZW50Q29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICBhd2FpdCBQcm9taXNlLmFsbChnbG9iYWxEaXNwYXRjaFByb21pc2VzKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICBoYW5kbGVyUmVtb3ZlZChwYXlsb2FkLCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IHsgaGFuZGxlcklkIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudCA9IHRoaXMuY2xpZW50cy5nZXQoY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCk7XG5cdCAgICAgICAgaWYgKGNsaWVudCkge1xuXHQgICAgICAgICAgICBBcnJheS5mcm9tKGNsaWVudC5jb250ZXh0SGFuZGxlcnMpLmZvckVhY2goKFssIGhhbmRsZXJzXSkgPT4ge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgaW5kZXggPSBoYW5kbGVycy5pbmRleE9mKGhhbmRsZXJJZCk7XG5cdCAgICAgICAgICAgICAgICBpZiAoaW5kZXggPiAtMSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGhhbmRsZXJzLnNwbGljZShpbmRleCwgMSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICBpZiAoY2xpZW50Lmdsb2JhbEhhbmRsZXIgPT09IGhhbmRsZXJJZCkge1xuXHQgICAgICAgICAgICAgICAgY2xpZW50Lmdsb2JhbEhhbmRsZXIgPSB1bmRlZmluZWQ7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNvbnNvbGUud2FybihgVHJ5aW5nIHRvIHJlbW92ZSBhIGhhbmRsZXIgZnJvbSBhIGNsaWVudCB0aGF0IGlzbid0IG1hcHBlZC4gaGFuZGxlcklkOiAke2hhbmRsZXJJZH0uIGNsaWVudElkZW50aXR5OiAke2NsaWVudElkZW50aXR5fWApO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIHJlZ2lzdGVyTmV3Q2xpZW50KGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgaWYgKCF0aGlzLmNsaWVudHMuaGFzKGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQpKSB7XG5cdCAgICAgICAgICAgIGNvbnN0IGNsaWVudFN1YnNjcmlwdGlvblN0YXRlID0ge1xuXHQgICAgICAgICAgICAgICAgY29udGV4dEhhbmRsZXJzOiBuZXcgTWFwKCksXG5cdCAgICAgICAgICAgICAgICBjbGllbnRJZGVudGl0eSxcblx0ICAgICAgICAgICAgICAgIGdsb2JhbEhhbmRsZXI6IHVuZGVmaW5lZFxuXHQgICAgICAgICAgICB9O1xuXHQgICAgICAgICAgICB0aGlzLmNsaWVudHMuc2V0KGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQsIGNsaWVudFN1YnNjcmlwdGlvblN0YXRlKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICBvbkRpc2Nvbm5lY3Rpb24oY2xpZW50SWRlbnRpdHkpIHtcblx0ICAgICAgICB0aGlzLmNsaWVudHMuZGVsZXRlKGNsaWVudElkZW50aXR5LmV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ksIGN1cnJDbGllbnRTdGF0ZS5nbG9iYWxIYW5kbGVyLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgZ2V0Q3VycmVudENvbnRleHQocGF5bG9hZCwgc2VuZGVyQ2xpZW50SWRlbnRpdHkpIHtcblx0ICAgICAgICBjb25zdCB7IGNvbnRleHRUeXBlIH0gPSBwYXlsb2FkO1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN0YXRlID0gdGhpcy5nZXRDbGllbnRTdGF0ZShzZW5kZXJDbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKCFjbGllbnRTdGF0ZSkge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENsaWVudCB3aXRoIElkZW50aXR5OiAke3NlbmRlckNsaWVudElkZW50aXR5LnV1aWR9ICR7c2VuZGVyQ2xpZW50SWRlbnRpdHkubmFtZX0sIHRyaWVkIHRvIGNhbGwgZ2V0Q3VycmVudENvbnRleHQsIGlzIG5vdCBjb25uZWN0ZWQgdG8gdGhpcyBQcml2YXRlIENoYW5uZWxgKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHRUeXBlICE9PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgY29uc3QgY3VycmVudENvbnRleHQgPSB0aGlzLmNvbnRleHRCeUNvbnRleHRUeXBlLmdldChjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgIGlmIChjdXJyZW50Q29udGV4dClcblx0ICAgICAgICAgICAgICAgIHJldHVybiBjdXJyZW50Q29udGV4dDtcblx0ICAgICAgICAgICAgcmV0dXJuIG51bGw7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIHJldHVybiB0aGlzLmxhc3RDb250ZXh0ID8gdGhpcy5sYXN0Q29udGV4dCA6IG51bGw7XG5cdCAgICB9XG5cdCAgICBjb250ZXh0SGFuZGxlckFkZGVkKHBheWxvYWQsI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UuZ2xvYmFsSGFuZGxlciA9IHVuZGVmaW5lZDtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgW2N1cnJDb250ZXh0VHlwZSwgaGFuZGxlcnNJZHNdIG9mIHJlbW92aW5nQ2xpZW50U3RhdGUuaGFuZGxlcklkc0J5Q29udGV4dFR5cGVzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgaW5kZXggPSBoYW5kbGVyc0lkcy5pbmRleE9mKGhhbmRsZXJJZCk7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKGluZGV4ID4gLTEpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlcnNJZHMuc3BsaWNlKGluZGV4LCAxKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFR5cGUgPSBjdXJyQ29udGV4dFR5cGU7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIC8vIGdldHRpbmcgb25seSB2YWxpZCBjbGllbnQgY29ubmVjdGlvbnMgaGVyZSwgaXQgaXMgcG9zc2libGUgd2UgaGF2ZW4ndCByZW1vdmVkIGEgZGlzY29ubmVjdGVkIGNsaWVudCBmcm9tIHRoZSBtYXAgeWV0XG5cdCAgICAgICAgICAgIC8vIHNvIHdlIG5lZWQgdG8gZW5zdXJlIHdlIGRvbid0IGRpc3BhdGNoIHRvIGFueSBkaXNjb25uZWN0ZWQgY2xpZW50XG5cdCAgICAgICAgICAgIC8vIFRPRE86IFRha2UgYSBsb29rIGF0IG91ciBjbGllbnQgZGlzY29ubmVjdGlvbiBsb2dpYyBhbmQgc2VlIGlmIHdlIGNhbiBoYW5kbGUgY2xpZW50IGRpc2Nvbm5lY3Rpb24gY2xlYW5seVxuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRzVG9EaXNwYX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bm5lbGApO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjbGllbnRTdGF0ZS5vbkFkZENvbnRleHRMaXN0ZW5lckhhbmRsZXJJZCA9IGhhbmRsZXJJZDtcblx0ICAgICAgICAvLyBGREMzIFNwZWMgc2F5cyB0aGF0IHRoZSBhZGRlZCBsaXN0ZW5lciBzaG91bGQgZmlyZSBmb3IgYWxsIHByZXZpb3VzbHktcmVnaXN0ZXJlZCBhZGRDb250ZXh0TGlzdGVuZXJzIGZyb20gdGhlIG90aGVyIGNsaWVudFxuXHQgICAgICAgIEFycmF5LmZyb20odGhpcy5jbGllbnRzLnZhbHVlcygpKS5mb3JFYWNoKChvdGhlckNsaWVudFN0YXRlKSA9PiB7XG5cdCAgICAgICAgICAgIGlmIChvdGhlckNsaWVudFN0YXRlLmNsaWVudElkZW50aXR5LmVuZHBvaW50SWQgIT09IHNlbmRlckNsaWVudElkZW50aXR5LmVuZHBvaW50SWQpIHtcblx0ICAgICAgICAgICAgICAgIEFycmF5LmZyb20ob3RoZXJDbGllbnRTdGF0ZS5oYW5kbGVySWRzQnlDb250ZXh0VHlwZXMua2V5cygpKS5mb3JFYWNoKChzdWJzY3JpYmVkQ29udGV4dFR5cGUpID0+IHtcblx0ICAgICAgICAgICAgICAgICAgICB0aGlzLnByb3ZpZGVyLmRpc3BhdGNoKHNlbmRlckNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIHN1YnNjcmliZWRDb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgb25EaXNjb25uZWN0SGFuZGxlckFkZGVkKHBheWxvYWQsIGlkKSB7XG5cdCAgICAgICAgY29uc3QgY2xpZW50U3RhdGUgPSB0aGlzLmdldENsaWVudFN0YXRlKGlkKTtcblx0ICAgICAgICBjb25zdCB7IGhhbmRsZXJJZCB9ID0gcGF5bG9hZDtcblx0ICAgICAgICBpZiA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2VzID0gY29udGV4dFR5cGVIYW5kbGVySWRzLm1hcChhc3luYyAoaGFuZGxlcklkKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29udGV4dEhhbmRsZXJSZW1vdmVkKHsgaGFuZGxlcklkIH0sIGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCBQcm9taXNlLmFsbCh1bnN1YlByb21pc2VzKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgaWYgKGdsb2JhbEhhbmRsZXJJZCkge1xuXHQgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmNvbnRleHRIYW5kbGVyUmVtb3ZlZCh7IGhhbmRsZXJJZDogZ2xvYmFsSGFuZGxlcklkIH0sIGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IubWVzc2FnZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICBhc3luYyBoYW5kbGVDbGllbnREaXNjb25uZWN0aW5nKGRpc2Nvbm5lY3RpbmdDbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGF3YWl0IHRoaXMudW5zdWJzY3JpYmVBbGwoZGlzY29ubmVjdGluZ0NsaWVudElkZW50aXR5K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dGh1Yi5pby9nb2xkZW4tcHJvdG90eXBlL2Zhdmljb24uaWNvXCIsXG5cdCAqICAgICAgICAgIFwiYXV0b1Nob3dcIjogZmFsc2UsXG5cdCAqICAgICAgICAgIFwicHJvdmlkZXJVcmxcIjogXCJodHRwOi8vbG9jYWxob3N0OjU1NTUvcHJvdmlkZXIuaHRtbFwiLFxuXHQgKiAgICAgICAgICBcImludGVyb3BCcm9rZXJDb25maWd1cmF0aW9uXCI6IHtcblx0ICogICAgICAgICAgICAgIFwiY29udGV4dEdyb3Vwc1wiOiBbXG5cdCAqICAgICAgICAgICAgICAgICAge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IFwiZ3JlZW5cIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgXCJkaXNwbGF5TWV0YWRhdGFcIjoge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJjb2xvclwiOiBcIiMwMENDODhcIixcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiBcImdyZWVuXCJcblx0ICogICAgICAgICAgICAgICAgICAgICAgfVxuXHQgKiAgICAgICAgICAgICAgICAgIH0sXG5cdCAqICAgICAgICAgICAgICAgICAge1xuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IFwicHVycGxlXCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgIFwiZGlzcGxheU1ldGFkYXRhXCI6IHtcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwiY29sb3JcIjogXCIjOEM2MUZGXCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgICAgICBcIm5hbWVcIjogXCJwdXJwbGVcIlxuXHQgKiAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAqICAgICAgICAgICAgICAgICAgfSxcblx0ICogICAgICAgICAgICAgIF1cblx0ICogICAgICAgICAgfVxuXHQgKiAgICAgIH1cblx0ICogfVxuXHQgKiBgYGBcblx0ICpcblx0ICogQnkgZGVmYXVs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ZUNhbGxiYWNrOiBhc3luYyAoUHJvdmlkZXIpID0+IHtcblx0ICogICAgICAgICBjbGFzcyBPdmVycmlkZSBleHRlbmRzIFByb3ZpZGVyIHtcblx0ICogICAgICAgICAgICAgYXN5bmMgZ2V0U25hcHNob3QoKSB7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYmVmb3JlIGdldFNuYXBzaG90Jylcblx0ICogICAgICAgICAgICAgICAgIGNvbnN0IHNuYXBzaG90ID0gYXdhaXQgc3VwZXIuZ2V0U25hcHNob3QoKTtcblx0ICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdhZnRlciBnZXRTbmFwc2hvdCcpXG5cdCAqICAgICAgICAgICAgICAgICByZXR1cm4gc25hcHNob3Q7XG5cdCAqICAgICAgICAgICAgIH1cblx0ICpcblx0ICogICAgICAgICAgICAgYXN5bmMgYXBwbHlTbmFwc2hvdCh7IHNuYXBzaG90LCBvcHRpb25zIH0pIHtcblx0ICogICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdiZWZvcmUgYXBwbHlTbmFwc2hvdCcpXG5cdCAqICAgICAgICAgICAgICAgICBjb25zdCBvcmlnaW5hbFByb21pc2UgPSBzdXBlci5hcHBseVNuYXBzaG90KHsgc25hcHNob3QsIG9wdGlvbnMgfSk7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYWZ0ZXIgYXBwbHlTbmFwc2hvdCcpXG5cdCAqXG5cdCAqICAgICAgICAgICAgICAgICByZXR1cm4gb3JpZ2luYWxQcm9taXNlO1xuXHQgKiAgICAgICAgICAgICB9XG5cdCAqICAgICAgICAgfTtcblx0ICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAqICAgICB9LFxuXHQgKiAgICAgaW50ZXJvcE92ZXJyaWRlOiBhc3luYyAoSW50ZXJvcEJyb2tlcikgPT4ge1xuXHQgKiAgICAgICAgIGNsYXNzIE92ZXJyaWRlIGV4dGVuZ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GV4dCAtIGJhZCBDb250ZXh0LiBSZWFzb246ICR7Y29udGV4dEludGVncml0eUNoZWNrUmVzdWx0LnJlYXNvbn0uIENvbnRleHQ6ICR7SlNPTi5zdHJpbmdpZnkoY29udGV4dCl9YCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1ub24tbnVsbC1hc3NlcnRpb25cblx0ICAgICAgICAgICAgY29uc3QgY29udGV4dEdyb3VwU3RhdGUgPSB0aGlzLmNvbnRleHRHcm91cHNCeUlkLmdldChjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgIGNvbnN0IGJyb2FkY2FzdGVkQ29udGV4dFR5cGUgPSBjb250ZXh0LnR5cGU7XG5cdCAgICAgICAgICAgIGNvbnRleHRHcm91cFN0YXRlLnNldChicm9hZGNhc3RlZENvbnRleHRUeXBlLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgdGhpcy5sYXN0Q29udGV4dE1hcC5zZXQoY29udGV4dEdyb3VwSWQsIGJyb2FkY2FzdGVkQ29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRzSW5TYW1lQ29udGV4dEdyb3VwID0gQXJyYXkuZnJvbSh0aGlzLmludGVyb3BDbGllbnRzLnZhbHVlcygpKS5maWx0ZXIoKGNvbm5lY3RlZENsaWVudCkgPT4gY29ubmVjdGVkQ2xpZW50LmNvbnRleHRHcm91cElkID09PSBjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgIGNsaWVudHNJblNhbWVDb250ZXh0R3JvdXAuZm9yRWFjaCgoY2xpZW50KSA9PiB7XG5cdCAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IFssIGhhbmRsZXJJbmZvXSBvZiBjbGllbnQuY29udGV4dEhhbmRsZXJzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKEludGVyb3BCcm9rZXIuaXNDb250ZXh0VHlwZUNvbXBhdGlibGUoYnJvYWRjYXN0ZWRDb250ZXh0VHlwZSwgaGFuZGxlckluZm8uY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50LmNsaWVudElkZW50aXR5LCBoYW5kbGVySW5mby5oYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2UgaWYgKGNsaWVudFN0YXRlKSB7XG5cdCAgICAgICAgICAgIC8vIENsaWVudCBoYXMgbm90IGpvaW5lZCBhbnkgY29udGV4dCBncm91cCBiZWhhdmlvci5cblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgbXVzdCBqb2luIGEgY29udGV4dCBncm91cCBiZWZvcmUgeW91IGNhbiBzZXQgY29udGV4dC4nKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIC8vIFRoaXMgc2hvdWxkbid0IGdldCBoaXQuXG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2xpZW50IHdpdGggSWRlbnRpdHk6ICR7Y2xpZW50SWRlbnRpdHkudXVpZH0gJHtjbGllbnRJZGVudGl0eS5uYW1lfSBub3QgaW4gQ2xpZW50IFN0YXRlIE1hcGApO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogR2V0IGN1cnJlbnQgY29udGV4dCBmb3IgYSBjbGllbnQgc3Vic2NyaWJlZCB0byBhIENvbnRleHQgR3JvdXAuXG5cdCAgICAgKlxuXHQgICAgICogQHJlbWFya3MgSXQgdGFrZXMgYW4gb3B0aW9uYWwgQ29udGV4dCBUeXBlIGFyZ3VtZW50IGFuZCByZXR1c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GV4dCBncm91cCBmb3IgYWxsIGNvbm5lY3Rpb25zLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgTW9yZSB0aGFuIG9uZSBjb25uZWN0aW9uIGZvdW5kIGZvciBpZGVudGl0eSAke3RhcmdldC51dWlkfSAke3RhcmdldC5uYW1lfWApO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgY29ubmVjdGlvbiBvZiBhbGxDb25uZWN0aW9ucykge1xuXHQgICAgICAgICAgICAgICAgICAgIHByb21pc2VzLnB1c2godGhpcy5hZGRDbGllbnRUb0NvbnRleHRHcm91cCh7IGNvbnRleHRHcm91cElkIH0sIGNvbm5lY3Rpb24pKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHByb21pc2VzKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlcnJvcik7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIC8vIE5vIHRhcmdldCBwcm92aWRlZCwgYWRkIHRoZSBzZW5kZXIgdG8gdGhlIGNvbnRleHQgZ3JvdXAuXG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMuYWRkQ2xpZW50VG9Db250ZXh0R3JvdXAoeyBjb250ZXh0R3JvdXBJZCB9LCBzZW5kZXJJZGVudGl0eSk7XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLy8gYWRkQ2xpZW50VG9Db250ZXh0R3JvdXAgZG9lcyB0aGUgYWN0dWFsIGFkZGl0aW9uIG9mIHRoZSBjbGllbnQgdG8gdGhlIENvbnRleHQgR3JvdXBcbl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SA9IGhhbmRsZXJJbmZvO1xuXHQgICAgICAgICAgICAgICAgaWYgKGNvbnRleHRUeXBlID09PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgICAgICAvLyBTZW5kIHRoaXMgc2luZ2xlIGhhbmRsZXIgYWxsIG9mIHRoZSBjb250ZXh0LCBiZWNhdXNlIGl0IGFjY2VwdHMgYWxsLlxuXHQgICAgICAgICAgICAgICAgICAgIGNvbnRleHRHcm91cE1hcC5mb3JFYWNoKChjb250ZXh0LCBfKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBlbHNlIGlmIChjb250ZXh0R3JvdXBNYXAuaGFzKGNvbnRleHRUeXBlKSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNvbnRleHRGb3JUeXBlID0gY29udGV4dEdyb3VwTWFwLmdldChjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRleHRGb3JUeXBlKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dEZvclR5cGUpO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIC8vIFJlbW92ZXMgdGhlIHRhcmdldCBmcm9tIGl0cyBjb250ZXh0IGdyb3VwLiBTaW1pbGFyIHN0cnVjdHVyZSB0byBqb2luQ29udGV4dEdyb3VwLlxuXHQgICAgLyoqXG5cdCAgICAgKiBSZW1vdmVzI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yZ2V0LnV1aWR9ICR7dGFyZ2V0Lm5hbWV9YCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgZm9yIChjb25zdCBjb25uZWN0aW9uIG9mIGFsbENvbm5lY3Rpb25zKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcHJvbWlzZXMucHVzaCh0aGlzLnJlbW92ZUNsaWVudEZyb21Db250ZXh0R3JvdXAoY29ubmVjdGlvbikpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgLy8gTm8gdGFyZ2V0IHByb3ZpZGVkLCByZW1vdmUgdGhlIHNlbmRlciBmcm9tIHRoZSBjb250ZXh0IGdyb3VwLlxuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLnJlbW92ZUNsaWVudEZyb21Db250ZXh0R3JvdXAoc2VuZGVySWRlbnRpdHkpO1xuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIC8vIHJlbW92ZUNsaWVudEZyb21Db250ZXh0R3JvdXAgZG9lcyB0aGUgYWN0dWFsIHJlbW92ZSBvZiB0aGUgY2xpZW50IGZyb20gdGhlIENvbnRleHQgR3JvdXBcblx0ICAgIC8qKlxuXHQgICAgICogSGVscGVyIGZ1bmN0aW9uIGZvciB7QGxpbmsgSW50ZXJvcEJyb2tlciNyZW1vdmVGcm9tQ29udGV4dEdyb3VwIEludGVyb3BCcm9rZXIucmVtb3ZlRnJvbUNvbnRleHRHcm91cH0uIERvZXM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Zpbm9zLm9yZy9kb2NzL2FwaS9yZWYvSW50ZW50UmVzb2x1dGlvbikuXG5cdCAgICAgKlxuXHQgICAgICogQHBhcmFtIGludGVudCBUaGUgY29tYmluYXRpb24gb2YgYW4gYWN0aW9uIGFuZCBhIGNvbnRleHQgdGhhdCBpcyBwYXNzZWQgdG8gYW4gYXBwbGljYXRpb24gZm9yIHJlc29sdXRpb24uXG5cdCAgICAgKiBAcGFyYW0gIGNsaWVudElkZW50aXR5IElkZW50aXR5IG9mIHRoZSBDbGllbnQgbWFraW5nIHRoZSByZXF1ZXN0LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogLy8gb3ZlcnJpZGUgY2FsbCBzbyB3ZSBzZXQgaW50ZW50IHRhcmdldCBhbmQgY3JlYXRlIHZpZXcgdGhhdCB3aWxsIGhhbmRsZSBpdFxuXHQgICAgICogZmluLlBsYXRmb3JtLmluaXQoe1xuXHQgICAgICogICAgIGludGVyb3BPdmVycmlkZTogYXN5bmMgKEludGVyb3BCcm9rZXIpID0+IHtcblx0ICAgICAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICAgICAqICAgICAgICAgICAgIGFzeW5jIGhhbmRsZUZpcmVkSW50ZW50KGludGVudCkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHN1cGVyLnNldEludGVudFRhcmdldChpbnRlbnQsIHsgdXVpZDogJ3BsYXRmb3JtLXV1aWQnLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0pO1xuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgd2luID0gZmluLldpbmRvdy53cmFwU3luYyh7IG5hbWU6ICdmb28nLCB1dWlkOiAncGxhdGZvcm0tdXV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HRhcmdldC5uYW1lLCBuZXcgTWFwKCkpO1xuXHQgICAgICAgICAgICBjb25zdCBuZXdIYW5kbGVySW5mb01hcCA9IHRoaXMuaW50ZW50Q2xpZW50TWFwLmdldCh0YXJnZXQubmFtZSk7XG5cdCAgICAgICAgICAgIGlmIChuZXdIYW5kbGVySW5mb01hcCkge1xuXHQgICAgICAgICAgICAgICAgbmV3SGFuZGxlckluZm9NYXAuc2V0KGhhbmRsZXJJZCwgeyBpc1JlYWR5OiBmYWxzZSwgcGVuZGluZ0ludGVudHM6IFtpbnRlbnRdIH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICBjb25zdCBoYW5kbGVySW5mbyA9IHRhcmdldEluZm8uZ2V0KGhhbmRsZXJJZCk7XG5cdCAgICAgICAgICAgIGlmICghaGFuZGxlckluZm8pIHtcblx0ICAgICAgICAgICAgICAgIHRhcmdldEluZm8uc2V0KGhhbmRsZXJJZCwgeyBpc1JlYWR5OiBmYWxzZSwgcGVuZGluZ0ludGVudHM6IFtpbnRlbnRdIH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgaGFuZGxlckluZm8ucGVuZGluZ0ludGVudHMucHVzaChpbnRlbnQpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGhhbmRsZXJJbmZvLmNsaWVudElkZW50aXR5ICYmIGhhbmRsZXJJbmZvLmlzUmVhZHkpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGNsaWVudElkZW50aXR5LCBwZW5kaW5nSW50ZW50cyB9ID0gaGFuZGxlckluZm87XG5cdCAgICAgICAgICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50ZW50VG9TZW5kID0gcGVuZGluZ0ludGVudHNbcGVuZGluZ0ludGVudHMubGVuZ3RoIC0gMV07XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMuaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBpbnRlbnRUb1NlbmQpO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5wZW5kaW5nSW50ZW50cyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihgRXJyb3IgaW52b2tpbmcgaW50ZW50IGhhbmRsZXIgZm9yIGNsaWVudCAke2NsaWVudElkZW50aXR5LnV1aWR9LyR7Y2xpZW50SWRlbnRpdHkubmFtZX0vJHtjbGllbnRJZGVudGl0eS5lbmRwb2ludElkfWApO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5pc1JlYWR5ID0gZmFsc2U7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBSZXNwb25zaWJsZSBmb3IgcmV0dXJuaW5nIGluZm9ybWF0aW9uIG9uIGEgcGFydGljdWxhciBJbnRlbnQuXG5cdCAgICAgKlxuXHQgICAgICogQHJlbWFya3MgV2hlbmV2ZXIgSW50ZXJvcENsaWVudC5nZXRJbmZvRm9ySW50ZW50IGlzIGNhbGxlZCB0aGlzIGZ1bmN0aW9uIHdpbGwgZmlyZS4gVGhlIG9wdGlvbnMgYXJndW1lbnQgZ2l2ZXMgeW91XG5cdCAgICAgKiBhY2Nlc3MgdG8gdGhlIGludGVudCBuYW1lIGFuZCBhbnkgb3B0aW9uYWwgY29udGV4dCB0aGF0IHdhcyBwYXNzZWQgYW5kIGNsaWVudElkZW50aXR5IGlzIHRoZSBpZGVudGl0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GV4dCkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHJldHVybiBzdXBlci5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIC4uLmNvbnRleHQsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRNZXRhZGF0YToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwSWQ6ICdvcGVuZmluLWFwcCcsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogJzNENTRENDU2RDlIVDAnXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCkge1xuXHQgICAgICAgIGNvbnN0IHByb3ZpZGVyID0gYXdhaXQgdGhpcy5nZXRQcm92aWRlcigpO1xuXHQgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgIGF3YWl0IHByb3ZpZGVyLmRpc3BhdGNoKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgY29uc29sZS5lcnJvcihgRX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ICAgICAgIGNsYXNzIE92ZXJyaWRlIGV4dGVuZHMgSW50ZXJvcEJyb2tlciB7XG5cdCAgICAgKiAgICAgICAgICAgICBhc3luYyBpbnZva2VJbnRlbnRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCB7IGNvbnRleHQgfSA9IGludGVudDtcblx0ICAgICAqICAgICAgICAgICAgICAgICByZXR1cm4gc3VwZXIuaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIC4uLmludGVudCxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgY29udGV4dDoge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgLi4uY29udGV4dCxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRNZXRhZGF0YToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBJZDogJ29wZW5maW4tYXBwJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogJzNENTRENDU2RDlIVDAnXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSgpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx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XRlIHRoZSBBcHBJZGVudGlmaWVyIGZvciB0aGUgSW50ZW50UmVzb2x1dGlvbi5cblx0ICAgICAqXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiAvLyBGREMzIDIuMCBFeGFtcGxlOlxuXHQgICAgICogZmluLlBsYXRmb3JtLmluaXQoe1xuXHQgICAgICogICAgIGludGVyb3BPdmVycmlkZTogYXN5bmMgKEludGVyb3BCcm9rZXIsIC4uLmFyZ3MpID0+IHtcblx0ICAgICAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICAgICAqICAgICAgICAgICAgIGFzeW5jIGhhbmRsZUZpcmVkSW50ZW50KGludGVudCkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIHN1cGVyLnNldEludGVudFRhcmdldChpbnRlbnQsIHsgdXVpZDogJ3BsYXRmb3JtLXV1aWQnLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0pO1xuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgd2luID0gZmluLldpbmRvdy53cmFwU3luYyh7IG5hbWU6ICdmb28nLCB1dWlkOiAncGxhdGZvcm0tdXVpZCcgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgY3JlYXRlZFZpZXcgPSBhd2FpdCBwbGF0Zm9ybS5jcmVhdGVWaWV3KHsgdXJsOiAnaHR0cDovL29wZW5maW4uY28nLCBuYW1lOiAnaW50ZW50LXZpZXcnIH0sIHdpbi5pZGVudGl0eSk7XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IGFsbENsaWVudEluZm8gPSBhd2FpdCBzdXBlci5nZXRBbGxDbGllbnRJbmZvKCk7XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IGluZm9Gb3JUYXJnZXQgPSBhbGxDbGllbnRJbmZvLmZpbmQoKGNsaWVudEluZm8pID0+IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsaWVudEluZm8udXVpZCA9PT0gJ3BsYXRmb3JtLXV1aWQnICYmIGNsaWVudEluZm8ubmFtZSA9PT0gJ2ludGVudC12aWV3Jztcblx0ICAgICAqICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3Qgc291cmNlID0ge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBhcHBJZDogJ2ludGVudC12aWV3Jyxcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2VJZDogaW5mb0ZvclRhcmdldC5lbmRwb2ludElkXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfVxuXHQgICAgICpcblx0ICAgICAqICAgICAgICAgICAgICAgICByZXR1cm4ge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBzb3VyY2UsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGludGVudDogaW50ZW50Lm5hbWVcblx0ICAgICAqICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoLi4uYXJncyk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgYXN5bmMgZ2V0QWxsQ2xpZW50SW5mbygpIHtcblx0ICAgICAgICBjb25zdCBwcm92aWRlciA9IGF3YWl0IHRoaXMuZ2V0UHJvdmlkZXIoKTtcblx0ICAgICAgICByZXR1cm4gcHJvdmlkZXIuZ2V0QWxsQ2xpZW50SW5mb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gY2xpZW50cy5mb3JFYWNoKChzdWJTdGF0ZSkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCB7IGNsaWVudElkZW50aXR5LCBjb250ZXh0R3JvdXBJZCwgY29udGV4dEhhbmRsZXJzIH0gPSBzdWJTdGF0ZTtcblx0ICAgICAgICAgICAgaWYgKGNvbnRleHRHcm91cElkKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBncm91cENvbnRleHRzID0gY29udGV4dEdyb3VwU3RhdGVzW2NvbnRleHRHcm91cElkXTtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgWywgY29udGV4dF0gb2YgT2JqZWN0LmVudHJpZXMoZ3JvdXBDb250ZXh0cykpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb250ZXh0SGFuZGxlcnMuZm9yRWFjaCgoY29udGV4dEhhbmRsZXIpID0+IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgeyBoYW5kbGVySWQsIGNvbnRleHRUeXBlIH0gPSBjb250ZXh0SGFuZGxlcjtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEludGVyb3BCcm9rZXIuaXNDb250ZXh0VHlwZUNvbXBhdGlibGUoY29udGV4dC50eXBlLCBjb250ZXh0VHlwZSkpIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgLy8gVXNlZCB0byBzdG9yZSBjb250ZXh0IGdyb3VwIHN0YXRlIGluIHNuYXBzaG90c1xuXHQgICAgZ2V0Q29udGV4dEdyb3VwU3RhdGVzKCkge1xuXHQgICAgICAgIH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Ghpcy5jb250ZXh0R3JvdXBzQnlJZC5nZXQoY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICBpZiAoY29udGV4dFR5cGUgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgLy8gU2VuZCB0aGlzIHNpbmdsZSBoYW5kbGVyIGFsbCBvZiB0aGUgY29udGV4dCwgYmVjYXVzZSBpdCBhY2NlcHRzIGFsbC5cblx0ICAgICAgICAgICAgICAgIGNvbnRleHRHcm91cE1hcC5mb3JFYWNoKChjb250ZXh0LCBfKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGVsc2UgaWYgKGNvbnRleHRHcm91cE1hcC5oYXMoY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICBjb25zdCBjb250ZXh0Rm9yVHlwZSA9IGNvbnRleHRHcm91cE1hcC5nZXQoY29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGNvbnRleHRGb3JUeXBlKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDb250ZXh0SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0Rm9yVHlwZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgY2xhc3MtbWV0aG9kcy11c2UtdGhpc1xuXHQgICAgYXN5bmMgaW50ZW50SGFuZGxlclJlZ2lzdGVyZWQocGF5bG9hZCwgY2xpZW50SWRlbnRpdHkpIHtcblx0ICAgICAgICBjb25zdCB7IGhhbmRsZXJ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hbmRsZXJJbmZvLmlzUmVhZHkgPSB0cnVlO1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgaWYgKHBlbmRpbmdJbnRlbnRzLmxlbmd0aCA+IDApIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnRlbnRUb1NlbmQgPSBwZW5kaW5nSW50ZW50c1twZW5kaW5nSW50ZW50cy5sZW5ndGggLSAxXTtcblx0ICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmludm9rZUludGVudEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgaW50ZW50VG9TZW5kKTtcblx0ICAgICAgICAgICAgICAgICAgICBoYW5kbGVySW5mby5wZW5kaW5nSW50ZW50cyA9IFtdO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuXHQgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihgRXJyb3IgaW52b2tpbmcgaW50ZW50IGhhbmRsZXI6ICR7aGFuZGxlcklkfSBmb3IgY2xpZW50ICR7Y2xpZW50SWRlbnRpdHkudXVpZH0vJHtjbGllbnRJZGVudGl0eS5uYW1lfS8ke2NsaWVudElkZW50aXR5LmVuZHBvaW50SWR9YCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvLyBVc2VkIHRvIHJlbW92ZSBhIGNvbnRleHQgaGFuZGxlciBmb3IgYSBjbGllbnRcblx0ICAgIHJlbW92ZUNvbnRleHRIYW5kbGVyKHsgaGFuZGxlcklkIH0sIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgY2xpZW50U3RhdGUgPSB0aGlzLmdldENsaWVudFN0YXRlKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICBpZiAoY2xpZW50U3RhdGUpIHtcblx0ICAgICAgICAgICAgY2xpZW50U3RhdGUuY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C5zZXQoc2Vzc2lvbkNvbnRleHRHcm91cElkLCBuZXdTZXNzaW9uQ29udGV4dEdyb3VwQnJva2VyKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICByZXR1cm4geyBoYXNDb25mbGljdDogdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5oYXMoc2Vzc2lvbkNvbnRleHRHcm91cElkKSB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9yKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvKlxuXHQgICAgSW50ZXJuYWwgVXRpbHRpZXNcblx0ICAgICovXG5cdCAgICAvLyBHZXR0ZXIgZm9yIGludGVyb3AgaW5mbyBmb3IgYSBjbGllbnQuXG5cdCAgICBnZXRDbGllbnRTdGF0ZShpZCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLmludGVyb3BDbGllbnRzLmdldChpZC5lbmRwb2ludElkKTtcblx0ICAgIH1cblx0ICAgIC8vIFV0aWwgZm9yIGdldENvbnRleHRHcm91cFN0YXRlcy4gU2VyaWFsaXplcyB0aGUgY29udGV4dEdyb3VwU3RhdGVzIG9iamVjdCBzbyB3ZSBjYW4gc3RvcmUgaXQuXG5cdCAgICBzdGF0aWMgdG9PYmplY3QobWFwKSB7XG5cdCAgICAgICAgY29uc3Qgb2JqZWN0RnJvbU1hcCA9IE9iamVjdC5mcm9tRW50cmllcyhtYXApO1xuXHQgICAgICAgIGNvbnN0IG5ld09iamVjdCA9IHt9O1xuXHQgICAgICAgIE9iamVjdC5lbnRyaWVzKG9iamVjdEZyb21NYXApLmZvckVhY2goKFtjb250ZXh0R3JvdXBJZCwgY29udGV4dE1hcF0pID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgbmV3Q29udGV4dE9iamVjdCA9IE9iamVjdC5mcm9tRW50cmllcyhjb250ZXh0TWFwKTtcblx0ICAgICAgICAgICAgbmV3T2JqZWN0W2NvbnRleHRHcm91cElkXSA9IG5ld0NvbnRleHRPYmplY3Q7XG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgcmV0dXJuIG5ld09iamVjdDtcblx0ICAgIH1cblx0ICAgIHN0YXRpYyBjaGVja0NvbnRleHRJbnRlZ3JpdHkoY29udGV4dCkge1xuXHQgICAgICAgIGlmICghY29udGV4dCkge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnTm8gY29udGV4dCBzdXBwbGllZCcgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKHR5cGVvZiBjb250ZXh0ICE9PSAnb2JqZWN0Jykge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnQ29udGV4dCBtdXN0IGJlIGFuIE9iamVjdCcgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKCFjb250ZXh0LnR5cGUpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRleHQgbXVzdCBoYXZlIGEgdHlwZSBwcm9wZXJ0eScgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHQuaWQgJiYgdHlwZW9mIGNvbnRleHQuaWQgIT09ICdvYmplY3QnKSB7XG5cdCAgICAgICAgICAgIHJldHVybiB7XG5cdCAgICAgICAgICAgICAgICBpc1ZhbGlkOiBmYWxzZSxcblx0ICAgICAgICAgICAgICAgIHJlYXNvbjogJ0NvbnRleHQgaWQgbXVzdCBiZSBhbiBPYmplY3QgcG9wdWxhdGVkIHdpdGgga2V5LXZhbHVlIGlkZW50aWZpZXJzIChpZiBzZXQpJ1xuXHQgICAgICAgICAgICB9O1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoY29udGV4dC5pZCkge1xuXHQgICAgICAgICAgICBjb25zdCB7IGlkIH0gPSBjb250ZXh0O1xuXHQgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXMoaWQpO1xuXHQgICAgICAgICAgICBsZXQgZm91bmRCYWRJZGVudGlmaWVyID0gZmFsc2U7XG5cdCAgICAgICAgICAgIGlmICgha2V5cy5sZW5ndGgpIHtcblx0ICAgICAgICAgICAgICAgIHJldHVybiB7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdDb250ZXh0IGlkIG11c3QgaGF2ZSBhdCBsZWFzdCBvbmUga2V5LXZhbHVlIGlkZW50aWZpZXInIH07XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAga2V5cy5mb3JFYWNoKChrZXkpID0+IHtcblx0ICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yga2V5ICE9PSAnc3RyaW5nJyB8fCB0eXBlb2YgaWRba2V5XSAhPT0gJ3N0cmluZycpIHtcblx0ICAgICAgICAgICAgICAgICAgICBmb3VuZEJhZElkZW50aWZpZXIgPSB0cnVlO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgaWYgKGZvdW5kQmFkSWRlbnRpZmllcikge1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRleHQgaWQga2V5LXZhbHVlIGlkZW50aWZpZXJzIG11c3QgYmUgb2YgdHlwZSBzdHJpbmcnIH07XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHQubmFtZSAmJiB0eXBlb2YgY29udGV4dC5uYW1lICE9PSAnc3RyaW5nJykge1xuXHQgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnQ29udGV4dCBuYW1lIG11c3QgYmUgb2Ygc3RyaW5nIHR5cGUgKGlmIHNldCknIH07XG5cdCAgICAgICAgfVxuXHQgICAgICAgIHJldHVyb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2xpZW50T3B0aW9ucyhjbGllbnRJZGVudGl0eSwgY29udGV4dEdyb3VwSWQpIHtcblx0ICAgICAgICBjb25zdCBlbnRpdHlJbmZvID0gYXdhaXQgdGhpcy5maW4uU3lzdGVtLmdldEVudGl0eUluZm8oY2xpZW50SWRlbnRpdHkudXVpZCwgY2xpZW50SWRlbnRpdHkubmFtZSk7XG5cdCAgICAgICAgbGV0IGVudGl0eTtcblx0ICAgICAgICBpZiAoZW50aXR5SW5mby5lbnRpdHlUeXBlID09PSAndmlldycpIHtcblx0ICAgICAgICAgICAgZW50aXR5ID0gYXdhaXQgdGhpcy5maW4uVmlldy53cmFwKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSBpZiAoZW50aXR5SW5mby5lbnRpdHlUeXBlID09PSAnd2luZG93Jykge1xuXHQgICAgICAgICAgICBlbnRpdHkgPSBhd2FpdCB0aGlzLmZpbi5XaW5kb3cud3JhcChjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChlbnRpdHkpIHtcblx0ICAgICAgICAgICAgYXdhaXQgZW50aXR5LnVwZGF0ZU9wdGlvbnMoe1xuXHQgICAgICAgICAgICAgICAgaW50ZXJvcDoge1xuXHQgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRDb250ZXh0R3JvdXA6IGNvbnRleHRHcm91cElkXG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgY29uc29sZS53YXJuKGBTZXR0aW5nIEN1cnJlbnQgQ29udGV4dCBHcm91cDogRW50aXR5IHdpdGggaWRlbnRpdHkgJHtjbGllbnRJZGVudGl0eS51dWlkfSwgJHtjbGllbnRJZGVudGl0eS5uYW1lfSBpcyBub3QgYSB3aW5kb3cgb3Igdmlldy4gSXQgaXMgYSAke2VudGl0eUluZm8uZW50aXR5VHl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FrO1xuICAgICAqICAgICAgICAgY2FzZSAnY291bnRyeSc6XG4gICAgICogICAgICAgICAgICAgaGFuZGxlQ291bnRyeUNvbnRleHQoY29udGV4dEluZm8pO1xuICAgICAqICAgICAgICAgICAgIGJyZWFrO1xuICAgICAqXG4gICAgICogICAgICAgICBkZWZhdWx0OlxuICAgICAqICAgICAgICAgICAgIGJyZWFrO1xuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBoYW5kbGVJbnN0cnVtZW50Q29udGV4dChjb250ZXh0SW5mbykge1xuICAgICAqICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBjb250ZXh0SW5mbztcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ2NvbnRleHRJbmZvIGZvciBpbnN0cnVtZW50JywgY29udGV4dEluZm8pXG4gICAgICogfVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gaGFuZGxlQ291bnRyeUNvbnRleHQoY29udGV4dEluZm8pIHtcbiAgICAgKiAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gY29udGV4dEluZm87XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdjb250ZXh0SW5mbyBmb3IgY291bnRyeScsIGNvbnRleHRJbmZvKVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGZpbi5tZS5pbnRlcm9wLmFkZENvbnRleHRIYW5kbGVyKGhhbmRsZUluY29taW5nQ29udGV4dCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKlxuICAgICAqIFdlIGFyZSBhbHNvIHRlc3RpbmcgdGhlIGFiaWxpdHkgdG8gYWRkIGEgY29udGV4dCBoYW5kbGVyIGZvciBzcGVjaWZpYyBjb250ZXh0cy4gSWYgeW91IHdvdWxkIGxpa2UgdG8gdXNlXG4gICAgICogdGhpcywgcGxlYXNlIG1ha2Ugc3VyZSB5b3UgYWRkIHlvdXIgY29udGV4dCBoYW5kbGVycyBhdCB0aGUgdG9wIGxldmVsIG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l0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIGlmICghY29udGV4dEdyb3VwSWQpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTm8gY29udGV4dEdyb3VwSWQgc3BlY2lmaWVkIGZvciBnZXRBbGxDbGllbnRzSW5Db250ZXh0R3JvdXAuJyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGNsaWVudC5kaXNwYXRjaCgnZ2V0QWxsQ2xpZW50c0luQ29udGV4dEdyb3VwJywgeyBjb250ZXh0R3JvdXBJZCB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogR2V0cyBkaXNwbGF5IGluZm8gZm9yIGEgY29udGV4dCBncm91cFxuICAgICAqXG4gICAgICogQHJlbWFya3MgVXNlZCBieSBQbGF0Zm9ybSBXaW5kb3dzLlxuICAgICAqIEBwYXJhbSBjb250ZXh0R3JvdXBJZCAtIFRoZSBpZCBvZiBjb250ZXh0IGdyb3VwIHlvdSB3aXNoIHRvIGdldCBkaXNwbGF5IGluZm8gZm9yLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGZpbi5tZS5pbnRlcm9wLmdldEluZm9Gb3JDb250ZXh0R3JvdXAoJ3JlZCcpXG4gICAgICogICAgIC50aGVuKGNvbnRleHRHcm91cEluZm8gPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coY29udGV4dEdyb3VwSW5mby5kaXNwbGF5TWV0YWRhdGEubmFtZSlcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGNvbnRleHRHcm91cEluZm8uZGlzcGxheU1ldGFkYXRhLmNvbG9yKVxuICAgICAqICAgICB9KVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldEluZm9Gb3JDb250ZXh0R3JvdXAoY29udGV4dEdyb3VwSWQpI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gX0ludGVyb3BDbGllbnRfY2xpZW50UHJvbWlzZSwgXCJmXCIpO1xuICAgICAgICByZXR1cm4gY2xpZW50LmRpc3BhdGNoKCdnZXRJbmZvRm9ySW50ZW50Jywgb3B0aW9ucyk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEdldCBpbmZvcm1hdGlvbiBmcm9tIHRoZSBJbnRlcm9wIEJyb2tlciBvbiBhbGwgSW50ZW50cyB0aGF0IGFyZSBtZWFudCB0byBoYW5kbGUgYSBwYXJ0aWN1bGFyIGNvbnRleHQuXG4gICAgICpcbiAgICAgKiBAcmVtYXJrcyBUbyByZXNvbHZlIHRoaXMgaW5mbywgdGhlIGZ1bmN0aW9uIGhhbmRsZUluZm9Gb3JJbnRlbnRzQnlDb250ZXh0IGlzIG1lYW50IHRvIGJlIG92ZXJyaWRkZW4gaW4gdGhlIEludGVyb3AgQnJva2VyLlxuICAgICAqIFRoZSBmb3JtYXQgZm9yIHRoZSByZXNwb25zZSB3aWxsIGJlIGRldGVybWluZWQgYnkgdGhlIEFwcCBQcm92aWRlciBvdmVycmlkaW5nIHRoZSBmdW5jdGlvbi5cbiAgICAgKlxuICAgICAqIEBwYXJhbSBjb250ZXh0XG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogdGlja2VyRWxlbWVudC5vbignY2xpY2snLCAoZWxlbWVudCkgPT4ge1xuICAgICAqICAgICBjb25zdCB0aWNrZXIgPSBlbGVtZW50LmlubmVyVGV4dDtcbiAgICAgKlxuICAgICAqICAgICBjb25zdCBjb250ZXh0ID0ge1xuICAgICAqICAgICAgICAgdHlwZTogJ2ZkYzMuaW5zdHJ1bWVudCcsXG4gICAgICogICAgICAgICBpZDoge1xuICAgICAqICAgICAgICAgICAgIHRpY2tlclxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICpcbiAgICAgKiAgICAgY29uc3QgaW50ZW50c0luZm8gPSBhd2FpdCBmaW4ubWUuaW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Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0gY29udGV4dFxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIHRpY2tlckVsZW1lbnQub24oJ2NsaWNrJywgKGVsZW1lbnQpID0+IHtcbiAgICAgKiAgICAgY29uc3QgdGlja2VyID0gZWxlbWVudC5pbm5lclRleHQ7XG4gICAgICpcbiAgICAgKiAgICAgY29uc3QgY29udGV4dCA9IHtcbiAgICAgKiAgICAgICAgIHR5cGU6ICdmZGMzLmluc3RydW1lbnQnLFxuICAgICAqICAgICAgICAgaWQ6IHtcbiAgICAgKiAgICAgICAgICAgICB0aWNrZXJcbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqXG4gICAgICogICAgIGNvbnN0IGludGVudFJlc29sdXRpb24gPSBhd2FpdCBmaW4ubWUuaW50ZXJvcC5maXJlSW50ZW50Rm9yQ29udGV4dChjb250ZXh0KTtcbiAgICAgKiB9KVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGZpcmVJbnRlbnRGb3JDb250ZXh0KGNvbnRleHQpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2ludGVyb3AtY2xpZW50LWZpcmUtaW50ZW50LWZvci1jb250ZXh0JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZSwgYW5hbHl0aWNzLW9ubHkgY2FsbFxuICAgICAgICB9KTtcbiAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQyKHRoaXMsIF9JbnRlcm9wQ2xpZW50X2NsaWVudFByb21pc2UsIFwiZlwiKTtcbiAgICAgICAgcmV0dXJuIGNsaWVudC5kaXNwYXRjaCgnZmlyZUludGVudEZvckNvbnRleHQnLCBjb250ZXh0KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogSm9pbiB0aGUgY3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ICAgIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMSh0aGlzLCBfU25hcHNob3RTb3VyY2VfZ2V0Q29ubmVjdGlvbiwgXCJmXCIpLmNhbGwodGhpcykuY2xpZW50UHJvbWlzZSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVGhlIHRhcmdldGVkIFNuYXBzaG90U291cmNlIGlzIG5vdCBjdXJyZW50bHkgaW5pdGlhbGl6ZWQuIEF3YWl0IHRoaXMgb2JqZWN0J3MgcmVhZHkoKSBtZXRob2QuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgX1NuYXBzaG90U291cmNlX3NldFVwQ29ubmVjdGlvbkxpc3RlbmVyLnNldCh0aGlzLCBhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBjaGFubmVsTmFtZSA9ICgwLCB1dGlsc18xJDEuZ2V0U25hcHNob3RTb3VyY2VDaGFubmVsTmFtZSkodGhpcy5pZGVudGl0eSk7XG4gICAgICAgICAgICBsZXQgcmVzb2x2ZTtcbiAgICAgICAgICAgIGxldCByZWplY3Q7XG4gICAgICAgICAgICBjb25zdCBldmVudEZpcmVkID0gbmV3IFByb21pc2UoKHksIG4pID0+IHtcbiAgICAgICAgICAgICAgICByZXNvbHZlID0geTtcbiAgICAgICAgICAgICAgICByZWplY3QgPSBuO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2dldENvbm5lY3Rpb24sIFwiZlwiKS5jYWxsKHRoaXMpLmV2ZW50RmlyZWQgPSBldmVudEZpcmVkO1xuICAgICAgICAgICAgY29uc3QgbGlzdGVuZXIgPSBhc3luYyAoZSkgPT4ge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlLmNoYW5uZWxOYW1lID09PSBjaGFubmVsTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5maW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLnJlbW92ZUxpc3RlbmVyKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgYXdhaXQgdGhpcy5maW4uSW50ZXJBcHBsaWNhdGlvbkJ1cy5DaGFubmVsLm9uKCdjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgICAgIH0pO1xuICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2lkZW50aXR5LCBpZCwgXCJmXCIpO1xuICAgIH1cbiAgICBnZXQgaWRlbnRpdHkoKSB7XG4gICAgICAgIHJldHVybiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDEodGhpcywgX1NuYXBzaG90U291cmNlX2lkZW50aXR5LCBcImZcIik7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIE1ldGhvZCB0byBkZXRlcm1pbmUgaWYgdGhlIFNuYXBzaG90U291cmNlIGhhcyBiZWVuIGluaXRpYWxpemVkLlxuICAgICAqXG4gICAgICogQHJlbWFya3MgVXNlIHdoZW4gdGhlIHBhcmVudCBhcHBsaWNhdGlvbiBpcyBzdGFydGluZyB1cCB0byBlbnN1cmUgdGhlIFNuYXBzaG90U291cmNlIGlzIGFibGUgdG8gYWNjZXB0IGFuZFxuICAgICAqIGFwcGx5IGEgc25hcHNob3QgdXNpbmcgdGhlIHtAbGluayBTbmFwc2hvdFNvdXJjZSNhcHBseVNuYXBza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ybWF0LlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHNuYXBzaG90UHJvdmlkZXIgPSB7XG4gICAgICogICAgIGFzeW5jIGdldFNuYXBzaG90KCkge1xuICAgICAqICAgICAgIGNvbnN0IGJvdW5kcyA9IGF3YWl0IGZpbi5tZS5nZXRCb3VuZHMoKTtcbiAgICAgKiAgICAgICByZXR1cm4gYm91bmRzO1xuICAgICAqICAgICAgfSxcbiAgICAgKiAgICAgYXN5bmMgYXBwbHlTbmFwc2hvdChzbmFwc2hvdCkge1xuICAgICAqICAgICAgIGF3YWl0IGZpbi5tZS5zZXRCb3VuZHMoc25hcHNob3QpO1xuICAgICAqICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICogICAgIH1cbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBhd2FpdCBmaW4uU25hcHNob3RTb3VyY2UuaW5pdChzbmFwc2hvdFByb3ZpZGVyKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqL1xuICAgIGFzeW5jIGluaXQocHJvdmlkZXIpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NuYXBzaG90LXNvdXJjZS1pbml0JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZSwgYW5hbHl0aWNzLW9ubHkgY2FsbFxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKHR5cGVvZiBwcm92aWRlciAhPT0gJ29iamVjdCcgfHxcbiAgICAgICAgICAgIHR5cGVvZiBwcm92aWRlci5nZXRTbmFwc2hvdCAhPT0gJ2Z1bmN0aW9uJyB8fFxuICAgICAgICAgICAgdHlwZW9mIHByb3ZpZGVyLmFwcGx5U25hcHNob3QgIT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigneW91IG11c3QgcGFzcyBpbiBhIHZhbGlkIFNuYXBzaG90UH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yBpbiBkYXRhKSkge1xuICAgICAgICAgICAgaWYgKHRoaXMudW5jb3JyZWxhdGVkTGlzdGVuZXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnVuY29ycmVsYXRlZExpc3RlbmVyLmNhbGwobnVsbCwgZGF0YSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLnVuY29ycmVsYXRlZExpc3RlbmVyID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGVtcHR5IGJsb2NrXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKCF0aGlzLndpcmVMaXN0ZW5lcnMuaGFzKGlkKSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy8gV2UganVzdCBjaGVja2VkIGZvciBleGlzdGVuY2UgYWJvdmVcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tbm9uLW51bGwtYXNzZXJ0aW9uXG4gICAgICAgICAgICBjb25zdCB7IHJlc29sdmUsIGhhbmRsZU5hY2sgfSA9IHRoaXMud2lyZUxpc3RlbmVycy5nZXQoaWQpO1xuICAgICAgICAgICAgaWYgKGRhdGEuYWN0aW9uICE9PSAnYWNrJykge1xuICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soeyByZWFzb246ICdEaWQgbm90IHJlY2VpdmUgYWNrIGFjdGlvbicsIGVycm9yOiAoMCwgZXJyb3JzXzEuZXJyb3JUb1BPSk8pKG5ldyB0cmFuc3BvcnRfZXJyb3JzXzEuTm9BY2tFcnJvcihkYXRhLmFjdGlvbikpIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoISgncGF5bG9hZCcgaW4gZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAvLyBJJ20gbm90IHN1cmUgd2hlbiB0aGlzIGNvZGUgd291bGQgYWN0dWFsbHkgcnVuLCBidXQgcGFzc2luZyBpbiBzb21ldGhpbmcgdGhhdCBkb2Vlc24ndCBoYXZlIGEgcmVhc29uIHRvIHRoZSBydW50aW1lZXJyb3IgY29uc3RydWN0b3Igd2lsbCBub3QgZW5kIHdlbGwuXG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZGF0YS5yZWFzb24gPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soZGF0YSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oJ1JlY2VpdmVkIGludmFsaWQgcmVzcG9uc2UgZnJvbSBjb3JlJywgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIGhhbmRsZU5hY2soeyByZWFzb246ICdpbnZhbGlkIHJlc3BvbnNlIHNoYXBlJyB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmICghZGF0YS5wYXlsb2FkLnN1Y2Nlc3MpIHtcbiAgICAgICAgICAgICAgICBoYW5kbGVOYWNrKGRhdGEucGF5bG9hZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXNvbHZlLmNhbGwobnVsbCwgZGF0YSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLndpcmVMaXN0ZW5lcnMuZGVsZXRlKGlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9XG59XG50cmFuc3BvcnQuVHJhbnNwb3J0ID0gVHJhbnNwb3J0O1xuX1RyYW5zcG9ydF93aXJlID0gbmV3IFdlYWtNYXAoKSwgX1RyYW5zcG9ydF9maW4gPSBuZXcgV2Vha01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bmNlb2YgTGF6eVdyYXBwZXIpKSB7XG4gICAgICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIExvZGFzaFdyYXBwZXIpIHtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGhhc093blByb3BlcnR5LmNhbGwodmFsdWUsICdfX3dyYXBwZWRfXycpKSB7XG4gICAgICAgICAgcmV0dXJuIHdyYXBwZXJDbG9uZSh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBuZXcgTG9kYXNoV3JhcHBlcih2YWx1ZSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uY3JlYXRlYCB3aXRob3V0IHN1cHBvcnQgZm9yIGFzc2lnbmluZ1xuICAgICAqIHByb3BlcnRpZXMgdG8gdGhlIGNyZWF0ZWQgb2JqZWN0LlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gcHJvdG8gVGhlIG9iamVjdCB0byBpbmhlcml0IGZyb20uXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgbmV3IG9iamVjdC5cbiAgICAgKi9cbiAgICB2YXIgYmFzZUNyZWF0ZSA9IChmdW5jdGlvbigpIHtcbiAgICAgIGZ1bmN0aW9uIG9iamVjdCgpIHt9XG4gICAgICByZXR1cm4gZnVuY3Rpb24ocHJvdG8pIHtcbiAgICAgICAgaWYgKCFpc09iamVjdChwcm90bykpIHtcbiAgICAgICAgICByZXR1cm4ge307XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG9iamVjdENyZWF0ZSkge1xuICAgICAgICAgIHJldHVybiBvYmplY3RDcmVhdGUocHJvdG8pO1xuICAgICAgICB9XG4gICAgICAgIG9iamVjdC5wcm90b3R5cGUgPSBwcm90bztcbiAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBvYmpl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aCwgdGhpcy5fX3Rha2VDb3VudF9fKTtcblxuICAgICAgaWYgKCFpc0FyciB8fCAoIWlzUmlnaHQgJiYgYXJyTGVuZ3RoID09IGxlbmd0aCAmJiB0YWtlQ291bnQgPT0gbGVuZ3RoKSkge1xuICAgICAgICByZXR1cm4gYmFzZVdyYXBwZXJWYWx1ZShhcnJheSwgdGhpcy5fX2FjdGlvbnNfXyk7XG4gICAgICB9XG4gICAgICB2YXIgcmVzdWx0ID0gW107XG5cbiAgICAgIG91dGVyOlxuICAgICAgd2hpbGUgKGxlbmd0aC0tICYmIHJlc0luZGV4IDwgdGFrZUNvdW50KSB7XG4gICAgICAgIGluZGV4ICs9IGRpcjtcblxuICAgICAgICB2YXIgaXRlckluZGV4ID0gLTEsXG4gICAgICAgICAgICB2YWx1ZSA9IGFycmF5W2luZGV4XTtcblxuICAgICAgICB3aGlsZSAoKytpdGVySW5kZXggPCBpdGVyTGVuZ3RoKSB7XG4gICAgICAgICAgdmFyIGRhdGEgPSBpdGVyYXRlZXNbaXRlckluZGV4XSxcbiAgICAgICAgICAgICAgaXRlcmF0ZWUgPSBkYXRhLml0ZXJhdGVlLFxuICAgICAgICAgICAgICB0eXBlID0gZGF0YS50eXBlLFxuICAgICAgICAgICAgICBjb21wdXRlZCA9IGl0ZXJhdGVlKHZhbHVlKTtcblxuICAgICAgICAgIGlmICh0eXBlID09IExBWllfTUFQX0ZMQUcpIHtcbiAgICAgICAgICAgIHZhbHVlID0gY29tcHV0ZWQ7XG4gICAgICAgICAgfSBlbHNlIGlmICghY29tcHV0ZWQpIHtcbiAgICAgICAgICAgIGlmICh0eXBlID09IExBWllfRklMVEVSX0ZMQUcpIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBicmVhayBvdXRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmVzdWx0W3Jlc0luZ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sdWUgIT09IDApID8gdmFsdWUgOiAwO1xuICAgICAgICBpZiAoIShzZWVuXG4gICAgICAgICAgICAgID8gY2FjaGVIYXMoc2VlbiwgY29tcHV0ZWQpXG4gICAgICAgICAgICAgIDogaW5jbHVkZXMocmVzdWx0LCBjb21wdXRlZCwgY29tcGFyYXRvcilcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICBvdGhJbmRleCA9IG90aExlbmd0aDtcbiAgICAgICAgICB3aGlsZSAoLS1vdGhJbmRleCkge1xuICAgICAgICAgICAgdmFyIGNhY2hlID0gY2FjaGVzW290aEluZGV4XTtcbiAgICAgICAgICAgIGlmICghKGNhY2hlXG4gICAgICAgICAgICAgICAgICA/IGNhY2hlSGFzKGNhY2hlLCBjb21wdXRlZClcbiAgICAgICAgICAgICAgICAgIDogaW5jbHVkZXMoYXJyYXlzW290aEluZGV4XSwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICBjb250aW51ZSBvdXRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICAgIHNlZW4ucHVzaChjb21wdXRlZCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlc3VsdC5wdXNoKHZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBUaGUgYmFzZSBpbXBsZW1lbnRhdGlvbiBvZiBgXy5pbnZlcnRgIGFuZCBgXy5pbnZlcnRCeWAgd2hpY2ggaW52ZXJ0c1xuICAgICAqIGBvYmplY3RgIHdpdGggdmFsdWVzIHRyYW5zZm9ybWVkIGJ5IGBpdGVyYXRlZWAgYW5kIHNldCBieSBgc2V0dGVyYC5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdC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uIGJhc2VJc0VxdWFsRGVlcChvYmplY3QsIG90aGVyLCBiaXRtYXNrLCBjdXN0b21pemVyLCBlcXVhbEZ1bmMsIHN0YWNrKSB7XG4gICAgICB2YXIgb2JqSXNBcnIgPSBpc0FycmF5KG9iamVjdCksXG4gICAgICAgICAgb3RoSXNBcnIgPSBpc0FycmF5KG90aGVyKSxcbiAgICAgICAgICBvYmpUYWcgPSBvYmpJc0FyciA/IGFycmF5VGFnIDogZ2V0VGFnKG9iamVjdCksXG4gICAgICAgICAgb3RoVGFnID0gb3RoSXNBcnIgPyBhcnJheVRhZyA6IGdldFRhZyhvdGhlcik7XG5cbiAgICAgIG9ialRhZyA9IG9ialRhZyA9PSBhcmdzVGFnID8gb2JqZWN0VGFnIDogb2JqVGFnO1xuICAgICAgb3RoVGFnID0gb3RoVGFnID09IGFyZ3NUYWcgPyBvYmplY3RUYWcgOiBvdGhUYWc7XG5cbiAgICAgIHZhciBvYmpJc09iaiA9IG9ialRhZyA9PSBvYmplY3RUYWcsXG4gICAgICAgICAgb3RoSXNPYmogPSBvdGhUYWcgPT0gb2JqZWN0VGFnLFxuICAgICAgICAgIGlzU2FtZVRhZyA9IG9ialRhZyA9PSBvdGhUYWc7XG5cbiAgICAgIGlmIChpc1NhbWVUYWcgJiYgaXNCdWZmZXIob2JqZWN0KSkge1xuICAgICAgICBpZiAoIWlzQnVmZmVyKG90aGVyKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBvYmpJc0FyciA9IHRydWU7XG4gICAgICAgIG9iaklzT2JqID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBpZiAoaXNTYW1lVGFnICYmICFvYmpJc09iaikge1xuICAgICAgICBzdGFjayB8fCAoc3RhY2sgPSBuZXcgU3RhY2spO1xuICAgICAgICByZXR1cm4gKG9iaklzQXJyIHx8IGlzVHlwZWRBcnJheShvYmplY3QpKVxuICAgICAgICAgID8gZXF1YWxBcnJheXMob2JqZWN0LCB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YW59IFJldHVybnMgYHRydWVgIGlmIGBvYmplY3RgIGlzIGEgbWF0Y2gsIGVsc2UgYGZhbHNlYC5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBiYXNlSXNNYXRjaChvYmplY3QsIHNvdXJjZSwgbWF0Y2hEYXRhLCBjdXN0b21pemVyKSB7XG4gICAgICB2YXIgaW5kZXggPSBtYXRjaERhdGEubGVuZ3RoLFxuICAgICAgICAgIGxlbmd0aCA9IGluZGV4LFxuICAgICAgICAgIG5vQ3VzdG9taXplciA9ICFjdXN0b21pemVyO1xuXG4gICAgICBpZiAob2JqZWN0ID09IG51bGwpIHtcbiAgICAgICAgcmV0dXJuICFsZW5ndGg7XG4gICAgICB9XG4gICAgICBvYmplY3QgPSBPYmplY3Qob2JqZWN0KTtcbiAgICAgIHdoaWxlIChpbmRleC0tKSB7XG4gICAgICAgIHZhciBkYXRhID0gbWF0Y2hEYXRhW2luZGV4XTtcbiAgICAgICAgaWYgKChub0N1c3RvbWl6ZXIgJiYgZGF0YVsyXSlcbiAgICAgICAgICAgICAgPyBkYXRhWzFdICE9PSBvYmplY3RbZGF0YVswXV1cbiAgICAgICAgICAgICAgOiAhKGRhdGFbMF0gaW4gb2JqZWN0KVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICBkYXRhID0gbWF0Y2hEYXRhW2luZGV4XTtcbiAgICAgICAgdmFyIGtleSA9IGRhdGFbMF0sXG4gICAgICAgICAgICBvYmpWYWx1ZSA9IG9iamVjdFtrZXldLFxuICAgICAgICAgICAgc3JjVmFsdWUgPSBkYXRhWzFdO1xuXG4gICAgICAgIGlmIChub0N1c3RvbWl6ZXIgJiYgZGF0YVsyXSkge1xuICAgICAgICAgIGlmIChvYmpWYWx1ZSA9PT0gdW5kZWZpbmVkICYmICEoa2V5IGluIG9iamVjdCk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gZWxlbWVudC5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIG5ldyBhcnJheSBvZiB2YWx1ZXMuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZVhvcihhcnJheXMsIGl0ZXJhdGVlLCBjb21wYXJhdG9yKSB7XG4gICAgICB2YXIgbGVuZ3RoID0gYXJyYXlzLmxlbmd0aDtcbiAgICAgIGlmIChsZW5ndGggPCAyKSB7XG4gICAgICAgIHJldHVybiBsZW5ndGggPyBiYXNlVW5pcShhcnJheXNbMF0pIDogW107XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICByZXN1bHQgPSBBcnJheShsZW5ndGgpO1xuXG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIgYXJyYXkgPSBhcnJheXNbaW5kZXhdLFxuICAgICAgICAgICAgb3RoSW5kZXggPSAtMTtcblxuICAgICAgICB3aGlsZSAoKytvdGhJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgIGlmIChvdGhJbmRleCAhPSBpbmRleCkge1xuICAgICAgICAgICAgcmVzdWx0W2luZGV4XSA9IGJhc2VEaWZmZXJlbmNlKHJlc3VsdFtpbmRleF0gfHwgYXJyYXksIGFycmF5c1tvdGhJbmRleF0sIGl0ZXJhdGVlLCBjb21wYXJhdG9yKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBiYXNlVW5pcShiYXNlRmxhdHRlbihyZXN1bHQsIDEpLCBpdGVyYXRlZSwgY29tcGFyYXRvcik7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLnppcE9iamVjdGAgd2hpY2ggYXNzaWducyB2YWx1ZXMgdXNpbmcgYGFzc2lnbkZ1bmNgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW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zIHRoZSBzb3J0IG9yZGVyIGluZGljYXRvciBmb3IgYHZhbHVlYC5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBjb21wYXJlQXNjZW5kaW5nKHZhbHVlLCBvdGhlcikge1xuICAgICAgaWYgKHZhbHVlICE9PSBvdGhlcikge1xuICAgICAgICB2YXIgdmFsSXNEZWZpbmVkID0gdmFsdWUgIT09IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIHZhbElzTnVsbCA9IHZhbHVlID09PSBudWxsLFxuICAgICAgICAgICAgdmFsSXNSZWZsZXhpdmUgPSB2YWx1ZSA9PT0gdmFsdWUsXG4gICAgICAgICAgICB2YWxJc1N5bWJvbCA9IGlzU3ltYm9sKHZhbHVlKTtcblxuICAgICAgICB2YXIgb3RoSXNEZWZpbmVkID0gb3RoZXIgIT09IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIG90aElzTnVsbCA9IG90aGVyID09PSBudWxsLFxuICAgICAgICAgICAgb3RoSXNSZWZsZXhpdmUgPSBvdGhlciA9PT0gb3RoZXIsXG4gICAgICAgICAgICBvdGhJc1N5bWJvbCA9IGlzU3ltYm9sKG90aGVyKTtcblxuICAgICAgICBpZiAoKCFvdGhJc051bGwgJiYgIW90aElzU3ltYm9sICYmICF2YWxJc1N5bWJvbCAmJiB2YWx1ZSA+IG90aGVyKSB8fFxuICAgICAgICAgICAgKHZhbElzU3ltYm9sICYmIG90aElzRGVmaW5lZCAmJiBvdGhJc1JlZmxleGl2ZSAmJiAhb3RoSXNOdWxsICYmICFvdGhJc1N5bWJvbCkgfHxcbiAgICAgICAgICAgICh2YWxJc051bGwgJiYgb3RoSXNEZWZpbmVkICYmIG90aElzUmVmbGV4aXZlKSB8fFxuICAgICAgICAgICAgKCF2YWxJc0RlZmluZWQgJiYgb3RoSXNSZWZsZXhpdmUpIHx8XG4gICAgICAgICAgICAhdmFsSXNSZWZsZXhpdmUpIHtcbiAgICAgICAgICByZXR1cm4gMTtcbiAgICAgICAgfVxuICAgIC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A9PSAxXG4gICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgd3JhcHBlciA9IHdyYXBwZXJbZ2V0RnVuY05hbWUoZGF0YVswXSldLmFwcGx5KHdyYXBwZXIsIGRhdGFbM10pO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB3cmFwcGVyID0gKGZ1bmMubGVuZ3RoID09IDEgJiYgaXNMYXppYWJsZShmdW5jKSlcbiAgICAgICAgICAgICAgPyB3cmFwcGVyW2Z1bmNOYW1lXSgpXG4gICAgICAgICAgICAgIDogd3JhcHBlci50aHJ1KGZ1bmMpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgdmFyIGFyZ3MgPSBhcmd1bWVudHMsXG4gICAgICAgICAgICAgIHZhbHVlID0gYXJnc1swXTtcblxuICAgICAgICAgIGlmICh3cmFwcGVyICYmIGFyZ3MubGVuZ3RoID09IDEgJiYgaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgIHJldHVybiB3cmFwcGVyLnBsYW50KHZhbHVlKS52YWx1ZSgpO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgaW5kZXggPSAwLFxuICAgICAgICAgICAgICByZXN1bHQgPSBsZW5ndGggPyBmdW5jc1tpbmRleF0uYXBwbHkodGhpcywgYXJncykgOiB2YWx1ZTtcblxuICAgICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmdW5jc1tpbmRleF0uY2FsbCh0aGlzLCByZXN1bHQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9O1xuICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ3JlYXRlcyBhIGZ1bmN0aW9uIHRoYXQgd3JhcHMgYGZ1bmNgIHRvIGludm9rZSBpdCB3aXRoIG9wdGlvbmFs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emVyKGFyclZhbHVlLCBvdGhWYWx1ZSwgaW5kZXgsIGFycmF5LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wYXJlZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKGNvbXBhcmVkKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBhcnJheXMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICBpZiAoIWFycmF5U29tZShvdGhlciwgZnVuY3Rpb24ob3RoVmFsdWUsIG90aEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFjYWNoZUhhcyhzZWVuLCBvdGhJbmRleCkgJiZcbiAgICAgICAgICAgICAgICAgICAgKGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gc2Vlbi5wdXNoKG90aEluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0pKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmICghKFxuICAgICAgICAgICAgICBhcnJWYWx1ZSA9PT0gb3RoVmFsdWUgfHxcbiAgICAgICAgICAgICAgICBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaylcbiAgICAgICAgICAgICkpIHtcbiAgICAgIC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b2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIG90aFZhbHVlID0gb3RoZXJba2V5XTtcblxuICAgICAgICBpZiAoY3VzdG9taXplcikge1xuICAgICAgICAgIHZhciBjb21wYXJlZCA9IGlzUGFydGlhbFxuICAgICAgICAgICAgPyBjdXN0b21pemVyKG90aFZhbHVlLCBvYmpWYWx1ZSwga2V5LCBvdGhlciwgb2JqZWN0LCBzdGFjaylcbiAgICAgICAgICAgIDogY3VzdG9taXplcihvYmpWYWx1ZSwgb3RoVmFsdWUsIGtleSwgb2JqZWN0LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIC8vIFJlY3Vyc2l2ZWx5IGNvbXBhcmUgb2JqZWN0cyAoc3VzY2VwdGlibGUgdG8gY2FsbCBzdGFjayBsaW1pdHMpLlxuICAgICAgICBpZiAoIShjb21wYXJlZCA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgID8gKG9ialZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMob2JqVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpXG4gICAgICAgICAgICAgIDogY29tcGFyZWRcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBza2lwQ3RvciB8fCAoc2tpcEN0b3IgPSBrZXkgPT0gJ2NvbnN0cnVjdG9yJyk7XG4gICAgICB9XG4gICAgICBpZiAocmVzdWx0ICYmICFza2lwQ3Rvcikge1xuICAgICAgICB2YXIgb2JqQ3RvciA9IG9iamVjdC5jb25zdHJ1Y3RvcixcbiAgICAgICAgICAgIG90aEN0b3IgPSBvdGhlci5jb25zdHJ1Y3RvcjtcblxuICAgICAgICAvLyBOb24gYE9iamVjdGAgb2JqZWN0IGluc3RhbmNlcyB3aXRoIGRpZmZlcmVudCBjb25zdHJ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InOiAnZnJlZCcsXG4gICAgICogICAnZ3JlZXQnOiBmdW5jdGlvbihncmVldGluZywgcHVuY3R1YXRpb24pIHtcbiAgICAgKiAgICAgcmV0dXJuIGdyZWV0aW5nICsgJyAnICsgdGhpcy51c2VyICsgcHVuY3R1YXRpb247XG4gICAgICogICB9XG4gICAgICogfTtcbiAgICAgKlxuICAgICAqIHZhciBib3VuZCA9IF8uYmluZEtleShvYmplY3QsICdncmVldCcsICdoaScpO1xuICAgICAqIGJvdW5kKCchJyk7XG4gICAgICogLy8gPT4gJ2hpIGZyZWQhJ1xuICAgICAqXG4gICAgICogb2JqZWN0LmdyZWV0ID0gZnVuY3Rpb24oZ3JlZXRpbmcsIHB1bmN0dWF0aW9uKSB7XG4gICAgICogICByZXR1cm4gZ3JlZXRpbmcgKyAneWEgJyArIHRoaXMudXNlciArIHB1bmN0dWF0aW9uO1xuICAgICAqIH07XG4gICAgICpcbiAgICAgKiBib3VuZCgnIScpO1xuICAgICAqIC8vID0+ICdoaXlhIGZyZWQhJ1xuICAgICAqXG4gICAgICogLy8gQm91bmQgd2l0aCBwbGFjZWhvbGRlcnMuXG4gICAgICogdmFyIGJvdW5kID0gXy5iaW5kS2V5KG9iamVjdCwgJ2dyZWV0JywgXywgJyEnKTtcbiAgICAgKiBib3VuZCgnaGknKTtcbiAgICAgKiAvLyA9PiAnaGl5YSBmcmVkISdcbiAgICAgKi9cbiAgICB2YXIgYmluZEtleSA9IGJhc2VSZXN0KGZ1bmN0aW9uKG9iamVjdCwga2V5LCBwYXJ0aWFscykge1xuICAgICAgdmFyIGJpdG1hc2sgPSBXUkFQX0JJTkRfRkxBRyB8IFdSQVBfQklORF9LRVlfRkxBRztcbiAgICAgIGlmIChwYXJ0aWFscy5sZW5ndGgpIHtcbiAgICAgICAgdmFyIGhvbGRlcnMgPSByZXBsYWNlSG9sZGVycyhwYXJ0aWFscywgZ2V0SG9sZGVyKGJpbmRLZXkpKTtcbiAgICAgICAgYml0bWFzayB8PSBXUkF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1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBkZWJvdW5jZWQoKSB7XG4gICAgICAgIHZhciB0aW1lID0gbm93KCksXG4gICAgICAgICAgICBpc0ludm9raW5nID0gc2hvdWxkSW52b2tlKHRpbWUpO1xuXG4gICAgICAgIGxhc3RBcmdzID0gYXJndW1lbnRzO1xuICAgICAgICBsYXN0VGhpcyA9IHRoaXM7XG4gICAgICAgIGxhc3RDYWxsVGltZSA9IHRpbWU7XG5cbiAgICAgICAgaWYgKGlzSW52b2tpbmcpIHtcbiAgICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4gbGVhZGluZ0VkZ2UobGFzdENhbGxUaW1lKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG1heGluZykge1xuICAgICAgICAgICAgLy8gSGFuZGxlIGludm9jYXRpb25zIGluIGEgdGlnaHQgbG9vcC5cbiAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lcklkKTtcbiAgICAgICAgICAgIHRpbWVySWQgPSBzZXRUaW1lb3V0KHRpbWVyRXhwaXJlZCwgd2FpdCk7XG4gICAgICAgICAgICByZXR1cm4gaW52b2tlRnVuYyhsYXN0Q2FsbFRpbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgdGltZXJJZCA9IHNldFRpbWVvdXQodGltZXJFeHBpcmVkLCB3YWl0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgfVxuICAgICAgZGVib3VuY2VkLmNhbmNlbCA9IGNhbmNlbDtcbiAgICAgIGRlYm91bmNlZC5mbHVzaCA9IGZsdXNoO1xuICAgICAgcmV0dXJuIGRlYm91bmNlZDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBEZWZlcnMgaW52b2tpbmcgdGhlIGBmdW5jYCB1bn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ICAgICByZXR1cm47XG4gICAgICB9XG4gICAgICBmb3IgKHZhciBrZXkgaW4gc291cmNlKSB7XG4gICAgICAgIGlmIChoYXNPd25Qcm9wZXJ0eS5jYWxsKHNvdXJjZSwga2V5KSkge1xuICAgICAgICAgIGFzc2lnblZhbHVlKG9iamVjdCwga2V5LCBzb3VyY2Vba2V5XSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9KTtcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIGlzIGxpa2UgYF8uYXNzaWduYCBleGNlcHQgdGhhdCBpdCBpdGVyYXRlcyBvdmVyIG93biBhbmRcbiAgICAgKiBpbmhlcml0ZWQgc291cmNlIHByb3BlcnRpZXMuXG4gICAgICpcbiAgICAgKiAqKk5vdGU6KiogVGhpcyBtZXRob2QgbXV0YXRlcyBgb2JqZWN0YC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjAuMFxuICAgICAqIEBhbGlhcyBleHRlbmRcbiAgICAgKiBAY2F0ZWdvcnkgT2JqZWN0XG4gICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgZGVzdGluYXRpb24gb2JqZWN0LlxuICAgICAqIEBwYXJhbSB7Li4uT2JqZWN0fSBbc291cmNlc10gVGhlIHNvdXJjZSBvYmplY3RzLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICogQHNlZSBfLmFzc2lnblxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBGb28oKSB7XG4gICAgICogICB0aGlzLmEgPSAxO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGZ1bmN0aW9uIEJhcigpIHtcbiAgICAgKiAgIHRoaXMuYyA9IDM7XG4gICAgICogfVxuICAgICAqXG4gICAgICogRm9vLnByb3RvdHlwZS5iID0gMjtcbiAgICAgKiB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Bzb3VyY2UgPSAoaXNFdmFsdWF0aW5nID8gc291cmNlLnJlcGxhY2UocmVFbXB0eVN0cmluZ0xlYWRpbmcsICcnKSA6IHNvdXJjZSlcbiAgICAgICAgLnJlcGxhY2UocmVFbXB0eVN0cmluZ01pZGRsZSwgJyQxJylcbiAgICAgICAgLnJlcGxhY2UocmVFbXB0eVN0cmluZ1RyYWlsaW5nLCAnJDE7Jyk7XG5cbiAgICAgIC8vIEZyYW1lIGNvZGUgYXMgdGhlIGZ1bmN0aW9uIGJvZHkuXG4gICAgICBzb3VyY2UgPSAnZnVuY3Rpb24oJyArICh2YXJpYWJsZSB8fCAnb2JqJykgKyAnKSB7XFxuJyArXG4gICAgICAgICh2YXJpYWJsZVxuICAgICAgICAgID8gJydcbiAgICAgICAgICA6ICdvYmogfHwgKG9iaiA9IHt9KTtcXG4nXG4gICAgICAgICkgK1xuICAgICAgICBcInZhciBfX3QsIF9fcCA9ICcnXCIgK1xuICAgICAgICAoaXNFc2NhcGluZ1xuICAgICAgICAgICA/ICcsIF9fZSA9IF8uZXNjYXBlJ1xuICAgICAgICAgICA6ICcnXG4gICAgICAgICkgK1xuICAgICAgICAoaXNFdmFsdWF0aW5nXG4gICAgICAgICAgPyAnLCBfX2ogPSBBcnJheS5wcm90b3R5cGUuam9pbjtcXG4nICtcbiAgICAgICAgICAgIFwiZnVuY3Rpb24gcHJpbnQoKSB7IF9fcCArPSBfX2ouY2FsbChhcmd1bWVudHMsICcnKSB9XFxuXCJcbiAgICAgICAgICA6ICc7XFxuJ1xuICAgICAgICApICtcbiAgICAgICAgc291cmNlICtcbiAgICAgICAgJ3JldHVybiBfX3BcXG59JztcblxuICAgICAgdmFyIHJlc3VsdCA9IGF0dGVtcHQoZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiBGdW5jdGlvbihpbXBvcnRzS2V5cywgc291cmNlVVJMICsgJ3JldHVybiAnICsgc291cmNlKVxuICAgICAgICAgIC5hcHBseSh1bmRlZmluZWQsIGltc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gICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgdW5kb1N1YnNjcmlwdGlvbihlbWl0dGVyKTtcbiAgICAgICAgICAgICAgICB0aGlzLmRlbGV0ZUVtaXR0ZXJJZk5vdGhpbmdSZWdpc3RlcmVkKGVtaXR0ZXIpO1xuICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMuZGVyZWdpc3RlckV2ZW50TGlzdGVuZXIgPSBhc3luYyAoZXZlbnRUeXBlLCBvcHRpb25zID0ge30pID0+IHtcbiAgICAgICAgICAgIGlmICh0aGlzLmhhc0VtaXR0ZXIoKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHJ1bnRpbWVFdmVudCA9IHtcbiAgICAgICAgICAgICAgICAgICAgLi4udGhpcy5pZGVudGl0eSxcbiAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wOiBvcHRpb25zLnRpbWVzdGFtcCB8fCBEYXRlLm5vdygpLFxuICAgICAgICAgICAgICAgICAgICB0b3BpYzogdGhpcy50b3BpYyxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTogZXZlbnRUeXBlXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbigndW5zdWJzY3JpYmUtdG8tZGVza3RvcC1ldmVudCcsIHJ1bnRpbWVFdmVudCkuY2F0Y2goKCkgPT4gbnVsbCk7XG4gICAgICAgICAgICAgICAgY29uc3QgZW1pdHRlciA9IHRoaXMuZ2V0T3JDcmVhdGVFbWl0dGVyKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtaXR0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBUaGlzIHdpbGwgb25seSBiZSByZWFjaGVkIGlmIHVuc3Vic2NyaWJlIGZyb20gZXZlbnQgdGhhdCBkb2VzIG5vdCBleGlzdC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RhbmNlKSwge1xuICAgICAgICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMsXG4gICAgICAgICAgICAgICAgICAgIG1ldGE6IGluc3RhbmNlT3B0aW9uc1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIGtleSxcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogY3VzdG9tQ29uc3VtcHRpb25PcHRpb25zXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIGF3YWl0IHRoaXMuc3RyYXRlZ3kuZXhwb3NlTWV0YShpbnN0YW5jZU9wdGlvbnMsIGV4cG9zZWRQcm9wcyk7XG4gICAgICAgIH07XG4gICAgfVxuICAgIDtcbn1cbmFwaUV4cG9zZXIuQXBpRXhwb3NlciA9IEFwaUV4cG9zZXI7XG5cbnZhciBzdHJhdGVnaWVzID0ge307XG5cbnZhciBvcGVuZmluQ2hhbm5lbHMgPSB7fTtcblxudmFyIGNoYW5uZWxzQ29uc3VtZXIgPSB7fTtcblxuT2JqZWN0LmRlZmluZVByb3BlcnR5KGNoYW5uZWxzQ29uc3VtZXIsIFwiX19lc01vZHVsZVwiLCB7IHZhbHVlOiB0cnVlIH0pO1xuY2hhbm5lbHNDb25zdW1lci5DaGFubmVsc0NvbnN1bWVyID0gdm9pZCAwO1xuY2xhc3MgQ2hhbm5lbHNDb25zdW1lciB7XG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lXG4gICAgY29uc3RydWN0b3IoY2hhbm5lbCkge1xuICAgICAgICB0aGlzLmNoYW5uZWwgPSBjaGFubmVsO1xuICAgICAgICB0aGlzLmdldEV4cG9zZWRGdW5jdGlvbnMgPSBhc3luYyAob3B0aW9ucykgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyBpZCB9ID0gb3B0aW9ucztcbiAgICAgICAgICAgIGNvbnN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KGNsaWVudCwgZW50aXR5SWQpIHtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBpZ25vcmVcbiAgICAgICAgICogQGludGVybmFsXG4gICAgICAgICAqIEFwaUNsaWVudCBmb3Ige0BsaW5rIExheW91dEVudGl0aWVzQ29udHJvbGxlcn1cbiAgICAgICAgICovXG4gICAgICAgIF9MYXlvdXROb2RlX2NsaWVudC5zZXQodGhpcywgdm9pZCAwKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIENoZWNrcyBpZiB0aGUgVGFiU3RhY2sgb3IgQ29sdW1uT3JSb3cgaXMgdGhlIHJvb3QgY29udGVudCBpdGVtXG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGlmICghZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcuJyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3Qgc3RhY2sgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFN0YWNrKCk7XG4gICAgICAgICAqIGNvbnN0IGlzUm9vdCA9IGF3YWl0IHN0YWNrLmlzUm9vdCgpO1xuICAgICAgICAgKiAvLyBUaGUgVGFiU3RhY2sgaXMgcm9vdDogZmFsc2VcbiAgICAgICAgICogY29uc29sZS5sb2coYFRoZSBUYWJTdGFjayBpcyByb290OiAke2lzUm9vdH1gKTtcbiAgICAgICAgICpcbiAgICAgICAgICogLy8gUmV0cmlldmVzIHRoZSBwYXJlbnQgQ29sdW1uT3JSb3dcbiAgICAgICAgICogY29uc3QgcGFyZW50ID0gYXdhaXQgc3RhY2suZ2V0UGFyZW50KCk7XG4gICAgICAgICAqIGNvbnN0IHBhcmVudElzUm9vdCA9IGF3YWl0IHBhcmVudC5pc1Jvb3QoKTtcbiAgICAgICAgICogLy8gVGhlIHBhcmVudCBDb2x1bW5PclJvdyBpcyByb290OiB0cnVlXG4gICAgICAgICAqIGNvbnNvbGUubG9nKGBUaGUgcGFyZW50IENvbHVtbk9yUm93IGlzIHJvb3Q6ICR7cGFyZW50SXNSb290fWApO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaXNSb290ID0gKCkgPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9MYXlvdXROb2RlX2NsaWVudCwgXCJmXCIpLmlzUm9vdCh0aGlzLmVudGl0eUlkKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIENoZWNrcyBpZiB0aGUgVGFiU3RhY2sgb3IgQ29sdW1uT3JSb3cgZXhpc3RzXG4gICAgICAgICAqXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGlmICghZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcuJyk7XG4gICAgICAgICAqIH1cbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3Qgc3RhY2sgPSBhd2FpdCBmaW4ubWUuZ2V0Q3VycmVudFN0YWNrKCk7XG4gICAgICAgICAqIC8vIFJldHJpZXZlcyB0aGUgcGFyZW50IENvbHVtbk9yUm93XG4gICAgICAgICAqIGNvbnN0IGNvbHVtbk9yUm93ID0gYXdhaXQgc3RhY2suZ2V0UGFyZW50KCk7XG4gICAgICAgICAqIGxldCBleGlzdHMgPSBhd2FpdCBzdGFjay5leGlzdHMoKTtcbiAgICAgICAgICogLy8gb3JcbiAgICAgICAgICogbGV0IGV4aXN0cyA9IGF3YWl0IGNvbHVtbk9yUm93LmV4aXN0cygpO1xuICAgICAgICAgKiAvLyBUaGUgZW50aXR5IGV4aXN0czogdHJ1ZVxuICAgICAgICAgKiBjb25zb2xlLmxvZyhgVGhlIGVudGl0eSBleGlzdHM6ICR7ZXhpc3RzfWApO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZXhpc3RzID0gKCkgPT4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9MYXlvdXROb2RlX2NsaWVudCwgXCJmXCIpLmV4aXN0cyh0aGlzLmVudGl0eUlkKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIFJldHJpZXZlcyB0aGUgcGFyZW50IG9mIHRoZSBUYWJTdGFjayBvciBDb2x1bW5PclJvd1xuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiBpZiAoIWZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3LicpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IHN0YWNrID0gYXdhaXQgZmluLm1lLmdldEN1cnJlbnRTdGFjaygpO1xuICAgICAgICAgKiAvLyBSZXRyaWV2ZXMgdGhlIHBhcmVudCBDb2x1bW5PclJvd1xuICAgICAgICAgKiBjb25zdCBjb2x1bW5PclJvdyA9IGF3YWl0IHN0YWNrLmdldFBhcmVudCgpO1xuICAgICAgICAgKlxuICAgICAgICAgKiAvLyB1bmRlZmluZWQgaWYgZW50aXR5IGlzIHRoZSByb290IGl0ZW1cbiAgICAgICAgICogbGV0IHBhcmVudCA9IGF3YWl0IGNvbHVtbk9yUm93LmdldFBhcmVudCgpO1xuICAgICAgICAgKiAvLyBvclxuICAgICAgICAgKiBsZXQgcGFyZW50ID0gYXdhaXQgc3RhY2suZ2V0UGFyZW50KCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5nZXRQYXJlbnQgPSBhc3luYyAoKSA9PiB7XG4gICAgICAgICAgIC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sZWZ0U3RhY2tzLmxlbmd0aH0gc3RhY2tzIHRvIHRoZSBsZWZ0YCk7XG4gICAgICAgICAqXG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmdldEFkamFjZW50U3RhY2tzID0gYXN5bmMgKGVkZ2UpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGFkamFjZW50U3RhY2tzID0gYXdhaXQgX19jbGFzc1ByaXZhdGVGaWVsZEdldCRlKHRoaXMsIF9MYXlvdXROb2RlX2NsaWVudCwgXCJmXCIpLmdldEFkamFjZW50U3RhY2tzKHtcbiAgICAgICAgICAgICAgICB0YXJnZXRJZDogdGhpcy5lbnRpdHlJZCxcbiAgICAgICAgICAgICAgICBlZGdlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHJldHVybiBhZGphY2VudFN0YWNrcy5tYXAoKHN0YWNrKSA9PiBMYXlvdXROb2RlLmdldEVudGl0eSh7XG4gICAgICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgICAgICAgICAgICBlbnRpdHlJZDogc3RhY2suZW50aXR5SWRcbiAgICAgICAgICAgIH0sIF9fY2xhc3NQcml2YXRlRmllbGRHZXQkZSh0aGlzLCBfTGF5b3V0Tm9kZV9jbGllbnQsIFwiZlwiKSkpO1xuICAgICAgICB9O1xuICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0JGModGhpcywgX0xheW91dE5vZGVfY2xpZW50LCBjbGllbnQsIFwiZlwiKTtcbiAgICAgICAgdGhpcy5lbnRpdHlJZCA9IGVudGl0eUlkO1xuICAgIH1cbn1cbmxheW91dEVudGl0aWVzLkxheW91dE5vZGUgPSBMYXlvdXROb2RlO1xuX0xheW91dE5vZGVfY2xpZW50ID0gbmV3IFdlYWtNYXAoKTtcbi8qKlxuICogQGlnbm9yZVxuICogQGludGVybmFsXG4gKiBFbmNhcHN1bGF0ZXMgQXBp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WVsZFNldCRjKHRoaXMsIF9UYWJTdGFja19jbGllbnQsIGNsaWVudCwgXCJmXCIpO1xuICAgIH1cbn1cbmxheW91dEVudGl0aWVzLlRhYlN0YWNrID0gVGFiU3RhY2s7XG5fVGFiU3RhY2tfY2xpZW50ID0gbmV3IFdlYWtNYXAoKTtcbi8qKlxuICogQSBDb2x1bW5PclJvdyBpcyB1c2VkIHRvIG1hbmFnZSB0aGUgc3RhdGUgb2YgQ29sdW1uIGFuZCBSb3dzIHdpdGhpbiBhbiBPcGVuRmluIExheW91dC5cbiAqL1xuY2xhc3MgQ29sdW1uT3JSb3cgZXh0ZW5kcyBMYXlvdXROb2RlIHtcbiAgICAvKipcbiAgICAgKiBAaW50ZXJuYWxcbiAgICAgKi9cbiAgICBjb25zdHJ1Y3RvcihjbGllbnQsIGVudGl0eUlkLCB0eXBlKSB7XG4gICAgICAgIHN1cGVyKGNsaWVudCwgZW50aXR5SWQpO1xuICAgICAgICAvKipcbiAgICAgICAgICogQGlnbm9yZVxuICAgICAgICAgKiBAaW50ZXJuYWxcbiAgICAgICAgICogQXBpQ2xpZW50IGZvciB7QGxpbmsgTGF5b3V0RW50aXRpZXNDb250cm9sbGVyfVxuICAgICAgICAgKi9cbiAgICAgICAgX0NvbHVtbk9yUm93X2NsaWVudC5zZXQodGhpcywgdm9pZCAwKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIFJldHJpZXZlcyB0aGUgY29udGVudCBhcnJheSBvZiB0aGUgQ29sdW1uT3JSb3dcbiAgICAgICAgICpcbiAgICAgICAgICogQGV4YW1wbGVcbiAgICAgICAgICogYGBganNcbiAgICAgICAgICogaWYgKCFmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldy4nKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBzdGFjayA9IGF3YWl0IGZpb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O1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogV2luZG93OlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3Qgd25kID0gYXdhaXQgZmluLldpbmRvdy5nZXRDdXJyZW50KCk7XG4gICAgICpcbiAgICAgKiAvLyBQTkcgaW1hZ2Ugb2YgYSBmdWxsIHZpc2libGUgd2luZG93XG4gICAgICogY29uc29sZS5sb2coYXdhaXQgd25kLmNhcHR1cmVQYWdlKCkpO1xuICAgICAqXG4gICAgICogLy8gTG93LXF1YWxpdHkgSlBFRyBpbWFnZSBvZiBhIGRlZmluZWQgdmlzaWJsZSBhcmVhIG9mIHRoZSB3aW5kb3dcbiAgICAgKiBjb25zdCBvcHRpb25zID0ge1xuICAgICAqICAgICBhcmVhOiB7XG4gICAgICogICAgICAgICBoZWlnaHQ6IDEwMCxcbiAgICAgKiAgICAgICAgIHdpZHRoOiAxMDAsXG4gICAgICogICAgICAgICB4OiAxMCxcbiAgICAgKiAgICAgICAgIHk6IDEwLFxuICAgICAqICAgICB9LFxuICAgICAqICAgICBmb3JtYXQ6ICdqcGcnLFxuICAgICAqICAgICBxdWFsaXR5OiAyMFxuICAgICAqIH1cbiAgICAgKiBjb25zb2xlLmxvZyhhd2FpdCB3bmQuY2FwdHVyZVBhZ2Uob3B0aW9ucykpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogQHJlbWFya3NcbiAgICAgKiBgV2ViQ29udGVudHNgIHJlZmVycyB0byBzaGFyZWQgZnVuY3Rpb25hbGl0eSBiZXR3ZWVuIHtAbGluayBPcGVuRmluLldpbmRvd30gYW5kIHtAbGluayBPcGVuRmluLlZpZXd9LlxuICAgICAqIFdlIGRvIG5vdCBleHBvc2UgYW4gZXhwbGljaXQgc3VwZXJjbGFzcyBmb3IgdGhpcyBmdW5jdGlvbmFsaXR5LCBidXQgaXQgZG9lcyBoYXZlIGl0cyBvd25cbiAgICAgKiB7QGxpbmsgT3BlbkZpbi5XZWJDb250ZW50c0V2ZW50cyB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0+IHtcbiAgICAgKiAgICAgICAgIHByaW50ZXJzLmZvckVhY2goKHByaW50ZXIpID0+IHtcbiAgICAgKiAgICAgICAgICAgICBpZiAocHJpbnRlci5pc0RlZmF1bHQpIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocHJpbnRlcik7XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfSk7XG4gICAgICogICAgIH0pXG4gICAgICogICAgIC5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xuICAgICAqICAgICB9KTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFdpbmRvdzpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHdpbiA9IGZpbi5XaW5kb3cuZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKlxuICAgICAqIHdpbi5nZXRQcmludGVycygpXG4gICAgICogICAgIC50aGVuKChwcmludGVycykgPT4ge1xuICAgICAqICAgICAgICAgcHJpbnRlcnMuZm9yRWFjaCgocHJpbnRlcikgPT4ge1xuICAgICAqICAgICAgICAgICAgIGlmIChwcmludGVyLmlzRGVmYXVsdCkge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcmludGVyKTtcbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9KTtcbiAgICAgKiAgICAgfSlcbiAgICAgKiAgICAgLmNhdGNoKChlcnIpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICogICAgIH0pO1xuICAgICAqIGBgYFxuICAgICAqIEByZW1hcmtzXG4gICAgICogYFdlYkNvbnRlbnRzYCByZWZlcnMgdG8gc2hhcmVkIGZ1bmN0aW9uYWxpdHkgYmV0d2VlbiB7QGxpbmsgT3BlbkZpbi5XaW5kb3d9IGFuZCB7QGxpbmsgT3BlbkZpbi5WaWV3fS5cbiAgICAgKiBXZSBkby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MgZm9yIHRoZSBzaGFyZWQgd29ya2VyIGNvbnRleHQuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIFZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmNyZWF0ZSh7XG4gICAgICogICAgICAgICBuYW1lOiAndmlld05hbWUnLFxuICAgICAqICAgICAgICAgdGFyZ2V0OiBmaW4ubWUuaWRlbnRpdHksXG4gICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG4gICAgICogICAgIH0pO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IHZpZXcubmF2aWdhdGUoJ2h0dHA6Ly9tZG4uZ2l0aHViLmlvL3NpbXBsZS1zaGFyZWQtd29ya2VyL2luZGV4Mi5odG1sJyk7XG4gICAgICpcbiAgICAgKiAgICAgYXdhaXQgdmlldy5pbnNwZWN0U2hhcmVkV29ya2VyKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGFtcGxlOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIGNvbnN0IHdpbk9wdGlvbiA9IHtcbiAgICAgKiAgICAgICAgIG5hbWU6J2NoaWxkJyxcbiAgICAgKiAgICAgICAgIGRlZmF1bHRXaWR0aDogMzAwLFxuICAgICAqICAgICAgICAgZGVmYXVsdEhlaWdodDogMzAwLFxuICAgICAqICAgICAgICAgdXJsOiAnaHR0cDovL21kbi5naXRodWIuaW8vc2ltcGxlLXNoYXJlZC13b3JrZXIvaW5kZXgyLmh0bWwnLFxuICAgICAqICAgICAgICAgZnJhbWU6IHRydWUsXG4gICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuICAgICAqICAgICB9O1xuICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBmaW4uV2luZG93LmNyZWF0ZSh3aW5PcHRpb24pO1xuICAgICAqIC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9zZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwXG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBTYW1lIGFzIGFib3ZlIGJ1dCB1c2luZyBhbiBleGlzdGluZyB3aW5kb3cgYXMgYSBwb3B1cCBieSByZWZlcmVuY2luZyBpdHMgYG5hbWVgOlxuICAgICAqXG4gICAgICogTm90ZTogaWYgYSB3aW5kb3cgd2l0aCB0aGUgYG5hbWVgIHByb3ZpZGVkIGRvZXNuJ3QgZXhpc3QsIGl0IHdpbGwgYmUgY3JlYXRlZC5cbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcmVzdWx0ID0gYXdhaXQgZmluLm1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGluaXRpYWxPcHRpb25zOiB7XG4gICAgICogICAgICAgICBmcmFtZTogdHJ1ZVxuICAgICAqICAgICB9LFxuICAgICAqICAgICBuYW1lOiAnbXktcG9wdXAnLCAvLyBzaG93cyB0aGUgJ215LXBvcHVwJyB3aW5kb3cgaWYgaXQgZXhpc3RzLCBvdGhlcndpc2UgY3JlYXRlcyBpdFxuICAgICAqICAgICB1cmw6ICc8bXlfcG9wdXBfdXJsPicsIC8vIG5hdmlnYXRlcyB0byB0aGlzIHVybCBpZiBpdCBkb2Vzbid0IG1hdGNoIHRoZSBsb2NhdGlvbi5ocmVmIG9mIHRoZSAnbXktcG9wdXAnIHdpbmRvd1xuICAgICAqICAgICByZXN1bHREaXNwYXRjaEJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqICAgICBibHVyQmVoYXZpb3I6ICdjbG9zZScsXG4gICAgICogICAgIGZvY3VzOiB0cnVlLFxuICAgICAqIC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AgICAgICAgICAgaWYgKHBheWxvYWQuZGF0YS50b3BpYyA9PT0gJ2NvbG9yLWNoYW5nZWQnKSB7XG4gICAgICogICAgICAgICAgICAgICAgLy8gZG8gc29tZXRoaW5nIGxpa2VcbiAgICAgKiAgICAgICAgICAgICAgICAvLyBzZXRDb2xvcihwYXlsb2FkLmRhdGEudmFsdWUpO1xuICAgICAqICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogfTtcbiAgICAgKlxuICAgICAqIGF3YWl0IGZpbi5tZS5zaG93UG9wdXBXaW5kb3coe1xuICAgICAqICAgICBpbml0aWFsT3B0aW9uczoge1xuICAgICAqICAgICAgICAgZnJhbWU6IGZhbHNlXG4gICAgICogICAgIH0sXG4gICAgICogICAgIHVybDogJzxteV9wb3B1cF91cmw+JyxcbiAgICAgKiAgICAgcmVzdWx0RGlzcGF0Y2hCZWhhdmlvcjogJ25vbmUnLFxuICAgICAqICAgICBibHVyQmVoYXZpb3I6ICdjbG9zZScsXG4gICAgICogICAgIGZvY3VzOiB0cnVlLFxuICAgICAqICAgICBoZWlnaHQ6IDMwMCxcbiAgICAgKiAgICAgd2lkdGg6IDMwMCxcbiAgICAgKiAgICAgeDogMCxcbiAgICAgKiAgICAgeTogMCxcbiAgICAgKiAgICAgb25Qb3B1cFJlc3VsdDogcG9wdXBSZXN1bHRDYWxsYmFja1xuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogU2FtZSBhcyBhYm92ZSBidXQgdXNpbmcgYW4gZXhpc3Rpbmcgd2luZG93IGFzIGEgcG9wdXA6XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBvcHVwUmVzdWx0Q2FsbGJhY2sgPSAocGF5bG9hZCkgPT4ge1xuICAgICAqICAgICAgICBpZiAocGF5bG9hZC5yZXN1bHQgPT09ICdjbGlja2VkJykge1xuICAgICAqICAgICAgICAgICAgaWYgKHBheWxvYWQuZGF0YS50b3BpYyA9PT0gJ2NvbG9yLWNoYW5nZWQnKSB7XG4gICAgICogICAgICAgICAgICAgICAgLy8gZG8gc29tZXRoaW5nIGxpa2VcbiAgICAgKiAgICAgICAgICAgICAgICAvLyBzZXRDb2xvcihwYXlsb2FkLmRhdGEudmFsdWUpO1xuICAgICAqICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogfTtcbiAgICAgKlxuICAgICAqIGF3YWl0IGZpbi5tZS5zaG93UG9wdXBXaW5kb3coe1xuICAgICAqICAgICBpbml0aWFsT3B0aW9uczoge1xuICAgICAqICAgICAgICAgZnJhbWU6IGZhbHNlXG4gICAgICogICAgIH0sXG4gICAgICogICAgIG5hbWU6ICdteS1wb3B1cCcsIC8vIHNob3dzIHRoZSAnbXktcG9wdXAnIHdpbmRvdyBpZiBpdCBleGlzdHMsIG90aGVyd2lzZSBjcmVhdGVzIGl0XG4gICAgICogICAgIHVybDogJzxteV9wb3B1cF91cmw+JywgLy8gbmF2aWdhdGVzIHRvIHRoaXMgdXJsIGlmIGl0IGRvZXNuJ3QgbWF0Y2ggdGhlIGxvY2F0aW9uLmhyZWYgb2YgdGhlICdteS1wb3B1cCcgd2luZG93XG4gICAgICogICAgIHJlc3VsdERpc3BhdGNoQmVoYXZpb3I6ICdub25lJyxcbiAgICAgKiAgICAgYmx1ckJlaGF2aW9yOiAnaGlkZScsXG4gICAgICogICAgIGZvY3VzOiB0cnVlLFxuICAgICAqICAgICBoaWRlT25DbG9zZTogdHJ1ZSwgLy8gd2UgY2FuIGp1c3QgdXNlIHRoaXMgb3Igd2UgY2FuIGNoYW5nZSBibHVyQmVoYXZpb3IgdG8gJ2hpZGUnXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwLFxuICAgICAqICAgICBvblBvcHVwUmVzdWx0OiBwb3B1cFJlc3VsdENhbGxiYWNrXG4gICAgICogfSk7XG4gICAgIC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ICAqIGBgYGpzXG4gICAgICogY29uc3QgcmVzdWx0ID0gYXdhaXQgZmluLm1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGluaXRpYWxPcHRpb25zOiB7XG4gICAgICogICAgICAgICBmcmFtZTogZmFsc2UsXG4gICAgICogICAgICAgICBtb2RhbFBhcmVudElkZW50aXR5OiBmaW4ubWUuaWRlbnRpdHlcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgdXJsOiAnPG15X3BvcHVwX3VybD4nLFxuICAgICAqICAgICByZXN1bHREaXNwYXRjaEJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqICAgICBibHVyQmVoYXZpb3I6ICdtb2RhbCcsXG4gICAgICogICAgIGZvY3VzOiB0cnVlLFxuICAgICAqICAgICBoZWlnaHQ6IDMwMCxcbiAgICAgKiAgICAgd2lkdGg6IDMwMCxcbiAgICAgKiAgICAgeDogMCxcbiAgICAgKiAgICAgeTogMFxuICAgICAqIH0pO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogUGFzcyBkYXRhIHRvIGEgcG9wdXAgd2luZG93IHRoYXQgaXMgYXZhaWxhYmxlIHdoZW4gdGhlIHBvcHVwIGlzIHNob3duLlxuICAgICAqXG4gICAgICogTm90ZTogdGhpcyBpcyBqdXN0IG9uZSBleGFtcGxlIGZvciBhIHVzZSBvZiBgYWRkaXRpb25hbE9wdGlvbnNgLCBpdCBjYW4gYmUgdXNlZCB0byB1cGRhdGUgYW55IHVwZGF0YWJsZVxuICAgICAqIHdpbmRvdyBvcHRpb25zIHdoZW4gY3JlYXRpbmcgb3Igc2hvd2luZyBhbiBleGlzdGluZyB3aW5kb3cgYXMgYSBwb3B1cC5cbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgcmVzdWx0ID0gYXdhaXQgZmluLm1lLnNob3dQb3B1cFdpbmRvdyh7XG4gICAgICogICAgIGFkZGl0aW9uYWxPcHRpb25zOiB7XG4gICAgICogICAgICAgICBjdXN0b21EYXRhOiB7XG4gICAgICogICAgICAgICAgICAgZm9vOiAnYmFyJ1xuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9LFxuICAgICAqICAgICB1cmw6ICc8bXlfcG9wdXBfdXJsPicsXG4gICAgICogICAgIHJlc3VsdERpc3BhdGNoQmVoYXZpb3I6ICdjbG9zZScsXG4gICAgICogICAgIGJsdXJCZWhhdmlvcjogJ2Nsb3NlJyxcbiAgICAgKiAgICAgZm9jdXM6IHRydWUsXG4gICAgICogICAgIGhlaWdodDogMzAwLFxuICAgICAqICAgICB3aWR0aDogMzAwLFxuICAgICAqICAgICB4OiAwLFxuICAgICAqICAgICB5OiAwXG4gICAgICogfSk7XG4gICAgICpcbiAgICAgKiAvLyBBY2Nlc3MgZnJvbSB0aGUgcG9wdXAgd2luZG93IGNvbnRleHQgbGlrZSBzbzpcbiAgICAgKiBjb25zdCB7IGN1c3RvbURhdGEgfSA9IGF3YWl0IGZpbi5tZS5nZXRPcHRpb25zKCk7XG4gICAgICogY29uc3QgeyBmb28gfSA9IGN1c3RvbURhdGE7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGVjdXRlIGEgY2FsbGJhY2sgb24gdGhlIHBvcHVwJ3MgT3BlbkZpbiB3aW5kb3cgd2hlbiB0aGUgcG9wdXAgaXMgc2hvd246XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBvcHVwV2luZG93Q2FsbGJhY2sgPSBhc3luYyAod2luKSA9PiB7XG4gICAgICogICAgIGF3YWl0IHdpbi5mbGFzaCgpO1xuICAgICAqIH07XG4gICAgICpcbiAgICAgKiBjb25zdCByZXN1bHQgPSBhd2FpdCBmaW4ubWUuc2hvd1BvcHVwV2luZG93KHtcbiAgICAgKiAgICAgdXJsOiAnPG15X3BvcHVwX3VybD4nLFxuICAgICAqICAgICByZXN1bHREaXNwYXRjaEJlaGF2aW9yOiAnY2xvc2UnLFxuICAgICAqICAgICBibHVyQmVoYXZ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YW1lIH0pID0+IHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBwb3B1cFdpbmRvdyA9IHRoaXMuZmluLldpbmRvdy53cmFwU3luYyh7IHV1aWQ6IHRoaXMuZmluLm1lLnV1aWQsIG5hbWU6IHBvcHVwTmFtZSB9KTtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgb3B0aW9ucy5vblBvcHVwUmVhZHkocG9wdXBXaW5kb3cpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBTb21ldGhpbmcgd2VudCB3cm9uZyBkdXJpbmcgb25Qb3B1cFJlYWR5IGV4ZWN1dGlvbjogJHtlcnJvcn1gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy8gVE9ETzogZml4IHR5cGluZyAoaW50ZXJuYWwpXG4gICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICBhd2FpdCB0aGlzLm9uY2UoJ3BvcHVwLXJlYWR5JywgcmVhZHlMaXN0ZW5lcik7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgeyBwYXlsb2FkOiB0cnlDcmVhdGVQYXlsb2FkIH0gPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbigndHJ5LWNyZWF0ZS1wb3B1cC13aW5kb3cnLCB7XG4gICAgICAgICAgICBvcHRpb25zOiB7XG4gICAgICAgICAgICAgICAgLi4ub3B0aW9ucyxcbiAgICAgICAgICAgICAgICAvLyBJbnRlcm5hbCB1c2Ugb25seS5cbiAgICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yXG4gICAgICAgICAgICAgICAgaGFzUmVzdWx0Q2FsbGJhY2s6ICEhb3B0aW9ucz8ub25Qb3B1cFJlc3VsdCxcbiAgICAgICAgICAgICAgICBoYXNSZWFkeUNhbGxiYWNrOiAhIW9wdGlvbnM/Lm9uUG9wdXBSZWFkeVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC4uLnRoaXMuaWRlbnRpdHlcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IHsgZGF0YTogeyB3aWxsT3Blbiwgb3B0aW9uczogcG9wdXBPcHRpb25zIH0gfSA9IHRyeUNyZWF0ZVBheWxvYWQ7XG4gICAgICAgIGlmICh3aWxsT3Blbikge1xuICAgICAgICAgICAgLy8gU29sdmUgdGhlIGlzc3VlIHdoZXJlIEludGVyb3AgaW4gYSBwb3B1cCB3aW5kb3cgd2l0aCBub24gY3Jvc3Mtb3JpZ2luIHVybCBpcyBub3Qgd29ya2luZyhjb3JlLTEwNzYpLlxuICAgICAgICAgICAgYXdhaXQgdGhpcy5maW4uV2luZG93LmNyZWF0ZShwb3B1cE9wdGlvbnMuaW5pdGlhbE9wdGlvbnMpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG5vcm1hbGl6ZVBvcHVwUmVzdWx0ID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHsgbmFtZSwgdXVpZCwgcmVzdWx0LCBkYXRhIH0gPSBwYXlsb2FkO1xuICAgICAgICAgICAgY29uc3QgcG9wdXBSZXN1bHQgPSB7XG4gICAgICAgICAgICAgICAgaWRlbnRpdHk6IHtcbiAgICAgICAgICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgICAgICAgICAgdXVpZFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcmVzdWx0XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgaWYgKGRhdGEpIHtcbiAgICAgICAgICAgICAgICBwb3B1cFJlc3VsdC5kYXRhID0gZGF0YTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBwb3B1cFJlc3VsdDtcbiAgICAgICAgfTtcbiAgICAgICAgaWYgKG9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gICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gYXR0YWNoVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBjb25zdCB3aW5PcHRpb24gPSB7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOid3aW5PcHRpb25OYW1lJyxcblx0ICAgICAgICAgKiAgICAgICAgIGRlZmF1bHRXaWR0aDogMzAwLFxuXHQgICAgICAgICAqICAgICAgICAgZGVmYXVsdEhlaWdodDogMzAwLFxuXHQgICAgICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5jcmVhdGUuaHRtbCcsXG5cdCAgICAgICAgICogICAgICAgICBmcmFtZTogdHJ1ZSxcblx0ICAgICAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgICAgICogICAgIH07XG5cdCAgICAgICAgICogICAgIGNvbnN0IG5ld1dpbmRvdyA9IGF3YWl0IGZpbi5XaW5kb3cuY3JlYXRlKHdpbk9wdGlvbik7XG5cdCAgICAgICAgICogICAgIHZpZXcuYXR0YWNoKG5ld1dpbmRvdy5pZGVudGl0eSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXR0YWNoVmlldygpXG5cdCAgICAgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdWaWV3IGF0dGFjaGVkIHRvIG5ldyB3aW5kb3cuJykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuYXR0YWNoID0gYXN5bmMgKHRhcmdldCkgPT4ge1xuXHQgICAgICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignYXR0YWNoLXZpZXcnLCB7IHRhcmdldCwgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIERlc3Ryb3lzIHRoZSBjdXJyZW50IHZpZXdcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBjb25zdCB2aWV3ID0gZmluLlZpZXcud3JhcFN5bmMoeyB1dWlkOiAndmlld1V1aWQnLCBuYW1lOiAndmlld05hbWUnIH0pO1xuXHQgICAgICAgICAqIHZpZXcuZGVzdHJveSgpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmRlc3Ryb3kgPSBhc3luYyAoKSA9PiB7XG5cdCAgICAgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdkZXN0cm95LXZpZXcnLCB7IC4uLnRoaXMuaWRlbnRpdHkgfSk7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBTaG93cyB0aGUgY3VycmVudCB2aWV3IGlmIGl0IGlzIGN1cnJlbnRseSBoaWRkZW4uXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVTaG93Jyxcblx0ICAgICAgICAgKiAgICAgICAgIHRhcmdldDogbWUuaWRlbnRpdHksXG5cdCAgICAgICAgICogICAgICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGFzeW5jIGZ1bmN0aW9uIGhpZGVBbmRTaG93VmlldygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybCBvcHRpb24uJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5oaWRlKCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKFwiVmlldyBoaWRkZW4uXCIpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZpZXcuc2hvdygpO1xuXHQgICAgICAgICAqICAgICBjb25z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ybmVyIG9mIHRoZSB3aW5kb3cpXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICBuYW1lOiAndmlld05hbWVTZXRCb3VuZHMnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gc2hvd1ZpZXdBdCgpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3LnNob3dBdCh7XG5cdCAgICAgICAgICogICAgICAgICB0b3A6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIGxlZnQ6IDEwMCxcblx0ICAgICAgICAgKiAgICAgICAgIHdpZHRoOiAzMDAsXG5cdCAgICAgICAgICogICAgICAgICBoZWlnaHQ6IDMwMFxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBzaG93Vmlld0F0KClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1ZpZXcgc2V0IHRvIG5ldyBib3VuZHMgYW5kIHNob3duLicpKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLnNob3dBdCA9IGFzeW5jIChib3VuZHMpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3Nob3ctdmlldy1hdCcsIHsgYm91bmRzLCAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogSGlkZXMgdGhlIGN1cnJlbnQgdmlldyBpZiBpdCBpcyBjdXJyZW50bHkgdmlzaWJsZS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZUhpZGUnLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gaGlkZVZpZXcoKSB7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5oaWRlKCk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogaGlkZVZpZXcoKVxuXHQgICAgICAgICAqICAgICAudGhlbigoKSA9PiBjb25zb2xlLmxvZygnVmlldyBoaWRkZW4uJykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuaGlkZSA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2hpZGUtdmlldycsIHsgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICB9O1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICA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cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5zZXRCb3VuZHMoe1xuXHQgICAgICAgICAqICAgICAgICAgdG9wOiAxMDAsXG5cdCAgICAgICAgICogICAgICAgICBsZWZ0OiAxMDAsXG5cdCAgICAgICAgICogICAgICAgICB3aWR0aDogMzAwLFxuXHQgICAgICAgICAqICAgICAgICAgaGVpZ2h0OiAzMDBcblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogc2V0Vmlld0JvdW5kcygpXG5cdCAgICAgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdWaWV3IHNldCB0byBuZXcgYm91bmRzLicpKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLnNldEJvdW5kcyA9IGFzeW5jIChib3VuZHMpID0+IHtcblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NldC12aWV3LWJvdW5kcycsIHsgYm91bmRzLCAuLi50aGlzLmlkZW50aXR5IH0pO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogR2V0cyB0aGUgYm91bmRzICh0b3AsIGxlZnQsIHdpZHRoLCBoZWlnaHQpIG9mIHRoZSB2aWV3IHJlbGF0aXZlIHRvIGl0cyB3aW5kb3cuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmVtYXJrcyBWaWV3IHBvc2l0aW9uIGlzIHJlbGF0aXZlIHRvIHRoZSBib3VuZHMgb2YgdGhlIHdpbmRvdy5cblx0ICAgICAgICAgKiAoe3RvcDogMCwgbGVmdDogMH0gcmVwcmVzZW50cyB0aGUgdG9wIGxlZnQgY29ybmVyIG9mIHRoZSB3aW5kb3cpXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogY29uc3QgdmlldyA9IGF3YWl0IGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgIG5hbWU6ICd2aWV3TmFtZVNldEJvdW5kcycsXG5cdCAgICAgICAgICogICAgIHRhcmdldDogZmluLm1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICBib3VuZHM6IHt0b3A6IDEwLCBsZWZ0OiAxMCwgd2lkdGg6IDIwMCwgaGVpZ2h0OiAyMDB9XG5cdCAgICAgICAgICogfSk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGF3YWl0IHZpZXcuc2V0Qm91bmRzKHtcblx0ICAgICAgICAgKiAgICAgdG9wOiAxMDAsXG5cdCAgICAgICAgICogICAgIGxlZnQ6IDEwMCxcblx0ICAgICAgICAgKiAgICAgd2lkdGg6IDMwMCxcblx0ICAgICAgICAgKiAgICAgaGVpZ2h0OiAzMDBcblx0ICAgICAgICAgKiB9KTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGNvbnNvbGUubG9nKGF3YWl0IHZpZXcuZ2V0Qm91bmRzKCkpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmdldEJvdW5kcyA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgYWNrID0gYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2dldC12aWV3LWJvdW5kcycsIHsgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICAgICAgcmV0dXJuIGFjay5wYXlsb2FkLmRhdGE7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBHZXRzIHRoZSBWaWV3J3MgaW5mby5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgICAgICAqICAgICBjb25zdCBtZSA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqICAgICByZXR1cm4gZmluLlZpZXcuY3JlYXRlKHtcblx0ICAgICAgICAgKiAgICAgICAgIG5hbWU6ICd2aWV3TmFtZUdldEluZm8nLFxuXHQgICAgICAgICAqICAgICAgICAgdGFyZ2V0OiBtZS5pZGVudGl0eSxcblx0ICAgICAgICAgKiAgICAgICAgIGJvdW5kczoge3RvcDogMTAsIGxlZnQ6IDEwLCB3aWR0aDogMjAwLCBoZWlnaHQ6IDIwMH1cblx0ICAgICAgICAgKiAgICAgfSk7XG5cdCAgICAgICAgICogfVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gZ2V0Vmlld0luZm8oKSB7XG5cdCAgICAgICAgICogICAgIHZpZXcgPSBhd2FpdCBjcmVhdGVWaWV3KCk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IGNyZWF0ZWQuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSgnaHR0cHM6Ly9nb29nbGUuY29tJyk7XG5cdCAgICAgICAgICogICAgIGNvbnNvbGUubG9nKCdWaWV3IG5hdmlnYXRlZCB0byBnaXZlbiB1cmwuJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIHZpZXcuZ2V0SW5mbygpO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIGdldFZpZXdJbmZvKClcblx0ICAgICAgICAgKiAgICAgLnRoZW4oKGluZm8pID0+IGNvbnNvbGUubG9nKCdWaWV3IGluZm8gZmV0Y2hlZC4nLCBpbmZvKSlcblx0ICAgICAgICAgKiAgICAgLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKiBAZXhwZXJpbWVudGFsXG5cdCAgICAgICAgICovXG5cdCAgICAgICAgdGhpcy5nZXRJbmZvID0gYXN5bmMgKCkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCBhY2sgPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LXZpZXctaW5mbycsIHsgLi4udGhpcy5pZGVudGl0eSB9KTtcblx0ICAgICAgICAgICAgcmV0dXJuIGFjay5wYXlsb2FkLmRhdGE7XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBSZXRyaWV2ZXMgdGhlIGxheW91dCBmb3IgdGhlIHdpbmRvdyB0aGUgdmlldyBpcyBhdHRhY2hlZCB0by5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiAgICAgLy9nZXQgdGhlIGN1cnJlbnQgVmlld1xuXHQgICAgICAgICAqICAgICBjb25zdCB2aWV3ID0gYXdhaXQgZmluLlZpZXcuZ2V0Q3VycmVudCgpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAg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GF3YWl0IGNsaWVudC5nZXRMYXlvdXRJZGVudGl0eUZvclZpZXdPclRocm93KHRoaXMuaWRlbnRpdHkpO1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmluLlBsYXRmb3JtLkxheW91dC53cmFwKGxheW91dElkZW50aXR5KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZSkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgYWxsb3dlZEVycm9ycyA9IFtcblx0ICAgICAgICAgICAgICAgICAgICAnTm8gYWN0aW9uIHJlZ2lzdGVyZWQgYXQgdGFyZ2V0IGZvcicsXG5cdCAgICAgICAgICAgICAgICAgICAgJ2dldExheW91dElkZW50aXR5Rm9yVmlld09yVGhyb3cgaXMgbm90IGEgZnVuY3Rpb24nXG5cdCAgICAgICAgICAgICAgICBdO1xuXHQgICAgICAgICAgICAgICAgaWYgKCFhbGxvd2VkRXJyb3JzLnNvbWUoKG0pID0+IGUubWVzc2FnZS5pbmNsdWRlcyhtKSkpIHtcblx0ICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgLy8gZmFsbGJhY2sgbG9naWMgZm9yIG1pc3NpbmcgZW5kcG9pbnRcblx0ICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcChsYXlvdXRXaW5kb3cuaWRlbnRpdHkpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfTtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBHZXRzIHRoZSBWaWV3J3Mgb3B0aW9ucy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICogYGBganNcblx0ICAgICAgICAgKiBsZXQgdmlldztcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiBjcmVhdGVWaWV3KCkge1xuXHQgICAgIC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ICAgICAgICAgKiBnZXRWaWV3T3B0aW9ucygpXG5cdCAgICAgICAgICogICAgIC50aGVuKChpbmZvKSA9PiBjb25zb2xlLmxvZygnVmlldyBvcHRpb25zIGZldGNoZWQuJywgaW5mbykpXG5cdCAgICAgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgICAgICogYGBgXG5cdCAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHRoaXMuZ2V0T3B0aW9ucyA9IGFzeW5jICgpID0+IHtcblx0ICAgICAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtdmlldy1vcHRpb25zJywgeyAuLi50aGlzLmlkZW50aXR5IH0pLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiBwYXlsb2FkLmRhdGEpO1xuXHQgICAgICAgIH07XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogVXBkYXRlcyB0aGUgdmlldydzIG9wdGlvbnMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqIGBgYGpzXG5cdCAgICAgICAgICogbGV0IHZpZXc7XG5cdCAgICAgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgY29uc3QgbWUgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAgICAgKiAgICAgcmV0dXJuIGZpbi5WaWV3LmNyZWF0ZSh7XG5cdCAgICAgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2dvb2dsZS5jb20nLFxuXHQgICAgICAgICAqICAgICAgICAgbmFtZTogJ3ZpZXdOYW1lVXBkYXRlT3B0aW9ucycsXG5cdCAgICAgICAgICogICAgICAgICB0YXJnZXQ6IG1lLmlkZW50aXR5LFxuXHQgICAgICAgICAqICAgICAgICAgYm91bmRzOiB7dG9wOiAxMCwgbGVmdDogMTAsIHdpZHRoOiAyMDAsIGhlaWdodDogMjAwfVxuXHQgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgKiB9XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBhc3luYyBmdW5jdGlvbiB1cGRhdGVWaWV3T3B0aW9ucygpIHtcblx0ICAgICAgICAgKiAgICAgdmlldyA9IGF3YWl0IGNyZWF0ZVZpZXcoKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgY3JlYXRlZC4nKTtcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBhd2FpdCB2aWV3Lm5hdmlnYXRlKCdodHRwczovL2dvb2dsZS5jb20nKTtcblx0ICAgICAgICAgKiAgICAgY29uc29sZS5sb2coJ1ZpZXcgbmF2aWdhdGVkIHRvIGdpdmVuIHVybCBvcHRpb24uJyk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgY29uc3QgbmV3T3B0aW9ucyA9IHsgYXV0b1Jlc2l6ZToge1xuXHQgICAgICAgICAqICAgICAgICAgd2lkdGg6IHRydWUsXG5cdCAgICAgICAgICogICAgICAgICBob3Jpem9udGFsOiB0cnVlXG5cdCAgICAgICAgICogICAgIH19O1xuXHQgICAgICAgICAqICAgICByZXR1cm4gdmlldy51cGRhdGVPcHRpb25zKG5ld09wdGlvbnMpO1xuXHQgICAgICAgICAqIH1cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIHVwZGF0ZVZpZXdPcHRpb25zKClcblx0ICAgICAgICAgKiAgICAgLnRoZW4ocGF5bG9hZCA9PiBjb25zb2xlLmxvZygnVmlldyBvcHRpb25zIHVwZGF0ZWQ6ICcsIHBheWxvYWQpKVxuXHQgICAgICAgICAqICAgICAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICAgICAqIGBgYFxuXHQgICAgICAgICAqIEBleHBlcmltZW50YWxcblx0ICAgICAgICAgKi9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gYXN5bmMgZnVuY3Rpb24gY3JlYXRlQW5kQXR0YWNoVmlldygpIHtcblx0ICAgICAgICAgKiAgICAgICAgIGNvbnN0IHVybCA9ICdodHRwczovL2V4YW1wbGUuY29tJztcblx0ICAgICAgICAgKiAgICAgICAgIGNvbnN0IGVsZW1lbnRJZCA9ICd2aWV3LWNvbnRhaW5lcic7XG5cdCAgICAgICAgICogICAgICAgICBjb25zdCBlbGVtZW50ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxlbWVudElkKTtcblx0ICAgICAgICAgKiAgICAgICAgIGNvbnN0IHZpZXcgPSBhd2FpdCBmaW4uVmlldy5jcmVhdGUoe1xuXHQgICAgICAgICAqICAgICAgICAgICAgIG5hbWU6ICdteS12aWV3Jyxcblx0ICAgICAgICAgKiAgICAgICAgICAgICB1cmwsXG5cdCAgICAgICAgICogICAgICAgICAgICAgdGFyZ2V0OiBmaW4ubWUuaWRlbnRpdHlcblx0ICAgICAgICAgKiAgICAgICAgIH0pO1xuXHQgICAgICAgICAqICAgICAgICAgYXdhaXQgdmlldy5uYXZpZ2F0ZSh1cmwpO1xuXHQgICAgICAgICAqICAgICAgICAgYXdhaXQgdmlldy5iaW5kVG9FbGVtZW50KGVsZW1lbnQpO1xuXHQgICAgICAgICAqICAgICB9XG5cdCAgICAgICAgICogICAgIGNyZWF0ZUFuZEF0dGFjaFZpZXcoKS5jYXRjaChjb25zb2xlLmVycm9yKTtcblx0ICAgICAgICAgKiA8L3NjcmlwdD5cblx0ICAgICAgICAgKiBgYGBcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0aGlzLmJpbmRUb0VsZW1lbnQgPSBhc3luYyAoZWxlbWVudCkgPT4ge1xuXHQgICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRWxlbWVudCBub3QgZm91bmQuJyk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgY29uc3Q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udGl0eSkudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFJldHVybnMgYW4gaW5zdGFuY2Ugb2YgdGhlIG1haW4gV2luZG93IG9mIHRoZSBhcHBsaWNhdGlvblxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKlxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFdpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtQXBwbGljYXRpb24uZ2V0V2luZG93Lmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCBhcHAuZ2V0V2luZG93KCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogZ2V0V2luZG93KCkudGhlbih3aW4gPT4ge1xuXHQgICAgICogICAgIHdpbi5zaG93QXQoMCwgNDAwKTtcblx0ICAgICAqICAgICB3aW4uZmxhc2goKTtcblx0ICAgICAqIH0pLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRXaW5kb3coKSB7XG5cdCAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2FwcGxpY2F0aW9uLWdldC13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoZSkgPT4ge1xuXH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vbicsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvblBhdGg6ICdodHRwczovL3BhdGgudG8vYXBwL2ljb24uaWNvJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uSW5kZXg6IDBcblx0ICAgICAqICAgICAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgICAgICB7IHR5cGU6ICdzZXBhcmF0b3InIH0sXG5cdCAgICAgKiAgICAgICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdHlwZTogJ3Rhc2snLFxuXHQgICAgICogICAgICAgICAgICAgICAgIHRpdGxlOiBgUmVzdG9yZSAke2FwcE5hbWV9YCxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogJ1Jlc3RvcmUgdG8gbGFzdCBjb25maWd1cmF0aW9uJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZWVwTGluazogJ2ZpbnM6Ly9wYXRoLnRvL2FwcC9tYW5pZmVzdC5qc29uPyQkdXNlLWxhc3QtY29uZmlndXJhdGlvbj10cnVlJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uUGF0aDogJ2h0dHBzOi8vcGF0aC50by9hcHAvaWNvbi5pY28nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25JbmRleDogMFxuXHQgICAgICogICAgICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgICAgIF1cblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgbmFtZTogJ1Rvb2xzJyxcblx0ICAgICAqICAgICAgICAgICAgIGl0ZW1zOiBbIC8vIGFycmF5IG9mIEp1bXBMaXN0IGl0ZW1zXG5cdCAgICAgKiAgICAgICAgICAgICB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdHlwZTogJ3Rhc2snLFxuXHQgICAgICogICAgICAgICAgICAgICAgIHRpdGxlOiAnVG9vbCBBJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogJ1J1bnMgVG9vbCBBJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBkZWVwTGluazogJ2ZpbnM6Ly9wYXRoLnRvL3Rvb2wtYS9tYW5pZmVzdC5qc29uJyxcblx0ICAgICAqICAgICAgICAgICAgICAgICBpY29uUGF0aDogJ2h0dHBzOi8vcGF0aC50by90b29sLWEvaWNvbi5pY28nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25JbmRleDogMFxuXHQgICAgICogICAgICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAgICAgIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAndGFzaycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgdGl0bGU6ICdUb29sIEInLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiAnUnVucyBUb29sIEInLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGRlZXBMaW5rOiAnZmluczovL3BhdGgudG8vdG9vbC1iL21hbmlmZXN0Lmpzb24nLFxuXHQgICAgICogICAgICAgICAgICAgICAgIGljb25QYXRoOiAnaHR0cHM6Ly9wYXRoLnRvL3Rvb2wtYi9pY29uLmljbycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgaWNvbkluZGV4OiAwXG5cdCAgICAgKiAgICAgICAgICAgICB9XVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgXTtcblx0ICAgICAqXG5cdCAgICAgKiAgICAgYXBwLnNldEp1bXBMaXN0KGp1bXBMaXN0Q29uZmlnKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdKdW1wTGlzdCBhcHBsaWVkJykpLmNhdGNoKGUgPT4gY29uc29sZS5sb2coYEp1bXBMaXN0IGZhaWxlZCB0byBhcHBseTogJHtlLnRvU3RyaW5nKCl9YCkpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKlxuXHQgICAgICogVG8gaGFuZGxlIGRlZXBsaW5rIGFyZ3M6XG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogICAgIGZ1bmN0aW9uIGhhbmRsZVVzZUxhc3RDb25maWd1cmF0aW9uKCkge1xuXHQgICAgICogICAgICAgICAvLyB0aGlzIGhhbmRsZXIgaXMgY2FsbGVkIHdoZW4gdGhlIGFwcCBpcyBiZWluZyBsYXVuY2hlZFxuXHQgICAgICogICAgICAgICBhcHAub24oJ3J1bi1yZXF1ZXN0ZWQnLCBldmVudCA9PiB7XG5cdCAgICAgKiAgICAgICAgICAgICBpZihldmVudC51c2VyQXBwQ29uZmlnQXJnc1sndXNlLWxhc3QtY29uZmlndXJhdGlvbiddKSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgLy8geW91ciBsb2dpYyBoZXJlXG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH0pO1xuXHQgICAgICogICAgICAgICAvLyB0aGlzIGhhbmRsZXIgaXMgY2FsbGVkIHdoZW4gdGhlIGFwcCB3YXMgYWxyZWFkeSBydW5uaW5nIHdoZW4gdGhlIGxhdW5jaCB3YXMgcmVxdWVzdGVkXG5cdCAgICAgKiAgICAgICAgIGZpbi5kZXNrdG9wLm1haW4oZnVuY3Rpb24oYXJncykge1xuXHQgICAgICogICAgICAgICAgICAgaWYoYXJncyAmJiBhcmdzWyd1c2UtbGFzdC1jb25maWd1cmF0aW9uJ10pIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAvLyB5b3VyIGxvZ2ljIGhlcmVcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIHNldEp1bXBMaXN0KGp1bXBMaXN0Q2F0ZWdvcmllcykge1xuXHQgICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzZXQtanVtcC1saXN0JywgeyBjb25maWc6IG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5jdGlvbiBzZXRUcmF5SWNvbihpY29uKSB7XG5cdCAgICAgKiAgICAgY29uc3QgYXBwID0gYXdhaXQgZmluLkFwcGxpY2F0aW9uLmdldEN1cnJlbnQoKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLnNldFRyYXlJY29uKGljb24pO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIC8vIHVzZSBpbWFnZSB1cmwgdG8gc2V0IHRyYXkgaWNvblxuXHQgICAgICogc2V0VHJheUljb24oaW1hZ2VVcmwpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1NldHRpbmcgdHJheSBpY29uJykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqXG5cdCAgICAgKiAvLyB1c2UgYmFzZTY0IGVuY29kZWQgc3RyaW5nIHRvIHNldCB0cmF5IGljb25cblx0ICAgICAqIHNldFRyYXlJY29uKGJhc2U2NEVuY29kZWRJbWFnZSkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnU2V0dGluZyB0cmF5IGljb24nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICpcblx0ICAgICAqIC8vIHVzZSBhIGRhdGFVUkwgdG8gc2V0IHRyYXkgaWNvblxuXHQgICAgICogc2V0VHJheUljb24oZGF0YVVSTCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnU2V0dGluZyB0cmF5IGljb24nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIHNldFRyYXlJY29uKGljb24pIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlXG5cdCAgICAgICAgICAgIC5zZW5kQWN0aW9uKCdzZXQtdHJheS1pY29uJywge1xuXHQgICAgICAgICAgICBlbmFibGVkSWNvbjogaWNvbixcblx0ICAgICAgICAgICAgLi4udGhpcy5pZGVudGl0eVxuXHQ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AgICAgICAgIGNvbnN0IHBhZ2VSZXNwb25zZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAvLyBUT0RPOiBmaXggdHlwaW5nIChpbnRlcm5hbClcblx0ICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3Jcblx0ICAgICAgICAgICAgICAgIHRoaXMub24oQ09OU1RSVUNUT1JfQ0JfVE9QSUMsIGZ1bmN0aW9uIGZpcmVDb25zdHJ1Y3RvcihyZXNwb25zZSkge1xuXHQgICAgICAgICAgICAgICAgICAgIGxldCBjYlBheWxvYWQ7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgeyBzdWNjZXNzIH0gPSByZXNwb25zZTtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZURhdGEgPSByZXNwb25zZS5kYXRhO1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbWVzc2FnZSB9ID0gcmVzcG9uc2VEYXRhO1xuXHQgICAgICAgICAgICAgICAgICAgIGlmIChzdWNjZXNzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNiUGF5bG9hZCA9IHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0dHBSZXNwb25zZUNvZGU6IHJlc3BvbnNlRGF0YS5odHRwUmVzcG9uc2VDb2RlLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpSW5qZWN0ZWQ6IHJlc3BvbnNlRGF0YS5hcGlJbmplY3RlZFxuXHQgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY2JQYXlsb2FkID0ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogcmVzcG9uc2VEYXRhLm1lc3NhZ2UsXG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXR3b3JrRXJyb3JDb2RlOiByZXNwb25zZURhdGEubmV0d29ya0Vycm9yQ29kZSxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiByZXNwb25zZURhdGEuc3RhY2tcblx0ICAgICAgICAgICAgICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVMaXN0ZW5lcihDT05TVFJVQ1RPUl9DQl9UT1BJQywgZmlyZUNvbnN0cnVjdG9yKTtcblx0ICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSxcblx0ICAgICAgICAgICAgICAgICAgICAgICAgY2JQYXlsb2FkLFxuXHQgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzXG5cdCAgICAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIC8vIHNldCBkZWZhdWx0czpcblx0ICAgICAgICAgICAgaWYgKG9wdGlvbnMud2FpdEZvclBhZ2VMb2FkID09PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgIG9wdGlvbnMud2FpdEZvclBhZ2VMb2FkID0gZmFsc2U7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgaWYgKG9wdGlvbnMuYXV0b1Nob3cgPT09IHVuZGVmaW5lZCkge1xuXHQgICAgICAgICAgICAgICAgb3B0aW9ucy5hdXRvU2hvdyA9IHRydWU7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgKDAsIHdhcm5pbmdzXzEuaGFuZGxlRGVwcmVjYXRlZFdhcm5pbmdzKShvcHRpb25zKTtcblx0ICAgICAgICAgICAgY29uc3Qgd2luZG93Q3JlYXRpb24gPSB0aGlzLndpcmUuZW52aXJvbm1lbnQuY3JlYXRlQ2hpbGRDb250ZW50KHsgZW50aXR5VHlwZTogJ3dpbmRvdycsIG9wdGlvbnMgfSk7XG5cdCAgICAgICAgICAgIFByb21pc2UuYWxsKFtwYWdlUmVzcG9uc2UsIHdpbmRvd0NyZWF0aW9uXSlcblx0ICAgICAgICAgICAgICAgIC50aGVuKChyZXNvbHZlZEFycikgPT4ge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgcGFnZVJlc29sdmUgPSByZXNvbHZlZEFyclswXTtcblx0ICAgICAgICAgICAgICAgIGlmIChwYWdlUmVzb2x2ZS5zdWNjZXNzKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh0aGlzKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgICAgIHJlamVjdChwYWdlUmVzb2x2ZSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgaXMgdG8gZW5mb3JjZSBhIDUuMCBjb250cmFjdCB0aGF0IHRoZSBjaGlsZCdzIG1haW4gZnVuY3Rpb25cblx0ICAgICAgICAgICAgICAgICAgICAvLyB3aWxsIG5vdCBmaXJlIGJlZm9yZSB0aGUgcGFyZW50J3Mgc3VjY2VzcyBjYWxsYmFjayBvbiBjcmVhdGlvbi5cblx0ICAgICAgICAgICAgICAgICAgICAvLyBpZiB0aGUgY2hpbGQgd2luZG93IGlzIG5vdCBhY2Nlc3NpYmxlIChDT1JTKSB0aGlzIGNvbnRyYWN0IGRvZXNcblx0ICAgICAgICAgICAgICAgICAgICAvLyBub3QgaG9sZC5cblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCB3ZWJXaW5kb3cgPSB0aGlzLmdldFdlYldpbmRvdygpO1xuXHQgICAgICAgICAgICAgICAgICAgIHdlYldpbmRvdy5maW4uX19pbnRlcm5hbF8ub3BlbmVyU3VjY2Vzc0NCQ2FsbGVkKCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIGNvbW1vbiBmb3IgbWFpbiB3aW5kb3dzLCB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvci4gaGVyZSBqdXN0IHRvIGhhdmUgYSBkZWJ1ZyB0YXJnZXQuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gY29uc29sZS5lcnJvcihlKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSlcblx0ICAgICAgICAgICAgICAgIC5jYXRjaChyZWplY3QpO1xuXHQgICAgICAgIH0pO1xuXHQgICAgfVxuXHQgICAgLyoqXG5cdCAgICAgKiBSZXRyaWV2ZXMgYW4gYXJyYXkgb2YgZnJhbWUgaW5mbyBvYmplY3RzIHJlcHJlc2VudGluZyB0aGUgbWFpbiBmcmFtZSBhbmQgYW55XG5cdCAgICAgKiBpZnJhbWVzIHRoYXQgYXJlIGN1cnJlbnRseSBvbiB0aGUgcGFnZS5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldEFsbEZyYW1lcygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmdldEFsbEZyYW1lcy5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtc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hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLmdldEJvdW5kcygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGdldEJvdW5kcygpLnRoZW4oYm91bmRzID0+IGNvbnNvbGUubG9nKGJvdW5kcykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRCb3VuZHMoKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZVxuXHQgICAgICAgICAgICAuc2VuZEFjdGlvbignZ2V0LXdpbmRvdy1ib3VuZHMnLCB0aGlzLmlkZW50aXR5KVxuXHQgICAgICAgICAgICAudGhlbigoeyBwYXlsb2FkIH0pID0+IHBheWxvYWQuZGF0YSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIENlbnRlcnMgdGhlIHdpbmRvdyBvbiBpdHMgY3VycmVudCBzY3JlZW4uXG5cdCAgICAgKlxuXHQgICAgICogQHJlbWFya3MgRG9lcyBub3QgaGF2ZSBhbiBlZmZlY3Qgb24gbWluaW1pemVkIG9yIG1heGltaXplZCB3aW5kb3dzLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gY2VudGVyV2luZG93KCkge1xuXHQgICAgICogICAgIGNvbnN0IGFwcCA9IGF3YWl0IGZpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG5cdCAgICAgKiAgICAgICAgIG5hbWU6ICdteUFwcCcsXG5cdCAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG5cdCAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuY2VudGVyLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLmNlbnRlcigpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGNlbnRlcldpbmRvdygpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1dpbmRvdyBjZW50ZXJlZCcpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqXG5cdCAgICAgKi9cblx0ICAgIGNlbnRlcigpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2NlbnRlci13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFJlbW92ZXMgZm9jdXMgZnJvbSB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gYmx1cldpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LmJsdXIuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uYmx1cigpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGJsdXJXaW5kb3coKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdCbHVyZWQgV2luZG93JykpLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBibHVyKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignYmx1ci13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIEJyaW5ncyB0aGUgd2luZG93IHRvIHRoZSBmcm9udCBvZiB0aGUgd2luZG93IHN0YWNrLlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gQnJpbmdXaW5kb3dUb0Zyb250KCkge1xuXHQgICAgICogICAgIGNvbnN0IGFwcCA9IGF3YWl0IGZpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG5cdCAgICAgKiAgICAgICAgIG5hbWU6ICdteUFwcCcsXG5cdCAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG5cdCAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cuYnJpbmdUb0Zyb250Lmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF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5cdCAgICAgKiAgICAgICAgIHBvc2l0aW9uOiB7XG5cdCAgICAgKiAgICAgICAgICAgICB0b3A6IDEwMCxcblx0ICAgICAqICAgICAgICAgICAgIGxlZnQ6IDEwMCxcblx0ICAgICAqICAgICAgICAgICAgIGR1cmF0aW9uOiA1MDAsXG5cdCAgICAgKiAgICAgICAgICAgICByZWxhdGl2ZTogdHJ1ZVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgfTtcblx0ICAgICAqICAgICBjb25zdCBvcHRpb25zID0ge1xuXHQgICAgICogICAgICAgICBpbnRlcnJ1cHQ6IHRydWUsXG5cdCAgICAgKiAgICAgICAgIHR3ZWVuOiAnZWFzZS1pbidcblx0ICAgICAqICAgICB9O1xuXHQgICAgICpcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICAqICAgICByZXR1cm4gd2luLmFuaW1hdGUodHJhbnNpdGlvbnMsIG9wdGlvbnMpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFuaW1hdGVXaW5kb3coKVxuXHQgICAgICogICAgIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdBbmltYXRpb24gZG9uZScpKVxuXHQgICAgICogICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5lcnJvcihlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBhbmltYXRlKHRyYW5zaXRpb25zLCBvcHRpb25zKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZVxuXHQgICAgICAgICAgICAuc2VuZEFjdGlvbignYW5pbWF0ZS13aW5kb3cnLCB7XG5cdCAgICAgICAgICAgIHRyYW5zaXRpb25zLFxuXHQgICAgICAgICAgICBvcHRpb25zLFxuXHQgICAgICAgICAgICAuLi50aGlzLmlkZW50aXR5XG5cdCAgICAgICAgfSlcblx0ICAgICAgICAgICAgLnRoZW4oKCkgPT4gdW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Z2luX3BvbGljeSkgcG9saWN5IHJlcXVpcmVtZW50cy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogSW5qZWN0aW5nIGNvbnRlbnQgaW50byBhbiBlbXB0eSB3aW5kb3c6XG5cdCAgICAgKlxuXHQgICAgICogYGBganNcblx0ICAgICAqIChhc3luYyAoKT0+IHtcblx0ICAgICAqICAgICB0cnkge1xuXHQgICAgICogICAgICAgICBjb25zdCB3aW5OYW1lID0gYGNoaWxkLXdpbmRvdy0ke0RhdGUubm93KCl9YDtcblx0ICAgICAqICAgICAgICAgY29uc3Qgd2luID0gYXdhaXQgZmluLldpbmRvdy5jcmVhdGUoe1xuXHQgICAgICogICAgICAgICAgICAgbmFtZTogd2luTmFtZSxcblx0ICAgICAqICAgICAgICAgICAgIHVybDogJ2Fib3V0OmJsYW5rJ1xuXHQgICAgICogICAgICAgICB9KTtcblx0ICAgICAqICAgICAgICAgd2luLmdldFdlYldpbmRvdygpLmRvY3VtZW50LndyaXRlKCc8aDE+SGVsbG8gV29ybGQ8L2gxPicpO1xuXHQgICAgICogICAgIH0gY2F0Y2ggKGVycikge1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmVycm9yKGVycik7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSkoKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICpcblx0ICAgICAqIENsb25pbmcgRE9NIGVsZW1lbnRzIGZyb20gdGhlIHBhcmVudCB3aW5kb3cgKGluIHRoaXMgZXhhbXBsZSB3ZSBjbG9uZSBhbiBgaDNgIGVsZW1lbnQgZnJvbSB0aGUgcGFyZW50IHdpbmRvdyk6XG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogKGFzeW5jICgpPT4ge1xuXHQgICAgICogICAgIHRyeSB7XG5cdCAgICAgKiAgICAgICAgIGNvbnN0IGN1cnJlbnRXaW5kb3cgPSBhd2FpdCBmaW4uV2luZG93LmdldEN1cnJlbnQoKTtcblx0ICAgICA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iA9IGF3YWl0IGZpbi5XaW5kb3cuY3JlYXRlKHtcblx0ICAgICAqICAgICAgICAgICAgIG5hbWU6IGBjaGlsZC13aW5kb3ctJHtEYXRlLm5vdygpfWAsXG5cdCAgICAgKiAgICAgICAgICAgICB1cmw6ICdhYm91dDpibGFuaydcblx0ICAgICAqICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgIGNvbnN0IHRlbXBsYXRlID0gaHRtbGBcblx0ICAgICAqICAgICAgICAgICAgIDxkaXY+XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgPHNwYW4+Q2xpY2sgaGVyZTogPC9zcGFuPlxuXHQgICAgICogICAgICAgICAgICAgICAgIDxidXR0b24gQGNsaWNrPSR7KCk9PiBjb25zb2xlLmxvZygnSGVsbG8gV29ybGQhJyl9PmxvZyB0byB0aGUgY29uc29sZTwvYnV0dG9uPlxuXHQgICAgICogICAgICAgICAgICAgPC9kaXY+YDtcblx0ICAgICAqICAgICAgICAgcmVuZGVyKHRlbXBsYXRlLCB3aW4uZ2V0V2ViV2luZG93KCkuZG9jdW1lbnQuYm9keSk7XG5cdCAgICAgKlxuXHQgICAgICogICAgIH0gY2F0Y2ggKGVycikge1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmVycm9yKGVycik7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSkoKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRXZWJXaW5kb3coKSB7XG5cdCAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3dpbmRvdy1nZXQtd2ViLXdpbmRvdycsIHRoaXMuaWRlbnRpdHkpLmNhdGNoKChlKSA9PiB7XG5cdCAgICAgICAgICAgIC8vIHdlIGRvIG5vdCB3YW50IHRvIGV4cG9zZSB0aGlzIGVycm9yLCBqdXN0IGNvbnRpbnVlIGlmIHRoaXMgYW5hbHl0aWNzLW9ubHkgY2FsbCBmYWlsc1xuXHQgICAgICAgIH0pO1xuXHQgICAgIC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YXdhaXQgZmluLkFwcGxpY2F0aW9uLnN0YXJ0KHtcblx0ICAgICAqICAgICAgICAgbmFtZTogJ215QXBwJyxcblx0ICAgICAqICAgICAgICAgdXVpZDogJ2FwcC0xJyxcblx0ICAgICAqICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9kb2NzL2phdmFzY3JpcHQvc3RhYmxlL3R1dG9yaWFsLVdpbmRvdy5pc1Nob3dpbmcuaHRtbCcsXG5cdCAgICAgKiAgICAgICAgIGF1dG9TaG93OiB0cnVlXG5cdCAgICAgKiAgICAgfSk7XG5cdCAgICAgKiAgICAgY29uc3Qgd2luID0gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4uaXNTaG93aW5nKCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogaXNXaW5kb3dTaG93aW5nKCkudGhlbihib29sID0+IGNvbnNvbGUubG9nKGJvb2wpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgaXNTaG93aW5nKCkge1xuXHQgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignaXMtd2luZG93LXNob3dpbmcnLCB0aGlzLmlkZW50aXR5KS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogTWF4aW1pemVzIHRoZSB3aW5kb3dcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIG1heFdpbmRvdygpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93Lm1heGltaXplLmh0bWwnLFxuXHQgICAgICogICAgICAgICBhdXRvU2hvdzogdHJ1ZVxuXHQgICAgICogICAgIH0pO1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGFwcC5nZXRXaW5kb3coKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLm1heGltaXplKCk7XG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogbWF4V2luZG93KCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnTWF4aW1pemVkIHdpbmRvdycpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgbWF4aW1pemUoKSB7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdtYXhpbWl6ZS13aW5kb3cnLCB0aGlzLmlkZW50aXR5KS50aGVuKCgpID0+IHVuZGVmaW5lZCk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIE1pbmltaXplcyB0aGUgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gbWluV2luZG93KCkge1xuXHQgICAgICogICAgIGNvbnN0IHdpbiA9IGF3YWl0IGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpO1xuXHQgICAgICogICAgIHJldHVybiBhd2FpdCB3aW4ubWluaW1pemUoKTtcblx0ICAgICAqIH1cblx0ICAgICAqXG5cdCAgICAgKiBtaW5XaW5kb3coKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdNaW5pbWl6ZWQgd2luZG93Jyk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Bmb2N1cy5cblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbigpIHtcblx0ICAgICAqICAgICBjb25zdCBhcHAgPSBhd2FpdCBmaW4uQXBwbGljYXRpb24uc3RhcnQoe1xuXHQgICAgICogICAgICAgICBuYW1lOiAnbXlBcHAnLFxuXHQgICAgICogICAgICAgICB1dWlkOiAnYXBwLTEnLFxuXHQgICAgICogICAgICAgICB1cmw6ICdodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9zdGFibGUvdHV0b3JpYWwtV2luZG93LnNldEFzRm9yZWdyb3VuZC5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICpcblx0ICAgICAqIGFzeW5jIGZ1bmN0aW9uIHNldEFzRm9yZWdyb3VuZCgpIHtcblx0ICAgICAqICAgICBjb25zdCB3aW4gPSBhd2FpdCBjcmVhdGVXaW4oKTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgd2luLnNldEFzRm9yZWdyb3VuZCgpXG5cdCAgICAgKiB9XG5cdCAgICAgKlxuXHQgICAgICogc2V0QXNGb3JlZ3JvdW5kKCkudGhlbigoKSA9PiBjb25zb2xlLmxvZygnSW4gdGhlIGZvcmVncm91bmQnKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIHNldEFzRm9yZWdyb3VuZCgpIHtcblx0ICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3NldC1mb3JlZ3JvdW5kLXdpbmRvdycsIHRoaXMuaWRlbnRpdHkpLnRoZW4oKCkgPT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iAgICAge1xuXHQgICAgICogICAgICAgICBsYWJlbDogJ01lbnUgSXRlbSAxJyxcblx0ICAgICAqICAgICAgICAgZGF0YTogJ2hlbGxvIGZyb20gaXRlbSAxJ1xuXHQgICAgICogICAgIH0sXG5cdCAgICAgKiAgICAgeyB0eXBlOiAnc2VwYXJhdG9yJyB9LFxuXHQgICAgICogICAgIHtcblx0ICAgICAqICAgICAgICAgbGFiZWw6ICdNZW51IEl0ZW0gMicsXG5cdCAgICAgKiAgICAgICAgIHR5cGU6ICdjaGVja2JveCcsXG5cdCAgICAgKiAgICAgICAgIGNoZWNrZWQ6IHRydWUsXG5cdCAgICAgKiAgICAgICAgIGRhdGE6ICdUaGUgdXNlciBjbGlja2VkIHRoZSBjaGVja2JveCdcblx0ICAgICAqICAgICB9LFxuXHQgICAgICogICAgIHtcblx0ICAgICAqICAgICAgICAgbGFiZWw6ICdzZWUgbW9yZScsXG5cdCAgICAgKiAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLFxuXHQgICAgICogICAgICAgICBzdWJtZW51OiBbXG5cdCAgICAgKiAgICAgICAgICAgICB7IGxhYmVsOiAnc3VibWVudSAxJywgZGF0YTogJ2hlbGxvIGZyb20gc3VibWVudScgfVxuXHQgICAgICogICAgICAgICBdXG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogXVxuXHQgICAgICogZmluLm1lLnNob3dQb3B1cE1lbnUoeyB0ZW1wbGF0ZSB9KS50aGVuKHIgPT4ge1xuXHQgICAgICogICAgIGlmIChyLnJlc3VsdCA9PT0gJ2Nsb3NlZCcpIHtcblx0ICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ25vdGhpbmcgaGFwcGVuZWQnKTtcblx0ICAgICAqICAgICB9IGVsc2Uge1xuXHQgICAgICogICAgICAgICBjb25zb2xlLmxvZyhyLmRhdGEpXG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSlcblx0ICAgICAqIGBgYFxuXHQgICAgICpcblx0ICAgICAqIE92ZXJyaWRpbmcgdGhlIGJ1aWx0IGluIGNvbnRleHQgbWVudSAob3RlIHRoYXQgdGhpcyBjYW4gYmUgZG9uZSBwZXIgZWxlbWVudCBvciBkb2N1bWVudCB3aWRlKTpcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCdjb250ZXh0bWVudScsIGUgPT4ge1xuXHQgICAgICogICAgIGUucHJldmVudERlZmF1bHQoKTtcblx0ICAgICAqICAgICBjb25zdCB0ZW1wbGF0ZSA9IFtcblx0ICAgICAqICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgbGFiZWw6ICdNZW51IEl0ZW0gMScsXG5cdCAgICAgKiAgICAgICAgICAgICBkYXRhOiAnaGVsbG8gZnJvbSBpdGVtIDEnXG5cdCAgICAgKiAgICAgICAgIH0sXG5cdCAgICAgKiAgICAgICAgIHsgdHlwZTogJ3NlcGFyYXRvcicgfSxcblx0ICAgICAqICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgbGFiZWw6ICdNZW51IEl0ZW0gMicsXG5cdCAgICAgKiAgICAgICAgICAgICB0eXBlOiAnY2hlY2tib3gnLFxuXHQgICAgICogICAgICAgICAgICAgY2hlY2tlZDogdHJ1ZSxcblx0ICAgICAqICAgICAgICAgICAgIGRhdGE6ICdUaGUgdXNlciBjbGlja2VkIHRoZSBjaGVja2JveCdcblx0ICAgICAqICAgICAgICAgfSxcblx0ICAgICAqICAgICAgICAge1xuXHQgICAgICogICAgICAgICAgICAgbGFiZWw6ICdzZWUgbW9yZScsXG5cdCAgICAgKiAgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSxcblx0ICAgICAqICAgICAgICAgICAgIHN1Ym1lbnU6IFtcblx0ICAgICAqICAgICAgICAgICAgICAgICB7IGxhYmVsOiAnc3VibWVudSAxJywgZGF0YTogJ2hlbGxvIGZyb20gc3VibWVudScgfVxuXHQgICAgICogICAgICAgICAgICAgXVxuXHQgICAgICogICAgICAgICB9XG5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XHQgICAgLyoqXG5cdCAgICAgKiBBc3luY2hyb25vdXNseSByZXR1cm5zIGEgV2luZG93IG9iamVjdCB0aGF0IHJlcHJlc2VudHMgYW4gZXhpc3Rpbmcgd2luZG93LlxuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogYXN5bmMgZnVuY3Rpb24gY3JlYXRlV2luKCkge1xuXHQgICAgICogICAgIGNvbnN0IGFwcCA9IGF3YWl0IGZpbi5BcHBsaWNhdGlvbi5zdGFydCh7XG5cdCAgICAgKiAgICAgICAgIG5hbWU6ICdteUFwcCcsXG5cdCAgICAgKiAgICAgICAgIHV1aWQ6ICdhcHAtMScsXG5cdCAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L3N0YWJsZS90dXRvcmlhbC1XaW5kb3cud3JhcC5odG1sJyxcblx0ICAgICAqICAgICAgICAgYXV0b1Nob3c6IHRydWVcblx0ICAgICAqICAgICB9KTtcblx0ICAgICAqICAgICByZXR1cm4gYXdhaXQgYXBwLmdldFdpbmRvdygpO1xuXHQgICAgICogfVxuXHQgICAgICogY3JlYXRlV2luKCkudGhlbigoKSA9PiBmaW4uV2luZG93LndyYXAoeyB1dWlkOiAnYXBwLTEnLCBuYW1lOiAnbXlBcHAnIH0pKVxuXHQgICAgICogLnRoZW4od2luID0+IGNvbnNvbGUubG9nKCd3cmFwcGVkIHdpbmRvdycpKVxuXHQgICAgICogLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBhc3luYyB3cmFwKGlkZW50aXR5KSB7XG5cdCAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3dpbmRvdy13cmFwJykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gd2UgZG8gbm90IHdhbnQgdG8gZXhwb3N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oYXQgcmVwcmVzZW50cyB0aGUgY3VycmVudCB3aW5kb3dcblx0ICAgICAqXG5cdCAgICAgKiBAZXhhbXBsZVxuXHQgICAgICogYGBganNcblx0ICAgICAqIGZpbi5XaW5kb3cuZ2V0Q3VycmVudCgpXG5cdCAgICAgKiAudGhlbih3bmQgPT4gY29uc29sZS5sb2coJ2N1cnJlbnQgd2luZG93JykpXG5cdCAgICAgKiAuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuXHQgICAgICpcblx0ICAgICAqIGBgYFxuXHQgICAgICovXG5cdCAgICBnZXRDdXJyZW50KCkge1xuXHQgICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtY3VycmVudC13aW5kb3cnKS5jYXRjaCgoZSkgPT4ge1xuXHQgICAgICAgICAgICAvLyB3ZSBkbyBub3Qgd2FudCB0byBleHBvc2UgdGhpcyBlcnJvciwganVzdCBjb250aW51ZSBpZiB0aGlzIGFuYWx5dGljcy1vbmx5IGNhbGwgZmFpbHNcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5pc1dpbmRvdykge1xuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1lvdSBhcmUgbm90IGluIGEgV2luZG93IGNvbnRleHQnKTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgY29uc3QgeyB1dWlkLCBuYW1lIH0gPSB0aGlzLndpcmUubWU7XG5cdCAgICAgICAgcmV0dXJuIHRoaXMud3JhcCh7IHV1aWQsIG5hbWUgfSk7XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIFN5bmNocm9ub3VzbHkgcmV0dXJucyBhIFdpbmRvdyBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50IHdpbmRvd1xuXHQgICAgICpcblx0ICAgICAqIEBleGFtcGxlXG5cdCAgICAgKiBgYGBqc1xuXHQgICAgICogY29uc3Qgd25kID0gZmluLldpbmRvd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cbmNsYXNzIFN5c3RlbSBleHRlbmRzIGJhc2VfMSRqLkVtaXR0ZXJCYXNlIHtcbiAgICAvKipcbiAgICAgKiBAaW50ZXJuYWxcbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcih3aXJlKSB7XG4gICAgICAgIHN1cGVyKHdpcmUsICdzeXN0ZW0nKTtcbiAgICB9XG4gICAgc2VuZEV4dGVybmFsUHJvY2Vzc1JlcXVlc3QoYWN0aW9uLCBvcHRpb25zKSB7XG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICBjb25zdCBleGl0RXZlbnRLZXkgPSAnZXh0ZXJuYWwtcHJvY2Vzcy1leGl0ZWQnO1xuICAgICAgICAgICAgbGV0IHByb2Nlc3NVdWlkO1xuICAgICAgICAgICAgbGV0IGV4aXRQYXlsb2FkO1xuICAgICAgICAgICAgbGV0IGV4dGVybmFsUHJvY2Vzc0V4aXRIYW5kbGVyO1xuICAgICAgICAgICAgbGV0IG9mV2luZG93O1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zLmxpc3RlbmVyID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgZXh0ZXJuYWxQcm9jZXNzRXhpdEhhbmRsZXIgPSAocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBkYXRhID0gcGF5bG9hZCB8fCB7fTtcbiAgICAgICAgICAgICAgICAgICAgZXhpdFBheWxvYWQgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b3BpYzogJ2V4aXRlZCcsXG4gICAgICAgICAgICAgICAgICAgICAgICB1dWlkOiBkYXRhLnByb2Nlc3NVdWlkIHx8ICcnLFxuICAgICAgICAgICAgICAgICAgICAgICAgZXhpdENvZGU6IGRhdGEuZXhpdENvZGUgfHwgMFxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJvY2Vzc1V1aWQgPT09IHBheWxvYWQucHJvY2Vzc1V1aWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMubGlzdGVuZXIoZXhpdFBheWxvYWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgb2ZXaW5kb3cucmVtb3ZlTGlzdGVuZXIoZXhpdEV2ZW50S2V5LCBleHRlcm5hbFByb2Nlc3NFeGl0SGFuZGxlcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIC8vIHdpbmRvdyBjb25zdHJ1Y3RvciBleHBlY3RzIHRoZSBuYW1lIGlzIG5vdCB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICBpZiAoIXRoaXMud2lyZS5tZS5uYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMud2lyZS5tZS5uYW1lID0gdGhpcy53aXJlLm1lLnV1aWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG9mV2luZG93ID0gbmV3IHdpbmRvd18xLl9XaW5kb3codGhpcy53aXJlLCB0aGlzLndpcmUubWUpO1xuICAgICAgICAgICAgICAgIG9mV2luZG93Lm9uKGV4aXRFdmVudEtleSwgZXh0ZXJuYWxQcm9jZXNzRXhpdEhhbmRsZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy53aXJlXG4gICAgICAgICAgICAgICAgLnNlbmRBY3Rpb24oYWN0aW9uLCBvcHRpb25zKVxuICAgICAgICAgICAgICAgIC50aGVuKCh7IHBheWxvYWQgfSkgPT4ge1xuICAgICAgICAgICAgICAgIHByb2Nlc3NVdWlkID0gcGF5bG9hZC5kYXRhLnV1aWQ7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZShwYXlsb2FkLmRhdGEpO1xuICAgICAgICAgICAgICAgIGlmIChleGl0UGF5bG9hZCAmJiBwcm9jZXNzVXVpZCA9PT0gZXhpdFBheWxvYWQudXVp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MjY5OTE3NSc7XG4gICAgICogZmluLlN5c3RlbS5nZXRFbnRpdHlJbmZvKGVudGl0eVV1aWQsIGVudGl0eU5hbWUpLnRoZW4oaW5mbyA9PiBjb25zb2xlLmxvZyhpbmZvKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqXG4gICAgICogLy8gZXhhbXBsZSBpbmZvIHNoYXBlXG4gICAgICoge1xuICAgICAqICAgICBcInV1aWRcIjogXCJPcGVuZmluUE9DXCIsXG4gICAgICogICAgIFwibmFtZVwiOiBcIjQwYzc0YjVkLWVkOTgtNDBmNy04NTNmLWUzZDNjMjY5OTE3NVwiLFxuICAgICAqICAgICBcInBhcmVudFwiOiB7XG4gICAgICogICAgICAgICBcInV1aWRcIjogXCJPcGVuZmluUE9DXCIsXG4gICAgICogICAgICAgICBcIm5hbWVcIjogXCJPcGVuZmluUE9DXCJcbiAgICAgKiAgICAgfSxcbiAgICAgKiAgICAgXCJlbnRpdHlUeXBlXCI6IFwiaWZyYW1lXCJcbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0RW50aXR5SW5mbyh1dWlkLCBuYW1lKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWVudGl0eS1pbmZvJywgeyB1dWlkLCBuYW1lIH0pLnRoZW4oKHsgcGF5bG9hZCB9KSA9PiBwYXlsb2FkLmRhdGEpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBHZXRzIHRoZSB2YWx1ZSBvZiBhIGdpdmVuIGVudmlyb25tZW50IHZhcmlhYmxlIG9uIHRoZSBjb21wdXRlciBvbiB3aGljaCB0aGUgcnVudGltZSBpcyBpbnN0YWxsZWRcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4uU3lzdGVtLmdldEVudmlyb25tZW50VmFyaWFibGUoJ0hPTUUnKS50aGVuKGVudiA9PiBjb25zb2x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2FpdCBmaW4uU3lzdGVtLmdldEFsbFByb2Nlc3NJbmZvKCk7XG4gICAgICogYGBgXG4gICAgICogQGV4cGVyaW1lbnRhbFxuICAgICAqL1xuICAgIGFzeW5jIGdldEFsbFByb2Nlc3NJbmZvKCkge1xuICAgICAgICBjb25zdCB7IHBheWxvYWQ6IHsgZGF0YSB9IH0gPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWFsbC1wcm9jZXNzLWluZm8nLCB0aGlzLmlkZW50aXR5KTtcbiAgICAgICAgcmV0dXJuIGRhdGE7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHJpZXZlcyB0aGUgUHJveHkgc2V0dGluZ3MuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5nZXRQcm94eVNldHRpbmdzKCkudGhlbihQcm94eVNldHRpbmcgPT4gY29uc29sZS5sb2coUHJveHlTZXR0aW5nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqXG4gICAgICogLy9UaGlzIHJlc3BvbnNlIGhhcyB0aGUgZm9sbG93aW5nIHNoYXBlOlxuICAgICAqIHtcbiAgICAgKiAgICAgY29uZmlnOiB7XG4gICAgICogICAgICAgICBwcm94eUFkZHJlc3M6IFwicHJveHlBZGRyZXNzXCIsIC8vdGhlIGNvbmZpZ3VyZWQgUHJveHkgQWRkcmVzc1xuICAgICAqICAgICAgICAgcHJveHlQb3J0OiAwLCAvL3RoZSBjb25maWd1cmVkIFByb3h5IHBvcnRcbiAgICAgKiAgICAgICAgIHR5cGU6IFwic3lzdGVtXCIgLy9Qcm94eSBUeXBlXG4gICAgICogICAgIH0sXG4gICAgICogICAgIHN5c3RlbToge1xuICAgICAqICAgICAgICAgYXV0b0NvbmZpZ1VybDogXCJcIixcbiAgICAgKiAgICAgICAgIGJ5cGFzczogXCJcIixcbiAgICAgKiAgICAgICAgIGVuYWJsZW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luZyBvbiBNQUNfT1MsICdhbGlhcycgaXMgbm90IGF2YWlsYWJsZS4gSW5zdGVhZCBwcm92aWRlXG4gICAgICogdGhlIGZ1bGwgcGF0aCBlLmcuIF8vQXBwbGljYXRpb25zL0NhbGN1bGF0b3IuYXBwL0NvbnRlbnRzL01hY09TL0NhbGN1bGF0b3JfLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBCYXNpYyBFeGFtcGxlOlxuICAgICAqIGBgYGpzXG4gICAgICogZmluLlN5c3RlbS5sYXVuY2hFeHRlcm5hbFByb2Nlc3Moe1xuICAgICAqICAgICBwYXRoOiAnbm90ZXBhZCcsXG4gICAgICogICAgIGFyZ3VtZW50czogJycsXG4gICAgICogICAgIGxpc3RlbmVyOiBmdW5jdGlvbiAocmVzdWx0KSB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBQcm9taXNlIHJlc29sdXRpb246XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIC8vVGhpcyByZXNwb25zZSBoYXMgdGhlIGZvbGxvd2luZyBzaGFwZTpcbiAgICAgKiB7XG4gICAgICogICAgIHV1aWQ6IFwiRkIzRTZFMzYtMDk3Ni00QzJCLTlBMDktRkIyRTU0RDJGMUJCXCIgLy8gVGhlIG1hcHBlZCBVVUlEIHdoaWNoIGlkZW50aWZpZXMgdGhlIGxhdW5jaGVkIHByb2Nlc3NcbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICpc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emlwIGZpbGUgc3BlY2lmaWVkIGluIGFwcEFzc2V0c1xuICAgICAqICAgICAvL3dpbGwgZGVmYXVsdCB0byB0aGUgb25lIG1lbnRpb25lZCBieSBhcHBBc3NldHMudGFyZ2V0XG4gICAgICogICAgIC8vSWYgdGhlIHRoZSBwYXRoIGJlbG93IHJlZmVycyB0byBhIHNwZWNpZmljIHBhdGggaXQgd2lsbCBvdmVycmlkZSB0aGlzIGRlZmF1bHRcbiAgICAgKiAgICAgYWxpYXM6ICdteUFwcCcsXG4gICAgICogICAgIGxpc3RlbmVyOiAocmVzdWx0KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KS50aGVuKHByb2Nlc3NJZGVudGl0eSA9PiB7XG4gICAgICogICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogfSkuY2F0Y2goZXJyb3IgPT4ge1xuICAgICAqICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICogfSk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBFeGFtcGxlIHVzaW5nIGFuIGFsaWFzIGJ1dCBvdmVycmlkaW5nIHRoZSBhcmd1bWVudHM6XG4gICAgICpcbiAgICAgKiBgYGBqc29uXG4gICAgICogXCJhcHBBc3NldHNcIjogW1xuICAgICAqICAgICB7XG4gICAgICogICAgICAgICBcInNyY1wiOiBcImV4ZS56aXBcIixcbiAgICAgKiAgICAgICAgIFwiYWxpYXNcIjogXCJteUFwcFwiLFxuICAgICAqICAgICAgICAgXCJ2ZXJzaW9uXCI6IFwiNC4xMi44XCIsXG4gICAgICogICAgICAgICBcInRhcmdldFwiOiBcIm15QXBwLmV4ZVwiLFxuICAgICAqICAgICAgICAgXCJhcmdzXCI6IFwiYSBiIGMgZFwiXG4gICAgICogICAgIH0sXG4gICAgICogXVxuICAgICAqIGBgYF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dpbiA9IGZpbi5XaW5kb3cuZ2V0Q3VycmVudFN5bmMoKTtcbiAgICAgKiB3aW4uYWRkTGlzdGVuZXIoJ2ZpbGUtZG93bmxvYWQtY29tcGxldGVkJywgKGV2dCkgPT4ge1xuICAgICAqICAgICBpZiAoZXZ0LnN0YXRlID09PSAnY29tcGxldGVkJykge1xuICAgICAqICAgICAgICAgZmluLlN5c3RlbS5sYXVuY2hFeHRlcm5hbFByb2Nlc3Moe1xuICAgICAqICAgICAgICAgICAgIGZpbGVVdWlkOiBldnQuZmlsZVV1aWQsXG4gICAgICogICAgICAgICAgICAgYXJndW1lbnRzOiAnJyxcbiAgICAgKiAgICAgICAgICAgICBsaXN0ZW5lcjogKHJlc3VsdCkgPT4ge1xuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygndGhlIGV4aXQgY29kZScsIHJlc3VsdC5leGl0Q29kZSk7XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfSkudGhlbihwcm9jZXNzSWRlbnRpdHkgPT4ge1xuICAgICAqICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByb2Nlc3NJZGVudGl0eSk7XG4gICAgICogICAgICAgICB9KS5jYXRjaChlcnJvciA9PiB7XG4gICAgICogICAgICAgICAgICAgY29uc29sZS5sb2coZXJyb3IpO1xuICAgICAqICAgICAgICAgfSk7XG4gICAgICogICAgIH1cbiAgICAgKiB9KTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIExhdW5jaGluZyBhc3NldHMgc3BlY2lmaWVkIGluIHRoZSBhcHAgbWFuaWZlc3Q6XG4gICAgICpcbiAgICAgKiBTYW1wbGUgYXBwQXNzZXRzIHNlY3Rpb24gaW4gYXBwLmpzb25cbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcImFwcEFzc2V0c1wiOiBbXG4gICAgICogICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgXCJzcmNcIjogXCJodHRwOi8vZmlsZXNhbXBsZXMuY29tL2V4ZS56aXBcIixcbiAgICAgKiAgICAgICAgICAgICBcImFsaWFzXCI6IFwibXlBcHBcIixcbiAgICAgKiAgICAgICAgICAgICBcInZlcnNpb25cIjogXCI0LjEyLjhcIixcbiAgICAgKiAgICAgICAgICAgICBcInRhcmdldFwiOiBcIm15QXBwLmV4ZVwiLFxuICAgICAqICAgICAgICAgICAgIFwiYXJnc1wiOiBcImEgYiBjIGRcIlxuICAgICAqICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICBcInNyY1wiOiBcImh0dHA6Ly9leGFtcGxlcy5jb20vZXhlLnppcFwiLFxuICAgICAqICAgICAgICAgICAgIFwiYWxpYXNcIjogXCJteUFwcDJcIixcbiAgICAgKiAgICAgICAgICAgICBcInZlcnNpb25cIjogXCI1LjEyLjhcIixcbiAgICAgKiAgICAgICAgICAgICBcInRhcmdldFwiOiBcIm15QXBwMi5leGVcIixcbiAgICAgKiAgICAgICAgICAgICBcImFyZ3NcIjogXCJhIGIgY1wiXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIF1cbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIFRoaXMgcGVybWlzc2lvbiBhbGxvd3MgZm9yIGxhdW5jaGluZyBvZiBhbGwgYXNzZXRzIHNwZWNpZmllZCBpbiB0aGUgYWJvdmUgYXBwQXNzZXRzIHNlY3Rpb24uIChcIm15QXBwXCIgYW5kIFwibXlBcHAyXCIpOlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiYXNzZXRzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICogVGhpcyBwZXJtaXNzaW9uIGFsbG93cyBmb3IgbGF1bmNoaW5nIG9mIF9vbmx5XyB0aGUgXCJteUFwcFwiIGFzc2V0IGluIHRoZSBhYm92ZSBhcHBBc3NldHMgc2VjdGlvbiwgYXMgZGVmaW5lZCBpbiBgc3JjUnVsZXNgOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImFzc2V0c1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJzcmNSdWxlc1wiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiKjovL2ZpbGVzYW1wbGVzLmNvbS8qXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcImFsbG93XCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIjxhbGxfdXJscz5cIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwiYmxvY2tcIlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBMYXVuY2hpbmcgZG93bmxvYWRlZCBmaWxlczpcbiAgICAgKiBgYGBqc1xuICAgICAqICAgICBcInBlcm1pc3Npb25zXCI6IHtcbiAgICAgKiAgICAgICAgXCJTeXN0ZW1cIjoge1xuICAgICAqICAgICAgICAgICAgXCJsYXVuY2hFeHRlcm5hbFByb2Nlc3NcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICBcImVuYWJsZWRcIjogdHJ1ZSxcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJkb3dubG9hZHNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgfVxuICAgICAqICAgICB9XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBUaGlzIHBlcm1pc3Npb24gYWxsb3dzIHRvIGxhdW5jaCBhbGwgdGhlIGV4ZWN1dGFibGVzOlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcImxhdW5jaEV4dGVybmFsUHJvY2Vzc1wiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcImV4ZWN1dGFibGVzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgIH1cbiAgICAgKiAgICAgfVxuICAgICAqIGBgYFxuICAgICAqXG4gICAgICpcbiAgICAgKiBUaGlzIHBlcm1pc3Npb24gb25seSBhbGxvd3MgbGF1bmNoaW5nIG9mIGV4ZWN1dGFibGVzIHdob3NlIGZpbGUgcGF0aHMgbWF0Y2ggdGhlIGNvcnJlc3BvbmRpbmcgYHBhdGhSdWxlc2A6XG4gICAgICogYGBganNcbiAgICAgKiAgICAgXCJwZXJtaXNzaW9uc1wiOiB7XG4gICAgICogICAgICAgIFwiU3lzdGVtXCI6IHtcbiAgICAgKiAgICAgICAgICAgIFwibGF1bmNoRXh0ZXJuYWxQcm9jZXNzXCI6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWUsXG4gICAgICogICAgICAgICAgICAgICAgIFwiZXhlY3V0YWJsZXNcIjoge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgXCJlbmFibGVkXCI6IHRydWVcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIFwicGF0aFJ1bGVzXCI6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIvV2luZG93cy9TeXN0ZW0zMi8qLmV4ZVwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJhbGxvd1wiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIqLmV4ZVwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYmVoYXZpb3JcIjogXCJibG9ja1wiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBsYXVuY2hFeHRlcm5hbFByb2Nlc3Mob3B0aW9ucykge1xuICAgICAgICByZXR1cm4gdGhpcy5zZW5kRXh0ZXJuYWxQcm9jZXNzUmVxdWVzdCgnbGF1bmNoLWV4dGVybmFsLXByb2Nlc3MnLCBvcHRpb25zKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogTW9uaXRvcnMgYSBydW5uaW5nIHByb2Nlc3MuIEEgcGlkIGZvciB0aGUgcHJvY2VzcyBtdXN0IGJlIGluY2x1ZGVkIGluIG9wdGlvbnMuXG4gICAgICogPGJyPiBBIHV1aWQgbWF5IGJlIG9wdGlvbmFsbHkgcHJvdmlkZWQuIElmIG5vdCBwcm92aWRlZCwgT3BlbkZpbiB3aWxsIGNyZWF0ZSBhIHV1aWQgZm9yIHRoZSBuZXcgcHJvY2Vzcy5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIElmIGFuIHVudXNlZCB1dWlkIGlzIHByb3ZpZGVkIGluIG9wdGlvbnMsIGl0IHdpbGwgYmUgdXNlZC4gSWYgbm8gd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eXN0ZW0ub3BlblVybFdpdGhCcm93c2VyLmh0bWwnKVxuICAgICAqIC50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdPcGVuZWQgVVJMJykpXG4gICAgICogLmNhdGNoKGVyciA9PiBjb25zb2xlLmxvZyhlcnIpKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIEV4YW1wbGUgb2YgcGVybWlzc2lvbiBkZWZpbml0aW9uIHRvIGVuYWJsZSBub24tZGVmYXVsdCBwcm90b2NvbHM6XG4gICAgICpcbiAgICAgKiBOb3RlOiBwZXJtaXNzaW9uIGRlZmluaXRpb24gc2hvdWxkIGJlIHNwZWNpZmllZCBpbiBhbiBhcHAgbWFuaWZlc3QgZmlsZSBpZiB0aGVyZSBpcyBubyBET1Mgc2V0dGluZ3MuXG4gICAgICogT3RoZXJ3aXNlIGl0IGhhcyB0byBiZSBzcGVjaWZpZWQgaW4gYm90aCBET1MgYW5kIGFwcCBtYW5pZmVzdCBmaWxlcy5cbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogICAgIFwicGVybWlzc2lvbnNcIjoge1xuICAgICAqICAgICAgICBcIlN5c3RlbVwiOiB7XG4gICAgICogICAgICAgICAgICBcIm9wZW5VcmxXaXRoQnJvd3NlclwiOiB7XG4gICAgICogICAgICAgICAgICAgICAgIFwiZW5hYmxlZFwiOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgICAgICBcInByb3RvY29sc1wiOiBbIFwibXN0ZWFtc1wiLCBcInNsYWNrXCJdXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBvcGVuVXJsV2l0aEJyb3dzZXIodXJsKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignb3Blbi11cmwtd2l0aC1icm93c2VyJywgeyB1cmwgfSkudGhlbigoKSA9PiB1bmRlZmluZWQpO1xuICAgIH1cbiAg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0ZXM6IHByb2dyZXNzLnRvdGFsQnl0ZXNcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHByb2dyZXNzTGlzdGVuZXIocCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29uc3QgY2xlYW5MaXN0ZW5lcnMgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gVE9ETzogZml4IGludGVybmFsIHR5cGVzXG4gICAgICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlTGlzdGVuZXIoZGxQcm9ncmVzc0tleSwgZGxQcm9ncmVzcyk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29uc3QgZGxFcnJvciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICAgICAgY2xlYW5MaXN0ZW5lcnMoKTtcbiAgICAgICAgICAgICAgICBjb25zdCB7IHJlYXNvbiwgZXJyOiBlcnJvciB9ID0gcGF5bG9hZDtcbiAgICAgICAgICAgICAgICByZWplY3QobmV3IHRyYW5zcG9ydF9lcnJvcnNfMSQxLlJ1bnRpbWVFcnJvcih7IHJlYXNvbiwgZXJyb3IgfSwgY2FsbHNpdGVzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29uc3QgZGxDb21wbGV0ZSA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICBjbGVhbkxpc3RlbmVycygpO1xuICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvLyBUT0RPOiBmaXggaW50ZXJuYWwgdHlwZXNcbiAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgIHRoaXMub24oZGxQcm9ncmVzc0tleSwgZGxQcm9ncmVzcyk7XG4gICAgICAgICAgICAvLyBUT0RPOiBmaXggaW50ZXJuYWwgdHlwZXNcbiAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgIHRoaXMub25jZShkbEVycm9yS2V5LCBkbEVycm9yKTtcbiAgICAgICAgICAgIC8vIFRPRE86IGZpeCBpbnRlcm5hbCB0eXBlc1xuICAgICAgICAgICAgLy8gQHRzLWV4cGVjdC1lcnJvclxuICAgICAgICAgICAgdGhpcy5vbmNlKGRsQ29tcGxldGVLZXksIGRsQ29tcGxldGUpO1xuICAgICAgICAgICAgY29uc3QgZG93bmxvYWRPcHRpb25zID0gT2JqZWN0LmFzc2lnbihvcHRpb25zLCB7IGRvd25sb2FkSWQgfSk7XG4gICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignZG93bmxvYWQtcnVudGltZScsIGRvd25sb2FkT3B0aW9ucykuY2F0Y2goKGVycikgPT4ge1xuICAgICAgICAgICAgICAgIGNsZWFuTGlzdGVuZXJzKCk7XG4gICAgICAgICAgICAgICAgcmVqZWN0KGVycik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIERvd25sb2FkIHByZWxvYWQgc2NyaXB0cyBmcm9tIGdpdmVuIFVSTHNcbiAgICAgKiBAcGFyYW0gc2NyaXB0cyAtIFVSTHMgb2YgcHJlbG9hZCBzY3JpcHRzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHNjcmlwdHMgPSBbXG4gICAgICogICAgIHsgdXJsOiAnaHR0cDovLy4uLi9wcmVsb2FkLmpzJyB9LFxuICAgICAqICAgICB7IHVybDogJ2h0dHA6Ly8uLi4vcHJlbG9hZDIuanMnIH1cbiAgICAgKiBdO1xuICAgICAqXG4gICAgICogZmluLlN5c3RlbS5kb3dubG9hZFByZWxvYWRTY3JpcHRzKHNjcmlwdHMpLnRoZW4ocmVzdWx0cyA9PiB7XG4gICAgICogICAgIHJlc3VsdHMuZm9yRWFjaCgoe3VybCwgc3VjY2VzcywgZXJyb3J9KS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lcmV9LlxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiAvLyBSRUdfRFdPUkRcbiAgICAgKiB7XG4gICAgICogICAgIGRhdGE6IDEsXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9MT0NBTF9NQUNISU5FXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19EV09SRFwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19RV09SRFxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogMTMxMDgxNDY2NzEzMzQxMTIsXG4gICAgICogICAgIHJvb3RLZXk6IFwiSEtFWV9MT0NBTF9NQUNISU5FXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19RV09SRFwiLFxuICAgICAqICAgICB2YWx1ZTogXCJCYXpcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIC8vIFJFR19TWlxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogXCJGb29CYXJCYXpcIixcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0xPQ0FMX01BQ0hJTkVcIixcbiAgICAgKiAgICAgc3Via2V5OiBcIkZvb1xcQmFyXCIsXG4gICAgICogICAgIHR5cGU6IFwiUkVHX1NaXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX0VYUEFORF9TWlxuICAgICAqIHtcbiAgICAgKiAgICAgZGF0YTogXCJDOlxcVXNlclxcSm9obkRvZVxcQXBwRGF0YVxcTG9jYWxcIixcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0NVUlJFTlRfVVNFUlwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfRVhQQU5EX1NaXCIsXG4gICAgICogICAgIHZhbHVlOiBcIkJhelwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogLy8gUkVHX01VTFRJX1NaXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiBbXG4gICAgICogICAgICAgICBcIkZvb1wiLFxuICAgICAqICAgICAgICAgXCJCYXJcIixcbiAgICAgKiAgICAgICAgIFwiQmF6XCJcbiAgICAgKiAgICAgXSxcbiAgICAgKiAgICAgcm9vdEtleTogXCJIS0VZX0NVUlJFTlRfVVNFUlwiLFxuICAgICAqICAgICBzdWJrZXk6IFwiRm9vXFxCYXJcIixcbiAgICAgKiAgICAgdHlwZTogXCJSRUdfTVVMVElfU1pcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiAvLyBSRUdfQklOQVJZXG4gICAgICoge1xuICAgICAqICAgICBkYXRhOiB7XG4gICAgICogICAgICAgICBkYXRhOiBbXG4gICAgICogICAgICAgICAgICAgMjU1LFxuICAgICAqICAgICAgICAgICAgIDI1NSxcbiAgICAgKiAgICAgICAgICAgICAwLFxuICAgICAqICAgICAgICAgICAgIDQzLFxuICAgICAqICAgICAgICAgICAgIDU1LFxuICAgICAqICAgICAgICAgICAgIDAsXG4gICAgICogICAgICAgICAgICAgMCxcbiAgICAgKiAgICAgICAgICAgICAyNTUsXG4gICAgICogICAgICAgICAgICAgMjU1XG4gICAgICogICAgICAgICBdLFxuICAgICAqICAgICAgICAgdHlwZTogXCJCdWZmZXJcIlxuICAgICAqICAgICB9LFxuICAgICAqICAgICByb290S2V5OiBcIkhLRVlfQ1VSUkVOVF9VU0VSXCIsXG4gICAgICogICAgIHN1YmtleTogXCJGb29cXEJhclwiLFxuICAgICAqICAgICB0eXBlOiBcIlJFR19CSU5BUllcIixcbiAgICAgKiAgICAgdmFsdWU6IFwiQmF6XCJcbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICovXG4gIC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AgICB0aGlzLndpcmUuc2VuZEFjdGlvbignc3lzdGVtLXJlZ2lzdGVyLXNodXRkb3duLWhhbmRsZXInKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBTeXN0ZW1TaHV0ZG93bkV2ZW50TmFtZSA9ICdzeXN0ZW0tc2h1dGRvd24nO1xuICAgICAgICBjb25zdCBTeXN0ZW1TaHV0ZG93bkhhbmRsZWRFdmVudE5hbWUgPSAnc3lzdGVtLXNodXRkb3duLWhhbmRsZWQnO1xuICAgICAgICBjb25zdCB7IHV1aWQsIG5hbWUgfSA9IHRoaXMud2lyZS5tZTtcbiAgICAgICAgY29uc3Qgc2h1dGRvd25IYW5kbGVyID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHByb2NlZWQgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gbm90aWZ5IGNvcmUgdGhhdCB0aGUgYXBwIGlzIHJlYWR5IGZvciBzaHV0ZG93blxuICAgICAgICAgICAgICAgIHRoaXMud2lyZS5lbnZpcm9ubWVudC5yYWlzZUV2ZW50KGBhcHBsaWNhdGlvbi8ke1N5c3RlbVNodXRkb3duSGFuZGxlZEV2ZW50TmFtZX1gLCB7XG4gICAgICAgICAgICAgICAgICAgIHV1aWQsXG4gICAgICAgICAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHRvcGljOiAnYXBwbGljYXRpb24nXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgaGFuZGxlcih7IHByb2NlZWQgfSk7XG4gICAgICAgIH07XG4gICAgICAgIHRoaXMub24oU3lzdGVtU2h1dGRvd25FdmVudE5hbWUsIHNodXRkb3duSGFuZGxlcik7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNpZ25hbHMgdGh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AqICAgICAgICAgICAgIGFwaVZlcnNpb246ICcxLjAnLFxuICAgICAqICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICdob21lJyxcbiAgICAgKiAgICAgICAgICAgICBjb21wb25lbnRWZXJzaW9uOiAnMS4wJyxcbiAgICAgKiAgICAgICAgICAgICBhbGxvd2VkOiB0cnVlLFxuICAgICAqICAgICAgICAgICAgIHJlamVjdGlvbkNvZGU6ICcnXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0pO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIHJlZ2lzdGVyVXNhZ2UoKS50aGVuKCgpID0+IGNvbnNvbGUubG9nKCdTdWNjZXNzZnVsbHkgcmVnaXN0ZXJlZCBjb21wb25lbnQgYXBwbGljYXRpb24nKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIHJlZ2lzdGVyVXNhZ2UoeyBkYXRhLCB0eXBlIH0pIHtcbiAgICAgICAgYXdhaXQgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ3JlZ2lzdGVyLXVzYWdlJywgeyBkYXRhLCB0eXBlIH0pO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIGFuIGFycmF5IHdpdGggYWxsIHByaW50ZXJzIG9mIHRoZSBjYWxsZXIgYW5kIG5vdCBhbGwgdGhlIHByaW50ZXJzIG9uIHRoZSBkZXNrdG9wLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGZpbi5TeXN0ZW0uZ2V0UHJpbnRlcnMoKVxuICAgICAqICAgICAudGhlbigocHJpbnRlcnMpID0+IHtcbiAgICAgKiAgICAgICAgIHByaW50ZXJzLmZvckVhY2goKHByaW50ZXIpID0+IHtcbiAgICAgKiAgICAgICAgICAgICBpZiAocHJpbnRlci5pc0RlZmF1bHQpIHtcbiAgICAgKiAgICAgICAgICAgICAgICA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9ucyh7XG4gICAgICogICAgIGludGVydmFsOiAxMCxcbiAgICAgKiAgICAgb3V0bGllckRldGVjdGlvbjoge1xuICAgICAqICAgICAgICAgaW50ZXJ2YWw6IDE1LFxuICAgICAqICAgICAgICAgZW50cmllczogMjAwXG4gICAgICogICAgIH1cbiAgICAgKiB9KTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyB1cGRhdGVQcm9jZXNzTG9nZ2luZ09wdGlvbnMob3B0aW9ucykge1xuICAgICAgICBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignc3lzdGVtLXVwZGF0ZS1wcm9jZXNzLWxvZ2dpbmctb3B0aW9ucycsIHsgb3B0aW9ucyB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBkb21haW4gc2V0dGluZ3MgZm9yIHRoZSBjdXJyZW50IGFwcGxpY2F0aW9uLlxuICAgICAqIEluaXRpYWwgc2V0dGluZ3MgYXJlIGNvbmZpZ3VyZWQgd2l0aCB0aGUgZGVmYXVsdERvbWFpblNldHRpbmdzIGFwcGxpY2F0aW9uIG9wdGlvbiB2aWEgbWFuaWZlc3QuXG4gICAgICogRG9tYWluIHNldHRpbmdzIGNhbiBiZSBvdmVyd3JpdHRlbiBkdXJpbmcgcnVudGltZSB3aXRoIFN5c3RlbS5zZXREb21haW5TZXR0aW5ncy5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgZG9tYWluU2V0dGluZ3MgPSBhd2FpdCBmaW4uU3lzdGVtLmdldERvbWFpblNldHRpbmdzKCk7XG4gICAgICogLy8ge1xuICAgICAqIC8vICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJodHRwczovL29wZW5maW4uY29cIlxuICAgICAqIC8vICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJkb3dubG9hZFNldHRpbmdzXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIjxhbGxfdXJscz5cIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwicHJvbXB0XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogLy8gICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICB9XG4gICAgICogLy8gICAgIF1cbiAgICAgKiAvLyB9XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0RG9tYWluU2V0dGluZ3MoKSB7XG4gICAgICAgIGNvbnN0IHsgcGF5bG9hZDogeyBkYXRhIH0gfSA9IGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdnZXQtZG9tYWluLXNldHRpbmdzJywgdGhpcy5pZGVudGl0eSk7XG4gICAgICAgIHJldHVybiBkYXRhO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBTZXRzIHRoZSBkb21haW4gc2V0dGluZ3MgZm9yIHRoZSBjdXJyZW50IGFwcGxpY2F0aW9uLlxuICAgICAqIEBwYXJhbSBkb21haW5TZXR0aW5ncyAtIGRvbWFpbiBzZXR0aW5ncyBvYmplY3RcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgZG9tYWluU2V0dGluZ3MgPSBhd2FpdCBmaW4uU3lzdGVtLmdldERvbWFpblNldHRpbmdzKCk7XG4gICAgICogLy8ge1xuICAgICAqIC8vICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICBcIm1hdGNoXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJodHRwczovL29wZW5maW4uY29cIlxuICAgICAqIC8vICAgICAgICAgICAgIF0sXG4gICAgICogLy8gICAgICAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgXCJkb3dubG9hZFNldHRpbmdzXCI6IHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgIFwicnVsZXNcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIjxhbGxfdXJscz5cIlxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImJlaGF2aW9yXCI6IFwicHJvbXB0XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogLy8gICAgICAgICAgICAgICAgIH1cbiAgICAgKiAvLyAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICB9XG4gICAgICogLy8gICAgIF1cbiAgICAgKiAvLyB9XG4gICAgICpcbiAgICAgKiAvLyBWYWxpZCBydWxlIGJlaGF2aW9ycyBhcmUgJ3Byb21wdCcgYW5kICduby1wcm9tcHQnXG4gICAgICogZG9tYWluU2V0dGluZ3MucnVsZXNbMF0ub3B0aW9ucy5kb3dubG9hZFNldHRpbmdzLnJ1bGVzWzBdLmJlaGF2aW9yID0gJ25vLXByb21wdCc7XG4gICAgICpcbiAgICAgKiBhd2FpdCBmaW4uU3lzdGVtLnNldERvbWFpblNldHRpbmdzKGRvbWFpblNldHRpbmdzKTtcbiAgICAgKlxuICAgICAqIGNvbnN0IG5ld0RvbWFpblNldHRpbmdzID0gYXdhaXQgZmluLlN5c3RlbS5nZXREb21haW5TZXR0aW5ncygpO1xuICAgICAqIC8vIHtcbiAgICAgKiAvLyAgICAgXCJydWxlc1wiOiBbXG4gICAgICogLy8gICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgXCJtYXRjaFwiOiBbXG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiaHR0cHM6Ly9vcGVuZmluLmNvXCJcbiAgICAgKiAvLyAgICAgICAgICAgICBdLFxuICAgICAqIC8vICAgICAgICAgICAgIFwib3B0aW9uc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgIFwiZG93bmxvYWRTZXR0aW5nc1wiOiB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICBcInJ1bGVzXCI6IFtcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibWF0Y2hcIjogW1xuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCI8YWxsX3VybHM+XCJcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgKiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJiZWhhdmlvclwiOiBcIm5vLXByb21wdFwiXG4gICAgICogLy8gICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAqIC8vICAgICAgICAgICAgICAgICB9XG4gICAgICogLy8gICAgICAgICAgICAgfVxuICAgICAqIC8vICAgICAgICAgfVxuICAgICAqIC8vICAgICBdXG4gICAgICogLy8gfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIHNldERvbWFpblNldHRpbmdzKGRvbWFpblNldHRpbmdzKSB7XG4gICAgICAgIGF3YWl0IHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzZXQtZG9tYWluLXNldHRpbmdzJywgeyBkb21haW5TZXR0aW5ncywgLi4udGhpcy5pZGVudGl0eSB9KTtcbiAgICB9XG59XG5zeXN0ZW0uU3lzdGVtID0gU3lzdGVtO1xuXG52YXIgaW50ZXJhcHBidXMgPSB7fTtcblxudmFyIHJlZkNvdW50ZXIgPSB7fTtcblxuT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlZkNvdW50ZXIsIFwiX19lc01vZHVsZVwiLCB7IHZhbHVlOiB0cnVlIH0pO1xucmVmQ291bnRlci5SZWZDb3VudGVyID0gdm9pZCAwO1xuY2xhc3MgUmVmQ291bnRlciB7XG4gICAgY29uc3RydWN0b3IoKSB7XG4gICAgICAgIHRoaXMudG9waWNSZWZNYXAgPSBuZXcgTWFwKCk7XG4gICAgfVxuICAgIC8vIHJldHVybnMgdGhlIHJlZiBjb3VudCBhZnRlciBpbmNyZW1lbnRpbmdcbiAgICBpbmNSZWZDb3VudChrZXkpIHtcbiAgICAgICAgY29uc3QgcmVmQ291bnQgPSB0aGlzLnRvcGljUmVmTWFwLmdldChrZXkpO1xuICAgICAgICBsZXQgcmV0dXJuQ291bnQ7XG4gICAgICAgIGlmICghcmVmQ291bnQpIHtcbiAgICAgICAgICAgIHRoaXMudG9waWNSZWZNYXAuc2V0KGtleSwgMSk7XG4gICAgICAgICAgICByZXR1cm5Db3VudCA9IDE7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBjb25zdCBuZXdSZWZDb3VudCA9IHJlZkNvdW50ICsgMTtcbiAgICAgICAgICAgIHJldHVybkNvdW50ID0gbmV3UmVmQ291bnQ7XG4gICAgICAgICAgICB0aGlzLnRvcGljUmVmTWFwLnNldChrZXksIG5ld1JlZkNvdW50KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmV0dXJuQ291bnQ7XG4gICAgfVxuICAgIC8vIHJldHVybnMgdGhlIHJlZiBjb3VudCBhZnRlciBkZWNyZW1lbnRpbmcsIG9yIC0xIGlmIHRoZSBrZXkgYWxyZWFkeSBoYWQgbm8gcmVmZXJlbmNlc1xuICAgIGRlY1JlZkNvdW50KGtleSkge1xuICAgICAgICBjb25zdCByZWZDb3VudCA9IHRoaXMudG9waWNSZWZNYXAuZ2V0KGtleSk7XG4gICAgICAgIGxldCByZXR1cm5Db3VudDtcbiAgICAgICAgaWYgKHJlZkNvdW50KSB7XG4gICAgICAgICAgICBjb25zdCBuZXdSZWZDb3VudCA9IHJlZkNvdW50IC0gMTtcbiAgICAgICAgICAgIHRoaXMudG9waWNSZWZNYXAuc2V0KGtleSwgbmV3UmVmQ291bnQpO1xuICAgICAgICAgICAgcmV0dXJuQ291bnQgPSBuZXdSZWZDb3VudDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybkNvdW50ID0gLTE7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJldHVybkNvdW50O1xuICAgIH1cbiAgICAvLyBFeGVjdXRlIGZpcnN0QWN0aW9uIGlmIGl0IGlzIHRoZSBmaXJzdCBzdWNoIHJlZiwgZWxzZSBleGVjdXRlIG5vbkZpcnN0QWN0aW9uLlxuICAgIC8vIEluIGVpdGhlciBjYXNlIHRoZSByZXR1cm4gdmFsdWUgaXMgdGhhdCBvZiB0aGUgYWN0aW9uIGV4ZWN1dGVkXG4gICAgYWN0T25GaXJzdChrZXksIGZpcnN0QWN0aW9uLCBub25GaXJzdEFjdGlvbikge1xuICAgICAgICBjb25zdCBudW1SZWZzID0gdGhpcy5pbmNSZWZDb3VudChrZXkpO1xuICAgICA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dGVyKCdwcm92aWRlci1hY3Rpb24nLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKHBheWxvYWQsIGlkZW50aXR5KTtcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiAgICAgcHJvdmlkZXIuYmVmb3JlQWN0aW9uKChhY3Rpb24sIHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICAvL1RoZSBwYXlsb2FkIGNhbiBiZSBhbHRlcmVkIGhlcmUgYmVmb3JlIGhhbmRsaW5nIHRoZSBhY3Rpb24uXG4gICAgICogICAgICAgICBwYXlsb2FkLnJlY2VpdmVkID0gRGF0ZS5ub3coKTtcbiAgICAgKiAgICAgICAgIHJldHVybiBwYXlsb2FkO1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCwgaWRlbnRpdHkpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgIC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ZpZGVyID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jcmVhdGUoJ2NoYW5uZWxOYW1lJyk7XG4gICAgICpcbiAgICAgKiAgICAgcHJvdmlkZXIucmVnaXN0ZXIoJ3Byb3ZpZGVyLWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCk7XG4gICAgICogICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0FjdGlvbiBlcnJvcicpO1xuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqICAgICBwcm92aWRlci5vbkVycm9yKChhY3Rpb24sIGVycm9yLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2coJ3VuY2F1Z2h0IEV4Y2VwdGlvbiBpbiBhY3Rpb246JywgYWN0aW9uKTtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUuZXJyb3IoZXJyb3IpO1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGNsaWVudC5yZWdpc3RlcignY2xpZW50LWFjdGlvbicsIChwYXlsb2FkLCBpZGVudGl0eSkgPT4ge1xuICAgICAqICAgICAgICAgY29uc29sZS5sb2cocGF5bG9hZCk7XG4gICAgICogICAgICAgICB0aHJvdyBuZXcgRXJy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GlkZW50aXR5ICR7SlNPTi5zdHJpbmdpZnkoaWRlbnRpdHkpfSBoYXMgYXR0ZW1wdGVkIHRvIGRpc3BhdGNoIHVucmVnaXN0ZXJlZCBhY3Rpb246ICR7YWN0aW9ufS5gKTtcbiAgICAgKlxuICAgICAqICAgICAgICAgcmV0dXJuIHtcbiAgICAgKiAgICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICB9KTtcbiAgICAgKlxuICAgICAqIH0pKCk7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBDaGFubmVsIENsaWVudDpcbiAgICAgKiBgYGBqc1xuICAgICAqIChhc3luYyAoKT0+IHtcbiAgICAgKiAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5jb25uZWN0KCdjaGFubmVsTmFtZScpO1xuICAgICAqXG4gICAgICogICAgIGF3YWl0IGNsaWVudC5zZXREZWZhdWx0QWN0aW9uKChhY3Rpb24sIHBheWxvYWQsIGlkZW50aXR5KSA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhgUHJvdmlkZXIgd2l0aCBpZGVudGl0eSAke0pTT04uc3RyaW5naWZ5KGlkZW50aXR5KX0gaGFzIGF0dGVtcHRlZCB0byBkaXNwYXRjaCB1bnJlZ2lzdGVyZWQgYWN0aW9uOiAke2FjdGlvbn0uYCk7XG4gICAgICpcbiAgICAgKiAgICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICAgZWNobzogcGF5bG9hZFxuICAgICAqICAgICAgICAgfTtcbiAgICAgKiAgICAgfSk7XG4gICAgICpcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqIEBwYXJhbSBmdW5jXG4gICAgICovXG4gICAgc2V0RGVmYXVsdEFjdGlvbihmdW5jKSB7XG4gICAgICAgIGlmICh0aGlzLmRlZmF1bHRBY3Rpb24pIHtcbiAgICAgIC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IGxpc3RlbmVyXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogYGBganNcbiAgICAgKiAoYXN5bmMgKCk9PiB7XG4gICAgICogICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IGZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY29ubmVjdCgnY2hhbm5lbE5hbWUnKTtcbiAgICAgKlxuICAgICAqICAgICBhd2FpdCBjbGllbnQub25EaXNjb25uZWN0aW9uKGV2dCA9PiB7XG4gICAgICogICAgICAgICBjb25zb2xlLmxvZygnUHJvdmlkZXIgZGlzY29ubmVjdGVkJywgYHV1aWQ6ICR7ZXZ0LnV1aWR9LCBuYW1lOiAke2V2dC5uYW1lfWApO1xuICAgICAqICAgICB9KTtcbiAgICAgKiB9KSgpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIG9uRGlzY29ubmVjdGlvbihsaXN0ZW5lcikge1xuICAgICAgICB0aGlzLmRpc2Nvbm5lY3RMaXN0ZW5lciA9IChwYXlsb2FkKSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyKHBheWxvYWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgRXJyb3Igd2hpbGUgY2FsbGluZyB0aGUgb25EaXNjb25uZWN0aW9uIGNhbGxiYWNrOiAke2Vyci5tZXNzYWdlfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7XG4gICAgICAgICAgICAgICAgdGhpcy5kaXNjb25uZWN0TGlzdGVuZXIgPSAoKSA9PiB1bmRlZmluZWQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuICAgIC8qKlxuICAgICAqIERpc2Nvbm5lY3RzIHRoZSBjbGllbnQgZnJvbSB0aGUgY2hhbm5lbC5cbiAgICAgKlxuICAg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gICAgICAgICBjb25zdCB7IHJlc29sdmUsIHJlamVjdCB9ID0gdGhpcy5yZXNwb25zZU1hcC5nZXQobWVzc2FnZUlkKSA/PyB7fTtcbiAgICAgICAgICAgIGlmIChyZXNvbHZlICYmIHJlamVjdCkge1xuICAgICAgICAgICAgICAgIHRoaXMucmVzcG9uc2VNYXAuZGVsZXRlKG1lc3NhZ2VJZCk7XG4gICAgICAgICAgICAgICAgaWYgKHN1Y2Nlc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShwYXlsb2FkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlamVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ0NvdWxkIG5vdCBmaW5kIGlkIGluIHJlc3BvbnNlTWFwLicpO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5ydGMuY2hhbm5lbHMucmVxdWVzdC5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgYXN5bmMgKGUpID0+IHtcbiAgICAgICAgICAgIGxldCB7IGRhdGEgfSA9IGU7XG4gICAgICAgICAgICBpZiAoZS5kYXRhIGluc3RhbmNlb2YgQXJyYXlCdWZmZXIpIHtcbiAgICAgICAgICAgICAgICBkYXRhID0gbmV3IFRleHREZWNvZGVyKCkuZGVjb2RlKGUuZGF0YSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCB7IG1lc3NhZ2VJZCwgYWN0aW9uLCBwYXlsb2FkIH0gPSBKU09OLnBhcnNlKGRhdGEpO1xuICAgICAgICAgICAgaWYgKF9fY2xhc3NQcml2YXRlRmllbGRHZXQkYih0aGlzLCBfUlRDRW5kcG9pbn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ICAgICAgICAgICAgICAgbWVzc2FnZUlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiAoMCwgZXJyb3JzXzEkMS5lcnJvclRvUE9KTykoZXJyb3IpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgUlRDRGF0YUNoYW5uZWwgaXMgb3BlbiBmb3Igc2FtZSByZWFzb24gYXMgY2F0Y2ggYmxvY2sgYWJvdmUuXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmICh0aGlzLnJ0Yy5jaGFubmVscy5yZXNwb25zZS5yZWFkeVN0YXRlID09PSAnb3BlbicpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJ0Yy5jaGFubmVscy5yZXNwb25zZS5zZW5kKEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUlkLFxuICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICdDb25uZWN0aW9uIG5vdCByZWFkeS4nXG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5ydGMucnRjQ2xpZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2Nvbm5lY3Rpb25zdGF0ZWNoYW5nZScsIHRoaXMuY29ubmVjdGlvblN0YXRlQ2hhbmdlSGFuZGxlcik7XG4gICAgICAgIC8vIERpc2Nvbm5lY3QgaWYgZGF0YSBjaGFubmVscyBjbG9zZSB1bmV4cGVjdGVkbHksIGUuZy4gY2FuIGhhcHBlbiBkdWUgdG8gbWVzc2FnZSBzaXplID4gfjI1NWtCIChSVENQZWVyQ29ub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i8vZXhhbXBsZS5jb21cIlxuICAgICAqIC8vICAgIH1cbiAgICAgKiAvL11cbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBnZXRBbGxDbGllbnRJbmZvKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5jb25uZWN0aW9ucy5tYXAoKGNsaWVudEluZm8pID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHsgdXVpZCwgbmFtZSwgZW5kcG9pbnRJZCwgZW50aXR5VHlwZSwgY29ubmVjdGlvblVybCB9ID0gY2xpZW50SW5mbztcbiAgICAgICAgICAgIHJldHVybiB7IHV1aWQsIG5hbWUsIGVuZHBvaW50SWQsIGVudGl0eVR5cGUsIGNvbm5lY3Rpb25VcmwgfTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGNoZWNrRm9yQ2xpZW50Q29ubmVjdGlvbihjbGllbnRJZGVudGl0eSkge1xuICAgICAgICBpZiAoIXRoaXMuaXNDbGllbnRDb25uZWN0ZWQoY2xpZW50SWRlbnRpdHkpKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRoaXMgYWN0aW9uIHdhcyBzZW50IGZyb20gYSBjbGllbnQgdGhhdCBpcyBub3QgY29ubmVjdGVkIHRvIHRoZSBwcm92aWRlci5cbiAgICAgICAgICAgICAgICAgICAgQ2xpZW50IElkZW50aXR5OiB7dXVpZDogJHtjbGllbnRJZGVudGl0eS51dWlkfSwgbmFtZTogJHtjbGllbnRJZGVudGl0eS5uYW1lfSwgZW5kcG9pbnRJZDogJHtjbGllbnRJZGVudGl0eS5lbmRwb2ludElkfX1gKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBpc0NsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSkge1xuICAgICAgICBpZiAoQ2hhbm5lbFByb3ZpZGVyLmNsaWVudElkZW50aXR5SW5jbHVkZXNFbmRwb2ludElkKGNsaWVudElkZW50aXR5KSkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29ubmVjdGlvbnMuc29tZSgoaWRlbnRpdHkpID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgICAgIC8vIE1pZ2h0IGJlIHJlZHVuZGFudCB0byBjaGVjayBmb3IgdXVpZCBhbmQgbmFtZSBoZXJlIGFmdGVyIHdlIGdldCBhbiBlbmRwb2ludElkIG1hdGNoLCBidXQganVzdCBpbiBjYXNlXG4gICAgICAgICAgICAgICAgaWRlbnRpdHkuZW5kcG9pbnRJZCA9PT0gY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCAmJlxuICAgICAgICAgICAgICAgICAgICBpZGVudGl0eS51dWlkID09PSBjbGllbnRJZGVudGl0eS51dWlkICYmXG4gICAgICAgICAgICAgICAgICAgIGlkZW50aXR5Lm5hbWUgPT09IGNsaWVudElkZW50aXR5Lm5hbWUpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuaXNMZWdhY3lDbGllbnRDb25uZWN0ZWQoY2xpZW50SWRlbnRpdHkpO1xuICAgIH1cbiAgICBpc0xlZ2FjeUNsaWVudENvbm5lY3RlZChjbGllbnRJZGVudGl0eSkge1xuICAgICAgICByZXR1cm4gdGhpcy5jb25uZWN0aW9ucy5zb21lKChpZGVudGl0eSkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIGlkZW50aXR5LnV1aWQgPT09IGNsaWVudElkZW50aXR5LnV1aWQgJiYgaWRlbnRpdHkubmFtZSA9PT0gY2xpZW50SWRlbnRpdHkubmFtZTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGhhbmRsZU11bHRpUnVudGltZUxlZ2FjeUNsaWVudChzZW5kZXJJZGVudGl0eSkge1xuICAgICAgICBpZiAoIXRoaXMuaXNMZWdhY3lDbGllbnRDb25uZWN0ZWQoc2VuZGVySWRlbnRpdHkpKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRoaXMgYW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W5jZU9yZGVyID0gUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXI7XG4gICAgICAgIHRoaXMuRGVmYXVsdENsaWVudFByb3RvY29scyA9IFsnY2xhc3NpYyddO1xuICAgICAgICB0aGlzLkRlZmF1bHRQcm92aWRlclByb3RvY29scyA9IFsnY2xhc3NpYyddO1xuICAgICAgICB0aGlzLmdldENsaWVudFByb3RvY29scyA9IChwcm90b2NvbHMpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHN1cHBvcnRlZCA9IHByb3RvY29sc1xuICAgICAgICAgICAgICAgID8gdGhpcy5Qcm90b2NvbHNJblByZWZlcmVuY2VPcmRlci5maWx0ZXIoKHgpID0+IHByb3RvY29scy5pbmNsdWRlcyh4KSlcbiAgICAgICAgICAgICAgICA6IHRoaXMuRGVmYXVsdENsaWVudFByb3RvY29scztcbiAgICAgICAgICAgIGlmICghc3VwcG9ydGVkLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgTm8gdmFsaWQgcHJvdG9jb2xzIHdlcmUgcGFzc2VkIGluLiBBY2NlcHRlZCB2YWx1ZXMgYXJlOiAke3RoaXMuUHJvdG9jb2xzSW5QcmVmZXJlbmNlT3JkZXIuam9pbignLCAnKX0uYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gc3VwcG9ydGVkO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmdldFByb3ZpZGVyUHJvdG9jb2xzID0gKHByb3RvY29scykgPT4ge1xuICAgICAgICAgICAgY29uc3Qgc3VwcG9ydGVkID0gcHJvdG9jb2xzXG4gICAgICAgICAgICAgICAgPyB0aGlzLlByb3RvY29sc0luUHJlZmVyZW5jZU9yZGVyLmZpbHRlcigoeCkgPT4gcHJvdG9jb2xzLmluY2x1ZGVzKHgpKVxuICAgICAgICAgICAgICAgIDogdGhpcy5EZWZhdWx0UHJvdmlkZXJQcm90b2NvbHM7XG4gICAgICAgICAgICBpZiAo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nN0IHByb3RvY29scyA9IHRoaXMucHJvdG9jb2xNYW5hZ2VyLmdldENsaWVudFByb3RvY29scyhvcHRpb25zPy5wcm90b2NvbHMpO1xuICAgICAgICBsZXQgcnRjUGFja2V0O1xuICAgICAgICBjb25zdCBzdXBwb3J0ZWRQcm90b2NvbHMgPSBhd2FpdCBQcm9taXNlLmFsbChwcm90b2NvbHMubWFwKGFzeW5jICh0eXBlKSA9PiB7XG4gICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHtcbiAgICAgICAgICAgICAgICBjYXNlICdydGMnOiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgcnRjQ2xpZW50LCBjaGFubmVscywgb2ZmZXIsIHJ0Y0Nvbm5lY3Rpb25JZCwgY2hhbm5lbHNPcGVuZWQgfSA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkOCh0aGlzLCBfQ29ubmVjdGlvbk1hbmFnZXJfcnRjQ29ubmVjdGlvbk1hbmFnZXIsIFwiZlwiKS5zdGFydENsaWVudE9mZmVyKCk7XG4gICAgICAgICAgICAgICAgICAgIHJ0Y1BhY2tldCA9IHsgcnRjQ2xpZW50LCBjaGFubmVscywgY2hhbm5lbHNPcGVuZWQgfTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdydGMnLFxuICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogc3RyYXRlZ3lfMi5SVENJbmZvLnZlcnNpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXlsb2FkOiB7IG9mZmVyLCBydGNDb25uZWN0aW9uSWQgfVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXNlICdjbGFzc2ljJzpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgdHlwZTogJ2NsYXNzaWMnLCB2ZXJzaW9uOiBzdHJhdGVneV8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ID0gdGhpcy5wcm92aWRlck1hcC5nZXQoa2V5KTtcbiAgICAgICAgaWYgKCFidXMpIHtcbiAgICAgICAgICAgIGFja1RvU2VuZGVyLnBheWxvYWQuc3VjY2VzcyA9IGZhbHNlO1xuICAgICAgICAgICAgYWNrVG9TZW5kZXIucGF5bG9hZC5yZWFzb24gPSBgQ2hhbm5lbCBcIiR7cHJvdmlkZXJJZGVudGl0eS5jaGFubmVsTmFtZX1cIiBoYXMgYmVlbiBkZXN0cm95ZWQuYDtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZFJhdyhhY2tUb1NlbmRlcik7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgeyBwcm92aWRlciwgc3RyYXRlZ3ksIHN1cHBvcnRlZFByb3RvY29scyB9ID0gYnVzO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgaWYgKCEocHJvdmlkZXIgaW5zdGFuY2VvZiBwcm92aWRlcl8xJDEuQ2hhbm5lbFByb3ZpZGVyKSkge1xuICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDYW5ub3QgY29ubmVjdCB0byBhIGNoYW5uZWwgY2xpZW50Jyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBvZmZlciA9IGNsaWVudE9mZmVyID8/IHtcbiAgICAgICAgICAgICAgICBzdXBwb3J0ZWRQcm90b2NvbHM6IFt7IHR5cGU6ICdjbGFzc2ljJywgdmVyc2lvbjogMSB9XSxcbiAgICAgICAgICAgICAgICBtYXhQcm90b2NvbHM6IDFcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb25zdCBvdmVybGFwcGluZ1Byb3RvY29scyA9IHRoaXMucHJvdG9jb2xNYW5hZ2VyLmdldENvbXBhdGlibGVQcm90b2NvbHMoc3VwcG9ydGVkUHJvdG9jb2xzLCBvZmZlcik7XG4gICAgICAgICAgICBpZiAoIW92ZXJsYXBwaW5nUHJvdG9jb2xzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVGhpcyBwcm92aWRlciBkb2VzIG5vdCBzdXBwb3J0IGFueSBvZiB0aGUgb2ZmZXJlZCBwcm90b2NvbHMuJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCByZXMgPSBhd2FpdCBwcm92aWRlci5wcm9jZXNzQ29ubmVjdGlvbihjbGllbnRJZGVudGl0eSwgcGF5bG9hZCk7XG4gICAgICAgICAgICBhY2tUb1NlbmRlci5wYXlsb2FkLnBheWxvYWQgPSBhY2tUb1NlbmRlci5wYXlsb2FkLnBheWxvYWQgfHwge307XG4gICAgICAgICAgICAvLyBMb29wIHRocm91Z2ggYWxsIHN1cHBvcnRlZCBwcm90b2NvbHMgYW5kIGFjY3VtdWxhdGUgdGhlbSBpbnRvIHRoZSBhbnN3ZXJcbiAgICAgICAgICAgIC8vIGFkZEVuZHBvaW50IGlzIHRyaWNreSBidXQgd2UgbmVlZCB0byB3YWl0IGZvciBjaGFubmVsIHJlc29sdXRpb24gYmVmb3JlIGFkZGluZyB0aGUgZW5kcG9pbnQuXG4gICAgICAgICAgICBsZXQgY2xpZW50QW5zd2VyID0ge1xuICAgICAgICAgICAgICAgIHN1cHBvcnRlZFByb3RvY29sczogW10sXG4gICAgICAgICAgICAgICAgZW5kcG9pbnRQYXlsb2FkUHJvbWlzZTogUHJvbWlzZS5yZXNvbHZlKHsgZW5kcG9pbnRJZGVudGl0eTogY2xpZW50SWRlbnRpdHkgfSlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjbGllbnRBbnN3ZXIgPSBhd2FpdCBvdmVybGFwcGluZ1Byb3RvY29scy5yZWR1Y2UoYXN5bmMgKGFjY3VtUCwgcHJvdG9jb2xUb1VzZSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGFuc3dlciA9IGF3YWl0IGFjY3VtUDtcbiAgICAgICAgICAgICAgICBpZiAocHJvdG9jb2xUb1VzZS50eXBlID09PSAncnRjJykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGFuc3dlcjogcnRjQW5zd2VyLCBydGNDbGllbnQsIGNoYW5uZWxzIH0gPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDgodGhpcywgX0Nvbm5lY3Rpb25NYW5hZ2VyX3J0Y0Nvbm5lY3Rpb25NYW5hZ2VyLCBcImZcIikuY3JlYXRlUHJvdmlkZXJBbnN3ZXIocHJvdG9jb2xUb1VzZS5wYXlsb2FkLnJ0Y0Nvbm5lY3Rpb25JZCwgcHJvdG9jb2xUb1VzZS5wYXlsb2FkLm9mZmVyKTtcbiAgICAgICAgICAgICAgICAgICAgYW5zd2VyLnN1cHBvcnRlZFByb3RvY29scy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdydGMnLFxuICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogc3RyYXRlZ3lfMi5SVENJbmZvLnZlcnNpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXlsb2FkOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5zd2VyOiBydGNBbnN3ZXJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGFuc3dlci5lbmRwb2ludFBheWxvYWRQcm9taXNlID0gYW5zd2VyLmVuZHBvaW50UGF5bG9hZFByb21pc2UudGhlbigoZW5kcG9pbnRQYXlsb2FkKSA9PiBjaGFubmVscy50aGVuKChyZXNvbHZlZENoYW5uZWxzKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC4uLmVuZHBvaW50UGF5bG9hZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydGM6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnRjQ2xpZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsczogcmVzb2x2ZWRDaGFubmVsc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGFuc3dlci5zdXBwb3J0ZWRQcm90b2NvbHMucHVzaCh7IHR5cGU6ICdjbGFzc2ljJywgdmVyc2lvbjogc3RyYXRlZ3lfMS5DbGFzc2ljSW5mby52ZXJzaW9uIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gYW5zd2VyO1xuICAgICAgICAgICAgfSwgUHJvbWlzZS5yZXNvbHZlKGNsaWVudEFuc3dlcikpO1xuICAgICAgICAgICAgLy8gTmVlZCB0byBhcyBjYXN0IGhlcmUuXG4gICAgICAgICAgICBjbGllbnRBbnN3ZXIuZW5kcG9pbnRQYXlsb2FkUHJvbWlzZS50aGVuKChlbmRwb2ludFBheWxvYWQpID0+IHN0cmF0ZWd5LmFkZEVuZHBvaW50KGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQsIGVuZHBvaW50UGF5bG9hZCkpO1xuICAgICAgICAgICAgYWNrVG9TZW5kZXIucGF5bG9hZC5wYXlsb2FkLnJlc3VsdCA9IHJlcztcbiAgICAgICAgICAgIGFja1RvU2VuZGVyLnBheWxvYWQucGF5bG9hZC5hbnN3ZXIgPSBjbGllbnRBbnN3ZXI7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy53aXJlLnNlbmRSYXcoYWNrVG9TZW5kZXIpO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICBhY2tUb1NlbmRlci5wYXlsb2FkLnN1Y2Nlc3MgPSBmYWxzZTtcbiAgICAgICAgICAgIGFja1RvU2VuZGVyLnBheWxvYWQucmVhc29uID0gZS5t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ogXCJjb3VudGVyXCIsXG4gICAgICogICAgIFwiY2hhbm5lbElkXCI6IFwiT3BlbmZpblBPQy9PcGVuZmluUE9DL2NvdW50ZXJcIlxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIG9uQ2hhbm5lbENvbm5lY3QobGlzdGVuZXIpIHtcbiAgICAgICAgYXdhaXQgdGhpcy5vbignY29ubmVjdGVkJywgbGlzdGVuZXIpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBMaXN0ZW4gZm9yIGNoYW5uZWwgZGlzY29ubmVjdGlvbnMuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gbGlzdGVuZXIgLSBjYWxsYmFjayB0byBleGVjdXRlLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgbGlzdGVuZXIgPSAoY2hhbm5lbFBheWxvYWQpID0+IGNvbnNvbGUubG9nKGNoYW5uZWxQYXlsb2FkKTsgLy8gc2VlIHJldHVybiB2YWx1ZSBiZWxvd1xuICAgICAqXG4gICAgICogZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5vbkNoYW5uZWxEaXNjb25uZWN0KGxpc3RlbmVyKTtcbiAgICAgKlxuICAgICAqIC8vIGV4YW1wbGUgc2hhcGVcbiAgICAgKiB7XG4gICAgICogICAgIFwidG9waWNcIjogXCJjaGFubmVsXCIsXG4gICAgICogICAgIFwidHlwZVwiOiBcImRpc2Nvbm5lY3RlZFwiLFxuICAgICAqICAgICBcInV1aWRcIjogXCJPcGVuZmluUE9DXCIsXG4gICAgICogICAgIFwibmFtZVwiOiBcIk9wZW5maW5QT0NcIixcbiAgICAgKiAgICAgXCJjaGFubmVsTmFtZVwiOiBcImNvdW50ZXJcIixcbiAgICAgKiAgICAgXCJjaGFubmVsSWRcIjogXCJPcGVuZmluUE9DL09wZW5maW5QT0MvY291bnRlclwiXG4gICAgICogfVxuICAgICAqXG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgb25DaGFubmVsRGlzY29ubmVjdChsaXN0ZW5lcikge1xuICAgICAgICBhd2FpdCB0aGlzLm9uKCdkaXNjb25uZWN0ZWQnLCBsaXN0ZW5lcik7XG4gICAgfVxuICAgIGFzeW5jIHNhZmVDb25uZWN0KGNoYW5uZWxOYW1lLCBzaG91bGRXYWl0LCBjb25uZWN0UGF5bG9hZCkge1xuICAgICAgICBjb25zdCByZXRyeUluZm8gPSB7IGNvdW50OiAwIH07XG4gICAgICAgIC8qIGVzbGludC1kaXNhYmxlIG5vLWF3YWl0LWluLWxvb3AsIG5vLWNvbnN0YW50LWNvbmRpdGlvbiAqL1xuICAgICAgICBkbyB7XG4gICAgICAgICAgICAvLyBzZXR1cCBhIGxpc3RlbmVyIGFuZCBhIGNvbm5lY3RlZCBwcm9taXNlIHRvIGF3YWl0IGluIGNhc2Ugd2UgY29ubmVjdCBiZWZvcmUgdGhlIGNoYW5uZWwgaXMgcmVhZHlcbiAgICAgICAgICAgIGxldCBjb25uZWN0ZWRMaXN0ZW5lciA9ICgpID0+IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGNvbnN0IGNvbm5lY3RlZFByb21pc2UgPSBuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbm5lY3RlZExpc3RlbmVyID0gKHBheWxvYWQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoYW5uZWxOYW1lID09PSBwYXlsb2FkLmNoYW5uZWxOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHRydWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDcodGhpcywgX0NoYW5uZWxfaW50ZXJuYWxFbWl0dGVyLCBcImZcIikub24oJ2Nvbm5lY3RlZCcsIGNvbm5lY3RlZExpc3RlbmVyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBpZiAocmV0cnlJbmZvLmNvdW50ID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBXYWl0IGJlZm9yZSByZXRyeWluZ1xuICAgICAgICAgICAgICAgICAgICAvLyBEZWxheSByZXR1cm5zIGZhbHNlIGNvbm5lY3RlZFByb21pc2UgcmV0dXJucyB0cnVlIHNvIHdlIGNhbiBrbm93IGlmIGEgcmV0cnkgaXMgZHVlIHRvIGNvbm5lY3RlZCBldmVudFxuICAgICAgICAgICAgICAgICAgICByZXRyeUluZm8uZ290Q29ubmVjdGVkRXZlbnQgPSBhd2FpdCBQcm9taXNlLnJhY2UoW3JldHJ5RGVsYXkocmV0cnlJbmZvLmNvdW50KSwgY29ubmVjdGVkUHJvbWlzZV0pO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSBhd2FpdCB0aGlzLndpcmUuc2VuZEFjdGlvbignY29ubmVjdC10by1jaGFubmVsJywgeyAuLi5jb25uZWN0UGF5bG9hZCwgcmV0cnlJbmZvIH0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBsb2cgb25seSBpZiB0aGVyZSB3YXMgYSByZXRyeVxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhgU3VjY2Vzc2Z1bGx5IGNvbm5lY3RlZCB0byBjaGFubmVsTmFtZTogJHtjaGFubmVsTmFtZX1gKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdC5wYXlsb2FkLmRhdGE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFNlbmQgcmV0cnlJbmZvIHRvIHRoZSBjb3JlIGZvciBkZWJ1ZyBsb2cgaW5jbHVzaW9uXG4gICAgICAgICAgICAgICAgY29uc3Qgc2VudE1lc3NhZ2VQcm9taXNlID0gdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2Nvbm5lY3QtdG8tY2hhbm5lbCcsIGNvbm5lY3RQYXlsb2FkKTtcbiAgICAgICAgICAgICAgICAvLyBTYXZlIG1lc3NhZ2VJZCBmcm9tIHRoZSBmaXJzdCBjb25uZWN0aW9uIGF0dGVtcHRcbiAgICAgICAgICAgICAgICByZXRyeUluZm8ub3JpZ2luYWxNZXNzYWdlSWQgPSBzZW50TWVzc2FnZVByb21pc2UubWVzc2FnZUlkO1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IHNlbnRNZXNzYWdlUHJvbWlzZTtcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0LnBheWxvYWQuZGF0YTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIGlmICghZXJyb3IubWVzc2FnZS5pbmNsdWRlcygnaW50ZXJuYWwtbmFjaycpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE5vdCBhbiBpbnRlcm5hbCBuYWNrLCBicmVhayB0aGUgbG9vcFxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHNob3VsZFdhaXQgJiYgcmV0cnlJbmZvLmNvdW50ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHN0YXJ0IHdhaXRpbmcgb24gdGhlIG5leHQgaXRlcmF0aW9uLCB3YXJuIHRoZSB1c2VyXG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgTm8gY2hhbm5lbCBmb3VuZCBmb3IgY2hhbm5lbE5hbWU6ICR7Y2hhbm5lbE5hbWV9LiBXYWl0aW5nIGZvciBjb25uZWN0aW9uLi4uYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7XG4gICAgICAgICAgICAgICAgcmV0cnlJb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lvbiBoZXJlIGJ5IHRocm93aW5nIGFuIGVycm9yXG4gICAgICogICAgICAgIGNvbnNvbGUubG9nKCdDbGllbnQgY29ubmVjdGlvbiByZXF1ZXN0IGlkZW50aXR5OiAnLCBKU09OLnN0cmluZ2lmeShpZGVudGl0eSkpO1xuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnQ2xpZW50IGNvbm5lY3Rpb24gcmVxdWVzdCBwYXlsb2FkOiAnLCBKU09OLnN0cmluZ2lmeShwYXlsb2FkKSk7XG4gICAgICogICAgfSk7XG4gICAgICpcbiAgICAgKiAgICBwcm92aWRlckJ1cy5yZWdpc3RlcigndG9waWMnLCAocGF5bG9hZCwgaWRlbnRpdHkpID0+IHtcbiAgICAgKiAgICAgICAgLy8gcmVnaXN0ZXIgYSBjYWxsYmFjayBmb3IgYSAndG9waWMnIHRvIHdoaWNoIGNsaWVudHMgY2FuIGRpc3BhdGNoIGFuIGFjdGlvblxuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnQWN0aW9uIGRpc3BhdGNoZWQgYnkgY2xpZW50OiAnLCBKU09OLnN0cmluZ2lmeShpZGVudGl0eSkpO1xuICAgICAqICAgICAgICBjb25zb2xlLmxvZygnUGF5bG9hZCBzZW50IGluIGRpc3BhdGNoOiAnLCBKU09OLnN0cmluZ2lmeShwYXlsb2FkKSk7XG4gICAgICogICAgICAgIHJldHVybiB7XG4gICAgICogICAgICAgICAgICBlY2hvOiBwYXlsb2FkXG4gICAgICogICAgICAgIH07XG4gICAgICogICAgfSk7XG4gICAgICogfSkoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBjcmVhdGUoY2hhbm5lbE5hbWUsIG9wdGlvbnMpIHtcbiAgICAgICAgaWYgKCFjaGFubmVsTmFtZSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdQbGVhc2UgcHJvdmlkZSBhIGNoYW5uZWxOYW1lIHRvIGNyZWF0ZSBhIGNoYW5uZWwnKTtcbiA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2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqXG4gICAgICogLy8gc3Vic2NyaWJlIHRvIHdpbGRjYXJkXG4gICAgICogZmluLkludGVyQXBwbGljYXRpb25CdXMuc3Vic2NyaWJlKHsgdXVpZDogJyonIH0sICd0b3BpYycsIHN1Yl9tc2cgPT4gY29uc29sZS5sb2coc3ViX21zZykpLnRoZW4oKCkgPT4gY29uc29sZS5sb2coJ1N1YnNjcmliZWQgdG8gKicpKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgc3Vic2NyaWJlKHNvdXJjZSwgdG9waWMsIGxpc3RlbmVyKSB7XG4gICAgICAgIGNvbnN0IHN1YktleSA9IHRoaXMuY3JlYXRlU3Vic2NyaXB0aW9uS2V5KHNvdXJjZS51dWlkLCBzb3VyY2UubmFtZSB8fCAnKicsIHRvcGljKTtcbiAgICAgICAgY29uc3Qgc2VuZFN1YnNjcmlwdGlvbiA9ICgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignc3Vic2NyaWJlJywge1xuICAgICAgICAgICAgICAgIHNvdXJjZVV1aWQ6IHNvdXJjZS51dWlkLFxuICAgICAgICAgICAgICAgIHNvdXJjZVdpbmRvd05hbWU6IHNvdXJjZS5uYW1lIHx8ICcqJyxcbiAgICAgICAgICAgICAgICB0b3BpYyxcbiAgICAgICAgICAgICAgICBkZXN0aW5hdGlvbldpbmRvd05hbWU6IHRoaXMubWUubmFtZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGFscmVhZHlTdWJzY3JpYmVkID0gKCkgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmVtaXR0ZXIub24oc3ViS2V5LCBsaXN0ZW5lcik7XG4gICAgICAgIHJldHVybiB0a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KiBhc3luYyBmdW5jdGlvbiBnZXRJbmZvKCkge1xuICAgICAqICAgICBjb25zdCBmcm0gPSBhd2FpdCBmaW4uRnJhbWUuZ2V0Q3VycmVudCgpO1xuICAgICAqICAgICByZXR1cm4gYXdhaXQgZnJtLmdldEluZm8oKTtcbiAgICAgKiB9XG4gICAgICogZ2V0SW5mbygpLnRoZW4oaW5mbyA9PiBjb25zb2xlLmxvZyhpbmZvKSkuY2F0Y2goZXJyID0+IGNvbnNvbGUubG9nKGVycikpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGdldEluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndpcmUuc2VuZEFjdGlvbignZ2V0LWZyYW1lLWluZm8nLCB0aGlzLmlkZW50aXR5KS50aGVuKCh7IHBheWxvYWQgfSkgPT4gcGF5bG9hZC5kYXRhKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhIGZyYW1lIGluZm8gb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgd2luZG93IHRoYXQgdGhlIHJlZmVyZW5jZWQgaWZyYW1lIGlzXG4gICAgICogY3VycmVudGx5IGVtYmVkZGVkIGluLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGdldFBhcmVudFdpbmRvdygpIHtcbiAgICAgKiAgICAgY29uc3QgZnJtID0gYXdhaXQgZmluLkZyYW1lLmdldEN1cnJlbnQoKTtcbiAgICAgKiAgICAgcmV0dXJuIGF3YWl0IGZybS5nZXRQYXJlbnRXaW5kb3coKTtcbiAgICAgKiB9XG4gICAgICogZ2V0UGFyZW50V2luZG93KCkudGhlbih3aW5JbmZvID0+IGNvbnNvbGUubG9nKHdpbkluZm8pKS5jYXRjaChlcnIgPT4gY29uc29sZS5sb2coZXJyKSk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgZ2V0UGFyZW50V2luZG93KCkge1xuICAgICAgICByZXR1cm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IGlkZW50aXR5IHx8IHRoaXMuaWRlbnRpdHk7XG4gICAgICAgICAgICBjb25zdCB7IHV1aWQgfSA9IHRhcmdldDtcbiAgICAgICAgICAgIGlmICghY2xpZW50TWFwLmhhcyh1dWlkKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNsaWVudFByb21pc2UgPSBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDYodGhpcywgX1BsYXRmb3JtX2Nvbm5lY3RUb1Byb3ZpZGVyLCBcImZcIikuY2FsbCh0aGlzLCB1dWlkKTtcbiAgICAgICAgICAgICAgICBjbGllbnRNYXAuc2V0KHV1aWQsIGNsaWVudFByb21pc2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gd2Ugc2V0IGl0IGFib3ZlXG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLW5vbi1udWxsLWFzc2VydGlvblxuICAgICAgICAgICAgcmV0dXJuIGNsaWVudE1hcC5nZXQodXVpZCk7XG4gICAgICAgIH07XG4gICAgICAgIF9QbGF0Zm9ybV9jb25uZWN0VG9Qcm92aWRlci5zZXQodGhpcywgYXN5bmMgKHV1aWQpID0+IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29uc3QgY2hhbm5lbE5hbWUgPSBgY3VzdG9tLWZyYW1lLSR7dXVpZH1gO1xuICAgICAgICAgICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IHRoaXMuX2NoYW5uZWwuY29ubmVjdChjaGFubmVsTmFtZSwgeyB3YWl0OiBmYWxzZSB9KTtcbiAgICAgICAgICAgICAgICBjbGllbnQub25EaXNjb25uZWN0aW9uKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY2xpZW50TWFwLmRlbGV0ZSh1dWlkKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gY2xpZW50O1xuIC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3IHdpbGwgbm93IHNob3cgaW4gdGhlIGN1cnJlbnQgd2luZG93XG4gICAgICogYXdhaXQgcGxhdGZvcm0uY3JlYXRlVmlldyh2aWV3T3B0aW9ucywgd2luZG93SWRlbnRpdHkpO1xuICAgICAqXG4gICAgICogY29uc3QgdmlldyA9IGZpbi5WaWV3LndyYXBTeW5jKHsgdXVpZDogd2luZG93SWRlbnRpdHkudXVpZCwgbmFtZTogJ3lhaG9vX3ZpZXcnIH0pO1xuICAgICAqIC8vIHJlcGFyZW50IGBleGFtcGxlX3ZpZXdgIHdoZW4gYSB2aWV3IGluIHRoZSBuZXcgd2luZG93IGlzIHNob3duXG4gICAgICogdmlldy5vbignc2hvd24nLCBhc3luYyAoKSA9PiB7XG4gICAgICogICAgIGxldCB2aWV3SWRlbnRpdHkgPSB7IHV1aWQ6IHdpbmRvd0lkZW50aXR5LnV1aWQsIG5hbWU6ICdleGFtcGxlX3ZpZXcnfTtcbiAgICAgKiAgICAgbGV0IHRhcmdldCA9IHt1dWlkOiB3aW5kb3dJZGVudGl0eS51dWlkLCBuYW1lOiAndGVzdF93aW4nfTtcbiAgICAgKiAgICAgcGxhdGZvcm0uY3JlYXRlVmlldyh2aWV3T3B0aW9ucywgdGFyZ2V0KTtcbiAgICAgKiB9KTtcbiAgICAgKlxuICAgICAqIC8vIGNyZWF0ZSBhIG5ldyB3aW5kb3dcbiAgICAgKiBhd2FpdCBwbGF0Zm9ybS5jcmVhdGVXaW5kb3coe1xuICAgICAqICAgICBuYW1lOiBcInRlc3Rfd2luXCIsXG4gICAgICogICAgIGxheW91dDoge1xuICAgICAqICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgKiAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAneWFob29fdmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8veWFob28uY29tJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIF1cbiAgICAgKiAgICAgfVxuICAgICAqIH0pLnRoZW4oY29uc29sZS5sb2cpO1xuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGNyZWF0ZVZpZXcodmlld09wdGlvbnMsIHRhcmdldCwgdGFyZ2V0Vmlldykge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigncGxhdGZvcm0tY3JlYXRlLXZpZXcnLCB0aGlzLmlkZW50aXR5KS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLmdldENsaWVudCgpO1xuICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IGNsaWVudC5kaXNwYXRjaCgnY3JlYXRlLXZpZXcnLCB7XG4gICAgICAgICAgICB0YXJnZXQsXG4gICAgICAgICAgICBvcHRzOiB2aWV3T3B0aW9ucyxcbiAgICAgICAgICAgIHRhcmdldFZpZXdcbiAgICAgICAgfSk7XG4gICAgICAgIGlmICghcmVzcG9uc2UgfHwgKDAsIHZhbGlkYXRlXzEkMS52YWxpZGF0ZUlkZW50aXR5KShyZXNwb25z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XG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICpcbiAgICAgKiBUaGUgZXhhbXBsZSBiZWxvdyB3aWxsIGNyZWF0ZSBhIERlZmF1bHQgV2luZG93IHdoaWNoIHVzZXMgT3BlbkZpbiBkZWZhdWx0IFdpbmRvdyBVSS48YnI+XG4gICAgICogVGhlIFdpbmRvdyBjb250YWlucyB0d28gVmlld3MgaW4gYSBzdGFjayBMYXlvdXQ6XG4gICAgICpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG4gICAgICogcGxhdGZvcm0uY3JlYXRlV2luZG93KHtcbiAgICAgKiAgICAgbGF5b3V0OiB7XG4gICAgICogICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAqICAgICAgICAgICAgICAgICBjb250ZW50OiBbXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0ZXN0X3ZpZXdfMScsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L2NhbmFyeS9QbGF0Zm9ybS5odG1sJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICogICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogJ3ZpZXcnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0ZXN0X3ZpZXdfMicsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L2NhbmFyeS9QbGF0Zm9ybS5odG1sJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIF1cbiAgICAgKiAgICAgfVxuICAgICAqIH0pLnRoZW4oY29uc29sZS5sb2cpO1xuICAgICAqIGBgYFxuICAgICAqIFRoZSBEZWZhdWx0IFdpbmRvdydzIGRlc2lnbiBjYW4gYmUgY3VzdG9taXplZCBieSBzcGVjaWZ5aW5nIHRoZSBgc3R5bGVzaGVldFVybGAgcHJvcGVydHkgaW4gdGhlIG1hbmlmZXN0OlxuICAgICAqXG4gICAgICogYGBganNvblxuICAgICAqIHtcbiAgICAgKiAgICAgcGxhdGZvcm06IHtcbiAgICAgKiAgICAgICAgIGRlZmF1bHRXaW5kb3dPcHRpb25zOiB7XG4gICAgICogICAgICAgICAgICAgc3R5bGVzaGVldFVybDogJ3NvbWUtdXJsLmNzcycsXG4gICAgICogICAgICAgICAgICAgLi4uXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKiB9XG4gICAgICogYGBgXG4gICAgICogRm9yIGEgbGlzdCBvZiBjb21tb24gTGF5b3V0IENTUyBjbGFzc2Vz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gICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBcInN0YWNrXCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBcImNvbXBvbmVudFwiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZTogXCJ2aWV3XCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFwiYXBwICMxXCIsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcImh0dHBzOi8vY2RuLm9wZW5maW4uY28vZG9jcy9qYXZhc2NyaXB0L2NhbmFyeS9QbGF0Zm9ybS5odG1sXCJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXCJjb21wb25lbnRcIixcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6IFwidmlld1wiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBcImFwcCAjMlwiLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXCJodHRwczovL2Nkbi5vcGVuZmluLmNvL2RvY3MvamF2YXNjcmlwdC9jYW5hcnkvUGxhdGZvcm0uaHRtbFwiXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICB9O1xuICAgICAqICAgICBwbGF0Zm9ybS5jcmVhdGVXaW5kb3cod2luZG93Q29uZmlnKTtcbiAgICAgKiBgYGBcbiAgICAgKlxuICAgICAqIEhlcmUncyBhbiBleGFtcGxlIG9mIGEgbWluaW1hbGlzdCBDdXN0b20gUGxhdGZvcm0gV2luZG93IGltcGxlbWVudGF0aW9uOlxuICAgICAqIGBgYGh0bWxcbiAgICAgKiA8aHRtbD5cbiAgICAgKiAgICAgPGhlYWQ+XG4gICAgICogICAgICAgICA8bWV0YSBjaGFyc2V0PVwidXRmLThcIj5cbiAgICAgKiAgICAgICAgIDxtZXRhIG5hbWU9XCJ2aWV3cG9ydFwiIGNvbnRlbnQ9XCJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MVwiPlxuICAgICAqICAgICAgICAgPGxpbmsgcmVsPVwic3R5bGVzaGVldFwiIHR5cGU9XCJ0ZXh0L2Nzc1wiIGhyZWY9XCIuL3N0eWxlcy5jc3NcIj5cbiAgICAgKiAgICAgPC9oZWFkPlxuICAgICAqICAgICA8Ym9keT5cbiAgICAgKiAgICAgICAgIDxkaXYgaWQ9XCJvZi1mcmFtZS1tYWluXCI+XG4gICAgICogICAgICAgICAgICAgPGRpdiBpZD1cInRpdGxlLWJhclwiPlxuICAgICAqICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGl0bGUtYmFyLWRyYWdnYWJsZVwiPlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgPGRpdiBpZD1cInRpdGxlXCI+IFRoaXMgaXMgYSBjdXN0b20gZnJhbWUhIDwvZGl2PlxuICAgICAqICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgPGRpdiBpZD1cImJ1dHRvbnMtd3JhcHBlclwiPlxuICAgICAqICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImJ1dHRvblwiIGlkPVwibWluaW1pemUtYnV0dG9uXCI+PC9kaXY+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiYnV0dG9uXCIgaWQ9XCJleHBhbmQtYnV0dG9uXCI+PC9kaXY+XG4gICAgICogICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiYnV0dG9uXCIgaWQ9XCJjbG9zZS1idXR0b25cIj48L2Rpdj5cbiAgICAgKiAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICogICAgICAgICAgICAgPC9kaXY+XG4gICAgICogICAgICAgICAgICAgPGRpdiBpZD1cImxheW91dC1jb250YWluZXJcIj48L2Rpdj4gPCEtLSBPcGVuRmluIGxheW91dCB3b3VsZCBiZSBpbmplY3RlZCBoZXJlIC0tPlxuICAgICAqICAgICAgICAgICAgIDxzY3JpcHQgc3JjPVwiLi9jdXN0b20tZnJhbWUuanNcIj48L3NjcmlwdD5cbiAgICAgKiAgICAgICAgIDwvZGl2PlxuICAgICAqICAgICA8L2JvZHk+XG4gICAgICogPC9odG1sPlxuICAgICAqIGBgYFxuICAgICAqIFlvdXIgQ3VzdG9tIFdpbmRvdyBjYW4gdXNlIGluLWRvbWFpbiByZXNvdXJjZXMgZm9yIGZ1cnRoZXIgY3VzdG9taXphdGlvbiAoc3VjaCBhcyBDU1MsIHNjcmlwdHMsIGV0Yy4pLjxicj5cbiAgICAgKiBGb3IgYSBsaXN0IG9mIGNvbW1vb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BjbGllbnQgPSBhd2FpdCB0aGlzLmdldENsaWVudCgpO1xuICAgICAgICByZXR1cm4gY2xpZW50LmRpc3BhdGNoKCdxdWl0Jyk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIENsb3NlcyBhIHNwZWNpZmllZCB2aWV3IGluIGEgdGFyZ2V0IHdpbmRvdy5cbiAgICAgKiBAcGFyYW0gdmlld0lkZW50aXR5IFZpZXcgaWRlbnRpdHlcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBsZXQgd2luZG93SWRlbnRpdHk7XG4gICAgICogaWYgKGZpbi5tZS5pc1dpbmRvdykge1xuICAgICAqICAgICB3aW5kb3dJZGVudGl0eSA9IGZpbi5tZS5pZGVudGl0eTtcbiAgICAgKiB9IGVsc2UgaWYgKGZpbi5tZS5pc1ZpZXcpIHtcbiAgICAgKiAgICAgd2luZG93SWRlbnRpdHkgPSAoYXdhaXQgZmluLm1lLmdldEN1cnJlbnRXaW5kb3coKSkuaWRlbnRpdHk7XG4gICAgICogfSBlbHNlIHtcbiAgICAgKiAgICAgdGhyb3cgbmV3IEVycm9yKCdOb3QgcnVubmluZyBpbiBhIHBsYXRmb3JtIFZpZXcgb3IgV2luZG93Jyk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogY29uc3Qgdmlld09wdGlvbnMgPSB7XG4gICAgICogICAgIG5hbWU6ICd0ZXN0X3ZpZXcnLFxuICAgICAqICAgICB1cmw6ICdodHRwczovL2V4YW1wbGUuY29tJ1xuICAgICAqIH07XG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBzbGVlcChtcykge1xuICAgICAqICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiBzZXRUaW1lb3V0KHJlc29sdmUsIG1zKSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogY29uc3QgcGxhdGZvcm0gPSBhd2FpdCBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudCgpO1xuICAgICAqX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AgICAgKiBAcGFyYW0gb3B0aW9ucyBPcHRpb25hbCBwYXJhbWV0ZXJzIHRvIHNwZWNpZnkgd2hldGhlciBleGlzdGluZyB3aW5kb3dzIHNob3VsZCBiZSBjbG9zZWQuXG4gICAgICpcbiAgICAgKiBAcmVtYXJrcyBXaWxsIGNyZWF0ZSBhbnkgd2luZG93cyBhbmQgdmlld3MgdGhhdCBhcmUgbm90IHJ1bm5pbmcgYnV0IGFyZSBwYXNzZWQgaW4gdGhlIHNuYXBzaG90IG9iamVjdC4gQW55IFZpZXdcbiAgICAgKiBzcGVjaWZpZWQgaW4gdGhlIHNuYXBzaG90IGlzIGFzc2lnbmVkIGEgcmFuZG9tbHkgZ2VuZXJhdGVkIG5hbWUgdG8gYXZvaWQgY29sbGlzaW9ucy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiAvLyBHZXQgYSB3cmFwcGVkIGxheW91dCBwbGF0Zm9ybSBpbnN0YW5jZVxuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gYXdhaXQgZmluLlBsYXRmb3JtLmdldEN1cnJlbnQoKTtcbiAgICAgKlxuICAgICAqIGNvbnN0IHNuYXBzaG90ID0ge1xuICAgICAqICAgICB3aW5kb3dzOiBbXG4gICAgICogICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgbGF5b3V0OiB7XG4gICAgICogICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjb21wb25lbnRfWCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly93d3cub3BlbmZpbi5jbydcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjb21wb25lbnRfWScsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9jZG4ub3BlbmZpbi5jby9lbWJlZC13ZWIvY2hhcnQuaHRtbCdcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIF1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgXVxuICAgICAqICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgIH1cbiAgICAgKiAgICAgXVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIHBsYXRmb3JtLmFwcG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lld18zJyxcbiAgICAgKiAgICAgICAgIHVybDogJ2h0dHBzOi8vb3BlbmZpbi5jbydcbiAgICAgKiAgICAgfSwgd2luSWQpO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGFzeW5jIGZ1bmN0aW9uIGNyZWF0ZVdpbmRvd1dpdGhUd29WaWV3cygpIHtcbiAgICAgKiAgICAgY29uc3QgcGxhdGZvcm0gPSBhd2FpdCBmaW4uUGxhdGZvcm0uZ2V0Q3VycmVudCgpO1xuICAgICAqXG4gICAgICogICAgIHJldHVybiBwbGF0Zm9ybS5jcmVhdGVXaW5kb3coe1xuICAgICAqICAgICAgICAgbGF5b3V0OiB7XG4gICAgICogICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RhY2snLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgY29udGVudDogW1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2NvbXBvbmVudCcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50U3RhdGU6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0ZXN0X3ZpZXdfMScsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2V4YW1wbGUuY29tJ1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnROYW1lOiAndmlldycsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudFN0YXRlOiB7XG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndGVzdF92aWV3XzInLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly95YWhvby5jb20nXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICogICAgICAgICAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICAgICAgICAgIH1cbiAgICAgKiAgICAgICAgICAgICBdXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH0pO1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGNvbnN0IHdpbiA9IGF3YWl0IGNyZWF0ZVdpbmRvd1dpdGhUd29WaWV3cygpO1xuICAgICAqIC8vIC4uLiB5b3Ugd2lsbCBub3cgc2VlIGEgbmV3IHdpbmRvdyB3aXRoIHR3byB2aWV3cyBpbiBpdFxuICAgICAqXG4gICAgICogLy8gd2UgdGFrZSBhIHNuYXBzaG90IG9mIHRoZSBjdXJyZW50IHN0YXRlIG9mIHRoZSBhcHAsIGJlZm9yZSBjaGFuZ2luZyBpdFxuICAgICAqIGNvbnN0IHNuYXBzaG90T2ZJbml0aWFsQXBwU3RhdGUgPSBhd2FpdCBwbGF0Zm9ybS5nZXRTbmFwc2hvdCgpO1xuICAgICAqXG4gICAgICogLy8gbm93IGxldCdzIGNoYW5nZSB0aGUgc3RhdGUgb2YgdGhlIGFwcDpcbiAgICAgKiBhd2FpdCBhZGRWaWV3VG9XaW5kb3cod2luLmlkZW50aXR5KTtcbiAgICAgKiAvLyAuLi4gdGhlIHdpbmRvdyBub3cgaGFzIHRocmVlIHZpZXdzIGluIGl0XG4gIC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IHdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogU2V0dGluZyBvd24gY29udGV4dDpcbiAgICAgKiBgYGBqc1xuICAgICAqIGNvbnN0IHBsYXRmb3JtID0gZmluLlBsYXRmb3JtLmdldEN1cnJlbnRTeW5jKCk7XG4gICAgICogY29uc3QgY29udGV4dERhdGEgPSB7XG4gICAgICogICAgIHNlY3VyaXR5OiAnU1RPQ0snLFxuICAgICAqICAgICBjdXJyZW50VmlldzogJ2RldGFpbGVkJ1xuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGF3YWl0IHBsYXRmb3JtLnNldFdpbmRvd0NvbnRleHQoY29udGV4dERhdGEpO1xuICAgICAqIC8vIENvbnRleHQgb2YgY3VycmVudCB3aW5kb3cgaXMgbm93IHNldCB0byBgY29udGV4dERhdGFgXG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKiBTZXR0aW5nIHRoZSBjb250ZXh0IG9mIGFub3RoZXIgd2luZG93IG9yIHZpZXc6XG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBwbGF0Zm9ybSA9IGZpbi5QbGF0Zm9ybS5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIGNvbnN0IGNvbnRleHREYXRhID0ge1xuICAgICAqICAgICBzZWN1cml0eTogJ1NUT0NLJyxcbiAgICAgKiAgICAgY3VycmVudFZpZXc6ICdkZXRhaWxlZCdcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBjb25zdCB3aW5kb3dPclZpZXdJZGVudGl0eSA9IHsgdXVpZDogZmluLm1lLnV1aWQsIG5hbWU6ICduYW1lT2ZXaW5kb3dPclZpZXcnIH07XG4gICAgICogYXdhaXQgcGxhdGZvcm0uc2V0V2luZG93Q29udGV4dChjb250ZXh0RGF0YSwgd2luZG93T3JWaWV3SWRlbnRpdHkpO1xuICAgICAqIC8vIENvbnRleHQgb2YgdGhlIHRhcmdldCB3aW5kb3cgb3IgdmlldyBpcyBub3cgc2V0IHRvIGBj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ZCBsYXlvdXQgYnV0IG5vdCB0aGUgbmV3IGxheW91dCB3aWxsIGJlIGRlc3Ryb3llZC4gVmlld3Mgd2lsbCBiZSBhc3NpZ25lZCBhIHJhbmRvbWx5IGdlbmVyYXRlZCBuYW1lIHRvIGF2b2lkIGNvbGxpc2lvbnMuXG4gICAgICAgICAqIEBleGFtcGxlXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGxldCB3aW5kb3dJZGVudGl0eTtcbiAgICAgICAgICogaWYgKGZpbi5tZS5pc1dpbmRvdykge1xuICAgICAgICAgKiAgICAgd2luZG93SWRlbnRpdHkgPSBmaW4ubWUuaWRlbnRpdHk7XG4gICAgICAgICAqIH0gZWxzZSBpZiAoZmluLm1lLmlzVmlldykge1xuICAgICAgICAgKiAgICAgd2luZG93SWRlbnRpdHkgPSAoYXdhaXQgZmluLm1lLmdldEN1cnJlbnRXaW5kb3coKSkuaWRlbnRpdHk7XG4gICAgICAgICAqIH0gZWxzZSB7XG4gICAgICAgICAqICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vdCBydW5uaW5nIGluIGEgcGxhdGZvcm0gVmlldyBvciBXaW5kb3cnKTtcbiAgICAgICAgICogfVxuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBsYXlvdXQgPSBmaW4uUGxhdGZvcm0uTGF5b3V0LndyYXBTeW5jKHdpbmRvd0lkZW50aXR5KTtcbiAgICAgICAgICpcbiAgICAgICAgICogY29uc3QgbmV3TGF5b3V0ID0ge1xuICAgICAgICAgKiAgICAgY29udGVudDogW1xuICAgICAgICAgKiAgICAgICAgIHtcbiAgICAgICAgICogICAgICAgICAgICAgdHlwZTogJ3N0YWNrJyxcbiAgICAgICAgICogICAgICAgICAgICAgY29udGVudDogW1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAge1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbmV3X2NvbXBvbmVudF9BMScsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NBZmZpbml0eTogJ3BzXzEnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbSdcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAqICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAge1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdjb21wb25lbnQnLFxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudE5hbWU6ICd2aWV3JyxcbiAgICAgICAgICogICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdGF0ZToge1xuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbmV3X2NvbXBvbmVudF9BMicsXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vY2RuLm9wZW5maW4uY28vZW1iZWQtd2ViL2NoYXJ0Lmh0bWwnXG4gICAgICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgKiAgICAgICAgICAgICBdXG4gICAgICAgICAqICAgICAgICAgfVxuICAgICAgICAgKiAgICAgXVxuICAgICAgICAgKiB9O1xuICAgICAgICAgKlxuICAgICAgICAgKiBsYXlvdXQucmVwbGFjZShuZXdMYXlvdXQpO1xuICAgICAgICAgKiBgYGBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMucmVwbGFjZSA9IGFzeW5jI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ycmVudFdpbmRvdztcbiAgICAgICAgICogaWYgKGZpbi5tZS5pc1dpbmRvdykge1xuICAgICAgICAgKiAgICAgY3VycmVudFdpbmRvdyA9IGZpbi5tZTtcbiAgICAgICAgICogfSBlbHNlIGlmIChmaW4ubWUuaXNWaWV3KSB7XG4gICAgICAgICAqICAgICBjdXJyZW50V2luZG93ID0gYXdhaXQgZmluLm1lLmdldEN1cnJlbnRXaW5kb3coKTtcbiAgICAgICAgICogfSBlbHNlIHtcbiAgICAgICAgICogICAgIHRocm93IG5ldyBFcnJvcignTm90IHJ1bm5pbmcgaW4gYSBwbGF0Zm9ybSBWaWV3IG9yIFdpbmRvdycpO1xuICAgICAgICAgKiB9XG4gICAgICAgICAqXG4gICAgICAgICAqIGNvbnN0IGxheW91dCA9IGZpbi5QbGF0Zm9ybS5MYXlvdXQud3JhcFN5bmMoY3VycmVudFdpbmRvdy5pZGVudGl0eSk7XG4gICAgICAgICAqIGNvbnN0IHZpZXdUb1JlcGxhY2UgPSAoYXdhaXQgY3VycmVudFdpbmRvdy5nZXRDdXJyZW50Vmlld3MoKSlbMF07XG4gICAgICAgICAqIGNvbnN0IG5ld1ZpZXdDb25maWcgPSB7dXJsOiAnaHR0cHM6Ly9leGFtcGxlLmNvbSd9O1xuICAgICAgICAgKiBhd2FpdCBsYXlvdXQucmVwbGFjZVZpZXcodmlld1RvUmVwbGFjZS5pZGVudGl0eSwgbmV3Vmlld0NvbmZpZyk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5yZXBsYWNlVmlldyA9IGFzeW5jICh2aWV3VG9SZXBsYWNlLCBuZXdWaWV3KSA9PiB7XG4gICAgICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LXJlcGxhY2UtdmlldycpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGNvbn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ZpZXdzIGluIGN1cnJlbnQgd2luZG93IGxheW91dC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBsYXlvdXQgPSBmaW4uUGxhdGZvcm0uTGF5b3V0LmdldEN1cnJlbnRTeW5jKCk7XG4gICAgICogY29uc3Qgdmlld3MgPSBhd2FpdCBsYXlvdXQuZ2V0Q3VycmVudFZpZXdzKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0Q3VycmVudFZpZXdzKCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignbGF5b3V0LWdldC12aWV3cycpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IHRoaXMucGxhdGZvcm0uZ2V0Q2xpZW50KCk7XG4gICAgICAgIGNvbnN0IHZpZXdJZGVudGl0aWVzID0gYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdnZXQtbGF5b3V0LXZpZXdzJywge1xuICAgICAgICAgICAgdGFyZ2V0OiB0aGlzLmlkZW50aXR5XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdmlld0lkZW50aXRpZXMubWFwKChpZGVudGl0eSkgPT4gdGhpcy5maW4uVmlldy53cmFwU3luYyhpZGVudGl0eSkpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXRyaWV2ZXMgdGhlIHRvcCBsZXZlbCBjb250ZW50IGl0ZW0gb2YgdGhlIGxheW91dC5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIENhbm5vdCBiZSBjYWxsZWQgZnJvbSBhIHZpZXcuXG4gICAgICpcbiAgICAgKlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBgYGBqc1xuICAgICAqIGlmICghZmluLm1lLmlzV2luZG93KSB7XG4gICAgICogICAgIHRocm93IG5ldyBF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GFpbmVyLlxuICAgICAgICAgKiBJbiBvcmRlciB0byBjYXB0dXJlIHRoZSByZWxldmFudCBldmVudHMgZHVyaW5nIExheW91dCBpbml0aWF0aW9uLCBzZXQgdXAgdGhlIGxpc3RlbmVycyBvbiB0aGUgRE9NIGVsZW1lbnQgcHJpb3IgdG8gY2FsbGluZyBgaW5pdGAuXG4gICAgICAgICAqIEBwYXJhbSBvcHRpb25zIC0gTGF5b3V0IGluaXQgb3B0aW9ucy5cbiAgICAgICAgICpcbiAgICAgICAgICogQGV4cGVyaW1lbnRhbFxuICAgICAgICAgKlxuICAgICAgICAgKiBAZXhhbXBsZVxuICAgICAgICAgKiBgYGBqc1xuICAgICAgICAgKiAvLyBJZiBubyBvcHRpb25zIGFyZSBpbmNsdWRlZCwgdGhlIGxheW91dCBpbiB0aGUgd2luZG93IG9wdGlvbnMgaXMgaW5pdGlhbGl6ZWQgaW4gYW4gZWxlbWVudCB3aXRoIHRoZSBpZCBgbGF5b3V0LWNvbnRhaW5lcmBcbiAgICAgICAgICogY29uc3QgbGF5b3V0ID0gYXdhaXQgZmluLlBsYXRmb3JtLkxheW91dC5pbml0KCk7XG4gICAgICAgICAqIGBgYFxuICAgICAgICAgKiA8YnI+XG4gICAgICAgICAqXG4gICAgICAgICAqIGBgYGpzXG4gICAgICAgICAqIGNvbnN0IGNvbnRhaW5lcklkID0gJ215LWN1c3RvbS1jb250YWluZXItaWQnO1xuICAgICAgICAgKlxuICAgICAgICAgKiBjb25zdCBteUxheW91dENvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGNvbnRhaW5lcklkKTtcbiAgICAgICAgICpcbiAgICAgICAgICogbXlMYXlvdXRDb250YWluZXIuYWRkRXZlbnRMaXN0ZW5lcigndGFiLWNyZWF0ZWQnLCBmdW5jdGlvbihldmVudCkge1xuICAgICAgICAgKiAgICAgY29uc3QgeyB0YWJTZWxlY3RvciB9ID0gZXZlbnQuZGV0YWlsO1xuICAgICAgICAgKiAg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ZyA9ICdbTGF5b3V0XSBZb3UgYXJlIHVzaW5nIGEgZGVwcmVjYXRlZCBwcm9wZXJ0eSBgbGF5b3V0TWFuYWdlcmAgLSBpdCB3aWxsIHRocm93IGlmIHlvdSBhY2Nlc3MgaXQgc3RhcnRpbmcgaW4gdjM3Lic7XG4gICAgICAgICAgICBjb25zdCBtYW5hZ2VyUHJveHkgPSBuZXcgUHJveHkobGF5b3V0TWFuYWdlciwge1xuICAgICAgICAgICAgICAgIGdldCh0YXJnZXQsIGtleSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYFtMYXlvdXQtbWdyLXByb3h5XSBhY2Nlc3NpbmcgJHtrZXkudG9TdHJpbmcoKX1gKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKG1zZyk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0YXJnZXRba2V5XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGNvbnN0IGxheW91dCA9IE9iamVjdC5hc3NpZ24odGhpcy53cmFwU3luYyhsYXlvdXRJZGVudGl0eSksIHsgbGF5b3V0TWFuYWdlcjogbWFuYWdlclByb3h5IH0pO1xuICAgICAgICAgICAgY29uc3QgbGF5b3V0UHJveHkgPSBuZXcgUHJveHkobGF5b3V0LCB7XG4gICAgICAgICAgICAgICAgZ2V0KHRhcmdldCwga2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChrZXkgPT09ICdsYXlvdXRNYW5hZ2VyJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBbTGF5b3V0LXByb3h5XSBhY2Nlc3NpbmcgJHtrZXkudG9TdHJpbmcoKX1gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2Fybihtc2cpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0YXJnZXRba2V5XTtcbiAgICAgIC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jpcbiAgICAgKiBjb25zdCBsYXlvdXRDb25maWcgPSBhd2FpdCBsYXlvdXQuZ2V0Q29uZmlnKCk7XG4gICAgICogYGBgXG4gICAgICovXG4gICAgYXN5bmMgZ2V0Q3VycmVudCgpIHtcbiAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2xheW91dC1nZXQtY3VycmVudCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2VcbiAgICAgICAgfSk7XG4gICAgICAgIGlmICghdGhpcy5maW4ubWUuaXNXaW5kb3cpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IGFyZSBub3QgaW4gYSBXaW5kb3cgY29udGV4dC4gIE9ubHkgV2luZG93cyBjYW4gaGF2ZSBhIExheW91dC4nKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCB7IHV1aWQsIG5hbWUgfSA9IHRoaXMuZmluLm1lO1xuICAgICAgICByZXR1cm4gdGhpcy53cmFwKHsgdXVpZCwgbmFtZSB9KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogU3luY2hyb25vdXNseSByZXR1cm5zIGEgTGF5b3V0IG9iamVjdCB0aGF0IHJlcHJlc2VudHMgYSBXaW5kb3cncyBsYXlvdXQuXG4gICAgICpcbiAgICAgKiBAcmVtYXJrcyBDYW5ub3QgYmUgY2FsbGVkIGZyb20gYSB2aWV3LlxuICAgICAqXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogY29uc3QgbGF5b3V0ID0gZmluLlBsYXRmb3JtLkxheW91dC5nZXRDdXJyZW50U3luYygpO1xuICAgICAqIC8vIFVzZSB3cmFwcGVkIGluc3RhbmNlIHRvIGNvbnRyb2wgbGF5b3V0LCBlLmcuOlxuICAgICAqIGNvbnN0IGxheW91dENvbmZpZyA9IGF3YWl0IGxheW91dC5nZXRDb25maWcoKTtcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgIC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J5IHtcbiAgICAgKiAgICAgY29uc3QgcGxhdGZvcm0gPSBhd2FpdCBmaW4uUGxhdGZvcm0uc3RhcnQoe1xuICAgICAqICAgICAgICAgdXVpZDogJ3BsYXRmb3JtLTEnLFxuICAgICAqICAgICAgICAgYXV0b1Nob3c6IGZhbHNlLFxuICAgICAqICAgICAgICAgZGVmYXVsdFdpbmRvd09wdGlvbnM6IHtcbiAgICAgKiAgICAgICAgICAgICBzdHlsZXNoZWV0VXJsOiAnY3NzLXNoZWV0LXVybCcsXG4gICAgICogICAgICAgICAgICAgY29ybmVyUm91bmRpbmc6IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgaGVpZ2h0OiAxMCxcbiAgICAgKiAgICAgICAgICAgICAgICAgd2lkdGg6IDEwXG4gICAgICogICAgICAgICAgICAgfVxuICAgICAqICAgICAgICAgfVxuICAgICAqICAgICB9KTtcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ1BsYXRmb3JtIGlzIHJ1bm5pbmcnLCBwbGF0Zm9ybSk7XG4gICAgICogfSBjYXRjaChlKSB7XG4gICAgICogICAgIGNvbnNvbGUuZXJyb3IoZSk7XG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIHN0YXJ0KHBsYXRmb3JtT3B0aW9ucykge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbigncGxhdGZvcm0tc3RhcnQnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlXG4gICAgICAgIH0pO1xuICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tYXN5bmMtcHJvbWlzZS1leGVjdXRvclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoYXN5bmMgKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBjb25zdCB7IHV1aWQgfSA9IHBsYXRmb3JtT3B0aW9ucztcbiA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m9wZXJ0eTogaGFuZGxlLFxuICAgICAgICBnZXQ6IGhhbmRsZSxcbiAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOiBoYW5kbGUsXG4gICAgICAgIGdldFByb3RvdHlwZU9mOiBoYW5kbGUsXG4gICAgICAgIGhhczogaGFuZGxlLFxuICAgICAgICBpc0V4dGVuc2libGU6IGhhbmRsZSxcbiAgICAgICAgb3duS2V5czogaGFuZGxlLFxuICAgICAgICBwcmV2ZW50RXh0ZW5zaW9uczogaGFuZGxlLFxuICAgICAgICBzZXQ6IGhhbmRsZSxcbiAgICAgICAgc2V0UHJvdG90eXBlT2Y6IGhhbmRsZVxuICAgIH0pO1xufVxuaW5hY2Nlc3NpYmxlT2JqZWN0LmNyZWF0ZVVudXNhYmxlT2JqZWN0ID0gY3JlYXRlVW51c2FibGVPYmplY3Q7XG5mdW5jdGlvbiBjcmVhdGVXYXJuaW5nT2JqZWN0KG1lc3NhZ2UsIG9iaikge1xuICAgIHJldHVybiBuZXcgUHJveHkob2JqLCB7XG4gICAgICAgIGdldDogKC4uLmFyZ3MpID0+IHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICAgICAgICBjb25zb2xlLndhcm4obWVzc2FnZSk7XG4gICAgICAgICAgICByZXR1cm4gUmVmbGVjdC5nZXQoLi4uYXJncyk7XG4gICAgICAgIH0sXG4gICAgICAgIHNldDogKC4uLmFyZ3MpID0+IHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICAgICAgICBjb25zb2xlLndhcm4obWVzc2FnZSk7XG4gICAgICAgICAgICByZXR1cm4gUmVmbGVjdC5zZXQoLi4uYXJncyk7XG4gICAgICAgIH0sXG4gICAgICAgIGdldE93blByb3BlcnR5RGVzY3JpcHRvcjogKC4uLmFyZ3MpID0+IHtcbiAgICAgICAgICAgIC8vIGVzbGlud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ZCwgY29udGV4dFR5cGUgfSA9IHBheWxvYWQ7XG5cdCAgICAgICAgY29uc3QgY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUgPSB0aGlzLmdldENsaWVudFN0YXRlKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICBpZiAoIWNsaWVudFN1YnNjcmlwdGlvblN0YXRlKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2xpZW50IHdpdGggSWRlbnRpdHk6ICR7Y2xpZW50SWRlbnRpdHkudXVpZH0gJHtjbGllbnRJZGVudGl0eS5uYW1lfSBub3QgaW4gQ2xpZW50IFN0YXRlIE1hcGApO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoY29udGV4dFR5cGUpIHtcblx0ICAgICAgICAgICAgY29uc3QgY3VycmVudEhhbmRsZXJMaXN0ID0gY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUuY29udGV4dEhhbmRsZXJzLmdldChjb250ZXh0VHlwZSkgfHwgW107XG5cdCAgICAgICAgICAgIGNsaWVudFN1YnNjcmlwdGlvblN0YXRlLmNvbnRleHRIYW5kbGVycy5zZXQoY29udGV4dFR5cGUsIFsuLi5jdXJyZW50SGFuZGxlckxpc3QsIGhhbmRsZXJJZF0pO1xuXHQgICAgICAgICAgICBjb25zdCBjdXJyZW50Q29udGV4dCA9IHRoaXMuY29udGV4dEdyb3VwTWFwLmdldChjb250ZXh0VHlwZSk7XG5cdCAgICAgICAgICAgIGlmIChjdXJyZW50Q29udGV4dCkge1xuXHQgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5wcm92aWRlci5kaXNwYXRjaChjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjdXJyZW50Q29udGV4dCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNsaWVudFN1YnNjcmlwdGlvblN0YXRlLmdsb2JhbEhhbmRsZXIgPSBoYW5kbGVySWQ7XG5cdCAgICAgICAgICAgIGNvbnN0IGdsb2JhbERpc3BhdGNoUHJvbWlzZXMgPSBbLi4udGhpcy5jb250ZXh0R3JvdXBNYXAua2V5cygpXS5tYXAoYXN5bmMgKGN1cnJlbnRDb250ZXh0VHlwZSkgPT4ge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgY3VycmVudENvbnRleHQgPSB0aGlzLmNvbnRleHRHcm91cE1hcC5nZXQoY3VycmVudENvbnRleHRUeXBlKTtcblx0ICAgICAgICAgICAgICAgIGlmIChjdXJyZW50Q29udGV4dCkge1xuXHQgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucHJvdmlkZXIuZGlzcGF0Y2goY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY3VycmVudENvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwoZ2xvYmFsRGlzcGF0Y2hQcm9taXNlcyk7XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgaGFuZGxlclJlbW92ZWQocGF5bG9hZCwgY2xpZW50SWRlbnRpdHkpIHtcblx0ICAgICAgICBjb25zdCB7IGhhbmRsZXJJZCB9ID0gcGF5bG9hZDtcblx0ICAgICAgICBjb25zdCBjbGllbnQgPSB0aGlzLmNsaWVudHMuZ2V0KGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQpO1xuXHQgICAgICAgIGlmIChjbGllbnQpIHtcblx0ICAgICAgICAgICAgQXJyYXkuZnJvbShjbGllbnQuY29udGV4dEhhbmRsZXJzKS5mb3JFYWNoKChbLCBoYW5kbGVyc10pID0+IHtcblx0ICAgICAgICAgICAgICAgIGNvbnN0IGluZGV4ID0gaGFuZGxlcnMuaW5kZXhPZihoYW5kbGVySWQpO1xuXHQgICAgICAgICAgICAgICAgaWYgKGluZGV4ID4gLTEpIHtcblx0ICAgICAgICAgICAgICAgICAgICBoYW5kbGVycy5zcGxpY2UoaW5kZXgsIDEpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgaWYgKGNsaWVudC5nbG9iYWxIYW5kbGVyID09PSBoYW5kbGVySWQpIHtcblx0ICAgICAgICAgICAgICAgIGNsaWVudC5nbG9iYWxIYW5kbGVyID0gdW5kZWZpbmVkO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICBjb25zb2xlLndhcm4oYFRyeWluZyB0byByZW1vdmUgYSBoYW5kbGVyIGZyb20gYSBjbGllbnQgdGhhdCBpc24ndCBtYXBwZWQuIGhhbmRsZXJJZDogJHtoYW5kbGVySWR9LiBjbGllbnRJZGVudGl0eTogJHtjbGllbnRJZGVudGl0eX1gKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICByZWdpc3Rlck5ld0NsaWVudChjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGlmICghdGhpcy5jbGllbnRzLmhhcyhjbGllbnRJZGVudGl0eS5lbmRwb2ludElkKSkge1xuXHQgICAgICAgICAgICBjb25zdCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSA9IHtcblx0ICAgICAgICAgICAgICAgIGNvbnRleHRIYW5kbGVyczogbmV3IE1hcCgpLFxuXHQgICAgICAgICAgICAgICAgY2xpZW50SWRlbnRpdHksXG5cdCAgICAgICAgICAgICAgICBnbG9iYWxIYW5kbGVyOiB1bmRlZmluZWRcblx0ICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgdGhpcy5jbGllbnRzLnNldChjbGllbnRJZGVudGl0eS5lbmRwb2ludElkLCBjbGllbnRTdWJzY3JpcHRpb25TdGF0ZSk7XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgb25EaXNjb25uZWN0aW9uKGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgdGhpcy5jb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oY29udGV4dEludGVncml0eUNoZWNrUmVzdWx0LmlzVmFsaWQgPT09IGZhbHNlKSB7XG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgRmFpbGVkIHRvIGJyb2FkY2FzdCAtIGJhZCBDb250ZXh0LiBSZWFzb246ICR7Y29udGV4dEludGVncml0eUNoZWNrUmVzdWx0LnJlYXNvbn0uIENvbnRleHQ6ICR7SlNPTi5zdHJpbmdpZnkoY29udGV4dCl9YCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIHRoaXMuY29udGV4dEJ5Q29udGV4dFR5cGUuc2V0KGNvbnRleHQudHlwZSwgY29udGV4dCk7XG5cdCAgICAgICAgdGhpcy5sYXN0Q29udGV4dCA9IGNvbnRleHQ7XG5cdCAgICAgICAgQXJyYXkuZnJvbSh0aGlzLmNsaWVudHMudmFsdWVzKCkpLmZvckVhY2goKGN1cnJDbGllbnRTdGF0ZSkgPT4ge1xuXHQgICAgICAgICAgICBjb25zdCBoYW5kbGVySWRzRm9yQ29udGV4dFR5cGUgPSBjdXJyQ2xpZW50U3RhdGUuaGFuZGxlcklkc0J5Q29udGV4dFR5cGVzLmdldChjb250ZXh0LnR5cGUpO1xuXHQgICAgICAgICAgICBpZiAoaGFuZGxlcklkc0ZvckNvbnRleHRUeXBlKSB7XG5cdCAgICAgICAgICAgICAgICBoYW5kbGVySWRzRm9yQ29udGV4dFR5cGUuZm9yRWFjaCgoaGFuZGxlcklkKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm92aWRlci5kaXNwYXRjaChjdXJyQ2xpZW50U3RhdGUuY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBpZiAoY3VyckNsaWVudFN0YXRlLmdsb2JhbEhhbmRsZXIpIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMucHJvdmlkZXIuZGlzcGF0Y2goY3VyckNsaWVudFN0YXRlLmNsaWVudElkZW50aXR5LCBjdXJyQ2xpZW50U3RhdGUuZ2xvYmFsSGFuZGxlciwgY29udGV4dCk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9KTtcblx0ICAgIH1cblx0ICAgIGdldEN1cnJlbnRDb250ZXh0KHBheWxvYWQsIHNlbmRlckNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgeyBjb250ZXh0VHlwZSB9ID0gcGF5bG9hZDtcblx0ICAgICAgICBjb25zdCBjbGllbnRTdGF0ZSA9IHRoaXMuZ2V0Q2xpZW50U3RhdGUoc2VuZGVyQ2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgIGlmICghY2xpZW50U3RhdGUpIHtcblx0ICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBDbGllbnQgd2l0aCBJZGVudGl0eTogJHtzZW5kZXJDbGllbnRJZGVudGl0eS51dWlkfSAke3NlbmRlckNsaWVudElkZW50aXR5Lm5hbWV9LCB0cmllZCB0byBjYWxsIGdldEN1cnJlbnRDb250ZXh0LCBpcyBub3QgY29ubmVjdGVkIHRvIHRoaXMgUHJpdmF0ZSBDaGFubmVsYCk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChjb250ZXh0VHlwZSAhPT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRDb250ZXh0ID0gdGhpcy5jb250ZXh0QnlDb250ZXh0VHlwZS5nZXQoY29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICBpZiAoY3VycmVudENvbnRleHQpXG5cdCAgICAgICAgICAgICAgICByZXR1cm4gY3VycmVudENvbnRleHQ7XG5cdCAgICAgICAgICAgIHJldHVybiBudWxsO1xuXHQgICAgICAgIH1cblx0ICAgICAgICByZXR1cm4gdGhpcy5sYXN0Q29udGV4dCA/IHRoaXMubGFzdENvbnRleHQgOiBudWxsO1xuXHQgICAgfV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gIGlmIChjb250ZXh0VHlwZUhhbmRsZXJJZHMubGVuZ3RoID4gMCkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgdW5zdWJQcm9taXNlcyA9IGNvbnRleHRUeXBlSGFuZGxlcklkcy5tYXAoYXN5bmMgKGhhbmRsZXJJZCkgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbnRleHRIYW5kbGVyUmVtb3ZlZCh7IGhhbmRsZXJJZCB9LCBjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwodW5zdWJQcm9taXNlcyk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGlmIChnbG9iYWxIYW5kbGVySWQpIHtcblx0ICAgICAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5jb250ZXh0SGFuZGxlclJlbW92ZWQoeyBoYW5kbGVySWQ6IGdsb2JhbEhhbmRsZXJJZCB9LCBjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGVycm9yLm1lc3NhZ2UpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgYXN5bmMgaGFuZGxlQ2xpZW50RGlzY29ubmVjdGluZyhkaXNjb25uZWN0aW5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hdGZvcm1fY3VzdG9taXphdGlvbl9sb2NhbFwiLFxuXHQgKiAgICAgICAgICBcImFwcGxpY2F0aW9uSWNvblwiOiBcImh0dHBzOi8vb3BlbmZpbi5naXRodWIuaW8vZ29sZGVuLXByb3RvdHlwZS9mYXZpY29uLmljb1wiLFxuXHQgKiAgICAgICAgICBcImF1dG9TaG93XCI6IGZhbHNlLFxuXHQgKiAgICAgICAgICBcInByb3ZpZGVyVXJsXCI6IFwiaHR0cDovL2xvY2FsaG9zdDo1NTU1L3Byb3ZpZGVyLmh0bWxcIixcblx0ICogICAgICAgICAgXCJpbnRlcm9wQnJva2VyQ29uZmlndXJhdGlvblwiOiB7XG5cdCAqICAgICAgICAgICAgICBcImNvbnRleHRHcm91cHNcIjogW1xuXHQgKiAgICAgICAgICAgICAgICAgIHtcblx0ICogICAgICAgICAgICAgICAgICAgICAgXCJpZFwiOiBcImdyZWVuXCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgIFwiZGlzcGxheU1ldGFkYXRhXCI6IHtcblx0ICogICAgICAgICAgICAgICAgICAgICAgICAgIFwiY29sb3JcIjogXCIjMDBDQzg4XCIsXG5cdCAqICAgICAgICAgICAgICAgICAgICAgICAgICBcIm5hbWVcIjogXCJncmVlblwiXG5cdCAqICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICogICAgICAgICAgICAgICAgICB9LFxuXHQgKiAgICAgICAgICAgICAgICAgIHtcblx0ICogICAgICAgICAgICAgICAgICAgICAgXCJpZFwiOiBcInB1cnBsZVwiLFxuXHQgKiAgICAgICAgICAgICAgICAgICAgICBcImRpc3BsYXlNZXRhZGF0YVwiOiB7XG5cdCAqICAgICAgICAgICAgICAgICAgICAgICAgICBcImNvbG9yXCI6IFwiIzhDNjFGRlwiLFxuXHQgKiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJuYW1lXCI6IFwicHVycGxlXCJcblx0ICogICAgICAgICAgICAgICAgICAgICAgfVxuXHQgKiAgICAgICAgICAgICAgICAgIH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hdmUgdG8gY29udGludWFsbHkgbWFpbnRhaW4geW91ciBvd24gb3ZlcnJpZGUgY29kZS5cblx0ICpcblx0ICogYGBganNcblx0ICogZmluLlBsYXRmb3JtLmluaXQoe1xuXHQgKiAgICAgb3ZlcnJpZGVDYWxsYmFjazogYXN5bmMgKFByb3ZpZGVyKSA9PiB7XG5cdCAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBQcm92aWRlciB7XG5cdCAqICAgICAgICAgICAgIGFzeW5jIGdldFNuYXBzaG90KCkge1xuXHQgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2JlZm9yZSBnZXRTbmFwc2hvdCcpXG5cdCAqICAgICAgICAgICAgICAgICBjb25zdCBzbmFwc2hvdCA9IGF3YWl0IHN1cGVyLmdldFNuYXBzaG90KCk7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYWZ0ZXIgZ2V0U25hcHNob3QnKVxuXHQgKiAgICAgICAgICAgICAgICAgcmV0dXJuIHNuYXBzaG90O1xuXHQgKiAgICAgICAgICAgICB9XG5cdCAqXG5cdCAqICAgICAgICAgICAgIGFzeW5jIGFwcGx5U25hcHNob3QoeyBzbmFwc2hvdCwgb3B0aW9ucyB9KSB7XG5cdCAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnYmVmb3JlIGFwcGx5U25hcHNob3QnKVxuXHQgKiAgICAgICAgICAgICAgICAgY29uc3Qgb3JpZ2luYWxQcm9taXNlID0gc3VwZXIuYXBwbHlTbmFwc2hvdCh7IHNuYXBzaG90LCBvcHRpb25zIH0pO1xuXHQgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2FmdGVyIGFwcGx5U25hcHNob3QnKVxuXHQgKlxuXHQgKiAgICAgICAgICAgICAgICAgcmV0dXJuIG9yaWdpbmFsUHJvbWlzZTtcblx0ICogICAgICAgICAgICAgfVxuXHQgKiAgICAgICAgIH07XG5cdCAqICAgICAgICAgcmV0dXJ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iBAcGFyYW0gY2xpZW50SWRlbnRpdHkgLSBJZGVudGl0eSBvZiB0aGUgY2xpZW50IHNlbmRlci5cblx0ICAgICAqXG5cdCAgICAgKi9cblx0ICAgIHNldENvbnRleHQoeyBjb250ZXh0IH0sIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgdGhpcy53aXJlLnNlbmRBY3Rpb24oJ2ludGVyb3AtYnJva2VyLXNldC1jb250ZXh0JykuY2F0Y2goKGUpID0+IHtcblx0ICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG5cdCAgICAgICAgfSk7XG5cdCAgICAgICAgY29uc3QgY2xpZW50U3RhdGUgPSB0aGlzLmdldENsaWVudFN0YXRlKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICBpZiAoY2xpZW50U3RhdGUgJiYgY2xpZW50U3RhdGUuY29udGV4dEdyb3VwSWQpIHtcblx0ICAgICAgICAgICAgY29uc3QgeyBjb250ZXh0R3JvdXBJZCB9ID0gY2xpZW50U3RhdGU7XG5cdCAgICAgICAgICAgIGlmICghdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5oYXMoY29udGV4dEdyb3VwSWQpKSB7XG5cdCAgICAgICAgICAgICAgICAvLyBUaGVvcmV0aWNhbGx5IG5vdCBwb3NzaWJsZS5cblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2xpZW50IGhhcyBhIGNvbnRleHQgZ3JvdXAgdGhhdCBpc24ndCBpbiB0aGUgY29udGV4dCBncm91cCBtYXBwaW5nOiAke2NvbnRleHRHcm91cElkfS5gKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjb25zdCBjb250ZXh0SW50ZWdyaXR5Q2hlY2tSZXN1bHQgPSBJbnRlcm9wQnJva2VyLmNoZWNrQ29udGV4dEludGVncml0eShjb250ZXh0KTtcblx0ICAgICAgICAgICAgaWYgKGNvbnRleHRJbnRlZ3JpdHlDaGVja1Jlc3VsdC5pc1ZhbGlkID09PSBmYWxzZSkge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBGYWlsZWQgdG8gc2V0IENvbnRleHQgLSBiYWQgQ29udGV4dC4gUmVhc29uOiAke2NvbnRleHRJbnRlZ3JpdHlDaGVja1Jlc3VsdC5yZWFzb259LiBDb250ZXh0OiAke0pTT04uc3RyaW5naWZ5KGNvbnRleHQpfWApO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tbm9uLW51bGwtYXNzZXJ0aW9uXG5cdCAgICAgICAgICAgIGNvbnN0IGNvbnRleHRHcm91cFN0YXRlID0gdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5nZXQoY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICBjb25zdCBicm9hZGNhc3RlZENvbnRleHRUeXBlID0gY29udGV4dC50eXBlO1xuXHQgICAgICAgICAgICBjb250ZXh0R3JvdXBTdGF0ZS5zZXQoYnJvYWRjYXN0ZWRDb250ZXh0VHlwZSwgY29udGV4dCk7XG5cdCAgICAgICAgICAgIHRoaXMubGFzdENvbnRleHRNYXAuc2V0KGNvbnRleHRHcm91cElkLCBicm9hZGNhc3RlZENvbnRleHRUeXBlKTtcblx0ICAgICAgICAgICAgY29uc3QgY2xpZW50c0luU2FtZUNvbnRleHRHcm91cCA9IEFycmF5LmZyb20odGhpcy5pbnRlcm9wQ2xpZW50cy52YWx1ZXMoKSkuZmlsdGVyKChjb25uZWN0ZWRDbGllbnQpID0+IGNvbm5lY3RlZENsaWVudC5jb250ZXh0R3JvdXBJZCA9PT0gY29udGV4dEdyb3VwSWQpO1xuXHQgICAgICAgICAgICBjbGllbnRzSW5TYW1lQ29udGV4dEdyb3VwLmZvckVhY2goKGNsaWVudCkgPT4ge1xuXHQgICAgICAgICAgICAgICAgZm9yIChjb25zdCBbLCBoYW5kbGVySW5mb10gb2YgY2xpZW50LmNvbnRleHRIYW5kbGVycykge1xuXHQgICAgICAgICAgICAgICAgICAgIGlmIChJbnRlcm9wQnJva2VyLmlzQ29udGV4dFR5cGVDb21wYXRpYmxlKGJyb2FkY2FzdGVkQ29udGV4dFR5cGUsIGhhbmRsZXJJbmZvLmNvbnRleHRUeXBlKSkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudC5jbGllbnRJZGVudGl0eSwgaGFuZGxlckluZm8uaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0pO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIGlmIChjbGllbnRTdGF0ZSkge1xuXHQgICAgICAgICAgICAvLyBDbGllbnQgaGFzIG5vdCBqb2luZWQgYW55IGNvbnRleHQgZ3JvdXAgYmVoYXZpb3IuXG5cdCAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IG11c3Qgam9pbiBhIGNvbnRleHQgZ3JvdXAgYmVmb3JlIHlvdSBjYW4gc2V0IGNvbnRleHQuJyk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2Uge1xuXHQgICAgICAgICAgICAvLyBUaGlzIHNob3VsZG4ndCBnZXQgaGl0LlxuXHQgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENsaWVudCB3aXRoIElkZW50aXR5OiAke2NsaWVudElkZW50aXR5LnV1aWR9ICR7Y2xpZW50SWRlbnRpdHkubmFtZX0gbm90IGluIENsaWVudCBTdGF0ZSBNYXBgKTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvKipcblx0ICAgICAqIEdldCBjdXJyZW50IGNvbnRleHQgZm9yIGEgY2xpZW50IHN1YnNjcmliZWQgdG8gYSBDb250ZXh0IEdyb3VwLlxu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udFN1YnNjcmlwdGlvblN0YXRlLmNvbnRleHRIYW5kbGVycykge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgeyBjb250ZXh0VHlwZSwgaGFuZGxlcklkIH0gPSBoYW5kbGVySW5mbztcblx0ICAgICAgICAgICAgICAgIGlmIChjb250ZXh0VHlwZSA9PT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgLy8gU2VuZCB0aGlzIHNpbmdsZSBoYW5kbGVyIGFsbCBvZiB0aGUgY29udGV4dCwgYmVjYXVzZSBpdCBhY2NlcHRzIGFsbC5cblx0ICAgICAgICAgICAgICAgICAgICBjb250ZXh0R3JvdXBNYXAuZm9yRWFjaCgoY29udGV4dCwgXykgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgZWxzZSBpZiAoY29udGV4dEdyb3VwTWFwLmhhcyhjb250ZXh0VHlwZSkpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCBjb250ZXh0Rm9yVHlwZSA9IGNvbnRleHRHcm91cE1hcC5nZXQoY29udGV4dFR5cGUpO1xuXHQgICAgICAgICAgICAgICAgICAgIGlmIChjb250ZXh0Rm9yVHlwZSkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHRGb3JUeXBlKTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvLyBSZW1vdmVzIHRoZSB0YXJnZXQgZnJvbSBpdHMgY29udG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kge1xuXHQgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgTW9yZSB0aGFuIG9uZSBjb25uZWN0aW9uIGZvdW5kIGZvciBpZGVudGl0eSAke3RhcmdldC51dWlkfSAke3RhcmdldC5uYW1lfWApO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcblx0ICAgICAgICAgICAgICAgIGZvciAoY29uc3QgY29ubmVjdGlvbiBvZiBhbGxDb25uZWN0aW9ucykge1xuXHQgICAgICAgICAgICAgICAgICAgIHByb21pc2VzLnB1c2godGhpcy5yZW1vdmVDbGllbnRGcm9tQ29udGV4dEdyb3VwKGNvbm5lY3Rpb24pKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHByb21pc2VzKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlcnJvcik7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIC8vIE5vIHRhcmdldCBwcm92aWRlZCwgcmVtb3ZlIHRoZSBzZW5kZXIgZnJvbSB0aGUgY29udGV4dCBncm91cC5cblx0ICAgICAgICAgICAgYXdhaXQgdGhpcy5yZW1vdmVDbGllbnRGcm9tQ29udGV4dEdyb3VwKHNlbmRlcklkZW50aXR5KTtcblx0ICAgICAgICB9XG5cdCAgICB9XG5cdCAgICAvLyByZW1vdmVDbGllbnRGcm9tQ29udGV4dEdyb3VwIGRvZXMgdGhlIGFjdHVhbCByZW1vdmUgb2YgdGhlIGNsaWVudCBmcm9tIHRoZSBDb250ZXh0IEdyb3VwXG5cdCAgICAvKipcblx0ICAgICAqIEhlbHBlciBmdW5jdGlvbiBmb3Ige0BsaW5rIEludGVyb3BC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CF0YXJnZXRJbmZvKSB7XG5cdCAgICAgICAgICAgIHRoaXMuaW50ZW50Q2xpZW50TWFwLnNldCh0YXJnZXQubmFtZSwgbmV3IE1hcCgpKTtcblx0ICAgICAgICAgICAgY29uc3QgbmV3SGFuZGxlckluZm9NYXAgPSB0aGlzLmludGVudENsaWVudE1hcC5nZXQodGFyZ2V0Lm5hbWUpO1xuXHQgICAgICAgICAgICBpZiAobmV3SGFuZGxlckluZm9NYXApIHtcblx0ICAgICAgICAgICAgICAgIG5ld0hhbmRsZXJJbmZvTWFwLnNldChoYW5kbGVySWQsIHsgaXNSZWFkeTogZmFsc2UsIHBlbmRpbmdJbnRlbnRzOiBbaW50ZW50XSB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgY29uc3QgaGFuZGxlckluZm8gPSB0YXJnZXRJbmZvLmdldChoYW5kbGVySWQpO1xuXHQgICAgICAgICAgICBpZiAoIWhhbmRsZXJJbmZvKSB7XG5cdCAgICAgICAgICAgICAgICB0YXJnZXRJbmZvLnNldChoYW5kbGVySWQsIHsgaXNSZWFkeTogZmFsc2UsIHBlbmRpbmdJbnRlbnRzOiBbaW50ZW50XSB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAgICAgIGhhbmRsZXJJbmZvLnBlbmRpbmdJbnRlbnRzLnB1c2goaW50ZW50KTtcblx0ICAgICAgICAgICAgICAgIGlmIChoYW5kbGVySW5mby5jbGllbnRJZGVudGl0eSAmJiBoYW5kbGVySW5mby5pc1JlYWR5KSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgeyBjbGllbnRJZGVudGl0eSwgcGVuZGluZ0ludGVudHMgfSA9IGhhbmRsZXJJbmZvO1xuXHQgICAgICAgICAgICAgICAgICAgIHRyeSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludGVudFRvU2VuZCA9IHBlbmRpbmdJbnRlbnRzW3BlbmRpbmdJbnRlbnRzLmxlbmd0aCAtIDFdO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmludm9rZUludGVudEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgaW50ZW50VG9TZW5kKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlckluZm8ucGVuZGluZ0ludGVudHMgPSBbXTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoYEVycm9yIGludm9raW5nIGludGVudCBoYW5kbGVyIGZvciBjbGllbnQgJHtjbGllbnRJZGVudGl0eS51dWlkfS8ke2NsaWVudElkZW50aXR5Lm5hbWV9LyR7Y2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZH1gKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlckluZm8uaXNSZWFkeSA9IGZhbHNlO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH1cblx0ICAgIH1cblx0ICAgIC8qKlxuXHQgICAgICogUmVzcG9uc2libGUgZm9yIHJldHVybmluZyBpbmZvcm1hdGlvbiBvbiBhIHBhcnRpY3VsYXIgSW50ZW50LlxuXHQgICAgICpcblx0ICAgICAqIEByZW1hcmtzIFdoZW5ldmVyIEludGVyb3BDbGllbnQuZ2V0SW5mb0ZvckludGVudCBpcyBjYWxsZWQgdGhpcyBmdW5jdGlvbiB3aWxsIGZpcmUuIFRoZSBvcHRpb25zIGFyZ3VtZW50IGdpdmVzIHlvdVxuXHQgICAgICogYWNjZXNzIHRvIHRoZSBpbnRlbnQgbmFtZSBhbmQgYW55IG9wdGlvbmFsIGNvbnRleHQ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dGhlIHJlcXVlc3QuXG5cdCAgICAgKlxuXHQgICAgICogQGV4YW1wbGVcblx0ICAgICAqIGBgYGpzXG5cdCAgICAgKiBmaW4uUGxhdGZvcm0uaW5pdCh7XG5cdCAgICAgKiAgICAgaW50ZXJvcE92ZXJyaWRlOiBhc3luYyAoSW50ZXJvcEJyb2tlcikgPT4ge1xuXHQgICAgICogICAgICAgICBjbGFzcyBPdmVycmlkZSBleHRlbmRzIEludGVyb3BCcm9rZXIge1xuXHQgICAgICogICAgICAgICAgICAgYXN5bmMgaGFuZGxlSW5mb0ZvckludGVudChvcHRpb25zLCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICogICAgICAgICAgICAgICAgIC8vIFlvdXIgY29kZSBnb2VzIGhlcmUuXG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSgpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBjbGFzcy1tZXRob2RzLXVzZS10aGlzXG5cdCAgICBhc3luYyBoYW5kbGVJbmZvRm9ySW50ZW50KG9wdGlvbnMsIGNsaWVudElkZW50aXR5IC8vIFRPRE8oQ09SRS04MTEpOiByZW1vdmUgaW5saW5lIGludGVyc2VjdGVkIHR5cGVcblx0ICAgICkge1xuXHQgICAgICAgIGNvbnN0IHdhcm5pbmcgPSAoMCwgdXRpbHNfMS5nZW5lcmF0ZU92ZXJyaWRlV2FybmluZykoJ2ZkYzMuZmluZEludGVudCcsICdJbnRlcm9wQnJva2VyLmhhbmRsZUluZm9Gb3JJbnRlbnQnLCBjbGllbnRJZGVudGl0eSwgJ2ludGVyb3BDbGllbnQuZ2V0SW5mb0ZvckludGVudCcpO1xuXHQgICAgICAgIGNvbnNvbGUud2Fybih3YXJuaW5nKTtc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uXHQgICAgICogZmluLlBsYXRmb3JtLmluaXQoe1xuXHQgICAgICogICAgIGludGVyb3BPdmVycmlkZTogYXN5bmMgKEludGVyb3BCcm9rZXIpID0+IHtcblx0ICAgICAqICAgICAgICAgY2xhc3MgT3ZlcnJpZGUgZXh0ZW5kcyBJbnRlcm9wQnJva2VyIHtcblx0ICAgICAqICAgICAgICAgICAgIGFzeW5jIGhhbmRsZUluZm9Gb3JJbnRlbnRzQnlDb250ZXh0KGNvbnRleHQsIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgLy8gWW91ciBjb2RlIGdvZXMgaGVyZS5cblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKCk7XG5cdCAgICAgKiAgICAgfVxuXHQgICAgICogfSk7XG5cdCAgICAgKiBgYGBcblx0ICAgICAqL1xuXHQgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGNsYXNzLW1ldGhvZHMtdXNlLXRoaXNcblx0ICAgIGFzeW5jIGhhbmRsZUluZm9Gb3JJbnRlbnRzQnlDb250ZXh0KGNvbnRleHQsIGNsaWVudElkZW50aXR5IC8vIFRPRE8oQ09SRS04MTEpOiByZW1vdmUgaW5saW5lIGludGVyc2VjdGVkIHR5cGVcblx0ICAgICkge1xuXHQgICAgICAgIGNvbnN0IHdhcm5pbmcgPSAoMCwgdXRpbHNfMS5nZW5lcmF0ZU92ZXJyaWRlV2FybmluZykoJ2ZkYzMuZmluZEludGVudHNCeUNvbnRleHQnLCAnSW50ZXJvcEJyb2tlci5oYW5kbGVJbmZvRm9ySW50ZW50c0J5Q29udGV4dCcsIGNsaWVudElkZW50aXR5LCAnaW50ZXJvcENsaWVudC5nZXRJbmZvRm9ySW50ZW50c0J5Q29udGV4dCcpO1xuXHQgICAgICAgIGNvbnNvbGUud2Fybih3YXJuaW5nKTtcblx0ICA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NsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICByZXR1cm4gc3VwZXIuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAuLi5jb250ZXh0LFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBjb250ZXh0TWV0YWRhdGE6IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZToge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcElkOiAnb3BlbmZpbi1hcHAnLFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluc3RhbmNlSWQ6ICczRDU0RDQ1NkQ5SFQwJ1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgKiAgICAgICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgcmV0dXJuIG5ldyBPdmVycmlkZSgpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIGludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpIHtcblx0ICAgICAgICBjb25zdCBwcm92aWRlciA9IGF3YWl0IHRoaXMuZ2V0UHJvdmlkZXIoKTtcblx0ICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICBhd2FpdCBwcm92aWRlci5kaXNwYXRjaChjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgY2F0Y2ggKGVycm9yKSB7XG5cdCA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yAoSW50ZXJvcEJyb2tlcikgPT4ge1xuXHQgICAgICogICAgICAgICBjbGFzcyBPdmVycmlkZSBleHRlbmRzIEludGVyb3BCcm9rZXIge1xuXHQgICAgICogICAgICAgICAgICAgYXN5bmMgaW52b2tlSW50ZW50SGFuZGxlcihjbGllbnRJZGVudGl0eSwgaGFuZGxlcklkLCBjb250ZXh0KSB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgY29uc3QgeyBjb250ZXh0IH0gPSBpbnRlbnQ7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgcmV0dXJuIHN1cGVyLmludm9rZUludGVudEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwge1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAuLi5pbnRlbnQsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIC4uLmNvbnRleHQsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0TWV0YWRhdGE6IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwSWQ6ICdvcGVuZmluLWFwcCcsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluc3RhbmNlSWQ6ICczRDU0RDQ1NkQ5SFQwJ1xuXHQgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICAgICAgICAgIH0pO1xuXHQgICAgICogICAgICAgICAgICAgfVxuXHQgICAgICogICAgICAgICB9XG5cdCAgICAgKiAgICAgICAgIHJldHVybiBuZXcgT3ZlcnJpZGUoKTtcblx0ICAgIC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25zdCBhbGxDbGllbnRJbmZvID0gYXdhaXQgc3VwZXIuZ2V0QWxsQ2xpZW50SW5mbygpO1xuXHQgICAgICpcblx0ICAgICAqICAgICAgICAgICAgICAgICBjb25zdCBpbmZvRm9yVGFyZ2V0ID0gYWxsQ2xpZW50SW5mby5maW5kKChjbGllbnRJbmZvKSA9PiB7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGllbnRJbmZvLnV1aWQgPT09ICdwbGF0Zm9ybS11dWlkJyAmJiBjbGllbnRJbmZvLm5hbWUgPT09ICdpbnRlbnQtdmlldyc7XG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgKlxuXHQgICAgICogICAgICAgICAgICAgICAgIGNvbnN0IHNvdXJjZSA9IHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgYXBwSWQ6ICdpbnRlbnQtdmlldycsXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgICAgIGluc3RhbmNlSWQ6IGluZm9Gb3JUYXJnZXQuZW5kcG9pbnRJZFxuXHQgICAgICogICAgICAgICAgICAgICAgIH1cblx0ICAgICAqXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgcmV0dXJuIHtcblx0ICAgICAqICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuXHQgICAgICogICAgICAgICAgICAgICAgICAgICBpbnRlbnQ6IGludGVudC5uYW1lXG5cdCAgICAgKiAgICAgICAgICAgICAgICAgfVxuXHQgICAgICpcblx0ICAgICAqICAgICAgICAgICAgIH1cblx0ICAgICAqICAgICAgICAgfVxuXHQgICAgICogICAgICAgICByZXR1cm4gbmV3IE92ZXJyaWRlKC4uLmFyZ3MpO1xuXHQgICAgICogICAgIH1cblx0ICAgICAqIH0pO1xuXHQgICAgICogYGBgXG5cdCAgICAgKi9cblx0ICAgIGFzeW5jIGdldEFsbENsaWVudEluZm8oKSB7XG5cdCAgICAgICAgY29uc3QgcHJvdmlkZXIgPSBhd2FpdCB0aG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N0YXRlcykge1xuXHQgICAgICAgIGNvbnN0IGNsaWVudHMgPSB0aGlzLmludGVyb3BDbGllbnRzO1xuXHQgICAgICAgIGNsaWVudHMuZm9yRWFjaCgoc3ViU3RhdGUpID0+IHtcblx0ICAgICAgICAgICAgY29uc3QgeyBjbGllbnRJZGVudGl0eSwgY29udGV4dEdyb3VwSWQsIGNvbnRleHRIYW5kbGVycyB9ID0gc3ViU3RhdGU7XG5cdCAgICAgICAgICAgIGlmIChjb250ZXh0R3JvdXBJZCkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgZ3JvdXBDb250ZXh0cyA9IGNvbnRleHRHcm91cFN0YXRlc1tjb250ZXh0R3JvdXBJZF07XG5cdCAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IFssIGNvbnRleHRdIG9mIE9iamVjdC5lbnRyaWVzKGdyb3VwQ29udGV4dHMpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29udGV4dEhhbmRsZXJzLmZvckVhY2goKGNvbnRleHRIYW5kbGVyKSA9PiB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgaGFuZGxlcklkLCBjb250ZXh0VHlwZSB9ID0gY29udGV4dEhhbmRsZXI7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJbnRlcm9wQnJva2VyLmlzQ29udGV4dFR5cGVDb21wYXRpYmxlKGNvbnRleHQudHlwZSwgY29udGV4dFR5cGUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmludm9rZUNvbnRleHRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGNvbnRleHQpO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9KTtcblx0ICAgIH1cblx0ICAgIC8vIFVzZWQgdG8gc3RvcmUgY29udGV4dCBncm91cCBzdGF0ZSBpbiBzbmFwc2hvdHNcblx0ICAgIGdldENvbnRleHRHcm91cFN0YXRlcygpIHtcblx0ICAgICAgICByZXR1cm4gSW50ZXJvcEJyb2tlci50b09iamVjdCh0aGlzLmNvbnRleHRHcm91cHNCeUlkKTtcblx0ICAgIH1cblx0ICAgIC8vIFVzZWQgdG8gcmVoeWRyYXRlIHRoZSBjb250ZXh0IHN0YXRlIGZyb20gYSBzbmFwc2hvdFxuXHQgICAgcmVoeWRyYXRlQ29udGV4dEdyb3VwU3RhdGVzKGluY29taW5nQ29udGV4dEdyb3VwU3RhdGVzKSB7XG5cdCAgICAgICAgY29uc3QgY29udGV4dEdyb3VwU3RhdGVzID0gT2JqZWN0LmVudHJpZXMoaW5jb21pbmdDb250ZXh0R3JvdXBTdGF0ZXMpO1xuXHQgICAgICAgIGZvciAoY29uc3QgW2NvbnRleHRHcm91cElkLCBjb250ZXh0c10gb2YgY29udGV4dEdyb3VwU3RhdGVzKSB7XG5cdCAgICAgICAgICAgIGNvbnN0IGNvbnRleHRPYmplY3RzID0gT2JqZWN0LmVudHJpZXMoY29udGV4dHMpO1xuXHQgICAgICAgICAgICBmb3IgKGNvbnN0IFtjb250ZXh0VHlwZSwgY29udGV4dF0gb2YgY29udGV4dE9iamVjdHMpIHtcblx0ICAgICAgICAgICAgICAgIGlmICh0aGlzLmNvbnRleHRHcm91cHNCeUlkLmhhcyhjb250ZXh0R3JvdXBJZCkpIHtcblx0ICAgICAgICAgICAgICAgICAgICBjb25zdCBjdXJyZW50Q29udGV4dEdyb3VwU3RhdGUgPSB0aGlzLmNvbnRleHRHcm91cHNCeUlkLmdldChjb250ZXh0R3JvdXBJZCk7XG5cdCAgICAgICAgICAgICAgICAgICAgY3VycmVudENvbnRleHRHcm91cFN0YXRlLnNldChjb250ZXh0VHlwZSwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBlbHNlIHtcblx0ICAgICAgICAgICAg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RhdGU7XG5cdCAgICAgICAgICAgIGNvbnN0IGNvbnRleHRHcm91cE1hcCA9IHRoaXMuY29udGV4dEdyb3Vwc0J5SWQuZ2V0KGNvbnRleHRHcm91cElkKTtcblx0ICAgICAgICAgICAgaWYgKGNvbnRleHRUeXBlID09PSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgIC8vIFNlbmQgdGhpcyBzaW5nbGUgaGFuZGxlciBhbGwgb2YgdGhlIGNvbnRleHQsIGJlY2F1c2UgaXQgYWNjZXB0cyBhbGwuXG5cdCAgICAgICAgICAgICAgICBjb250ZXh0R3JvdXBNYXAuZm9yRWFjaCgoY29udGV4dCwgXykgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dCk7XG5cdCAgICAgICAgICAgICAgICB9KTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBlbHNlIGlmIChjb250ZXh0R3JvdXBNYXAuaGFzKGNvbnRleHRUeXBlKSkge1xuXHQgICAgICAgICAgICAgICAgY29uc3QgY29udGV4dEZvclR5cGUgPSBjb250ZXh0R3JvdXBNYXAuZ2V0KGNvbnRleHRUeXBlKTtcblx0ICAgICAgICAgICAgICAgIGlmIChjb250ZXh0Rm9yVHlwZSkge1xuXHQgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ29udGV4dEhhbmRsZXIoY2xpZW50SWRlbnRpdHksIGhhbmRsZXJJZCwgY29udGV4dEZvclR5cGUpO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGNsYXNzLW1ldGhvZHMtdXNlLXRoaXNcblx0ICAgIGFzeW5jIGludGVudEhhbmRsZXJSZWdpc3RlcmVkKHBheWxvYWQsIGNsaWVudElkZW50aXR5KSB7XG5cdCAgICAgICAgY29uc3QgeyBoYW5kbGVySWQgfSA9IHBheWxvYWQ7XG5cdCAgICAgICAgY29uc3QgY2xpZW50SW50ZW50SW5mbyA9IHRoaXMuaW50ZW50Q2xpZW50TWFwLmdldChjbGllbnRJZGVudGl0eS5uYW1lKTtcblx0ICAgICAgICBjb25zdCBoYW5kbGVySW5mbyA9IGNsaWVudEludGVudEluZm8/LmdldChoYW5kbGVySWQpO1xuXHQgICAgICAgIGlmICghY2xpZW50SW50ZW50SW5mbykge1xuXHQgICAgICAgICAgICB0aGlzLmludGVudENsaWVudE1hcC5zZXQoY2xpZW50SWRlbnRpdHkubmFtZSwgbmV3IE1hcCgpKTtcblx0ICAgICAgICAgICAgY29uc3QgbmV3SGFuZGxlckluZm9NYXAgPSB0aGlzLmludGVudENsaWVudE1hcC5nZXQoY2xpZW50SWRlbnRpdHkubmFtZSk7XG5cdCAgICAgICAgICAgIGlmIChuZXdIYW5kbGVySW5mb01hcCkge1xuXHQgICAgICAgICAgICAgICAgbmV3SGFuZGxlckluZm9NYXAuc2V0KGhhbmRsZXJJZCwgeyBpc1JlYWR5OiB0cnVlLCBwZW5kaW5nSW50ZW50czogW10sIGNsaWVudElkZW50aXR5IH0pO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2UgaWYgKCFoYW5kbGVySW5mbykge1xuXHQgICAgICAgICAgICBjbGllbnRJbnRlbnRJbmZvLnNldChoYW5kbGVySWQsIHsgaXNSZWFkeTogdHJ1ZSwgcGVuZGluZ0ludGVudHM6IFtdLCBjbGllbnRJZGVudGl0eSB9KTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNvbnN0IHsgcGVuZGluZ0ludGVudHMgfSA9IGhhbmRsZXJJbmZvO1xuXHQgICAgICAgICAgICBoYW5kbGVySW5mby5jbGllbnRJZGVudGl0eSA9IGNsaWVudElkZW50aXR5O1xuXHQgICAgICAgICAgICBoYW5kbGVySW5mby5pc1JlYWR5ID0gdHJ1ZTtcblx0ICAgICAgICAgICAgdHJ5IHtcblx0ICAgICAgICAgICAgICAgIGlmIChwZW5kaW5nSW50ZW50cy5sZW5ndGggPiAwKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50ZW50VG9TZW5kID0gcGVuZGluZ0ludGVudHNbcGVuZGluZ0ludGVudHMubGVuZ3RoIC0gMV07XG5cdCAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5pbnZva2VJbnRlbnRIYW5kbGVyKGNsaWVudElkZW50aXR5LCBoYW5kbGVySWQsIGludGVudFRvU2VuZCk7XG5cdCAgICAgICAgICAgICAgICAgICAgaGFuZGxlckluZm8ucGVuZGluZ0ludGVudHMgPSBbXTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcblx0ICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoYEVycm9yIGludm9raW5nIGludGVudCBoYW5kbGVyOiAke2hhbmRsZXJJZH0gZm9yIGNsaWVudCAke2NsaWVudElkZW50aXR5LnV1aWR9LyR7Y2xpZW50SWRlbnRpdHkubmFtZX0vJHtjbGllbnRJZGVudGl0eS5lbmRwb2ludElkfWApO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgfVxuXHQgICAgLy8gVXNlZCB0byByZW1vdmUgYSBjb250ZXh0IGhhbmRsZXIgZm9yIGEgY2xpZW50XG5cdCAgICByZW1vdmVDb250ZXh0SGFuZGxlcih7IGhhbmRsZXJJZCB9LCBjbGllbnRJZGVudGl0eSkge1xuXHQgICAgICAgIGNvbnN0IGNsaWVudFN0YXRlID0gdGhpcy5nZXRDbGllbnRTdGF0ZShjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgaWYgKGNsaWVudFN0YXRlKSB7XG5cdCAgICAgICAgICA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MoY29udGV4dE1hcCk7XG5cdCAgICAgICAgICAgIG5ld09iamVjdFtjb250ZXh0R3JvdXBJZF0gPSBuZXdDb250ZXh0T2JqZWN0O1xuXHQgICAgICAgIH0pO1xuXHQgICAgICAgIHJldHVybiBuZXdPYmplY3Q7XG5cdCAgICB9XG5cdCAgICBzdGF0aWMgY2hlY2tDb250ZXh0SW50ZWdyaXR5KGNvbnRleHQpIHtcblx0ICAgICAgICBpZiAoIWNvbnRleHQpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ05vIGNvbnRleHQgc3VwcGxpZWQnIH07XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmICh0eXBlb2YgY29udGV4dCAhPT0gJ29iamVjdCcpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRleHQgbXVzdCBiZSBhbiBPYmplY3QnIH07XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmICghY29udGV4dC50eXBlKSB7XG5cdCAgICAgICAgICAgIHJldHVybiB7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdDb250ZXh0IG11c3QgaGF2ZSBhIHR5cGUgcHJvcGVydHknIH07XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChjb250ZXh0LmlkICYmIHR5cGVvZiBjb250ZXh0LmlkICE9PSAnb2JqZWN0Jykge1xuXHQgICAgICAgICAgICByZXR1cm4ge1xuXHQgICAgICAgICAgICAgICAgaXNWYWxpZDogZmFsc2UsXG5cdCAgICAgICAgICAgICAgICByZWFzb246ICdDb250ZXh0IGlkIG11c3QgYmUgYW4gT2JqZWN0IHBvcHVsYXRlZCB3aXRoIGtleS12YWx1ZSBpZGVudGlmaWVycyAoaWYgc2V0KSdcblx0ICAgICAgICAgICAgfTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgaWYgKGNvbnRleHQuaWQpIHtcblx0ICAgICAgICAgICAgY29uc3QgeyBpZCB9ID0gY29udGV4dDtcblx0ICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKGlkKTtcblx0ICAgICAgICAgICAgbGV0IGZvdW5kQmFkSWRlbnRpZmllciA9IGZhbHNlO1xuXHQgICAgICAgICAgICBpZiAoIWtleXMubGVuZ3RoKSB7XG5cdCAgICAgICAgICAgICAgICByZXR1cm4geyBpc1ZhbGlkOiBmYWxzZSwgcmVhc29uOiAnQ29udGV4dCBpZCBtdXN0IGhhdmUgYXQgbGVhc3Qgb25lIGtleS12YWx1ZSBpZGVudGlmaWVyJyB9O1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIGtleXMuZm9yRWFjaCgoa2V5KSA9PiB7XG5cdCAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGtleSAhPT0gJ3N0cmluZycgfHwgdHlwZW9mIGlkW2tleV0gIT09ICdzdHJpbmcnKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgZm91bmRCYWRJZGVudGlmaWVyID0gdHJ1ZTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIGlmIChmb3VuZEJhZElkZW50aWZpZXIpIHtcblx0ICAgICAgICAgICAgICAgIHJldHVybiB7IGlzVmFsaWQ6IGZhbHNlLCByZWFzb246ICdDb250ZXh0IGlkIGtleS12YWx1ZSBpZGVudGlmaWVycyBtdXN0IGJlIG9mIHR5cGUgc3RyaW5nJyB9O1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGlmIChjb250ZXh0Lm5hbWUgJiYgdHlwZW9mIGNvbnRleHQubmFtZSAhPT0gJ3N0cmluZycpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIHsgaXNWYWxpZDogZmFsc2UsIHJlYXNvbjogJ0NvbnRleHQgbmFtZSBtdXN0IGJlIG9mIHN0cmluZyB0eXBlIChpZiBzZXQpJyB9O1xu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Xh0R3JvdXBJbkNsaWVudE9wdGlvbnMoY2xpZW50SWRlbnRpdHksIGNvbnRleHRHcm91cElkKSB7XG5cdCAgICAgICAgY29uc3QgZW50aXR5SW5mbyA9IGF3YWl0IHRoaXMuZmluLlN5c3RlbS5nZXRFbnRpdHlJbmZvKGNsaWVudElkZW50aXR5LnV1aWQsIGNsaWVudElkZW50aXR5Lm5hbWUpO1xuXHQgICAgICAgIGxldCBlbnRpdHk7XG5cdCAgICAgICAgaWYgKGVudGl0eUluZm8uZW50aXR5VHlwZSA9PT0gJ3ZpZXcnKSB7XG5cdCAgICAgICAgICAgIGVudGl0eSA9IGF3YWl0IHRoaXMuZmluLlZpZXcud3JhcChjbGllbnRJZGVudGl0eSk7XG5cdCAgICAgICAgfVxuXHQgICAgICAgIGVsc2UgaWYgKGVudGl0eUluZm8uZW50aXR5VHlwZSA9PT0gJ3dpbmRvdycpIHtcblx0ICAgICAgICAgICAgZW50aXR5ID0gYXdhaXQgdGhpcy5maW4uV2luZG93LndyYXAoY2xpZW50SWRlbnRpdHkpO1xuXHQgICAgICAgIH1cblx0ICAgICAgICBpZiAoZW50aXR5KSB7XG5cdCAgICAgICAgICAgIGF3YWl0IGVudGl0eS51cGRhdGVPcHRpb25zKHtcblx0ICAgICAgICAgICAgICAgIGludGVyb3A6IHtcblx0ICAgICAgICAgICAgICAgICAgICBjdXJyZW50Q29udGV4dEdyb3VwOiBjb250ZXh0R3JvdXBJZFxuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9KTtcblx0ICAgICAgICB9XG5cdCAgICAgICAgZWxzZSB7XG5cdCAgICAgICAgICAgIGNvbnNvbGUud2FybihgU2V0dGluZyBDdXJyZW50IENvbnRleHQgR3JvdXA6IEVudGl0eSB3aXRoIGlkZW50aXR5ICR7Y2xpZW50SWRlbnRpdHkudXVpZH0sICR7Y2xpZW50SWRlbnRpdHkubmFtZX0gaXMgbm90IGEgd2luZG93IG9yIHZpZXcuIEl0IGlzIGEgJH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gICAgIGlmICghY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCkge1xuXHQgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdWZXJzaW9uIHRvbyBvbGQgdG8gYmUgY29tcGF0aWJsZSB3aXRoIEludGVyb3AuIFBsZWFzZSB1cGdyYWRlIHlvdXIgcnVudGltZSB0byBhIG1vcmUgcmVjZW50IHZlcnNpb24uJyk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgY29uc3QgY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUgPSB7XG5cdCAgICAgICAgICAgICAgICBjb250ZXh0R3JvdXBJZDogdW5kZWZpbmVkLFxuXHQgICAgICAgICAgICAgICAgY29udGV4dEhhbmRsZXJzOiBuZXcgTWFwKCksXG5cdCAgICAgICAgICAgICAgICBjbGllbnRJZGVudGl0eVxuXHQgICAgICAgICAgICB9O1xuXHQgICAgICAgICAgICAvLyBPbmx5IGFsbG93IHRoZSBjbGllbnQgdG8gam9pbiBhIGNvbnRleHRHcm91cCB0aGF0IGFjdHVhbGx5IGV4aXN0cy5cblx0ICAgICAgICAgICAgaWYgKHBheWxvYWQ/LmN1cnJlbnRDb250ZXh0R3JvdXAgJiYgdGhpcy5jb250ZXh0R3JvdXBzQnlJZC5oYXMocGF5bG9hZC5jdXJyZW50Q29udGV4dEdyb3VwKSkge1xuXHQgICAgICAgICAgICAgICAgY2xpZW50U3Vic2NyaXB0aW9uU3RhdGUuY29udGV4dEdyb3VwSWQgPSBwYXlsb2FkPy5jdXJyZW50Q29udGV4dEdyb3VwO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIHRoaXMuaW50ZXJvcENsaWVudHMuc2V0KGNsaWVudElkZW50aXR5LmVuZHBvaW50SWQsIGNsaWVudFN1YnNjcmlwdGlvblN0YXRlKTtcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBjaGFubmVsLm9uRGlzY29ubmVjdGlvbigoY2xpZW50SWRlbnRpdHkpID0+IHtcblx0ICAgICAgICAgICAgdGhpcy5pbnRlcm9wQ2xpZW50cy5kZWxldGUoY2xpZW50SWRlbnRpdHkuZW5kcG9pbnRJZCk7XG5cdCAgICAgICAgICAgIGNvbnN0IHRhcmdldEluZm8gPSB0aGlzLmludGVudENsaWVudE1hcC5nZXQoY2xpZW50SWRlbnRpdHkubmFtZSk7XG5cdCAgICAgICAgICAgIGlmICh0YXJnZXRJbmZvICYmIGNsaWVudElkZW50aXR5LnV1aWQgPT09IHRoaXMuZmluLm1lLnV1aWQpIHtcblx0ICAgICAgICAgICAgICAgIHRhcmdldEluZm8uZm9yRWFjaCgoaGFuZGxlcikgPT4ge1xuXHQgICAgICAgICAgICAgICAgICAgIGhhbmRsZXIuaXNSZWFkeSA9IGZhbHNlO1xuXHQgICAgICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgdGhpcy5zZXNzaW9uQ29udGV4dEdyb3VwTWFwLmZvckVhY2goKHNlc3Npb25Db250ZXh0R3JvdXApID0+IHtcblx0ICAgICAgICAgICAgICAgIHNlc3Npb25Db250ZXh0R3JvdXAub25EaXNjb25uZWN0aW9uKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICAgICAgfSk7XG5cdCAgICAgICAgICAgIHRoaXMuY2xpZW50RGlzY29ubmVjdGVkKGNsaWVudElkZW50aXR5KTtcblx0ICAgICAgICB9KTtcblx0ICAgICAgICBjaGFubmVsLmJlZm9yZUFjdGlvbihhc3luYyAoYWN0aW9uLCBwYXlsb2FkLCBjbGllbnRJZGVudGl0eSkgPT4ge1xuXHQgICAgICAgICAgICBpZiAoIShhd2FpdCB0aGlzLmlzQWN0aW9uQXV0aG9yaXplZChhY3Rpb24sIHBheWxvYWQsIGNsaWVudElkZW50aXR5KSkpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQWN0aW9uICgke2FjdGlvbn0pIG5vdCBhdXRob3JpemVkIGZvciAke2NsaW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2lvbkNvbnRleHRHcm91cENsaWVudF9jbGllbnRQcm9taXNlLnNldCh0aGlzLCB2b2lkIDApO1xuICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgIF9fY2xhc3NQcml2YXRlRmllbGRTZXQkMyh0aGlzLCBfU2Vzc2lvbkNvbnRleHRHcm91cENsaWVudF9jbGllbnRQcm9taXNlLCBjbGllbnQsIFwiZlwiKTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogU2V0cyBhIGNvbnRleHQgZm9yIHRoZSBzZXNzaW9uIGNvbnRleHQgZ3JvdXAuXG4gICAgICogQHBhcmFtIGNvbnRleHQgLSBOZXcgY29udGV4dCB0byBzZXQuXG4gICAgICpcbiAgICAgKiBAdHV0b3JpYWwgaW50ZXJvcC5zZXRDb250ZXh0XG4gICAgICovXG4gICAgYXN5bmMgc2V0Q29udGV4dChjb250ZXh0KSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdpbnRlcm9wLXNlc3Npb24tY29udGV4dC1ncm91cC1zZXQtY29udGV4dCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMyh0aGlzLCBfU2Vzc2lvbkNvbnRleHRHcm91cENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJldHVybiBjbGllbnQuZGlzcGF0Y2goYHNlc3Npb25Db250ZXh0R3JvdXA6c2V0Q29udGV4dC0ke3RoaXMuaWR9YCwge1xuICAgICAgICAgICAgc2Vzc2lvbkNvbnRleHRHcm91cElkOiB0aGlzLmlkLFxuICAgICAgICAgICAgY29udGV4dFxuICAgICAgICB9KTtcbiAgICB9XG4gICAgYXN5bmMgZ2V0Q3VycmVudENvbnRleHQodHlwZSkge1xuICAg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lbnQnOlxuICAgICAqICAgICAgICAgICAgIGhhbmRsZUluc3RydW1lbnRDb250ZXh0KGNvbnRleHRJbmZvKTtcbiAgICAgKiAgICAgICAgICAgICBicmVhaztcbiAgICAgKiAgICAgICAgIGNhc2UgJ2NvdW50cnknOlxuICAgICAqICAgICAgICAgICAgIGhhbmRsZUNvdW50cnlDb250ZXh0KGNvbnRleHRJbmZvKTtcbiAgICAgKiAgICAgICAgICAgICBicmVhaztcbiAgICAgKlxuICAgICAqICAgICAgICAgZGVmYXVsdDpcbiAgICAgKiAgICAgICAgICAgICBicmVhaztcbiAgICAgKiAgICAgfVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqXG4gICAgICogZnVuY3Rpb24gaGFuZGxlSW5zdHJ1bWVudENvbnRleHQoY29udGV4dEluZm8pIHtcbiAgICAgKiAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gY29udGV4dEluZm87XG4gICAgICogICAgIGNvbnNvbGUubG9nKCdjb250ZXh0SW5mbyBmb3IgaW5zdHJ1bWVudCcsIGNvbnRleHRJbmZvKVxuICAgICAqIH1cbiAgICAgKlxuICAgICAqIGZ1bmN0aW9uIGhhbmRsZUNvdW50cnlDb250ZXh0KGNvbnRleHRJbmZvKSB7XG4gICAgICogICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IGNvbnRleHRJbmZvO1xuICAgICAqICAgICBjb25zb2xlLmxvZygnY29udGV4dEluZm8gZm9yIGNvdW50cnknLCBjb250ZXh0SW5mbylcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBmaW4ubWUuaW50ZXJvcC5hZGRDb250ZXh0SGFuZGxlcihoYW5kbGVJbmNvbWluZ0NvbnRleHQpO1xuICAgICAqIGBgYFxuICAgICAqXG4gICAgICpcbiAgICAgKiBXZSBhcmUgYWxzbyB0ZXN0aW5nIHRoZSBhYmlsaXR5IHRvIGFkZCBhIGNvbnRleHQgaGFuZGxlciBmb3Igc3BlY2lmaWMgY29udGV4dHMuIElmIHlvd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ycyBhdCB0aGUgdG9wIGxldmVsIGluIHlvdXIgYXBwbGljYXRpb24uYCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBoYW5kbGVySWQgPSAnaW52b2tlQ29udGV4dEhhbmRsZXInO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHdyYXBwZWRIYW5kbGVyID0gKDAsIHV0aWxzXzEkMi53cmFwQ29udGV4dEhhbmRsZXIpKGhhbmRsZXIsIGhhbmRsZXJJZCk7XG4gICAgICAgIGNsaWVudC5yZWdpc3RlcihoYW5kbGVySWQsIHdyYXBwZWRIYW5kbGVyKTtcbiAgICAgICAgYXdhaXQgY2xpZW50LmRpc3BhdGNoKCdjb250ZXh0SGFuZGxlclJlZ2lzdGVyZWQnLCB7IGhhbmRsZXJJZCwgY29udGV4dFR5cGUgfSk7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB1bnN1YnNjcmliZTogYXN5bmMgKCkgPT4ge1xuICAgICAgICAgICAgICAgIGNsaWVudC5yZW1vdmUoaGFuZGxlcklkKTtcbiAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQuZGlzcGF0Y2goJ3JlbW92ZUNvbnRleHRIYW5kbGVyJywgeyBoYW5kbGVySWQgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuICAgIC8qXG4gICAgUGxhdGZvcm0gV2luZG93IEFQSXNcbiAgICAqL1xuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIEludGVyb3AtQnJva2VyLWRlZmluZWQgY29udGV4dCBncm91cHMgYXZhaWxhYmxlIGZvciBhbiBlbnRpdHkgdG8gam9pbi5cbiAgICAgKiBVc2VkIGJ5IFBsYXRmb3JtIFdpbmRvd3MuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogZmluLm1lLmludGVyb3AuZ2V0Q29udGV4dEdyb3VwcygpXG4gICAgICogICAgICAgICAudGhlbihjb250ZXh0R3JvdXBzID0+IHtcbiAgICAgKiAgICAgICAgICAgICBjb250ZXh0R3JvdXBzLmZvckVhY2goY29udGV4dEdyb3VwID0+IHtcbiAgICAgKiAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coY29udGV4dEdyb3VwLmRpc3BsYXlNZXRhZGF0YS5uYW1lKVxuICAgICAqICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhjb250ZXh0R3JvdXAuZGlzcGxheU1ldGFkYXRhLmNvbG9yKVxuICAgICAqICAgICAgICAgICAgIH0pXG4gICAgICogICAgICAgICB9KVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIGdldENvbnRleHRHcm91cHMoKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdpbnRlcm9wLWNsaWVudC1nZXQtY29udGV4dC1ncm91cHMnKS5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDIodGhpcywgX0ludGVyb3BDbGllbnRfY2xpZW50UHJvbWlzZSwgXCJmXCIpO1xuICAgICAgICByZXR1cm4gY2xpZW50LmRpc3BhdGNoKCdnZXRDb250ZXh0R3JvdXBzJyk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEpvaW4gYWxsIEludGVyb3AgQ2xpZW50cyBhdCB0aGUgZ2l2ZW4gaWRlbnRpdHkgdG8gY29udGV4dCBncm91cCBgY29udGV4dEdyb3VwSWRgLlxuICAgICAqIElmIG5vIHRhcmdldCBpcyBzcGVjaWZpZWQsIGl0IGFkZHMgdGhlIHNlbmRlciB0byB0aGUgY29udGV4dCBncm91cC5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIEJlY2F1c2UgbXVsdGlwbGUgQ2hhbm5lbCBj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ICAgICAgICAgICAgLy8gZG9uJ3QgZXhwb3NlLCBhbmFseXRpY3Mtb25seSBjYWxsXG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0JDIodGhpcywgX0ludGVyb3BDbGllbnRfY2xpZW50UHJvbWlzZSwgXCJmXCIpO1xuICAgICAgICBpZiAoIWNvbnRleHRHcm91cElkKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ05vIGNvbnRleHRHcm91cElkIHNwZWNpZmllZCBmb3IgZ2V0QWxsQ2xpZW50c0luQ29udGV4dEdyb3VwLicpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjbGllbnQuZGlzcGF0Y2goJ2dldEFsbENsaWVudHNJbkNvbnRleHRHcm91cCcsIHsgY29udGV4dEdyb3VwSWQgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEdldHMgZGlzcGxheSBpbmZvIGZvciBhIGNvbnRleHQgZ3JvdXBcbiAgICAgKlxuICAgICAqIEByZW1hcmtzIFVzZWQgYnkgUGxhdGZvcm0gV2luZG93cy5cbiAgICAgKiBAcGFyYW0gY29udGV4dEdyb3VwSWQgLSBUaGUgaWQgb2YgY29udGV4dCBncm91cCB5b3Ugd2lzaCB0byBnZXQgZGlzcGxheSBpbmZvIGZvci5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBmaW4ubWUuaW50ZXJvcC5nZXRJbmZvRm9yQ29udGV4dEdyb3VwKCdyZWQnKVxuICAgICAqICAgICAudGhlbihjb250ZXh0R3JvdXBJbmZvID0+IHtcbiAgICAgKiAgICAgICAgIGNvbnNvbGUubG9nKGNvbnRleHRHcm91cEluZm8uZGlzcGxheU1ldGFkYXRhLm5hbWUpXG4gICAgICogICAgICAgICBjb25zb2xlLmxvZyhjb250ZXh0R3JvdXBJbmZvLmRpc3BsYXlNZXRhZGF0YS5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dCBmb3IgdGhlIHJlc3BvbnNlIHdpbGwgYmUgZGV0ZXJtaW5lZCBieSB0aGUgQXBwIFByb3ZpZGVyIG92ZXJyaWRpbmcgdGhlIGZ1bmN0aW9uLlxuICAgICAqXG4gICAgICogQHBhcmFtIGNvbnRleHRcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiB0aWNrZXJFbGVtZW50Lm9uKCdjbGljaycsIChlbGVtZW50KSA9PiB7XG4gICAgICogICAgIGNvbnN0IHRpY2tlciA9IGVsZW1lbnQuaW5uZXJUZXh0O1xuICAgICAqXG4gICAgICogICAgIGNvbnN0IGNvbnRleHQgPSB7XG4gICAgICogICAgICAgICB0eXBlOiAnZmRjMy5pbnN0cnVtZW50JyxcbiAgICAgKiAgICAgICAgIGlkOiB7XG4gICAgICogICAgICAgICAgICAgdGlja2VyXG4gICAgICogICAgICAgICB9XG4gICAgICogICAgIH1cbiAgICAgKlxuICAgICAqICAgICBjb25zdCBpbnRlbnRSZXNvbHV0aW9uID0gYXdhaXQgZmluLm1lLmludGVyb3AuZmlyZUludGVudEZvckNvbnRleHQoY29udGV4dCk7XG4gICAgICogfSlcbiAgICAgKiBgYGBcbiAgICAgKi9cbiAgICBhc3luYyBmaXJlSW50ZW50Rm9yQ29udGV4dChjb250ZXh0KSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdpbnRlcm9wLWNsaWVudC1maXJlLWludGVudC1mb3ItY29udGV4dCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGNvbnN0IGNsaWVudCA9IGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMih0aGlzLCBfSW50ZXJvcENsaWVudF9jbGllbnRQcm9taXNlLCBcImZcIik7XG4gICAgICAgIHJldHVybiBjbGllbnQuZGlzcGF0Y2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ldCh0aGlzLCBhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBjaGFubmVsTmFtZSA9ICgwLCB1dGlsc18xJDEuZ2V0U25hcHNob3RTb3VyY2VDaGFubmVsTmFtZSkodGhpcy5pZGVudGl0eSk7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGlmICghX19jbGFzc1ByaXZhdGVGaWVsZEdldCQxKHRoaXMsIF9TbmFwc2hvdFNvdXJjZV9nZXRDb25uZWN0aW9uLCBcImZcIikuY2FsbCh0aGlzKS5ldmVudEZpcmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IF9fY2xhc3NQcml2YXRlRmllbGRHZXQkMSh0aGlzLCBfU25hcHNob3RTb3VyY2Vfc2V0VXBDb25uZWN0aW9uTGlzdGVuZXIsIFwiZlwiKS5jYWxsKHRoaXMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCBjbGllbnQgPSBhd2FpdCB0aGlzLmZpbi5JbnRlckFwcGxpY2F0aW9uQnVzLkNoYW5uZWwuY29ubmVjdChjaGFubmVsTmFtZSwgeyB3YWl0OiBmYWxzZSB9KTtcbiAgICAgICAgICAgICAgICBjbGllbnQub25EaXNjb25uZWN0aW9uKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQxKHRoaXMsIF9TbmFwc2hvdFNvdXJjZV9nZXRDb25uZWN0aW9uLCBcImZcIikuY2FsbCh0aGlzKS5jbGllbnRQcm9taXNlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgX19jbGFzc1ByaXZhdGVGaWVsZEdldCQxKHRoaXMsIF9TbmFwc2hvdFNvdXJjZV9nZXRDb25uZWN0aW9uLCBcImZcIikuY2FsbCh0aGlzKS5ldmVudEZpcmVkID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gY2xpZW50O1xuIC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AgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZS5jaGFubmVsTmFtZSA9PT0gY2hhbm5lbE5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMuZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5yZW1vdmVMaXN0ZW5lcignY29ubmVjdGVkJywgbGlzdGVuZXIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGF3YWl0IHRoaXMuZmluLkludGVyQXBwbGljYXRpb25CdXMuQ2hhbm5lbC5vbignY29ubmVjdGVkJywgbGlzdGVuZXIpO1xuICAgICAgICB9KTtcbiAgICAgICAgX19jbGFzc1ByaXZhdGVGaWVsZFNldCQxKHRoaXMsIF9TbmFwc2hvdFNvdXJjZV9pZGVudGl0eSwgaWQsIFwiZlwiKTtcbiAgICB9XG4gICAgZ2V0IGlkZW50aXR5KCkge1xuICAgICAgICByZXR1cm4gX19jbGFzc1ByaXZhdGVGaWVsZEdldCQxKHRoaXMsIF9TbmFwc2hvdFNvdXJjZV9pZGVudGl0eSwgXCJmXCIpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBNZXRob2QgdG8gZGV0ZXJtaW5lIGlmIHRoZSBTbmFwc2hvdFNvdXJjZSBoYXMgYmVlbiBpbml0aWFsaXplZC5cbiAgICAgKlxuICAgICAqIEByZW1hcmtzIFVzZSB3aGVuIHRoZSBwYXJlbnQgYXBwbGljYXRpb24gaXMgc3RhcnRpbmcgdXAgdG8gZW5zdXJlIHRoZSBTbmFwc2hvdFNvdXJjZSBpcyBhYmxlIHRvIGFjY2VwdCBhbmRcbiAgICAgKiBhcHBseSBhIHNuYXBzaG90IHVzaW5nIHRoZSB7QGxpbmsgU25hcHNob3RTb3VyY2UjYXBwbHlTbmFwc2hvdCBhcHBseVNuYXBzaG90fSBtZXRob2QuXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGBgYGpzXG4gICAgICogbGV0IHNuYXBzaG90U291cmNlID0gZmluLlNuYXBzaG90U291cmNlLndyYXBTeW5jKGZpbi5tZSk7XG4gICAgICpcbiAgICAgKiBjb25zdCBzbmFwc2hvdFByb3ZpZGVyID0ge1xuICAgICAqICAgICBhc3luYyBnZXRTbmFwc2hvdCgpIHsgcmV0dXJuICdmb28nIH0sXG4gICAgICogICAgIGFzeW5jIGFwcGx5U25hcHNob3Qoc25hcHNob3QpIHtcbiAgICAgKiAgICAgICBjb25zb2xlLmxvZyhzbmFwc2hvdCk7XG4gICAgICogICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICAgKiAgICAgfVxuICAgICAqIH1cbiAgICAgKiBhd2FpdCBmaW4uU25hcHNob3RTb3VyY2UuaW5pdChzbmFwc2hvdFByb3ZpZGVyKTtcbiAgICAgKlxuICAgICAqIHRyeSB7XG4gICAgICogICBhd2FpdCBzbmFwc2hvdFNvdXJjZS5yZWFkeSgpO1xuICAgICAqICAgYXdhaXQgc25hcHNob3RTb3VyY2UuYXBwbHlTbmFwc2hvdCgnZm9vJyk7XG4gICAgICogfSBjYXRjaCAoZXJyKSB7XG4gICAgICogICBjb25zb2xlLmxvZyhlcnIpXG4gICAgICogfVxuICAgICAqIGBgYFxuICAgICAqL1xuICAgIGFzeW5jIHJlYWR5KCkge1xuICAgICAgICB0aGlzLndpcmUuc2VuZEFjdGlvbignc25hcHNob3Qtc291cmNlLXJlYWR5JykuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIC8vIGRvbid0IGV4cG9zZSwgYW5hbHl0aWNzLW9ubHkgY2FsbFxuICAgICAgICB9KTtcbiAgICAgICAgLy8gZXNs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IHNuYXBzaG90IGltcGxlbWVudGF0aW9ucyBmb3IgbGVnYWN5IGFwcGxpY2F0aW9ucyB0byBkZWZpbmUgdGhlaXIgb3duIHNuYXBzaG90IGZvcm1hdC5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogYGBganNcbiAgICAgKiBjb25zdCBzbmFwc2hvdFByb3ZpZGVyID0ge1xuICAgICAqICAgICBhc3luYyBnZXRTbmFwc2hvdCgpIHtcbiAgICAgKiAgICAgICBjb25zdCBib3VuZHMgPSBhd2FpdCBmaW4ubWUuZ2V0Qm91bmRzKCk7XG4gICAgICogICAgICAgcmV0dXJuIGJvdW5kcztcbiAgICAgKiAgICAgIH0sXG4gICAgICogICAgIGFzeW5jIGFwcGx5U25hcHNob3Qoc25hcHNob3QpIHtcbiAgICAgKiAgICAgICBhd2FpdCBmaW4ubWUuc2V0Qm91bmRzKHNuYXBzaG90KTtcbiAgICAgKiAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgICAqICAgICB9XG4gICAgICogfVxuICAgICAqXG4gICAgICogYXdhaXQgZmluLlNuYXBzaG90U291cmNlLmluaXQoc25hcHNob3RQcm92aWRlcik7XG4gICAgICogYGBgXG4gICAgICpcbiAgICAgKi9cbiAgICBhc3luYyBpbml0KHByb3ZpZGVyKSB7XG4gICAgICAgIHRoaXMud2lyZS5zZW5kQWN0aW9uKCdzbmFwc2hvdC1zb3VyY2UtaW5pdCcpLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAvLyBkb24ndCBleHBvc2UsIGFuYWx5dGljcy1vbmx5IGNhbGxcbiAgICAgICAgfSk7XG4gICAgICAgIGlmICh0eXBlb2YgcHJvdmlkZXIgIT09ICdvYmplY3QnIHx8XG4gICAgICAgICAgICB0eXBlb2YgcHJvdmlkZXIuZ2V0U25hcHNob3QgIT09ICdmdW5jdGlvbicgfHxcbiAgICAgICAgICAgIHR5cGVvZiBwcm92aWRlci5hcHBseVNuYXBzaG90ICE9PSAnZnVu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Nrd2FyZHMgY29tcGF0aWJpbGl0eSB0byBzdXBwb3J0IHBsYWluIHN0cmluZyByZWplY3Rpb25zXG4gICAgICAgICAgICByZWplY3QocGF5bG9hZE9yTWVzc2FnZSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICByZWplY3QobmV3IHRyYW5zcG9ydF9lcnJvcnNfMS5SdW50aW1lRXJyb3IocGF5bG9hZE9yTWVzc2FnZSwgY2FsbFNpdGVzKSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZmVycnlBY3Rpb24ob3JpZ0RhdGEpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGlkID0gdGhpcy5lbnZpcm9ubWVudC5nZXROZXh0TWVzc2FnZUlkKCk7XG4gICAgICAgICAgICBvcmlnRGF0YS5tZXNzYWdlSWQgPSBpZDtcbiAgICAgICAgICAgIGNvbnN0IHJlc29sdmVyID0gKGRhdGEpID0+IHtcbiAgICAgICAgICAgICAgICByZXNvbHZlKGRhdGEucGF5bG9hZCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29uc3Qgd2lyZSA9IF9fY2xhc3NQcml2YXRlRmllbGRHZXQodGhpcywgX1RyYW5zcG9ydF93aXJlLCBcImZcIik7XG4gICAgICAgICAgICByZXR1cm4gd2lyZVxuICAgICAgICAgICAgICAgIC5zZW5kKG9yaWdEYXRhKVxuICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHRoaXMuYWRkV2lyZUxpc3RlbmVyKGlkLCByZXNvbHZlciwgKHBheWxvYWQpID0+IHRoaXMubmFja0hhbmRsZXIocGF5bG9hZCwgcmVqZWN0KSwgZmFsc2UpKVxuICAgICAgICAgICAgICAgIC5jYXRjaChyZWplY3QpO1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgcmVnaXN0ZXJNZXNzYWdlSGFuZGxlcihoYW5kbGVyK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RXJyb3IoZGF0YS5hY3Rpb24pKSB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKCEoJ3BheWxvYWQnIGluIGRhdGEpKSB7XG4gICAgICAgICAgICAgICAgLy8gSSdtIG5vdCBzdXJlIHdoZW4gdGhpcyBjb2RlIHdvdWxkIGFjdHVhbGx5IHJ1biwgYnV0IHBhc3NpbmcgaW4gc29tZXRoaW5nIHRoYXQgZG9lZXNuJ3QgaGF2ZSBhIHJlYXNvbiB0byB0aGUgcnVudGltZWVycm9yIGNvbnN0cnVjdG9yIHdpbGwgbm90IGVuZCB3ZWxsLlxuICAgICAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3JcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGRhdGEucmVhc29uID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgICAgICBoYW5kbGVOYWNrKGRhdGEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKCdSZWNlaXZlZCBpbnZhbGlkIHJlc3BvbnNlIGZyb20gY29yZScsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICBoYW5kbGVOYWNrKHsgcmVhc29uOiAnaW52YWxpZCByZXNwb25zZSBzaGFwZScgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoIWRhdGEucGF5bG9hZC5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgaGFuZGxlTmFjayhkYXRhLnBheWxvYWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZS5jYWxsKG51bGwsIGRhdGEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy53aXJlTGlzdGVuZXJzLmRlbGV0ZShpZCk7XG4gICAgICAgIH1cbiA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T0gMCkge1xuICAgICAgICAgIHRoaXMuX2V2ZW50cyA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgdGhpcy5fZXZlbnRzQ291bnQgPSAwO1xuICAgICAgICB9IGVsc2UgaWYgKGV2ZW50c1t0eXBlXSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKC0tdGhpcy5fZXZlbnRzQ291bnQgPT09IDApXG4gICAgICAgICAgICB0aGlzLl9ldmVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgIGRlbGV0ZSBldmVudHNbdHlwZV07XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICB9XG5cbiAgICAgIC8vIGVtaXQgcmVtb3ZlTGlzdGVuZXIgZm9yIGFsbCBsaXN0ZW5lcnMgb24gYWxsIGV2ZW50c1xuICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgdmFyIGtleXMgPSBPYmplY3Qua2V5cyhldmVudHMpO1xuICAgICAgICB2YXIga2V5O1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwga2V5cy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgIGtleSA9IGtleXNbaV07XG4gICAgICAgICAgaWYgKGtleSA9PT0gJ3JlbW92ZUxpc3RlbmVyJykgY29udGludWU7XG4gICAgICAgICAgdGhpcy5yZW1vdmVBbGxMaXN0ZW5lcnMoa2V5KTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygncmVtb3ZlTGlzdGVuZXInKTtcbiAgICAgICAgdGhpcy5fZXZlbnRzID0gT2JqZWN0LmNyZWF0ZShudWxsKTtcbiAgICAgICAgdGhpcy5fZXZlbnRzQ291bnQgPSAwO1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgIH1cblxuICAgICAgbGlzdGVuZXJzID0gZXZlbnRzW3R5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KSA6IFtdLFxuICAgICAgICAgIGxlbmd0aCA9IHJlc3VsdC5sZW5ndGg7XG5cbiAgICAgIGZvciAodmFyIGtleSBpbiB2YWx1ZSkge1xuICAgICAgICBpZiAoKGluaGVyaXRlZCB8fCBoYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrZXkpKSAmJlxuICAgICAgICAgICAgIShza2lwSW5kZXhlcyAmJiAoXG4gICAgICAgICAgICAgICAvLyBTYWZhcmkgOSBoYXMgZW51bWVyYWJsZSBgYXJndW1lbnRzLmxlbmd0aGAgaW4gc3RyaWN0IG1vZGUuXG4gICAgICAgICAgICAgICBrZXkgPT0gJ2xlbmd0aCcgfHxcbiAgICAgICAgICAgICAgIC8vIE5vZGUuanMgMC4xMCBoYXMgZW51bWVyYWJsZSBub24taW5kZXggcHJvcGVydGllcyBvbiBidWZmZXJzLlxuICAgICAgICAgICAgICAgKGlzQnVmZiAmJiAoa2V5ID09ICdvZmZzZXQnIHx8IGtleSA9PSAncGFyZW50JykpIHx8XG4gICAgICAgICAgICAgICAvLyBQaGFudG9tSlMgMiBoYXMgZW51bWVyYWJsZSBub24taW5kZXggcHJvcGVydGllcyBvbiB0eXBlZCBhcnJheXMuXG4gICAgICAgICAgICAgICAoaXNUeXBlICYmIChrZXkgPT0gJ2J1ZmZlcicgfHwga2V5ID09ICdieXRlTGVuZ3RoJyB8fCBrZXkgPT0gJ2J5dGVPZmZzZXQnKSkgfHxcbiAgICAgICAgICAgICAgIC8vIFNraXAgaW5kZXggcHJvcGVydGllcy5cbiAgICAgICAgICAgICAgIGlzSW5kZXgoa2V5LCBsZW5ndGgpXG4gICAgICAgICAgICApKSkge1xuICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQSBzcGVjaWFsaXplZCB2ZXJzaW9uIG9mIGBfLnNhbXBsZWAgZm9y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ZTtcblxuICAgICAgICB2YWx1ZSA9IChjb21wYXJhdG9yIHx8IHZhbHVlICE9PSAwKSA/IHZhbHVlIDogMDtcbiAgICAgICAgaWYgKCEoc2VlblxuICAgICAgICAgICAgICA/IGNhY2hlSGFzKHNlZW4sIGNvbXB1dGVkKVxuICAgICAgICAgICAgICA6IGluY2x1ZGVzKHJlc3VsdCwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpXG4gICAgICAgICAgICApKSB7XG4gICAgICAgICAgb3RoSW5kZXggPSBvdGhMZW5ndGg7XG4gICAgICAgICAgd2hpbGUgKC0tb3RoSW5kZXgpIHtcbiAgICAgICAgICAgIHZhciBjYWNoZSA9IGNhY2hlc1tvdGhJbmRleF07XG4gICAgICAgICAgICBpZiAoIShjYWNoZVxuICAgICAgICAgICAgICAgICAgPyBjYWNoZUhhcyhjYWNoZSwgY29tcHV0ZWQpXG4gICAgICAgICAgICAgICAgICA6IGluY2x1ZGVzKGFycmF5c1tvdGhJbmRleF0sIGNvbXB1dGVkLCBjb21wYXJhdG9yKSlcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzZWVuKSB7XG4gICAgICAgICAgICBzZWVuLnB1c2goY29tcHV0ZWQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQucHVzaCh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uaW52ZXJ0YCBhbmQgYF8uaW52ZXJ0QnlgIHdoaWNoIGludmVydHNcbiAgICAgKiBgb2JqZWN0YCB3aXRoIHZhbHVlcyB0cmFuc2Zvcm1lZCBieSBgaXRlcmF0ZWVgIGFuZCBzZXQgYnkgYHNldHRlcmAuXG4gICAgICp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NlSXNFcXVhbERlZXAob2JqZWN0LCBvdGhlciwgYml0bWFzaywgY3VzdG9taXplciwgZXF1YWxGdW5jLCBzdGFjaykge1xuICAgICAgdmFyIG9iaklzQXJyID0gaXNBcnJheShvYmplY3QpLFxuICAgICAgICAgIG90aElzQXJyID0gaXNBcnJheShvdGhlciksXG4gICAgICAgICAgb2JqVGFnID0gb2JqSXNBcnIgPyBhcnJheVRhZyA6IGdldFRhZyhvYmplY3QpLFxuICAgICAgICAgIG90aFRhZyA9IG90aElzQXJyID8gYXJyYXlUYWcgOiBnZXRUYWcob3RoZXIpO1xuXG4gICAgICBvYmpUYWcgPSBvYmpUYWcgPT0gYXJnc1RhZyA/IG9iamVjdFRhZyA6IG9ialRhZztcbiAgICAgIG90aFRhZyA9IG90aFRhZyA9PSBhcmdzVGFnID8gb2JqZWN0VGFnIDogb3RoVGFnO1xuXG4gICAgICB2YXIgb2JqSXNPYmogPSBvYmpUYWcgPT0gb2JqZWN0VGFnLFxuICAgICAgICAgIG90aElzT2JqID0gb3RoVGFnID09IG9iamVjdFRhZyxcbiAgICAgICAgICBpc1NhbWVUYWcgPSBvYmpUYWcgPT0gb3RoVGFnO1xuXG4gICAgICBpZiAoaXNTYW1lVGFnICYmIGlzQnVmZmVyKG9iamVjdCkpIHtcbiAgICAgICAgaWYgKCFpc0J1ZmZlcihvdGhlcikpIHtcbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgb2JqSXNBcnIgPSB0cnVlO1xuICAgICAgICBvYmpJc09iaiA9IGZhbHNlO1xuICAgICAgfVxuICAgICAgaWYgKGlzU2FtZVRhZyAmJiAhb2JqSXNPYmopIHtcbiAgICAgICAgc3RhY2sgfHwgKHN0YWNrID0gbmV3IFN0YWNrKTtcbiAgICAgICAgcmV0dXJuIChvYmpJc0FyciB8fCBpc1R5cGVkQXJyYXkob2JqZWN0KSlcbiAgICAgICAgICA/IGVxdWFsQXJyYXlzKG9iamVjdCwgb3RoZ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R1cm5zIGB0cnVlYCBpZiBgb2JqZWN0YCBpcyBhIG1hdGNoLCBlbHNlIGBmYWxzZWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZUlzTWF0Y2gob2JqZWN0LCBzb3VyY2UsIG1hdGNoRGF0YSwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGluZGV4ID0gbWF0Y2hEYXRhLmxlbmd0aCxcbiAgICAgICAgICBsZW5ndGggPSBpbmRleCxcbiAgICAgICAgICBub0N1c3RvbWl6ZXIgPSAhY3VzdG9taXplcjtcblxuICAgICAgaWYgKG9iamVjdCA9PSBudWxsKSB7XG4gICAgICAgIHJldHVybiAhbGVuZ3RoO1xuICAgICAgfVxuICAgICAgb2JqZWN0ID0gT2JqZWN0KG9iamVjdCk7XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICB2YXIgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIGlmICgobm9DdXN0b21pemVyICYmIGRhdGFbMl0pXG4gICAgICAgICAgICAgID8gZGF0YVsxXSAhPT0gb2JqZWN0W2RhdGFbMF1dXG4gICAgICAgICAgICAgIDogIShkYXRhWzBdIGluIG9iamVjdClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIHZhciBrZXkgPSBkYXRhWzBdLFxuICAgICAgICAgICAgb2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHNyY1ZhbHVlID0gZGF0YVsxXTtcblxuICAgICAgICBpZiAobm9DdXN0b21pemVyICYmIGRhdGFbMl0pIHtcbiAgICAgICAgICBpZiAob2JqVmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSB7XG4gICAgICAgICA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AgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkgJiYga2V5ICE9ICdjb25zdHJ1Y3RvcicpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmtleXNJbmAgd2hpY2ggZG9lc24ndCB0cmVhdCBzcGFyc2UgYXJyYXlzIGFzIGRlbnNlLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gcXVlcnkuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBhcnJheSBvZiBwcm9wZXJ0eSBuYW1lcy5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBiYXNlS2V5c0luKG9iamVjdCkge1xuICAgICAgaWYgKCFpc09iamVjdChvYmplY3QpKSB7XG4gICAgICAgIHJldHVybiBuYXRpdmVLZXlzSW4ob2JqZWN0KTtcbiAgICAgIH1cbiAgICAgIHZhciBpc1Byb3RvID0gaXNQcm90b3R5cGUob2JqZWN0KSxcbiAgICAgICAgICByZXN1bHQgPSBbXTtcblxuICAgICAgZm9yICh2YXIga2V5IGluIG9iamVjdCkge1xuICAgICAgICBpZiAoIShrZXkgPT0gJ2NvbnN0cnVjdG9yJyAmJiAoaXNQcm90byB8fCAhaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkpKSkge1xuICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ubHRgIHdoaWNoIGRvZXNuJ3QgY29lcm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4gICAgICAgIGlmIChpc0FyciB8fCBpc0J1ZmYgfHwgaXNUeXBlZCkge1xuICAgICAgICAgIGlmIChpc0FycmF5KG9ialZhbHVlKSkge1xuICAgICAgICAgICAgbmV3VmFsdWUgPSBvYmpWYWx1ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoaXNBcnJheUxpa2VPYmplY3Qob2JqVmFsdWUpKSB7XG4gICAgICAgICAgICBuZXdWYWx1ZSA9IGNvcHlBcnJheShvYmpWYWx1ZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGlzQnVmZikge1xuICAgICAgICAgICAgaXNDb21tb24gPSBmYWxzZTtcbiAgICAgICAgICAgIG5ld1ZhbHVlID0gY2xvbmVCdWZmZXIoc3JjVmFsdWUsIHRydWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBlbHNlIGlmIChpc1R5cGVkKSB7XG4gICAgICAgICAgICBpc0NvbW1vbiA9IGZhbHNlO1xuICAgICAgICAgICAgbmV3VmFsdWUgPSBjbG9uZVR5cGVkQXJyYXkoc3JjVmFsdWUsIHRydWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIG5ld1ZhbHVlID0gW107XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzUGxhaW5PYmplY3Qoc3JjVmFsdWUpIHx8IGlzQXJndW1lbnRzKHNyY1ZhbHVlKSkge1xuICAgICAgICAgIG5ld1ZhbHVlID0gb2JqVmFsdWU7XG4gICAgICAgICAgaWYgKGlzQXJndW1lbnRzKG9ialZhbHVlKSkge1xuICAgICAgICAgICAgbmV3VmFsdWUgPSB0b1BsYWluT2JqZWN0KG9ialZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoIWlzT2JqZWN0KG9ialZhbHVlKSB8fCBpc0Z1bmN0aW9uKG9ialZhbHVlKSkge1xuICAgICAgICAgICAgb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lbmd0aCkge1xuICAgICAgICB2YXIga2V5ID0gdG9LZXkocGF0aFtpbmRleF0pLFxuICAgICAgICAgICAgbmV3VmFsdWUgPSB2YWx1ZTtcblxuICAgICAgICBpZiAoa2V5ID09PSAnX19wcm90b19fJyB8fCBrZXkgPT09ICdjb25zdHJ1Y3RvcicgfHwga2V5ID09PSAncHJvdG90eXBlJykge1xuICAgICAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5kZXggIT0gbGFzdEluZGV4KSB7XG4gICAgICAgICAgdmFyIG9ialZhbHVlID0gbmVzdGVkW2tleV07XG4gICAgICAgICAgbmV3VmFsdWUgPSBjdXN0b21pemVyID8gY3VzdG9taXplcihvYmpWYWx1ZSwga2V5LCBuZXN0ZWQpIDogdW5kZWZpbmVkO1xuICAgICAgICAgIGlmIChuZXdWYWx1ZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBuZXdWYWx1ZSA9IGlzT2JqZWN0KG9ialZhbHVlKVxuICAgICAgICAgICAgICA/IG9ialZhbHVlXG4gICAgICAgICAgICAgIDogKGlzSW5kZXgocGF0aFtpbmRleCArIDFdKSA/IFtdIDoge30pO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBhc3NpZ25WYWx1ZShuZXN0ZWQsIGtleSwgbmV3VmFsdWUpO1xuICAgICAgICBuZXN0ZWQgPSBuZXN0ZWRba2V5XTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYHNldERhdGFgIHdpdGhvdXQgc3VwcG9ydCBmb3IgaG90IGxvb3Agc2hvcnRpbmcuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGZ1bmMgVGhlIGZ1bmN0aW9uIHRvIGFzc29jaWF0ZSBtZXRhZGF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FjaGU7XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgc2VlbiA9IGl0ZXJhdGVlID8gW10gOiByZXN1bHQ7XG4gICAgICB9XG4gICAgICBvdXRlcjpcbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgIHZhciB2YWx1ZSA9IGFycmF5W2luZGV4XSxcbiAgICAgICAgICAgIGNvbXB1dGVkID0gaXRlcmF0ZWUgPyBpdGVyYXRlZSh2YWx1ZSkgOiB2YWx1ZTtcblxuICAgICAgICB2YWx1ZSA9IChjb21wYXJhdG9yIHx8IHZhbHVlICE9PSAwKSA/IHZhbHVlIDogMDtcbiAgICAgICAgaWYgKGlzQ29tbW9uICYmIGNvbXB1dGVkID09PSBjb21wdXRlZCkge1xuICAgICAgICAgIHZhciBzZWVuSW5kZXggPSBzZWVuLmxlbmd0aDtcbiAgICAgICAgICB3aGlsZSAoc2VlbkluZGV4LS0pIHtcbiAgICAgICAgICAgIGlmIChzZWVuW3NlZW5JbmRleF0gPT09IGNvbXB1dGVkKSB7XG4gICAgICAgICAgICAgIGNvbnRpbnVlIG91dGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoaXRlcmF0ZWUpIHtcbiAgICAgICAgICAgIHNlZW4ucHVzaChjb21wdXRlZCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlc3VsdC5wdXNoKHZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmICghaW5jbHVkZXMoc2VlbiwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpKSB7XG4gICAgICAgICAgaWYgKHNlZW4gIT09IHJlc3VsdCkge1xuICAgICAgICAgICAgc2Vlbi5wdXNoKGNvbXB1dGVkKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0LnB1c2godmFsdWUpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH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gaXNOZXcgPSAhb2JqZWN0O1xuICAgICAgb2JqZWN0IHx8IChvYmplY3QgPSB7fSk7XG5cbiAgICAgIHZhciBpbmRleCA9IC0xLFxuICAgICAgICAgIGxlbmd0aCA9IHByb3BzLmxlbmd0aDtcblxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgdmFyIGtleSA9IHByb3BzW2luZGV4XTtcblxuICAgICAgICB2YXIgbmV3VmFsdWUgPSBjdXN0b21pemVyXG4gICAgICAgICAgPyBjdXN0b21pemVyKG9iamVjdFtrZXldLCBzb3VyY2Vba2V5XSwga2V5LCBvYmplY3QsIHNvdXJjZSlcbiAgICAgICAgICA6IHVuZGVmaW5lZDtcblxuICAgICAgICBpZiAobmV3VmFsdWUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIG5ld1ZhbHVlID0gc291cmNlW2tleV07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzTmV3KSB7XG4gICAgICAgICAgYmFzZUFzc2lnblZhbHVlKG9iamVjdCwga2V5LCBuZXdWYWx1ZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgYXNzaWduVmFsdWUob2JqZWN0LCBrZXksIG5ld1ZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIG9iamVjdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb3BpZXMgb3duIHN5bWJvbHMgb2YgYHNvdXJjZWAgdG8gYG9iamVjdGAuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBzb3VyY2UgVGhlIG9iamVjdCB0byBjb3B5IHN5bWJvbHMgZnJvbS5cbiAgICAgKiBAcGFyYW0ge09iamVjdH0gW29iamVjdD17fV0gVGhlIG9iamVjdCB0byBjb3B5IHN5bWJvbHMgdG8uXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5c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ZhbHVlLCBpbmRleCwgb3RoZXIsIGFycmF5LCBzdGFjaylcbiAgICAgICAgICAgIDogY3VzdG9taXplcihhcnJWYWx1ZSwgb3RoVmFsdWUsIGluZGV4LCBhcnJheSwgb3RoZXIsIHN0YWNrKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29tcGFyZWQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIGlmIChjb21wYXJlZCkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIC8vIFJlY3Vyc2l2ZWx5IGNvbXBhcmUgYXJyYXlzIChzdXNjZXB0aWJsZSB0byBjYWxsIHN0YWNrIGxpbWl0cykuXG4gICAgICAgIGlmIChzZWVuKSB7XG4gICAgICAgICAgaWYgKCFhcnJheVNvbWUob3RoZXIsIGZ1bmN0aW9uKG90aFZhbHVlLCBvdGhJbmRleCkge1xuICAgICAgICAgICAgICAgIGlmICghY2FjaGVIYXMoc2Vlbiwgb3RoSW5kZXgpICYmXG4gICAgICAgICAgICAgICAgICAgIChhcnJWYWx1ZSA9PT0gb3RoVmFsdWUgfHwgZXF1YWxGdW5jKGFyclZhbHVlLCBvdGhWYWx1ZSwgYml0bWFzaywgY3VzdG9taXplciwgc3RhY2spKSkge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlZW4ucHVzaChvdGhJbmRleCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KSkge1xuICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoIShcbiAgICAgICAgICAgICAgYXJyVmFsdWUgPT09IG90aFZhbHVlIHx8XG4gICAgICAgICAgICAgICAgZXF1YWxGdW5jKGFyclZhbHVlLCBvdGhWYWx1ZSwgYml0bWF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UkVfUEFSVElBTF9GTEFHLFxuICAgICAgICAgIG9ialByb3BzID0gZ2V0QWxsS2V5cyhvYmplY3QpLFxuICAgICAgICAgIG9iakxlbmd0aCA9IG9ialByb3BzLmxlbmd0aCxcbiAgICAgICAgICBvdGhQcm9wcyA9IGdldEFsbEtleXMob3RoZXIpLFxuICAgICAgICAgIG90aExlbmd0aCA9IG90aFByb3BzLmxlbmd0aDtcblxuICAgICAgaWYgKG9iakxlbmd0aCAhPSBvdGhMZW5ndGggJiYgIWlzUGFydGlhbCkge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSBvYmpMZW5ndGg7XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICB2YXIga2V5ID0gb2JqUHJvcHNbaW5kZXhdO1xuICAgICAgICBpZiAoIShpc1BhcnRpYWwgPyBrZXkgaW4gb3RoZXIgOiBoYXNPd25Qcm9wZXJ0eS5jYWxsKG90aGVyLCBrZXkpKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgLy8gQ2hlY2sgdGhhdCBjeWNsaWMgdmFsdWVzIGFyZSBlcXVhbC5cbiAgICAgIHZhciBvYmpTdGFja2VkID0gc3RhY2suZ2V0KG9iamVjdCk7XG4gICAgICB2YXIgb3RoU3RhY2tlZCA9IHN0YWNrLmdldChvdGhlcik7XG4gICAgICBpZiAob2JqU3RhY2tlZCAmJiBvdGhTdGFja2VkKSB7XG4gICAgICAgIHJldHVybiBvYmpTdGFja2VkID09IG90aGVyICYmIG90aFN0YWNrZWQgPT0gb2JqZWN0O1xuICAgICAgfVxuICAgICAgdmFyIHJlc3VsdCA9IHRydWU7XG4gICAgICBzdGFjay5zZXQob2JqZWN0LCBvdGhlcik7XG4gICAgICBzdGFjay5zZXQob3RoZXIsIG9iamVjdCk7XG5cbiAgICAgIHZhciBza2lwQ3RvciA9IGlzUGFydGlhbDtcbiA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BpZiAoIShyZXN1bHQgPSBvYmplY3QgIT0gbnVsbCAmJiBoYXNGdW5jKG9iamVjdCwga2V5KSkpIHtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBvYmplY3QgPSBvYmplY3Rba2V5XTtcbiAgICAgIH1cbiAgICAgIGlmIChyZXN1bHQgfHwgKytpbmRleCAhPSBsZW5ndGgpIHtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgIH1cbiAgICAgIGxlbmd0aCA9IG9iamVjdCA9PSBudWxsID8gMCA6IG9iamVjdC5sZW5ndGg7XG4gICAgICByZXR1cm4gISFsZW5ndGggJiYgaXNMZW5ndGgobGVuZ3RoKSAmJiBpc0luZGV4KGtleSwgbGVuZ3RoKSAmJlxuICAgICAgICAoaXNBcnJheShvYmplY3QpIHx8IGlzQXJndW1lbnRzKG9iamVjdCkpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEluaXRpYWxpemVzIGFuIGFycmF5IGNsb25lLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge0FycmF5fSBhcnJheSBUaGUgYXJyYXkgdG8gY2xvbmUuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBpbml0aWFsaXplZCBjbG9uZS5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBpbml0Q2xvbmVBcnJheShhcnJheSkge1xuICAgICAgdmFyIGxlbmd0aCA9IGFycmF5Lmxlbmd0aCxcbiAgICAgICAgICByZXN1bHQgPSBuZXcgYXJyYXkuY29uc3RydWN0b3IobGVuZ3RoKTtcblxuICAgICAgLy8gQWRkIHByb3BlcnRpZXMgYXNzaWduZWQgYnkgYFJlZ0V4cCNleGVjYC5cbiAgICAgIGlmIChsZW5ndGggJiYgdHlwZW9mIGFycmF5WzBdID09ICdzdHJpbmcnICYmIGhhc093blByb3BlcnR5LmNhbGwoYXJyYXksICdpbmRleCcpKSB7XG4gICAgICAgIHJ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uICAgICAgfVxuICAgICAgbiA9IChndWFyZCB8fCBuID09PSB1bmRlZmluZWQpID8gMSA6IHRvSW50ZWdlcihuKTtcbiAgICAgIHJldHVybiBiYXNlU2xpY2UoYXJyYXksIDAsIG4gPCAwID8gMCA6IG4pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYSBzbGljZSBvZiBgYXJyYXlgIHdpdGggYG5gIGVsZW1lbnRzIHRha2VuIGZyb20gdGhlIGVuZC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSAzLjAuMFxuICAgICAqIEBjYXRlZ29yeSBBcnJheVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBxdWVyeS5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gW249MV0gVGhlIG51bWJlciBvZiBlbGVtZW50cyB0byB0YWtlLlxuICAgICAqIEBwYXJhbS0ge09iamVjdH0gW2d1YXJkXSBFbmFibGVzIHVzZSBhcyBhbiBpdGVyYXRlZSBmb3IgbWV0aG9kcyBsaWtlIGBfLm1hcGAuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBzbGljZSBvZiBgYXJyYXlgLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBfLnRha2VSaWdodChbMSwgMiwgM10pO1xuICAgICAqIC8vID0+IFszXVxuICAgICAqXG4gICAgICogXy50YWtlUmlnaHQoWzEsIDIsIDNdLCAyKTtcbiAgICAgKiAvLyA9PiBbMiwgM11cbiAgICAgKlxuICAgICAqIF8udGFrZVJpZ2h0KFsxLCAyLCAzXSwgNSk7XG4gICAgICogLy8gPT4gWzEsIDIsIDNdXG4gICAgICpcbiAgICAgKiBfLnRha2VSaWdodChbMSwgMiwgM10sIDApO1xuICAgICAqIC8vID0+IFtdXG4gICAgICovXG4gICAgZnVuY3Rpb24gdGFrZVJpZ2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G4gICAgICogd2l0aCB0d28gYXJndW1lbnRzOiAoYXJyVmFsLCBvdGhWYWwpLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMC4wXG4gICAgICogQGNhdGVnb3J5IEFycmF5XG4gICAgICogQHBhcmFtIHsuLi5BcnJheX0gW2FycmF5c10gVGhlIGFycmF5cyB0byBpbnNwZWN0LlxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IFtjb21wYXJhdG9yXSBUaGUgY29tcGFyYXRvciBpbnZva2VkIHBlciBlbGVtZW50LlxuICAgICAqIEByZXR1cm5zIHtBcnJheX0gUmV0dXJucyB0aGUgbmV3IGFycmF5IG9mIGZpbHRlcmVkIHZhbHVlcy5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIG9iamVjdHMgPSBbeyAneCc6IDEsICd5JzogMiB9LCB7ICd4JzogMiwgJ3knOiAxIH1dO1xuICAgICAqIHZhciBvdGhlcnMgPSBbeyAneCc6IDEsICd5JzogMSB9LCB7ICd4JzogMSwgJ3knOiAyIH1dO1xuICAgICAqXG4gICAgICogXy54b3JXaXRoKG9iamVjdHMsIG90aGVycywgXy5pc0VxdWFsKTtcbiAgICAgKiAvLyA9PiBbeyAneCc6IDIsICd5JzogMSB9LCB7ICd4JzogMSwgJ3knOiAxIH1dXG4gICAgICovXG4gICAgdmFyIHhvcldpdGggPSBiYXNlUmVzdChmdW5jdGlvbihhcnJheXMpIHtcbiAgICAgIHZhciBjb21wYXJhdG9yID0gbGFzdChhcnJheXMpO1xuICAgICAgY29tcGFyYXRvciA9IHR5cGVvZiBjb21wYXJhdG9yID09ICdmdW5jdGlvbicgPyBjb21wYXJhdG9yIDogdW5kZWZpbmVkO1xuICAgICAgcmV0dXJuIGJhc2VYb3IoYXJyYXlGaWx0ZXIoYXJyYXlzLCBpc0FycmF5TGlrZU9iamVjdCksIHVuZGVmaW5lZCwgY29tcG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IG9iamVjdHMuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAc2luY2UgMC4xLjBcbiAgICAgKiBAY2F0ZWdvcnkgQ29sbGVjdGlvblxuICAgICAqIEBwYXJhbSB7QXJyYXl8T2JqZWN0fHN0cmluZ30gY29sbGVjdGlvbiBUaGUgY29sbGVjdGlvbiB0byBpbnNwZWN0LlxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9IFJldHVybnMgdGhlIGNvbGxlY3Rpb24gc2l6ZS5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy5zaXplKFsxLCAyLCAzXSk7XG4gICAgICogLy8gPT4gM1xuICAgICAqXG4gICAgICogXy5zaXplKHsgJ2EnOiAxLCAnYic6IDIgfSk7XG4gICAgICogLy8gPT4gMlxuICAgICAqXG4gICAgICogXy5zaXplKCdwZWJibGVzJyk7XG4gICAgICogLy8gPT4gN1xuICAgICAqL1xuICAgIGZ1bmN0aW9uIHNpemUoY29sbGVjdGlvbikge1xuICAgICAgaWYgKGNvbGxlY3Rpb24gPT0gbnVsbCkge1xuICAgICAgICByZXR1cm4gMDtcbiAgICAgIH1cbiAgICAgIGlmIChpc0FycmF5TGlrZShjb2xsZWN0aW9uKSkge1xuICAgICAgICByZXR1cm4gaXNTdHJpbmcoY29sbGVjdGlvbikgPyBzdHJpbmdTaXplKGNvbGxlY3Rpb24pIDogY29sbGVjdGlvbi5sZW5ndGg7XG4gICAgICB9XG4gICAgICB2YXIgdGFnID0gZ2V0VGFnKGNvbGxlY3Rpb24pO1xuICAgICAgaWYgKHRhZyA9PSBtYXBUYWcgfHwgdGFnID09IHNldFRhZykge1xuICAgICAgICByZXR1cm4gY29sbGVjdGlvbi5zaXplO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGJhc2VLZXlzKGNvbGxlY3Rpb24pLmxlbmd0aDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDaGVja3Mga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xuICAgICAqIEBwYXJhbSB7Li4uT2JqZWN0fSBbc291cmNlc10gVGhlIHNvdXJjZSBvYmplY3RzLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICogQHNlZSBfLmFzc2lnbkluXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIGZ1bmN0aW9uIEZvbygpIHtcbiAgICAgKiAgIHRoaXMuYSA9IDE7XG4gICAgICogfVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gQmFyKCkge1xuICAgICAqICAgdGhpcy5jID0gMztcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBGb28ucHJvdG90eXBlLmIgPSAyO1xuICAgICAqIEJhci5wcm90b3R5cGUuZCA9IDQ7XG4gICAgICpcbiAgICAgKiBfLmFzc2lnbih7ICdhJzogMCB9LCBuZXcgRm9vLCBuZXcgQmFyKTtcbiAgICAgKiAvLyA9PiB7ICdhJzogMSwgJ2MnOiAzIH1cbiAgICAgKi9cbiAgICB2YXIgYXNzaWduID0gY3JlYXRlQXNzaWduZXIoZnVuY3Rpb24ob2JqZWN0LCBzb3VyY2UpIHtcbiAgICAgIGlmIChpc1Byb3RvdHlwZShzb3VyY2UpIHx8IGlzQXJyYXlMaWtlKHNvdXJjZSkpIHtcbiAgICAgICAgY29weU9iamVjdChzb3VyY2UsIGtleXMoc291cmNlKSwgb2JqZWN0KTtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgZm9yICh2YXIga2V5IGluIHNvdXJjZSkge1xuICAgICAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChzb3VyY2UsIGtleSkpIHtcbiAgICAgICAgICBhc3NpZ25WYWx1ZShvYmplY3QsIGtleSwgc291cmNlW2tleV0pO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICAvKipcbiAgICAgKiBUaGlzIG1ldGhvZCBpcyBsaWtlIGBfLmFzc2lnbmAgZXhjZX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2InOiAyIH1cbiAgICAgKi9cbiAgICB2YXIgZGVmYXVsdHMgPSBiYXNlUmVzdChmdW5jdGlvbihvYmplY3QsIHNvdXJjZXMpIHtcbiAgICAgIG9iamVjdCA9IE9iamVjdChvYmplY3QpO1xuXG4gICAgICB2YXIgaW5kZXggPSAtMTtcbiAgICAgIHZhciBsZW5ndGggPSBzb3VyY2VzLmxlbmd0aDtcbiAgICAgIHZhciBndWFyZCA9IGxlbmd0aCA+IDIgPyBzb3VyY2VzWzJdIDogdW5kZWZpbmVkO1xuXG4gICAgICBpZiAoZ3VhcmQgJiYgaXNJdGVyYXRlZUNhbGwoc291cmNlc1swXSwgc291cmNlc1sxXSwgZ3VhcmQpKSB7XG4gICAgICAgIGxlbmd0aCA9IDE7XG4gICAgICB9XG5cbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzW2luZGV4XTtcbiAgICAgICAgdmFyIHByb3BzID0ga2V5c0luKHNvdXJjZSk7XG4gICAgICAgIHZhciBwcm9wc0luZGV4ID0gLTE7XG4gICAgICAgIHZhciBwcm9wc0xlbmd0aCA9IHByb3BzLmxlbmd0aDtcblxuICAgICAgICB3aGlsZSAoKytwcm9wc0luZGV4IDwgcHJvcHNMZW5ndGgpIHtcbiAgICAgICAgICB2YXIga2V5ID0gcHJvcHNbcHJvcHNJbmRleF07XG4gICAgICAgICAgdmFyIHZhbHVlID0gb2JqZWN0W2tleV07XG5cbiAgICAgICAgICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCB8fFxuICAgICAgICAgICAgICAoZXEodmFsdWUsIG9iamVjdFByb3RvW2tleV0pICYmICFoYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkpIHtcbiAgICAgICAgICAgIG9iamVjdFtrZXldID0gc291cmNlW2tleV07XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBvYm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GVyO1xuICAgICAgICAgIHVwcGVyID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHR5cGVvZiBsb3dlciA9PSAnYm9vbGVhbicpIHtcbiAgICAgICAgICBmbG9hdGluZyA9IGxvd2VyO1xuICAgICAgICAgIGxvd2VyID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAobG93ZXIgPT09IHVuZGVmaW5lZCAmJiB1cHBlciA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGxvd2VyID0gMDtcbiAgICAgICAgdXBwZXIgPSAxO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIGxvd2VyID0gdG9GaW5pdGUobG93ZXIpO1xuICAgICAgICBpZiAodXBwZXIgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIHVwcGVyID0gbG93ZXI7XG4gICAgICAgICAgbG93ZXIgPSAwO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHVwcGVyID0gdG9GaW5pdGUodXBwZXIpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAobG93ZXIgPiB1cHBlcikge1xuICAgICAgICB2YXIgdGVtcCA9IGxvd2VyO1xuICAgICAgICBsb3dlciA9IHVwcGVyO1xuICAgICAgICB1cHBlciA9IHRlbXA7XG4gICAgICB9XG4gICAgICBpZiAoZmxvYXRpbmcgfHwgbG93ZXIgJSAxIHx8IHVwcGVyICUgMSkge1xuICAgICAgICB2YXIgcmFuZCA9IG5hdGl2ZVJhbmRvbSgpO1xuICAgICAgICByZXR1cm4gbmF0aXZlTWluKGxvd2VyICsgKHJhbmQgKiAodXBwZXIgLSBsb3dlciArIGZyZWVQYXJzZUZsb2F0KCcxZS0nICsgKChyYW5kICsgJycpLmxlbmd0aCAtIDEpKSkpLCB1cHBlcik7XG4gICAgICB9XG4gICAgICByZXR1cm4gYmFzZVJhbmRvbShsb3dlciwgdXBwZXIpO1xuICAgIH1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jdGlvbiBib2R5LlxuICAgICAgc291cmNlID0gJ2Z1bmN0aW9uKCcgKyAodmFyaWFibGUgfHwgJ29iaicpICsgJykge1xcbicgK1xuICAgICAgICAodmFyaWFibGVcbiAgICAgICAgICA/ICcnXG4gICAgICAgICAgOiAnb2JqIHx8IChvYmogPSB7fSk7XFxuJ1xuICAgICAgICApICtcbiAgICAgICAgXCJ2YXIgX190LCBfX3AgPSAnJ1wiICtcbiAgICAgICAgKGlzRXNjYXBpbmdcbiAgICAgICAgICAgPyAnLCBfX2UgPSBfLmVzY2FwZSdcbiAgICAgICAgICAgOiAnJ1xuICAgICAgICApICtcbiAgICAgICAgKGlzRXZhbHVhdGluZ1xuICAgICAgICAgID8gJywgX19qID0gQXJyYXkucHJvdG90eXBlLmpvaW47XFxuJyArXG4gICAgICAgICAgICBcImZ1bmN0aW9uIHByaW50KCkgeyBfX3AgKz0gX19qLmNhbGwoYXJndW1lbnRzLCAnJykgfVxcblwiXG4gICAgICAgICAgOiAnO1xcbidcbiAgICAgICAgKSArXG4gICAgICAgIHNvdXJjZSArXG4gICAgICAgICdyZXR1cm4gX19wXFxufSc7XG5cbiAgICAgIHZhciByZXN1bHQgPSBhdHRlbXB0KGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gRnVuY3Rpb24oaW1wb3J0c0tleXMsIHNvdXJjZVVSTCArICdyZXR1cm4gJyArIHNvdXJjZSlcbiAgICAgICAgICAuYXBwbHkodW5kZWZpbmVkLCBpbXBvcnRzVmFsdWVzKTtcbiAgICAgIH0pO1xuXG4gICAgICAvLyBQcm92aWRlIHRoZSBjb21waWxlZCBmdW5jdGlvbidzIHNvdXJjZSBieSBpdHMgYHRvU3RyaW5nYCBtZXRob2Qgb3JcbiAgICAgIC8vIHRoZSBgc291cmNlYCBwcm9wZXJ0eSBhcyBhIGNvbnZlbmllbmNlIGZvciBpbmxpbmluZyBjb21waWxlZCB0ZW1wbGF0ZXMuXG4gICAgICByZXN1bHQuc291cmNlID0gc291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lXSBUaGUgY2hhcmFjdGVycyB0byB0cmltLlxuICAgICAqIEBwYXJhbS0ge09iamVjdH0gW2d1YXJkXSBFbmFibGVzIHVzZSBhcyBhbiBpdGVyYXRlZSBmb3IgbWV0aG9kcyBsaWtlIGBfLm1hcGAuXG4gICAgICogQHJldHVybnMge3N0cmluZ30gUmV0dXJucyB0aGUgdHJpbW1lZCBzdHJpbmcuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udHJpbSgnICBhYmMgICcpO1xuICAgICAqIC8vID0+ICdhYmMnXG4gICAgICpcbiAgICAgKiBfLnRyaW0oJy1fLWFiYy1fLScsICdfLScpO1xuICAgICAqIC8vID0+ICdhYmMnXG4gICAgICpcbiAgICAgKiBfLm1hcChbJyAgZm9vICAnLCAnICBiYXIgICddLCBfLnRyaW0pO1xuICAgICAqIC8vID0+IFsnZm9vJywgJ2JhciddXG4gICAgICovXG4gICAgZnVuY3Rpb24gdHJpbShzdHJpbmcsIGNoYXJzLCBndWFyZCkge1xuICAgICAgc3RyaW5nID0gdG9TdHJpbmcoc3RyaW5nKTtcbiAgICAgIGlmIChzdHJpbmcgJiYgKGd1YXJkIHx8IGNoYXJzID09PSB1bmRlZmluZWQpKSB7XG4gICAgICAgIHJldHVybiBiYXNlVHJpbShzdHJpbmcpO1xuICAgICAgfVxuICAgICAgaWYgKCFzdHJpbmcgfHwgIShjaGFycyA9IGJhc2VUb1N0cmluZyhjaGFycykpKSB7XG4gICAgICAgIHJldHVybiBzdHJpbmc7XG4gICAgICB9XG4gICAgICB2YXIgc3RyU3ltYm9scyA9IHN0cmluZ1RvQXJyYXkoc3RyaW5nKSxcbiAgICAgICAgICBjaHJTeW1ib2xzID0gc3RyaW5nVG9BcnJheShjaGFycyksXG4gICAgICAgICAgc3RhcnQgPSBjaGFyc1N0YXJ0SW5kZXgoc3RyU3ltYm9scywgY2hyU3ltYm9scyksXG4gICAgICAgICAgZW5kID0gY2hhcnNFbmRJbmRleChzdHJTeW1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SBUaGUgb2JqZWN0IG9mIGZ1bmN0aW9ucyB0byBhZGQuXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvcHRpb25zPXt9XSBUaGUgb3B0aW9ucyBvYmplY3QuXG4gICAgICogQHBhcmFtIHtib29sZWFufSBbb3B0aW9ucy5jaGFpbj10cnVlXSBTcGVjaWZ5IHdoZXRoZXIgbWl4aW5zIGFyZSBjaGFpbmFibGUuXG4gICAgICogQHJldHVybnMge0Z1bmN0aW9ufE9iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gdm93ZWxzKHN0cmluZykge1xuICAgICAqICAgcmV0dXJuIF8uZmlsdGVyKHN0cmluZywgZnVuY3Rpb24odikge1xuICAgICAqICAgICByZXR1cm4gL1thZWlvdV0vaS50ZXN0KHYpO1xuICAgICAqICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogXy5taXhpbih7ICd2b3dlbHMnOiB2b3dlbHMgfSk7XG4gICAgICogXy52b3dlbHMoJ2ZyZWQnKTtcbiAgICAgKiAvLyA9PiBbJ2UnXVxuICAgICAqXG4gICAgICogXygnZnJlZCcpLnZvd2VscygpLnZhbHVlKCk7XG4gICAgICogLy8gPT4gWydlJ11cbiAgICAgKlxuICAgICAqIF8ubWl4aW4oeyAndm93ZWxzJzogdm93ZWxzIH0sIHsgJ2NoYWluJzogZmFsc2UgfSk7XG4gICAgICogXygnZnJlZCcpLnZvd2VscygpO1xuICAgICAqIC8vID0+IFsnZSddXG4gICAgICovXG4gICAgZnVuY3Rpb24gbWl4aW4ob2JqZWN0LCBzb3VyY2UsIG9wdGlvbnMpIHtcbiAgICAgIHZhciBwcm9wcyA9IGtleXMoc291cmNlKSxcbiAgICAgICAgICBtZXRob2ROYW1lcyA9IGJhc2VGdW5jdGlvbnMoc291cmNlLCBwcm9wcyk7XG5cbiAgICAgIGlmIChvcHRpb25zID09IG51bGwgJiZcbiAgICAgICAgICAhKGlzT2JqZWN0KHNvdXJjZSkgJiYgKG1ldGhvZE5hbWVzLmxlbmd0aCB8fCAhcHJvcHMubGVuZ3RoKSkpIHtcbiAgICAgICAgb3B0aW9ucyA9IHNvdXJjZTtcbiAgICAgICAgc291cmNlID0gb2JqZWN0O1xuICAgICAgICBvYmplY3QgPSB0aGlzO1xuICAgICAgICBtZXRob2ROYW1lcyA9IGJhc2VGdW5jdGlvbnMoc291cmNlLCBrZXlzKHNvdXJjZSkpO1xuICAgICAgfVxuICAgICAgdmFyIGNoYWluID0gIShpc09iamVjdChvcHRpb25zKSAmJiAnY2hhaW4nIGluIG9wdGlvbnMpIHx8ICEhb3B0aW9ucy5jaGFpbixcbiAgICAgICAgICBpc0Z1bmMgPSBpc0Z1bmN0aW9uKG9iamVjdCk7XG5cbiAgICAgIGFycmF5RWFjaChtZXRob2ROYW1lcywgZnVuY3Rpb24obWV0aG9kTmFtZSkge1xuICAgICAgICB2YXIgZnVuYyA9IHNvdXJjZVttZXRob2ROYW1lXTtcbiAgICAgICAgb2JqZWN0W21ldGhvZE5hbWVdID0gZnVuYztcbiAgICAgICAgaWYgKGlzRnVuYykge1xuICAgICAgICAgIG9iamVjdC5wcm90b3R5cGVbbWV0aG9kTmFtZV0gPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBjaGFpbkFsbCA9IHRoaXMuX19jaGFpbl9fO1xuICAgICAgICAgICAgaWYgKGNoYWluIHx8IGNoYWluQWxsKSB7XG4gICAgICAgICAgICAgIHZhciByZXN1bHQgPSBvYmplY3QodGhpcy5fX3dyYXBwZWRfXyksXG4gICAgICAgICAgICAgICAgICBhY3Rpb25zID0gcmVzdWx0Ll9fYWN0aW9uc19fID0gY29weUFycmF5KHRoaXMuX19hY3Rpb25zX18pO1xuXG4gICAgICAgICAgICAgIGFjdGlvbnMucHVzaCh7ICdmdW5jJzogZnVuYywgJ2FyZ3MnOiBhcmd1bWVudHMsICd0aGlzQXJnJzogb2JqZWN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vcnkgVXRpbFxuICAgICAqIEByZXR1cm5zIHtBcnJheX0gUmV0dXJucyB0aGUgbmV3IGVtcHR5IGFycmF5LlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXlzID0gXy50aW1lcygyLCBfLnN0dWJBcnJheSk7XG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhhcnJheXMpO1xuICAgICAqIC8vID0+IFtbXSwgW11dXG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhhcnJheXNbMF0gPT09IGFycmF5c1sxXSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViQXJyYXkoKSB7XG4gICAgICByZXR1cm4gW107XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgcmV0dXJucyBgZmFsc2VgLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFJldHVybnMgYGZhbHNlYC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy50aW1lcygyLCBfLnN0dWJGYWxzZSk7XG4gICAgICogLy8gPT4gW2ZhbHNlLCBmYWxzZV1cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViRmFsc2UoKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgcmV0dXJucyBhIG5ldyBlbXB0eSBvYmplY3QuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAc2luY2UgNC4xMy4wXG4gICAgICogQGNhdGVnb3J5IFV0aWxcbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBSZXR1cm5zIHRoZSBu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biAgICAgKiBAcGFyYW0ge251bWJlcn0gW3ByZWNpc2lvbj0wXSBUaGUgcHJlY2lzaW9uIHRvIHJvdW5kIGRvd24gdG8uXG4gICAgICogQHJldHVybnMge251bWJlcn0gUmV0dXJucyB0aGUgcm91bmRlZCBkb3duIG51bWJlci5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy5mbG9vcig0LjAwNik7XG4gICAgICogLy8gPT4gNFxuICAgICAqXG4gICAgICogXy5mbG9vcigwLjA0NiwgMik7XG4gICAgICogLy8gPT4gMC4wNFxuICAgICAqXG4gICAgICogXy5mbG9vcig0MDYwLCAtMik7XG4gICAgICogLy8gPT4gNDAwMFxuICAgICAqL1xuICAgIHZhciBmbG9vciA9IGNyZWF0ZVJvdW5kKCdmbG9vcicpO1xuXG4gICAgLyoqXG4gICAgICogQ29tcHV0ZXMgdGhlIG1heGltdW0gdmFsdWUgb2YgYGFycmF5YC4gSWYgYGFycmF5YCBpcyBlbXB0eSBvciBmYWxzZXksXG4gICAgICogYHVuZGVmaW5lZGAgaXMgcmV0dXJuZWQuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgTWF0aFxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBpdGVyYXRlIG92ZXIuXG4gICAgICogQHJldHVybnMgeyp9IFJldHVybnMgdGhlIG1heGltdW0gdmFsdWUuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8ubWF4KFs0LCAyLCA4LCA2XSk7XG4gICAgICogLy8gPT4gOFxuICAgICAqXG4gICAgICogXy5tYXgoW10pO1xuICAgICAqIC8vID0+IHVuZGVmaW5lZFxuICAgICAqL1xuICAgIGZ1bmN0aW9uIG1heChhcnJheSkge1xuICAgICAgcmV0dXJuIChhcnJheSAmJiBhcnJheS5sZW5ndGg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c2lvblByb3ZpZGVyXCIpO1xuXHRcdGF3YWl0IGNsaWVudC5kaXNwYXRjaChcImdldC11c2VyLWRlY2lzaW9uXCIsIHVzZXJEZWNpc2lvbik7XG5cdFx0d2luZG93LmNsb3NlKCk7XG5cdH0gY2F0Y2ggKGVycm9yKSB7XG5cdFx0Y29uc29sZS5sb2coZXJyb3IpO1xuXHR9XG59XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/dev/john/update-window-options/use-platform-warn-before-closing-dialog/manifest.fin.json b/dev/john/update-window-options/use-platform-warn-before-closing-dialog/manifest.fin.json index 0f37588c..37f1e602 100644 --- a/dev/john/update-window-options/use-platform-warn-before-closing-dialog/manifest.fin.json +++ b/dev/john/update-window-options/use-platform-warn-before-closing-dialog/manifest.fin.json @@ -1,115 +1,115 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "enableBeforeUnload": true, - "uuid": "platform-warn", - "icon": "https://openfin.github.io/golden-prototype/favicon.ico", - "autoShow": false, - "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/provider.html", - "apiDiagnostics": false, - "defaultWindowOptions": { - "contextMenu": true, - "defaultWidth": 900, - "defaultHeight": 900, - "defaultLeft": 0, - "defaultTop": 0, - "saveWindowState": false, - "backgroundThrottling": true, - "minHeight": 445, - "minWidth": 354, - "defaultCentered": true - } - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "column", - "id": "no-drop-target", - "content": [ - { - "type": "row", - "content": [ - { - "type": "stack", - "content": [ - { - "type": "component", - "title": "view1", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view1", - "name": "view1", - "backgroundThrottling": true, - "componentName": "view" - } - } - ] - }, - { - "type": "stack", - "content": [ - { - "type": "component", - "title": "view3", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view3", - "name": "view3", - "backgroundThrottling": true, - "componentName": "view" - } - } - ] - } - ] - }, - { - "type": "row", - "content": [ - { - "type": "stack", - "content": [ - { - "type": "component", - "title": "view2", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view2", - "name": "view2", - "componentName": "view" - } - } - ] - }, - { - "type": "stack", - "content": [ - { - "type": "component", - "title": "view4", - "componentName": "view", - "componentState": { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view4", - "name": "view4", - "backgroundThrottling": true, - "componentName": "view" - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "enableBeforeUnload": true, + "uuid": "platform-warn", + "icon": "https://openfin.github.io/golden-prototype/favicon.ico", + "autoShow": false, + "providerUrl": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/provider.html", + "apiDiagnostics": false, + "defaultWindowOptions": { + "contextMenu": true, + "defaultWidth": 900, + "defaultHeight": 900, + "defaultLeft": 0, + "defaultTop": 0, + "saveWindowState": false, + "backgroundThrottling": true, + "minHeight": 445, + "minWidth": 354, + "defaultCentered": true + } + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "column", + "id": "no-drop-target", + "content": [ + { + "type": "row", + "content": [ + { + "type": "stack", + "content": [ + { + "type": "component", + "title": "view1", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view1", + "name": "view1", + "backgroundThrottling": true, + "componentName": "view" + } + } + ] + }, + { + "type": "stack", + "content": [ + { + "type": "component", + "title": "view3", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view3", + "name": "view3", + "backgroundThrottling": true, + "componentName": "view" + } + } + ] + } + ] + }, + { + "type": "row", + "content": [ + { + "type": "stack", + "content": [ + { + "type": "component", + "title": "view2", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view2", + "name": "view2", + "componentName": "view" + } + } + ] + }, + { + "type": "stack", + "content": [ + { + "type": "component", + "title": "view4", + "componentName": "view", + "componentState": { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-platform-warn-before-closing-dialog/html/view.html?title=view4", + "name": "view4", + "backgroundThrottling": true, + "componentName": "view" + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-popup-window-advanced/manifest.fin.json b/dev/john/update-window-options/use-popup-window-advanced/manifest.fin.json index a5b6bedd..ee61829b 100644 --- a/dev/john/update-window-options/use-popup-window-advanced/manifest.fin.json +++ b/dev/john/update-window-options/use-popup-window-advanced/manifest.fin.json @@ -1,35 +1,35 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-popup-window-advanced", - "autoShow": true - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-advanced/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-popup-window-advanced", + "autoShow": true + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-advanced/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-popup-window-modal/manifest.fin.json b/dev/john/update-window-options/use-popup-window-modal/manifest.fin.json index 6ec7ec23..a4b862bc 100644 --- a/dev/john/update-window-options/use-popup-window-modal/manifest.fin.json +++ b/dev/john/update-window-options/use-popup-window-modal/manifest.fin.json @@ -1,35 +1,35 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-popup-window-modal", - "autoShow": true - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-modal/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-popup-window-modal", + "autoShow": true + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-modal/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-popup-window-multiple-results/manifest.fin.json b/dev/john/update-window-options/use-popup-window-multiple-results/manifest.fin.json index b10e5cb6..472f3763 100644 --- a/dev/john/update-window-options/use-popup-window-multiple-results/manifest.fin.json +++ b/dev/john/update-window-options/use-popup-window-multiple-results/manifest.fin.json @@ -1,35 +1,35 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-popup-window-multiple-results", - "autoShow": true - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-multiple-results/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-popup-window-multiple-results", + "autoShow": true + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-multiple-results/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-popup-window-single-result/manifest.fin.json b/dev/john/update-window-options/use-popup-window-single-result/manifest.fin.json index 9ee5c810..85416cf4 100644 --- a/dev/john/update-window-options/use-popup-window-single-result/manifest.fin.json +++ b/dev/john/update-window-options/use-popup-window-single-result/manifest.fin.json @@ -1,35 +1,35 @@ { - "licenseKey": "openfin-demo-license-key", - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-popup-window-single-result", - "autoShow": true - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-single-result/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "licenseKey": "openfin-demo-license-key", + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-popup-window-single-result", + "autoShow": true + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-popup-window-single-result/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-preloads-basic/manifest.fin.json b/dev/john/update-window-options/use-preloads-basic/manifest.fin.json index 4ffb8e4c..6f233753 100644 --- a/dev/john/update-window-options/use-preloads-basic/manifest.fin.json +++ b/dev/john/update-window-options/use-preloads-basic/manifest.fin.json @@ -1,54 +1,54 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-preloads-hello-world", - "autoShow": true, - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/favicon.ico", - "preloadScripts": [ - { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-platform.bundle.js" - } - ], - "defaultWindowOptions": { - "preloadScripts": [ - { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-window.bundle.js" - } - ] - }, - "defaultViewOptions": { - "preloadScripts": [ - { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-view.bundle.js" - } - ] - } - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-preloads-hello-world", + "autoShow": true, + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/favicon.ico", + "preloadScripts": [ + { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-platform.bundle.js" + } + ], + "defaultWindowOptions": { + "preloadScripts": [ + { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-window.bundle.js" + } + ] + }, + "defaultViewOptions": { + "preloadScripts": [ + { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/js/preload-view.bundle.js" + } + ] + } + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-basic/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-preloads-restart-on-refresh/manifest.fin.json b/dev/john/update-window-options/use-preloads-restart-on-refresh/manifest.fin.json index 7ae4e650..105f0072 100644 --- a/dev/john/update-window-options/use-preloads-restart-on-refresh/manifest.fin.json +++ b/dev/john/update-window-options/use-preloads-restart-on-refresh/manifest.fin.json @@ -1,42 +1,42 @@ { - "runtime": { - "arguments": "--v=1 --inspect", - "version": "34.118.78.77" - }, - "platform": { - "uuid": "how-to-use-preloads-restart-on-refresh", - "autoShow": false, - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-restart-on-refresh/favicon.ico", - "defaultViewOptions": { - "preloadScripts": [ - { - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-restart-on-refresh/js/preload-view.bundle.js" - } - ] - } - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://www.google.com/search?q=openfin+preload+scripts" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect", + "version": "34.118.78.80" + }, + "platform": { + "uuid": "how-to-use-preloads-restart-on-refresh", + "autoShow": false, + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-restart-on-refresh/favicon.ico", + "defaultViewOptions": { + "preloadScripts": [ + { + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-preloads-restart-on-refresh/js/preload-view.bundle.js" + } + ] + } + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://www.google.com/search?q=openfin+preload+scripts" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-security-realms/app.fin.json b/dev/john/update-window-options/use-security-realms/app.fin.json index aface991..192290ab 100644 --- a/dev/john/update-window-options/use-security-realms/app.fin.json +++ b/dev/john/update-window-options/use-security-realms/app.fin.json @@ -1,19 +1,19 @@ { - "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", - "runtime": { - "version": "34.118.78.77", - "arguments": "--v=1 --security-realm=PROD-MAIN" - }, - "shortcut": { - "company": "OpenFin", - "description": "PROD Main Application", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", - "name": "PROD Main Application" - }, - "startup_app": { - "name": "prod-main-application", - "uuid": "prod-main-application", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html", - "autoShow": true - } -} \ No newline at end of file + "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", + "runtime": { + "version": "34.118.78.80", + "arguments": "--v=1 --security-realm=PROD-MAIN" + }, + "shortcut": { + "company": "OpenFin", + "description": "PROD Main Application", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", + "name": "PROD Main Application" + }, + "startup_app": { + "name": "prod-main-application", + "uuid": "prod-main-application", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html", + "autoShow": true + } +} diff --git a/dev/john/update-window-options/use-security-realms/manifest.fin.json b/dev/john/update-window-options/use-security-realms/manifest.fin.json index 0d30561e..186a3262 100644 --- a/dev/john/update-window-options/use-security-realms/manifest.fin.json +++ b/dev/john/update-window-options/use-security-realms/manifest.fin.json @@ -1,45 +1,45 @@ { - "runtime": { - "arguments": "--v=1 --inspect --security-realm=PROD-MAIN", - "version": "34.118.78.77" - }, - "shortcut": { - "company": "OpenFin", - "description": "PROD Main Platform", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", - "name": "PROD Main Platform" - }, - "platform": { - "uuid": "prod-main-platform", - "autoShow": false, - "permissions": { - "System": { - "launchExternalProcess": true - } - } - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/view-app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect --security-realm=PROD-MAIN", + "version": "34.118.78.80" + }, + "shortcut": { + "company": "OpenFin", + "description": "PROD Main Platform", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", + "name": "PROD Main Platform" + }, + "platform": { + "uuid": "prod-main-platform", + "autoShow": false, + "permissions": { + "System": { + "launchExternalProcess": true + } + } + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/view-app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-security-realms/uat/app.fin.json b/dev/john/update-window-options/use-security-realms/uat/app.fin.json index d78a3615..d8e7a605 100644 --- a/dev/john/update-window-options/use-security-realms/uat/app.fin.json +++ b/dev/john/update-window-options/use-security-realms/uat/app.fin.json @@ -1,34 +1,34 @@ { - "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", - "runtime": { - "version": "34.118.78.77", - "arguments": "--v=1 --security-realm=UAT-MAIN" - }, - "shortcut": { - "company": "OpenFin", - "description": "UAT Main Application", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", - "name": "UAT Main Application" - }, - "startup_app": { - "name": "uat-main-application", - "uuid": "uat-main-application", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html", - "autoShow": true, - "permissions": { - "System": { - "launchExternalProcess": true, - "downloadAsset": true - } - } - }, - "appAssets": [ - { - "src": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/assets/UseSecurityRealms.zip", - "version": "0.0.0.1", - "alias": "security-realms-native", - "target": "UseSecurityRealms.exe", - "mandatory": true - } - ] -} \ No newline at end of file + "licenseKey": "64605fac-add3-48a0-8710-64b38e96a2dd", + "runtime": { + "version": "34.118.78.80", + "arguments": "--v=1 --security-realm=UAT-MAIN" + }, + "shortcut": { + "company": "OpenFin", + "description": "UAT Main Application", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", + "name": "UAT Main Application" + }, + "startup_app": { + "name": "uat-main-application", + "uuid": "uat-main-application", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html", + "autoShow": true, + "permissions": { + "System": { + "launchExternalProcess": true, + "downloadAsset": true + } + } + }, + "appAssets": [ + { + "src": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/assets/UseSecurityRealms.zip", + "version": "0.0.0.1", + "alias": "security-realms-native", + "target": "UseSecurityRealms.exe", + "mandatory": true + } + ] +} diff --git a/dev/john/update-window-options/use-security-realms/uat/manifest.fin.json b/dev/john/update-window-options/use-security-realms/uat/manifest.fin.json index b895a22c..946a2d7b 100644 --- a/dev/john/update-window-options/use-security-realms/uat/manifest.fin.json +++ b/dev/john/update-window-options/use-security-realms/uat/manifest.fin.json @@ -1,45 +1,45 @@ { - "runtime": { - "arguments": "--v=1 --inspect --security-realm=UAT-MAIN", - "version": "34.118.78.77" - }, - "shortcut": { - "company": "OpenFin", - "description": "UAT Main Platform", - "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", - "name": "UAT Main Platform" - }, - "platform": { - "uuid": "uat-main-platform", - "autoShow": false, - "permissions": { - "System": { - "launchExternalProcess": true - } - } - }, - "snapshot": { - "windows": [ - { - "layout": { - "content": [ - { - "type": "stack", - "id": "no-drop-target", - "content": [ - { - "type": "component", - "componentName": "view", - "componentState": { - "processAffinity": "ps_1", - "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html" - } - } - ] - } - ] - } - } - ] - } -} \ No newline at end of file + "runtime": { + "arguments": "--v=1 --inspect --security-realm=UAT-MAIN", + "version": "34.118.78.80" + }, + "shortcut": { + "company": "OpenFin", + "description": "UAT Main Platform", + "icon": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/favicon.ico", + "name": "UAT Main Platform" + }, + "platform": { + "uuid": "uat-main-platform", + "autoShow": false, + "permissions": { + "System": { + "launchExternalProcess": true + } + } + }, + "snapshot": { + "windows": [ + { + "layout": { + "content": [ + { + "type": "stack", + "id": "no-drop-target", + "content": [ + { + "type": "component", + "componentName": "view", + "componentState": { + "processAffinity": "ps_1", + "url": "https://built-on-openfin.github.io/container-starter/dev/john/update-window-options/use-security-realms/html/app.html" + } + } + ] + } + ] + } + } + ] + } +} diff --git a/dev/john/update-window-options/use-window-options/html/app.html b/dev/john/update-window-options/use-window-options/html/app.html index 4cf2ff0b..0e9a4646 100644 --- a/dev/john/update-window-options/use-window-options/html/app.html +++ b/dev/john/update-window-options/use-window-options/html/app.html @@ -2,7 +2,7 @@ - Window Options Example + Window Options Builder @@ -12,7 +12,7 @@
-

Window Options Example

+

Window Options Builder

Demonstrate the customization options available for opening windows.

@@ -41,6 +41,10 @@

Common

+
+ + +
@@ -235,10 +239,11 @@

Preview

diff --git a/dev/john/update-window-options/use-window-options/html/preview.html b/dev/john/update-window-options/use-window-options/html/preview.html index f219f432..d15e8cac 100644 --- a/dev/john/update-window-options/use-window-options/html/preview.html +++ b/dev/john/update-window-options/use-window-options/html/preview.html @@ -19,18 +19,104 @@

Demonstrate the customization options available for opening wind

-

This is the preview window.

+
This is the preview window.