@yourdash/uikit 1.0.31 → 1.0.33
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/accessibility-16-uva4fZex.js +0 -1
- package/dist/accessibility-inset-16-DWzB3IjG.js +0 -1
- package/dist/alert-16-DwAQwyBK.js +0 -1
- package/dist/app-launcher-16-C7hnENpC.js +0 -1
- package/dist/apps-16-CVfbC2bb.js +0 -1
- package/dist/archive-16-BZGSPJkx.js +0 -1
- package/dist/arrow-both-16-D4pAyV4U.js +0 -1
- package/dist/arrow-down-16-DK9ag-gk.js +0 -1
- package/dist/arrow-left-16-DYkryq2D.js +0 -1
- package/dist/arrow-right-16-OTyXEvHz.js +0 -1
- package/dist/arrow-switch-16-DFOully_.js +0 -1
- package/dist/arrow-up-16-Dxwb5Tzb.js +0 -1
- package/dist/beaker-16-CnNc9r-O.js +0 -1
- package/dist/bell-16-Dp6XEu_P.js +0 -1
- package/dist/bell-fill-16-DC8GZ_ml.js +0 -1
- package/dist/bell-slash-16-CNGnmeTn.js +0 -1
- package/dist/blocked-16-D4zjCHxV.js +0 -1
- package/dist/bold-16-BfSacKBr.js +0 -1
- package/dist/book-16-Cbx7nhRf.js +0 -1
- package/dist/bookmark-16-liEsGE05.js +0 -1
- package/dist/bookmark-slash-16-BpA1ZKFT.js +0 -1
- package/dist/briefcase-16-D-qCbq6J.js +0 -1
- package/dist/broadcast-16-Crd5FtS2.js +0 -1
- package/dist/browser-16-CVb22dcd.js +0 -1
- package/dist/bug-16-CtJpjfbz.js +0 -1
- package/dist/cache-16-DDgjAWW5.js +0 -1
- package/dist/calendar-16-C6dCLIvL.js +0 -1
- package/dist/check-16-6YNaQNFN.js +0 -1
- package/dist/check-circle-16-BjKfoe5_.js +0 -1
- package/dist/check-circle-fill-16-DdMO2wXu.js +0 -1
- package/dist/checkbox-16-B2oKipWw.js +0 -1
- package/dist/checklist-16-Zf6Kygb8.js +0 -1
- package/dist/chevron-down-16-DEpquzJ_.js +0 -1
- package/dist/chevron-left-16-BIGn1PV5.js +0 -1
- package/dist/chevron-right-16-B8LafSsi.js +0 -1
- package/dist/chevron-up-16-CugMIitk.js +0 -1
- package/dist/circle-16-B593gRA3.js +0 -1
- package/dist/circle-slash-16-B5Ww73vU.js +0 -1
- package/dist/clock-16-qUwX1NRV.js +0 -1
- package/dist/cloud-16-Rhl-Y4cv.js +0 -1
- package/dist/cloud-offline-16-ChdtXP8s.js +0 -1
- package/dist/code-16-CyMDCYbk.js +0 -1
- package/dist/code-of-conduct-16-3jxiG7BK.js +0 -1
- package/dist/code-review-16-DMtB7Dru.js +0 -1
- package/dist/code-square-16-dgSkAxDY.js +0 -1
- package/dist/codescan-16-CkGjDIRJ.js +0 -1
- package/dist/codescan-checkmark-16-CTHqRJ7Z.js +0 -1
- package/dist/codespaces-16-CoZQ8Psv.js +0 -1
- package/dist/columns-16-DKbJWXAg.js +0 -1
- package/dist/command-palette-16-DZ0Q7ffJ.js +0 -1
- package/dist/comment-16-B09NEr6-.js +0 -1
- package/dist/comment-discussion-16-gcMEsg_Q.js +0 -1
- package/dist/container-16-BdSF_CC6.js +0 -1
- package/dist/copilot-16-tzDSkzaO.js +0 -1
- package/dist/copilot-48-C7o3SsdM.js +0 -1
- package/dist/copilot-96-DRWtudKT.js +0 -1
- package/dist/copilot-error-16-mS3AFeBJ.js +0 -1
- package/dist/copilot-warning-16-DDHrbpjQ.js +0 -1
- package/dist/copy-16-U4bBESsW.js +0 -1
- package/dist/cpu-16-B1nGSXjd.js +0 -1
- package/dist/credit-card-16-uQInMwnT.js +0 -1
- package/dist/cross-reference-16-BXVZtDhD.js +0 -1
- package/dist/dash-16-Dj70y9jI.js +0 -1
- package/dist/database-16-OKZrFj7L.js +0 -1
- package/dist/dependabot-16-ybT9-lhR.js +0 -1
- package/dist/desktop-download-16-1OhnJTN6.js +0 -1
- package/dist/device-camera-16-Bh1yGmqu.js +0 -1
- package/dist/device-camera-video-16-BmT22xsn.js +0 -1
- package/dist/device-desktop-16-m5wh49qs.js +0 -1
- package/dist/device-mobile-16-C1ZEWPwb.js +0 -1
- package/dist/diamond-16-D-w62P-X.js +0 -1
- package/dist/diff-16-Cylk8iSK.js +0 -1
- package/dist/diff-added-16-BlJ2cb6b.js +0 -1
- package/dist/diff-ignored-16-Ccd8OFzb.js +0 -1
- package/dist/diff-modified-16-BlXb7Wwh.js +0 -1
- package/dist/diff-removed-16-Cn0mhKYP.js +0 -1
- package/dist/diff-renamed-16-DIu8aDPG.js +0 -1
- package/dist/dot-16-BvkuaxUz.js +0 -1
- package/dist/dot-fill-16-D1FNypdu.js +0 -1
- package/dist/download-16-fugL3zxY.js +0 -1
- package/dist/duplicate-16-OiUFntSI.js +0 -1
- package/dist/ellipsis-16-ClTH0fbr.js +0 -1
- package/dist/ewsgit-jMFOdurQ.js +0 -1
- package/dist/eye-16-Dpz-OhId.js +0 -1
- package/dist/eye-closed-16-DIUAb4Xb.js +0 -1
- package/dist/feed-discussion-16-DNcL8nZw.js +0 -1
- package/dist/feed-forked-16-DMU2yXdo.js +0 -1
- package/dist/feed-heart-16-CBrg58q-.js +0 -1
- package/dist/feed-merged-16-CQYwGlvM.js +0 -1
- package/dist/feed-person-16-BVo_agig.js +0 -1
- package/dist/feed-repo-16-DNHxzukP.js +0 -1
- package/dist/feed-rocket-16-DJ4yF4T8.js +0 -1
- package/dist/feed-star-16-4DcJOBOK.js +0 -1
- package/dist/feed-tag-16-BMokDbhr.js +0 -1
- package/dist/feed-trophy-16-B91fsGEY.js +0 -1
- package/dist/file-16-DIeKUUYi.js +0 -1
- package/dist/file-added-16-D2CFL7Uo.js +0 -1
- package/dist/file-badge-16-CBU42y9Y.js +0 -1
- package/dist/file-binary-16-Fe6xRdy_.js +0 -1
- package/dist/file-code-16-DUeOa2n1.js +0 -1
- package/dist/file-diff-16-fcHLvRjr.js +0 -1
- package/dist/file-directory-16-DTq8L7XZ.js +0 -1
- package/dist/file-directory-fill-16-DvR6seEJ.js +0 -1
- package/dist/file-directory-open-fill-16-D99Fi0Uv.js +0 -1
- package/dist/file-moved-16-J4r90OBP.js +0 -1
- package/dist/file-removed-16-C96WF_Jl.js +0 -1
- package/dist/file-submodule-16-Cx_q19a2.js +0 -1
- package/dist/file-symlink-file-16-87lgtC6n.js +0 -1
- package/dist/file-zip-16-CY1OP2oH.js +0 -1
- package/dist/filter-16-BBY8gRAj.js +0 -1
- package/dist/flame-16-BQjUkHlk.js +0 -1
- package/dist/fold-16-c5GFBwTE.js +0 -1
- package/dist/fold-down-16-COVTHOOm.js +0 -1
- package/dist/fold-up-16-CKn_S_xy.js +0 -1
- package/dist/gear-16-DumL4R2n.js +0 -1
- package/dist/gift-16-Cwzr0gsC.js +0 -1
- package/dist/git-branch-16-DvVGm5c4.js +0 -1
- package/dist/git-commit-16-B_7xQW9c.js +0 -1
- package/dist/git-compare-16-DlK0CGps.js +0 -1
- package/dist/git-merge-16-BDUp3rix.js +0 -1
- package/dist/git-merge-queue-16-BU1k9bjJ.js +0 -1
- package/dist/git-pull-request-16-1aj8YV_B.js +0 -1
- package/dist/git-pull-request-closed-16-hBv3wiW6.js +0 -1
- package/dist/git-pull-request-draft-16-DVlwk56b.js +0 -1
- package/dist/globe-16-BZn8GRSm.js +0 -1
- package/dist/grabber-16-XsiP6L33.js +0 -1
- package/dist/graph-16-C3jugR5U.js +0 -1
- package/dist/hash-16-INeZLwfH.js +0 -1
- package/dist/heading-16-DZ2y6_f4.js +0 -1
- package/dist/heart-16-C164hwwe.js +0 -1
- package/dist/heart-fill-16-BLIsvQib.js +0 -1
- package/dist/history-16-BdsiN28s.js +0 -1
- package/dist/home-16-BnAzc0t0.js +0 -1
- package/dist/horizontal-rule-16-CkgtCsRk.js +0 -1
- package/dist/hourglass-16-DCYwuA1E.js +0 -1
- package/dist/hubot-16-CB8ALc4b.js +0 -1
- package/dist/id-badge-16-BfWbvypi.js +0 -1
- package/dist/image-16-CI2AKWja.js +0 -1
- package/dist/inbox-16-BwPN_Pqp.js +0 -1
- package/dist/infinity-16-C3WWt8iw.js +0 -1
- package/dist/info-16-HbLgChx_.js +0 -1
- package/dist/issue-closed-16-BxAFCRD_.js +0 -1
- package/dist/issue-draft-16-BlDzM4WD.js +0 -1
- package/dist/issue-opened-16-D7Oxfpbr.js +0 -1
- package/dist/issue-reopened-16-BBhYiACa.js +0 -1
- package/dist/italic-16-YevyopkT.js +0 -1
- package/dist/iterations-16-ct_Zy_ha.js +0 -1
- package/dist/kebab-horizontal-16-BAtFnPV1.js +0 -1
- package/dist/key-16-cK5chQrW.js +0 -1
- package/dist/key-asterisk-16-tFceMwFA.js +0 -1
- package/dist/law-16-B05_CbgH.js +0 -1
- package/dist/light-bulb-16-Deu3ygRK.js +0 -1
- package/dist/link-16-gr8iDaj6.js +0 -1
- package/dist/link-external-16-DydJR9tS.js +0 -1
- package/dist/list-ordered-16-zTd4ngaN.js +0 -1
- package/dist/list-unordered-16-cwkrOE2e.js +0 -1
- package/dist/location-16-ydwVyd5Q.js +0 -1
- package/dist/lock-16-CLq3uwix.js +0 -1
- package/dist/log-16-C0L4He2w.js +0 -1
- package/dist/login-BwNjTSN_.js +0 -1
- package/dist/logo-gist-16-TtSc--Ox.js +0 -1
- package/dist/logo-github-16-BeUjNLEP.js +0 -1
- package/dist/logout-BitCiQuQ.js +0 -1
- package/dist/mail-16-CSJcliU3.js +0 -1
- package/dist/mark-github-16-BTmYlr1K.js +0 -1
- package/dist/markdown-16-7RbG-T2H.js +0 -1
- package/dist/megaphone-16-B42g-tb0.js +0 -1
- package/dist/mention-16-DKNmD-e-.js +0 -1
- package/dist/meter-16-p57sJ2Ki.js +0 -1
- package/dist/milestone-16-Dq1pZDo8.js +0 -1
- package/dist/mirror-16-BhrpmWlZ.js +0 -1
- package/dist/moon-16-CtR6e7uz.js +0 -1
- package/dist/mortar-board-16-C1wVPMZe.js +0 -1
- package/dist/multi-select-16-jlz6eIXl.js +0 -1
- package/dist/mute-16-BaaR3TM4.js +0 -1
- package/dist/no-entry-16-Jl3LIHGk.js +0 -1
- package/dist/north-star-16-KtvX4ZHg.js +0 -1
- package/dist/note-16-BzYoUHl3.js +0 -1
- package/dist/number-16-790SB7b2.js +0 -1
- package/dist/organization-16-DaJvLPdY.js +0 -1
- package/dist/package-16-Dt3hnR7v.js +0 -1
- package/dist/package-dependencies-16-Ca4D2ZGA.js +0 -1
- package/dist/package-dependents-16-qTuTdgtV.js +0 -1
- package/dist/paintbrush-16-DjNZ3TYq.js +0 -1
- package/dist/paper-airplane-16-BYjlaU1X.js +0 -1
- package/dist/paperclip-16-dZHoanH1.js +0 -1
- package/dist/paste-16-D4rAp7H6.js +0 -1
- package/dist/pencil-16-yVA3cW9W.js +0 -1
- package/dist/people-16-Dhralm-7.js +0 -1
- package/dist/person-16-eRHtJ0rn.js +0 -1
- package/dist/person-add-16-DKthdM_G.js +0 -1
- package/dist/person-fill-16-ChkxtXd7.js +0 -1
- package/dist/pin-16-CVBFK8YL.js +0 -1
- package/dist/play-16-DQFcHXSC.js +0 -1
- package/dist/plug-16-1JhHgUhG.js +0 -1
- package/dist/plus-16-Baask508.js +0 -1
- package/dist/plus-circle-16-BMJZhn7g.js +0 -1
- package/dist/project-16-CeAT1XdX.js +0 -1
- package/dist/pulse-16-BX0IQseD.js +0 -1
- package/dist/question-16-Dmzmugo4.js +0 -1
- package/dist/quote-16-DRb6SNg5.js +0 -1
- package/dist/reply-16-XmiLb2fd.js +0 -1
- package/dist/repo-16-DGftjbNe.js +0 -1
- package/dist/repo-clone-16-BmxJcB0F.js +0 -1
- package/dist/repo-deleted-16-g76QeX-X.js +0 -1
- package/dist/repo-forked-16-63FNDYK-.js +0 -1
- package/dist/repo-locked-16-Dy05PUmf.js +0 -1
- package/dist/repo-pull-16-BTh0zEQS.js +0 -1
- package/dist/repo-push-16-4AG6clSy.js +0 -1
- package/dist/repo-template-16-Caw2Hpe_.js +0 -1
- package/dist/report-16-CyRJbIap.js +0 -1
- package/dist/rocket-16-Dggo49wd.js +0 -1
- package/dist/rows-16-fGIr0S01.js +0 -1
- package/dist/rss-16-DWle3roS.js +0 -1
- package/dist/ruby-16-BreboEYi.js +0 -1
- package/dist/screen-full-16-vKKvRK_T.js +0 -1
- package/dist/screen-normal-16-BFiON6jh.js +0 -1
- package/dist/search-16-d9YAifw3.js +0 -1
- package/dist/server-16-PXkdGIz7.js +0 -1
- package/dist/share-16-CeaKGzF6.js +0 -1
- package/dist/share-android-16-Y0jPvfBW.js +0 -1
- package/dist/shield-16-B9tadaQL.js +0 -1
- package/dist/shield-check-16-BWKJFQV-.js +0 -1
- package/dist/shield-lock-16-DUfTkk8o.js +0 -1
- package/dist/shield-slash-16-BWh26Hd4.js +0 -1
- package/dist/shield-x-16-Df1cfMy1.js +0 -1
- package/dist/sidebar-collapse-16-DO-Oh_kH.js +0 -1
- package/dist/sidebar-expand-16-C3pxNr67.js +0 -1
- package/dist/sign-in-16-D6p2_-5k.js +0 -1
- package/dist/sign-out-16-JjnZ1Tho.js +0 -1
- package/dist/single-select-16-Byk6XVox.js +0 -1
- package/dist/skip-16-Bs6yOqrX.js +0 -1
- package/dist/sliders-16-BHKGoJhB.js +0 -1
- package/dist/smiley-16-DPhwU_6u.js +0 -1
- package/dist/sort-asc-16-B7XOWdSg.js +0 -1
- package/dist/sort-desc-16-B5iS9cqk.js +0 -1
- package/dist/square-16-B9kJQ-hA.js +0 -1
- package/dist/square-fill-16-XEr3NJ2b.js +0 -1
- package/dist/squirrel-16-tH5Qgxz7.js +0 -1
- package/dist/stack-16-BM0NXNCR.js +0 -1
- package/dist/star-16-CskIof-_.js +0 -1
- package/dist/star-fill-16-EG_wS7u5.js +0 -1
- package/dist/stop-16-SDgo6czX.js +0 -1
- package/dist/stopwatch-16-BbHE3PgN.js +0 -1
- package/dist/store-CoWUtwnO.js +0 -1
- package/dist/strikethrough-16-R4mZSVbu.js +0 -1
- package/dist/sun-16-hrWRillM.js +0 -1
- package/dist/sync-16-BUhljzac.js +0 -1
- package/dist/tab-external-16-DlFayM4z.js +0 -1
- package/dist/table-16-D23Tuy3n.js +0 -1
- package/dist/tag-16-CSbX60Y0.js +0 -1
- package/dist/tasklist-16-BGUg5t2o.js +0 -1
- package/dist/telescope-16-CkqdZV2W.js +0 -1
- package/dist/telescope-fill-16-Bc_8rywi.js +0 -1
- package/dist/terminal-16-CS4NLijU.js +0 -1
- package/dist/three-bars-16-RtW9hDLk.js +0 -1
- package/dist/thumbsdown-16-DXmfxQSW.js +0 -1
- package/dist/thumbsup-16-DBMF-Hkr.js +0 -1
- package/dist/tools-16-CCmSf4Mt.js +0 -1
- package/dist/trash-16-D-qAwcOJ.js +0 -1
- package/dist/triangle-down-16-T-DZZA9H.js +0 -1
- package/dist/triangle-left-16-CteMjjMD.js +0 -1
- package/dist/triangle-right-16-D9ClWREJ.js +0 -1
- package/dist/triangle-up-16-FS6az6-y.js +0 -1
- package/dist/trophy-16-NGT_1p4C.js +0 -1
- package/dist/typography-16-IirtJXxN.js +0 -1
- package/dist/uikit.js +0 -1
- package/dist/unfold-16-DjzHMoJW.js +0 -1
- package/dist/unlock-16-CJgQHziq.js +0 -1
- package/dist/unmute-16-DCRFpFL7.js +0 -1
- package/dist/unverified-16-CAAVyiPH.js +0 -1
- package/dist/upload-16-BNFqJc1F.js +0 -1
- package/dist/verified-16-CTElcDEy.js +0 -1
- package/dist/versions-16-DI9tKMFX.js +0 -1
- package/dist/video-16-DAXLpsgq.js +0 -1
- package/dist/webhook-16-B63wCkFf.js +0 -1
- package/dist/workflow-16-BrP4zNK0.js +0 -1
- package/dist/x-16-B7iyXdcL.js +0 -1
- package/dist/x-circle-16-C79HwlWA.js +0 -1
- package/dist/x-circle-fill-16-4KWscQI9.js +0 -1
- package/dist/yourdash-xKqdwKGy.js +0 -1
- package/dist/zap-16-hscWSFVd.js +0 -1
- package/package.json +2 -2
- /package/dist/{main.d.ts → uikit.d.ts} +0 -0
package/dist/uikit.js
CHANGED
@@ -3717,4 +3717,3 @@ export {
|
|
3717
3717
|
cs as UtilityComponent,
|
3718
3718
|
is as Views
|
3719
3719
|
};
|
3720
|
-
//# sourceMappingURL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uXG4gICAgICBjYXNlIFJFQUNUX0ZPUldBUkRfUkVGX1RZUEU6XG4gICAgICAgIHJldHVybiBnZXRXcmFwcGVkTmFtZSh0eXBlLCB0eXBlLnJlbmRlciwgJ0ZvcndhcmRSZWYnKTtcblxuICAgICAgY2FzZSBSRUFDVF9NRU1PX1RZUEU6XG4gICAgICAgIHZhciBvdXRlck5hbWUgPSB0eXBlLmRpc3BsYXlOYW1lIHx8IG51bGw7XG5cbiAgICAgICAgaWYgKG91dGVyTmFtZSAhPT0gbnVsbCkge1xuICAgICAgICAgIHJldHVybiBvdXRlck5hbWU7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZ2V0Q29tcG9uZW50TmFtZUZyb21UeXBlKHR5cGUudHlwZSkgfHwgJ01lbW8nO1xuXG4gICAgICBjYXNlIFJFQUNUX0xBWllfVFlQRTpcbiAgICAgICAge1xuICAgICAgICAgIHZhciBsYXp5Q29tcG9uZW50ID0gdHlwZTtcbiAgICAgICAgICB2YXIgcGF5bG9hZCA9IGxhenlDb21wb25lbnQuX3BheWxvYWQ7XG4gICAgICAgICAgdmFyIGluaXQgPSBsYXp5Q29tcG9uZW50Ll9pbml0O1xuXG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJldHVybiBnZXRDb21wb25lbnROYW1lRnJvbVR5cGUoaW5pdChwYXlsb2FkKSk7XG4gICAgICAgICAgfSBjYXRjaCAoeCkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1mYWxsdGhyb3VnaFxuICAgIH1cbiAgfVxuXG4gIHJldHVybiBudWxsO1xufVxuXG52YXIgaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG52YXIgUkVTRVJWRURfUFJPUFMgPSB7XG4gIGtleTogdHJ1ZSxcbiAgcmVmOiB0cnV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vbHZlIGJlZm9yZSBleGl0aW5nIHRoZSBjdXJyZW50IHNjb3BlLlxuXG4gICAgICB2YXIgd2FzQXdhaXRlZCA9IGZhbHNlO1xuICAgICAgdmFyIHRoZW5hYmxlID0ge1xuICAgICAgICB0aGVuOiBmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7XG4gICAgICAgICAgd2FzQXdhaXRlZCA9IHRydWU7XG4gICAgICAgICAgdGhlbmFibGVSZXN1bHQudGhlbihmdW5jdGlvbiAocmV0dXJuVmFsdWUpIHtcbiAgICAgICAgICAgIHBvcEFjdFNjb3BlKHByZXZBY3RTY29wZURlcHRoKTtcblxuICAgICAgICAgICAgaWYgKGFjdFNjb3BlRGVwdGggPT09IDApIHtcbiAgICAgICAgICAgICAgLy8gV2UndmUgZXhpdGVkIHRoZSBvdXRlcm1vc3QgYWN0IHNjb3BlLiBSZWN1cnNpdmVseSBmbHVzaCB0aGVcbiAgICAgICAgICAgICAgLy8gcXVldWUgdW50aWwgdGhlcmUncyBubyByZW1haW5pbmcgd29yay5cbiAgICAgICAgICAgICAgcmVjdXJzaXZlbHlGbHVzaEFzeW5jQWN0V29yayhyZXR1cm5WYWx1ZSwgcmVzb2x2ZSwgcmVqZWN0KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHJlc29sdmUocmV0dXJuVmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0sIGZ1bmN0aW9uIChlcnJvcikge1xuICAgICAgICAgICAgLy8gVGhlIGNhbGxiYWNrIHRocmV3IGFuIGVycm9yLlxuICAgICAgICAgICAgcG9wQWN0U2NvcGUocHJldkFjdFNjb3BlRGVwdGgpO1xuICAgICAgICAgICAgcmVqZWN0KGVycm9yKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfTtcblxuICAgICAge1xuICAgICAgICBpZiAoIWRpZFdhcm5Ob0F3YWl0QWN0ICYmIHR5cGVvZiBQcm9taXNlICE9PS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HRlciA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoY29uZmlnLCAncmVmJykuZ2V0O1xuXG4gICAgICBpZiAoZ2V0dGVyICYmIGdldHRlci5pc1JlYWN0V2FybmluZykge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIGNvbmZpZy5yZWYgIT09IHVuZGVmaW5lZDtcbn1cblxuZnVuY3Rpb24gaGFzVmFsaWRLZXkoY29uZmlnKSB7XG4gIHtcbiAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChjb25maWcsICdrZXknKSkge1xuICAgICAgdmFyIGdldHRlciA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoY29uZmlnLCAna2V5JykuZ2V0O1xuXG4gICAgICBpZiAoZ2V0dGVyICYmIGdldHRlci5pc1JlYWN0V2FybmluZykge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIGNvbmZpZy5rZXkgIT09IHVuZGVmaW5lZDtcbn1cblxuZnVuY3Rpb24gd2FybklmU3RyaW5nUmVmQ2Fubm90QmVBdXRvQ29udmVydGVkKGNvbmZpZywgc2VsZikge1xuICB7XG4gICAgaWYgKHR5cGVvZiBjb25maWcucmVmID09PSAnc3RyaW5nJyAmJiBSZWFjdEN1cnJlbnRPd25lci5jdXJyZW50ICYmIHNlbGYgJiYgUmVhY3RDdXJyZW50T3duZXIuY3VycmVudC5zdGF0ZU5vZGUgIT09IHNlbGYpIHtcbiAgICAgIHZhciBjb21wb25lbnROYW1lID0gZ2V0Q29tcG9uZW50TmFtZUZyb21UeXBlKFJlYWN0Q3VycmVudE93bmVyLmN1cnJlbnQudHlwZSk7XG5cbiAgICAgIGlmICghZGlkV2FybkFib3V0U3RyaW5nUmVmc1tjb21wb25lbnROYW1lXSkge1xuICAgICAgICBlcnJvcignQ29tcG9uZW50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7XHJcbn0+ID0gKHsgaXRlbXMsIGNoaWxkcmVuLCBjbGFzc05hbWUgfSkgPT4ge1xyXG4gIHJldHVybiAoXHJcbiAgICA8Y29udGV4dE1lbnVSb290Q29udGV4dC5Db25zdW1lcj5cclxuICAgICAgeyhyb290Q29udGV4dCkgPT4ge1xyXG4gICAgICAgIHJldHVybiAoXHJcbiAgICAgICAgICA8ZGl2XHJcbiAgICAgICAgICAgIGNsYXNzTmFtZT17Y2xhc3NOYW1lfVxyXG4gICAgICAgICAgICBvbkNvbnRleHRNZW51PXsoZSkgPT4ge1xyXG4gICAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG5cclxuICAgICAgICAgICAgICBjb25zdCBtZW51UmVjdCA9IGUuY3VycmVudFRhcmdldC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcclxuXHJcbiAgICAgICAgICAgICAgcm9vdENvbnRleHQuY3JlYXRlTWVudSh7XHJcbiAgICAgICAgICAgICAgICB4OiBlLnBhZ2VYLFxyXG4gICAgICAgICAgICAgICAgeTogZS5wYWdlWSxcclxuICAgICAgICAgICAgICAgIHdpZHRoOiBtZW51UmVjdC53aWR0aCxcclxuICAgICAgICAgICAgICAgIGhlaWdodDogbWVudVJlY3QuaGVpZ2h0LFxyXG4gICAgICAgICAgICAgICAgaXRlbXM6IGl0ZW1zLFxyXG4gICAgICAgICAgICAgIH0pO1xyXG5cclxuICAgICAgICAgICAgICBjb25zdCBsaXN0ZW5lciA9IChldjogTW91c2VFdmVudCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgZXYucHJldmVudERlZmF1bHQoKTtcclxuXHJcbiAgICAgICAgICAgICAgICByb290Q29udGV4dC5kZXN0cm95TWVudSgpO1xyXG5cclxuICAgICAgICAgICAgICAgIHdpbmRvdy5yZW1vdmVFdmVudExpc3RlbmVyKFwiY2xpY2tcIiwgbGlzdGVuZXIp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C5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0ICsgc2Nyb2xsRWxlbWVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS53aWR0aCAvIDIpLFxuICAgICAgICAgICAgKSA8XG4gICAgICAgICAgICBlbGUuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkud2lkdGggLyAyXG4gICAgICAgICAgKSB7XG4gICAgICAgICAgICBzZXRDdXJyZW50UGFnZShpbmRleCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0sIDI1KSBhcyB1bmtub3duIGFzIG51bWJlcjtcbiAgICB9O1xuXG4gICAgc2Nyb2xsRWxlbWVudC5hZGRFdmVudExpc3RlbmVyKFwic2Nyb2xsXCIsIGxpc3RlbmVyKTtcblxuICAgIHJldHVybiAoKSA9PiB7XG4gICAgICBzY3JvbGxFbGVtZW50LnJlbW92ZUV2ZW50TGlzdGVuZXIoXCJzY3JvbGxcIiwgbGlzdGVuZXIpO1xuICAgICAgY2xlYXJUaW1lb3V0KHRpbWVyKTtcbiAgICB9O1xuICB9LCBbXSk7XG5cbiAgcmV0dXJuIChcbiAgICA8Q29udGFpbmVyIGNsYXNzTmFtZT17Y2xpcHB5KHN0eWxlcy5jb250YWluZXJDb21wb25lbnQsIGNsYXNzTmFtZSl9PlxuICAgICAgPGRpdlxuICAgICAgICBjbGFzc05hbWU9e3N0eWxlcy5jb21wb25lbnR9XG4gICAgICAgIHJlZj17c2Nyb2xsUmVmfVxuICAgICAgPlxuICAgICAgICB7aXRlbXMubWFwKChjaGlsZCkgPT4ge1xuICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICA8ZGl2XG4gICAgICAgICAgICAgIGtleT17Y2hpbGQuaWR9XG4gICAgICAgICAgICAgIGNsYXNzTmFtZT17c3R5bGVzLnBhZ2V9XG4gICAgICAgICAgICA+XG4gICAgICAgICAgICAgIHtjaGlsZC5lbGVtZW50fVxuICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgKTtcbiAgICAgICAgfSl9XG4gICAgICA8L2Rpdj5cbiAgICAgIDxkaXYgY2xhc3NOYW1lPXtzdHlsZXMuY29udHJvbHN9PlxuICAgICAgICA8SWNvbkJ1dHRvblxuICAgICAgICAgIGFjY2Vzc2libGVMYWJlbD17XCJwcmV2aW91cyBwYWdlXCJ9XG4gICAgICAgICAgaWNvbj17VUtJY29uLkNoZXZyb25MZWZ0fVxuICAgICAgICAgIGNsYXNzTmFtZT17c3R5bGVzLnBhZ2VDb250cm9sfVxuICAgICAgICAgIG9uQ2xpY2s9eygpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHNjcm9sbEVsZW1lbnQgPSBzY3JvbGxSZWYuY3VycmVudDtcblxuICAgICAgICAgICAgaWYgKCFzY3JvbGxFbGVtZW50KSB7XG4gICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgY2Fyb3VzZWxUYXJnZXRQYWdlID0gc2Nyb2xsRWxlbWVudC5jaGlsZHJlbltjdXJyZW50UGFnZSAtIDFdIGFzIEhUTUxEaXZFbGVtZW50O1xuXG4gICAgICAgICAgICBpZiAoIWNhcm91c2VsVGFyZ2V0UGFnZSkge1xuICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNhcm91c2VsVGFyZ2V0UGFnZS5zY3JvbGxJbnRvVmlldyh7IGJlaGF2aW9yOiBcInNtb290aFwiIH0pO1xuICAgICAgICAgIH19XG4gICAgICAgIC8+XG4gICAgICAgIDxDYXJkIGNsYXNzTmFtZT17c3R5bGVzLmluZGljYXRvcn0+XG4gICAgICAgICAge2l0ZW1zLm1hcCgocGFnZSwgaW5kZXgpID0+IHtcbiAgICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICAgIDxidXR0b25cbiAgICAgICAgICAgICAgICBrZXk9e3BhZ2UuaWR9XG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lPXtjbGlwcHkoc3R5bGVzLnBhZ2VJbmRpY2F0b3IsIGluZGV4ID09PSBjdXJyZW50UGFnZSAmJiBzdHlsZXMuc2VsZWN0ZWQpfVxuICAgICAgICAgICAgICAgIG9uQ2xpY2s9eygpID0+IHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IHNjcm9sbEVsZW1lbnQgPSBzY3JvbGxSZWYuY3VycmVudDtcblxuICAgICAgICAgICAgICAgICAgaWYgKCFzY3JvbGxFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgc2Nyb2xsRWxlbWVudC5zY3JvbGxJbnRvVmlldyh7IGJlaGF2aW9yOiBcInNtb290aFwiIH0pO1xuXG4gICAgICAgICAgICAgICAgICBjb25zdCBjYXJvdXNlbFRhcmdldFBhZ2UgPSBzY3JvbGxFbGVtZW50LmNoaWxkcmVuW2luZGV4XSBhcyBIVE1MRGl2RWxlbWVudDtcblxuICAgICAgICAgICAgICAgICAgY2Fyb3VzZWxUYXJnZXRQYWdlLnNjcm9sbEludG9WaWV3KHsgYmVoYXZpb3I6IFwic21vb3RoXCIgfSk7XG4gICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfSl9XG4gICAgICAgIDwvQ2FyZD5cbiAgICAgICAgPEljb25CdXR0b25cbiAgICAgICAgICBhY2Nlc3NpYmxlTGFiZWw9e1wibmV4dCBwYWdlXCJ9XG4gICAgICAgICAgaWNvbj17VUtJY29uLkNoZXZyb25SaWdodH1cbiAgICAgICAgICBjbGFzc05hbWU9e3N0eWxlcy5wYWdlQ29udHJvbH1cbiAgICAgICAgICBvbkNsaWNrPXsoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzY3JvbGxFbGVtZW50ID0gc2Nyb2xsUmVmLmN1cnJlbnQ7XG5cbiAgIC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gICAgICAgICAgICBzZXRDdXJyZW50UGFnZShjdXJyZW50UGFnZSAtIDEpO1xyXG4gICAgICAgICAgICB9fVxyXG4gICAgICAgICAgLz5cclxuICAgICAgICApfVxyXG4gICAgICAgIDxJbWFnZVxyXG4gICAgICAgICAgY2xhc3NOYW1lPXtzdHlsZXMuaGVhZGVySW1hZ2V9XHJcbiAgICAgICAgICBzcmM9e3BhZ2UuaGVhZGVySW1hZ2V9XHJcbiAgICAgICAgICBhY2Nlc3NpYmxlTGFiZWw9XCJcIlxyXG4gICAgICAgIC8+XHJcbiAgICAgICAgPEhlYWRpbmdcclxuICAgICAgICAgIGNsYXNzTmFtZT17c3R5bGVzLmhlYWRlcn1cclxuICAgICAgICAgIHRleHQ9e3BhZ2UuaGVhZGVyfVxyXG4gICAgICAgIC8+XHJcbiAgICAgICAgPFRleHRcclxuICAgICAgICAgIGNsYXNzTmFtZT17c3R5bGVzLmJvZHl9XHJcbiAgICAgICAgICB0ZXh0PXtwYWdlLmJvZHl9XHJcbiAgICAgICAgLz5cclxuICAgICAgICA8RmxleFxyXG4gICAgICAgICAgY2xhc3NOYW1lPXtzdHlsZXMuYWN0aW9uc31cclxuICAgICAgICAgIGRpcmVjdGlvbj1cInJvd1wiXHJcbiAgICAgICAgPlxyXG4gICAgICAgICAge3BhZ2UuYWN0aW9ucy5tYXAoKGFjdGlvbikgPT4ge1xyXG4gICAgICAgICAgICBpZiAoYWN0aW9uLmljb24pIHtcclxuICAgICAgICAgICAgICByZXR1cm4gKFxyXG4gICAgICAgICAgICAgICAgPD5cclxuICAgICAgICAgICAgICAgICAgPEJ1dHRvbldpdGhJY29uXHJcbiAgICAgICAgICAgICAgICAgICAga2V5PXthY3Rpb24ubGFiZWx9XHJcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lPXtjbGlwcHkoc3R5bGVzLmFjdGlvbiwgc3R5bGVzLmFjdGlvbldpdGhJY29uLCBcImFuaW1hdGVfX2FuaW1hdGVkIGFuaW1hdGVfX2ZhZGVJblVwXCIpfVxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ9e2FjdGlvbi5sYWJlbH1cclxuICAgICAgICAgICAgICAgICAgICBpY29uPXthY3Rpb24uaWNvbn1cclxuICAgICAgICAgICAgICAgICAgICBvbkNsaWNrPXsoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICBhY3Rpb24ub25DbGljaygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgaWYgKGFjdGlvbi5jaGFuZ2VUbykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGFjdGlvbi5jaGFuZ2VUbykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJuZXh0XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRDdXJyZW50UGFnZShjdXJyZW50UGFnZSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInByZXZpb3VzXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudFBhZ2UgPiAwKSBzZXRDdXJyZW50UGFnZShjdXJyZW50UGFnZSAtIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInJlbWFpblwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImNvbXBsZXRlZFwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q3VycmVudFBhZ2UocGFnZXMubGVuZ3RoICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9fVxyXG4gICAgICAgICAgICAgICAgICAvPlxyXG4gICAgICAgICAgICAgICAgPC8+XHJcbiAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgcmV0dXJuIChcclxuICAgICAgICAgICAgICA8PlxyXG4gICAgICAgICAgICAgICAgPEJ1dHRvblxyXG4gICAgICAgICAgICAgICAgICBrZXk9e2FjdGlvbi5pY29ufVxyXG4gICAgICAgICAgICAgICAgICBjbGFzc05hbWU9e2NsaXBweShzdHlsZXMuYWN0aW9uLCBzdHlsZXMuYWN0aW9uV2l0aG91dEljb24sIFwiYW5pbWF0ZV9fYW5pbWF0ZWQgYW5pbWF0ZV9fZmFkZUluVXBcIil9XHJcbiAgICAgICAgICAgICAgICAgIHRleHQ9e2FjdGlvbi5sYWJlbH1cclxuICAgICAgICAgICAgICAgICAgb25DbGljaz17KCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbi5vbkNsaWNrKCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhY3Rpb24uY2hhbmdlVG8pIHtcclxuICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYWN0aW9uLmNoYW5nZVRvKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJuZXh0XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q3VycmVudFBhZ2UoY3VycmVudFBhZ2UgKyAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInByZXZpb3VzXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRQYWdlID4gMCkgc2V0Q3VycmVudFBhZ2UoY3VycmVudFBhZ2UgLSAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcInJlbWFpblwiOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiY29tcGxldGVkXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q3VycmVudFBhZ2UocGFnZXMubGVuZ3RoICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICB9fVxyXG4gICAgICAgICAgICAgICAgLz5cclxuICAgICAgICAgICAgICA8Lz5cclxuICAgICAgICAgICAgKTtcclxuICAgICAgICAgIH0pfVxyXG4gICAgICAgIDwvRmxleD5cclxuICAgICAgPC9DYXJkPlxyXG4gICAgPC9kaXY+XHJcbiAgKTtcclxufTtcclxuXHJcbmV4cG9ydCBkZWZhdWx0IE9uQm9hcmRpbmc7XHJcbiIsIi8qXHJcbiAqIENvcHlyaWdodCDCqTIwMjQgRXdzZ2l0PGh0dHBzOi8vZ2l0aHViLmNvbS9ld3NnaXQ+IGFuZCBZb3VyRGFzaDxodHRwczovL2dpdGh1Yi5jb20veW91cmRhc2g+IGNvbnRyaWJ1dG9ycy5cclxuICogWW91ckRhc2ggaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBMaWNlbnNlLiAoaHR0cHM6Ly9ld3NnaXQubWl0LWxpY2Vuc2Uub3JnKVxyXG4gKi9cclxuXHJcbmltcG9ydCBSZWFjdCwgeyBGQywgdXNlRWZmZWN0LCB1c2VSZWYsIHVzZVN0YXRlIH0gZ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+IHtcclxuICAgICAgICAgIGNvbnN0IHNjcmVlbldpZHRoID0gd2luZG93LmlubmVyV2lkdGg7XHJcbiAgICAgICAgICBjb25zdCBzY3JlZW5IZWlnaHQgPSB3aW5kb3cuaW5uZXJIZWlnaHQ7XHJcblxyXG4gICAgICAgICAgY29uc3QgTUVOVV9XSURUSCA9IHJlZi5jdXJyZW50Py5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS53aWR0aCB8fCAyMDA7XHJcbiAgICAgICAgICBjb25zdCBNRU5VX0hFSUdIVCA9IHJlZi5jdXJyZW50Py5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5oZWlnaHQgfHwgMjAwO1xyXG5cclxuICAgICAgICAgIGxldCByZXN1bHRYID0geDtcclxuICAgICAgICAgIGxldCByZXN1bHRZID0geTtcclxuXHJcbiAgICAgICAgICBpZiAoeCArIE1FTlVfV0lEVEggPj0gc2NyZWVuV2lkdGgpIHtcclxuICAgICAgICAgICAgcmVzdWx0WCA9IHNjcmVlbldpZHRoIC0gTUVOVV9XSURUSDtcclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICBpZiAoeSArIE1FTlVfSEVJR0hUID49IHNjcmVlbkhlaWdodCkge1xyXG4gICAgICAgICAgICByZXN1bHRZID0gc2NyZWVuSGVpZ2h0IC0gTUVOVV9IRUlHSFQ7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgc2V0UG9zaXRpb24oe1xyXG4gICAgICAgICAgICB4OiByZXN1bHRYLFxyXG4gICAgICAgICAgICB5OiByZXN1bHRZLFxyXG4gICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgc2V0SXRlbXMoaSk7XHJcbiAgICAgICAgICBzZXRWaXNpYmxlKHRydWUpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZGVzdHJveU1lbnU6ICgpID0+IHtcclxuICAgICAgICAgIHNldFZpc2libGUoZmFsc2UpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgIH19XHJcbiAgICA+XHJcbiAgICAgIDxkaXZcclxuICAgICAgICByZWY9e3JlZn1cclxuICAgICAgICBzdHlsZT17e1xyXG4gICAgICAgICAgZGlzcGxheTogdmlzaWJsZSA/IFwiZmxleFwiIDogXCJub25lXCIsXHJcbiAgICAgICAgICBsZWZ0OiBwb3NpdGlvbi54LFxyXG4gICAgICAgICAgdG9wOiBwb3NpdGlvbi55LFxyXG4gICAgICAgIH19XHJcbiAgICAgICAgY2xhc3NOYW1lPXtzdHlsZXMuY29tcG9uZW50fVxyXG4gICAgICA+XHJcbiAgICAgICAge2l0ZW1zLm1hcCgoaXRlbSkgPT4ge1xyXG4gICAgICAgICAgcmV0dXJuIChcclxuICAgICAgICAgICAgPEJ1dHRvblxyXG4gICAgICAgICAgICAgIGNsYXNzTmFtZT17c3R5bGVzLmJ1dHRvbn1cclxuICAgICAgICAgICAgICB0ZXh0PXtpdGVtLmxhYmVsfVxyXG4gICAgICAgICAgICAgIG9uQ2xpY2s9e2l0ZW0ub25DbGlja31cclxuICAgICAgICAgICAgICBrZXk9e2l0ZW0ubGFiZWx9XHJcbiAgICAgICAgICAgIC8+XHJcbiAgICAgICAgICApO1xyXG4gICAgICAgIH0pfVxyXG4gICAgICA8L2Rpdj5cclxuICAgICAge2NoaWxkcmVufVxyXG4gICAgPC9Db250ZXh0TWVudVJvb3RDb250ZXh0LlByb3ZpZGVyPlxyXG4gICk7XHJcbn07XHJcblxyXG5leHBvcnQgZGVmYXVsdCBDb250ZXh0TWVudVJvb3Q7XHJcbiIsIi8qXHJcbiAqIENvcHlyaWdodCDCqTIwMjQgQEV3c2dpdCBhbmQgWW91ckRhc2ggY29udHJpYnV0b3JzLlxyXG4gKiBZb3VyRGFzaCBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIExpY2Vuc2UuIChodHRwczovL2V3c2dpdC5taXQtbGljZW5zZS5vcmcpXHJcbiAqL1xyXG5cclxuaW1wb3J0IHsgVVVJRCB9IGZyb20gXCIuLi8uLi9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iAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgcmV0dXJuIHRvYXN0O1xuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSwgVE9BU1RfRElTUExBWV9USU1FIC0gNTAwKTtcblxuICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgIHNldFRvYXN0cygodCkgPT4gdC5maWx0ZXIoKHRvYXN0KSA9PiB0b2FzdC51dWlkICE9PSB1dWlkKSk7XG4gICAgICAgICAgICB9LCBUT0FTVF9ESVNQTEFZX1RJTUUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgIH19XG4gICAgPlxuICAgICAgPGRpdiBjbGFzc05hbWU9e3N0eWxlcy5jb250YWluZXJ9PlxuICAgICAgICB7dG9hc3RzLm1hcCgodCkgPT4ge1xuICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICA8Q2FyZFxuICAgICAgICAgICAgICBrZXk9e3QudXVpZH1cbiAgICAgICAgICAgICAgYWN0aW9ucz17XG4gICAgICAgICAgICAgICAgdC5wZXJzaXN0ID8gKFxuICAgICAgICAgICAgICAgICAgPEljb25CdXR0b25cbiAgICAgICAgICAgICAgICAgICAgYWNjZXNzaWJsZUxhYmVsPXtcIkNsb3NlIHRvYXN0c1wifVxuICAgICAgICAgICAgICAgICAgICBpY29uPXtVS0ljb24uWH1cbiAgICAgICAgICAgICAgICAgICAgb25DbGljaz17KCkgPT4gc2V0VG9hc3RzKCh0b2FzdHMpID0+IHRvYXN0cy5maWx0ZXIoKHgpID0+IHgudXVpZCAhPT0gdC51dWlkKSl9XG4gICAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICAgICkgOiBudWxsXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgY2xhc3NOYW1lPXtjbGlwcHkoc3R5bGVzLmNhcmRDb250ZW50LCB0LnR5cGUgJiYgc3R5bGVzW3QudHlwZV0pfVxuICAgICAgICAgICAgICBjb250YWluZXJDbGFzc05hbWU9e2NsaXBweShcbiAgICAgICAgICAgICAgICBzdHlsZXMuY29tcG9uZW50LFxuICAgICAgICAgICAgICAgIHQucGVyc2lzdCAmJiBzdHlsZXMucG9pbnRlckV2ZW50cyxcbiAgICAgICAgICAgICAgICB0LmFuaW1hdGluZ091dCA/IFwiYW5pbWF0ZV9fYW5pbWF0ZWQgYW5pbWF0ZV9fZmFkZU91dFJpZ2h0QmlnXCIgOiBcImFuaW1hdGVfX2FuaW1hdGVkIGFuaW1hdGVfX2ZhZGVJbkRvd25cIixcbiAgICAgICAgICAgICAgKX1cbiAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgPEhlYWRpbmdcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU9e3N0eWxlcy5oZWFkaW5nfVxuICAgICAgICAgICAgICAgIGxldmVsPXszfVxuICAgICAgICAgICAgICAgIHRleHQ9e3QuY29udGVudC50aXRsZX1cbiAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgICAgPFNlcGFyYXRvciBkaXJlY3Rpb249e1wiY29sdW1uXCJ9IC8+XG4gICAgICAgICAgICAgIDxUZXh0XG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lPXtzdHlsZXMuYm9keX1cbiAgICAgICAgICAgICAgICB0ZXh0PXt0LmNvbnRlbnQuYm9keX1cbiAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgIDwvQ2FyZD5cbiAgICAgICAgICApO1xuICAgICAgICB9KX1cbiAgICAgIDwvZGl2PlxuICAgICAge2NoaWxkcmVufVxuICAgIDwvVG9hc3RDb250ZXh0LlByb3ZpZGVyPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgVG9hc3RzO1xuIiwiLypcbiAqIENvcHlyaWdodCDCqTIwMjQgRXdzZ2l0PGh0dHBzOi8vZXdzZ2l0LnVrPiBhbmQgWW91ckRhc2g8aHR0c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XHJcbiAgICBjb25zdCBjdXJyZW50ID0gcmVmLmN1cnJlbnQ7XHJcblxyXG4gICAgY29uc3QgaGFuZGxlU2Nyb2xsID0gKCkgPT4ge1xyXG4gICAgICBjb25zdCB7IHRvcCwgYm90dG9tLCBsZWZ0LCByaWdodCB9ID0gY3VycmVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcclxuXHJcbiAgICAgIGlmICghaXNJblZpZXcuY3VycmVudCkge1xyXG4gICAgICAgIGlmICh0b3AgPCAwKSB7XHJcbiAgICAgICAgICBvbkVudGVyVmlldz8uKFwidXBcIik7XHJcbiAgICAgICAgICBpc0luVmlldy5jdXJyZW50ID0gdHJ1ZTtcclxuICAgICAgICAgIHJldHVybjtcclxuICAgICAgICB9IGVsc2UgaWYgKGJvdHRvbSA+IHdpbmRvdy5pbm5lckhlaWdodCkge1xyXG4gICAgICAgICAgb25FbnRlclZpZXc/LihcImRvd25cIik7XHJcbiAgICAgICAgICBpc0luVmlldy5jdXJyZW50ID0gdHJ1ZTtcclxuICAgICAgICAgIHJldHVybjtcclxuICAgICAgICB9IGVsc2UgaWYgKGxlZnQgPCAwKSB7XHJcbiAgICAgICAgICBvbkVudGVyVmlldz8uKFwibGVmdFwiKTtcclxuICAgICAgICAgIGlzSW5WaWV3LmN1cnJlbnQgPSB0cnVlO1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH0gZWxzZSBpZiAocmlnaHQgPiB3aW5kb3cuaW5uZXJXaWR0aCkge1xyXG4gICAgICAgICAgb25FbnRlclZpZXc/LihcInJpZ2h0XCIpO1xyXG4gICAgICAgICAgaXNJblZpZXcuY3VycmVudCA9IHRydWU7XHJcbiAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAodG9wID4gd2luZG93LmlubmVySGVpZ2h0KSB7XHJcbiAgICAgICAgb25MZWF2ZVZpZXc/LihcImRvd25cIik7XHJcbiAgICAgICAgaX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