diff --git a/README.md b/README.md index 9d68013..27115da 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Quick start ### Install - npm install mol-milo + npm install milojs or @@ -130,8 +130,8 @@ cd $MILO_FOLDER npm link cd $MY_PROJECT -rm -R -f -d node_modules/mol-milo -npm link mol-milo # link milo to your current project to use with browserify +rm -R -f -d node_modules/milojs +npm link milojs # link milo to your current project to use with browserify cd $MILO_FOLDER grunt # rebuild milo bundle every time you change any .js file @@ -208,7 +208,7 @@ __milo__ supplies internal messaging classes that can also be used for applicati Messenger instances use instances of `MessageSource` subclasses to connect to external sources and instances of `MessengerAPI` subclasses to create higher level internal messages and transform message data. This architecture allows creating an advanced functionality in just a few lines of code. -See [Messenger documentation](http://milojs.github.io/milo/messenger/index.js.html). +See [Messenger documentation](http://milojs.github.io/milo-core/messenger/index.js.html). ### Model @@ -217,7 +217,7 @@ __milo__ defines Model to allow safe access to the data without the need to worr Using Model does not require these APIs, and unlike these APIs it allows subscribing to changes on properties of your Models to any depth. -See Model [demo](https://github.com/milojs/milo/blob/master/lib/model/demo.js) and [Model documentation](http://milojs.github.io/milo/model/index.js.html). +See Model [demo](https://github.com/milojs/milo/blob/master/lib/model/demo.js) and [Model documentation](http://milojs.github.io/milo-core/model/index.js.html). ### Connector @@ -232,7 +232,7 @@ Very soon Connector instances will support structure translation allowing creati One or multiple reactive connections can be created with [milo.minder](http://milojs.github.io/milo/minder.js.html). -See [Connector documentation](http://milojs.github.io/milo/model/connector.js.html). +See [Connector documentation](http://milojs.github.io/milo-core/model/connector.js.html). ### Views and application management diff --git a/bower.json b/bower.json index 9310a46..ebfb7b9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "milojs", - "version": "0.2.4", + "version": "0.2.5", "homepage": "https://github.com/milojs/milo", "authors": [ "MOL Technical " diff --git a/lib/milo.js b/lib/milo.js index a58183b..d551f67 100644 --- a/lib/milo.js +++ b/lib/milo.js @@ -20,7 +20,7 @@ require('./use_components'); * At the moment it is not possiible to require it with browserify to have it bundled with the app because of the way [brfs](https://github.com/substack/brfs) browserify plugin is implemented. * It is possible though to require `milo` with node to use universal parts of the framework (abstract classes, Messenger, Model, etc.): * ``` - * var milo = require('mol-milo'); + * var milo = require('milojs'); * ``` * * `milo` itself is a function that in the browser can be used to delay execution until DOM is ready. @@ -63,7 +63,7 @@ _.extend(milo, { Component: require('./components/c_class'), Command: require('./command'), registry: require('./registry'), - milo_version: '0.2.4', + milo_version: '0.2.5', createComponentClass: require('./util/create_component_class'), destroy: destroy }); diff --git a/milo.bundle.js b/milo.bundle.js index f8dda62..90c0f71 100644 --- a/milo.bundle.js +++ b/milo.bundle.js @@ -9184,7 +9184,7 @@ require('./use_components'); * At the moment it is not possiible to require it with browserify to have it bundled with the app because of the way [brfs](https://github.com/substack/brfs) browserify plugin is implemented. * It is possible though to require `milo` with node to use universal parts of the framework (abstract classes, Messenger, Model, etc.): * ``` - * var milo = require('mol-milo'); + * var milo = require('milojs'); * ``` * * `milo` itself is a function that in the browser can be used to delay execution until DOM is ready. @@ -9227,7 +9227,7 @@ _.extend(milo, { Component: require('./components/c_class'), Command: require('./command'), registry: require('./registry'), - milo_version: '0.2.4', + milo_version: '0.2.5', createComponentClass: require('./util/create_component_class'), destroy: destroy }); @@ -19053,5 +19053,5 @@ function makeFindMethod(eachMethod, findWhat) { } },{}]},{},[66]) -//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9ldmdlbnlwb2JlcmV6a2luL1dvcmsvQ0MvbWlsby9saWIvYWJzdHJhY3QvZmFjZXQuanMiLCIvVXNlcnMvZXZnZW55cG9iZXJlemtpbi9Xb3JrL0NDL21pbG8vbGliL2Fic3RyYWN0L2ZhY2V0ZWRfb2JqZWN0LmpzIiwiL1VzZXJzL2V2Z2VueXBvYmVyZXpraW4vV29yay9DQy9taWxvL2xpYi9hYnN0cmFjdC9yZWdpc3RyeS5qcyIsIi9Vc2Vycy9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h0VHlwZSA9PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgIGlmIChzdWJzY3JpYmVyLmNvbnRleHQgPT0gdGhpcy5uYW1lIHx8IHN1YnNjcmliZXIuY29udGV4dCA9PSAnZmFjZXQnKVxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlcjogc3Vic2NyaWJlci5zdWJzY3JpYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpc1xuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN1YnNjcmliZXIuY29udGV4dCA9PSAnb3duZXInKVxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlcjogc3Vic2NyaWJlci5zdWJzY3JpYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpcy5vd25lclxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIHN1YnNjcmliZXIgY29udGV4dCBpbiBjb25maWd1cmF0aW9uOiAnICsgc3Vic2NyaWJlci5jb250ZXh0KTtcblxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9uKG1lc3NhZ2VzLCBzdWJzY3JpYmVyKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIHN1YnNjcmliZXIgY29udGV4dCB0eXBlIGluIGNvbmZpZ3VyYXRpb246ICcgKyBjb250ZXh0VHlwZSk7XG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3Vua25vd24gc3Vic2NyaWJlciB0eXBlIGluIGNvbmZpZ3VyYXRpb246ICcgKyBzdWJzY3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2FkZEl0ZW1zKG5ld0l0ZW1zQ291bnQpO1xuICAgICAgICAgICAgICAgICAgICBsaXN0RmFjZXQuX3VwZGF0ZURhdGFQYXRocyhsaXN0TGVuZ3RoLCBsaXN0RmFjZXQuY291bnQoKSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsdWUuZm9yRWFjaChmdW5jdGlvbihjaGlsZFZhbHVlLCBpbmRleCkge1xuICAgICAgICAgICAgICAgICAgICBzZXRDaGlsZERhdGEuY2FsbCh0aGlzLCB2YWx1ZVNldCwgY2hpbGRWYWx1ZSwgaW5kZXgsICdbJCRdJyk7XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG5cbiAgICAgICAgICAgICAgICB2YXIgbGlzdENvdW50ID0gbGlzdEZhY2V0LmNvdW50KClcbiAgICAgICAgICAgICAgICAgICAgLCByZW1vdmVDb3VudCA9IGxpc3RDb3VudCAtIHZhbHVlLmxlbmd0aDtcblxuICAgICAgICAgICAgICAgIHdoaWxlIChyZW1vdmVDb3VudC0tID4gMClcbiAgICAgICAgICAgICAgICAgICAgbGlzdEZhY2V0Ll9yZW1vdmVJdGVtKHZhbHVlLmxlbmd0aCk7XG4gICAgICAgICAgICB9IGVsc2VcbiAgICAgICAgICAgICAgICBsb2dnZXIud2FybignRGF0YTogc2V0dGluZyBhcnJheSBkYXRhIHdpdGhvdXQgTGlzdCBmYWNldCcpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsdWVTZXQgPSB7fTtcbiAgICAgICAgICAgIF8uZWFjaEtleSh2YWx1ZSwgZnVuY3Rpb24oY2hpbGRWYWx1ZSwga2V5KSB7XG4gICAgICAgICAgICAgICAgc2V0Q2hpbGREYXRhLmNhbGwodGhpcywgdmFsdWVTZXQsIGNoaWxkVmFsdWUsIGtleSwgJy4kJCcpO1xuICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgIH1cbiAgICB9IGVsc2VcbiAgICAgICAgdmFsd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m91bmQgPSBmYWxzZTtcblxuICAgIHdoaWxlIChuZXh0Tm9kZSkge1xuICAgICAgICB2YXIgYXR0ciA9IG5ldyBCaW5kQXR0cmlidXRlKG5leHROb2RlKTtcbiAgICAgICAgaWYgKGF0dHIubm9kZSkge1xuICAgICAgICAgICAgYXR0ci5wYXJzZSgpLnZhbGlkYXRlKCk7XG4gICAgICAgICAgICBpZiAoc2NvcGUuaGFzT3duUHJvcGVydHkoYXR0ci5jb21wTmFtZSkpIHtcbiAgICAgICAgICAgICAgICB2YXIgY29tcG9uZW50ID0gc2NvcGVbYXR0ci5jb21wTmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKCEgaXRlcmF0b3IgfHwgaXRlcmF0b3IoY29tcG9uZW50KSkge1xuICAgICAgICAgICAgICAgICAgICBmb3VuZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0cmVlV2Fsa2VyLmN1cnJlbnROb2RlID0gbmV4dE5vZGU7XG4gICAgICAgIG5leHROb2RlID0gdHJlZVdhbGtlcltmaW5kRGlyZWN0aW9uc1tkaXJlY3Rpb25dXSgpO1xuICAgIH1cblxuICAgIGlmIChmb3VuZCkgcmV0dXJuIGNvbXBvbmVudDtcbn1cblxuXG4vLyByZXR1cm5zIHRydWUgaWYgdGhlIGVsZW1lbnQgaGFzIHRleHQgYmVmb3JlIHNlbGVjdGlvblxuZnVuY3Rpb24gaGFzVGV4dEJlZm9yZVNlbGVjdGlvbigpIHtcbiAgICB2YXIgc2VsZWN0aW9uID0gd2luZG93LmdldFNlbGVjdGlvbigpO1xuICAgIGlmICghIHNlbGVjdGlvbi5pc0NvbGxhcHNlZCkgcmV0dXJuIHRydWU7XG4gICAgXG4gICAgdmFyIHRleHQgPSBzZWxlY3Rpb24uZm9jdXNOb2RlICYmIHNlbGVjdGlvbi5mb2N1c05vZGUudGV4dENvbnRlb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VkKGR0LCBvcmlnaW5hbERyb3BDb21wb25lbnQpIHtcbiAgICB2YXIgYWxsb3cgPSB0aGlzLmNvbmZpZy5hbGxvdztcblxuICAgIGlmIChkdC5pc0NvbXBvbmVudCgpKSB7XG4gICAgICAgIHZhciBhbGxvd0NvbXBzID0gYWxsb3cgJiYgYWxsb3cuY29tcG9uZW50c1xuICAgICAgICAgICAgLCBtZXRhID0gZHQuZ2V0Q29tcG9uZW50TWV0YSgpO1xuXG4gICAgICAgIHN3aXRjaCAodHlwZW9mIGFsbG93Q29tcHMpIHtcbiAgICAgICAgICAgIGNhc2UgJ3VuZGVmaW5lZCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWxsb3dDb21wcztcbiAgICAgICAgICAgIC8vIGNvbXBvbmVudCBjbGFzc1xuICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gbWV0YSAmJiBtZXRhLmNvbXBDbGFzcyA9PSBhbGxvd0NvbXBzO1xuICAgICAgICAgICAgLy8gdGVzdCBmdW5jdGlvblxuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBhbGxvd0NvbXBzLmNhbGwodGhpcy5vd25lciwgbWV0YSwgZHQsIG9yaWdpbmFsRHJvcENvbXBvbmVudCk7XG4gICAgICAgICAgICBjYXNlICdvYmplY3QnOlxuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGFsbG93Q29tcHMpKVxuICAgICAgICAgICAgICAgICAgICAvLyBsaXN0IG9mIGFsbG93ZWQgY2xhc3Nlc1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWxsb3dDb21wcy5pbmRleE9mKG1ldGEgJiYgbWV0YS5jb21wQ2xhc3MpID49IDA7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1hcCBvZiBjbGFzczogYm9vbGVhbnx0ZXN0IGZ1bmN0aW9uXG4gICAgICAgICAgICAgICAgICAgIHZhciB0ZXN0ID0gYWxsb3dDb21wc1ttZXRhICYmIG1ldGEuY29tcENsYXNzXTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhIF8ucmVzdWx0KHRlc3QsIHRoaXMub3duZXIsIG1ldGEsIGR0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSW5jb3JyZWN0IGFsbG93ZWQgY29tcG9uZW50cyBpbiBjb25maWcnKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIHZhciBkYXRhVHlwZXMgPSBhbGxvdyAmJiBhbGxvdy5kYXRhVHlwZXNcbiAgICAgICAgc3dpdGNoICh0eXBlb2YgZGF0YVR5cGVzKSB7XG4gICAgICAgICAgICBjYXNlICd1bmRlZmluZWQnOlxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIGNhc2UgJ3N0cmluZyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIGR0LnR5cGVzLmluZGV4T2YoZGF0YVR5cGVzKSA+PSAwO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gVE9ETyB0ZXN0IGZvciBvdGhlciBkYXRhIHR5cGVzXG59XG4iLCIndXNlIHN0cmljdCc7XG5cbnZhciBDb21wb25lbnRGYWNldCA9IHJlcXVpcmUoJy4uL2NfZmFjZXQnKVxuICAgICwgZmFjZXRzUmVnaXN0cnkgPSByZXF1aXJlKCcuL2NmX3JlZ2lzdHJ5JylcbiAgICAsIG1pbG9Db3JlID0gcmVxdWlyZSgnbWlsby1jb3JlJylcbiAgICAsIE1lc3NlbmdlciA9IG1pbG9Db3JlLk1lc3NlbmdlclxuICAgICwgRE9NRXZlbnRzU291cmNlID0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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBsaXN0TGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogaW5kZXg7XG5cbiAgICAgICAgdmFyIHByZXZDb21wb25lbnQgPSBzcGxpY2VJbmRleCA9PSAwXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdGhpcy5pdGVtU2FtcGxlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdGhpcy5fbGlzdEl0ZW1zW3NwbGljZUluZGV4IC0gMV07XG5cbiAgICAgICAgdmFyIGZyYWcgPSBkb2N1bWVudC5jcmVhdGVEb2N1bWVudEZyYWdtZW50KClcbiAgICAgICAgICAgICwgbmV3Q29tcG9uZW50cyA9IFtdO1xuXG4gICAgICAgIGNoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24oZWwsIGkpIHtcbiAgICAgICAgICAgIHZhciBjb21wb25lbnQgPSBDb21wb25lbnQuZ2V0Q29tcG9uZW50KGVsKTtcbiAgICAgICAgICAgIGlmICghIGNvbXBvbmVudClcbiAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyLmVycm9yKCdMaXN0OiBlbGVtZW50IGluIG5ldyBpdGVtcyBpcyBub3QgYSBjb21wb25lbnQnKTtcbiAgICAgICAgICAgIG5ld0NvbXBvbmVudHMucHVzaChjb21wb25lbnQpO1xuICAgICAgICAgICAgdGhpcy5fc2V0SXRlbShzcGxpY2VJbmRleCsrLCBjb21wb25lbnQpO1xuICAgICAgICAgICAgZnJhZy5hcHBlbmRDaGlsZChlbCk7XG4gICAgICAgICAgICBlbC5zdHlsZS5kaXNwbGF5ID0gJyc7XG4gICAgICAgIH0sIHRoaXMpO1xuXG4gICAgICAgIF91cGRhdGVJdGVtc0luZGV4ZXMuY2FsbCh0aGlzLCBzcGxpY2VJbmRleCk7XG5cbiAgICAgICAgaWYgKCFwcmV2Q29tcG9uZW50LmVsLnBhcmVudE5vZGUpXG4gICAgICAgICAgICBy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gICAgICAgICAgICB7e34gaXQuZGF0YS5pdGVtcyA6aXRlbTppbmRleCB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3sgdmFyIGhhc1N1YlRyZWUgPSBpdGVtLml0ZW1zICYmIGl0ZW0uaXRlbXMubGVuZ3RoOyB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPGxpIHt7PyBoYXNTdWJUcmVlIH19Y2xhc3M9XCJtbC11aS1mb2xkdHJlZS0taGFzLW11bHRpcGxlXCJ7ez99fT5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwibWwtdWktZm9sZHRyZWUtaXRlbVwiPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez8gaGFzU3ViVHJlZSB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cIm1sLXVpLWZvbGR0cmVlLWJ1dHRvblwiPjwvZGl2PlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez99fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez0gaXQuaXRlbVRlbXBsYXRlKHsgaXRlbTogaXRlbSwgaWQ6IGl0Lml0ZW1JRHNbaW5kZXhdIH0pIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/IGhhc1N1YlRyZWUgfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s9IGl0LnRyZWVUZW1wbGF0ZShpdGVtKSB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7P319XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2xpPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICB7e359fVxcXG4gICAgICAgICAgICAgICAgICAgIDwvd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dGVtcGxhdGU6ICdcXFxuICAgICAgICAgICAgPGRpdiBjbGFzcz1cIm1vZGFsLWRpYWxvZyB7ez0gaXQuY3NzQ2xhc3MgfX1cIj5cXFxuICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJtb2RhbC1jb250ZW50XCI+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/IGl0LnRpdGxlIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJtb2RhbC1oZWFkZXJcIj5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7PyBpdC5jbG9zZS5idXR0b24gfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIG1sLWJpbmQ9XCJbZXZlbnRzXTpjbG9zZUJ0blwiIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImNsb3NlXCI+JnRpbWVzOzwvYnV0dG9uPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxoNCBjbGFzcz1cIm1vZGFsLXRpdGxlXCI+e3s9IGl0LnRpdGxlIH19PC9oND5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICB7ez8gaXQuaHRtbCB8fCBpdC50ZXh0IH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJtb2RhbC1ib2R5XCIgbWwtYmluZD1cIltjb250YWluZXJdOmRpYWxvZ0JvZHlcIj5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7PyBpdC5odG1sIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s9IGl0Lmh0bWwgfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7Pz99fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwPnt7PSBpdC50ZXh0IH19PC9wPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICB7ez8gaXQuYnV0dG9ucyAmJiBpdC5idXR0b25zLmxlbmd0aCB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwibW9kYWwtZm9vdGVyXCI+XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7e34gaXQuYnV0dG9ucyA6YnRuIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCJcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3M9XCJidG4gYnRuLXt7PSBidG4udHlwZSB9fXt7PyBidG4uY2xzIH19IHt7PSBidG4uY2xzIH19e3s/fX1cIlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtbC1iaW5kPVwiW2V2ZW50c106e3s9IGJ0bi5uYW1lIH19XCI+e3s9IGJ0bi5sYWJlbCB9fTwvYnV0dG9uPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3t+fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgIDwvZGl2PlxcXG4gICAgICAgICAgICA8L2Rpdj4nXG4gICAgfVxufSk7XG5cbmNvbXBvbmVudHNSZWdpc3RyeS5hZGQoTUxEaWFsb2cpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE1MRGlhbG9nO1xuXG5cbl8uZXh0ZW5kKE1MRGlhbG9nLCB7XG4gICAgY3JlYXRlRGlhbG9nOiBNTERpYWxvZyQkY3JlYXRlRGlhbG9nLFxuICAgI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vcDoge1xuICAgICAgICBkYXRhVHlwZXM6IHtcbiAgICAgICAgICAgIGNvbXBvbmVudDogJ3gtYXBwbGljYXRpb24vbWlsby9jb21wb25lbnQnLFxuICAgICAgICAgICAgY29tcG9uZW50TWV0YVRlbXBsYXRlOiAneC1hcHBsaWNhdGlvbi9taWxvL2NvbXBvbmVudC1tZXRhLyVjbGFzcy8lbmFtZS8lcGFyYW1zJyxcbiAgICAgICAgICAgIGNvbXBvbmVudE1ldGFSZWdleDogL154XFwtYXBwbGljYXRpb25cXC9taWxvXFwvY29tcG9uZW50XFwtbWV0YVxcLyhbYS16MC05XSspXFwvKFthLXowLTldKylcXC8oW2EtejAtOV0qKSQvLFxuICAgICAgICB9XG4gICAgfSxcbiAgICByZXF1ZXN0OiB7XG4gICAgICAgIGpzb25wVGltZW91dDogNjAwMDAsXG4gICAgICAgIGpzb25wQ2FsbGJhY2tQcmVmaXg6ICdfX19taWxvX2NhbGxiYWNrXycsXG4gICAgICAgIG9wdGlvbnNLZXk6ICdfX19taWxvX29wdGlvbnMnLFxuICAgICAgICBkZWZhdWx0czoge1xuICAgICAgICAgICAgdGltZW91dDogNjAwMDBcbiAgICAgICAgfVxuICAgIH0sXG4gICAgd2Vic29ja2V0OiB7XG4gICAgICAgIHJwYzoge1xuICAgICAgICAgICAgdGltZW91dDogMTUwMDAsXG4gICAgICAgICAgICByZXNwb25zZVByZWZpeDogJ3Jlc3BvbnNlXydcbiAgICAgICAgfVxuICAgIH0sXG4gICAgZGVwcmVjYXRpb25XYXJuaW5nOiAnb25jZSdcbn0pO1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG5cbnZhciBtaWxvTWFpbCA9IHJlcXVpcmUoJy4vc2VydmljZXMvbWFpbCcpXG4gICAgLCByZXF1ZXN0ID0gcmVxdWlyZSgnLi91dGlsL3JlcXVlc3QnKVxuICAgICwgbWlsb0NvcmUgPSByZXF1aXJlKCdtaWxvLWNvcmUnKVxuICAgICwgbG9nZ2VyID0gbWlsb0Nv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ICdmaW5pc2hlZCcsXG4gICAgICAgICAgICB2aWV3czogdmlld3NcbiAgICAgICAgfSk7XG4gICAgICAgIGNhbGxiYWNrKHZpZXdzKTtcbiAgICB9KTtcbn1cblxuXG5mdW5jdGlvbiBfbG9hZFZpZXdzSW5FbGVtZW50KHJvb3RFbCwgcmVtb3ZlQXR0cmlidXRlLCBjYWxsYmFjaykge1xuICAgIHZhciBsb2FkRWxlbWVudHMgPSByb290RWwuZ2V0QXR0cmlidXRlKGNvbmZpZy5hdHRycy5sb2FkKVxuICAgICAgICAgICAgICAgICAgICAgICAgPyBbcm9vdEVsXVxuICAgICAgICAgICAgICAgICAgICAgICAgOiByb290RWwucXVlcnlTZWxlY3RvckFsbCgnWycgKyBjb25maWcuYXR0cnMubG9hZCArICddJyk7XG5cbiAgICB2YXIgdmlld3MgPSB7fVxuICAgICAgICAsIHRvdGFsQ291bnQgPSBsb2FkRWxlbWVudHMubGVuZ3RoXG4gICAgICAgICwgbG9hZGVkQ291bnQgPSAwO1xuXG4gICAgXy5mb3JFYWNoKGxvYWRFbGVtZW50cywgZnVuY3Rpb24gKGVsKSB7XG4gICAgICAgIGxvYWRWaWV3KGVsLCByZW1vdmVBdHRyaWJ1dGUsIGZ1bmN0aW9uKGVycikge1xuICAgICAgICAgICAgdmlld3NbZWwuaWRdID0gZXJyIHx8IGVsO1xuICAgICAgICAgICAgbG9hZGVkQ291bnQrKztcbiAgICAgICAgICAgIGlmIChsb2FkZWRDb3VudCA9PSB0b3RhbENvdW50KVxuICAgICAgICAgICAgICAgIGNhbGxiYWNrKHZpZXdzKTtcbiAgICAgICAgfSk7XG4gICAgfSk7XG59O1xuXG5cbmZ1bmN0aW9uIGxvYWRWaWV3KGVsLCByZW1vdmVBdHRyaWJ1dGUsIGNhbGxiYWNrKSB7XG4gICAgaWYgKHV0aWxEb20uY2hpbGRyZW4oZWwpLmxlbmd0aClcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjYW5cXCd0IGxvYWQgaHR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gICAgICAgICAgICAgICAgICAucmVwbGFjZSgnJWNsYXNzJywgX2VuY29kZShtZXRhLmNvbXBDbGFzcyB8fCAnJykpXG4gICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKCclbmFtZScsIF9lbmNvZGUobWV0YS5jb21wTmFtZSB8fCAnJykpXG4gICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKCclcGFyYW1zJywgX2VuY29kZShwYXJhbXNTdHIgfHwgJycpKTtcblxuICAgIGlmIChkYXRhICYmIHR5cGVvZiBkYXRhID09ICdvYmplY3QnKSBkYXRhID0gSlNPTi5zdHJpbmdpZnkoZGF0YSk7XG5cbiAgICB0aGlzLmRhdGFUcmFuc2Zlci5zZXREYXRhKGRhdGFUeXBlLCBkYXRhIHx8ICcnKTtcblxuICAgIHJldHVybiBkYXRhVHlwZTtcbn1cblxuXG5mdW5jdGlvbiBfZW5jb2RlKHN0cikge1xuICAgIHJldHVybiBiYXNlMzIuZW5jb2RlKHN0cikudG9Mb3dlckNhc2UoKTtcbn1cblxuXG5mdW5jdGlvbiBfY29tcG9uZW50TWV0YShjb21wb25lbnQpIHtcbiAgICByZXR1cm4gY29tcG9uZW50LnRyYW5zZmVyXG4gICAgICAgICAgICA/IGNvbXBvbmVudC50cmFuc2Zlci5nZXRDb21wb25lbnRNZXRhKClcbiAgICAgICAgICAgIDogeyBcbiAgICAgICAgICAgICAgICBjb21wQ2xhc3M6IGNvbXBvbmVudC5jb25zdHJ1Y3Rvci5uYW1lLFxuICAgICAgICAgICAgICAgIGNvbXBOYW1lOiBjb21wb25lbnQubmFtZVxuICAgICAgICAgICAgfTtcbn1cblxuXG5mdW5jdGlvbiBEcmFnRHJvcCRnZXRDb21wb25lbnRNZXRhKCkge1xuICAgIHZhciBtYXRjaDtcbiAgICB2YXIgbWV0YURhdGFUeXBlID0gXy5maW5kKHRoaXMudHlwZXMsIGZ1bmN0aW9uIChkVHlwZSkge1xuICAgICAgICBtYXRjaCA9IGRUeXBlLm1hdGNoK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iaXRzIHw9IChieXRlID4+ICgtc2tpcCkpXG4gICAgICAgIH0gZWxzZSB7IC8vIG5vIGNhcnJ5XG4gICAgICAgICAgICBiaXRzID0gKGJ5dGUgPDwgc2tpcCkgJiAyNDhcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChza2lwID4gMykge1xuICAgICAgICAgICAgLy8gbm90IGVub3VnaCBkYXRhIHRvIHByb2R1Y2UgYSBjaGFyYWN0ZXIsIGdldCB1cyBhbm90aGVyIG9uZVxuICAgICAgICAgICAgc2tpcCAtPSA4XG4gICAgICAgICAgICByZXR1cm4gMVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHNraXAgPCA0KSB7XG4gICAgICAgICAgICAvLyBwcm9kdWNlIGEgY2hhcmFjdGVyXG4gICAgICAgICAgICB0aGlzLm91dHB1dCArPSBhbHBoYWJldFtiaXRzID4+IDNdXG4gICAgICAgICAgICBza2lwICs9IDVcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiAwXG4gICAgfVxuXG4gICAgLy8gRmx1c2ggYW55IHJlbWFpbmluZyBiaXRzIGxlZnQgaW4gdGhlIHN0cmVhbVxuICAgIHRoaXMuZmluaXNoID0gZnVuY3Rpb24oY2hlY2spIHtcbiAgICAgICAgdmFyIG91dHB1dCA9IHRoaXMub3V0cHV0ICsgKHNraXAgPCAwID8gYWxwaGFiZXRbYml0cyA+PiAzXSA6ICcnKSArIChjaGVjayA/ICckJyA6ICcnKVxuICAgICAgICB0aGlzLm91dHB1dCA9ICcnXG4gICAgICAgIHJldHVybiBvdXRwdXRcbiAgICB9XG59XG5cbi8qKlxuICogUHJvY2VzcyBhZGRpdGlvbmFsIGlucHV0XG4gKlxuICogaW5wdXQ6IHN0cmluZyBvZiBieXRlcyB0byBjb252ZXJ0XG4gKiBmbHVzaDogYm9vbGVhbiwgc2hvdWxkIHdlIGZsdXNoIGFueSB0cmFpbGluZyBiaXRzIGxlZnRcbiAqICAgICAgICBpbiB0aGUgc3RyZWFtXG4g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VQYXRoKTtcblxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGFyZ2V0UGF0aCA9PSAndW5kZWZpbmVkJykgcmV0dXJuO1xuXG4gICAgICAgICAgICAgICAgdmFyIGNoYW5nZSA9IF8uY2xvbmUoY2hhbmdlKTtcbiAgICAgICAgICAgICAgICBfLmV4dGVuZChjaGFuZ2UsIHtcbiAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmcm9tRFMsXG4gICAgICAgICAgICAgICAgICAgIHBhdGg6IHRhcmdldFBhdGhcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIHRyYW5zbGF0ZURhdGEoc291cmNlUGF0aCwgY2hhbmdlKTtcbiAgICAgICAgICAgICAgICB2YWxpZGF0ZURhdGEoc291cmNlUGF0aCwgY2hhbmdlKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpZiAoISBjaGFuZ2VzUXVldWUubGVuZ3RoKVxuICAgICAgICAgICAgICAgIF8uZGVmZXIocG9zdENoYW5nZURhdGEpO1xuXG4gICAgICAgICAgICBjaGFuZ2VzUXVldWUucHVzaChzZW5kRGF0YSk7XG5cblxuICAgICAgICAgICAgZnVuY3Rpb24gdHJhbnNsYXRlUGF0aChzb3VyY2VQYXRoKSB7XG4gICAgICAgICAgICAgICAgaWYgKHBhdGhUcmFuc2xhdGlvbikge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdHJhbnNsYXRlZFBhdGggPSBwYXRoVHJhbnNsYXRpb25bc291cmNlUGF0aF07XG4gICAgICAgICAgICAgICAgICAgIGlmICh0cmFuc2xhdGVkUGF0aCkgcmV0dXJuIHRyYW5zbGF0ZWRQYXRoO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXBhdHRlcm5UcmFuc2xhdGlvbi5sZW5ndGgpIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHB0ID0gXy5maW5kKHBhdHRlcm5UcmFuc2xhdGlvbiwgZnVuY3Rpb24ocFRyYW5zbGF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcFRyYW5zbGF0aW9uLmZyb21QYXR0ZXJuLnRlc3Qoc291cmNlUGF0aCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXB0KSByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIHZhciB0cmFuc2xhdGVkUGF0aCA9IHNvdXJjZVBhdGgucmVwbGFjZShwdC5mcm9tU3RhdGljUGF0aCwgcHQudG9TdGF0aWNQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCEgKChzdWJzY3JpcHRpb25QYXR0ZXJuIGluc3RhbmNlb2YgUmVnRXhwXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBzdWJzY3JpcHRpb25QYXR0ZXJuLnRlc3Qoc291cmNlUGF0aCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBzdWJzY3JpcHRpb25QYXR0ZXJuID09IHNvdXJjZVBhdGgpKSByZXR1cm47XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNsYXRlZFBhdGggfHwgc291cmNlUGF0aDtcbiAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICBmdW5jdGlvbiB0cmFuc2xhdGVEYXRhKHNvdXJjZVBhdGgsIGNoYW5nZSkge1xuICAgICAgICAgICAgICAgIGlmIChkYXRhVHJhbnNsYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRyYW5zbGF0ZSA9IGRhdGFUcmFuc2xhdGlvbltzb3VyY2VQYXRoXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRyYW5zbGF0ZSAmJiB0eXBlb2YgdHJhbnNsYXRlID09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZS5vbGRWYWx1ZSA9IHRyYW5zbGF0ZShjaGFuZ2Uub2xkVmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlLm5ld1ZhbHVlID0gdHJhbnNsYXRlKGNoYW5nZS5uZXdWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICBcbiAgICAgICAgICAgIGZ1bmN0aW9uIHZhbGlkYXRlRGF0YShzb3VyY2VQYXRoLCBjaGFuZ2UpIHtcbiAgICAgICAgICAgICAgICBwcm9wYWdhdGVEYXRhKGNoYW5nZSk7XG5cbiAgICAgICAgICAgICAgICBpZiAoZGF0YVZhbGlkYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHZhbGlkYXRvcnMgPSBkYXRhVmFsaWRhdGlvbltzb3VyY2VQYXRoXVxuICAgICAgICAgICAgICAgICAgICAgICAgLCBwYXNzZWRDb3VudCA9IDBcbiAgICAgICAgICAgICAgICAgICAgICAgICwgYWxyZWFkeUZhaWxlZCA9IGZhbHNlO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZGF0b3JzKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdG9ycy5mb3JFYWNoKGNhbGxWYWxpZGF0b3IpOyAgIFxuICAgICAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gY2FsbFZhbGlkYXRvcih2YWxpZGF0b3IpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdG9yKGNoYW5nZS5uZXdWYWx1ZSwgZnVuY3Rpb24oZXJyLCByZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UucGF0aCA9IHNvdXJjZVBhdGg7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoISBhbHJlYWR5RmFpbGVkICYmIChlcnIgfHwgcmVzcG9uc2UudmFsaWQpICYmICsrcGFzc2VkQ291bnQgPT0gdmFsaWRhdG9ycy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tRFMucG9zdE1lc3NhZ2UoJ3ZhbGlkYXRlZCcsIHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoISByZXNwb25zZS52YWxpZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFscmVhZHlGYWlsZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21EUy5wb3N0TWVzc2FnZSgndmFsaWRhdGVkJywgcmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgZnVuY3Rpb24gcHJvcGFnYXRlRGF0YShjaGFuZ2UpIHtcbiAgICAgICAgICAgICAgICBzZW5kRGF0YS5jaGFuZ2VzLnB1c2goY2hhbmdlKTtcbiAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICBmdW5jdGlvbiBwb3N0Q2hhbmdlRGF0YSgpIHtcbiAgICAgICAgICAgICAgICAvLyBwcmV2ZW50IGVuZGxlc3MgbG9vcCBvZiB1cGRhdGVzIGZvciAyLXdheSBjb25uZWN0aW9uXG4gICAgICAgICAgICAgICAgaWYgKHNlbGZbcmV2ZXJzZUxpbmtdKSB2YXIgY2FsbGJhY2sgPSBzdWJzY3JpcHRpb25Td2l0Y2g7XG5cbiAgICAgICAgICAgICAgICB2YXIgdHJhbnNhY3Rpb25zID0gbWVyZ2VUcmFuc2FjdGlvbnMoY2hhbmdlc1F1ZXVlKTtcbiAgICAgICAgICAgICAgICBjaGFuZ2VzUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgICAgICAgICB0cmFuc2FjdGlvbnMuZm9yRWFjaChmdW5jdGlvbih0cmFuc2FjdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAvLyBzZW5kIGRhdGEgY2h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W5lZDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEgYmF0Y2guY2hhbmdlcy5sZW5ndGgpIHJldHVybjtcblxuICAgICAgICAgICAgICAgICAgICBpZiAoYmF0Y2gudHJhbnNhY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50VHJhbnNhY3Rpb24pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5hcHBlbmRBcnJheShjdXJyZW50VHJhbnNhY3Rpb24sIGJhdGNoLmNoYW5nZXMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudFRyYW5zYWN0aW9uID0gXy5jbG9uZShiYXRjaC5jaGFuZ2VzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2FjdGlvbnMucHVzaChjdXJyZW50VHJhbnNhY3Rpb24pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zYWN0aW9ucy5wdXNoKGJhdGNoLmNoYW5nZXMpO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRyYW5zYWN0aW9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuXG4vKipcbiAqIHR1cm5PZmZcbiAqIE1ldGhvZCBvZiBDb25uZWN0b3IgdGhhdCBkaXNhYmxlcyBjb25uZWN0aW9uIChpZiBpdCB3YXMgcHJldmlvdXNseSBlbmFibGVkKVxuICovXG5mdW5jdGlvbiBDb25uZWN0b3IkdHVybk9mZigpIHtcbiAgICBpZiAoISB0aGlzLmlzT24pXG4gICAgICAgIHJldHVybiBsb2dnZXIud2FybignZGF0YSBzb3VyY2VzIGFyZSBhbHJlYWR5IGRpc2Nvbm5lY3RlZCcpO1xuXG4gICAgdmFyIHNlb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gICAgICAgICAgXS5qb2luKCd8JylcbiAgICAsIHBhdGhQYXJzZVBhdHRlcm4gPSBuZXcgUmVnRXhwKHBhdGhQYXJzZVN5bnRheCwgJ2cnKVxuXG4gICAgLCBwYXR0ZXJuUGF0aFBhcnNlU3ludGF4ID0gIFtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhQYXJzZVN5bnRheCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5U3RhclN5bnRheCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5U3RhclN5bnRheCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJTeW50YXhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCd8JylcbiAgICAsIHBhdHRlcm5QYXRoUGFyc2VQYXR0ZXJuID0gbmV3IFJlZ0V4cChwYXR0ZXJuUGF0aFBhcnNlU3ludGF4LCAnZycpXG5cbiAgICAvLywgdGFyZ2V0UGF0aFBhcnNlUGF0dGVybiA9IC9cXC5bQS1aYS16XVtBLVphLXowLTlfXSp8XFxbWzAtOV0rXFxdfFxcLlxcJFsxLTldWzAtOV0qfFxcW1xcJFsxLTldWzAtOV0qXFxdfFxcJFsxLTldWzAtOV0vZ1xuICAgICwgcGF0aE5vZGVUeXBlcyA9IHtcbiAgICAgICAgJy4nOiB7IHN5bnRheDogJ29iamVjdCcsIGVtcHR5OiAne30nIH0sXG4gICAgICAgICdbJzogeyBzeW50YXg6ICdhcnJheScsIGVtcHR5OiAnW10nfSxcbiAgICAgICAgJyonOiB7IHN5bnRheDogJ21hdGNoJywgZW1wdHk6ICd7fSd9LFxuICAgIH07XG5cbmZ1bmN0aW9uIHBhcnNlQWNjZXNzUGF0aChwYXRoLCBub2RlUGFyc2VQYXR0ZXJuKSB7XG4gICAgbm9kZVBhcnNlUGF0dGVybiA9IG5vZGVQYXJzZVBhdHRlcm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RleChzcGxpY2VJbmRleCwgbS5sZW5ndGgpO1xcblxcbiAgICAgICAge3sgLyogY2xvbmUgYWRkZWQgYXJndW1lbnRzIHRvIHByZXZlbnQgc2FtZSByZWZlcmVuY2VzIGluIGxpbmtlZCBtb2RlbHMgKi8gfX1cXG4gICAgICAgIGlmIChhZGRJdGVtcylcXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMjsgaSA8IGFyZ3NMZW47IGkrKylcXG4gICAgICAgICAgICAgICAgYXJndW1lbnRzW2ldID0gY2xvbmVUcmVlKGFyZ3VtZW50c1tpXSk7XFxuXFxuICAgICAgICB7eyAvKiBhY3R1YWwgc3BsaWNlIGNhbGwgKi8gfX1cXG4gICAgICAgIHZhciByZW1vdmVkID0gQXJyYXkucHJvdG90eXBlLnNwbGljZS5hcHBseShtLCBhcmd1bWVudHMpO1xcblxcbiAgICAgICAgaWYgKHRoaXMuX29wdGlvbnMucmVhY3RpdmUgIT09IGZhbHNlKSB7XFxuICAgICAgICAgICAge3sjIGRlZi5hZGRNc2cgfX0gYWNjZXNzUGF0aCwgdHlwZTogJ3NwbGljZScsXFxuICAgICAgICAgICAgICAgICAgICBpbmRleDogc3BsaWNlSW5kZXgsIHJlbW92ZWQ6IHJlbW92ZWQsIGFkZGVkQ291bnQ6IGFkZEl0ZW1zID8gYXJnc0xlbiAtIDIgOiAwLFxcbiAgICAgICAgICAgICAgICAgICAgbmV3VmFsdWU6IG0gfSk7XFxuXFxuICAgICAgICAgICAgaWYgKHJlbW92ZWQgJiYgcmVtb3ZlZC5sZW5ndGgpXFxuICAgICAgICAgICAgICAgIHJlbW92ZWQuZm9yRWFjaChmdW5jdGlvbihpdGVtLCBpbmRleCkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGl0ZW1QYXRoID0gYWNjZXNzUGF0aCArICdbJyArIChzcGxpY2VJbmRleCArIGluZGV4KSArICddJztcXG4gICAgICAgICAgICAgICAgICAgIHt7IyBkZWYuYWRkTXNnIH19IGl0ZW1Q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IHBhdGhTeW50YXgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgcGF0aFN5bnRheCA9IHJvb3RQYXRoICsgJy4kJCc7XG4gICAgICAgICAgICAgICAgXy5lYWNoS2V5KG9iaiwgZnVuY3Rpb24odmFsdWUsIGtleSkge1xuICAgICAgICAgICAgICAgICAgICBhZGRNZXNzYWdlKHZhbHVlLCBrZXksIHBhdGhTeW50YXgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gYWRkTWVzc2FnZSh2YWx1ZSwga2V5LCBwYXRoU3ludGF4KSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHBhdGhTeW50YXgucmVwbGFjZSgnJCQnLCBrZXkpXG4gICAgICAgICAgICAgICAgLCBleGlzdGluZ01zZyA9IG1lc3NhZ2VzSGFzaFtwYXRoXTtcblxuICAgICAgICAgICAgaWYgKGV4aXN0aW5nTXNnKSB7XG4gICAgICAgICAgICAgICAgaWYgKGV4aXN0aW5nTXNnLnR5cGUgPT0gbXNnVHlwZSlcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKCdzZXR0ZXIgZXJyb3I6IHNhbWUgbWVzc2FnZSB0eXBlIHBvc3RlZCBvbiB0aGUgc2FtZSBwYXRoJyk7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nTXNnLnR5cGUgPSAnY2hhbmdlZCc7XG4gICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nTXNnW3ZhbHVlUHJvcF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBtc2cgPSB7IHBhdGg6IHBhdGgsIHR5cGU6IG1zZ1R5cGUgfTtcbiAgICAgICAgICAg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gICAgaWYgKHBhdHRlcm4gaW5zdGFuY2VvZiBPbmVPZikge1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBhdHRlcm4uY2hvaWNlcy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBjaGVja1N1YnRyZWUodmFsdWUsIHBhdHRlcm4uY2hvaWNlc1tpXSk7XG4gICAgICAgICAgICAgICAgLy8gTm8gZXJyb3I/IFlheSwgcmV0dXJuLlxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIC8vIE90aGVyIGVycm9ycyBzaG91bGQgYmUgdGhyb3duLiBNYXRjaCBlcnJvcnMganVzdCBtZWFuIHRyeSBhbm90aGVyXG4gICAgICAgICAgICAgICAgLy8gY2hvaWNlLlxuICAgICAgICAgICAgICAgIGlmICghKGVyciBpbnN0YW5jZW9mIE1hdGNoLkVycm9yKSlcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIFhYWCB0aGlzIGVycm9yIGlzIHRlcnJpYmxlXG4gICAgICAgIHRocm93IG5ldyBNYXRjaC5FcnJvcihcIkZhaWxlZCBNYXRjaC5PbmVPZiBvciBNYXRjaC5PcHRpb25hbCB2YWxpZGF0aW9uXCIpO1xuICAgIH1cblxuICAgIC8vIEEgZnVuY3Rpb24gdGhhdCBpc24ndCBzb21ldGhpbmcgd2Ugc3BlY2lhbC1jYXNlIGlzIGFzc3VtZWQgdG8gYmUgYVxuICAgIC8vIGNvbnN0cnVjdG9yLlxuICAgIGlmIChwYXR0ZXJuIGluc3RhbmNlb2YgRnVuY3Rpb24pIHtcbiAgICAgICAgaWYgKHZhbHVlIGluc3RhbmNlb2YgcGF0dGVybilcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gWFhYIHdoYXQgaWYgL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biAgICAgICAgaWYgKHBhdHRlcm5ba2V5XSBpbnN0YW5jZW9mIE9wdGlvbmFsKVxuICAgICAgICAgICAgb3B0aW9uYWxQYXR0ZXJuc1trZXldID0gcGF0dGVybltrZXldLnBhdHRlcm47XG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIHJlcXVpcmVkUGF0dGVybnNba2V5XSA9IHBhdHRlcm5ba2V5XTtcbiAgICB9LCB0aGlzLCB0cnVlKTtcblxuICAgIF8uZWFjaEtleSh2YWx1ZSwgZnVuY3Rpb24oc3ViVmFsdWUsIGtleSkge1xuICAgICAgICB2YXIgc3ViVmFsdWUgPSB2YWx1ZVtrZXldO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgaWYgKHJlcXVpcmVkUGF0dGVybnMuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICAgIGNoZWNrU3VidHJlZShzdWJWYWx1ZSwgcmVxdWlyZWRQYXR0ZXJuc1trZXldKTtcbiAgICAgICAgICAgICAgICBkZWxldGUgcmVxdWlyZWRQYXR0ZXJuc1trZXldO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChvcHRpb25hbFBhdHRlcm5zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgICAgICBjaGVja1N1YnRyZWUoc3ViVmFsdWUsIG9wdGlvbmFsUGF0dGVybnNba2V5XSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICghdW5rbm93bktleXNBbGxvd2VkKVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTWF0Y2guRXJyb3IoXCJVbmtub3duIGtleVwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgTWF0Y2guRXJyb3IpXG4gICAgICAgICAgICAgICAgZXJyLnBhdGggPSBfcHJlcGVuZFBhdGgoa2V5LCBlcnIucGF0a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GluZGV4ID0gbGV2ZWxzLmluZGV4T2YodHlwZSk7XG5cbiAgICBpZiAoISB0aGlzLmVuYWJsZWQgfHwgaW5kZXggPiB0aGlzLmxldmVsKVxuICAgICAgICByZXR1cm4gdGhpcztcblxuICAgIHZhciBhcmdzID0gXy5zbGljZShhcmd1bWVudHMsIDEpO1xuXG4gICAgaWYgKGluZGV4IDw9IHRoaXMudGhyb3dMZXZlbClcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFt0aGlzLmxvZ1ByZWZpeCwgdHlwZSArICc6J10uY29uY2F0KGFyZ3MpLmpvaW4oJyAnKSk7XG5cbiAgICBjb25zb2xlLmxvZy5hcHBseShcbiAgICAgICAgICBjb25zb2xlXG4gICAgICAgICwgWyB0aGlzLmxvZ1ByZWZpeENvbG9yXG4gICAgICAgICAgICAgID8gJyAgICcgKyBjb2xvcmVkKHRoaXMubG9nUHJlZml4LCB0aGlzLmxvZ1ByZWZpeENvbG9yKVxuICAgICAgICAgICAgICA6IHRoaXMubG9nUHJlZml4LFxuICAgICAgICAgICAgKHRoaXMuY29sb3JzXG4gICAgICAgICAgICAgID8gJyAnICsgY29sb3JlZChwYWQodHlwZSksIGNvbG9yc1tpbmRleF0pXG4gICAgICAgICAgICAgIDogdHlwZSkgKyAnOidcbiAgICAgICAgICBdLmNvbmNhdChhcmdzKVxuICAgICk7XG5cbiAgICByZXR1cm4gdGhpcztcbn07XG5cbi8qKlxuICogR2VuZXJhdGUgbWV0aG9kcy5cbiAqL1xuXG5sZXZlbHMuZm9yRWFjaChmdW5jdGlvbiAobmFtZSkge1xuICAgIExvZ2dlci5wcm90b3R5cGVbbmFtZV0gPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHRoaXMubG9nLmFwcGx5KHRoaXMsIFtuYW1lXS5jb25jYXQoXy50b0FycmF5KGFyZ3VtZW50cykpKTtcbiAgICB9O1xufSk7XG5cblxubW9kdWxlLmV4cG9ydHMgPSBMb2dnZXI7XG4iLCIvLyBkb1Quan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TtcblxuICAgIHJldHVybiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIG5vdyA9IERhdGUubm93KCk7XG4gICAgICAgIGlmICghcHJldmlvdXMgJiYgb3B0aW9ucy5sZWFkaW5nID09PSBmYWxzZSkgcHJldmlvdXMgPSBub3c7XG4gICAgICAgIHZhciByZW1haW5pbmcgPSB3YWl0IC0gKG5vdyAtIHByZXZpb3VzKTtcbiAgICAgICAgY29udGV4dCA9IHRoaXM7XG4gICAgICAgIGFyZ3MgPSBhcmd1bWVudHM7XG4gICAgICAgIGlmIChyZW1haW5pbmcgPD0gMCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXQpO1xuICAgICAgICAgICAgdGltZW91dCA9IG51bGw7XG4gICAgICAgICAgICBwcmV2aW91cyA9IG5vdztcbiAgICAgICAgICAgIHJlc3VsdCA9IGZ1bmMuYXBwbHkoY29udGV4dCwgYXJncyk7XG4gICAgICAgIH0gZWxzZSBpZiAoIXRpbWVvdXQgJiYgb3B0aW9ucy50cmFpbGluZyAhPT0gZmFsc2UpXG4gICAgICAgICAgICB0aW1lb3V0ID0gc2V0VGltZW91dChsYXRlciwgcmVtYWluaW5nKTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH07XG5cbiAgICBmdW5jdGlvbiBsYXRlcigpIHtcbiAgICAgICAgcHJldmlvdXMgPSBvcHRpb25zLmxlYWRpbmcgPT09IGZhbHNlID8gMCA6IERhdGUubm93KCk7XG4gICAgICAgIHRpbWVvdXQgPSBudWxsO1xuICAgICAgICByZXN1bHQgPSBmdW5jLmFwcGx5KGNvbnRleHQsIGFyZ3MpO1xuICAgIH1cbn1cblxuXG4vKipcbiAqIENhbGwgcGFzc2VkIGZ1bmN0aW9uIG9ubHkgb25jZVxuICogQHJldHVybiB7RnVuY3Rpb259IHNlbGZcbiAqL1xuZnVuY3Rpb24gb25jZSgpIHtcbiAgICB2YXIgZnVuYyA9IHRoaXNcbiAgICAgICAgLC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0cmluZyc6XG4gICAgICAgICAgICByZXR1cm4gdGhpcyA9PSBTdHJpbmcob2JqKTtcbiAgICAgICAgY2FzZSAnTnVtYmVyJzpcbiAgICAgICAgICAgIHJldHVybiB0aGlzICE9ICt0aGlzID8gb2JqICE9ICtvYmogOiAodGhpcyA9PSAwID8gMS90aGlzID09IDEvb2JqIDogdGhpcyA9PSArb2JqKTtcbiAgICAgICAgY2FzZSAnRGF0ZSc6XG4gICAgICAgIGNhc2UgJ0Jvb2xlYW4nOlxuICAgICAgICAgICAgcmV0dXJuICt0aGlzID09ICtvYmo7XG4gICAgICAgIGNhc2UgJ1JlZ0V4cCc6XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zb3VyY2UgPT0gb2JqLnNvdXJjZVxuICAgICAgICAgICAgICAgICAgICAmJiB0aGlzLmdsb2JhbCA9PSBvYmouZ2xvYmFsXG4gICAgICAgICAgICAgICAgICAgICYmIHRoaXMubXVsdGlsaW5lID09IG9iai5tdWx0aWxpbmVcbiAgICAgICAgICAgICAgICAgICAgJiYgdGhpcy5pZ25vcmVDYXNlID09IG9iai5pZ25vcmVDYXNlO1xuICAgIH1cbiAgICBpZiAodHlwZW9mIHRoaXMgIT0gJ29iamVjdCcgfHwgdHlwZW9mIG9iaiAhPSAnb2JqZWN0JykgcmV0dXJuIGZhbHNlO1xuXG4gICAgaWYgKEFycmF5LmlzQXJyYXkodGhpcykpXG4gICAgICAgIHJldHVybiB0aGlzLmxlbmd0aCA9PSBvYmoubGVuZ3RoXG4gICAgICAgICAgICAgICAgJiYgdGhpcy5ldmVyeShmdW5jdGlvbihpdGVtLCBpbmRleCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNFcXVhbC5jYWxsKGl0ZW0sIG9ialtpbmRleF0pO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgIGVsc2Uge1xuICAgICAgICByZXR1cm4gYWxsS2V5cy5jYWxsKHRoaXMpLmxlbmd0aCA9PSBhbGxLZXlzLmNhbGwob2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vbmZpZy5tZXNzYWdlcylcbiAgICAgICAgdGhpcy5vbkNvbmZpZ01lc3NhZ2VzKHRoaXMuY29uZmlnLm1lc3NhZ2VzKTtcbn1cblxuXG5mdW5jdGlvbiBDb21wb25lbnRGYWNldCRvbkNvbmZpZ01lc3NhZ2VzKG1lc3NhZ2VTdWJzY3JpYmVycykge1xuICAgIHZhciBub3RZZXRSZWdpc3RlcmVkTWFwID0gXy5tYXBLZXlzKG1lc3NhZ2VTdWJzY3JpYmVycywgZnVuY3Rpb24oc3Vic2NyaWJlciwgbWVzc2FnZXMpIHtcbiAgICAgICAgdmFyIHN1YnNjcmliZXJUeXBlID0gdHlwZW9mIHN1YnNjcmliZXI7XG4gICAgICAgIGlmIChzdWJzY3JpYmVyVHlwZSA9PSAnZnVuY3Rpb24nKVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMub24obWVzc2FnZXMsIHN1YnNjcmliZXIpO1xuXG4gICAgICAgIGlmIChzdWJzY3JpYmVyVHlwZSA9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgdmFyIGNvbnRleHRUeXBlID0gdHlwZW9mIHN1YnNjcmliZXIuY29udGV4dDtcbiAgICAgICAgICAgIGlmIChjb250ZXh0VHlwZSA9PSAnb2JqZWN0JylcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vbihtZXNzYWdlcywgc3Vic2NyaWJlcik7XG5cbiAgICAgICAgICAgIGlmIChjb250ZXh0VHlwZSA9PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgIGlmIChzdWJzY3JpYmVyLmNvbnRleHQgPT0gdGhpcy5uYW1lIHx8IHN1YnNjcmliZXIuY29udGV4dCA9PSAnZmFjZXQnKVxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlcjogc3Vic2NyaWJlci5zdWJzY3JpYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpc1xuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN1YnNjcmliZXIuY29udGV4dCA9PSAnb3duZXInKVxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVyID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlcjogc3Vic2NyaWJlci5zdWJzY3JpYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpcy5vd25lclxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIHN1YnNjcmliZXIgY29udGV4dCBpbiBjb25maWd1cmF0aW9uOiAnICsgc3Vic2NyaWJlci5jb250ZXh0KTtcblxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9uKG1lc3NhZ2VzLCBzdWJzY3JpYmVyKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIHN1YnNjcmliZXIgY29udGV4dCB0eXBlIGluIGNvbmZpZ3VyYXRpb246ICcgKyBjb250ZXh0VHlwZSk7XG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3Vua25vd24gc3Vic2NyaWJlciB0eXBlIGluIGNvbmZpZ3VyYXRpb246ICcgKyBzdWJzY3JpYmVyVHlwZSk7XG4gICAgfSwgdGhpcyk7XG5cbiAgICByZXR1cm4gbm90WWV0UmVnaXN0ZXJlZE1hcDtcbn1cblxuXG4vLyBjaGVja0RlcGVuZGVuY2llc1xuZnVuY3Rpb24gQ29tcG9uZW50RmFjZXQkY2hlY2soKSB7XG4gICAgaWYgKHRoaXMucmVxdWlyZSkge1xuICAgICAgICB0aGlzLnJlcXVpcmUuZm9yRWFjaChmdW5jdGlvbihyZXFGYWNldCkge1xuICAgICAgICAgICAgaWYgKCEgdGhpcy5vd25l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2YXIgaSA9IDAsIGxlbiA9IHBhcnNlZFBhdGgubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHtcbiAgICAgICAgdmFyIHBhdGhOb2RlID0gcGFyc2VkUGF0aFtpXVxuICAgICAgICAgICAgLCBub2RlS2V5ID0gcGF0aFV0aWxzLmdldFBhdGhOb2RlS2V5KHBhdGhOb2RlKTtcbiAgICAgICAgaWYgKHBhdGhOb2RlLnN5bnRheCA9PSAnYXJyYXknICYmIGN1cnJlbnRDb21wb25lbnQubGlzdCkge1xuICAgICAgICAgICAgdmFyIGl0ZW1Db21wb25lbnQgPSBjdXJyZW50Q29tcG9uZW50Lmxpc3QuaXRlbShub2RlS2V5KTtcbiAgICAgICAgICAgIGlmICghIGl0ZW1Db21wb25lbnQgJiYgY3JlYXRlSXRlbSAhPT0gZmFsc2UpIHtcbiAgICAgICAgICAgICAgICBpdGVtQ29tcG9uZW50ID0gY3VycmVudENvbXBvbmVudC5saXN0Ll9hZGRJdGVtKG5vZGVLZXkpO1xuICAgICAgICAgICAgICAgIGl0ZW1Db21wb25lbnQuZGF0YS5fcGF0aCA9IHBhdGhOb2RlLnByb3BlcnR5O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY3VycmVudENvbXBvbmVudCA9IGl0ZW1Db21wb25lbnQ7XG4gICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbXBvbmVudC5jb250YWluZXIpXG4gICAgICAgICAgICBjdXJyZW50Q29tcG9uZW50ID0gY3VycmVudENvbXBvbmVudC5jb250YWluZXIuc2NvcGVbbm9kZUtleV07XG5cbiAgICAgICAgdmFyIGN1cnJlbnREYXRhRmFjZXQgPSBjdXJyZW50Q29tcG9uZW50ICYmIGN1cnJlbnRDb21wb25lbnQuZGF0YTtcbiAgICAgICAgaWYgKCEgY3VycmVudERhdGFGYWNldClcbiAgICAgICAgICAgIGJyZWFrO1xuICAgIH1cblxuICAgIHJldHVybiBjdXJyZW50RGF0YUZhY2V0O1xufVxuXG5cbi8qK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HMpIHtcbiAgICAgICAgICAgIGNhc2UgJ3VuZGVmaW5lZCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWxsb3dDb21wcztcbiAgICAgICAgICAgIC8vIGNvbXBvbmVudCBjbGFzc1xuICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gbWV0YSAmJiBtZXRhLmNvbXBDbGFzcyA9PSBhbGxvd0NvbXBzO1xuICAgICAgICAgICAgLy8gdGVzdCBmdW5jdGlvblxuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBhbGxvd0NvbXBzLmNhbGwodGhpcy5vd25lciwgbWV0YSwgZHQsIG9yaWdpbmFsRHJvcENvbXBvbmVudCk7XG4gICAgICAgICAgICBjYXNlICdvYmplY3QnOlxuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGFsbG93Q29tcHMpKVxuICAgICAgICAgICAgICAgICAgICAvLyBsaXN0IG9mIGFsbG93ZWQgY2xhc3Nlc1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWxsb3dDb21wcy5pbmRleE9mKG1ldGEgJiYgbWV0YS5jb21wQ2xhc3MpID49IDA7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1hcCBvZiBjbGFzczogYm9vbGVhbnx0ZXN0IGZ1bmN0aW9uXG4gICAgICAgICAgICAgICAgICAgIHZhciB0ZXN0ID0gYWxsb3dDb21wc1ttZXRhICYmIG1ldGEuY29tcENsYXNzXTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhIF8ucmVzdWx0KHRlc3QsIHRoaXMub3duZXIsIG1ldGEsIGR0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAg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e1xuICAgICAgICBjb21wb25lbnROYW1lOiBjb21wb25lbnROYW1lLFxuICAgICAgICBjb3VudDogY291bnRcbiAgICB9KTtcblxuICAgIHZhciB3cmFwRWwgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTtcbiAgICB3cmFwRWwuaW5uZXJIVE1MID0gaXRlbXNIVE1MO1xuXG4gICAgbWlsb0JpbmRlcih3cmFwRWwsIHRoaXMub3duZXIuY29udGFpbmVyLnNjb3BlKTtcbiAgICB2YXIgY2hpbGRyZW4gPSBkb21VdGlscy5jaGlsZHJlbih3cmFwRWwpO1xuXG4gICAgaWYgKGNvdW50ICE9IGNoaWxkcmVuLmxlbmd0aClcbiAgICAgICAgbG9nZ2VyLmVycm9yKCdudW1iZXIgb2YgaXRlbXMgYWRkZWQgaXMgZGlmZmVyZW50IGZyb20gcmVxdWVzdGVkJyk7XG5cbiAgICBpZiAoY2hpbGRyZW4gJiYgY2hpbGRyZW4ubGVuZ3RoKSB7XG4gICAgICAgIHZhciBsaXN0TGVuZ3RoID0gdGhpcy5jb3VudCgpO1xuICAgICAgICB2YXIgc3BsaWNlSW5kZXggPSBpbmRleCA8IDBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IDBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHR5cGVvZiBpbmRleCA9PSAndW5kZWZpbmVkJyB8fCBpbmRleCA+IGxpc3RMZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBsaXN0TGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogaW5kZXg7XG5cbiAgICAgICAgdmFyIHByZXZDb21wb25lbnQgPSBzcGxpY2VJbmRleCA9PSAwXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdGhpcy5pdGVtU2FtcGxlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdGhpcy5fbGlzdEl0ZW1zW3NwbGljZUluZGV4IC0gM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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwibWwtdWktZm9sZHRyZWUtaXRlbVwiPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez8gaGFzU3ViVHJlZSB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cIm1sLXVpLWZvbGR0cmVlLWJ1dHRvblwiPjwvZGl2PlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez99fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ez0gaXQuaXRlbVRlbXBsYXRlKHsgaXRlbTogaXRlbSwgaWQ6IGl0Lml0ZW1JRHNbaW5kZXhdIH0pIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/IGhhc1N1YlRyZWUgfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s9IGl0LnRyZWVUZW1wbGF0ZShpdGVtKSB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7P319XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2xpPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICB7e359fVxcXG4gICAgICAgICAgICAgICAgICAgIDwvdWw+JztcblxudmFyIERFRkFVTFRfQ09NUElMRURfSVRFTV9URU1QTEFURSA9IGRvVC5jb21waWxlKCdcXFxuICAgICAgICAgICAgPHNwYW4gY2xhc3M9XCJtbC11aS1mb2xkdHJlZS1sYWJlbFwiIGRhdGEtaXRlbS1pZD1cInt7PSBpdC5pZCB9fVwiPlxcXG4gICAgICAgICAgICAgICAge3s9IGl0Lml0ZW0ubGFiZWwgfX1cXFxuICAgICAgICAgICAgPC9zcGFuPicpXG4gICAgLCBDT01QSUxFRF9UUkVFX1RFTVBM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ICAgICAgICAgICAgICAgIHt7PyBpdC5jbG9zZS5idXR0b24gfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIG1sLWJpbmQ9XCJbZXZlbnRzXTpjbG9zZUJ0blwiIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImNsb3NlXCI+JnRpbWVzOzwvYnV0dG9uPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxoNCBjbGFzcz1cIm1vZGFsLXRpdGxlXCI+e3s9IGl0LnRpdGxlIH19PC9oND5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICB7ez8gaXQuaHRtbCB8fCBpdC50ZXh0IH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJtb2RhbC1ib2R5XCIgbWwtYmluZD1cIltjb250YWluZXJdOmRpYWxvZ0JvZHlcIj5cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7PyBpdC5odG1sIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3s9IGl0Lmh0bWwgfX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt7Pz99fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwPnt7PSBpdC50ZXh0IH19PC9wPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgICAgICB7ez8gaXQuYnV0dG9ucyAmJiBpdC5idXR0b25zLmxlbmd0aCB9fVxcXG4gICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwibW9kYWwtZm9vdGVyXCI+XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7e34gaXQuYnV0dG9ucyA6YnRuIH19XFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCJcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3M9XCJidG4gYnRuLXt7PSBidG4udHlwZSB9fXt7PyBidG4uY2xzIH19IHt7PSBidG4uY2xzIH19e3s/fX1cIlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtbC1iaW5kPVwiW2V2ZW50c106e3s9IGJ0bi5uYW1lIH19XCI+e3s9IGJ0bi5sYWJlbCB9fTwvYnV0dG9uPlxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAge3t+fX1cXFxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxcbiAgICAgICAgICAgICAgICAgICAge3s/fX1cXFxuICAgICAgICAgICAgICAgIDwvZGl2PlxcXG4gICAgICAgICAgICA8L2Rpdj4nXG4gICAgfVxufSk7XG5cbmNvbXBvbmVudHNSZWdpc3RyeS5hZGQoTUxEaWFsb2cpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE1MRGlhbG9nO1xuXG5cbl8uZXh0ZW5kKE1MRGlhbG9nLCB7XG4gICAgY3JlYXRlRGlhbG9nOiBNTERpYWxvZyQkY3JlYXRlRGlhbG9nLFxuICAgIG9wZW5EaWFsb2c6IE1MRGlhbG9nJCRvcGVuRGlhbG9nLFxuICAgIGdldE9wZW5lZERpYWxvZzogTUxEaWFsb2ckJGdldE9wZW5lZERpYWxvZ1xufSk7XG5cblxuXy5leHRlbmRQcm90byhNTERpYWxvZywge1xuICAgIG9wZW5EaWFsb2c6IE1MRGlhbG9nJG9wZW5EaWFsb2csXG4gICAgY2xvc2VEaWFsb2c6IE1MRGlhbG9nJGNsb3NlRGlhbG9nLFxuICAgIGRlc3Ryb3k6IE1MRGlhbG9nJGRlc3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4gICAgLCBkb1QgPSBtaWxvQ29yZS51dGlsLmRvVDtcblxuXG52YXIgY29uZmlnID0gbW9kdWxlLmV4cG9ydHMgPSBtaWxvQ29yZS5jb25maWc7XG5cblxuY29uZmlnKHtcbiAgICBhdHRyczoge1xuICAgICAgICBiaW5kOiAnbWwtYmluZCcsXG4gICAgICAgIGxvYWQ6ICdtbC1sb2FkJ1xuICAgIH0sXG4gICAgY29tcG9uZW50UmVmOiAnX19fbWlsb19jb21wb25lbnQnLFxuICAgIGNvbXBvbmVudFByZWZpeDogJ21pbG9fJyxcbiAgICB0ZW1wbGF0ZToge1xuICAgICAgICBjb21waWxlOiBkb1QuY29tcGlsZVxuICAgIH0sXG4gICAgZG9tU3RvcmFnZToge1xuICAgICAgICB0eXBlU3VmZml4OiAnOl9fX21pbG9fZGF0YV90eXBlJyxcbiAgICAgICAgcHJlZml4U2VwYXJhdG9yOiAnLycsXG4gICAgICAgIHJvb3Q6ICcnLFxuICAgICAgICBtZXNzYWdlS2V5OiAnX19fbWlsb19tZXNzYWdlLycsXG4gICAgICAgIG1lc3NhZ2VUaW1lc3RhbXA6ICdfX19taWxvX3RpbWVzdGFtcCcsXG4gICAgICAgIHF1b3RhRXhjZWVkZWQ6IHtcbiAgICAgICAgICAgIHRocm93RXJyb3I6IHRydWUsXG4gICAgICAgICAgICBtZXNzYWdlOiBmYWxzZVxuICAgICAgICB9XG4gICAgfSxcbiAgICBkcmFnRHJvcDoge1xuICAgICAgICBkYXRhVHlwZXM6IHtcbiAgICAgICAgICAgIGNvbXBvbmVudDogJ3gtYXBwbGljYXRpb24vbWlsby9jb21wb25lbnQnLFxuICAgICAgICAgICAgY29tcG9uZW50TWV0YVRlbXBsYXRlOiAneC1hcHBsaWNhdGlvbi9taWxvL2NvbXBvbmVudC1tZXRhLyVjbGFzcy8lbmFtZS8lcGFyYW1zJyxcbiAgICAgICAgICAgIGNvbXBvbmVudE1ldGFSZWdleDogL154XFwtYXBwbGljYXRpb25cXC9taWxvXFw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cgPSBfZmluZENvbnRhaW5pbmdDaGlsZChjb250YWluZXJOb2RlLCBlbmROb2RlKTtcblxuICAgIGlmIChzdGFydFNpYmxpbmcgJiYgZW5kU2libGluZykge1xuICAgICAgICBpZiAoc3RhcnRTaWJsaW5nID09IGVuZFNpYmxpbmcpIHtcbiAgICAgICAgICAgIGxvZ2dlci5lcnJvcignZGVsZXRlU2VsZWN0aW9uQ29tbWFuZCBsb2dpY2FsIGVycm9yOiBzYW1lIHNpYmxpbmdzJyk7XG4gICAgICAgICAgICByZXR1cm4geyBzaWJsaW5nczogZmFsc2UsIHN0YXJ0OiBzdGFydFNpYmxpbmcgfTtcbiAgICAgICAgfSBlbHNlXG4gICAgICAgICAgICByZXR1cm4geyBzaWJsaW5nczogdHJ1ZSwgc3RhcnQ6IHN0YXJ0U2libGluZywgZW5kOiBlbmRTaWJsaW5nIH07XG4gICAgfVxufVxuXG5cbmZ1bmN0aW9uIF9maW5kQ29udGFpbmluZ0NoaWxkKGNvbnRhaW5lck5vZGUsIHNlbE5vZGUpIHtcbiAgICByZXR1cm4gXy5maW5kKGNvbnRhaW5lck5vZGUuY2hpbGROb2RlcywgZnVuY3Rpb24obm9kZSkge1xuICAgICAgICByZXR1cm4gbm9kZS5jb250YWlucyhzZWxOb2RlKTtcbiAgICB9KTtcbn1cblxuXG5mdW5jdGlvbiBfY3JlYXRlTm9kZXNBbmRQYXRoc0Z1bmMoZnVuYykge1xuICAgIHJldHVybiBmdW5jdGlvbihyb290RWwsIGZyb21PYmopIHtcbiAgICAgICAgdmFyIHRvT2JqID0ge1xuICAgICAgICAgICAgc2libGluZ3M6IGZyb21PYmouc2libGluZ3MsXG4gICAgICAgICAgICBzdGFydDogZnVuYyhyb290RWwsIGZyb21PYmouc3RhcnQpXG4gICAgICAgIH07XG4gICAgICAgIGlmICh0b09iai5zaWJsaW5ncylcbiAgICAgICAgICAgIHRvT2JqLmVuZCA9IGZ1bmMocm9vdEVsLCBmcm9tT2JqLmVuZCk7XG4gIC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aW9uLCBkYXRhVmFsaWRhdGlvbikge1xuICAgICAgICBmcm9tRFMub25TeW5jKCdkYXRhY2hhbmdlcycsIG9uRGF0YSk7XG4gICAgICAgIHJldHVybiBvbkRhdGE7XG5cbiAgICAgICAgZnVuY3Rpb24gb25EYXRhKG1lc3NhZ2UsIGJhdGNoKSB7XG4gICAgICAgICAgICB2YXIgc2VuZERhdGEgPSB7XG4gICAgICAgICAgICAgICAgY2hhbmdlczogW10sXG4gICAgICAgICAgICAgICAgdHJhbnNhY3Rpb246IGJhdGNoLnRyYW5zYWN0aW9uXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGJhdGNoLmNoYW5nZXMuZm9yRWFjaChmdW5jdGlvbihjaGFuZ2UpIHtcbiAgICAgICAgICAgICAgICB2YXIgc291cmNlUGF0aCA9IGNoYW5nZS5wYXRoXG4gICAgICAgICAgICAgICAgICAgICwgdGFyZ2V0UGF0aCA9IHRyYW5zbGF0ZVBhdGgoc291cmNlUGF0aCk7XG5cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHRhcmdldFBhdGggPT0gJ3VuZGVmaW5lZCcpIHJldHVybjtcblxuICAgICAgICAgICAgICAgIHZhciBjaGFuZ2UgPSBfLmNsb25lKGNoYW5nZSk7XG4gICAgICAgICAgICAgICAgXy5leHRlbmQoY2hhbmdlLCB7XG4gICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnJvbURTLFxuICAgICAgICAgICAgICAgICAgICBwYXRoOiB0YXJnZXRQYXRoXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICB0cmFuc2xhdGVEYXRhKHNvdXJjZVBhdGgsIGNoYW5nZSk7XG4gICAgICAgICAgICAgICAgdmFsaWRhdGVEYXRhKHNvdXJjZVBhdGgsIGNoYW5nZSk7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgaWYgKCEgY2hhbmdlc1F1ZXVlLmxlbmd0aClcbiAgICAgICAgICAgICAgICBfLmRlZmVyKHBvc3RDaGFuZ2VEYXRhKTtcblxuICAgICAgICAgICAgY2hhbmdlc1F1ZXVlLnB1c2goc2VuZERhdGEpO1xuXG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHRyYW5zbGF0ZVBhdGgoc291cmNlUGF0aCkge1xuICAgICAgICAgICAgICAgIGlmIChwYXRoVHJhbnNsYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRyYW5zbGF0ZWRQYXRoID0gcGF0aFRyYW5zbGF0aW9uW3NvdXJjZVBhdGhdO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHJhbnNsYXRlZFBhdGgpIHJldHVybiB0cmFuc2xhdGVkUGF0aDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFwYXR0ZXJuVHJhbnNsYXRpb24ubGVuZ3RoKSByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIHZhciBwdCA9IF8uZmluZChwYXR0ZXJuVHJhbnNsYXRpb24sIGZ1bmN0aW9uKHBUcmFuc2xhdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBUcmFuc2xhdGlvbi5mcm9tUGF0dGVybi50ZXN0KHNvdXJjZVBhdGgpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFwdCkgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB2YXIgdHJhbnNsYXRlZFBhdGggPSBzb3VyY2VQYXRoLnJlcGxhY2UocHQuZnJvbVN0YXRpY1BhdGgsIHB0LnRvU3RhdGljUGF0aCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICghICgoc3Vic2NyaXB0aW9uUGF0dGVybiBpbnN0YW5jZW9mIFJlZ0V4cFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgc3Vic2NyaXB0aW9uUGF0dGVybi50ZXN0KHNvdXJjZVBhdGgpKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgc3Vic2NyaXB0aW9uUGF0dGVybiA9PSBzb3VyY2VQYXRoKSkgcmV0dXJuO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRyYW5zbGF0ZWRQYXRoIHx8IHNvdXJjZVBhdGg7XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgZnVuY3Rpb24gdHJhbnNsYXRlRGF0YShzb3VyY2VQYXRoLCBjaGFuZ2UpIHtcbiAgICAgICAgICAgICAgICBpZiAoZGF0YVRyYW5zbGF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB0cmFuc2xhdGUgPSBkYXRhVHJhbnNsYXRpb25bc291cmNlUGF0aF07XG4gICAgICAgICAgICAgICAgICAgIGlmICh0cmFuc2xhdGUgJiYgdHlwZW9mIHRyYW5zbGF0ZSA9PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2Uub2xkVmFsdWUgPSB0cmFuc2xhdGUoY2hhbmdlLm9sZFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZS5uZXdWYWx1ZSA9IHRyYW5zbGF0ZShjaGFuZ2UubmV3VmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgXG4gICAgICAgICAgICBmdW5jdGlvbiB2YWxpZGF0ZURhdGEoc291cmNlUGF0aCwgY2hhbmdlKSB7XG4gICAgICAgICAgICAgICAgcHJvcGFnYXRlRGF0YShjaGFuZ2UpO1xuXG4gICAgICAgICAgICAgICAgaWYgKGRhdGFWYWxpZGF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB2YWxpZGF0b3JzID0gZGF0YVZhbGlkYXRpb25bc291cmNlUGF0aF1cbiAgICAgICAgICAgICAgICAgICAgICAgICwgcGFzc2VkQ291bnQgPSAwXG4gICAgICAgICAgICAgICAgICAgICAgICAsIGFscmVhZHlGYWlsZWQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICAgICAgICBpZiAodmFsaWRhdG9ycylcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRvcnMuZm9yRWFjaChjYWxsVmFsaWRhdG9yKTsgICBcbiAgICAgICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNhbGxWYWxpZGF0b3IodmFsaWRhdG9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbGlkYXRvcihjaGFuZ2UubmV3VmFsdWUsIGZ1bmN0aW9uKGVyciwgcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlLnBhdGggPSBzb3VyY2VQYXRoO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEgYWxyZWFkeUZhaWxlZCAmJiAoZXJyIHx8IHJlc3BvbnNlLnZhbGlkKSAmJiArK3Bhc3NlZENvdW50ID09IHZhbGlkYXRvcnMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbURTLnBvc3RNZXNzYWdlKCd2YWxpZGF0ZWQnLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCEgcmVzcG9uc2UudmFsaWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbHJlYWR5RmFpbGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tRFMucG9zdE1lc3NhZ2UoJ3ZhbGlkYXRlZCcsIHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHByb3BhZ2F0ZURhdGEoY2hhbmdlKSB7XG4gICAgICAgICAgICAgICAgc2VuZERhdGEuY2hhbmdlcy5wdXNoKGN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lID0gY2hhbmdlRmluaXNoZWQgPyAnY2hhbmdlY29tcGxldGVkJyA6ICdjaGFuZ2VzdGFydGVkJztcbiAgICAgICAgICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKG1lc3NhZ2UsIHsgc291cmNlOiBmcm9tRFMsIHRhcmdldDogdG9EUyB9KTtcbiAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICBmdW5jdGlvbiBtZXJnZVRyYW5zYWN0aW9ucyhiYXRjaGVzKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRyYW5zYWN0aW9ucyA9IFtdXG4gICAgICAgICAgICAgICAgICAgICwgY3VycmVudFRyYW5zYWN0aW9uO1xuXG4gICAgICAgICAgICAgICAgYmF0Y2hlcy5mb3JFYWNoKGZ1bmN0aW9uKGJhdGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghIGJhdGNoLnRyYW5zYWN0aW9uKSBjdXJyZW50VHJhbnNhY3Rpb24gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICghIGJhdGNoLmNoYW5nZXMubGVuZ3RoKSByZXR1cm47XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGJhdGNoLnRyYW5zYWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudFRyYW5zYWN0aW9uKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uYXBwZW5kQXJyYXkoY3VycmVudFRyYW5zYWN0aW9uLCBiYXRjaC5jaGFuZ2VzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRUcmFuc2FjdGlvbiA9IF8uY2xvbmUoYmF0Y2guY2hhbmdlcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNhY3Rpb25zLnB1c2goY3VycmVudFRyYW5zYWN0aW9uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgIC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pbnRlcnBvbGF0aW9uU3ludGF4ICsgJ1xcXFxdJ1xuXG4gICAgLCBwcm9wZXJ0eVN0YXJTeW50YXggPSAnXFxcXC5cXFxcKidcbiAgICAsIGFycmF5U3RhclN5bnRheCA9ICdcXFxcW1xcXFwqXFxcXF0nXG4gICAgLCBzdGFyU3ludGF4ID0gJ1xcXFwqJ1xuXG4gICAgLCBwYXRoUGFyc2VTeW50YXggPSBbXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlQYXRoU3ludGF4LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5UGF0aFN5bnRheCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eUludGVycG9sYXRlU3ludGF4LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5SW50ZXJwb2xhdGVTeW50YXhcbiAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignfCcpXG4gICAgLCBwYXRoUGFyc2VQYXR0ZXJuID0gbmV3IFJlZ0V4cChwYXRoUGFyc2VTeW50YXgsICdnJylcblxuICAgICwgcGF0dGVyblBhdGhQYXJzZVN5bnRheCA9ICBbXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoUGFyc2VTeW50YXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eVN0YXJTeW50YXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVN0YXJTeW50YXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFyU3ludGF4XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignfCcpXG4gICAgLCBwYXR0ZXJuUGF0aFBhcnNlUGF0dGVybiA9IG5ldyBSZWdFeHAocGF0dGVyblBhdGhQYXJzZVN5bnRheCwgJ2cnKVxuXG4gICAgLy8sIHRhcmdldFBhdGhQYXJzZVBhdHRlcm4gPS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gICB7eyMgZGVmLmFkZE1zZyB9fSAnJywgdHlwZTogJ2FkZGVkJyxcXG4gICAgICAgICAgICAgICAgICAgICAgbmV3VmFsdWU6IG0gfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB7ez8/fX1cXG4gICAgICAgIHt7PyBtZXRob2QgPT0gJ3NwbGljZScgfX1cXG4gICAgICAgICAgICBpZiAoISBtKSB7XFxuICAgICAgICB7ez99fVxcbiAgICAgICAgICAgICAgICBtID0ge3sjIGRlZi5tb2RlbEFjY2Vzc1ByZWZpeCB9fSA9IGNsb25lVHJlZSh2YWx1ZSk7XFxuICAgICAgICAgICAgICAgIHdhc0RlZiA9IHR5cGVvZiBvbGQgIT0gJ3VuZGVmaW5lZCc7XFxuICAgICAgICB7ez8gbWV0aG9kID09ICdzcGxpY2UnIH19XFxuICAgICAgICAgICAgfVxcbiAgICAgICAge3s/fX0gICAgICAgXFxuICAgIHt7P319XFxuXFxuXFxuICAgIHt7IC8qIGNyZWF0ZSBtb2RlbCB0cmVlIGlmIGl0IGRvZXNuJ3QgZXhpc3QgKi8gfX1cXG4gICAge3sgIHZhciBtb2RlbERhdGFQcm9wZXJ0eSA9ICcnO1xcbiAgICAgICAgdmFyIG5leHROb2RlID0gaXQucGFyc2VkUGF0aFswXTtcXG4gICAgICAgIHZhciBjb3VudCA9IGl0LnBhcnNlZFBhdGgubGVuZ3RoIC0gMTtcXG5cXG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY291bnQ7IGkrKykge1xcbiAgICAgICAgICAgIHZhciBjdXJyTm9kZSA9IG5leHROb2RlO1xcbiAgICAgICAgICAgIHZhciBjdXJyUHJvcCA9IGN1cnJOb2RlLnByb3BlcnR5O1xcbiAgICAgICAgICAgIG5leHROb2RlID0gaXQucGFyc2VkUGF0aFtpICsgMV07XFxuICAgICAgICAgICAgdmFyIGVtcHR5UHJvcCA9IG5leHROb2RlICYmIG5leHROb2RlLmVtcHR5O1xcbiAgICB9f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H1cblxuICAgIGZ1bmN0aW9uIGFkZE1lc3NhZ2VzKG1lc3NhZ2VzLCBtZXNzYWdlc0hhc2gsIHJvb3RQYXRoLCBvYmosIG1zZ1R5cGUsIHZhbHVlUHJvcCkge1xuICAgICAgICBfYWRkTWVzc2FnZXMocm9vdFBhdGgsIG9iaik7XG5cblxuICAgICAgICBmdW5jdGlvbiBfYWRkTWVzc2FnZXMocm9vdFBhdGgsIG9iaikge1xuICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoU3ludGF4ID0gcm9vdFBhdGggKyAnWyQkXSc7XG4gICAgICAgICAgICAgICAgb2JqLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIGluZGV4KSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZE1lc3NhZ2UodmFsdWUsIGluZGV4LCBwYXRoU3ludGF4KTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFyIHBhdGhTeW50YXggPSByb290UGF0aCArICcuJCQnO1xuICAgICAgICAgICAgICAgIF8uZWFjaEtleShvYmosIGZ1bmN0aW9uKHZhbHVlLCBrZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgYWRkTWVzc2FnZSh2YWx1ZSwga2V5LCBwYXRoU3ludGF4KTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIGFkZE1lc3NhZ2UodmFsdWUsIGtleSwgcGF0aFN5bnRheCkge1xuICAgICAgICAgICAgdmFyIHBhdGggPSBwYXRoU3ludGF4LnJlcGxhY2UoJyQkJywga2V5KVxuICAgICAgICAgICAgICAgICwgZXhpc3RpbmdNc2cgPSBtZXNzYWdlc0hhc2hbcGF0aF07XG5cbiAgICAgICAgICAgIGlmIChleGlzdGluZ01zZykge1xuICAgICAgICAgICAgICAgIGlmIChleGlzdGluZ01zZy50eXBlID09IG1zZ1R5cGUpXG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcignc2V0dGVyIGVycm9yOiBzYW1lIG1lc3NhZ2UgdHlwZSBwb3N0ZWQgb24gdGhlIHNhbWUgcGF0aCcpO1xuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBleGlzdGluZ01zZy50eXBlID0gJ2NoYW5nZWQnO1xuICAgICAgICAgICAgICAgICAgICBleGlzdGluZ01zZ1t2YWx1ZVByb3BdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgbXNnID0geyBwYXRoOiBwYXRoLCB0eXBlOiBtc2dUeXBlIH07XG4gICAgICAgICAgICAgICAgbXNnW3ZhbHVlUHJvcF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICBhZGRDaGFuZ2VNZXNzYWdlKG1lc3NhZ2VzLCBtZXNzYWdlc0hhc2gsIG1zZyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2YWx1ZUlzVHJlZSh2YWx1ZSkpXG4gICAgICAgICAgICAgICAgX2FkZE1lc3NhZ2VzKHBhdGgsIHZhbHVlKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNsb25lVHJlZSh2YWx1ZSkge1xuICAgICAgICByZXR1cm4gdmFsdWVJc05vcm1hbE9iamVjdCh2YWx1ZSlcbiAgICAgICAgICAgICAgICA/IF8uZGVlcENsb25lKHZhbHVlKVxuICAgICAgICAgICAgICAgIDogdmFsdWU7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcHJvdGVjdFZhbHVlKHZhbHVlKSB7XG4gICAgICAgIHJldHVybiAhIHZhbHVlSXNOb3JtYWxPYmplY3QodmFsdWUpXG4gICAgICAgICAgICAgICAgPyB2YWx1ZVxuICAgICAgICAgICAgICAgIDogQXJy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SB7XG4gICAgICAgIGlmIChwYXR0ZXJuLmxlbmd0aCAhPT0gMSlcbiAgICAgICAgICAgIHRocm93IEVycm9yKFwiQmFkIHBhdHRlcm46IGFycmF5cyBtdXN0IGhhdmUgb25lIHR5cGUgZWxlbWVudFwiICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEpTT04uc3RyaW5naWZ5KHBhdHRlcm4pKTtcbiAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IE1hdGNoLkVycm9yKFwiRXhwZWN0ZWQgYXJyYXksIGdvdCBcIiArIEpTT04uc3RyaW5naWZ5KHZhbHVlKSk7XG4gICAgICAgIH1cblxuICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uICh2YWx1ZUVsZW1lbnQsIGluZGV4KSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGNoZWNrU3VidHJlZSh2YWx1ZUVsZW1lbnQsIHBhdHRlcm5bMF0pO1xuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGVyciBpbnN0YW5jZW9mIE1hdGNoLkVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIGVyci5wYXRoID0gX3ByZXBlbmRQYXRoKGluZGV4LCBlcnIucGF0aCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICAvLyBBcmJpdHJhcnkgdmFsaWRhdGlvbiBjaGVja3MuIFRoZSBjb25kaXRpb24gY2FuIHJldHVybiBmYWxzZSBvciB0aHJvdyBhXG4gICAgLy8gTWF0Y2guRXJyb3IgKGllLCBpdCBjYW4gaW50ZXJuYWxseSB1c2UgY2hlY2soKSkgdG8gZmFpbC5cbiAgICBpZiAocGF0dGVybiBpbnN0YW5jZW9mIFdoZXJlKSB7XG4gICAgICAgIGlmIChwYXR0ZXJuLmNvbmRpdGlvbih2YWx1ZSkpXG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIC8vIFhYWCB0aGlzIGVycm9yIGlzIHRlcnJpYmxlXG4gICAgICAgIHRocm93IG5ldyBNYXRjaC5FcnJvcihcIkZhaWxlZCBNYXRjaC5XaGVyZSB2YWxpZGF0aW9uXCIpO1xuICAgIH1cblxuXG4gICAgaWYgKHBhdHRlcm4gaW5zdGFuY2VvZiBPcHRpb25hbClcbiAgICAgICAgcGF0dGVybiA9IE1hdGNoLk9uZU9mKHVuZGVmaW5lZCwgcGF0dGVybi5wYXR0ZXJuKTtcblxuICAgIGlmIChwYXR0ZXJuIGluc3RhbmNlb2YgT25lT2YpIHtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBwYXR0ZXJuLmNob2ljZXMubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY2hlY2tTdWJ0cmVlKHZhbHVlLCBwYXR0ZXJuLmNob2ljZXNbaV0pO1xuICAgICAgICAgICAgICAgIC8vIE5vIGVycm9yPyBZYXksIHJldHVybi5cbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgICAvLyBPdGhlciBlcnJvcnMgc2hvdWxkIGJlIHRocm93bi4gTWF0Y2ggZXJyb3JzIGp1c3QgbWVhbiB0cnkgYW5vdGhlclxuICAgICAgICAgICAgICAgIC8vIGNob2ljZS5cbiAgICAgICAgICAgICAgICBpZiAoIShlcnIgaW5zdGFuY2VvZiBNYXRjaC5FcnJvcikpXG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBYWFggdGhpcyBlcnJvciBpcyB0ZXJyaWJsZVxuICAgICAgICB0a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xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZWFjaE1ldGhvZC5jYWxsKHRoaXMsIHRlc3RJdGVtLCB0aGlzQXJnLCBvbmx5RW51bWVyYWJsZSk7XG4gICAgICAgIH0gY2F0Y2ggKGZvdW5kKSB7XG4gICAgICAgICAgICBpZiAoZm91bmQgPT09IF9lcnJvcikgdGhyb3cgY2F1Z2h0RXJyb3I7XG4gICAgICAgICAgICBlbHNlIHJldHVybiBmb3VuZDtcbiAgICAgICAgfVxuICAgICAgICAvLyBpZiBsb29raW5nIGZvciBpbmRleCBhbmQgbm90IGZvdW5kLCByZXR1cm4gLTFcbiAgICAgICAgaWYgKGFyZ0luZGV4ICYmIGVhY2hNZXRob2QgPT0gQXJyYXkucHJvdG90eXBlLmZvckVhY2gpXG4gICAgICAgICAgICByZXR1cm4gLTE7IFxuXG4gICAgICAgIGZ1bmN0aW9uIHRlc3RJdGVtKHZhbHVlLCBpbmRleCwgc2VsZikge1xuICAgICAgICAgICAgdmFyIHRlc3Q7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHRlc3QgPSBjYWxsYmFjay5jYWxsKHRoaXMsIHZhbHVlLCBpbmRleCwgc2VsZik7XG4gICAgICAgICAgICB9IGNhdGNoKGVycikge1xuICAgICAgICAgICAgICAgIGNhdWdodEVycm9yID0gZXJyO1xuICAgICAgICAgICAgICAgIHRocm93IF9lcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0ZXN0KVxuICAgICAgICAgICAgICAgIHRocm93IGFyZ3VtZW50c1thcmdJbmRleF07XG4gICAgICAgIH1cbiAgICB9XG59XG4iXX0= ; \ No newline at end of file diff --git a/package.json b/package.json index 112bb98..838d5ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "milojs", - "version": "0.2.4", + "version": "0.2.5", "description": "Browser/nodejs reactive programming and data driven DOM manipulation with modular components.", "keywords": [ "framework", diff --git a/pushdocs b/pushdocs index 509b2c1..21a45a0 100644 --- a/pushdocs +++ b/pushdocs @@ -4,7 +4,7 @@ set -e git stash git branch gh-pages | echo 'Create branch gh-pages if it does not exist' git checkout gh-pages -doxx --source lib --target . --title 'milo' +doxx --source lib --target . --title 'milojs' git add . git add -u . git commit -m 'doxx generated'