From 7cb9eb0610305f50d485e6ee0aa4b599c170ec17 Mon Sep 17 00:00:00 2001 From: steve wirts Date: Wed, 6 Jan 2016 09:54:32 -0500 Subject: [PATCH] updated v0.1 examples with fixed filter focus issue --- examples/autosizeissue/index.js | 295 ++++++++++++++------------- examples/autosizeissue/index.min.js | 14 +- examples/bclys/index.js | 295 ++++++++++++++------------- examples/bclys/index.min.js | 14 +- examples/polymerwrapper/index.js | 295 ++++++++++++++------------- examples/polymerwrapper/index.min.js | 14 +- 6 files changed, 495 insertions(+), 432 deletions(-) diff --git a/examples/autosizeissue/index.js b/examples/autosizeissue/index.js index 0e22a2bb7..66be0667f 100644 --- a/examples/autosizeissue/index.js +++ b/examples/autosizeissue/index.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { contexts.unshift(arguments); } - return template.replace(templex.regexp, templex.merger.bind(contexts)); -} - -templex.regexp = /\{(.*?)\}/g; - -templex.with = function (i, s) { - return 'with(this[' + i + ']){' + s + '}'; -}; - -templex.cache = []; - -templex.deref = function (key) { - if (!(this.length in templex.cache)) { - var code = 'return eval(expr)'; - - for (var i = 0; i < this.length; ++i) { - code = templex.with(i, code); - } - - templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval - } - return templex.cache[this.length].call(this, key); -}; - -templex.merger = function (match, key) { - // Advanced features: Context can be a list of contexts which are searched in order. - var replacement; - - try { - replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; - } catch (e) { - replacement = '{' + key + '}'; - } - - return replacement; -}; - -// this interface consists solely of the templex function (and it's properties) -module.exports = templex; - -},{}],28:[function(require,module,exports){ +},{"css-injector":2,"templex":31}],26:[function(require,module,exports){ ;(function () { // closure for web browsers if (typeof module === 'object' && module.exports) { @@ -7243,7 +7190,7 @@ function Entry (key, value, lu, length, now, maxAge) { })() -},{}],29:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ /*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js @@ -7874,7 +7821,7 @@ function Entry (key, value, lu, length, now, maxAge) { })); -},{}],30:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ /* object-iterators.js - Mini Underscore library * by Jonathan Eiten * @@ -8082,7 +8029,7 @@ if (!Array.prototype.find) { module.exports = Wrapper; -},{}],31:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8636,7 +8583,7 @@ Rectangle.prototype = { exports.Point = Point; exports.Rectangle = Rectangle; -},{}],32:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8974,7 +8921,76 @@ exports.Rectangle = Rectangle; * 2.b. If `module` object undefined, redefine`RangeSelectionModel` to be the `RangeSelectionModel.exports` object */ -},{}],33:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ +// templex node module +// https://github.com/joneit/templex + +/* eslint-env node */ + +/** + * Merges values of execution context properties named in template by {prop1}, + * {prop2}, etc., or any javascript expression incorporating such prop names. + * The context always includes the global object. In addition you can specify a single + * context or an array of contexts to search (in the order given) before finally + * searching the global context. + * + * Merge expressions consisting of simple numeric terms, such as {0}, {1}, etc., deref + * the first context given, which is assumed to be an array. As a convenience feature, + * if additional args are given after `template`, `arguments` is unshifted onto the context + * array, thus making first additional arg available as {1}, second as {2}, etc., as in + * `templex('Hello, {1}!', 'World')`. ({0} is the template so consider this to be 1-based.) + * + * If you prefer something other than braces, redefine `templex.regexp`. + * + * See tests for examples. + * + * @param {string} template + * @param {...string} [args] + */ +function templex(template) { + var contexts = this instanceof Array ? this : [this]; + if (arguments.length > 1) { contexts.unshift(arguments); } + return template.replace(templex.regexp, templex.merger.bind(contexts)); +} + +templex.regexp = /\{(.*?)\}/g; + +templex.with = function (i, s) { + return 'with(this[' + i + ']){' + s + '}'; +}; + +templex.cache = []; + +templex.deref = function (key) { + if (!(this.length in templex.cache)) { + var code = 'return eval(expr)'; + + for (var i = 0; i < this.length; ++i) { + code = templex.with(i, code); + } + + templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval + } + return templex.cache[this.length].call(this, key); +}; + +templex.merger = function (match, key) { + // Advanced features: Context can be a list of contexts which are searched in order. + var replacement; + + try { + replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; + } catch (e) { + replacement = '{' + key + '}'; + } + + return replacement; +}; + +// this interface consists solely of the templex function (and it's properties) +module.exports = templex; + +},{}],32:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -9575,7 +9591,7 @@ function roundRect(gc, x, y, width, height, radius, fill, stroke) { module.exports = CellProvider; -},{"extend-me":3}],34:[function(require,module,exports){ +},{"extend-me":3}],33:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -13041,7 +13057,7 @@ function installPolyfills() { module.exports = Hypergrid; -},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":28,"object-iterators":30,"rectangular":31}],35:[function(require,module,exports){ +},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":26,"object-iterators":28,"rectangular":29}],34:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -14205,7 +14221,7 @@ function setNumberColumnWidth(gc, behavior, maxRow) { module.exports = Renderer; -},{"extend-me":3,"object-iterators":30}],36:[function(require,module,exports){ +},{"extend-me":3,"object-iterators":28}],35:[function(require,module,exports){ 'use strict'; var RangeSelectionModel = require('sparse-boolean-array'); @@ -14728,7 +14744,7 @@ SelectionModel.prototype = { module.exports = SelectionModel; -},{"sparse-boolean-array":32}],37:[function(require,module,exports){ +},{"sparse-boolean-array":30}],36:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16390,7 +16406,7 @@ var Behavior = Base.extend('Behavior', { module.exports = Behavior; -},{"../CellProvider":33,"./Column":38,"./images":42,"extend-me":3,"object-iterators":30}],38:[function(require,module,exports){ +},{"../CellProvider":32,"./Column":37,"./images":41,"extend-me":3,"object-iterators":28}],37:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16485,7 +16501,7 @@ Column.prototype = { module.exports = Column; -},{"object-iterators":30}],39:[function(require,module,exports){ +},{"object-iterators":28}],38:[function(require,module,exports){ 'use strict'; function DataModelDecorator(grid, component) { @@ -16671,7 +16687,7 @@ DataModelDecorator.prototype = { module.exports = DataModelDecorator; -},{}],40:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict'; var ListDragon = require('list-dragon'); @@ -16988,7 +17004,7 @@ var JSON = Behavior.extend('behaviors.JSON', { module.exports = JSON; -},{"../dataModels/JSON":54,"../features/index":72,"../stylesheets":74,"./Behavior":37,"./DataModelDecorator":39,"hyper-analytics":9,"list-dragon":25}],41:[function(require,module,exports){ +},{"../dataModels/JSON":53,"../features/index":71,"../stylesheets":73,"./Behavior":36,"./DataModelDecorator":38,"hyper-analytics":9,"list-dragon":25}],40:[function(require,module,exports){ 'use strict'; var Behavior = require('./Behavior'); @@ -17022,7 +17038,7 @@ var Null = Behavior.extend('Null', { module.exports = Null; -},{"./Behavior":37}],42:[function(require,module,exports){ +},{"./Behavior":36}],41:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17039,7 +17055,7 @@ _(images).each(function(image, key) { module.exports = images; -},{"../../images":1,"object-iterators":30}],43:[function(require,module,exports){ +},{"../../images":1,"object-iterators":28}],42:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17047,7 +17063,7 @@ module.exports = { JSON: require('./JSON'), Null: require('./Null') }; -},{"./Behavior":37,"./JSON":40,"./Null":41}],44:[function(require,module,exports){ +},{"./Behavior":36,"./JSON":39,"./Null":40}],43:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17365,7 +17381,7 @@ var CellEditor = Base.extend('CellEditor', { module.exports = CellEditor; -},{"extend-me":3,"mustache":29}],45:[function(require,module,exports){ +},{"extend-me":3,"mustache":27}],44:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17438,7 +17454,7 @@ var Choice = Simple.extend('Choice', { module.exports = Choice; -},{"./Simple":48}],46:[function(require,module,exports){ +},{"./Simple":47}],45:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17465,7 +17481,7 @@ var Color = Simple.extend('Color', { module.exports = Color; -},{"./Simple":48}],47:[function(require,module,exports){ +},{"./Simple":47}],46:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17492,7 +17508,7 @@ var Date = Simple.extend('Date', { module.exports = Date; -},{"./Simple":48}],48:[function(require,module,exports){ +},{"./Simple":47}],47:[function(require,module,exports){ 'use strict'; var CellEditor = require('./CellEditor.js'); @@ -17544,9 +17560,11 @@ var Simple = CellEditor.extend('Simple', { self.getGrid().fireSyntheticEditorKeyDownEvent(self, e); }); input.addEventListener('keypress', function(e) { - console.log('keypress', e.keyCode); self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17670,7 +17688,7 @@ var Simple = CellEditor.extend('Simple', { module.exports = Simple; -},{"./CellEditor.js":44}],49:[function(require,module,exports){ +},{"./CellEditor.js":43}],48:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17697,7 +17715,7 @@ var Slider = Simple.extend('Slider', { module.exports = Slider; -},{"./Simple":48}],50:[function(require,module,exports){ +},{"./Simple":47}],49:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17724,7 +17742,7 @@ var Spinner = Simple.extend('Spinner', { module.exports = Spinner; -},{"./Simple":48}],51:[function(require,module,exports){ +},{"./Simple":47}],50:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17778,6 +17796,9 @@ var Textfield = Simple.extend('Textfield', { input.addEventListener('keypress', function(e) { self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17797,7 +17818,7 @@ var Textfield = Simple.extend('Textfield', { module.exports = Textfield; -},{"./Simple":48}],52:[function(require,module,exports){ +},{"./Simple":47}],51:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17810,7 +17831,7 @@ module.exports = { Slider: require('./Slider'), Spinner: require('./Spinner') }; -},{"./CellEditor":44,"./Choice":45,"./Color":46,"./Date":47,"./Slider":49,"./Spinner":50,"./Textfield":51}],53:[function(require,module,exports){ +},{"./CellEditor":43,"./Choice":44,"./Color":45,"./Date":46,"./Slider":48,"./Spinner":49,"./Textfield":50}],52:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -17872,7 +17893,7 @@ var DataModel = Base.extend('DataModel', { module.exports = DataModel; -},{"extend-me":3}],54:[function(require,module,exports){ +},{"extend-me":3}],53:[function(require,module,exports){ 'use strict'; var analytics = require('hyper-analytics'); @@ -18606,7 +18627,7 @@ function textMatchFilter(string) { module.exports = JSON; -},{"./DataModel":53,"hyper-analytics":9}],55:[function(require,module,exports){ +},{"./DataModel":52,"hyper-analytics":9}],54:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -18623,7 +18644,7 @@ window.fin = { Hypergrid: Hypergrid }; -},{"./Hypergrid":34,"./behaviors/index":43,"./cellEditors/index":52,"./features/index":72,"./polyfills":73}],56:[function(require,module,exports){ +},{"./Hypergrid":33,"./behaviors/index":42,"./cellEditors/index":51,"./features/index":71,"./polyfills":72}],55:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18657,7 +18678,7 @@ var CellClick = Feature.extend('CellClick', { module.exports = CellClick; -},{"./Feature.js":64}],57:[function(require,module,exports){ +},{"./Feature.js":63}],56:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18710,7 +18731,7 @@ var CellEditing = Feature.extend('CellEditing', { module.exports = CellEditing; -},{"./Feature.js":64}],58:[function(require,module,exports){ +},{"./Feature.js":63}],57:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19264,7 +19285,7 @@ var CellSelection = Feature.extend('CellSelection', { module.exports = CellSelection; -},{"./Feature.js":64}],59:[function(require,module,exports){ +},{"./Feature.js":63}],58:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19297,7 +19318,7 @@ var ColumnAutosizing = Feature.extend('ColumnAutosizing', { module.exports = ColumnAutosizing; -},{"./Feature.js":64}],60:[function(require,module,exports){ +},{"./Feature.js":63}],59:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -19984,7 +20005,7 @@ var ColumnMoving = Feature.extend('ColumnMoving', { module.exports = ColumnMoving; -},{"./Feature.js":64}],61:[function(require,module,exports){ +},{"./Feature.js":63}],60:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20282,7 +20303,7 @@ var ColumnResizing = Feature.extend('ColumnResizing', { module.exports = ColumnResizing; -},{"./Feature.js":64}],62:[function(require,module,exports){ +},{"./Feature.js":63}],61:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20821,7 +20842,7 @@ var ColumnSelection = Feature.extend('ColumnSelection', { module.exports = ColumnSelection; -},{"./Feature.js":64}],63:[function(require,module,exports){ +},{"./Feature.js":63}],62:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20872,7 +20893,7 @@ var ColumnSorting = Feature.extend('ColumnSorting', { module.exports = ColumnSorting; -},{"./Feature.js":64}],64:[function(require,module,exports){ +},{"./Feature.js":63}],63:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -21215,7 +21236,7 @@ var Feature = Base.extend('Feature', { module.exports = Feature; -},{"extend-me":3}],65:[function(require,module,exports){ +},{"extend-me":3}],64:[function(require,module,exports){ 'use strict'; @@ -21271,7 +21292,7 @@ var Filters = Feature.extend('Filters', { module.exports = Filters; -},{"./Feature.js":64}],66:[function(require,module,exports){ +},{"./Feature.js":63}],65:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21310,7 +21331,7 @@ var KeyPaging = Feature.extend('KeyPaging', { module.exports = KeyPaging; -},{"./Feature.js":64}],67:[function(require,module,exports){ +},{"./Feature.js":63}],66:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21347,7 +21368,7 @@ var OnHover = Feature.extend('OnHover', { module.exports = OnHover; -},{"./Feature.js":64}],68:[function(require,module,exports){ +},{"./Feature.js":63}],67:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -21544,7 +21565,7 @@ var Overlay = Feature.extend('Overlay', { module.exports = Overlay; -},{"./Feature.js":64}],69:[function(require,module,exports){ +},{"./Feature.js":63}],68:[function(require,module,exports){ 'use strict'; var ColumnResizing = require('./ColumnResizing'); @@ -21720,7 +21741,7 @@ var RowResizing = ColumnResizing.extend('RowResizing', { module.exports = RowResizing; -},{"./ColumnResizing":61}],70:[function(require,module,exports){ +},{"./ColumnResizing":60}],69:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22234,7 +22255,7 @@ var RowSelection = Feature.extend('RowSelection', { module.exports = RowSelection; -},{"./Feature.js":64}],71:[function(require,module,exports){ +},{"./Feature.js":63}],70:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22275,7 +22296,7 @@ var ThumbwheelScrolling = Feature.extend('ThumbwheelScrolling', { module.exports = ThumbwheelScrolling; -},{"./Feature.js":64}],72:[function(require,module,exports){ +},{"./Feature.js":63}],71:[function(require,module,exports){ 'use strict'; module.exports = { @@ -22296,7 +22317,7 @@ module.exports = { RowSelection: require('./RowSelection'), ThumbwheelScrolling: require('./ThumbwheelScrolling') }; -},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(require,module,exports){ +},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(require,module,exports){ // polyfills copied verbatim from developer.mozilla.org /* eslint-disable no-extend-native */ @@ -22327,7 +22348,7 @@ if (!Array.prototype.find) { }; } -},{}],74:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ 'use strict'; var cssInjector = require('css-injector'); @@ -22383,5 +22404,5 @@ function addStylesheet(key, referenceElement) { module.exports = addStylesheet; -},{"css-injector":2}]},{},[55]) -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jyb3dzZXItcGFjay9fcHJlbHVkZS5qcyIsIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL2ltYWdlcy9pbmRleC5qcyIsIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL25vZGVfbW9kdWxlcy9jc3MtaW5qZWN0b3IvaW5kZXguanMiLCIvVXNlcnMvc3RldmUvUHJvamVjdC9kZXYv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E9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdUd28gcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgc3RyaW5nLCBvYmplY3QuJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgJ1RvbyBtYW55IHBhcmFtZXRlcnMnO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIENvbnN0cnVjdG9yKCkge1xuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnByZUluaXRpYWxpemUpIHtcbiAgICAgICAgICAgIHByb3RvdHlwZUFkZGl0aW9ucy5wcmVJbml0aWFsaXplLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgIH1cblxuICAgICAgICBpbml0aWFsaXplUHJvdG90eXBlQ2hhaW4uYXBwbHkodGhpcywgYXJndW1lbnRzKTtcblxuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnBvc3RJbml0aWFsaXplKSB7XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMucG9zdEluaXRpYWxpemUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIENvbnN0cnVjdG9yLmV4dGVuZCA9IGV4dGVuZDtcblxuICAgIHZhciBwcm90b3R5cGUgPSBDb25zdHJ1Y3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHRoaXMucHJvdG90eXBlKTtcbiAgICBwcm90b3R5cGUuY29uc3RydWN0b3IgPSBDb25zdHJ1Y3RvcjtcblxuICAgIGlmIChleHRlbmRlZENsYXNzTmFtZSAmJiBleHRlbmQuZGVidWcpIHtcbiAgICAgICAgcHJvdG90eXBlLiQkQ0xBU1NfTkFNRSA9IGV4dGVuZGVkQ2xhc3NOYW1lO1xuICAgIH1cblxuICAgIGZvciAodmFyIGtleSBpbiBwcm90b3R5cGVBZGRpdGlvbnMpIHtcbiAgICAgICAgaWYgKHByb3RvdHlwZUFkZGl0aW9ucy5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBwcm90b3R5cGVBZGRpdGlvbnNba2V5XTtcbiAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSAnaW5pdGlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWxpYXNdLCBhbGlhcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycgJiYgdmFsdWVbMF0gPT09ICcjJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFrZUFsaWFzKHZhbHVlLCBrZXkuc3Vic3RyKDEpKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZVtrZXldID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBDb25z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GFuZCB0aGVuIGNhbGxzIGl0cyB7QGxpbmsgRmluQmFyI3Jlc2l6ZXxyZXNpemUoKX0gbWV0aG9kLlxuICAgICAqXG4gICAgICogVGh1cyB0aGUgbm9kZSB0cmVlIGlzIHR5cGljYWxseTpcbiAgICAgKiAqIEEgKipjb250ZW50IGNvbnRhaW5lcioqIGVsZW1lbnQsIHdoaWNoIGNvbnRhaW5zOlxuICAgICAqICAgICogVGhlIGNvbnRlbnQgZWxlbWVudChzKVxuICAgICAqICAgICogVGhpcyAqKnNjcm9sbGJhciBlbGVtZW50KiosIHdoaWNoIGluIHR1cm4gY29udGFpbnM6XG4gICAgICogICAgICAgICogVGhlICoqdGh1bWIgZWxlbWVudCoqXG4gICAgICpcbiAgICAgKiBAdHlwZSB7RWxlbWVudH1cbiAgICAgKiBAbWVtYmVyT2YgRmluQmFyLnByb3RvdHlwZVxuICAgICAqL1xuICAgIHZhciBiYXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTtcblxuICAgIGJhci5jbGFzc0xpc3QuYWRkKCdmaW5iYXItdmVydGljYWwnKTtcblxuICAgIGJhci5hcHBlbmRDaGlsZCh0aHVtYik7XG4gICAgaWYgKHRoaXMucGFnaW5nKSB7XG4gICAgICAgIGJhci5vbmNsaWNrID0gYm91bmQub25jbGljaztcbiAgICB9XG4gICAgdGhpcy5iYXIgPSBiYXI7XG5cbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgIC8vIHByZXNldHNcbiAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIEZpbkJhci5wcm90b3R5cGVba2V5XSAhPT0gJ2Z1bmN0aW9uJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAvLyBvdmVycmlkZSBwcm90b3R5cGUgZGVmYXVsdHMgZm9yIHN0YW5kYXJkIDtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXh0ZW5kIHdpdGggYWRkaXRpb25hbCBwcm9wZXJ0aWVzIChmb3IgdXNlIGluIG9uY2hhbmdlIGV2ZW50IGhhbmRsZXJzKVxuICAgICAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBvcHRpb247XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjc3NJbmplY3Rvcihjc3NGaW5CYXJzLCAnZmluYmFyL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zLm9oO1xuXG4gICAgICAgICAgICAvLyBCZWZvcmUgYXBwbHlpbmcgbmV3IHN0eWxlcywgcmV2ZXJ0IGFsbCBzdHlsZXMgdG8gdmFsdWVzIGluaGVyaXRlZCBmcm9tIHN0eWxlc2hlZXRzXG4gICAgICAgICAgICBiYXIucmVtb3ZlQXR0cmlidXRlKCdzdHlsZScpO1xuXG4gICAgICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gYmFyIHNpemUgZ2l2ZW4gYXMgcGVyY2VudGFnZSBvZiBjb250YWluZXIsIGlmIGJhciBoYXMgbWFyZ2lucywgcmVzdGF0ZSBzaXplIGluIHBpeGVscyBsZXNzIG1hcmdpbnMuXG4gICAgICAgICAgICAgICAgICAgIC8vIChJZiBsZWZ0IGFzIHBlcmNlbnRhZ2UsIENTUydzIGNhbGN1bGF0aW9uIHdpbGwgbm90IGV4Y2x1ZGUgbWFyZ2lucy4pXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcmllbnRlZCA9IGF4aXNba2V5XSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbnMgPSBiYXJSZWN0W29yaWVudGVkLm1hcmdpbkxlYWRpbmddICsgYmFyUmVjdFtvcmllbnRlZC5tYXJnaW5UcmFpbGluZ107XG4gICAgICAgICAgICAgICAgICAg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5jZW9mIEVsZW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudGVzdFBhbmVsSXRlbS5pbmRleC5pbm5lckhUTUwgPSBNYXRoLnJvdW5kKGlkeCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBDYWxsIHRoZSBjYWxsYmFja1xuICAgICAgICBpZiAodGhpcy5vbmNoYW5nZSkge1xuICAgICAgICAgICAgdGhpcy5vbmNoYW5nZS5jYWxsKHRoaXMsIE1hdGgucm91bmQoaWR4KSk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBNb3ZlIHRoZSB0aHVtYlxuICAgICAgICBpZiAoc2NhbGVkID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHNjYWxlZCA9IChpZHggLSB0aGlzLl9taW4pIC8gKHRoaXMuX21heCAtIHRoaXMuX21pbikgKiB0aGlzLl90aHVtYk1heDtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnRodW1iLnN0eWxlW3RoaXMub2gubGVhZGluZ10gPSBzY2FsZWQgKyAncHgnO1xuICAgIH0sXG5cbiAgICBzY3JvbGxSZWFsQ29udGVudDogZnVuY3Rpb24gKGlkeCkge1xuICAgICAgICB2YXIgY29udGFpbmVyUmVjdCA9IHRoaXMuY29udGVudC5wYXJlbnRFbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLFxuICAgICAgICAgICAgc2l6ZVByb3AgPSB0aGlzLm9oLnNpemUsXG4gICAgICAgICAgICBtYXhTY3JvbGwgPSBNYXRoLm1heCgwLCB0aGlzLmNvbnRlbnRbc2l6ZVByb3BdIC0gY29udGFpbmVyUmVjdFtzaXplUHJvcF0pLFxuICAgICAgICAgICAgLy9zY3JvbGwgPSBNYXRoLm1pbihpZHgsIG1heFNjcm9sbCk7XG4gICAgICAgICAgICBzY3JvbGwgPSAoaWR4IC0gdGhpcy5fbWluKSAvICh0aGlzLl9tYXggLSB0aGlzLl9taW4pICogbWF4U2Nyb2xsO1xuICAgICAgICAvL2Nvbn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HtcbiAgICAgICAgICAgIGJhclN0eWxlcyA9IGluY3JlbWVudDtcbiAgICAgICAgICAgIGluY3JlbWVudCA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuc3R5bGUgPSB0aGlzLmJhclN0eWxlcyA9IGJhclN0eWxlcyB8fCB0aGlzLmJhclN0eWxlcztcblxuICAgICAgICAvLyBCb3VuZCB0byByZWFsIGNvbnRlbnQ6IENvbnRlbnQgd2FzIGdpdmVuIGJ1dCBubyBvbmNoYW5nZSBoYW5kbGVyLlxuICAgICAgICAvLyBTZXQgdXAgLm9uY2hhbmdlLCAuY29udGFpbmVyU2l6ZSwgYW5kIC5pbmNyZW1lbnQuXG4gICAgICAgIC8vIE5vdGUgdGhpcyBvbmx5IG1ha2VzIHNlbnNlIGlmIHlvdXIgaW5kZXggdW5pdCBpcyBwaXhlbHMuXG4gICAgICAgIGlmICh0aGlzLmNvbnRlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5vbmNoYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMub25jaGFuZ2UgPSB0aGlzLnNjcm9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uY2hhbmdlID09PSB0aGlzLnNjcm9sbFJlYWxDb250ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lclNpemUgPSBjb250YWluZXJSZWN0W3RoaXMub2guc2l6ZV07XG4gICAgICAgICAgICB0aGlzLmluY3JlbWVudCA9IHRoaXMuY29udGFpbmVyU2l6ZSAvICh0aGlzLmNvbnRlbnRTaXplIC0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IwIChwaXhlbHMpLlxuICAgICAqIEBtZW1iZXJPZiBGaW5CYXIucHJvdG90eXBlXG4gICAgICovXG4gICAgX3NldFRodW1iU2l6ZTogZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgb2ggPSB0aGlzLm9oLFxuICAgICAgICAgICAgdGh1bWJDb21wID0gd2luZG93LmdldENvbXB1dGVkU3R5bGUodGhpcy50aHVtYiksXG4gICAgICAgICAgICB0aHVtYk1hcmdpbkxlYWRpbmcgPSBwYXJzZUludCh0aHVtYkNvbXBbb2gubWFyZ2luTGVhZGluZ10pLFxuICAgICAgICAgICAgdGh1bWJNYXJnaW5UcmFpbGluZyA9IHBhcnNlSW50KHRodW1iQ29tcFtvaC5tYXJnaW5UcmFpbGluZ10pLFxuICAgICAgICAgICAgdGh1bWJNYXJnaW5zID0gdGh1bWJNYXJnaW5MZWFkaW5nICsgdGh1bWJNYXJnaW5UcmFpbGluZyxcbiAgICAgICAgICAgIGJhclNpemUgPSB0aGlzLmJhci5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKVtvaC5zaXplXSxcbiAgICAgICAgICAgIHRodW1iU2l6ZSA9IE1hdGgubWF4KDIwLCBiYXJTaXplICogdGhpcy5jb250YWluZXJTaXplIC8gdGhpcy5jb250ZW50U2l6ZSk7XG5cbiAgICAgICAgaWYgKHRoaXMuY29udGFpbmVyU2l6ZSA8IHRoaXMuY29udGVudFNpemUpIHtcbiAgICAgICAgICAgIHRoaXMuYmFyLnN0eWxlLnZpc2liaWxpdHkgPSAndmlzaWJsZSc7XG4gICAgICAgICAgICB0aGlzLnRodW1iLnN0eWxlW29oLnNpemVdID0gdGh1bWJTaXplICsgJ3B4JztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuYmFyLnN0eWxlLnZpc2liaWxpdHkgPSAnaGlkZGVuJztcbiAgICAgICAgfVxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAcHJpdmF0ZVxuICAgICAgICAgKiBAbmF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YICYmIGV2dC5jbGllbnRYIDw9IHRodW1iQm94LnJpZ2h0ICYmXG4gICAgICAgICAgICB0aHVtYkJveC50b3AgPD0gZXZ0LmNsaWVudFkgJiYgZXZ0LmNsaWVudFkgPD0gdGh1bWJCb3guYm90dG9tXG4gICAgICAgICkge1xuICAgICAgICAgICAgdGhpcy5fYm91bmQub25tb3VzZW92ZXIoZXZ0KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX2JvdW5kLm9ubW91c2VvdXQoZXZ0KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV2dC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgfVxufTtcblxudmFyIG9yaWVudGF0aW9uSGFzaGVzID0ge1xuICAgIHZlcnRpY2FsOiB7XG4gICAgICAgIGNvb3JkaW5hdGU6ICAgICAnY2xpZW50WScsXG4gICAgICAgIGF4aXM6ICAgICAgICAgICAncGFnZVknLFxuICAgICAgICBzaXplOiAgICAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgIG91dHNpZGU6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6IC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YWludGVyID0gZnVuY3Rpb24obm93KSB7XG4gICAgICAgICAgICBzZWxmLnRpY2tQYWludChub3cpO1xuICAgICAgICB9O1xuICAgICAgICBwYWludGFibGVzLnB1c2godGhpcyk7XG4gICAgfSxcblxuICAgIHN0b3BQYWludGluZzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHBhaW50YWJsZXMuc3BsaWNlKHBhaW50YWJsZXMuaW5kZXhPZih0aGlzKSwgMSk7XG4gICAgfSxcblxuICAgIGJlZ2luUmVzaXppbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMudGlja1Jlc2l6ZXIgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuY2hlY2tzaXplKCk7XG4gICAgICAgIH07XG4gICAgICAgIHJlc2l6YWJsZXMucHVzaCh0aGlzKTtcbiAgICB9LFxuXG4gICAgc3RvcFJlc2l6aW5nOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmVzaXphYmxlcy5zcGxpY2UocmVzaXphYmxlcy5pbmRleE9mKHRoaXMpLCAxKTtcbiAgICB9LFxuXG4gICAgc3RhcnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmJlZ2luUGFpbnRpbmcoKTtcbiAgICAgICAgdGhpcy5iZWdpblJlc2l6aW5nKCk7XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLnN0b3BQYWludGluZygpO1xuICAgICAgICB0aGlzLnN0b3BSZXNpemluZygpO1xuICAgIH0sXG5cbiAgICBjaGVja3NpemU6IGZ1bmN0aW9uKCkge1xuICAgICAgICAvL3RoaXMgaXMgZXhwZW5zaXZlIGxldHMgZG8gaXQgYXQgc29tZSBtb2R1bG9cbiAgICAgICAgdmFyIHNpemVOb3cgPSB0aGlzLmRpdi5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgaWYgKHNpemVO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XG4gICAgICAgIC8vY29uc29sZS5sb2coJ2RibGNsaWNrJywgdGhpcy5jdXJyZW50S2V5cyk7XG4gICAgfSxcblxuICAgIGdldENoYXJNYXA6IGZ1bmN0aW9uKCkgeyAvL1RPRE86IFRoaXMgaXMgc3RhdGljLiBNYWtlIGl0IGEgcHJvcGVydHkgb2YgdGhlIGNvbnN0cnVjdG9yLlxuICAgICAgICByZXR1cm4gY2hhck1hcDtcbiAgICB9LFxuXG4gICAgZmlua2V5ZG93bjogZnVuY3Rpb24oZSkge1xuICAgICAgICBpZiAoIXRoaXMuaGFzRm9jdXMoKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgLy9lLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgaWYgKGUucmVwZWF0KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5yZXBlYXRLZXkgPT09IGtleUNoYXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5zcGxpY2UodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpLCAxKTtcbiAgICAgICAgaWYgKCF0aGlzLmhhc0ZvY3VzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlc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0dXJuIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgfVxufTtcblxuZnVuY3Rpb24gcGFpbnRMb29wRnVuY3Rpb24obm93KSB7XG4gICAgaWYgKCFwYWludExvb3BSdW5uaW5nKSB7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBwYWludGFibGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwYWludGFibGVzW2ldLnRpY2tQYWludGVyKG5vdyk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKHBhaW50TG9vcEZ1bmN0aW9uKTtcbn1cbnJlcXVlc3RBbmltYXRpb25GcmFtZShwYWludExvb3BGdW5jdGlvbik7XG5cbmZ1bmN0aW9uIHJlc2l6YWJsZXNMb29wRnVuY3Rpb24obm93KSB7XG4gICAgaWYgKCFyZXNpemVMb29wUnVubmluZykge1xuICAgICAgICByZXR1cm47XG4gICAgfVxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcmVzaXphYmxlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzaXphYmxlc1tpXS50aWNrUmVzaXplcihub3cpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgICAgICB9XG4gICAgfVxufVxuc2V0SW50ZXJ2YWwocmVzaXphYmxlc0xvb3BGdW5jdGlvbiwgUkVTSVpFX1BPTExJTkdfSU5URVJWQUwpO1xuXG5mdW5jdGlvbiBtYWtlQ2hhck1hcCgpIHtcbiAgICB2YXIgbWFwID0gW107XG5cbiAgICB2YXIgZW1wdHkgPSBbJycsICcnXTtcblxuICAgIGZvciAodmFyI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tcbiAgICBtYXBbMjIxXSA9IFsnXScsICd9J107XG4gICAgbWFwWzIyMF0gPSBbJ1xcXFwnLCAnfCddO1xuICAgIG1hcFsyMjBdID0gWydDQVBTTE9DSycsICdDQVBTTE9DS1NISUZUJ107XG4gICAgbWFwWzY1XSA9IFsnYScsICdBJ107XG4gICAgbWFwWzgzXSA9IFsncycsICdTJ107XG4gICAgbWFwWzY4XSA9IFsnZCcsICdEJ107XG4gICAgbWFwWzcwXSA9IFsnZicsICdGJ107XG4gICAgbWFwWzcxXSA9IFsnZycsICdHJ107XG4gICAgbWFwWzcyXSA9IFsnaCcsICdIJ107XG4gICAgbWFwWzc0XSA9IFsnaicsICdKJ107XG4gICAgbWFwWzc1XSA9IFsnaycsICdLJ107XG4gICAgbWFwWzc2XSA9IFsnbCcsICdMJ107XG4gICAgbWFwWzE4Nl0gPSBbJzsnLCAnOiddO1xuICAgIG1hcFsyMjJdID0gWydcXCcnLCAnfCddO1xuICAgIG1hcFsxM10gPSBbJ1JFVFVSTicsICdSRVRVUk5TSElGVCddO1xuICAgIG1hcFsxNl0gPSBbJ1NISUZUJywgJ1NISUZUJ107XG4gICAgbWFwWzkwXSA9IFsneicsICdaJ107XG4gICAgbWFwWzg4XSA9IFsneCcsICdYJ107XG4gICAgbWFwWzY3XSA9IFsnYycsICdDJ107XG4gICAgbWFwWzg2XSA9IFsndicsICdWJ107XG4gICAgbWFwWzY2XSA9IFsnYicsICdCJ107XG4gICAgbWFwWzc4XSA9IFsnbicsICdOJ107XG4gICAgbWFwWzc3XSA9IFsnbScsICdNJ107XG4gICAgbWFwWzE4OF0gPSBbJywnLCAnPCddO1xuICAgIG1hcFsxOTBdID0gWycuJywgJz4nXTtcbiAgICBtYXBbMTkxXSA9IFsnLycsICc/J107XG4gICAgbWFwWzE2XSA9IFsnU0hJRlQnLCAnU0hJRlQnXTtcbiAgICBtYXBbMTddID0gWydDVFJMJywgJ0NUUkxTSElGVCddO1xuICAgIG1hcFsxOF0gPSBbJ0F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YCBmdW5jdGlvbiBib3VuZCB0byAnZ2MuJyBhcyBwcmVmaXhcbiAqICogc3RyaW5nIHVzZXMgYGdjLWNvbnNvbGUtbG9nZ2VyYCBmdW5jdGlvbiBib3VuZCB0byBzdHJpbmdcbiAqICogZnVuY3Rpb24gdXNlZCBhcyBpc1xuICovXG5mdW5jdGlvbiBHcmFwaGljc0NvbnRleHQoZ2MsIGxvZ2dlcikge1xuICAgIHRoaXMuZ2MgPSBnYztcblxuICAgIHZhciBzZWxmID0gdGhpcztcbiAgICB2YXIgcmVXRUJLSVQgPSAvXndlYmtpdC87XG5cbiAgICBzd2l0Y2ggKHR5cGVvZiBsb2dnZXIpIHtcblxuICAgICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICAgICAgbG9nZ2VyID0gIGNvbnNvbGVMb2dnZXIuYmluZCh1bmRlZmluZWQsIGxvZ2dlciArICcuJyk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgICAgIGlmIChsb2dnZXIgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIgPSBjb25zb2xlTG9nZ2VyLmJpbmQodW5kZWZpbmVkLCAnZ2MuJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdmdW5jdGlvbic6XG4gICAgICAgICAgICBpZiAobG9nZ2VyLmxlbmd0aCAhPT0gMykge1xuICAgICAgICAgICAgICAgIHRocm93ICdHcmFwaGljc0NvbnRleHQ6IFVzZXItc3VwcGxpZWQgQVBJIGxvZ2dlciBmdW5jdGlvbiBkb2VzIG5vdCBhY2NlcHQgdGhyZWUgcGFyYW1ldGVycy4nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGxvZ2dlciA9IGZhbHNlO1xuICAgIH1cblxuICAgIC8vIFN0dWIgb3V0IGFsbCB0aGUgcHJvdG90eXBlIG1lbWJlcnMgb2YgdGhlIGNhbnZhcyAyRCBncmFwaGljcyBjb250ZXh0OlxuICAgIE9iamVjdC5rZXlzKE9iamVjdC5nZXRQcm90b3R5cGVPZihnYykpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgLy8gU29tZSBvbGRlciBicm93c2VycyAoZS5nLiwgQ2hyb21lIDQwKSBkaWQgbm90IGhhdmUgYWxsIG1lbWJlcnMgb2YgY2FudmFzXG4gICAgLy8gMkQgZ3JhcGhpY3MgY29udGV4dCBpbiB0aGUgcHJvdG90eXBlIHNvIHdlIG1ha2UgdGhpcyBhZGRpdGlvbmFsIGNhbGw6XG4gICAgT2JqZWN0LmtleXMoZ2MpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgZnVuY3Rpb24gTWFrZVN0dWIoa2V5KSB7XG4gICAgICAgIGlmIChrZXkgaW4gR3JhcGhpY3NDb250ZXh0LnByb3RvdHlwZSB8fCByZVdFQktJVC50ZXN0KGtleSkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIGdjW2tleV0gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHNlbGZba2V5XSA9ICFsb2dnZXIgPyBnY1trZXldLmJpbmQoZ2MpIDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvZ2dlcihrZXksIGFyZ3VtZW50cywgZ2Nba2V5XS5hcHBseShnYywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ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4gICAgICAgIHMuZGlzcGF0Y2hFdmVudChldik7XG4gICAgICAgIHBhdGhUZXN0LnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQocGF0aFRlc3QpO1xuICAgICAgICBzciA9IHMgPSBudWxsO1xuICAgIH1cbiAgICBwYXRoVGVzdCA9IG51bGw7XG5cbiAgICB2YXIgdGFyZ2V0ID0ge1xuICAgICAgICBzaGFkb3c6IGZ1bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIGlmIChpbkVsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluRWwuc2hhZG93Um9vdCB8fCBpbkVsLndlYmtpdFNoYWRvd1Jvb3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGNhblRhcmdldDogZnVuY3Rpb24oc2hhZG93KSB7XG4gICAgICAgICAgICByZXR1cm4gc2hhZG93ICYmIEJvb2xlYW4oc2hhZG93LmVsZW1lbnRGcm9tUG9pbnQpO1xuICAgICAgICB9LFxuICAgICAgICB0YXJnZXRpbmdTaGFkb3c6IGZ1bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5zaGFkb3coaW5FbCk7XG4gICAgICAgICAgICBpZiAodGhpcy5jYW5UYXJnZXQocykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgb2xkZXJTaGFkb3c6IGZ1bmN0aW9uKHNoYWRvdykge1xuICAgICAgICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtc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AqIEBwYXJhbSB7T2JqZWN0fSBbaW5EaWN0XSBBbiBvcHRpb25hbCBkaWN0aW9uYXJ5IG9mIGluaXRpYWwgZXZlbnQgcHJvcGVydGllcy5cbiAqIEByZXR1cm4ge0V2ZW50fSBBIG5ldyBQb2ludGVyRXZlbnQgb2YgdHlwZSBgaW5UeXBlYCBhbmQgaW5pdGlhbGl6ZWQgd2l0aCBwcm9wZXJ0aWVzIGZyb20gYGluRGljdGAuXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuXG4gICAgdmFyIE1PVVNFX1BST1BTID0gW1xuICAgICAgICAnYnViYmxlcycsXG4gICAgICAgICdjYW5jZWxhYmxlJyxcbiAgICAgICAgJ3ZpZXcnLFxuICAgICAgICAnZGV0YWlsJyxcbiAgICAgICAgJ3NjcmVlblgnLFxuICAgICAgICAnc2NyZWVuWScsXG4gICAgICAgICdjbGllbnRYJyxcbiAgICAgICAgJ2NsaWVudFknLFxuICAgICAgICAnY3RybEtleScsXG4gICAgICAgICdhbHRLZXknLFxuICAgICAgICAnc2hpZnRLZXknLFxuICAgICAgICAnbWV0YUtleScsXG4gICAgICAgICdidXR0b24nLFxuICAgICAgICAncmVsYXRlZFRhcmdldCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWSdcbiAgICBdO1xuXG4gICAgdmFyIE1PVVNFX0RFRkFVTFRTID0gW1xuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIG51bGwsXG4gICAgICAgIG51bGwsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICAwLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwXG4gICAgXTtcblxuICAgIHZhciBOT1BfRkFDVE9SWSA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7fTtcbiAgICB9O1xuXG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHtcbiAgICAgICAgLy8gVE9ETyhkZnJlZWRtKTogdGhpcyBpcyBvdmVycmlkZGVuIGJ5IHRhcCByZWNvZ25pemVyLCBuZWVkcyByZXZpZXdcbiAgICAgICAgcHJldmVudFRhcDogTk9QX0ZBQ1RPUlksXG4gICAgICAgIG1ha2VCYXNlRXZlbnQ6IGZ1bmN0aW9uKGluVHlwZSwgaW5EaWN0KSB7XG4gICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdFdmVudCcpO1xuICAgICAgICAgICAgZS5pbml0RXZlbnQoaW5UeXBlLCBpbkRpY3QuYnViYmxlcyB8fCBmYWxzZSwgaW5EaWN0LmNhbmNlbGFibGUgfHwgZmFsc2UpO1xuICAgICAgICAgICAgZS5wcmV2ZW50VGFwID0gZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAoZSk7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZUdlc3R1cmVFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgfHwgJyc7XG4gICAgICAgICAgICBlLmh3VGltZXN0YW1wID0gaW5EaWN0Lmh3VGltZXN0YW1wIHx8IDA7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IGluRGljdC5pc1ByaW1hcnkgfHwgZmFsc2U7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSBpbkRpY3QuX3NvdXJjZSB8fCAnJztcbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHNjb3BlLmV2ZW50RmFjdG9yeSA9IGV2ZW50RmFjdG9yeTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgbW9kdWxlIGltcGxlbWVudHMgYW4gbWFwIG9mIHBvaW50ZXIgc3RhdGVzXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBVU0VfTUFQID0gd2luZG93Lk1hcCAmJiB3aW5kb3cuTWFwLnByb3RvdHlwZS5mb3JFYWNoO1xuICAgIHZhciBQT0lOVEVSU19GTiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5zaXplO1xuICAgIH07XG5cbiAgICBmdW5jdGlvbiBQb2ludGVyTWFwKCkge1xuICAgICAgICBpZiAoVVNFX01BUCkge1xuICAgICAgICAgICAgdmFyIG0gPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICBtLnBvaW50ZXJzID0gUE9JTlRFUlNfRk47XG4gICAgICAgICAgICByZXR1cm4gbTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMua2V5cyA9IFtdO1xuICAgICAgICAgICAgdGhpcy52YWx1ZXMgPSBbXTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFBvaW50ZXJNYXAucHJvdG90eXBlID0ge1xuICAgICAgICBzZXQ6IGZ1bmN0aW9uKGluSWQsIGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBpID0gdGhpcy5rZXlzLmluZGV4T2YoaW5JZCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEFTX1NWR19JTlNUQU5DRSA9ICh0eXBlb2YgU1ZHRWxlbWVudEluc3RhbmNlICE9PSAndW5kZWZpbmVkJyk7XG5cbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuXG4gICAgLy8gc2V0IG9mIHJlY29nbml6ZXJzIHRvIHJ1biBmb3IgdGhlIGN1cnJlbnRseSBoYW5kbGVkIGV2ZW50XG4gICAgdmFyIGN1cnJlbnRHZXN0dXJlcztcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbW9kdWxlIGlzIGZvciBub3JtYWxpemluZyBldmVudHMuIE1vdXNlIGFuZCBUb3VjaCBldmVudHMgd2lsbCBiZVxuICAgICAqIGNvbGxlY3RlZCBoZXJlLCBhbmQgZmlyZSBQb2ludGVyRXZlbnRzIHRoYXQgaGF2ZSB0aGUgc2FtZSBzZW1hbnRpY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zKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIGVsZW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBFVkVOVFNcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLnNldChpbkV2ZW50LnBvaW50ZXJJZCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCdkb3duJywgaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIG1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIHBpcGUgbW92ZSBldmVudHMgaW50byBnZXN0dXJlIHF1ZXVlIGRpcmVjdGx5XG4gICAgICAgICAgICBpbkV2ZW50LnR5cGUgPSAnbW92ZSc7XG4gICAgICAgICAgICB0aGlzLmZpbGxHZXN0dXJlUXVldWUoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmZpcmVFdmVudCgndXAnLCBpbkV2ZW50KTtcbiAgICAgICAgICAgIHRoaXMucmVxdWlyZWRHZXN0dXJlcy5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGluRXZlbnQudGFwUHJldmVudGVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCd1cCcsIGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEdlc3R1cmVEZXBlbmRlbmN5OiBmdW5jdGlvbihub2RlLCBjdXJyZW50R2VzdHVyZXMpIHtcbiAgICAgICAgICAgIHZhciBnZXN0dXJlc1dhbnRlZCA9IG5vZGUuX3BnRXZlbnRzO1xuICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkICYmIGN1cnJlbnRHZXN0dXJlcykge1xuICAgICAgICAgICAgICAgIHZhciBnayA9IE9iamVjdC5rZXlzKGdlc3R1cmVzV2FudGVkKTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciwgcmksIGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBMSVNURU5FUiBMT0dJQ1xuICAgICAgICBldmVudEhhbmRsZXI6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgdXNlZCB0byBwcmV2ZW50IG11bHRpcGxlIGRpc3BhdGNoIG9mIGV2ZW50cyBmcm9tXG4gICAgICAgICAgICAvLyBwbGF0Zm9ybSBldmVudHMuIFRoaXMgY2FuIGhhcHBlbiB3aGVuIHR3byBlbGVtZW50cyBpbiBkaWZmZXJlbnQgc2NvcGVzXG4gICAgICAgICAgICAvLyBhcmUgc2V0IHVwIHRvIGNyZWF0ZSBwb2ludGVyIGV2ZW50cywgd2hpY2ggaXMgcmVsZXZhbnQgdG8gU2hhZG93IERPTS5cblxuICAgICAgICAgICAgdmFyIHR5cGUgPSBpbkV2ZW50LnR5cGU7XG5cbiAgICAgICAgICAgIC8vIG9ubHkgZ2VuZXJhdGUgdGhlIGxpc3Qgb2YgZGVzaXJlZCBldmVudHMgb24gXCJkb3duXCJcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ21vdXNlZG93bicgfHwgdHlwZSA9PT0gJ3BvaW50ZXJkb3duJyB8fCB0eXBlID09PSAnTVNQb2ludGVyRG93bicpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWluRXZlbnQuX2hhbmRsZWRCeVBHKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlcyA9IHt9O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGluIElPUyBtb2RlLCB0aGVyZSBpcyBvbmx5IGEgbGlzdGVuZXIgb24gdGhlIGRvY3VtZW50LCBzbyB0aGlzIGlzIG5vdCByZS1lbnRyYW50XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdm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Byb3BlcnRpZXMuXG4gICAgICAgICAqL1xuICAgICAgICBjbG9uZUV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZXZlbnRDb3B5ID0gT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgICAgICAgICBwO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBDTE9ORV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBDTE9ORV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBldmVudENvcHlbcF0gPSBpbkV2ZW50W3BdIHx8IENMT05FX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgICAgIC8vIFdvcmsgYXJvdW5kIFNWR0luc3RhbmNlRWxlbWVudCBzaGFkb3cgdHJlZVxuICAgICAgICAgICAgICAgIC8vIFJldHVybiB0aGUgPHVzZT4gZWxlbWVudCB0aGF0IGlzIHJlcHJlc2VudGVkIGJ5IHRoZSBpbnN0YW5jZSBmb3IgU2FmYXJpLCBDaHJvbWUsIElFLlxuICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAgICAgIH0sXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBEaXNwYXRjaGVzIHRoZSBldmVudCB0byBpdHMgdGFyZ2V0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IFRoZSBldmVudCB0byBiZSBkaXNwYXRjaGVkLlxuICAgICAgICAgKiBAcmV0dXJuIHtCb29sZWFufSBUcnVlIGlmIGFuIGV2ZW50IGhhbmRsZXIgcmV0dXJucyB0cnVlLCBmYWxzZSBvdGhlcndpc2UuXG4gICAgICAgICAqL1xuICAgICAgICBkaXNwYXRjaEV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuX3RhcmdldDtcbiAgICAgICAgICAgIGlmICh0KSB7XG4gICAgICAgICAgICAgICAgdC5kaXNwYXRjaEV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIC8vIGNsb25lIHRoZSBldmVudCBmb3IgdGhlIGdlc3R1cmUgc3lzdGVtIHRvIHByb2Nlc3NcbiAgICAgICAgICAgICAgICAvLyBjbG9uZSBhZnRlciBkaXNwYXRjaCB0byBwaWNrIHVwIGdlc3R1cmUgcHJldmVudGlvbiBjb2RlXG4gICAgICAgICAgICAgICAgdmFyIGNsb25lID0gdGhpcy5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGNsb25lLnRhcmdldCA9IHQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maWxsR2VzdHVyZVF1ZXVlKGNsb25lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVRyaWdnZXI6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgLy8gcHJvY2VzcyB0aGUgZ2VzdHVyZSBxdWV1ZVxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGUsIHJnOyBpIDwgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLmNhbGwoZywgZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgZm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ICAgICogQHJldHVybiBCb29sZWFuIGBnZXN0dXJlYCBpcyBhIHZhbGlkIGdlc3R1cmVcbiAgICAgKi9cbiAgICBzY29wZS5hY3RpdmF0ZUdlc3R1cmUgPSBmdW5jdGlvbihub2RlLCBnZXN0dXJlKSB7XG4gICAgICAgIHZhciBnID0gZ2VzdHVyZS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICB2YXIgZGVwID0gZGlzcGF0Y2hlci5kZXBlbmRlbmN5TWFwW2ddO1xuICAgICAgICBpZiAoZGVwKSB7XG4gICAgICAgICAgICB2YXIgcmVjb2duaXplciA9IGRpc3BhdGNoZXIuZ2VzdHVyZXNbZGVwLmluZGV4XTtcbiAgICAgICAgICAgIGlmICghbm9kZS5fcGdMaXN0ZW5lcnMpIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnJlZ2lzdGVyKG5vZGUpO1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFRPRE8oZGZyZWVkbSk6IHJlLWV2YWx1YXRlIGJvb2trZWVwaW5nIHRvIGF2b2lkIHVzaW5nIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgIGlmIChyZWNvZ25pemVyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gcmVjb2duaXplci5kZWZhdWx0QWN0aW9ucyAmJiByZWNvZ25pemVyLmRlZmF1bHRBY3Rpb25zW2ddO1xuICAgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW50cykge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzID0ge307XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBub2RlLl9wZ0V2ZW50c1tnXSA9IChub2RlLl9wZ0V2ZW50c1tnXSB8fCAwKSArIDE7XG4gICAgICAgICAgICBub2RlLl9wZ0xpc3RlbmVycysrO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBCb29sZWFuKGRlcCk7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogTGlzdGVuIGZvciBgZ2VzdHVyZWAgZnJvbSBgbm9kZWAgd2l0aCBgaGFuZGxlcmAgZnVuY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge0VsZW1lbnR9IG5vZGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gZ2VzdHVyZVxuICAgICAqIEBwYXJhbSB7RnVuY3Rp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BnTGlzdGVuZXJzLS07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdMaXN0ZW5lcnMgPT09IDApIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnVucmVnaXN0ZXIobm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHMpIHtcbiAgICAgICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHNbZ10gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzW2ddLS07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZS5fcGdFdmVudHNbZ10gPSAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gQm9vbGVhbihkZXApO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBTdG9wIGxpc3RlbmluZyBmb3IgYGdlc3R1cmVgIGZyb20gYG5vZGVgIHdpdGggYGhhbmRsZXJgIGZ1bmN0aW9uLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtFbGVtZW50fSBub2RlXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGdlc3R1cmVcbiAgICAgKiBAcGFyYW0ge0Z1bmN0aW9ufSBoYW5kbGVyXG4gICAgICogQHBhcmFtIHtCb29sZWFufSBjYXB0dXJlXG4gICAgICovXG4gICAgc2NvcGUucmVtb3ZlRXZlbnRMaXN0ZW5lciA9IGZ1bmN0aW9uKG5vZGUsIGdlc3R1cmUsIGhhbmRsZXIsIGNhcHR1cmUpIHtcbiAgICAgICAgaWYgKGhhbmRsZXIpIHtcbiAgICAgICAgICAgIHNjb3BlLmRlYWN0aXZhdGVHZXN0dXJlKG5vZGUsIGdlc3R1cmUpO1xuICAgICAgICAgICAgbm9kZS5yZW1vdmVFdmVudExpc3RlbmVyKGdlc3R1cmUsIGhhbmR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mdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbHRzID0gdGhpcy5sYXN0VG91Y2hlcztcbiAgICAgICAgICAgIHZhciB4ID0gaW5FdmVudC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGx0cy5sZW5ndGgsIHQ7IGkgPCBsICYmICh0ID0gbHRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgLy8gc2ltdWxhdGVkIG1vdXNlIGV2ZW50cyB3aWxsIGJlIHN3YWxsb3dlZCBuZWFyIGEgcHJpbWFyeSB0b3VjaGVuZFxuICAgICAgICAgICAgICAgIHZhciBkeCA9IE1hdGguYWJzKHggLSB0LngpLFxuICAgICAgICAgICAgICAgICAgICBkeSA9IE1hdGguYWJzKHkgLSB0LnkpO1xuICAgICAgICAgICAgICAgIGlmIChkeCA8PSBERURVUF9ESVNUICYmIGR5IDw9IERFRFVQX0RJU1QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ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gICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB2YXIgY3RlID0gdGhpcy5jdXJyZW50VG91Y2hFdmVudDtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluVG91Y2gpO1xuICAgICAgICAgICAgLy8gU3BlYyBzcGVjaWZpZXMgdGhhdCBwb2ludGVySWQgMSBpcyByZXNlcnZlZCBmb3IgTW91c2UuXG4gICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBjYW4gc3RhcnQgYXQgMC5cbiAgICAgICAgICAgIC8vIEFkZCAyIHRvIHRoZSB0b3VjaCBpZGVudGlmaWVyIGZvciBjb21wYXRpYmlsaXR5LlxuICAgICAgICAgICAgdmFyIGlkID0gZS5wb2ludGVySWQgPSBpblRvdWNoLmlkZW50aWZpZXIgKyAyO1xuICAgICAgICAgICAgZS50YXJnZXQgPSB0aGlzLmZpbmRUYXJnZXQoaW5Ub3V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uKGluRXZlbnQsIGluRnVuY3Rpb24pIHtcbiAgICAgICAgICAgIHZhciB0bCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXM7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50ID0gaW5FdmVudDtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCB0LCBwOyBpIDwgdGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gRm9yIHNpbmdsZSBheGlzIHNjcm9sbGVycywgZGV0ZXJtaW5lcyB3aGV0aGVyIHRoZSBlbGVtZW50IHNob3VsZCBlbWl0XG4gICAgICAgIC8vIHBvaW50ZXIgZXZlbnRzIG9yIGJlaGF2ZSBhcyBhIHNjcm9sbGVyXG4gICAgICAgIHNob3VsZFNjcm9sbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQ7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gc2NvcGUudGFyZ2V0RmluZGluZy5maW5kVG91Y2hBY3Rpb24oaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgdmFyIHNjcm9sbEF4aXMgPSB0aGlzLnRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlKHRvdWNoQWN0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsQXhpcyA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgZWxlbWVudCBpcyBhIHRvdWNoLWFjdGlvbjogbm9uZSwgc2hvdWxkIG5ldmVyIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICByZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNjcm9sbEF4aXMgPT09ICdYWScpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBlbGVtZW50IHNob3VsZCBhbHdheXMgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayB0aGUgaW50ZW5kZWQgc2Nyb2xsIGF4aXMsIGFuZCBvdGhlciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvLyBtYWtpbmcgZXZlbnRzXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IGRhID49IGRvYTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoOiBmdW5jdGlvbihpblRMLCBpbklkKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGluVEwubGVuZ3RoLCB0OyBpIDwgbCAmJiAodCA9IGluVExbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAodC5pZGVudGlmaWVyID09PSBpbklkKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gSW4gc29tZSBpbnN0YW5jZXMsIGEgdG91Y2hzdGFydCBjYW4gaGFwcGVuIHdpdGhvdXQgYSB0b3VjaGVuZC4gVGhpc1xuICAgICAgICAvLyBsZWF2ZXMgdGhlIHBvaW50ZXJtYXAgaW4gYSBicm9rZW4gc3RhdGUuXG4gICAgICAgIC8vIFRoZXJlZm9yZSwgb24gZXZlcnkgdG91Y2hzdGFydCwgd2UgcmVtb3ZlIHRoZSB0b3VjaGVzIHRoYXQgZGlkIG5vdCBmaXJlIGFcbiAgICAgICAgLy8gdG91Y2hlbmQgZXZlbnQuXG4gICAgICAgIC8vIFRvIGtlZXAgc3RhdGUgZ2xvYmFsbHkgY29uc2lzdGVudCwgd2UgZmlyZSBhXG4gICAgICAgIC8vIHBvaW50ZXJjYW5jZWwgZm9yIHRoaXMgXCJhYmFuZG9uZWRcIiB0b3VjaFxuICAgICAgICB2YWN1dW1Ub3VjaGVzOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgdGwgPSBpbkV2ZW50LnRvdWNoZXM7XG4gICAgICAgICAgICAvLyBwb2ludGVybWFwLnBvaW50ZXJzKCkgc2hvdWxkIGJlIDwgdGwubGVuZ3RoIGhlcmUsIGFzIHRoZSB0b3VjaHN0YXJ0IGhhcyBub3RcbiAgICAgICAgICAgIC8vIGJlZW4gcHJvY2Vzc2VkIHlldC5cbiAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPj0gdGwubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdmFyIGQgPSBbXTtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIGtleSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOZXZlciByZW1vdmUgcG9pbnRlcklkID09IDEsIHdoaWNoIGlzIG1vdXNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBhcmUgMiBzbWFsbGVyIHRoYW4gdGhlaXIgcG9pbnRlcklkLCB3aGljaCBpcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXggaW4gcG9pbnRlcm1hcC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5Qb2ludGVyKSB7XG4gICAgICAgICAgICBpblBvaW50ZXIucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5Qb2ludGVyKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIudXAoaW5Qb2ludGVyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoY2FuY2VsOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpbkV2ZW50Ll9jYW5jZWwgPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLmNhbmNlbCk7XG4gICAgICAgIH0sXG4gICAgICAgIGNsZWFuVXBQb2ludGVyOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGluUG9pbnRlci5wb2ludGVySWQpO1xuICAgICAgICAgICAgdGhpcy5yZW1vdmVQcmltYXJ5UG9pbnRlcihpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICAvLyBwcmV2ZW50IHN5bnRoIG1vdXNlIGV2ZW50cyBmcm9tIGNyZWF0aW5nIHBvaW50ZXIgZXZlbnRzXG4gICAgICAgIGRlZHVwU3ludGhNb3VzZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGx0cyA9IHNjb3BlLm1vdXNlRXZlbnRzLmxhc3RUb3VjaGVzO1xuICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgLy8gb25seSB0aGUgcHJpbWFyeSBmaW5nZXIgd2lsbCBzeW50aCBtb3VzZSBldmVudHNcbiAgICAgICAgICAgIGlmICh0aGlzLmlzUHJpbWFyeVRvdWNoKHQpKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVtZW1iZXIgeC95IG9mIGxhc3QgdG91Y2hcbiAgICAgICAgICAgICAgICB2YXIgbHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIHg6IHQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogdC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4g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HlwZW9mIHdpbmRvdy5NU1BvaW50ZXJFdmVudC5NU1BPSU5URVJfVFlQRV9NT1VTRSA9PT0gJ251bWJlcic7XG4gICAgdmFyIG1zRXZlbnRzID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdNU1BvaW50ZXJEb3duJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJNb3ZlJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJVcCcsXG4gICAgICAgICAgICAnTVNQb2ludGVyQ2FuY2VsJyxcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgUE9JTlRFUl9UWVBFUzogW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAndW5hdmFpbGFibGUnLFxuICAgICAgICAgICAgJ3RvdWNoJyxcbiAgICAgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2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sXG4gICAgICAgIHByZXBhcmVFdmVudDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAncG9pbnRlcic7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcmRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAg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gICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0cmFja3N0YXJ0JyxcbiAgICAgICAgICAgICd0cmFjaycsXG4gICAgICAgICAgICAndHJhY2t4JyxcbiAgICAgICAgICAgICd0cmFja3knLFxuICAgICAgICAgICAgJ3RyYWNrZW5kJ1xuICAgICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ucGFnZVggPSBpbkV2ZW50LnBhZ2VYO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5zY3JlZW5YID0gaW5FdmVudC5zY3JlZW5YO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54RGlyZWN0aW9uID0gdC54RGlyZWN0aW9uO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGluVHlwZSAhPT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZHkgPSBkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmRkeSA9IGRkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnkgPSBpbkV2ZW50Lnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmNsaWVudFkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnBhZ2VZID0gaW5FdmVudC5wYWdlWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uc2NyZWVuWSA9IGluRXZlbnQuc2NyZWVuWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ueURpcmVjdGlvbiA9IHQueURpcmVjdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBlID0gZXZlbnRGYWN0b3J5Lm1ha2VHZXN0dXJlRXZlbnQoaW5UeXBlLCBnZXN0dXJlUHJvdG8pO1xuICAgICAgICAgICAgdC5kb3duVGFyZ2V0LmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAoaW5FdmVudC5wb2ludGVyVHlwZSA9PT0gJ21vdXNlJyA/IGluRXZlbnQuYnV0dG9ucyA9PT0gMSA6IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNreScsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBpbkV2ZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAocCkge1xuICAgICAgICAgICAgICAgIGlmIChwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja2VuZCcsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwb2ludGVyb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WVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IHRoaXMuaGVsZFBvaW50ZXIucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgcG9pbnRlcklkOiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCxcbiAgICAgICAgICAgICAgICB4OiB0aGlzLmhlbGRQb2ludGVyLmNsaWVudFgsXG4gICAgICAgICAgICAgICAgeTogdGhpcy5oZWxkUG9pbnRlci5jbGllbnRZLFxuICAgICAgICAgICAgICAg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qIEB0eXBlIE51bWJlclxuICovXG4vKipcbiAqIFR5cGUgb2YgdGhlIHBvaW50ZXIgdGhhdCBtYWRlIHRoZSB0YXAuXG4gKiBAcHJvcGVydHkgcG9pbnRlclR5cGVcbiAqIEB0eXBlIFN0cmluZ1xuICovXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgZGlzcGF0Y2hlciA9IHNjb3BlLmRpc3BhdGNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRhcCA9IHtcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnZG93bicsXG4gICAgICAgICAgICAndXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0YXAnXG4gICAgICAgIF0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAhaW5FdmVudC50YXBQcmV2ZW50ZWQpIHtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLnNldChpbkV2ZW50LnBvaW50ZXJJZCwge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGluRXZlbnQudGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICBidXR0b25zOiBpbkV2ZW50LmJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZXk6IGluRXZlbnQuY3RybEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFLZXk6IGluRXZlbnQubWV0YUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoaWZ0S2V5OiBpbkV2ZW50LnNoaWZ0S2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgX3NvdXJjZTogJ3RhcCdcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIC8vIHBhdGNoIGV2ZW50RmFjdG9yeSB0byByZW1vdmUgaWQgZnJvbSB0YXAncyBwb2ludGVybWFwIGZvciBwcmV2ZW50VGFwIGNhbGxzXG4gICAgZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgIHJldHVybiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGUudGFwUHJldmVudGVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKGUucG9pbnRlcklkKTtcbiAgICAgICAgfTtcbiAgICB9O1xuICAgIGRpc3BhdGNoZXIucmVnaXN0ZXJHZXN0dXJlKCd0YXAnLCB0YXApO1xufSkoZXhwb3J0cyk7XG5cbi8qXG4gKiBCYXNpYyBzdHJhd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4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG9pbnRzLmEuY2xpZW50WCArIHBvaW50cy5iLmNsaWVudFgpIC8gMjtcbiAgICAgICAgICAgIHkgPSBNYXRoLmFicyhwb2ludHMuYS5jbGllbnRZICsgcG9pbnRzLmIuY2xpZW50WSkgLyAyO1xuICAgICAgICAgICAgcG9pbnRzLmNlbnRlciA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwb2ludHMuZGlhbWV0ZXIgPSBkaXN0O1xuICAgICAgICAgICAgcmV0dXJuIHBvaW50cztcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY0FuZ2xlOiBmdW5jdGlvbihwb2ludHMpIHtcbiAgICAgICAgICAgIHZhciB4ID0gcG9pbnRzLmEuY2xpZW50WCAtIHBvaW50cy5iLmNsaWVudFg7XG4gICAgICAgICAgICB2YXIgeSA9IHBvaW50cy5hLmNsaWVudFkgLSBwb2ludHMuYi5jbGllbnRZO1xuICAgICAgICAgICAgcmV0dXJuICgzNjAgKyBNYXRoLmF0YW4yKHksIHgpICogUkFEX1RPX0RFRykgJSAzNjA7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIGRpc3BhdGNoZXIucmVnaXN0ZXJHZXN0dXJlKCdwaW5jaCcsIHBpbmNoKTtcbn0pKGV4cG9ydHMpOyIsIid1c2Ugc3RyaWN0JztcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gICAgSlNEYXRhU291cmNlOiByZXF1aXJlKCcuL2pzL0RhdGFTb3VyY2UnKSxcbiAgICBEYXRhU291cmNlU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BwYXJhbSB7c3RyaW5nfSBrZXlcbiAgICAgKi9cbiAgICBpbml0aWFsaXplOiBmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICAgICAqL1xuXG4gICAgICAgIHRoaXMubGFiZWwgPSBrZXk7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtzdHJpbmdbXX1cbiAgICAgICAgICogQGRlZmF1bHQgZmFsc2VcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGF0YSA9IFsnJ107IC8vIFRPRE86IFdoeSBpcyB0aGlzIGZpcnN0IGVsZW1lbnQgbmVlZGVkP1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyW119XG4gICAgICAgICAqIEBkZWZhdWx0IFsnJ11cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaW5kZXggPSBbXTsgLy8gVE9ETzogZm9ybWVybHkgcm93SW5kZXhcblxuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFOb2RlQmFzZS5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhhc0NoaWxkcmVuID0gZmFsc2U7IC8vIFRPRE86IFdoZXJlL2hvdyBpcyB0aGlzIHVzZWQ/XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgICAqIEBkZWZhdWx0IDBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGVwdGggPSAwO1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyfVxuICAgICAgICAgKiBAZGVmYXVsdCAxXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhlaWdodCA9IDE7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAgICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leHBhbmRlZCA9IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVMZWFmLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0VmFsdWU6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVt4XTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlTGVhZi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGVwdGhcbiAgICAgKi9cbiAgICB0b0FycmF5OiBmdW5jdGlvbihkZXB0aCkge1xuICAgICAgICB0aGlzLmRlcHRoID0gZGVwdGg7XG4gICAgICAgIHRoaXMuZGF0YVswXSA9IHRoaXMuY29tcHV0ZURlcHRoU3RyaW5nKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBjb21w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cblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRWYWx1ZTogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgcm93ID0gdGhpcy5nZXRSb3coeSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzLmdldFJvdyh5KVt0aGlzLmZpZWxkc1t4XV0gPSB2YWx1ZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGEubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfVxuICAgICAqL1xuICAgIGdldENvbHVtbkNvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmllbGRzKCkubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKip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XJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBidWlsZEdyb3VwVHJlZTogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuZ3JvdXBCeXMsXG4gICAgICAgICAgICBsZWFmRGVwdGggPSBncm91cEJ5cy5sZW5ndGggLSAxLFxuICAgICAgICAgICAgc291cmNlID0gdGhpcy5kYXRhU291cmNlLFxuICAgICAgICAgICAgcm93Q291bnQgPSBzb3VyY2UuZ2V0Um93Q291bnQoKSxcbiAgICAgICAgICAgIHRyZWUgPSB0aGlzLnRyZWUgPSBuZXcgRGF0YU5vZGVUcmVlKCdUb3RhbHMnKTtcblxuICAgICAgICAvLyBmaXJzdCBzb3J0IGRhdGFcbiAgICAgICAgaWYgKHRoaXMucHJlc29ydEdyb3Vwcykge1xuICAgICAgICAgICAgZ3JvdXBCeXMucmV2ZXJzZSgpLmZvckVhY2goZnVuY3Rpb24oZ3JvdXBCeSkge1xuICAgICAgICAgICAgICAgIHNvdXJjZSA9IG5ldyBEYXRhU291cmNlU29ydGVyKHNvdXJjZSk7XG4gICAgICAgICAgICAgICAgc291cmNlLnNvcnRPbihncm91cEJ5KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCByb3dDb3VudDsgcisrKSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHRyZWU7XG5cbiAgICAgICAgICAgIGdyb3VwQnlzLmZvckVhY2goZnVuY3Rpb24oZywgYykgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWxvb3AtZnVuY1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBzb3VyY2UuZ2V0VmFsdWUoZywgciksXG4gICAgICAgICAgICAgICAgICAgIGZhY3RvcnlEYXRhTm9kZSA9IChjID09PSBsZWFmRGVwdGgpID8gZmFjdG9yeURhdGFOb2RlTGVhZiA6IG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gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEZpZWxkczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlSW5kZXhlZC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7c3RyaW5nW119IGhlYWRlcnNcbiAgICAgKiBAcmV0dXJucyB7c3RyaW5nW119XG4gICAgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldEhlYWRlcnMoaGVhZGVycyk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogQHJldHVybnMge3N0cmluZ1tdfVxuICAgICAqL1xuICAgIGdldEhlYWRlcnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldEhlYWRlcnMoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEdyYW5kVG90YWxzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRHcmFuZFRvdGFscygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUluZGV4ZWQucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtvYmplY3RbXX0gYXJyYXlPZlVuaWZvcm1PYmplY3RzXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIHNldERhdGE6IGZ1bmN0aW9uKGFycmF5T2ZVbmlmb3JtT2JqZWN0cykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldERhdGEoYXJyYXlPZlVuaWZvcm1PYmplY3RzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGNsZWFySW5kZXg6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmluZGV4Lmxlbmd0aCA9IDA7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlSW5kZXhlZC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gcHJlZGljYXRlXG4gICAgICogQHJldHVybnMge251bWJlcltdfVxuICAgICAqL1xuICAgIGJ1aWxkSW5kZXg6IGZ1bmN0aW9uKHByZWRpY2F0ZSkge1xuICAgICAgICB2YXIgcm93Q291bnQgPSB0aGlzLmRhdGFTb3VyY2UuZ2V0Um93Q291bnQoKSxcbiAgICAgICAgICAgIGluZGV4ID0gdGhpcy5pbmRleDtcblxuICAgICAgICB0aGlzLmNsZWFySW5kZXgoKTtcblxuICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgIGlmICghcHJlZGljYXRlIHx8IHByZWRpY2F0ZS5jYWxsKHRoaXMsIHIsIHRoaXMuZGF0YVNvdXJjZS5nZXRSb3cocik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G4gICAgICAgICAgICBuZXdNYXAuc2V0KGtleSwgdHJhbnNmb3JtZWQpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIG5ld01hcDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtNYXBweX1cbiAgICAgKi9cbiAgICBjb3B5OiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGtleXMgPSB0aGlzLmtleXMsXG4gICAgICAgICAgICBuZXdNYXAgPSBuZXcgTWFwcHkoKSxcbiAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgbmV3TWFwLnNldChrZXksIHZhbHVlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBuZXdNYXA7XG4gICAgfVxuXG59O1xuXG52YXIgT0lEX1BSRUZJWCA9ICcufi4jJV8nOyAvL3RoaXMgc2hvdWxkIGJlIHNvbWV0aGluZyB3ZSBuZXZlciB3aWxsIHNlZSBhdCB0aGUgYmVnaW5uaW5nIG9mIGEgc3RyaW5nXG52YXIgY291bnRlciA9IDA7XG5cbmZ1bmN0aW9uIGhhc2goa2V5KSB7XG4gICAgdmFyIHR5cGVPZiA9IHR5cGVvZiBrZXk7XG5cbiAgICBzd2l0Y2ggKHR5cGVPZikge1xuICAgICAgICBjYXNlICdudW1iZXInOlxuICAgICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgY2FzZSAnc3ltYm9sJzpcbiAgICAgICAgICAgIHJldHVybiBPSURfUFJFRklYICsgdHlwZU9mICsgJ18nICsga2V5O1xuXG4gICAgICAgIGNhc2UgJ3VuZGVmaW5lZCc6XG4gICAgICAgICAgICByZXR1cm4g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ZXRoaW5nIHRvIGRvXG4gICAgICAgIHN3aXRjaCAoZGlyZWN0aW9uKSB7XG4gICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgcmV0dXJuOyAvLyBiYWlsOiBub3RoaW5nIHRvIHNvcnRcblxuICAgICAgICAgICAgY2FzZSB1bmRlZmluZWQ6IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tZmFsbHRocm91Z2hcbiAgICAgICAgICAgICAgICBkaXJlY3Rpb24gPSAxO1xuICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgIGNvbXBhcmUgPSBhc2NlbmRpbmcodHlwZW9mIGdldFZhbHVlKDApKTtcbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgY2FzZSAtMTpcbiAgICAgICAgICAgICAgICBjb21wYXJlID0gZGVzY2VuZGluZyh0eXBlb2YgZ2V0VmFsdWUoMCkpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gc2V0IHVwIHRoZSBzb3J0Li4uLi5cbiAgICAgICAgdmFyIHRtcCA9IG5ldyBBcnJheShpbmRleC5sZW5ndGgpO1xuXG4gICAgICAgIC8vIGFkZCB0aGUgaW5kZXggZm9yIFwic3RhYmlsaXR5XCJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGluZGV4Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICB0bXBbaV0gPSBbZ2V0VmFsdWUoaSksIGldO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gZG8gdGhlIGFjdHVhbCBzb3J0XG4gICAgICAgIHRtcC5zb3J0KGNvbXBhcmUpO1xuXG4gICAgICAgIC8vIGNvcHkgdGhlIHNvcnRlZCB2YWx1ZXMgaW50byBvdXIgaW5kZXggdmVjdG9yXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBpbmRleC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaW5kZXhbaV0gP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IG9uIHRoZSBsaXN0IGVsZW1lbnRzXG4gICAgICAgIHRoaXMubW9kZWxMaXN0cy5mb3JFYWNoKGZ1bmN0aW9uIChtb2RlbExpc3QpIHtcbiAgICAgICAgICAgIG1vZGVsTGlzdC5lbGVtZW50LnJlbW92ZUV2ZW50TGlzdGVuZXIoJ3doZWVsJywgY2FwdHVyZUV2ZW50KTtcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIHBvaW50SW5MaXN0UmVjdHM6IGZ1bmN0aW9uIChwb2ludCkge1xuICAgICAgICByZXR1cm4gdGhpcy5tb2RlbExpc3RzLmZpbmQoZnVuY3Rpb24gKG1vZGVsTGlzdCkge1xuICAgICAgICAgICAgdmFyIHJlY3QgPSBtb2RlbExpc3QuZWxlbWVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgICAgICAgcmVjdCA9IHtcbiAgICAgICAgICAgICAgICBsZWZ0OiAgIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5sZWZ0LFxuICAgICAgICAgICAgICAgIHRvcDogICAgd2luZG93LnNjcm9sbFkgKyByZWN0LnRvcCxcbiAgICAgICAgICAgICAgICByaWdodDogIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5yaWdodCxcbiAgICAgICAgICAgICAgICBib3R0b206IHdpbmRvdy5zY3JvbGxZICsgcmVjdC5ib3R0b20sXG4gICAgICAgICAgICAgICAgd2lkdGg6ICByZWN0LndpZHRoLFxuICAgICAgICAgICAgICAgIGhlaWdodDogcmVjdC5oZWlnaHRcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcblxuICAgICAgICAgICAgaWYgKHBvaW50SW5SZWN0KHBvaW50LCByZWN0KSkge1xuICAgICAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgLy8gZm91bmRcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcG9pbnRJbkl0ZW1SZWN0czogZnVuY3Rpb24gKHBvaW50LCBleGNlcHQxLCBleGNlcHQyKSB7XG4gICAgICAgIHJldHVybiB0aGlzLml0ZW1zLmZpbmQoZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgIHZhciBlbGVtZW50ID0gaXRlbS5lbGVtZW50O1xuICAgICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgICAgICBlbGVtZW50ICE9PSBleGNlcHQxICYmXG4gICAgICAgICAgICAgICAgZWxlbWVudCAhPT0gZXhjZXB0MiAmJlxuICAgICAgICAgICAgICAgIHBvaW50SW5SZWN0KHBvaW50LCBpdGVtLnJlY3QpXG4gICAgICAgICAgICApO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgLy8gZ2V0IHBvc2l0aW9ucyBvZiBhbGwgbGlzdCBpdGVtcyBpbiBwYWdlIGNvb3JkcyAobm9ybWFsaXplZCBmb3Igd2luZG93IGFuZCBsaXN0IHNjcm9sbGluZylcbiAgICBnZXRBbGxJdGVtQm91bmRpbmdSZWN0czogZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgbW9kZWxMaXN0cyA9IHRoaXMubW9kZWxMaXN0cywgaGVpZ2h0O1xuICAgICAgICB0aGlzLml0ZW1zLmZvckVhY2goZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgIHZhciBpdGVtRWxlbWVudCA9IGl0ZW0uZWxlbWVudCxcbiAgICAgICAgICAgICAgICBsaXN0RWxlbWVudCA9IGl0ZW1FbGVtZW50LnBhcmVudEVsZW1lbnQsXG4gICAgICAgICAgICAgICAgbGlzdCA9IG1vZGVsTGlzdHMuZmluZChmdW5jdGlvbiAobGlzdCkgeyByZXR1cm4gbGlzdC5lbGVtZW50ID09PSBsaXN0RWxlbWVudDsgfSk7XG5cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAvLyBvbWl0dGVkOiBkZWZhdWx0IHRvIHRydWVcbiAgICAgICAgICAgICAgICBsaXN0LmlzRHJvcFRhcmdldCA9PT0gdW5kZWZpbmVkIHx8XG5cbiAgICAgICAgICAgICAgICAvLyBmdW5jdGlvbjogdXNlIHJldHVybiB2YWx1ZVxuICAgICAgICAgICAgICAgIHR5cGVvZiBsaXN0LmlzRHJvcFRhcmdldCA9PT0gJ2Z1bmN0aW9uJyAmJiBsaXN0LmlzRHJvcFRhcmdldCgpIHx8XG5cbiAgICAgICAgICAgICAgICAvLyBvdGhlcndpc2U6IHVzZSB0cnV0aGluZXNzIG9mIGdpdmVuIHZhbHVlXG4gICAgICAgICAgICAgICAgbGlzdC5pc0Ryb3BUYXJnZXRcbiAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIHZhciByZWN0ID0gaXRlbUVsZW1lbnQuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksXG4gICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IHJlY3QuYm90dG9tO1xuXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW1FbGVtZW50ID09PSBsaXN0RWxlbWVudC5sYXN0RWxlbWVudENoaWxkKSB7XG4gICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IGxpc3RFbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmJvdHRvbTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGJvdHRvbSA8IHJlY3QudG9wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBib3R0b20gPSByZWN0LnRvcCArIChoZWlnaHQgfHwgNTApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0ID0gcmVjdC5oZWlnaHQ7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICA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GllbnRSZWN0KCk7XG5cbiAgICAgICAgZHJhZ29uLnJlY3QgPSByZWN0ID0ge1xuICAgICAgICAgICAgbGVmdDogICBNYXRoLnJvdW5kKHJlY3QubGVmdCAtIDEpLFxuICAgICAgICAgICAgdG9wOiAgICBNYXRoLnJvdW5kKHJlY3QudG9wIC0gMSksXG4gICAgICAgICAgICByaWdodDogIE1hdGgucm91bmQocmVjdC5yaWdodCksXG4gICAgICAgICAgICBib3R0b206IE1hdGgucm91bmQocmVjdC5ib3R0b20pLFxuICAgICAgICAgICAgd2lkdGg6ICBNYXRoLnJvdW5kKHJlY3Qud2lkdGgpLFxuICAgICAgICAgICAgaGVpZ2h0OiBNYXRoLnJvdW5kKHJlY3QuaGVpZ2h0KVxuICAgICAgICB9O1xuXG4gICAgICAgIGRyYWdvbi5waW4gPSB7XG4gICAgICAgICAgICB4OiB3aW5kb3cuc2Nyb2xsWCArIGV2dC5jbGllbnRYLFxuICAgICAgICAgICAgeTogd2luZG93LnNjcm9sbFkgKyBldnQuY2xpZW50WVxuICAgICAgICB9O1xuXG4gICAgICAgIGRyYWdvbi5vcmlnaW4gPSBkcmFnb24uaXRlbUNvb3JkaW5hdGVzKHRoaXMpO1xuXG4gICAgICAgIGlmIChkcmFnb24uY2FsbGJhY2suZ3JhYmJlZCkge1xuICAgICAgICAgICAgZHJhZ29uLmNhbGxiYWNrLmdyYWJiZWQuY2FsbCh0aGlzLCBkcmFnb24pO1xuICAgICAgICB9XG5cbiAgICAgICAgZHJhZ29uLmdldEFsbEl0ZW1Cb3VuZGluZ1JlY3RzKCk7XG5cbiAgICAgICAgZHJhZ29uLmRyb3AgPSB0aGlzLm5leHRFbGVtZW50U2libGluZztcbiAgICAgICAgZHJhZ29uLmRyb3Auc3R5bGUudHJhbnNpdGlvbkR1cmF0aW9uID0gJzBzJztcbiAgICAgICAgZHJhZ29uLmRyb3Auc3R5bGUuYm9yZGVyVG9wV2lkdGggPSByZWN0LmhlaWdodCArICdweCc7XG5cbiAgICAgICAgdGhpcy5zdHlsZS53aWR0aCA9IHJlY3Qud2lkdGggKyAncHgnO1xuICAgICAgICB0aGlzLnN0eWxlLnRyYW5zaXRpb25EdXJhdGlvbiA9ICcwcyc7XG4gICAgICAgIHRoaXMuc3R5bGVbdHJhbnNmb3JtXSA9IHRyYW5zbGF0ZShcbiAgICAgICAgICAgIHJlY3QubGVmdCAtIHdpbmRvdy5zY3JvbGxYLFxuICAgICAgICAgICAgcmVjdC50b3AgIC0gd2luZG93LnNjcm9sbFlcbiAgICAgICAgKTtcbiAgICAgICAgdGhpcy5jbGFzc0xpc3QuYWRkKCdkcmFnb24tcG9wJyk7XG4gICAgICAgIHRoaXMuc3R5bGUuekluZGV4ID0gd2luZG93LmdldENvbXB1dGVkU3R5bGUoZHJhZ29uLm1vZGVsTGlzdHNbMF0uY29udGFpbmVyLnBhcmVudEVsZW1lbnQpLnpJbmRleDtcblxuICAgICAgICBpZiAoIWRyYWdvbi5jb250YWluZXIpIHtcbiAgICAgICAgICAgIC8vIHdhbGsgYmFjayB0byBjbG9zZXN0IHNoYWRvdyByb290IE9SIGJvZHkgdGFnIE9SIHJvb3QgdGFnXG4gICAgICAgICAgICB2YXIgY29udGFpbmVyID0gdGhpcztcbiAgICAgICAgICAgIHdoaWxlIChjb250YWluZXIucGFyZW50Tm9kZSkge1xuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IGNvbnRhaW5lci5wYXJlbnROb2RlO1xuICAgICAgICAgICAgICAgIGlmIChjb250YWluZXIgaW5zdGFuY2VvZiBTaGFkb3dSb290IHx8IGNvbnRhaW5lci50YWdOYW1lID09PSAnQk9EWScpe1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkcmFnb24uY29udGFpbmVyID0gY29udGFpbmVyO1xuICAgICAgICB9XG5cbiAgICAgICAgZHJhZ29uLmNvbnRhaW5lci5hcHBlbmRDaGlsZCh0aGlzKT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aXR1ZGU7XG5cbiAgICAgICAgICAgIGlmIChtYXhTY3JvbGxZID4gMCkge1xuICAgICAgICAgICAgICAgIC8vIGxpc3QgaXMgc2Nyb2xsYWJsZSAoaXMgdGFsbGVyIHRoYW4gcmVjdClcbiAgICAgICAgICAgICAgICBpZiAoaG92ZXJMaXN0LmVsZW1lbnQuc2Nyb2xsVG9wID4gMCAmJiAobWFnbml0dWRlID0geSAtIChob3Zlckxpc3QucmVjdC50b3AgKyA1KSkgPCAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIG5lYXIgb3IgYWJvdmUgdG9wIGFuZCBsaXN0IGlzIG5vdCBzY3JvbGxlZCB0byB0b3AgeWV0XG4gICAgICAgICAgICAgICAgICAgIHJlc2V0QXV0b1Njcm9sbFRpbWVyKG1hZ25pdHVkZSwgMCwgaG92ZXJMaXN0LmVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaG92ZXJMaXN0LmVsZW1lbnQuc2Nyb2xsVG9wIDwgbWF4U2Nyb2xsWSAmJiAobWFnbml0dWRlID0geSAtIChob3Zlckxpc3QucmVjdC5ib3R0b20gLSAxIC0gNSkpID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBuZWFyIG9yIGJlbG93IGJvdHRvbSBhbmQgbGlzdCBub3Qgc2Nyb2xsZWQgdG8gYm90dG9tIHlldFxuICAgICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcihtYWduaXR1ZGUsIG1heFNjcm9sbFksIGhvdmVyTGlzdC5lbGVtZW50KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBpbnNpZGVcbiAgICAgICAgICAgICAgICAgICAgcmVzZXRBdXRvU2Nyb2xsVGltZXIoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBvdGhlciA9IGRyYWd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bnQgZnJvbSB3aGljaCB0byBjb21wdXRlIHRoZSBkaXN0YW5jZSB0byB0aGlzIHBvaW50LlxuICAgICAqIEBtZW1iZXJPZiBQb2ludC5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBkaXN0YW5jZTogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgdmFyIGRlbHRhWCA9IHBvaW50LnggLSB0aGlzLngsXG4gICAgICAgICAgICBkZWx0YVkgPSBwb2ludC55IC0gdGhpcy55O1xuXG4gICAgICAgIHJldHVybiBNYXRoLnNxcnQoXG4gICAgICAgICAgICBkZWx0YVggKiBkZWx0YVggK1xuICAgICAgICAgICAgZGVsdGFZICogZGVsdGFZXG4gICAgICAgICk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIF8oRm9ybWVybHk6IGBlcXVhbGAuKV9cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmZiBfYm90aF8gY29vcmRpbmF0ZXMgb2YgdGhpcyBwb2ludCBhcmUgZXhhY3RseSBlcXVhbCB0byB0aG9zZSBvZiBnaXZlbiBgcG9pbnRgLlxuICAgICAqIEBwYXJhbSB7UG9pbnR9IHBvaW50IC0gQSBwb2ludCB0byBjb21wYXJlIHRvIHRoaXMgcG9pbnQuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIGVxdWFsczogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IGZhbHNlO1xuXG4gICAgICAgIGlmIChwb2ludCkge1xuICAgICAgICAgICAgcmVzdWx0ID1cbiAgICAgICAgICAgICAgICB0aGlzLnggPT09IHBvaW50LnggJiZcbiAgICAgICAgICAgICAgICB0aGlzLnkgPT09IHBvaW50Lnk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gY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BhZ2FpbnN0LlxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBgdHJ1ZWAgaWZmIHRoaXMgcG9pbnQgaXMgd2l0aGluIGdpdmVuIGByZWN0YC5cbiAgICAgKiBAbWVtYmVyT2YgUG9pbnQucHJvdG90eXBlXG4gICAgICovXG4gICAgd2l0aGluOiBmdW5jdGlvbihyZWN0KSB7XG4gICAgICAgIHZhciBtaW5YID0gcmVjdC5vcmlnaW4ueCxcbiAgICAgICAgICAgIG1heFggPSBtaW5YICsgcmVjdC5leHRlbnQueDtcbiAgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55LFxuICAgICAgICAgICAgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICAgICBtYXhZID0gcmVjdC5vcmlnaW4ueTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICBtaW5YIDw9IHRoaXMueCAmJiB0aGlzLnggPCBtYXhYICYmXG4gICAgICAgICAgICBtaW5ZIDw9IHRoaXMueSAmJiB0aGlzLnkgPCBtYXhZXG4gICAgICAgICk7XG4gICAgfVxufTtcblxuUG9pbnQucHJvdG90eXBlLkVRID0gUG9pbnQucHJvdG90eXBlLmVxdWFscztcblBvaW50LnByb3RvdHlwZS5HVCA9IFBvaW50LnByb3RvdHlwZS5ncmVhdGVyVGhhbjtcblBvaW50LnByb3RvdHlwZS5MVCA9IFBvaW50LnByb3RvdHlwZS5sZXNzVGhhbjtcblBvaW50LnByb3RvdHlwZS5HRSA9IFBvaW50LnByb3RvdHlwZS5ncmVhdGVyVGhhb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9IFswLCAwXTtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLmZvckVhY2goZnVuY3Rpb24gKGVhY2gpIHtcbiAgICAgICAgICAgICAgICBpZiAob3ZlcmxhcHMoZWFjaCwgcnVuKSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgcGllY2VzID0gc3VidHJhY3QoZWFjaCwgcnVuKTtcbiAgICAgICAgICAgICAgICAgICAgc3BsaWNlciA9IHNwbGljZXIuY29uY2F0KHBpZWNlcyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3BsaWNlci5wdXNoKGVhY2gpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgc3BsaWNlclsxXSA9IHRoaXMuc2VsZWN0aW9uLmxlbmd0aDtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLnNwbGljZS5hcHBseSh0aGlzLnNlbGVjdGlvbiwgc3BsaWNlcik7IC8vIHVwZGF0ZSBpbiBwbGFjZSB0byBwcmVzZXJ2ZSBleHRlcm5hbCByZWZlcmVuY2VzXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHN1bW1hcnkgRW1wdGllcyBgdGhpcy5zZWxlY3Rpb25gLCBlZmZlY3RpdmVseSByZW1vdmluZyBhbGwgcnVucy5cbiAgICAgICAgICogQHJldHVybnMge1JhbmdlU2VsZWN0aW9uTW9kZWx9IFNlbGYgKGkuZS4sIGB0aGlzYCksIGZvciBjaGFpbmluZy5cbiAgICAgICAgICogQG1lbWJlck9mIFJhbmdlU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICAgICAqL1xuICAgICAgICBjbGVhcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy5zdGF0ZXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9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ndGggPT09IDA7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBzdW1tYXJ5IFJldHVybiB0aGUgaW5kZXhlcyB0aGF0IGFyZSBzZWxlY3RlZC5cbiAgICAgICAgICogQGRlc2MgUmV0dXJuIHRoZSBpbmRleGVzIHRoYXQgYXJlIHNlbGVjdGVkLlxuICAgICAgICAgKiBAcmV0dXJucyB7QXJyYXkuQXJyYXkubnVtYmVyfVxuICAgICAgICAgKiBAbWVtYmVyT2YgUmFuZ2VTZWxlY3Rpb25Nb2RlbC5wcm90b3R5cGVcbiAgICAgICAgICovXG4gICAgICAgIGdldFNlbGVjdGlvbnM6IGZ1bmN0aW9uICgpe1xuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IFtdO1xuICAgICAgICAgICAgdGhpcy5zZWxlY3Rpb24uZm9yRWFjaChmdW5jdGlvbiAoZWFjaCkge1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSBlYWNoWzBdOyBpIDw9IGVhY2hbMV07IGkrKykge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHJlc3VsdC5zb3J0KGZ1bmN0aW9uIChhLCBiKXtcbiAgICAgICAgICAgICAgICByZXR1cm4gYSAtIGI7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cblxuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBzdW1tYXJ5IFByZXBzIGBzdGFydGAgYW5kIGBzdG9wYCBwYXJhbXMgaW50byBvcmRlciBhcnJheVxuICAgICAqIEBmdW5jdGlvbiBtYWtlUnVuXG4gICAgICogQGRlc2MgVXRpbGl0eSBmdW5jdGlvbiBjYWxsZWQgYnkgYm90aCBgc2VsZWN0KClgIGFuZCBgZGVzZWxlY3QoKWAuXG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b3JlIG1pbnVlbmQ6IHJldHVybiByZW1haW5pbmcgcGllY2Ugb2YgYG1pbnVlbmRgXG4gICAgICAgICAgICByZXN1bHQucHVzaChbczEgKyAxLCBtMV0pO1xuICAgICAgICB9IGVsc2UgaWYgKHMwID4gbTAgJiYgczEgPj0gbTEpIHtcbiAgICAgICAgICAgIC8vc3VidHJhaGVuZCBleHRlbmRzIGFmdGVyIG1pbnVlbmQ6IHJldHVybiByZW1haW5pbmcgcGllY2Ugb2YgYG1pbnVlbmRgXG4gICAgICAgICAgICByZXN1bHQucHVzaChbbTAsIHMwIC0gMV0pO1xuICAgICAgICB9IGVsc2UgaWYgKG0wIDwgczAgJiYgczEgPCBtMSkge1xuICAgICAgICAgICAgLy9jb21wbGV0ZWx5IGluc2lkZTogcmV0dXJuIDIgc21hbGxlciBwaWVjZXMgcmVzdWx0aW5nIGZyb20gdGhlIGhvbGVcbiAgICAgICAgICAgIHJlc3VsdC5wdXNoKFttMCwgczAgLSAxXSk7XG4gICAgICAgICAgICByZXN1bHQucHVzaChbczEgKyAxLCBtMV0pO1xuICAgICAgICB9IGVsc2UgaWYgKHMxIDwgbTAgfHwgczAgPiBtMSkge1xuICAgICAgICAgICAgLy8gY29tcGxldGVseSBvdXRzaWRlOiByZXR1cm4gYG1pbnVlbmRgIHVudG91Y2hlZFxuICAgICAgICAgICAgcmVzdWx0LnB1c2gobWludWVuZCk7XG4gICAgICAgIH1cblxuICAgICAgICAvL2Vsc2Ugc3VidHJhaGVuZCBtdXN0IGNvbXBsZXRlbHkgb3ZlcmxhcCBtaW51ZW5kIHNvIHJldHVybiBubyBwaWVjZXNcblxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuXG4gICAgLy8gTG9jYWwgdXRpbGl0eSBmdW5jdGlvbnNcblxuICAgIC8qKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQGZ1bmN0aW9uIG1lcmdlXG4gICAgICogQHN1bW1hcnkgT3BlcmF0b3IgdGhhdCBtZ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O1xuICAgICAgICAgICAgdmFsID0gdmFsWzFdO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICdvYmplY3QnKSB7IC8vIG11c3QgYmUgYW4gaW1hZ2VcbiAgICAgICAgICAgICAgICBjZW50ZXJJY29uID0gdmFsO1xuICAgICAgICAgICAgICAgIHZhbCA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGVmdEljb24gJiYgbGVmdEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgbGVmdEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHJpZ2h0SWNvbiAmJiByaWdodEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgcmlnaHRJY29uID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjZW50ZXJJY29uICYmIGNlbnRlckljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgY2VudGVySWNvbiA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgPSB2YWx1ZU9yRnVuY3Rpb25FeGVjdXRlKGNvbmZpZywgdmFsKTtcblxuICAgICAgICBpZiAoZ2MuZm9udCAhPT0gY29uZmlnLmZvbnQpIHtcbiAgICAgICAgICAgIGdjLmZvbnQgPSBjb25maWcuZm9udDtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ2MudGV4dEFsaWduICE9PSAnbGVmdCcpIHtcbiAgICAgICAgICAgIGdjLnRleHRBbGlnbiA9ICdsZWZ0JztcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ2MudGV4dEJhc2VsaW5lICE9PSAnbWlkZGxlJykge1xuICAgICAgICAgICAgZ2MudGV4dEJhc2VsaW5lID0gJ21pZGRsZSc7XG4gICAgICAgIH1cblxuICAgICAgICAvL2ZpbGwgYmFja2dyb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aHQpIC8gMik7XG4gICAgICAgICAgICBpeG9mZnNldCA9IE1hdGgucm91bmQoKHdpZHRoIC0gY2VudGVySWNvbi53aWR0aCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShjZW50ZXJJY29uLCB4ICsgd2lkdGggLSBpeG9mZnNldCAtIGNlbnRlckljb24ud2lkdGgsIHkgKyBpeW9mZnNldCk7XG4gICAgICAgICAgICBpY29uV2lkdGggPSBNYXRoLm1heChjZW50ZXJJY29uLndpZHRoICsgMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvbmZpZy5jZWxsQm9yZGVyVGhpY2tuZXNzKSB7XG4gICAgICAgICAgICBnYy5iZWdpblBhdGgoKTtcbiAgICAgICAgICAgIGdjLnJlY3QoeCwgeSwgd2lkdGgsIGhlaWdodCk7XG4gICAgICAgICAgICBnYy5saW5lV2lkdGggPSBjb25maWcuY2VsbEJvcmRlclRoaWNrbmVzcztcbiAgICAgICAgICAgIGdjLnN0cm9rZVN0eWxlID0gY29uZmlnLmNlbGxCb3JkZXJTdHlsZTtcblxuICAgICAgICAgICAgLy8gYW5pbWF0ZSB0aGUgZGFzaGVkIGxpbmUgYSBiaXQgaGVyZSBmb3IgZnVuXG5cbiAgICAgICAgICAgIGdjLnN0cm9rZSgpO1xuICAgICAgICAgICAgZ2MuY2xvc2VQYXRoKCk7XG4gICAgICAgIH1cbiAgICAgICAgY29uZmlnLm1pbldpZHRoID0gY29uZmlnLm1pbldpZHRoICsgMiAqIChpY29uV2lkdGgpO1xuICAgIH0sXG5cbiAgICByZW5kZXJNdWx0aUxpbmVUZXh0OiBmdW5jdGlvbih4LCB5LCBoZWlnaHQsIHdpZHRoLCBnYywgY29uZmlnLCB2YWwpIHtcbiAgICAgICAgdmFyIGxpbmVzID0gZml0VGV4dChnYywgY29uZmlnLCB2YWwsIHdpZHRoKTtcbiAgICAgICAgaWYgKGxpbmVzLmxlbmd0aCA9PT0gMSkge1xuICAgICAgICAgICAgcmV0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sXG4gICAgICAgICAgICBpc0NvbHVtbkhvdmVyZWQgPSBjb25maWcuaXNDb2x1bW5Ib3ZlcmVkLFxuICAgICAgICAgICAgaXNSb3dIb3ZlcmVkID0gY29uZmlnLmlzUm93SG92ZXJlZCxcbiAgICAgICAgICAgIGlzTGluayA9IGlzTGluayB8fCBmYWxzZTtcblxuICAgICAgICB2YXIgZm9udE1ldHJpY3MgPSBjb25maWcuZ2V0VGV4dEhlaWdodChjb25maWcuZm9udCk7XG4gICAgICAgIHZhciB0ZXh0V2lkdGggPSBjb25maWcuZ2V0VGV4dFdpZHRoKGdjLCB2YWwpO1xuXG4gICAgICAgIC8vd2UgbXVzdCBzZXQgdGhpcyBpbiBvcmRlciB0byBjb21wdXRlIHRoZSBtaW5pbXVtIHdpZHRoXG4gICAgICAgIC8vZm9yIGNvbHVtbiBhdXRvc2l6aW5nIHB1cnBvc2VzXG4gICAgICAgIGNvbmZpZy5taW5XaWR0aCA9IHRleHRXaWR0aCArICgyICogY29sSEVkZ2VPZmZzZXQpO1xuXG4gICAgICAgIHN3aXRjaCAoaGFsaWduKSB7XG4gICAgICAgICAgICBjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgLy90ZXh0V2lkdGggPSBjb25maWcuZ2V0VGV4dFdpZHRoKGdjLCBjb25maWcudmFsdWUpO1xuICAgICAgICAgICAgICAgIGhhbGlnbk9mZnNldCA9IHdpZHRoIC0gY29sSEVkZ2VPZmZzZXQgLSB0ZXh0V2lkdGg7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlICdjZW50ZXInOlxuICAgICAgICAgICAgICAgIC8vdGV4dFdpZHRoID0gY29uZmlnLmdldFRleHRXaWR0aChnYywgY29uZmlnLnZhbHVlKTtcbiAgICAgICAgICAgICAgICBoYWxpZ25PZmZzZXQgPSAod2lkdGggLSB0ZXh0V2lkdGgpIC8gMjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgJ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VGV4dFxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmNlbGxDYWNoZS5zbGlkZXJDZWxsUmVuZGVyZXIgPSB7XG4gICAgICAgICAgICBwYWludDogdGhpcy5wYWludFNsaWRlclxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmNlbGxDYWNoZS5zcGFya2JhckNlbGxSZW5kZXJlciA9IHtcbiAgICAgICAgICAgIHBhaW50OiB0aGlzLnBhaW50U3BhcmtiYXJcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5jZWxsQ2FjaGUuc3BhcmtsaW5lQ2VsbFJlbmRlcmVyID0ge1xuICAgICAgICAgICAgcGFpbnQ6IHRoaXMucGFpbnRTcGFya2xpbmVcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5jZWxsQ2FjaGUudHJlZUNlbGxSZW5kZXJlciA9IHtcbiAgICAgICAgICAgIHBhaW50OiB0aGlzLnRyZWVDZWxsUmVuZGVyZXJcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5jZWxsQ2FjaGUuZW1wdHlDZWxsUmVuZGVyZXIgPSB7XG4gICAgICAgICAgICBwYWludDogdGhpcy5lbXB0eUNlbGxSZW5kZXJlclxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmNlbGxDYWNoZS5idXR0b25SZW5kZXJlciA9IHtcbiAgICAgICAgICAgIHBhaW50OiB0aGlzLnBhaW50QnV0dG9uLFxuICAgICAgICAgICAgLy9kZWZhdWx0Q2VsbFBhaW50OiB0aGlzLmRlZmF1bHRDZWxsUGFpbnRcbiAgICAgICAgfTtcbiAgICAgICAgdGhpcy5jZWxsQ2FjaGUubGlua0NlbGxSZW5kZXJlciA9IHtcbiAgICAgICAgICAgIHBhaW50OiBmdW5jdGlvbihnYywgeCwgeSwgd2lkdGgsIGhlaWdodCkge1xuICAgICAgICAgICAgICAgIHNlbGYuY29uZmlnID0gdGhpcy5jb25maWc7XG4gICAgICAgICAgICAgICAgc2VsZi5kZWZhdWx0Q2VsbFBhaW50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ovXG4gICAgYWRkR2xvYmFsUHJvcGVydGllczogZnVuY3Rpb24ocHJvcGVydGllcykge1xuICAgICAgICAvL3dlIGNoZWNrIGZvciBleGlzdGVuY2UgdG8gYXZvaWQgcmFjZSBjb25kaXRpb24gaW4gaW5pdGlhbGl6YXRpb25cbiAgICAgICAgaWYgKCFnbG9iYWxQcm9wZXJ0aWVzKSB7XG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuYWRkR2xvYmFsUHJvcGVydGllcyhwcm9wZXJ0aWVzKTtcbiAgICAgICAgICAgIH0sIDEwKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX2FkZEdsb2JhbFByb3BlcnRpZXMocHJvcGVydGllcyk7XG4gICAgICAgIH1cblxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIEFtbWVuZCBwcm9wZXJ0aWVzIGZvciBhbGwgaHlwZXJncmlkcyBpbiB0aGlzIHByb2Nlc3MuXG4gICAgICogQHBhcmFtIHtvYmplY3R9IHByb3BlcnRpZXMgLSBBIHNpbXBsZSBwcm9wZXJ0aWVzIGhhc2guXG4gICAgICogQHByaXZhdGVcbiAgICAgKi9cbiAgICBfYWRkR2xvYmFsUHJvcGVydGllczogZnVuY3Rpb24ocHJvcGVydGllcykge1xuICAgICAgICBfKHByb3BlcnRpZXMpLmVhY2goZnVuY3Rpb24ocHJvcGVydHksIGtleSkge1xuICAgICAgICAgICAgZ2xvYmFsUHJvcGVydGllc1trZXldID0gcHJvcGVydHk7XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIEFtbWVuZCBwcm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lnaHQ7IGgrKykge1xuICAgICAgICAgICAgICAgIGZvciAodmFyIHcgPSAwOyB3IDwgd2lkdGg7IHcrKykge1xuICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaChzZWxlY3Rpb25zW3ddW2hdKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHcgPCB3aWR0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goJ1xcdCcpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChoIDwgaGVpZ2h0KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5wdXNoKCdcXG4nKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBjb2xsZWN0b3Iuam9pbignJyk7XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuICcnO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBXZSBoYXZlIGZvY3VzLlxuICAgICAqL1xuICAgIGhhc0ZvY3VzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0Q2FudmFzKCkuaGFzRm9jdXMoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBDbGVhciBhbGwgdGhlIHNlbGVjdGlvbnMuXG4gICAgICovXG4gICAgY2xlYXJTZWxlY3Rpb25zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmNsZWFyKCk7XG4gICAgICAgIHRoaXMuY2xlYXJNb3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nZhcyA9IHRoaXMuZ2V0Q2FudmFzKCk7XG4gICAgICAgIGlmIChjYW52YXMpIHtcbiAgICAgICAgICAgIGlmIChub3cgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBjYW52YXMucGFpbnROb3coKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY2FudmFzLnJlcGFpbnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIFBhaW50IGltbWVkaWF0ZWx5IGluIHRoaXMgbWljcm90YXNrLlxuICAgICAqL1xuICAgIHBhaW50Tm93OiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGNhbnZhcyA9IHRoaXMuZ2V0Q2FudmFzKCk7XG4gICAgICAgIGNhbnZhcy5wYWludE5vdygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBJbiBIaURQSSBtb2RlIChoYXMgYW4gYXR0cmlidXRlIGFzIHN1Y2gpLlxuICAgICAqL1xuICAgIHVzZUhpRFBJOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMucmVzb2x2ZVByb3BlcnR5KCd1c2VIaURQSScpICE9PSBmYWxzZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAc3VtbWFyeSBJbml0aWFsaXplIGRyYXdpbmcgc3VyZmFjZS5cbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqL1xuICAgIGluaXRDYW52YXM6IGZ1bmN0aW9uKCkge1xuXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcblxuICAgICAgICB2YXIgZGl2Q2FudmFz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ICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZU1vdmUobW91c2VFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgbW91c2VFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5tb3VzZURvd25TdGF0ZSA9IG1vdXNlRXZlbnQ7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlTW91c2VEb3duKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VEb3duRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLnJlcGFpbnQoKTtcbiAgICAgICAgfSk7XG5cblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtY2xpY2snLCBmdW5jdGlvbihlKSB7XG4gICAgICAgIC8vICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgLy8gICAgICAgICByZXR1cm47XG4gICAgICAgIC8vICAgICB9XG4gICAgICAgIC8vICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgLy8gICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAvLyAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgIC8vICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICAvLyB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtbW91c2V1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIGlmIChzZWxmLmlzU2Nyb2xsaW5nTm93KCkpIHtcbiAgICAgICAgICAgICAgICBzZWxmLnNldFNjcm9sbGluZ05vdyhmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZykge1xuICAgICAgICAgICAgICAgIHNlbGYuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZVVwKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHNlbGYubW91c2VEb3duU3RhdGUpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNCdXR0b25QcmVzc2VkRXZlbnQoc2VsZi5tb3VzZURvd25TdGF0ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbnVsbDtcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY01vdXNlVXBFdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRhcCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgdGFwRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgdGFwRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgdGFwRXZlbnQua2V5cyA9IGUuZGV0YWlsLmtleXM7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KHRhcEV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVUYXAodGFwRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtZHJhZycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURyYWcobW91c2VFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5ZG93bkV2ZW50KGUpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZUtleURvd24oZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXl1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0tleXVwRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5VXAoZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy10cmFjaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHByaW1FdmVudCA9IGUuZGV0YWlsLnByaW1pdGl2ZUV2ZW50O1xuICAgICAgICAgICAgaWYgKE1hdGguYWJzKHByaW1FdmVudC5keSkgPiBNYXRoLmFicyhwcmltRXZlbnQuZHgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbFZCeSgtMik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZlbnQueURpcmVjdGlvbiA8IC0wKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KDIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbEhCeSgtMSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZl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YXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5VXBFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktdXAnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIGtleUV2ZW50OiBrZXlFdmVudFxuICAgICAgICAgICAgfSxcblxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0VkaXRvcktleURvd25FdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktZG93bicsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5UHJlc3NFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktcHJlc3MnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB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XG4gICAgICAgIHZhciByb3dDb3VudCA9IHJlY3QuZXh0ZW50LnkgKyAxO1xuICAgICAgICB2YXIgb3ggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB2YXIgb3kgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgY29sQ291bnQ7IGMrKykge1xuICAgICAgICAgICAgdmFyIGNvbHVtbiA9IG5ldyBBcnJheShyb3dDb3VudCk7XG4gICAgICAgICAgICByZXN1bHRbY10gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgICAgICBjb2x1bW5bcl0gPSB2YWx1ZU9yRnVuY3Rpb25FeGVjdXRlKHRoaXMuZ2V0VmFsdWUob3ggKyBjLCBveSArIHIpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBTeW50aGVzaXplIGFuZCBmaXJlIGEgYGZpbi1jb250ZXh0LW1lbnVgIGV2ZW50XG4gICAgICogQHBhcmFtIHtrZXlFdmVudH0gZXZlbnQgLSBUaGUgY2FudmFzIGV2ZW50LlxuICAgICAqL1xuICAgIGZpcmVTeW50aGV0aWNDb250ZXh0TWVudUV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIGUuZ3JpZENlbGwgPSB0aGlzLmNvbnZlcnRWaWV3UG9pbnRUb0RhdGFQb2ludChlLmdyaWRDZWxsKTtcbiAgICAgICAgdmFyIGV2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tY29udGV4dC1tZW51Jywge1xuICAgICAgICAgICAgZGV0YWlsOiB7XG4gICAgICAgICAgICAgICAgZ3JpZENlbGw6IGUuZ3JpZENlbGwsXG4gICAgICAgICAgICAgICAgbW91c2VQb2ludDogZS5tb3VzZVBvaW50LFxuICAgICAgICAgICAgICAgIHZpZXdQb2ludDogZS52aWV3UG9pbnQsXG4gICAgICAgICAgICAgICAgcHJpbWl0aXZlRXZlbnQ6IGUucHJpbWl0aXZlRXZlbnQsXG4gICAgICAgICAgICAgICAgcm93czogdGhpcy5nZXRTZWxlY3RlZFJvd3MoKSxcbiAgICAgICAgICAgICAgICBjb2x1bW5zOiB0aGlzLmdldFNlbGVjdGVkQ29sdW1ucygpLFxuICAgICAgICAgICAgICAgIHNlbGVjdGlvbnM6IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKS5nZXRTZWxlY3Rpb25zKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoZXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljTW91c2VVcEV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBldmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLW1vdXNldXAnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudDogZnVuY3Rpb24oZSkge1xuICAgICAgICB2YXIgZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ2Zpbi1tb3VzZWRvd24nLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGlzVmlld2FibGVCdXR0b246IGZ1bmN0aW9uKGMsIHIpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0UmVuZGVyZXIoKS5pc1ZpZXdhYmxlQnV0dG9uKGMsIHIpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljQnV0dG9uUHJlc3NlZEV2ZW50OiBmdW5jdGlvbihldnQpIHtcbiAgICAgICAgdmFyIGRhdGFDZWxsID0gZXZ0LmRhdGFDZWxsO1xuIC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ICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXRDYW52YXMoKS50YWtlRm9jdXMoKTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIFJlcXVlc3QgZm9jdXMgZm9yIG91ciBjZWxsIGVkaXRvci5cbiAgICAgKi9cbiAgICBlZGl0b3JUYWtlRm9jdXM6IGZ1bmN0aW9uKCkge1xuICAgICAgICBpZiAodGhpcy5jZWxsRWRpdG9yKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jZWxsRWRpdG9yLnRha2VGb2N1cygpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFdlIGhhdmUgYSBjdXJyZW50bHkgYWN0aXZlIGNlbGwgZWRpdG9yLlxuICAgICAqL1xuICAgIGlzRWRpdGluZzogZnVuY3Rpb24oKSB7XG4gICAgICAgIGlmICh0aGlzLmNlbGxFZGl0b3IpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmNlbGxFZGl0b3IuaXNFZGl0aW5nO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBJbml0aWFsaXplIHRoZSBzY3JvbGwgYmFycy5cbiAgICAgKi9cbiAgICBpbml0U2Nyb2xsYmFyczogZnVuY3Rpb24oKSB7XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuXG4gICAgICAgIHZhciBob3J6QmFyID0gbmV3IEZpbkJhcih7XG4gICAgICAgICAgICBvcmllbnRhdGlvbjogJ2hvcml6b250YWwnLFxuICAgICAgICAgICAgb25j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AgICAgICAgcm93O1xuXG4gICAgICAgIGhlYWRlcnMuZm9yRWFjaChmdW5jdGlvbihoZWFkZXIsIGMpIHtcbiAgICAgICAgICAgIGhlYWRlcnNbY10gPSBiZWhhdmlvci5nZXRDb2x1bW5JZChjLCAwKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmVzdWx0cy5mb3JFYWNoKGZ1bmN0aW9uKHJlc3VsdCwgcikge1xuICAgICAgICAgICAgcm93ID0gcmVzdWx0c1tyXSA9IHtcbiAgICAgICAgICAgICAgICBoaWVyYXJjaHk6IGJlaGF2aW9yLmdldEZpeGVkQ29sdW1uVmFsdWUoMCwgcilcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBoZWFkZXJzLmZvckVhY2goZnVuY3Rpb24oZmllbGQsIGMpIHtcbiAgICAgICAgICAgICAgICByb3dbZmllbGRdID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgcik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdH0gQW4gb2JqZWN0IHRoYXQgcmVwcmVzZW50cyB0aGUgY3VycmVudGx5IHNlbGVjdGlvbiByb3cuXG4gICAgICovXG4gICAgZ2V0U2VsZWN0ZWRSb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VscyA9IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKS5nZXRTZWxlY3Rpb25zKCk7XG4gICAgICAgIGlmIChzZWxzLmxlbmd0aCkge1xuICAgICAgICAgICAgdmFyIGJlaGF2aW9yID0gdGhpcy5nZXRCZWhhdmlvcigpLFxuICAgICAgICAgICAgICAgIGNvbENvdW50ID0gdGhpcy5nZXRDb2x1bW5Db3VudCgpLFxuICAgICAgICAgICAgICAgIHRvcFJvdyA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gICBpZiAoIWFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChoYXNDVFJMKSB7XG4gICAgICAgICAgICAgICAgaWYgKGFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5kZXNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4oeCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4odGhpcy5sYXN0RWRnZVNlbGVjdGlvblswXSwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFhbHJlYWR5U2VsZWN0ZWQgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICB0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzBdID0geDtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGFpbnQoKTtcbiAgICAgICAgdGhpcy5maXJlU3ludGhldGljQ29sdW1uU2VsZWN0aW9uQ2hhbmdlZEV2ZW50KCk7XG4gICAgfSxcblxuICAgIHRvZ2dsZVNlbGVjdFJvdzogZnVuY3Rpb24oeSwga2V5cykge1xuXG4gICAgICAgIC8vd2UgY2FuIHNlbGVjdCB0aGUgdG90YWxzIHJvd3MgaWYgdGhleSBleGlzdCxcbiAgICAgICAgLy9idXQgbm90IHJvd3MgYWJvdmUgdGhhdFxuICAgICAgICB2YXIgc2VsZWN0aW9uRWRnZSA9IHRoaXMuZ2V0RmlsdGVyUm93SW5kZXgoKSArIDE7XG4gICAgICAgIGlmICh5IDwgc2VsZWN0aW9uRWRnZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAga2V5cyA9IGtleXMgfHwgW107XG5cbiAgICAgICAgdmFyIGlzU2luZ2xlUm93U2VsZWN0aW9uID0gdGhpcy5pc1NpbmdsZVJvd1NlbGVjdGlvbk1vZGUoKTtcbiAgICAgICAgdmFyIG1vZGVsID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpO1xuICAgICAgICB2YXIgYWxyZWFkeVNlbGVjdGVkID0gbW9kZWwuaXNSb3dTZWxlY3RlZCh5KTtcbiAgICAgICAgdmFyIGhhc0NUUkwgPSBrZXlzLmluZGV4T2YoJ0NUUkwnKSA+IC0xO1xuICAgICAgICB2YXIgaGFzU0hJRlQgPSBrZXlzLmluZGV4T2YoJ1NISUZUJykgPiAtMTtcblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgaWYgKCFhbHJlYWR5U2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RSb3coeSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoaGFzQ1RSTCkge1xuICAgICAgICAgICAgICAgIGlmIChhbHJlYWR5U2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuZGVzZWxlY3RSb3coeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzU2luZ2xlUm93U2VsZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlbC5jbGVhclJvd1NlbGVjdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh5KT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gICAgdGhpcy52aXNpYmxlUm93cy5sZW5ndGggPSAwO1xuICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzSW5kZXhNYXAgPSB7fTtcbiAgICAgICAgdGhpcy5yb3dFZGdlc0luZGV4TWFwID0ge307XG5cbiAgICAgICAgdGhpcy5pbnNlcnRpb25Cb3VuZHMgPSBbXTtcbiAgICAgICAgdmFyIGluc2VydGlvbkJvdW5kc0N1cnNvciA9IDA7XG4gICAgICAgIHZhciBwcmV2aW91c0luc2VydGlvbkJvdW5kc0N1cnNvclZhbHVlID0gMDtcblxuICAgICAgICB4ID0gMDtcbiAgICAgICAgdmFyIHN0YXJ0ID0gMDtcbiAgICAgICAgdmFyIGZpcnN0VlgsIGxhc3RWWDtcbiAgICAgICAgdmFyIGZpcnN0VlksIGxhc3RWWTtcbiAgICAgICAgaWYgKGdyaWQuaXNTaG93Um93TnVtYmVycygpKSB7XG4gICAgICAgICAgICBzdGFydC0tO1xuICAgICAgICAgICAgdGhpcy5jb2x1bW5FZGdlc1stMV0gPSAtMTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGMgPSBzdGFydDsgYyA8IG51bUNvbHVtbnM7IGMrKykge1xuICAgICAgICAgICAgdnggPSBjO1xuICAgICAgICAgICAgaWYgKGMgPj0gbnVtRml4ZWRDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgdnggPSB2eCArIHNjcm9sbExlZnQ7XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0VlggPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFZYID0gdng7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxhc3RWWCA9IHZ4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHggPiB2aWV3V2lkdGggfHwgbnVtQ29sdW1ucyA8PSB2eCkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgd2lkdGggPSB0aGlzLmdldENvbHVtbldpZHRoKHZ4KTtcbiAgICAgICAgICAgIHggPSB4ICsgd2lkdGg7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzW2MgKyAxXSA9IE1hdGgucm91bmQoeCk7XG4gICAgICAgICAgICB0aGlzLnZpc2libGVDb2x1bW5zW2NdID0gdng7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzSW5kZXhNYXBbdnhdID0gYztcblxuICAgICAgICAgICAgaW5zZXJ0aW9uQm91bmRzQ3Vyc29yID0gaW5zZXJ0aW9uQm91bmRzQ3Vyc29yICsgTWF0aC5yb3VuZCh3aWR0aCAvIDIpICsgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZTtcbiAgICAgICAgICAgIHRoaXMuaW5zZXJ0aW9uQm91bmRzLnB1c2goaW5zZXJ0aW9uQm91bmRzQ3Vyc29yKTtcbiAgICAgICAgICAgIHByZXZpb3VzSW5zZXJ0aW9uQm91bmRzQ3Vyc29yVmFsdWUgPSBNYXRoLnJvdW5kKHdpZHRoIC8gMik7XG4gICAgICAgIH1cblxuICAgICAgICB5ID0gMDtcbiAgICAgICAgZm9yIChyID0gMDsgciA8IG51bVJvd3M7IHIrKykge1xuICAgICAgICAgICAgdnkgPSByO1xuICAgICAgICAgICAgaWYgKHIgPj0gbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgdnkgPSB2eSArIHNjcm9sbFRvcDtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RWWSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0VlkgPSB2eTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGFzdFZZID0gdnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeSA+IHZpZXdIZWlnaHQgfHwgbnVtUm93cyA8PSB2eSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAg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iAgICAgICAgZm9yIChjID0gMDsgYyA8IGNvbHVtbkVkZ2VzLmxlbmd0aDsgYysrKSB7XG4gICAgICAgICAgICB3aWR0aCA9IGNvbHVtbkVkZ2VzW2NdO1xuICAgICAgICAgICAgaWYgKHBvaW50LnggPCB3aWR0aCkge1xuICAgICAgICAgICAgICAgIHggPSBNYXRoLm1heCgwLCBwb2ludC54IC0gcHJldmlvdXMgLSAyKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gd2lkdGg7XG4gICAgICAgIH1cbiAgICAgICAgYy0tO1xuICAgICAgICBwcmV2aW91cyA9IDA7XG4gICAgICAgIGZvciAociA9IDA7IHIgPCB0aGlzLnJvd0VkZ2VzLmxlbmd0aDsgcisrKSB7XG4gICAgICAgICAgICBoZWlnaHQgPSB0aGlzLnJvd0VkZ2VzW3JdO1xuICAgICAgICAgICAgaWYgKHBvaW50LnkgPCBoZWlnaHQpIHtcbiAgICAgICAgICAgICAgICB5ID0gTWF0aC5tYXgoMCwgcG9pbnQueSAtIHByZXZpb3VzIC0gMik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmV2aW91cyA9IGhlaWdodDtcbiAgICAgICAgfVxuICAgICAgICByLS07XG4gICAgICAgIGlmIChwb2ludC54IDwgMCkge1xuICAgICAgICAgICAgYyA9IC0xO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb2ludC55IDwgMCkge1xuICAgICAgICAgICAgciA9IC0xO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHZpZXdQb2ludCA9IGdyaWQubmV3UG9pbnQoYywgcik7XG5cbiAgICAgICAgLy9jb21wZW5zYXRlIGlmIHdlIGFyZSBzY3JvbGxlZFxuICAgICAgICBpZiAoYyA+PSBmaXhlZENvbHVtbkNvdW50KSB7XG4gICAgICAgICAgICBjID0gYyArIHNjcm9sbFg7XG4gICAgICAg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wKTtcblxuICAgICAgICBpZiAoZHJhd1RoZW1WKSB7XG4gICAgICAgICAgICBmb3IgKGMgPSAwOyBjIDwgY29sV2lkdGhzLmxlbmd0aCArIDE7IGMrKykge1xuICAgICAgICAgICAgICAgIHggPSBjb2xXaWR0aHNbY10gKyAwLjU7XG4gICAgICAgICAgICAgICAgZ2MubW92ZVRvKHgsIDApO1xuICAgICAgICAgICAgICAgIGdjLmxpbmVUbyh4LCB2aWV3SGVpZ2h0KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChkcmF3VGhlbUgpIHtcbiAgICAgICAgICAgIGZvciAociA9IDA7IHIgPCByb3dIZWlnaHRzLmxlbmd0aDsgcisrKSB7XG4gICAgICAgICAgICAgICAgeSA9IHJvd0hlaWdodHNbcl0gKyAwLjU7XG4gICAgICAgICAgICAgICAgZ2MubW92ZVRvKDAsIHkpO1xuICAgICAgICAgICAgICAgIGdjLmxpbmVUbyh2aWV3V2lkdGgsIHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGdjLnN0cm9rZSgpO1xuICAgICAgICBnYy5jbG9zZVBhdGgoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7Q2FudmFzUmVuZGVyaW5nQ29udGV4dDJEfSBnY1xuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHBhcmFtIHlcbiAgICAgKi9cbiAgICBwYWludENlbGw6IGZ1bmN0aW9uKGdjLCB4LCB5KSB7XG4gICAgICAgIGdjLm1vdmVUbygwLCAwKTtcblxuICAgICAgICB2YXIgYyA9IHRoaXMuZ2V0VmlzaWJsZUNvbHVtbnMoKVt4XSxcbiAgICAgICAgICAgIHIgPSB0aGlzLmdldFZpc2libGVSb3dzKClbeV07XG5cbiAgICAgICAgaWYgKGMpIHsgLy9zb21ldGhpbmcgaXMgYmVpbmcgdmlld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c2l6ZTsgcisrKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRpID0gciArIHRvcDtcbiAgICAgICAgICAgICAgICBpZiAoIXNldFt0aV0pIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2godGkpO1xuICAgICAgICAgICAgICAgICAgICBzZXRbdGldID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXN1bHQuc29ydChmdW5jdGlvbih4LCB5KSB7XG4gICAgICAgICAgICByZXR1cm4geCAtIHk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHBhcmFtIG9mZnNldFxuICAgICAqL1xuICAgIHNlbGVjdFJvd3NGcm9tQ2VsbHM6IGZ1bmN0aW9uKG9mZnNldCkge1xuICAgICAgICBvZmZzZXQgPSBvZmZzZXQgfHwgMDtcblxuICAgICAgICB2YXIgc20gPSB0aGlzLnJvd1NlbGVjdGlvbk1vZGVsO1xuICAgICAgICB0aGlzLmFsbFJvd3NTZWxlY3RlZCA9IGZhbHNlO1xuICAgICAgICBzbS5jbGVhcigpO1xuXG4gICAgICAgIHRoaXMuc2VsZWN0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgdmFyIHRvcCA9IHNlbGVjdGlvbi5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICBzaXplID0gc2VsZWN0aW9uLmV4dGVudC55O1xuICAgICAgICAgICAgc20uc2VsZWN0KHRvcCArIG9mZnNldCwgdG9wICsgc2l6ZSArIG9mZnNldCk7XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4g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zIHtib29sZWFufVxuICAgICAqL1xuICAgIHJlY3RhbmdsZUNvbnRhaW5zOiBmdW5jdGlvbihyZWN0LCB4LCB5KSB7IC8vVE9ETzogZXhwbG9yZSB3aHkgdGhpcyB3b3JrcyBhbmQgY29udGFpbnMgb24gcmVjdGFuZ2x1bGFyIGRvZXMgbm90XG4gICAgICAgIHZhciBtaW5YID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgbWF4WCA9IG1pblggKyByZWN0LmV4dGVudC54O1xuICAgICAgICB2YXIgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICAgICBtYXhZID0gcmVjdC5vcmlnaW4ueTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZXN1bHQgPVxuICAgICAgICAgICAgeCA+PSBtaW5YICYmXG4gICAgICAgICAgICB5ID49IG1pblkgJiZcbiAgICAgICAgICAgIHggPD0gbWF4WCAmJlxuICAgICAgICAgICAgeSA8PSBtYXhZO1xuXG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxufTtcblxubW9kdWxlLmV4cG9ydHMgPSBTZWxlY3Rpb25Nb2RlbDtcbiIsIi8qIGVzbGludC1lbnYgYnJvd3NlciAqL1xuXG4ndXNlIHN0cmljdCc7XG5cbnZhciBfID0gcmVxdWlyZSgnb2JqZWN0LWl0ZXJhdG9ycycpO1xudmFyIEJhc2UgPSByZXF1aXJlKCdleHRlbmQtbWUnKS5CYXNlO1xuXG52YXIgQ29sdW1uID0gcmVxdWly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cmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9udCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5jb2x1bW5IZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gd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0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnJvd0hlYWRlclJvd1NlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy5yb3dIZWFkZXIsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmZpbHRlclByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJTdHlsZToge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGU7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclN0eWxlID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJUaGlja25lc3M6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclRoaWNrbmVzcztcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnRyZWVDb2x1bW5Qcm9wZXJ0aWVzID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXNDb2x1bW5TZWxlY3Rpb24gPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY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ZXMuaW5kZXhPZihpKSA9PT0gLTEpIHtcbiAgICAgICAgICAgICAgICBsYWJlbHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogdGhpcy5nZXRIZWFkZXIoaSksXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiB0aGlzLmdldEZpZWxkKGkpXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGxhYmVscztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEJlaGF2aW9yLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGhpZGUgY29sdW1ucyB0aGF0IGFyZSBzcGVjaWZpZWQgYnkgdGhlaXIgaW5kZXhlc1xuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5T2ZJbmRleGVzIC0gYW4gYXJyYXkgb2YgY29sdW1uIGluZGV4ZXMgdG8gaGlkZVxuICAgICAqL1xuICAgIGhpZGVDb2x1bW5zOiBmdW5jdGlvbihhcnJheU9mSW5kZXhlcykge1xuICAgICAgICB2YXIgdGFibGVTdGF0ZSA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCk7XG4gICAgICAgIHZhciBvcmRlciA9IHRhYmxlU3RhdGUuY29sdW1uSW5kZXhlcztcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnJheU9mSW5kZXhlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgdmFyIGVhY2ggPSBhcnJheU9mSW5kZXhlc1tpXTtcbiAgICAgICAgICAgIGlmIChvcmRlci5pbmRleE9mKGVhY2gpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIG9yZGVyLnNwbGljZShvcmRlci5pbmRleE9mKGVhY2gpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBA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nO1xuXG52YXIgU2ltcGxlID0gcmVxdWlyZSgnLi9TaW1wbGUnKTtcblxuLyoqXG4gKiBAY29uc3RydWN0b3JcbiAqL1xudmFyIENob2ljZSA9IFNpbXBsZS5leHRlbmQoJ0Nob2ljZScsIHtcblxuICAgIC8qKlxuICAgICAqIG15IGxvb2t1cCBhbGlhc1xuICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBhbGlhczogJ2Nob2ljZScsXG5cbiAgICAvKipcbiAgICAgKiB0aGUgbGlzdCBvZiBpdGVtcyB0byBwaWNrIGZyb21cbiAgICAgKiBAdHlwZSB7QXJyYXl9XG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBpdGVtczogWydhJywgJ2InLCAnYyddLFxuXG4gICAgdGVtcGxhdGU6IGZ1bmN0aW9uKCkge1xuICAgICAgICAvKlxuICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9XCJlZGl0b3JcIj5cbiAgICAgICAgICAgICAgICAgICAge3sjaXRlbXN9fVxuICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiB2YWx1ZT1cInt7Ln19XCI+e3sufX08L29wdGlvbj5cbiAgICAgICAgICAgICAgICAgICAge3svaXRlbXN9fVxuICAgICAgICAgICAgICAgIDwvc2VsZWN0PlxuICAgICAgICAgICAgKi9cbiAgICB9LFxuXG4gICAgLy9ubyBldmVudHMgYXJlIGZpcmVkIHdoaWxlIHRoZSBkcm9wZG93biBpcyBvcGVuXG4gICAgLy9zZWUgaHR0cDovL2pzZmlkZGxlLm5ldC9tNHRuZHR1NC82L1xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBzaG93RWRpdG9yOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgIC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Anc2ltcGxlJyxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBTaW1wbGUucHJvdG90eXBlXG4gICAgICovXG4gICAgaW5pdGlhbGl6ZTogZnVuY3Rpb24oKSB7XG4gICAgICAgIHRoaXMuZWRpdG9yUG9pbnQgPSB7XG4gICAgICAgICAgICB4OiAwLFxuICAgICAgICAgICAgeTogMFxuICAgICAgICB9O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2ltcGxlLnByb3RvdHlwZVxuICAgICAqIEBkZXNjICB0aGUgZnVuY3Rpb24gdG8gb3ZlcnJpZGUgZm9yIGluaXRpYWxpemF0aW9uXG4gICAgICovXG4gICAgaW5pdGlhbGl6ZUlucHV0OiBmdW5jdGlvbihpbnB1dCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKGUgJiYgKGUua2V5Q29kZSA9PT0gMTMgfHwgZS5rZXlDb2RlID09PSAyNyB8fCBlLmtleUNvZGUgPT09IDgpKSB7XG4gICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGlmIChlLmtleUNvZGUgPT09IDgpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbGVhclN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkucmVwYWludCgpO1xuICAgICAgICAgICAgICA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3Rpb25SYW5nZSgwLCB0aGlzLmlucHV0LnZhbHVlLmxlbmd0aCk7XG4gICAgfSxcblxuICAgIGluaXRpYWxpemVJbnB1dDogZnVuY3Rpb24oaW5wdXQpIHtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdrZXl1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChlICYmIChlLmtleUNvZGUgPT09IDEzIHx8IGUua2V5Q29kZSA9PT0gMjcpKSB7XG4gICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGlmIChlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkucmVwYWludCgpO1xuICAgICAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLnRha2VGb2N1cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNlbGYuZ2V0R3JpZCgpLmlzRmlsdGVyUm93KHNlbGYuZ2V0RWRpdG9yUG9pbnQoKS55KSkge1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2F2ZUVkaXRvclZhbHVlKCk7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX21vdmVFZGl0b3IoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLmZpcmVTeW50aGV0aWNFZGl0b3JLZXlVcEV2ZW50KHNlbGYsIGUpO1xuICAgICA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yAoaXNIZWFkZXJSb3cgPyAxIDogMCk7XG4gICAgICAgIGlmICh5ID49IHRvcFRvdGFsc09mZnNldCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0VG9wVG90YWxzKClbeSAtIHRvcFRvdGFsc09mZnNldF1beF07XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGZpbHRlciA9IHRoaXMuZ2V0RmlsdGVyKHgpO1xuICAgICAgICB2YXIgaW1hZ2UgPSBmaWx0ZXIubGVuZ3RoID09PSAwID8gJ2ZpbHRlci1vZmYnIDogJ2ZpbHRlci1vbic7XG4gICAgICAgIHZhciBoZWFkZXIsIHNvcnRTdHJpbmc7XG4gICAgICAgIGlmIChpc0JvdGgpIHtcbiAgICAgICAgICAgIGlmICh5ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaGVhZGVyID0gdGhpcy5nZXRIZWFkZXJzKClbeF07XG4gICAgICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgICAgIGlmIChzb3J0U3RyaW5nKSB7IGhlYWRlciA9IHNvcnRTdHJpbmcgKyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVhZGVyUm93Q291bnQpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyUm93VmFsdWUoeCwgeSwgdmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGhhc0hpZXJhcmNoeUNvbHVtbikge1xuICAgICAgICAgICAgeSArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5n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GVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleFxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEZpbHRlcjogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBpZiAoIWNvbHVtblByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Db3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLn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B2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy5nZXRCZWhhdmlvcigpLmNvbHVtbnM7XG4gICAgICAgIGl0ZW1zID0gaXRlbXMuZmlsdGVyKGZ1bmN0aW9uKGVhY2gpIHtcbiAgICAgICAgICAgIHJldHVybiBlYWNoLmxhYmVsICE9PSAnVHJlZSc7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gaXRlbXM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldEhpZGRlbkNvbHVtbnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgdmlzaWJsZSA9IHRoaXMuZ2V0QmVoYXZpb3IoKS5jb2x1bW5zO1xuICAgICAgICB2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29ydHMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzdGF0ZS5zb3J0cy5sZW5ndGggPiAzKSB7XG4gICAgICAgICAgICBzdGF0ZS5zb3J0cy5sZW5ndGggPSAzO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERPV05XQVJEU19CTEFDS19BUlJPVztcbiAgICAgICAgICAgIHJldHVybiByYW5rICsgYXJyb3cgKyAnICc7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IHJhbmsgKyAodXAgPyAnLXVwJyA6ICctZG93bicpO1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRCZWhhdmlvcigpLmdldEltYWdlKG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AhdGhpcy5oYXNBZ2dyZWdhdGVzKCkpIHtcbiAgICAgICAgICAgIHZhciB0b3BUb3RhbHMgPSB0aGlzLmdldFRvcFRvdGFscygpO1xuICAgICAgICAgICAgcmV0dXJuIHRvcFRvdGFsc1t5IC0gKGhlYWRlclJvd0NvdW50IC0gdG9wVG90YWxzLmxlbmd0aCldO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLmdldERhdGFTb3VyY2UoKS5nZXRSb3coeSAtIGhlYWRlclJvd0NvdW50KTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEByZXR1cm5zIHtvYmplY3R9XG4gICAgICovXG4gICAgYnVpbGRSb3c6IGZ1bmN0aW9uKHkpIHtcbiAgICAgICAgdmFyIGNvbENvdW50ID0gdGhpcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgICAgICB2YXIgZmllbGRzID0gW10uY29uY2F0KHRoaXMuZ2V0RmllbGRzKCkpO1xuICAgICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIGlmICh0aGlzLmhhc0FnZ3JlZ2F0ZXMoKSkge1xuICAgICAgICAgICAgcmVzdWx0LnRyZWUgPSB0aGlzLmdldFZhbHVlKC0yLCB5KTtcbiAgICAgICAgICAgIGZpZWxkcy5zaGlmdCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgcmVzdWx0W2ZpZWxkc1tpXV0gPSB0aGlzLmdldFZhbHVlKGksIHkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZ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CBoZWFkZXJSb3dDb3VudCB8fCBkeCA8IGhlYWRlckNvbHVtbkNvdW50O1xuXG4gICAgICAgIGlmICghZ3JpZC5pc0NlbGxTZWxlY3Rpb24oKSB8fCBpc1JpZ2h0Q2xpY2sgfHwgaXNIZWFkZXIgfHwgaXNPdXRzaWRlKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eS5cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIWdyaWQuaXNDZWxsU2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrIHx8ICF0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiA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AgICAgLy93ZXJlIG91dHNpZGUgb2YgdGhlIGdyaWQgZG8gbm90aGluZ1xuICAgICAgICBpZiAoeCA8IDAgfHwgeSA8IDApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vd2UgaGF2ZSByZXBlYXRlZCBhIGNsaWNrIGluIHRoZSBzYW1lIHNwb3QgZGVzbGVjdCB0aGUgdmFsdWUgZnJvbSBsYXN0IHRpbWVcbiAgICAgICAgaWYgKHggPT09IG1vdXNlUG9pbnQueCAmJiB5ID09PSBtb3VzZVBvaW50LnkpIHtcbiAgICAgICAgICAgIGdyaWQuY2xlYXJNb3N0UmVjZW50U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICBncmlkLnBvcE1vdXNlRG93bigpO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyU2VsZWN0aW9ucygpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyTW9zdFJlY2VudFNlbGVjdGlvbigpO1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QobW91c2VQb2ludC54LCBtb3VzZVBvaW50LnksIHggLSBtb3VzZVBvaW50LnggKyAxLCB5IC0gbW91c2VQb2ludC55ICsgMSk7XG4gICAgICAgICAgICBncmlkLnNldERyYWdFeHRlbnQoZ3JpZC5uZXdQb2ludCh4IC0gbW91c2VQb2ludC54ICsgMSwgeSAtIG1vdXNlUG9pbnQueSkpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QoeCwgeSwgMCwgMCk7XG4gICAgICAgICAgICBncmlkLnNldE1vdXNlRG93bihncmlkLm5ld1BvaW50KHgsIHkpKTtcbiAgICAg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uXG4gICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zaXRpb24nLCAnJyk7XG4gICAgICAgICAgICAgICAgZ3JpZC5yZW5kZXJPdmVycmlkZXNDYWNoZS5mbG9hdGVyID0gbnVsbDtcbiAgICAgICAgICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICAgICAgICAgICAgICBzZWxmLmRvRmxvYXRlckFuaW1hdGlvbihncmlkKTtcbiAgICAgICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIGQuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Zsb2F0aW5nTm93ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LCBjb2x1bW5BbmltYXRpb25UaW1lICsgNTApO1xuICAgICAgICB9O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbE1vdmluZy5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBtYW5pZmVzdCB0aGUgZmxvYXRlciBhbmltYXRpb25cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqL1xuICAgIGRvRmxvYXRlckFuaW1hdGlvbjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5mbG9hdGVyQW5pbWF0aW9uUXVldWUubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICB0aGlzLmZsb2F0aW5nTm93ID0gZmFsc2U7XG4gICAgICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIgYW5pbWF0aW9uID0gdGhpcy5mbG9hdG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dGhlIHByZXZpb3VzIHRpbWUgYW4gYXV0b3Njcm9sbCBzdGFydGVkXG4gICAgICogQHR5cGUge251bWJlcn1cbiAgICAgKiBAZGVmYXVsdCAwXG4gICAgICogQG1lbWJlck9mIENvbHVtblNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBzYkxhc3RBdXRvOiAwLFxuXG4gICAgLyoqXG4gICAgICogYSBtaWxsaXNlY29uZCB2YWx1ZSByZXByZXNlbnRpbmcgdGhlIHRpbWUgdGhlIGN1cnJlbnQgYXV0b3Njcm9sbCBzdGFydGVkXG4gICAgICogQHR5cGUge251bWJlcn1cbiAgICAgKiBAZGVmYXVsdCAwXG4gICAgICogQG1lbWJlck9mIENvbHVtblNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBzYkF1dG9TdGFydDogMCxcblxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENvbHVtblNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBIYW5kbGUgdGhpcyBldmVudCBkb3duIHRoZSBmZWF0dXJlIGNoYWluIG9mIHJlc3BvbnNpYmlsaXR5LlxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm5leHQpIHtcbiAgICAgICAgICAgIHRoaXMubmV4dC5oYW5kbGVNb3VzZVVwKGdyaWQsIGV2ZW50KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtY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iAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVLZXlEb3duOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlS2V5RG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVLZXlVcDogZnVuY3Rpb24oZ3JpZCwgZXZlbnQpIHtcbiAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZUtleVVwKGdyaWQsIGV2ZW50KTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiA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LmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbG9zZUNvbHVtblBpY2tlcihncmlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy9ncmlkLnNldEZvY3VzYWJsZShmYWxzZSk7XG4gICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYub3ZlcmxheS5zdHlsZS5vcGFjaXR5ID0gMC45NTtcbiAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBzZWxmLl9jbG9zZXIsIGZhbHNlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuZm9jdXMoKTtcbiAgICAgICAgfSwgMTAwKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2MgY2xvc2UgdGhlIGNvbHVtbiBwaWNrZXJcbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqL1xuICAgIGNsb3NlQ29sdW1uUGlja2VyOiBmdW5jdGlvbihncmlkKSB7XG4gICAgICAgIC8vZ3JpZC5zZXRGb2N1c2FibGUodHJ1ZSk7XG5cbiAgICAgICAgaWYgKCF0aGlzLmlzQ29sdW1uUGlja2VyT3BlbigpKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3BlbkVkaXRvcikge1xuICAgICAgICAgICAgdGhpcy5vcGVuRWRpdG9yID0gZmFsc2U7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZX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IgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIXRoaXMuZHJhZ0FybWVkIHx8ICFncmlkLmlzUm93U2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmRyYWdnaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIC8vdmFyIGR4ID0gY2VsbC54O1xuICAgICAgICAgICAgdmFyIGR5ID0gY2VsbC55O1xuXG4gICAgICAgICAgICAvL2lmIHdlIGFyZSBpbiB0aGUgZml4ZWQgYXJlYSBkbyBub3QgYXBwbHkgdGhlIHNjcm9sbCB2YWx1ZXNcbiAgICAgICAgICAgIC8vY2hlY2sgYm90aCB4IGFuZCB5IHZhbHVlcyBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgICBpZiAodmlld0NlbGwueSA8IG51bUZpeGVkUm93cykge1xuICAgICAgICAgICAgICAgIGR5ID0gdmlld0NlbGwueTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGRDZWxsID0gZ3JpZC5uZXdQb2ludCgwLCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudERyYWcgP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ICAgICAgICAgIGlmIChwcmVkaWNhdGUuY2FsbCh0aGlzQXJnLCB2YWx1ZSwgaSwgbGlzdCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9O1xufVxuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgY3NzSW5qZWN0b3IgPSByZXF1aXJlKCdjc3MtaW5qZWN0b3InKTtcblxudmFyIHN0eWxlc2hlZXRzID0ge1xuICAgIGdyaWQ6IFtcbiAgICAgICAgJ2RpdiNncmlkLWNvbnRhaW5lciB7JyxcbiAgICAgICAgJyAgICBwb3NpdGlvbjogcmVsYXRpdmU7JyxcbiAgICAgICAgJyAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7JyxcbiAgICAgICAgJyAgICAtd2Via2l0LXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgLW1vei11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1tcy11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1vLXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgdXNlci1zZWxlY3Q6IG5vbmU7JyxcbiAgICAgICAgJyAgICBvdmVyZmxvdzogaGlkZGVuOyB9JyxcbiAgICAgICAgJ3Zpc2libGUgeyBvcGFjaXR5OiAwLjc1OyB9JyxcbiAgICAgICAgJ2hpZGRlbiB7IG9wYWNpdHk6IDAuMDsgfScsXG4gICAgICAgICdlZGl0b3IgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgZGlzcGxheTogbm9uZTsnLFxuICAgICAgICAnICAgIGJvcmRlcjogc29saWQgMnB4IGJsYWNrOycsXG4gICAgICAgICcgICAgb3V0bGluZTogMDsnLFxuICAgICAgICAnICAgIHBhZGRpbmc6IDA7Jyxc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JyZWFrO1xuICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMgPSBleHRlbmRlZENsYXNzTmFtZTtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgcHJvdG90eXBlQWRkaXRpb25zICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdTaW5nbGUgcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgb2JqZWN0Lic7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBleHRlbmRlZENsYXNzTmFtZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dGVuZGVkQ2xhc3NOYW1lICE9PSAnc3RyaW5nJyB8fCB0eXBlb2YgcHJvdG90eXBlQWRkaXRpb25zICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdUd28gcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgc3RyaW5nLCBvYmplY3QuJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgJ1RvbyBtYW55IHBhcmFtZXRlcnMnO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIENvbnN0cnVjdG9yKCkge1xuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnByZUluaXRpYWxpemUpIHtcbiAgICAgICAgICAgIHByb3RvdHlwZUFkZGl0aW9ucy5wcmVJbml0aWFsaXplLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgIH1cblxuICAgICAgICBpbml0aWFsaXplUHJvdG90eXBlQ2hhaW4uYXBwbHkodGhpcywgYXJndW1lbnRzKTtcblxuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnBvc3RJbml0aWFsaXplKSB7XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMucG9zdEluaXRpYWxpemUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIENvbnN0cnVjdG9yLmV4dGVuZCA9IGV4dGVuZDtcblxuICAgIHZhciBwcm90b3R5cGUgPSBDb25zdHJ1Y3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHRoaXMucHJvdG90eXBlKTtcbiAgICBwcm90b3R5cGUuY29uc3RydWN0b3IgPSBDb25zdHJ1Y3RvcjtcblxuICAgIGlmIChleHRlbmRlZENsYXNzTmFtZSAmJiBleHRlbmQuZGVidWcpIHtcbiAgICAgICAgcHJvdG90eXBlLiQkQ0xBU1NfTkFNRSA9IGV4dGVuZGVkQ2xhc3NOYW1lO1xuICAgIH1cblxuICAgIGZvciAodmFyIGtleSBpbiBwcm90b3R5cGVBZGRpdGlvbnMpIHtcbiAgICAgICAgaWYgKHByb3RvdHlwZUFkZGl0aW9ucy5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBwcm90b3R5cGVBZGRpdGlvbnNba2V5XTtcbiAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSAnaW5pdGlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWx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ydGljYWwnKTtcblxuICAgIGJhci5hcHBlbmRDaGlsZCh0aHVtYik7XG4gICAgaWYgKHRoaXMucGFnaW5nKSB7XG4gICAgICAgIGJhci5vbmNsaWNrID0gYm91bmQub25jbGljaztcbiAgICB9XG4gICAgdGhpcy5iYXIgPSBiYXI7XG5cbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgIC8vIHByZXNldHNcbiAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAg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G4gICAgc2V0IHN0eWxlKHN0eWxlcykge1xuICAgICAgICB2YXIga2V5cyA9IE9iamVjdC5rZXlzKHN0eWxlcyA9IGV4dGVuZCh7fSwgc3R5bGVzLCB0aGlzLl9hdXhTdHlsZXMpKTtcblxuICAgICAgICBpZiAoa2V5cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHZhciBiYXIgPSB0aGlzLmJhcixcbiAgICAgICAgICAgICAgICBiYXJSZWN0ID0gYmFyLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IHRoaXMuY29udGFpbmVyIHx8IGJhci5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lclJlY3QgPSBjb250YWluZXIuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksXG4gICAgICAgICAgICAgICAgb2ggPSB0aGlzLm9oO1xuXG4gICAgICAgICAgICAvLyBCZWZvcmUgYXBwbHlpbmcgbmV3IHN0eWxlcywgcmV2ZXJ0IGFsbCBzdHlsZXMgdG8gdmFsdWVzIGluaGVyaXRlZCBmcm9tIHN0eWxlc2hlZXRzXG4gICAgICAgICAgICBiYXIucmVtb3ZlQXR0cmlidXRlKCdzdHlsZScpO1xuXG4gICAgICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gYmFyIHNpemUgZ2l2ZW4gYXMgcGVyY2VudGFnZSBvZiBjb250YWluZXIsIGlmIGJhciBoYXMgbWFyZ2lucywgcmVzdGF0ZSBzaXplIGluIHBpeGVscyBsZXNzIG1hcmdpbnMuXG4gICAgICAgICAgICAgICAgICAgIC8vIChJZiBsZWZ0IGFzIHBlcmNlbnRhZ2UsIENTUydzIGNhbGN1bGF0aW9uIHdpbGwgbm90IGV4Y2x1ZGUgbWFyZ2lucy4pXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcmllbnRlZCA9IGF4aXNba2V5XSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbnMgPSBiYXJSZWN0W29yaWVudGVkLm1hcmdpbkxlYWRpbmddICsgYmFyUmVjdFtvcmllbnRlZC5tYXJnaW5UcmFpbGluZ107XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXJnaW5zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSBwYXJzZUludCh2YWwsIDEwKSAvIDEwMCAqIGNvbnRhaW5lclJlY3Rbb3JpZW50ZWQuc2l6ZV0gLSBtYXJnaW5zICsgJ3B4JztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGJhci5zdHlsZVtrZXldID0gdmFsO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQHJlYWRvbmx5XG4gICAgICogQG5hbWUgcGFnaW5nXG4gICAgICogQHN1bW1hcnkgRW5hYmxlIHBhZ2UgdXAvZG4gY2xpY2tzLlxuICAgICAqIEBkZXNjIFNldCBieSB0aGUgY29uc3RydWN0b3IuIFNlZSB0aGUgc2ltaWxhcmx5IG5hbWVkIHByb3BlcnR5IGluIHRoZSB7QGxpbmsgZmluYmFyT3B0aW9uc30gb2JqZWN0LlxuICAgICAqXG4gICAgICogSWYgdHJ1dGh5LCB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uZ2UgPSB0aGlzLnNjcm9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uY2hhbmdlID09PSB0aGlzLnNjcm9sbFJlYWxDb250ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lclNpemUgPSBjb250YWluZXJSZWN0W3RoaXMub2guc2l6ZV07XG4gICAgICAgICAgICB0aGlzLmluY3JlbWVudCA9IHRoaXMuY29udGFpbmVyU2l6ZSAvICh0aGlzLmNvbnRlbnRTaXplIC0gdGhpcy5jb250YWluZXJTaXplKSAqICh0aGlzLl9tYXggLSB0aGlzLl9taW4pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jb250YWluZXJTaXplID0gMTtcbiAgICAgICAgICAgIHRoaXMuaW5jcmVtZW50ID0gaW5jcmVtZW50IHx8IHRoaXMuaW5jcmVtZW50O1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGluZGV4ID0gdGhpcy5pbmRleDtcbiAgICAgICAgdGhpcy50ZXN0UGFuZWxJdGVtID0gdGhpcy50ZXN0UGFuZWxJdGVtIHx8IHRoaXMuX2FkZFRlc3RQYW5lbEl0ZW0oKTtcbiAgICAgICAgdGhpcy5fc2V0VGh1bWJTaXplKCk7XG4gICAgICAgIHRoaXMuaW5kZXggPSBpbmRleDtcblxuICAgICAgICBpZiAodGhpcy5kZWx0YVByb3AgIT09IG51bGwpIHtcbiAgICAgICAgICAgIGNvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCd3aGVlbCcsIHRoaXMuX2JvdW5kLm9ud2hlZWwpO1xuICAgIC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G4gICAgICAgIG91dHNpZGU6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6ICAgICAgICAgICAnd2lkdGgnLFxuICAgICAgICBvdXRzaWRlOiAgICAgICAgJ2JvdHRvbScsXG4gICAgICAgIGluc2lkZTogICAgICAgICAndG9wJyxcbiAgICAgICAgbGVhZGluZzogICAgICAgICdsZWZ0JyxcbiAgICAgICAgdHJhaWxpbmc6ICAgICAgICdyaWdodCcsXG4gICAgICAgIG1hcmdpbkxlYWRpbmc6ICAnbWFyZ2luTGVmdCcsXG4gICAgICAgIG1hcmdpblRyYWlsaW5nOiAnbWFyZ2luUmlnaHQnLFxuICAgICAgICB0aGlja25lc3M6ICAgICAgJ2hlaWdodCcsXG4gICAgICAgIGRlbHRhOiAgICAgICAgICAnZGVsdGFYJ1xuICAgIH1cbn07XG5cbnZhciBheGlzID0ge1xuICAgIHRvcDogICAgJ3ZlcnRpY2FsJyxcbiAgICBib3R0b206ICd2ZXJ0aWNhbCcsXG4gICAgaGVpZ2h0OiAndmVydGljYWwnLFxuICAgIGxlZnQ6ICAgJ2hvcml6b250YWwnLFxuICAgIHJpZ2h0OiAgJ2hvcml6b250YWwnLFxuICAgIHdpZH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cmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHZhciBpbnRlcnZhbCA9IDEwMDAgLyBmcHM7XG5cbiAgICAgICAgdmFyIGVsYXBzZWQgPSBub3cgLSB0aGlzLmxhc3RSZXBhaW50VGltZTtcbiAgICAgICAgaWYgKGVsYXBzZWQgPiBpbnRlcnZhbCAmJiB0aGlzLmRpcnR5KSB7XG4gICAgICAgICAgICB0aGlzLmxhc3RSZXBhaW50VGltZSA9IG5vdyAtIChlbGFwc2VkICUgaW50ZXJ2YWwpO1xuICAgICAgICAgICAgdGhpcy5wYWludE5vdygpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIGJlZ2luUGFpbnRpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMuZGlydHkgPSB0cnVlO1xuICAgICAgICB0aGlzLnRpY2tQYWludGVyID0gZnVuY3Rpb24obm93KSB7XG4gICAgICAgICAgICBzZWxmLnRpY2tQYWludChub3cpO1xuICAgICAgICB9O1xuICAgICAgICBwYWludGFibGVzLnB1c2godGhpcyk7XG4gICAgfSxcblxuICAgIHN0b3BQYWludGluZzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHBhaW50YWJsZXMuc3BsaWNlKHBhaW50YWJsZXMuaW5kZXhPZih0aGlzKSwgMSk7XG4gICAgfSxcblxuICAgIGJlZ2luUmVzaXppbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMudGlja1Jlc2l6ZXIgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuY2hlY2tzaXplKCk7XG4gICAgICAgIH07XG4gICAgICAgIHJlc2l6YWJsZXMucHVzaCh0aGlzKTtcbiAgICB9LFxuXG4gICAgc3RvcFJlc2l6aW5nOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmVzaXphYmxlcy5zcGxpY2UocmVzaXphYmxlcy5pbm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Y3Rpb24oKSB7XG4gICAgICAgIHZhciBjb21wID0gdGhpcy5fY29tcG9uZW50O1xuICAgICAgICBpZiAoY29tcCkge1xuICAgICAgICAgICAgY29tcC5zZXRCb3VuZHModGhpcy5ib3VuZHMpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucmVzaXplTm90aWZpY2F0aW9uKCk7XG4gICAgICAgIHRoaXMucGFpbnROb3coKTtcbiAgICAgICAgLy99KTtcbiAgICB9LFxuXG4gICAgcmVzaXplTm90aWZpY2F0aW9uOiBmdW5jdGlvbigpIHtcbiAgICAgICAgLy90byBiZSBvdmVycmlkZGVuXG4gICAgfSxcblxuICAgIGdldEJvdW5kczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmJvdW5kcztcbiAgICB9LFxuXG4gICAgcGFpbnROb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMuc2FmZVBhaW50SW1tZWRpYXRlbHkoZnVuY3Rpb24oZ2MpIHtcbiAgICAgICAgICAgIGdjLmNsZWFyUmVjdCgwLCAwLCBzZWxmLmNhbnZhcy53aWR0aCwgc2VsZi5jYW52YXMuaGVpZ2h0KTtcblxuICAgICAgICAgICAgdmFyIGNvbXAgPSBzZWxmLl9jb21wb25lbnQ7XG4gICAgICAgICAgICBpZiAoY29tcCkge1xuICAgICAgICAgICAgICAgIGNvbXAuX3BhaW50KGdjKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc2VsZi5kaXJ0eSA9IGZhbHNlO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgc2FmZVBhaW50SW1tZWRpYXRlbHk6IGZ1bmN0aW9uKHBhaW50RnVuY3Rpb24pIHtcbiAgICAgICAgdmFyIHVzZUJpdEJsaXQgPSB0aGlzLnVzZUJpdEJsaXQoKSxcbiAgICAgICAgICAgIGdjID0gdXNlQml0QmxpdCA/IHRoaXMuYnVmZmVyR0MgOi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G9sZFB1bHNlQ291bnQrK1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgZmludGFwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIC8vdGhpcyBub25zZW5zZSBpcyB0byBob2xkIGEgdGFwIGlmIGl0J3MgcmVhbGx5IGEgZG91YmxlIGNsaWNrXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIG5vdyA9IERhdGUubm93KCk7XG4gICAgICAgIHZhciBkaWYgPSBub3cgLSB0aGlzLmxhc3REb3VibGVDbGlja1RpbWU7XG4gICAgICAgIGlmIChkaWYgPCAzMDApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICAvL2RyYWdlbmQgaXMgYWxzbyBjYXVzaW5nIGEgdGFwXG4gICAgICAgIC8vbGV0cyBmaXggdGhpcyBoZXJlXG4gICAgICAgIGlmIChub3cgLSB0aGlzLmRyYWdFbmR0aW1lIDwgMTAwKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuX2ZpbnRhcChlKTtcbiAgICAgICAgfSwgMTgwKTtcbiAgICB9LFxuXG4gICAgX2ZpbnRhcDogZnVuY3Rpb24oZSkge1xuICAgICAgICAvL3RoaXMgbm9uc2Vuc2UgaXMgdG8gaG9sZCBhIHRhcCBpZiBpdCdzIHJlYWxseSBhIGRvdWJsZSBjbGlja1xuICAgICAgICB2YXIgbm93ID0gRGF0ZS5ub3coKTtcbiAgICAgICAgdmFyIGRpZiA9IG5vdyAtIHRoaXMubGFzdERvdWJsZUNsaWNrVGltZTtcbiAgICAgICAgaWYgKGRpZiA8IDMwMCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIC8vdGhpcy5tb3VzZUxvY2F0aW9uID0gdGhpcy5nZXRMb2NhbChlKTtcbiAgICAgICAgdGhpcy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gPT09IGtleUNoYXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5zcGxpY2UodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpLCAxKTtcbiAgICAgICAgaWYgKCF0aGlzLmhhc0ZvY3VzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgdGhpcy5yZXBlYXRLZXkgPSBudWxsO1xuICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IDA7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1rZXl1cCcsIHtcbiAgICAgICAgICAgIGFsdDogZS5hbHRLZXksXG4gICAgICAgICAgICBjdHJsOiBlLmN0cmxLZXksXG4gICAgICAgICAgICBjaGFyOiBrZXlDaGFyLFxuICAgICAgICAgICAgY29kZTogZS5jaGFyQ29kZSxcbiAgICAgICAgICAgIGtleTogZS5rZXlDb2RlLFxuICAgICAgICAgICAgbWV0YTogZS5tZXRhS2V5LFxuICAgICAgICAgICAgcmVwZWF0OiBlLnJlcGVhdCxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xp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fVxuICAgICAgICBpZiAodHlwZW9mIGdjW2tleV0gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHNlbGZba2V5XSA9ICFsb2dnZXIgPyBnY1trZXldLmJpbmQoZ2MpIDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvZ2dlcihrZXksIGFyZ3VtZW50cywgZ2Nba2V5XS5hcHBseShnYywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ2VyKGtleSwgJ2dldHRlcicsIHJlc3VsdCkgOiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGdjW2tleV0gPSBsb2dnZXIgPyBsb2dnZXIoa2V5LCAnc2V0dGVyJywgdmFsdWUpIDogdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gR3JhcGhpY3NDb250ZXh0O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgWUlFTERTID0gJ1xcdTI3RjknOyAvLyBMT05HIFJJR0hUV0FSRFMgRE9VQkxFIEFSUk9XXG5cbmZ1bmN0aW9uIGNvbnNvbGVMb2dnZXIocHJlZml4LCBuYW1lLCBhcmdzLCB2YWx1ZSkge1xuICAgIHZhciByZXN1bHQgPSB2YWx1ZTtcblxuICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICd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wpIHtcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5zaGFkb3coaW5FbCk7XG4gICAgICAgICAgICBpZiAodGhpcy5jYW5UYXJnZXQocykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgb2xkZXJTaGFkb3c6IGZ1bmN0aW9uKHNoYWRvdykge1xuICAgICAgICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc2NvcGUudGFyZ2V0RmluZGluZyA9IHRhcmdldDtcbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBldmVudCwgZmluZHMgdGhlIFwiZGVlcGVzdFwiIG5vZGUgdGhhdCBjb3VsZCBoYXZlIGJlZW4gdGhlIG9yaWdpbmFsIHRhcmdldCBiZWZvcmUgU2hhZG93RE9NIHJldGFyZ2V0dGluZ1xuICAgICAqXG4gICAgICogQHBhcmFtIHtFdmVudH0gRXZlbnQgQW4gZXZlbnQgb2JqZWN0IHdpdGggY2xpZW50WCBhbmQgY2xpZW50WSBwcm9wZXJ0aWVzXG4gICAgICogQHJldHVybiB7RWxlbWVudH0gVGhlIHByb2JhYmxlIGV2ZW50IG9yaWduaW5hdG9yXG4gICAgICovXG4gICAgc2NvcGUuZmluZFRhcmdldCA9IHRhcmdldC5maW5kVGFyZ2V0LmJpbmQodGFyZ2V0KTtcbiAgICAvKipcbiAgICAgKiBEZXRlcm1pbmVzIGlmIHRoZSBcImNvbnRhaW5lclwiIG5vZGUgZGVlcG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vLyBvbmx5IGFkZCBzaGFkb3cgc2VsZWN0b3JzIGlmIHNoYWRvd2RvbSBpcyBzdXBwb3J0ZWRcbiAgICB2YXIgaGFzU2hhZG93Um9vdCA9ICF3aW5kb3cuU2hhZG93RE9NUG9seWZpbGwgJiYgZG9jdW1lbnQuaGVhZC5jcmVhdGVTaGFkb3dSb290O1xuXG4gICAgaWYgKGhhc1RvdWNoQWN0aW9uKSB7XG4gICAgICAgIGF0dHJpYjJjc3MuZm9yRWFjaChmdW5jdGlvbihyKSB7XG4gICAgICAgICAgICBpZiAoU3RyaW5nKHIpID09PSByKSB7XG4gICAgICAgICAgICAgICAgc3R5bGVzICs9IHNlbGVjdG9yKHIpICsgcnVsZShyKSArICdcXG4nO1xuICAgICAgICAgICAgICAgIGlmIChoYXNTaGFkb3dSb290KSB7XG4gICAgICAgICAgICAgICAgICAgIHN0eWxlcyArPSBzaGFkb3dTZWxlY3RvcihyKSArIHJ1bGUocikgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0eWxlcyArPSByLnNlbGVjdG9ycy5tYXAoc2VsZWN0b3IpICsgcnVsZShyLnJ1bGUpICsgJ1xcbic7XG4gICAgICAgICAgICAgICAgaWYgKGhhc1NoYWRvd1Jvb3QpIHtcbiAgICAgICAgICAgICAgICAgICAgc3R5bGVzICs9IHIuc2VsZWN0b3JzLm1hcChzaGFkb3dTZWxlY3RvcikgKyBydWxlKHIucnVsZSkgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHZhciBlbCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7XG4gICAgICAgIGVsLnRleHRDb250ZW50ID0gc3R5bGVzO1xuICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGVsKTtcbiAgICB9XG59KSgpO1xuXG4v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AnbWV0YUtleScsXG4gICAgICAgICdidXR0b24nLFxuICAgICAgICAncmVsYXRlZFRhcmdldCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWSdcbiAgICBdO1xuXG4gICAgdmFyIE1PVVNFX0RFRkFVTFRTID0gW1xuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIG51bGwsXG4gICAgICAgIG51bGwsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICAwLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwXG4gICAgXTtcblxuICAgIHZhciBOT1BfRkFDVE9SWSA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7fTtcbiAgICB9O1xuXG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHtcbiAgICAgICAgLy8gVE9ETyhkZnJlZWRtKTogdGhpcyBpcyBvdmVycmlkZGVuIGJ5IHRhcCByZWNvZ25pemVyLCBuZWVkcyByZXZpZXdcbiAgICAgICAgcHJldmVudFRhcDogTk9QX0ZBQ1RPUlksXG4gICAgICAgIG1ha2VCYXNlRXZlbnQ6IGZ1bmN0aW9uKGluVHlwZSwgaW5EaWN0KSB7XG4gICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdFdmVudCcpO1xuICAgICAgICAgICAgZS5pbml0RXZlbnQoaW5UeXBlLCBpbkRpY3QuYnViYmxlcyB8fCBmYWxzZSwgaW5EaWN0LmNhbmNlbGFibGUgfHwgZmFsc2UpO1xuICAgICAgICAgICAgZS5wcmV2ZW50VGFwID0gZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAoZSk7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZUdlc3R1cmVFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgf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AgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEF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bnRlck1hcCgpLFxuICAgICAgICByZXF1aXJlZEdlc3R1cmVzOiBuZXcgc2NvcGUuUG9pbnRlck1hcCgpLFxuICAgICAgICBldmVudE1hcDogT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgLy8gU2NvcGUgb2JqZWN0cyBmb3IgbmF0aXZlIGV2ZW50cy5cbiAgICAgICAgLy8gVGhpcyBleGlzdHMgZm9yIGVhc2Ugb2YgdGVzdGluZy5cbiAgICAgICAgZXZlbnRTb3VyY2VzOiBPYmplY3QuY3JlYXRlKG51bGwpLFxuICAgICAgICBldmVudFNvdXJjZUxpc3Q6IFtdLFxuICAgICAgICBnZXN0dXJlczogW10sXG4gICAgICAgIC8vIG1hcCBnZXN0dXJlIGV2ZW50IC0+IHtsaXN0ZW5lcnM6IGludCwgaW5kZXg6IGdlc3R1cmVzW2ludF19XG4gICAgICAgIGRlcGVuZGVuY3lNYXA6IHtcbiAgICAgICAgICAgIC8vIG1ha2Ugc3VyZSBkb3duIGFuZCB1cCBhcmUgaW4gdGhlIG1hcCB0byB0cmlnZ2VyIFwicmVnaXN0ZXJcIlxuICAgICAgICAgICAgZG93bjoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB1cDoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVF1ZXVlOiBbXSxcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEFkZCBhIG5ldyBldmVudCBzb3VyY2UgdGhhdCB3aWxsIGdlbmVyYXRlIHBvaW50ZXIgZXZlbnRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBgaW5Tb3VyY2VgIG11c3QgY29udGFpbiBhbiBhcnJheSBvZiBldmVudCBuYW1lcyBuYW1lZCBgZXZlbnRzYCwgYW5kXG4gICAgICAgICAqIGZ1bmN0aW9ucyB3aXRoIHRoZSBuYW1lcyBzcGVjaWZpZWQgaW4gdGhlIGBldmVudHNgIGFycmF5LlxuICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSBBIG5hbWUgZm9yIHRoZSBldmVudCBzb3VyY2VcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBBIG5ldyBzb3VyY2Ugb2YgcGxhdGZvcm0gZXZlbnRzLlxuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJTb3VyY2U6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIHMgPSBzb3VyY2U7XG4gICAgICAgICAgICB2YXIgbmV3RXZlbnRzID0gcy5ldmVudHM7XG4gICAgICAgICAgICBpZiAobmV3RXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIG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BnZXN0dXJlc1dhbnRlZCA9IG5vZGUuX3BnRXZlbnRzO1xuICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkICYmIGN1cnJlbnRHZXN0dXJlcykge1xuICAgICAgICAgICAgICAgIHZhciBnayA9IE9iamVjdC5rZXlzKGdlc3R1cmVzV2FudGVkKTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciwgcmksIGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBMSVNURU5FUiBMT0dJQ1xuICAgICAgICBldmVudEhhbmRsZXI6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgdXNlZCB0byBwcmV2ZW50IG11bHRpcGxlIGRpc3BhdGNoIG9mIGV2ZW50cyBmcm9tXG4gICAgICAgICAgICAvLyBwbGF0Zm9ybSBldmVudHMuIFRoaXMgY2FuIGhhcHBlbiB3aGVuIHR3byBlbGVtZW50cyBpbiBkaWZmZXJlbnQgc2NvcGVzXG4gICAgICAgICAgICAvLyBhcmUgc2V0IHVwIHRvIGNyZWF0ZSBwb2ludGVyIGV2ZW50cywgd2hpY2ggaXMgcmVsZXZhbnQgdG8gU2hhZG93IERPTS5cblxuICAgICAgICAgICAgdmFyIHR5cGUgPSBpbkV2ZW50LnR5cGU7XG5cbiAgICAgICAgICAgIC8vIG9ubHkgZ2VuZXJhdGUgdGhlIGxpc3Qgb2YgZGVzaXJlZCBldmVudHMgb24gXCJkb3duXCJcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ21vdXNlZG93bicgfHwgdHlwZSA9PT0gJ3BvaW50ZXJkb3duJyB8fCB0eXBlID09PSAnTVNQb2ludGVyRG93bicpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWluRXZlbnQuX2hhbmRsZWRCeVBHKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlcyA9IHt9O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGluIElPUyBtb2RlLCB0aGVyZSBpcyBvbmx5IGEgbGlzdGVuZXIgb24gdGhlIGRvY3VtZW50LCBzbyB0aGlzIGlzIG5vdCByZS1lbnRyYW50XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdmUgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIHVubGlzdGVuOiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50cykge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBldmVudHMubGVuZ3RoLCBlO1xuICAgICAgICAgICAgICAgIChpIDwgbCkgJiYgKGUgPSBldmVudHNbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUV2ZW50KHRhcmdldCwgZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LmFkZEV2ZW50TGlzdGVuZXIoZXZlbnROYW1lLCB0aGlzLmJvdW5kSGFuZGxlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHJlbW92ZUV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LnJlbW92ZUV2ZW50TGlzdGVuZXIo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LlxuICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAgICAgIH0sXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBEaXNwYXRjaGVzIHRoZSBldmVudCB0byBpdHMgdGFyZ2V0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IFRoZSBldmVudCB0byBiZSBkaXNwYXRjaGVkLlxuICAgICAgICAgKiBAcmV0dXJuIHtCb29sZWFufSBUcnVlIGlmIGFuIGV2ZW50IGhhbmRsZXIgcmV0dXJucyB0cnVlLCBmYWxzZSBvdGhlcndpc2UuXG4gICAgICAgICAqL1xuICAgICAgICBkaXNwYXRjaEV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuX3RhcmdldDtcbiAgICAgICAgICAgIGlmICh0KSB7XG4gICAgICAgICAgICAgICAgdC5kaXNwYXRjaEV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIC8vIGNsb25lIHRoZSBldmVudCBmb3IgdGhlIGdlc3R1cmUgc3lzdGVtIHRvIHByb2Nlc3NcbiAgICAgICAgICAgICAgICAvLyBjbG9uZSBhZnRlciBkaXNwYXRjaCB0byBwaWNrIHVwIGdlc3R1cmUgcHJldmVudGlvbiBjb2RlXG4gICAgICAgICAgICAgICAgdmFyIGNsb25lID0gdGhpcy5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGNsb25lLnRhcmdldCA9IHQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maWxsR2VzdHVyZVF1ZXVlKGNsb25lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVRyaWdnZXI6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgLy8gcHJvY2VzcyB0aGUgZ2VzdHVyZSBxdWV1ZVxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGUsIHJnOyBpIDwgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLmNhbGwoZywgZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgZmlsbEdlc3R1cmVRdWV1ZTogZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgICAgIC8vIG9ubHkgdHJpZ2dlciB0aGUgZ2VzdHVyZSBxdWV1ZSBvbmNlXG4gICAgICAgICAgICBpZiAoIXRoaXMuZ2VzdHVyZVF1ZXVlLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZSh0aGlzLmJvdW5kR2VzdHVyZVRyaWdnZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXYuX3JlcXVpcmVkR2VzdHVyZXMgPSB0aGlzLnJlcXVpcmVkR2VzdHVyZXMuZ2V0KGV2LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICB0aGlzLmdlc3R1cmVRdWV1ZS5wdXNoKGV2KTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgZGlzcGF0Y2hlci5ib3VuZEhhbmRsZXIgPSBkaXNwYXRjaGVyLmV2ZW50SGFuZGxlci5iaW5kKGRpc3BhdGNoZXIpO1xuICAgIGRpc3BhdGNoZXIuYm91bmRHZ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WV2YWx1YXRlIGJvb2trZWVwaW5nIHRvIGF2b2lkIHVzaW5nIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgIGlmIChyZWNvZ25pemVyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gcmVjb2duaXplci5kZWZhdWx0QWN0aW9ucyAmJiByZWNvZ25pemVyLmRlZmF1bHRBY3Rpb25zW2ddO1xuICAgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW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IGRpc2FibGVkLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtFbGVtZW50fSBub2RlXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGdlc3R1cmVcbiAgICAgKiBAcmV0dXJuIEJvb2xlYW4gYGdlc3R1cmVgIGlzIGEgdmFsaWQgZ2VzdHVyZVxuICAgICAqL1xuICAgIHNjb3BlLmRlYWN0aXZhdGVHZXN0dXJlID0gZnVuY3Rpb24obm9kZSwgZ2VzdHVyZSkge1xuICAgICAgICB2YXIgZyA9IGdlc3R1cmUudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgdmFyIGRlcCA9IGRpc3BhdGNoZXIuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgaWYgKGRlcCkge1xuICAgICAgICAgICAgaWYgKG5vZGUuX3BnTGlzdGVuZXJzID4gMCkge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzLS07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdMaXN0ZW5lcnMgPT09IDApIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnVucmVnaXN0ZXIobm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHMpIHtcbiAgICAgICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHNbZ10gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzW2ddLS07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZS5fcGdFdmVudHNbZ10gPSAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gQm9vbGVhbihkZXApO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBTdG9wIGxpc3RlbmluZyBmb3IgYGdlc3R1cmVgIGZyb20gYG5vZGVgIHdpdGggYGhhb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bmNvcnJlY3QgdmFsdWVzIGZvciBtb3VzZXVwLmJ1dHRvbnNcbiAgICAgICAgLy8gaHR0cHM6Ly9kZXZlbG9wZXIubW96aWxsYS5vcmcvZW4tVVMvZG9jcy9XZWIvQVBJL01vdXNlRXZlbnQuYnV0dG9ucyNTZWVfYWxzb1xuICAgICAgICAvLyBodHRwczovL2NvZGVyZXZpZXcuY2hyb21pdW0ub3JnLzcyNzU5MzAwMy8jbXNnMTZcbiAgICAgICAgaWYgKEZJUkVGT1hfTElOVVgudGVzdChuYXZpZ2F0b3IudXNlckFnZW50KSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IE1vdXNlRXZlbnQoJ3Rlc3QnLCB7XG4gICAgICAgICAgICAgICAgYnV0dG9uczogMVxuICAgICAgICAgICAgfSkuYnV0dG9ucyA9PT0gMTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfSkoKTtcblxuICAgIC8vIGhhbmRsZXIgYmxvY2sgZm9yIG5hdGl2ZSBtb3VzZSBldmVudHNcbiAgICB2YXIgbW91c2VFdmVudHMgPSB7XG4gICAgICAgIFBPSU5URVJfSUQ6IDEsXG4gICAgICAgIFBPSU5URVJfVFlQRTogJ21vdXNlJyxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnbW91c2Vkb3duJyxcbiAgICAgICAgICAgICdtb3VzZW1vdmUnLFxuICAgICAgICAgICAgJ21vdXNldXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgIC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ICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KHRoaXMuUE9JTlRFUl9JRCk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjbGVhbnVwTW91c2U6IGZ1bmN0aW9uKGJ1dHRvbnMpIHtcbiAgICAgICAgICAgIGlmIChidXR0b25zID09PSAwKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUodGhpcy5QT0lOVEVSX0lEKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tb3VzZUV2ZW50cyA9IG1vdXNlRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2Nvc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ICAgICAndG91Y2hjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TID8gaW5pdGlhbCA6ICFpbml0aWFsKSB7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLklTX0lPUykge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB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RlclR5cGUgPSB0aGlzLlBPSU5URVJfVFlQRTtcbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICd0b3VjaCc7XG4gICAgICAgICAgICAvLyBmb3J3YXJkIHRvdWNoIHByZXZlbnREZWZhdWx0c1xuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgc2VsZi5maXJzdFhZID0gbnVsbDtcbiAgICAgICAgICAgICAgICBjdGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcHJvY2Vzc1RvdWNoZXM6IGZ1bmN0aW9uKGluRXZlbnQsIGluRnVuY3Rpb24pIHtcbiAgICAgICAgICAgIHZhciB0bCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXM7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50ID0gaW5FdmVudDtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCB0LCBwOyBpIDwgdGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gRm9yIHNpbmdsZSBheGlzIHNjcm9sbGVycywgZGV0ZXJtaW5lcyB3aGV0aGVyIHRoZSBlbGVtZW50IHNob3VsZCBlbWl0XG4gICAgICAgIC8vIHBvaW50ZXIgZXZlbnRzIG9yIGJlaGF2ZSBhcyBhIHNjcm9sbGVyXG4gICAgICAgIHNob3VsZFNjcm9sbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQ7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gc2NvcGUudGFyZ2V0RmluZGluZy5maW5kVG91Y2hBY3Rpb24oaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgdmFyIHNjcm9sbEF4aXMgPSB0aGlzLnRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlKHRvdWNoQWN0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsQXhpcyA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgZWxlbWVudCBpcyBhIHRvdWNoLWFjdGlvbjogbm9uZSwgc2hvdWxkIG5ldmVyIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICByZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNjcm9sbEF4aXMgPT09ICdYWScpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBlbGVtZW50IHNob3VsZCBhbHdheXMgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayB0aGUgaW50ZW5kZWQgc2Nyb2xsIGF4aXMsIGFuZCBvdGhlciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvLyBtYWtpbmcgZXZlbnRzXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IGRhID49IGRvYTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoOiBmdW5jdGlvbihpblRMLCBpbklkKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGluVEwubGVuZ3RoLCB0OyBpIDwgbCAmJiAodCA9IGluVExbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAodC5pZGVudGlmaWVyID09PSBpbklkKSB7XG4gICAgICAgICAgICAgICA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IHdoaWNoIGlzIG1vdXNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBhcmUgMiBzbWFsbGVyIHRoYW4gdGhlaXIgcG9pbnRlcklkLCB3aGljaCBpcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXggaW4gcG9pbnRlcm1hcC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW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mICh0aGlzLmlzUHJpbWFyeVRvdWNoKHQpKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVtZW1iZXIgeC95IG9mIGxhc3QgdG91Y2hcbiAgICAgICAgICAgICAgICB2YXIgbHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIHg6IHQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogdC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KS5iaW5kKG51bGwsIGx0cywgbHQpO1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZm4sIERFRFVQX1RJTUVPVVQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHByZXZlbnQgXCJnaG9zdCBjbGlja3NcIiB0aGF0IGNvbWUgZnJvbSBlbGVtZW50cyB0aGF0IHdlcmUgcmVtb3ZlZCBpbiBhIHRvdWNoIGhhbmRsZXJcbiAgICB2YXIgU1RPUF9QUk9QX0ZOID0gRXZlbnQucHJvdG90eXBlLnN0b3BJbW1lZGlhdGVQcm9wYWdhdGlvbiB8fCBFdmVudC5wcm90b3R5cGUuc3RvcFByb3BhZ2F0aW9uO1xuICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgdmFyIHggPSBldi5jbGllbnRYLFxuICAgICAgICAgICAgeSA9IGV2LmNsaWVudFk7XG4gICAg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XJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgUE9JTlRFUl9UWVBFUzogW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAndW5hdmFpbGFibGUnLFxuICAgICAgICAgICAgJ3RvdWNoJyxcbiAgICAgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlckNhbmNlbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGUucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGUpO1xuICAgICAgICA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TtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcmRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGUudGFyZ2V0ID0gdGFyZ2V0O1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcnVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtc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4dGVuZHMgdHJhY2tzdGFydFxuICovXG4vKipcbiAqIFRoaXMgZXZlbnQgZmlyZXMgd2hlbiB0aGUgcG9pbnRlciBpcyBubyBsb25nZXIgYmVpbmcgdHJhY2tlZC5cbiAqXG4gKiBAY2xhc3MgdHJhY2tlbmRcbiAqIEBleHRlbmRzIHRyYWNrc3RhcnRcbiAqL1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgZGlzcGF0Y2hlciA9IHNjb3BlLmRpc3BhdGNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRyYWNrID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0cmFja3N0YXJ0JyxcbiAgICAgICAgICAgICd0cmFjaycsXG4gICAgICAgICAgICAndHJhY2t4JyxcbiAgICAgICAgICAgICd0cmFja3knLFxuICAgICAgICAgICAgJ3RyYWNrZW5kJ1xuICAgICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ucGFnZVggPSBpbkV2ZW50LnBhZ2VYO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5zY3JlZW5YID0gaW5FdmVudC5zY3JlZW5YO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54RGlyZWN0aW9uID0gdC54RGlyZWN0aW9uO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGluVHlwZSAhPT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZHkgPSBkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmRkeSA9IGRkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnkgPSBpbkV2ZW50Lnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmNsaWVudFkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnBhZ2VZID0gaW5FdmVudC5wYWdlWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uc2NyZWVuWSA9IGluRXZlbnQuc2NyZWVuWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ueURpcmVjdGlvbiA9IHQueURpcmVjdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBlID0gZXZlbnRGYWN0b3J5Lm1ha2VHZXN0dXJlRXZlbnQoaW5UeXBlLCBnZXN0dXJlUHJvdG8pO1xuICAgICAgICAgICAgdC5kb3duVGFyZ2V0LmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAoaW5FdmVudC5wb2ludGVyVHlwZSA9PT0gJ21vdXNlJyA/IGluRXZlbnQuYnV0dG9ucyA9PT0gMSA6IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNreScsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBpbkV2ZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAocCkge1xuICAgICAgICAgICAgICAgIGlmIChwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja2VuZCcsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIGRpc3BhdGNoZXIucmVnaXN0ZXJHZXN0dXJlKCd0cmFjaycsIHRyYWNrKTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgZXZlbnQgaXMgZmlyZWQgd2hlbiBhIHBvaW50ZXIgaXMgaGVsZCBkb3duIGZvciAyMDBtcy5cbiAqXG4gKiBAbW9kdWxlIFBvaW50ZXJHZXN0dXJlc1xuICogQHN1Ym1vZHVsZSBFdmVudHNcbiAqIEBjbGFzcyBob2xkXG4gKi9cbi8qKlxuICogVHlwZSBvZiBwb2ludGVyIHRoYXQgbWFkZSB0aGUgaG9sZGluZyBldmVudC5cbiAqIEB0eXBlIFN0cmluZ1xuICogQHByb3BlcnR5IHBvaW50ZXJUeXBlXG4gKi9cbi8qKlxuICogU2NyZWVuIFggYXhpcyBwb3NpdGlvbiBvZiB0aGUgaGVsZCBwb2ludGVyXG4gKiBAdHlwZSBOdW1iZXJ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IGJlZm9yZSBub3QgY291bnRpbmcgYXMgYSBob2xkXG4gICAgICAgIFdJR0dMRV9USFJFU0hPTEQ6IDE2LFxuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdob2xkJyxcbiAgICAgICAgICAgICdob2xkcHVsc2UnLFxuICAgICAgICAgICAgJ3JlbGVhc2UnXG4gICAgICAgIF0sXG4gICAgICAgIGhlbGRQb2ludGVyOiBudWxsLFxuICAgICAgICBob2xkSm9iOiBudWxsLFxuICAgICAgICBwdWxzZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaG9sZCA9IERhdGUubm93KCkgLSB0aGlzLmhlbGRQb2ludGVyLnRpbWVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IHRoaXMuaGVsZFBvaW50ZXIucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgcG9pbnRlcklkOiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCxcbiAgICAgICAgICAgICAgICB4OiB0aGlzLmhlbGRQb2ludGVyLmNsaWVudFgsXG4gICAgICAgICAgICAgICAgeTogdGhpcy5oZWxkUG9pbnRlci5jbGllbnRZLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICdob2xkJ1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICAgICAgcC5ob2xkVGltZSA9IGluSG9sZFRpbWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KGluVHlwZSwgcCk7XG4gICAgICAgICAgICB0aGlzLnRhcmdldC5kaXNwYXRjaEV2ZW50KGUpO1xuICAgICAgICB9XG4gICAgfTtcbiAgICBkaXNwYXRjaGVyLnJlZ2lzdGVyR2VzdHVyZSgnaG9sZCcsIGhvbGQpO1xufSkoZXhwb3J0cyk7XG5cbi8qKlxuICogVGhpcyBldmVudCBpcyBmaXJlZCB3aGVuIGEgcG9pbnRlciBxdWlja2x5IGdvZXMgZG93biBhbmQgdXAsIGFuZCBpcyB1c2VkIHRvXG4gKiBkZW5vdGUgYWN0aXZhdGlvbi5cbiAqXG4gKiBBbnkgZ2VzdHVyZSBldmVudCBjYW4gcHJldmVudCB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ChpbkV2ZW50LmlzUHJpbWFyeSAmJiAhaW5FdmVudC50YXBQcmV2ZW50ZWQpIHtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLnNldChpbkV2ZW50LnBvaW50ZXJJZCwge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGluRXZlbnQudGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICBidXR0b25zOiBpbkV2ZW50LmJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZXk6IGluRXZlbnQuY3RybEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFLZXk6IGluRXZlbnQubWV0YUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoaWZ0S2V5OiBpbkV2ZW50LnNoaWZ0S2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgX3NvdXJjZTogJ3RhcCdcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2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AgICAgICAgICdwaW5jaCcsXG4gICAgICAgICAgICAncGluY2hlbmQnLFxuICAgICAgICAgICAgJ3JvdGF0ZSdcbiAgICAgICAgXSxcbiAgICAgICAgZGVmYXVsdEFjdGlvbnM6IHtcbiAgICAgICAgICAgICdwaW5jaCc6ICdub25lJyxcbiAgICAgICAgICAgICdyb3RhdGUnOiAnbm9uZSdcbiAgICAgICAgfSxcbiAgICAgICAgcmVmZXJlbmNlOiB7fSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHBvaW50ZXJtYXAucG9pbnRlcnMoKSA9PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG9pbnRzLmEuY2xpZW50WCArIHBvaW50cy5iLmNsaWVudFgpIC8gMjtcbiAgICAgICAgICAgIHkgPSBNYXRoLmFicyhwb2ludHMuYS5jbGllbnRZICsgcG9pbnRzLmIuY2xpZW50WSkgLyAyO1xuICAgICAgICAgICAgcG9pbnRzLmNlbnRlciA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwb2ludHMuZGlhbWV0ZXIgPSBkaXN0O1xuICAgICAgICAgICAgcmV0dXJuIHBvaW50cztcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY0FuZ2xlOiBmdW5jdGl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dHlwZSB7bnVtYmVyW119XG4gICAgICAgICAqIEBkZWZhdWx0IFsnJ11cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaW5kZXggPSBbXTsgLy8gVE9ETzogZm9ybWVybHkgcm93SW5kZXhcblxuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFOb2RlQmFzZS5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhhc0NoaWxkcmVuID0gZmFsc2U7IC8vIFRPRE86IFdoZXJlL2hvdyBpcyB0aGlzIHVzZWQ/XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgICAqIEBkZWZhdWx0IDBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGVwdGggPSAwO1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyfVxuICAgICAgICAgKiBAZGVmYXVsdCAxXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhlaWdodCA9IDE7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAgICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leHBhbmRlZCA9IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVMZWFmLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0VmFsdWU6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVt4XTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlTGVhZi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGVwdGhcbiAgICAgKi9cbiAgICB0b0FycmF5OiBmdW5jdGlvbihkZXB0aCkge1xuICAgICAgICB0aGlzLmRlcHRoID0gZGVwdGg7XG4gICAgICAgIHRoaXMuZGF0YVswXSA9IHRoaXMuY29tcHV0ZURlcHRoU3RyaW5nKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBjb21wdXRlRGVwdGhTdHJpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gQXJyYXkodGhpcy5kZXB0aCArIDEpLmpvaW4odGhpcy5JTkRFTlQpICsgJyAgJyArIHRoaXMubGFiZWw7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBjb21wdXRlSGVpZ2h0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIDE7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge0FycmF5fVxuICAgICAqL1xuICAgIGdldEluZGV4OiBmdW5jdGlvbigpIHsgLy8gVE9ETzogZm9ybWVybHkgZ2V0QWxsUm93SW5kZXhlc1xuICAgICAgICByZXR1cm4gdGhpcy5pbmRleDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1l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YXRhWzBdKTtcblxuICAgIC8qKlxuICAgICAqIEB0eXBlIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICB0aGlzLmRhdGEgPSBkYXRhO1xufVxuXG5EYXRhU291cmNlLnByb3RvdHlwZSA9IHtcbiAgICBjb25zdHJ1Y3RvcjogRGF0YVNvdXJjZS5wcm90b3R5cGUuY29uc3RydWN0b3IsIC8vIHByZXNlcnZlIGNvbnN0cnVjdG9yXG5cbiAgICBpc051bGxPYmplY3Q6IGZhbHNlLFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0Um93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFbeV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRWYWx1ZTogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgcm93ID0gdGhpcy5nZXRSb3coeSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzL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YXRhU291cmNlU29ydGVyKHNvdXJjZSk7XG4gICAgICAgICAgICAgICAgc291cmNlLnNvcnRPbihncm91cEJ5KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCByb3dDb3VudDsgcisrKSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHRyZWU7XG5cbiAgICAgICAgICAgIGdyb3VwQnlzLmZvckVhY2goZnVuY3Rpb24oZywgYykgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWxvb3AtZnVuY1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBzb3VyY2UuZ2V0VmFsdWUoZywgciksXG4gICAgICAgICAgICAgICAgICAgIGZhY3RvcnlEYXRhTm9kZSA9IChjID09PSBsZWFmRGVwdGgpID8gZmFjdG9yeURhdGFOb2RlTGVhZiA6IGZhY3RvcnlEYXRhTm9kZUdyb3VwO1xuICAgICAgICAgICAgICAgIHBhdGggPSBwYXRoLmNoaWxkcmVuLmdldElmVW5kZWZpbmVkKGtleSwgZmFjdG9yeURhdGFOb2RlKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBwYXRoLmluZGV4LnB1c2gocik7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNvcnRlckluc3RhbmNlID0gbmV3IERhdGFTb3VyY2VTb3J0ZXIoc291cmNlKTtcbiAgICAgICAgdHJlZS50b0FycmF5KCk7XG4gICAgICAgIHRyZWUuY29tcHV0ZUFnZ3JlZ2F0ZXModGhpcyk7XG4gICAgICAgIHRoaXMuYnVpbGRWaWV3KCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGF0YU5vZGVcbiAgICAgKi9cbiAgICBhZGRWaWV3OiBmdW5jdGlvbihkYXRhTm9kZSkge1xuICAgICAgICB0aGlz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xuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0geFxuICAgICAqIEBwYXJhbSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIGlmICghdGhpcy52aWV3TWFrZXNTZW5zZSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldFZhbHVlKHgsIHksIHZhbHVlKTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUFnZ3JlZ2F0b3IucHJvdG90eXBlXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0Q29sdW1uQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICBpZiAoIXRoaXMudmlld01ha2VzU2Vuc2UoKSkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRDb2x1bW5Db3VudCgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLmdldEhlYWRlcnMoKS5sZW5ndGg7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIGlmICghdGhpcy52aWV3TWFrZXNTZW5zZSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldFJvd0NvdW50KCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMudmlldy5sZW5ndGg7IC8vaGVhZGVyIGNvbHVt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1xuICAgIGdldEZpZWxkczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICBnZXRHcmFuZFRvdGFsczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciB2aWV3ID0gdGhpcy50cmVlO1xuICAgICAgICByZXR1cm4gW3ZpZXcuZGF0YV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0geVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFJvdzogZnVuY3Rpb24oeSkge1xuICAgICAgICBpZiAoIXRoaXMudmlld01ha2VzU2Vuc2UoKSkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRSb3coeSk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcm9sbHVwcyA9IHRoaXMudmlld1t5XTtcblxuICAgICAgICByZXR1cm4gcm9sbHVwcyA/IHJvbGx1cHMgOiB0aGlzLnRyZWU7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRh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gICBkZWxldGUgdGhpcy5kYXRhW2hhc2hDb2RlXTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgTWFwcHkucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtmdW5jdGlvbn0gaXRlcmF0ZWVcbiAgICAgKi9cbiAgICBmb3JFYWNoOiBmdW5jdGlvbihpdGVyYXRlZSkge1xuICAgICAgICBpZiAodHlwZW9mIGl0ZXJhdGVlID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICB2YXIga2V5cyA9IHRoaXMua2V5cyxcbiAgICAgICAgICAgICAgICBzZWxmID0gdGhpcztcbiAgICAgICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgICAgIGl0ZXJhdGVlKHZhbHVlLCBrZXksIHNlbGYpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7ZnVuY3Rpb259IGl0ZXJhdGVlXG4gICAgICogQHJldHVybnMge01hcHB5fVxuICAgICAqL1xuICAgIG1hcDogZnVuY3Rpb24oaXRlcmF0ZWUpIHtcbiAgICAgICAgdmFyIGtleXMgPSB0aGlzLmtleXMsXG4gICAgICAgICAgICBuZXdNYXAgPSBuZXcgTWFwcHkoKSxcbiAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuXG4gICAgICAgIGlmICghKHR5cGVvZiBpdGVyYXRlZSA9PT0gJ2Z1bmN0aW9uJykpIHtcbiAgICAgICAgICAgIGl0ZXJhdGVlID0gcmVmbGVjdGlvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgIHZhciB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V2ZW50TGlzdGVuZXIoJ21vdXNlZG93bicsIGl0ZW0uaGFuZGxlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICAvLyB3aGVlbCBldmVudHMgb24gdGhlIGxpc3QgZWxlbWVudHNcbiAgICAgICAgdGhpcy5tb2RlbExpc3RzLmZvckVhY2goZnVuY3Rpb24gKG1vZGVsTGlzdCkge1xuICAgICAgICAgICAgbW9kZWxMaXN0LmVsZW1lbnQucmVtb3ZlRXZlbnRMaXN0ZW5lcignd2hlZWwnLCBjYXB0dXJlRXZlbnQpO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcG9pbnRJbkxpc3RSZWN0czogZnVuY3Rpb24gKHBvaW50KSB7XG4gICAgICAgIHJldHVybiB0aGlzLm1vZGVsTGlzdHMuZmluZChmdW5jdGlvbiAobW9kZWxMaXN0KSB7XG4gICAgICAgICAgICB2YXIgcmVjdCA9IG1vZGVsTGlzdC5lbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpO1xuXG4gICAgICAgICAgICByZWN0ID0ge1xuICAgICAgICAgICAgICAgIGxlZnQ6ICAgd2luZG93LnNjcm9sbFggKyByZWN0LmxlZnQsXG4gICAgICAgICAgICAgICAgdG9wOiAgICB3aW5kb3cuc2Nyb2xsWSArIHJlY3QudG9wLFxuICAgICAgICAgICAgICAgIHJpZ2h0OiAgd2luZG93LnNjcm9sbFggKyByZWN0LnJpZ2h0LFxuICAgICAgICAgICAgICAgIGJvdHRvbTogd2luZG93LnNjcm9sbFkgKyByZWN0LmJvdHRvbSxcbiAgICAgICAgICAgICAgICB3aWR0aDogIHJlY3Qud2lkdGgsXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiByZWN0LmhlaWdodFxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgbW9kZWxMaXN0LnJlY3QgPSByZWN0O1xuXG4gICAgICAgICAgICBpZiAocG9pbnRJblJlY3QocG9pbnQsIHJlY3QpKSB7XG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RWxlbWVudCxcbiAgICAgICAgICAgICAgICBsaXN0ID0gbW9kZWxMaXN0cy5maW5kKGZ1bmN0aW9uIChsaXN0KSB7IHJldHVybiBsaXN0LmVsZW1lbnQgPT09IGxpc3RFbGVtZW50OyB9KTtcblxuICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgIC8vIG9taXR0ZWQ6IGRlZmF1bHQgdG8gdHJ1ZVxuICAgICAgICAgICAgICAgIGxpc3QuaXNEcm9wVGFyZ2V0ID09PSB1bmRlZmluZWQgfHxcblxuICAgICAgICAgICAgICAgIC8vIGZ1bmN0aW9uOiB1c2UgcmV0dXJuIHZhbHVlXG4gICAgICAgICAgICAgICAgdHlwZW9mIGxpc3QuaXNEcm9wVGFyZ2V0ID09PSAnZnVuY3Rpb24nICYmIGxpc3QuaXNEcm9wVGFyZ2V0KCkgfHxcblxuICAgICAgICAgICAgICAgIC8vIG90aGVyd2lzZTogdXNlIHRydXRoaW5lc3Mgb2YgZ2l2ZW4gdmFsdWVcbiAgICAgICAgICAgICAgICBsaXN0LmlzRHJvcFRhcmdldFxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgdmFyIHJlY3QgPSBpdGVtRWxlbWVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKSxcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gcmVjdC5ib3R0b207XG5cbiAgICAgICAgICAgICAgICBpZiAoaXRlbUVsZW1lbnQgPT09IGxpc3RFbGVtZW50Lmxhc3RFbGVtZW50Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gbGlzdEVsZW1lbnQuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkuYm90dG9tO1xuICAgICAgICAgICAgICAgICAgICBpZiAoYm90dG9tIDwgcmVjdC50b3ApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IHJlY3QudG9wICsgKGhlaWdodCB8fCA1MCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBoZWlnaHQgPSByZWN0LmhlaWdodDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZWN0ID0ge1xuICAgICAgICAgICAgICAgICAgICBsZWZ0OiAgIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5sZWZ0LFxuICAgICAgICAgICAgICAgICAgICByaWdodDogIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5yaWdodCxcbiAgICAgICAgICAgICAgICAgICAgdG9wOiAgICB3aW5kb3cuc2Nyb2xsWSArIHJlY3QudG9wICAgICsgbGlzdEVsZW1lbnQuc2Nyb2xsVG9wLFxuICAgICAgICAgICAgICAgICAgICBib3R0b206IHdpbmRvdy5zY3JvbGxZICsgYm90dG9tICsgbGlzdEVsZW1lbnQuc2Nyb2xsVG9wXG4gICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgIGl0ZW0ucmVjdCA9IHJlY3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICByZWluc2VydDogZnVuY3Rpb24gKHRhcmdldCkge1xuICAgICAgICB2YXIgc3R5bGUgPSB0YXJnZXQuc3R5bGU7XG4gICAgICAgIHN0eWxlLndpZHRoID0gc3R5bGVbdHJhbnNmb3JtXSA9IHN0eWxlLnRyYW5zaXRpb24gPSBSRVZFUlRfVE9fU1RZTEVTSEVFVF9WQUxVRTtcblxuICAgICAgICB0YXJnZXQuY2xhc3NMaXN0LnJlbW92ZSgnZHJhZ29uLXBvcCcpO1xuXG4gICAgICAgIHRoaXMuZHJvcC5zdHlsZS50cmFuc2l0aW9uRHVyYXRpb24gPSAnMHMnO1xuICAgICAgICB0aGlzLmRyb3Auc3R5bGUuYm9yZGVyVG9wV2lkdGggPSBSRVZFUlRfVE9fU1RZTEVTSEVFVF9WQUxVRTtcbiAgICAgICAgdGhpcy5kcm9wLnBhcmVud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RHVyYXRpb24gPSAnMHMnO1xuICAgICAgICBkcmFnb24uZHJvcC5zdHlsZS5ib3JkZXJUb3BXaWR0aCA9IHJlY3QuaGVpZ2h0ICsgJ3B4JztcblxuICAgICAgICB0aGlzLnN0eWxlLndpZHRoID0gcmVjdC53aWR0aCArICdweCc7XG4gICAgICAgIHRoaXMuc3R5bGUudHJhbnNpdGlvbkR1cmF0aW9uID0gJzBzJztcbiAgICAgICAgdGhpcy5zdHlsZVt0cmFuc2Zvcm1dID0gdHJhbnNsYXRlKFxuICAgICAgICAgICAgcmVjdC5sZWZ0IC0gd2luZG93LnNjcm9sbFgsXG4gICAgICAgICAgICByZWN0LnRvcCAgLSB3aW5kb3cuc2Nyb2xsWVxuICAgICAgICApO1xuICAgICAgICB0aGlzLmNsYXNzTGlzdC5hZGQoJ2RyYWdvbi1wb3AnKTtcbiAgICAgICAgdGhpcy5zdHlsZS56SW5kZXggPSB3aW5kb3cuZ2V0Q29tcHV0ZWRTdHlsZShkcmFnb24ubW9kZWxMaXN0c1swXS5jb250YWluZXIucGFyZW50RWxlbWVudCkuekluZGV4O1xuXG4gICAgICAgIGlmICghZHJhZ29uLmNvbnRhaW5lcikge1xuICAgICAgICAgICAgLy8gd2FsayBiYWNrIHRvIGNsb3Nlc3Qgc2hhZG93IHJvb3QgT1IgYm9keSB0YWcgT1Igcm9vdCB0YWdcbiAgICAgICAgICAgIHZhciBjb250YWluZXIgPSB0aGlzO1xuICAgICAgICAgICAgd2hpbGUgKGNvbnRhaW5lci5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgY29udGFpbmVyID0gY29udGFpbmVyLnBhcmVudE5vZGU7XG4gICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5lciBpbnN0YW5jZW9mIFNoYWRvd1Jvb3QgfHwgY29udGFpbmVyLnRhZ05hbWUgPT09ICdCT0RZJyl7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgIC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gICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIG90aGVyID0gZHJhZ29uLnBvaW50SW5JdGVtUmVjdHMoe1xuICAgICAgICAgICAgICAgIHg6IGV2dC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHk6IGRyYWdvbi5yZWN0LmJvdHRvbSArIHdpbmRvdy5zY3JvbGxZICsgZHkgKyBob3Zlckxpc3QuZWxlbWVudC5zY3JvbGxUb3BcbiAgICAgICAgICAgIH0sIHRoaXMsIGRyYWdvbi5kcm9wKTtcblxuICAgICAgICAgICAgdGhpcy5zdHlsZVt0cmFuc2Zvcm1dID0gdHJhbnNsYXRlKFxuICAgICAgICAgICAgICAgIGRyYWdvbi5yZWN0LmxlZnQgLSB3aW5kb3cuc2Nyb2xsWCArIGR4LFxuICAgICAgICAgICAgICAgIGRyYWdvbi5yZWN0LnRvcCAtIHdpbmRvdy5zY3JvbGxZICsgZHlcbiAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgIGlmIChvdGhlcikge1xuICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gb3RoZXIuZWxlbWVudDtcbiAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlLnRyYW5zaXRpb24gPSBSRVZFUlRfVE9fU1RZTEVTSEVFVF9WQUxVRTtcbiAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlLmJvcmRlclRvcFdpZHRoID0gZHJhZ29uLmRyb3Auc3R5bGUuYm9yZGVyVG9wV2lkdGg7XG4gICAgICAgICAgICAgICAgZHJhZ29uLmRyb3Auc3R5bGUuYm9yZGVyVG9wV2lkdGggPSBudWxsO1xuICAgICAgICAgICAgICAgIGRyYWdvbi5kcm9wID0gZWxlbWVudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICBtb3VzZXVwOiBmdW5jdGlvbiAo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HJldHVybiBtb2RlbExpc3RzO1xufVxuXG4vKipcbiAqIENyZWF0ZSBhIGAubW9kZWxMaXN0c2AgYXJyYXkgd2l0aCB0aGVzZSA8bGk+IGVsZW1lbnRzJyBwYXJlbnQgPHVsPiBlbGVtZW50c1xuICogQHBhcmFtIHtFbGVtZW50W119IGxpc3RJdGVtRWxlbWVudHNcbiAqIEByZXR1cm5zIHtBcnJheX1cbiAqL1xuZnVuY3Rpb24gY3JlYXRlTW9kZWxMaXN0c0Zyb21MaXN0RWxlbWVudHMobGlzdEl0ZW1FbGVtZW50cykge1xuICAgIHZhciBtb2RlbExpc3RzID0gW107XG5cbiAgICBsaXN0SXRlbUVsZW1lbnRzLmZvckVhY2goZnVuY3Rpb24gKGl0ZW1FbGVtZW50KSB7XG4gICAgICAgIHZhciBsaXN0RWxlbWVudCA9IGl0ZW1FbGVtZW50LnBhcmVudEVsZW1lbnQsXG4gICAgICAgICAgICBjb250YWluZXIgPSBsaXN0RWxlbWVudC5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgbW9kZWxzID0gW107XG4gICAgICAgIGlmICghbW9kZWxMaXN0cy5maW5kKGZ1bmN0aW9uIChsaXN0KSB7IHJldHVybiBsaXN0LmVsZW1lbnQgPT09IGxpc3RFbGVtZW50OyB9KSkge1xuICAgICAgICAgICAgdG9BcnJheShsaXN0RWxlbWVudC5xdWVyeVNlbGVjdG9yQWxsKCdsaScpKS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtRWxlbWVudCkge1xuICAgICAgICAgICAgICAgIGlmIChpdGVtRWxlbWVudCAhPT0gbGlzdEVsZW1lbnQubGFzdEVsZW1lbnRDaGlsZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbHMucHVzaChpdGVtRWxlbWVudC5pbm5lckhUTUwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgbW9kZWxzLmVsZW1lbnQgPSBsaXN0RWxlbWVudDtcbiAgICAg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ZW1iZXJPZiBQb2ludC5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBtaW51czogZnVuY3Rpb24ob2Zmc2V0KSB7XG4gICAgICAgIHJldHVybiBuZXcgUG9pbnQoXG4gICAgICAgICAgICB0aGlzLnggLSBvZmZzZXQueCxcbiAgICAgICAgICAgIHRoaXMueSAtIG9mZnNldC55XG4gICAgICAgICk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEByZXR1cm5zIHtQb2ludH0gQSBuZXcgYFBvaW50YCBwb3NpdGlvbmVkIHRvIGxlYXN0IHggYW5kIGxlYXN0IHkgb2YgdGhpcyBwb2ludCBhbmQgZ2l2ZW4gYG9mZnNldGAuXG4gICAgICogQHBhcmFtIHtQb2ludH0gcG9pbnQgLSBBIHBvaW50IHRvIGNvbXBhcmUgdG8gdGhpcyBwb2ludC5cbiAgICAgKiBAbWVtYmVyT2YgUG9pbnQucHJvdG90eXBlXG4gICAgICovXG4gICAgbWluOiBmdW5jdGlvbihwb2ludCkge1xuICAgICAgICByZXR1cm4gbmV3IFBvaW50KFxuICAgICAgICAgICAgTWF0aC5taW4odGhpcy54LCBwb2ludC54KSxcbiAgICAgICAgICAgIE1hdGgubWluKHRoaXMueSwgcG9pbnQueSlcbiAgICAgICAgKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQHJldHVybnMge1BvaW50fSBBIG5ldyBgUG9pbnRgIHBvc2l0aW9uZWQgdG8gZ3JlYXRlc3QgeCBhbmQgZ3JlYXRlc3QgeSBvZiB0aGlzIHBvaW50IGFuZCBnaXZlbiBgcG9pbnRgLlxuICAgICAqIEBwYXJhbSB7UG9pbnR9IHBvaW50IC0gQSBwb2ludCB0byBjb21wYXJlIHRvIHRoaXMgcG9pbnQuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIG1heDogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBQb2ludChcbiAgICAg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WxUbzogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIHRoaXMueCA8PSBwb2ludC54ICYmXG4gICAgICAgICAgICB0aGlzLnkgPD0gcG9pbnQueVxuICAgICAgICApO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBfKEZvcm1lcmx5IGBpc0NvbnRhaW5lZFdpdGhpblJlY3RhbmdsZWAuKV9cbiAgICAgKiBAcGFyYW0gcmVjdCB7UmVjdGFuZ2xlfSAtIFJlY3RhbmdsZSB0byB0ZXN0IHRoaXMgcG9pbnQgYWdhaW5zdC5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmZiB0aGlzIHBvaW50IGlzIHdpdGhpbiBnaXZlbiBgcmVjdGAuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIHdpdGhpbjogZnVuY3Rpb24ocmVjdCkge1xuICAgICAgICB2YXIgbWluWCA9IHJlY3Qub3JpZ2luLngsXG4gICAgICAgICAgICBtYXhYID0gbWluWCArIHJlY3QuZXh0ZW50Lng7XG4gICAgICAgIHZhciBtaW5ZID0gcmVjdC5vcmlnaW4ueSxcbiAgICAgICAgICAgIG1heFkgPSBtaW5ZICsgcmVjdC5leHRlbnQueTtcblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueCA8IDApIHtcbiAgICAgICAgICAgIG1pblggPSBtYXhYO1xuICAgICAgICAgICAgbWF4WCA9IHJlY3Qub3JpZ2luLng7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueSA8IDApIHtcbiAgICAgICAgICAgIG1pblkgPSBtYXhZO1xuICAgICAgICAgICAgbWF4WSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgbWluWCA8PSB0aGlzLnggJiYgdGhpcy54IDwgbWF4WCAmJlxuICAgICAg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R5cGVcbiAgICAgICAgICovXG4gICAgICAgIGlzU2VsZWN0ZWQ6IGZ1bmN0aW9uIChjZWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZWxlY3Rpb24uc29tZShmdW5jdGlvbiAoZWFjaCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBlYWNoWzBdIDw9IGNlbGwgJiYgY2VsbCA8PSBlYWNoWzFdO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0sXG5cbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKCl7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZWxlY3Rpb24ubGVuZ3RoID09PSAwO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAc3VtbWFyeSBSZXR1cm4gdGhlIGluZGV4ZXMgdGhhdCBhcmUgc2VsZWN0ZWQuXG4gICAgICAgICAqIEBkZXNjIFJldHVybiB0aGUgaW5kZXhlcyB0aGF0IGFyZSBzZWxlY3RlZC5cbiAgICAgICAgICogQHJldHVybnMge0FycmF5LkFycmF5Lm51bWJlcn1cbiAgICAgICAgICogQG1lbWJlck9mIFJhbmdlU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICAgICAqL1xuICAgICAgICBnZXRTZWxlY3Rpb25zOiBmdW5jdGlvbiAoKXtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLmZvckVhY2goZnVuY3Rpb24gKGVhY2gpIHtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gZWFjaFswXTsgaSA8PSBlYWNoWzFdOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goaSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICByZXN1bHQuc29ydChmdW5jdGlvbiAoYSwgYil7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG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4cGVuc2l2ZSwgbGV0cyBub3QgZG8gaXQgdW5uZWNlc3NhcmlseVxuXG4gICAgICAgIGlmICh2YWwgJiYgdmFsLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgbGVmdEljb24gPSB2YWxbMF07XG4gICAgICAgICAgICByaWdodEljb24gPSB2YWxbMl07XG4gICAgICAgICAgICB2YWwgPSB2YWxbMV07XG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gJ29iamVjdCcpIHsgLy8gbXVzdCBiZSBhbiBpbWFnZVxuICAgICAgICAgICAgICAgIGNlbnRlckljb24gPSB2YWw7XG4gICAgICAgICAgICAgICAgdmFsID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChsZWZ0SWNvbiAmJiBsZWZ0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICBsZWZ0SWNvbiA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocmlnaHRJY29uICYmIHJpZ2h0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICByaWdodEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNlbnRlckljb24gJiYgY2VudGVySWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICBjZW50ZXJJY29uID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUoY29uZmlnLCB2YWwpO1xuXG4gICAgICAgIGlmIChnYy5mb250ICE9PSBjb25maWcuZm9udCkge1xuICAgICAgICAgICAgZ2MuZm9udCA9IGNvbmZpZy5mb250O1xuICAgICAgICB9XG4gICAgICAgIGlmIChnYy50ZXh0QWxpZ24gIT09ICdsZWZ0Jykge1xuICAgICAgICAgICA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mZnNldCk7XG4gICAgICAgICAgICBpY29uV2lkdGggPSBNYXRoLm1heChyaWdodEljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY2VudGVySWNvbikge1xuICAgICAgICAgICAgaXlvZmZzZXQgPSBNYXRoLnJvdW5kKChoZWlnaHQgLSBjZW50ZXJJY29uLmhlaWdodCkgLyAyKTtcbiAgICAgICAgICAgIGl4b2Zmc2V0ID0gTWF0aC5yb3VuZCgod2lkdGggLSBjZW50ZXJJY29uLndpZHRoKSAvIDIpO1xuICAgICAgICAgICAgZ2MuZHJhd0ltYWdlKGNlbnRlckljb24sIHggKyB3aWR0aCAtIGl4b2Zmc2V0IC0gY2VudGVySWNvbi53aWR0aCwgeSArIGl5b2Zmc2V0KTtcbiAgICAgICAgICAgIGljb25XaWR0aCA9IE1hdGgubWF4KGNlbnRlckljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29uZmlnLmNlbGxCb3JkZXJUaGlja25lc3MpIHtcbiAgICAgICAgICAgIGdjLmJlZ2luUGF0aCgpO1xuICAgICAgICAgICAgZ2MucmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcbiAgICAgICAgICAgIGdjLmxpbmVXaWR0aCA9IGNvbmZpZy5jZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgZ2Muc3Ryb2tlU3R5bGUgPSBjb25maWcuY2VsbEJvcmRlclN0eWxlO1xuXG4gICAgICAgICAgICAvLyBhbmltYXRlIHRoZSBkYXNoZWQgbGluZSBhIGJpdCBoZXJlIGZvciBmdW5cblxuICAgICAgICAgICAgZ2Muc3Ryb2tlKCk7XG4gICAgICAgICAgICBnYy5jbG9zZVBhdGgoKTtcbiAgICAgICAgfVxuICAgICAgICBjb25maWcubWluV2lkdGggPSBjb25maWcubWluV2lkdGggKyAyICogKGljb25XaWR0aCk7XG4gICAgfSxcblxuICAgIHJlbmRlck11bHRpTGluZVRleHQ6IGZ1bmN0aW9uKHgsIHksIGhlaWdodCwgd2lkdGgsIGdjLCBjb25maWcsIHZhbCkge1xuICAgICAgICB2YXIgbGluZXMgPSBmaXRUZXh0KGdjLCBjb25maWcsIHZhbCwgd2lkdGgpO1xuICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5yZW5kZXJTaW5nbGVMaW5lVGV4dCh4LCB5LCBoZWlnaHQsIHdpZHRoLCBnYywgY29uZmlnLCBzcXVlZXplKHZhbCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGNvbEhFZGdlT2Zmc2V0ID0gY29uZmlnLmNlbGxQYWRkaW5nLFxuICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gMCxcbiAgICAgICAgICAgIHZhbGlnbk9mZnNldCA9IGNvbmZpZy52b2Zmc2V0LFxuICAgICAgICAgICAgaGFsaWduID0gY29uZmlnLmhhbGlnbixcbiAgICAgICAgICAgIHRleHRIZWlnaHQgPSBjb25maWcuZ2V0VGV4dEhlaWdodChjb25maWcuZm9udCkuaGVpZ2h0O1xuXG4gICAgICAgIHN3aXRjaCAoaGFsaWduKSB7XG4gICAgICAgICAgICBjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gd2lkdGggLSBjb2xIRWRnZU9mZnNldDtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgJ2NlbnRlcic6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gd2lkdGggLyAyO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAnbGVmdCc6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gY29sSEVkZ2VPZmZzZXQ7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgaE1pbiA9IDAsIHZNaW4gPSBNYXRoL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xlY3Rpb24gc2l6ZSBpcyB0b28gYmlnIHRvIGNvcHkgdG8gdGhlIHBhc3RlIGJ1ZmZlcicpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWFsZXJ0XG4gICAgICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGhlaWdodDsgaCsrKSB7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgdyA9IDA7IHcgPCB3aWR0aDsgdysrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5wdXNoKHNlbGVjdGlvbnNbd11baF0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAodyA8IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaCgnXFx0Jyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGggPCBoZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goJ1xcbicpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IGNvbGxlY3Rvci5qb2luKCcnKTtcblxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFdlIGhhdmUgZm9jdXMuXG4gICAgICovXG4gICAgaGFzRm9jdXM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRDYW52YXMoKS5oYXNGb2N1cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncml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5jb21wdXRlQ2VsbHNCb3VuZHMoKTtcbiAgICAgICAgdGhpcy5yZXBhaW50KCk7XG4gICAgfSxcblxuICAgIHJlcGFpbnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgbm93ID0gdGhpcy5yZXNvbHZlUHJvcGVydHkoJ3JlcGFpbnRJbW1lZGlhdGVseScpO1xuICAgICAgICB2YXIgY2FudmFzID0gdGhpcy5nZXRDYW52YXMoKTtcbiAgICAgICAgaWYgKGNhbnZhcykge1xuICAgICAgICAgICAgaWYgKG5vdyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGNhbnZhcy5wYWludE5vdygpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjYW52YXMucmVwYWludCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQGRlc2MgUGFpbnQgaW1tZWRpYXRlbHkgaW4gdGhpcyBtaWNyb3Rhc2suXG4gICAgICovXG4gICAgcGFpbnROb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgY2FudmFzID0gdGhpcy5nZXRDYW52YXMoKTtcbiAgICAgICAgY2FudmFzLnBhaW50Tm93KCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IEluIEhpRFBJIG1vZGUgKGhhcyBhbiBhdHRyaWJ1dGUgYXMgc3VjaCkuXG4gICAgICovXG4gICAgdXNlSGlEUEk6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlUHJvcGVydHkoJ3VzZUhpRFBJJykgIT09IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnBy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mUnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlTW92ZShtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLW1vdXNlZG93bicsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LmtleXMgPSBlLmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbW91c2VFdmVudDtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURvd24obW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYucmVwYWludCgpO1xuICAgICAgICB9KTtcblxuXG4gICAgICAgIC8vIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1jbGljaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgLy8gICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gICAgIH1cbiAgICAgICAgLy8gICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgIC8vICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgLy8gICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgIC8vIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgaWYgKHNlbGYuaXNTY3JvbGxpbmdOb3coKSkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0U2Nyb2xsaW5nTm93KGZhbHNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmNvbHVtbkRyYWdBdXRvU2Nyb2xsaW5nKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlVXAobW91c2VFdmVudCk7XG4gICAgICAgICAgICBpZiAoc2VsZi5tb3VzZURvd25TdGF0ZSkge1xuICAgICAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0J1dHRvblByZXNzZWRFdmVudChzZWxmLm1vdXNlRG93blN0YXRlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYubW91c2VEb3duU3RhdGUgPSBudWxsO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VVcEV2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtdGFwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciB0YXBFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICB0YXBFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICB0YXBFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQodGFwRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZVRhcCh0YXBFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1kcmFnJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlRHJhZyhtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNLZXlkb3duRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5RG93bihlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5dXBFdmVudChlKTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVLZXlVcChlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRyYWNrJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNlbGYuZHJhZ2dpbmcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcHJpbUV2ZW50ID0gZS5kZXRhaWwucHJpbWl0aXZlRXZlbnQ7XG4gICAgICAgICAgICBpZiAoTWF0aC5hYnMocHJpbUV2ZW50LmR5KSA+IE1hdGguYWJzKHByaW1FdmVudC5keCkpIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnlEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KC0yKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxWQnkoMik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnhEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsSEJ5KC0xKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxIQnkoMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtaG9sZHB1bHNlJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAvLyAgICAgY29uc29sZS5sb2coJ2hvbGRwdWxzZScpO1xuICAgICAgICAvLyAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgIC8vICAgICAgICAgcmV0dXJuO1xuICAgICAgICAvLyAgICAgfVxuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgIC8vICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgLy8gICAgIHNlbGYuZGVsZWdhdGVIb2xkUHVsc2UobW91c2VFdmVudCk7XG4gICAgICAgIC8vIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1kYmxjbGljaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAg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IGRldGFpbDoge1xuICAgICAgICAgICAgICAgIHg6IHgsXG4gICAgICAgICAgICAgICAgeTogeSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogdmFsdWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoY2xpY2tFdmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNFZGl0b3JLZXlVcEV2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS11cCcsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5RG93bkV2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS1kb3duJywge1xuICAgICAgICAgICAgZGV0YWlsOiB7XG4gICAgICAgICAgICAgICAgaW5wdXQ6IGlucHV0Q29udHJvbCxcbiAgICAgICAgICAgICAgICBrZXlFdmVudDoga2V5RXZlbnRcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoY2xpY2tFdmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNFZGl0b3JLZXlQcmVzc0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AgdmFyIGNvbENvdW50ID0gcmVjdC5leHRlbnQueCArIDE7XG4gICAgICAgIHZhciByb3dDb3VudCA9IHJlY3QuZXh0ZW50LnkgKyAxO1xuICAgICAgICB2YXIgb3ggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB2YXIgb3kgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIHZhciByO1xuICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgIHZhciBjb2x1bW4gPSBuZXcgQXJyYXkocm93Q291bnQpO1xuICAgICAgICAgICAgcmVzdWx0W3RoaXMuZ2V0RmllbGQoYyArIG94KV0gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgcm93Q291bnQ7IHIrKykge1xuICAgICAgICAgICAgICAgIGNvbHVtbltyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUodGhpcy5nZXRWYWx1ZShveCArIGMsIG95ICsgcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIGdldFNlbGVjdGlvbk1hdHJpeDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIHNlbGVjdGlvbnMgPSB0aGlzLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBBcnJheShzZWxlY3Rpb25zLmxlbmd0aCk7XG4gICAgICAgIHNlbGVjdGlvbnMuZm9yRWFjaChmdW5jdGlvbihzZWxlY3Rpb25SZWN0LCBpKSB7XG4gICAgICAgICAgICByZXN1bHRbaV0gPSBzZWxmLl9nZXRTZWxlY3Rpb25NYXRyaXgoc2VsZWN0aW9uUmVjdCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICBfZ2V0U2VsZWN0aW9uTWF0cml4OiBmdW5jdGlvbihyZWN0KSB7XG4gICAgICAgIHJlY3QgPSBub3JtYWxpemVSZWN0KHJlY3QpO1xuICAgICAgICB2YXIgY29sQ291bnQgPSByZWN0LmV4dGVudC54ICsgMTtcbiAgICAgICAgdmFyIHJvd0NvdW50ID0gcmVjdC5leHRlbnQueSArIDE7XG4gICAgICAgIHZhciBveCA9IHJlY3Qub3JpZ2luLng7XG4gICAgICAgIHZhciBveSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBjb2xDb3VudDsgYysrKSB7XG4gICAgICAgICAgICB2YXIgY29sdW1uID0gbmV3IEFycmF5KHJvd0NvdW50KTtcbiAgICAgICAgICAgIHJlc3VsdFtjXSA9IGNvbHVtbjtcbiAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgcm93Q291bnQ7IHIrKykge1xuICAgICAgICAgICAgICAgIGNvbHVtbltyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUodGhpcy5nZXRWYWx1ZShveCArIGMsIG95ICsgcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIFN5bnRoZXNpemUgYW5kIGZpcmUgYSBgZmluLWNvbnRleHQtbWVudWAgZXZlbnRcbiAgICAgKiBAcGFyYW0ge2tleUV2ZW50fSBldmVudCAtIFRoZSBjYW52YXMgZXZlbnQuXG4gICAgICovXG4gICAgZmlyZVN5bnRoZXRpY0NvbnRleHRNZW51RXZlbnQ6IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgZS5ncmlkQ2VsbCA9IHRoaXMuY29udmVydFZpZXdQb2ludFRvRGF0YVBvaW50KGUuZ3JpZENlbGwpO1xuICAgICAgICB2YXIgZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ2Zpbi1jb250ZXh0LW1lbnUnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNNb3VzZVVwRXZlbnQ6IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgdmFyIGV2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tbW91c2V1cCcsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGdyaWRDZWxsOiBlLmdyaWRDZWxsLFxuICAgICAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGUubW91c2VQb2ludCxcbiAgICAgICAgICAgICAgICB2aWV3UG9pbnQ6IGUudmlld1BvaW50LFxuICAgICAgICAgICAgICAgIHByaW1pdGl2ZUV2ZW50OiBlLnByaW1pdGl2ZUV2ZW50LFxuICAgICAgICAgICAgICAgIHJvd3M6IHRoaXMuZ2V0U2VsZWN0ZWRSb3dzKCksXG4gICAgICAgICAgICAgICAgY29sdW1uczogdGhpcy5nZXRTZWxlY3RlZENvbHVtbnMoKSxcbiAgICAgICAgICAgICAgICBzZWxlY3Rpb25zOiB0aGlzLmdldFNlbGVjdGlvbk1vZGVsKCkuZ2V0U2VsZWN0aW9ucygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGV2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY01vdXNlRG93bkV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBldmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLW1vdXNlZG93bicsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGdyaWRDZWxsOiBlLmdyaWRDZWxsLFxuICAgICAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGUubW91c2VQb2ludCxcbiAgICAgICAgICAgICAgICB2aWV3UG9pbnQ6IGUudmlld1BvaW50LFxuICAgICAgICAgICAgICAgIHByaW1pdGl2ZUV2ZW50OiBlLnByaW1pdGl2ZUV2ZW50LFxuICAgICAgICAgICAgICAgIHJvd3M6IHRoaXMuZ2V0U2VsZWN0ZWRSb3dzKCksXG4gICAgICAgICAgICAgICAgY29sdW1uczogdGhpcy5nZXRTZWxlY3RlZENvbHVtbnMoKSxcbiAgICAgICAgICAgICAgICBzZWxlY3Rpb25zOiB0aGlzLmdldFNlbGVjdGlvbk1vZGVsKCkuZ2V0U2VsZWN0aW9ucygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGV2ZW50KTtcbiAgICB9LFxuXG4gICAgaXNWaWV3YWJsZUJ1dHRvbjogZnVuY3Rpb24oYywgcikge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRSZ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mVyKCksXG4gICAgICAgICAgICBjb2xDb3VudCA9IHRoaXMuZ2V0Q29sdW1uQ291bnQoKSxcbiAgICAgICAgICAgIHJvd0NvdW50ID0gcmVuZGVyZXIuZ2V0VmlzaWJsZVJvd3MoKSxcbiAgICAgICAgICAgIGhlYWRlcnMgPSBuZXcgQXJyYXkoY29sQ291bnQpLFxuICAgICAgICAgICAgcmVzdWx0cyA9IG5ldyBBcnJheShyb3dDb3VudCksXG4gICAgICAgICAgICByb3c7XG5cbiAgICAgICAgaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKGhlYWRlciwgYykge1xuICAgICAgICAgICAgaGVhZGVyc1tjXSA9IGJlaGF2aW9yLmdldENvbHVtbklkKGMsIDApO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXN1bHRzLmZvckVhY2goZnVuY3Rpb24ocmVzdWx0LCByKSB7XG4gICAgICAgICAgICByb3cgPSByZXN1bHRzW3JdID0ge1xuICAgICAgICAgICAgICAgIGhpZXJhcmNoeTogYmVoYXZpb3IuZ2V0Rml4ZWRDb2x1bW5WYWx1ZSgwLCByKVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGhlYWRlcnMuZm9yRWFjaChmdW5jdGlvbihmaWVsZCwgYykge1xuICAgICAgICAgICAgICAgIHJvd1tmaWVsZF0gPSBiZWhhdmlvci5nZXRWYWx1ZShjLCByKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fSBBbiBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50bHkgc2VsZWN0aW9uIHJvdy5cbiAgICAgKi9cbiAgICBnZXRTZWxlY3RlZFJvdzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxzID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgaWYgKHNlbHMubGVuZ3RoKSB7XG4gICAgICAgICAgICB2YXIgYmVoYXZpb3IgPSB0aGlzLmdldEJlaGF2aW9yKCksXG4gICAgICAgICAgICAgICAgY29sQ291bnQgPSB0aGlzLmdldENvbHVtbkNvdW50KCksXG4gICAgICAgICAgICAgICAgdG9wUm93ID0gc2Vsc1swXS5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICByb3cgPSB7XG4gICAgICAgICAgICAgICAgICAgIC8vaGllcmFyY2h5OiBiZWhhdmlvci5nZXRGaXhlZENvbHVtblZhbHVlKDAsIHRvcFJvdylcbiAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgICAgICByb3dbYmVoYXZpb3IuZ2V0Q29sdW1uSWQoYywgMCldID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgdG9wUm93KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHJvdztcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICBmaXJlUmVxdWVzdENlbGxFZGl0OiBmdW5jdGlvbihjZWxsLCB2YWx1ZSkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLXJlcXVlc3QtY2VsbC1lZGl0Jywge1xuICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogY2VsbCxcbiAgICAgICAgICAgICAgICB0aW1lOiBEYXRlLm5vdygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcy5jYW52YXMuZGlzcGF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YWxyZWFkeVNlbGVjdGVkID0gbW9kZWwuaXNDb2x1bW5TZWxlY3RlZCh4KTtcbiAgICAgICAgdmFyIGhhc0NUUkwgPSBrZXlzLmluZGV4T2YoJ0NUUkwnKSA+IC0xO1xuICAgICAgICB2YXIgaGFzU0hJRlQgPSBrZXlzLmluZGV4T2YoJ1NISUZUJykgPiAtMTtcbiAgICAgICAgaWYgKCFoYXNDVFJMICYmICFoYXNTSElGVCkge1xuICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKGhhc0NUUkwpIHtcbiAgICAgICAgICAgICAgICBpZiAoYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLmRlc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaGFzU0hJRlQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzBdLCB4KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMF0gPSB4O1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucmVwYWludCgpO1xuICAgICAgICB0aGlzLmZpcmVTeW50aGV0aWNDb2x1b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ZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5kZXNlbGVjdFJvdyh5KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNTaW5nbGVSb3dTZWxlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vZGVsLmNsZWFyUm93U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNTSElGVCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMV0sIHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkICYmICFoYXNTSElGVCkge1xuICAgICAgICAgICAgdGhpcy5sYXN0RWRnZVNlbGVjdGlvblsxXSA9IHk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5yZXBhaW50KCk7XG4gICAgfSxcblxuICAgIHNlbGVjdFZpZXdwb3J0Q2VsbDogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSB0aGlzLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIHZhciByZW5kZXJlciA9IHRoaXMuZ2V0UmVuZGVyZXIoKTtcbiAgICAgICAgdmFyIHJlYWxYID0gcmVuZGVyZXIuZ2V0VmlzaWJsZUNvbHVtbnMoKVt4XTtcbiAgICAgICAgdmFyIHJlYWxZID0gcmVuZGVyZXIuZ2V0VmlzaWJsZVJvd3MoKVt5XTtcbiAgICAgICAgdGhpcy5jbGVhclNlbGVjdGlvbnMoKTtcbiAgICA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XhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICB2eCA9IHZ4ICsgc2Nyb2xsTGVmdDtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RWWCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0VlggPSB2eDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGFzdFZYID0gdng7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IHZpZXdXaWR0aCB8fCBudW1Db2x1bW5zIDw9IHZ4KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aWR0aCA9IHRoaXMuZ2V0Q29sdW1uV2lkdGgodngpO1xuICAgICAgICAgICAgeCA9IHggKyB3aWR0aDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNbYyArIDFdID0gTWF0aC5yb3VuZCh4KTtcbiAgICAgICAgICAgIHRoaXMudmlzaWJsZUNvbHVtbnNbY10gPSB2eDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNJbmRleE1hcFt2eF0gPSBjO1xuXG4gICAgICAgICAgICBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgPSBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgKyBNYXRoLnJvdW5kKHdpZHRoIC8gMikgKyBwcmV2aW91c0luc2VydGlvbkJvdW5kc0N1cnNvclZhbHVlO1xuICAgICAgICAgICAgdGhpcy5pbnNlcnRpb25Cb3VuZHMucHVzaChpbnNlcnRpb25Cb3VuZHNDdXJzb3IpO1xuICAgICAgICAgICAgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZSA9IE1hdGgucm91bmQod2lkdGggLyAyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHkgPSAwO1xuICAgICAgICBmb3IgKHIgPSAwOyByIDwgbnVtUm93czsgcisrKSB7XG4gICAgICAgICAgICB2eSA9IHI7XG4gICAgICAgICAgICBpZiAociA+PSBudW1GaXhlZFJvd3MpIHtcbiAgICAgICAgICAgICAgICB2eSA9IHZ5ICsgc2Nyb2xsVG9wO1xuICAgICAgICAgICAgICAgIGlmIChmaXJzdFZZID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RWWSA9IHZ5O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsYXN0VlkgPSB2eTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh5ID4gdmlld0hlaWdodCB8fCBudW1Sb3dzIDw9IHZ5KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoZWlnaHQgPSB0aGlzLmdldFJvd0hlaWdodCh2eSk7XG4gICAgICAgICAgICB5ID0geSArIGhlaWdodDtcbiAgICAgICAgICAgIHRoaXMucm93RWRnZXNbciArIDFdID0gTWF0aC5yb3VuZCh5KTtcbiAgICAgICAgICAgIHRoaXMudmlzaWJsZVJvd3Nbcl0gPSB2eTtcbiAgICAgICAgICAgIHRoaXMucm93RWRnZXNJbmRleE1hcFt2eV0gPSByO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMudmlld0hlaWdodCA9IHZpZXdIZWlnaHQ7XG4gICAgICAgIHRoaXMuZGF0YVdpbmRvdyA9IGdyaWQubmV3UmVjdGFuZ2xlKGZpcnN0VlgsIGZpcnN0VlksIGxhc3RWWCAtIGZpcnN0VlgsIGxhc3RWWSAtIGZpcnN0VlkpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgUmVuZGVyZXIucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge09iamVjdH0gYSBwcm9wZXJ0eSB2YWx1ZSBhdCBhIGtleSwgZGVsZWdhdGVzIHRvIHRoZSBncmlkXG4gICAgICovXG4gICAgcmVzb2x2ZVByb3BlcnR5OiBmdW5jdGlvbihrZ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c2libGVDb2x1bW5zO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgUmVuZGVyZXIucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn0gVGhlIGNvbHVtbiBpbmRleCB3aG5lIHRoZSBtb3VzZUV2ZW50IGNvb3JkaW5hdGVzIGFyZSBvdmVyIGEgY29sdW1uIGRpdmlkZXIuXG4gICAgICovXG4gICAgb3ZlckNvbHVtbkRpdmlkZXI6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgeCA9IE1hdGgucm91bmQoeCk7XG4gICAgICAgIHZhciBlZGdlcyA9IHRoaXMuZ2V0Q29sdW1uRWRnZXMoKTtcbiAgICAgICAgdmFyIHdoaWNoQ29sID0gZWRnZXMuaW5kZXhPZih4IC0gMSk7XG4gICAgICAgIGlmICh3aGljaENvbCA8IDApIHtcbiAgICAgICAgICAgIHdoaWNoQ29sID0gZWRnZXMuaW5kZXhPZih4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAod2hpY2hDb2wgPCAwKSB7XG4gICAgICAgICAgICB3aGljaENvbCA9IGVkZ2VzLmluZGV4T2YoeCAtIDIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh3aGljaENvbCA8IDApIHtcbiAgICAgICAgICAgIHdoaWNoQ29sID0gZWRnZXMuaW5kZXhPZih4ICsgMSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHdoaWNoQ29sIDwgMCkge1xuICAgICAgICAgICAgd2hpY2hDb2wgPSBlZGdlcy5pbmRleE9mKHggLSAzKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB3aGljaENvbDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9IFRoZSByb3cgaW5kZXggd2hlbiB0aGUgbW91c2VFdmVudCBjb29yZGluYXRlcyBhcmUgb3ZlciBhIHJ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ICAgICovXG4gICAgX2dldEJvdW5kc09mQ2VsbDogZnVuY3Rpb24oYywgcikge1xuICAgICAgICB2YXIgeE91dHNpZGUgPSBmYWxzZTtcbiAgICAgICAgdmFyIHlPdXRzaWRlID0gZmFsc2U7XG4gICAgICAgIHZhciBjb2x1bW5FZGdlcyA9IHRoaXMuZ2V0Q29sdW1uRWRnZXMoKTtcbiAgICAgICAgdmFyIHJvd0VkZ2VzID0gdGhpcy5nZXRSb3dFZGdlcygpO1xuXG4gICAgICAgIHZhciB4ID0gdGhpcy5jb2x1bW5FZGdlc0luZGV4TWFwW2NdO1xuICAgICAgICB2YXIgeSA9IHRoaXMucm93RWRnZXNJbmRleE1hcFtyXTtcbiAgICAgICAgaWYgKHggPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgeCA9IHRoaXMuY29sdW1uRWRnZXNJbmRleE1hcFtjIC0gMV07XG4gICAgICAgICAgICB4T3V0c2lkZSA9IHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoeSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICB5ID0gdGhpcy5yb3dFZGdlc0luZGV4TWFwW3IgLSAxXTtcbiAgICAgICAgICAgIHlPdXRzaWRlID0gdHJ1ZTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBveCA9IGNvbHVtbkVkZ2VzW3hdLFxuICAgICAgICAgICAgb3kgPSByb3dFZGdlc1t5XSxcbiAgICAgICAgICAgIGN4ID0gY29sdW1uRWRnZXNbeCArIDFdLFxuICAgICAgICAgICAgY3kgPSByb3dFZGdlc1t5ICsgMV0sXG4gICAgICAgICAgICBleCA9IGN4IC0gb3gsXG4gICAgICAgICAgICBleSA9IGN5IC0gb3k7XG5cbiAgICAgICAgdmFyIGNlbGwgPSB0aGlzLmNlbGw7XG4gICAgICAgIGNlbGwueCA9IHhPdXRzaWRlID8gY3ggOiBveDtcbiAgICAgICAgY2VsbC55ID0geU91dHNpZGUgPyBjeSA6IG95O1xuICAgIC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A9IHRoaXMuZ2V0Rml4ZWRSb3dDb3VudCgpO1xuXG4gICAgICAgIC8vIHZhciBmaXhlZENvbHVtbkNvdW50ID0gdGhpcy5nZXRGaXhlZENvbHVtbkNvdW50KCk7XG4gICAgICAgIC8vIHZhciBmaXhlZFJvd0NvdW50ID0gdGhpcy5nZXRGaXhlZFJvd0NvdW50KCk7XG4gICAgICAgIHZhciBzY3JvbGxYID0gdGhpcy5nZXRTY3JvbGxMZWZ0KCk7XG4gICAgICAgIHZhciBzY3JvbGxZID0gdGhpcy5nZXRTY3JvbGxUb3AoKTtcblxuICAgICAgICBmb3IgKGMgPSAwOyBjIDwgY29sdW1uRWRnZXMubGVuZ3RoOyBjKyspIHtcbiAgICAgICAgICAgIHdpZHRoID0gY29sdW1uRWRnZXNbY107XG4gICAgICAgICAgICBpZiAocG9pbnQueCA8IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgeCA9IE1hdGgubWF4KDAsIHBvaW50LnggLSBwcmV2aW91cyAtIDIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldmlvdXMgPSB3aWR0aDtcbiAgICAgICAgfVxuICAgICAgICBjLS07XG4gICAgICAgIHByZXZpb3VzID0gMDtcbiAgICAgICAgZm9yIChyID0gMDsgciA8IHRoaXMucm93RWRnZXMubGVuZ3RoOyByKyspIHtcbiAgICAgICAgICAgIGhlaWdodCA9IHRoaXMucm93RWRnZXNbcl07XG4gICAgICAgICAgICBpZiAocG9pbnQueSA8IGhlaWdodCkge1xuICAgICAgICAgICAgICAgIHkgPSBNYXRoLm1heCgwLCBwb2ludC55IC0gcHJldmlvdXMgLSAyKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gaGVpZ2h0O1xuICAgICAgICB9XG4gICAgICAgIHItLTtcbiAgICAgICAgaWYgKHBvaW50LnggPCAwKSB7XG4gICAgICAgICAgICBjID0gLTE7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHBvaW50LnkgPCAwKSB7XG4gICAgICAgICAgICByID0gLTE7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdmlld1BvaW50ID0gZ3JpZC5uZXdQb2ludChjLCByKTtcblxuICAgICAgICAvL2NvbXBlbnNhdGUgaWYgd2UgYXJlIHNjcm9sbGVkXG4gICAgICAgIGlmIChjID49IGZpeGVkQ29sdW1uQ291bnQpIHtcbiAgICAgICAgICAgIGMgPSBjICsgc2Nyb2xsWDtcbiAgICAgICAgfVxuICAgICAgICBpZiAociA+PSBmaXhlZFJvd0NvdW50KSB7XG4gICAgICAgICAgICByID0gciArIHNjcm9sbFk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdHJhbnNsYXRlZEluZGV4ID0gLTE7XG5cbiAgICAgICAgdmFyIGNvbHVtbiA9IGJlaGF2aW9yLmdldENvbHVtbihjKTtcbiAgICAgICAgaWYgKGNvbHVtbikge1xuICAgICAgICAgICAgdHJhbnNsYXRlZEluZGV4ID0gY29sdW1uLmluZGV4O1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGdyaWRDZWxsOiBncmlkLm5ld1BvaW50KGMsIHIpLFxuICAgICAgICAgICAgbW91c2VQb2ludDogZ3JpZC5uZXdQb2ludCh4LCB5KSxcbiAgICAgICAgICAgIHZpZXdQb2ludDogdmlld1BvaW50LFxuICAgICAgICAgICAgZGF0YUNlbGw6IGdyaWQubmV3UG9pbnQodHJhbnNsYXRlZEluZGV4LCByKSxcbiAgICAgICAgfTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEBzdW1tYXJ5IERldGVybWluZXMgaWYgYSBjb2x1bW4gaXMgdmlzaWJsZS5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gY29sSW5kZXggLSB0aGUgY29sdW1uIGluZGV4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wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9XG4gICAgICovXG4gICAgZ2V0RmxhdHRlbmVkWXM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICAgIHZhciBzZXQgPSB7fTtcbiAgICAgICAgdGhpcy5zZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0aW9uKSB7XG4gICAgICAgICAgICB2YXIgdG9wID0gc2VsZWN0aW9uLm9yaWdpbi55O1xuICAgICAgICAgICAgdmFyIHNpemUgPSBzZWxlY3Rpb24uZXh0ZW50LnkgKyAxO1xuICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCBzaXplOyByKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgdGkgPSByICsgdG9wO1xuICAgICAgICAgICAgICAgIGlmICghc2V0W3RpXSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaCh0aSk7XG4gICAgICAgICAgICAgICAgICAgIHNldFt0aV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHJlc3VsdC5zb3J0KGZ1bmN0aW9uKHgsIHkpIHtcbiAgICAgICAgICAgIHJldHVybiB4IC0geTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBTZWxlY3Rpb25Nb2RlbC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gb2Zmc2V0XG4gICAgICovXG4gICAgc2VsZWN0Um93c0Zyb21DZWxsczogZnVuY3Rpb24ob2Zmc2V0KSB7XG4gICAgICAgIG9mZnNldCA9IG9mZnNldCB8fCAwO1xuXG4gICAgICAgIHZhciBzbSA9IHRoaXMucm93U2VsZWN0aW9uTW9kZWw7XG4gICAgICAgIHRoaXMuYWxsUm93c1NlbGVjdGVkID0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dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5yb3dIZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuY29sdW1uSGVhZGVyQ29sdW1uU2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyUm93U2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLnJvd0hlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuZmlsdGVyUHJvcGVydGllcyA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclN0eWxlOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNlbGxCb3JkZXJTdHlsZTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGUgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclRoaWNrbmVzczoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNlbGxCb3JkZXJUaGlja25lc3MgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllc0NvbHVtblNlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgIC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b3IgKHZhciBrZXkgaW4gb2JqKSB7XG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgb2JqLmhhc093blByb3BlcnR5KGtleSkgJiYgKFxuICAgICAgICAgICAgICAgICAgICBleHBvcnRQcm9wcyA9PT0gdW5kZWZpbmVkIHx8XG4gICAgICAgICAgICAgICAgICAgICFleHBvcnRQcm9wcyAmJiBub0V4cG9ydFByb3BlcnRpZXMuaW5kZXhPZihrZXkpID49IDAgfHxcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0UHJvcHMgJiYgbm9FeHBvcnRQcm9wZXJ0aWVzLmluZGV4T2Yoa2V5KSA8IDBcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBkZWxldGUgb2JqW2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEJlaGF2aW9yLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGdldHRlciBmb3IgYSBbTWVtZW50b10oaHR0cDovL2MyLmNvbS9jZ2kvd2lraT9NZW1lbnRvUGF0dGVybikgT2JqZWN0XG4gICAgICogQHJldHVybnMge29iamVjdH1cbiAgICAgKi9cbiAgICBnZXRQcml2YXRlU3RhdGU6IGZ1bmN0aW9uKCkge1xuICAgICAgICBpZiAoIXRoaXMudGFibGVTdGF0ZSkge1xuICAgICAgICAgICAgdGhpcy50YWJsZVN0YXRlID0gdGhpcy5nZXREZWZhdWx0U3RhdGUoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy50YWJsZVN0YXRlO1xuICAgIH0sXG5cbiAgICAvL3RoaXMgaXMgZWZmZWN0aXZlbHkgYSBjbG9uZSwgd2l0aCBjZXJ0YWluIHRoaW5ncyByZW1vdmVkLi4uLlxuICAgIGdldFN0YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGNvcHkgPSBKU09OLnBhcnNlK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nZWQ6IGZ1bmN0aW9uKCkge30sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7Ym9vbGVhbn0gQ2FuIHJlLW9yZGVyIGNvbHVtbnMuXG4gICAgICovXG4gICAgaXNDb2x1bW5SZW9yZGVyYWJsZTogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7T2JqZWN0fSBUaGUgcHJvcGVydGllcyBmb3IgYSBzcGVjaWZpYyBjb2x1bW4uIFRoZXNlIGFyZSB1c2VkIGlmIG5vIGNlbGwgcHJvcGVydGllcyBhcmUgc3BlY2lmaWVkLlxuICAgICAqIEBwYXJhbSB7aW5kZXh9IGNvbHVtbkluZGV4IC0gdGhlIGNvbHVtbiBpbmRleCBvZiBpbnRlcmVzdFxuICAgICAqL1xuICAgIGdldENvbHVtblByb3BlcnRpZXM6IGZ1bmN0aW9uKGNvbHVtbkluZGV4KSB7XG4gICAgICAgIHZhciBjb2wgPSB0aGlzLmNvbHVtbnNbY29sdW1uSW5kZXhdO1xuICAgICAgICBpZiAoIWNvbCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBpc051bGw6IHRydWVcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb2wuZ2V0UHJvcGVydGllcygpOyAvL1RPRE86IHJldHVybnMgYG51bGxgIG9uIEh5cGVyZ3JpZC5yZXNldCgpO1xuICAgICAgICBpZiAoIXByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgaXNOdWxsOiB0cnVlXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwcm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maWVsZDogdGhpcy5nZXRGaWVsZChpZClcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsYWJlbHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBCZWhhdmlvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJuIHtzdHJpbmd9IFRoZSBmaWVsZCBhdCBgY29sSW5kZXhgLlxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleCAtIHRoZSBjb2x1bW4gaW5kZXggb2YgaW50ZXJlc3RcbiAgICAgKi9cbiAgICBnZXRGaWVsZDogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgaWYgKGNvbEluZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgcmV0dXJuICd0cmVlJztcbiAgICAgICAgfVxuICAgICAgICB2YXIgY29sID0gdGhpcy5nZXRDb2x1bW4oY29sSW5kZXgpO1xuICAgICAgICByZXR1cm4gY29sLmdldEZpZWxkKCk7XG4gICAgfSxcbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgY29sdW1uIGhlYWRpbmcgYXQgYGNvbEluZGV4Jy5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gY29sSW5kZXggLSB0aGUgY29sdW1uIGluZGV4IG9mIGludGVyZXN0XG4gICAgICovXG4gICAgZ2V0SGVhZGVyOiBmdW5jdGlvbihjb2xJbmRleCkge1xuICAgICAgICBpZiAoY29sSW5kZXggPT09IC0xKSB7XG4gICAgICAgICAgICByZXR1cm4gJ1RyZWUnO1xuICAgICAgICB9XG4gICAgICAgIHZhciBjb2wgPSB0aGlzLmdldENvbHVtbihjb2xJbmRleCk7XG4gICAgICAgIHJldHVybiBjb2wuZ2V0SGVhZGVyKCk7XG4gICAgfSxcbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVo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gdGFibGVTdGF0ZSA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCk7XG4gICAgICAgIHZhciBpbmRleGVzID0gdGFibGVTdGF0ZS5jb2x1bW5JbmRleGVzO1xuICAgICAgICB2YXIgbGFiZWxzID0gW107XG4gICAgICAgIHZhciBjb2x1bW5Db3VudCA9IHRoaXMuZ2V0Q29sdW1uQ291bnQoKTtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjb2x1bW5Db3VudDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoaW5kZXhlcy5pbmRleE9mKGkpID09PSAtMSkge1xuICAgICAgICAgICAgICAgIGxhYmVscy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGksXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsOiB0aGlzLmdldEhlYWRlcihpKSxcbiAgICAgICAgICAgICAgICAgICAgZmllbGQ6IHRoaXMuZ2V0RmllbGQoaSlcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGFiZWxzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGlkZSBjb2x1bW5zIHRoYXQgYXJlIHNwZWNpZmllZCBieSB0aGVpciBpbmRleGVzXG4gICAgICogQHBhcmFtIHtBcnJheX0gYXJyYXlPZkluZGV4ZXMgLSBhbiBhcnJheSBvZiBjb2x1bW4gaW5kZXhlcyB0byBoaWRlXG4gICAgICovXG4gICAgaGlkZUNvbHVtbnM6IGZ1bmN0aW9uKGFycmF5T2ZJbmRleGVzKSB7XG4gICAgICAgIHZhciB0YWJsZVN0YXRlID0gdGhpcy5nZXRQcml2YXRlU3RhdGUoKTtcbiAgICAgICAgdmFyIG9yZGVyID0gdGFibGVTdGF0ZS5jb2x1bW5JbmRleGVzO1xuICAgICAgICBmb3IgKHZhciBpID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sZiA9IHRoaXM7XG4gICAgICAgIGlmICh0aGlzLmdldEdyaWQoKS5pc0NvbHVtbkF1dG9zaXppbmcoKSkge1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmF1dG9zaXplQWxsQ29sdW1ucygpO1xuICAgICAgICAgICAgfSwgMTAwKTtcbiAgICAgICAgICAgIHNlbGYuY2hhbmdlZCgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmFsbENvbHVtbnNbLTFdLmNoZWNrQ29sdW1uQXV0b3NpemluZyh0cnVlKTtcbiAgICAgICAgICAgICAgICBzZWxmLmNoYW5nZWQoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBiZWhhdmlvcnMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAZGVzY3JpcHRpb24gR2V0IHRoZSBkYXRhIGZpZWxkLlxuICAgICAqL1xuICAgIGdldERhdGE6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXREYXRhTW9kZWwoKS5nZXREYXRhKCk7XG4gICAgfSxcblxuICAgIGdldENlbGxFZGl0b3JBdDogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICBpZiAoZ3JpZC5pc0ZpbHRlclJvdyh5KSkge1xuICAgICAgICAgICAgcmV0dXJuIGdyaWQuY2VsbEVkaXRvcnMudGV4dGZpZWxkO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBiZWhhdmlvcnMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAZGVzY3JpcHRpb24gU2V0IHRoZSB0b3RhbHMgZmllbGQu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AgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyU3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5VXBFdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5RG93bkV2ZW50KHNlbGYsIGUpO1xuICAgICAgICB9KTtcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcigna2V5cHJlc3MnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5UHJlc3NFdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0Lm9uYmx1ciA9IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICB9O1xuICAgICAgICAvLyBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdmb2N1c291dCcsIGZ1bmN0aW9uKCkge1xuICAgICAgICAvLyAgICAgc2VsZi5zdG9wRWR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4gICAgICogbXkgbG9va3VwIGFsaWFzXG4gICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgKiBAbWVtYmVyT2YgVGV4dGZpZWxkLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGFsaWFzOiAndGV4dGZpZWxkJyxcblxuICAgIHRlbXBsYXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgLypcbiAgICAgICAgICAgIDxpbnB1dCBpZD1cImVkaXRvclwiPlxuICAgICAgICAqL1xuICAgIH0sXG5cbiAgICBzZWxlY3RBbGw6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmlucHV0LnNldFNlbGVjdGlvblJhbmdlKDAsIHRoaXMuaW5wdXQudmFsdWUubGVuZ3RoKTtcbiAgICB9LFxuXG4gICAgaW5pdGlhbGl6ZUlucHV0OiBmdW5jdGlvbihpbnB1dCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKGUgJiYgKGUua2V5Q29kZSA9PT0gMTMgfHwgZS5rZXlDb2RlID09PSAyNykpIHtcbiAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5nZXRHcmlkKCkuaXNGaW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KyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVhZGVyUm93Q291bnQpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyUm93VmFsdWUoeCwgeSwgdmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGhhc0hpZXJhcmNoeUNvbHVtbikge1xuICAgICAgICAgICAgeSArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXREYXRhU291cmNlKCkuc2V0VmFsdWUoeCwgeSAtIGhlYWRlclJvd0NvdW50LCB2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5jaGFuZ2VkKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIHNldEhlYWRlclJvd1ZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3NldEhlYWRlcih4LCB5KTsgLy8geSBpcyByZWFsbHkgdGhlIHZhbHVlXG4gICAgICAgIH1cbiAgICAgICAgdmFyIGdyaWQgPSB0aGlzLmdldEdyaWQoKTtcbiAgICAgICAgdmFyIGlzRmlsdGVyUm93ID0gZ3JpZC5pc1Nob3dGaW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gKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Qcm9wZXJ0aWVzOiBmdW5jdGlvbihjb2xJbmRleCkge1xuICAgICAgICAvL2FjY2VzcyBkaXJlY3RseSBiZWNhdXNlIHdlIHdhbnQgaXQgb3JkZXJlZFxuICAgICAgICB2YXIgY29sdW1uID0gdGhpcy5nZXRCZWhhdmlvcigpLmFsbENvbHVtbnNbY29sSW5kZXhdO1xuICAgICAgICBpZiAoY29sdW1uKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sdW1uLmdldFByb3BlcnRpZXMoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleFxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEZpbHRlcjogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBpZiAoIWNvbHVtblByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Db3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9XG4gICAgICovXG4gICAgZ2V0Um93Q291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgY291bnQgPSB0aGlzLmdldERhdGFTb3VyY2UoKS5nZXRSb3dDb3VudCgpO1xuICAgICAgICBjb3VudCArPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIHJldHVybiBjb3VudDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7c3RyaW5nW119XG4gICAgICovXG4gICAgZ2V0SGVhZGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRIZWFkZXJzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtzdHJpbmdbXX0gaGVhZGV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sXG4gICAgICAgICAgICAgICAgZmllbGQ6IGZpZWxkc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGdyb3VwcztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0QXZhaWxhYmxlR3JvdXBzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB0aGlzLnNvdXJjZS5nZXRIZWFkZXJzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy5nZXRCZWhhd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G4gICAgICAgICAgICBpZiAoc3RhdGUuc29ydHNbYWxyZWFkeV0gPiAwKSB7XG4gICAgICAgICAgICAgICAgc3RhdGUuc29ydHNbYWxyZWFkeV0gPSAtMSAqIHN0YXRlLnNvcnRzW2FscmVhZHldO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzdGF0ZS5zb3J0cy5zcGxpY2UoYWxyZWFkeSwgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoaGFzQ1RSTCB8fCBzdGF0ZS5zb3J0cy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc3RhdGUuc29ydHMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzdGF0ZS5zb3J0cy5sZW5ndGggPiAzKSB7XG4gICAgICAgICAgICBzdGF0ZS5zb3J0cy5sZW5ndGggPSAzO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERPV05XQVJEU19CTEFDS19BUlJPVztcbiAgICAgICAgICAgIHJldHVybiByYW5rICsgYXJyb3cgKyAnICc7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IHJhbmsgKyAodXAgPyAnLXVwJyA6ICctZG93bicpO1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRCZWhhdmlvcigpLmdldEltYWdlKG5hbWUpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBjZWxsXG4gICAgICogQHBhcmFtIGV2ZW50XG4gICAgICovXG4gICAgY2VsbENsaWNrZWQ6IGZ1bmN0aW9uKGNlbGwsIGV2ZW50KSB7XG4gICAgICAgIGlmICghdGhpcy5oYXNBZ2dyZWdhdGVzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZXZlbnQuZ3JpZENlbGwueCAhPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuOyAvLyB0aGlzIHdhc24ndCBhIGNsaWNrIG9uIHRoZSBoaWVyYXJjaHkgY29sdW1uXG4gICAgICAgIH1cbiAgICAgICAgdmFyIGdyaWQgPSB0aGlzLmdldEdyaWQoKTtcbiAgICAgICAgdmFyIGhlYWRlclJvd0NvdW50ID0gZ3JpZC5nZXRIZWFkZXJSb3dDb3VudCgpO1xuICAgICAgICB2YXIgeSA9IGV2ZW50LmdyaWRDZWxsLnkgLSBoZWFkZXJSb3dDb3VudCArIDE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gICAgIGlmICh0aGlzLmhhc0FnZ3JlZ2F0ZXMoKSkge1xuICAgICAgICAgICAgcmVzdWx0LnRyZWUgPSB0aGlzLmdldFZhbHVlKC0yLCB5KTtcbiAgICAgICAgICAgIGZpZWxkcy5zaGlmdCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgcmVzdWx0W2ZpZWxkc1tpXV0gPSB0aGlzLmdldFZhbHVlKGksIHkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fVxuICAgICAqL1xuICAgIGdldENvbXB1dGVkUm93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHZhciByY2YgPSB0aGlzLmdldFJvd0NvbnRleHRGdW5jdGlvbihbeV0pO1xuICAgICAgICB2YXIgZmllbGRzID0gdGhpcy5nZXRGaWVsZHMoKTtcbiAgICAgICAgdmFyIHJvdyA9IHt9O1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGZpZWxkcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgdmFyIGZpZWxkID0gZmllbGRzW2ldO1xuICAgICAgICAgICAgcm93W2ZpZWxkXSA9IHJjZihmaWVsZClbMF07XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJvdztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gZmllbGROYW1lXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiA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VxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eS5cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIWdyaWQuaXNDZWxsU2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrIHx8ICF0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIHZhciBkeCA9IGNlbGwueDtcbiAgICAgICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVud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zZXRDcm9zc0Jyb3dzZXJQcm9wZXJ0eShkLCAndHJhbnNpdGlvbicsIChzZWxmLmlzV2Via2l0ID8gJy13ZWJraXQtJyA6ICcnKSArICd0cmFuc2Zvcm0gJyArIGNvbHVtbkFuaW1hdGlvblRpbWUgKyAnbXMgZWFzZScpO1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zZm9ybScsICd0cmFuc2xhdGUoJyArIGRyYWdnZXJTdGFydFggKyAncHgsICcgKyAtMiArICdweCknKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICAvL25lZWQgdG8gY2hhbmdlIHRoaXMgdG8ga2V5IGZyYW1lc1xuXG4gICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zaXRpb24nLCAnJyk7XG4gICAgICAgICAgICAgICAgZ3JpZC5yZW5kZXJPdmVycmlkZXNDYWNoZS5mbG9hdGVyID0gbnVsbDtcbiAgICAgICAgICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICAgICAgICAgICAgICBzZWxmLmRvRmxvYXRlckFuaW1hdGlvbihncmlkKTtcbiAgICAgICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIGQuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Zsb2F0aW5nTm93ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LCBjb2x1bW5BbmltYXRpb25UaW1lICsgNTApO1xuICAgICAgICB9O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2V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AgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmlzRmxvYXRpbmdOb3cgPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5jcmVhdGVGbG9hdENvbHVtbihncmlkLCBvdmVyQ29sKTtcbiAgICAgICAgICAgIHRoaXMuZmxvYXRDb2x1bW5UbyhncmlkLCBkcmFnZ2VkVG9UaGVSaWdodCk7XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIGlmICh4IDwgbWluWCAtIDEwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5jaGVja0F1dG9TY3JvbGxUb0xlZnQoZ3JpZCwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IG1pblggLSAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdMZWZ0ID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL2xldHMgY2hlY2sgZm9yIGF1dG9zY3JvbGwgdG8gcmlnaHQgaWYgd2VyZSB1cCBhZ2FpbnN0IGl0XG4gICAgICAgICAgICBpZiAoYXRNYXggfHwgeCA+IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tBdXRvU2Nyb2xsVG9SaWdodChncmlkLCB4KTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA8IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdSaWdodCA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDZWxsTW92aW5nLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGF1dG9zY3JvbGwgdG8gdGhlIHJpZ2h0IGlmIG5lY2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lRG93bjogZnVuY3Rpb24oZ3JpZCwgZXZlbnQpIHtcbiAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVLZXlEb3duOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlS2V5RG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJ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ICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2Mgb3BlbiB0aGUgY29sdW1uIHBpY2tlclxuICAgICAqICMjIyMgcmV0dXJuczogdHlwZVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICovXG4gICAgb3BlbkNvbHVtblBpY2tlcjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5pc0NvbHVtblBpY2tlck9wZW4oKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMub3BlbkVkaXRvciA9IHRydWU7XG4gICAgICAgIGlmIChncmlkLmdldEJlaGF2aW9yKCkub3BlbkVkaXRvcih0aGlzLm92ZXJsYXkpID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gZ3JpZC5yZXNvbHZlUHJvcGVydHkoJ2JhY2tncm91bmRDb2xvcicpO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS50b3AgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUucmlnaHQgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYm90dG9tID0gJzAlJztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLmxlZnQgPSAnMCUnO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5Ub3AgPSAnMTVweCc7XG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5SaWdodCA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkJvdHRvbSA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkxlZnQgPSAnMTVweCc7XG5cbiAgICAgICAgc2VsZi5vdmVybGF5LnN0eWxlLmRpc3BsYXkgPSAnJztcblxuXG4gICAgICAgIGlmICghdGhpcy5fY2xvc2VyKSB7XG4gICAgICAgICAgICB0aGlzLl9jbG9zZXIgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IHNlbGYuZ2V0Q2hhckZvcihncmlkLCBlLmtleUNvZGUpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgdmFyIGtleXMgPSBncmlkLnJlc29sdmVQcm9wZXJ0eSgnZWRpdG9yQWN0aXZhdGlvbktleXMnKTtcbiAgICAgICAgICAgICAgICBpZiAoa2V5cy5pbmRleE9mKGtleSkgPiAtMSB8fCBlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbG9zZUNvbHVtblBpY2tlcihncmlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy9ncmlkLnNldEZvY3VzYWJsZShmYWxzZSk7XG4gICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYub3ZlcmxheS5zdHlsZS5vcGFjaXR5ID0gMC45NTtcbiAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBzZWxmLl9jbG9zZXIsIGZhbHNlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuZm9jdXMoKTtcbiAgICAgICAgfSwgMTAwKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXB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mVudC5ncmlkQ2VsbDtcbiAgICAgICAgdmFyIHZpZXdDZWxsID0gZXZlbnQudmlld1BvaW50O1xuICAgICAgICB2YXIgZHggPSBjZWxsLng7XG4gICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuXG4gICAgICAgIHZhciBpc0hlYWRlciA9IGdyaWQuaXNTaG93Um93TnVtYmVycygpICYmIGR4IDwgMDtcblxuICAgICAgICBpZiAoIWdyaWQuaXNSb3dTZWxlY3Rpb24oKSB8fCBpc1JpZ2h0Q2xpY2sgfHwgIWlzSGVhZGVyKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnkgPCBudW1GaXhlZFJvd3MpIHtcbiAgICAgICAgICAgICAgICBkeSA9IHZpZXdDZWxsLnk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBkQ2VsbCA9IGdyaWQubmV3UG9pbnQoMCwgZHkpO1xuXG4gICAgICAgICAgICB2YXIgcHJpbUV2ZW50ID0gZXZlbnQucHJpbWl0aXZlRXZlbnQ7XG4gICAgICAgICAgICB2YXIga2V5cyA9IHByaW1FdmVudC5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIHRoaXMuZHJhZ0FybWVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHRo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Itc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgdXNlci1zZWxlY3Q6IG5vbmU7JyxcbiAgICAgICAgJyAgICBvdmVyZmxvdzogaGlkZGVuOyB9JyxcbiAgICAgICAgJ3Zpc2libGUgeyBvcGFjaXR5OiAwLjc1OyB9JyxcbiAgICAgICAgJ2hpZGRlbiB7IG9wYWNpdHk6IDAuMDsgfScsXG4gICAgICAgICdlZGl0b3IgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgZGlzcGxheTogbm9uZTsnLFxuICAgICAgICAnICAgIGJvcmRlcjogc29saWQgMnB4IGJsYWNrOycsXG4gICAgICAgICcgICAgb3V0bGluZTogMDsnLFxuICAgICAgICAnICAgIHBhZGRpbmc6IDA7JyxcbiAgICAgICAgJyAgICB6LWluZGV4OiAxMDAwOyB9J1xuICAgIF0sXG4gICAgJ2xpc3QtZHJhZ29uJzogW1xuICAgICAgICAnZGl2LmRyYWdvbi1saXN0LCBsaS5kcmFnb24tcG9wIHsnLFxuICAgICAgICAnICAgIGZvbnQtZmFtaWx5OiBSb2JvdG8sIHNhbnMtc2VyaWY7JyxcbiAgICAgICAgJyAgICB0ZXh0LXRyYW5zZm9ybTogY2FwaXRhbGl6ZTsgfScsXG4gICAgICAgICdkaXYuZHJhZ29uLWxpc3QgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgdG9wOiA0JTsnLFxuICAgICAgICAnICAgIGxlZnQ6IDQlOycsXG4gICAgICAgICcgICAgaGVpZ2h0OiA5MiU7JyxcbiAgICAgICAgJyAgICB3aWR0aDogMjAlOyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdDpudGgtY2hpbGQoMikgeyBsZWZ0OiAyOCU7IH0nLFxuICAgICAgICAnZGl2LmRyYWdvbi1saXN0Om50aC1jaGlsZCgzKSB7IGxlZnQ6IDUyJTsgfScsXG4gICAgICAgICdkaXYuZHJhZ29uLWxpc3Q6bnRoLWNoaWxkKDQpIHsgbGVmdDogNzYlOyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdCA+IGRpdiwgZGl2LmRyYWdvbi1saXN0ID4gdWwgPiBsaSwgbGkuZHJhZ29uLXBvcCB7IGxpbmUtaGVpZ2h0OiA0NnB4OyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdCA+IHVsIHsgdG9wOiA0NnB4OyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdCA+IHVsID4gbGk6bm90KDpsYXN0LWNoaWxkKTo6YmVmb3JlLCBsaS5kcmFnb24tcG9wOjpiZWZvcmUgeycsXG4gICAgICAgICcgICAgY29udGVudDogXFwnXFxcXDJiMjRcXCc7JywgLy8gQkxBQ0sgTEFSR0UgQ0lSQ0xFXG4gICAgICAgICcgICAgY29sb3I6ICNiNmI2YjY7JyxcbiAgICAgICAgJyAgICBmb250LXNpemU6IDMwcHg7JyxcbiAgICAgICAgJyAgICBtYXJnaW46IDhweCAxNHB4IDhweCA4cHg7IH0nLFxuICAgICAgICAnbGkuZHJhZ29uLXBvcCB7IG9wYWNpdHk6Ljg7IH0nXG4gICAgXVxufTtcblxuZnVuY3Rpb24gYWRkU3R5bGVzaGVldChrZXksIHJlZmVyZW5jZUVsZW1lbnQpIHtcbiAgICBjc3NJbmplY3RvcihzdHlsZXNoZWV0c1trZXldLCBrZXksIHJlZmVyZW5jZUVsZW1lbnQpO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGFkZFN0eWxlc2hlZXQ7XG4iXX0= diff --git a/examples/autosizeissue/index.min.js b/examples/autosizeissue/index.min.js index 1d26fde82..e8e5cd6c2 100644 --- a/examples/autosizeissue/index.min.js +++ b/examples/autosizeissue/index.min.js @@ -1,8 +1,8 @@ !function t(e,i,n){function o(s,l){if(!i[s]){if(!e[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(r)return r(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(t){var i=e[s][1][t];return o(i?i:t)},u,u.exports,t,e,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s'+t.replace("mouse","")+""}),e.appendChild(n),t={},i.forEach(function(e){t[e]=n.getElementsByClassName(e)[0]})}return t},_addEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.add("listening"),window.addEventListener(t,this._bound["on"+t])},_removeEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.remove("listening"),window.removeEventListener(t,this._bound["on"+t])}};var a,u={shortStop:function(t){t.stopPropagation()},onwheel:function(t){this.index+=t[this.deltaProp],t.stopPropagation(),t.preventDefault()},onclick:function(t){var e=this.thumb.getBoundingClientRect(),i=t[this.oh.coordinate].thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:31}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){var i=this;return!this.filters.find(function(n){return!n(i.dataSource.getValue(n.columnIndex,t),e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){var i=this;return this.visibleColumnMap.find(function(n,o){var r=i.dataSource.getValue(n,t);return i.filter(r,e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":26,templex:27}],26:[function(t,e,i){e.exports=t(2)},{}],27:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;ie.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],29:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],30:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],31:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],33:[function(t,e,i){"use strict";function n(t,e){var i="f"===(typeof e)[0],n=i?e(t):e;return n||0===n?n:""}function o(t,e,i,n,o,r){var s=t.getTextWidth(e,i);switch(e.textAlign){case"center":n-=s/2;break;case"right":n-=s}e.lineWidth=r,e.moveTo(n+.5,o+.5),e.lineTo(n+s+.5,o+.5)}function r(t,e,i,n){if(1===i.length)return i;for(var o,s=[i.shift()];(o=e.getTextWidth(t,s.join(" "))1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent},setDragExtent:function(t){ -this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":28,"object-iterators":30,rectangular:31}],35:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); -}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":30}],36:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":32}],37:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],54:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":64}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":64}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s)); -var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":64}],59:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":64}],60:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":64}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":64}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":64}],63:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":64}],64:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":64}],69:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":61}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":64}],71:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":64}],72:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],74:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[55]); \ No newline at end of file +}},c={vertical:{coordinate:"clientY",axis:"pageY",size:"height",outside:"right",inside:"left",leading:"top",trailing:"bottom",marginLeading:"marginTop",marginTrailing:"marginBottom",thickness:"width",delta:"deltaY"},horizontal:{coordinate:"clientX",axis:"pageX",size:"width",outside:"bottom",inside:"top",leading:"left",trailing:"right",marginLeading:"marginLeft",marginTrailing:"marginRight",thickness:"height",delta:"deltaX"}},h={top:"vertical",bottom:"vertical",height:"vertical",left:"horizontal",right:"horizontal",width:"horizontal"};a="div.finbar-horizontal,div.finbar-vertical{position:absolute;margin:3px}div.finbar-horizontal>.thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:29}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){for(var i=this.filters.length;i--;)if(!this.filters[i](this.dataSource.getValue(this.filters[i].columnIndex,t),e,t))return!1;return!0}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){for(var i=this.visibleColumnMap,n=i.length;n--;)if(this.filter(this.dataSource.getValue(i[n],t),e,t))return!0;return!1}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":2,templex:31}],26:[function(t,e,i){!function(){function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i(){return 1}function n(t){d||"string"==typeof t||"number"==typeof t||(d=!0,console.error(new TypeError("LRU: key must be a string or number. Almost certainly a bug! "+typeof t).stack))}function o(t){return this instanceof o?("number"==typeof t&&(t={max:t}),t||(t={}),this._max=t.max,(!this._max||"number"!=typeof this._max||this._max<=0)&&(this._max=1/0),this._lengthCalculator=t.length||i,"function"!=typeof this._lengthCalculator&&(this._lengthCalculator=i),this._allowStale=t.stale||!1,this._maxAge=t.maxAge||null,this._dispose=t.dispose,void this.reset()):new o(t)}function r(t,e,i){n(e);var o=t._cache[e];return o&&(s(t,o)?(c(t,o),t._allowStale||(o=void 0)):i&&l(t,o),o&&(o=o.value)),o}function s(t,e){if(!e||!e.maxAge&&!t._maxAge)return!1;var i=!1,n=Date.now()-e.now;return i=e.maxAge?n>e.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],27:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],28:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],29:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],31:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;i1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent; +},setDragExtent:function(t){this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":26,"object-iterators":28,rectangular:29}],34:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); +}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":28}],35:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":30}],36:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],53:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":63}],56:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":63}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r), +o=Math.min(o,s));var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":63}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":63}],59:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":63}],60:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":63}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":63}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":63}],63:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":63}],68:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":60}],69:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":63}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":63}],71:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],73:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[54]); \ No newline at end of file diff --git a/examples/bclys/index.js b/examples/bclys/index.js index 0e22a2bb7..66be0667f 100644 --- a/examples/bclys/index.js +++ b/examples/bclys/index.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { contexts.unshift(arguments); } - return template.replace(templex.regexp, templex.merger.bind(contexts)); -} - -templex.regexp = /\{(.*?)\}/g; - -templex.with = function (i, s) { - return 'with(this[' + i + ']){' + s + '}'; -}; - -templex.cache = []; - -templex.deref = function (key) { - if (!(this.length in templex.cache)) { - var code = 'return eval(expr)'; - - for (var i = 0; i < this.length; ++i) { - code = templex.with(i, code); - } - - templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval - } - return templex.cache[this.length].call(this, key); -}; - -templex.merger = function (match, key) { - // Advanced features: Context can be a list of contexts which are searched in order. - var replacement; - - try { - replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; - } catch (e) { - replacement = '{' + key + '}'; - } - - return replacement; -}; - -// this interface consists solely of the templex function (and it's properties) -module.exports = templex; - -},{}],28:[function(require,module,exports){ +},{"css-injector":2,"templex":31}],26:[function(require,module,exports){ ;(function () { // closure for web browsers if (typeof module === 'object' && module.exports) { @@ -7243,7 +7190,7 @@ function Entry (key, value, lu, length, now, maxAge) { })() -},{}],29:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ /*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js @@ -7874,7 +7821,7 @@ function Entry (key, value, lu, length, now, maxAge) { })); -},{}],30:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ /* object-iterators.js - Mini Underscore library * by Jonathan Eiten * @@ -8082,7 +8029,7 @@ if (!Array.prototype.find) { module.exports = Wrapper; -},{}],31:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8636,7 +8583,7 @@ Rectangle.prototype = { exports.Point = Point; exports.Rectangle = Rectangle; -},{}],32:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8974,7 +8921,76 @@ exports.Rectangle = Rectangle; * 2.b. If `module` object undefined, redefine`RangeSelectionModel` to be the `RangeSelectionModel.exports` object */ -},{}],33:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ +// templex node module +// https://github.com/joneit/templex + +/* eslint-env node */ + +/** + * Merges values of execution context properties named in template by {prop1}, + * {prop2}, etc., or any javascript expression incorporating such prop names. + * The context always includes the global object. In addition you can specify a single + * context or an array of contexts to search (in the order given) before finally + * searching the global context. + * + * Merge expressions consisting of simple numeric terms, such as {0}, {1}, etc., deref + * the first context given, which is assumed to be an array. As a convenience feature, + * if additional args are given after `template`, `arguments` is unshifted onto the context + * array, thus making first additional arg available as {1}, second as {2}, etc., as in + * `templex('Hello, {1}!', 'World')`. ({0} is the template so consider this to be 1-based.) + * + * If you prefer something other than braces, redefine `templex.regexp`. + * + * See tests for examples. + * + * @param {string} template + * @param {...string} [args] + */ +function templex(template) { + var contexts = this instanceof Array ? this : [this]; + if (arguments.length > 1) { contexts.unshift(arguments); } + return template.replace(templex.regexp, templex.merger.bind(contexts)); +} + +templex.regexp = /\{(.*?)\}/g; + +templex.with = function (i, s) { + return 'with(this[' + i + ']){' + s + '}'; +}; + +templex.cache = []; + +templex.deref = function (key) { + if (!(this.length in templex.cache)) { + var code = 'return eval(expr)'; + + for (var i = 0; i < this.length; ++i) { + code = templex.with(i, code); + } + + templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval + } + return templex.cache[this.length].call(this, key); +}; + +templex.merger = function (match, key) { + // Advanced features: Context can be a list of contexts which are searched in order. + var replacement; + + try { + replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; + } catch (e) { + replacement = '{' + key + '}'; + } + + return replacement; +}; + +// this interface consists solely of the templex function (and it's properties) +module.exports = templex; + +},{}],32:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -9575,7 +9591,7 @@ function roundRect(gc, x, y, width, height, radius, fill, stroke) { module.exports = CellProvider; -},{"extend-me":3}],34:[function(require,module,exports){ +},{"extend-me":3}],33:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -13041,7 +13057,7 @@ function installPolyfills() { module.exports = Hypergrid; -},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":28,"object-iterators":30,"rectangular":31}],35:[function(require,module,exports){ +},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":26,"object-iterators":28,"rectangular":29}],34:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -14205,7 +14221,7 @@ function setNumberColumnWidth(gc, behavior, maxRow) { module.exports = Renderer; -},{"extend-me":3,"object-iterators":30}],36:[function(require,module,exports){ +},{"extend-me":3,"object-iterators":28}],35:[function(require,module,exports){ 'use strict'; var RangeSelectionModel = require('sparse-boolean-array'); @@ -14728,7 +14744,7 @@ SelectionModel.prototype = { module.exports = SelectionModel; -},{"sparse-boolean-array":32}],37:[function(require,module,exports){ +},{"sparse-boolean-array":30}],36:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16390,7 +16406,7 @@ var Behavior = Base.extend('Behavior', { module.exports = Behavior; -},{"../CellProvider":33,"./Column":38,"./images":42,"extend-me":3,"object-iterators":30}],38:[function(require,module,exports){ +},{"../CellProvider":32,"./Column":37,"./images":41,"extend-me":3,"object-iterators":28}],37:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16485,7 +16501,7 @@ Column.prototype = { module.exports = Column; -},{"object-iterators":30}],39:[function(require,module,exports){ +},{"object-iterators":28}],38:[function(require,module,exports){ 'use strict'; function DataModelDecorator(grid, component) { @@ -16671,7 +16687,7 @@ DataModelDecorator.prototype = { module.exports = DataModelDecorator; -},{}],40:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict'; var ListDragon = require('list-dragon'); @@ -16988,7 +17004,7 @@ var JSON = Behavior.extend('behaviors.JSON', { module.exports = JSON; -},{"../dataModels/JSON":54,"../features/index":72,"../stylesheets":74,"./Behavior":37,"./DataModelDecorator":39,"hyper-analytics":9,"list-dragon":25}],41:[function(require,module,exports){ +},{"../dataModels/JSON":53,"../features/index":71,"../stylesheets":73,"./Behavior":36,"./DataModelDecorator":38,"hyper-analytics":9,"list-dragon":25}],40:[function(require,module,exports){ 'use strict'; var Behavior = require('./Behavior'); @@ -17022,7 +17038,7 @@ var Null = Behavior.extend('Null', { module.exports = Null; -},{"./Behavior":37}],42:[function(require,module,exports){ +},{"./Behavior":36}],41:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17039,7 +17055,7 @@ _(images).each(function(image, key) { module.exports = images; -},{"../../images":1,"object-iterators":30}],43:[function(require,module,exports){ +},{"../../images":1,"object-iterators":28}],42:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17047,7 +17063,7 @@ module.exports = { JSON: require('./JSON'), Null: require('./Null') }; -},{"./Behavior":37,"./JSON":40,"./Null":41}],44:[function(require,module,exports){ +},{"./Behavior":36,"./JSON":39,"./Null":40}],43:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17365,7 +17381,7 @@ var CellEditor = Base.extend('CellEditor', { module.exports = CellEditor; -},{"extend-me":3,"mustache":29}],45:[function(require,module,exports){ +},{"extend-me":3,"mustache":27}],44:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17438,7 +17454,7 @@ var Choice = Simple.extend('Choice', { module.exports = Choice; -},{"./Simple":48}],46:[function(require,module,exports){ +},{"./Simple":47}],45:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17465,7 +17481,7 @@ var Color = Simple.extend('Color', { module.exports = Color; -},{"./Simple":48}],47:[function(require,module,exports){ +},{"./Simple":47}],46:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17492,7 +17508,7 @@ var Date = Simple.extend('Date', { module.exports = Date; -},{"./Simple":48}],48:[function(require,module,exports){ +},{"./Simple":47}],47:[function(require,module,exports){ 'use strict'; var CellEditor = require('./CellEditor.js'); @@ -17544,9 +17560,11 @@ var Simple = CellEditor.extend('Simple', { self.getGrid().fireSyntheticEditorKeyDownEvent(self, e); }); input.addEventListener('keypress', function(e) { - console.log('keypress', e.keyCode); self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17670,7 +17688,7 @@ var Simple = CellEditor.extend('Simple', { module.exports = Simple; -},{"./CellEditor.js":44}],49:[function(require,module,exports){ +},{"./CellEditor.js":43}],48:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17697,7 +17715,7 @@ var Slider = Simple.extend('Slider', { module.exports = Slider; -},{"./Simple":48}],50:[function(require,module,exports){ +},{"./Simple":47}],49:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17724,7 +17742,7 @@ var Spinner = Simple.extend('Spinner', { module.exports = Spinner; -},{"./Simple":48}],51:[function(require,module,exports){ +},{"./Simple":47}],50:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17778,6 +17796,9 @@ var Textfield = Simple.extend('Textfield', { input.addEventListener('keypress', function(e) { self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17797,7 +17818,7 @@ var Textfield = Simple.extend('Textfield', { module.exports = Textfield; -},{"./Simple":48}],52:[function(require,module,exports){ +},{"./Simple":47}],51:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17810,7 +17831,7 @@ module.exports = { Slider: require('./Slider'), Spinner: require('./Spinner') }; -},{"./CellEditor":44,"./Choice":45,"./Color":46,"./Date":47,"./Slider":49,"./Spinner":50,"./Textfield":51}],53:[function(require,module,exports){ +},{"./CellEditor":43,"./Choice":44,"./Color":45,"./Date":46,"./Slider":48,"./Spinner":49,"./Textfield":50}],52:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -17872,7 +17893,7 @@ var DataModel = Base.extend('DataModel', { module.exports = DataModel; -},{"extend-me":3}],54:[function(require,module,exports){ +},{"extend-me":3}],53:[function(require,module,exports){ 'use strict'; var analytics = require('hyper-analytics'); @@ -18606,7 +18627,7 @@ function textMatchFilter(string) { module.exports = JSON; -},{"./DataModel":53,"hyper-analytics":9}],55:[function(require,module,exports){ +},{"./DataModel":52,"hyper-analytics":9}],54:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -18623,7 +18644,7 @@ window.fin = { Hypergrid: Hypergrid }; -},{"./Hypergrid":34,"./behaviors/index":43,"./cellEditors/index":52,"./features/index":72,"./polyfills":73}],56:[function(require,module,exports){ +},{"./Hypergrid":33,"./behaviors/index":42,"./cellEditors/index":51,"./features/index":71,"./polyfills":72}],55:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18657,7 +18678,7 @@ var CellClick = Feature.extend('CellClick', { module.exports = CellClick; -},{"./Feature.js":64}],57:[function(require,module,exports){ +},{"./Feature.js":63}],56:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18710,7 +18731,7 @@ var CellEditing = Feature.extend('CellEditing', { module.exports = CellEditing; -},{"./Feature.js":64}],58:[function(require,module,exports){ +},{"./Feature.js":63}],57:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19264,7 +19285,7 @@ var CellSelection = Feature.extend('CellSelection', { module.exports = CellSelection; -},{"./Feature.js":64}],59:[function(require,module,exports){ +},{"./Feature.js":63}],58:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19297,7 +19318,7 @@ var ColumnAutosizing = Feature.extend('ColumnAutosizing', { module.exports = ColumnAutosizing; -},{"./Feature.js":64}],60:[function(require,module,exports){ +},{"./Feature.js":63}],59:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -19984,7 +20005,7 @@ var ColumnMoving = Feature.extend('ColumnMoving', { module.exports = ColumnMoving; -},{"./Feature.js":64}],61:[function(require,module,exports){ +},{"./Feature.js":63}],60:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20282,7 +20303,7 @@ var ColumnResizing = Feature.extend('ColumnResizing', { module.exports = ColumnResizing; -},{"./Feature.js":64}],62:[function(require,module,exports){ +},{"./Feature.js":63}],61:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20821,7 +20842,7 @@ var ColumnSelection = Feature.extend('ColumnSelection', { module.exports = ColumnSelection; -},{"./Feature.js":64}],63:[function(require,module,exports){ +},{"./Feature.js":63}],62:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20872,7 +20893,7 @@ var ColumnSorting = Feature.extend('ColumnSorting', { module.exports = ColumnSorting; -},{"./Feature.js":64}],64:[function(require,module,exports){ +},{"./Feature.js":63}],63:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -21215,7 +21236,7 @@ var Feature = Base.extend('Feature', { module.exports = Feature; -},{"extend-me":3}],65:[function(require,module,exports){ +},{"extend-me":3}],64:[function(require,module,exports){ 'use strict'; @@ -21271,7 +21292,7 @@ var Filters = Feature.extend('Filters', { module.exports = Filters; -},{"./Feature.js":64}],66:[function(require,module,exports){ +},{"./Feature.js":63}],65:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21310,7 +21331,7 @@ var KeyPaging = Feature.extend('KeyPaging', { module.exports = KeyPaging; -},{"./Feature.js":64}],67:[function(require,module,exports){ +},{"./Feature.js":63}],66:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21347,7 +21368,7 @@ var OnHover = Feature.extend('OnHover', { module.exports = OnHover; -},{"./Feature.js":64}],68:[function(require,module,exports){ +},{"./Feature.js":63}],67:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -21544,7 +21565,7 @@ var Overlay = Feature.extend('Overlay', { module.exports = Overlay; -},{"./Feature.js":64}],69:[function(require,module,exports){ +},{"./Feature.js":63}],68:[function(require,module,exports){ 'use strict'; var ColumnResizing = require('./ColumnResizing'); @@ -21720,7 +21741,7 @@ var RowResizing = ColumnResizing.extend('RowResizing', { module.exports = RowResizing; -},{"./ColumnResizing":61}],70:[function(require,module,exports){ +},{"./ColumnResizing":60}],69:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22234,7 +22255,7 @@ var RowSelection = Feature.extend('RowSelection', { module.exports = RowSelection; -},{"./Feature.js":64}],71:[function(require,module,exports){ +},{"./Feature.js":63}],70:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22275,7 +22296,7 @@ var ThumbwheelScrolling = Feature.extend('ThumbwheelScrolling', { module.exports = ThumbwheelScrolling; -},{"./Feature.js":64}],72:[function(require,module,exports){ +},{"./Feature.js":63}],71:[function(require,module,exports){ 'use strict'; module.exports = { @@ -22296,7 +22317,7 @@ module.exports = { RowSelection: require('./RowSelection'), ThumbwheelScrolling: require('./ThumbwheelScrolling') }; -},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(require,module,exports){ +},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(require,module,exports){ // polyfills copied verbatim from developer.mozilla.org /* eslint-disable no-extend-native */ @@ -22327,7 +22348,7 @@ if (!Array.prototype.find) { }; } -},{}],74:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ 'use strict'; var cssInjector = require('css-injector'); @@ -22383,5 +22404,5 @@ function addStylesheet(key, referenceElement) { module.exports = addStylesheet; -},{"css-injector":2}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YXNlIDE6XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMgPSBleHRlbmRlZENsYXNzTmFtZTtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgcHJvdG90eXBlQWRkaXRpb25zICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdTaW5nbGUgcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgb2JqZWN0Lic7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBleHRlbmRlZENsYXNzTmFtZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dGVuZGVkQ2xhc3NOYW1lICE9PSAnc3RyaW5nJyB8fCB0eXBlb2YgcHJvdG90eXBlQWRkaXRpb25zICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdUd28gcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgc3RyaW5nLCBvYmplY3QuJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgJ1RvbyBtYW55IHBhcmFtZXRlcnMnO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIENvbnN0cnVjdG9yKCkge1xuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnByZUluaXRpYWxpemUpIHtcbiAgICAgICAgICAgIHByb3RvdHlwZUFkZGl0aW9ucy5wcmVJbml0aWFsaXplLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgIH1cblxuICAgICAgICBpbml0aWFsaXplUHJvdG90eXBlQ2hhaW4uYXBwbHkodGhpcywgYXJndW1lbnRzKTtcblxuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnBvc3RJbml0aWFsaXplKSB7XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMucG9zdEluaXRpYWxpemUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIENvbnN0cnVjdG9yLmV4dGVuZCA9IGV4dGVuZDtcblxuICAgIHZhciBwcm90b3R5cGUgPSBDb25zdHJ1Y3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHRoaXMucHJvdG90eXBlKTtcbiAgICBwcm90b3R5cGUuY29uc3RydWN0b3IgPSBDb25zdHJ1Y3RvcjtcblxuICAgIGlmIChleHRlbmRlZENsYXNzTmFtZSAmJiBleHRlbmQuZGVidWcpIHtcbiAgICAgICAgcHJvdG90eXBlLiQkQ0xBU1NfTkFNRSA9IGV4dGVuZGVkQ2xhc3NOYW1lO1xuICAgIH1cblxuICAgIGZvciAodmFyIGtleSBpbiBwcm90b3R5cGVBZGRpdGlvbnMpIHtcbiAgICAgICAgaWYgKHByb3RvdHlwZUFkZGl0aW9ucy5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBwcm90b3R5cGVBZGRpdGlvbnNba2V5XTtcbiAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSAnaW5pdGlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWxpYXNdLCBhbGlhcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycgJiYgdmFsdWVbMF0gPT09ICcjJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFrZUFsaWFzKHZhbHVlLCBrZXkuc3Vic3RyKDEpKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZVtrZXldID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBDb25zdHJ1Y3RvcjtcblxuICAgIGZ1bmN0aW9uIG1ha2VBbGlhcyh2YWx1ZSwga2V5KSB7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tc2hhZG93XG4gICAgICAgIHByb3RvdHlwZVtrZXldID0gcHJvdG90eXBlQWRkaXRpb25zW3ZhbHVlXTtcbiAgICB9XG59XG5cbmV4dGVuZC5CYXNlID0gZnVuY3Rpb24gKCkge307XG5leHRlbmQuQmFzZS5leHRlbmQgPSBleHRlbmQ7XG5cbi8qKiBAdHlwZWRlZiB7ZnVuY3Rpb259IGV4dGVuZGVkQ29uc3RydWN0b3JcbiAqIEBwcm9wZXJ0eSBwcm90b3R5cGUuc3VwZXIgLSBBIHJlZmVyZW5jZSB0byB0aGUgcHJvdG90eXBlIHRoaXMgY29uc3RydWN0b3Igd2FzIGV4dGVuZGVkIGZyb20uXG4gKiBAcHJvcGVydHkgW2V4dGVuZF0gLSBJZiBgcHJvdG90eXBlQWRkaXRpb25zLmV4dGVuZGFibGVgIHdhcyB0cnV0aHksIHRoaXMgd2lsbCBiZSBhIHJlZmVyZW5jZSB0byB7QGxpb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Jhci5hcHBlbmRDaGlsZCh0aHVtYik7XG4gICAgaWYgKHRoaXMucGFnaW5nKSB7XG4gICAgICAgIGJhci5vbmNsaWNrID0gYm91bmQub25jbGljaztcbiAgICB9XG4gICAgdGhpcy5iYXIgPSBiYXI7XG5cbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgIC8vIHByZXNldHNcbiAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIEZpbkJh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HN0eWxlcykge1xuICAgICAgICB2YXIga2V5cyA9IE9iamVjdC5rZXlzKHN0eWxlcyA9IGV4dGVuZCh7fSwgc3R5bGVzLCB0aGlzLl9hdXhTdHlsZXMpKTtcblxuICAgICAgICBpZiAoa2V5cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHZhciBiYXIgPSB0aGlzLmJhcixcbiAgICAgICAgICAgICAgICBiYXJSZWN0ID0gYmFyLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IHRoaXMuY29udGFpbmVyIHx8IGJhci5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lclJlY3QgPSBjb250YWluZXIuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksXG4gICAgICAgICAgICAgICAgb2ggPSB0aGlzLm9oO1xuXG4gICAgICAgICAgICAvLyBCZWZvcmUgYXBwbHlpbmcgbmV3IHN0eWxlcywgcmV2ZXJ0IGFsbCBzdHlsZXMgdG8gdmFsdWVzIGluaGVyaXRlZCBmcm9tIHN0eWxlc2hlZXRzXG4gICAgICAgICAgICBiYXIucmVtb3ZlQXR0cmlidXRlKCdzdHlsZScpO1xuXG4gICAgICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4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m9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uY2hhbmdlID09PSB0aGlzLnNjcm9sbFJlYWxDb250ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lclNpemUgPSBjb250YWluZXJSZWN0W3RoaXMub2guc2l6ZV07XG4gICAgICAgICAgICB0aGlzLmluY3JlbWVudCA9IHRoaXMuY29udGFpbmVyU2l6ZSAvICh0aGlzLmNvbnRlbnRTaXplIC0gdGhpcy5jb250YWluZXJTaXplKSAqICh0aGlzLl9tYXggLSB0aGlzLl9taW4pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jb250YWluZXJTaXplID0gMTtcbiAgICAgICAgICAgIHRoaXMuaW5jcmVtZW50ID0gaW5jcmVtZW50IHx8IHRoaXMuaW5jcmVtZW50O1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGluZGV4ID0gdGhpcy5pbmRleDtcbiAgICAgICAgdGhpcy50ZXN0UGFuZWxJdGVtID0gdGhpcy50ZXN0UGFuZWxJdGVtIHx8IHRoaXMuX2FkZFRlc3RQYW5lbEl0ZW0oKTtcbiAgICAgICAgdGhpcy5fc2V0VGh1bWJTaXplKCk7XG4gICAgICAgIHRoaXMuaW5kZXggPSBpbmRleDtcblxuICAgICAgICBpZiAodGhpcy5kZWx0YVByb3AgIT09IG51bGwpIHtcbiAgICAgICAgICAgIGNvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCd3aGVlbCcsIHRoaXMuX2JvdW5kLm9ud2hlZWwpO1xuICAgICAgICB9XG5cbiAgICAgICAg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6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6ICAgICAgICAgICAnd2lkdGgnLFxuICAgICAgICBvdXRzaWRlOiAgICAgICAgJ2JvdHRvbScsXG4gICAgICAgIGluc2lkZTogICAgICAgICAndG9wJyxcbiAgICAgICAgbGVhZGluZzogICAgICAgICdsZWZ0JyxcbiAgICAgICAgdHJhaWxpbmc6ICAgICAgICdyaWdodCcsXG4gICAgICAgIG1hcmdpbkxlYWRpbmc6ICAnbWFyZ2luTGVmdCcsXG4gICAgICAgIG1hcmdpblRyYWlsaW5nOiAnbWFyZ2luUmlnaHQnLFxuICAgICAgICB0aGlja25lc3M6ICAgICAgJ2hlaWdodCcsXG4gICAgICAgIGRlbHRhOiAgICAgICAgICAnZGVsdGFYJ1xuICAgIH1cbn07XG5cbnZhciBheGlzID0ge1xuICAgIHRvcDogICAgJ3ZlcnRpY2FsJyxcbiAgICBib3R0b206ICd2ZXJ0aWNhbCcsXG4gICAgaGVpZ2h0OiAndmVydGljYWwnLFxuICAgIGxlZnQ6ICAgJ2hvcml6b250YWwnLFxuICAgIHJpZ2h0OiAgJ2hvcml6b250YWwnLFxuICAgIHdpZHRoOiAgJ2hvcml6b250YWw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B9XG4gICAgICAgIHZhciBpbnRlcnZhbCA9IDEwMDAgLyBmcHM7XG5cbiAgICAgICAgdmFyIGVsYXBzZWQgPSBub3cgLSB0aGlzLmxhc3RSZXBhaW50VGltZTtcbiAgICAgICAgaWYgKGVsYXBzZWQgPiBpbnRlcnZhbCAmJiB0aGlzLmRpcnR5KSB7XG4gICAgICAgICAgICB0aGlzLmxhc3RSZXBhaW50VGltZSA9IG5vdyAtIChlbGFwc2VkICUgaW50ZXJ2YWwpO1xuICAgICAgICAgICAgdGhpcy5wYWludE5vdygpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIGJlZ2luUGFpbnRpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMuZGlydHkgPSB0cnVlO1xuICAgICAgICB0aGlzLnRpY2tQYWludGVyID0gZnVuY3Rpb24obm93KSB7XG4gICAgICAgICAgICBzZWxmLnRpY2tQYWludChub3cpO1xuICAgICAgICB9O1xuICAgICAgICBwYWludGFibGVzLnB1c2godGhpcyk7XG4gICAgfSxcblxuICAgIHN0b3BQYWludGluZzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHBhaW50YWJsZXMuc3BsaWNlKHBhaW50YWJsZXMuaW5kZXhPZih0aGlzKSwgMSk7XG4gICAgfSxcblxuICAgIGJlZ2luUmVzaXppbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMudGlja1Jlc2l6ZXIgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuY2hlY2tzaXplKCk7XG4gICAgICAgIH07XG4gICAgICAgIHJlc2l6YWJsZXMucHVzaCh0aGlzKTtcbiAgICB9LFxuXG4gICAgc3RvcFJlc2l6aW5nOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmVzaXphYmxlcy5zcGxpY2UocmVzaXphYmxlcy5pbmRleE9mKHRoaXMpLCAxKT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ICAgIHZhciBjb21wID0gdGhpcy5fY29tcG9uZW50O1xuICAgICAgICBpZiAoY29tcCkge1xuICAgICAgICAgICAgY29tcC5zZXRCb3VuZHModGhpcy5ib3VuZHMpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucmVzaXplTm90aWZpY2F0aW9uKCk7XG4gICAgICAgIHRoaXMucGFpbnROb3coKTtcbiAgICAgICAgLy99KTtcbiAgICB9LFxuXG4gICAgcmVzaXplTm90aWZpY2F0aW9uOiBmdW5jdGlvbigpIHtcbiAgICAgICAgLy90byBiZSBvdmVycmlkZGVuXG4gICAgfSxcblxuICAgIGdldEJvdW5kczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmJvdW5kcztcbiAgICB9LFxuXG4gICAgcGFpbnROb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMuc2FmZVBhaW50SW1tZWRpYXRlbHkoZnVuY3Rpb24oZ2MpIHtcbiAgICAgICAgICAgIGdjLmNsZWFyUmVjdCgwLCAwLCBzZWxmLmNhbnZhcy53aWR0aCwgc2VsZi5jYW52YXMuaGVpZ2h0KTtcblxuICAgICAgICAgICAgdmFyIGNvbXAgPSBzZWxmLl9jb21wb25lbnQ7XG4gICAgICAgICAgICBpZiAoY29tcCkge1xuICAgICAgICAgICAgICAgIGNvbXAuX3BhaW50KGdjKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc2VsZi5kaXJ0eSA9IGZhbHNlO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgc2FmZVBhaW50SW1tZWRpYXRlbHk6IGZ1bmN0aW9uKHBhaW50RnVuY3Rpb24pIHtcbiAgICAgICAgdmFyIHVzZUJpdEJsaXQgPSB0aGlzLnVzZUJpdEJsaXQoKSxcbiAgICAgICAgICAgIGdjID0gdXNlQml0QmxpdCA/IHRoaXMuYnVmZmVyR0MgOiB0aGlzLmdjO1xuICAgICA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XRpb24pKSB7XG4gICAgICAgICAgICB0aGlzLmRpc3BhdGNoTmV3TW91c2VLZXlzRXZlbnQoZSwgJ2Zpbi1jYW52YXMtbW91c2Vtb3ZlJyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgZmlubW91c2Vkb3duOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHRoaXMubW91c2VMb2NhdGlvbiA9IHRoaXMuZ2V0TG9jYWwoZSk7XG4gICAgICAgIHRoaXMubW91c2Vkb3duID0gdHJ1ZTtcblxuICAgICAgICB0aGlzLmRpc3BhdGNoTmV3TW91c2VLZXlzRXZlbnQoZSwgJ2Zpbi1jYW52YXMtbW91c2Vkb3duJywge1xuICAgICAgICAgICAgaXNSaWdodENsaWNrOiB0aGlzLmlzUmlnaHRDbGljayhlKVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy50YWtlRm9jdXMoKTtcbiAgICB9LFxuXG4gICAgZmlubW91c2V1cDogZnVuY3Rpb24oZSkge1xuICAgICAgICBpZiAodGhpcy5pc0RyYWdnaW5nKCkpIHtcbiAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdNb3VzZUtleXNFdmVudChlLCAnZmluLWNhbnZhcy1kcmFnZW5kJywge1xuICAgICAgICAgICAgICAgIGRyYWdzdGFydDogdGhpcy5kcmFnc3RhcnQsXG4gICAgICAgICAgICAgICAgaXNSaWdodENsaWNrOiB0aGlzLmlzUmlnaHRDbGljayhlKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLmJlTm90RHJhZ2dpbmcoKTtcbiAgICAgICAgICAgIHRoaXMuZHJhZ0VuZHRpbWUgPSBEYXRlLm5vdygpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMubW91c2Vkb3duID0gZmFsc2U7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdNb3VzZUtleXNFdmVudChlLCAnZmluLWNhbnZhcy1tb3VzZXVwJywge1xuICAgICAgICAgICAgaXNSaWdodENsa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1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgZmludGFwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIC8vdGhpcyBub25zZW5zZSBpcyB0byBob2xkIGEgdGFwIGlmIGl0J3MgcmVhbGx5IGEgZG91YmxlIGNsaWNrXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIG5vdyA9IERhdGUubm93KCk7XG4gICAgICAgIHZhciBkaWYgPSBub3cgLSB0aGlzLmxhc3REb3VibGVDbGlja1RpbWU7XG4gICAgICAgIGlmIChkaWYgPCAzMDApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICAvL2RyYWdlbmQgaXMgYWxzbyBjYXVzaW5nIGEgdGFwXG4gICAgICAgIC8vbGV0cyBmaXggdGhpcyBoZXJlXG4gICAgICAgIGlmIChub3cgLSB0aGlzLmRyYWdFbmR0aW1lIDwgMTAwKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuX2ZpbnRhcChlKTtcbiAgICAgICAgfSwgMTgwKTtcbiAgICB9LFxuXG4gICAgX2ZpbnRhcDogZnVuY3Rpb24oZSkge1xuICAgICAgICAvL3RoaXMgbm9uc2Vuc2UgaXMgdG8gaG9sZCBhIHRhcCBpZiBpdCdzIHJlYWxseSBhIGRvdWJsZSBjbGlja1xuICAgICAgICB2YXIgbm93ID0gRGF0ZS5ub3coKTtcbiAgICAgICAgdmFyIGRpZiA9IG5vdyAtIHRoaXMubGFzdERvdWJsZUNsaWNrVGltZTtcbiAgICAgICAgaWYgKGRpZiA8IDMwMCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIC8vdGhpcy5tb3VzZUxvY2F0aW9uID0gdGhpcy5nZXRMb2NhbChlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld01vdX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biAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5zcGxpY2UodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpLCAxKTtcbiAgICAgICAgaWYgKCF0aGlzLmhhc0ZvY3VzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgdGhpcy5yZXBlYXRLZXkgPSBudWxsO1xuICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IDA7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1rZXl1cCcsIHtcbiAgICAgICAgICAgIGFsdDogZS5hbHRLZXksXG4gICAgICAgICAgICBjdHJsOiBlLmN0cmxLZXksXG4gICAgICAgICAgICBjaGFyOiBrZXlDaGFyLFxuICAgICAgICAgICAgY29kZTogZS5jaGFyQ29kZSxcbiAgICAgICAgICAgIGtleTogZS5rZXlDb2RlLFxuICAgICAgICAgICAgbWV0YTogZS5tZXRhS2V5LFxuICAgICAgICAgICAgcmVwZWF0OiBlLnJlcGVhdCxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfS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wZW9mIGdjW2tleV0gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHNlbGZba2V5XSA9ICFsb2dnZXIgPyBnY1trZXldLmJpbmQoZ2MpIDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvZ2dlcihrZXksIGFyZ3VtZW50cywgZ2Nba2V5XS5hcHBseShnYywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ2VyKGtleSwgJ2dldHRlcicsIHJlc3VsdCkgOiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGdjW2tleV0gPSBsb2dnZXIgPyBsb2dnZXIoa2V5LCAnc2V0dGVyJywgdmFsdWUpIDogdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gR3JhcGhpY3NDb250ZXh0O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgWUlFTERTID0gJ1xcdTI3RjknOyAvLyBMT05HIFJJR0hUV0FSRFMgRE9VQkxFIEFSUk9XXG5cbmZ1bmN0aW9uIGNvbnNvbGVMb2dnZXIocHJlZml4LCBuYW1lLCBhcmdzLCB2YWx1ZSkge1xuICAgIHZhciByZXN1bHQgPSB2YWx1ZTtcblxuICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnKSB7XG4gICA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IHZhciBzID0gdGhpcy5zaGFkb3coaW5FbCk7XG4gICAgICAgICAgICBpZiAodGhpcy5jYW5UYXJnZXQocykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgb2xkZXJTaGFkb3c6IGZ1bmN0aW9uKHNoYWRvdykge1xuICAgICAgICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc2NvcGUudGFyZ2V0RmluZGluZyA9IHRhcmdldDtcbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBldmVudCwgZmluZHMgdGhlIFwiZGVlcGVzdFwiIG5vZGUgdGhhdCBjb3VsZCBoYXZlIGJlZW4gdGhlIG9yaWdpbmFsIHRhcmdldCBiZWZvcmUgU2hhZG93RE9NIHJldGFyZ2V0dGluZ1xuICAgICAqXG4gICAgICogQHBhcmFtIHtFdmVudH0gRXZlbnQgQW4gZXZlbnQgb2JqZWN0IHdpdGggY2xpZW50WCBhbmQgY2xpZW50WSBwcm9wZXJ0aWVzXG4gICAgICogQHJldHVybiB7RWxlbWVudH0gVGhlIHByb2JhYmxlIGV2ZW50IG9yaWduaW5hdG9yXG4gICAgICovXG4gICAgc2NvcGUuZmluZFRhcmdldCA9IHRhcmdldC5maW5kVGFyZ2V0LmJpbmQodGFyZ2V0KTtcbiAgICAvKipcbiAgICAgKiBEZXRlcm1pbmVzIGlmIHRoZSBcImNvbnRhaW5lclwiIG5vZGUgZGVlcGx5IGNvbnRhaW5zIHRoZ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Fkb3cgc2VsZWN0b3JzIGlmIHNoYWRvd2RvbSBpcyBzdXBwb3J0ZWRcbiAgICB2YXIgaGFzU2hhZG93Um9vdCA9ICF3aW5kb3cuU2hhZG93RE9NUG9seWZpbGwgJiYgZG9jdW1lbnQuaGVhZC5jcmVhdGVTaGFkb3dSb290O1xuXG4gICAgaWYgKGhhc1RvdWNoQWN0aW9uKSB7XG4gICAgICAgIGF0dHJpYjJjc3MuZm9yRWFjaChmdW5jdGlvbihyKSB7XG4gICAgICAgICAgICBpZiAoU3RyaW5nKHIpID09PSByKSB7XG4gICAgICAgICAgICAgICAgc3R5bGVzICs9IHNlbGVjdG9yKHIpICsgcnVsZShyKSArICdcXG4nO1xuICAgICAgICAgICAgICAgIGlmIChoYXNTaGFkb3dSb290KSB7XG4gICAgICAgICAgICAgICAgICAgIHN0eWxlcyArPSBzaGFkb3dTZWxlY3RvcihyKSArIHJ1bGUocikgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0eWxlcyArPSByLnNlbGVjdG9ycy5tYXAoc2VsZWN0b3IpICsgcnVsZShyLnJ1bGUpICsgJ1xcbic7XG4gICAgICAgICAgICAgICAgaWYgKGhhc1NoYWRvd1Jvb3QpIHtcbiAgICAgICAgICAgICAgICAgICAgc3R5bGVzICs9IHIuc2VsZWN0b3JzLm1hcChzaGFkb3dTZWxlY3RvcikgKyBydWxlKHIucnVsZSkgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHZhciBlbCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7XG4gICAgICAgIGVsLnRleHRDb250ZW50ID0gc3R5bGVzO1xuICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGVsKTtcbiAgICB9XG59KSgpO1xuXG4vKipcbiAqIFRoaXMgaXMg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ICAgICdidXR0b24nLFxuICAgICAgICAncmVsYXRlZFRhcmdldCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWSdcbiAgICBdO1xuXG4gICAgdmFyIE1PVVNFX0RFRkFVTFRTID0gW1xuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIG51bGwsXG4gICAgICAgIG51bGwsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICAwLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwXG4gICAgXTtcblxuICAgIHZhciBOT1BfRkFDVE9SWSA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7fTtcbiAgICB9O1xuXG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHtcbiAgICAgICAgLy8gVE9ETyhkZnJlZWRtKTogdGhpcyBpcyBvdmVycmlkZGVuIGJ5IHRhcCByZWNvZ25pemVyLCBuZWVkcyByZXZpZXdcbiAgICAgICAgcHJldmVudFRhcDogTk9QX0ZBQ1RPUlksXG4gICAgICAgIG1ha2VCYXNlRXZlbnQ6IGZ1bmN0aW9uKGluVHlwZSwgaW5EaWN0KSB7XG4gICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdFdmVudCcpO1xuICAgICAgICAgICAgZS5pbml0RXZlbnQoaW5UeXBlLCBpbkRpY3QuYnViYmxlcyB8fCBmYWxzZSwgaW5EaWN0LmNhbmNlbGFibGUgfHwgZmFsc2UpO1xuICAgICAgICAgICAgZS5wcmV2ZW50VGFwID0gZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAoZSk7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZUdlc3R1cmVFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgfHwgJyc7XG4gICAgICAgICA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IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEFTX1NWR19JTlNUQU5DRSA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AgICByZXF1aXJlZEdlc3R1cmVzOiBuZXcgc2NvcGUuUG9pbnRlck1hcCgpLFxuICAgICAgICBldmVudE1hcDogT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgLy8gU2NvcGUgb2JqZWN0cyBmb3IgbmF0aXZlIGV2ZW50cy5cbiAgICAgICAgLy8gVGhpcyBleGlzdHMgZm9yIGVhc2Ugb2YgdGVzdGluZy5cbiAgICAgICAgZXZlbnRTb3VyY2VzOiBPYmplY3QuY3JlYXRlKG51bGwpLFxuICAgICAgICBldmVudFNvdXJjZUxpc3Q6IFtdLFxuICAgICAgICBnZXN0dXJlczogW10sXG4gICAgICAgIC8vIG1hcCBnZXN0dXJlIGV2ZW50IC0+IHtsaXN0ZW5lcnM6IGludCwgaW5kZXg6IGdlc3R1cmVzW2ludF19XG4gICAgICAgIGRlcGVuZGVuY3lNYXA6IHtcbiAgICAgICAgICAgIC8vIG1ha2Ugc3VyZSBkb3duIGFuZCB1cCBhcmUgaW4gdGhlIG1hcCB0byB0cmlnZ2VyIFwicmVnaXN0ZXJcIlxuICAgICAgICAgICAgZG93bjoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB1cDoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVF1ZXVlOiBbXSxcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEFkZCBhIG5ldyBldmVudCBzb3VyY2UgdGhhdCB3aWxsIGdlbmVyYXRlIHBvaW50ZXIgZXZlbnRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBgaW5Tb3VyY2VgIG11c3QgY29udGFpbiBhbiBhcnJheSBvZiBldmVudCBuYW1lcyBuYW1lZCBgZXZlbnRzYCwgYW5kXG4gICAgICAgICAqIGZ1bmN0aW9ucyB3aXRoIHRoZSBuYW1lcyBzcGVjaWZpZWQgaW4gdGhlIGBldmVudHNgIGFycmF5LlxuICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSBBIG5hbWUgZm9yIHRoZSBldmVudCBzb3VyY2VcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBBIG5ldyBzb3VyY2Ugb2YgcGxhdGZvcm0gZXZlbnRzLlxuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJTb3VyY2U6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIHMgPSBzb3VyY2U7XG4gICAgICAgICAgICB2YXIgbmV3RXZlbnRzID0gcy5ldmVudHM7XG4gICAgICAgICAgICBpZiAobmV3RXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIGVsZW1lbnQpO1xuICAgICA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CA9IG5vZGUuX3BnRXZlbnRzO1xuICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkICYmIGN1cnJlbnRHZXN0dXJlcykge1xuICAgICAgICAgICAgICAgIHZhciBnayA9IE9iamVjdC5rZXlzKGdlc3R1cmVzV2FudGVkKTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciwgcmksIGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBMSVNURU5FUiBMT0dJQ1xuICAgICAgICBldmVudEhhbmRsZXI6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgdXNlZCB0byBwcmV2ZW50IG11bHRpcGxlIGRpc3BhdGNoIG9mIGV2ZW50cyBmcm9tXG4gICAgICAgICAgICAvLyBwbGF0Zm9ybSBldmVudHMuIFRoaXMgY2FuIGhhcHBlbiB3aGVuIHR3byBlbGVtZW50cyBpbiBkaWZmZXJlbnQgc2NvcGVzXG4gICAgICAgICAgICAvLyBhcmUgc2V0IHVwIHRvIGNyZWF0ZSBwb2ludGVyIGV2ZW50cywgd2hpY2ggaXMgcmVsZXZhbnQgdG8gU2hhZG93IERPTS5cblxuICAgICAgICAgICAgdmFyIHR5cGUgPSBpbkV2ZW50LnR5cGU7XG5cbiAgICAgICAgICAgIC8vIG9ubHkgZ2VuZXJhdGUgdGhlIGxpc3Qgb2YgZGVzaXJlZCBldmVudHMgb24gXCJkb3duXCJcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ21vdXNlZG93bicgfHwgdHlwZSA9PT0gJ3BvaW50ZXJkb3duJyB8fCB0eXBlID09PSAnTVNQb2ludGVyRG93bicpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWluRXZlbnQuX2hhbmRsZWRCeVBHKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlcyA9IHt9O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGluIElPUyBtb2RlLCB0aGVyZSBpcyBvbmx5IGEgbGlzdGVuZXIgb24gdGhlIGRvY3VtZW50LCBzbyB0aGlzIGlzIG5vdCByZS1lbnRyYW50XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdmUgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIHVubGlzdGVuOiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50cykge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBldmVudHMubGVuZ3RoLCBlO1xuICAgICAgICAgICAgICAgIChpIDwgbCkgJiYgKGUgPSBldmVudHNbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUV2ZW50KHRhcmdldCwgZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LmFkZEV2ZW50TGlzdGVuZXIoZXZlbnROYW1lLCB0aGlzLmJvdW5kSGFuZGxlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHJlbW92ZUV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LnJlbW92ZUV2ZW50TGlzdGVuZXIoZXZlbnROYW1lLCB0aGlz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IC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAgICAgIH0sXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBEaXNwYXRjaGVzIHRoZSBldmVudCB0byBpdHMgdGFyZ2V0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IFRoZSBldmVudCB0byBiZSBkaXNwYXRjaGVkLlxuICAgICAgICAgKiBAcmV0dXJuIHtCb29sZWFufSBUcnVlIGlmIGFuIGV2ZW50IGhhbmRsZXIgcmV0dXJucyB0cnVlLCBmYWxzZSBvdGhlcndpc2UuXG4gICAgICAgICAqL1xuICAgICAgICBkaXNwYXRjaEV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuX3RhcmdldDtcbiAgICAgICAgICAgIGlmICh0KSB7XG4gICAgICAgICAgICAgICAgdC5kaXNwYXRjaEV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIC8vIGNsb25lIHRoZSBldmVudCBmb3IgdGhlIGdlc3R1cmUgc3lzdGVtIHRvIHByb2Nlc3NcbiAgICAgICAgICAgICAgICAvLyBjbG9uZSBhZnRlciBkaXNwYXRjaCB0byBwaWNrIHVwIGdlc3R1cmUgcHJldmVudGlvbiBjb2RlXG4gICAgICAgICAgICAgICAgdmFyIGNsb25lID0gdGhpcy5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGNsb25lLnRhcmdldCA9IHQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maWxsR2VzdHVyZVF1ZXVlKGNsb25lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVRyaWdnZXI6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgLy8gcHJvY2VzcyB0aGUgZ2VzdHVyZSBxdWV1ZVxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGUsIHJnOyBpIDwgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLmNhbGwoZywgZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgZmlsbEdlc3R1cmVRdWV1ZTogZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgICAgIC8vIG9ubHkgdHJpZ2dlciB0aGUgZ2VzdHVyZSBxdWV1ZSBvbmNlXG4gICAgICAgICAgICBpZiAoIXRoaXMuZ2VzdHVyZVF1ZXVlLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZSh0aGlzLmJvdW5kR2VzdHVyZVRyaWdnZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXYuX3JlcXVpcmVkR2VzdHVyZXMgPSB0aGlzLnJlcXVpcmVkR2VzdHVyZXMuZ2V0KGV2LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICB0aGlzLmdlc3R1cmVRdWV1ZS5wdXNoKGV2KTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgZGlzcGF0Y2hlci5ib3VuZEhhbmRsZXIgPSBkaXNwYXRjaGVyLmV2ZW50SGFuZGxlci5iaW5kKGRpc3BhdGNoZXIpO1xuICAgIGRpc3BhdGNoZXIuYm91bmRHZXN0dXJlVHJpZ2dlciA9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WVwaW5nIHRvIGF2b2lkIHVzaW5nIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgIGlmIChyZWNvZ25pemVyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gcmVjb2duaXplci5kZWZhdWx0QWN0aW9ucyAmJiByZWNvZ25pemVyLmRlZmF1bHRBY3Rpb25zW2ddO1xuICAgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW50cykge1xuICAgICAgICAgICAg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AqXG4gICAgICogQHBhcmFtIHtFbGVtZW50fSBub2RlXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGdlc3R1cmVcbiAgICAgKiBAcmV0dXJuIEJvb2xlYW4gYGdlc3R1cmVgIGlzIGEgdmFsaWQgZ2VzdHVyZVxuICAgICAqL1xuICAgIHNjb3BlLmRlYWN0aXZhdGVHZXN0dXJlID0gZnVuY3Rpb24obm9kZSwgZ2VzdHVyZSkge1xuICAgICAgICB2YXIgZyA9IGdlc3R1cmUudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgdmFyIGRlcCA9IGRpc3BhdGNoZXIuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgaWYgKGRlcCkge1xuICAgICAgICAgICAgaWYgKG5vZGUuX3BnTGlzdGVuZXJzID4gMCkge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzLS07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdMaXN0ZW5lcnMgPT09IDApIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnVucmVnaXN0ZXIobm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHMpIHtcbiAgICAgICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHNbZ10gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzW2ddLS07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZS5fcGdFdmVudHNbZ10gPSAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gQm9vbGVhbihkZXApO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBTdG9wIGxpc3RlbmluZyBmb3IgYGdlc3R1cmVgIGZyb20gYG5vZGVgIHdpdGggYGhhbmRsZXJgIGZ1bmN0aW9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zIGZvciBtb3VzZXVwLmJ1dHRvbnNcbiAgICAgICAgLy8gaHR0cHM6Ly9kZXZlbG9wZXIubW96aWxsYS5vcmcvZW4tVVMvZG9jcy9XZWIvQVBJL01vdXNlRXZlbnQuYnV0dG9ucyNTZWVfYWxzb1xuICAgICAgICAvLyBodHRwczovL2NvZGVyZXZpZXcuY2hyb21pdW0ub3JnLzcyNzU5MzAwMy8jbXNnMTZcbiAgICAgICAgaWYgKEZJUkVGT1hfTElOVVgudGVzdChuYXZpZ2F0b3IudXNlckFnZW50KSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IE1vdXNlRXZlbnQoJ3Rlc3QnLCB7XG4gICAgICAgICAgICAgICAgYnV0dG9uczogMVxuICAgICAgICAgICAgfSkuYnV0dG9ucyA9PT0gMTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfSkoKTtcblxuICAgIC8vIGhhbmRsZXIgYmxvY2sgZm9yIG5hdGl2ZSBtb3VzZSBldmVudHNcbiAgICB2YXIgbW91c2VFdmVudHMgPSB7XG4gICAgICAgIFBPSU5URVJfSUQ6IDEsXG4gICAgICAgIFBPSU5URVJfVFlQRTogJ21vdXNlJyxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnbW91c2Vkb3duJyxcbiAgICAgICAgICAgICdtb3VzZW1vdmUnLFxuICAgICAgICAgICAgJ21vdXNldXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saX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G4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KHRoaXMuUE9JTlRFUl9JRCk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjbGVhbnVwTW91c2U6IGZ1bmN0aW9uKGJ1dHRvbnMpIHtcbiAgICAgICAgICAgIGlmIChidXR0b25zID09PSAwKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUodGhpcy5QT0lOVEVSX0lEKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tb3VzZUV2ZW50cyA9IG1vdXNlRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjt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wnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TID8gaW5pdGlhbCA6ICFpbml0aWFsKSB7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLklTX0lPUykge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB2YXIgY3RlID0gdGhpcy5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BPSU5URVJfVFlQRTtcbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICd0b3VjaCc7XG4gICAgICAgICAgICAvLyBmb3J3YXJkIHRvdWNoIHByZXZlbnREZWZhdWx0c1xuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgc2VsZi5maXJzdFhZID0gbnVsbDtcbiAgICAgICAgICAgICAgICBjdGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcHJvY2Vzc1RvdWNoZXM6IGZ1bmN0aW9uKGluRXZlbnQsIGluRnVuY3Rpb24pIHtcbiAgICAgICAgICAgIHZhciB0bCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXM7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50ID0gaW5FdmVudDtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCB0LCBwOyBpIDwgdGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gRm9yIHNpbmdsZSBheGlzIHNjcm9sbGVycywgZGV0ZXJtaW5lcyB3aGV0aGVyIHRoZSBlbGVtZW50IHNob3VsZCBlbWl0XG4gICAgICAgIC8vIHBvaW50ZXIgZXZlbnRzIG9yIGJlaGF2ZSBhcyBhIHNjcm9sbGVyXG4gICAgICAgIHNob3VsZFNjcm9sbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQ7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gc2NvcGUudGFyZ2V0RmluZGluZy5maW5kVG91Y2hBY3Rpb24oaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgdmFyIHNjcm9sbEF4aXMgPSB0aGlzLnRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlKHRvdWNoQWN0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsQXhpcyA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgZWxlbWVudCBpcyBhIHRvdWNoLWFjdGlvbjogbm9uZSwgc2hvdWxkIG5ldmVyIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICByZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNjcm9sbEF4aXMgPT09ICdYWScpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBlbGVtZW50IHNob3VsZCBhbHdheXMgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayB0aGUgaW50ZW5kZWQgc2Nyb2xsIGF4aXMsIGFuZCBvdGhlciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvLyBtYWtpbmcgZXZlbnRzXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IGRhID49IGRvYTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoOiBmdW5jdGlvbihpblRMLCBpbklkKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGluVEwubGVuZ3RoLCB0OyBpIDwgbCAmJiAodCA9IGluVExbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAodC5pZGVudGlmaWVyID09PSBpbklkKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO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lLlxuICAgICAgICAgICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBhcmUgMiBzbWFsbGVyIHRoYW4gdGhlaXIgcG9pbnRlcklkLCB3aGljaCBpcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXggaW4gcG9pbnRlcm1hcC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5Qb2ludGVyKSB7XG4gIC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yeVRvdWNoKHQpKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVtZW1iZXIgeC95IG9mIGxhc3QgdG91Y2hcbiAgICAgICAgICAgICAgICB2YXIgbHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIHg6IHQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogdC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KS5iaW5kKG51bGwsIGx0cywgbHQpO1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZm4sIERFRFVQX1RJTUVPVVQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHByZXZlbnQgXCJnaG9zdCBjbGlja3NcIiB0aGF0IGNvbWUgZnJvbSBlbGVtZW50cyB0aGF0IHdlcmUgcmVtb3ZlZCBpbiBhIHRvdWNoIGhhbmRsZXJcbiAgICB2YXIgU1RPUF9QUk9QX0ZOID0gRXZlbnQucHJvdG90eXBlLnN0b3BJbW1lZGlhdGVQcm9wYWdhdGlvbiB8fCBFdmVudC5wcm90b3R5cGUuc3RvcFByb3BhZ2F0aW9uO1xuICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgdmFyIHggPSBldi5jbGllbnRYLFxuICAgICAgICAgICAgeSA9IGV2LmNsaWVudFk7XG4gICAgICAgIC8vIGNoZWNrIGlm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ICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGV2LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICBTVE9QX1BST1BfRk4uY2FsbChldik7XG4gICAgICAgIH1cbiAgICB9LCB0cnVlKTtcblxuICAgIHNjb3BlLnRvdWNoRXZlbnRzID0gdG91Y2hFdmVudHM7XG59KShleHBvcnRzKTtcblxuKGZ1bmN0aW9uKHNjb3BlKSB7XG4gICAgdmFyIGRpc3BhdGNoZXIgPSBzY29wZS5kaXNwYXRjaGVyO1xuICAgIHZhciBwb2ludGVybWFwID0gZGlzcGF0Y2hlci5wb2ludGVybWFwO1xuICAgIHZhciBIQVNfQklUTUFQX1RZUEUgPSB3aW5kb3cuTVNQb2ludGVyRXZlbnQgJiYgdHlwZW9mIHdpbmRvdy5NU1BvaW50ZXJFdmVudC5NU1BPSU5URVJfVFlQRV9NT1VTRSA9PT0gJ251bWJlcic7XG4gICAgdmFyIG1zRXZlbnRzID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdNU1BvaW50ZXJEb3duJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJNb3ZlJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJVcCcsXG4gICAgICAgICAgICAnTVNQb2ludGVyQ2FuY2VsJyxcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgUE9JTlRFUl9UWVBFUzogW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAndW5hdmFpbGFibGUnLFxuICAgICAgICAgICAgJ3RvdWNoJyxcbiAgICAgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlckNhbmNlbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGUucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGUpO1xuICAgICAgICAgICAgdGhpcy5jbGVhbnV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AgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcmRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGUudGFyZ2V0ID0gdGFyZ2V0O1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcnVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaX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FydFxuICovXG4vKipcbiAqIFRoaXMgZXZlbnQgZmlyZXMgd2hlbiB0aGUgcG9pbnRlciBpcyBubyBsb25nZXIgYmVpbmcgdHJhY2tlZC5cbiAqXG4gKiBAY2xhc3MgdHJhY2tlbmRcbiAqIEBleHRlbmRzIHRyYWNrc3RhcnRcbiAqL1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgZGlzcGF0Y2hlciA9IHNjb3BlLmRpc3BhdGNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRyYWNrID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0cmFja3N0YXJ0JyxcbiAgICAgICAgICAgICd0cmFjaycsXG4gICAgICAgICAgICAndHJhY2t4JyxcbiAgICAgICAgICAgICd0cmFja3knLFxuICAgICAgICAgICAgJ3RyYWNrZW5kJ1xuICAgICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ucGFnZVggPSBpbkV2ZW50LnBhZ2VYO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5zY3JlZW5YID0gaW5FdmVudC5zY3JlZW5YO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54RGlyZWN0aW9uID0gdC54RGlyZWN0aW9uO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGluVHlwZSAhPT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZHkgPSBkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmRkeSA9IGRkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnkgPSBpbkV2ZW50Lnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmNsaWVudFkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnBhZ2VZID0gaW5FdmVudC5wYWdlWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uc2NyZWVuWSA9IGluRXZlbnQuc2NyZWVuWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ueURpcmVjdGlvbiA9IHQueURpcmVjdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBlID0gZXZlbnRGYWN0b3J5Lm1ha2VHZXN0dXJlRXZlbnQoaW5UeXBlLCBnZXN0dXJlUHJvdG8pO1xuICAgICAgICAgICAgdC5kb3duVGFyZ2V0LmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAoaW5FdmVudC5wb2ludGVyVHlwZSA9PT0gJ21vdXNlJyA/IGluRXZlbnQuYnV0dG9ucyA9PT0gMSA6IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICA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RpbmcgYXMgYSBob2xkXG4gICAgICAgIFdJR0dMRV9USFJFU0hPTEQ6IDE2LFxuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdob2xkJyxcbiAgICAgICAgICAgICdob2xkcHVsc2UnLFxuICAgICAgICAgICAgJ3JlbGVhc2UnXG4gICAgICAgIF0sXG4gICAgICAgIGhlbGRQb2ludGVyOiBudWxsLFxuICAgICAgICBob2xkSm9iOiBudWxsLFxuICAgICAgICBwdWxzZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaG9sZCA9IERhdGUubm93KCkgLSB0aGlzLmhlbGRQb2ludGVyLnRpbWVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IHRoaXMuaGVsZFBvaW50ZXIucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgcG9pbnRlcklkOiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCxcbiAgICAgICAgICAgICAgICB4OiB0aGlzLmhlbGRQb2ludGVyLmNsaWVudFgsXG4gICAgICAgICAgICAgICAgeTogdGhpcy5oZWxkUG9pbnRlci5jbGllbnRZLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICdob2xkJ1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICAgICAgcC5ob2xkVGltZSA9IGluSG9sZFRpbWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KGluVHlwZSwgcCk7XG4gICAgICAgICAgICB0aGlzLnRhcmdldC5kaXNwYXRjaEV2ZW50KGUpO1xuICAgICAgICB9XG4gICAgfTtcbiAgICBkaXNwYXRjaGVyLnJlZ2lzdGVyR2VzdHVyZSgnaG9sZCcsIGhvbGQpO1xufSkoZXhwb3J0cyk7XG5cbi8qKlxuICogVGhpcyBldmVudCBpcyBmaXJlZCB3aGVuIGEgcG9pbnRlciBxdWlja2x5IGdvZXMgZG93biBhbmQgdXAsIGFuZCBpcyB1c2VkIHRvXG4gKiBkZW5vdGUgYWN0aXZhdGlvbi5cbiAqXG4gKiBBbnkgZ2VzdHVyZSBldmVudCBjYW4gcHJldmVudCB0aGUgdGFwIGV2ZW50IG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WFyeSAmJiAhaW5FdmVudC50YXBQcmV2ZW50ZWQpIHtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLnNldChpbkV2ZW50LnBvaW50ZXJJZCwge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGluRXZlbnQudGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICBidXR0b25zOiBpbkV2ZW50LmJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZXk6IGluRXZlbnQuY3RybEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFLZXk6IGluRXZlbnQubWV0YUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoaWZ0S2V5OiBpbkV2ZW50LnNoaWZ0S2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgX3NvdXJjZTogJ3RhcCdcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7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XG4gICAgICAgICAgICAncGluY2hlbmQnLFxuICAgICAgICAgICAgJ3JvdGF0ZSdcbiAgICAgICAgXSxcbiAgICAgICAgZGVmYXVsdEFjdGlvbnM6IHtcbiAgICAgICAgICAgICdwaW5jaCc6ICdub25lJyxcbiAgICAgICAgICAgICdyb3RhdGUnOiAnbm9uZSdcbiAgICAgICAgfSxcbiAgICAgICAgcmVmZXJlbmNlOiB7fSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHBvaW50ZXJtYXAucG9pbnRlcnMoKSA9PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG9pbnRzLmEuY2xpZW50WCArIHBvaW50cy5iLmNsaWVudFgpIC8gMjtcbiAgICAgICAgICAgIHkgPSBNYXRoLmFicyhwb2ludHMuYS5jbGllbnRZICsgcG9pbnRzLmIuY2xpZW50WSkgLyAyO1xuICAgICAgICAgICAgcG9pbnRzLmNlbnRlciA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwb2ludHMuZGlhbWV0ZXIgPSBkaXN0O1xuICAgICAgICAgICAgcmV0dXJuIHBvaW50cztcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY0FuZ2xlOiBmdW5jdGlvbihwb2ludHMpIHtcbiAg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G4gICAgICAgICAqIEBkZWZhdWx0IFsnJ11cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaW5kZXggPSBbXTsgLy8gVE9ETzogZm9ybWVybHkgcm93SW5kZXhcblxuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFOb2RlQmFzZS5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhhc0NoaWxkcmVuID0gZmFsc2U7IC8vIFRPRE86IFdoZXJlL2hvdyBpcyB0aGlzIHVzZWQ/XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgICAqIEBkZWZhdWx0IDBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGVwdGggPSAwO1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyfVxuICAgICAgICAgKiBAZGVmYXVsdCAxXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhlaWdodCA9IDE7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAgICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leHBhbmRlZCA9IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVMZWFmLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0VmFsdWU6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVt4XTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlTGVhZi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGVwdGhcbiAgICAgKi9cbiAgICB0b0FycmF5OiBmdW5jdGlvbihkZXB0aCkge1xuICAgICAgICB0aGlzLmRlcHRoID0gZGVwdGg7XG4gICAgICAgIHRoaXMuZGF0YVswXSA9IHRoaXMuY29tcHV0ZURlcHRoU3RyaW5nKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBjb21wdXRlRGVwdGhTdHJpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gQXJyYXkodGhpcy5kZXB0aCArIDEpLmpvaW4odGhpcy5JTkRFTlQpICsgJyAgJyArIHRoaXMubGFiZWw7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBjb21wdXRlSGVpZ2h0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIDE7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge0FycmF5fVxuICAgICAqL1xuICAgIGdldEluZGV4OiBmdW5jdGlvbigpIHsgLy8gVE9ETzogZm9ybWVybHkgZ2V0QWxsUm93SW5kZXhlc1xuICAgICAgICByZXR1cm4gdGhpcy5pbmRleDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlT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C8qKlxuICAgICAqIEB0eXBlIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICB0aGlzLmRhdGEgPSBkYXRhO1xufVxuXG5EYXRhU291cmNlLnByb3RvdHlwZSA9IHtcbiAgICBjb25zdHJ1Y3RvcjogRGF0YVNvdXJjZS5wcm90b3R5cGUuY29uc3RydWN0b3IsIC8vIHByZXNlcnZlIGNvbnN0cnVjdG9yXG5cbiAgICBpc051bGxPYmplY3Q6IGZhbHNlLFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0Um93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFbeV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRWYWx1ZTogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgcm93ID0gdGhpcy5nZXRSb3coeSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzLmdldFJvdyh5KVt0aGlzLmZpZWxkc1t4XV0gPSB2YWx1ZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGEubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfVxuICAgICAqL1xuICAgIGdldENvbHVtbkNvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmllbGRzKCkubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyW119XG4gICAgICovXG4gICAgZ2V0RmllbGRzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZmllbGRzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7c3RyaW5nW119XG4gICAgICovXG4gICAgZ2V0SGVhZGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICB0aGlzLmhlYWRlcnMgPSB0aGlzLmhlYWRlcnMgfHwgdGhpcy5nZXREZWZhdWx0SGVhZGVycygpLm1hcChmdW5jdGlvbihlYWNoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGhlYWRlcmlmeShlYWNoKTtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291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NvdXJjZSk7XG4gICAgICAgICAgICAgICAgc291cmNlLnNvcnRPbihncm91cEJ5KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCByb3dDb3VudDsgcisrKSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHRyZWU7XG5cbiAgICAgICAgICAgIGdyb3VwQnlzLmZvckVhY2goZnVuY3Rpb24oZywgYykgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWxvb3AtZnVuY1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBzb3VyY2UuZ2V0VmFsdWUoZywgciksXG4gICAgICAgICAgICAgICAgICAgIGZhY3RvcnlEYXRhTm9kZSA9IChjID09PSBsZWFmRGVwdGgpID8gZmFjdG9yeURhdGFOb2RlTGVhZiA6IGZhY3RvcnlEYXRhTm9kZUdyb3VwO1xuICAgICAgICAgICAgICAgIHBhdGggPSBwYXRoLmNoaWxkcmVuLmdldElmVW5kZWZpbmVkKGtleSwgZmFjdG9yeURhdGFOb2RlKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBwYXRoLmluZGV4LnB1c2gocik7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNvcnRlckluc3RhbmNlID0gbmV3IERhdGFTb3VyY2VTb3J0ZXIoc291cmNlKTtcbiAgICAgICAgdHJlZS50b0FycmF5KCk7XG4gICAgICAgIHRyZWUuY29tcHV0ZUFnZ3JlZ2F0ZXModGhpcyk7XG4gICAgICAgIHRoaXMuYnVpbGRWaWV3KCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGF0YU5vZGVcbiAgICAgKi9cbiAgICBhZGRWaWV3OiBmdW5jdGlvbihkYXRhTm9kZSkge1xuICAgICAgICB0aGlzLnZpZXcucHVzaChkYXRhT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IEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0geFxuICAgICAqIEBwYXJhbSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIGlmICghdGhpcy52aWV3TWFrZXNTZW5zZSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldFZhbHVlKHgsIHksIHZhbHVlKTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUFnZ3JlZ2F0b3IucHJvdG90eXBlXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0Q29sdW1uQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICBpZiAoIXRoaXMudmlld01ha2VzU2Vuc2UoKSkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRDb2x1bW5Db3VudCgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLmdldEhlYWRlcnMoKS5sZW5ndGg7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIGlmICghdGhpcy52aWV3TWFrZXNTZW5zZSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldFJvd0NvdW50KCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMudmlldy5sZW5ndGg7IC8vaGVhZGVyIGNvbHVtblxuICAgIH0sXG5cbiAgIC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ZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICBnZXRHcmFuZFRvdGFsczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciB2aWV3ID0gdGhpcy50cmVlO1xuICAgICAgICByZXR1cm4gW3ZpZXcuZGF0YV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0geVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFJvdzogZnVuY3Rpb24oeSkge1xuICAgICAgICBpZiAoIXRoaXMudmlld01ha2VzU2Vuc2UoKSkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRSb3coeSk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcm9sbHVwcyA9IHRoaXMudmlld1t5XTtcblxuICAgICAgICByZXR1cm4gcm9sbHVwcyA/IHJvbGx1cHMgOiB0aGlzLnRyZWU7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5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gICBkZWxldGUgdGhpcy5maWx0ZXI7XG4gICAgICAgIHRoaXMuY2xlYXJJbmRleCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlR2xvYmFsRmlsdGVyLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7b2JqZWN0fSB2aXNpYmxlQ29sdW1uc1xuICAgICAqL1xuICAgIGFwcGx5OiBmdW5jdGlvbih2aXNpYmxlQ29sdW1ucykge1xuICAgICAgICBpZiAoIXRoaXMuZmlsdGVyKSB7XG4gICAgICAgICAgICB0aGlzLmNsZWFySW5kZXgoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHZhciB2aXNpYmxlQ29sdW1uTWFwID0gdGhpcy52aXNpYmxlQ29sdW1uTWFwID0gW107XG4gICAgICAgICAgICB2aXNpYmxlQ29sdW1ucy5mb3JFYWNoKGZ1bmN0aW9uKGNvbHVtbikge1xuICAgICAgICAgICAgICAgIHZpc2libGVDb2x1bW5NYXAucHVzaChjb2x1bW4uaW5kZXgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLmJ1aWxkSW5kZXgoYXBwbHlGaWx0ZXIpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VHbG9iYWxGaWx0ZXIucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmZpbHRlciA/IHRoaXMuaW5kZXgubGVuZ3RoIDogdGhpcy5kYXRhU291cmNlLmdldFJvd0NvdW50KCk7XG4gICAgfVxufSk7XG5cbi8qKlxuICogKnByaXZhdGVcbiAqIEBwYXJhbSB7bnVibWVyfSByXG4gKiBAcGFyYW0ge29iamVjdH0gcm93T2JqZWN0XG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AgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldEhlYWRlcnMoaGVhZGVycyk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogQHJldHVybnMge3N0cmluZ1tdfVxuICAgICAqL1xuICAgIGdldEhlYWRlcnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldEhlYWRlcnMoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEdyYW5kVG90YWxzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRHcmFuZFRvdGFscygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUluZGV4ZWQucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtvYmplY3RbXX0gYXJyYXlPZlVuaWZvcm1PYmplY3RzXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIHNldERhdGE6IGZ1bmN0aW9uKGFycmF5T2ZVbmlmb3JtT2JqZWN0cykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldERhdGEoYXJyYXlPZlVuaWZvcm1PYmplY3RzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGNsZWFySW5kZXg6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmluZGV4Lmxlbmd0aCA9IDA7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU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RpYWxpemU6IGZ1bmN0aW9uKCkge1xuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VTb3J0ZXIucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5kZXNjZW5kaW5nU29ydCA9IGZhbHNlOyAvLyBUT0RPOiB0aGlzIGRvZXMgbm90IHNlZW0gdG8gYmUgaW4gdXNlXG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlU29ydGVyLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJZHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gW2RpcmVjdGlvbj0xXVxuICAgICAqL1xuICAgIHNvcnRPbjogZnVuY3Rpb24oY29sSWR4LCBkaXJlY3Rpb24pIHtcbiAgICAgICAgc3dpdGNoIChkaXJlY3Rpb24pIHtcbiAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFySW5kZXgoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgY2FzZSB1bmRlZmluZWQ6XG4gICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICBjYXNlIC0xOlxuICAgICAgICAgICAgICAgIHZhciBzZWxmID0gdGhpczsgLy8gZm9yIHVzZSBpbiBnZXRWYWx1ZVxuICAgICAgICAgICAgICAgIHN0YWJsZVNvcnQuc29ydCh0aGlzLmJ1aWxkSW5kZXgoKSwgZ2V0VmFsdWUsIGRpcmVjdGlvbik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiBnZXRWYWx1ZShyb3dJZHgpIHtcbiAgICAgICAgICAgIHJldHVybiB2YWxPckZ1bmNDYWxsKHNlbGYuZGF0YVNvdXJjZS5nZXRWYWx1ZShjb2xJZHgsIH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iAgICAgKi9cbiAgICBtYXA6IGZ1bmN0aW9uKGl0ZXJhdGVlKSB7XG4gICAgICAgIHZhciBrZXlzID0gdGhpcy5rZXlzLFxuICAgICAgICAgICAgbmV3TWFwID0gbmV3IE1hcHB5KCksXG4gICAgICAgICAgICBzZWxmID0gdGhpcztcblxuICAgICAgICBpZiAoISh0eXBlb2YgaXRlcmF0ZWUgPT09ICdmdW5jdGlvbicpKSB7XG4gICAgICAgICAgICBpdGVyYXRlZSA9IHJlZmxlY3Rpb247XG4gICAgICAgIH1cblxuICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpLFxuICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkID0gaXRlcmF0ZWUodmFsdWUsIGtleSwgc2VsZik7XG4gICAgICAgICAgICBuZXdNYXAuc2V0KGtleSwgdHJhbnNmb3JtZWQpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIG5ld01hcDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtNYXBweX1cbiAgICAgKi9cbiAgICBjb3B5OiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGtleXMgPSB0aGlzLmtleXMsXG4gICAgICAgICAgICBuZXdNYXAgPSBuZXcgTWFwcHkoKSxcbiAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgbmV3TWFwLnNldChrZXksIHZhbHVlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBuZXdNYXA7XG4gICAgfVxuXG59O1xuXG52YXIgT0lEX1BSRUZJWCA9ICcufi4jJV8nOyAvL3RoaX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xcbiAgICAgICAgICAgICAgICByaWdodDogIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5yaWdodCxcbiAgICAgICAgICAgICAgICBib3R0b206IHdpbmRvdy5zY3JvbGxZICsgcmVjdC5ib3R0b20sXG4gICAgICAgICAgICAgICAgd2lkdGg6ICByZWN0LndpZHRoLFxuICAgICAgICAgICAgICAgIGhlaWdodDogcmVjdC5oZWlnaHRcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcblxuICAgICAgICAgICAgaWYgKHBvaW50SW5SZWN0KHBvaW50LCByZWN0KSkge1xuICAgICAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgLy8gZm91bmRcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcG9pbnRJbkl0ZW1SZWN0czogZnVuY3Rpb24gKHBvaW50LCBleGNlcHQxLCBleGNlcHQyKSB7XG4gICAgICAgIHJldHVybiB0aGlzLml0ZW1zLmZpbmQoZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgIHZhciBlbGVtZW50ID0gaXRlbS5lbGVtZW50O1xuICAgICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgICAgICBlbGVtZW50ICE9PSBleGNlcHQxICYmXG4gICAgICAgICAgICAgICAgZWxlbWVudCAhPT0gZXhjZXB0MiAmJlxuICAgICAgICAgICAgICAgIHBvaW50SW5SZWN0KHBvaW50LCBpdGVtLnJlY3QpXG4gICAgICAgICAgICApO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgLy8gZ2V0IHBvc2l0aW9ucyBvZiBhbGwgbGlzdCBpdGVtcyBpbiBwYWdlIGNvb3JkcyAobm9ybWFsaXplZCBmb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1xuXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW1FbGVtZW50ID09PSBsaXN0RWxlbWVudC5sYXN0RWxlbWVudENoaWxkKSB7XG4gICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IGxpc3RFbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmJvdHRvbTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGJvdHRvbSA8IHJlY3QudG9wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBib3R0b20gPSByZWN0LnRvcCArIChoZWlnaHQgfHwgNTApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0ID0gcmVjdC5oZWlnaHQ7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmVjdCA9IHtcbiAgICAgICAgICAgICAgICAgICAgbGVmdDogICB3aW5kb3cuc2Nyb2xsWCArIHJlY3QubGVmdCxcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQ6ICB3aW5kb3cuc2Nyb2xsWCArIHJlY3QucmlnaHQsXG4gICAgICAgICAgICAgICAgICAgIHRvcDogICAgd2luZG93LnNjcm9sbFkgKyByZWN0LnRvcCAgICArIGxpc3RFbGVtZW50LnNjcm9sbFRvcCxcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tOiB3aW5kb3cuc2Nyb2xsWSArIGJvdHRvbSArIGxpc3RFbGVtZW50LnNjcm9sbFRvcFxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICBpdGVtLnJlY3QgPSByZWN0O1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcmVpbnNlcnQ6IGZ1bmN0aW9uICh0YXJnZXQpIHtcbiAgICAgICAgdmFyIHN0eWxlID0gdGFyZ2V0LnN0eWxlO1xuICAgICAgICBzdHlsZS53aWR0aCA9IHN0eWxlW3RyY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GhlIG9uZSB3ZSBiZWxvbmcgdG9cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIGNvb3JkcztcbiAgICB9XG5cbn07XG5cbnZhciBoYW5kbGVycyA9IHtcbiAgICBtb3VzZWRvd246IGZ1bmN0aW9uIChkcmFnb24sIGV2dCkge1xuXG4gICAgICAgIGV2dC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7ICAvL3ByZXZlbnRzIHVzZXIgc2VsZWN0aW9uIG9mIHJlbmRlcmVkIG5vZGVzIGR1cmluZyBkcmFnXG5cbiAgICAgICAgaWYgKGRyYWdvbi5kcm9wKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcmVjdCA9IHRoaXMuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCk7XG5cbiAgICAgICAgZHJhZ29uLnJlY3QgPSByZWN0ID0ge1xuICAgICAgICAgICAgbGVmdDogICBNYXRoLnJvdW5kKHJlY3QubGVmdCAtIDEpLFxuICAgICAgICAgICAgdG9wOiAgICBNYXRoLnJvdW5kKHJlY3QudG9wIC0gMSksXG4gICAgICAgICAgICByaWdodDogIE1hdGgucm91bmQocmVjdC5yaWdodCksXG4gICAgICAgICAgICBib3R0b206IE1hdGgucm91bmQocmVjdC5ib3R0b20pLFxuICAgICAgICAgICAgd2lkdGg6ICBNYXRoLnJvdW5kKHJlY3Qud2lkdGgpLFxuICAgICAgICAgICAgaGVpZ2h0OiBNYXRoLnJvdW5kKHJlY3QuaGVpZ2h0KVxuICAgICAgICB9O1xuXG4gICAgICAgIGRyYWdvbi5waW4gPSB7XG4gICAgICAgICAgICB4OiB3aW5kb3cuc2Nyb2xsWCArIGV2dC5jbGllbnRYLFxuICAgICAgICAgICAgeTogd2luZG93LnNjcm9sbFkgKyBldnQuY2xpZW50WVxuICAgICAgICB9O1xuXG4gICAgICAgIGRyYWdvbi5vcmlnaW4gPS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IHJvb3QgdGFnXG4gICAgICAgICAgICB2YXIgY29udGFpbmVyID0gdGhpcztcbiAgICAgICAgICAgIHdoaWxlIChjb250YWluZXIucGFyZW50Tm9kZSkge1xuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IGNvbnRhaW5lci5wYXJlbnROb2RlO1xuICAgICAgICAgICAgICAgIGlmIChjb250YWluZXIgaW5zdGFuY2VvZiBTaGFkb3dSb290IHx8IGNvbnRhaW5lci50YWdOYW1lID09PSAnQk9EWScpe1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkcmFnb24uY29udGFpbmVyID0gY29udGFpbmVyO1xuICAgICAgICB9XG5cbiAgICAgICAgZHJhZ29uLmNvbnRhaW5lci5hcHBlbmRDaGlsZCh0aGlzKTtcblxuICAgICAgICByZWN0LmxlZnQgICArPSB3aW5kb3cuc2Nyb2xsWDtcbiAgICAgICAgcmVjdC50b3AgICAgKz0gd2luZG93LnNjcm9sbFk7XG4gICAgICAgIHJlY3QucmlnaHQgICs9IHdpbmRvdy5zY3JvbGxYO1xuICAgICAgICByZWN0LmJvdHRvbSArPSB3aW5kb3cuc2Nyb2xsWTtcblxuICAgICAgICBkcmFnb24uYWRkRXZ0KHRoaXMsICdtb3VzZW1vdmUnKTtcbiAgICAgICAgZHJhZ29uLmFkZEV2dCh0aGlzLCAnbW91c2V1cCcpO1xuICAgIH0sXG5cbiAgICBtb3VzZW1vdmU6IGZ1bmN0aW9uIChkcmFnb24sIGV2dCkge1xuICAgICAgICBkcmFnb24uZHJvcC5zdHlsZS50cmFuc2l0aW9uID0gUkVWRVJUX1RPX1NUWUxFU0hFRVRfVkFMVUU7XG5cbiAgICAgICAgdmFyIGhvdmVyTGlzdCA9IGRyYWdvbi5wb2ludEluTGlzdFJlY3RzKHsgeDogZXZ0LmNsaWVudFgsIHk6IGV2dC5jbGllbnRZIH0pIHx8IGRyYWdvbi5tb3N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QucmVjdC5ib3R0b20gLSAxIC0gNSkpID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBuZWFyIG9yIGJlbG93IGJvdHRvbSBhbmQgbGlzdCBub3Qgc2Nyb2xsZWQgdG8gYm90dG9tIHlldFxuICAgICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcihtYWduaXR1ZGUsIG1heFNjcm9sbFksIGhvdmVyTGlzdC5lbGVtZW50KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBpbnNpZGVcbiAgICAgICAgICAgICAgICAgICAgcmVzZXRBdXRvU2Nyb2xsVGltZXIoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBvdGhlciA9IGRyYWdvbi5wb2ludEluSXRlbVJlY3RzKHtcbiAgICAgICAgICAgICAgICB4OiBldnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5OiBkcmFnb24ucmVjdC5ib3R0b20gKyB3aW5kb3cuc2Nyb2xsWSArIGR5ICsgaG92ZXJMaXN0LmVsZW1lbnQuc2Nyb2xsVG9wXG4gICAgICAgICAgICB9LCB0aGlzLCBkcmFnb24uZHJvcCk7XG5cbiAgICAgICAgICAgIHRoaXMuc3R5bGVbdHJhbnNmb3JtXSA9IHRyYW5zbGF0ZShcbiAgICAgICAgICAgICAgICBkcmFnb24ucmVjdC5sZWZ0IC0gd2luZG93LnNjcm9sbFggKyBkeCxcbiAgICAgICAgICAgICAgICBkcmFnb24ucmVjdC50b3AgLSB3aW5kb3cuc2Nyb2xsWSArIGR5XG4gICAgICAgICAgICApO1xuXG4gICAgICAgICAgICBpZiAob3RoZXIpIHtcbiAgICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IG90aGVyLmVsZW1lbnQ7XG4gICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS50cmFuc2l0aW9uID0gUkVWRV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m9yRWFjaChmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gJ21vZGVscycpIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kZWxMaXN0Lm1vZGVsc1trZXldID0gbW9kZWxMaXN0W2tleV07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBtb2RlbExpc3RzW2xpc3RJbmRleF0gPSBtb2RlbExpc3QgPSBtb2RlbExpc3QubW9kZWxzO1xuICAgICAgICB9IGVsc2UgaWYgKG1vZGVsTGlzdCBpbnN0YW5jZW9mIEFycmF5KSB7XG4gICAgICAgICAgICBtb2RlbExpc3QubW9kZWxzID0gbW9kZWxMaXN0OyAvLyBwb2ludCB0byBzZWxmXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aHJvdyBlcnJvcignTGlzdCBbezF9XSBub3QgYW4gYXJyYXkgb2YgbW9kZWxzICh3aXRoIG9yIHdpdGhvdXQgYWRkaXRpb25hbCBwcm9wZXJ0aWVzKSBPUiAnICtcbiAgICAgICAgICAgICAgICAnYW4gb2JqZWN0ICh3aXRoIGEgYG1vZGVsc2AgcHJvcGVydHkgY29udGFpbmluZyBhbiBhcnJheSBvZiBtb2RlbHMpLicsIGxpc3RJbmRleCk7XG4gICAgICAgIH1cblxuICAgICAgICBtb2RlbExpc3QuZm9yRWFjaChmdW5jdGlvbiAobW9kZWwpIHtcbiAgICAgICAgICAgIHZhciBtb2RlbExhYmVsID0gbW9kZWwubGFiZWwgfHwgbGlzdExhYmVsLFxuICAgICAgICAgICAgICAgIG1vZGVsSHRtbEVuY29kZSA9IG1vZGVsLmh0bWxFbmNvZGUgIT09IHVuZGVmaW5lZCAmJiBtb2RlbC5odG1sRW5jb2RlIHx8IGxpc3RIdG1sRW5jb2RlLFxuICAgICAgICAgICAgICAgIG1vZGVsT2JqZWN0ID0gdHlwZW9mIG1vZGVsID09PSAnb2JqZWN0JyA/IG1vZGV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XJhbSB7UG9pbnR9IHBvaW50IC0gQSBwb2ludCB0byBjb21wYXJlIHRvIHRoaXMgcG9pbnQuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIGxlc3NUaGFuT3JFcXVhbFRvOiBmdW5jdGlvbihwb2ludCkge1xuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgdGhpcy54IDw9IHBvaW50LnggJiZcbiAgICAgICAgICAgIHRoaXMueSA8PSBwb2ludC55XG4gICAgICAgICk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIF8oRm9ybWVybHkgYGlzQ29udGFpbmVkV2l0aGluUmVjdGFuZ2xlYC4pX1xuICAgICAqIEBwYXJhbSByZWN0IHtSZWN0YW5nbGV9IC0gUmVjdGFuZ2xlIHRvIHRlc3QgdGhpcyBwb2ludCBhZ2FpbnN0LlxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBgdHJ1ZWAgaWZmIHRoaXMgcG9pbnQgaXMgd2l0aGluIGdpdmVuIGByZWN0YC5cbiAgICAgKiBAbWVtYmVyT2YgUG9pbnQucHJvdG90eXBlXG4gICAgICovXG4gICAgd2l0aGluOiBmdW5jdGlvbihyZWN0KSB7XG4gICAgICAgIHZhciBtaW5YID0gcmVjdC5vcmlnaW4ueCxcbiAgICAgICAgICAgIG1heFggPSBtaW5YICsgcmVjdC5leHRlbnQueDtcbiAgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55LFxuICAgICAgICAgICAgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICA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VuY2VzXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHN1bW1hcnkgRW1wdGllcyBgdGhpcy5zZWxlY3Rpb25gLCBlZmZlY3RpdmVseSByZW1vdmluZyBhbGwgcnVucy5cbiAgICAgICAgICogQHJldHVybnMge1JhbmdlU2VsZWN0aW9uTW9kZWx9IFNlbGYgKGkuZS4sIGB0aGlzYCksIGZvciBjaGFpbmluZy5cbiAgICAgICAgICogQG1lbWJlck9mIFJhbmdlU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICAgICAqL1xuICAgICAgICBjbGVhcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy5zdGF0ZXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLmxlbmd0aCA9IDA7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBjbGVhck1vc3RSZWNlbnRTZWxlY3Rpb246IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLnNlbGVjdGlvbiA9IHRoaXMuc3RhdGVzLnBvcCgpO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAc3VtbWFyeSBEZXRlcm1pbmVzIGlmIHRoZSBnaXZlbiBgY2VsbGAgaXMgc2VsZWN0ZWQuXG4gICAgICAgICAqIEByZXR1cm5zIHtib29sZWFufSBgdHJ1ZWAgaWZmIGdpdmVuIGBjZWxsYCBpcyB3aXRoaW4gYW55IG9mIHRoZSBydW5zIGluIGB0aGlzLnNlbGVjdGlvbmAuXG4gICAgICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjZWxsIC0gVGhlIGNlbGwgdG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WRlclRleHRXcmFwcGluZyxcbiAgICAgICAgICAgIGxlZnRQYWRkaW5nID0gMiwgLy9UT0RPOiBmaXggdGhpc1xuICAgICAgICAgICAgaXNIZWFkZXIgPSBjb25maWcueSA9PT0gMDtcblxuICAgICAgICB2YXIgbGVmdEljb24sIHJpZ2h0SWNvbiwgY2VudGVySWNvbiwgaXhvZmZzZXQsIGl5b2Zmc2V0O1xuXG4gICAgICAgIC8vc2V0dGluZyBnYyBwcm9wZXJ0aWVzIGFyZSBleHBlbnNpdmUsIGxldHMgbm90IGRvIGl0IHVubmVjZXNzYXJpbHlcblxuICAgICAgICBpZiAodmFsICYmIHZhbC5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgIGxlZnRJY29uID0gdmFsWzBdO1xuICAgICAgICAgICAgcmlnaHRJY29uID0gdmFsWzJdO1xuICAgICAgICAgICAgdmFsID0gdmFsWzFdO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICdvYmplY3QnKSB7IC8vIG11c3QgYmUgYW4gaW1hZ2VcbiAgICAgICAgICAgICAgICBjZW50ZXJJY29uID0gdmFsO1xuICAgICAgICAgICAgICAgIHZhbCA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGVmdEljb24gJiYgbGVmdEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgbGVmdEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHJpZ2h0SWNvbiAmJiByaWdodEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgcmlnaHRJY29uID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjZW50ZXJJY29uICYmIGNlbnRlckljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgY2VudGVySWNvbiA9IG51bGw7XG4gICAgICAgIC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vdW5kKChoZWlnaHQgLSByaWdodEljb24uaGVpZ2h0KSAvIDIpO1xuICAgICAgICAgICAgaXhvZmZzZXQgPSAwOyAvL01hdGgucm91bmQoKGhhbGlnbk9mZnNldCAtIHJpZ2h0SWNvbi53aWR0aCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShyaWdodEljb24sIHggKyB3aWR0aCAtIGl4b2Zmc2V0IC0gcmlnaHRJY29uLndpZHRoLCB5ICsgaXlvZmZzZXQpO1xuICAgICAgICAgICAgaWNvbldpZHRoID0gTWF0aC5tYXgocmlnaHRJY29uLndpZHRoICsgMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNlbnRlckljb24pIHtcbiAgICAgICAgICAgIGl5b2Zmc2V0ID0gTWF0aC5yb3VuZCgoaGVpZ2h0IC0gY2VudGVySWNvbi5oZWlnaHQpIC8gMik7XG4gICAgICAgICAgICBpeG9mZnNldCA9IE1hdGgucm91bmQoKHdpZHRoIC0gY2VudGVySWNvbi53aWR0aCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShjZW50ZXJJY29uLCB4ICsgd2lkdGggLSBpeG9mZnNldCAtIGNlbnRlckljb24ud2lkdGgsIHkgKyBpeW9mZnNldCk7XG4gICAgICAgICAgICBpY29uV2lkdGggPSBNYXRoLm1heChjZW50ZXJJY29uLndpZHRoICsgMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvbmZpZy5jZWxsQm9yZGVyVGhpY2tuZXNzKSB7XG4gICAgICAgICAgICBnYy5iZWdpblBhdGgoKTtcbiAgICAgICAgICAgIGdjLnJlY3QoeCwgeSwgd2lkdGgsIGhlaWdodCk7XG4gICAgICAgICAgICBnYy5saW5lV2lkdGggPSBjb25maWcuY2VsbEJvcmRlclRoaWNrbmVzcztcbiAgICAgICAgICAgIGdjLnN0cm9rZVN0eWxlID0gY29uZmlnLmNlbGxCb3JkZXJTdHlsZTtcblxuICAgICAgICAgICAgLy8gYW5p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BjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgLy90ZXh0V2lkdGggPSBjb25maWcuZ2V0VGV4dFdpZHRoKGdjLCBjb25maWcudmFsdWUpO1xuICAgICAgICAgICAgICAgIGhhbGlnbk9mZnNldCA9IHdpZHRoIC0gY29sSEVkZ2VPZmZzZXQgLSB0ZXh0V2lkdGg7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlICdjZW50ZXInOlxuICAgICAgICAgICAgICAgIC8vdGV4dFdpZHRoID0gY29uZmlnLmdldFRleHRXaWR0aChnYywgY29uZmlnLnZhbHVlKTtcbiAgICAgICAgICAgICAgICBoYWxpZ25PZmZzZXQgPSAod2lkdGggLSB0ZXh0V2lkdGgpIC8gMjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgJ2xlZnQnOlxuICAgICAgICAgICAgICAgIGhhbGlnbk9mZnNldCA9IGNvbEhFZGdlT2Zmc2V0O1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG5cbiAgICAgICAgaGFsaWduT2Zmc2V0ID0gTWF0aC5tYXgoMCwgaGFsaWduT2Zmc2V0KTtcbiAgICAgICAgdmFsaWduT2Zmc2V0ID0gdmFsaWduT2Zmc2V0ICsgTWF0aC5jZWlsKGhlaWdodCAvIDIpO1xuXG4gICAgICAgIGlmICh2YWwgIT09IG51bGwpIHtcbiAgICAgICAgICAgIGdjLmZpbGxUZXh0KHZhbCwgeCArIGhhbGlnbk9mZnNldCwgeSArIHZhbGlnbk9mZnNldCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNDb2x1bW5Ib3ZlcmVkICYmIGlzUm93SG92ZXJlZCkge1xuICAgICAgICAgICAgZ2MuYmVnaW5QYXRoKCk7XG4gICAgICAgICAgICBpZiAoaXNMaW5rKSB7XG4gICAgICAgICAgICAgICAgdW5kZXJsaW5lKGNvbmZpZywgZ2MsIHZhbCwgeCArIGhhbGl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QgPSBzZWxlY3Rpb25zWzBdLmxlbmd0aCxcbiAgICAgICAgICAgICAgICBhcmVhID0gd2lkdGggKiBoZWlnaHQsXG4gICAgICAgICAgICAgICAgY29sbGVjdG9yID0gW107XG5cbiAgICAgICAgICAgIC8vZGlzYWxsb3cgaWYgc2VsZWN0aW9uIGlzIHRvbyBiaWdcbiAgICAgICAgICAgIGlmIChhcmVhID4gMjAwMDApIHtcbiAgICAgICAgICAgICAgICBhbGVydCgnc2VsZWN0aW9uIHNpemUgaXMgdG9vIGJpZyB0byBjb3B5IHRvIHRoZSBwYXN0ZSBidWZmZXInKTsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1hbGVydFxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZm9yICh2YXIgaCA9IDA7IGggPCBoZWlnaHQ7IGgrKykge1xuICAgICAgICAgICAgICAgIGZvciAodmFyIHcgPSAwOyB3IDwgd2lkdGg7IHcrKykge1xuICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaChzZWxlY3Rpb25zW3ddW2hdKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHcgPCB3aWR0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goJ1xcdCcpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChoIDwgaGVpZ2h0KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5wdXNoKCdcXG4nKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBjb2xsZWN0b3Iuam9pbignJyk7XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuICcnO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmV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L3N0eWxlLm1hcmdpbkJvdHRvbSA9ICcxNXB4JztcbiAgICAgICAgc3R5bGUubGVmdCA9IDA7XG5cbiAgICAgICAgdGhpcy5jYW52YXMucmVzaXplTm90aWZpY2F0aW9uID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLnJlc2l6ZWQoKTtcbiAgICAgICAgfTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtbW91c2Vtb3ZlJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZU1vdmUobW91c2VFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgbW91c2VFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5tb3VzZURvd25TdGF0ZSA9IG1vdXNlRXZlbnQ7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlTW91c2VEb3duKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VEb3duRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLnJlcGFpbnQoKTtcbiAgICAgICAgfSk7XG5cblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtY2xpY2snLCBmdW5jdGlvbihlKSB7XG4gICAgICAgIC8vICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgLy8gICAgICAgICByZXR1cm47XG4gICAgICAgIC8vICAgICB9XG4gICAgICAgIC8vICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgLy8gICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAvLyAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgIC8vICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICAvLyB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtbW91c2V1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIGlmIChzZWxmLmlzU2Nyb2xsaW5nTm93KCkpIHtcbiAgICAgICAgICAgICAgICBzZWxmLnNldFNjcm9sbGluZ05vdyhmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZykge1xuICAgICAgICAgICAgICAgIHNlbGYuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZVVwKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHNlbGYubW91c2VEb3duU3RhdGUpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNCdXR0b25QcmVzc2VkRXZlbnQoc2VsZi5tb3VzZURvd25TdGF0ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbnVsbDtcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY01vdXNlVXBFdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRhcCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgdGFwRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgdGFwRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgdGFwRXZlbnQua2V5cyA9IGUuZGV0YWlsLmtleXM7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KHRhcEV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVUYXAodGFwRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtZHJhZycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURyYWcobW91c2VFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5ZG93bkV2ZW50KGUpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZUtleURvd24oZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXl1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0tleXVwRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5VXAoZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy10cmFjaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHByaW1FdmVudCA9IGUuZGV0YWlsLnByaW1pdGl2ZUV2ZW50O1xuICAgICAgICAgICAgaWYgKE1hdGguYWJzKHByaW1FdmVudC5keSkgPiBNYXRoLmFicyhwcmltRXZlbnQuZHgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbFZCeSgtMik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZlbnQueURpcmVjdGlvbiA8IC0wKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KDIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbEhCeSgtMSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZlbnQueERpcmVjdGlvbiA8IC0wKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsSEJ5KDEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgLy8gdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWhvbGRwdWxzZScsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgLy8gICAgIGNvbnNvbGUubG9nKCdob2xkcHVsc2UnKTtcbiAgICAgICAgLy8gICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gICAgIH1cbiAgICAgICAgLy8gICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAvLyAgICAgbW91c2VFdmVudC5wcmltaXRpdm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bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHRoaXMuZmlyZVN5bnRoZXRpY1NldFRvdGFsc1ZhbHVlKHgsIHksIHZhbHVlKTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY1NldFRvdGFsc1ZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLXNldC10b3RhbHMtdmFsdWUnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHksXG4gICAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5VXBFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktdXAnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIGtleUV2ZW50OiBrZXlFdmVudFxuICAgICAgICAgICAgfSxcblxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0VkaXRvcktleURvd25FdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktZG93bicsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5UHJlc3NFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktcHJlc3MnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIGtleUV2ZW50OiBrZXlFdmVudFxuICAgICAgICAgICAgfSxcblxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0VkaXRvckRhdGFDaGFuZ2VFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBvbGRWYWx1ZSwgbmV3VmFsdWUpIHtcbiAgICAgICAgdmFyIGNsaWNrRXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ2Zpbi1lZGl0b3ItZGF0YS1jaGFuZ2UnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIG9sZFZhbHVlOiBvbGRWYWx1ZSxcbiAgICAgICAgICAgICAgICBuZXdWYWx1ZTogbmV3VmFsdWVcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjYW5jZWxhYmxlOiB0cn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5nZXRTZWxlY3Rpb25zKCk7XG4gICAgICAgIHZhciByZXN1bHQgPSBuZXcgQXJyYXkoc2VsZWN0aW9ucy5sZW5ndGgpO1xuICAgICAgICBzZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0aW9uUmVjdCwgaSkge1xuICAgICAgICAgICAgcmVzdWx0W2ldID0gc2VsZi5fZ2V0U2VsZWN0aW9uTWF0cml4KHNlbGVjdGlvblJlY3QpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9LFxuXG4gICAgX2dldFNlbGVjdGlvbk1hdHJpeDogZnVuY3Rpb24ocmVjdCkge1xuICAgICAgICByZWN0ID0gbm9ybWFsaXplUmVjdChyZWN0KTtcbiAgICAgICAgdmFyIGNvbENvdW50ID0gcmVjdC5leHRlbnQueCArIDE7XG4gICAgICAgIHZhciByb3dDb3VudCA9IHJlY3QuZXh0ZW50LnkgKyAxO1xuICAgICAgICB2YXIgb3ggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB2YXIgb3kgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgY29sQ291bnQ7IGMrKykge1xuICAgICAgICAgICAgdmFyIGNvbHVtbiA9IG5ldyBBcnJheShyb3dDb3VudCk7XG4gICAgICAgICAgICByZXN1bHRbY10gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgICAgICBjb2x1bW5bcl0gPSB2YWx1ZU9yRnVuY3Rpb25FeGVjdXRlKHRoaXMuZ2V0VmFsdWUob3ggKyBjLCBveSArIHIpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3J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nZmluLW1vdXNldXAnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudDogZnVuY3Rpb24oZSkge1xuICAgICAgICB2YXIgZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ2Zpbi1tb3VzZWRvd24nLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW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0ge01vdXNlRXZlbnR9IGV2ZW50IC0gVGhlIHN5c3RlbSBtb3VzZSBldmVudC5cbiAgICAgKi9cbiAgICBmaXJlU3ludGhldGljT25DZWxsRW50ZXJFdmVudDogZnVuY3Rpb24oY2VsbCkge1xuICAgICAgICB2YXIgZGV0YWlsID0ge1xuICAgICAgICAgICAgZ3JpZENlbGw6IGNlbGwsXG4gICAgICAgICAgICB0aW1lOiBEYXRlLm5vdygpLFxuICAgICAgICAgICAgZ3JpZDogdGhpc1xuICAgICAgICB9O1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWNlbGwtZW50ZXInLCB7XG4gICAgICAgICAgICBkZXRhaWw6IGRldGFpbFxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0dyb3Vwc0NoYW5nZWRFdmVudDogZnVuY3Rpb24oZ3JvdXBzKSB7XG4gICAgICAgIHZhciBkZXRhaWwgPSB7XG4gICAgICAgICAgICBncm91cHM6IGdyb3VwcyxcbiAgICAgICAgICAgIHRpbWU6IERhdGUubm93KCksXG4gICAgICAgICAgICBncmlkOiB0aGlzXG4gICAgICAgIH07XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZ3JvdXBzLWNoYW5nZWQnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IGRldGFpbFxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBTeW50aGVzaXplIGFuZCBmaXJlIGEgYGZpbi1jZWxsLWV4aXRgIGV2ZW50LlxuICAgICAqIEBw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lbmRlcmVkLlxuICAgICAqL1xuICAgIGdldFJlbmRlcmVkRGF0YTogZnVuY3Rpb24oKSB7XG4gICAgICAgIC8vIGFzc3VtZXMgb25lIHJvdyBvZiBoZWFkZXJzXG4gICAgICAgIHZhciBiZWhhdmlvciA9IHRoaXMuZ2V0QmVoYXZpb3IoKSxcbiAgICAgICAgICAgIHJlbmRlcmVyID0gdGhpcy5nZXRSZW5kZXJlcigpLFxuICAgICAgICAgICAgY29sQ291bnQgPSB0aGlzLmdldENvbHVtbkNvdW50KCksXG4gICAgICAgICAgICByb3dDb3VudCA9IHJlbmRlcmVyLmdldFZpc2libGVSb3dzKCksXG4gICAgICAgICAgICBoZWFkZXJzID0gbmV3IEFycmF5KGNvbENvdW50KSxcbiAgICAgICAgICAgIHJlc3VsdHMgPSBuZXcgQXJyYXkocm93Q291bnQpLFxuICAgICAgICAgICAgcm93O1xuXG4gICAgICAgIGhlYWRlcnMuZm9yRWFjaChmdW5jdGlvbihoZWFkZXIsIGMpIHtcbiAgICAgICAgICAgIGhlYWRlcnNbY10gPSBiZWhhdmlvci5nZXRDb2x1bW5JZChjLCAwKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmVzdWx0cy5mb3JFYWNoKGZ1bmN0aW9uKHJlc3VsdCwgcikge1xuICAgICAgICAgICAgcm93ID0gcmVzdWx0c1tyXSA9IHtcbiAgICAgICAgICAgICAgICBoaWVyYXJjaHk6IGJlaGF2aW9yLmdldEZpeGVkQ29sdW1uVmFsdWUoMCwgcilcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBoZWFkZXJzLmZvckVhY2goZnVuY3Rpb24oZmllbGQsIGMpIHtcbiAgICAgICAgICAgICAgICByb3dbZmllbGRdID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgcik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW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5cbiAgICB0b2dnbGVTZWxlY3RDb2x1bW46IGZ1bmN0aW9uKHgsIGtleXMpIHtcbiAgICAgICAga2V5cyA9IGtleXMgfHwgW107XG4gICAgICAgIHZhciBtb2RlbCA9IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKTtcbiAgICAgICAgdmFyIGFscmVhZHlTZWxlY3RlZCA9IG1vZGVsLmlzQ29sdW1uU2VsZWN0ZWQoeCk7XG4gICAgICAgIHZhciBoYXNDVFJMID0ga2V5cy5pbmRleE9mKCdDVFJMJykgPiAtMTtcbiAgICAgICAgdmFyIGhhc1NISUZUID0ga2V5cy5pbmRleE9mKCdTSElGVCcpID4gLTE7XG4gICAgICAgIGlmICghaGFzQ1RSTCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChoYXNDVFJMKSB7XG4gICAgICAgICAgICAgICAgaWYgKGFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5kZXNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4oeCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4odGhpcy5sYXN0RWRnZVNlbGVjdGlvblswXSwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFhbHJlYWR5U2VsZW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WN0ZWQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RSb3coeSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoaGFzQ1RSTCkge1xuICAgICAgICAgICAgICAgIGlmIChhbHJlYWR5U2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuZGVzZWxlY3RSb3coeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzU2luZ2xlUm93U2VsZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlbC5jbGVhclJvd1NlbGVjdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh5KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaGFzU0hJRlQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzFdLCB5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMV0gPSB5O1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucmVwYWludCgpO1xuICAgIH0sXG5cbiAgICBzZWxlY3RWaWV3cG9ydENlbGw6IGZ1bmN0aW9uKHgsIHkpIHtcbiAgICAgICAgdmFyIGhlYWRlclJvd0NvdW50ID0gdGhpcy5nZXRIZWFkZXJSb3dDb3VudCgpO1xuICAgICAgICB2YXIgcmVuZGVyZXIgPSB0aGlzLmdldFJlbmRlcmVyKCk7XG4gICAgICAgIHZhciByZW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gYyA8IG51bUNvbHVtbnM7IGMrKykge1xuICAgICAgICAgICAgdnggPSBjO1xuICAgICAgICAgICAgaWYgKGMgPj0gbnVtRml4ZWRDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgdnggPSB2eCArIHNjcm9sbExlZnQ7XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0VlggPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFZYID0gdng7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxhc3RWWCA9IHZ4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHggPiB2aWV3V2lkdGggfHwgbnVtQ29sdW1ucyA8PSB2eCkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgd2lkdGggPSB0aGlzLmdldENvbHVtbldpZHRoKHZ4KTtcbiAgICAgICAgICAgIHggPSB4ICsgd2lkdGg7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzW2MgKyAxXSA9IE1hdGgucm91bmQoeCk7XG4gICAgICAgICAgICB0aGlzLnZpc2libGVDb2x1bW5zW2NdID0gdng7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzSW5kZXhNYXBbdnhdID0gYztcblxuICAgICAgICAgICAgaW5zZXJ0aW9uQm91bmRzQ3Vyc29yID0gaW5zZXJ0aW9uQm91bmRzQ3Vyc29yICsgTWF0aC5yb3VuZCh3aWR0aCAvIDIpICsgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZTtcbiAgICAgICAgICAgIHRoaXMuaW5zZXJ0aW9uQm91bmRzLnB1c2goaW5zZXJ0aW9uQm91bmRzQ3Vyc29yKTtcbiAgICAgICAgICAgIHByZXZpb3VzSW5zZXJ0aW9uQm91bmRzQ3Vyc29yVmFsdWUgPSBNYXRoLnJvdW5kKHdpZHRoIC8gMik7XG4gICAgICAgIH1cblxuICAgICAgICB5ID0gMDtcbiAgICAgICAgZm9yIChyID0gMDsgciA8IG51bVJvd3M7IHIrKykge1xuICAgICAgICAgICAgdnkgPSByO1xuICAgICAgICAgICAgaWYgKHIgPj0gbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgdnkgPSB2eSArIHNjcm9sbFRvcDtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RWWSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0VlkgPSB2eTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGFzdFZZID0gdnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeSA+IHZpZXdIZWlnaHQgfHwgbnVtUm93cyA8PSB2eSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaGVpZ2h0ID0gdGhpcy5nZXRSb3dIZWlnaHQodnkpO1xuICAgICAgICAgICAgeSA9IHkgKyBoZWlnaHQ7XG4gICAgICAgICAgICB0aGlzLnJvd0VkZ2VzW3IgKyAxXSA9IE1hdGgucm91bmQoeSk7XG4gICAgICAgICAgICB0aGlzLnZpc2libGVSb3dzW3JdID0gdnk7XG4gICAgICAgICAgICB0aGlzLnJvd0VkZ2VzSW5kZXhNYXBbdnldID0gcjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnZpZXdIZWlnaHQgPSB2aWV3SGVpZ2h0O1xuICAgICAgICB0aGlzLmRhdGFXaW5kb3cgPSBncmlkLm5ld1JlY3RhbmdsZShmaXJzdFZYLCBmaXJzdFZZLCBsYXN0VlggLSBmaXJzdFZYLCBsYXN0VlkgLSBmaXJzdFZZKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IGEgcHJvcGVydHkgdmFsdWUgYXQgYS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Gp1c3QgcmVuZGVyZWQuXG4gICAgICovXG4gICAgZ2V0VmlzaWJsZUNvbHVtbnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy52aXNpYmxlQ29sdW1ucztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9IFRoZSBjb2x1bW4gaW5kZXggd2huZSB0aGUgbW91c2VFdmVudCBjb29yZGluYXRlcyBhcmUgb3ZlciBhIGNvbHVtbiBkaXZpZGVyLlxuICAgICAqL1xuICAgIG92ZXJDb2x1bW5EaXZpZGVyOiBmdW5jdGlvbih4KSB7XG4gICAgICAgIHggPSBNYXRoLnJvdW5kKHgpO1xuICAgICAgICB2YXIgZWRnZXMgPSB0aGlzLmdldENvbHVtbkVkZ2VzKCk7XG4gICAgICAgIHZhciB3aGljaENvbCA9IGVkZ2VzLmluZGV4T2YoeCAtIDEpO1xuICAgICAgICBpZiAod2hpY2hDb2wgPCAwKSB7XG4gICAgICAgICAgICB3aGljaENvbCA9IGVkZ2VzLmluZGV4T2YoeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHdoaWNoQ29sIDwgMCkge1xuICAgICAgICAgICAgd2hpY2hDb2wgPSBlZGdlcy5pbmRleE9mKHggLSAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAod2hpY2hDb2wgPCAwKSB7XG4gICAgICAgICAgICB3aGljaENvbCA9IGVkZ2VzLmluZGV4T2YoeCArIDEpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh3aGljaENvbCA8IDApIHtcbiAgICAgICAgICAgIHdoaWNoQ29sID0gZWRnZXMuaW5kZXhPZih4IC0gMyk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gd2hpY2hDb2w7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBSZW5kZXJlci5wcm90b3R5cGVc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ik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmV2aW91cyA9IGhlaWdodDtcbiAgICAgICAgfVxuICAgICAgICByLS07XG4gICAgICAgIGlmIChwb2ludC54IDwgMCkge1xuICAgICAgICAgICAgYyA9IC0xO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb2ludC55IDwgMCkge1xuICAgICAgICAgICAgciA9IC0xO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHZpZXdQb2ludCA9IGdyaWQubmV3UG9pbnQoYywgcik7XG5cbiAgICAgICAgLy9jb21wZW5zYXRlIGlmIHdlIGFyZSBzY3JvbGxlZFxuICAgICAgICBpZiAoYyA+PSBmaXhlZENvbHVtbkNvdW50KSB7XG4gICAgICAgICAgICBjID0gYyArIHNjcm9sbFg7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHIgPj0gZml4ZWRSb3dDb3VudCkge1xuICAgICAgICAgICAgciA9IHIgKyBzY3JvbGxZO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHRyYW5zbGF0ZWRJbmRleCA9IC0xO1xuXG4gICAgICAgIHZhciBjb2x1bW4gPSBiZWhhdmlvci5nZXRDb2x1bW4oYyk7XG4gICAgICAgIGlmIChjb2x1bW4pIHtcbiAgICAgICAgICAgIHRyYW5zbGF0ZWRJbmRleCA9IGNvbHVtbi5pbmRleDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBncmlkQ2VsbDogZ3JpZC5uZXdQb2ludChjLCByKSxcbiAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGdyaWQubmV3UG9pbnQoeCwgeSksXG4gICAgICAgICAgICB2aWV3UG9pbnQ6IHZpZXdQb2ludCxcbiAgICAgICAgICAgIGRhdGFDZWxsOiBncmlkLm5ld1BvaW50KHRyYW5zbGF0ZWRJbmRleCwgciksXG4gICAgICAgIH07XG4gICAgfSxcblxuICAgIC8qKlxuICAgIC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WdodCgpIDogby55KTtcbiAgICAgICAgLy8gdmFyIG93ID0gby53aWR0aDtcbiAgICAgICAgLy8gdmFyIG9oID0gby5oZWlnaHQ7XG4gICAgICAgIHZhciBlID0gdGhpcy5fZ2V0Qm91bmRzT2ZDZWxsKGRwRVgsIGRwRVkpO1xuICAgICAgICB2YXIgZXggPSBNYXRoLnJvdW5kKChlLnggPT09IHVuZGVmaW5lZCkgPyBncmlkLmdldEZpeGVkQ29sdW1uc1dpZHRoKCkgOiBlLngpO1xuICAgICAgICB2YXIgZXkgPSBNYXRoLnJvdW5kKChlLnkgPT09IHVuZGVmaW5lZCkgPyBncmlkLmdldEZpeGVkUm93c0hlaWdodCgpIDogZS55KTtcbiAgICAgICAgLy8gdmFyIGV3ID0gZS53aWR0aDtcbiAgICAgICAgLy8gdmFyIGVoID0gZS5oZWlnaHQ7XG4gICAgICAgIHZhciB4ID0gTWF0aC5taW4ob3gsIGV4KTtcbiAgICAgICAgdmFyIHkgPSBNYXRoLm1pbihveSwgZXkpO1xuICAgICAgICB2YXIgd2lkdGggPSAxICsgZXggLSBveDtcbiAgICAgICAgdmFyIGhlaWdodCA9IDEgKyBleSAtIG95O1xuICAgICAgICBpZiAoeCA9PT0gZXgpIHtcbiAgICAgICAgICAgIHdpZHRoID0gb3ggLSBleDtcbiAgICAgICAgfVxuICAgICAgICBpZiAoeSA9PT0gZXkpIHtcbiAgICAgICAgICAgIGhlaWdodCA9IG95IC0gZXk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHdpZHRoICogaGVpZ2h0IDwgMSkge1xuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgb25seSBhIHNraW5ueSBsaW5lLCBkb24ndCByZW5kZXIgYW55dGhpbmdcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGdjLnJlY3QoeCwgeSwgd2lkdGgsIGhlaWdodCk7XG4gICAgICAgIGdjLmZpbGxTdHlsZSA9ICdyZ2JhKDAsIDAsIDAsI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xuICAgICAgICB2YXIgY2VsbCA9IGJlaGF2aW9yLmdldENlbGxSZW5kZXJlcihjZWxsUHJvcGVydGllcywgYywgcik7XG4gICAgICAgIHZhciBvdmVycmlkZXMgPSBiZWhhdmlvci5nZXRDZWxsUHJvcGVydGllcyhjLCByKTtcblxuICAgICAgICAvL2RlY2xhcmF0aXZlIGNlbGwgcHJvcGVydGllc1xuICAgICAgICBfKGNlbGxQcm9wZXJ0aWVzKS5leHRlbmRPd24ob3ZlcnJpZGVzKTtcblxuICAgICAgICAvL2FsbG93IHRoZSByZW5kZXJlciB0byBpZGVudGlmeSBpdHNlbGYgaWYgaXQncyBhIGJ1dHRvblxuICAgICAgICBjZWxsUHJvcGVydGllcy5idXR0b25DZWxscyA9IHRoaXMuYnV0dG9uQ2VsbHM7XG5cbiAgICAgICAgY2VsbC5wYWludChnYywgY2VsbFByb3BlcnRpZXMpO1xuXG4gICAgICAgIHRoaXMucmVuZGVyZWRDb2x1bW5NaW5XaWR0aHNbY10gPSBNYXRoLm1heChjZWxsUHJvcGVydGllcy5taW5XaWR0aCB8fCAwLCB0aGlzLnJlbmRlcmVkQ29sdW1uTWluV2lkdGhzW2NdKTtcbiAgICAgICAgY29sdW1uUHJvcGVydGllcy5wcmVmZXJyZWRXaWR0aCA9IHRoaXMucmVuZGVyZWRDb2x1bW5NaW5XaWR0aHNbY107XG4gICAgfSxcblxuICAgIGlzVmlld2FibGVCdXR0b246IGZ1bmN0aW9uKGMsIHIpIHtcbiAgICAgICAgdmFyIGtleSA9IGMgKyAnLCcgKyByO1xuICAgICAgICByZXR1cm4gdGhpcy5idXR0b25DZWxsc1trZXldID09PSB0cnVlO1xuICAgIH0sXG5cbiAgICBnZXRSb3dOdW1iZXJzV2lkdGg6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgY29sRWRnZXMgPSB0aGlzLmdldENvbHVtbkVkZ2VzKCk7XG4gICAgICAgIGlmIChjb2xFZGdlcy5sZW5ndGggPT09IDApIHtcbiAgIC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bXB0eSgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge0FycmF5fVxuICAgICAqL1xuICAgIGdldEZsYXR0ZW5lZFlzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IFtdO1xuICAgICAgICB2YXIgc2V0ID0ge307XG4gICAgICAgIHRoaXMuc2VsZWN0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgdmFyIHRvcCA9IHNlbGVjdGlvbi5vcmlnaW4ueTtcbiAgICAgICAgICAgIHZhciBzaXplID0gc2VsZWN0aW9uLmV4dGVudC55ICsgMTtcbiAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgc2l6ZTsgcisrKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRpID0gciArIHRvcDtcbiAgICAgICAgICAgICAgICBpZiAoIXNldFt0aV0pIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2godGkpO1xuICAgICAgICAgICAgICAgICAgICBzZXRbdGldID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXN1bHQuc29ydChmdW5jdGlvbih4LCB5KSB7XG4gICAgICAgICAgICByZXR1cm4geCAtIHk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHBhcmFtIG9mZnNldFxuICAgICAqL1xuICAgIHNlbGVjdFJvd3NGcm9tQ2VsbHM6IGZ1bmN0aW9uKG9mZnNldCkge1xuICAgICAgICBvZmZzZXQgPSBvZmZzZXQgfHwgMDtcblxuICAgICAgICB2YXIgc20gPSB0a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IHhcbiAgICAgKiBAcGFyYW0geVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGlzSW5DdXJyZW50U2VsZWN0aW9uUmVjdGFuZ2xlOiBmdW5jdGlvbih4LCB5KSB7XG4gICAgICAgIHZhciBsYXN0ID0gdGhpcy5zZWxlY3Rpb25zW3RoaXMuc2VsZWN0aW9ucy5sZW5ndGggLSAxXTtcbiAgICAgICAgcmV0dXJuIGxhc3QgJiYgdGhpcy5yZWN0YW5nbGVDb250YWlucyhsYXN0LCB4LCB5KTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFNlbGVjdGlvbk1vZGVsLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSByZWN0XG4gICAgICogQHBhcmFtIHhcbiAgICAgKiBAcGFyYW0geVxuICAgICAqIEByZXR1cm5zIHtib29sZWFufVxuICAgICAqL1xuICAgIHJlY3RhbmdsZUNvbnRhaW5zOiBmdW5jdGlvbihyZWN0LCB4LCB5KSB7IC8vVE9ETzogZXhwbG9yZSB3aHkgdGhpcyB3b3JrcyBhbmQgY29udGFpbnMgb24gcmVjdGFuZ2x1bGFyIGRvZXMgbm90XG4gICAgICAgIHZhciBtaW5YID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgbWF4WCA9IG1pblggKyByZWN0LmV4dGVudC54O1xuICAgICAgICB2YXIgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICAgICBtYXhZID0gcmVjdC5vcm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uKTtcbiAgICAgICAgdGhpcy5hbGxDb2x1bW5zLnB1c2goY29sdW1uKTtcbiAgICAgICAgcmV0dXJuIGNvbHVtbjtcbiAgICB9LFxuXG4gICAgY3JlYXRlQ29sdW1uczogZnVuY3Rpb24oKSB7XG4gICAgICAgIC8vY29uY3JldGUgaW1wbGVtZW50YXRpb24gaGVyZVxuICAgIH0sXG5cbiAgICBjcmVhdGVDb2x1bW5Qcm9wZXJ0aWVzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHRhYmxlU3RhdGUgPSB0aGlzLmdldFByaXZhdGVTdGF0ZSgpO1xuICAgICAgICB2YXIgcHJvcGVydGllcyA9IE9iamVjdC5jcmVhdGUodGFibGVTdGF0ZSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5yb3dOdW1iZXJzUHJvcGVydGllcyA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9udCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5jb2x1bW5IZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlckNvbHVtblNlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy5jb2x1bW5IZWFkZXIsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnJvd0hlYWRlclJvd1NlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy5yb3dIZWFkZXIsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmZpbHRlclByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJTdHlsZToge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGU7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclN0eWxlID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJUaGlja25lc3M6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclRoaWNrbmVzcztcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnRyZWVDb2x1bW5Qcm9wZXJ0aWVzID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXNDb2x1bW5TZWxlY3Rpb24gPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWV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GUgZXhwb3J0IHByb3BlcnRpZXNcbiAgICAgKi9cbiAgICBjbGVhck9iamVjdFByb3BlcnRpZXM6IGZ1bmN0aW9uKG9iaiwgZXhwb3J0UHJvcHMpIHtcbiAgICAgICAgZm9yICh2YXIga2V5IGluIG9iaikge1xuICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgIG9iai5oYXNPd25Qcm9wZXJ0eShrZXkpICYmIChcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0UHJvcHMgPT09IHVuZGVmaW5lZCB8fFxuICAgICAgICAgICAgICAgICAgICAhZXhwb3J0UHJvcHMgJiYgbm9FeHBvcnRQcm9wZXJ0aWVzLmluZGV4T2Yoa2V5KSA+PSAwIHx8XG4gICAgICAgICAgICAgICAgICAgIGV4cG9ydFByb3BzICYmIG5vRXhwb3J0UHJvcGVydGllcy5pbmRleE9mKGtleSkgPCAwXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgZGVsZXRlIG9ialtrZXldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBCZWhhdmlvci5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBnZXR0ZXIgZm9yIGEgW01lbWVudG9dKGh0dHA6Ly9jMi5jb20vY2dpL3dpa2k/TWVtZW50b1BhdHRlcm4pIE9iamVjdFxuICAgICAqIEByZXR1cm5zIHtvYmplY3R9XG4gICAgICovXG4gICAgZ2V0UHJpdmF0ZVN0YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgaWYgKCF0aGlzLnRhYmxlU3RhdGUpIHtcbiAgICAgICAgICAgIHRoaXMudGFibGVTdGF0ZSA9IHRoaXMuZ2V0RGVmYXVsdFN0YXRlKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMudGFibGVTdGF0ZTtcbiAgICB9LFxuXG4gICAgLy90aGlzIGlzIGVm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vbHVtbkluZGV4ZXNbaV07XG4gICAgICAgICAgICBsYWJlbHMucHVzaCh7XG4gICAgICAgICAgICAgICAgaWQ6IGlkLFxuICAgICAgICAgICAgICAgIGxhYmVsOiB0aGlzLmdldEhlYWRlcihpZCksXG4gICAgICAgICAgICAgICAgZmllbGQ6IHRoaXMuZ2V0RmllbGQoaWQpXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGFiZWxzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgZmllbGQgYXQgYGNvbEluZGV4YC5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gY29sSW5kZXggLSB0aGUgY29sdW1uIGluZGV4IG9mIGludGVyZXN0XG4gICAgICovXG4gICAgZ2V0RmllbGQ6IGZ1bmN0aW9uKGNvbEluZGV4KSB7XG4gICAgICAgIGlmIChjb2xJbmRleCA9PT0gLTEpIHtcbiAgICAgICAgICAgIHJldHVybiAndHJlZSc7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGNvbCA9IHRoaXMuZ2V0Q29sdW1uKGNvbEluZGV4KTtcbiAgICAgICAgcmV0dXJuIGNvbC5nZXRGaWVsZCgpO1xuICAgIH0sXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEJlaGF2aW9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm4ge3N0cmluZ30gVGhlIGNvbHVtbiBoZWFkaW5nIGF0IGBjb2xJbmRleCcuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4IC0gdGhlIGNvbHVtbiBpbmRleCBvZiBpbnRlcmVzdFxuICAgICAqL1xuICAgIGdldEhlYWRlcjogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgaWYgKGNvbEluZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgcmV0dXJuICdUcm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B7fSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDZWxsRWRpdG9yLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGNoZWNrIHRoYXQgdGhlIGVkaXRvciBpcyBpbiB0aGUgY29ycmVjdCBsb2NhdGlvbiwgYW5kIGlzIHNob3dpbmcvaGlkZGVuIGFwcHJvcHJpYXRlbHlcbiAgICAgKi9cbiAgICBjaGVja0VkaXRvcjogZnVuY3Rpb24oKSB7XG4gICAgICAgIGlmICghdGhpcy5jaGVja0VkaXRvclBvc2l0aW9uRmxhZykge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jaGVja0VkaXRvclBvc2l0aW9uRmxhZyA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdGhpcy5pc0VkaXRpbmcpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIgZWRpdG9yUG9pbnQgPSB0aGlzLmdldEVkaXRvclBvaW50KCk7XG4gICAgICAgIGlmICh0aGlzLmdyaWQuaXNEYXRhVmlzaWJsZShlZGl0b3JQb2ludC54LCBlZGl0b3JQb2ludC55KSkge1xuICAgICAgICAgICAgdGhpcy5tb3ZlRWRpdG9yKCk7XG4gICAgICAgICAgICB0aGlzLnNob3dFZGl0b3IoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuaGlkZUVkaXRvcigpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIGdldEdyaWQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5ncmlkO1xuICAgIH0sXG5cbiAgICB0ZW1wbGF0ZTogZnVuY3Rpb24oKSB7XG4gICAgICAgIC8qXG5cbiAgICAgICAgICovXG4gICAgfSxcblxuICAgIGdldEhUTUw6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc3RyaW5nID0gdGhpcy50Z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sjaXRlbXN9fVxuICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiB2YWx1ZT1cInt7Ln19XCI+e3sufX08L29wdGlvbj5cbiAgICAgICAgICAgICAgICAgICAge3svaXRlbXN9fVxuICAgICAgICAgICAgICAgIDwvc2VsZWN0PlxuICAgICAgICAgICAgKi9cbiAgICB9LFxuXG4gICAgLy9ubyBldmVudHMgYXJlIGZpcmVkIHdoaWxlIHRoZSBkcm9wZG93biBpcyBvcGVuXG4gICAgLy9zZWUgaHR0cDovL2pzZmlkZGxlLm5ldC9tNHRuZHR1NC82L1xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBzaG93RWRpdG9yOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLmlucHV0LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJztcbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuc2hvd0Ryb3Bkb3duKHNlbGYuaW5wdXQpO1xuICAgICAgICB9LCA1MCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDaG9pY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIGl0ZW1zXG4gICAgICovXG4gICAgc2V0SXRlbXM6IGZ1bmN0aW9uKGl0ZW1zKSB7XG4gICAgICAgIHRoaXMuaXRlbXMgPSBpdGVtcztcbiAgICAgICAgdGhpcy51cGRhdGVWaWV3KCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDaG9pY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIGlucHV0XG4gICAgICovXG4gICAgaW5pdGlhbGl6ZUlucHV0OiBmdW5jdGlvbihpbnB1dCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIFNpbXBsZS5wc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yB8fCBlLmtleUNvZGUgPT09IDgpKSB7XG4gICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGlmIChlLmtleUNvZGUgPT09IDgpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbGVhclN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkucmVwYWludCgpO1xuICAgICAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLnRha2VGb2N1cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleVVwRXZlbnQoc2VsZiwgZSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdrZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleURvd25FdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXByZXNzJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coJ2tleXByZXNzJywgZS5rZXlDb2RlKTtcbiAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLmZpcmVTeW50aGV0aWNFZGl0b3JLZXlQcmVzc0V2ZW50KHNlbGYsIGUpO1xuICAgICAgICB9KTtcbiAgICAgICAgLy8gaW5wdXQuYWRk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SB7IGhlYWRlciA9IHNvcnRTdHJpbmcgKyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVhZGVyUm93Q291bnQpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyUm93VmFsdWUoeCwgeSwgdmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGhhc0hpZXJhcmNoeUNvbHVtbikge1xuICAgICAgICAgICAgeSArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXREYXRhU291cmNlKCkuc2V0VmFsdWUoeCwgeSAtIGhlYWRlclJvd0NvdW50LCB2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5jaGFuZ2VkKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIHNldEhlYWRlclJvd1ZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3NldEhlYWRlcih4LCB5KTsgLy8geSBpcyByZWFsbHkgdGhlIHZhbHVlXG4gICAgICAgIH1cbiAgICAgICAgdmFyIGdyaWQgPSB0aGlzLmdldEdyaWQoKTtcbiAgICAgICAgdmFyIGlzRmls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W0ge251bWJlcn0gY29sSW5kZXhcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Qcm9wZXJ0aWVzOiBmdW5jdGlvbihjb2xJbmRleCkge1xuICAgICAgICAvL2FjY2VzcyBkaXJlY3RseSBiZWNhdXNlIHdlIHdhbnQgaXQgb3JkZXJlZFxuICAgICAgICB2YXIgY29sdW1uID0gdGhpcy5nZXRCZWhhdmlvcigpLmFsbENvbHVtbnNbY29sSW5kZXhdO1xuICAgICAgICBpZiAoY29sdW1uKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sdW1uLmdldFByb3BlcnRpZXMoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleFxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEZpbHRlcjogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBpZiAoIWNvbHVtblByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Db3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9XG4gICAgICovXG4gICAgZ2V0Um93Q291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgY291bnQgPSB0aGlzLmdldERhdGFTb3VyY2UoKS5nZXRSb3dDb3VudCgpO1xuICAgICAgICBjb3VudCArPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIHJldHVybiBjb3VudDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7c3RyaW5nW119XG4gICAgICovXG4gICAgZ2V0SGVhZGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRIZWFkZXJzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQ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AgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgZmllbGQ6IGZpZWxkc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGdyb3VwcztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0QXZhaWxhYmxlR3JvdXBzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB0aGlzLnNvdXJjZS5nZXRIZWFkZXJzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmF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AgICBpZiAoYWxyZWFkeSA+IC0xKSB7XG4gICAgICAgICAgICBpZiAoc3RhdGUuc29ydHNbYWxyZWFkeV0gPiAwKSB7XG4gICAgICAgICAgICAgICAgc3RhdGUuc29ydHNbYWxyZWFkeV0gPSAtMSAqIHN0YXRlLnNvcnRzW2FscmVhZHldO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzdGF0ZS5zb3J0cy5zcGxpY2UoYWxyZWFkeSwgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoaGFzQ1RSTCB8fCBzdGF0ZS5zb3J0cy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc3RhdGUuc29ydHMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzdGF0ZS5zb3J0cy5sZW5ndGggPiAzKSB7XG4gICAgICAgICAgICBzdGF0ZS5zb3J0cy5sZW5ndGggPSAzO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERPV05XQVJEU19CTEFDS19BUlJPVztcbiAgICAgICAgICAgIHJldHVybiByYW5rICsgYXJyb3cgKyAnICc7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IHJhbmsgKyAodXAgPyAnLXVwJyA6ICctZG93bicpO1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRCZWhhdmlvcigpLmdldEltYWdlKG5hbWUpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBjZWxsXG4gICAgICogQHBhcmFtIGV2ZW50XG4gICAgICovXG4gICAgY2VsbENsaWNrZWQ6IGZ1bmN0aW9uKGNlbGwsIGV2ZW50KSB7XG4gICAgICAgIGlmICghdGhpcy5oYXNBZ2dyZWdhdGVzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZXZlbnQuZ3JpZENlbGwueCAhPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuOyAvLyB0aGlzIHdhc24ndCBhIGNsaWNrIG9uIHRoZSBoaWVyYXJjaHkgY29sdW1uXG4gICAgICAgIH1cbiAgICAgICAgdmFyIGdyaWQgPSB0aGlzLmdldEdyaWQoKTtcbiAgICAgICAgdmFyIGhlYWRlclJvd0NvdW50ID0gZ3JpZC5nZXRIZWFkZXJSb3dDb3VudCgpO1xuICAgICAgICB2YXIgeSA9IGV2ZW50LmdyaWRDZWx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ICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIGlmICh0aGlzLmhhc0FnZ3JlZ2F0ZXMoKSkge1xuICAgICAgICAgICAgcmVzdWx0LnRyZWUgPSB0aGlzLmdldFZhbHVlKC0yLCB5KTtcbiAgICAgICAgICAgIGZpZWxkcy5zaGlmdCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgcmVzdWx0W2ZpZWxkc1tpXV0gPSB0aGlzLmdldFZhbHVlKGksIHkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fVxuICAgICAqL1xuICAgIGdldENvbXB1dGVkUm93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHZhciByY2YgPSB0aGlzLmdldFJvd0NvbnRleHRGdW5jdGlvbihbeV0pO1xuICAgICAgICB2YXIgZmllbGRzID0gdGhpcy5nZXRGaWVsZHMoKTtcbiAgICAgICAgdmFyIHJvdyA9IHt9O1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGZpZWxkcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgdmFyIGZpZWxkID0gZmllbGRzW2ldO1xuICAgICAgICAgICAgcm93W2ZpZWxkXSA9IHJjZihmaWVsZClbMF07XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJvdztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gZmllbGROYW1lXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBA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geSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eS5cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIWdyaWQuaXNDZWxsU2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrIHx8ICF0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIHZhciBkeCA9IGNlbGwueDtcbiAgICAgICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudD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cy5jdXJzb3IgPSBudWxsO1xuICAgICAgICBncmlkLnJlcGFpbnQoKTtcblxuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cblxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbE1vdmluZy5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBoYW5kbGUgdGhpcyBldmVudFxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZU1vdmU6IGZ1bmN0aW9uKGdyaWQsIGV2ZW50KSB7XG5cbiAgICAgICAgaWYgKCF0aGlzLmRyYWdnaW5nICYmIGV2ZW50Lm1vdXNlUG9pbnQueSA8IDUgJiYgZXZlbnQudmlld1BvaW50LnkgPT09IDApIHtcbiAgICAgICAgICAgIHRoaXMuY3Vyc29yID0gdGhpcy5nZXRDYW5EcmFnQ3Vyc29yTmFtZSgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jdXJzb3IgPSBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlTW92ZShncmlkLCBldmVudCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5pc0hlYWRlclJvdyhncmlkLCBldmVudCkgJiYgdGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgdGhpcy5jdXJzb3IgPSB0aGlzLmdldERyYWdnaW5nQ3Vyc29yTmFtZSgpOyAvL21vdmUnO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDZWxsTW92aW5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KSB7XG4gICAgICAgICAgICAgICAgc2VsZi5zZXRDcm9zc0Jyb3dzZXJQcm9wZXJ0eShkLCAndHJhbnNpdGlvbicsIChzZWxmLmlzV2Via2l0ID8gJy13ZWJraXQtJyA6ICcnKSArICd0cmFuc2Zvcm0gJyArIGNvbHVtbkFuaW1hdGlvblRpbWUgKyAnbXMgZWFzZScpO1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zZm9ybScsICd0cmFuc2xhdGUoJyArIGRyYWdnZXJTdGFydFggKyAncHgsICcgKyAtMiArICdweCknKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICAvL25lZWQgdG8gY2hhbmdlIHRoaXMgdG8ga2V5IGZyYW1lc1xuXG4gICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zaXRpb24nLCAnJyk7XG4gICAgICAgICAgICAgICAgZ3JpZC5yZW5kZXJPdmVycmlkZXNDYWNoZS5mbG9hdGVyID0gbnVsbDtcbiAgICAgICAgICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICAgICAgICAgICAgICBzZWxmLmRvRmxvYXRlckFuaW1hdGlvbihncmlkKTtcbiAgICAgICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIGQuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Zsb2F0aW5nTm93ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LCBjb2x1bW5BbmltYXRpb25UaW1lICsgNTApO1xuICAgICAgICB9O1xuICAgIH0sXG5cbiAgICAv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pcy5pc0Zsb2F0aW5nTm93KSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmlzRmxvYXRpbmdOb3cgPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5jcmVhdGVGbG9hdENvbHVtbihncmlkLCBvdmVyQ29sKTtcbiAgICAgICAgICAgIHRoaXMuZmxvYXRDb2x1bW5UbyhncmlkLCBkcmFnZ2VkVG9UaGVSaWdodCk7XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIGlmICh4IDwgbWluWCAtIDEwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5jaGVja0F1dG9TY3JvbGxUb0xlZnQoZ3JpZCwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IG1pblggLSAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdMZWZ0ID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL2xldHMgY2hlY2sgZm9yIGF1dG9zY3JvbGwgdG8gcmlnaHQgaWYgd2VyZSB1cCBhZ2FpbnN0IGl0XG4gICAgICAgICAgICBpZiAoYXRNYXggfHwgeCA+IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tBdXRvU2Nyb2xsVG9SaWdodChncmlkLCB4KTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA8IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdSaWdodCA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDZWxsTW92aW5nLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGF1dG9zY3Jvb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xuICAgICAqL1xuICAgIGhhbmRsZU1vdXNlRG93bjogZnVuY3Rpb24oZ3JpZCwgZXZlbnQpIHtcbiAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVLZXlEb3duOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlS2V5RG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9L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cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2Mgb3BlbiB0aGUgY29sdW1uIHBpY2tlclxuICAgICAqICMjIyMgcmV0dXJuczogdHlwZVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICovXG4gICAgb3BlbkNvbHVtblBpY2tlcjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5pc0NvbHVtblBpY2tlck9wZW4oKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMub3BlbkVkaXRvciA9IHRydWU7XG4gICAgICAgIGlmIChncmlkLmdldEJlaGF2aW9yKCkub3BlbkVkaXRvcih0aGlzLm92ZXJsYXkpID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gZ3JpZC5yZXNvbHZlUHJvcGVydHkoJ2JhY2tncm91bmRDb2xvcicpO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS50b3AgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUucmlnaHQgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYm90dG9tID0gJzAlJztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLmxlZnQgPSAnMCUnO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5Ub3AgPSAnMTVweCc7XG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5SaWdodCA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkJvdHRvbSA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkxlZnQgPSAnMTVweCc7XG5cbiAgICAgICAgc2VsZi5vdmVybGF5LnN0eWxlLmRpc3BsYXkgPSAnJztcblxuXG4gICAgICAgIGlmICghdGhpcy5fY2xvc2VyKSB7XG4gICAgICAgICAgICB0aGlzLl9jbG9zZXIgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IHNlbGYuZ2V0Q2hhckZvcihncmlkLCBlLmtleUNvZGUpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgdmFyIGtleXMgPSBncmlkLnJlc29sdmVQcm9wZXJ0eSgnZWRpdG9yQWN0aXZhdGlvbktleXMnKTtcbiAgICAgICAgICAgICAgICBpZiAoa2V5cy5pbmRleE9mKGtleSkgPiAtMSB8fCBlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbG9zZUNvbHVtblBpY2tlcihncmlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy9ncmlkLnNldEZvY3VzYWJsZShmYWxzZSk7XG4gICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYub3ZlcmxheS5zdHlsZS5vcGFjaXR5ID0gMC45NTtcbiAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBzZWxmLl9jbG9zZXIsIGZhbHNlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuZm9jdXMoKTtcbiAgICAgICAgfSwgMTAwKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG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ljaztcbiAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgdmFyIHZpZXdDZWxsID0gZXZlbnQudmlld1BvaW50O1xuICAgICAgICB2YXIgZHggPSBjZWxsLng7XG4gICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuXG4gICAgICAgIHZhciBpc0hlYWRlciA9IGdyaWQuaXNTaG93Um93TnVtYmVycygpICYmIGR4IDwgMDtcblxuICAgICAgICBpZiAoIWdyaWQuaXNSb3dTZWxlY3Rpb24oKSB8fCBpc1JpZ2h0Q2xpY2sgfHwgIWlzSGVhZGVyKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnkgPCBudW1GaXhlZFJvd3MpIHtcbiAgICAgICAgICAgICAgICBkeSA9IHZpZXdDZWxsLnk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBkQ2VsbCA9IGdyaWQubmV3UG9pbnQoMCwgZHkpO1xuXG4gICAgICAgICAgICB2YXIgcHJpbUV2ZW50ID0gZXZlbnQucHJpbWl0aXZlRXZlbnQ7XG4gICAgICAgICAgICB2YXIga2V5cyA9IHByaW1FdmVudC5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIHRoaXMuZHJhZ0FybWVk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ZTsnLFxuICAgICAgICAnICAgIC1vLXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgdXNlci1zZWxlY3Q6IG5vbmU7JyxcbiAgICAgICAgJyAgICBvdmVyZmxvdzogaGlkZGVuOyB9JyxcbiAgICAgICAgJ3Zpc2libGUgeyBvcGFjaXR5OiAwLjc1OyB9JyxcbiAgICAgICAgJ2hpZGRlbiB7IG9wYWNpdHk6IDAuMDsgfScsXG4gICAgICAgICdlZGl0b3IgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgZGlzcGxheTogbm9uZTsnLFxuICAgICAgICAnICAgIGJvcmRlcjogc29saWQgMnB4IGJsYWNrOycsXG4gICAgICAgICcgICAgb3V0bGluZTogMDsnLFxuICAgICAgICAnICAgIHBhZGRpbmc6IDA7JyxcbiAgICAgICAgJyAgICB6LWluZGV4OiAxMDAwOyB9J1xuICAgIF0sXG4gICAgJ2xpc3QtZHJhZ29uJzogW1xuICAgICAgICAnZGl2LmRyYWdvbi1saXN0LCBsaS5kcmFnb24tcG9wIHsnLFxuICAgICAgICAnICAgIGZvbnQtZmFtaWx5OiBSb2JvdG8sIHNhbnMtc2VyaWY7JyxcbiAgICAgICAgJyAgICB0ZXh0LXRyYW5zZm9ybTogY2FwaXRhbGl6ZTsgfScsXG4gICAgICAgICdkaXYuZHJhZ29uLWxpc3QgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgdG9wOiA0JTsnLFxuICAgICAgICAnICAgIGxlZnQ6IDQlOycsXG4gICAgICAgICcgICAgaGVpZ2h0OiA5MiU7JyxcbiAgICAgICAgJyAgICB3aWR0aDogMjAlOyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdDpudGgtY2hpbGQoMikgeyBsZWZ0OiAyOCU7IH0nLFxuICAgICAgICAnZGl2LmRyYWdvbi1saXN0Om50aC1jaGlsZCgzKSB7IG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Bwcm90b3R5cGVBZGRpdGlvbnNba2V5XTtcbiAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSAnaW5pdGlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWxpYXNdLCBhbGlhcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycgJiYgdmFsdWVbMF0gPT09ICcjJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFrZUFsaWFzKHZhbHVlLCBrZXkuc3Vic3RyKDEpKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZVtrZXldID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBDb25zdHJ1Y3RvcjtcblxuICAgIGZ1bmN0aW9uIG1ha2VBbGlhcyh2YWx1ZSwga2V5KSB7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tc2hhZG93XG4gICAgICAgIHBy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GlzIHR5cGljYWxseTpcbiAgICAgKiAqIEEgKipjb250ZW50IGNvbnRhaW5lcioqIGVsZW1lbnQsIHdoaWNoIGNvbnRhaW5zOlxuICAgICAqICAgICogVGhlIGNvbnRlbnQgZWxlbWVudChzKVxuICAgICAqICAgICogVGhpcyAqKnNjcm9sbGJhciBlbGVtZW50KiosIHdoaWNoIGluIHR1cm4gY29udGFpbnM6XG4gICAgICogICAgICAgICogVGhlICoqdGh1bWIgZWxlbWVudCoqXG4gICAgICpcbiAgICAgKiBAdHlwZSB7RWxlbWVudH1cbiAgICAgKiBAbWVtYmVyT2YgRmluQmFyLnByb3RvdHlwZVxuICAgICAqL1xuICAgIHZhciBiYXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTtcblxuICAgIGJhci5jbGFzc0xpc3QuYWRkKCdmaW5iYXItdmVydGljYWwnKTtcblxuICAgIGJhci5hcHBlbmRDaGlsZCh0aHVtYik7XG4gICAgaWYgKHRoaXMucGFnaW5nKSB7XG4gICAgICAgIGJhci5vbmNsaWNrID0gYm91bmQub25jbGljaztcbiAgICB9XG4gICAgdGhpcy5iYXIgPSBiYXI7XG5cbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgIC8vIHByZXNldHNcbiAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIEZpbkJhci5wcm90b3R5cGVba2V5XSAhPT0gJ2Z1bmN0aW9uJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAvLyBvdmVycmlkZSBwcm90b3R5cGUgZGVmYXVsdHMgZm9yIHN0YW5kYXJkIDtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXh0ZW5kIHdpdGggYWRkaXRpb25hbCBwcm9wZXJ0aWVzIChmb3IgdXNlIGluIG9uY2hhbmdlIGV2ZW50IGhhbmRsZXJzKVxuICAgICAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBvcHRpb247XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjc3NJbmplY3Rvcihjc3NGaW5CYXJzLCAnZmluYmFyLWJhc2UnLCBvcHRpb25zLmNzc1N0eWxlc2hlZXRSZWZlcmVuY2VFbGVtZW50KTtcbn1cblxuRmluQmFyLnByb3RvdHlwZSA9IHtcblxuICAgIC8qKlxuICAgICAqIEBzd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ICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gYmFyIHNpemUgZ2l2ZW4gYXMgcGVyY2VudGFnZSBvZiBjb250YWluZXIsIGlmIGJhciBoYXMgbWFyZ2lucywgcmVzdGF0ZSBzaXplIGluIHBpeGVscyBsZXNzIG1hcmdpbnMuXG4gICAgICAgICAgICAgICAgICAgIC8vIChJZiBsZWZ0IGFzIHBlcmNlbnRhZ2UsIENTUydzIGNhbGN1bGF0aW9uIHdpbGwgbm90IGV4Y2x1ZGUgbWFyZ2lucy4pXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcmllbnRlZCA9IGF4aXNba2V5XSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbnMgPSBiYXJSZWN0W29yaWVudGVkLm1hcmdpbkxlYWRpbmddICsgYmFyUmVjdFtvcmllbnRlZC5tYXJnaW5UcmFpbGluZ107XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXJnaW5zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSBwYXJzZUludCh2YWwsIDEwKSAvIDEwMCAqIGNvbnRhaW5lclJlY3Rbb3JpZW50ZWQuc2l6ZV0gLSBtYXJnaW5zICsgJ3B4JztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgIC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yBCb3VuZCB0byByZWFsIGNvbnRlbnQ6IENvbnRlbnQgd2FzIGdpdmVuIGJ1dCBubyBvbmNoYW5nZSBoYW5kbGVyLlxuICAgICAgICAvLyBTZXQgdXAgLm9uY2hhbmdlLCAuY29udGFpbmVyU2l6ZSwgYW5kIC5pbmNyZW1lbnQuXG4gICAgICAgIC8vIE5vdGUgdGhpcyBvbmx5IG1ha2VzIHNlbnNlIGlmIHlvdXIgaW5kZXggdW5pdCBpcyBwaXhlbHMuXG4gICAgICAgIGlmICh0aGlzLmNvbnRlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5vbmNoYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMub25jaGFuZ2UgPSB0aGlzLnNjcm9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uY2hhbmdlID09PSB0aGlzLnNjcm9sbFJlYWxDb250ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lclNpemUgPSBjb250YWluZXJSZWN0W3RoaXMub2guc2l6ZV07XG4gICAgICAgICAgICB0aGlzLmluY3JlbWVudCA9IHRoaXMuY29udGFpbmVyU2l6ZSAvICh0aGlzLmNvbnRlbnRTaXplIC0gdGhpcy5jb250YWluZXJTaXplKSAqICh0aGlzLl9tYXggLSB0aGlzLl9taW4pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jb250YWluZXJTaXplID0gMTtcbiAgICAgICAgICAgIHRoaXMuaW5jcmVtZW50ID0gaW5jcmVtZW50IHx8IHRoaXMuaW5jcmVtZW50O1xuICAgICAgICB9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TtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX2JvdW5kLm9ubW91c2VvdXQoZXZ0KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV2dC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgfVxufTtcblxudmFyIG9yaWVudGF0aW9uSGFzaGVzID0ge1xuICAgIHZlcnRpY2FsOiB7XG4gICAgICAgIGNvb3JkaW5hdGU6ICAgICAnY2xpZW50WScsXG4gICAgICAgIGF4aXM6ICAgICAgICAgICAncGFnZVknLFxuICAgICAgICBzaXplOiAgICAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgIG91dHNpZGU6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6ICAgICAgICAgICAnd2lkdGgnLFxuICAgICAgICBvdXRzaWRlOiAgICAgICAgJ2JvdHRvbScsXG4gICAgICAgIGluc2lkZTogICAgICAgICAndG9wJyxcbiAgICAgICAgbGVhZGluZzogICAgICAgICdsZWZ0JyxcbiAgICAgICAgdHJhaWxpbmc6ICAgICAgICdyaWdodCcsXG4gICAgICAgIG1hcmdpbkxlYWRp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ICAgICByZXR1cm4gY2hhck1hcDtcbiAgICB9LFxuXG4gICAgZmlua2V5ZG93bjogZnVuY3Rpb24oZSkge1xuICAgICAgICBpZiAoIXRoaXMuaGFzRm9jdXMoKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgLy9lLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgaWYgKGUucmVwZWF0KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5yZXBlYXRLZXkgPT09IGtleUNoYXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5zcGxpY2UodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpLCAxKTtcbiAgICAgICAgaWYgKCF0aGlzLmhhc0ZvY3VzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgdGhpcy5yZXBlYXRLZXkgPSBudWxsO1xuICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IDA7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1rZXl1cCcsIHtcbiAgICAgICAgICAgIGFsdDogZS5hbHRLZXksXG4gICAgICAgICAgICBjdHJsOiBlLmN0cmxLZXksXG4gICAgICAgICAgICBjaGFyOiBrZXlDaGFyLFxuICAgICAgICAgICAgY29kZTogZS5jaGFyQ29kZSxcbiAgICAgICAgICAgIGtleTogZS5rZXlDb2RlLFxuICAgICAgICAgICAgbWV0YTogZS5tZXRhS2V5LFxuICAgICAgICAgICAgcmVwZWF0OiBlLnJlcGVhdCxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmZvY3VzZ2FpbmVkOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1mb2N1cy1nYWluZWQnKTtcbiAgICB9LFxuXG4gICAgZmluZm9jdXNsb3N0OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1mb2N1cy1sb3N0Jyk7XG4gICAgfSxcblxuICAgIGZpbmNvbnRleHRtZW51OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIGlmIChlLmN0cmxLZXkgJiYgdGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKCdDVFJMJykgPT09IC0xKSB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRLZXlzLnB1c2goJ0NUUkwnKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoRGF0ZS5ub3coKSAtIHRoaXMubGFzdENsaWNrVGltZSA8IDI1MCkge1xuICAgICAgICAgICAgLy90aGlzIGlzIGEgZG91YmxlIGNsaWNrLi4uXG4gICAgICAgICAgICB0aGlzLmZpbmRibGNsaWNrKGUpO1xuICAgICAgICAgICAgcm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ludGFibGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwYWludGFibGVzW2ldLnRpY2tQYWludGVyKG5vdyk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKHBhaW50TG9vcEZ1bmN0aW9uKTtcbn1cbnJlcXVlc3RBbmltYXRpb25GcmFtZShwYWludExvb3BGdW5jdGlvbik7XG5cbmZ1bmN0aW9uIHJlc2l6YWJsZXNMb29wRnVuY3Rpb24obm93KSB7XG4gICAgaWYgKCFyZXNpemVMb29wUnVubmluZykge1xuICAgICAgICByZXR1cm47XG4gICAgfVxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcmVzaXphYmxlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzaXphYmxlc1tpXS50aWNrUmVzaXplcihub3cpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgICAgICB9XG4gICAgfVxufVxuc2V0SW50ZXJ2YWwocmVzaXphYmxlc0xvb3BGdW5jdGlvbiwgUkVTSVpFX1BPTExJTkdfSU5URVJWQUwpO1xuXG5mdW5jdGlvbiBtYWtlQ2hhck1hcCgpIHtcbiAgICB2YXIgbWFwID0gW107XG5cbiAgICB2YXIgZW1wdHkgPSBbJycsICcnXTtcblxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgMjU2OyBpKyspIHtcbiAgICAgICAgbWFwW2ldID0gZW1wdHk7XG4gICAgfVxuXG4gICAgbWFwWzI3XSA9IFsnRVNDJywgJ0VTQ1NISUZUJ107XG4gICAgbWFwWzE5Ml0gPSBbJ2AnLCAnfiddO1xuICAgIG1hcFs0OV0gPSBbJzEnLCAnISddO1xuICAgIG1hcFs1M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MsIGxvZ2dlcikge1xuICAgIHRoaXMuZ2MgPSBnYztcblxuICAgIHZhciBzZWxmID0gdGhpcztcbiAgICB2YXIgcmVXRUJLSVQgPSAvXndlYmtpdC87XG5cbiAgICBzd2l0Y2ggKHR5cGVvZiBsb2dnZXIpIHtcblxuICAgICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICAgICAgbG9nZ2VyID0gIGNvbnNvbGVMb2dnZXIuYmluZCh1bmRlZmluZWQsIGxvZ2dlciArICcuJyk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgICAgIGlmIChsb2dnZXIgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIgPSBjb25zb2xlTG9nZ2VyLmJpbmQodW5kZWZpbmVkLCAnZ2MuJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdmdW5jdGlvbic6XG4gICAgICAgICAgICBpZiAobG9nZ2VyLmxlbmd0aCAhPT0gMykge1xuICAgICAgICAgICAgICAgIHRocm93ICdHcmFwaGljc0NvbnRleHQ6IFVzZXItc3VwcGxpZWQgQVBJIGxvZ2dlciBmdW5jdGlvbiBkb2VzIG5vdCBhY2NlcHQgdGhyZWUgcGFyYW1ldGVycy4nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGxvZ2dlciA9IGZhbHNlO1xuICAgIH1cblxuICAgIC8vIFN0dWIgb3V0IGFsbCB0aGUgcHJvdG90eXBlIG1lbWJlcnMgb2YgdGhlIGNhbnZhcyAyRCBncmFwaGljcyBjb250ZXh0OlxuICAgIE9iamVjdC5rZXlzKE9iamVjdC5nZXRQcm90b3R5cGVPZihnYykpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgLy8gU29tZSBvbGRlciBicm93c2VycyAoZS5nLiwgQ2hyb21lIDQwKSBkaWQgbm90IGhhdmUgYWxsIG1lbWJlcnMgb2YgY2FudmFzXG4gICAgLy8gMkQgZ3JhcGhpY3MgY29udGV4dCBpbiB0aGUgcHJvdG90eXBlIHNvIHdlIG1ha2UgdGhpcyBhZGRpdGlvbmFsIGNhbGw6XG4gICAgT2JqZWN0LmtleXMoZ2MpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgZnVuY3Rpb24gTWFrZVN0dWIoa2V5KSB7XG4gICAgICAgIGlmIChrZXkgaW4gR3JhcGhpY3NDb250ZXh0LnByb3RvdHlwZSB8fCByZVdFQktJVC50ZXN0KGtleSkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIGdjW2tleV0gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHNlbGZba2V5XSA9ICFsb2dnZXIgPyBnY1trZXldLmJpbmQoZ2MpIDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvZ2dlcihrZXksIGFyZ3VtZW50cywgZ2Nba2V5XS5hcHBseShnYywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ2VyKGtleSwgJ2dldHRlcicsIHJlc3VsdCkgOiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGdjW2tleV0gPSBsb2dnZXIgPyBsb2dnZXIoa2V5LCAnc2V0dGVyJywgdmFsdWUpIDogdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gR3JhcGhpY3NDb250ZXh0O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgWUlFTERTID0gJ1xcdTI3RjknOyAvLyBMT05HIFJJR0hUV0FSRFMgRE9VQkxFIEFSUk9XXG5cbmZ1bmN0aW9uIGNvbnNvbGVMb2dnZXIocHJlZml4LCBuYW1lLCBhcmdzLCB2YWx1ZSkge1xuICAgIHZhciByZXN1bHQgPSB2YWx1ZTtcblxuICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgIHJlc3VsdCA9ICdcIicgKyByZXN1bHQgKyAnXCInO1xuICAgIH1cblxuICAgIG5hbWUgPSBwcmVmaXggKyBuYW1lO1xuXG4gICAgc3dpdGNoIChhcmdzKSB7XG4gICAgICAgIGNhc2UgJ2dldHRlcic6XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhuYW1lLCAnPScsIHJlc3VsdCk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdzZXR0ZXInOlxuICAgICAgICAgICAgY29uc29sZS5sb2cobmFtZSwgWUlFTERTLCByZXN1bHQpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDogLy8gbWV0aG9kIGNhbGxcbiAgICAgICAgICAgIG5hbWUgKz0gJygnICsgQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJncykuam9pbignLCAnKSArICcpJztcbiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKG5hbWUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhuYW1lLCBZSUVMRFMsIHJlc3VsdCk7XG4gICA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BzaGFkb3c6IGZ1bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIGlmIChpbkVsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluRWwuc2hhZG93Um9vdCB8fCBpbkVsLndlYmtpdFNoYWRvd1Jvb3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGNhblRhcmdldDogZnVuY3Rpb24oc2hhZG93KSB7XG4gICAgICAgICAgICByZXR1cm4gc2hhZG93ICYmIEJvb2xlYW4oc2hhZG93LmVsZW1lbnRGcm9tUG9pbnQpO1xuICAgICAgICB9LFxuICAgICAgICB0YXJnZXRpbmdTaGFkb3c6IGZ1bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5zaGFkb3coaW5FbCk7XG4gICAgICAgICAgICBpZiAodGhpcy5jYW5UYXJnZXQocykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgb2xkZXJTaGFkb3c6IGZ1bmN0aW9uKHNoYWRvdykge1xuICAgICAgICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc2NvcGUudGFyZ2V0RmluZGluZyA9IHRhcmdldDtcbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBldmVudCwgZmluZHMgdGhlIFwiZGVlcGVzdFwiIG5vZGUgdGhhdCBjb3VsZCBoYXZlIGJlZW4gdGhlIG9yaWdpbmFsIHRhcmdldCBiZWZvcmUg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gICAgICAgICAgICAgICdwYW4teCBwYW4teScsXG4gICAgICAgICAgICAgICAgJ3Bhbi15IHBhbi14J1xuICAgICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICAnbWFuaXB1bGF0aW9uJ1xuICAgIF07XG4gICAgdmFyIHN0eWxlcyA9ICcnO1xuICAgIC8vIG9ubHkgaW5zdGFsbCBzdHlsZXNoZWV0IGlmIHRoZSBicm93c2VyIGhhcyB0b3VjaCBhY3Rpb24gc3VwcG9ydFxuICAgIHZhciBoYXNUb3VjaEFjdGlvbiA9IHR5cGVvZiBkb2N1bWVudC5oZWFkLnN0eWxlLnRvdWNoQWN0aW9uID09PSAnc3RyaW5nJztcbiAgICAvLyBvbmx5IGFkZCBzaGFkb3cgc2VsZWN0b3JzIGlmIHNoYWRvd2RvbSBpcyBzdXBwb3J0ZWRcbiAgICB2YXIgaGFzU2hhZG93Um9vdCA9ICF3aW5kb3cuU2hhZG93RE9NUG9seWZpbGwgJiYgZG9jdW1lbnQuaGVhZC5jcmVhdGVTaGFkb3dSb290O1xuXG4gICAgaWYgKGhhc1RvdWNoQWN0aW9uKSB7XG4gICAgICAgIGF0dHJpYjJjc3MuZm9yRWFjaChmdW5jdGlvbihyKSB7XG4gICAgICAgICAgICBpZiAoU3RyaW5nKHIpID09PSByKSB7XG4gICAgICAgICAgICAgICAgc3R5bGVzICs9IHNlbGVjdG9yKHIpICsgcnVsZShyKSArICdcXG4nO1xuICAgICAgICAgICAgICAgIGlmIChoYXNTaGFkb3dSb290KSB7XG4gICAgICAgICAgICAgICAgICAgIHN0eWxlcyArPSBzaGFkb3dTZWxlY3RvcihyKSArIHJ1bGUocikgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0eWxlcyArPSByLnNlbGVjdG9ycy5tYXAoc2VsZWN0b3IpICsgcnVsZShyLnJ1bGUpICsgJ1xcbic7XG4gICAgICAgICAgICAgICAgaWY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0aCBwcm9wZXJ0aWVzIGZyb20gYGluRGljdGAuXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuXG4gICAgdmFyIE1PVVNFX1BST1BTID0gW1xuICAgICAgICAnYnViYmxlcycsXG4gICAgICAgICdjYW5jZWxhYmxlJyxcbiAgICAgICAgJ3ZpZXcnLFxuICAgICAgICAnZGV0YWlsJyxcbiAgICAgICAgJ3NjcmVlblgnLFxuICAgICAgICAnc2NyZWVuWScsXG4gICAgICAgICdjbGllbnRYJyxcbiAgICAgICAgJ2NsaWVudFknLFxuICAgICAgICAnY3RybEtleScsXG4gICAgICAgICdhbHRLZXknLFxuICAgICAgICAnc2hpZnRLZXknLFxuICAgICAgICAnbWV0YUtleScsXG4gICAgICAgICdidXR0b24nLFxuICAgICAgICAncmVsYXRlZFRhcmdldCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWSdcbiAgICBdO1xuXG4gICAgdmFyIE1PVVNFX0RFRkFVTFRTID0gW1xuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIG51bGwsXG4gICAgICAgIG51bGwsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICAwLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwXG4gICAgXTtcblxuICAgIHZhciBOT1BfRkFDVE9SWSA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7fTtcbiAgICB9O1xuXG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHtcbiAgICAgICAgLy8gVE9ETyhkZnJlZWRtKTogdGhpcyBpcyBvdmVycmlkZGVuIGJ5IHRhcCByZWNvZ25pemVyLCBuZWVkcyByZXZpZXdcbiAgICAgICAgcHJldmVudFRhcDogTk9QX0ZBQ1RPUlksXG4gICAgICAgIG1ha2VCYXNlRXZlbnQ6IGZ1bmN0aW9uKGluVHlwZSwgaW5EaWN0KSB7XG4gICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdFdmVudCcpO1xuICAgICAgICAgICAgZS5pbml0RXZlbnQoaW5UeXBlLCBpbkRpY3QuYnViYmxlcyB8fCBmYWxzZSwgaW5EaWN0LmNhbmNlbGFibGUgfHwgZmFsc2UpO1xuICAgICAgICAgICAgZS5wcmV2ZW50VGFwID0gZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAoZSk7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZUdlc3R1cmVFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgfHwgJyc7XG4gICAgICAgICAgICBlLmh3VGltZXN0YW1wID0gaW5EaWN0Lmh3VGltZXN0YW1wIHx8IDA7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IGluRGljdC5pc1ByaW1hcnkgfHwgZmFsc2U7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSBpbkRpY3QuX3NvdXJjZSB8fCAnJztcbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHNjb3BlLmV2ZW50RmFjdG9yeSA9IGV2ZW50RmFjdG9yeTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgbW9kdWxlIGltcGxlbWVudHMgYW4gbWFwIG9mIHBvaW50ZXIgc3RhdGVzXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBVU0VfTUFQID0gd2luZG93Lk1hcCAmJiB3aW5kb3cuTWFwLnByb3RvdHlwZS5mb3JFYWNoO1xuICAgIHZhciBQT0lOVEVSU19GTiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5zaXplO1xuICAgIH07XG5cbiAgICBmdW5jdGlvbiBQb2ludGVyTWFwKCkge1xuICAgICAgICBpZiAoVVNFX01BUCkge1xuICAgICAgICAgICAgdmFyIG0gPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICBtLnBvaW50ZXJzID0gUE9JTlRFUlNfRk47XG4gICAgICAgICAgICByZXR1cm4gbTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMua2V5cyA9IFtdO1xuICAgICAgICAgICAgdGhpcy52YWx1ZXMgPSBbXTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFBvaW50ZXJNYXAucHJvdG90eXBlID0ge1xuICAgICAgICBzZXQ6IGZ1bmN0aW9uKGluSWQsIGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBpID0gdGhpcy5rZXlzLmluZGV4T2YoaW5JZCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEFTX1NWR19JTlNUQU5DRSA9ICh0eXBlb2YgU1ZHRWxlbWVudEluc3RhbmNlICE9PSAndW5kZWZpbmVkJyk7XG5cbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuXG4gICAgLy8gc2V0IG9mIHJlY29nbml6ZXJzIHRvIHJ1biBmb3IgdGhlIGN1cnJlbnRseSBoYW5kbGVkIGV2ZW50XG4gICAgdmFyIGN1cnJlbnRHZXN0dXJlcztcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbW9kdWxlIGlzIGZvciBub3JtYWxpemluZyBldmVudHMuIE1vdXNlIGFuZCBUb3VjaCBldmVudHMgd2lsbCBiZVxuICAgICAqIGNvbGxlY3RlZCBoZXJlLCBhbmQgZmlyZSBQb2ludGVyRXZlbnRzIHRoYXQgaGF2ZSB0aGUgc2FtZSBzZW1hbnRpY3MsIG5vXG4gICAgICogbWF0dGVyIHRoZSBzb3VyY2UuXG4gICAgICogRXZlbnRzIGZpcmVkOlxuICAgICAqICAgLSBwb2ludGVyZG93bjogYSBwb2ludGluZyBpcyBhZGRlZFxuICAgICAqICAgLSBwb2ludGVydXA6IGEgcG9pbnRlciBpcyByZW1vdmVkXG4gICAgICogICAtIHBvaW50ZXJtb3ZlOi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iAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB1cDoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVF1ZXVlOiBbXSxcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEFkZCBhIG5ldyBldmVudCBzb3VyY2UgdGhhdCB3aWxsIGdlbmVyYXRlIHBvaW50ZXIgZXZlbnRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBgaW5Tb3VyY2VgIG11c3QgY29udGFpbiBhbiBhcnJheSBvZiBldmVudCBuYW1lcyBuYW1lZCBgZXZlbnRzYCwgYW5kXG4gICAgICAgICAqIGZ1bmN0aW9ucyB3aXRoIHRoZSBuYW1lcyBzcGVjaWZpZWQgaW4gdGhlIGBldmVudHNgIGFycmF5LlxuICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSBBIG5hbWUgZm9yIHRoZSBldmVudCBzb3VyY2VcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBBIG5ldyBzb3VyY2Ugb2YgcGxhdGZvcm0gZXZlbnRzLlxuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJTb3VyY2U6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIHMgPSBzb3VyY2U7XG4gICAgICAgICAgICB2YXIgbmV3RXZlbnRzID0gcy5ldmVudHM7XG4gICAgICAgICAgICBpZiAobmV3RXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIGVsZW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBFVkVOVFNcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLnNldChpbkV2ZW50LnBvaW50ZXJJZCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCdkb3duJywgaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIG1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIHBpcGUgbW92ZSBldmVudHMgaW50byBnZXN0dXJlIHF1ZXVlIGRpcmVjdGx5XG4gICAgICAgICAgICBpbkV2ZW50LnR5cGUgPSAnbW92ZSc7XG4gICAgICAgICAgICB0aGlzLmZpbGxHZXN0dXJlUXVldWUoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmZpcmVFdmVudCgndXAnLCBpbkV2ZW50KTtcbiAgICAgICAgICAgIHRoaXMucmVxdWlyZWRHZXN0dXJlcy5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGluRXZlbnQudGFwUHJldmVudGVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCd1cCcsIGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEdlc3R1cmVEZXBlbmRlbmN5OiBmdW5jdGlvbihub2RlLCBjdXJyZW50R2VzdHVyZXMpIHtcbiAgICAgICAgICAgIHZhciBnZXN0dXJlc1dhbnRlZCA9IG5vZGUuX3BnRXZlbnRzO1xuICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkICYmIGN1cnJlbnRHZXN0dXJlcykge1xuICAgICAgICAgICAgICAgIHZhciBnayA9IE9iamVjdC5rZXlzKGdlc3R1cmVzV2FudGVkKTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciwgcmksIGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBMSVNURU5FUiBMT0dJQ1xuICAgICAgICBldmVudEhhbmRsZXI6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgdXNlZCB0byBwcmV2ZW50IG11bHRpcGxlIGRpc3BhdGNoIG9mIGV2ZW50cyBmcm9tXG4gICAgICAgICAgICAvLyBwbGF0Zm9ybSBldmVudHMuIFRoaXMgY2FuIGhhcHBlbiB3aGVuIHR3byBlbGVtZW50cyBpbiBkaWZmZXJlbnQgc2NvcGVzXG4gICAgICAgICAgICAvLyBhcmUgc2V0IHVwIHRvIGNyZWF0ZSBwb2ludGVyIGV2ZW50cywgd2hpY2ggaXMgcmVsZXZhbnQgdG8gU2hhZG93IERPTS5cblxuICAgICAgICAgICAgdmFyIHR5cGUgPSBpbkV2ZW50LnR5cGU7XG5cbiAgICAgICAgICAgIC8vIG9ubHkgZ2VuZXJhdGUgdGhlIGxpc3Qgb2YgZGVzaXJlZCBldmVudHMgb24gXCJkb3duXCJcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ21vdXNlZG93bicgfHwgdHlwZSA9PT0gJ3BvaW50ZXJkb3duJyB8fCB0eXBlID09PSAnTVNQb2ludGVyRG93bicpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWluRXZlbnQuX2hhbmRsZWRCeVBHKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlcyA9IHt9O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGluIElPUyBtb2RlLCB0aGVyZSBpcyBvbmx5IGEgbGlzdGVuZXIgb24gdGhlIGRvY3VtZW50LCBzbyB0aGlzIGlzIG5vdCByZS1lbnRyYW50XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdmUgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIHVubGlzdGVuOiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50cykge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBldmVudHMubGVuZ3RoLCBlO1xuICAgICAgICAgICAgICAgIChpIDwgbCkgJiYgKGUgPSBldmVudHNbaV0pOyBpKyspIHtcb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udCk7XG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0ID0gaW5FdmVudC5wcmV2ZW50RGVmYXVsdDtcbiAgICAgICAgICAgIGUudGFwUHJldmVudGVkID0gaW5FdmVudC50YXBQcmV2ZW50ZWQ7XG4gICAgICAgICAgICBlLl90YXJnZXQgPSBlLl90YXJnZXQgfHwgaW5FdmVudC50YXJnZXQ7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgLy8gbWFrZSBhbmQgZGlzcGF0Y2ggYW4gZXZlbnQgaW4gb25lIGNhbGxcbiAgICAgICAgZmlyZUV2ZW50OiBmdW5jdGlvbihpblR5cGUsIGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5tYWtlRXZlbnQoaW5UeXBlLCBpbkV2ZW50KTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgICAgIH0sXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZXR1cm5zIGEgc25hcHNob3Qgb2YgaW5FdmVudCwgd2l0aCB3cml0YWJsZSBwcm9wZXJ0aWVzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IEFuIGV2ZW50IHRoYXQgY29udGFpbnMgcHJvcGVydGllcyB0byBjb3B5LlxuICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IEFuIG9iamVjdCBjb250YWluaW5nIHNoYWxsb3cgY29waWVzIG9mIGBpbkV2ZW50YCdzXG4gICAgICAgICAqICAgIHByb3BlcnRpZXMuXG4gICAgICAgICAqL1xuICAgICAgICBjbG9uZUV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZXZlbnRDb3B5ID0gT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgICAgICAgICBwO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBDTE9ORV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBDTE9ORV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBldmVudENvcHlbcF0gPSBpbkV2ZW50W3BdIHx8IENMT05FX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgICAgIC8vIFdvcmsgYXJvdW5kIFNWR0luc3RhbmNlRWxlbWVudCBzaGFkb3cgdHJlZVxuICAgICAgICAgICAgICAgIC8vIFJldHVybiB0aGUgPHVzZT4gZWxlbWVudCB0aGF0IGlzIHJlcHJlc2VudGVkIGJ5IHRoZSBpbnN0YW5jZSBmb3IgU2FmYXJpLCBDaHJvbWUsIElFLlxuICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAg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RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLmNhbGwoZywgZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgZmlsbEdlc3R1cmVRdWV1ZTogZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgICAgIC8vIG9ubHkgdHJpZ2dlciB0aGUgZ2VzdHVyZSBxdWV1ZSBvbmNlXG4gICAgICAgICAgICBpZiAoIXRoaXMuZ2VzdHVyZVF1ZXVlLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3RBbmltY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ICB2YXIgZGVwID0gZGlzcGF0Y2hlci5kZXBlbmRlbmN5TWFwW2ddO1xuICAgICAgICBpZiAoZGVwKSB7XG4gICAgICAgICAgICB2YXIgcmVjb2duaXplciA9IGRpc3BhdGNoZXIuZ2VzdHVyZXNbZGVwLmluZGV4XTtcbiAgICAgICAgICAgIGlmICghbm9kZS5fcGdMaXN0ZW5lcnMpIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnJlZ2lzdGVyKG5vZGUpO1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFRPRE8oZGZyZWVkbSk6IHJlLWV2YWx1YXRlIGJvb2trZWVwaW5nIHRvIGF2b2lkIHVzaW5nIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgIGlmIChyZWNvZ25pemVyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gcmVjb2duaXplci5kZWZhdWx0QWN0aW9ucyAmJiByZWNvZ25pemVyLmRlZmF1bHRBY3Rpb25zW2ddO1xuICAgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW50cykge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzID0ge307XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBub2RlLl9wZ0V2ZW50c1tnXSA9IChub2RlLl9wZ0V2ZW50c1tnXSB8fCAwKSArIDE7XG4gICAgICAgICAgICBub2RlLl9wZ0xpc3RlbmVycysrO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBCb29sZWFuKGRlcCk7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogTGlzdGVuIGZvciBgZ2VzdHVyZWAgZnJvbSBgbm9kZWAgd2l0aCBgaGFuZGxlcmAgZnVuY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge0VsZW1lbnR9IG5vZGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gZ2VzdHVyZVxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGhhbmRsZXJcbiAgICAgKiBAcGFyYW0ge0Jvb2xlYW59IGNhcHR1cmVcbiAgICAgKi9cbiAgICBzY29wZS5hZGRFdmVudExpc3RlbmVyID0gZnVuY3Rpb24obm9kZSwgZ2VzdHVyZSwgaGFuZGxlciwgY2FwdHVyZSkge1xuICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgc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B7XG4gICAgICAgIFBPSU5URVJfSUQ6IDEsXG4gICAgICAgIFBPSU5URVJfVFlQRTogJ21vdXNlJyxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnbW91c2Vkb3duJyxcbiAgICAgICAgICAgICdtb3VzZW1vdmUnLFxuICAgICAgICAgICAgJ21vdXNldXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgbGFzdFRvdWNoZXM6IFtdLFxuICAgICAgICAvLyBjb2xsaWRlIHdpdGggdGhlIGdsb2JhbCBtb3VzZSBsaXN0ZW5lclxuICAgICAgICBpc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbHRzID0gdGhpcy5sYXN0VG91Y2hlcztcbiAgICAgICAgICAgIHZhciB4ID0gaW5FdmVudC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGx0cy5sZW5ndGgsIHQ7IGkgPCBsICYmICh0ID0gbHRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgLy8gc2ltdWxhdGVkIG1vdXNlIGV2ZW50cyB3aWxsIGJlIHN3YWxsb3dlZCBuZWFyIGEgcHJpbWFyeSB0b3VjaGVuZFxuICAgICAgICAgICAgICAgIHZhciBkeCA9IE1hdGguYWJzKHggLSB0LngpLFxuICAgICAgICAgICAgICAgICAgICBkeSA9IE1hdGguYWJzKHkgLSB0LnkpO1xuICAgICAgICAgICAgICAgIGlmIChkeCA8PSBERURVUF9ESVNUICYmIGR5IDw9IERFRFVQX0RJU1QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KHRoaXMuUE9JTlRFUl9JRCk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ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y8gdmFyIEhBU19UT1VDSF9BQ1RJT04gPSBBVFRSSUIgaW4gZG9jdW1lbnQuaGVhZC5zdHlsZTtcbiAgICB2YXIgSEFTX1RPVUNIX0FDVElPTiA9IGZhbHNlO1xuXG4gICAgLy8gaGFuZGxlciBibG9jayBmb3IgbmF0aXZlIHRvdWNoIGV2ZW50c1xuICAgIHZhciB0b3VjaEV2ZW50cyA9IHtcbiAgICAgICAgSVNfSU9TOiBmYWxzZSxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAndG91Y2hzdGFydCcsXG4gICAgICAgICAgICAndG91Y2htb3ZlJyxcbiAgICAgICAgICAgICd0b3VjaGVuZCcsXG4gICAgICAgICAgICAndG91Y2hjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TID8gaW5pdGlhbCA6ICFpbml0aWFsKSB7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLklTX0lPUykge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB2YXIgY3RlID0gdGhpcy5jdXJyZW50VG91Y2hFdmVudDtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluVG91Y2gpO1xuICAgICAgICAgICAgLy8gU3BlYyBzcGVjaWZpZXMgdGhhdCBwb2ludGVySWQgMSBpcyByZXNlcnZlZCBmb3IgTW91c2UuXG4gICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBjYW4gc3RhcnQgYXQgMC5cbiAgICAgICAgICAgIC8vIEFkZCAyIHRvIHRoZSB0b3VjaCBpZGVudGlmaWVyIGZvciBjb21wYXRpYmlsaXR5LlxuICAgICAgICAgICAgdmFyIGlkID0gZS5wb2ludGVySWQgPSBpblRvdWNoLmlkZW50aWZpZXIgKyAyO1xuICAgICAgICAgICAgZS50YXJnZXQgPSB0aGlzLmZpbmRUYXJnZXQoaW5Ub3VjaCwgaWQpO1xuICAgICAgICAgICAgZS5idWJibGVzID0gdHJ1ZTtcbiAgICAgICAgICAgIGUuY2FuY2VsYWJsZSA9IHRydWU7XG4gICAgICAgICAgICBlLmRldGFpbCA9IHRoaXMuY2xpY2tDb3VudDtcbiAgICAgICAgICAgIGUuYnV0dG9ucyA9IHRoaXMudHlwZVRvQnV0dG9ucyhjdGUudHlw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3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gRm9yIHNpbmdsZSBheGlzIHNjcm9sbGVycywgZGV0ZXJtaW5lcyB3aGV0aGVyIHRoZSBlbGVtZW50IHNob3VsZCBlbWl0XG4gICAgICAgIC8vIHBvaW50ZXIgZXZlbnRzIG9yIGJlaGF2ZSBhcyBhIHNjcm9sbGVyXG4gICAgICAgIHNob3VsZFNjcm9sbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQ7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gc2NvcGUudGFyZ2V0RmluZGluZy5maW5kVG91Y2hBY3Rpb24oaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgdmFyIHNjcm9sbEF4aXMgPSB0aGlzLnRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlKHRvdWNoQWN0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsQXhpcyA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgZWxlbWVudCBpcyBhIHRvdWNoLWFjdGlvbjogbm9uZSwgc2hvdWxkIG5ldmVyIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICByZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNjcm9sbEF4aXMgPT09ICdYWScpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBlbGVtZW50IHNob3VsZCBhbHdheXMgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayB0aGUgaW50ZW5kZWQgc2Nyb2xsIGF4aXMsIGFuZCBvdGhlciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvL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WFwLnBvaW50ZXJzKCkgc2hvdWxkIGJlIDwgdGwubGVuZ3RoIGhlcmUsIGFzIHRoZSB0b3VjaHN0YXJ0IGhhcyBub3RcbiAgICAgICAgICAgIC8vIGJlZW4gcHJvY2Vzc2VkIHlldC5cbiAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPj0gdGwubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdmFyIGQgPSBbXTtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIGtleSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOZXZlciByZW1vdmUgcG9pbnRlcklkID09IDEsIHdoaWNoIGlzIG1vdXNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBhcmUgMiBzbWFsbGVyIHRoYW4gdGhlaXIgcG9pbnRlcklkLCB3aGljaCBpcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXggaW4gcG9pbnRlcm1hcC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5Qb2ludGVyKSB7XG4gICAgICAgICAgICBpblBvaW50ZXIucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5Qb2ludGVyKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIudXAoaW5Qb2ludGVyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoY2FuY2VsOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpbkV2ZW50Ll9jYW5jZWwgPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLmNhbmNlbCk7XG4gICAgICAgIH0sXG4gICAgICAgIGNsZWFuVXBQb2ludGVyOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGluUG9pbnRlci5wb2ludGVySWQpO1xuICAgICAgICAgICAgdGhpcy5yZW1vdmVQcmltYXJ5UG9pbnRlcihpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICAvLyBwcmV2ZW50IHN5bnRoIG1vdXNlIGV2ZW50cyBmcm9tIGNyZWF0aW5nIHBvaW50ZXIgZXZlbnRzXG4gICAgICAgIGRlZHVwU3ludGhNb3VzZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGx0cyA9IHNjb3BlLm1vdXNlRXZlbnRzLmxhc3RUb3VjaGVzO1xuICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgLy8gb25seSB0aGUgcHJpbWFyeSBmaW5nZXIgd2lsbCBzeW50aCBtb3VzZSBldmVudHNcbiAgICAgICAgICAgIGlmICh0aGlzLmlzUHJpbWFyeVRvdWNoKHQpKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVtZW1iZXIgeC95IG9mIGxhc3QgdG91Y2hcbiAgICAgICAgICAgICAgICB2YXIgbHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIHg6IHQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogdC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KS5iaW5kKG51bGwsIGx0cywgbHQpO1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZm4sIERFRFVQX1RJTUVPVVQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHByZXZlbnQgXCJnaG9zdCBjbGlja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iAgICAgICAgICAgICdNU1BvaW50ZXJVcCcsXG4gICAgICAgICAgICAnTVNQb2ludGVyQ2FuY2VsJyxcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgUE9JTlRFUl9UWVBFUzogW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAndW5hdmFpbGFibGUnLFxuICAgICAgICAgICAgJ3RvdWNoJyxcbiAgICAgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlckNhbmNlbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGUucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGUpO1xuICAgICAgICAgICAgdGhpcy5jbGVhbnVwKGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tc0V2ZW50cyA9IG1zRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IGRpc3BhdGNoZXIucG9pbnRlcm1hcDtcbiAgICB2YXIgcG9pbnRlckV2ZW50cyA9IHtcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAncG9pbnRlcmRvd24nLFxuICAgICAgICAgICAgJ3BvaW50ZXJtb3ZlJyxcbiAgICAgICAgICAgICdwb2ludGVydXAnLFxuICAgICAgICAgICAgJ3BvaW50ZXJjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIHByZXBhcmVFdmVudDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAncG9pbnRlcic7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcmRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGUudGFyZ2V0ID0gdGFyZ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YWNrZW5kJ1xuICAgICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAg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IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNreScsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBpbkV2ZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAocCkge1xuICAgICAgICAgICAgICAgIGlmIChwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja2VuZCcsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIGRpc3BhdGNoZXIucmVnaXN0ZXJHZXN0dXJlKCd0cmFjaycsIHRyYWNrKTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgZXZlbnQgaXMgZmlyZWQg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Y2xhc3MgcmVsZWFzZVxuICovXG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuICAgIHZhciBob2xkID0ge1xuICAgICAgICAvLyB3YWl0IGF0IGxlYXN0IEhPTERfREVMQVkgbXMgYmV0d2VlbiBob2xkIGFuZCBwdWxzZSBldmVudHNcbiAgICAgICAgSE9MRF9ERUxBWTogMjAwLFxuICAgICAgICAvLyBwb2ludGVyIGNhbiBtb3ZlIFdJR0dMRV9USFJFU0hPTEQgcGl4ZWxzIGJlZm9yZSBub3QgY291bnRpbmcgYXMgYSBob2xkXG4gICAgICAgIFdJR0dMRV9USFJFU0hPTEQ6IDE2LFxuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdob2xkJyxcbiAgICAgICAgICAgICdob2xkcHVsc2UnLFxuICAgICAgICAgICAgJ3JlbGVhc2UnXG4gICAgICAgIF0sXG4gICAgICAgIGhlbGRQb2ludGVyOiBudWxsLFxuICAgICAgICBob2xkSm9iOiBudWxsLFxuICAgICAgICBwdWxzZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaG9sZCA9IERhdGUubm93KCkgLSB0aGlzLmhlbGRQb2ludGVyLnRpbWVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IHRoaXMuaGVsZFBvaW50ZXIucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgcG9pbnRlcklkOiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCxcbiAgICAgICAgICAgICAgICB4OiB0aGlzLmhlbGRQb2ludGVyLmNsaWVudFgsXG4gICAgICAgICAgICAgICAgeTogdGhpcy5oZWxkUG9pbnRlci5jbGllbnRZLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICdob2xkJ1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICAgICAgcC5ob2xkVGltZSA9IGluSG9sZFRpbWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2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Njb3BlLmRpc3BhdGNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRhcCA9IHtcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnZG93bicsXG4gICAgICAgICAgICAndXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0YXAnXG4gICAgICAgIF0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAhaW5FdmVudC50YXBQcmV2ZW50ZWQpIHtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLnNldChpbkV2ZW50LnBvaW50ZXJJZCwge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGluRXZlbnQudGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICBidXR0b25zOiBpbkV2ZW50LmJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAg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ZhY3RvcnkgPSBzY29wZS5ldmVudEZhY3Rvcnk7XG4gICAgdmFyIHBvaW50ZXJtYXAgPSBuZXcgc2NvcGUuUG9pbnRlck1hcCgpO1xuICAgIHZhciBSQURfVE9fREVHID0gMTgwIC8gTWF0aC5QSTtcbiAgICB2YXIgcGluY2ggPSB7XG4gICAgICAgIGV2ZW50czogW1xuICAgICAgICAgICAgJ2Rvd24nLFxuICAgICAgICAgICAgJ3VwJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICdjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdwaW5jaHN0YXJ0JyxcbiAgICAgICAgICAgICdwaW5jaCcsXG4gICAgICAgICAgICAncGluY2hlbmQnLFxuICAgICAgICAgICAgJ3JvdGF0ZSdcbiAgICAgICAgXSxcbiAgICAgICAgZGVmYXVsdEFjdGlvbnM6IHtcbiAgICAgICAgICAgICdwaW5jaCc6ICdub25lJyxcbiAgICAgICAgICAgICdyb3RhdGUnOiAnbm9uZSdcbiAgICAgICAgfSxcbiAgICAgICAgcmVmZXJlbmNlOiB7fSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHBvaW50ZXJtYXAucG9pbnRlcnMoKSA9PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG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AgICAgIHRoaXMubGFiZWwgPSBrZXk7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtzdHJpbmdbXX1cbiAgICAgICAgICogQGRlZmF1bHQgZmFsc2VcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGF0YSA9IFsnJ107IC8vIFRPRE86IFdoeSBpcyB0aGlzIGZpcnN0IGVsZW1lbnQgbmVlZGVkP1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyW119XG4gICAgICAgICAqIEBkZWZhdWx0IFsnJ11cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaW5kZXggPSBbXTsgLy8gVE9ETzogZm9ybWVybHkgcm93SW5kZXhcblxuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFOb2RlQmFzZS5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhhc0NoaWxkcmVuID0gZmFsc2U7IC8vIFRPRE86IFdoZXJlL2hvdyBpcyB0aGlzIHVzZWQ/XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgICAqIEBkZWZhdWx0IDBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGVwdGggPSAwO1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyfVxuICAgICAgICAgKiBAZ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dGhpcy5nZXRSb3coeSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzLmdldFJvdyh5KVt0aGlzLmZpZWxkc1t4XV0gPSB2YWx1ZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGEubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfVxuICAgICAqL1xuICAgIGdldENvbHVtbkNvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmllbGRzKCkubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyW119XG4gICAgICovXG4gICAgZ2V0RmllbGRzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZmllbGRzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbW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AgICAgICAgICAgc291cmNlID0gdGhpcy5kYXRhU291cmNlLFxuICAgICAgICAgICAgcm93Q291bnQgPSBzb3VyY2UuZ2V0Um93Q291bnQoKSxcbiAgICAgICAgICAgIHRyZWUgPSB0aGlzLnRyZWUgPSBuZXcgRGF0YU5vZGVUcmVlKCdUb3RhbHMnKTtcblxuICAgICAgICAvLyBmaXJzdCBzb3J0IGRhdGFcbiAgICAgICAgaWYgKHRoaXMucHJlc29ydEdyb3Vwcykge1xuICAgICAgICAgICAgZ3JvdXBCeXMucmV2ZXJzZSgpLmZvckVhY2goZnVuY3Rpb24oZ3JvdXBCeSkge1xuICAgICAgICAgICAgICAgIHNvdXJjZSA9IG5ldyBEYXRhU291cmNlU29ydGVyKHNvdXJjZSk7XG4gICAgICAgICAgICAgICAgc291cmNlLnNvcnRPbihncm91cEJ5KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCByb3dDb3VudDsgcisrKSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHRyZWU7XG5cbiAgICAgICAgICAgIGdyb3VwQnlzLmZvckVhY2goZnVuY3Rpb24oZywgYykgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWxvb3AtZnVuY1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBzb3VyY2UuZ2V0VmFsdWUoZywgciksXG4gICAgICAgICAgICAgICAgICAgIGZhY3RvcnlEYXRhTm9kZSA9IChjID09PSBsZWFmRGVwdGgpID8gZmFjdG9yeURhdGFOb2RlTGVhZiA6IGZhY3RvcnlEYXRhTm9kZUdyb3VwO1xuICAgICAgICAgICAgICAgIHBhdGggPSBwYXRoLmNoaWxkcmVuLmdldElmVW5kZWZpbmVkKGtleSwgZmFjdG9yeURhdGFOb2RlKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBwYXRoLmluZGV4LnB1c2gocik7XG4gICAgICAgIH1cblxuICAgICAg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aGVhZGVycz9cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBoZWFkZXJzXG4gICAgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICB0aGlzLmRhdGFTb3VyY2Uuc2V0SGVhZGVycyhoZWFkZXJzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfG51bWJlcltdfVxuICAgICAqL1xuICAgIGdldEZpZWxkczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICBnZXRHcmFuZFRvdGFsczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciB2aWV3ID0gdGhpcy50cmVlO1xuICAgICAgICByZXR1cm4gW3ZpZXcuZGF0YV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGV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GFTb3VyY2VTb3J0ZXIucHJvdG90eXBlXG4gICAgICovXG4gICAgaW5pdGlhbGl6ZTogZnVuY3Rpb24oKSB7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZVNvcnRlci5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmRlc2NlbmRpbmdTb3J0ID0gZmFsc2U7IC8vIFRPRE86IHRoaXMgZG9lcyBub3Qgc2VlbSB0byBiZSBpbiB1c2VcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VTb3J0ZXIucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbElkeFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBbZGlyZWN0aW9uPTFdXG4gICAgICovXG4gICAgc29ydE9uOiBmdW5jdGlvbihjb2xJZHgsIGRpcmVjdGlvbikge1xuICAgICAgICBzd2l0Y2ggKGRpcmVjdGlvbikge1xuICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIHRoaXMuY2xlYXJJbmRleCgpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICBjYXNlIHVuZGVmaW5lZDpcbiAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgIGNhc2UgLTE6XG4gICAgICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzOyAvLyBmb3IgdXNlIGluIGdldFZhbHVlXG4gICAgICAgICAgICAgICAgc3RhYmxlU29ydC5zb3J0KHRoaXMuYnVpbGRJbmRleCgpLCBnZXRWYWx1ZSwgZGlyZWN0aW9uKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIGdldFZhbHVlKHJvd0lkeCkge1xuICAgICAgICAgICAgcmV0dXJuIHZhbE9yRn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HJvdG90eXBlXG4gICAgICogQHBhcmFtIGtleVxuICAgICAqL1xuICAgIGRlbGV0ZTogZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgIHZhciBoYXNoQ29kZSA9IGhhc2goa2V5KTtcbiAgICAgICAgaWYgKHRoaXMuZGF0YVtoYXNoQ29kZV0gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgdmFyIGluZGV4ID0gYmV0dGVySW5kZXhPZih0aGlzLmtleXMsIGtleSk7XG4gICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGluZGV4LCAxKTtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpbmRleCwgMSk7XG4gICAgICAgICAgICBkZWxldGUgdGhpcy5kYXRhW2hhc2hDb2RlXTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgTWFwcHkucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtmdW5jdGlvbn0gaXRlcmF0ZWVcbiAgICAgKi9cbiAgICBmb3JFYWNoOiBmdW5jdGlvbihpdGVyYXRlZSkge1xuICAgICAgICBpZiAodHlwZW9mIGl0ZXJhdGVlID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICB2YXIga2V5cyA9IHRoaXMua2V5cyxcbiAgICAgICAgICAgICAgICBzZWxmID0gdGhpcztcbiAgICAgICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgICAgIGl0ZXJhdGVlKHZhbHVlLCBrZXksIHNlbGYpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7ZnVuY3Rpb259IGl0ZXJhdGVlXG4gICAgICogQHJldHVybnMge01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uc2Nyb2xsWSArIHJlY3QudG9wLFxuICAgICAgICAgICAgICAgIHJpZ2h0OiAgd2luZG93LnNjcm9sbFggKyByZWN0LnJpZ2h0LFxuICAgICAgICAgICAgICAgIGJvdHRvbTogd2luZG93LnNjcm9sbFkgKyByZWN0LmJvdHRvbSxcbiAgICAgICAgICAgICAgICB3aWR0aDogIHJlY3Qud2lkdGgsXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiByZWN0LmhlaWdodFxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgbW9kZWxMaXN0LnJlY3QgPSByZWN0O1xuXG4gICAgICAgICAgICBpZiAocG9pbnRJblJlY3QocG9pbnQsIHJlY3QpKSB7XG4gICAgICAgICAgICAgICAgbW9kZWxMaXN0LnJlY3QgPSByZWN0O1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOyAvLyBmb3VuZFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICBwb2ludEluSXRlbVJlY3RzOiBmdW5jdGlvbiAocG9pbnQsIGV4Y2VwdDEsIGV4Y2VwdDIpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuaXRlbXMuZmluZChmdW5jdGlvbiAoaXRlbSkge1xuICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBpdGVtLmVsZW1lbnQ7XG4gICAgICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgICAgIGVsZW1lbnQgIT09IGV4Y2VwdDEgJiZcbiAgICAgICAgICAgICAgICBlbGVtZW50ICE9PSBleGNlcHQyICYmXG4gICAgICAgICAgICAgICAgcG9pbnRJblJlY3QocG9pbnQsIGl0ZW0ucmVjdClcbiAgICAgICAgICAgICk7XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICAvLyBnZXQgcG9zaXRpb25zIG9mIGFsbCBsaXN0IGl0ZW1zIGluIHB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ICAgICAgICAgICAgICAgICAgYm90dG9tID0gcmVjdC5ib3R0b207XG5cbiAgICAgICAgICAgICAgICBpZiAoaXRlbUVsZW1lbnQgPT09IGxpc3RFbGVtZW50Lmxhc3RFbGVtZW50Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gbGlzdEVsZW1lbnQuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkuYm90dG9tO1xuICAgICAgICAgICAgICAgICAgICBpZiAoYm90dG9tIDwgcmVjdC50b3ApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IHJlY3QudG9wICsgKGhlaWdodCB8fCA1MCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBoZWlnaHQgPSByZWN0LmhlaWdodDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZWN0ID0ge1xuICAgICAgICAgICAgICAgICAgICBsZWZ0OiAgIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5sZWZ0LFxuICAgICAgICAgICAgICAgICAgICByaWdodDogIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5yaWdodCxcbiAgICAgICAgICAgICAgICAgICAgdG9wOiAgICB3aW5kb3cuc2Nyb2xsWSArIHJlY3QudG9wICAgICsgbGlzdEVsZW1lbnQuc2Nyb2xsVG9wLFxuICAgICAgICAgICAgICAgICAgICBib3R0b206IHdpbmRvdy5zY3JvbGxZICsgYm90dG9tICsgbGlzdEVsZW1lbnQuc2Nyb2xsVG9wXG4gICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgIGl0ZW0ucmVjdCA9IHJlY3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICByZWluc2VydDogZnVuY3Rpb24gKHRhcmdldCkge1xuICAgICAgICB2YXIgc3R5bGUgPSB0YXJnZXQuc3R5bGU7XG4g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AvLyBzdG9wIHdoZW4gd2UgZmluZCB0aGUgb25lIHdlIGJlbG9uZyB0b1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gY29vcmRzO1xuICAgIH1cblxufTtcblxudmFyIGhhbmRsZXJzID0ge1xuICAgIG1vdXNlZG93bjogZnVuY3Rpb24gKGRyYWdvbiwgZXZ0KSB7XG5cbiAgICAgICAgZXZ0LnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICBldnQucHJldmVudERlZmF1bHQoKTsgIC8vcHJldmVudHMgdXNlciBzZWxlY3Rpb24gb2YgcmVuZGVyZWQgbm9kZXMgZHVyaW5nIGRyYWdcblxuICAgICAgICBpZiAoZHJhZ29uLmRyb3ApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZWN0ID0gdGhpcy5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgICBkcmFnb24ucmVjdCA9IHJlY3QgPSB7XG4gICAgICAgICAgICBsZWZ0OiAgIE1hdGgucm91bmQocmVjdC5sZWZ0IC0gMSksXG4gICAgICAgICAgICB0b3A6ICAgIE1hdGgucm91bmQocmVjdC50b3AgLSAxKSxcbiAgICAgICAgICAgIHJpZ2h0OiAgTWF0aC5yb3VuZChyZWN0LnJpZ2h0KSxcbiAgICAgICAgICAgIGJvdHRvbTogTWF0aC5yb3VuZChyZWN0LmJvdHRvbSksXG4gICAgICAgICAgICB3aWR0aDogIE1hdGgucm91bmQocmVjdC53aWR0aCksXG4gICAgICAgICAgICBoZWlnaHQ6IE1hdGgucm91bmQocmVjdC5oZWlnaHQpXG4gICAgICAgIH07XG5cbiAgICAgICAgZHJhZ29uLnBpbiA9IHtcbiAgICAgICAgICAgIHg6IHdpbmRvdy5zY3JvbGxYICsgZXZ0LmNsaWVudFgsXG4gICAgICAgICAgICB5OiB3aW5kb3cuc2Nyb2xsWSArIGV2dC5jbGllbnRZXG4gICAgICAgIH07XG5cbiAgICA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G93IHJvb3QgT1IgYm9keSB0YWcgT1Igcm9vdCB0YWdcbiAgICAgICAgICAgIHZhciBjb250YWluZXIgPSB0aGlzO1xuICAgICAgICAgICAgd2hpbGUgKGNvbnRhaW5lci5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgY29udGFpbmVyID0gY29udGFpbmVyLnBhcmVudE5vZGU7XG4gICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5lciBpbnN0YW5jZW9mIFNoYWRvd1Jvb3QgfHwgY29udGFpbmVyLnRhZ05hbWUgPT09ICdCT0RZJyl7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRyYWdvbi5jb250YWluZXIgPSBjb250YWluZXI7XG4gICAgICAgIH1cblxuICAgICAgICBkcmFnb24uY29udGFpbmVyLmFwcGVuZENoaWxkKHRoaXMpO1xuXG4gICAgICAgIHJlY3QubGVmdCAgICs9IHdpbmRvdy5zY3JvbGxYO1xuICAgICAgICByZWN0LnRvcCAgICArPSB3aW5kb3cuc2Nyb2xsWTtcbiAgICAgICAgcmVjdC5yaWdodCAgKz0gd2luZG93LnNjcm9sbFg7XG4gICAgICAgIHJlY3QuYm90dG9tICs9IHdpbmRvdy5zY3JvbGxZO1xuXG4gICAgICAgIGRyYWdvbi5hZGRFdnQodGhpcywgJ21vdXNlbW92ZScpO1xuICAgICAgICBkcmFnb24uYWRkRXZ0KHRoaXMsICdtb3VzZXVwJyk7XG4gICAgfSxcblxuICAgIG1vdXNlbW92ZTogZnVuY3Rpb24gKGRyYWdvbiwgZXZ0KSB7XG4gICAgICAgIGRyYWdvbi5kcm9wLnN0eWxlLnRyYW5zaXRpb24gPSBSRVZFUlRfVE9fU1RZTEVTSEVFVF9WQUxVRTtcblxuICAgICAgICB2YXIgaG92ZXJMaXN0ID0gZHJhZ29uLnBvaW50SW5MaXN0UmVjdHMoeyB4OiBldnQuY2xpZW50WCwg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WduaXR1ZGUgPSB5IC0gKGhvdmVyTGlzdC5yZWN0LmJvdHRvbSAtIDEgLSA1KSkgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIG5lYXIgb3IgYmVsb3cgYm90dG9tIGFuZCBsaXN0IG5vdCBzY3JvbGxlZCB0byBib3R0b20geWV0XG4gICAgICAgICAgICAgICAgICAgIHJlc2V0QXV0b1Njcm9sbFRpbWVyKG1hZ25pdHVkZSwgbWF4U2Nyb2xsWSwgaG92ZXJMaXN0LmVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIGluc2lkZVxuICAgICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIG90aGVyID0gZHJhZ29uLnBvaW50SW5JdGVtUmVjdHMoe1xuICAgICAgICAgICAgICAgIHg6IGV2dC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHk6IGRyYWdvbi5yZWN0LmJvdHRvbSArIHdpbmRvdy5zY3JvbGxZICsgZHkgKyBob3Zlckxpc3QuZWxlbWVudC5zY3JvbGxUb3BcbiAgICAgICAgICAgIH0sIHRoaXMsIGRyYWdvbi5kcm9wKTtcblxuICAgICAgICAgICAgdGhpcy5zdHlsZVt0cmFuc2Zvcm1dID0gdHJhbnNsYXRlKFxuICAgICAgICAgICAgICAgIGRyYWdvbi5yZWN0LmxlZnQgLSB3aW5kb3cuc2Nyb2xsWCArIGR4LFxuICAgICAgICAgICAgICAgIGRyYWdvbi5yZWN0LnRvcCAtIHdpbmRvdy5zY3JvbGxZICsgZHlcbiAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgIGlmIChvdGhlcikge1xuICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gb3RoZXIuZWxlbWVudDtcbiAgICAgICAgICAgICAgICBl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W5ZICsgcmVjdC5leHRlbnQueTtcblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueCA8IDApIHtcbiAgICAgICAgICAgIG1pblggPSBtYXhYO1xuICAgICAgICAgICAgbWF4WCA9IHJlY3Qub3JpZ2luLng7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueSA8IDApIHtcbiAgICAgICAgICAgIG1pblkgPSBtYXhZO1xuICAgICAgICAgICAgbWF4WSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgbWluWCA8PSB0aGlzLnggJiYgdGhpcy54IDwgbWF4WCAmJlxuICAgICAgICAgICAgbWluWSA8PSB0aGlzLnkgJiYgdGhpcy55IDwgbWF4WVxuICAgICAgICApO1xuICAgIH1cbn07XG5cblBvaW50LnByb3RvdHlwZS5FUSA9IFBvaW50LnByb3RvdHlwZS5lcXVhbHM7XG5Qb2ludC5wcm90b3R5cGUuR1QgPSBQb2ludC5wcm90b3R5cGUuZ3JlYXRlclRoYW47XG5Qb2ludC5wcm90b3R5cGUuTFQgPSBQb2ludC5wcm90b3R5cGUubGVzc1RoYW47XG5Qb2ludC5wcm90b3R5cGUuR0UgPSBQb2ludC5wcm90b3R5cGUuZ3JlYXRlclRoYW5PckVxdWFsVG87XG5Qb2ludC5wcm90b3R5cGUuTEUgPSBQb2ludC5wcm90b3R5cGUubGVzc1RoYW5PckVxdWFsVG87XG5cblxuLyoqXG4gKiBAY29uc3RydWN0b3IgUmVjdGFuZ2xlXG4gKlxuICogQGRlc2MgVGhpcyBvYmplY3QgcmVwcmVzZW50cyBhIHJlY3Rhbmd1bGFyIGFyZWEgd2l0aGluIGFuIGFic3RyYWN0IDItZGltZW5zaW9uYWwgbWF0cml4LlxuICpcbiAqIFRoZSB1bml0IG9mIG1lYXN1cmUgaXMgdHlwaWNhbGx5IHBpeGVscy5cbiAqIChJZiB1c2VkIHRvIG1vZGVsIGNvbXB1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AgICAgICAgICAgIGhlaWdodCA9IGNvbmZpZy5ib3VuZHMuaGVpZ2h0LFxuICAgICAgICAgICAgd3JhcEhlYWRlcnMgPSBjb25maWcuaGVhZGVyVGV4dFdyYXBwaW5nLFxuICAgICAgICAgICAgbGVmdFBhZGRpbmcgPSAyLCAvL1RPRE86IGZpeCB0aGlzXG4gICAgICAgICAgICBpc0hlYWRlciA9IGNvbmZpZy55ID09PSAwO1xuXG4gICAgICAgIHZhciBsZWZ0SWNvbiwgcmlnaHRJY29uLCBjZW50ZXJJY29uLCBpeG9mZnNldCwgaXlvZmZzZXQ7XG5cbiAgICAgICAgLy9zZXR0aW5nIGdjIHByb3BlcnRpZXMgYXJlIGV4cGVuc2l2ZSwgbGV0cyBub3QgZG8gaXQgdW5uZWNlc3NhcmlseVxuXG4gICAgICAgIGlmICh2YWwgJiYgdmFsLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgbGVmdEljb24gPSB2YWxbMF07XG4gICAgICAgICAgICByaWdodEljb24gPSB2YWxbMl07XG4gICAgICAgICAgICB2YWwgPSB2YWxbMV07XG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gJ29iamVjdCcpIHsgLy8gbXVzdCBiZSBhbiBpbWFnZVxuICAgICAgICAgICAgICAgIGNlbnRlckljb24gPSB2YWw7XG4gICAgICAgICAgICAgICAgdmFsID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChsZWZ0SWNvbiAmJiBsZWZ0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICBsZWZ0SWNvbiA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocmlnaHRJY29uICYmIHJpZ2h0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICByaWdodEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgK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C5tYXgobGVmdEljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmlnaHRJY29uKSB7XG4gICAgICAgICAgICBpeW9mZnNldCA9IE1hdGgucm91bmQoKGhlaWdodCAtIHJpZ2h0SWNvbi5oZWlnaHQpIC8gMik7XG4gICAgICAgICAgICBpeG9mZnNldCA9IDA7IC8vTWF0aC5yb3VuZCgoaGFsaWduT2Zmc2V0IC0gcmlnaHRJY29uLndpZHRoKSAvIDIpO1xuICAgICAgICAgICAgZ2MuZHJhd0ltYWdlKHJpZ2h0SWNvbiwgeCArIHdpZHRoIC0gaXhvZmZzZXQgLSByaWdodEljb24ud2lkdGgsIHkgKyBpeW9mZnNldCk7XG4gICAgICAgICAgICBpY29uV2lkdGggPSBNYXRoLm1heChyaWdodEljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY2VudGVySWNvbikge1xuICAgICAgICAgICAgaXlvZmZzZXQgPSBNYXRoLnJvdW5kKChoZWlnaHQgLSBjZW50ZXJJY29uLmhlaWdodCkgLyAyKTtcbiAgICAgICAgICAgIGl4b2Zmc2V0ID0gTWF0aC5yb3VuZCgod2lkdGggLSBjZW50ZXJJY29uLndpZHRoKSAvIDIpO1xuICAgICAgICAgICAgZ2MuZHJhd0ltYWdlKGNlbnRlckljb24sIHggKyB3aWR0aCAtIGl4b2Zmc2V0IC0gY2VudGVySWNvbi53aWR0aCwgeSArIGl5b2Zmc2V0KTtcbiAgICAgICAgICAgIGljb25XaWR0aCA9IE1hdGgubWF4KGNlbnRlckljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29uZmlnLmNlbGxCb3JkZXJUaGlja25lc3MpIHtcbiAgICAgICAgICAgIGdjLmJlZ2luUGF0aCgpO1xuICAgICAgICAgICAgZ2MucmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcbiAgICAgICAgICAgIGdjLmxpbmVXaWR0aCA9IGNvbmZpZy5jZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgZ2Muc3Ryb2tlU3R5bGUgPSBjb25maWcuY2VsbEJvcmRlclN0eWxlO1xuXG4gICAgICAgICAgICAvLyBhbmltYXRlIHRoZSBkYXNoZWQgbGluZSBhIGJpdCBoZXJlIGZvciBmdW5cblxuICAgICAgICAgICAgZ2Muc3Ryb2tlKCk7XG4gICAgICAgICAgICBnYy5jbG9zZVBhdGgoKTtcbiAgICAgICAgfVxuICAgICAgICBjb25maWcubWluV2lkdGggPSBjb25maWcubWluV2lkdGggKyAyICogKGljb25XaWR0aCk7XG4gICAgfSxcblxuICAgIHJlbmRlck11bHRpTGluZVRleHQ6IGZ1bmN0aW9uKHgsIHksIGhlaWdodCwgd2lkdGgsIGdjLCBjb25maWcsIHZhbCkge1xuICAgICAgICB2YXIgbGluZXMgPSBmaXRUZXh0KGdjLCBjb25maWcsIHZhbCwgd2lkdGgpO1xuICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5yZW5kZXJTaW5nbGVMaW5lVGV4dCh4LCB5LCBoZWlnaHQsIHdpZHRoLCBnYywgY29uZmlnLCBzcXVlZXplKHZhbCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGNvbEhFZGdlT2Zmc2V0ID0gY29uZmlnLmNlbGxQYWRkaW5nLFxuICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gMCxcbiAgICAgICAgICAgIHZhbGlnbk9mZnNldCA9IGNvbmZpZy52b2Zmc2V0LFxuICAgICAgICAgICAgaGFsaWduID0gY29uZmlnLmhhbGlnbixcbiAgICAgICAgICAgIHRleHRIZWlnaHQgPSBjb25maWcuZ2V0VGV4dEhlaWdodChjb25maWcuZm9udCkuaGVpZ2h0O1xuXG4gICAgICAgIHN3aXRjaCAoaGFsaWduKSB7XG4gICAgICAgICAgICBjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgaG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Bvc2l0aW9uIG9uIGEgbW91c2UgZG93biBldmVudCBmb3IgY2VsbCBlZGl0aW5nIG9yIGEgZHJhZyBvcGVyYXRpb24uXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBnZXRNb3VzZURvd246IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgbGFzdCA9IHRoaXMubW91c2VEb3duLmxlbmd0aCAtIDE7XG4gICAgICAgIGlmIChsYXN0IDwgMCkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMubW91c2VEb3duW2xhc3RdO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIFJlbW92ZSB0aGUgbGFzdCBpdGVtIGZyb20gdGhlIG1vdXNlIGRvd24gc3RhY2suXG4gICAgICovXG4gICAgcG9wTW91c2VEb3duOiBmdW5jdGlvbigpIHtcbiAgICAgICAgaWYgKHRoaXMubW91c2VEb3duLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMubW91c2VEb3duLmxlbmd0aCA9IHRoaXMubW91c2VEb3duLmxlbmd0aCAtIDE7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQGRlc2MgRW1wdHkgb3V0IHRoZSBtb3VzZSBkb3duIHN0YWNrLlxuICAgICAqL1xuICAgIGNsZWFyTW91c2VEb3duOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdGhpcy5tb3VzZURvd24gPSBbbmV3IFBvaW50KC0xLCAtMSldO1xuICAgICAgICB0aGlzLmRyYWdFeHRlbnQgPSBudWxsO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtY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c2VsZWN0aW9ucy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHZhciB3aWR0aCA9IHNlbGVjdGlvbnMubGVuZ3RoLFxuICAgICAgICAgICAgICAgIGhlaWdodCA9IHNlbGVjdGlvbnNbMF0ubGVuZ3RoLFxuICAgICAgICAgICAgICAgIGFyZWEgPSB3aWR0aCAqIGhlaWdodCxcbiAgICAgICAgICAgICAgICBjb2xsZWN0b3IgPSBbXTtcblxuICAgICAgICAgICAgLy9kaXNhbGxvdyBpZiBzZWxlY3Rpb24gaXMgdG9vIGJpZ1xuICAgICAgICAgICAgaWYgKGFyZWEgPiAyMDAwMCkge1xuICAgICAgICAgICAgICAgIGFsZXJ0KCdzZWxlY3Rpb24gc2l6ZSBpcyB0b28gYmlnIHRvIGNvcHkgdG8gdGhlIHBhc3RlIGJ1ZmZlcicpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWFsZXJ0XG4gICAgICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGhlaWdodDsgaCsrKSB7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgdyA9IDA7IHcgPCB3aWR0aDsgdysrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5wdXNoKHNlbGVjdGlvbnNbd11baF0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAodyA8IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaCgnXFx0Jyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGggPCBoZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goJ1xcbicpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IGNvbGxlY3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dXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LmtleXMgPSBlLmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbW91c2VFdmVudDtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURvd24obW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYucmVwYWludCgpO1xuICAgICAgICB9KTtcblxuXG4gICAgICAgIC8vIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1jbGljaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgLy8gICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gICAgIH1cbiAgICAgICAgLy8gICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgIC8vICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgLy8gICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgIC8vIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgaWYgKHNlbGYuaXNTY3JvbGxpbmdOb3coKSkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0U2Nyb2xsaW5nTm93KGZhbHNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmNvbHVtbkRyYWdBdXRvU2Nyb2xsaW5nKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlVXAobW91c2VFdmVudCk7XG4gICAgICAgICAgICBpZiAoc2VsZi5tb3VzZURvd25TdGF0ZSkge1xuICAgICAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0J1dHRvblByZXNzZWRFdmVudChzZWxmLm1vdXNlRG93blN0YXRlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYubW91c2VEb3duU3RhdGUgPSBudWxsO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VVcEV2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtdGFwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciB0YXBFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICB0YXBFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICB0YXBFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQodGFwRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZVRhcCh0YXBFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1kcmFnJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlRHJhZyhtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNLZXlkb3duRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5RG93bihlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5dXBFdmVudChlKTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVLZXlVcChlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRyYWNrJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNlbGYuZHJhZ2dpbmcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcHJpbUV2ZW50ID0gZS5kZXRhaWwucHJpbWl0aXZlRXZlbnQ7XG4gICAgICAgICAgICBpZiAoTWF0aC5hYnMocHJpbUV2ZW50LmR5KSA+IE1hdGguYWJzKHByaW1FdmVudC5keCkpIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnlEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KC0yKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxWQnkoMik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnhEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsSEJ5KC0xKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxIQnkoMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtaG9sZHB1bHNlJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAvLyAgICAgY29uc29sZS5sb2coJ2hvbGRwdWxzZScpO1xuICAgICAgICAvLyAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgIC8vICAgICAgICAgcmV0dXJuO1xuICAgICAgICAvLyAgICAgfVxuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IH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wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS1kb3duJywge1xuICAgICAgICAgICAgZGV0YWlsOiB7XG4gICAgICAgICAgICAgICAgaW5wdXQ6IGlucHV0Q29udHJvbCxcbiAgICAgICAgICAgICAgICBrZXlFdmVudDoga2V5RXZlbnRcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoY2xpY2tFdmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNFZGl0b3JLZXlQcmVzc0V2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS1wcmVzcycsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yRGF0YUNoYW5nZUV2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIG9sZFZhbHVlLCBuZXdWYWx1ZSkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1kYXRhLWNoYW5nZScsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAgb2xkVmFsdWU6IG9sZFZhbHVlLF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ICAgICAgIHZhciByZXN1bHQgPSBuZXcgQXJyYXkoc2VsZWN0aW9ucy5sZW5ndGgpO1xuICAgICAgICBzZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0aW9uUmVjdCwgaSkge1xuICAgICAgICAgICAgcmVzdWx0W2ldID0gc2VsZi5fZ2V0U2VsZWN0aW9uKHNlbGVjdGlvblJlY3QpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9LFxuXG4gICAgX2dldFNlbGVjdGlvbjogZnVuY3Rpb24ocmVjdCkge1xuICAgICAgICByZWN0ID0gbm9ybWFsaXplUmVjdChyZWN0KTtcbiAgICAgICAgdmFyIGNvbENvdW50ID0gcmVjdC5leHRlbnQueCArIDE7XG4gICAgICAgIHZhciByb3dDb3VudCA9IHJlY3QuZXh0ZW50LnkgKyAxO1xuICAgICAgICB2YXIgb3ggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB2YXIgb3kgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIHZhciByO1xuICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgIHZhciBjb2x1bW4gPSBuZXcgQXJyYXkocm93Q291bnQpO1xuICAgICAgICAgICAgcmVzdWx0W3RoaXMuZ2V0RmllbGQoYyArIG94KV0gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgcm93Q291bnQ7IHIrKykge1xuICAgICAgICAgICAgICAgIGNvbHVtbltyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUodGhpcy5nZXRWYWx1ZShveCArIGMsIG95ICsgcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIGdldFNlbGVjdGlvbk1hdHJpeDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIHNlbGVjdGlvbnMgPSB0aGlzLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBBcnJheShzZWxlY3Rpb25zLmxlbmd0aCk7XG4gICAgICAgIHNlbGVjdGlvbnMuZm9yRWFjaChmdW5jdGlvbihzZWxlY3Rpb25SZWN0LCBpKSB7XG4gICAgICAgICAgICByZXN1bHRbaV0gPSBzZWxmLl9nZXRTZWxlY3Rpb25NYXRyaXgoc2VsZWN0aW9uUmVjdCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICBfZ2V0U2VsZWN0aW9uTWF0cml4OiBmdW5jdGlvbihyZWN0KSB7XG4gICAgICAgIHJlY3QgPSBub3JtYWxpemVSZWN0KHJlY3QpO1xuICAgICAgICB2YXIgY29sQ291bnQgPSByZWN0LmV4dGVudC54ICsgMTtcbiAgICAgICAgdmFyIHJvd0NvdW50ID0gcmVjdC5leHRlbnQueSArIDE7XG4gICAgICAgIHZhciBveCA9IHJlY3Qub3JpZ2luLng7XG4gICAgICAgIHZhciBveSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBjb2xDb3VudDsgYysrKSB7XG4gICAgICAgICAgICB2YXIgY29sdW1uID0gbmV3IEFycmF5KHJvd0NvdW50KTtcbiAgICAgICAgICAgIHJlc3VsdFtjXSA9IGNvbHVtbjtcbiAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgcm93Q291bnQ7IHIrKykge1xuICAgICAgICAgICAgICAgIGNvbHVtbltyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUodGhpcy5nZXRWYWx1ZShveCArIGMsIG95ICsgcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAg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VVwRXZlbnQ6IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgdmFyIGV2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tbW91c2V1cCcsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGdyaWRDZWxsOiBlLmdyaWRDZWxsLFxuICAgICAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGUubW91c2VQb2ludCxcbiAgICAgICAgICAgICAgICB2aWV3UG9pbnQ6IGUudmlld1BvaW50LFxuICAgICAgICAgICAgICAgIHByaW1pdGl2ZUV2ZW50OiBlLnByaW1pdGl2ZUV2ZW50LFxuICAgICAgICAgICAgICAgIHJvd3M6IHRoaXMuZ2V0U2VsZWN0ZWRSb3dzKCksXG4gICAgICAgICAgICAgICAgY29sdW1uczogdGhpcy5nZXRTZWxlY3RlZENvbHVtbnMoKSxcbiAgICAgICAgICAgICAgICBzZWxlY3Rpb25zOiB0aGlzLmdldFNlbGVjdGlvbk1vZGVsKCkuZ2V0U2VsZWN0aW9ucygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGV2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY01vdXNlRG93bkV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBldmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLW1vdXNlZG93bicsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGdyaWRDZWxsOiBlLmdyaWRDZWxsLFxuICAgICAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGUubW91c2VQb2ludCxcbiAgICAgICAgICAgICAgICB2aWV3UG9pbnQ6IGUudmlld1BvaW50LFxuICAgICAgICAgICAgICAgIHByaW1pdGl2ZUV2ZW50OiBlLnByaW1pdGl2ZUV2ZW50LFxuICAgICAgICAgICAgICAgIHJvd3M6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Jvd1tmaWVsZF0gPSBiZWhhdmlvci5nZXRWYWx1ZShjLCByKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fSBBbiBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50bHkgc2VsZWN0aW9uIHJvdy5cbiAgICAgKi9cbiAgICBnZXRTZWxlY3RlZFJvdzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxzID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgaWYgKHNlbHMubGVuZ3RoKSB7XG4gICAgICAgICAgICB2YXIgYmVoYXZpb3IgPSB0aGlzLmdldEJlaGF2aW9yKCksXG4gICAgICAgICAgICAgICAgY29sQ291bnQgPSB0aGlzLmdldENvbHVtbkNvdW50KCksXG4gICAgICAgICAgICAgICAgdG9wUm93ID0gc2Vsc1swXS5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICByb3cgPSB7XG4gICAgICAgICAgICAgICAgICAgIC8vaGllcmFyY2h5OiBiZWhhdmlvci5nZXRGaXhlZENvbHVtblZhbHVlKDAsIHRvcFJvdylcbiAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgICAgICByb3dbYmVoYXZpb3IuZ2V0Q29sdW1uSWQoYywgMCldID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgdG9wUm93KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHJvdztcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICBmaXJlUmVxdWVzdENlbGxFZGl0OiBmdW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1xuICAgICAgICAgICAgaWYgKHNlbGYuaXNDb2x1bW5BdXRvc2l6aW5nKCkpIHtcbiAgICAgICAgICAgICAgICBiZWhhdmlvci5hdXRvc2l6ZUFsbENvbHVtbnMoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYucmVwYWludCgpO1xuICAgICAgICB9LCAxMCk7XG4gICAgfSxcblxuICAgIHRvZ2dsZVNlbGVjdENvbHVtbjogZnVuY3Rpb24oeCwga2V5cykge1xuICAgICAgICBrZXlzID0ga2V5cyB8fCBbXTtcbiAgICAgICAgdmFyIG1vZGVsID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpO1xuICAgICAgICB2YXIgYWxyZWFkeVNlbGVjdGVkID0gbW9kZWwuaXNDb2x1bW5TZWxlY3RlZCh4KTtcbiAgICAgICAgdmFyIGhhc0NUUkwgPSBrZXlzLmluZGV4T2YoJ0NUUkwnKSA+IC0xO1xuICAgICAgICB2YXIgaGFzU0hJRlQgPSBrZXlzLmluZGV4T2YoJ1NISUZUJykgPiAtMTtcbiAgICAgICAgaWYgKCFoYXNDVFJMICYmICFoYXNTSElGVCkge1xuICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKGhhc0NUUkwpIHtcbiAgICAgICAgICAgICAgICBpZiAoYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLmRlc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB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5kZXhPZignQ1RSTCcpID4gLTE7XG4gICAgICAgIHZhciBoYXNTSElGVCA9IGtleXMuaW5kZXhPZignU0hJRlQnKSA+IC0xO1xuXG4gICAgICAgIGlmICghaGFzQ1RSTCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChoYXNDVFJMKSB7XG4gICAgICAgICAgICAgICAgaWYgKGFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5kZXNlbGVjdFJvdyh5KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNTaW5nbGVSb3dTZWxlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vZGVsLmNsZWFyUm93U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNTSElGVCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMV0sIHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkICYmICFoYXNTSElGVCkge1xuICAgICAgICAgICAgdGhpcy5sYXN0RWRnZVNlbGVjdGlvblsxXSA9IHk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5yZXBhaW50KCk7XG4gICAgfSx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wO1xuICAgICAgICB2YXIgc3RhcnQgPSAwO1xuICAgICAgICB2YXIgZmlyc3RWWCwgbGFzdFZYO1xuICAgICAgICB2YXIgZmlyc3RWWSwgbGFzdFZZO1xuICAgICAgICBpZiAoZ3JpZC5pc1Nob3dSb3dOdW1iZXJzKCkpIHtcbiAgICAgICAgICAgIHN0YXJ0LS07XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzWy0xXSA9IC0xO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoYyA9IHN0YXJ0OyBjIDwgbnVtQ29sdW1uczsgYysrKSB7XG4gICAgICAgICAgICB2eCA9IGM7XG4gICAgICAgICAgICBpZiAoYyA+PSBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICB2eCA9IHZ4ICsgc2Nyb2xsTGVmdDtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RWWCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0VlggPSB2eDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGFzdFZYID0gdng7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IHZpZXdXaWR0aCB8fCBudW1Db2x1bW5zIDw9IHZ4KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aWR0aCA9IHRoaXMuZ2V0Q29sdW1uV2lkdGgodngpO1xuICAgICAgICAgICAgeCA9IHggKyB3aWR0aDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNbYyArIDFdID0gTWF0aC5yb3VuZCh4KTtcbiAgICAgICAgICAgIHRoaXMudmlzaWJsZUNvbHVtbnNbY10gPSB2eDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNJbmRleE1hcFt2eF0gPSBjO1xuXG4gICAgICAgICAgICBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgPSBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgKyBNYXRoLnJvdW5kKHdpZHRoIC8gMikgKyBwcmV2aW91c0luc2VydGlvbkJvdW5kc0N1cnNvclZhbHVlO1xuICAgICAgICAgICAgdGhpcy5pbnNlcnRpb25Cb3VuZHMucHVzaChpbnNlcnRpb25Cb3VuZHNDdXJzb3IpO1xuICAgICAgICAgICAgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZSA9IE1hdGgucm91bmQod2lkdGggLyAyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHkgPSAwO1xuICAgICAgICBmb3IgKHIgPSAwOyByIDwgbnVtUm93czsgcisrKSB7XG4gICAgICAgICAgICB2eSA9IHI7XG4gICAgICAgICAgICBpZiAociA+PSBudW1GaXhlZFJvd3MpIHtcbiAgICAgICAgICAgICAgICB2eSA9IHZ5ICsgc2Nyb2xsVG9wO1xuICAgICAgICAgICAgICAgIGlmIChmaXJzdFZZID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RWWSA9IHZ5O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsYXN0VlkgPSB2eTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh5ID4gdmlld0hlaWdodCB8fCBudW1Sb3dzIDw9IHZ5KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoZWlnaHQgPSB0aGlzLmdldFJvd0hlaWdodCh2eSk7XG4gICAgICAgICAgICB5ID0geSArIGhlaWdodDtcbiAgICAgICAgICAgIHRoaXMucm93RWRnZXNbciArIDFdID0gTWF0aC5yb3VuZCh5KTtcbiAgICAgICAgICAgIHRoaXMudmlzaWJsZVJvd3Nbcl0gPSB2eTtcbiAgICAgICAgICAgIHRoaXMucm93RWRnZXNJbmRleE1hcFt2eV0gPSByO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMudmlld0hlaWdodCA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m9yIChyID0gMDsgciA8IHRoaXMucm93RWRnZXMubGVuZ3RoOyByKyspIHtcbiAgICAgICAgICAgIGhlaWdodCA9IHRoaXMucm93RWRnZXNbcl07XG4gICAgICAgICAgICBpZiAocG9pbnQueSA8IGhlaWdodCkge1xuICAgICAgICAgICAgICAgIHkgPSBNYXRoLm1heCgwLCBwb2ludC55IC0gcHJldmlvdXMgLSAyKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gaGVpZ2h0O1xuICAgICAgICB9XG4gICAgICAgIHItLTtcbiAgICAgICAgaWYgKHBvaW50LnggPCAwKSB7XG4gICAgICAgICAgICBjID0gLTE7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHBvaW50LnkgPCAwKSB7XG4gICAgICAgICAgICByID0gLTE7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdmlld1BvaW50ID0gZ3JpZC5uZXdQb2ludChjLCByKTtcblxuICAgICAgICAvL2NvbXBlbnNhdGUgaWYgd2UgYXJlIHNjcm9sbGVkXG4gICAgICAgIGlmIChjID49IGZpeGVkQ29sdW1uQ291bnQpIHtcbiAgICAgICAgICAgIGMgPSBjICsgc2Nyb2xsWDtcbiAgICAgICAgfVxuICAgICAgICBpZiAociA+PSBmaXhlZFJvd0NvdW50KSB7XG4gICAgICAgICAgICByID0gciArIHNjcm9sbFk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdHJhbnNsYXRlZEluZGV4ID0gLTE7XG5cbiAgICAgICAgdmFyIGNvbHVtbiA9IGJlaGF2aW9yLmdldENvbHVtbihjKTtcbiAgICAgICAgaWYgKGNvbHVtbikge1xuICAgICAgICAgICAgdHJhbnNsYXRlZEluZGV4ID0gY29sdW1uLmluZGV4O1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGdyaWRDZWxsOiBncmlkLm5ld1BvaW50KGMsIHIpLFxuICAgICAgICA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zpc2libGVSb3dzLmxlbmd0aCAtIDFdO1xuXG4gICAgICAgIHZhciBleHRlbnQgPSBzZWxlY3Rpb24uZXh0ZW50O1xuXG4gICAgICAgIHZhciBkcE9YID0gTWF0aC5taW4obW91c2VEb3duLngsIG1vdXNlRG93bi54ICsgZXh0ZW50LngpO1xuICAgICAgICB2YXIgZHBPWSA9IE1hdGgubWluKG1vdXNlRG93bi55LCBtb3VzZURvd24ueSArIGV4dGVudC55KTtcblxuICAgICAgICAvL2xldHMgY2hlY2sgaWYgb3VyIHNlbGVjdGlvbiByZWN0YW5nbGUgaXMgc2Nyb2xsZWQgb3V0c2lkZSBvZiB0aGUgdmlzaWJsZSBhcmVhXG4gICAgICAgIGlmIChkcE9YID4gbGFzdFZpc2libGVDb2x1bW4pIHtcbiAgICAgICAgICAgIHJldHVybjsgLy90aGUgdG9wIG9mIG91ciByZWN0YW5nbGUgaXMgYmVsb3cgdmlzaWJsZVxuICAgICAgICB9XG4gICAgICAgIGlmIChkcE9ZID4gbGFzdFZpc2libGVSb3cpIHtcbiAgICAgICAgICAgIHJldHVybjsgLy90aGUgbGVmdCBvZiBvdXIgcmVjdGFuZ2xlIGlzIHRvIHRoZSByaWdodCBvZiBiZWluZyB2aXNpYmxlXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgZHBFWCA9IE1hdGgubWF4KG1vdXNlRG93bi54LCBtb3VzZURvd24ueCArIGV4dGVudC54KSArIDE7XG4gICAgICAgIGRwRVggPSBNYXRoLm1pbihkcEVYLCAxICsgbGFzdFZpc2libGVDb2x1bW4pO1xuXG4gICAgICAgIHZhciBkcEVZID0gTWF0aC5tYXgobW91c2VEb3duLnksIG1vdXNlRG93bi55ICsgZXh0ZW50LnkpICsgMTtcbiAgICAgICAgZHBFWSA9IE1hdGgubWluKGRwRVksIDEgKyBsYXN0VmlzaWJsZVJvdyk7XG5cbiAgICAgICAgdmFyIG8gPSB0aGlzLl9nZXRCb3VuZHNPZkNlbGwoZHBPWCwgZHBPWSk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gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5yb3dIZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuY29sdW1uSGVhZGVyQ29sdW1uU2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyUm93U2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLnJvd0hlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuZmlsdGVyUHJvcGVydGllcyA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclN0eWxlOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNlbGxCb3JkZXJTdHlsZTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGUgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclRoaWNrbmVzczoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNlbGxCb3JkZXJUaGlja25lc3MgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllc0NvbHVtblNlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gcHJvcGVydGllcztcbiAgICB9LFxuXG4gICAgZ2V0Q29sdW1uV2lkdGg6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgdmFyIGNvbCA9IHRoaXMuZ2V0Q29sdW1uKHgpO1xuICAgICAgICBpZiAoIWNvbCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVzb2x2ZVByb3BlcnR5KCdkZWZhdWx0Q29sdW1uV2lkdGgnK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bSB7Ym9vbGVhbn0gW2V4cG9ydFByb3BzXVxuICAgICAqICogYHVuZGVmaW5lZGAgKG9taXR0ZWQpIC0gZGVsZXRlICphbGwqIHByb3BlcnRpZXNcbiAgICAgKiAqICoqZmFsc3kqKiAtIGRlbGV0ZSAqb25seSogdGhlIGV4cG9ydCBwcm9wZXJ0aWVzXG4gICAgICogKiAqKnRydXRoeSoqIC0gZGVsZXRlIGFsbCBwcm9wZXJ0aWVzICpleGNlcHQqIHRoZSBleHBvcnQgcHJvcGVydGllc1xuICAgICAqL1xuICAgIGNsZWFyT2JqZWN0UHJvcGVydGllczogZnVuY3Rpb24ob2JqLCBleHBvcnRQcm9wcykge1xuICAgICAgICBmb3IgKHZhciBrZXkgaW4gb2JqKSB7XG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgb2JqLmhhc093blByb3BlcnR5KGtleSkgJiYgKFxuICAgICAgICAgICAgICAgICAgICBleHBvcnRQcm9wcyA9PT0gdW5kZWZpbmVkIHx8XG4gICAgICAgICAgICAgICAgICAgICFleHBvcnRQcm9wcyAmJiBub0V4cG9ydFByb3BlcnRpZXMuaW5kZXhPZihrZXkpID49IDAgfHxcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0UHJvcHMgJiYgbm9FeHBvcnRQcm9wZXJ0aWVzLmluZGV4T2Yoa2V5KSA8IDBcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBkZWxldGUgb2JqW2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEJlaGF2aW9yLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGdldHRlciBmb3IgYSBbTWVtZW50b10oaHR0cDovL2MyLmNvbS9jZ2kvd2lraT9NZW1lbnRvUGF0dGVybikgT2JqZWN0XG4gICAgICogQHJldHVybnMge29iamVjdH1cbiAgICAgKi9cbiAgICBnZXRQcml2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gICBpZiAoIWNvbCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBpc051bGw6IHRydWVcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb2wuZ2V0UHJvcGVydGllcygpOyAvL1RPRE86IHJldHVybnMgYG51bGxgIG9uIEh5cGVyZ3JpZC5yZXNldCgpO1xuICAgICAgICBpZiAoIXByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgaXNOdWxsOiB0cnVlXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwcm9wZXJ0aWVzO1xuICAgIH0sXG4gICAgc2V0Q29sdW1uUHJvcGVydGllczogZnVuY3Rpb24oY29sdW1uSW5kZXgsIHByb3BlcnRpZXMpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sdW1uSW5kZXgpO1xuICAgICAgICBfKGNvbHVtblByb3BlcnRpZXMpLmV4dGVuZE93bihwcm9wZXJ0aWVzKTtcbiAgICAgICAgdGhpcy5jaGFuZ2VkKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBCZWhhdmlvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJuIHtzdHJpbmdzW119IExhYmVscyB0byB1c2UgZm9yIHRoZSBjb2x1bW4gcGlja2VyLlxuICAgICAqL1xuICAgIGdldENvbHVtbkRlc2NyaXB0b3JzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgLy9hc3N1bWVzIHRoZXJlIGlzIG9uZSByb3cuLi4uXG4gICAgICAgIHRoaXMuaW5zdXJlQ29sdW1uSW5kZXhlc0FyZUluaXRpYWxpemVkKCk7XG4gICAgICAgIHZhciB0YWJsZVN0YXRlID0gdGhpcy5nZXRQcml2YXRlU3RhdGUoKTtcbiAgICAgICAgdmFyIGNvbHVtbkNvdW50ID0gdGFibGVTdGF0ZS5jb2x1bW5JbmRleGVzLmxlbmd0aDtcbiAgICAgICAgdmFyIGxhYmVscyA9IFtdO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNvbHVtbkNvdW50OyBpKyspIHtcbiAgICAgICAgICAgIHZhciBpZCA9IHRhYmxlU3RhdGUuY29sdW1uSW5kZXhlc1tpXTtcbiAgICAgICAgICAgIGxhYmVscy5wdXNoKHtcbiAgICAgICAgICAgICAgICBpZDogaWQsXG4gICAgICAgICAgICAgICAgbGFiZWw6IHRoaXMuZ2V0SGVhZGVyKGlkKSxcbiAgICAgICAgICAgICAgICBmaWVsZDogdGhpcy5nZXRGaWVsZChpZClcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsYWJlbHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBCZWhhdmlvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJuIHtzdHJpbmd9IFRoZSBmaWVsZCBhdCBgY29sSW5kZXhgLlxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleCAtIHRoZSBjb2x1bW4gaW5kZXggb2YgaW50ZXJlc3RcbiAgICAgKi9cbiAgICBnZXRGaWVsZDogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgaWYgKGNvbEluZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgcmV0dXJuICd0cmVlJztcbiAgICAgICAgfVxuICAgICAgICB2YXIgY29sID0gdGhpcy5nZXRDb2x1bW4oY29sSW5kZXgpO1xuICAgICAgICByZXR1cm4gY29sLmdldEZpZWxkKCk7XG4gICAgfSxcbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgY29sdW1uIGhlYWRpbmcgYXQgYGNvbEluZG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NpYmxlW2ldLmlkKTtcbiAgICAgICAgfVxuICAgICAgICB0YWJsZVN0YXRlLmNvbHVtbkluZGV4ZXMgPSBpbmRleGVzO1xuICAgICAgICB0aGlzLmNoYW5nZWQoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEJlaGF2aW9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm4ge3N0cmluZ1tdfSBBbGwgdGhlIGN1cnJlbnRseSBoaWRkZW4gY29sdW1uIGhlYWRlciBsYWJlbHMuXG4gICAgICovXG4gICAgZ2V0SGlkZGVuQ29sdW1uRGVzY3JpcHRvcnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgdGFibGVTdGF0ZSA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCk7XG4gICAgICAgIHZhciBpbmRleGVzID0gdGFibGVTdGF0ZS5jb2x1bW5JbmRleGVzO1xuICAgICAgICB2YXIgbGFiZWxzID0gW107XG4gICAgICAgIHZhciBjb2x1bW5Db3VudCA9IHRoaXMuZ2V0Q29sdW1uQ291bnQoKTtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjb2x1bW5Db3VudDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoaW5kZXhlcy5pbmRleE9mKGkpID09PSAtMSkge1xuICAgICAgICAgICAgICAgIGxhYmVscy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGksXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsOiB0aGlzLmdldEhlYWRlcihpKSxcbiAgICAgICAgICAgICAgICAgICAgZmllbGQ6IHRoaXMuZ2V0RmllbGQoaSlcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGFiZWxzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGlkZ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zLkpTT04ucHJvdG90eXBlXG4gICAgICogQGRlc2NyaXB0aW9uIFNldCB0aGUgZGF0YSBmaWVsZC5cbiAgICAgKiBAcGFyYW0ge29iamVjdFtdfSBvYmplY3RzIC0gQW4gYXJyYXkgb2YgdW5pZm9ybSBvYmplY3RzLCBlYWNoIGJlaW5nIGEgcm93IGluIHRoZSBncmlkLlxuICAgICAqL1xuICAgIHNldERhdGE6IGZ1bmN0aW9uKGRhdGFSb3dzKSB7XG4gICAgICAgIHRoaXMuZ2V0RGF0YU1vZGVsKCkuc2V0RGF0YShkYXRhUm93cyk7XG4gICAgICAgIHRoaXMuY3JlYXRlQ29sdW1ucygpO1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIGlmICh0aGlzLmdldEdyaWQoKS5pc0NvbHVtbkF1dG9zaXppbmcoKSkge1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmF1dG9zaXplQWxsQ29sdW1ucygpO1xuICAgICAgICAgICAgfSwgMTAwKTtcbiAgICAgICAgICAgIHNlbGYuY2hhbmdlZCgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmFsbENvbHVtbnNbLTFdLmNoZWNrQ29sdW1uQXV0b3NpemluZyh0cnVlKTtcbiAgICAgICAgICAgICAgICBzZWxmLmNoYW5nZWQoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBiZWhhdmlvcnMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAZGVzY3JpcHRpb24gR2V0IHRoZSBkYXRhIGZpZWxkLlxuICAgICAqL1xuICAgIGdldERhdGE6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXREYXRhTW9kZWwoKS5nZX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YXRpb25cbiAgICAgKi9cbiAgICBpbml0aWFsaXplSW5wdXQ6IGZ1bmN0aW9uKGlucHV0KSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcigna2V5dXAnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoZSAmJiAoZS5rZXlDb2RlID09PSAxMyB8fCBlLmtleUNvZGUgPT09IDI3IHx8IGUua2V5Q29kZSA9PT0gOCkpIHtcbiAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgaWYgKGUua2V5Q29kZSA9PT0gOCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyU3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5VXBFdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5RG93bkV2ZW50KHNlbGYsIGUpO1xuICAgICAgICB9KTtcbiAgICAgICAgaW5wdXQuYWR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4gICAgICAgICAgICAgICAgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5nZXRHcmlkKCkuaXNGaWx0ZXJSb3coc2VsZi5nZXRFZGl0b3JQb2ludCgpLnkpKSB7XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zYXZlRWRpdG9yVmFsdWUoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbW92ZUVkaXRvcigpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleVVwRXZlbnQoc2VsZiwgZSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdrZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleURvd25FdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXByZXNzJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleVByZXNzRXZlbnQoc2VsZiwgZSk7XG4gICA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XIubGVuZ3RoID09PSAwID8gJ2ZpbHRlci1vZmYnIDogJ2ZpbHRlci1vbic7XG4gICAgICAgIHZhciBoZWFkZXIsIHNvcnRTdHJpbmc7XG4gICAgICAgIGlmIChpc0JvdGgpIHtcbiAgICAgICAgICAgIGlmICh5ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaGVhZGVyID0gdGhpcy5nZXRIZWFkZXJzKClbeF07XG4gICAgICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgICAgIGlmIChzb3J0U3RyaW5nKSB7IGhlYWRlciA9IHNvcnRTdHJpbmcgKyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVhZGVyUm93Q291bnQpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyUm93VmFsdWUoeCwgeSwgdmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGhhc0hpZXJhcmNoeUNvbHVtbikge1xuICAgICAgICAgICAgeSArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXREYXRhU291cmNlKCkuc2V0VmFsdWUoeCwgeSAtIGhlYWRlclJvd0NvdW50LCB2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5jaGFuZ2VkKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn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b3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Db3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9XG4gICAgICovXG4gICAgZ2V0Um93Q291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgY291bnQgPSB0aGlzLmdldERhdGFTb3VyY2UoKS5nZXRSb3dDb3VudCgpO1xuICAgICAgICBjb3VudCArPSBncmlkLmdldEhlYWRlclJvd0Nvd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yA9IHRoaXMuZ2V0RmllbGRzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZ3JvdXBCeXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIHZhciBmaWVsZCA9IGhlYWRlcnNbZ3JvdXBCeXNbaV1dO1xuICAgICAgICAgICAgZ3JvdXBzLnB1c2goe1xuICAgICAgICAgICAgICAgIGlkOiBncm91cEJ5c1tpXSxcbiAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgZmllbGQ6IGZpZWxkc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGdyb3VwcztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0QXZhaWxhYmxlR3JvdXBzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB0aGlzLnNvdXJjZS5nZXRIZWFkZXJzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy5nZXRCZWhhdmlvcigpLmNvbHVtbnM7XG4gICAgICAgIGl0ZW1zID0gaXRlbXMuZmlsdGVyKGZ1bmN0aW9uKGVhY2gpIHtcbiAgICAgICAgICAgIHJldHVybiBlYWNoLmxhYmVsICE9PSAnVHJlZSc7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gaXRlbXM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldEhpZGRlbkNvbHVtbnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgdmlzaWJsZSA9IHRoaXMuZ2V0QmVoYXZpb3IoKS5jb2x1bW5zO1xuICAgICAgICB2YXIgYWxsID0gdGhpcy5nZXRCZWhhdmlvcigpLmFsbENvbHVtbnM7XG4gICAgICAgIHZhciBoaWRkZW4gPSBbXTtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhbGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2aXNpYmxlLmluZGV4T2YoYWxsW2ldKSA9PT0gLTEpIHtcbiAgICAgICAgICAgICAgICBoaWRkZW4ucHVzaChhbGxbaV0pO1x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zLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERPV05XQVJEU19CTEFDS19BUlJPVztcbiAgICAgICAgICAgIHJldHVybiByYW5rICsgYXJyb3cgKyAnICc7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IHJhbmsgKyAodXAgPyAnLXVwJyA6ICctZG93bicpO1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRCZWhhdmlvcigpLmdldEltYWdlKG5hbWUpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBjZWxsXG4gICAgICogQHBhcmFtIGV2ZW50XG4gICAgICovXG4gICAgY2VsbENsaWNrZWQ6IGZ1bmN0aW9uKGNlbGwsIGV2ZW50KSB7XG4gICAgICAgIGlmICghdGhpcy5oYXNBZ2dyZWdhdGVzKCkpIHtcbi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IGhlYWRlclJvd0NvdW50KTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEByZXR1cm5zIHtvYmplY3R9XG4gICAgICovXG4gICAgYnVpbGRSb3c6IGZ1bmN0aW9uKHkpIHtcbiAgICAgICAgdmFyIGNvbENvdW50ID0gdGhpcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgICAgICB2YXIgZmllbGRzID0gW10uY29uY2F0KHRoaXMuZ2V0RmllbGRzKCkpO1xuICAgICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIGlmICh0aGlzLmhhc0FnZ3JlZ2F0ZXMoKSkge1xuICAgICAgICAgICAgcmVzdWx0LnRyZWUgPSB0aGlzLmdldFZhbHVlKC0yLCB5KTtcbiAgICAgICAgICAgIGZpZWxkcy5zaGlmdCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgcmVzdWx0W2ZpZWxkc1tpXV0gPSB0aGlzLmdldFZhbHVlKGksIHkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fVxuICAgICAqL1xuICAgIGdldENvbXB1dGVkUm93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHZhciByY2YgPSB0aGlzLmdldFJvd0NvbnRleHRGdW5jdGlvbihbeV0pO1xuICAgICAgICB2YXIgZmllbGRzID0gdGhpcy5nZXRGaWVsZHMoKTtcbiAgICAgICAgdmFyIHJvdyA9IHt9O1xuICAgICAgICBmb3IgKHZh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ncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eS5cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIWdyaWQuaXNDZWxsU2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrIHx8ICF0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIHZhciBkeCA9IGNlbGwueDtcbiAgICAgICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgK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ckFyZWEoKTtcbiAgICAgICAgdmFyIGxhc3REcmFnQ2VsbCA9IHRoaXMubGFzdERyYWdDZWxsO1xuICAgICAgICB2YXIgYiA9IGdyaWQuZ2V0RGF0YUJvdW5kcygpO1xuICAgICAgICB2YXIgeE9mZnNldCA9IDA7XG4gICAgICAgIHZhciB5T2Zmc2V0ID0gMDtcblxuICAgICAgICB2YXIgbnVtRml4ZWRDb2x1bW5zID0gZ3JpZC5nZXRGaXhlZENvbHVtbkNvdW50KCk7XG4gICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICB2YXIgZHJhZ0VuZEluRml4ZWRBcmVhWCA9IGxhc3REcmFnQ2VsbC54IDwgbnVtRml4ZWRDb2x1bW5zO1xuICAgICAgICB2YXIgZHJhZ0VuZEluRml4ZWRBcmVhWSA9IGxhc3REcmFnQ2VsbC55IDwgbnVtRml4ZWRSb3dzO1xuXG4gICAgICAgIGlmICghZHJhZ1N0YXJ0ZWRJbkhlYWRlckFyZWEpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLmN1cnJlbnREcmFnLnggPCBiLm9yaWdpbi54KSB7XG4gICAgICAgICAgICAgICAgeE9mZnNldCA9IC0xO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuY3VycmVudERyYWcueSA8IGIub3JpZ2luLnkpIHtcbiAgICAgICAgICAgICAgICB5T2Zmc2V0ID0gLTE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMuY3VycmVudERyYWcueCA+IGIub3JpZ2luLnggKyBiLmV4dGVudC54KSB7XG4gICAgICAgICAgICB4T2Zmc2V0ID0gMTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50RHJhZy55ID4gYi5vcmlnaW4ueSArIGIuZXh0ZW50LnkpIHtcbiAgICAgICAgICAgIHlPZmZzZXQgPSAxO1xuICAgICAgICB9XG5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gaWYgKHggPT09IG1vdXNlUG9pbnQueCAmJiB5ID09PSBtb3VzZVBvaW50LnkpIHtcbiAgICAgICAgICAgIGdyaWQuY2xlYXJNb3N0UmVjZW50U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICBncmlkLnBvcE1vdXNlRG93bigpO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyU2VsZWN0aW9ucygpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyTW9zdFJlY2VudFNlbGVjdGlvbigpO1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QobW91c2VQb2ludC54LCBtb3VzZVBvaW50LnksIHggLSBtb3VzZVBvaW50LnggKyAxLCB5IC0gbW91c2VQb2ludC55ICsgMSk7XG4gICAgICAgICAgICBncmlkLnNldERyYWdFeHRlbnQoZ3JpZC5uZXdQb2ludCh4IC0gbW91c2VQb2ludC54ICsgMSwgeSAtIG1vdXNlUG9pbnQueSkpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QoeCwgeSwgMCwgMCk7XG4gICAgICAgICAgICBncmlkLnNldE1vdXNlRG93bihncmlkLm5ld1BvaW50KHgsIHkpKTtcbiAgICAgICAgICAgIGdyaWQuc2V0RHJhZ0V4dGVudChncmlkLm5ld1BvaW50KDAsIDApKTtcbiAgICAgICAgfVxuICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICB9LFxuXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbFNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBoYW5kbGUgdGhpcyBldmVudFxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlk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RldGFjaENoYWluKCk7XG4gICAgICAgIH0gZWxzZSBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VEb3duKGdyaWQsIGV2ZW50KTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ29sdW1uUmVzaXppbmcucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNFbmFibGVkID0gdGhpcy5pc0VuYWJsZWQoZ3JpZCk7XG4gICAgICAgIGlmIChpc0VuYWJsZWQgJiYgdGhpcy5kcmFnSW5kZXggPiAtMikge1xuICAgICAgICAgICAgdGhpcy5jdXJzb3IgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5kcmFnSW5kZXggPSAtMjtcblxuICAgICAgICAgICAgZXZlbnQucHJpbWl0aXZlRXZlbnQuc3RvcFByb3BhZ2F0aW9uKCk7XG4gICAgICAgICAgICAvL2RlbGF5IGhlcmUgdG8gZ2l2ZSBvdGhlciBldmVudHMgYSBjaGFuY2UgdG8gYmUgZHJvcHBlZFxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICAgICAgZ3JpZC5zeW5jaHJvbml6ZVNjcm9sbGluZ0JvdW5kcmllcygpO1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmF0dGFjaENoYWluKCk7XG4gICAgICAgICAgICB9LCAyMDApO1x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naHRDbGljayA9IGV2ZW50LnByaW1pdGl2ZUV2ZW50LmRldGFpbC5pc1JpZ2h0Q2xpY2s7XG5cbiAgICAgICAgaWYgKGlzUmlnaHRDbGljayB8fCAhdGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgICAgIHRoaXMubmV4dC5oYW5kbGVNb3VzZURyYWcoZ3JpZCwgZXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICB2YXIgbnVtRml4ZWRDb2x1bW5zID0gZ3JpZC5nZXRGaXhlZENvbHVtbkNvdW50KCk7XG5cbiAgICAgICAgICAgIHZhciBjZWxsID0gZXZlbnQuZ3JpZENlbGw7XG4gICAgICAgICAgICB2YXIgdmlld0NlbGwgPSBldmVudC52aWV3UG9pbnQ7XG4gICAgICAgICAgICB2YXIgZHggPSBjZWxsLng7XG4gICAgICAgICAgICB2YXIgZHkgPSBjZWxsLnk7XG5cbiAgICAgICAgICAgIC8vaWYgd2UgYXJlIGluIHRoZSBmaXhlZCBhcmVhIGRvIG5vdCBhcHBseSB0aGUgc2Nyb2xsIHZhbHVlc1xuICAgICAgICAgICAgLy9jaGVjayBib3RoIHggYW5kIHkgdmFsdWVzIGluZGVwZW5kZW50bHlcbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC54IDwgbnVtRml4ZWRDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgZHggPSB2aWV3Q2VsbC54O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudERyYWcgPSBwcmltRXZlbnQuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdGhpcy5sYXN0RHJhZ0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xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2MgcmV0dXJucyB0cnVlIGlmIHRoZSBjb2x1bW4gcGlja2VyIGlzIG9wZW5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn1cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqL1xuICAgIGlzQ29sdW1uUGlja2VyT3BlbjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICByZXR1cm4gdGhpcy5vdmVybGF5LnN0eWxlLmRpc3BsYXkgIT09ICdub25lJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2Mgb3BlbiB0aGUgY29sdW1uIHBpY2tlclxuICAgICAqICMjIyMgcmV0dXJuczogdHlwZVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICovXG4gICAgb3BlbkNvbHVtblBpY2tlcjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5pc0NvbHVtblBpY2tlck9wZW4oKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMub3BlbkVkaXRvciA9IHRydWU7XG4gICAgICAgIGlmIChncmlkLmdldEJlaGF2aW9yKCkub3BlbkVkaXRvcih0aGlzLm92ZXJsYXkpID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gZ3JpZC5yZXNvbHZlUHJvcGVydHkoJ2JhY2tncm91bmRDb2xvcicpO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS50b3AgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUucmlnaHQgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYm90dG9tID0gJzAlJztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLmxlZnQgPSAnMCUnO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5Ub3AgPSAnMTVweCc7XG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5SaWdodCA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkJvdHRvbSA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkxlZnQgPSAnMTVweCc7XG5cbiAgICAgICAgc2VsZi5vdmVybGF5LnN0eWxlLmRpc3BsYXkgPSAnJztcblxuXG4gICAgICAgIGlmICghdGhpcy5fY2xvc2VyKSB7XG4gICAgICAgICAgICB0aGlzLl9jbG9zZXIgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IHNlbGYuZ2V0Q2hhckZvcihncmlkLCBlLmtleUNvZGUpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgdmFyIGtleXMgPSBncmlkLnJlc29sdmVQcm9wZXJ0eSgnZWRpdG9yQWN0aXZhdGlvbktleXMnKTtcbiAgICAgICAgICAgICAgICBpZiAoa2V5cy5pbmRleE9mKGtleSkgPiAtMSB8fCBlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbG9zZUNvbHVtblBpY2tlcihncmlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy9ncmlkLnNldEZvY3VzYWJsZShmYWxzZSk7XG4gICAgICAgIHJlcXVlc3RBbmltYX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ZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmRyYWdnaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIC8vdmFyIGR4ID0gY2VsbC54O1xuICAgICAgICAgICAgdmFyIGR5ID0gY2VsbC55O1xuXG4gICAgICAgICAgICAvL2lmIHdlIGFyZSBpbiB0aGUgZml4ZWQgYXJlYSBkbyBub3QgYXBwbHkgdGhlIHNjcm9sbCB2YWx1ZXNcbiAgICAgICAgICAgIC8vY2hlY2sgYm90aCB4IGFuZCB5IHZhbHVlcyBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgICBpZiAodmlld0NlbGwueSA8IG51bUZpeGVkUm93cykge1xuICAgICAgICAgICAgICAgIGR5ID0gdmlld0NlbGwueTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGRDZWxsID0gZ3JpZC5uZXdQb2ludCgwLCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudERyYWcgPSBwcmltRXZlbnQuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdGhpcy5sYXN0RHJhZ0NlbGwgPSBkQ2VsbDtcblxuICAgICAgICAgICAgdGhpcy5jaGVja0RyYWdTY3JvbGwoZ3JpZCwgdGhpcy5jdXJyZW50RHJhZyk7XG4gICAgICAgICAgICB0aGlzLmhhbmRsZU1vdXNlRHJhZ0NlbGxTZWxlY3Rpb24oZ3JpZCwgZENlbGwsIHByaW1FdmVudC5kZ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MtaW5qZWN0b3InKTtcblxudmFyIHN0eWxlc2hlZXRzID0ge1xuICAgIGdyaWQ6IFtcbiAgICAgICAgJ2RpdiNncmlkLWNvbnRhaW5lciB7JyxcbiAgICAgICAgJyAgICBwb3NpdGlvbjogcmVsYXRpdmU7JyxcbiAgICAgICAgJyAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7JyxcbiAgICAgICAgJyAgICAtd2Via2l0LXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgLW1vei11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1tcy11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1vLXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgdXNlci1zZWxlY3Q6IG5vbmU7JyxcbiAgICAgICAgJyAgICBvdmVyZmxvdzogaGlkZGVuOyB9JyxcbiAgICAgICAgJ3Zpc2libGUgeyBvcGFjaXR5OiAwLjc1OyB9JyxcbiAgICAgICAgJ2hpZGRlbiB7IG9wYWNpdHk6IDAuMDsgfScsXG4gICAgICAgICdlZGl0b3IgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgZGlzcGxheTogbm9uZTsnLFxuICAgICAgICAnICAgIGJvcmRlcjogc29saWQgMnB4IGJsYWNrOycsXG4gICAgICAgICcgICAgb3V0bGluZTogMDsnLFxuICAgICAgICAnICAgIHBhZGRpbmc6IDA7JyxcbiAgICAgICAgJyAgICB6LWluZGV4OiAxMDAwOyB9J1xuICAgIF0sXG4gICAgJ2xpc3QtZHJhZ29uJzogW1xuICAgICAgICAnZGl2LmRyYWdvbi1saXN0LCBsaS5kcmFnb24tcG9wIHsnLFxuICAgICAgICAnICAgIGZvbnQtZmFtaWx5OiBSb2JvdG8sIHNhbnMtc2VyaWY7JyxcbiAgICAgICAgJyAgICB0ZXh0LXRyYW5zZm9ybTogY2FwaXRhbGl6ZTsgfScs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GVzaGVldChrZXksIHJlZmVyZW5jZUVsZW1lbnQpIHtcbiAgICBjc3NJbmplY3RvcihzdHlsZXNoZWV0c1trZXldLCBrZXksIHJlZmVyZW5jZUVsZW1lbnQpO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGFkZFN0eWxlc2hlZXQ7XG4iXX0= diff --git a/examples/bclys/index.min.js b/examples/bclys/index.min.js index 1d26fde82..e8e5cd6c2 100644 --- a/examples/bclys/index.min.js +++ b/examples/bclys/index.min.js @@ -1,8 +1,8 @@ !function t(e,i,n){function o(s,l){if(!i[s]){if(!e[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(r)return r(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(t){var i=e[s][1][t];return o(i?i:t)},u,u.exports,t,e,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s'+t.replace("mouse","")+""}),e.appendChild(n),t={},i.forEach(function(e){t[e]=n.getElementsByClassName(e)[0]})}return t},_addEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.add("listening"),window.addEventListener(t,this._bound["on"+t])},_removeEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.remove("listening"),window.removeEventListener(t,this._bound["on"+t])}};var a,u={shortStop:function(t){t.stopPropagation()},onwheel:function(t){this.index+=t[this.deltaProp],t.stopPropagation(),t.preventDefault()},onclick:function(t){var e=this.thumb.getBoundingClientRect(),i=t[this.oh.coordinate].thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:31}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){var i=this;return!this.filters.find(function(n){return!n(i.dataSource.getValue(n.columnIndex,t),e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){var i=this;return this.visibleColumnMap.find(function(n,o){var r=i.dataSource.getValue(n,t);return i.filter(r,e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":26,templex:27}],26:[function(t,e,i){e.exports=t(2)},{}],27:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;ie.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],29:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],30:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],31:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],33:[function(t,e,i){"use strict";function n(t,e){var i="f"===(typeof e)[0],n=i?e(t):e;return n||0===n?n:""}function o(t,e,i,n,o,r){var s=t.getTextWidth(e,i);switch(e.textAlign){case"center":n-=s/2;break;case"right":n-=s}e.lineWidth=r,e.moveTo(n+.5,o+.5),e.lineTo(n+s+.5,o+.5)}function r(t,e,i,n){if(1===i.length)return i;for(var o,s=[i.shift()];(o=e.getTextWidth(t,s.join(" "))1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent},setDragExtent:function(t){ -this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":28,"object-iterators":30,rectangular:31}],35:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); -}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":30}],36:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":32}],37:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],54:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":64}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":64}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s)); -var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":64}],59:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":64}],60:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":64}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":64}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":64}],63:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":64}],64:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":64}],69:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":61}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":64}],71:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":64}],72:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],74:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[55]); \ No newline at end of file +}},c={vertical:{coordinate:"clientY",axis:"pageY",size:"height",outside:"right",inside:"left",leading:"top",trailing:"bottom",marginLeading:"marginTop",marginTrailing:"marginBottom",thickness:"width",delta:"deltaY"},horizontal:{coordinate:"clientX",axis:"pageX",size:"width",outside:"bottom",inside:"top",leading:"left",trailing:"right",marginLeading:"marginLeft",marginTrailing:"marginRight",thickness:"height",delta:"deltaX"}},h={top:"vertical",bottom:"vertical",height:"vertical",left:"horizontal",right:"horizontal",width:"horizontal"};a="div.finbar-horizontal,div.finbar-vertical{position:absolute;margin:3px}div.finbar-horizontal>.thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:29}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){for(var i=this.filters.length;i--;)if(!this.filters[i](this.dataSource.getValue(this.filters[i].columnIndex,t),e,t))return!1;return!0}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){for(var i=this.visibleColumnMap,n=i.length;n--;)if(this.filter(this.dataSource.getValue(i[n],t),e,t))return!0;return!1}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":2,templex:31}],26:[function(t,e,i){!function(){function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i(){return 1}function n(t){d||"string"==typeof t||"number"==typeof t||(d=!0,console.error(new TypeError("LRU: key must be a string or number. Almost certainly a bug! "+typeof t).stack))}function o(t){return this instanceof o?("number"==typeof t&&(t={max:t}),t||(t={}),this._max=t.max,(!this._max||"number"!=typeof this._max||this._max<=0)&&(this._max=1/0),this._lengthCalculator=t.length||i,"function"!=typeof this._lengthCalculator&&(this._lengthCalculator=i),this._allowStale=t.stale||!1,this._maxAge=t.maxAge||null,this._dispose=t.dispose,void this.reset()):new o(t)}function r(t,e,i){n(e);var o=t._cache[e];return o&&(s(t,o)?(c(t,o),t._allowStale||(o=void 0)):i&&l(t,o),o&&(o=o.value)),o}function s(t,e){if(!e||!e.maxAge&&!t._maxAge)return!1;var i=!1,n=Date.now()-e.now;return i=e.maxAge?n>e.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],27:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],28:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],29:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],31:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;i1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent; +},setDragExtent:function(t){this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":26,"object-iterators":28,rectangular:29}],34:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); +}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":28}],35:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":30}],36:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],53:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":63}],56:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":63}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r), +o=Math.min(o,s));var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":63}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":63}],59:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":63}],60:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":63}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":63}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":63}],63:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":63}],68:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":60}],69:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":63}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":63}],71:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],73:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[54]); \ No newline at end of file diff --git a/examples/polymerwrapper/index.js b/examples/polymerwrapper/index.js index 0e22a2bb7..66be0667f 100644 --- a/examples/polymerwrapper/index.js +++ b/examples/polymerwrapper/index.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { contexts.unshift(arguments); } - return template.replace(templex.regexp, templex.merger.bind(contexts)); -} - -templex.regexp = /\{(.*?)\}/g; - -templex.with = function (i, s) { - return 'with(this[' + i + ']){' + s + '}'; -}; - -templex.cache = []; - -templex.deref = function (key) { - if (!(this.length in templex.cache)) { - var code = 'return eval(expr)'; - - for (var i = 0; i < this.length; ++i) { - code = templex.with(i, code); - } - - templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval - } - return templex.cache[this.length].call(this, key); -}; - -templex.merger = function (match, key) { - // Advanced features: Context can be a list of contexts which are searched in order. - var replacement; - - try { - replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; - } catch (e) { - replacement = '{' + key + '}'; - } - - return replacement; -}; - -// this interface consists solely of the templex function (and it's properties) -module.exports = templex; - -},{}],28:[function(require,module,exports){ +},{"css-injector":2,"templex":31}],26:[function(require,module,exports){ ;(function () { // closure for web browsers if (typeof module === 'object' && module.exports) { @@ -7243,7 +7190,7 @@ function Entry (key, value, lu, length, now, maxAge) { })() -},{}],29:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ /*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js @@ -7874,7 +7821,7 @@ function Entry (key, value, lu, length, now, maxAge) { })); -},{}],30:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ /* object-iterators.js - Mini Underscore library * by Jonathan Eiten * @@ -8082,7 +8029,7 @@ if (!Array.prototype.find) { module.exports = Wrapper; -},{}],31:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8636,7 +8583,7 @@ Rectangle.prototype = { exports.Point = Point; exports.Rectangle = Rectangle; -},{}],32:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ 'use strict'; /* eslint-env node, browser */ @@ -8974,7 +8921,76 @@ exports.Rectangle = Rectangle; * 2.b. If `module` object undefined, redefine`RangeSelectionModel` to be the `RangeSelectionModel.exports` object */ -},{}],33:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ +// templex node module +// https://github.com/joneit/templex + +/* eslint-env node */ + +/** + * Merges values of execution context properties named in template by {prop1}, + * {prop2}, etc., or any javascript expression incorporating such prop names. + * The context always includes the global object. In addition you can specify a single + * context or an array of contexts to search (in the order given) before finally + * searching the global context. + * + * Merge expressions consisting of simple numeric terms, such as {0}, {1}, etc., deref + * the first context given, which is assumed to be an array. As a convenience feature, + * if additional args are given after `template`, `arguments` is unshifted onto the context + * array, thus making first additional arg available as {1}, second as {2}, etc., as in + * `templex('Hello, {1}!', 'World')`. ({0} is the template so consider this to be 1-based.) + * + * If you prefer something other than braces, redefine `templex.regexp`. + * + * See tests for examples. + * + * @param {string} template + * @param {...string} [args] + */ +function templex(template) { + var contexts = this instanceof Array ? this : [this]; + if (arguments.length > 1) { contexts.unshift(arguments); } + return template.replace(templex.regexp, templex.merger.bind(contexts)); +} + +templex.regexp = /\{(.*?)\}/g; + +templex.with = function (i, s) { + return 'with(this[' + i + ']){' + s + '}'; +}; + +templex.cache = []; + +templex.deref = function (key) { + if (!(this.length in templex.cache)) { + var code = 'return eval(expr)'; + + for (var i = 0; i < this.length; ++i) { + code = templex.with(i, code); + } + + templex.cache[this.length] = eval('(function(expr){' + code + '})'); // eslint-disable-line no-eval + } + return templex.cache[this.length].call(this, key); +}; + +templex.merger = function (match, key) { + // Advanced features: Context can be a list of contexts which are searched in order. + var replacement; + + try { + replacement = isNaN(key) ? templex.deref.call(this, key) : this[0][key]; + } catch (e) { + replacement = '{' + key + '}'; + } + + return replacement; +}; + +// this interface consists solely of the templex function (and it's properties) +module.exports = templex; + +},{}],32:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -9575,7 +9591,7 @@ function roundRect(gc, x, y, width, height, radius, fill, stroke) { module.exports = CellProvider; -},{"extend-me":3}],34:[function(require,module,exports){ +},{"extend-me":3}],33:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -13041,7 +13057,7 @@ function installPolyfills() { module.exports = Hypergrid; -},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":28,"object-iterators":30,"rectangular":31}],35:[function(require,module,exports){ +},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,"finbars":4,"fincanvas":5,"lru-cache":26,"object-iterators":28,"rectangular":29}],34:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -14205,7 +14221,7 @@ function setNumberColumnWidth(gc, behavior, maxRow) { module.exports = Renderer; -},{"extend-me":3,"object-iterators":30}],36:[function(require,module,exports){ +},{"extend-me":3,"object-iterators":28}],35:[function(require,module,exports){ 'use strict'; var RangeSelectionModel = require('sparse-boolean-array'); @@ -14728,7 +14744,7 @@ SelectionModel.prototype = { module.exports = SelectionModel; -},{"sparse-boolean-array":32}],37:[function(require,module,exports){ +},{"sparse-boolean-array":30}],36:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16390,7 +16406,7 @@ var Behavior = Base.extend('Behavior', { module.exports = Behavior; -},{"../CellProvider":33,"./Column":38,"./images":42,"extend-me":3,"object-iterators":30}],38:[function(require,module,exports){ +},{"../CellProvider":32,"./Column":37,"./images":41,"extend-me":3,"object-iterators":28}],37:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -16485,7 +16501,7 @@ Column.prototype = { module.exports = Column; -},{"object-iterators":30}],39:[function(require,module,exports){ +},{"object-iterators":28}],38:[function(require,module,exports){ 'use strict'; function DataModelDecorator(grid, component) { @@ -16671,7 +16687,7 @@ DataModelDecorator.prototype = { module.exports = DataModelDecorator; -},{}],40:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict'; var ListDragon = require('list-dragon'); @@ -16988,7 +17004,7 @@ var JSON = Behavior.extend('behaviors.JSON', { module.exports = JSON; -},{"../dataModels/JSON":54,"../features/index":72,"../stylesheets":74,"./Behavior":37,"./DataModelDecorator":39,"hyper-analytics":9,"list-dragon":25}],41:[function(require,module,exports){ +},{"../dataModels/JSON":53,"../features/index":71,"../stylesheets":73,"./Behavior":36,"./DataModelDecorator":38,"hyper-analytics":9,"list-dragon":25}],40:[function(require,module,exports){ 'use strict'; var Behavior = require('./Behavior'); @@ -17022,7 +17038,7 @@ var Null = Behavior.extend('Null', { module.exports = Null; -},{"./Behavior":37}],42:[function(require,module,exports){ +},{"./Behavior":36}],41:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17039,7 +17055,7 @@ _(images).each(function(image, key) { module.exports = images; -},{"../../images":1,"object-iterators":30}],43:[function(require,module,exports){ +},{"../../images":1,"object-iterators":28}],42:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17047,7 +17063,7 @@ module.exports = { JSON: require('./JSON'), Null: require('./Null') }; -},{"./Behavior":37,"./JSON":40,"./Null":41}],44:[function(require,module,exports){ +},{"./Behavior":36,"./JSON":39,"./Null":40}],43:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -17365,7 +17381,7 @@ var CellEditor = Base.extend('CellEditor', { module.exports = CellEditor; -},{"extend-me":3,"mustache":29}],45:[function(require,module,exports){ +},{"extend-me":3,"mustache":27}],44:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17438,7 +17454,7 @@ var Choice = Simple.extend('Choice', { module.exports = Choice; -},{"./Simple":48}],46:[function(require,module,exports){ +},{"./Simple":47}],45:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17465,7 +17481,7 @@ var Color = Simple.extend('Color', { module.exports = Color; -},{"./Simple":48}],47:[function(require,module,exports){ +},{"./Simple":47}],46:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17492,7 +17508,7 @@ var Date = Simple.extend('Date', { module.exports = Date; -},{"./Simple":48}],48:[function(require,module,exports){ +},{"./Simple":47}],47:[function(require,module,exports){ 'use strict'; var CellEditor = require('./CellEditor.js'); @@ -17544,9 +17560,11 @@ var Simple = CellEditor.extend('Simple', { self.getGrid().fireSyntheticEditorKeyDownEvent(self, e); }); input.addEventListener('keypress', function(e) { - console.log('keypress', e.keyCode); self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17670,7 +17688,7 @@ var Simple = CellEditor.extend('Simple', { module.exports = Simple; -},{"./CellEditor.js":44}],49:[function(require,module,exports){ +},{"./CellEditor.js":43}],48:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17697,7 +17715,7 @@ var Slider = Simple.extend('Slider', { module.exports = Slider; -},{"./Simple":48}],50:[function(require,module,exports){ +},{"./Simple":47}],49:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17724,7 +17742,7 @@ var Spinner = Simple.extend('Spinner', { module.exports = Spinner; -},{"./Simple":48}],51:[function(require,module,exports){ +},{"./Simple":47}],50:[function(require,module,exports){ 'use strict'; var Simple = require('./Simple'); @@ -17778,6 +17796,9 @@ var Textfield = Simple.extend('Textfield', { input.addEventListener('keypress', function(e) { self.getGrid().fireSyntheticEditorKeyPressEvent(self, e); }); + input.onblur = function(e) { + self.cancelEditing(); + }; // input.addEventListener('focusout', function() { // self.stopEditing(); // }); @@ -17797,7 +17818,7 @@ var Textfield = Simple.extend('Textfield', { module.exports = Textfield; -},{"./Simple":48}],52:[function(require,module,exports){ +},{"./Simple":47}],51:[function(require,module,exports){ 'use strict'; module.exports = { @@ -17810,7 +17831,7 @@ module.exports = { Slider: require('./Slider'), Spinner: require('./Spinner') }; -},{"./CellEditor":44,"./Choice":45,"./Color":46,"./Date":47,"./Slider":49,"./Spinner":50,"./Textfield":51}],53:[function(require,module,exports){ +},{"./CellEditor":43,"./Choice":44,"./Color":45,"./Date":46,"./Slider":48,"./Spinner":49,"./Textfield":50}],52:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -17872,7 +17893,7 @@ var DataModel = Base.extend('DataModel', { module.exports = DataModel; -},{"extend-me":3}],54:[function(require,module,exports){ +},{"extend-me":3}],53:[function(require,module,exports){ 'use strict'; var analytics = require('hyper-analytics'); @@ -18606,7 +18627,7 @@ function textMatchFilter(string) { module.exports = JSON; -},{"./DataModel":53,"hyper-analytics":9}],55:[function(require,module,exports){ +},{"./DataModel":52,"hyper-analytics":9}],54:[function(require,module,exports){ /* eslint-env browser */ 'use strict'; @@ -18623,7 +18644,7 @@ window.fin = { Hypergrid: Hypergrid }; -},{"./Hypergrid":34,"./behaviors/index":43,"./cellEditors/index":52,"./features/index":72,"./polyfills":73}],56:[function(require,module,exports){ +},{"./Hypergrid":33,"./behaviors/index":42,"./cellEditors/index":51,"./features/index":71,"./polyfills":72}],55:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18657,7 +18678,7 @@ var CellClick = Feature.extend('CellClick', { module.exports = CellClick; -},{"./Feature.js":64}],57:[function(require,module,exports){ +},{"./Feature.js":63}],56:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -18710,7 +18731,7 @@ var CellEditing = Feature.extend('CellEditing', { module.exports = CellEditing; -},{"./Feature.js":64}],58:[function(require,module,exports){ +},{"./Feature.js":63}],57:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19264,7 +19285,7 @@ var CellSelection = Feature.extend('CellSelection', { module.exports = CellSelection; -},{"./Feature.js":64}],59:[function(require,module,exports){ +},{"./Feature.js":63}],58:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -19297,7 +19318,7 @@ var ColumnAutosizing = Feature.extend('ColumnAutosizing', { module.exports = ColumnAutosizing; -},{"./Feature.js":64}],60:[function(require,module,exports){ +},{"./Feature.js":63}],59:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -19984,7 +20005,7 @@ var ColumnMoving = Feature.extend('ColumnMoving', { module.exports = ColumnMoving; -},{"./Feature.js":64}],61:[function(require,module,exports){ +},{"./Feature.js":63}],60:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20282,7 +20303,7 @@ var ColumnResizing = Feature.extend('ColumnResizing', { module.exports = ColumnResizing; -},{"./Feature.js":64}],62:[function(require,module,exports){ +},{"./Feature.js":63}],61:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20821,7 +20842,7 @@ var ColumnSelection = Feature.extend('ColumnSelection', { module.exports = ColumnSelection; -},{"./Feature.js":64}],63:[function(require,module,exports){ +},{"./Feature.js":63}],62:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -20872,7 +20893,7 @@ var ColumnSorting = Feature.extend('ColumnSorting', { module.exports = ColumnSorting; -},{"./Feature.js":64}],64:[function(require,module,exports){ +},{"./Feature.js":63}],63:[function(require,module,exports){ 'use strict'; var Base = require('extend-me').Base; @@ -21215,7 +21236,7 @@ var Feature = Base.extend('Feature', { module.exports = Feature; -},{"extend-me":3}],65:[function(require,module,exports){ +},{"extend-me":3}],64:[function(require,module,exports){ 'use strict'; @@ -21271,7 +21292,7 @@ var Filters = Feature.extend('Filters', { module.exports = Filters; -},{"./Feature.js":64}],66:[function(require,module,exports){ +},{"./Feature.js":63}],65:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21310,7 +21331,7 @@ var KeyPaging = Feature.extend('KeyPaging', { module.exports = KeyPaging; -},{"./Feature.js":64}],67:[function(require,module,exports){ +},{"./Feature.js":63}],66:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -21347,7 +21368,7 @@ var OnHover = Feature.extend('OnHover', { module.exports = OnHover; -},{"./Feature.js":64}],68:[function(require,module,exports){ +},{"./Feature.js":63}],67:[function(require,module,exports){ /* eslint-env browser */ /* global requestAnimationFrame */ @@ -21544,7 +21565,7 @@ var Overlay = Feature.extend('Overlay', { module.exports = Overlay; -},{"./Feature.js":64}],69:[function(require,module,exports){ +},{"./Feature.js":63}],68:[function(require,module,exports){ 'use strict'; var ColumnResizing = require('./ColumnResizing'); @@ -21720,7 +21741,7 @@ var RowResizing = ColumnResizing.extend('RowResizing', { module.exports = RowResizing; -},{"./ColumnResizing":61}],70:[function(require,module,exports){ +},{"./ColumnResizing":60}],69:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22234,7 +22255,7 @@ var RowSelection = Feature.extend('RowSelection', { module.exports = RowSelection; -},{"./Feature.js":64}],71:[function(require,module,exports){ +},{"./Feature.js":63}],70:[function(require,module,exports){ 'use strict'; var Feature = require('./Feature.js'); @@ -22275,7 +22296,7 @@ var ThumbwheelScrolling = Feature.extend('ThumbwheelScrolling', { module.exports = ThumbwheelScrolling; -},{"./Feature.js":64}],72:[function(require,module,exports){ +},{"./Feature.js":63}],71:[function(require,module,exports){ 'use strict'; module.exports = { @@ -22296,7 +22317,7 @@ module.exports = { RowSelection: require('./RowSelection'), ThumbwheelScrolling: require('./ThumbwheelScrolling') }; -},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(require,module,exports){ +},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(require,module,exports){ // polyfills copied verbatim from developer.mozilla.org /* eslint-disable no-extend-native */ @@ -22327,7 +22348,7 @@ if (!Array.prototype.find) { }; } -},{}],74:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ 'use strict'; var cssInjector = require('css-injector'); @@ -22383,5 +22404,5 @@ function addStylesheet(key, referenceElement) { module.exports = addStylesheet; -},{"css-injector":2}]},{},[55]) -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jyb3dzZXItcGFjay9fcHJlbHVkZS5qcyIsIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL2ltYWdlcy9pbmRleC5qcyIsIi9Vc2Vycy9zdGV2ZS9Qcm9qZWN0L2Rldi9maW4taHlwZXJncmlkL25vZGVfbW9kdWxlcy9jc3MtaW5qZWN0b3IvaW5kZXguanMiLCIvVXNlcnMvc3RldmUvUHJvamVjdC9kZXYvZmluLWh5cGVyZ3JpZC9ub2RlX21vZHVsZXMvZXh0ZW5kLW1lL2luZGV4LmpzIiwiL1VzZXJzL3N0ZXZlL1Byb2plY3QvZGV2L2Zpbi1oeXBlcmdyaWQvbm9kZV9tb2R1bGVzL2ZpbmJhcnMvaW5kZXguanMiLCIvVXNlcnMvc3RldmUvUHJvamVjdC9kZXYvZmluLWh5cGVyZ3JpZC9ub2RlX21v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GlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWxpYXNdLCBhbGlhcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycgJiYgdmFsdWVbMF0gPT09ICcjJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFrZUFsaWFzKHZhbHVlLCBrZXkuc3Vic3RyKDEpKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZVtrZXldID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBDb25zdHJ1Y3RvcjtcblxuICAgIGZ1bmN0aW9uIG1ha2VBbGlhcyh2YWx1ZSwga2V5KSB7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tc2hhZG93XG4gICAgICAgIHByb3RvdHlwZVtrZXldID0gcHJvdG90eXBlQWRkaXRpb25zW3ZhbHVlXTtcbiAgICB9XG59XG5cbmV4dGVuZC5CYXNlID0gZnVuY3Rpb24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qICAgICogVGhlIGNvbnRlbnQgZWxlbWVudChzKVxuICAgICAqICAgICogVGhpcyAqKnNjcm9sbGJhciBlbGVtZW50KiosIHdoaWNoIGluIHR1cm4gY29udGFpbnM6XG4gICAgICogICAgICAgICogVGhlICoqdGh1bWIgZWxlbWVudCoqXG4gICAgICpcbiAgICAgKiBAdHlwZSB7RWxlbWVudH1cbiAgICAgKiBAbWVtYmVyT2YgRmluQmFyLnByb3RvdHlwZVxuICAgICAqL1xuICAgIHZhciBiYXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTtcblxuICAgIGJhci5jbGFzc0xpc3QuYWRkKCdmaW5iYXItdmVydGljYWwnKTtcblxuICAgIGJhci5hcHBlbmRDaGlsZCh0aHVtYik7XG4gICAgaWYgKHRoaXMucGFnaW5nKSB7XG4gICAgICAgIGJhci5vbmNsaWNrID0gYm91bmQub25jbGljaztcbiAgICB9XG4gICAgdGhpcy5iYXIgPSBiYXI7XG5cbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgIC8vIHByZXNldHNcbiAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIEZpbkJhci5wcm90b3R5cGVba2V5XSAhPT0gJ2Z1bmN0aW9uJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAvLyBvdmVycmlkZSBwcm90b3R5cGUgZGVmYXVsdHMgZm9yIHN0YW5kYXJkIDtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXh0ZW5kIHdpdGggYWRkaXRpb25hbCBwcm9wZXJ0aWVzIChmb3IgdXNlIGluIG9uY2hhbmdlIGV2ZW50IGhhbmRsZXJzKVxuICAgICAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBvcHRpb247XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjc3NJbmplY3Rvcihjc3NGaW5CYXJzLCAnZmluYmFyLWJhc2UnLCBvcHRpb25zLmNzc1N0eWxlc2hlZXRSZWZlcmVuY2VFbGVtZW50KTtcbn1cblxuRmluQmFyLnByb3RvdHlwZSA9IHtcblxuICAgIC8qKlxuICAgICAqIEBzdW1tYXJ5IFRoZSBzY3JvbGxiYXIgb3JpZW50YXRpb24uXG4gICAgICogQGRlc2MgU2V0IGJ5IHRoZSBjb25zdHJ1Y3RvciB0byBlaX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VhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gYmFyIHNpemUgZ2l2ZW4gYXMgcGVyY2VudGFnZSBvZiBjb250YWluZXIsIGlmIGJhciBoYXMgbWFyZ2lucywgcmVzdGF0ZSBzaXplIGluIHBpeGVscyBsZXNzIG1hcmdpbnMuXG4gICAgICAgICAgICAgICAgICAgIC8vIChJZiBsZWZ0IGFzIHBlcmNlbnRhZ2UsIENTUydzIGNhbGN1bGF0aW9uIHdpbGwgbm90IGV4Y2x1ZGUgbWFyZ2lucy4pXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcmllbnRlZCA9IGF4aXNba2V5XSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbnMgPSBiYXJSZWN0W29yaWVudGVkLm1hcmdpbkxlYWRpbmddICsgYmFyUmVjdFtvcmllbnRlZC5tYXJnaW5UcmFpbGluZ107XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXJnaW5zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSBwYXJzZUludCh2YWwsIDEwKSAvIDEwMCAqIGNvbnRhaW5lclJlY3Rbb3JpZW50ZWQuc2l6ZV0gLSBtYXJnaW5zICsgJ3B4JztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGJh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FsIGNvbnRlbnQ6IENvbnRlbnQgd2FzIGdpdmVuIGJ1dCBubyBvbmNoYW5nZSBoYW5kbGVyLlxuICAgICAgICAvLyBTZXQgdXAgLm9uY2hhbmdlLCAuY29udGFpbmVyU2l6ZSwgYW5kIC5pbmNyZW1lbnQuXG4gICAgICAgIC8vIE5vdGUgdGhpcyBvbmx5IG1ha2VzIHNlbnNlIGlmIHlvdXIgaW5kZXggdW5pdCBpcyBwaXhlbHMuXG4gICAgICAgIGlmICh0aGlzLmNvbnRlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5vbmNoYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMub25jaGFuZ2UgPSB0aGlzLnNjcm9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9uY2hhbmdlID09PSB0aGlzLnNjcm9sbFJlYWxDb250ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lclNpemUgPSBjb250YWluZXJSZWN0W3RoaXMub2guc2l6ZV07XG4gICAgICAgICAgICB0aGlzLmluY3JlbWVudCA9IHRoaXMuY29udGFpbmVyU2l6ZSAvICh0aGlzLmNvbnRlbnRTaXplIC0gdGhpcy5jb250YWluZXJTaXplKSAqICh0aGlzLl9tYXggLSB0aGlzLl9taW4pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5jb250YWluZXJTaXplID0gMTtcbiAgICAgICAgICAgIHRoaXMuaW5jcmVtZW50ID0gaW5jcmVtZW50IHx8IHRoaXMuaW5jcmVtZW50O1xuICAgICAgICB9XG5cbiAgICAgICAgd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BlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX2JvdW5kLm9ubW91c2VvdXQoZXZ0KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV2dC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgfVxufTtcblxudmFyIG9yaWVudGF0aW9uSGFzaGVzID0ge1xuICAgIHZlcnRpY2FsOiB7XG4gICAgICAgIGNvb3JkaW5hdGU6ICAgICAnY2xpZW50WScsXG4gICAgICAgIGF4aXM6ICAgICAgICAgICAncGFnZVknLFxuICAgICAgICBzaXplOiAgICAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgIG91dHNpZGU6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6ICAgICAgICAgICAnd2lkdGgnLFxuICAgICAgICBvdXRzaWRlOiAgICAgICAgJ2JvdHRvbScsXG4gICAgICAgIGluc2lkZTogICAgICAgICAndG9wJyxcbiAgICAgICAgbGVhZGluZzogICAgICAgICdsZWZ0JyxcbiAgICAgICAgdHJhaWxpbmc6ICAgICAgICdyaWdodCcsXG4gICAgICAgIG1hcmdpbkxlYWRpbmc6ICAnbWFyZ2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hhck1hcDtcbiAgICB9LFxuXG4gICAgZmlua2V5ZG93bjogZnVuY3Rpb24oZSkge1xuICAgICAgICBpZiAoIXRoaXMuaGFzRm9jdXMoKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgLy9lLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgaWYgKGUucmVwZWF0KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5yZXBlYXRLZXkgPT09IGtleUNoYXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5zcGxpY2UodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpLCAxKTtcbiAgICAgICAgaWYgKCF0aGlzLmhhc0ZvY3VzKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgdGhpcy5yZXBlYXRLZXkgPSBudWxsO1xuICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IDA7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1rZXl1cCcsIHtcbiAgICAgICAgICAgIGFsdDogZS5hbHRLZXksXG4gICAgICAgICAgICBjdHJsOiBlLmN0cmxLZXksXG4gICAgICAgICAgICBjaGFyOiBrZXlDaGFyLFxuICAgICAgICAgICAgY29kZTogZS5jaGFyQ29kZSxcbiAgICAgICAgICAgIGtleTogZS5rZXlDb2RlLFxuICAgICAgICAgICAgbWV0YTogZS5tZXRhS2V5LFxuICAgICAgICAgICAgcmVwZWF0OiBlLnJlcGVhdCxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmZvY3VzZ2FpbmVkOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1mb2N1cy1nYWluZWQnKTtcbiAgICB9LFxuXG4gICAgZmluZm9jdXNsb3N0OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdFdmVudChlLCAnZmluLWNhbnZhcy1mb2N1cy1sb3N0Jyk7XG4gICAgfSxcblxuICAgIGZpbmNvbnRleHRtZW51OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIGlmIChlLmN0cmxLZXkgJiYgdGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKCdDVFJMJykgPT09IC0xKSB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRLZXlzLnB1c2goJ0NUUkwnKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoRGF0ZS5ub3coKSAtIHRoaXMubGFzdENsaWNrVGltZSA8IDI1MCkge1xuICAgICAgICAgICAgLy90aGlzIGlzIGEgZG91YmxlIGNsaWNrLi4uXG4gICAgICAgICAgICB0aGlzLmZpbmRibGNsaWNrKGUpO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICA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xuICAgIHRoaXMuZ2MgPSBnYztcblxuICAgIHZhciBzZWxmID0gdGhpcztcbiAgICB2YXIgcmVXRUJLSVQgPSAvXndlYmtpdC87XG5cbiAgICBzd2l0Y2ggKHR5cGVvZiBsb2dnZXIpIHtcblxuICAgICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICAgICAgbG9nZ2VyID0gIGNvbnNvbGVMb2dnZXIuYmluZCh1bmRlZmluZWQsIGxvZ2dlciArICcuJyk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgICAgIGlmIChsb2dnZXIgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIgPSBjb25zb2xlTG9nZ2VyLmJpbmQodW5kZWZpbmVkLCAnZ2MuJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdmdW5jdGlvbic6XG4gICAgICAgICAgICBpZiAobG9nZ2VyLmxlbmd0aCAhPT0gMykge1xuICAgICAgICAgICAgICAgIHRocm93ICdHcmFwaGljc0NvbnRleHQ6IFVzZXItc3VwcGxpZWQgQVBJIGxvZ2dlciBmdW5jdGlvbiBkb2VzIG5vdCBhY2NlcHQgdGhyZWUgcGFyYW1ldGVycy4nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGxvZ2dlciA9IGZhbHNlO1xuICAgIH1cblxuICAgIC8vIFN0dWIgb3V0IGFsbCB0aGUgcHJvdG90eXBlIG1lbWJlcnMgb2YgdGhlIGNhbnZhcyAyRCBncmFwaGljcyBjb250ZXh0OlxuICAgIE9iamVjdC5rZXlzKE9iamVjdC5nZXRQcm90b3R5cGVPZihnYykpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgLy8gU29tZSBvbGRlciBicm93c2VycyAoZS5nLiwgQ2hyb21lIDQwKSBkaWQgbm90IGhhdmUgYWxsIG1lbWJlcnMgb2YgY2FudmFzXG4gICAgLy8gMkQgZ3JhcGhpY3MgY29udGV4dCBpbiB0aGUgcHJvdG90eXBlIHNvIHdlIG1ha2UgdGhpcyBhZGRpdGlvbmFsIGNhbGw6XG4gICAgT2JqZWN0LmtleXMoZ2MpLmZvckVhY2goTWFrZVN0dWIpO1xuXG4gICAgZnVuY3Rpb24gTWFrZVN0dWIoa2V5KSB7XG4gICAgICAgIGlmIChrZXkgaW4gR3JhcGhpY3NDb250ZXh0LnByb3RvdHlwZSB8fCByZVdFQktJVC50ZXN0KGtleSkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIGdjW2tleV0gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHNlbGZba2V5XSA9ICFsb2dnZXIgPyBnY1trZXldLmJpbmQoZ2MpIDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvZ2dlcihrZXksIGFyZ3VtZW50cywgZ2Nba2V5XS5hcHBseShnYywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ2VyKGtleSwgJ2dldHRlcicsIHJlc3VsdCkgOiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGdjW2tleV0gPSBsb2dnZXIgPyBsb2dnZXIoa2V5LCAnc2V0dGVyJywgdmFsdWUpIDogdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gR3JhcGhpY3NDb250ZXh0O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgWUlFTERTID0gJ1xcdTI3RjknOyAvLyBMT05HIFJJR0hUV0FSRFMgRE9VQkxFIEFSUk9XXG5cbmZ1bmN0aW9uIGNvbnNvbGVMb2dnZXIocHJlZml4LCBuYW1lLCBhcmdzLCB2YWx1ZSkge1xuICAgIHZhciByZXN1bHQgPSB2YWx1ZTtcblxuICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgIHJlc3VsdCA9ICdcIicgKyByZXN1bHQgKyAnXCInO1xuICAgIH1cblxuICAgIG5hbWUgPSBwcmVmaXggKyBuYW1lO1xuXG4gICAgc3dpdGNoIChhcmdzKSB7XG4gICAgICAgIGNhc2UgJ2dldHRlcic6XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhuYW1lLCAnPScsIHJlc3VsdCk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdzZXR0ZXInOlxuICAgICAgICAgICAgY29uc29sZS5sb2cobmFtZSwgWUlFTERTLCByZXN1bHQpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDogLy8gbWV0aG9kIGNhbGxcbiAgICAgICAgICAgIG5hbWUgKz0gJygnICsgQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJncykuam9pbignLCAnKSArICcpJztcbiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKG5hbWUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhuYW1lLCBZSUVMRFMsIHJlc3VsdCk7XG4gICAgICAgICAgICB9XG4gIC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bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIGlmIChpbkVsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluRWwuc2hhZG93Um9vdCB8fCBpbkVsLndlYmtpdFNoYWRvd1Jvb3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGNhblRhcmdldDogZnVuY3Rpb24oc2hhZG93KSB7XG4gICAgICAgICAgICByZXR1cm4gc2hhZG93ICYmIEJvb2xlYW4oc2hhZG93LmVsZW1lbnRGcm9tUG9pbnQpO1xuICAgICAgICB9LFxuICAgICAgICB0YXJnZXRpbmdTaGFkb3c6IGZ1bmN0aW9uKGluRWwpIHtcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5zaGFkb3coaW5FbCk7XG4gICAgICAgICAgICBpZiAodGhpcy5jYW5UYXJnZXQocykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgb2xkZXJTaGFkb3c6IGZ1bmN0aW9uKHNoYWRvdykge1xuICAgICAgICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc2NvcGUudGFyZ2V0RmluZGluZyA9IHRhcmdldDtcbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBldmVudCwgZmluZHMgdGhlIFwiZGVlcGVzdFwiIG5vZGUgdGhhdCBjb3VsZCBoYXZlIGJlZW4gdGhlIG9yaWdpbmFsIHRhcmdldCBiZWZvcmUgU2hhZG93RE9NIHJld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WVzIGZyb20gYGluRGljdGAuXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuXG4gICAgdmFyIE1PVVNFX1BST1BTID0gW1xuICAgICAgICAnYnViYmxlcycsXG4gICAgICAgICdjYW5jZWxhYmxlJyxcbiAgICAgICAgJ3ZpZXcnLFxuICAgICAgICAnZGV0YWlsJyxcbiAgICAgICAgJ3NjcmVlblgnLFxuICAgICAgICAnc2NyZWVuWScsXG4gICAgICAgICdjbGllbnRYJyxcbiAgICAgICAgJ2NsaWVudFknLFxuICAgICAgICAnY3RybEtleScsXG4gICAgICAgICdhbHRLZXknLFxuICAgICAgICAnc2hpZnRLZXknLFxuICAgICAgICAnbWV0YUtleScsXG4gICAgICAgICdidXR0b24nLFxuICAgICAgICAncmVsYXRlZFRhcmdldCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWSdcbiAgICBdO1xuXG4gICAgdmFyIE1PVVNFX0RFRkFVTFRTID0gW1xuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIG51bGwsXG4gICAgICAgIG51bGwsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIDAsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICAwLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwXG4gICAgXTtcblxuICAgIHZhciBOT1BfRkFDVE9SWSA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7fTtcbiAgICB9O1xuXG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHtcbiAgICAgICAgLy8gVE9ETyhkZnJlZWRtKTogdGhpcyBpcyBvdmVycmlkZGVuIGJ5IHRhcCByZWNvZ25pemVyLCBuZWVkcyByZXZpZXdcbiAgICAgICAgcHJldmVudFRhcDogTk9QX0ZBQ1RPUlksXG4gICAgICAgIG1ha2VCYXNlRXZlbnQ6IGZ1bmN0aW9uKGluVHlwZSwgaW5EaWN0KSB7XG4gICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdFdmVudCcpO1xuICAgICAgICAgICAgZS5pbml0RXZlbnQoaW5UeXBlLCBpbkRpY3QuYnViYmxlcyB8fCBmYWxzZSwgaW5EaWN0LmNhbmNlbGFibGUgfHwgZmFsc2UpO1xuICAgICAgICAgICAgZS5wcmV2ZW50VGFwID0gZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAoZSk7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZUdlc3R1cmVFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgfHwgJyc7XG4gICAgICAgICAgICBlLmh3VGltZXN0YW1wID0gaW5EaWN0Lmh3VGltZXN0YW1wIHx8IDA7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IGluRGljdC5pc1ByaW1hcnkgfHwgZmFsc2U7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSBpbkRpY3QuX3NvdXJjZSB8fCAnJztcbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHNjb3BlLmV2ZW50RmFjdG9yeSA9IGV2ZW50RmFjdG9yeTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgbW9kdWxlIGltcGxlbWVudHMgYW4gbWFwIG9mIHBvaW50ZXIgc3RhdGVzXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBVU0VfTUFQID0gd2luZG93Lk1hcCAmJiB3aW5kb3cuTWFwLnByb3RvdHlwZS5mb3JFYWNoO1xuICAgIHZhciBQT0lOVEVSU19GTiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5zaXplO1xuICAgIH07XG5cbiAgICBmdW5jdGlvbiBQb2ludGVyTWFwKCkge1xuICAgICAgICBpZiAoVVNFX01BUCkge1xuICAgICAgICAgICAgdmFyIG0gPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICBtLnBvaW50ZXJzID0gUE9JTlRFUlNfRk47XG4gICAgICAgICAgICByZXR1cm4gbTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMua2V5cyA9IFtdO1xuICAgICAgICAgICAgdGhpcy52YWx1ZXMgPSBbXTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFBvaW50ZXJNYXAucHJvdG90eXBlID0ge1xuICAgICAgICBzZXQ6IGZ1bmN0aW9uKGluSWQsIGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBpID0gdGhpcy5rZXlzLmluZGV4T2YoaW5JZCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEFTX1NWR19JTlNUQU5DRSA9ICh0eXBlb2YgU1ZHRWxlbWVudEluc3RhbmNlICE9PSAndW5kZWZpbmVkJyk7XG5cbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuXG4gICAgLy8gc2V0IG9mIHJlY29nbml6ZXJzIHRvIHJ1biBmb3IgdGhlIGN1cnJlbnRseSBoYW5kbGVkIGV2ZW50XG4gICAgdmFyIGN1cnJlbnRHZXN0dXJlcztcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbW9kdWxlIGlzIGZvciBub3JtYWxpemluZyBldmVudHMuIE1vdXNlIGFuZCBUb3VjaCBldmVudHMgd2lsbCBiZVxuICAgICAqIGNvbGxlY3RlZCBoZXJlLCBhbmQgZmlyZSBQb2ludGVyRXZlbnRzIHRoYXQgaGF2ZSB0aGUgc2FtZSBzZW1hbnRpY3MsIG5vXG4gICAgICogbWF0dGVyIHRoZSBzb3VyY2UuXG4gICAgICogRXZlbnRzIGZpcmVkOlxuICAgICAqICAgLSBwb2ludGVyZG93bjogYSBwb2ludGluZyBpcyBhZGRlZFxuICAgICAqICAgLSBwb2ludGVydXA6IGEgcG9pbnRlciBpcyByZW1vdmVkXG4gICAgICogICAtIHBvaW50ZXJtb3ZlOiBhIHBvaW50ZXIga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sXG4gICAgICAgICAgICB1cDoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVF1ZXVlOiBbXSxcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEFkZCBhIG5ldyBldmVudCBzb3VyY2UgdGhhdCB3aWxsIGdlbmVyYXRlIHBvaW50ZXIgZXZlbnRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBgaW5Tb3VyY2VgIG11c3QgY29udGFpbiBhbiBhcnJheSBvZiBldmVudCBuYW1lcyBuYW1lZCBgZXZlbnRzYCwgYW5kXG4gICAgICAgICAqIGZ1bmN0aW9ucyB3aXRoIHRoZSBuYW1lcyBzcGVjaWZpZWQgaW4gdGhlIGBldmVudHNgIGFycmF5LlxuICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSBBIG5hbWUgZm9yIHRoZSBldmVudCBzb3VyY2VcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBBIG5ldyBzb3VyY2Ugb2YgcGxhdGZvcm0gZXZlbnRzLlxuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJTb3VyY2U6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIHMgPSBzb3VyY2U7XG4gICAgICAgICAgICB2YXIgbmV3RXZlbnRzID0gcy5ldmVudHM7XG4gICAgICAgICAgICBpZiAobmV3RXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIGVsZW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBFVkVOVFNcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLnNldChpbkV2ZW50LnBvaW50ZXJJZCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCdkb3duJywgaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIG1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIHBpcGUgbW92ZSBldmVudHMgaW50byBnZXN0dXJlIHF1ZXVlIGRpcmVjdGx5XG4gICAgICAgICAgICBpbkV2ZW50LnR5cGUgPSAnbW92ZSc7XG4gICAgICAgICAgICB0aGlzLmZpbGxHZXN0dXJlUXVldWUoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB0aGlzLmZpcmVFdmVudCgndXAnLCBpbkV2ZW50KTtcbiAgICAgICAgICAgIHRoaXMucmVxdWlyZWRHZXN0dXJlcy5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGluRXZlbnQudGFwUHJldmVudGVkID0gdHJ1ZTtcbiAgICAgICAgICAgIHRoaXMuZmlyZUV2ZW50KCd1cCcsIGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEdlc3R1cmVEZXBlbmRlbmN5OiBmdW5jdGlvbihub2RlLCBjdXJyZW50R2VzdHVyZXMpIHtcbiAgICAgICAgICAgIHZhciBnZXN0dXJlc1dhbnRlZCA9IG5vZGUuX3BnRXZlbnRzO1xuICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkICYmIGN1cnJlbnRHZXN0dXJlcykge1xuICAgICAgICAgICAgICAgIHZhciBnayA9IE9iamVjdC5rZXlzKGdlc3R1cmVzV2FudGVkKTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciwgcmksIGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgIC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fSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdmUgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIHVubGlzdGVuOiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50cykge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBldmVudHMubGVuZ3RoLCBlO1xuICAgICAgICAgICAgICAgIChpIDwgbCkgJiYgKGUgPSBldmVudHNbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAg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y5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBDTE9ORV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBldmVudENvcHlbcF0gPSBpbkV2ZW50W3BdIHx8IENMT05FX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgICAgIC8vIFdvcmsgYXJvdW5kIFNWR0luc3RhbmNlRWxlbWVudCBzaGFkb3cgdHJlZVxuICAgICAgICAgICAgICAgIC8vIFJldHVybiB0aGUgPHVzZT4gZWxlbWVudCB0aGF0IGlzIHJlcHJlc2VudGVkIGJ5IHRoZSBpbnN0YW5jZSBmb3IgU2FmYXJpLCBDaHJvbWUsIElFLlxuICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAgICAgIH0sXG4gICAgIC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AgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLmNhbGwoZywgZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoID0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgZmlsbEdlc3R1cmVRdWV1ZTogZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgICAgIC8vIG9ubHkgdHJpZ2dlciB0aGUgZ2VzdHVyZSBxdWV1ZSBvbmNlXG4gICAgICAgICAgICBpZiAoIXRoaXMuZ2VzdHVyZVF1ZXVlLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZSh0a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GlzcGF0Y2hlci5kZXBlbmRlbmN5TWFwW2ddO1xuICAgICAgICBpZiAoZGVwKSB7XG4gICAgICAgICAgICB2YXIgcmVjb2duaXplciA9IGRpc3BhdGNoZXIuZ2VzdHVyZXNbZGVwLmluZGV4XTtcbiAgICAgICAgICAgIGlmICghbm9kZS5fcGdMaXN0ZW5lcnMpIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnJlZ2lzdGVyKG5vZGUpO1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFRPRE8oZGZyZWVkbSk6IHJlLWV2YWx1YXRlIGJvb2trZWVwaW5nIHRvIGF2b2lkIHVzaW5nIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgIGlmIChyZWNvZ25pemVyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gcmVjb2duaXplci5kZWZhdWx0QWN0aW9ucyAmJiByZWNvZ25pemVyLmRlZmF1bHRBY3Rpb25zW2ddO1xuICAgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW50cykge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzID0ge307XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBub2RlLl9wZ0V2ZW50c1tnXSA9IChub2RlLl9wZ0V2ZW50c1tnXSB8fCAwKSArIDE7XG4gICAgICAgICAgICBub2RlLl9wZ0xpc3RlbmVycysrO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBCb29sZWFuKGRlcCk7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogTGlzdGVuIGZvciBgZ2VzdHVyZWAgZnJvbSBgbm9kZWAgd2l0aCBgaGFuZGxlcmAgZnVuY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge0VsZW1lbnR9IG5vZGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gZ2VzdHVyZVxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGhhbmRsZXJcbiAgICAgKiBAcGFyYW0ge0Jvb2xlYW59IGNhcHR1cmVcbiAgICAgKi9cbiAgICBzY29wZS5hZGRFdmVudExpc3RlbmVyID0gZnVuY3Rpb24obm9kZSwgZ2VzdHVyZSwgaGFuZGxlciwgY2FwdHVyZSkge1xuICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgc2NvcGUuYWN0aXZh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PSU5URVJfSUQ6IDEsXG4gICAgICAgIFBPSU5URVJfVFlQRTogJ21vdXNlJyxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnbW91c2Vkb3duJyxcbiAgICAgICAgICAgICdtb3VzZW1vdmUnLFxuICAgICAgICAgICAgJ21vdXNldXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgbGFzdFRvdWNoZXM6IFtdLFxuICAgICAgICAvLyBjb2xsaWRlIHdpdGggdGhlIGdsb2JhbCBtb3VzZSBsaXN0ZW5lclxuICAgICAgICBpc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbHRzID0gdGhpcy5sYXN0VG91Y2hlcztcbiAgICAgICAgICAgIHZhciB4ID0gaW5FdmVudC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGx0cy5sZW5ndGgsIHQ7IGkgPCBsICYmICh0ID0gbHRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgLy8gc2ltdWxhdGVkIG1vdXNlIGV2ZW50cyB3aWxsIGJlIHN3YWxsb3dlZCBuZWFyIGEgcHJpbWFyeSB0b3VjaGVuZFxuICAgICAgICAgICAgICAgIHZhciBkeCA9IE1hdGguYWJzKHggLSB0LngpLFxuICAgICAgICAgICAgICAgICAgICBkeSA9IE1hdGguYWJzKHkgLSB0LnkpO1xuICAgICAgICAgICAgICAgIGlmIChkeCA8PSBERURVUF9ESVNUICYmIGR5IDw9IERFRFVQX0RJU1QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KHRoaXMuUE9JTlRFUl9JRCk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICA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1VDSF9BQ1RJT04gPSBBVFRSSUIgaW4gZG9jdW1lbnQuaGVhZC5zdHlsZTtcbiAgICB2YXIgSEFTX1RPVUNIX0FDVElPTiA9IGZhbHNlO1xuXG4gICAgLy8gaGFuZGxlciBibG9jayBmb3IgbmF0aXZlIHRvdWNoIGV2ZW50c1xuICAgIHZhciB0b3VjaEV2ZW50cyA9IHtcbiAgICAgICAgSVNfSU9TOiBmYWxzZSxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAndG91Y2hzdGFydCcsXG4gICAgICAgICAgICAndG91Y2htb3ZlJyxcbiAgICAgICAgICAgICd0b3VjaGVuZCcsXG4gICAgICAgICAgICAndG91Y2hjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TID8gaW5pdGlhbCA6ICFpbml0aWFsKSB7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLklTX0lPUykge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB2YXIgY3RlID0gdGhpcy5jdXJyZW50VG91Y2hFdmVudDtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluVG91Y2gpO1xuICAgICAgICAgICAgLy8gU3BlYyBzcGVjaWZpZXMgdGhhdCBwb2ludGVySWQgMSBpcyByZXNlcnZlZCBmb3IgTW91c2UuXG4gICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBjYW4gc3RhcnQgYXQgMC5cbiAgICAgICAgICAgIC8vIEFkZCAyIHRvIHRoZSB0b3VjaCBpZGVudGlmaWVyIGZvciBjb21wYXRpYmlsaXR5LlxuICAgICAgICAgICAgdmFyIGlkID0gZS5wb2ludGVySWQgPSBpblRvdWNoLmlkZW50aWZpZXIgKyAyO1xuICAgICAgICAgICAgZS50YXJnZXQgPSB0aGlzLmZpbmRUYXJnZXQoaW5Ub3VjaCwgaWQpO1xuICAgICAgICAgICAgZS5idWJibGVzID0gdHJ1ZTtcbiAgICAgICAgICAgIGUuY2FuY2VsYWJsZSA9IHRydWU7XG4gICAgICAgICAgICBlLmRldGFpbCA9IHRoaXMuY2xpY2tDb3VudDtcbiAgICAgICAgICAgIGUuYnV0dG9ucyA9IHRoaXMudHlwZVRvQnV0dG9ucyhjdGUudHlwZSk7XG4gICAgICAgIC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iAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gRm9yIHNpbmdsZSBheGlzIHNjcm9sbGVycywgZGV0ZXJtaW5lcyB3aGV0aGVyIHRoZSBlbGVtZW50IHNob3VsZCBlbWl0XG4gICAgICAgIC8vIHBvaW50ZXIgZXZlbnRzIG9yIGJlaGF2ZSBhcyBhIHNjcm9sbGVyXG4gICAgICAgIHNob3VsZFNjcm9sbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQ7XG4gICAgICAgICAgICAgICAgdmFyIHRvdWNoQWN0aW9uID0gc2NvcGUudGFyZ2V0RmluZGluZy5maW5kVG91Y2hBY3Rpb24oaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgdmFyIHNjcm9sbEF4aXMgPSB0aGlzLnRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlKHRvdWNoQWN0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsQXhpcyA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRoaXMgZWxlbWVudCBpcyBhIHRvdWNoLWFjdGlvbjogbm9uZSwgc2hvdWxkIG5ldmVyIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICByZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNjcm9sbEF4aXMgPT09ICdYWScpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBlbGVtZW50IHNob3VsZCBhbHdheXMgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayB0aGUgaW50ZW5kZWQgc2Nyb2xsIGF4aXMsIGFuZCBvdGhlciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvLyBtYWtpbmcgZXZl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KCkgc2hvdWxkIGJlIDwgdGwubGVuZ3RoIGhlcmUsIGFzIHRoZSB0b3VjaHN0YXJ0IGhhcyBub3RcbiAgICAgICAgICAgIC8vIGJlZW4gcHJvY2Vzc2VkIHlldC5cbiAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPj0gdGwubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdmFyIGQgPSBbXTtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIGtleSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOZXZlciByZW1vdmUgcG9pbnRlcklkID09IDEsIHdoaWNoIGlzIG1vdXNlLlxuICAgICAgICAgICAgICAgICAgICAvLyBUb3VjaCBpZGVudGlmaWVycyBhcmUgMiBzbWFsbGVyIHRoYW4gdGhlaXIgcG9pbnRlcklkLCB3aGljaCBpcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXggaW4gcG9pbnRlcm1hcC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5Qb2ludGVyKSB7XG4gICAgICAgICAgICBpblBvaW50ZXIucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5Qb2ludGVyKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIudXAoaW5Qb2ludGVyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoY2FuY2VsOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpbkV2ZW50Ll9jYW5jZWwgPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLmNhbmNlbCk7XG4gICAgICAgIH0sXG4gICAgICAgIGNsZWFuVXBQb2ludGVyOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGluUG9pbnRlci5wb2ludGVySWQpO1xuICAgICAgICAgICAgdGhpcy5yZW1vdmVQcmltYXJ5UG9pbnRlcihpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICAvLyBwcmV2ZW50IHN5bnRoIG1vdXNlIGV2ZW50cyBmcm9tIGNyZWF0aW5nIHBvaW50ZXIgZXZlbnRzXG4gICAgICAgIGRlZHVwU3ludGhNb3VzZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGx0cyA9IHNjb3BlLm1vdXNlRXZlbnRzLmxhc3RUb3VjaGVzO1xuICAgICAgICAgICAgdmFyIHQgPSBpbkV2ZW50LmNoYW5nZWRUb3VjaGVzWzBdO1xuICAgICAgICAgICAgLy8gb25seSB0aGUgcHJpbWFyeSBmaW5nZXIgd2lsbCBzeW50aCBtb3VzZSBldmVudHNcbiAgICAgICAgICAgIGlmICh0aGlzLmlzUHJpbWFyeVRvdWNoKHQpKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVtZW1iZXIgeC95IG9mIGxhc3QgdG91Y2hcbiAgICAgICAgICAgICAgICB2YXIgbHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIHg6IHQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogdC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KS5iaW5kKG51bGwsIGx0cywgbHQpO1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZm4sIERFRFVQX1RJTUVPVVQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHByZXZlbnQgXCJnaG9zdCBjbGlja3NcIiB0aGF0IGNv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IGV2ZW50LFxuICAgICAgICAvLyB0aGVuIHRoZSB0b3VjaHN0YXJ0IHRhcmdldCB3YXMgcHJvYmFibHkgcmVtb3ZlZCwgYW5kIHRoZSBjbGljayBzaG91bGQgYmUgXCJidXN0ZWRcIlxuICAgICAgICB2YXIgcGF0aCA9IHNjb3BlLnRhcmdldEZpbmRpbmcucGF0aChldik7XG4gICAgICAgIGlmICh3YXNUb3VjaGVkKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBhdGgubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAocGF0aFtpXSA9PT0gdG91Y2hFdmVudHMuZmlyc3RUYXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGV2LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICBTVE9QX1BST1BfRk4uY2FsbChldik7XG4gICAgICAgIH1cbiAgICB9LCB0cnVlKTtcblxuICAgIHNjb3BlLnRvdWNoRXZlbnRzID0gdG91Y2hFdmVudHM7XG59KShleHBvcnRzKTtcblxuKGZ1bmN0aW9uKHNjb3BlKSB7XG4gICAgdmFyIGRpc3BhdGNoZXIgPSBzY29wZS5kaXNwYXRjaGVyO1xuICAgIHZhciBwb2ludGVybWFwID0gZGlzcGF0Y2hlci5wb2ludGVybWFwO1xuICAgIHZhciBIQVNfQklUTUFQX1RZUEUgPSB3aW5kb3cuTVNQb2ludGVyRXZlbnQgJiYgdHlwZW9mIHdpbmRvdy5NU1BvaW50ZXJFdmVudC5NU1BPSU5URVJfVFlQRV9NT1VTRSA9PT0gJ251bWJlcic7XG4gICAgdmFyIG1zRXZlbnRzID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdNU1BvaW50ZXJEb3duJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJNb3ZlJyxcbiAgICAgICAgICAgICdNU1BvaW50ZXJVcCcsXG4gICAgICAgICAgICAnTVNQb2ludGVyQ2FuY2VsJyxcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgUE9JTlRFUl9UWVBFUzogW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAndW5hdmFpbGFibGUnLFxuICAgICAgICAgICAgJ3RvdWNoJyxcbiAgICAgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlckNhbmNlbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGUucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGUpO1xuICAgICAgICAgICAgdGhpcy5jbGVhbnVwKGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tc0V2ZW50cyA9IG1zRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IGRpc3BhdGNoZXIucG9pbnRlcm1hcDtcbiAgICB2YXIgcG9pbnRlckV2ZW50cyA9IHtcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAncG9pbnRlcmRvd24nLFxuICAgICAgICAgICAgJ3BvaW50ZXJtb3ZlJyxcbiAgICAgICAgICAgICdwb2ludGVydXAnLFxuICAgICAgICAgICAgJ3BvaW50ZXJjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIHByZXBhcmVFdmVudDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAncG9pbnRlcic7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcmRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGUudGFyZ2V0ID0gdGFyZ2V0O1xuICAgICAgICA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gICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAgICAgICAgICBnZXN0dX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ICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNreScsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBpbkV2ZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAocCkge1xuICAgICAgICAgICAgICAgIGlmIChwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja2VuZCcsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIGRpc3BhdGNoZXIucmVnaXN0ZXJHZXN0dXJlKCd0cmFjaycsIHRyYWNrKTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgZXZlbnQgaXMgZmlyZWQgd2hlbiBhIHBvaW50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zZVxuICovXG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuICAgIHZhciBob2xkID0ge1xuICAgICAgICAvLyB3YWl0IGF0IGxlYXN0IEhPTERfREVMQVkgbXMgYmV0d2VlbiBob2xkIGFuZCBwdWxzZSBldmVudHNcbiAgICAgICAgSE9MRF9ERUxBWTogMjAwLFxuICAgICAgICAvLyBwb2ludGVyIGNhbiBtb3ZlIFdJR0dMRV9USFJFU0hPTEQgcGl4ZWxzIGJlZm9yZSBub3QgY291bnRpbmcgYXMgYSBob2xkXG4gICAgICAgIFdJR0dMRV9USFJFU0hPTEQ6IDE2LFxuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdob2xkJyxcbiAgICAgICAgICAgICdob2xkcHVsc2UnLFxuICAgICAgICAgICAgJ3JlbGVhc2UnXG4gICAgICAgIF0sXG4gICAgICAgIGhlbGRQb2ludGVyOiBudWxsLFxuICAgICAgICBob2xkSm9iOiBudWxsLFxuICAgICAgICBwdWxzZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaG9sZCA9IERhdGUubm93KCkgLSB0aGlzLmhlbGRQb2ludGVyLnRpbWVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IHRoaXMuaGVsZFBvaW50ZXIucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgcG9pbnRlcklkOiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCxcbiAgICAgICAgICAgICAgICB4OiB0aGlzLmhlbGRQb2ludGVyLmNsaWVudFgsXG4gICAgICAgICAgICAgICAgeTogdGhpcy5oZWxkUG9pbnRlci5jbGllbnRZLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICdob2xkJ1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICAgICAgcC5ob2xkVGltZSA9IGluSG9sZFRpbWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KGluVHlwZSwg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GNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRhcCA9IHtcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnZG93bicsXG4gICAgICAgICAgICAndXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0YXAnXG4gICAgICAgIF0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAhaW5FdmVudC50YXBQcmV2ZW50ZWQpIHtcbiAgICAgICAgICAgICAgICBwb2ludGVybWFwLnNldChpbkV2ZW50LnBvaW50ZXJJZCwge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGluRXZlbnQudGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICBidXR0b25zOiBpbkV2ZW50LmJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZ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29wZS5ldmVudEZhY3Rvcnk7XG4gICAgdmFyIHBvaW50ZXJtYXAgPSBuZXcgc2NvcGUuUG9pbnRlck1hcCgpO1xuICAgIHZhciBSQURfVE9fREVHID0gMTgwIC8gTWF0aC5QSTtcbiAgICB2YXIgcGluY2ggPSB7XG4gICAgICAgIGV2ZW50czogW1xuICAgICAgICAgICAgJ2Rvd24nLFxuICAgICAgICAgICAgJ3VwJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICdjYW5jZWwnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdwaW5jaHN0YXJ0JyxcbiAgICAgICAgICAgICdwaW5jaCcsXG4gICAgICAgICAgICAncGluY2hlbmQnLFxuICAgICAgICAgICAgJ3JvdGF0ZSdcbiAgICAgICAgXSxcbiAgICAgICAgZGVmYXVsdEFjdGlvbnM6IHtcbiAgICAgICAgICAgICdwaW5jaCc6ICdub25lJyxcbiAgICAgICAgICAgICdyb3RhdGUnOiAnbm9uZSdcbiAgICAgICAgfSxcbiAgICAgICAgcmVmZXJlbmNlOiB7fSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHBvaW50ZXJtYXAucG9pbnRlcnMoKSA9PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG9pbnRzLmEuY2xpZ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iZWwgPSBrZXk7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtzdHJpbmdbXX1cbiAgICAgICAgICogQGRlZmF1bHQgZmFsc2VcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGF0YSA9IFsnJ107IC8vIFRPRE86IFdoeSBpcyB0aGlzIGZpcnN0IGVsZW1lbnQgbmVlZGVkP1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyW119XG4gICAgICAgICAqIEBkZWZhdWx0IFsnJ11cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuaW5kZXggPSBbXTsgLy8gVE9ETzogZm9ybWVybHkgcm93SW5kZXhcblxuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlck9mIERhdGFOb2RlQmFzZS5wcm90b3R5cGVcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XG4gICAgICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhhc0NoaWxkcmVuID0gZmFsc2U7IC8vIFRPRE86IFdoZXJlL2hvdyBpcyB0aGlzIHVzZWQ/XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgICAqIEBkZWZhdWx0IDBcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMuZGVwdGggPSAwO1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVCYXNlLnByb3RvdHlwZVxuICAgICAgICAgKiBAdHlwZSB7bnVtYmVyfVxuICAgICAgICAgKiBAZGVmYXVsdCAxXG4gICAgICAgICAqL1xuICAgICAgICB0aGlzLmhlaWdodCA9IDE7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUJhc2UucHJvdG90eXBlXG4gICAgICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAgICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5leHBhbmRlZCA9IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YU5vZGVMZWFmLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0VmFsdWU6IGZ1bmN0aW9uKHgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVt4XTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlTGVhZi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZGVwdGhcbiAgICAgKi9cbiAgICB0b0FycmF5OiBmdW5jdGlvbihkZXB0aCkge1xuICAgICAgICB0aGlzLmRlcHRoID0gZGVwdGg7XG4gICAgICAgIHRoaXMuZGF0YVswXSA9IHRoaXMuY29tcHV0ZURlcHRoU3RyaW5nKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBjb21wdXRlRGVwdGhTdHJpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gQXJyYXkodGhpcy5kZXB0aCArIDEpLmpvaW4odGhpcy5JTkRFTlQpICsgJyAgJyArIHRoaXMubGFiZWw7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJld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eSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzLmdldFJvdyh5KVt0aGlzLmZpZWxkc1t4XV0gPSB2YWx1ZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGEubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfVxuICAgICAqL1xuICAgIGdldENvbHVtbkNvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmllbGRzKCkubGVuZ3RoO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZS5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyW119XG4gICAgICovXG4gICAgZ2V0RmllbGRzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZmllbGRzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0Y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NlID0gdGhpcy5kYXRhU291cmNlLFxuICAgICAgICAgICAgcm93Q291bnQgPSBzb3VyY2UuZ2V0Um93Q291bnQoKSxcbiAgICAgICAgICAgIHRyZWUgPSB0aGlzLnRyZWUgPSBuZXcgRGF0YU5vZGVUcmVlKCdUb3RhbHMnKTtcblxuICAgICAgICAvLyBmaXJzdCBzb3J0IGRhdGFcbiAgICAgICAgaWYgKHRoaXMucHJlc29ydEdyb3Vwcykge1xuICAgICAgICAgICAgZ3JvdXBCeXMucmV2ZXJzZSgpLmZvckVhY2goZnVuY3Rpb24oZ3JvdXBCeSkge1xuICAgICAgICAgICAgICAgIHNvdXJjZSA9IG5ldyBEYXRhU291cmNlU29ydGVyKHNvdXJjZSk7XG4gICAgICAgICAgICAgICAgc291cmNlLnNvcnRPbihncm91cEJ5KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCByb3dDb3VudDsgcisrKSB7XG4gICAgICAgICAgICB2YXIgcGF0aCA9IHRyZWU7XG5cbiAgICAgICAgICAgIGdyb3VwQnlzLmZvckVhY2goZnVuY3Rpb24oZywgYykgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWxvb3AtZnVuY1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBzb3VyY2UuZ2V0VmFsdWUoZywgciksXG4gICAgICAgICAgICAgICAgICAgIGZhY3RvcnlEYXRhTm9kZSA9IChjID09PSBsZWFmRGVwdGgpID8gZmFjdG9yeURhdGFOb2RlTGVhZiA6IGZhY3RvcnlEYXRhTm9kZUdyb3VwO1xuICAgICAgICAgICAgICAgIHBhdGggPSBwYXRoLmNoaWxkcmVuLmdldElmVW5kZWZpbmVkKGtleSwgZmFjdG9yeURhdGFOb2RlKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBwYXRoLmluZGV4LnB1c2gocik7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNvcnRl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ICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBoZWFkZXJzXG4gICAgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICB0aGlzLmRhdGFTb3VyY2Uuc2V0SGVhZGVycyhoZWFkZXJzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfG51bWJlcltdfVxuICAgICAqL1xuICAgIGdldEZpZWxkczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtvYmplY3RbXX1cbiAgICAgKi9cbiAgICBnZXRHcmFuZFRvdGFsczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciB2aWV3ID0gdGhpcy50cmVlO1xuICAgICAgICByZXR1cm4gW3ZpZXcuZGF0YV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGF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ZXJPZiBEYXRhU291cmNlSW5kZXhlZC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgc2V0RmllbGRzOiBmdW5jdGlvbihmaWVsZHMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5zZXRGaWVsZHMoZmllbGRzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7c3RyaW5nW119IGhlYWRlcnNcbiAgICAgKiBAcmV0dXJucyB7c3RyaW5nW119XG4gICAgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldEhlYWRlcnMoaGVhZGVycyk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqXG4gICAgICogQHJldHVybnMge3N0cmluZ1tdfVxuICAgICAqL1xuICAgIGdldEhlYWRlcnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldEhlYWRlcnMoKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEdyYW5kVG90YWxzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVNvdXJjZS5nZXRHcmFuZFRvdGFscygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUluZGV4ZWQucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtvYmplY3RbXX0gYXJyYXlPZlVuaWZvcm1PYmplY3RzXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIHNldERhdGE6IGZ1bmN0aW9uKGFycmF5T2ZVbmlmb3JtT2JqZWN0cykge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLnNldERhdGEoYXJyYXlPZlVuaWZvcm1PYmplY3RzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VJbmRleGVkLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGNsZWFySW5kZXg6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmluZGV4Lmxlbmd0aCA9IDA7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlSW5kZXhlZC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gcHJlZGljYXRlXG4gICAgICogQHJldHVybnMge251bWJlcltdfVxuICAgICAqL1xuICAgIGJ1aWxkSW5kZXg6IGZ1bmN0aW9uKHByZWRpY2F0ZSkge1xuICAgICAgICB2YXIgcm93Q291bnQgPSB0aGlzLmRhdGFTb3VyY2UuZ2V0Um93Q291bnQoKSxcbiAgICAgICAgICAgIGluZGV4ID0gdGhpcy5pbmRleDtcblxuICAgICAgICB0aGlzLmNsZWFySW5kZXgoKTtcblxuICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgIGlmICghcHJlZGljYXRlIHx8IHByZWRpY2F0ZS5jYWxsKHRoaXMsIHIsIHRoaXMuZGF0YVNvdXJjZS5nZXRSb3cocikpKSB7XG4gICAgICAgICAgICAgICAgaW5kZXgucHVzaChyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpbmRleDtcbiAgICB9XG5cbn0pO1xuXG5tb2R1bGUuZXhwb3J0cyA9IERhdGFTb3VyY2VJbmRleGVkO1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgRGF0YVNvdXJjZUlu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G4gICAgICAgICAgICAgICAgc2VsZiA9IHRoaXM7XG4gICAgICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gc2VsZi5nZXQoa2V5KTtcbiAgICAgICAgICAgICAgICBpdGVyYXRlZSh2YWx1ZSwga2V5LCBzZWxmKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBNYXBweS5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge2Z1bmN0aW9ufSBpdGVyYXRlZVxuICAgICAqIEByZXR1cm5zIHtNYXBweX1cbiAgICAgKi9cbiAgICBtYXA6IGZ1bmN0aW9uKGl0ZXJhdGVlKSB7XG4gICAgICAgIHZhciBrZXlzID0gdGhpcy5rZXlzLFxuICAgICAgICAgICAgbmV3TWFwID0gbmV3IE1hcHB5KCksXG4gICAgICAgICAgICBzZWxmID0gdGhpcztcblxuICAgICAgICBpZiAoISh0eXBlb2YgaXRlcmF0ZWUgPT09ICdmdW5jdGlvbicpKSB7XG4gICAgICAgICAgICBpdGVyYXRlZSA9IHJlZmxlY3Rpb247XG4gICAgICAgIH1cblxuICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpLFxuICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkID0gaXRlcmF0ZWUodmFsdWUsIGtleSwgc2VsZik7XG4gICAgICAgICAgICBuZXdNYXAuc2V0KGtleSwgdHJhbnNmb3JtZWQpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIG5ld01hcDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtNYXBweX1cbiAgICAgKi9cbiAgICBjb3B5OiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGtleXMgPSB0aGlzLmtleXMsXG4gICAgICAgICAgICBuZXdNYXAgPSBuZXcgTWFwcHkoKSxcbiAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgbmV3TWFwLnNldChrZXksIHZhbHVlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBuZXdNYXA7XG4gICAgfVxuXG59O1xuXG52YXIgT0lEX1BSRUZJWCA9ICcufi4jJV8nOyAvL3RoaXMgc2hvdWxkIGJlIHNvbWV0aGluZyB3ZSBuZXZlciB3aWxsIHNlZSBhdCB0aGUgYmVnaW5uaW5nIG9mIGEgc3RyaW5nXG52YXIgY291bnRlciA9IDA7XG5cbmZ1bmN0aW9uIGhhc2goa2V5KSB7XG4gICAgdmFyIHR5cGVPZiA9IHR5cGVvZiBrZXk7XG5cbiAgICBzd2l0Y2ggKHR5cGVPZikge1xuICAgICAgICBjYXNlICdudW1iZXInOlxuICAgICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgY2FzZSAnc3ltYm9sJzpcbiAgICAgICAgICAgIHJldHVybiBPSURfUFJFRklYICsgdHlwZU9mICsgJ18nICsga2V5O1xuXG4gICAgICAgIGNhc2UgJ3VuZGVmaW5lZCc6XG4gICAgICAgICAgICByZXR1cm4gJ1VOREVGSU5FRCc7XG5cbiAgICAgICAgY2FzZSAnb2JqZWN0JzpcbiAgICAgICAgICAgIGlmIChrZXkgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJ05VTEwnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoIHdoZW4gbm90IG51bGw6XG4gICAgICAgIGNhc2UgJ2Z1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fSxcblxuICAgIHBvaW50SW5MaXN0UmVjdHM6IGZ1bmN0aW9uIChwb2ludCkge1xuICAgICAgICByZXR1cm4gdGhpcy5tb2RlbExpc3RzLmZpbmQoZnVuY3Rpb24gKG1vZGVsTGlzdCkge1xuICAgICAgICAgICAgdmFyIHJlY3QgPSBtb2RlbExpc3QuZWxlbWVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgICAgICAgcmVjdCA9IHtcbiAgICAgICAgICAgICAgICBsZWZ0OiAgIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5sZWZ0LFxuICAgICAgICAgICAgICAgIHRvcDogICAgd2luZG93LnNjcm9sbFkgKyByZWN0LnRvcCxcbiAgICAgICAgICAgICAgICByaWdodDogIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5yaWdodCxcbiAgICAgICAgICAgICAgICBib3R0b206IHdpbmRvdy5zY3JvbGxZICsgcmVjdC5ib3R0b20sXG4gICAgICAgICAgICAgICAgd2lkdGg6ICByZWN0LndpZHRoLFxuICAgICAgICAgICAgICAgIGhlaWdodDogcmVjdC5oZWlnaHRcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcblxuICAgICAgICAgICAgaWYgKHBvaW50SW5SZWN0KHBvaW50LCByZWN0KSkge1xuICAgICAgICAgICAgICAgIG1vZGVsTGlzdC5yZWN0ID0gcmVjdDtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgLy8gZm91bmRcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcG9pbnRJbkl0ZW1SZWN0czogZnVuY3Rpb24gKHBvaW50LCBleGNlcHQxLCBleGNlcHQyKSB7XG4gICAgICAgIHJldHVybiB0aGlzLml0ZW1zLmZpbmQoZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgIHZhciBlbGVtZW50ID0gaXRlbS5lbGVtZW50O1xuICAgICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgICAgICBlbGVtZW50ICE9PSBleGNlcHQxICYmXG4gICAgICAgICAgICAgICAgZWxlbWVudCAhPT0gZXhjZXB0MiAmJlxuICAgICAgICAgICAgICAgIHBvaW50SW5SZWN0KHBvaW50LCBpdGVtLnJlY3QpXG4gICAgICAgICAgICApO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgLy8gZ2V0IHBvc2l0aW9ucyBvZiBhbGwgbGlzdCBpdGVtcyBpbiBwYWdlIGNvb3JkcyAobm9ybWFsaXplZCBmb3Igd2luZG93IGFuZCBsaXN0IHNjcm9sbGluZylcbiAgICBnZXRBbGxJdGVtQm91bmRpbmdSZWN0czogZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgbW9kZWxMaXN0cyA9IHRoaXMubW9kZWxMaXN0cywgaGVpZ2h0O1xuICAgICAgICB0aGlzLml0ZW1zLmZvckVhY2goZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgIHZhciBpdGVtRWxlbWVudCA9IGl0ZW0uZWxlbWVudCxcbiAgICAgICAgICAgICAgICBsaXN0RWxlbWVudCA9IGl0ZW1FbGVtZW50LnBhcmVudEVsZW1lbnQsXG4gICAgICAgICAgICAgICAgbGlzdCA9IG1vZGVsTGlzdHMuZmluZChmdW5jdGlvbiAobGlzdCkgeyByZXR1cm4gbGlzdC5lbGVtZW50ID09PSBsaXN0RWxlbWVudDsgfSk7XG5cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAvLyBvbWl0dGVkOiBkZWZhdWx0IHRvIHRydWVcbiAgICAgICAgICAgICAgICBsaXN0LmlzRHJvcFRhcmdldCA9PT0gdW5kZWZpbmVkIHx8XG5cbiAgICAgICAgICAgICAgICAvLyBmdW5jdGlvbjogdXNlIHJldHVybiB2YWx1ZVxuICAgICAgICAgICAgICAgIHR5cGVvZiBsaXN0LmlzRHJvcFRhcmdldCA9PT0gJ2Z1bmN0aW9uJyAmJiBsaXN0LmlzRHJvcFRhcmdldCgpIHx8XG5cbiAgICAgICAgICAgICAgICAvLyBvdGhlcndpc2U6IHVzZSB0cnV0aGluZXNzIG9mIGdpdmVuIHZhbHVlXG4gICAgICAgICAgICAgICAgbGlzdC5pc0Ryb3BUYXJnZXRcbiAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIHZhciByZWN0ID0gaXRlbUVsZW1lbnQuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksXG4gICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IHJlY3QuYm90dG9tO1xuXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW1FbGVtZW50ID09PSBsaXN0RWxlbWVudC5sYXN0RWxlbWVudENoaWxkKSB7XG4gICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IGxpc3RFbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmJvdHRvbTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGJvdHRvbSA8IHJlY3QudG9wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBib3R0b20gPSByZWN0LnRvcCArIChoZWlnaHQgfHwgNTApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0ID0gcmVjdC5oZWlnaHQ7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmVjdCA9IHtcbiAgICAgICAgICAgICAgICAgICAgbGVmdDogICB3aW5kb3cuc2Nyb2xsWCArIHJlY3QubGVmdCxcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQ6ICB3aW5kb3cuc2Nyb2xsWCArIHJlY3QucmlnaHQsXG4gICAgICAgICAgICAgICAgICAgIHRvcDogICAgd2luZG93LnNjcm9sbFkgKyByZWN0LnRvcC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LFxuICAgICAgICAgICAgcmVjdC50b3AgIC0gd2luZG93LnNjcm9sbFlcbiAgICAgICAgKTtcbiAgICAgICAgdGhpcy5jbGFzc0xpc3QuYWRkKCdkcmFnb24tcG9wJyk7XG4gICAgICAgIHRoaXMuc3R5bGUuekluZGV4ID0gd2luZG93LmdldENvbXB1dGVkU3R5bGUoZHJhZ29uLm1vZGVsTGlzdHNbMF0uY29udGFpbmVyLnBhcmVudEVsZW1lbnQpLnpJbmRleDtcblxuICAgICAgICBpZiAoIWRyYWdvbi5jb250YWluZXIpIHtcbiAgICAgICAgICAgIC8vIHdhbGsgYmFjayB0byBjbG9zZXN0IHNoYWRvdyByb290IE9SIGJvZHkgdGFnIE9SIHJvb3QgdGFnXG4gICAgICAgICAgICB2YXIgY29udGFpbmVyID0gdGhpcztcbiAgICAgICAgICAgIHdoaWxlIChjb250YWluZXIucGFyZW50Tm9kZSkge1xuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IGNvbnRhaW5lci5wYXJlbnROb2RlO1xuICAgICAgICAgICAgICAgIGlmIChjb250YWluZXIgaW5zdGFuY2VvZiBTaGFkb3dSb290IHx8IGNvbnRhaW5lci50YWdOYW1lID09PSAnQk9EWScpe1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkcmFnb24uY29udGFpbmVyID0gY29udGFpbmVyO1xuICAgICAgICB9XG5cbiAgICAgICAgZHJhZ29uLmNvbnRhaW5lci5hcHBlbmRDaGlsZCh0aGlzKTtcblxuICAgICAgICByZWN0LmxlZnQgICArPSB3aW5kb3cuc2Nyb2xsWDtcbiAgICAgICAgcmVjdC50b3AgICAgKz0gd2luZG93LnNjcm9sbFk7XG4gICAgICAgIHJlY3QucmlnaHQgICs9IHdpbmRvdy5zY3JvbGxYO1xuICAgICAgICByZWN0LmJvdHRvbSArPSB3aW5kb3cuc2Nyb2xsWTtcblxuICAgICAgICBkcmFnb24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tIChob3Zlckxpc3QucmVjdC50b3AgKyA1KSkgPCAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIG5lYXIgb3IgYWJvdmUgdG9wIGFuZCBsaXN0IGlzIG5vdCBzY3JvbGxlZCB0byB0b3AgeWV0XG4gICAgICAgICAgICAgICAgICAgIHJlc2V0QXV0b1Njcm9sbFRpbWVyKG1hZ25pdHVkZSwgMCwgaG92ZXJMaXN0LmVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaG92ZXJMaXN0LmVsZW1lbnQuc2Nyb2xsVG9wIDwgbWF4U2Nyb2xsWSAmJiAobWFnbml0dWRlID0geSAtIChob3Zlckxpc3QucmVjdC5ib3R0b20gLSAxIC0gNSkpID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBuZWFyIG9yIGJlbG93IGJvdHRvbSBhbmQgbGlzdCBub3Qgc2Nyb2xsZWQgdG8gYm90dG9tIHlldFxuICAgICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcihtYWduaXR1ZGUsIG1heFNjcm9sbFksIGhvdmVyTGlzdC5lbGVtZW50KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBpbnNpZGVcbiAgICAgICAgICAgICAgICAgICAgcmVzZXRBdXRvU2Nyb2xsVGltZXIoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBvdGhlciA9IGRyYWdvbi5wb2ludEluSXRlbVJlY3RzKHtcbiAgICAgICAgICAgICAgICB4OiBldnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5OiBkcmFnb24ucmVjdC5ib3R0b20gKyB3aW5kb3cuc2Nyb2xsWSArIGR5ICsgaG92ZXJMaXN0LmVsZW1lbnQuc2Nyb2xsVG9wXG4gICAgICAgICAgICB9LCB0aGlzLCBkcmFnb24uZHJ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aW50KSB7XG4gICAgICAgIHJldHVybiBuZXcgUG9pbnQoXG4gICAgICAgICAgICBNYXRoLm1pbih0aGlzLngsIHBvaW50LngpLFxuICAgICAgICAgICAgTWF0aC5taW4odGhpcy55LCBwb2ludC55KVxuICAgICAgICApO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyB7UG9pbnR9IEEgbmV3IGBQb2ludGAgcG9zaXRpb25lZCB0byBncmVhdGVzdCB4IGFuZCBncmVhdGVzdCB5IG9mIHRoaXMgcG9pbnQgYW5kIGdpdmVuIGBwb2ludGAuXG4gICAgICogQHBhcmFtIHtQb2ludH0gcG9pbnQgLSBBIHBvaW50IHRvIGNvbXBhcmUgdG8gdGhpcyBwb2ludC5cbiAgICAgKiBAbWVtYmVyT2YgUG9pbnQucHJvdG90eXBlXG4gICAgICovXG4gICAgbWF4OiBmdW5jdGlvbihwb2ludCkge1xuICAgICAgICByZXR1cm4gbmV3IFBvaW50KFxuICAgICAgICAgICAgTWF0aC5tYXgodGhpcy54LCBwb2ludC54KSxcbiAgICAgICAgICAgIE1hdGgubWF4KHRoaXMueSwgcG9pbnQueSlcbiAgICAgICAgKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQHJldHVybnMge251bWJlcn0gRGlzdGFuY2UgYmV0d2VlbiBnaXZlbiBgcG9pbnRgIGFuZCB0aGlzIHBvaW50IHVzaW5nIFB5dGhhZ29yZWFuIFRoZW9yZW0gZm9ybXVsYS5cbiAgICAgKiBAcGFyYW0ge1BvaW50fSBwb2ludCAtIEEgcG9pbnQgZnJvbSB3aGljaCB0byBjb21wdXRlIHRoZSBkaXN0YW5jZSB0byB0aGlzIHBvaW50LlxuICAgICAqIEBtZW1iZXJPZiBQb2ludC5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBkaXN0YW5jZTogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgdmFyIGRlbHRhWCA9IHBvaW50LnggLSB0aGlzLngsXG4gICAgICAgICAgICBkZWx0YVkgPSBwb2ludC55IC0gdGhpcy55O1xuXG4gICAgICAgIHJldHVybiBNYXRoLnNxcnQoXG4gICAgICAgICAgICBkZWx0YVggKiBkZWx0YVggK1xuICAgICAgICAgICAgZGVsdGFZICogZGVsdGFZXG4gICAgICAgICk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIF8oRm9ybWVybHk6IGBlcXVhbGAuKV9cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmZiBfYm90aF8gY29vcmRpbmF0ZXMgb2YgdGhpcyBwb2ludCBhcmUgZXhhY3RseSBlcXVhbCB0byB0aG9zZSBvZiBnaXZlbiBgcG9pbnRgLlxuICAgICAqIEBwYXJhbSB7UG9pbnR9IHBvaW50IC0gQSBwb2ludCB0byBjb21wYXJlIHRvIHRoaXMgcG9pbnQuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIGVxdWFsczogZnVuY3Rpb24ocG9pbnQpIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IGZhbHNlO1xuXG4gICAgICAgIGlmIChwb2ludCkge1xuICAgICAgICAgICAgcmVzdWx0ID1cbiAgICAgICAgICAgICAgICB0aGlzLnggPT09IHBvaW50LnggJiZcbiAgICAgICAgICAgICAgICB0aGlzLnkgPT09IHBvaW50Lnk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmZiBfYm90aF8gY29vcmRpbmF0ZXMgb2YgdGhpcyBwb2ludCBhcmUgZ3JlYXRlciB0aGFuIHRob3NlIG9mIGdpdmVuIGBwb2ludGAuXG4gICAgICogQHBhcmFtIHtQb2ludH0gcG9pbnQgLSBBIHBvaW50IHRvIGNvbXBhcmUgdG8gdGhpcyBwb2ludFxuICAgICAqIEBtZW1iZXJPZiBQb2ludC5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cmVjdC5vcmlnaW4ueCxcbiAgICAgICAgICAgIG1heFggPSBtaW5YICsgcmVjdC5leHRlbnQueDtcbiAgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55LFxuICAgICAgICAgICAgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICAgICBtYXhZID0gcmVjdC5vcmlnaW4ueTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICBtaW5YIDw9IHRoaXMueCAmJiB0aGlzLnggPCBtYXhYICYmXG4gICAgICAgICAgICBtaW5ZIDw9IHRoaXMueSAmJiB0aGlzLnkgPCBtYXhZXG4gICAgICAgICk7XG4gICAgfVxufTtcblxuUG9pbnQucHJvdG90eXBlLkVRID0gUG9pbnQucHJvdG90eXBlLmVxdWFscztcblBvaW50LnByb3RvdHlwZS5HVCA9IFBvaW50LnByb3RvdHlwZS5ncmVhdGVyVGhhbjtcblBvaW50LnByb3RvdHlwZS5MVCA9IFBvaW50LnByb3RvdHlwZS5sZXNzVGhhbjtcblBvaW50LnByb3RvdHlwZS5HRSA9IFBvaW50LnByb3RvdHlwZS5ncmVhdGVyVGhhbk9yRXF1YWxUbztcblBvaW50LnByb3RvdHlwZS5MRSA9IFBvaW50LnByb3RvdHlwZS5sZXNzVGhhbk9yRXF1YWxUbztcblxuXG4vKipcbiAqIEBjb25zdHJ1Y3RvciBSZWN0YW5nbGVcbiAqXG4gKiBAZGVzYyBUaGlzIG9iamVjdCByZXByZXNlbnRzIGEgcmVjdGFuZ3VsYXIgYXJlYSB3aXRoaW4gYW4g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gc3BsaWNlciA9IHNwbGljZXIuY29uY2F0KHBpZWNlcyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3BsaWNlci5wdXNoKGVhY2gpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgc3BsaWNlclsxXSA9IHRoaXMuc2VsZWN0aW9uLmxlbmd0aDtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLnNwbGljZS5hcHBseSh0aGlzLnNlbGVjdGlvbiwgc3BsaWNlcik7IC8vIHVwZGF0ZSBpbiBwbGFjZSB0byBwcmVzZXJ2ZSBleHRlcm5hbCByZWZlcmVuY2VzXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHN1bW1hcnkgRW1wdGllcyBgdGhpcy5zZWxlY3Rpb25gLCBlZmZlY3RpdmVseSByZW1vdmluZyBhbGwgcnVucy5cbiAgICAgICAgICogQHJldHVybnMge1JhbmdlU2VsZWN0aW9uTW9kZWx9IFNlbGYgKGkuZS4sIGB0aGlzYCksIGZvciBjaGFpbmluZy5cbiAgICAgICAgICogQG1lbWJlck9mIFJhbmdlU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICAgICAqL1xuICAgICAgICBjbGVhcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy5zdGF0ZXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLmxlbmd0aCA9IDA7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBjbGVhck1vc3RSZWNlbnRTZWxlY3Rpb246IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnN0YXRlcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB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1iZXJPZiBDZWxsUHJvdmlkZXIucHJvdG90eXBlXG4gICAgICovXG4gICAgZGVmYXVsdENlbGxQYWludDogZnVuY3Rpb24oZ2MsIGNvbmZpZykge1xuICAgICAgICB2YXIgdmFsID0gY29uZmlnLnZhbHVlLFxuICAgICAgICAgICAgeCA9IGNvbmZpZy5ib3VuZHMueCxcbiAgICAgICAgICAgIHkgPSBjb25maWcuYm91bmRzLnksXG4gICAgICAgICAgICB3aWR0aCA9IGNvbmZpZy5ib3VuZHMud2lkdGgsXG4gICAgICAgICAgICBoZWlnaHQgPSBjb25maWcuYm91bmRzLmhlaWdodCxcbiAgICAgICAgICAgIHdyYXBIZWFkZXJzID0gY29uZmlnLmhlYWRlclRleHRXcmFwcGluZyxcbiAgICAgICAgICAgIGxlZnRQYWRkaW5nID0gMiwgLy9UT0RPOiBmaXggdGhpc1xuICAgICAgICAgICAgaXNIZWFkZXIgPSBjb25maWcueSA9PT0gMDtcblxuICAgICAgICB2YXIgbGVmdEljb24sIHJpZ2h0SWNvbiwgY2VudGVySWNvbiwgaXhvZmZzZXQsIGl5b2Zmc2V0O1xuXG4gICAgICAgIC8vc2V0dGluZyBnYyBwcm9wZXJ0aWVzIGFyZSBleHBlbnNpdmUsIGxldHMgbm90IGRvIGl0IHVubmVjZXNzYXJpbHlcblxuICAgICAgICBpZiAodmFsICYmIHZhbC5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgIGxlZnRJY29uID0gdmFsWzBdO1xuICAgICAgICAgICAgcmlnaHRJY29uID0gdmFsWzJdO1xuICAgICAgICAgICAgdmFsID0gdmFsWzFdO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICdvYmplY3QnKSB7IC8vIG11c3QgYmUgYW4gaW1hZ2VcbiAgICAgICAgICAgICAgICBjZW50ZXJJY29uID0gdmFsO1xuICAgICAgICAgICAgICAgIHZhbCA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGVmdEljb24gJiYgbGVmdEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgbGVmdEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHJpZ2h0SWNvbiAmJiByaWdodEljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgcmlnaHRJY29uID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjZW50ZXJJY29uICYmIGNlbnRlckljb24ubm9kZU5hbWUgIT09ICdJTUcnKSB7XG4gICAgICAgICAgICAgICAgY2VudGVySWNvbiA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgPSB2YWx1ZU9yRnVuY3Rpb25FeGVjdXRlKGNvbmZpZywgdmFsKTtcblxuICAgICAgICBpZiAoZ2MuZm9udCAhPT0gY29uZmlnLmZvbnQpIHtcbiAgICAgICAgICAgIGdjLmZvbnQgPSBjb25maWcuZm9udDtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ2MudGV4dEFsaWduICE9PSAnbGVmdCcpIHtcbiAgICAgICAgICAgIGdjLnRleHRBbGlnbiA9ICdsZWZ0JztcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ2MudGV4dEJhc2VsaW5lICE9PSAnbWlkZGxlJykge1xuICAgICAgICAgICAgZ2MudGV4dEJhc2VsaW5lID0gJ21pZGRsZSc7XG4gICAgICAgIH1cblxuICAgICAgICAvL2ZpbGwgYmFja2dyb3VuZCBvbmx5IGlmIG91ciBiZ0NvbG9yIGlzIHBvcHVsYXRlZCBvciB3ZSBhcmUgYSBzZWxlY3RlZCBjZWxsXG4gICAgICAgIGlmIChjb25maWcuYmFja2dyb3VuZENvbG9yIHx8IGNvbmZpZy5pc1NlbGVjdGVkKSB7XG4gICAgICAgICAgICBnYy5maWxsU3R5bGUgPSB2YWx1ZU9yRnVuY3Rpb25FeGVj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dmFyIGljb25XaWR0aCA9IDA7XG4gICAgICAgIGlmIChsZWZ0SWNvbikge1xuICAgICAgICAgICAgaXlvZmZzZXQgPSBNYXRoLnJvdW5kKChoZWlnaHQgLSBsZWZ0SWNvbi5oZWlnaHQpIC8gMik7XG4gICAgICAgICAgICBnYy5kcmF3SW1hZ2UobGVmdEljb24sIHggKyBsZWZ0UGFkZGluZywgeSArIGl5b2Zmc2V0KTtcbiAgICAgICAgICAgIGljb25XaWR0aCA9IE1hdGgubWF4KGxlZnRJY29uLndpZHRoICsgMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHJpZ2h0SWNvbikge1xuICAgICAgICAgICAgaXlvZmZzZXQgPSBNYXRoLnJvdW5kKChoZWlnaHQgLSByaWdodEljb24uaGVpZ2h0KSAvIDIpO1xuICAgICAgICAgICAgaXhvZmZzZXQgPSAwOyAvL01hdGgucm91bmQoKGhhbGlnbk9mZnNldCAtIHJpZ2h0SWNvbi53aWR0aCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShyaWdodEljb24sIHggKyB3aWR0aCAtIGl4b2Zmc2V0IC0gcmlnaHRJY29uLndpZHRoLCB5ICsgaXlvZmZzZXQpO1xuICAgICAgICAgICAgaWNvbldpZHRoID0gTWF0aC5tYXgocmlnaHRJY29uLndpZHRoICsgMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNlbnRlckljb24pIHtcbiAgICAgICAgICAgIGl5b2Zmc2V0ID0gTWF0aC5yb3VuZCgoaGVpZ2h0IC0gY2VudGVySWNvbi5oZWlnaHQpIC8gMik7XG4gICAgICAgICAgICBpeG9mZnNldCA9IE1hdGgucm91bmQoKHdpZHRoIC0gY2VudGVySWNvbi53aWR0aCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShjZW50ZXJJY29uLCB4ICsgd2lkdGggLSBpeG9mZnNldCAtIGNlbnRlckljb24ud2lkdGgsIHkgKyBpeW9mZnNldCk7XG4gICAgICAg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uZ2V0VGV4dEhlaWdodChjb25maWcuZm9udCk7XG4gICAgICAgIHZhciB0ZXh0V2lkdGggPSBjb25maWcuZ2V0VGV4dFdpZHRoKGdjLCB2YWwpO1xuXG4gICAgICAgIC8vd2UgbXVzdCBzZXQgdGhpcyBpbiBvcmRlciB0byBjb21wdXRlIHRoZSBtaW5pbXVtIHdpZHRoXG4gICAgICAgIC8vZm9yIGNvbHVtbiBhdXRvc2l6aW5nIHB1cnBvc2VzXG4gICAgICAgIGNvbmZpZy5taW5XaWR0aCA9IHRleHRXaWR0aCArICgyICogY29sSEVkZ2VPZmZzZXQpO1xuXG4gICAgICAgIHN3aXRjaCAoaGFsaWduKSB7XG4gICAgICAgICAgICBjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgLy90ZXh0V2lkdGggPSBjb25maWcuZ2V0VGV4dFdpZHRoKGdjLCBjb25maWcudmFsdWUpO1xuICAgICAgICAgICAgICAgIGhhbGlnbk9mZnNldCA9IHdpZHRoIC0gY29sSEVkZ2VPZmZzZXQgLSB0ZXh0V2lkdGg7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlICdjZW50ZXInOlxuICAgICAgICAgICAgICAgIC8vdGV4dFdpZHRoID0gY29uZmlnLmdldFRleHRXaWR0aChnYywgY29uZmlnLnZhbHVlKTtcbiAgICAgICAgICAgICAgICBoYWxpZ25PZmZzZXQgPSAod2lkdGggLSB0ZXh0V2lkdGgpIC8gMjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgJ2xlZnQnOlxuICAgICAgICAgICAgICAgIGhhbGlnbk9mZnNldCA9IGNvbEhFZGdlT2Zmc2V0O1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG5cbiAgICAgICAgaGFsaWduT2Zmc2V0ID0gTWF0aC5tYXgoMCwgaGFsaWduT2Zmc2V0KTtcbiAgICAgICAgdmFsaWduT2Zmc2V0ID0gdmFsaWduT2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ybiB0aGlzLmdldE1hdHJpeFNlbGVjdGlvbkFzVFNWKHRoaXMuZ2V0Q29sdW1uU2VsZWN0aW9uTWF0cml4KCkpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIGdldE1hdHJpeFNlbGVjdGlvbkFzVFNWOiBmdW5jdGlvbihzZWxlY3Rpb25zKSB7XG4gICAgICAgIC8vb25seSB1c2UgdGhlIGRhdGEgZnJvbSB0aGUgbGFzdCBzZWxlY3Rpb25cbiAgICAgICAgaWYgKHNlbGVjdGlvbnMubGVuZ3RoKSB7XG4gICAgICAgICAgICB2YXIgd2lkdGggPSBzZWxlY3Rpb25zLmxlbmd0aCxcbiAgICAgICAgICAgICAgICBoZWlnaHQgPSBzZWxlY3Rpb25zWzBdLmxlbmd0aCxcbiAgICAgICAgICAgICAgICBhcmVhID0gd2lkdGggKiBoZWlnaHQsXG4gICAgICAgICAgICAgICAgY29sbGVjdG9yID0gW107XG5cbiAgICAgICAgICAgIC8vZGlzYWxsb3cgaWYgc2VsZWN0aW9uIGlzIHRvbyBiaWdcbiAgICAgICAgICAgIGlmIChhcmVhID4gMjAwMDApIHtcbiAgICAgICAgICAgICAgICBhbGVydCgnc2VsZWN0aW9uIHNpemUgaXMgdG9vIGJpZyB0byBjb3B5IHRvIHRoZSBwYXN0ZSBidWZmZXInKTsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1hbGVydFxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZm9yICh2YXIgaCA9IDA7IGggPCBoZWlnaHQ7IGgrKykge1xuICAgICAgICAgICAgICAgIGZvciAodmFyIHcgPSAwOyB3IDwgd2lkdGg7IHcrKykge1xuICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaChzZWxlY3Rpb25zW3ddW2hdKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHcgPCB3aWR0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29sbGVjd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AgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgbW91c2VFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5tb3VzZURvd25TdGF0ZSA9IG1vdXNlRXZlbnQ7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlTW91c2VEb3duKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VEb3duRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLnJlcGFpbnQoKTtcbiAgICAgICAgfSk7XG5cblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtY2xpY2snLCBmdW5jdGlvbihlKSB7XG4gICAgICAgIC8vICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgLy8gICAgICAgICByZXR1cm47XG4gICAgICAgIC8vICAgICB9XG4gICAgICAgIC8vICAgICAvL3NlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgLy8gICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAvLyAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgIC8vICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICAvLyB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtbW91c2V1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIGlmIChzZWxmLmlzU2Nyb2xsaW5nTm93KCkpIHtcbiAgICAgICAgICAgICAgICBzZWxmLnNldFNjcm9sbGluZ05vdyhmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZykge1xuICAgICAgICAgICAgICAgIHNlbGYuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZVVwKG1vdXNlRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHNlbGYubW91c2VEb3duU3RhdGUpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNCdXR0b25QcmVzc2VkRXZlbnQoc2VsZi5tb3VzZURvd25TdGF0ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbnVsbDtcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY01vdXNlVXBFdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRhcCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgdGFwRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgdGFwRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgdGFwRXZlbnQua2V5cyA9IGUuZGV0YWlsLmtleXM7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNDbGlja0V2ZW50KHRhcEV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVUYXAodGFwRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtZHJhZycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZHJhZ2dpbmcgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURyYWcobW91c2VFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5ZG93bkV2ZW50KGUpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZUtleURvd24oZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1rZXl1cCcsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0tleXVwRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5VXAoZSk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy10cmFjaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHByaW1FdmVudCA9IGUuZGV0YWlsLnByaW1pdGl2ZUV2ZW50O1xuICAgICAgICAgICAgaWYgKE1hdGguYWJzKHByaW1FdmVudC5keSkgPiBNYXRoLmFicyhwcmltRXZlbnQuZHgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbFZCeSgtMik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZlbnQueURpcmVjdGlvbiA8IC0wKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KDIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLnNjcm9sbEhCeSgtMSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltRXZlbnQueERpcmVjdGlvbiA8IC0wKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsSEJ5KDEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgLy8gdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWhvbGRwdWxzZScsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgLy8gICAgIGNvbnNvbGUubG9nKCdob2xkcHVsc2UnKTtcbiAgICAgICAgLy8gICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gICAgIH1cbiAgICAgICAgLy8gICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAvLyAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgIC8vICAgICBzZWxmLmRlbGVnYXRlSG9sZFB1bHNlKG1vdXNlRXZlbnQpO1xuICAgICAgICAvLyB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtZGJsY2xpY2snLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljRG91YmxlQ2xpY2tFdmVudChtb3VzZUV2ZW50LCBlKTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVEb3VibGVDbGljayhtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhp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gICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIGtleUV2ZW50OiBrZXlFdmVudFxuICAgICAgICAgICAgfSxcblxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0VkaXRvcktleURvd25FdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktZG93bicsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5UHJlc3NFdmVudDogZnVuY3Rpb24oaW5wdXRDb250cm9sLCBrZXlFdmVudCkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLWVkaXRvci1rZXktcHJlc3MnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBpbnB1dDogaW5wdXRDb250cm9sLFxuICAgICAgICAgICAgICAgIGtleUV2ZW50OiBrZXlFdmVudFxuICAgICAgICAgICAgfSxcblxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTtcbiAgICB9LFxuXG4gICAgZmlyZVN5bnRoZXRpY0VkaXRvckRhdGFDaGFuZ2VFdmVud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bkluZGV4ZXMubGVuZ3RoKTtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICBzZWxlY3RlZENvbHVtbkluZGV4ZXMuZm9yRWFjaChmdW5jdGlvbihzZWxlY3RlZENvbHVtbkluZGV4LCBjKSB7XG4gICAgICAgICAgICByZXN1bHRbY10gPSBuZXcgQXJyYXkobnVtUm93cyk7XG4gICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IG51bVJvd3M7IHIrKykge1xuICAgICAgICAgICAgICAgIHJlc3VsdFtjXVtyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUoc2VsZi5nZXRWYWx1ZShzZWxlY3RlZENvbHVtbkluZGV4LCByKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICBnZXRDb2x1bW5TZWxlY3Rpb246IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZWN0ZWRDb2x1bW5JbmRleGVzID0gdGhpcy5nZXRTZWxlY3RlZENvbHVtbnMoKTtcbiAgICAgICAgdmFyIHJlc3VsdCA9IHt9O1xuICAgICAgICB2YXIgcm93Q291bnQgPSB0aGlzLmdldFJvd0NvdW50KCk7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgc2VsZWN0ZWRDb2x1bW5JbmRleGVzLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0ZWRDb2x1bW5JbmRleCkge1xuICAgICAgICAgICAgdmFyIGNvbHVtbiA9IG5ldyBBcnJheShyb3dDb3VudCk7XG4gICAgICAgICAgICByZXN1bHRbc2VsZi5nZXRGaWVsZChzZWxlY3RlZENvbHVtbkluZGV4KV0gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgICAgICBjb2x1bW5bcl0gPSB2YWx1ZU9yRnVuY3Rpb25F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1xuICAgICAgICAgICAgdmFyIGNvbHVtbiA9IG5ldyBBcnJheShyb3dDb3VudCk7XG4gICAgICAgICAgICByZXN1bHRbY10gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHJvd0NvdW50OyByKyspIHtcbiAgICAgICAgICAgICAgICBjb2x1bW5bcl0gPSB2YWx1ZU9yRnVuY3Rpb25FeGVjdXRlKHRoaXMuZ2V0VmFsdWUob3ggKyBjLCBveSArIHIpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBTeW50aGVzaXplIGFuZCBmaXJlIGEgYGZpbi1jb250ZXh0LW1lbnVgIGV2ZW50XG4gICAgICogQHBhcmFtIHtrZXlFdmVudH0gZXZlbnQgLSBUaGUgY2FudmFzIGV2ZW50LlxuICAgICAqL1xuICAgIGZpcmVTeW50aGV0aWNDb250ZXh0TWVudUV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIGUuZ3JpZENlbGwgPSB0aGlzLmNvbnZlcnRWaWV3UG9pbnRUb0RhdGFQb2ludChlLmdyaWRDZWxsKTtcbiAgICAgICAgdmFyIGV2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tY29udGV4dC1tZW51Jywge1xuICAgICAgICAgICAgZGV0YWlsOiB7XG4gICAgICAgICAgICAgICAgZ3JpZENlbGw6IGUuZ3JpZENlbGwsXG4gICAgICAgICAgICAgICAgbW91c2VQb2ludDogZS5tb3VzZVBvaW50LFxuICAgICAgICAgICAgICAgIHZpZXdQb2ludDogZS52aWV3UG9pbnQsXG4gICAgICAgICAgICAgICAgcHJpbWl0aXZlRXZlbnQ6IGUucHJpbWl0aXZlRXZlbnQsXG4gICAgICAgICAgICAgICAgcm93czogdGhpcy5nZXRTZWxlY3RlZFJvd3MoKSxcbiAgICAgICAgICAgICAgICBjb2x1bW5zOiB0aGlzLmdldFNlbGVjdGVkQ29sdW1ucygpLFxuICAgICAgICAgICAgICAgIHNlbGVjdGlvbnM6IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKS5nZXRTZWxlY3Rpb25zKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoZXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljTW91c2VVcEV2ZW50OiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBldmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLW1vdXNldXAnLCB7XG4gICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogZS5ncmlkQ2VsbCxcbiAgICAgICAgICAgICAgICBtb3VzZVBvaW50OiBlLm1vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudDogZnVuY3Rpb24oZSkge1xuICAgICAgICB2YXIgZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ2Z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mRpbmF0ZS5cbiAgICAgKiBAcGFyYW0ge3l9IHkgLSBUaGUgdmVydGljYWwgY29vcmRpbmF0ZS5cbiAgICAgKi9cbiAgICBhY3RpdmF0ZUVkaXRvcjogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICBpZiAoIXRoaXMuaXNFZGl0YWJsZSgpICYmICF0aGlzLmlzRmlsdGVyUm93KHkpKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGVkaXRvciA9IHRoaXMuZ2V0Q2VsbEVkaXRvckF0KHgsIHkpO1xuICAgICAgICBpZiAoIWVkaXRvcikge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb2ludCA9IGVkaXRvci5lZGl0b3JQb2ludDtcbiAgICAgICAgaWYgKGVkaXRvcikge1xuICAgICAgICAgICAgaWYgKHBvaW50LnggPT09IHggJiYgcG9pbnQueSA9PT0geSAmJiBlZGl0b3IuaXNFZGl0aW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuOyAvL3dlJ3JlIGFscmVhZHkgb3BlbiBhdCB0aGlzIGxvY2F0aW9uXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuaXNFZGl0aW5nKCkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnN0b3BFZGl0aW5nKCk7IC8vb3RoZXIgZWRpdG9yIGlzIG9wZW4sIGNsb3NlIGl0IGZpcnN0XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBldmVudC5ncmlkQ2VsbCA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICB0aGlzLmVkaXRBdChlZGl0b3IsIGV2ZW50KTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBzdW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gICAgdGhpcy5jYW52YXMucmVzaXplKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn0gVGUgSGlEUEkgcmF0aW8uXG4gICAgICovXG4gICAgZ2V0SGlEUEk6IGZ1bmN0aW9uKGN0eCkge1xuICAgICAgICBpZiAod2luZG93LmRldmljZVBpeGVsUmF0aW8gJiYgdGhpcy51c2VIaURQSSgpKSB7XG4gICAgICAgICAgICB2YXIgZGV2aWNlUGl4ZWxSYXRpbyA9IHdpbmRvdy5kZXZpY2VQaXhlbFJhdGlvIHx8IDE7XG4gICAgICAgICAgICB2YXIgYmFja2luZ1N0b3JlUmF0aW8gPSBjdHgud2Via2l0QmFja2luZ1N0b3JlUGl4ZWxSYXRpbyB8fFxuICAgICAgICAgICAgICAgIGN0eC5tb3pCYWNraW5nU3RvcmVQaXhlbFJhdGlvIHx8XG4gICAgICAgICAgICAgICAgY3R4Lm1zQmFja2luZ1N0b3JlUGl4ZWxSYXRpbyB8fFxuICAgICAgICAgICAgICAgIGN0eC5vQmFja2luZ1N0b3JlUGl4ZWxSYXRpbyB8fFxuICAgICAgICAgICAgICAgIGN0eC5iYWNraW5nU3RvcmVQaXhlbFJhdGlvIHx8IDE7XG5cbiAgICAgICAgICAgIHZhciByYXRpbyA9IGRldmljZVBpeGVsUmF0aW8gLyBiYWNraW5nU3RvcmVSYXRpbztcbiAgICAgICAgICAgIHJldHVybiByYXRpbztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiAxO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn0gVGhlIHdpZHRoIG9mIHRoZSBnaXZlbiAocmVjZW50bHkgcmVuZGVyZWQpIGNvbHVtbi5cbiAgICAgKiBAcG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ge1xuICAgICAgICAgICAgcm93ID0gcmVzdWx0c1tyXSA9IHtcbiAgICAgICAgICAgICAgICBoaWVyYXJjaHk6IGJlaGF2aW9yLmdldEZpeGVkQ29sdW1uVmFsdWUoMCwgcilcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBoZWFkZXJzLmZvckVhY2goZnVuY3Rpb24oZmllbGQsIGMpIHtcbiAgICAgICAgICAgICAgICByb3dbZmllbGRdID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgcik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdH0gQW4gb2JqZWN0IHRoYXQgcmVwcmVzZW50cyB0aGUgY3VycmVudGx5IHNlbGVjdGlvbiByb3cuXG4gICAgICovXG4gICAgZ2V0U2VsZWN0ZWRSb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VscyA9IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKS5nZXRTZWxlY3Rpb25zKCk7XG4gICAgICAgIGlmIChzZWxzLmxlbmd0aCkge1xuICAgICAgICAgICAgdmFyIGJlaGF2aW9yID0gdGhpcy5nZXRCZWhhdmlvcigpLFxuICAgICAgICAgICAgICAgIGNvbENvdW50ID0gdGhpcy5nZXRDb2x1bW5Db3VudCgpLFxuICAgICAgICAgICAgICAgIHRvcFJvdyA9IHNlbHNbMF0ub3JpZ2luLnksXG4gICAgICAgICAgICAgICAgcm93ID0ge1xuICAgICAgICAgICAgICAgICAgICAvL2hpZXJhcmNoeTogYmVoYXZpb3IuZ2V0Rml4ZWRDb2x1bW5WYWx1ZSgwLCB0b3BSb3cpXG4gICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBjb2xDb3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sZVNvcnQoeCwga2V5cyk7XG5cbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuc3luY2hyb25pemVTY3JvbGxpbmdCb3VuZHJpZXMoKTtcbiAgICAgICAgICAgIC8vc2VsZi5iZWhhdmlvckNoYW5nZWQoKTtcbiAgICAgICAgICAgIGlmIChzZWxmLmlzQ29sdW1uQXV0b3NpemluZygpKSB7XG4gICAgICAgICAgICAgICAgYmVoYXZpb3IuYXV0b3NpemVBbGxDb2x1bW5zKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLnJlcGFpbnQoKTtcbiAgICAgICAgfSwgMTApO1xuICAgIH0sXG5cbiAgICB0b2dnbGVTZWxlY3RDb2x1bW46IGZ1bmN0aW9uKHgsIGtleXMpIHtcbiAgICAgICAga2V5cyA9IGtleXMgfHwgW107XG4gICAgICAgIHZhciBtb2RlbCA9IHRoaXMuZ2V0U2VsZWN0aW9uTW9kZWwoKTtcbiAgICAgICAgdmFyIGFscmVhZHlTZWxlY3RlZCA9IG1vZGVsLmlzQ29sdW1uU2VsZWN0ZWQoeCk7XG4gICAgICAgIHZhciBoYXNDVFJMID0ga2V5cy5pbmRleE9mKCdDVFJMJykgPiAtMTtcbiAgICAgICAgdmFyIGhhc1NISUZUID0ga2V5cy5pbmRleE9mKCdTSElGVCcpID4gLTE7XG4gICAgICAgIGlmICghaGFzQ1RSTCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChoYXNDVFJMKSB7XG4gICAgICAgICAgICAgICAgaWYgKGFscmVhZHlTZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5kZXNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4oeCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RDb2x1bW4odGhpcy5sYXN0RWRnZVNlbGVjdGlvblswXSwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFhbHJlYWR5U2VsZWN0ZWQgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICB0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzBdID0geDtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlcGFpbnQoKTtcbiAgICAgICAgdGhpcy5maXJlU3ludGhldGljQ29sdW1uU2VsZWN0aW9uQ2hhbmdlZEV2ZW50KCk7XG4gICAgfSxcblxuICAgIHRvZ2dsZVNlbGVjdFJvdzogZnVuY3Rpb24oeSwga2V5cykge1xuXG4gICAgICAgIC8vd2UgY2FuIHNlbGVjdCB0aGUgdG90YWxzIHJvd3MgaWYgdGhleSBleGlzdCxcbiAgICAgICAgLy9idXQgbm90IHJvd3MgYWJvdmUgdGhhdFxuICAgICAgICB2YXIgc2VsZWN0aW9uRWRnZSA9IHRoaXMuZ2V0RmlsdGVyUm93SW5kZXgoKSArIDE7XG4gICAgICAgIGlmICh5IDwgc2VsZWN0aW9uRWRnZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAga2V5cyA9IGtleXMgfHwgW107XG5cbiAgICAgICAgdmFyIGlzU2luZ2xlUm93U2VsZWN0aW9uID0gdGhpcy5pc1NpbmdsZVJvd1NlbGVjdGlvbk1vZGUoKTtcbiAgICAgICAgdmFyIG1vZGVsID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpO1xuICAgICAgICB2YXIgYWxyZWFkeVNlbGVjdGVkID0gbW9kZWwuaXNSb3dTZWxlY3RlZCh5KTtcbiAgICAgICAgdmFyIGhhc0NUUkwgPSBrZXlzLmluZGV4T2YoJ0NUUkwnKSA+IC0xO1xuICAgICAgICB2YXIgaGFzU0hJRlQgPSBrZXlzLmluZGV4T2YoJ1NISUZUJykgPiAtMTtcblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgaWYgKCFhbHJlYWR5U2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5zZWxlY3RSb3coeSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoaGFzQ1RSTCkge1xuICAgICAgICAgICAgICAgIGlmIChhbHJlYWR5U2VsZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuZGVzZWxlY3RSb3coeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzU2luZ2xlUm93U2VsZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlbC5jbGVhclJvd1NlbGVjdGlvbigpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh5KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaGFzU0hJRlQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdFJvdyh0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzFdLCB5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICA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VcbiAgICAgICAgICAgIGlmICh0aGlzID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQXJyYXkucHJvdG90eXBlLmZpbmQgY2FsbGVkIG9uIG51bGwgb3IgdW5kZWZpbmVkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIHByZWRpY2F0ZSAhPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ3ByZWRpY2F0ZSBtdXN0IGJlIGEgZnVuY3Rpb24nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBsaXN0ID0gT2JqZWN0KHRoaXMpO1xuICAgICAgICAgICAgdmFyIGxlbmd0aCA9IGxpc3QubGVuZ3RoID4+PiAwO1xuICAgICAgICAgICAgdmFyIHRoaXNBcmcgPSBhcmd1bWVudHNbMV07XG4gICAgICAgICAgICB2YXIgdmFsdWU7XG5cbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IGxpc3RbaV07XG4gICAgICAgICAgICAgICAgaWYgKHByZWRpY2F0ZS5jYWxsKHRoaXNBcmcsIHZhbHVlLCBpLCBsaXN0KSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICAgICAgfTtcbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gSHlwZXJncmlkO1xuIiwiLyogZXNsaW50LWVudiBicm93c2VyICovXG4vKiBnbG9iYWwgcmVxdWVzdEFuaW1hdGlvbkZyYW1lICovXG5cbid1c2Ugc3RyaWN0JztcblxudmFyIF8gPSByZXF1aXJlKCdvYmplY3QtaXRlcmF0b3JzJyk7XG52YX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0N1cnNvciA9IDA7XG4gICAgICAgIHZhciBwcmV2aW91c0luc2VydGlvbkJvdW5kc0N1cnNvclZhbHVlID0gMDtcblxuICAgICAgICB4ID0gMDtcbiAgICAgICAgdmFyIHN0YXJ0ID0gMDtcbiAgICAgICAgdmFyIGZpcnN0VlgsIGxhc3RWWDtcbiAgICAgICAgdmFyIGZpcnN0VlksIGxhc3RWWTtcbiAgICAgICAgaWYgKGdyaWQuaXNTaG93Um93TnVtYmVycygpKSB7XG4gICAgICAgICAgICBzdGFydC0tO1xuICAgICAgICAgICAgdGhpcy5jb2x1bW5FZGdlc1stMV0gPSAtMTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGMgPSBzdGFydDsgYyA8IG51bUNvbHVtbnM7IGMrKykge1xuICAgICAgICAgICAgdnggPSBjO1xuICAgICAgICAgICAgaWYgKGMgPj0gbnVtRml4ZWRDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgdnggPSB2eCArIHNjcm9sbExlZnQ7XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0VlggPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFZYID0gdng7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxhc3RWWCA9IHZ4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHggPiB2aWV3V2lkdGggfHwgbnVtQ29sdW1ucyA8PSB2eCkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgd2lkdGggPSB0aGlzLmdldENvbHVtbldpZHRoKHZ4KTtcbiAgICAgICAgICAgIHggPSB4ICsgd2lkdGg7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzW2MgKyAxXSA9IE1hdGgucm91bmQoeCk7XG4gICAgICAgICAgICB0aGlzLnZpc2libGVDb2x1bW5zW2NdID0gdng7XG4gICAgICAgICAgICB0aGlzLmNvbHVtbkVkZ2VzSW5kZXhNYXBbdnhdID0gYztcblxuICAgICAgICAgICAgaW5zZXJ0aW9uQm91bmRzQ3Vyc29yID0gaW5zZXJ0aW9uQm91bmRzQ3Vyc29yICsgTWF0aC5yb3VuZCh3aWR0aCAvIDIpICsgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZTtcbiAgICAgICAgICAgIHRoaXMuaW5zZXJ0aW9uQm91bmRzLnB1c2goaW5zZXJ0aW9uQm91bmRzQ3Vyc29yKTtcbiAgICAgICAgICAgIHByZXZpb3VzSW5zZXJ0aW9uQm91bmRzQ3Vyc29yVmFsdWUgPSBNYXRoLnJvdW5kKHdpZHRoIC8gMik7XG4gICAgICAgIH1cblxuICAgICAgICB5ID0gMDtcbiAgICAgICAgZm9yIChyID0gMDsgciA8IG51bVJvd3M7IHIrKykge1xuICAgICAgICAgICAgdnkgPSByO1xuICAgICAgICAgICAgaWYgKHIgPj0gbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgdnkgPSB2eSArIHNjcm9sbFRvcDtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RWWSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0VlkgPSB2eTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGFzdFZZID0gdnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeSA+IHZpZXdIZWlnaHQgfHwgbnVtUm93cyA8PSB2eSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaGVpZ2h0ID0gdGhpcy5nZXRSb3dIZWlnaHQodnkpO1xuICAgICAgICAgICAgeSA9IHkgKyBoZWlnaHQ7XG4gICAgICAgICAgICB0aGlzLnJvd0VkZ2VzW3IgKyAxXSA9IE1hdGgucm91bmQoeSk7XG4gICAgICAgICAgICB0aGlzLnZpc2libGVSb3dzW3JdID0gdnk7XG4gICA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TtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gd2lkdGg7XG4gICAgICAgIH1cbiAgICAgICAgYy0tO1xuICAgICAgICBwcmV2aW91cyA9IDA7XG4gICAgICAgIGZvciAociA9IDA7IHIgPCB0aGlzLnJvd0VkZ2VzLmxlbmd0aDsgcisrKSB7XG4gICAgICAgICAgICBoZWlnaHQgPSB0aGlzLnJvd0VkZ2VzW3JdO1xuICAgICAgICAgICAgaWYgKHBvaW50LnkgPCBoZWlnaHQpIHtcbiAgICAgICAgICAgICAgICB5ID0gTWF0aC5tYXgoMCwgcG9pbnQueSAtIHByZXZpb3VzIC0gMik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmV2aW91cyA9IGhlaWdodDtcbiAgICAgICAgfVxuICAgICAgICByLS07XG4gICAgICAgIGlmIChwb2ludC54IDwgMCkge1xuICAgICAgICAgICAgYyA9IC0xO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb2ludC55IDwgMCkge1xuICAgICAgICAgICAgciA9IC0xO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHZpZXdQb2ludCA9IGdyaWQubmV3UG9pbnQoYywgcik7XG5cbiAgICAgICAgLy9jb21wZW5zYXRlIGlmIHdlIGFyZSBzY3JvbGxlZFxuICAgICAgICBpZiAoYyA+PSBmaXhlZENvbHVtbkNvdW50KSB7XG4gICAgICAgICAgICBjID0gYyArIHNjcm9sbFg7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHIgPj0gZml4ZWRSb3dDb3VudCkge1xuICAgICAgICAgICAgciA9IHIgKyBzY3JvbGxZO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHRyYW5zbGF0ZWRJbmRleCA9IC0xO1xuXG4gICAgICAgIHZhciBjb2x1bW4gPSBiZWhhdmlvci5nZXRDb2x1bW4oYyk7XG4gICAgICAgIGlmIChjb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W5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uU2VsZWN0aW9uTW9kZWwuZ2V0U2VsZWN0aW9ucygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59XG4gICAgICovXG4gICAgIGlzQ29sdW1uT3JSb3dTZWxlY3RlZDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiAhdGhpcy5jb2x1bW5TZWxlY3Rpb25Nb2RlbC5pc0VtcHR5KCkgfHwgIXRoaXMucm93U2VsZWN0aW9uTW9kZWwuaXNFbXB0eSgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge0FycmF5fVxuICAgICAqL1xuICAgIGdldEZsYXR0ZW5lZFlzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IFtdO1xuICAgICAgICB2YXIgc2V0ID0ge307XG4gICAgICAgIHRoaXMuc2VsZWN0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgdmFyIHRvcCA9IHNlbGVjdGlvbi5vcmlnaW4ueTtcbiAgICAgICAgICAgIHZhciBzaXplID0gc2VsZWN0aW9uLmV4dGVudC55ICsgMTtcbiAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgc2l6ZTsgcisrKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRpID0gciArIHRvcDtcbiAgICAgICAgICAgICAgICBpZiAoIXNldFt0aV0pIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2godGkpO1xuICAgICAgICAgICAgICAgICAgICBzZXRbdGldID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXN1bHQuc29ydChmdW5jdGlvbih4LCB5KSB7XG4gICAgICAgICAgICByZXR1cm4geCAtIHk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHBhcmFtIG9mZnNldFxuICAgICAqL1xuICAgIHNlbGVjdFJvd3NGcm9tQ2VsbHM6IGZ1bmN0aW9uKG9mZnNldCkge1xuICAgICAgICBvZmZzZXQgPSBvZmZzZXQgfHwgMDtcblxuICAgICAgICB2YXIgc20gPSB0aGlzLnJvd1NlbGVjdGlvbk1vZGVsO1xuICAgICAgICB0aGlzLmFsbFJvd3NTZWxlY3RlZCA9IGZhbHNlO1xuICAgICAgICBzbS5jbGVhcigpO1xuXG4gICAgICAgIHRoaXMuc2VsZWN0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgdmFyIHRvcCA9IHNlbGVjdGlvbi5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICBzaXplID0gc2VsZWN0aW9uLmV4dGVudC55O1xuICAgICAgICAgICAgc20uc2VsZWN0KHRvcCArIG9mZnNldCwgdG9wICsgc2l6ZSArIG9mZnNldCk7XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHBhcmFtIG9mZnNldFxuICAgICAqL1xuICAgIHNlbGVjdENvbHVtbnNGcm9tQ2VsbHM6IGZ1bmN0aW9uKG9mZnNldCkge1xuICAgICAgICBvZmZzZXQgPSBvZmZzZXQgfHwgMDtcblxuICAgICAgICB2YXIgc20gPSB0aGlzLmNvbHVtblNlbGVjdGlvbk1vZGVsO1xuICAgICAgICBzbS5jbGVhcigpO1xuX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AgICAgICAgdmFyIG1pblkgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB2YXIgbWF4WCA9IG1pblggKyByZWN0LmV4dGVudC54O1xuICAgICAgICB2YXIgbWF4WSA9IG1pblkgKyByZWN0LmV4dGVudC55O1xuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC54IDwgMCkge1xuICAgICAgICAgICAgbWluWCA9IG1heFg7XG4gICAgICAgICAgICBtYXhYID0gcmVjdC5vcmlnaW4ueDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWN0LmV4dGVudC55IDwgMCkge1xuICAgICAgICAgICAgbWluWSA9IG1heFk7XG4gICAgICAgICAgICBtYXhZID0gcmVjdC5vcmlnaW4ueTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZXN1bHQgPVxuICAgICAgICAgICAgeCA+PSBtaW5YICYmXG4gICAgICAgICAgICB5ID49IG1pblkgJiZcbiAgICAgICAgICAgIHggPD0gbWF4WCAmJlxuICAgICAgICAgICAgeSA8PSBtYXhZO1xuXG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxufTtcblxubW9kdWxlLmV4cG9ydHMgPSBTZWxlY3Rpb25Nb2RlbDtcbiIsIi8qIGVzbGludC1lbnYgYnJvd3NlciAqL1xuXG4ndXNlIHN0cmljdCc7XG5cbnZhciBfID0gcmVxdWlyZSgnb2JqZWN0LWl0ZXJhdG9ycycpO1xudmFyIEJhc2UgPSByZXF1aXJlKCdleHRlbmQtbWUnKS5CYXNlO1xuXG52YXIgQ29sdW1uID0gcmVxdWlyZSgnLi9Db2x1bW4nKTtcbnZhciBpbWFnZXMgPSByZXF1aXJlKCcuL2ltYWdlcycpO1xudmFyIENlbGxQcm92aWRlciA9IHJlcXVpcmUoJy4uL0NlbGxQcm92aWRlcicpO1xuXG52YXIgbm9FeHBvcnRQcm9wZXJ0aWVzID0gW1xuICAgICdjb2x1bW5IZWFkZXInLFxuICAgICdjb2x1bW5IZWFkZXJDb2x1bW5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RTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9udCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5jb2x1bW5IZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlckNvbHVtblNlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy5jb2x1bW5IZWFkZXIsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnJvd0hlYWRlclJvd1NlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy5yb3dIZWFkZXIsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFJvd1NlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmZpbHRlclByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJTdHlsZToge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGU7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclN0eWxlID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNlbGxCb3JkZXJUaGlja25lc3M6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ2VsbEJvcmRlclRoaWNrbmVzcztcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnRyZWVDb2x1bW5Qcm9wZXJ0aWVzID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb250OiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXNDb2x1bW5TZWxlY3Rpb24gPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZENvbHVtblNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIHByb3BlcnRpZXM7XG4gICAgfSxcblxuICAgIGdldENvbHVtbldpZHRoOiBmdW5jdGlvbih4KSB7XG4gICAgICAgIHZhciBjb2wgPSB0aGl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HZhciBpID0gMDsgaSA8IGNvdW50OyBpKyspIHtcbiAgICAgICAgICAgIHRvdGFsID0gdG90YWwgKyB0aGlzLmdldFJvd0hlaWdodChpKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdG90YWw7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBCZWhhdmlvci5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJuIHtudW1iZXJ9IFRoZSBoZWlnaHQgaW4gcGl4ZWxzIG9mIGEgc3BlY2lmaWMgcm93IGluIHRoZSBoeXBlcmdyaWQuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHJvd051bSAtIHJvdyBpbmRleCBvZiBpbnRlcmVzdFxuICAgICAqL1xuICAgIGdldFJvd0hlaWdodDogZnVuY3Rpb24ocm93TnVtKSB7XG4gICAgICAgIHZhciB0YWJsZVN0YXRlID0gdGhpcy5nZXRQcml2YXRlU3RhdGUoKTtcbiAgICAgICAgaWYgKHRhYmxlU3RhdGUucm93SGVpZ2h0cykge1xuICAgICAgICAgICAgdmFyIG92ZXJyaWRlID0gdGFibGVTdGF0ZS5yb3dIZWlnaHRzW3Jvd051bV07XG4gICAgICAgICAgICBpZiAob3ZlcnJpZGUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gb3ZlcnJpZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RGVmYXVsdFJvd0hlaWdodCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQGRlc2MgVGhlIHZhbHVlIGlzIGxhemlseSBpbml0aWFsaXplZCBhbmQgY29tZXMgZnJvbSB0aGUgcHJvcGVydGllcyBtZWNoYW5pc20gZm9yICdgZGVmYXVsdFJvd0hlaWdodGAnLCB3aGljaCBzaG91bGQgYmUgfjIwcHguXG4gICAgICogQHJldHVybnMge251bW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NlXG4gICAgICogQG1lbWJlck9mIENlbGxFZGl0b3IucHJvdG90eXBlXG4gICAgICovXG4gICAgaXNFZGl0aW5nOiBmYWxzZSxcblxuICAgIC8qKlxuICAgICAqIHRoZSBwb2ludCB0aGF0IEkgYW0gZWRpdGluZyBhdCByaWdodCBub3dcbiAgICAgKiBAdHlwZSB7UG9pbnR9XG4gICAgICogQGRlZmF1bHQgbnVsbFxuICAgICAqIEBtZW1iZXJPZiBDZWxsRWRpdG9yLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGVkaXRvclBvaW50OiBudWxsLFxuXG4gICAgLyoqXG4gICAgICogaWYgdHJ1ZSwgY2hlY2sgdGhhdCB0aGUgZWRpdG9yIGlzIGluIHRoZSByaWdodCBsb2NhdGlvblxuICAgICAqIEB0eXBlIHtib29sZWFufVxuICAgICAqIEBkZWZhdWx0IGZhbHNlXG4gICAgICogQG1lbWJlck9mIENlbGxFZGl0b3IucHJvdG90eXBlXG4gICAgICovXG4gICAgY2hlY2tFZGl0b3JQb3NpdGlvbkZsYWc6IGZhbHNlLFxuXG4gICAgLyoqXG4gICAgICogbXkgbWFpbiBpbnB1dCBjb250cm9sXG4gICAgICogQHR5cGUge0VsZW1lbnR9XG4gICAgICogQGRlZmF1bHQgbnVsbFxuICAgICAqIEBtZW1iZXJPZiBDZWxsRWRpdG9yLnByb3RvdHlwZVxuICAgICAqL1xuICAgIGlucHV0OiBudWxsLFxuXG4gICAgLyoqXG4gICAgICogbXkgaW5zdGFuY2Ugb2YgaHlwZXJncmlkXG4gICAgICogQHR5cGUge0h5cGVyZ3JpZH1cbiAgICAgKiBAZGVmYXVsdCBudWxsXG4gICAgICogQG1lbWJlck9mIENlbGxFZGl0b3IucHJvdG90eXBlXG4gICAgICovXG4gICAgZ3JpZDogbnVsbCxcblxuICAgIC8qKlxuICAgICAqIHRoZSB2YWx1ZSBiZWZvcmUgZWRpdGluZ1xuICAgICAqIEB0eXBlIHt0eXBlfVxuICAgICAqIEBkZWZhdWx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1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBhbGlhczogJ2Nob2ljZScsXG5cbiAgICAvKipcbiAgICAgKiB0aGUgbGlzdCBvZiBpdGVtcyB0byBwaWNrIGZyb21cbiAgICAgKiBAdHlwZSB7QXJyYXl9XG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBpdGVtczogWydhJywgJ2InLCAnYyddLFxuXG4gICAgdGVtcGxhdGU6IGZ1bmN0aW9uKCkge1xuICAgICAgICAvKlxuICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9XCJlZGl0b3JcIj5cbiAgICAgICAgICAgICAgICAgICAge3sjaXRlbXN9fVxuICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiB2YWx1ZT1cInt7Ln19XCI+e3sufX08L29wdGlvbj5cbiAgICAgICAgICAgICAgICAgICAge3svaXRlbXN9fVxuICAgICAgICAgICAgICAgIDwvc2VsZWN0PlxuICAgICAgICAgICAgKi9cbiAgICB9LFxuXG4gICAgLy9ubyBldmVudHMgYXJlIGZpcmVkIHdoaWxlIHRoZSBkcm9wZG93biBpcyBvcGVuXG4gICAgLy9zZWUgaHR0cDovL2pzZmlkZGxlLm5ldC9tNHRuZHR1NC82L1xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENob2ljZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBzaG93RWRpdG9yOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLmlucHV0LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJztcbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuc2hvd0Ryb3Bkb3duKHNlbGYuaW5wdXQpO1xuICAgICAgICB9LCA1MCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDaG9pY2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sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2ltcGxlLnByb3RvdHlwZVxuICAgICAqIEBkZXNjICB0aGUgZnVuY3Rpb24gdG8gb3ZlcnJpZGUgZm9yIGluaXRpYWxpemF0aW9uXG4gICAgICovXG4gICAgaW5pdGlhbGl6ZUlucHV0OiBmdW5jdGlvbihpbnB1dCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKGUgJiYgKGUua2V5Q29kZSA9PT0gMTMgfHwgZS5rZXlDb2RlID09PSAyNyB8fCBlLmtleUNvZGUgPT09IDgpKSB7XG4gICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGlmIChlLmtleUNvZGUgPT09IDgpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbGVhclN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkucmVwYWludCgpO1xuICAgICAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLnRha2VGb2N1cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkuZmlyZVN5bnRoZXRpY0VkaXRvcktleVVwRXZlbnQoc2VsZiwgZSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdrZXlkb3duJywgZnVuY3Rpb24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AgICAgICAgICAgIGlmIChlICYmIChlLmtleUNvZGUgPT09IDEzIHx8IGUua2V5Q29kZSA9PT0gMjcpKSB7XG4gICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGlmIChlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkucmVwYWludCgpO1xuICAgICAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLnRha2VGb2N1cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNlbGYuZ2V0R3JpZCgpLmlzRmlsdGVyUm93KHNlbGYuZ2V0RWRpdG9yUG9pbnQoKS55KSkge1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2F2ZUVkaXRvclZhbHVlKCk7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX21vdmVFZGl0b3IoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLmZpcmVTeW50aGV0aWNFZGl0b3JLZXlVcEV2ZW50KHNlbGYsIGUpO1xuICAgICAgICB9KTtcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcigna2V5ZG93bicsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIHNlbGYuZ2V0R3JpZCgpLmZpcmVTeW50aGV0aWNFZGl0b3JLZXlEb3duRXZlbnQoc2VsZiwgZSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3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xuICAgICAgICB2YXIgaW1hZ2UgPSBmaWx0ZXIubGVuZ3RoID09PSAwID8gJ2ZpbHRlci1vZmYnIDogJ2ZpbHRlci1vbic7XG4gICAgICAgIHZhciBoZWFkZXIsIHNvcnRTdHJpbmc7XG4gICAgICAgIGlmIChpc0JvdGgpIHtcbiAgICAgICAgICAgIGlmICh5ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaGVhZGVyID0gdGhpcy5nZXRIZWFkZXJzKClbeF07XG4gICAgICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgICAgIGlmIChzb3J0U3RyaW5nKSB7IGhlYWRlciA9IHNvcnRTdHJpbmcgKyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVhZGVyUm93Q291bnQpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0SGVhZGVyUm93VmFsdWUoeCwgeSwgdmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGhhc0hpZXJhcmNoeUNvbHVtbikge1xuICAgICAgICAgICAgeSArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXREYXRhU291cmNlKCkuc2V0VmFsdWUoeCwgeSAtIGhlYWRlclJvd0NvdW50LCB2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5jaGFuZ2VkKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZX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W5kZXgpO1xuICAgICAgICBpZiAoIWNvbHVtblByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRDb2x1bW5Db3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmFuYWx5dGljcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9XG4gICAgICovXG4gICAgZ2V0Um93Q291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgY291bnQgPSB0aGlzLmdldERhdGFTb3VyY2UoKS5nZXRSb3dDb3VudCgpO1xuICAgICAgIC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bGljZSgwKTtcbiAgICAgICAgdmFyIGZpZWxkcyA9IHRoaXMuZ2V0RmllbGRzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZ3JvdXBCeXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIHZhciBmaWVsZCA9IGhlYWRlcnNbZ3JvdXBCeXNbaV1dO1xuICAgICAgICAgICAgZ3JvdXBzLnB1c2goe1xuICAgICAgICAgICAgICAgIGlkOiBncm91cEJ5c1tpXSxcbiAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgZmllbGQ6IGZpZWxkc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGdyb3VwcztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0QXZhaWxhYmxlR3JvdXBzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB0aGlzLnNvdXJjZS5nZXRIZWFkZXJzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy5nZXRCZWhhdmlvcigpLmNvbHVtbnM7XG4gICAgICAgIGl0ZW1zID0gaXRlbXMuZmlsdGVyKGZ1bmN0aW9uKGVhY2gpIHtcbiAgICAgICAgICAgIHJldHVybiBlYWNoLmxhYmVsICE9PSAnVHJlZSc7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gaXRlbXM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldEhpZGRlbkNvbHVtbnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgdmlzaWJsZSA9IHRoaXMuZ2V0QmVoYXZpb3IoKS5jb2x1bW5zO1xuICAgICAgICB2YXIgYWxsID0gdGhpcy5nZXRCZWhhdmlvcigpLmFsbENvbHVtbnM7XG4gICAgICAgIHZhciBoaWRkZW4gPSBbXTtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhbGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2aXNpYmxlLmluZGV4T2YoYWxsW2ldKSA9PT0gLTEpIHtcbiAgICAgICAgIC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uICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERPV05XQVJEU19CTEFDS19BUlJPVztcbiAgICAgICAgICAgIHJldHVybiByYW5rICsgYXJyb3cgKyAnICc7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IHJhbmsgKyAodXAgPyAnLXVwJyA6ICctZG93bicpO1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRCZWhhdmlvcigpLmdldEltYWdlKG5hbWUpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBjZWxsXG4gICAgICogQHBhcmFtIGV2ZW50XG4gICAgICovXG4gICAgY2VsbENsaWNrZWQ6IGZ1bmN0aW9uKGNlbGwsIGV2ZW50KSB7XG4gICAgICAgIGlmICghd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zLmdldERhdGFTb3VyY2UoKS5nZXRSb3coeSAtIGhlYWRlclJvd0NvdW50KTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEByZXR1cm5zIHtvYmplY3R9XG4gICAgICovXG4gICAgYnVpbGRSb3c6IGZ1bmN0aW9uKHkpIHtcbiAgICAgICAgdmFyIGNvbENvdW50ID0gdGhpcy5nZXRDb2x1bW5Db3VudCgpO1xuICAgICAgICB2YXIgZmllbGRzID0gW10uY29uY2F0KHRoaXMuZ2V0RmllbGRzKCkpO1xuICAgICAgICB2YXIgcmVzdWx0ID0ge307XG4gICAgICAgIGlmICh0aGlzLmhhc0FnZ3JlZ2F0ZXMoKSkge1xuICAgICAgICAgICAgcmVzdWx0LnRyZWUgPSB0aGlzLmdldFZhbHVlKC0yLCB5KTtcbiAgICAgICAgICAgIGZpZWxkcy5zaGlmdCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgcmVzdWx0W2ZpZWxkc1tpXV0gPSB0aGlzLmdldFZhbHVlKGksIHkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fVxuICAgICAqL1xuICAgIGdldENvbXB1dGVkUm93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHZhciByY2YgPSB0aGlzLmdldFJvd0NvbnRleHRGdW5jdGlvbihbeV0pO1xuICAgICAgICB2YXIgZmllbGRzID0gdGhpcy5nZXRGaWVsZHMoKTtcbiAgICAgICAgdmF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gdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIH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sdWUgZnJvbSBsYXN0IHRpbWVcbiAgICAgICAgaWYgKHggPT09IG1vdXNlUG9pbnQueCAmJiB5ID09PSBtb3VzZVBvaW50LnkpIHtcbiAgICAgICAgICAgIGdyaWQuY2xlYXJNb3N0UmVjZW50U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICBncmlkLnBvcE1vdXNlRG93bigpO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyU2VsZWN0aW9ucygpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyTW9zdFJlY2VudFNlbGVjdGlvbigpO1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QobW91c2VQb2ludC54LCBtb3VzZVBvaW50LnksIHggLSBtb3VzZVBvaW50LnggKyAxLCB5IC0gbW91c2VQb2ludC55ICsgMSk7XG4gICAgICAgICAgICBncmlkLnNldERyYWdFeHRlbnQoZ3JpZC5uZXdQb2ludCh4IC0gbW91c2VQb2ludC54ICsgMSwgeSAtIG1vdXNlUG9pbnQueSkpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QoeCwgeSwgMCwgMCk7XG4gICAgICAgICAgICBncmlkLnNldE1vdXNlRG93bihncmlkLm5ld1BvaW50KHgsIHkpKTtcbiAgICAgICAgICAgIGdyaWQuc2V0RHJhZ0V4dGVudChncmlkLm5ld1BvaW50KDAsIDApKTtcbiAgICAgICAgfVxuICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICB9LFxuXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbFNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBoYW5kbGUgdGhpcyBldm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ICAgICAgICB9XG5cbiAgICAgICAgdmFyIGlzUmlnaHRDbGljayA9IGV2ZW50LnByaW1pdGl2ZUV2ZW50LmRldGFpbC5pc1JpZ2h0Q2xpY2s7XG5cbiAgICAgICAgaWYgKGlzUmlnaHRDbGljayB8fCAhdGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgICAgIHRoaXMubmV4dC5oYW5kbGVNb3VzZURyYWcoZ3JpZCwgZXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICB2YXIgbnVtRml4ZWRDb2x1bW5zID0gZ3JpZC5nZXRGaXhlZENvbHVtbkNvdW50KCk7XG5cbiAgICAgICAgICAgIHZhciBjZWxsID0gZXZlbnQuZ3JpZENlbGw7XG4gICAgICAgICAgICB2YXIgdmlld0NlbGwgPSBldmVudC52aWV3UG9pbnQ7XG4gICAgICAgICAgICB2YXIgZHggPSBjZWxsLng7XG4gICAgICAgICAgICB2YXIgZHkgPSBjZWxsLnk7XG5cbiAgICAgICAgICAgIC8vaWYgd2UgYXJlIGluIHRoZSBmaXhlZCBhcmVhIGRvIG5vdCBhcHBseSB0aGUgc2Nyb2xsIHZhbHVlc1xuICAgICAgICAgICAgLy9jaGVjayBib3RoIHggYW5kIHkgdmFsdWVzIGluZGVwZW5kZW50bHlcbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC54IDwgbnVtRml4ZWRDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgZHggPSB2aWV3Q2VsbC54O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudERyYWcgPSBwcmltRXZlbnQuZGV0YWlsLm1vdXNlO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IoZ3JpZCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2MgcmV0dXJucyB0cnVlIGlmIHRoZSBjb2x1bW4gcGlja2VyIGlzIG9wZW5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn1cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqL1xuICAgIGlzQ29sdW1uUGlja2VyT3BlbjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICByZXR1cm4gdGhpcy5vdmVybGF5LnN0eWxlLmRpc3BsYXkgIT09ICdub25lJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2Mgb3BlbiB0aGUgY29sdW1uIHBpY2tlclxuICAgICAqICMjIyMgcmV0dXJuczogdHlwZVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICovXG4gICAgb3BlbkNvbHVtblBpY2tlcjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5pc0NvbHVtblBpY2tlck9wZW4oKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMub3BlbkVkaXRvciA9IHRydWU7XG4gICAgICAgIGlmIChncmlkLmdldEJlaGF2aW9yKCkub3BlbkVkaXRvcih0aGlzLm92ZXJsYXkpID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYmFja2dyb3VuZENvbG9yID0gZ3JpZC5yZXNvbHZlUHJvcGVydHkoJ2JhY2tncm91bmRDb2xvcicpO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS50b3AgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUucmlnaHQgPSAnMCUnO1xuICAgICAgICB0aGlzLm92ZXJsYXkuc3R5bGUuYm90dG9tID0gJzAlJztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLmxlZnQgPSAnMCUnO1xuXG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5Ub3AgPSAnMTVweCc7XG4gICAgICAgIHRoaXMub3ZlcmxheS5zdHlsZS5tYXJnaW5SaWdodCA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkJvdHRvbSA9ICczNXB4JztcbiAgICAgICAgdGhpcy5vdmVybGF5LnN0eWxlLm1hcmdpbkxlZnQgPSAnMTVweCc7XG5cbiAgICAgICAgc2VsZi5vdmVybGF5LnN0eWxlLmRpc3BsYXkgPSAnJztcblxuXG4gICAgICAgIGlmICghdGhpcy5fY2xvc2VyKSB7XG4gICAgICAgICAgICB0aGlzLl9jbG9zZXIgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IHNlbGYuZ2V0Q2hhckZvcihncmlkLCBlLmtleUNvZGUpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgdmFyIGtleXMgPSBncmlkLnJlc29sdmVQcm9wZXJ0eSgnZWRpdG9yQWN0aXZhdGlvbktleXMnKTtcbiAgICAgICAgICAgICAgICBpZiAoa2V5cy5pbmRleE9mKGtleSkgPiAtMSB8fCBlLmtleUNvZGUgPT09IDI3KSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jbG9zZUNvbHVtblBpY2tlcihncmlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy9ncmlkLnNldEZvY3VzYWJsZShmY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GZhbHNlLFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJvd1NlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBIYW5kbGUgdGhpcyBldmVudCBkb3duIHRoZSBmZWF0dXJlIGNoYWluIG9mIHJlc3BvbnNpYmlsaXR5LlxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5kcmFnQXJtZWQpIHtcbiAgICAgICAgICAgIHRoaXMuZHJhZ0FybWVkID0gZmFsc2U7XG4gICAgICAgICAgICAvL2dsb2JhbCByb3cgc2VsZWN0aW9uXG4gICAgICAgICAgICBpZiAoZXZlbnQuZ3JpZENlbGwueCA9PT0gLTEgJiYgZXZlbnQuZ3JpZENlbGwueSA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGdyaWQudG9nZ2xlU2VsZWN0QWxsUm93cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZ3JpZC5maXJlU3ludGhldGljUm93U2VsZWN0aW9uQ2hhbmdlZEV2ZW50KCk7XG4gICAgICAgIH0gZWxzZSBpZiAodGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgZ3JpZC5maXJlU3ludGhldGljUm93U2VsZWN0aW9uQ2hhbmdlZEV2ZW50KCk7XG4gICAgICAgIH0gZWxzZSBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJvd1NlbGVjdGlvbi5wcm90b3R5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gY3NzSW5qZWN0b3IgPSByZXF1aXJlKCdjc3MtaW5qZWN0b3InKTtcblxudmFyIHN0eWxlc2hlZXRzID0ge1xuICAgIGdyaWQ6IFtcbiAgICAgICAgJ2RpdiNncmlkLWNvbnRhaW5lciB7JyxcbiAgICAgICAgJyAgICBwb3NpdGlvbjogcmVsYXRpdmU7JyxcbiAgICAgICAgJyAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7JyxcbiAgICAgICAgJyAgICAtd2Via2l0LXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgLW1vei11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1tcy11c2VyLXNlbGVjdDogbm9uZTsnLFxuICAgICAgICAnICAgIC1vLXVzZXItc2VsZWN0OiBub25lOycsXG4gICAgICAgICcgICAgdXNlci1zZWxlY3Q6IG5vbmU7JyxcbiAgICAgICAgJyAgICBvdmVyZmxvdzogaGlkZGVuOyB9JyxcbiAgICAgICAgJ3Zpc2libGUgeyBvcGFjaXR5OiAwLjc1OyB9JyxcbiAgICAgICAgJ2hpZGRlbiB7IG9wYWNpdHk6IDAuMDsgfScsXG4gICAgICAgICdlZGl0b3IgeycsXG4gICAgICAgICcgICAgcG9zaXRpb246IGFic29sdXRlOycsXG4gICAgICAgICcgICAgZGlzcGxheTogbm9uZTsnLFxuICAgICAgICAnICAgIGJvcmRlcjogc29saWQgMnB4IGJsYWNrOycsXG4gICAgICAgICcgICAgb3V0bGluZTogMDsnLFxuICAgICAgICAnICAgIHBhZGRpbmc6IDA7JyxcbiAgICAgICAgJyAgICB6LWluZGV4OiAxMDAwOyB9J1xuICAgIF0sXG4gICAgJ2xpc3QtZHJhZ29uJzogW1xuICAgICAgICAnZGl2LmRyYWdvbi1saXN0LCBsaS5kcmFnb24tcG9wIHsnLFxuICAgICAgICAnICAgIGZvbnQtZmFtaWx5OiBSb2JvdG8sIHNhbnMtc2VyaWY7JyxcbiAgICAgICAgJyAgICB0ZXh0L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sb2FkIG11c3QgYmUgb2JqZWN0Lic7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBleHRlbmRlZENsYXNzTmFtZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dGVuZGVkQ2xhc3NOYW1lICE9PSAnc3RyaW5nJyB8fCB0eXBlb2YgcHJvdG90eXBlQWRkaXRpb25zICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIHRocm93ICdUd28gcGFyYW1ldGVyIG92ZXJsb2FkIG11c3QgYmUgc3RyaW5nLCBvYmplY3QuJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgJ1RvbyBtYW55IHBhcmFtZXRlcnMnO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIENvbnN0cnVjdG9yKCkge1xuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnByZUluaXRpYWxpemUpIHtcbiAgICAgICAgICAgIHByb3RvdHlwZUFkZGl0aW9ucy5wcmVJbml0aWFsaXplLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgIH1cblxuICAgICAgICBpbml0aWFsaXplUHJvdG90eXBlQ2hhaW4uYXBwbHkodGhpcywgYXJndW1lbnRzKTtcblxuICAgICAgICBpZiAocHJvdG90eXBlQWRkaXRpb25zLnBvc3RJbml0aWFsaXplKSB7XG4gICAgICAgICAgICBwcm90b3R5cGVBZGRpdGlvbnMucG9zdEluaXRpYWxpemUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIENvbnN0cnVjdG9yLmV4dGVuZCA9IGV4dGVuZDtcblxuICAgIHZhciBwcm90b3R5cGUgPSBDb25zdHJ1Y3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHRoaXMucHJvdG90eXBlKTtcbiAgICBwcm90b3R5cGUuY29uc3RydWN0b3IgPSBDb25zdHJ1Y3RvcjtcblxuICAgIGlmIChleHRlbmRlZENsYXNzTmFtZSAmJiBleHRlbmQuZGVidWcpIHtcbiAgICAgICAgcHJvdG90eXBlLiQkQ0xBU1NfTkFNRSA9IGV4dGVuZGVkQ2xhc3NOYW1lO1xuICAgIH1cblxuICAgIGZvciAodmFyIGtleSBpbiBwcm90b3R5cGVBZGRpdGlvbnMpIHtcbiAgICAgICAgaWYgKHByb3RvdHlwZUFkZGl0aW9ucy5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBwcm90b3R5cGVBZGRpdGlvbnNba2V5XTtcbiAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSAnaW5pdGlhbGl6ZU93bic6XG4gICAgICAgICAgICAgICAgICAgIC8vIGFscmVhZHkgY2FsbGVkIGFib3ZlOyBub3QgbmVlZGVkIGluIHByb3RvdHlwZVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlICdhbGlhc2VzJzpcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYWxpYXMgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5oYXNPd25Qcm9wZXJ0eShhbGlhcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlQWxpYXModmFsdWVbYWxpYXNdLCBhbGlhcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycgJiYgdmFsdWVbMF0gPT09ICc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iAgICB0aGlzLm9yaWVudGF0aW9uID0gJ3ZlcnRpY2FsJztcbiAgICB0aGlzLl9taW4gPSB0aGlzLl9pbmRleCA9IDA7XG4gICAgdGhpcy5fbWF4ID0gMTAwO1xuXG4gICAgLy8gb3B0aW9uc1xuICAgIGZvciAodmFyIGtleSBpbiBvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgIHZhciBvcHRpb24gPSBvcHRpb25zW2tleV07XG4gICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuXG4gICAgICAgICAgICBjYXNlICdpbmRleCc6XG4gICAgICAgICAgICAgICAgdGhpcy5faW5kZXggPSBvcHRpb247XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJ3JhbmdlJzpcbiAgICAgICAgICAgICAgICB2YWxpZFJhbmdlKG9wdGlvbik7XG4gICAgICAgICAgICAgICAgdGhpcy5fbWluID0gb3B0aW9uLm1pbjtcbiAgICAgICAgICAgICAgICB0aGlzLl9tYXggPSBvcHRpb24ubWF4O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSBvcHRpb24ubWF4IC0gb3B0aW9uLm1pbiArIDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgICAgICBrZXkuY2hhckF0KDApICE9PSAnXycgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIEZpbkJhci5wcm90b3R5cGVba2V5XSAhPT0gJ2Z1bmN0aW9uJ1xuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAvLyBvdmVycmlkZSBwcm90b3R5cGUgZGVmYXVsdHMgZm9yIHN0YW5kYXJkIDtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXh0ZW5kIHdpdGggYWRkaXRpb25h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ICAgICAgICBiYXJSZWN0ID0gYmFyLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IHRoaXMuY29udGFpbmVyIHx8IGJhci5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgICAgIGNvbnRhaW5lclJlY3QgPSBjb250YWluZXIuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksXG4gICAgICAgICAgICAgICAgb2ggPSB0aGlzLm9oO1xuXG4gICAgICAgICAgICAvLyBCZWZvcmUgYXBwbHlpbmcgbmV3IHN0eWxlcywgcmV2ZXJ0IGFsbCBzdHlsZXMgdG8gdmFsdWVzIGluaGVyaXRlZCBmcm9tIHN0eWxlc2hlZXRzXG4gICAgICAgICAgICBiYXIucmVtb3ZlQXR0cmlidXRlKCdzdHlsZScpO1xuXG4gICAgICAgICAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIHZhciB2YWwgPSBzdHlsZXNba2V5XTtcblxuICAgICAgICAgICAgICAgIGlmIChrZXkgaW4gb2gpIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gb2hba2V5XTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKE51bWJlcih2YWwpKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHx8IDApICsgJ3B4JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC8lJC8udGVzdCh2YWwpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdoZW4gYmFyIHNpemUgZ2l2ZW4gYXMgcGVyY2VudGFnZSBvZiBjb250YWluZXIsIGlmIGJhciBoYXMgbWFyZ2lucywgcmVzdGF0ZSBzaXplIGluIHBpeGVscyBsZXNzIG1hcmdpbnMuXG4gICAgICAgICAgICAgICAgICAgIC8vIChJZiBsZWZ0IGFzIHBlcmNlbnRhZ2UsIENTUydzIGNhbG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NvbnRhaW5lciA9IHRoaXMuY29udGFpbmVyIHx8IGJhci5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgY29udGFpbmVyUmVjdCA9IGNvbnRhaW5lci5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgICAvLyBzaGlmdCBhcmdzIGlmIGlmIDFzdCBhcmcgb21pdHRlZFxuICAgICAgICBpZiAodHlwZW9mIGluY3JlbWVudCA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgIGJhclN0eWxlcyA9IGluY3JlbWVudDtcbiAgICAgICAgICAgIGluY3JlbWVudCA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuc3R5bGUgPSB0aGlzLmJhclN0eWxlcyA9IGJhclN0eWxlcyB8fCB0aGlzLmJhclN0eWxlcztcblxuICAgICAgICAvLyBCb3VuZCB0byByZWFsIGNvbnRlbnQ6IENvbnRlbnQgd2FzIGdpdmVuIGJ1dCBubyBvbmNoYW5nZSBoYW5kbGVyLlxuICAgICAgICAvLyBTZXQgdXAgLm9uY2hhbmdlLCAuY29udGFpbmVyU2l6ZSwgYW5kIC5pbmNyZW1lbnQuXG4gICAgICAgIC8vIE5vdGUgdGhpcyBvbmx5IG1ha2VzIHNlbnNlIGlmIHlvdXIgaW5kZXggdW5pdCBpcyBwaXhlbHMuXG4gICAgICAgIGlmICh0aGlzLmNvbnRlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5vbmNoYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMub25jaGFuZ2UgPSB0aGlzLnNjcm9sbFJlYWxDb250ZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGVudFNpemUgPSB0aGlzLmNvbnRlbnRbdGhpcy5vaC5zaXplXTtcbiAgICAgICAgICAgICAgICB0aGlzLl9taW4gPSAwO1xuICAgICAgICAgICAgICAgIHRoaXMuX21heCA9IHRoaXMuY29udGVudFNpemUgLSAxO1xuICAgICAgIC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cmVtb3ZlRXZ0KCdtb3VzZXVwJyk7XG5cbiAgICAgICAgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnN0eWxlLmN1cnNvciA9ICdhdXRvJztcblxuICAgICAgICB2YXIgdGh1bWJCb3ggPSB0aGlzLnRodW1iLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpO1xuICAgICAgICBpZiAoXG4gICAgICAgICAgICB0aHVtYkJveC5sZWZ0IDw9IGV2dC5jbGllbnRYICYmIGV2dC5jbGllbnRYIDw9IHRodW1iQm94LnJpZ2h0ICYmXG4gICAgICAgICAgICB0aHVtYkJveC50b3AgPD0gZXZ0LmNsaWVudFkgJiYgZXZ0LmNsaWVudFkgPD0gdGh1bWJCb3guYm90dG9tXG4gICAgICAgICkge1xuICAgICAgICAgICAgdGhpcy5fYm91bmQub25tb3VzZW92ZXIoZXZ0KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX2JvdW5kLm9ubW91c2VvdXQoZXZ0KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV2dC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgfVxufTtcblxudmFyIG9yaWVudGF0aW9uSGFzaGVzID0ge1xuICAgIHZlcnRpY2FsOiB7XG4gICAgICAgIGNvb3JkaW5hdGU6ICAgICAnY2xpZW50WScsXG4gICAgICAgIGF4aXM6ICAgICAgICAgICAncGFnZVknLFxuICAgICAgICBzaXplOiAgICAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgIG91dHNpZGU6ICAgICAgICAncmlnaHQnLFxuICAgICAgICBpbnNpZGU6ICAgICAgICAgJ2xlZnQnLFxuICAgICAgICBsZWFkaW5nOiAgICAgICAgJ3RvcCcsXG4gICAgICAgIHRyYWlsaW5nOiAgICAgICAnYm90dG9tJyxcbiAgICAgICAgbWFyZ2luTGVhZGluZzogICdtYXJnaW5Ub3AnLFxuICAgICAgICBtYXJnaW5UcmFpbGluZzogJ21hcmdpbkJvdHRvbScsXG4gICAgICAgIHRoaWNrbmVzczogICAgICAnd2lkdGgnLFxuICAgICAgICBkZWx0YTogICAgICAgICAgJ2RlbHRhWSdcbiAgICB9LFxuICAgIGhvcml6b250YWw6IHtcbiAgICAgICAgY29vcmRpbmF0ZTogICAgICdjbGllbnRYJyxcbiAgICAgICAgYXhpczogICAgICAgICAgICdwYWdlWCcsXG4gICAgICAgIHNpemU6ICAgICAgICAgICAnd2lkdGgnLFxuICAgICAgICBvdXRzaWRlOiAgICAgICAgJ2JvdHRvbScsXG4gICAgICAgIGluc2lkZTogICAgICAgICAndG9wJyxcbiAgICAgICAgbGVhZGluZzogICAgICAgICdsZWZ0JyxcbiAgICAgICAgdHJhaWxpbmc6ICAgICAgICdyaWdodCcsXG4gICAgICAgIG1hcmdpbkxlYWRpbmc6ICAnbWFyZ2luTGVmdCcsXG4gICAgICAgIG1hcmdpblRyYWlsaW5nOiAnbWFyZ2luUmlnaHQnLFxuICAgICAgICB0aGlja25lc3M6ICAgICAgJ2hlaWdodCcsXG4gICAgICAgIGRlbHRhOiAgICAgICAgICAnZGVsdGFYJ1xuICAgIH1cbn07XG5cbnZhciBheGlzID0ge1xuICAgIHRvcDogICAgJ3ZlcnRpY2FsJyxcbiAgICBib3R0b206ICd2ZXJ0aWNhbCcsXG4gICAgaGVpZ2h0OiAndmVydGljYWwnLFxuICAgIGxlZnQ6ICAgJ2hvcml6b250YWwnLFxuICAgIHJpZ2h0OiAgJ2hvcml6b250YWwnLFxuICAgIHdpZHRoOiAgJ2hvcml6b250YWwnXG59O1xuXG52YXIgY3NzRmluQmFyczsgLy8gZGVmaW5pdGlvbiBpbnNlcnRlZCBieSBndWxwZmlsZSBiZXR3ZWVuIGZvbGxvd2luZyBjb21tZW50c1xuLyogaW5qZWN0OmNzcyAqL1xuY3NzRmluQmFycyA9ICdkaXYuZmluYmFyLWhvcml6b250YWwsZGl2LmZpbmJhci12ZXJ0aWN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mxhc3RSZXBhaW50VGltZSA9IG5vdyAtIChlbGFwc2VkICUgaW50ZXJ2YWwpO1xuICAgICAgICAgICAgdGhpcy5wYWludE5vdygpO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIGJlZ2luUGFpbnRpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMuZGlydHkgPSB0cnVlO1xuICAgICAgICB0aGlzLnRpY2tQYWludGVyID0gZnVuY3Rpb24obm93KSB7XG4gICAgICAgICAgICBzZWxmLnRpY2tQYWludChub3cpO1xuICAgICAgICB9O1xuICAgICAgICBwYWludGFibGVzLnB1c2godGhpcyk7XG4gICAgfSxcblxuICAgIHN0b3BQYWludGluZzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHBhaW50YWJsZXMuc3BsaWNlKHBhaW50YWJsZXMuaW5kZXhPZih0aGlzKSwgMSk7XG4gICAgfSxcblxuICAgIGJlZ2luUmVzaXppbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMudGlja1Jlc2l6ZXIgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHNlbGYuY2hlY2tzaXplKCk7XG4gICAgICAgIH07XG4gICAgICAgIHJlc2l6YWJsZXMucHVzaCh0aGlzKTtcbiAgICB9LFxuXG4gICAgc3RvcFJlc2l6aW5nOiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmVzaXphYmxlcy5zcGxpY2UocmVzaXphYmxlcy5pbmRleE9mKHRoaXMpLCAxKTtcbiAgICB9LFxuXG4gICAgc3RhcnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmJlZ2luUGFpbnRpbmcoKTtcbiAgICAgICAgdGhpcy5iZWdpblJlc2l6aW5nKCk7XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLnN0b3BQYWludGluZygp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GlvbiA9IHRoaXMuZ2V0TG9jYWwoZSk7XG4gICAgICAgIHRoaXMubGFzdERvdWJsZUNsaWNrVGltZSA9IERhdGUubm93KCk7XG4gICAgICAgIHRoaXMuZGlzcGF0Y2hOZXdNb3VzZUtleXNFdmVudChlLCAnZmluLWNhbnZhcy1kYmxjbGljaycsIHtcbiAgICAgICAgICAgIGlzUmlnaHRDbGljazogdGhpcy5pc1JpZ2h0Q2xpY2soZSlcbiAgICAgICAgfSk7XG4gICAgICAgIC8vY29uc29sZS5sb2coJ2RibGNsaWNrJywgdGhpcy5jdXJyZW50S2V5cyk7XG4gICAgfSxcblxuICAgIGdldENoYXJNYXA6IGZ1bmN0aW9uKCkgeyAvL1RPRE86IFRoaXMgaXMgc3RhdGljLiBNYWtlIGl0IGEgcHJvcGVydHkgb2YgdGhlIGNvbnN0cnVjdG9yLlxuICAgICAgICByZXR1cm4gY2hhck1hcDtcbiAgICB9LFxuXG4gICAgZmlua2V5ZG93bjogZnVuY3Rpb24oZSkge1xuICAgICAgICBpZiAoIXRoaXMuaGFzRm9jdXMoKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgLy9lLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNoYXJNYXBbZS5rZXlDb2RlXVsxXSA6IGNoYXJNYXBbZS5rZXlDb2RlXVswXTtcbiAgICAgICAgaWYgKGUucmVwZWF0KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5yZXBlYXRLZXkgPT09IGtleUNoYXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50Kys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5ID0ga2V5Q2hhcjtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnJlcGVhdEtleUNvdW50ID0gMDtcbiAgICAgICAgICAgIHRoaXMucmVwZWF0S2V5U3RhcnRUaW1lID0gMDtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5jdXJyZW50S2V5cy5pbmRleE9mKGtleUNoYXIpID09PSAtMSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50S2V5cy5wdXNoKGtleUNoYXIpO1xuICAgICAgICB9XG4gICAgICAgIC8vY29uc29sZS5sb2coa2V5Q2hhciwgZS5rZXlDb2RlKTtcbiAgICAgICAgdGhpcy5kaXNwYXRjaE5ld0V2ZW50KGUsICdmaW4tY2FudmFzLWtleWRvd24nLCB7XG4gICAgICAgICAgICBhbHQ6IGUuYWx0S2V5LFxuICAgICAgICAgICAgY3RybDogZS5jdHJsS2V5LFxuICAgICAgICAgICAgY2hhcjoga2V5Q2hhcixcbiAgICAgICAgICAgIGNvZGU6IGUuY2hhckNvZGUsXG4gICAgICAgICAgICBrZXk6IGUua2V5Q29kZSxcbiAgICAgICAgICAgIG1ldGE6IGUubWV0YUtleSxcbiAgICAgICAgICAgIHJlcGVhdENvdW50OiB0aGlzLnJlcGVhdEtleUNvdW50LFxuICAgICAgICAgICAgcmVwZWF0U3RhcnRUaW1lOiB0aGlzLnJlcGVhdEtleVN0YXJ0VGltZSxcbiAgICAgICAgICAgIHNoaWZ0OiBlLnNoaWZ0S2V5LFxuICAgICAgICAgICAgaWRlbnRpZmllcjogZS5rZXlJZGVudGlmaWVyLFxuICAgICAgICAgICAgY3VycmVudEtleXM6IHRoaXMuY3VycmVudEtleXMuc2xpY2UoMClcbiAgICAgICAgfSk7XG4gICAgfSxcblxuICAgIGZpbmtleXVwOiBmdW5jdGlvbihlKSB7XG4gICAgICAgIHZhciBrZXlDaGFyID0gZS5zaGlmdEtleSA/IGNo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ud2hpY2ggPT09IDM7XG4gICAgICAgIH0gZWxzZSBpZiAoJ2J1dHRvbicgaW4gZSkgeyAvLyBJRSwgT3BlcmFcbiAgICAgICAgICAgIGlzUmlnaHRNQiA9IGUuYnV0dG9uID09PSAyO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBpc1JpZ2h0TUI7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXZlbnQ6IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgfVxufTtcblxuZnVuY3Rpb24gcGFpbnRMb29wRnVuY3Rpb24obm93KSB7XG4gICAgaWYgKCFwYWludExvb3BSdW5uaW5nKSB7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBwYWludGFibGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwYWludGFibGVzW2ldLnRpY2tQYWludGVyKG5vdyk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKHBhaW50TG9vcEZ1bmN0aW9uKTtcbn1cbnJlcXVlc3RBbmltYXRpb25GcmFtZShwYWludExvb3BGdW5jdGlvbik7XG5cbmZ1bmN0aW9uIHJlc2l6YWJsZXNMb29wRnVuY3Rpb24obm93KSB7XG4gICAgaWYgKCFyZXNpemVMb29wUnVubmluZykge1xuICAgICAgICByZXR1cm47XG4gICAgfVxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcmVzaXphYmxlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzaXphYmxlc1tpXS50aWNrUmVzaXplcihub3cpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICA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ywgYXJndW1lbnRzKSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHNlbGYsIGtleSwge1xuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBnY1trZXldO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9nZ2VyID8gbG9nZ2VyKGtleSwgJ2dldHRlcicsIHJlc3VsdCkgOiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGdjW2tleV0gPSBsb2dnZXIgPyBsb2dnZXIoa2V5LCAnc2V0dGVyJywgdmFsdWUpIDogdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gR3JhcGhpY3NDb250ZXh0O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgWUlFTERTID0gJ1xcdTI3RjknOyAvLyBMT05HIFJJR0hUV0FSRFMgRE9VQkxFIEFSUk9XXG5cbmZ1bmN0aW9uIGNvbnNvbGVMb2dnZXIocHJlZml4LCBuYW1lLCBhcmdzLCB2YWx1ZSkge1xuICAgIHZhciByZXN1bHQgPSB2YWx1ZTtcblxuICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgIHJlc3VsdCA9ICdcIicgKyByZXN1bHQgKyAnXCInO1xuICAgIH1cblxuICAgIG5hbWUgPSBwcmVmaXggKyBuYW1lO1xuXG4gICAgc3dpdGNoIChhcmdzKSB7XG4gICAgICAgIGNhc2UgJ2dldHRlcic6XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhuYW1lLCAnPScsIHJlc3VsdCk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ICAgICAgdmFyIG9zID0gc2hhZG93Lm9sZGVyU2hhZG93Um9vdDtcbiAgICAgICAgICAgIGlmICghb3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2UgPSBzaGFkb3cucXVlcnlTZWxlY3Rvcignc2hhZG93Jyk7XG4gICAgICAgICAgICAgICAgaWYgKHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9zID0gc2Uub2xkZXJTaGFkb3dSb290O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBvcztcbiAgICAgICAgfSxcbiAgICAgICAgYWxsU2hhZG93czogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIHNoYWRvd3MgPSBbXSxcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5zaGFkb3coZWxlbWVudCk7XG4gICAgICAgICAgICB3aGlsZSAocykge1xuICAgICAgICAgICAgICAgIHNoYWRvd3MucHVzaChzKTtcbiAgICAgICAgICAgICAgICBzID0gdGhpcy5vbGRlclNoYWRvdyhzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBzaGFkb3dzO1xuICAgICAgICB9LFxuICAgICAgICBzZWFyY2hSb290OiBmdW5jdGlvbihpblJvb3QsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciB0LCBzdCwgc3IsIG9zO1xuICAgICAgICAgICAgaWYgKGluUm9vdCkge1xuICAgICAgICAgICAgICAgIHQgPSBpblJvb3QuZWxlbWVudEZyb21Qb2ludCh4LCB5KTtcbiAgICAgICAgICAgICAgICBpZiAodCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmb3VuZCBlbGVtZW50LCBjaGVjayBpZiBpdCBoYXMgYSBTaGFkb3dSb290XG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy50YXJnZXRpbmdTaGFkb3codCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpblJvb3QgIT09IGRvY3VtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGZvciBzaWJsaW5nIHJvb3RzXG4gICAgICAgICAgICAgICAgICAgIHNyID0gdGhpcy5vbGRlclNoYWRvdyhpblJvb3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBzZWFyY2ggb3RoZXIgcm9vdHMsIGZhbGwgYmFjayB0byBsaWdodCBkb20gZWxlbWVudFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlYXJjaFJvb3Qoc3IsIHgsIHkpIHx8IHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIG93bmVyOiBmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcyA9IGVsZW1lbnQ7XG4gICAgICAgICAgICAvLyB3YWxrIHVwIHVudGlsIHlvdSBoaXQgdGhlIHNoYWRvdyByb290IG9yIGRvY3VtZW50XG4gICAgICAgICAgICB3aGlsZSAocy5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgcyA9IHMucGFyZW50Tm9kZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHRoZSBvd25lciBlbGVtZW50IGlzIGV4cGVjdGVkIHRvIGJlIGEgRG9jdW1lbnQgb3IgU2hhZG93Um9vdFxuICAgICAgICAgICAgaWYgKHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9OT0RFICYmIHMubm9kZVR5cGUgIT0gTm9kZS5ET0NVTUVOVF9GUkFHTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHM7XG4gICAgICAgIH0sXG4gICAgICAgIGZpbmRUYXJnZXQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbkV2ZW50LnBhdGhbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICB5ID0gaW5FdmVudC5jbGllbnRZO1xuICAgICAgICAgICAgLy8gaWYgdGhlIGxpc3RlbmVyIGlzIGluIHRoZSBzaGFkb3cgcm9vdCwgaXQgaXMgbXVjaCBmYXN0ZXIgdG8gc3RhcnQgdGhlcmVcbiAgICAgICAgICAgIHZhciBzID0gdGhpcy5vd25lcihpbkV2ZW50LnRhcmdldCk7XG4gICAgICAgICAgICAvLyBpZiB4LCB5IGlzIG5vdCBpbiB0aGlzIHJvb3QsIGZhbGwgYmFjayB0byBkb2N1bWVudCBzZWFyY2hcbiAgICAgICAgICAgIGlmICghcy5lbGVtZW50RnJvbVBvaW50KHgsIHkpKSB7XG4gICAgICAgICAgICAgICAgcyA9IGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhcmNoUm9vdChzLCB4LCB5KTtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoQWN0aW9uOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbjtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBpbkV2ZW50LnBhdGggJiYgaW5FdmVudC5wYXRoLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhciBwYXRoID0gaW5FdmVudC5wYXRoO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGF0aC5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBuID0gcGF0aFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4ubm9kZVR5cGUgPT09IE5vZGUuRUxFTUVOVF9OT0RFICYmIG4uaGFzQXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZ2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbiA9IGluRXZlbnQudGFyZ2V0O1xuICAgICAgICAgICAgICAgIHdoaWxlIChuKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuLm5vZGVUeXBlID09PSBOb2RlLkVMRU1FTlRfTk9ERSAmJiBuLmhhc0F0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmdldEF0dHJpYnV0ZSgndG91Y2gtYWN0aW9uJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gYXV0byBpcyBkZWZhdWx0XG4gICAgICAgICAgICByZXR1cm4gXCJhdXRvXCI7XG4gICAgICAgIH0sXG4gICAgICAgIExDQTogZnVuY3Rpb24oYSwgYikge1xuICAgICAgICAgICAgaWYgKGEgPT09IGIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhICYmICFiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYiAmJiAhYSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFiICYmICFhKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gZmFzdCBjYXNlLCBhIGlzIGEgZGlyZWN0IGRlc2NlbmRhbnQgb2YgYiBvciB2aWNlIHZlcnNhXG4gICAgICAgICAgICBpZiAoYS5jb250YWlucyAmJiBhLmNvbnRhaW5zKGIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYi5jb250YWlucyAmJiBiLmNvbnRhaW5zKGEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgYWRlcHRoID0gdGhpcy5kZXB0aChhKTtcbiAgICAgICAgICAgIHZhciBiZGVwdGggPSB0aGlzLmRlcHRoKGIpO1xuICAgICAgICAgICAgdmFyIGQgPSBhZGVwdGggLSBiZGVwdGg7XG4gICAgICAgICAgICBpZiAoZCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgYSA9IHRoaXMud2FsayhhLCBkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiA9IHRoaXMud2FsayhiLCAtZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAoYSAmJiBiICYmIGEgIT09IGIpIHtcbiAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnROb2RlIHx8IGEuaG9zdDtcbiAgICAgICAgICAgICAgICBiID0gYi5wYXJlbnROb2RlIHx8IGIuaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhO1xuICAgICAgICB9LFxuICAgICAgICB3YWxrOiBmdW5jdGlvbihuLCB1KSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgbiAmJiAoaSA8IHUpOyBpKyspIHtcbiAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBuO1xuICAgICAgICB9LFxuICAgICAgICBkZXB0aDogZnVuY3Rpb24obikge1xuICAgICAgICAgICAgdmFyIGQgPSAwO1xuICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICBkKys7XG4gICAgICAgICAgICAgICAgbiA9IG4ucGFyZW50Tm9kZSB8fCBuLmhvc3Q7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZDtcbiAgICAgICAgfSxcbiAgICAgICAgZGVlcENvbnRhaW5zOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgICAgICB2YXIgY29tbW9uID0gdGhpcy5MQ0EoYSwgYik7XG4gICAgICAgICAgICAvLyBpZiBhIGlzIHRoZSBjb21tb24gYW5jZXN0b3IsIGl0IG11c3QgXCJkZWVwbHlcIiBjb250YWluIGJcbiAgICAgICAgICAgIHJldHVybiBjb21tb24gPT09IGE7XG4gICAgICAgIH0sXG4gICAgICAgIGluc2lkZU5vZGU6IGZ1bmN0aW9uKG5vZGUsIHgsIHkpIHtcbiAgICAgICAgICAgIHZhciByZWN0ID0gbm9kZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIHJldHVybiAocmVjdC5sZWZ0IDw9IHgpICYmICh4IDw9IHJlY3QucmlnaHQpICYmIChyZWN0LnRvcCA8PSB5KSAmJiAoeSA8PSByZWN0LmJvdHRvbSk7XG4gICAgICAgIH0sXG4gICAgICAgIHBhdGg6IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcDtcbiAgICAgICAgICAgIGlmIChoYXNGdWxsUGF0aCAmJiBldmVudC5wYXRoICYmIGV2ZW50LnBhdGgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcCA9IGV2ZW50LnBhdGg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHAgPSBbXTtcbiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZmluZFRhcmdldChldmVudCk7XG4gICAgICAgICAgICAgICAgd2hpbGUgKG4pIHtcbiAgICAgICAgICAgICAgICAgICAgcC5wdXNoKG4pO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5wYXJlbnROb2RlIHx8IG4uaG9zdDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc2NvcGUudGFyZ2V0RmluZGluZyA9IHRhcmdldDtcbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBldmVudCwgZmluZHMgdGhlIFwiZGVlcGVzdFwiIG5vZGUgdGhhdCBjb3VsZCBoYXZlIGJlZW4gdGhlIG9yaWdpbmFsIHRhcmdldCBiZWZvcmUgU2hhZG93RE9NIHJldGFyZ2V0dGluZ1xuICAgICAqXG4gICAgICogQHBhcmFtIHtFdmVudH0gRXZlbnQgQW4gZXZlbnQgb2JqZWN0IHdpdGggY2xpZW50WCBhbmQgY2xpZW50WSBwcm9wZXJ0aWVzXG4gICAgICogQHJldHVybiB7RWxlbWVudH0gVGhlIHByb2JhYmxlIGV2ZW50IG9yaWduaW5hdG9yXG4gICAgICovXG4gICAgc2NvcGUuZmluZFRhcmdldCA9IHRhcmdldC5maW5kVGFyZ2V0LmJpbmQodGFyZ2V0KTtcbiAgICAvKipcbiAgICAgKiBEZXRlcm1pbmVzIGlmIHRoZSBcImNvbnRhaW5lclwiIG5vZGUgZGVlcGx5IGNvbnRhaW5zIHRoZSBcImNvbnRhaW5lZVwiIG5vZGUsIGluY2x1ZGluZyBzaXR1YXRpb25zIHdoZXJlIHRoZSBcImNvbnRhaW5lZVwiIGlzIGNvbnRhaW5lZCBieSBvbmUgb3IgbW9yZSBTaGFkb3dET01cbiAgICAgKiByb290cy5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB7Tm9kZX0gY29udGFpbmVyX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SB7XG4gICAgICAgIGF0dHJpYjJjc3MuZm9yRWFjaChmdW5jdGlvbihyKSB7XG4gICAgICAgICAgICBpZiAoU3RyaW5nKHIpID09PSByKSB7XG4gICAgICAgICAgICAgICAgc3R5bGVzICs9IHNlbGVjdG9yKHIpICsgcnVsZShyKSArICdcXG4nO1xuICAgICAgICAgICAgICAgIGlmIChoYXNTaGFkb3dSb290KSB7XG4gICAgICAgICAgICAgICAgICAgIHN0eWxlcyArPSBzaGFkb3dTZWxlY3RvcihyKSArIHJ1bGUocikgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0eWxlcyArPSByLnNlbGVjdG9ycy5tYXAoc2VsZWN0b3IpICsgcnVsZShyLnJ1bGUpICsgJ1xcbic7XG4gICAgICAgICAgICAgICAgaWYgKGhhc1NoYWRvd1Jvb3QpIHtcbiAgICAgICAgICAgICAgICAgICAgc3R5bGVzICs9IHIuc2VsZWN0b3JzLm1hcChzaGFkb3dTZWxlY3RvcikgKyBydWxlKHIucnVsZSkgKyAnXFxuJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHZhciBlbCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7XG4gICAgICAgIGVsLnRleHRDb250ZW50ID0gc3R5bGVzO1xuICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGVsKTtcbiAgICB9XG59KSgpO1xuXG4vKipcbiAqIFRoaXMgaXMgdGhlIGNvbnN0cnVjdG9yIGZvciBuZXcgUG9pbnRlckV2ZW50cy5cbiAqXG4gKiBOZXcgUG9pbnRlciBFdmVudHMgbXVzdCBiZSBnaXZlbiBhIHR5cGUsIGFuZCBhbiBvcHRpb25hbCBkaWN0aW9uYXJ5IG9mXG4gKiBpbml0aWFsaXphdGlvbiBwcm9wZXJ0aWVzLlxuICp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AgICAgICAgICBmb3IgKHZhciBpID0gMCwga2V5cyA9IE9iamVjdC5rZXlzKGluRGljdCksIGs7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgayA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKGsgIT09ICdidWJibGVzJyAmJiBrICE9PSAnY2FuY2VsYWJsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgZVtrXSA9IGluRGljdFtrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWFrZVBvaW50ZXJFdmVudDogZnVuY3Rpb24oaW5UeXBlLCBpbkRpY3QpIHtcbiAgICAgICAgICAgIGluRGljdCA9IGluRGljdCB8fCBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFrZUJhc2VFdmVudChpblR5cGUsIGluRGljdCk7XG4gICAgICAgICAgICAvLyBkZWZpbmUgaW5oZXJpdGVkIE1vdXNlRXZlbnQgcHJvcGVydGllc1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIHA7IGkgPCBNT1VTRV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBNT1VTRV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBlW3BdID0gaW5EaWN0W3BdIHx8IE1PVVNFX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZS5idXR0b25zID0gaW5EaWN0LmJ1dHRvbnMgfHwgMDtcblxuICAgICAgICAgICAgLy8gU3BlYyByZXF1aXJlcyB0aGF0IHBvaW50ZXJzIHdpdGhvdXQgcHJlc3N1cmUgc3BlY2lmaWVkIHVzZSAwLjUgZm9yIGRvd25cbiAgICAgICAgICAgIC8vIHN0YXRlIGFuZCAwIGZvciB1cCBzdGF0ZS5cbiAgICAgICAgICAgIHZhciBwcmVzc3VyZSA9IDA7XG4gICAgICAgICAgICBpZiAoaW5EaWN0LnByZXNzdXJlKSB7XG4gICAgICAgICAgICAgICAgcHJlc3N1cmUgPSBpbkRpY3QucHJlc3N1cmU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHByZXNzdXJlID0gZS5idXR0b25zID8gMC41IDogMDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gYWRkIHgveSBwcm9wZXJ0aWVzIGFsaWFzZWQgdG8gY2xpZW50WC9ZXG4gICAgICAgICAgICBlLnggPSBlLmNsaWVudFg7XG4gICAgICAgICAgICBlLnkgPSBlLmNsaWVudFk7XG5cbiAgICAgICAgICAgIC8vIGRlZmluZSB0aGUgcHJvcGVydGllcyBvZiB0aGUgUG9pbnRlckV2ZW50IGludGVyZmFjZVxuICAgICAgICAgICAgZS5wb2ludGVySWQgPSBpbkRpY3QucG9pbnRlcklkIHx8IDA7XG4gICAgICAgICAgICBlLndpZHRoID0gaW5EaWN0LndpZHRoIHx8IDA7XG4gICAgICAgICAgICBlLmhlaWdodCA9IGluRGljdC5oZWlnaHQgfHwgMDtcbiAgICAgICAgICAgIGUucHJlc3N1cmUgPSBwcmVzc3VyZTtcbiAgICAgICAgICAgIGUudGlsdFggPSBpbkRpY3QudGlsdFggfHwgMDtcbiAgICAgICAgICAgIGUudGlsdFkgPSBpbkRpY3QudGlsdFkgfHwgMDtcbiAgICAgICAgICAgIGUucG9pbnRlclR5cGUgPSBpbkRpY3QucG9pbnRlclR5cGUgfHwgJyc7XG4gICAgICAgICAgICBlLmh3VGltZXN0YW1wID0gaW5EaWN0Lmh3VGltZXN0YW1wIHx8IDA7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IGluRGljdC5pc1ByaW1hcnkgfHwgZmFsc2U7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSBpbkRpY3QuX3NvdXJjZSB8fCAnJztcbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHNjb3BlLmV2ZW50RmFjdG9yeSA9IGV2ZW50RmFjdG9yeTtcbn0pKGV4cG9ydHMpO1xuXG4vKipcbiAqIFRoaXMgbW9kdWxlIGltcGxlbWVudHMgYW4gbWFwIG9mIHBvaW50ZXIgc3RhdGVzXG4gKi9cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBVU0VfTUFQID0gd2luZG93Lk1hcCAmJiB3aW5kb3cuTWFwLnByb3RvdHlwZS5mb3JFYWNoO1xuICAgIHZhciBQT0lOVEVSU19GTiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5zaXplO1xuICAgIH07XG5cbiAgICBmdW5jdGlvbiBQb2ludGVyTWFwKCkge1xuICAgICAgICBpZiAoVVNFX01BUCkge1xuICAgICAgICAgICAgdmFyIG0gPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICBtLnBvaW50ZXJzID0gUE9JTlRFUlNfRk47XG4gICAgICAgICAgICByZXR1cm4gbTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMua2V5cyA9IFtdO1xuICAgICAgICAgICAgdGhpcy52YWx1ZXMgPSBbXTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFBvaW50ZXJNYXAucHJvdG90eXBlID0ge1xuICAgICAgICBzZXQ6IGZ1bmN0aW9uKGluSWQsIGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBpID0gdGhpcy5rZXlzLmluZGV4T2YoaW5JZCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy52YWx1ZXNbaV0gPSBpbkV2ZW50O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMucHVzaChpbklkKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlcy5wdXNoKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBoYXM6IGZ1bmN0aW9uKGluSWQpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXMuaW5kZXhPZihpbklkKSA+IC0xO1xuICAgICAgICB9LFxuICAgICAgICAnZGVsZXRlJzogZnVuY3Rpb24oaW5JZCkge1xuICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmtleXMuaW5kZXhPZihpbklkKTtcbiAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmtleXMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgIHRoaXMudmFsdWVzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2V0OiBmdW5jdGlvbihpbklkKSB7XG4gICAgICAgICAgICB2YXIgaSA9IHRoaXMua2V5cy5pbmRleE9mKGluSWQpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudmFsdWVzW2ldO1xuICAgICAgICB9LFxuICAgICAgICBjbGVhcjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB0aGlzLmtleXMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmxlbmd0aCA9IDA7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIHJldHVybiB2YWx1ZSwga2V5LCBtYXBcbiAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24oY2FsbGJhY2ssIHRoaXNBcmcpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24odiwgaSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdiwgdGhpcy5rZXlzW2ldLCB0aGlzKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXlzLmxlbmd0aDtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5Qb2ludGVyTWFwID0gUG9pbnRlck1hcDtcbn0pKGV4cG9ydHMpO1xuXG4oZnVuY3Rpb24oc2NvcGUpIHtcbiAgICB2YXIgQ0xPTkVfUFJPUFMgPSBbXG4gICAgICAgIC8vIE1vdXNlRXZlbnRcbiAgICAgICAgJ2J1YmJsZXMnLFxuICAgICAgICAnY2FuY2VsYWJsZScsXG4gICAgICAgICd2aWV3JyxcbiAgICAgICAgJ2RldGFpbCcsXG4gICAgICAgICdzY3JlZW5YJyxcbiAgICAgICAgJ3NjcmVlblknLFxuICAgICAgICAnY2xpZW50WCcsXG4gICAgICAgICdjbGllbnRZJyxcbiAgICAgICAgJ2N0cmxLZXknLFxuICAgICAgICAnYWx0S2V5JyxcbiAgICAgICAgJ3NoaWZ0S2V5JyxcbiAgICAgICAgJ21ldGFLZXknLFxuICAgICAgICAnYnV0dG9uJyxcbiAgICAgICAgJ3JlbGF0ZWRUYXJnZXQnLFxuICAgICAgICAvLyBET00gTGV2ZWwgM1xuICAgICAgICAnYnV0dG9ucycsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAncG9pbnRlcklkJyxcbiAgICAgICAgJ3dpZHRoJyxcbiAgICAgICAgJ2hlaWdodCcsXG4gICAgICAgICdwcmVzc3VyZScsXG4gICAgICAgICd0aWx0WCcsXG4gICAgICAgICd0aWx0WScsXG4gICAgICAgICdwb2ludGVyVHlwZScsXG4gICAgICAgICdod1RpbWVzdGFtcCcsXG4gICAgICAgICdpc1ByaW1hcnknLFxuICAgICAgICAvLyBldmVudCBpbnN0YW5jZVxuICAgICAgICAndHlwZScsXG4gICAgICAgICd0YXJnZXQnLFxuICAgICAgICAnY3VycmVudFRhcmdldCcsXG4gICAgICAgICd3aGljaCcsXG4gICAgICAgICdwYWdlWCcsXG4gICAgICAgICdwYWdlWScsXG4gICAgICAgICd0aW1lU3RhbXAnLFxuICAgICAgICAvLyBnZXN0dXJlIGFkZG9uc1xuICAgICAgICAncHJldmVudFRhcCcsXG4gICAgICAgICd0YXBQcmV2ZW50ZWQnLFxuICAgICAgICAnX3NvdXJjZSdcbiAgICBdO1xuXG4gICAgdmFyIENMT05FX0RFRkFVTFRTID0gW1xuICAgICAgICAvLyBNb3VzZUV2ZW50XG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgbnVsbCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIGZhbHNlLFxuICAgICAgICBmYWxzZSxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIDAsXG4gICAgICAgIG51bGwsXG4gICAgICAgIC8vIERPTSBMZXZlbCAzXG4gICAgICAgIDAsXG4gICAgICAgIC8vIFBvaW50ZXJFdmVudFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAnJyxcbiAgICAgICAgMCxcbiAgICAgICAgZmFsc2UsXG4gICAgICAgIC8vIGV2ZW50IGluc3RhbmNlXG4gICAgICAgICcnLFxuICAgICAgICBudWxsLFxuICAgICAgICBudWxsLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICAwLFxuICAgICAgICBmdW5jdGlvbigpIHt9LFxuICAgICAgICBmYWxzZVxuICAgIF07XG5cbiAgICB2YXIgSEFTX1NWR19JTlNUQU5DRSA9ICh0eXBlb2YgU1ZHRWxlbWVudEluc3RhbmNlICE9PSAndW5kZWZpbmVkJyk7XG5cbiAgICB2YXIgZXZlbnRGYWN0b3J5ID0gc2NvcGUuZXZlbnRGYWN0b3J5O1xuXG4gICAgLy8gc2V0IG9mIHJlY29nbml6ZXJzIHRvIHJ1biBmb3IgdGhlIGN1cnJlbnRseSBoYW5kbGV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Vhc2Ugb2YgdGVzdGluZy5cbiAgICAgICAgZXZlbnRTb3VyY2VzOiBPYmplY3QuY3JlYXRlKG51bGwpLFxuICAgICAgICBldmVudFNvdXJjZUxpc3Q6IFtdLFxuICAgICAgICBnZXN0dXJlczogW10sXG4gICAgICAgIC8vIG1hcCBnZXN0dXJlIGV2ZW50IC0+IHtsaXN0ZW5lcnM6IGludCwgaW5kZXg6IGdlc3R1cmVzW2ludF19XG4gICAgICAgIGRlcGVuZGVuY3lNYXA6IHtcbiAgICAgICAgICAgIC8vIG1ha2Ugc3VyZSBkb3duIGFuZCB1cCBhcmUgaW4gdGhlIG1hcCB0byB0cmlnZ2VyIFwicmVnaXN0ZXJcIlxuICAgICAgICAgICAgZG93bjoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB1cDoge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyczogMCxcbiAgICAgICAgICAgICAgICBpbmRleDogLTFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVF1ZXVlOiBbXSxcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEFkZCBhIG5ldyBldmVudCBzb3VyY2UgdGhhdCB3aWxsIGdlbmVyYXRlIHBvaW50ZXIgZXZlbnRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBgaW5Tb3VyY2VgIG11c3QgY29udGFpbiBhbiBhcnJheSBvZiBldmVudCBuYW1lcyBuYW1lZCBgZXZlbnRzYCwgYW5kXG4gICAgICAgICAqIGZ1bmN0aW9ucyB3aXRoIHRoZSBuYW1lcyBzcGVjaWZpZWQgaW4gdGhlIGBldmVudHNgIGFycmF5LlxuICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSBBIG5hbWUgZm9yIHRoZSBldmVudCBzb3VyY2VcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBBIG5ldyBzb3VyY2Ugb2YgcGxhdGZvcm0gZXZlbnRzLlxuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJTb3VyY2U6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIHMgPSBzb3VyY2U7XG4gICAgICAgICAgICB2YXIgbmV3RXZlbnRzID0gcy5ldmVudHM7XG4gICAgICAgICAgICBpZiAobmV3RXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgbmV3RXZlbnRzLmZvckVhY2goZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1tlXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudE1hcFtlXSA9IHNbZV0uYmluZChzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRTb3VyY2VzW25hbWVdID0gcztcbiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50U291cmNlTGlzdC5wdXNoKHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICByZWdpc3Rlckdlc3R1cmU6IGZ1bmN0aW9uKG5hbWUsIHNvdXJjZSkge1xuICAgICAgICAgICAgdmFyIG9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICBvYmoubGlzdGVuZXJzID0gMDtcbiAgICAgICAgICAgIG9iai5pbmRleCA9IHRoaXMuZ2VzdHVyZXMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGc7IGkgPCBzb3VyY2UuZXhwb3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGcgPSBzb3VyY2UuZXhwb3Nlc1tpXS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZGVwZW5kZW5jeU1hcFtnXSA9IG9iajtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZ2VzdHVyZXMucHVzaChzb3VyY2UpO1xuICAgICAgICB9LFxuICAgICAgICByZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCwgaW5pdGlhbCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy5yZWdpc3Rlci5jYWxsKGVzLCBlbGVtZW50LCBpbml0aWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdW5yZWdpc3RlcjogZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmV2ZW50U291cmNlTGlzdC5sZW5ndGg7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgZXM7XG4gICAgICAgICAgICAgICAgKGkgPCBsKSAmJiAoZXMgPSB0aGlzLmV2ZW50U291cmNlTGlzdFtpXSk7IGkrKykge1xuICAgICAgICAgICAgICAgIC8vIGNhbGwgZXZlbnRzb3VyY2UgcmVnaXN0ZXJcbiAgICAgICAgICAgICAgICBlcy51bnJlZ2lzdGVyLmNhbGwoZXMsIGVsZW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBFVkVOVFNcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5yZXF1aXJlZEdlc3R1cmVzLnNldChpbkV2ZW50LnBvaW50ZXJJZCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgIHRoa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IGc7IGkgPCBnay5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAvLyBnZXN0dXJlXG4gICAgICAgICAgICAgICAgICAgIGcgPSBna1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdlc3R1cmVzV2FudGVkW2ddID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gbG9va3VwIGdlc3R1cmUgcmVjb2duaXplclxuICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlY29nbml6ZXIgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpID0gciA/IHIuaW5kZXggOiAtMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlc1tyaV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyBMSVNURU5FUiBMT0dJQ1xuICAgICAgICBldmVudEhhbmRsZXI6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIC8vIFRoaXMgaXMgdXNlZCB0byBwcmV2ZW50IG11bHRpcGxlIGRpc3BhdGNoIG9mIGV2ZW50cyBmcm9tXG4gICAgICAgICAgICAvLyBwbGF0Zm9ybSBldmVudHMuIFRoaXMgY2FuIGhhcHBlbiB3aGVuIHR3byBlbGVtZW50cyBpbiBkaWZmZXJlbnQgc2NvcGVzXG4gICAgICAgICAgICAvLyBhcmUgc2V0IHVwIHRvIGNyZWF0ZSBwb2ludGVyIGV2ZW50cywgd2hpY2ggaXMgcmVsZXZhbnQgdG8gU2hhZG93IERPTS5cblxuICAgICAgICAgICAgdmFyIHR5cGUgPSBpbkV2ZW50LnR5cGU7XG5cbiAgICAgICAgICAgIC8vIG9ubHkgZ2VuZXJhdGUgdGhlIGxpc3Qgb2YgZGVzaXJlZCBldmVudHMgb24gXCJkb3duXCJcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ21vdXNlZG93bicgfHwgdHlwZSA9PT0gJ3BvaW50ZXJkb3duJyB8fCB0eXBlID09PSAnTVNQb2ludGVyRG93bicpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWluRXZlbnQuX2hhbmRsZWRCeVBHKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRHZXN0dXJlcyA9IHt9O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGluIElPUyBtb2RlLCB0aGVyZSBpcyBvbmx5IGEgbGlzdGVuZXIgb24gdGhlIGRvY3VtZW50LCBzbyB0aGlzIGlzIG5vdCByZS1lbnRyYW50XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuSVNfSU9TKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBldiA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQgdXAgYSBmYWtlIGV2ZW50IHRvIGdpdmUgdG8gdGhlIHBhdGggYnVpbGRlclxuICAgICAgICAgICAgICAgICAgICAgICAgZXYgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBpbkV2ZW50LnRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRYOiBjdC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IGN0LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaW5FdmVudC5wYXRoXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSBldmVudCBwYXRoIGlmIGF2YWlsYWJsZSwgb3RoZXJ3aXNlIGJ1aWxkIGEgcGF0aCBmcm9tIHRhcmdldCBmaW5kaW5nXG4gICAgICAgICAgICAgICAgICAgIHZhciBub2RlcyA9IGluRXZlbnQucGF0aCB8fCBzY29wZS50YXJnZXRGaW5kaW5nLnBhdGgoZXYpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbjsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gbm9kZXNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KG4sIGN1cnJlbnRHZXN0dXJlcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEdlc3R1cmVEZXBlbmRlbmN5KGluRXZlbnQuY3VycmVudFRhcmdldCwgY3VycmVudEdlc3R1cmVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbkV2ZW50Ll9oYW5kbGVkQnlQRykge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBmbiA9IHRoaXMuZXZlbnRNYXAgJiYgdGhpcy5ldmVudE1hcFt0eXBlXTtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICAgIGZuKGluRXZlbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5FdmVudC5faGFuZGxlZEJ5UEcgPSB0cnVlO1xuICAgICAgICB9LFxuICAgICAgICAvLyBzZXQgdXAgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIGxpc3RlbjogZnVuY3Rpb24odGFyZ2V0LCBldmVudHMpIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnRzLmxlbmd0aCwgZTtcbiAgICAgICAgICAgICAgICAoaSA8IGwpICYmIChlID0gZXZlbnRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRFdmVudCh0YXJnZXQsIGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvLyByZW1vdmUgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgIHVubGlzdGVuOiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50cykge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBldmVudHMubGVuZ3RoLCBlO1xuICAgICAgICAgICAgICAgIChpIDwgbCkgJiYgKGUgPSBldmVudHNbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZUV2ZW50KHRhcmdldCwgZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGFkZEV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LmFkZEV2ZW50TGlzdGVuZXIoZXZlbnROYW1lLCB0aGlzLmJvdW5kSGFuZGxlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHJlbW92ZUV2ZW50OiBmdW5jdGlvbih0YXJnZXQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgICAgdGFyZ2V0LnJlbW92ZUV2ZW50TGlzdGVuZXIoZXZlbnROYW1lLCB0aGlzLmJvdW5kSGFuZGxlcik7XG4gICAgICAgIH0sXG4gICAgICAgIC8vIEVWRU5UIENSRUFUSU9OIEFORCBUUkFDS0lOR1xuICAgICAgICAvKipcbiAgICAgICAgICogQ3JlYXRlcyBhIG5ldyBFdmVudCBvZiB0eXBlIGBpblR5cGVgLCBiYXNlZCBvbiB0aGUgaW5mb3JtYXRpb24gaW5cbi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YWJsZSBwcm9wZXJ0aWVzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IEFuIGV2ZW50IHRoYXQgY29udGFpbnMgcHJvcGVydGllcyB0byBjb3B5LlxuICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IEFuIG9iamVjdCBjb250YWluaW5nIHNoYWxsb3cgY29waWVzIG9mIGBpbkV2ZW50YCdzXG4gICAgICAgICAqICAgIHByb3BlcnRpZXMuXG4gICAgICAgICAqL1xuICAgICAgICBjbG9uZUV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZXZlbnRDb3B5ID0gT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgICAgICAgICBwO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBDTE9ORV9QUk9QUy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHAgPSBDTE9ORV9QUk9QU1tpXTtcbiAgICAgICAgICAgICAgICBldmVudENvcHlbcF0gPSBpbkV2ZW50W3BdIHx8IENMT05FX0RFRkFVTFRTW2ldO1xuICAgICAgICAgICAgICAgIC8vIFdvcmsgYXJvdW5kIFNWR0luc3RhbmNlRWxlbWVudCBzaGFkb3cgdHJlZVxuICAgICAgICAgICAgICAgIC8vIFJldHVybiB0aGUgPHVzZT4gZWxlbWVudCB0aGF0IGlzIHJlcHJlc2VudGVkIGJ5IHRoZSBpbnN0YW5jZSBmb3IgU2FmYXJpLCBDaHJvbWUsIElFLlxuICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGJlaGF2aW9yIGltcGxlbWVudGVkIGJ5IEZpcmVmb3guXG4gICAgICAgICAgICAgICAgaWYgKHAgPT09ICd0YXJnZXQnIHx8IHAgPT09ICdyZWxhdGVkVGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoSEFTX1NWR19JTlNUQU5DRSAmJiBldmVudENvcHlbcF0gaW5zdGFuY2VvZiBTVkdFbGVtZW50SW5zdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50Q29weVtwXSA9IGV2ZW50Q29weVtwXS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGtlZXAgdGhlIHNlbWFudGljcyBvZiBwcmV2ZW50RGVmYXVsdFxuICAgICAgICAgICAgZXZlbnRDb3B5LnByZXZlbnREZWZhdWx0ID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaW5FdmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHJldHVybiBldmVudENvcHk7XG4gICAgICAgIH0sXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBEaXNwYXRjaGVzIHRoZSBldmVudCB0byBpdHMgdGFyZ2V0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge0V2ZW50fSBpbkV2ZW50IFRoZSBldmVudCB0byBiZSBkaXNwYXRjaGVkLlxuICAgICAgICAgKiBAcmV0dXJuIHtCb29sZWFufSBUcnVlIGlmIGFuIGV2ZW50IGhhbmRsZXIgcmV0dXJucyB0cnVlLCBmYWxzZSBvdGhlcndpc2UuXG4gICAgICAgICAqL1xuICAgICAgICBkaXNwYXRjaEV2ZW50OiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuX3RhcmdldDtcbiAgICAgICAgICAgIGlmICh0KSB7XG4gICAgICAgICAgICAgICAgdC5kaXNwYXRjaEV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIC8vIGNsb25lIHRoZSBldmVudCBmb3IgdGhlIGdlc3R1cmUgc3lzdGVtIHRvIHByb2Nlc3NcbiAgICAgICAgICAgICAgICAvLyBjbG9uZSBhZnRlciBkaXNwYXRjaCB0byBwaWNrIHVwIGdlc3R1cmUgcHJldmVudGlvbiBjb2RlXG4gICAgICAgICAgICAgICAgdmFyIGNsb25lID0gdGhpcy5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGNsb25lLnRhcmdldCA9IHQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maWxsR2VzdHVyZVF1ZXVlKGNsb25lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZ2VzdHVyZVRyaWdnZXI6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgLy8gcHJvY2VzcyB0aGUgZ2VzdHVyZSBxdWV1ZVxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGUsIHJnOyBpIDwgdGhpcy5nZXN0dXJlUXVldWUubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlID0gdGhpcy5nZXN0dXJlUXVldWVbaV07XG4gICAgICAgICAgICAgICAgcmcgPSBlLl9yZXF1aXJlZEdlc3R1cmVzO1xuICAgICAgICAgICAgICAgIGlmIChyZykge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgZywgZm47IGogPCB0aGlzLmdlc3R1cmVzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHJ1biByZWNvZ25pemVyIGlmIGFuIGVsZW1lbnQgaW4gdGhlIHNvdXJjZSBldmVudCdzIHBhdGggaXMgbGlzdGVuaW5nIGZvciB0aG9zZSBnZXN0dXJlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJnW2pdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHRoaXMuZ2VzdHVyZXNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBnW2UudHlwZV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZuKSB7XG4gICA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AgICAgICAgICAgICAgIHZhciBhY3Rpb25Ob2RlO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAobm9kZS5ub2RlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uTm9kZSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBOb2RlLkRPQ1VNRU5UX0ZSQUdNRU5UX05PREU6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbm9kZS5ob3N0O1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25Ob2RlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodG91Y2hBY3Rpb24gJiYgYWN0aW9uTm9kZSAmJiAhYWN0aW9uTm9kZS5oYXNBdHRyaWJ1dGUoJ3RvdWNoLWFjdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbk5vZGUuc2V0QXR0cmlidXRlKCd0b3VjaC1hY3Rpb24nLCB0b3VjaEFjdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFub2RlLl9wZ0V2ZW50cykge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzID0ge307XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBub2RlLl9wZ0V2ZW50c1tnXSA9IChub2RlLl9wZ0V2ZW50c1tnXSB8fCAwKSArIDE7XG4gICAgICAgICAgICBub2RlLl9wZ0xpc3RlbmVycysrO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBCb29sZ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gZnVuY3Rpb24obm9kZSwgZ2VzdHVyZSkge1xuICAgICAgICB2YXIgZyA9IGdlc3R1cmUudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgdmFyIGRlcCA9IGRpc3BhdGNoZXIuZGVwZW5kZW5jeU1hcFtnXTtcbiAgICAgICAgaWYgKGRlcCkge1xuICAgICAgICAgICAgaWYgKG5vZGUuX3BnTGlzdGVuZXJzID4gMCkge1xuICAgICAgICAgICAgICAgIG5vZGUuX3BnTGlzdGVuZXJzLS07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdMaXN0ZW5lcnMgPT09IDApIHtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLnVucmVnaXN0ZXIobm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHMpIHtcbiAgICAgICAgICAgICAgICBpZiAobm9kZS5fcGdFdmVudHNbZ10gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIG5vZGUuX3BnRXZlbnRzW2ddLS07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZS5fcGdFdmVudHNbZ10gPSAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gQm9vbGVhbihkZXApO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBTdG9wIGxpc3RlbmluZyBmb3IgYGdlc3R1cmVgIGZyb20gYG5vZGVgIHdpdGggYGhhbmRsZXJgIGZ1bmN0aW9uLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtFbGVtZW50fSBub2RlXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGdlc3R1cmVcbiAgICAgKiBAcGFyYW0ge0Z1bmN0aW9ufSBoYW5kbGVyXG4gICAgICogQHBhcmFtIHtCb29sZWFufSBjYXB0dXJlXG4gICAgICovXG4gICAgc2NvcGUucmVt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yNzU5MzAwMy8jbXNnMTZcbiAgICAgICAgaWYgKEZJUkVGT1hfTElOVVgudGVzdChuYXZpZ2F0b3IudXNlckFnZW50KSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IE1vdXNlRXZlbnQoJ3Rlc3QnLCB7XG4gICAgICAgICAgICAgICAgYnV0dG9uczogMVxuICAgICAgICAgICAgfSkuYnV0dG9ucyA9PT0gMTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfSkoKTtcblxuICAgIC8vIGhhbmRsZXIgYmxvY2sgZm9yIG5hdGl2ZSBtb3VzZSBldmVudHNcbiAgICB2YXIgbW91c2VFdmVudHMgPSB7XG4gICAgICAgIFBPSU5URVJfSUQ6IDEsXG4gICAgICAgIFBPSU5URVJfVFlQRTogJ21vdXNlJyxcbiAgICAgICAgZXZlbnRzOiBbXG4gICAgICAgICAgICAnbW91c2Vkb3duJyxcbiAgICAgICAgICAgICdtb3VzZW1vdmUnLFxuICAgICAgICAgICAgJ21vdXNldXAnXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgICAgICAnbW92ZSdcbiAgICAgICAgXSxcbiAgICAgICAgcmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKHRhcmdldC5ub2RlVHlwZSA9PT0gTm9kZS5ET0NVTUVOVF9OT0RFKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGlzcGF0Y2hlci51bmxpc3Rlbih0YXJnZXQsIHRoaXMuZXZlbnRzKTtcbiAgICAgICAgfSxcbiAgICAgICAgbGFzdFRvdWNoZXM6IFtdLFxuICAgICAgICAvLyBjb2xsaWRlIHdpdGggdGhlIGdsb2JhbCBtb3VzZSBsaXN0ZW5lclxuICAgICAgICBpc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgbHRzID0gdGhpcy5sYXN0VG91Y2hlcztcbiAgICAgICAgICAgIHZhciB4ID0gaW5FdmVudC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGx0cy5sZW5ndGgsIHQ7IGkgPCBsICYmICh0ID0gbHRzW2ldKTsgaSsrKSB7XG4gICAgICAgICAgICAgICAgLy8gc2ltdWxhdGVkIG1vdXNlIGV2ZW50cyB3aWxsIGJlIHN3YWxsb3dlZCBuZWFyIGEgcHJpbWFyeSB0b3VjaGVuZFxuICAgICAgICAgICAgICAgIHZhciBkeCA9IE1hdGguYWJzKHggLSB0LngpLFxuICAgICAgICAgICAgICAgICAgICBkeSA9IE1hdGguYWJzKHkgLSB0LnkpO1xuICAgICAgICAgICAgICAgIGlmIChkeCA8PSBERURVUF9ESVNUICYmIGR5IDw9IERFRFVQX0RJU1QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5wb2ludGVySWQgPSB0aGlzLlBPSU5URVJfSUQ7XG4gICAgICAgICAgICBlLmlzUHJpbWFyeSA9IHRydWU7XG4gICAgICAgICAgICBlLnBvaW50ZXJUeXBlID0gdGhpcy5QT0lOVEVSX1RZUEU7XG4gICAgICAgICAgICBlLl9zb3VyY2UgPSAnbW91c2UnO1xuICAgICAgICAgICAgaWYgKCFIQVNfQlVUVE9OUykge1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gaW5FdmVudC50eXBlO1xuICAgICAgICAgICAgICAgIHZhciBiaXQgPSBXSElDSF9UT19CVVRUT05TW2luRXZlbnQud2hpY2hdIHx8IDA7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdtb3VzZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRCdXR0b25zIHw9IGJpdDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09ICdtb3VzZXVwJykge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50QnV0dG9ucyAmPSB+Yml0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlLmJ1dHRvbnMgPSBjdXJyZW50QnV0dG9ucztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBlO1xuICAgICAgICB9LFxuICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5pc0V2ZW50U2ltdWxhdGVkRnJvbVRvdWNoKGluRXZlbnQpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSBwb2ludGVybWFwLmhhcyh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS50YXJnZXQgPSBzY29wZS5maW5kVGFyZ2V0KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHRoaXMuUE9JTlRFUl9JRCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIuZG93bihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbW91c2Vtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldCh0aGlzLlBPSU5URVJfSUQpO1xuICAgICAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZS50YXJnZXQgPSB0YXJnZXQ7XG4gICAgICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBjYXNlIHdoZXJlIHdlIG1pc3NlZCBhIG1vdXNldXBcbiAgICAgICAgICAgICAgICAgICAgaWYgKChIQVNfQlVUVE9OUyA/IGUuYnV0dG9ucyA6IGUud2hpY2gpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUhBU19CVVRUT05TKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEJ1dHRvbnMgPSBlLmJ1dHRvbnMgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5jYW5jZWwoZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5tb3ZlKGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3VzZXVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNFdmVudFNpbXVsYXRlZEZyb21Ub3VjaChpbkV2ZW50KSkge1xuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KHRoaXMuUE9JTlRFUl9JRCk7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgICAgICB0aGlzLmNsZWFudXBNb3VzZShlLmJ1dHRvbnMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjbGVhbnVwTW91c2U6IGZ1bmN0aW9uKGJ1dHRvbnMpIHtcbiAgICAgICAgICAgIGlmIChidXR0b25zID09PSAwKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUodGhpcy5QT0lOVEVSX0lEKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tb3VzZUV2ZW50cyA9IG1vdXNlRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgYWxsU2hhZG93cyA9IHNjb3BlLnRhcmdldEZpbmRpbmcuYWxsU2hhZG93cy5iaW5kKHNjb3BlLnRhcmdldEZpbmRpbmcpO1xuICAgIHZhciBwb2ludGVybWFwID0gZGlzcGF0Y2hlci5wb2ludGVybWFwO1xuICAgIHZhciB0b3VjaE1hcCA9IEFycmF5LnByb3RvdHlw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aWYgKHRoaXMuSVNfSU9TID8gaW5pdGlhbCA6ICFpbml0aWFsKSB7XG4gICAgICAgICAgICAgICAgZGlzcGF0Y2hlci5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVucmVnaXN0ZXI6IGZ1bmN0aW9uKHRhcmdldCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLklTX0lPUykge1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIudW5saXN0ZW4odGFyZ2V0LCB0aGlzLmV2ZW50cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNjcm9sbFR5cGVzOiB7XG4gICAgICAgICAgICBFTUlUVEVSOiAnbm9uZScsXG4gICAgICAgICAgICBYU0NST0xMRVI6ICdwYW4teCcsXG4gICAgICAgICAgICBZU0NST0xMRVI6ICdwYW4teScsXG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoQWN0aW9uVG9TY3JvbGxUeXBlOiBmdW5jdGlvbih0b3VjaEFjdGlvbikge1xuICAgICAgICAgICAgdmFyIHQgPSB0b3VjaEFjdGlvbjtcbiAgICAgICAgICAgIHZhciBzdCA9IHRoaXMuc2Nyb2xsVHlwZXM7XG4gICAgICAgICAgICBpZiAodCA9PT0gc3QuRU1JVFRFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZSc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LlhTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWCc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IHN0LllTQ1JPTExFUikge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWSc7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnWFknO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBQT0lOVEVSX1RZUEU6ICd0b3VjaCcsXG4gICAgICAgIGZpcnN0VG91Y2g6IG51bGwsXG4gICAgICAgIGlzUHJpbWFyeVRvdWNoOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5maXJzdFRvdWNoID09PSBpblRvdWNoLmlkZW50aWZpZXI7XG4gICAgICAgIH0sXG4gICAgICAgIHNldFByaW1hcnlUb3VjaDogZnVuY3Rpb24oaW5Ub3VjaCkge1xuICAgICAgICAgICAgLy8gc2V0IHByaW1hcnkgdG91Y2ggaWYgdGhlcmUgbm8gcG9pbnRlcnMsIG9yIHRoZSBvbmx5IHBvaW50ZXIgaXMgdGhlIG1vdXNlXG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5wb2ludGVycygpID09PSAwIHx8IChwb2ludGVybWFwLnBvaW50ZXJzKCkgPT09IDEgJiYgcG9pbnRlcm1hcC5oYXMoMSkpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFRvdWNoID0gaW5Ub3VjaC5pZGVudGlmaWVyO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IHtcbiAgICAgICAgICAgICAgICAgICAgWDogaW5Ub3VjaC5jbGllbnRYLFxuICAgICAgICAgICAgICAgICAgICBZOiBpblRvdWNoLmNsaWVudFlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RUYXJnZXQgPSBpblRvdWNoLnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxSZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVtb3ZlUHJpbWFyeVBvaW50ZXI6IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgaWYgKGluUG9pbnRlci5pc1ByaW1hcnkpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcnN0VG91Y2ggPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyc3RYWSA9IG51bGw7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldENsaWNrQ291bnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgY2xpY2tDb3VudDogMCxcbiAgICAgICAgcmVzZXRJZDogbnVsbCxcbiAgICAgICAgcmVzZXRDbGlja0NvdW50OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBmbiA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2xpY2tDb3VudCA9IDA7XG4gICAgICAgICAgICAgICAgdGhpcy5yZXNldElkID0gbnVsbDtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMucmVzZXRJZCA9IHNldFRpbWVvdXQoZm4sIENMSUNLX0NPVU5UX1RJTUVPVVQpO1xuICAgICAgICB9LFxuICAgICAgICBjYW5jZWxSZXNldENsaWNrQ291bnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVzZXRJZCkge1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzLnJlc2V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB0eXBlVG9CdXR0b25zOiBmdW5jdGlvbih0eXBlKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gMDtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndG91Y2hzdGFydCcgfHwgdHlwZSA9PT0gJ3RvdWNobW92ZScpIHtcbiAgICAgICAgICAgICAgICByZXQgPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRhcmdldDogZnVuY3Rpb24odG91Y2gsIGlkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5jdXJyZW50VG91Y2hFdmVudC50eXBlID09PSAndG91Y2hzdGFydCcpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1ByaW1hcnlUb3VjaCh0b3VjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZhc3RQYXRoID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50WDogdG91Y2guY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IHRvdWNoLmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50LnBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHRoaXMuY3VycmVudFRvdWNoRXZlbnQudGFyZ2V0XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZS5maW5kVGFyZ2V0KGZhc3RQYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NvcGUuZmluZFRhcmdldCh0b3VjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmV1c2UgdGFyZ2V0IHdlIGZvdW5kIGluIHRvdWNoc3RhcnRcbiAgICAgICAgICAgIHJldHVybiBwb2ludGVybWFwLmdldChpZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNoVG9Qb2ludGVyOiBmdW5jdGlvbihpblRvdWNoKSB7XG4gICAgICAgICAgICB2YXIgY3RlID0gdGhpcy5jdXJyZW50VG91Y2hFdmVudDtcbiAgICAgICAgICAgIHZhciBlID0gZGlzcGF0Y2hlci5jbG9uZUV2ZW50KGluVG91Y2gpO1xuICAgICAgICAgICAgLy8gU3BlYyBzcGVjaWZpZXMgdGhhdCBwb2ludGVySWQgMSBpcyByZXNlcnZlZCBmb3IgTW91c2UuXG4gICAgICAgICAgICAvLyBUb3Vj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aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgc2VsZi5maXJzdFhZID0gbnVsbDtcbiAgICAgICAgICAgICAgICBjdGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgcHJvY2Vzc1RvdWNoZXM6IGZ1bmN0aW9uKGluRXZlbnQsIGluRnVuY3Rpb24pIHtcbiAgICAgICAgICAgIHZhciB0bCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXM7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRUb3VjaEV2ZW50ID0gaW5FdmVudDtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCB0LCBwOyBpIDwgdGwubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB0ID0gdGxbaV07XG4gICAgICAgICAgICAgICAgcCA9IHRoaXMudG91Y2hUb1BvaW50ZXIodCk7XG4gICAgICAgICAgICAgICAgaWYgKGluRXZlbnQudHlwZSA9PT0gJ3RvdWNoc3RhcnQnKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KHAucG9pbnRlcklkLCBwLnRhcmdldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLmhhcyhwLnBvaW50ZXJJZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5GdW5jdGlvbi5jYWxsKHRoaXMsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaW5FdmVudC50eXBlID09PSAndG91Y2hlbmQnIHx8IGluRXZlbnQuX2NhbmNlbCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFuVXBQb2ludGVyKHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSx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lciBheGlzXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gc2Nyb2xsQXhpcztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9hID0gc2Nyb2xsQXhpcyA9PT0gJ1knID8gJ1gnIDogJ1knO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGEgPSBNYXRoLmFicyh0WydjbGllbnQnICsgYV0gLSB0aGlzLmZpcnN0WFlbYV0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZG9hID0gTWF0aC5hYnModFsnY2xpZW50JyArIG9hXSAtIHRoaXMuZmlyc3RYWVtvYV0pO1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiBkZWx0YSBpbiB0aGUgc2Nyb2xsIGF4aXMgPiBkZWx0YSBvdGhlciBheGlzLCBzY3JvbGwgaW5zdGVhZCBvZlxuICAgICAgICAgICAgICAgICAgICAvLyBtYWtpbmcgZXZlbnRzXG4gICAgICAgICAgICAgICAgICAgIHJldCA9IGRhID49IGRvYTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgZmluZFRvdWNoOiBmdW5jdGlvbihpblRMLCBpbklkKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGluVEwubGVuZ3RoLCB0OyBpIDwgbCAmJiAodCA9IGluVExbaV0pOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAodC5pZGVudGlmaWVyID09PSBpbklkKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgLy8gSW4gc29tZSBpbnN0YW5jZXMsIGEgdG91Y2hzdGFydCBjYW4gaGFwcGVuIHdpdGhvdXQgYSB0b3VjaGVuZC4gVGhpc1xuICAgICAgICAvLyBsZWF2ZXMgdGhlIHBvaW50ZXJtYX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SAhPT0gMSAmJiAhdGhpcy5maW5kVG91Y2godGwsIGtleSAtIDIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgdGhpcyk7XG4gICAgICAgICAgICAgICAgZC5mb3JFYWNoKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwocCk7XG4gICAgICAgICAgICAgICAgICAgIHBvaW50ZXJtYXAuZGVsZXRlKHAucG9pbnRlcklkKTtcbiAgICAgICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdG91Y2hzdGFydDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy52YWN1dW1Ub3VjaGVzKGluRXZlbnQpO1xuICAgICAgICAgICAgdGhpcy5zZXRQcmltYXJ5VG91Y2goaW5FdmVudC5jaGFuZ2VkVG91Y2hlc1swXSk7XG4gICAgICAgICAgICB0aGlzLmRlZHVwU3ludGhNb3VzZShpbkV2ZW50KTtcbiAgICAgICAgICAgIGlmICghdGhpcy5zY3JvbGxpbmcpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNsaWNrQ291bnQrKztcbiAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMuZG93bik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluUG9pbnRlcikge1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGluUG9pbnRlcik7XG4gICAgICAgIH0sXG4gICAgICAgIHRvdWNobW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKEhBU19UT1VDSF9BQ1RJT04pIHtcbiAgICAgICAgICAgICAgICAvLyB0b3VjaGV2ZW50LmNhbmNlbGFibGUgPT0gZmFsc2UgaXMgc2VudCB3aGVuIHRoZSBwYWdlIGlzIHNjcm9sbGluZyB1bmRlciBuYXRpdmUgVG91Y2ggQWN0aW9uIGluIENocm9tZSAzNlxuICAgICAgICAgICAgICAgIC8vIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vYS9jaHJvbWl1bS5vcmcvZC9tc2cvaW5wdXQtZGV2L3dIbnl1a2NZQmNBL2I5a210d00xakpRSlxuICAgICAgICAgICAgICAgIGlmIChpbkV2ZW50LmNhbmNlbGFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzVG91Y2hlcyhpbkV2ZW50LCB0aGlzLm1vdmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNjcm9sbGluZykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxpbmcgPT09IG51bGwgJiYgdGhpcy5zaG91bGRTY3JvbGwoaW5FdmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsaW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbkV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMubW92ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuZmlyc3RYWSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGluRXZlbnQuY2hhbmdlZFRvdWNoZXNbMF07XG4gICAgICAgICAgICAgICAgICAgIHZhciBkeCA9IHQuY2xpZW50WCAtIHRoaXMuZmlyc3RYWS5YO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZHkgPSB0LmNsaWVudFkgLSB0aGlzLmZpcnN0WFkuWTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRkID0gTWF0aC5zcXJ0KGR4ICogZHggKyBkeSAqIGR5KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRkID49IEhZU1RFUkVTSVMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG91Y2hjYW5jZWwoaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcnN0WFkgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShpblBvaW50ZXIpO1xuICAgICAgICB9LFxuICAgICAgICB0b3VjaGVuZDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdGhpcy5kZWR1cFN5bnRoTW91c2UoaW5FdmVudCk7XG4gICAgICAgICAgICB0aGlzLnByb2Nlc3NUb3VjaGVzKGluRXZlbnQsIHRoaXMudXApO1xuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5Qb2ludGVyKSB7XG4gICAgICAgICAgICBpblBvaW50ZXIucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5Qb2ludGVyKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIudXAoaW5Qb2ludGVyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbihpblBvaW50ZXIpIHtcbiAgICAg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AgICAgfTtcbiAgICAgICAgICAgICAgICBsdHMucHVzaChsdCk7XG4gICAgICAgICAgICAgICAgdmFyIGZuID0gKGZ1bmN0aW9uKGx0cywgbHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsdHMuaW5kZXhPZihsdCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGx0cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KS5iaW5kKG51bGwsIGx0cywgbHQpO1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZm4sIERFRFVQX1RJTUVPVVQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHByZXZlbnQgXCJnaG9zdCBjbGlja3NcIiB0aGF0IGNvbWUgZnJvbSBlbGVtZW50cyB0aGF0IHdlcmUgcmVtb3ZlZCBpbiBhIHRvdWNoIGhhbmRsZXJcbiAgICB2YXIgU1RPUF9QUk9QX0ZOID0gRXZlbnQucHJvdG90eXBlLnN0b3BJbW1lZGlhdGVQcm9wYWdhdGlvbiB8fCBFdmVudC5wcm90b3R5cGUuc3RvcFByb3BhZ2F0aW9uO1xuICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oZXYpIHtcbiAgICAgICAgdmFyIHggPSBldi5jbGllbnRYLFxuICAgICAgICAgICAgeSA9IGV2LmNsaWVudFk7XG4gICAgICAgIC8vIGNoZWNrIGlmIGEgY2xpY2sgaXMgd2l0aGluIERFRFVQX0RJU1QgcHggcmFkaXVzIG9mIHRoZSB0b3VjaHN0YXJ0XG4gICAgICAgIHZhciBjbG9zZVRvID0gZnVuY3Rpb24odG91Y2gpIHtcbiAgICAgICAgICAgIHZhciBkeCA9IE1hdGguYWJzKHggLSB0b3VjaC54KSxcbiAgICAgICAgICAgICAgICBk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AgICAgICAgICdwZW4nLFxuICAgICAgICAgICAgJ21vdXNlJ1xuICAgICAgICBdLFxuICAgICAgICBwcmVwYXJlRXZlbnQ6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gaW5FdmVudDtcbiAgICAgICAgICAgIGUgPSBkaXNwYXRjaGVyLmNsb25lRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoSEFTX0JJVE1BUF9UWVBFKSB7XG4gICAgICAgICAgICAgICAgZS5wb2ludGVyVHlwZSA9IHRoaXMuUE9JTlRFUl9UWVBFU1tpbkV2ZW50LnBvaW50ZXJUeXBlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGUuX3NvdXJjZSA9ICdtcyc7XG4gICAgICAgICAgICByZXR1cm4gZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2xlYW51cDogZnVuY3Rpb24oaWQpIHtcbiAgICAgICAgICAgIHBvaW50ZXJtYXBbJ2RlbGV0ZSddKGlkKTtcbiAgICAgICAgfSxcbiAgICAgICAgTVNQb2ludGVyRG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIHBvaW50ZXJtYXAuc2V0KGluRXZlbnQucG9pbnRlcklkLCBlLnRhcmdldCk7XG4gICAgICAgICAgICBkaXNwYXRjaGVyLmRvd24oZSk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlck1vdmU6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciB0YXJnZXQgPSBwb2ludGVybWFwLmdldChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgICAgICBpZiAodGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgICAgICBlLnRhcmdldCA9IHRhcmdldDtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaGVyLm1vdmUoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlclVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIE1TUG9pbnRlckNhbmNlbDogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnByZXBhcmVFdmVudChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUucmVsYXRlZFRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGUucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGRpc3BhdGNoZXIuY2FuY2VsKGUpO1xuICAgICAgICAgICAgdGhpcy5jbGVhbnVwKGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBzY29wZS5tc0V2ZW50cyA9IG1zRXZlbnRzO1xufSkoZXhwb3J0cyk7XG5cbihmdW5jdGlvbihzY29wZSkge1xuICAgIHZhciBkaXNwYXRjaGVyID0gc2NvcGUuZGlzcGF0Y2hlcjtcbiAgICB2YXIgc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bnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnRhcmdldCA9IHNjb3BlLmZpbmRUYXJnZXQoaW5FdmVudCk7XG4gICAgICAgICAgICBwb2ludGVybWFwLnNldChlLnBvaW50ZXJJZCwgZS50YXJnZXQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci5kb3duKGUpO1xuICAgICAgICB9LFxuICAgICAgICBwb2ludGVybW92ZTogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgdmFyIHRhcmdldCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmICh0YXJnZXQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGUudGFyZ2V0ID0gdGFyZ2V0O1xuICAgICAgICAgICAgICAgIGRpc3BhdGNoZXIubW92ZShlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcG9pbnRlcnVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgZSA9IHRoaXMucHJlcGFyZUV2ZW50KGluRXZlbnQpO1xuICAgICAgICAgICAgZS5yZWxhdGVkVGFyZ2V0ID0gc2NvcGUuZmluZFRhcmdldChpbkV2ZW50KTtcbiAgICAgICAgICAgIGUudGFyZ2V0ID0gcG9pbnRlcm1hcC5nZXQoZS5wb2ludGVySWQpO1xuICAgICAgICAgICAgZGlzcGF0Y2hlci51cChlKTtcbiAgICAgICAgICAgIHRoaXMuY2xlYW51cChpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH0sXG4gICAgICAgIHBvaW50ZXJjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcmVwYXJlRXZlbnQoaW5FdmVudCk7XG4gICAgICAgICAgICBlLnJlbGF0ZWRUYX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cbiAgICB2YXIgZGlzcGF0Y2hlciA9IHNjb3BlLmRpc3BhdGNoZXI7XG4gICAgdmFyIGV2ZW50RmFjdG9yeSA9IHNjb3BlLmV2ZW50RmFjdG9yeTtcbiAgICB2YXIgcG9pbnRlcm1hcCA9IG5ldyBzY29wZS5Qb2ludGVyTWFwKCk7XG4gICAgdmFyIHRyYWNrID0ge1xuICAgICAgICBldmVudHM6IFtcbiAgICAgICAgICAgICdkb3duJyxcbiAgICAgICAgICAgICdtb3ZlJyxcbiAgICAgICAgICAgICd1cCcsXG4gICAgICAgIF0sXG4gICAgICAgIGV4cG9zZXM6IFtcbiAgICAgICAgICAgICd0cmFja3N0YXJ0JyxcbiAgICAgICAgICAgICd0cmFjaycsXG4gICAgICAgICAgICAndHJhY2t4JyxcbiAgICAgICAgICAgICd0cmFja3knLFxuICAgICAgICAgICAgJ3RyYWNrZW5kJ1xuICAgICAgICBdLFxuICAgICAgICBkZWZhdWx0QWN0aW9uczoge1xuICAgICAgICAgICAgJ3RyYWNrJzogJ25vbmUnLFxuICAgICAgICAgICAgJ3RyYWNreCc6ICdwYW4teScsXG4gICAgICAgICAgICAndHJhY2t5JzogJ3Bhbi14J1xuICAgICAgICB9LFxuICAgICAgICBXSUdHTEVfVEhSRVNIT0xEOiA0LFxuICAgICAgICBjbGFtcERpcjogZnVuY3Rpb24oaW5EZWx0YSkge1xuICAgICAgICAgICAgcmV0dXJuIGluRGVsdGEgPiAwID8gMSA6IC0xO1xuICAgICAgICB9LFxuICAgICAgICBjYWxjUG9zaXRpb25EZWx0YTogZnVuY3Rpb24oaW5BLCBpbkIpIHtcbiAgICAgICAgICAgIHZhciB4ID0gMCxcbiAgICAgICAgICAgICAgICB5ID0gMDtcbiAgICAgICAgICAgIGlmIChpbkEgJiYgaW5CKSB7XG4gICAgICAgICAgICAgICAgeCA9IGluQi5wYWdlWCAtIGluQS5wYWdlWDtcbiAgICAgICAgICAgICAgICB5ID0gaW5CLnBhZ2VZIC0gaW5BLnBhZ2VZO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVUcmFjazogZnVuY3Rpb24oaW5UeXBlLCBpbkV2ZW50LCBpblRyYWNraW5nRGF0YSkge1xuICAgICAgICAgICAgdmFyIHQgPSBpblRyYWNraW5nRGF0YTtcbiAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YSh0LmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICB2YXIgZGQgPSB0aGlzLmNhbGNQb3NpdGlvbkRlbHRhKHQubGFzdE1vdmVFdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICBpZiAoZGQueCkge1xuICAgICAgICAgICAgICAgIHQueERpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGQueSkge1xuICAgICAgICAgICAgICAgIHQueURpcmVjdGlvbiA9IHRoaXMuY2xhbXBEaXIoZGQueSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGluVHlwZSA9PT0gJ3RyYWNreScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZ2VzdHVyZVByb3RvID0ge1xuICAgICAgICAgICAgICAgIGJ1YmJsZXM6IHRydWUsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICB0cmFja0luZm86IHQudHJhY2tJbmZvLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRUYXJnZXQ6IGluRXZlbnQucmVsYXRlZFRhcmdldCxcbiAgICAgICAgICAgICAgICBwb2ludGVyVHlwZTogaW5FdmVudC5wb2ludGVyVHlwZSxcbiAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgIF9zb3VyY2U6ICd0cmFjaydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaW5UeXBlICE9PSAndHJhY2t5Jykge1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54ID0gaW5FdmVudC54O1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5keCA9IGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZGR4ID0gZGQueDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uY2xpZW50WCA9IGluRXZlbnQuY2xpZW50WDtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ucGFnZVggPSBpbkV2ZW50LnBhZ2VYO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by5zY3JlZW5YID0gaW5FdmVudC5zY3JlZW5YO1xuICAgICAgICAgICAgICAgIGdlc3R1cmVQcm90by54RGlyZWN0aW9uID0gdC54RGlyZWN0aW9uO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGluVHlwZSAhPT0gJ3RyYWNreCcpIHtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uZHkgPSBkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmRkeSA9IGRkLnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnkgPSBpbkV2ZW50Lnk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLmNsaWVudFkgPSBpbkV2ZW50LmNsaWVudFk7XG4gICAgICAgICAgICAgICAgZ2VzdHVyZVByb3RvLnBhZ2VZID0gaW5FdmVudC5wYWdlWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8uc2NyZWVuWSA9IGluRXZlbnQuc2NyZWVuWTtcbiAgICAgICAgICAgICAgICBnZXN0dXJlUHJvdG8ueURpcmVjdGlvbiA9IHQueURpcmVjdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBlID0gZXZlbnRGYWN0b3J5Lm1ha2VHZXN0dXJlRXZlbnQoaW5UeXBlLCBnZXN0dXJlUHJvdG8pO1xuICAgICAgICAgICAgdC5kb3duVGFyZ2V0LmRpc3BhdGNoRXZlbnQoZSk7XG4gICAgICAgIH0sXG4gICAgICAgIGRvd246IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIGlmIChpbkV2ZW50LmlzUHJpbWFyeSAmJiAoaW5FdmVudC5wb2ludGVyVHlwZSA9PT0gJ21vdXNlJyA/IGluRXZlbnQuYnV0dG9ucyA9PT0gMSA6IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHAgPSB7XG4gICAgICAgICAgICAgICAgICAgIGRvd25FdmVudDogaW5FdmVudCxcbiAgICAgICAgICAgICAgICAgICAgZG93blRhcmdldDogaW5FdmVudC50YXJnZXQsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNrSW5mbzoge30sXG4gICAgICAgICAgICAgICAgICAgIGxhc3RNb3ZlRXZlbnQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHhEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHlEaXJlY3Rpb246IDAsXG4gICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiBmYWxzZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIHApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICB2YXIgcCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwLnRyYWNraW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpcy5jYWxjUG9zaXRpb25EZWx0YShwLmRvd25FdmVudCwgaW5FdmVudCk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtb3ZlID0gZC54ICogZC54ICsgZC55ICogZC55O1xuICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0cmFja2luZyBvbmx5IGlmIGZpbmdlciBtb3ZlcyBtb3JlIHRoYW4gV0lHR0xFX1RIUkVTSE9MRFxuICAgICAgICAgICAgICAgICAgICBpZiAobW92ZSA+IHRoaXMuV0lHR0xFX1RIUkVTSE9MRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcC50cmFja2luZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBwLmRvd25FdmVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3N0YXJ0JywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHAudHJhY2tpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNrJywgaW5FdmVudCwgcCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVRyYWNrKCd0cmFja3gnLCBpbkV2ZW50LCBwKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlVHJhY2soJ3RyYWNreScsIGluRXZlbnQsIHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwLmxhc3RNb3ZlRXZlbnQgPSBpbkV2ZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICB1cDogZnVuY3Rpb24oaW5FdmVudCkge1xuIC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AgICdob2xkJyxcbiAgICAgICAgICAgICdob2xkcHVsc2UnLFxuICAgICAgICAgICAgJ3JlbGVhc2UnXG4gICAgICAgIF0sXG4gICAgICAgIGhlbGRQb2ludGVyOiBudWxsLFxuICAgICAgICBob2xkSm9iOiBudWxsLFxuICAgICAgICBwdWxzZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaG9sZCA9IERhdGUubm93KCkgLSB0aGlzLmhlbGRQb2ludGVyLnRpbWVTdGFtcDtcbiAgICAgICAgICAgIHZhciB0eXBlID0gdGhpcy5oZWxkID8gJ2hvbGRwdWxzZScgOiAnaG9sZCc7XG4gICAgICAgICAgICB0aGlzLmZpcmVIb2xkKHR5cGUsIGhvbGQpO1xuICAgICAgICAgICAgdGhpcy5oZWxkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5ob2xkSm9iKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmhlbGQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVIb2xkKCdyZWxlYXNlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmhlbGQgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuaGVsZFBvaW50ZXIgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5ob2xkSm9iID0gbnVsbDtcbiAgICAgICAgfSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgaWYgKGluRXZlbnQuaXNQcmltYXJ5ICYmICF0aGlzLmhlbGRQb2ludGVyKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oZWxkUG9pbnRlciA9IGluRXZlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBpbkV2ZW50LnRhcmdldDtcbiAgICAgICAgICAgICAgICB0aGlzLmhvbGRKb2IgPSBzZXRJbnRlcnZhbCh0aGlzLnB1bHNlLmJpbmQodGhpcyksIHRoaXMuSE9MRF9ERUxBWSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHVwOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5oZWxkUG9pbnRlciAmJiB0aGlzLmhlbGRQb2ludGVyLnBvaW50ZXJJZCA9PT0gaW5FdmVudC5wb2ludGVySWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgeCA9IGluRXZlbnQuY2xpZW50WCAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WDtcbiAgICAgICAgICAgICAgICB2YXIgeSA9IGluRXZlbnQuY2xpZW50WSAtIHRoaXMuaGVsZFBvaW50ZXIuY2xpZW50WTtcbiAgICAgICAgICAgICAgICBpZiAoKHggKiB4ICsgeSAqIHkpID4gdGhpcy5XSUdHTEVfVEhSRVNIT0xEKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBmaXJlSG9sZDogZnVuY3Rpb24oaW5UeXBlLCBpbkhvbGRUaW1lKSB7XG4gICAgICAgICAgICB2YXIgcCA9IHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiB0cnVlLFxuICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAg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mJ1dHRvbnMsXG4gICAgICAgICAgICAgICAgICAgIHg6IGluRXZlbnQuY2xpZW50WCxcbiAgICAgICAgICAgICAgICAgICAgeTogaW5FdmVudC5jbGllbnRZXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHNob3VsZFRhcDogZnVuY3Rpb24oZSwgZG93blN0YXRlKSB7XG4gICAgICAgICAgICB2YXIgdGFwID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmIChlLnBvaW50ZXJUeXBlID09PSAnbW91c2UnKSB7XG4gICAgICAgICAgICAgICAgLy8gb25seSBhbGxvdyBsZWZ0IGNsaWNrIHRvIHRhcCBmb3IgbW91c2VcbiAgICAgICAgICAgICAgICB0YXAgPSAoZS5idXR0b25zIF4gMSkgJiYgKGRvd25TdGF0ZS5idXR0b25zICYgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGFwICYmICFlLnRhcFByZXZlbnRlZDtcbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBzdGFydCA9IHBvaW50ZXJtYXAuZ2V0KGluRXZlbnQucG9pbnRlcklkKTtcbiAgICAgICAgICAgIGlmIChzdGFydCAmJiB0aGlzLnNob3VsZFRhcChpbkV2ZW50LCBzdGFydCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cC5yZWxhdGVkVGFyZ2V0IGlzIHRhcmdldCBjdXJyZW50bHkgdW5kZXIgZmluZ2VyXG4gICAgICAgICAgICAgICAgdmFyIHQgPSBzY29wZS50YXJnZXRGaW5kaW5nLkxDQShzdGFydC50YXJnZXQsIGluRXZlbnQucmVsYXRlZFRhcmdldCk7XG4gICAgICAgICAgICAgICAgaWYgKHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCgndGFwJywge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB4OiBpbkV2ZW50LmNsaWVudFgsXG4gICAgICAgICAgICAgICAgICAgICAgICB5OiBpbkV2ZW50LmNsaWVudFksXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IGluRXZlbnQuZGV0YWlsLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IGluRXZlbnQucG9pbnRlclR5cGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVySWQ6IGluRXZlbnQucG9pbnRlcklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWx0S2V5OiBpbkV2ZW50LmFsdEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZXk6IGluRXZlbnQuY3RybEtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFLZXk6IGluRXZlbnQubWV0YUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoaWZ0S2V5OiBpbkV2ZW50LnNoaWZ0S2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgX3NvdXJjZTogJ3RhcCdcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwb2ludGVybWFwLmRlbGV0ZShpbkV2ZW50LnBvaW50ZXJJZCk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIC8vIHBhdGNoIGV2ZW50RmFjdG9yeSB0byByZW1vdmUgaWQgZnJvbSB0YXAncyBwb2ludGVybWFwIGZvciBwcmV2ZW50VGFwIGNhbGxzXG4gICAgZXZlbnRGYWN0b3J5LnByZXZlbnRUYXAgPSBmdW5jdGlvbihlKSB7XG4gICAgICAgIHJld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gcmVmZXJlbmNlOiB7fSxcbiAgICAgICAgZG93bjogZnVuY3Rpb24oaW5FdmVudCkge1xuICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgaWYgKHBvaW50ZXJtYXAucG9pbnRlcnMoKSA9PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZmVyZW5jZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgYW5nbGU6IGFuZ2xlLFxuICAgICAgICAgICAgICAgICAgICBkaWFtZXRlcjogcG9pbnRzLmRpYW1ldGVyLFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHNjb3BlLnRhcmdldEZpbmRpbmcuTENBKHBvaW50cy5hLnRhcmdldCwgcG9pbnRzLmIudGFyZ2V0KVxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZpcmVQaW5jaCgncGluY2hzdGFydCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgdXA6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHZhciBwID0gcG9pbnRlcm1hcC5nZXQoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgdmFyIG51bSA9IHBvaW50ZXJtYXAucG9pbnRlcnMoKTtcbiAgICAgICAgICAgIGlmIChwKSB7XG4gICAgICAgICAgICAgICAgaWYgKG51bSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaXJlICdwaW5jaGVuZCcgYmVmb3JlIGRlbGV0aW5nIHBvaW50ZXJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvaW50cyA9IHRoaXMuY2FsY0Nob3JkKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaGVuZCcsIHBvaW50cy5kaWFtZXRlciwgcG9pbnRzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5kZWxldGUoaW5FdmVudC5wb2ludGVySWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtb3ZlOiBmdW5jdGlvbihpbkV2ZW50KSB7XG4gICAgICAgICAgICBpZiAocG9pbnRlcm1hcC5oYXMoaW5FdmVudC5wb2ludGVySWQpKSB7XG4gICAgICAgICAgICAgICAgcG9pbnRlcm1hcC5zZXQoaW5FdmVudC5wb2ludGVySWQsIGluRXZlbnQpO1xuICAgICAgICAgICAgICAgIGlmIChwb2ludGVybWFwLnBvaW50ZXJzKCkgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsY1BpbmNoUm90YXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYW5jZWw6IGZ1bmN0aW9uKGluRXZlbnQpIHtcbiAgICAgICAgICAgIHRoaXMudXAoaW5FdmVudCk7XG4gICAgICAgIH0sXG4gICAgICAgIGZpcmVQaW5jaDogZnVuY3Rpb24odHlwZSwgZGlhbWV0ZXIsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIHpvb20gPSBkaWFtZXRlciAvIHRoaXMucmVmZXJlbmNlLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGUgPSBldmVudEZhY3RvcnkubWFrZUdlc3R1cmVFdmVudCh0eXBlLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIHNjYWxlOiB6b29tLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgZmlyZVJvdGF0ZTogZnVuY3Rpb24oYW5nbGUsIHBvaW50cykge1xuICAgICAgICAgICAgdmFyIGRpZmYgPSBNYXRoLnJvdW5kKChhbmdsZSAtIHRoaXMucmVmZXJlbmNlLmFuZ2xlKSAlIDM2MCk7XG4gICAgICAgICAgICB2YXIgZSA9IGV2ZW50RmFjdG9yeS5tYWtlR2VzdHVyZUV2ZW50KCdyb3RhdGUnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogdHJ1ZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGFuZ2xlOiBkaWZmLFxuICAgICAgICAgICAgICAgIGNlbnRlclg6IHBvaW50cy5jZW50ZXIueCxcbiAgICAgICAgICAgICAgICBjZW50ZXJZOiBwb2ludHMuY2VudGVyLnksXG4gICAgICAgICAgICAgICAgX3NvdXJjZTogJ3BpbmNoJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jZS50YXJnZXQuZGlzcGF0Y2hFdmVudChlKTtcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY1BpbmNoUm90YXRlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBwb2ludHMgPSB0aGlzLmNhbGNDaG9yZCgpO1xuICAgICAgICAgICAgdmFyIGRpYW1ldGVyID0gcG9pbnRzLmRpYW1ldGVyO1xuICAgICAgICAgICAgdmFyIGFuZ2xlID0gdGhpcy5jYWxjQW5nbGUocG9pbnRzKTtcbiAgICAgICAgICAgIGlmIChkaWFtZXRlciAhPSB0aGlzLnJlZmVyZW5jZS5kaWFtZXRlcikge1xuICAgICAgICAgICAgICAgIHRoaXMuZmlyZVBpbmNoKCdwaW5jaCcsIGRpYW1ldGVyLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFuZ2xlICE9IHRoaXMucmVmZXJlbmNlLmFuZ2xlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJlUm90YXRlKGFuZ2xlLCBwb2ludHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjYWxjQ2hvcmQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgdmFyIHBvaW50ZXJzID0gW107XG4gICAgICAgICAgICBwb2ludGVybWFwLmZvckVhY2goZnVuY3Rpb24ocCkge1xuICAgICAgICAgICAgICAgIHBvaW50ZXJzLnB1c2gocCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHZhciBkaXN0ID0gMDtcbiAgICAgICAgICAgIC8vIHN0YXJ0IHdpdGggYXQgbGVhc3QgdHdvIHBvaW50ZXJzXG4gICAgICAgICAgICB2YXIgcG9pbnRzID0ge1xuICAgICAgICAgICAgICAgIGE6IHBvaW50ZXJzWzBdLFxuICAgICAgICAgICAgICAgIGI6IHBvaW50ZXJzWzFdXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdmFyIHgsIHksIGQ7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBvaW50ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBwb2ludGVyc1tpXTtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gaSArIDE7IGogPCBwb2ludGVycy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHBvaW50ZXJzW2pdO1xuICAgICAgICAgICAgICAgICAgICB4ID0gTWF0aC5hYnMoYS5jbGllbnRYIC0gYi5jbGllbnRYKTtcbiAgICAgICAgICAgICAgICAgICAgeSA9IE1hdGguYWJzKGEuY2xpZW50WSAtIGIuY2xpZW50WSk7XG4gICAgICAgICAgICAgICAgICAgIGQgPSB4ICsgeTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPiBkaXN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGI6IGJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB4ID0gTWF0aC5hYnMocG9pbnRzLmEuY2xpZW50WCArIHBvaW50cy5iLmNsaWVudFgpIC8gMjtcbiAgICAgICAgICAgIHkgPSBNYXRoLmFicyhwb2ludHMuYS5jbGllbnRZICsgcG9pbnRzLmIuY2xpZW50WSkgLyAyO1xuICAgICAgICAgICAgcG9pbnRzLmNlbnRlciA9IHtcbiAgICAgICAgICAgICAgICB4OiB4LFxuICAgICAgICAgICAgICAgIHk6IHlcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBwb2ludHMuZGlhbWV0ZXIgPSBkaXN0O1xuICAgICAgICAgICAgcmV0dXJuIHBvaW50cztcbiAgICAgICAgfSxcbiAgICAgICAgY2FsY0FuZ2xlOiBmdW5jdGlvbihwb2ludHMpIHtcbiAgICAgICAgICAgIHZhciB4ID0gcG9pbnRzLmEuY2xpZW50WCAtIHBvaW50cy5iLmNsaWVudFg7XG4gICAgICAgICAgICB2YXIgeSA9IHBvaW50cy5hLmNsaWVudFkgLSBwb2ludHMuYi5jbGllbnRZO1xuICAgICAgICAgICAgcmV0dXJuICgzNjAgKyBNYXRoLmF0YW4yKHksIHgpICogUkFEX1RP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5OiBmdW5jdGlvbihkZXB0aCkge1xuICAgICAgICB0aGlzLmRlcHRoID0gZGVwdGg7XG4gICAgICAgIHRoaXMuZGF0YVswXSA9IHRoaXMuY29tcHV0ZURlcHRoU3RyaW5nKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBjb21wdXRlRGVwdGhTdHJpbmc6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gQXJyYXkodGhpcy5kZXB0aCArIDEpLmpvaW4odGhpcy5JTkRFTlQpICsgJyAgJyArIHRoaXMubGFiZWw7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBjb21wdXRlSGVpZ2h0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgcmV0dXJuIDE7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhTm9kZUxlYWYucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge0FycmF5fVxuICAgICAqL1xuICAgIGdldEluZGV4OiBmdW5jdGlvbigpIHsgLy8gVE9ETzogZm9ybWVybHkgZ2V0QWxsUm93SW5kZXhlc1xuICAgICAgICByZXR1cm4gdGhpcy5pbmRleDtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFOb2RlTGVhZi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gYWdncmVnYXRvclxuICAgICAqL1xuICAgIGNvbXB1dGVBZ2dyZWdhdGVzOiBmdW5jdGlvbihhZ2dyZWdhdG9yKSB7XG4gICAgICAgIHZhciBpbmRleCA9IHRoaXMuZ2V0SW5kZXgoKTtcblxuICAgICAgICBpZiAoaW5kZXgubGVu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bnN0cnVjdG9yXG5cbiAgICBpc051bGxPYmplY3Q6IGZhbHNlLFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0W119XG4gICAgICovXG4gICAgZ2V0Um93OiBmdW5jdGlvbih5KSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFbeV07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB4XG4gICAgICogQHBhcmFtIHlcbiAgICAgKiBAcmV0dXJucyB7Kn1cbiAgICAgKi9cbiAgICBnZXRWYWx1ZTogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgcm93ID0gdGhpcy5nZXRSb3coeSk7XG4gICAgICAgIGlmICghcm93KSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcm93W3RoaXMuZmllbGRzW3hdXTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geVxuICAgICAqIEBwYXJhbSB2YWx1ZVxuICAgICAqL1xuICAgIHNldFZhbHVlOiBmdW5jdGlvbih4LCB5LCB2YWx1ZSkge1xuICAgICAgICB0aGlzLmdldFJvdyh5KVt0aGlzLmZpZWxkc1t4XV0gPSB2YWx1ZTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2UucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge251bWJlcn1cbiAgICAgKi9cbiAgICBnZXRSb3dDb3VudDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLm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dsZUV4cGFuc2lvblN0YXRlKHRoaXMpO1xuICAgICAgICB0aGlzLmJ1aWxkVmlldygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgRGF0YVNvdXJjZUFnZ3JlZ2F0b3IucHJvdG90eXBlXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZ2V0SGVhZGVyczogZnVuY3Rpb24oKSB7XG4gICAgICAgIGlmICghdGhpcy52aWV3TWFrZXNTZW5zZSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhU291cmNlLmdldEhlYWRlcnMoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5oZWFkZXJzOyAvLyBUT0RPOiBWaWV3cyBvdmVycmlkZSBkYXRhU291cmNlIGhlYWRlcnMgd2l0aCB0aGVpciBvd24gaGVhZGVycz9cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBoZWFkZXJzXG4gICAgICovXG4gICAgc2V0SGVhZGVyczogZnVuY3Rpb24oaGVhZGVycykge1xuICAgICAgICB0aGlzLmRhdGFTb3VyY2Uuc2V0SGVhZGVycyhoZWFkZXJzKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIERhdGFTb3VyY2VBZ2dyZWdhdG9yLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHsqfG51bWJlcltdfVxuICAgICAqL1xuICAgIGdldEZpZWxkczogZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFTb3VyY2UuZ2V0RmllbGRzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBEYXRhU291cmNlQWdncmVnYXRvci5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gZmllbGRzXG4gICAgICogQHJldHVybn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uICAgICAgICBpZiAodHlwZW9mIGl0ZXJhdGVlID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICB2YXIga2V5cyA9IHRoaXMua2V5cyxcbiAgICAgICAgICAgICAgICBzZWxmID0gdGhpcztcbiAgICAgICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBzZWxmLmdldChrZXkpO1xuICAgICAgICAgICAgICAgIGl0ZXJhdGVlKHZhbHVlLCBrZXksIHNlbGYpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE1hcHB5LnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7ZnVuY3Rpb259IGl0ZXJhdGVlXG4gICAgICogQHJldHVybnMge01hcHB5fVxuICAgICAqL1xuICAgIG1hcDogZnVuY3Rpb24oaXRlcmF0ZWUpIHtcbiAgICAgICAgdmFyIGtleXMgPSB0aGlzLmtleXMsXG4gICAgICAgICAgICBuZXdNYXAgPSBuZXcgTWFwcHkoKSxcbiAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuXG4gICAgICAgIGlmICghKHR5cGVvZiBpdGVyYXRlZSA9PT0gJ2Z1bmN0aW9uJykpIHtcbiAgICAgICAgICAgIGl0ZXJhdGVlID0gcmVmbGVjdGlvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IHNlbGYuZ2V0KGtleSksXG4gICAgICAgICAgICAgICAgdHJhbnNmb3JtZWQgPSBpdGVyYXRlZSh2YWx1ZSwga2V5LCBzZWxmKTtcbiAgICAgICAgICAgIG5ld01hcC5zZXQoa2V5LCB0cmFuc2Zvcm1lZCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gbmV3TWFwO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgTWFwcHkucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge01hcHB5fVxuICAgICAqL1xuICAgIGNvcHk6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIga2V5cyA9IHRoaXMua2V5cyxcbiAgICAgICAgICAgIG5ld01hcCA9IG5ldyBNYXBweSgpLFxuICAgICAgICAgICAgc2VsZiA9IHRoaXM7XG4gICAgICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbihrZXkpIHtcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IHNlbGYuZ2V0KGtleSk7XG4gICAgICAgICAgICBuZXdNYXAuc2V0KGtleSwgdmFsdWUpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIG5ld01hcDtcbiAgICB9XG5cbn07XG5cbnZhciBPSURfUFJFRklYID0gJy5+LiMlXyc7IC8vdGhpcyBzaG91bGQgYmUgc29tZXRoaW5nIHdlIG5ldmVyIHdpbGwgc2VlIGF0IHRoZSBiZWdpbm5pbmcgb2YgYSBzdHJpbmdcbnZhciBjb3VudGVyID0gMDtcblxuZnVuY3Rpb24gaGFzaChrZXkpIHtcbiAgICB2YXIgdHlwZU9mID0gdHlwZW9mIGtleTtcblxuICAgIHN3aXRjaCAodHlwZU9mKSB7XG4gICAgICAgIGNhc2UgJ251bWJlcic6XG4gICAgICAgIGNhc2UgJ3N0cmluZyc6XG4gICAgICAgIGNhc2UgJ2Jvb2xlYW4nOlxuICAgICAgICBjYXNlICdzeW1ib2wnOlxuICAgICAgICAgICAgcmV0dXJuIE9JRF9QUkVGSVggKyB0eXBlT2YgKyAnXycgKyBrZXk7XG5cbiAgICAgICAgY2FzZSAndW5kZWZpbmVkJzpcbiAgICAgICAgICAgIHJldHVybiAnVU5ERUZJTkVEJztcblxuICAgICAgICBjYXNlICdvYmplY3QnOlxuICAgICAgICAgICAgaWYgKGtleSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVyb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AgICAgbW9kZWxMaXN0LmVsZW1lbnQucmVtb3ZlRXZlbnRMaXN0ZW5lcignd2hlZWwnLCBjYXB0dXJlRXZlbnQpO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgcG9pbnRJbkxpc3RSZWN0czogZnVuY3Rpb24gKHBvaW50KSB7XG4gICAgICAgIHJldHVybiB0aGlzLm1vZGVsTGlzdHMuZmluZChmdW5jdGlvbiAobW9kZWxMaXN0KSB7XG4gICAgICAgICAgICB2YXIgcmVjdCA9IG1vZGVsTGlzdC5lbGVtZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpO1xuXG4gICAgICAgICAgICByZWN0ID0ge1xuICAgICAgICAgICAgICAgIGxlZnQ6ICAgd2luZG93LnNjcm9sbFggKyByZWN0LmxlZnQsXG4gICAgICAgICAgICAgICAgdG9wOiAgICB3aW5kb3cuc2Nyb2xsWSArIHJlY3QudG9wLFxuICAgICAgICAgICAgICAgIHJpZ2h0OiAgd2luZG93LnNjcm9sbFggKyByZWN0LnJpZ2h0LFxuICAgICAgICAgICAgICAgIGJvdHRvbTogd2luZG93LnNjcm9sbFkgKyByZWN0LmJvdHRvbSxcbiAgICAgICAgICAgICAgICB3aWR0aDogIHJlY3Qud2lkdGgsXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiByZWN0LmhlaWdodFxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgbW9kZWxMaXN0LnJlY3QgPSByZWN0O1xuXG4gICAgICAgICAgICBpZiAocG9pbnRJblJlY3QocG9pbnQsIHJlY3QpKSB7XG4gICAgICAgICAgICAgICAgbW9kZWxMaXN0LnJlY3QgPSByZWN0O1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOyAvLyBmb3VuZFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0sXG5cbiAgICBwb2ludEluSXRlbVJ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gICAgICAgICAgICAgIGxpc3QuaXNEcm9wVGFyZ2V0ID09PSB1bmRlZmluZWQgfHxcblxuICAgICAgICAgICAgICAgIC8vIGZ1bmN0aW9uOiB1c2UgcmV0dXJuIHZhbHVlXG4gICAgICAgICAgICAgICAgdHlwZW9mIGxpc3QuaXNEcm9wVGFyZ2V0ID09PSAnZnVuY3Rpb24nICYmIGxpc3QuaXNEcm9wVGFyZ2V0KCkgfHxcblxuICAgICAgICAgICAgICAgIC8vIG90aGVyd2lzZTogdXNlIHRydXRoaW5lc3Mgb2YgZ2l2ZW4gdmFsdWVcbiAgICAgICAgICAgICAgICBsaXN0LmlzRHJvcFRhcmdldFxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgdmFyIHJlY3QgPSBpdGVtRWxlbWVudC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKSxcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gcmVjdC5ib3R0b207XG5cbiAgICAgICAgICAgICAgICBpZiAoaXRlbUVsZW1lbnQgPT09IGxpc3RFbGVtZW50Lmxhc3RFbGVtZW50Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gbGlzdEVsZW1lbnQuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkuYm90dG9tO1xuICAgICAgICAgICAgICAgICAgICBpZiAoYm90dG9tIDwgcmVjdC50b3ApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvdHRvbSA9IHJlY3QudG9wICsgKGhlaWdodCB8fCA1MCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBoZWlnaHQgPSByZWN0LmhlaWdodDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZWN0ID0ge1xuICAgICAgICAgICAgICAgICAgICBsZWZ0OiAgIHdpbmRvdy5zY3JvbGxYICsgcmVjdC5sZWZ0LFxuICAgICAg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vZiBsaXN0cz4gfVxuICAgIGl0ZW1Db29yZGluYXRlczogZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgdmFyIGxpc3RFbGVtZW50ID0gaXRlbS5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgY29vcmRzID0geyBpdGVtOiAwIH07XG5cbiAgICAgICAgd2hpbGUgKChpdGVtID0gaXRlbS5wcmV2aW91c0VsZW1lbnRTaWJsaW5nKSkge1xuICAgICAgICAgICAgKytjb29yZHMuaXRlbTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMubW9kZWxMaXN0cy5maW5kKGZ1bmN0aW9uIChsaXN0LCBpbmRleCkge1xuICAgICAgICAgICAgY29vcmRzLmxpc3QgPSBpbmRleDtcbiAgICAgICAgICAgIHJldHVybiBsaXN0LmVsZW1lbnQgPT09IGxpc3RFbGVtZW50OyAvLyBzdG9wIHdoZW4gd2UgZmluZCB0aGUgb25lIHdlIGJlbG9uZyB0b1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gY29vcmRzO1xuICAgIH1cblxufTtcblxudmFyIGhhbmRsZXJzID0ge1xuICAgIG1vdXNlZG93bjogZnVuY3Rpb24gKGRyYWdvbiwgZXZ0KSB7XG5cbiAgICAgICAgZXZ0LnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICBldnQucHJldmVudERlZmF1bHQoKTsgIC8vcHJldmVudHMgdXNlciBzZWxlY3Rpb24gb2YgcmVuZGVyZWQgbm9kZXMgZHVyaW5nIGRyYWdcblxuICAgICAgICBpZiAoZHJhZ29uLmRyb3ApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZWN0ID0gdGhpcy5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgICBkcmFnb24ucmVjdCA9IHJlY3QgPSB7XG4gICAgICAgICAgICBsZWZ0OiAgIE1hdGgucm91bmQocmVjdC5sZWZ0IC0gMSksXG4gICA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cbiAgICAgICAgdGhpcy5zdHlsZVt0cmFuc2Zvcm1dID0gdHJhbnNsYXRlKFxuICAgICAgICAgICAgcmVjdC5sZWZ0IC0gd2luZG93LnNjcm9sbFgsXG4gICAgICAgICAgICByZWN0LnRvcCAgLSB3aW5kb3cuc2Nyb2xsWVxuICAgICAgICApO1xuICAgICAgICB0aGlzLmNsYXNzTGlzdC5hZGQoJ2RyYWdvbi1wb3AnKTtcbiAgICAgICAgdGhpcy5zdHlsZS56SW5kZXggPSB3aW5kb3cuZ2V0Q29tcHV0ZWRTdHlsZShkcmFnb24ubW9kZWxMaXN0c1swXS5jb250YWluZXIucGFyZW50RWxlbWVudCkuekluZGV4O1xuXG4gICAgICAgIGlmICghZHJhZ29uLmNvbnRhaW5lcikge1xuICAgICAgICAgICAgLy8gd2FsayBiYWNrIHRvIGNsb3Nlc3Qgc2hhZG93IHJvb3QgT1IgYm9keSB0YWcgT1Igcm9vdCB0YWdcbiAgICAgICAgICAgIHZhciBjb250YWluZXIgPSB0aGlzO1xuICAgICAgICAgICAgd2hpbGUgKGNvbnRhaW5lci5wYXJlbnROb2RlKSB7XG4gICAgICAgICAgICAgICAgY29udGFpbmVyID0gY29udGFpbmVyLnBhcmVudE5vZGU7XG4gICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5lciBpbnN0YW5jZW9mIFNoYWRvd1Jvb3QgfHwgY29udGFpbmVyLnRhZ05hbWUgPT09ICdCT0RZJyl7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRyYWdvbi5jb250YWluZXIgPSBjb250YWluZXI7XG4gICAgICAgIH1cblxuICAgICAgICBkcmFnb24uY29udGFpbmVyLmFwcGVuZENoaWxkKHRoaXMpO1xuXG4gICAgICAgIHJlY3QubGVmdCAgICs9IHdpbmRvdy5zY3JvbGxYO1xuICAgICAgICByZWN0LnRvcCAgICArPSB3aW5kb3cuc2Nyb2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hYmxlIChpcyB0YWxsZXIgdGhhbiByZWN0KVxuICAgICAgICAgICAgICAgIGlmIChob3Zlckxpc3QuZWxlbWVudC5zY3JvbGxUb3AgPiAwICYmIChtYWduaXR1ZGUgPSB5IC0gKGhvdmVyTGlzdC5yZWN0LnRvcCArIDUpKSA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gbW91c2UgbmVhciBvciBhYm92ZSB0b3AgYW5kIGxpc3QgaXMgbm90IHNjcm9sbGVkIHRvIHRvcCB5ZXRcbiAgICAgICAgICAgICAgICAgICAgcmVzZXRBdXRvU2Nyb2xsVGltZXIobWFnbml0dWRlLCAwLCBob3Zlckxpc3QuZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChob3Zlckxpc3QuZWxlbWVudC5zY3JvbGxUb3AgPCBtYXhTY3JvbGxZICYmIChtYWduaXR1ZGUgPSB5IC0gKGhvdmVyTGlzdC5yZWN0LmJvdHRvbSAtIDEgLSA1KSkgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIG5lYXIgb3IgYmVsb3cgYm90dG9tIGFuZCBsaXN0IG5vdCBzY3JvbGxlZCB0byBib3R0b20geWV0XG4gICAgICAgICAgICAgICAgICAgIHJlc2V0QXV0b1Njcm9sbFRpbWVyKG1hZ25pdHVkZSwgbWF4U2Nyb2xsWSwgaG92ZXJMaXN0LmVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG1vdXNlIGluc2lkZVxuICAgICAgICAgICAgICAgICAgICByZXNldEF1dG9TY3JvbGxUaW1lcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIG90aGVyID0gZHJhZ29uLnBvaW50SW5JdGVtUmVjdHMoe1xuICAgICAgICAgICAgICAgIHg6IGV2dC5jbGllbnRYLFxuICAgICAgICAgICAgICAgIHk6IGRyYWdvbi5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L1xuZnVuY3Rpb24gY3JlYXRlTW9kZWxMaXN0c0Zyb21MaXN0RWxlbWVudHMobGlzdEl0ZW1FbGVtZW50cykge1xuICAgIHZhciBtb2RlbExpc3RzID0gW107XG5cbiAgICBsaXN0SXRlbUVsZW1lbnRzLmZvckVhY2goZnVuY3Rpb24gKGl0ZW1FbGVtZW50KSB7XG4gICAgICAgIHZhciBsaXN0RWxlbWVudCA9IGl0ZW1FbGVtZW50LnBhcmVudEVsZW1lbnQsXG4gICAgICAgICAgICBjb250YWluZXIgPSBsaXN0RWxlbWVudC5wYXJlbnRFbGVtZW50LFxuICAgICAgICAgICAgbW9kZWxzID0gW107XG4gICAgICAgIGlmICghbW9kZWxMaXN0cy5maW5kKGZ1bmN0aW9uIChsaXN0KSB7IHJldHVybiBsaXN0LmVsZW1lbnQgPT09IGxpc3RFbGVtZW50OyB9KSkge1xuICAgICAgICAgICAgdG9BcnJheShsaXN0RWxlbWVudC5xdWVyeVNlbGVjdG9yQWxsKCdsaScpKS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtRWxlbWVudCkge1xuICAgICAgICAgICAgICAgIGlmIChpdGVtRWxlbWVudCAhPT0gbGlzdEVsZW1lbnQubGFzdEVsZW1lbnRDaGlsZCkge1xuICAgICAgICAgICAgICAgICAgICBtb2RlbHMucHVzaChpdGVtRWxlbWVudC5pbm5lckhUTUwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgbW9kZWxzLmVsZW1lbnQgPSBsaXN0RWxlbWVudDtcbiAgICAgICAgICAgIG1vZGVscy5jb250YWluZXIgPSBjb250YWluZXI7XG4gICAgICAgICAgICBtb2RlbExpc3RzLnB1c2gobW9kZWxzKTtcbiAgICAgICAgfVxuICAgIH0pO1xuXG4gICAgcmV0dXJuIG1vZGVsTGlzdHM7XG59XG5cbmZ1bmN0aW9uIGNhcHR1cmVFdmVudChldnQpIHtcbiAgICBldnQuc3RvcFByb3BhZ2F0aW9u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ICBleHRlbmRPd246IGZ1bmN0aW9uIChzb3VyY2UpIHtcbiAgICAgICAgdmFyIG8gPSB0aGlzLm87XG4gICAgICAgIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cykuZm9yRWFjaChmdW5jdGlvbiAob2JqZWN0KSB7XG4gICAgICAgICAgICBXcmFwcGVyKG9iamVjdCkuZWFjaChmdW5jdGlvbiAodmFsLCBrZXkpIHsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuZXctY2FwXG4gICAgICAgICAgICAgICAgb1trZXldID0gdmFsO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcy5jaGFpbmluZyA/IHRoaXMgOiBvO1xuICAgIH1cbn07XG5cbi8vIGh0dHBzOi8vZGV2ZWxvcGVyLm1vemlsbGEub3JnL2VuLVVTL2RvY3MvV2ViL0phdmFTY3JpcHQvUmVmZXJlbmNlL0dsb2JhbF9PYmplY3RzL0FycmF5L2ZpbmRcbmlmICghQXJyYXkucHJvdG90eXBlLmZpbmQpIHtcbiAgICBBcnJheS5wcm90b3R5cGUuZmluZCA9IGZ1bmN0aW9uIChwcmVkaWNhdGUpIHsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1leHRlbmQtbmF0aXZlXG4gICAgICAgIGlmICh0aGlzID09PSBudWxsKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdBcnJheS5wcm90b3R5cGUuZmluZCBjYWxsZWQgb24gbnVsbCBvciB1bmRlZmluZWQnKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIHByZWRpY2F0ZSAhPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigncHJlZGljYXRlIG11c3QgYmUgYSBmdW5jdGlvbicpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBsaXN0ID0gT2JqZWN0KHRoaXMpO1xuICAgICA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mdsZWAuKV9cbiAgICAgKiBAcGFyYW0gcmVjdCB7UmVjdGFuZ2xlfSAtIFJlY3RhbmdsZSB0byB0ZXN0IHRoaXMgcG9pbnQgYWdhaW5zdC5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmZiB0aGlzIHBvaW50IGlzIHdpdGhpbiBnaXZlbiBgcmVjdGAuXG4gICAgICogQG1lbWJlck9mIFBvaW50LnByb3RvdHlwZVxuICAgICAqL1xuICAgIHdpdGhpbjogZnVuY3Rpb24ocmVjdCkge1xuICAgICAgICB2YXIgbWluWCA9IHJlY3Qub3JpZ2luLngsXG4gICAgICAgICAgICBtYXhYID0gbWluWCArIHJlY3QuZXh0ZW50Lng7XG4gICAgICAgIHZhciBtaW5ZID0gcmVjdC5vcmlnaW4ueSxcbiAgICAgICAgICAgIG1heFkgPSBtaW5ZICsgcmVjdC5leHRlbnQueTtcblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueCA8IDApIHtcbiAgICAgICAgICAgIG1pblggPSBtYXhYO1xuICAgICAgICAgICAgbWF4WCA9IHJlY3Qub3JpZ2luLng7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocmVjdC5leHRlbnQueSA8IDApIHtcbiAgICAgICAgICAgIG1pblkgPSBtYXhZO1xuICAgICAgICAgICAgbWF4WSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgbWluWCA8PSB0aGlzLnggJiYgdGhpcy54IDwgbWF4WCAmJlxuICAgICAgICAgICAgbWluWSA8PSB0aGlzLnkgJiYgdGhpcy55IDwgbWF4WVxuICAgICAgICApO1xuICAgIH1cbn07XG5cblBvaW50LnByb3RvdHlwZS5FUSA9IFBvaW50LnByb3RvdHlwZS5lcXVhbHM7XG5Qb2ludC5wcm90b3R5cGUuR1QgPSBQb2ludC5wcm90b3R5cGUuZ3JlYXRlclRoYW47XG5Qb2ludC5wcm90b3R5cGUu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AgICAgICAgICAgfSk7XG4gICAgICAgIH0sXG5cbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKCl7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZWxlY3Rpb24ubGVuZ3RoID09PSAwO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAc3VtbWFyeSBSZXR1cm4gdGhlIGluZGV4ZXMgdGhhdCBhcmUgc2VsZWN0ZWQuXG4gICAgICAgICAqIEBkZXNjIFJldHVybiB0aGUgaW5kZXhlcyB0aGF0IGFyZSBzZWxlY3RlZC5cbiAgICAgICAgICogQHJldHVybnMge0FycmF5LkFycmF5Lm51bWJlcn1cbiAgICAgICAgICogQG1lbWJlck9mIFJhbmdlU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICAgICAqL1xuICAgICAgICBnZXRTZWxlY3Rpb25zOiBmdW5jdGlvbiAoKXtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgICAgICAgIHRoaXMuc2VsZWN0aW9uLmZvckVhY2goZnVuY3Rpb24gKGVhY2gpIHtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gZWFjaFswXTsgaSA8PSBlYWNoWzFdOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goaSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICByZXN1bHQuc29ydChmdW5jdGlvbiAoYSwgYil7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGEgLSBiO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG5cbiAgICB9O1xuXG4gICAgLyoqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAc3VtbWFyeSBQcmVwcyBgc3RhcnRgIGFuZCBgc3RvcGAgcGFyYW1zIGludG8gb3JkZXIgYXJyYXlcbiAgICAgKiBAZnVu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ICAgICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gJ29iamVjdCcpIHsgLy8gbXVzdCBiZSBhbiBpbWFnZVxuICAgICAgICAgICAgICAgIGNlbnRlckljb24gPSB2YWw7XG4gICAgICAgICAgICAgICAgdmFsID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChsZWZ0SWNvbiAmJiBsZWZ0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICBsZWZ0SWNvbiA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocmlnaHRJY29uICYmIHJpZ2h0SWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICByaWdodEljb24gPSBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNlbnRlckljb24gJiYgY2VudGVySWNvbi5ub2RlTmFtZSAhPT0gJ0lNRycpIHtcbiAgICAgICAgICAgICAgICBjZW50ZXJJY29uID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUoY29uZmlnLCB2YWwpO1xuXG4gICAgICAgIGlmIChnYy5mb250ICE9PSBjb25maWcuZm9udCkge1xuICAgICAgICAgICAgZ2MuZm9udCA9IGNvbmZpZy5mb250O1xuICAgICAgICB9XG4gICAgICAgIGlmIChnYy50ZXh0QWxpZ24gIT09ICdsZWZ0Jykge1xuICAgICAgICAgICAgZ2MudGV4dEFsaWduID0gJ2xlZnQnO1xuICAgICAgICB9XG4gICAgICAgIGlmIChnYy50ZXh0QmFzZWxpbmUgIT09ICdtaWRkbGUnKSB7XG4gICAgICAgICAgICBnYy50ZXh0QmFzZWxpbmUgPSAnbWlkZGxlJztcbiAgICAgICAgfVxuXG4gICAgICAgIC8vZmlsbCBiYWNrZ3JvdW5kIG9ubHkgaWYgb3VyIGJ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GNvbmZpZy5pc0luQ3VycmVudFNlbGVjdGlvblJlY3RhbmdsZSkge1xuICAgICAgICAgICAgZ2MuZmlsbFN0eWxlID0gJ3JnYmEoMCwgMCwgMCwgMC4yKSc7XG4gICAgICAgICAgICBnYy5maWxsUmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaWNvbldpZHRoID0gMDtcbiAgICAgICAgaWYgKGxlZnRJY29uKSB7XG4gICAgICAgICAgICBpeW9mZnNldCA9IE1hdGgucm91bmQoKGhlaWdodCAtIGxlZnRJY29uLmhlaWdodCkgLyAyKTtcbiAgICAgICAgICAgIGdjLmRyYXdJbWFnZShsZWZ0SWNvbiwgeCArIGxlZnRQYWRkaW5nLCB5ICsgaXlvZmZzZXQpO1xuICAgICAgICAgICAgaWNvbldpZHRoID0gTWF0aC5tYXgobGVmdEljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmlnaHRJY29uKSB7XG4gICAgICAgICAgICBpeW9mZnNldCA9IE1hdGgucm91bmQoKGhlaWdodCAtIHJpZ2h0SWNvbi5oZWlnaHQpIC8gMik7XG4gICAgICAgICAgICBpeG9mZnNldCA9IDA7IC8vTWF0aC5yb3VuZCgoaGFsaWduT2Zmc2V0IC0gcmlnaHRJY29uLndpZHRoKSAvIDIpO1xuICAgICAgICAgICAgZ2MuZHJhd0ltYWdlKHJpZ2h0SWNvbiwgeCArIHdpZHRoIC0gaXhvZmZzZXQgLSByaWdodEljb24ud2lkdGgsIHkgKyBpeW9mZnNldCk7XG4gICAgICAgICAgICBpY29uV2lkdGggPSBNYXRoLm1heChyaWdodEljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY2VudGVySWNvbikge1xuICAgICAgICAgICAgaXlvZmZzZXQgPSBNYXRoLnJvdW5kKChoZWlnaHQgLSBjZW50ZXJJY29uLmhlaWdodCkgLyAyKTtcbiAgICAgICAgICAgIGl4b2Zmc2V0ID0gTWF0aC5yb3VuZCgod2lkdGggLSBjZW50ZXJJY29uLndpZHRoKSAvIDIpO1xuICAgICAgICAgICAgZ2MuZHJhd0ltYWdlKGNlbnRlckljb24sIHggKyB3aWR0aCAtIGl4b2Zmc2V0IC0gY2VudGVySWNvbi53aWR0aCwgeSArIGl5b2Zmc2V0KTtcbiAgICAgICAgICAgIGljb25XaWR0aCA9IE1hdGgubWF4KGNlbnRlckljb24ud2lkdGggKyAyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29uZmlnLmNlbGxCb3JkZXJUaGlja25lc3MpIHtcbiAgICAgICAgICAgIGdjLmJlZ2luUGF0aCgpO1xuICAgICAgICAgICAgZ2MucmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcbiAgICAgICAgICAgIGdjLmxpbmVXaWR0aCA9IGNvbmZpZy5jZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgZ2Muc3Ryb2tlU3R5bGUgPSBjb25maWcuY2VsbEJvcmRlclN0eWxlO1xuXG4gICAgICAgICAgICAvLyBhbmltYXRlIHRoZSBkYXNoZWQgbGluZSBhIGJpdCBoZXJlIGZvciBmdW5cblxuICAgICAgICAgICAgZ2Muc3Ryb2tlKCk7XG4gICAgICAgICAgICBnYy5jbG9zZVBhdGgoKTtcbiAgICAgICAgfVxuICAgICAgICBjb25maWcubWluV2lkdGggPSBjb25maWcubWluV2lkdGggKyAyICogKGljb25XaWR0aCk7XG4gICAgfSxcblxuICAgIHJlbmRlck11bHRpTGluZVRleHQ6IGZ1bmN0aW9uKHgsIHksIGhlaWdodCwgd2lkdGgsIGdjLCBjb25maWcsIHZhbCkge1xuICAgICAgICB2YXIgbGluZXMgPSBmaXRUZXh0KGdjLCBjb25maWcsIHZhbCwgd2lkdGgpO1xuICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5yZW5kZXJTaW5nbGVMaW5lVGV4dCh4LCB5LCBoZWlnaHQsIHdpZHRoLCBnYywgY29uZmlnLCBzcXVlZXplKHZhbCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGNvbEhFZGdlT2Zmc2V0ID0gY29uZmlnLmNlbGxQYWRkaW5nLFxuICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gMCxcbiAgICAgICAgICAgIHZhbGlnbk9mZnNldCA9IGNvbmZpZy52b2Zmc2V0LFxuICAgICAgICAgICAgaGFsaWduID0gY29uZmlnLmhhbGlnbixcbiAgICAgICAgICAgIHRleHRIZWlnaHQgPSBjb25maWcuZ2V0VGV4dEhlaWdodChjb25maWcuZm9udCkuaGVpZ2h0O1xuXG4gICAgICAgIHN3aXRjaCAoaGFsaWduKSB7XG4gICAgICAgICAgICBjYXNlICdyaWdodCc6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gd2lkdGggLSBjb2xIRWRnZU9mZnNldDtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgJ2NlbnRlcic6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gd2lkdGggLyAyO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAnbGVmdCc6XG4gICAgICAgICAgICAgICAgaGFsaWduT2Zmc2V0ID0gY29sSEVkZ2VPZmZzZXQ7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgaE1pbiA9IDAsIHZNaW4gPSBNYXRoLmNlaWwodGV4dEhlaWdodCAvIDIpO1xuXG4gICAgICAgIHZhbGlnbk9mZnNldCArPSBNYXRoLmNlaWwoKGhlaWdodCAtIChsaW5lcy5sZW5ndGggLSAxKSAqIHRleHRIZWlnaHQpIC8gMik7XG5cbiAgICAgICAgaGFsaWduT2Zmc2V0ID0gTWF0aC5tYXgoaE1pbiwgaGFsaWduT2Zmc2V0KTtcbiAgICAgICAg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GxFZGl0b3JzID0gW1xuICAgICAgICAgICAgJ1RleHRmaWVsZCcsXG4gICAgICAgICAgICAnQ2hvaWNlJyxcbiAgICAgICAgICAgIC8vJ0NvbWJvJyxcbiAgICAgICAgICAgICdDb2xvcicsXG4gICAgICAgICAgICAnRGF0ZScsXG4gICAgICAgICAgICAnU2xpZGVyJyxcbiAgICAgICAgICAgICdTcGlubmVyJ1xuICAgICAgICBdO1xuXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgY2VsbEVkaXRvcnMuZm9yRWFjaChmdW5jdGlvbihuYW1lKSB7XG4gICAgICAgICAgICBzZWxmLmluaXRDZWxsRWRpdG9yKG5ldyBIeXBlcmdyaWQuY2VsbEVkaXRvcnNbbmFtZV0pO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG4gICAgdG9nZ2xlQ29sdW1uUGlja2VyOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdGhpcy5nZXRCZWhhdmlvcigpLnRvZ2dsZUNvbHVtblBpY2tlcigpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBUaGUgcG9pbnRlciBpcyBvdmVyIHRoZSBnaXZlbiBjZWxsLlxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB4IC0gVGhlIHggY2VsbCBjb29yZGluYXRlLlxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5IC0gVGhlIHkgY2VsbCBjb29yZGluYXRlLlxuICAgICAqL1xuICAgIGlzSG92ZXJlZDogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgcCA9IHRoaXMuZ2V0SG92ZXJDZWxsKCk7XG4gICAgICAgIGlmICghcCkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwLnggPT09IHggJiYgcC55ID09PSB5O1xuICAgIH0sXG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srKSB7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgdyA9IDA7IHcgPCB3aWR0aDsgdysrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5wdXNoKHNlbGVjdGlvbnNbd11baF0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAodyA8IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3IucHVzaCgnXFx0Jyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGggPCBoZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goJ1xcbicpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IGNvbGxlY3Rvci5qb2luKCcnKTtcblxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFdlIGhhdmUgZm9jdXMuXG4gICAgICovXG4gICAgaGFzRm9jdXM6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRDYW52YXMoKS5oYXNGb2N1cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIENsZWFyIGFsbCB0aGUgc2VsZWN0aW9ucy5cbiAgICAgKi9cbiAgICBjbGVhclNlbGVjdGlvbnM6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmdldFNlbGVjdGlvbk1vZGVsKCkuY2xlYXIoKTtcbiAgICAgICAgdGhpcy5jbGVhck1vdXNlRG93bigpO1xuICAg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5nZXRDYW52YXMoKTtcbiAgICAgICAgaWYgKGNhbnZhcykge1xuICAgICAgICAgICAgaWYgKG5vdyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGNhbnZhcy5wYWludE5vdygpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjYW52YXMucmVwYWludCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQGRlc2MgUGFpbnQgaW1tZWRpYXRlbHkgaW4gdGhpcyBtaWNyb3Rhc2suXG4gICAgICovXG4gICAgcGFpbnROb3c6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgY2FudmFzID0gdGhpcy5nZXRDYW52YXMoKTtcbiAgICAgICAgY2FudmFzLnBhaW50Tm93KCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IEluIEhpRFBJIG1vZGUgKGhhcyBhbiBhdHRyaWJ1dGUgYXMgc3VjaCkuXG4gICAgICovXG4gICAgdXNlSGlEUEk6IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlUHJvcGVydHkoJ3VzZUhpRFBJJykgIT09IGZhbHNlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgSHlwZXJncmlkLnByb3RvdHlwZVxuICAgICAqIEBzdW1tYXJ5IEluaXRpYWxpemUgZHJhd2luZyBzdXJmYWNlLlxuICAgICAqIEBwcml2YXRlXG4gICAgICovXG4gICAgaW5pdENhbnZhczogZnVuY3Rpb24oKSB7XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuXG4gICAgICAgIHZhciBkaXZDYW52YXMgPSB0aGlzLmRpdkNhbnZh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c2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlTW92ZShtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLW1vdXNlZG93bicsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICBtb3VzZUV2ZW50LmtleXMgPSBlLmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICBzZWxmLm1vdXNlRG93blN0YXRlID0gbW91c2VFdmVudDtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVNb3VzZURvd24obW91c2VFdmVudCk7XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNNb3VzZURvd25FdmVudChtb3VzZUV2ZW50KTtcbiAgICAgICAgICAgIHNlbGYucmVwYWludCgpO1xuICAgICAgICB9KTtcblxuXG4gICAgICAgIC8vIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1jbGljaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgLy8gICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gICAgIH1cbiAgICAgICAgLy8gICAgIC8vc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgIC8vICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgLy8gICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQobW91c2VFdmVudCk7XG4gICAgICAgIC8vIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1tb3VzZXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgaWYgKHNlbGYuaXNTY3JvbGxpbmdOb3coKSkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0U2Nyb2xsaW5nTm93KGZhbHNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZWxmLmNvbHVtbkRyYWdBdXRvU2Nyb2xsaW5nKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5jb2x1bW5EcmFnQXV0b1Njcm9sbGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlVXAobW91c2VFdmVudCk7XG4gICAgICAgICAgICBpZiAoc2VsZi5tb3VzZURvd25TdGF0ZSkge1xuICAgICAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0J1dHRvblByZXNzZWRFdmVudChzZWxmLm1vdXNlRG93blN0YXRlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNlbGYubW91c2VEb3duU3RhdGUgPSBudWxsO1xuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljTW91c2VVcEV2ZW50KG1vdXNlRXZlbnQpO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtdGFwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy9zZWxmLnN0b3BFZGl0aW5nKCk7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciB0YXBFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgICAgICB0YXBFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4gICAgICAgICAgICB0YXBFdmVudC5rZXlzID0gZS5kZXRhaWwua2V5cztcbiAgICAgICAgICAgIHNlbGYuZmlyZVN5bnRoZXRpY0NsaWNrRXZlbnQodGFwRXZlbnQpO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZVRhcCh0YXBFdmVudCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1kcmFnJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB2YXIgbW91c2UgPSBlLmRldGFpbC5tb3VzZTtcbiAgICAgICAgICAgIHZhciBtb3VzZUV2ZW50ID0gc2VsZi5nZXRHcmlkQ2VsbEZyb21Nb3VzZVBvaW50KG1vdXNlKTtcbiAgICAgICAgICAgIG1vdXNlRXZlbnQucHJpbWl0aXZlRXZlbnQgPSBlO1xuICAgICAgICAgICAgc2VsZi5kZWxlZ2F0ZU1vdXNlRHJhZyhtb3VzZUV2ZW50KTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoc2VsZi5yZXNvbHZlUHJvcGVydHkoJ3JlYWRPbmx5JykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmZpcmVTeW50aGV0aWNLZXlkb3duRXZlbnQoZSk7XG4gICAgICAgICAgICBzZWxmLmRlbGVnYXRlS2V5RG93bihlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLWtleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc2VsZi5maXJlU3ludGhldGljS2V5dXBFdmVudChlKTtcbiAgICAgICAgICAgIHNlbGYuZGVsZWdhdGVLZXlVcChlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5hZGRGaW5FdmVudExpc3RlbmVyKCdmaW4tY2FudmFzLXRyYWNrJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNlbGYuZHJhZ2dpbmcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcHJpbUV2ZW50ID0gZS5kZXRhaWwucHJpbWl0aXZlRXZlbnQ7XG4gICAgICAgICAgICBpZiAoTWF0aC5hYnMocHJpbUV2ZW50LmR5KSA+IE1hdGguYWJzKHByaW1FdmVudC5keCkpIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnlEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsVkJ5KC0yKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC55RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxWQnkoMik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAocHJpbUV2ZW50LnhEaXJlY3Rpb24gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2Nyb2xsSEJ5KC0xKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByaW1FdmVudC54RGlyZWN0aW9uIDwgLTApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zY3JvbGxIQnkoMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICAvLyB0aGlzLmFkZEZpbkV2ZW50TGlzdGVuZXIoJ2Zpbi1jYW52YXMtaG9sZHB1bHNlJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAvLyAgICAgY29uc29sZS5sb2coJ2hvbGRwdWxzZScpO1xuICAgICAgICAvLyAgICAgaWYgKHNlbGYucmVzb2x2ZVByb3BlcnR5KCdyZWFkT25seScpKSB7XG4gICAgICAgIC8vICAgICAgICAgcmV0dXJuO1xuICAgICAgICAvLyAgICAgfVxuICAgICAgICAvLyAgICAgdmFyIG1vdXNlID0gZS5kZXRhaWwubW91c2U7XG4gICAgICAgIC8vICAgICB2YXIgbW91c2VFdmVudCA9IHNlbGYuZ2V0R3JpZENlbGxGcm9tTW91c2VQb2ludChtb3VzZSk7XG4gICAgICAgIC8vICAgICBtb3VzZUV2ZW50LnByaW1pdGl2ZUV2ZW50ID0gZTtcbiAgICAgICAgLy8gICAgIHNlbGYuZGVsZWdhdGVIb2xkUHVsc2UobW91c2VFdmVudCk7XG4gICAgICAgIC8vIH0pO1xuXG4gICAgICAgIHRoaXMuYWRkRmluRXZlbnRMaXN0ZW5lcignZmluLWNhbnZhcy1kYmxjbGljaycsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc29sdmVQcm9wZXJ0eSgncmVhZE9ubHknKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBtb3VzZSA9IGUuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdmFyIG1vdXNlRXZlbnQgPSBzZWxmLmdldEdyaWRDZWxsRnJvbU1vdXNlUG9pbnQobW91c2UpO1xuICAgICAgICAgICAgbW91c2VFdmVudC5wcmltaXRpdmVFdmVudCA9IGU7XG4g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50aGV0aWNFZGl0b3JLZXlVcEV2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS11cCcsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgICAgICAgICAga2V5RXZlbnQ6IGtleUV2ZW50XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmNhbnZhcy5kaXNwYXRjaEV2ZW50KGNsaWNrRXZlbnQpO1xuICAgIH0sXG5cbiAgICBmaXJlU3ludGhldGljRWRpdG9yS2V5RG93bkV2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS1kb3duJywge1xuICAgICAgICAgICAgZGV0YWlsOiB7XG4gICAgICAgICAgICAgICAgaW5wdXQ6IGlucHV0Q29udHJvbCxcbiAgICAgICAgICAgICAgICBrZXlFdmVudDoga2V5RXZlbnRcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuY2FudmFzLmRpc3BhdGNoRXZlbnQoY2xpY2tFdmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNFZGl0b3JLZXlQcmVzc0V2ZW50OiBmdW5jdGlvbihpbnB1dENvbnRyb2wsIGtleUV2ZW50KSB7XG4gICAgICAgIHZhciBjbGlja0V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tZWRpdG9yLWtleS1wcmVzcycsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGlucHV0OiBpbnB1dENvbnRyb2wsXG4gICAgICAgIC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hciByO1xuICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgIHZhciBjb2x1bW4gPSBuZXcgQXJyYXkocm93Q291bnQpO1xuICAgICAgICAgICAgcmVzdWx0W3RoaXMuZ2V0RmllbGQoYyArIG94KV0gPSBjb2x1bW47XG4gICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgcm93Q291bnQ7IHIrKykge1xuICAgICAgICAgICAgICAgIGNvbHVtbltyXSA9IHZhbHVlT3JGdW5jdGlvbkV4ZWN1dGUodGhpcy5nZXRWYWx1ZShveCArIGMsIG95ICsgcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIGdldFNlbGVjdGlvbk1hdHJpeDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIHNlbGVjdGlvbnMgPSB0aGlzLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBBcnJheShzZWxlY3Rpb25zLmxlbmd0aCk7XG4gICAgICAgIHNlbGVjdGlvbnMuZm9yRWFjaChmdW5jdGlvbihzZWxlY3Rpb25SZWN0LCBpKSB7XG4gICAgICAgICAgICByZXN1bHRbaV0gPSBzZWxmLl9nZXRTZWxlY3Rpb25NYXRyaXgoc2VsZWN0aW9uUmVjdCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0sXG5cbiAgICBfZ2V0U2VsZWN0aW9uTWF0cml4OiBmdW5jdGlvbihyZWN0KSB7XG4gICAgICAgIHJlY3QgPSBub3JtYWxpemVSZWN0KHJlY3QpO1xuICAgICAgICB2YXIgY29sQ291bnQgPSByZWN0LmV4dGVudC54ICsgMTtcbiAgICAgICAgdmFyIHJvd0NvdW50ID0gcmVjdC5leHRlbnQueSArIDE7XG4gICAgICA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vdXNlUG9pbnQsXG4gICAgICAgICAgICAgICAgdmlld1BvaW50OiBlLnZpZXdQb2ludCxcbiAgICAgICAgICAgICAgICBwcmltaXRpdmVFdmVudDogZS5wcmltaXRpdmVFdmVudCxcbiAgICAgICAgICAgICAgICByb3dzOiB0aGlzLmdldFNlbGVjdGVkUm93cygpLFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuZ2V0U2VsZWN0ZWRDb2x1bW5zKCksXG4gICAgICAgICAgICAgICAgc2VsZWN0aW9uczogdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgfSxcblxuICAgIGZpcmVTeW50aGV0aWNNb3VzZVVwRXZlbnQ6IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgdmFyIGV2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdmaW4tbW91c2V1cCcsIHtcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIGdyaWRDZWxsOiBlLmdyaWRDZWxsLFxuICAgICAgICAgICAgICAgIG1vdXNlUG9pbnQ6IGUubW91c2VQb2ludCxcbiAgICAgICAgICAgICAgICB2aWV3UG9pbnQ6IGUudmlld1BvaW50LFxuICAgICAgICAgICAgICAgIHByaW1pdGl2ZUV2ZW50OiBlLnByaW1pdGl2ZUV2ZW50LFxuICAgICAgICAgICAgICAgIHJvd3M6IHRoaXMuZ2V0U2VsZWN0ZWRSb3dzKCksXG4gICAgICAgICAgICAgICAgY29sdW1uczogdGhpcy5nZXRTZWxlY3RlZENvbHVtbnMoKSxcbiAgICAgICAgICAgICAgICBzZWxlY3Rpb25zOiB0aGlzLmdldFNlbGVjdGlvbk1vZGVsKCkuZ2V0U2VsZWN0aW9ucygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuIC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BcnJheShyb3dDb3VudCksXG4gICAgICAgICAgICByb3c7XG5cbiAgICAgICAgaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKGhlYWRlciwgYykge1xuICAgICAgICAgICAgaGVhZGVyc1tjXSA9IGJlaGF2aW9yLmdldENvbHVtbklkKGMsIDApO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXN1bHRzLmZvckVhY2goZnVuY3Rpb24ocmVzdWx0LCByKSB7XG4gICAgICAgICAgICByb3cgPSByZXN1bHRzW3JdID0ge1xuICAgICAgICAgICAgICAgIGhpZXJhcmNoeTogYmVoYXZpb3IuZ2V0Rml4ZWRDb2x1bW5WYWx1ZSgwLCByKVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGhlYWRlcnMuZm9yRWFjaChmdW5jdGlvbihmaWVsZCwgYykge1xuICAgICAgICAgICAgICAgIHJvd1tmaWVsZF0gPSBiZWhhdmlvci5nZXRWYWx1ZShjLCByKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEh5cGVyZ3JpZC5wcm90b3R5cGVcbiAgICAgKiBAcmV0dXJucyB7b2JqZWN0fSBBbiBvYmplY3QgdGhhdCByZXByZXNlbnRzIHRoZSBjdXJyZW50bHkgc2VsZWN0aW9uIHJvdy5cbiAgICAgKi9cbiAgICBnZXRTZWxlY3RlZFJvdzogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzZWxzID0gdGhpcy5nZXRTZWxlY3Rpb25Nb2RlbCgpLmdldFNlbGVjdGlvbnMoKTtcbiAgICAgICAgaWYgKHNlbHMubGVuZ3RoKSB7XG4gICAgICAgICAgICB2YXIgYmVoYXZpb3IgPSB0aGlzLmdldEJlaGF2aW9yKCksXG4gICAgICAgICAgICAgICAgY29sQ291bnQgPSB0aGlzLmdldENvbHVtbkNvdW50KCksXG4gICAgICAgICAgICAgICAgdG9wUm93ID0gc2Vsc1swXS5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICByb3cgPSB7XG4gICAgICAgICAgICAgICAgICAgIC8vaGllcmFyY2h5OiBiZWhhdmlvci5nZXRGaXhlZENvbHVtblZhbHVlKDAsIHRvcFJvdylcbiAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGNvbENvdW50OyBjKyspIHtcbiAgICAgICAgICAgICAgICByb3dbYmVoYXZpb3IuZ2V0Q29sdW1uSWQoYywgMCldID0gYmVoYXZpb3IuZ2V0VmFsdWUoYywgdG9wUm93KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHJvdztcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICBmaXJlUmVxdWVzdENlbGxFZGl0OiBmdW5jdGlvbihjZWxsLCB2YWx1ZSkge1xuICAgICAgICB2YXIgY2xpY2tFdmVudCA9IG5ldyBDdXN0b21FdmVudCgnZmluLXJlcXVlc3QtY2VsbC1lZGl0Jywge1xuICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICBncmlkQ2VsbDogY2VsbCxcbiAgICAgICAgICAgICAgICB0aW1lOiBEYXRlLm5vdygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGhpcy5jYW52YXMuZGlzcGF0Y2hFdmVudChjbGlja0V2ZW50KTsgLy9JIHdhc24ndCBjYW5jZWxsZWRcbiAgICB9LFxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBIeXBlcmdyaWQucHJvdG90eXBlXG4gICAgICogQGRlc2MgU3ludGhlc2l6ZSBhbmQgZmlyZSBhIGZpbi1iZWZvcmUtY2VsbC1lZGl0IGV2ZW50LlxuICAgICAqIEBwY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mICFoYXNTSElGVCkge1xuICAgICAgICAgICAgbW9kZWwuY2xlYXIoKTtcbiAgICAgICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKGhhc0NUUkwpIHtcbiAgICAgICAgICAgICAgICBpZiAoYWxyZWFkeVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLmRlc2VsZWN0Q29sdW1uKHgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaGFzU0hJRlQpIHtcbiAgICAgICAgICAgICAgICBtb2RlbC5jbGVhcigpO1xuICAgICAgICAgICAgICAgIG1vZGVsLnNlbGVjdENvbHVtbih0aGlzLmxhc3RFZGdlU2VsZWN0aW9uWzBdLCB4KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWFscmVhZHlTZWxlY3RlZCAmJiAhaGFzU0hJRlQpIHtcbiAgICAgICAgICAgIHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMF0gPSB4O1xuICAgICAgICB9XG4gICAgICAgIHRoaXMucmVwYWludCgpO1xuICAgICAgICB0aGlzLmZpcmVTeW50aGV0aWNDb2x1bW5TZWxlY3Rpb25DaGFuZ2VkRXZlbnQoKTtcbiAgICB9LFxuXG4gICAgdG9nZ2xlU2VsZWN0Um93OiBmdW5jdGlvbih5LCBrZXlzKSB7XG5cbiAgICAgICAgLy93ZSBjYW4gc2VsZWN0IHRoZSB0b3RhbHMgcm93cyBpZiB0aGV5IGV4aXN0LFxuICAgICAgICAvL2J1dCBub3Qgcm93cyBhYm92ZSB0aG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XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNTSElGVCkge1xuICAgICAgICAgICAgICAgIG1vZGVsLmNsZWFyKCk7XG4gICAgICAgICAgICAgICAgbW9kZWwuc2VsZWN0Um93KHRoaXMubGFzdEVkZ2VTZWxlY3Rpb25bMV0sIHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICghYWxyZWFkeVNlbGVjdGVkICYmICFoYXNTSElGVCkge1xuICAgICAgICAgICAgdGhpcy5sYXN0RWRnZVNlbGVjdGlvblsxXSA9IHk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5yZXBhaW50KCk7XG4gICAgfSxcblxuICAgIHNlbGVjdFZpZXdwb3J0Q2VsbDogZnVuY3Rpb24oeCwgeSkge1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSB0aGlzLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIHZhciByZW5kZXJlciA9IHRoaXMuZ2V0UmVuZGVyZXIoKTtcbiAgICAgICAgdmFyIHJlYWxYID0gcmVuZGVyZXIuZ2V0VmlzaWJsZUNvbHVtbnMoKVt4XTtcbiAgICAgICAgdmFyIHJlYWxZID0gcmVuZGVyZXIuZ2V0VmlzaWJsZVJvd3MoKVt5XTtcbiAgICAgICAgdGhpcy5jbGVhclNlbGVjdGlvbnMoKTtcbiAgICAgICAgdGhpcy5zZWxlY3QocmVhbFgsIHJlYWxZICsgaGVhZGVyUm93Q291bnQsIDAsIDApO1xuICAgICAgICB0aGlzLnNldE1vdXNlRG93bih0aGlzLm5ld1BvaW50KHJlYWxYLCByZWFsWSArIGhlYWRlclJvd0NvdW50KSk7XG4gICAgICAgIHRoaXMuc2V0RHJhZ0V4dGVudCh0aGlzLm5ld1BvaW50KDAsIDApKTtc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09PSAnZnVuY3Rpb24nID8gdmFsdWVPckZ1bmN0aW9uKCkgOiB2YWx1ZU9yRnVuY3Rpb247XG4gICAgcmV0dXJuIHJlc3VsdCB8fCByZXN1bHQgPT09IDAgPyByZXN1bHQgOiAnJztcbn1cblxuZnVuY3Rpb24gaW5zdGFsbFBvbHlmaWxscygpIHtcbiAgICBpZiAoIUFycmF5LnByb3RvdHlwZS5maW5kKSB7XG4gICAgICAgIEFycmF5LnByb3RvdHlwZS5maW5kID0gZnVuY3Rpb24ocHJlZGljYXRlKSB7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tZXh0ZW5kLW5hdGl2ZVxuICAgICAgICAgICAgaWYgKHRoaXMgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdBcnJheS5wcm90b3R5cGUuZmluZCBjYWxsZWQgb24gbnVsbCBvciB1bmRlZmluZWQnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlb2YgcHJlZGljYXRlICE9PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigncHJlZGljYXRlIG11c3QgYmUgYSBmdW5jdGlvbicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIGxpc3QgPSBPYmplY3QodGhpcyk7XG4gICAgICAgICAgICB2YXIgbGVuZ3RoID0gbGlzdC5sZW5ndGggPj4+IDA7XG4gICAgICAgICAgICB2YXIgdGhpc0FyZyA9IGFyZ3VtZW50c1sxXTtcbiAgICAgICAgICAgIHZhciB2YWx1ZTtcblxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHZhbHVlID0gbGlzdFtpXTtcbiAgICAgICAgICAgICAgICBpZiAocHJlZGljYXRlLmNhbGwodGhpc0FyZywgdmFsdWUsIGksIGxpc3QpKSB7XG4gICAgICAg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G4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IHZpZXdXaWR0aCB8fCBudW1Db2x1bW5zIDw9IHZ4KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aWR0aCA9IHRoaXMuZ2V0Q29sdW1uV2lkdGgodngpO1xuICAgICAgICAgICAgeCA9IHggKyB3aWR0aDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNbYyArIDFdID0gTWF0aC5yb3VuZCh4KTtcbiAgICAgICAgICAgIHRoaXMudmlzaWJsZUNvbHVtbnNbY10gPSB2eDtcbiAgICAgICAgICAgIHRoaXMuY29sdW1uRWRnZXNJbmRleE1hcFt2eF0gPSBjO1xuXG4gICAgICAgICAgICBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgPSBpbnNlcnRpb25Cb3VuZHNDdXJzb3IgKyBNYXRoLnJvdW5kKHdpZHRoIC8gMikgKyBwcmV2aW91c0luc2VydGlvbkJvdW5kc0N1cnNvclZhbHVlO1xuICAgICAgICAgICAgdGhpcy5pbnNlcnRpb25Cb3VuZHMucHVzaChpbnNlcnRpb25Cb3VuZHNDdXJzb3IpO1xuICAgICAgICAgICAgcHJldmlvdXNJbnNlcnRpb25Cb3VuZHNDdXJzb3JWYWx1ZSA9IE1hdGgucm91bmQod2lkdGggLyAyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHkgPSAwO1xuICAgICAgICBmb3IgKHIgPSAwOyByIDwgbnVtUm93czsgcisrKSB7XG4gICAgICAgICAgICB2eSA9IHI7XG4gICAgICAgICAgICBpZiAociA+PSBudW1GaXhlZFJvd3MpIHtcbiAgICAgICAgICAgICAgICB2eSA9IHZ5ICsgc2Nyb2xsVG9wO1xuICAgICAgICAgICAgICAgIGlmIChmaXJzdFZZID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RWWSA9IHZ5O1xuICAgICAgICAgICAgICAgIH1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Z2VzID0gdGhpcy5nZXRSb3dFZGdlcygpO1xuXG4gICAgICAgIHZhciB4ID0gdGhpcy5jb2x1bW5FZGdlc0luZGV4TWFwW2NdO1xuICAgICAgICB2YXIgeSA9IHRoaXMucm93RWRnZXNJbmRleE1hcFtyXTtcbiAgICAgICAgaWYgKHggPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgeCA9IHRoaXMuY29sdW1uRWRnZXNJbmRleE1hcFtjIC0gMV07XG4gICAgICAgICAgICB4T3V0c2lkZSA9IHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoeSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICB5ID0gdGhpcy5yb3dFZGdlc0luZGV4TWFwW3IgLSAxXTtcbiAgICAgICAgICAgIHlPdXRzaWRlID0gdHJ1ZTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBveCA9IGNvbHVtbkVkZ2VzW3hdLFxuICAgICAgICAgICAgb3kgPSByb3dFZGdlc1t5XSxcbiAgICAgICAgICAgIGN4ID0gY29sdW1uRWRnZXNbeCArIDFdLFxuICAgICAgICAgICAgY3kgPSByb3dFZGdlc1t5ICsgMV0sXG4gICAgICAgICAgICBleCA9IGN4IC0gb3gsXG4gICAgICAgICAgICBleSA9IGN5IC0gb3k7XG5cbiAgICAgICAgdmFyIGNlbGwgPSB0aGlzLmNlbGw7XG4gICAgICAgIGNlbGwueCA9IHhPdXRzaWRlID8gY3ggOiBveDtcbiAgICAgICAgY2VsbC55ID0geU91dHNpZGUgPyBjeSA6IG95O1xuICAgICAgICBjZWxsLndpZHRoID0geE91dHNpZGUgPyAwIDogZXg7XG4gICAgICAgIGNlbGwuaGVpZ2h0ID0geU91dHNpZGUgPyAwIDogZXk7XG5cbiAgICAgICAgcmV0dXJuIGNlbGw7XG5cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGFuc3d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Ghpcy5nZXRTY3JvbGxMZWZ0KCk7XG4gICAgICAgIHZhciBzY3JvbGxZID0gdGhpcy5nZXRTY3JvbGxUb3AoKTtcblxuICAgICAgICBmb3IgKGMgPSAwOyBjIDwgY29sdW1uRWRnZXMubGVuZ3RoOyBjKyspIHtcbiAgICAgICAgICAgIHdpZHRoID0gY29sdW1uRWRnZXNbY107XG4gICAgICAgICAgICBpZiAocG9pbnQueCA8IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgeCA9IE1hdGgubWF4KDAsIHBvaW50LnggLSBwcmV2aW91cyAtIDIpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldmlvdXMgPSB3aWR0aDtcbiAgICAgICAgfVxuICAgICAgICBjLS07XG4gICAgICAgIHByZXZpb3VzID0gMDtcbiAgICAgICAgZm9yIChyID0gMDsgciA8IHRoaXMucm93RWRnZXMubGVuZ3RoOyByKyspIHtcbiAgICAgICAgICAgIGhlaWdodCA9IHRoaXMucm93RWRnZXNbcl07XG4gICAgICAgICAgICBpZiAocG9pbnQueSA8IGhlaWdodCkge1xuICAgICAgICAgICAgICAgIHkgPSBNYXRoLm1heCgwLCBwb2ludC55IC0gcHJldmlvdXMgLSAyKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gaGVpZ2h0O1xuICAgICAgICB9XG4gICAgICAgIHItLTtcbiAgICAgICAgaWYgKHBvaW50LnggPCAwKSB7XG4gICAgICAgICAgICBjID0gLTE7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHBvaW50LnkgPCAwKSB7XG4gICAgICAgICAgICByID0gLTE7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdmlld1BvaW50ID0gZ3JpZC5uZXdQb2ludChjLCByKTtcblxuICAgICAgICAvL2NvbXBlbnNhdGUgaWYgd2UgYXJlIHNjcm9sbGVkXG4gICAgICAgIGlmIChjID49IGZpeGVkQ29sdW1uQ291bnQpIHtcbiAgICAgICAgICAgIGMgPSBjICsgc2Nyb2xsWDtcbiAgICAgICAgfVxuICAgICAgICBpZiAociA+PSBmaXhlZFJvd0NvdW50KSB7XG4gICAgICAgICAgICByID0gciArIHNjcm9sbFk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdHJhbnNsYXRlZEluZGV4ID0gLTE7XG5cbiAgICAgICAgdmFyIGNvbHVtbiA9IGJlaGF2aW9yLmdldENvbHVtbihjKTtcbiAgICAgICAgaWYgKGNvbHVtbikge1xuICAgICAgICAgICAgdHJhbnNsYXRlZEluZGV4ID0gY29sdW1uLmluZGV4O1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGdyaWRDZWxsOiBncmlkLm5ld1BvaW50KGMsIHIpLFxuICAgICAgICAgICAgbW91c2VQb2ludDogZ3JpZC5uZXdQb2ludCh4LCB5KSxcbiAgICAgICAgICAgIHZpZXdQb2ludDogdmlld1BvaW50LFxuICAgICAgICAgICAgZGF0YUNlbGw6IGdyaWQubmV3UG9pbnQodHJhbnNsYXRlZEluZGV4LCByKSxcbiAgICAgICAgfTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFJlbmRlcmVyLnByb3RvdHlwZVxuICAgICAqIEBzdW1tYXJ5IERldGVybWluZXMgaWYgYSBjb2x1bW4gaXMgdmlzaWJsZS5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gY29sSW5kZXggLSB0aGUgY29sdW1uIGluZGV4KlxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBUaGUgZ2l2ZW4gY29sdW1uIGlzIGZ1bGx5IHZpc2libGUuXG4gICAgICovXG4gICAgaXNDb2x1bW5WaXNpYmxlOiBmdW5jdGlvbihjb2xJbmRleCkge1xuICAgICAgICB2YXIgaXNWaXNpYmxlID0gdGhpcy52aXNpYmxlQ29sdW1ucy5pbmRleE9mKGNvbEluZGV4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lLnkpO1xuICAgICAgICAvLyB2YXIgZXcgPSBlLndpZHRoO1xuICAgICAgICAvLyB2YXIgZWggPSBlLmhlaWdodDtcbiAgICAgICAgdmFyIHggPSBNYXRoLm1pbihveCwgZXgpO1xuICAgICAgICB2YXIgeSA9IE1hdGgubWluKG95LCBleSk7XG4gICAgICAgIHZhciB3aWR0aCA9IDEgKyBleCAtIG94O1xuICAgICAgICB2YXIgaGVpZ2h0ID0gMSArIGV5IC0gb3k7XG4gICAgICAgIGlmICh4ID09PSBleCkge1xuICAgICAgICAgICAgd2lkdGggPSBveCAtIGV4O1xuICAgICAgICB9XG4gICAgICAgIGlmICh5ID09PSBleSkge1xuICAgICAgICAgICAgaGVpZ2h0ID0gb3kgLSBleTtcbiAgICAgICAgfVxuICAgICAgICBpZiAod2lkdGggKiBoZWlnaHQgPCAxKSB7XG4gICAgICAgICAgICAvL2lmIHdlIGFyZSBvbmx5IGEgc2tpbm55IGxpbmUsIGRvbid0IHJlbmRlciBhbnl0aGluZ1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgZ2MucmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcbiAgICAgICAgZ2MuZmlsbFN0eWxlID0gJ3JnYmEoMCwgMCwgMCwgMC4yKSc7XG4gICAgICAgIGdjLmZpbGwoKTtcbiAgICAgICAgZ2MubGluZVdpZHRoID0gMTtcbiAgICAgICAgZ2Muc3Ryb2tlU3R5bGUgPSAnYmxhY2snO1xuXG4gICAgICAgIC8vIGFuaW1hdGUgdGhlIGRhc2hlZCBsaW5lIGEgYml0IGhlcmUgZm9yIGZ1blxuXG4gICAgICAgIGdjLnN0cm9rZSgpO1xuXG4gICAgICAgIC8vZ2MucmVjdCh4LCB5LCB3aWR0aCwgaGVpZ2h0KTtcblxuICAgICAgICAvL2djLnN0cm9rZVN0eWxlID0gJ3doaXRlJztcblxuICAgICAgICAvLyBhbmltYXRlIHRoZSBkYXNoZWQgbGluZSBhIG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W9uKSB7XG4gICAgICAgICAgICB2YXIgdG9wID0gc2VsZWN0aW9uLm9yaWdpbi55O1xuICAgICAgICAgICAgdmFyIHNpemUgPSBzZWxlY3Rpb24uZXh0ZW50LnkgKyAxO1xuICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCBzaXplOyByKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgdGkgPSByICsgdG9wO1xuICAgICAgICAgICAgICAgIGlmICghc2V0W3RpXSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaCh0aSk7XG4gICAgICAgICAgICAgICAgICAgIHNldFt0aV0gPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAgIHJlc3VsdC5zb3J0KGZ1bmN0aW9uKHgsIHkpIHtcbiAgICAgICAgICAgIHJldHVybiB4IC0geTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBTZWxlY3Rpb25Nb2RlbC5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0gb2Zmc2V0XG4gICAgICovXG4gICAgc2VsZWN0Um93c0Zyb21DZWxsczogZnVuY3Rpb24ob2Zmc2V0KSB7XG4gICAgICAgIG9mZnNldCA9IG9mZnNldCB8fCAwO1xuXG4gICAgICAgIHZhciBzbSA9IHRoaXMucm93U2VsZWN0aW9uTW9kZWw7XG4gICAgICAgIHRoaXMuYWxsUm93c1NlbGVjdGVkID0gZmFsc2U7XG4gICAgICAgIHNtLmNsZWFyKCk7XG5cbiAgICAgICAgdGhpcy5zZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0aW9uKSB7XG4gICAgICAgICAgICB2YXIgdG9wID0gc2VsZWN0aW9uLm9yaWdpbi55LFxuICAgICAgICAgICAgICAgIHNpemUgPSBzZWxlY3Rpb24uZXh0ZW50Lnk7XG4g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sIHgsIHkpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgU2VsZWN0aW9uTW9kZWwucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHJlY3RcbiAgICAgKiBAcGFyYW0geFxuICAgICAqIEBwYXJhbSB5XG4gICAgICogQHJldHVybnMge2Jvb2xlYW59XG4gICAgICovXG4gICAgcmVjdGFuZ2xlQ29udGFpbnM6IGZ1bmN0aW9uKHJlY3QsIHgsIHkpIHsgLy9UT0RPOiBleHBsb3JlIHdoeSB0aGlzIHdvcmtzIGFuZCBjb250YWlucyBvbiByZWN0YW5nbHVsYXIgZG9lcyBub3RcbiAgICAgICAgdmFyIG1pblggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB2YXIgbWluWSA9IHJlY3Qub3JpZ2luLnk7XG4gICAgICAgIHZhciBtYXhYID0gbWluWCArIHJlY3QuZXh0ZW50Lng7XG4gICAgICAgIHZhciBtYXhZID0gbWluWSArIHJlY3QuZXh0ZW50Lnk7XG5cbiAgICAgICAgaWYgKHJlY3QuZXh0ZW50LnggPCAwKSB7XG4gICAgICAgICAgICBtaW5YID0gbWF4WDtcbiAgICAgICAgICAgIG1heFggPSByZWN0Lm9yaWdpbi54O1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHJlY3QuZXh0ZW50LnkgPCAwKSB7XG4gICAgICAgICAgICBtaW5ZID0gbWF4WTtcbiAgICAgICAgICAgIG1heFkgPSByZWN0Lm9yaWdpbi55O1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJlc3VsdCA9XG4gICAgICAgICAgICB4ID49IG1pblggJiZcbiAgICAgICAgICAgIHkgPj0gbWluWSAmJlxuICAgICAgICAgICAgeCA8PSBtYXhYICYmXG4gICAgICAgICAgICB5IDw9IG1heFk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IFNlbGVjdGlvbk1vZGVsO1xuI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ZSA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCk7XG4gICAgICAgIHZhciBwcm9wZXJ0aWVzID0gT2JqZWN0LmNyZWF0ZSh0YWJsZVN0YXRlKTtcblxuICAgICAgICBwcm9wZXJ0aWVzLnJvd051bWJlcnNQcm9wZXJ0aWVzID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLCB7XG4gICAgICAgICAgICBmb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy5yb3dIZWFkZXIgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucm93SGVhZGVyRm9udDtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb250ID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJvd0hlYWRlckNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucm93SGVhZGVyQmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb2x1bW5IZWFkZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbHVtbkhlYWRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29sdW1uSGVhZGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uSGVhZGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuY29sdW1uSGVhZGVyQ29sdW1uU2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLmNvbHVtbkhlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJGb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbHVtbkhlYWRlckJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2x1bW5IZWFkZXJCYWNrZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMucm93SGVhZGVyUm93U2VsZWN0aW9uID0gT2JqZWN0LmNyZWF0ZShwcm9wZXJ0aWVzLnJvd0hlYWRlciwge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckZvcmVncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJGb3JlZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJvd0hlYWRlckJhY2tncm91bmRSb3dTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3dIZWFkZXJCYWNrZ3JvdW5kUm93U2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMuZmlsdGVyUHJvcGVydGllcyA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9udDoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJGb250O1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJGb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckJhY2tncm91bmRTZWxlY3Rpb25Db2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJCYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclN0eWxlOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlckNlbGxCb3JkZXJTdHlsZTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJDZWxsQm9yZGVyU3R5bGUgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY2VsbEJvcmRlclRoaWNrbmVzczoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5maWx0ZXJDZWxsQm9yZGVyVGhpY2tuZXNzO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpbHRlckNlbGxCb3JkZXJUaGlja25lc3MgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHByb3BlcnRpZXMudHJlZUNvbHVtblByb3BlcnRpZXMgPSBPYmplY3QuY3JlYXRlKHByb3BlcnRpZXMsIHtcbiAgICAgICAgICAgIGZvbnQ6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkZvbnQ7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvbnQgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2xvcjtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24odmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmVlQ29sdW1uQmFja2dyb3VuZENvbG9yID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGZvcmVncm91bmRTZWxlY3Rpb25Db2xvcjoge1xuICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50cmVlQ29sdW1uRm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kU2VsZWN0aW9uQ29sb3IgPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYmFja2dyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5CYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRTZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllc0NvbHVtblNlbGVjdGlvbiA9IE9iamVjdC5jcmVhdGUocHJvcGVydGllcy50cmVlQ29sdW1uUHJvcGVydGllcywge1xuICAgICAgICAgICAgZm9yZWdyb3VuZFNlbGVjdGlvbkNvbG9yOiB7XG4gICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyZWVDb2x1bW5Gb3JlZ3JvdW5kQ29sdW1uU2VsZWN0aW9uQ29sb3I7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJlZUNvbHVtbkZvcmVncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvciA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBiYWNrZ3JvdW5kU2VsZWN0aW9uQ29sb3I6IHtcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudHJlZUNvbHVtbkJhY2tncm91bmRDb2x1bW5TZWxlY3Rpb25Db2xvcjtcbiAg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JldHVybiB0cnVlO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQHJldHVybiB7T2JqZWN0fSBUaGUgcHJvcGVydGllcyBmb3IgYSBzcGVjaWZpYyBjb2x1bW4uIFRoZXNlIGFyZSB1c2VkIGlmIG5vIGNlbGwgcHJvcGVydGllcyBhcmUgc3BlY2lmaWVkLlxuICAgICAqIEBwYXJhbSB7aW5kZXh9IGNvbHVtbkluZGV4IC0gdGhlIGNvbHVtbiBpbmRleCBvZiBpbnRlcmVzdFxuICAgICAqL1xuICAgIGdldENvbHVtblByb3BlcnRpZXM6IGZ1bmN0aW9uKGNvbHVtbkluZGV4KSB7XG4gICAgICAgIHZhciBjb2wgPSB0aGlzLmNvbHVtbnNbY29sdW1uSW5kZXhdO1xuICAgICAgICBpZiAoIWNvbCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBpc051bGw6IHRydWVcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb2wuZ2V0UHJvcGVydGllcygpOyAvL1RPRE86IHJldHVybnMgYG51bGxgIG9uIEh5cGVyZ3JpZC5yZXNldCgpO1xuICAgICAgICBpZiAoIXByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgaXNOdWxsOiB0cnVlXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwcm9wZXJ0aWVzO1xuICAgIH0sXG4gICAgc2V0Q29sdW1uUHJvcGVydGllczogZnVuY3Rpb24oY29sdW1uSW5kZXgsIHByb3BlcnRpZXMpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sdW1uSW5kZXgpO1xuICAgICAgICBfKGNvbHVtblByb3BlcnRpZXM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yICh2YXIgaSA9IDA7IGkgPCBjb2x1bW5Db3VudDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoaW5kZXhlcy5pbmRleE9mKGkpID09PSAtMSkge1xuICAgICAgICAgICAgICAgIGxhYmVscy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGksXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsOiB0aGlzLmdldEhlYWRlcihpKSxcbiAgICAgICAgICAgICAgICAgICAgZmllbGQ6IHRoaXMuZ2V0RmllbGQoaSlcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGFiZWxzO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQmVoYXZpb3IucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGlkZSBjb2x1bW5zIHRoYXQgYXJlIHNwZWNpZmllZCBieSB0aGVpciBpbmRleGVzXG4gICAgICogQHBhcmFtIHtBcnJheX0gYXJyYXlPZkluZGV4ZXMgLSBhbiBhcnJheSBvZiBjb2x1bW4gaW5kZXhlcyB0byBoaWRlXG4gICAgICovXG4gICAgaGlkZUNvbHVtbnM6IGZ1bmN0aW9uKGFycmF5T2ZJbmRleGVzKSB7XG4gICAgICAgIHZhciB0YWJsZVN0YXRlID0gdGhpcy5nZXRQcml2YXRlU3RhdGUoKTtcbiAgICAgICAgdmFyIG9yZGVyID0gdGFibGVTdGF0ZS5jb2x1bW5JbmRleGVzO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFycmF5T2ZJbmRleGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICB2YXIgZWFjaCA9IGFycmF5T2ZJbmRleGVzW2ldO1xuICAgICAgICAgICAgaWYgKG9yZGVyLmluZGV4T2YoZWFjaCkgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgb3JkZXIuc3BsaWNlKG9yZGVyLmluZGV4T2YoZWFj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dXAgYWxpYXNcbiAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAqIEBtZW1iZXJPZiBTaW1wbGUucHJvdG90eXBlXG4gICAgICovXG4gICAgYWxpYXM6ICdzaW1wbGUnLFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIFNpbXBsZS5wcm90b3R5cGVcbiAgICAgKi9cbiAgICBpbml0aWFsaXplOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdGhpcy5lZGl0b3JQb2ludCA9IHtcbiAgICAgICAgICAgIHg6IDAsXG4gICAgICAgICAgICB5OiAwXG4gICAgICAgIH07XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBTaW1wbGUucHJvdG90eXBlXG4gICAgICogQGRlc2MgIHRoZSBmdW5jdGlvbiB0byBvdmVycmlkZSBmb3IgaW5pdGlhbGl6YXRpb25cbiAgICAgKi9cbiAgICBpbml0aWFsaXplSW5wdXQ6IGZ1bmN0aW9uKGlucHV0KSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcigna2V5dXAnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBpZiAoZSAmJiAoZS5rZXlDb2RlID09PSAxMyB8fCBlLmtleUNvZGUgPT09IDI3IHx8IGUua2V5Q29kZSA9PT0gOCkpIHtcbiAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgaWYgKGUua2V5Q29kZSA9PT0gOCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyU3RvcEVkaXRpbmcoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5VXBFdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5RG93bkV2ZW50KHNlbGYsIGUpO1xuICAgICAgICB9KTtcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcigna2V5cHJlc3MnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5maXJlU3ludGhldGljRWRpdG9yS2V5UHJlc3NFdmVudChzZWxmLCBlKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGlucHV0Lm9uYmx1ciA9IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgIHNlbGYuY2FuY2VsRWRpdGluZygpO1xuICAgICAgICB9O1xuICAgICAgICAvLyBpbnB1dC5hZGRFdmVudExpc3RlbmVyKCdmb2N1c291dCcsIGZ1bmN0aW9uKCkge1xuICAgICAgICAvLyAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAvLyB9KTtcbiAgICAgICAgLy8gaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignYmx1cicsIGZ1bmN0aW9uKCkge1xuICAgICAgICAvLyAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAvLyB9KTtcbiAgICAgICAgaW5wdXQuc3R5bGUucG9zaXRpb24gPSAnYWJzb2x1dGUnO1xuIC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BpZD1cImVkaXRvclwiPlxuICAgICAgICAqL1xuICAgIH0sXG5cbiAgICBzZWxlY3RBbGw6IGZ1bmN0aW9uKCkge1xuICAgICAgICB0aGlzLmlucHV0LnNldFNlbGVjdGlvblJhbmdlKDAsIHRoaXMuaW5wdXQudmFsdWUubGVuZ3RoKTtcbiAgICB9LFxuXG4gICAgaW5pdGlhbGl6ZUlucHV0OiBmdW5jdGlvbihpbnB1dCkge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXVwJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgaWYgKGUgJiYgKGUua2V5Q29kZSA9PT0gMTMgfHwgZS5rZXlDb2RlID09PSAyNykpIHtcbiAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgaWYgKGUua2V5Q29kZSA9PT0gMjcpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5jYW5jZWxFZGl0aW5nKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdG9wRWRpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzZWxmLmdldEdyaWQoKS5yZXBhaW50KCk7XG4gICAgICAgICAgICAgICAgc2VsZi5nZXRHcmlkKCkudGFrZUZvY3VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoc2VsZi5nZXRHcmlkKCkuaXNGaWx0ZXJSb3coc2VsZi5nZXRFZGl0b3JQb2ludCgpLnkpKSB7XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zYXZlRWRpdG9yVmFsdWUoKTtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbW92ZUVkaXRvcigpO1xuICAgICAgICAgICAgICAgIH0pO1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O1xuICAgICAgICB2YXIgaXNIZWFkZXJSb3cgPSBncmlkLmlzU2hvd0hlYWRlclJvdygpO1xuICAgICAgICB2YXIgaXNCb3RoID0gaXNGaWx0ZXJSb3cgJiYgaXNIZWFkZXJSb3c7XG4gICAgICAgIHZhciB0b3BUb3RhbHNPZmZzZXQgPSAoaXNGaWx0ZXJSb3cgPyAxIDogMCkgKyAoaXNIZWFkZXJSb3cgPyAxIDogMCk7XG4gICAgICAgIGlmICh5ID49IHRvcFRvdGFsc09mZnNldCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0VG9wVG90YWxzKClbeSAtIHRvcFRvdGFsc09mZnNldF1beF07XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGZpbHRlciA9IHRoaXMuZ2V0RmlsdGVyKHgpO1xuICAgICAgICB2YXIgaW1hZ2UgPSBmaWx0ZXIubGVuZ3RoID09PSAwID8gJ2ZpbHRlci1vZmYnIDogJ2ZpbHRlci1vbic7XG4gICAgICAgIHZhciBoZWFkZXIsIHNvcnRTdHJpbmc7XG4gICAgICAgIGlmIChpc0JvdGgpIHtcbiAgICAgICAgICAgIGlmICh5ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaGVhZGVyID0gdGhpcy5nZXRIZWFkZXJzKClbeF07XG4gICAgICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgICAgIGlmIChzb3J0U3RyaW5nKSB7IGhlYWRlciA9IHNvcnRTdHJpbmcgKyBoZWFkZXI7IH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW251bGwsIGhlYWRlciwgbnVsbF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbCwgZmlsdGVyLCBiZWhhdmlvci5nZXRJbWFnZShpbWFnZSldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGlzRmlsdGVyUm93KSB7XG4gICAgICAgICAgICByZXR1cm4gW251bGwsIGZpbHRlciwgYmVoYXZpb3IuZ2V0SW1hZ2UoaW1hZ2UpXTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGhlYWRlciA9IHRoaXMuZ2V0SGVhZGVycygpW3hdO1xuICAgICAgICAgICAgc29ydFN0cmluZyA9IHRoaXMuZ2V0U29ydEltYWdlRm9yQ29sdW1uKHgsIHRydWUpO1xuICAgICAgICAgICAgaWYgKHNvcnRTdHJpbmcpIHsgaGVhZGVyID0gc29ydFN0cmluZyArIGhlYWRlcjsgfVxuICAgICAgICAgICAgcmV0dXJuIFtudWxsLCBoZWFkZXIsIG51bGxdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAnJztcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIGRhdGFNb2RlbHMuSlNPTi5wcm90b3R5cGVcbiAgICAgKiBAcGFyYW0ge251bWJlcn0geFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSB5XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0VmFsdWU6IGZ1bmN0aW9uKHgsIHksIHZhbHVlKSB7XG4gICAgICAgIHZhciBoYXNIaWVyYXJjaHlDb2x1bW4gPSB0aGlzLmhhc0hpZXJhcmNoeUNvbHVtbigpO1xuICAgICAgICB2YXIgZ3JpZCA9IHRoaXMuZ2V0R3JpZCgpO1xuICAgICAgICB2YXIgaGVhZGVyUm93Q291bnQgPSBncmlkLmdldEhlYWRlclJvd0NvdW50KCk7XG4gICAgICAgIGlmIChoYXNIaWVyYXJjaHlDb2x1bW4pIHtcbiAgICAgICAgICAgIGlmICh4ID09PSAtMikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgeCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh5IDwgaGVh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HVtbnNbY29sSW5kZXhdO1xuICAgICAgICBpZiAoY29sdW1uKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sdW1uLmdldFByb3BlcnRpZXMoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb2xJbmRleFxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldEZpbHRlcjogZnVuY3Rpb24oY29sSW5kZXgpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBpZiAoIWNvbHVtblByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sdW1uUHJvcGVydGllcy5maWx0ZXIgfHwgJyc7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvbEluZGV4XG4gICAgICogQHBhcmFtIHZhbHVlXG4gICAgICovXG4gICAgc2V0RmlsdGVyOiBmdW5jdGlvbihjb2xJbmRleCwgdmFsdWUpIHtcbiAgICAgICAgdmFyIGNvbHVtblByb3BlcnRpZXMgPSB0aGlzLmdldENvbHVtblByb3BlcnRpZXMoY29sSW5kZXgpO1xuICAgICAgICBjb2x1bW5Qcm9wZXJ0aWVzLmZpbHRlciA9IHZhbHVlO1xuICAgICAgICB0aGlzLmFwcGx5QW5hbHl0aWNzKCk7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICog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ovXG4gICAgZ2V0QXZhaWxhYmxlR3JvdXBzOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB0aGlzLnNvdXJjZS5nZXRIZWFkZXJzKCkuc2xpY2UoMCk7XG4gICAgICAgIHZhciBncm91cEJ5cyA9IHRoaXMuYW5hbHl0aWNzLmdyb3VwQnlzO1xuICAgICAgICB2YXIgZ3JvdXBzID0gW107XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaGVhZGVycy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKGdyb3VwQnlzLmluZGV4T2YoaSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkID0gaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICBncm91cHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIGlkOiBpLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbDogZmllbGQsXG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICogQHJldHVybnMge29iamVjdFtdfVxuICAgICAqL1xuICAgIGdldFZpc2libGVDb2x1bW5zOiBmdW5jdGlvbigpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy5nZXRCZWhhdmlvcigpLmNvbHVtbnM7XG4gICAgICAgIGl0ZW1zID0gaXRlbXMuZmlsdGVyKGZ1bmN0aW9uKGVhY2gpIHtcbiAgICAgICAgICAgIHJldHVybiBlYWNoLmxhYmVsICE9PSAnVHJlZSc7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gaXRlbXM7XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJP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wgMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoaGFzQ1RSTCB8fCBzdGF0ZS5zb3J0cy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc3RhdGUuc29ydHMubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIHN0YXRlLnNvcnRzLnVuc2hpZnQoY29sSW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzdGF0ZS5zb3J0cy5sZW5ndGggPiAzKSB7XG4gICAgICAgICAgICBzdGF0ZS5zb3J0cy5sZW5ndGggPSAzO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBkYXRhTW9kZWxzLkpTT04ucHJvdG90eXBlXG4gICAgICovXG4gICAgYXBwbHlTb3J0czogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBzb3J0aW5nU291cmNlID0gdGhpcy5nZXRTb3J0aW5nU291cmNlKCk7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIHZhciBncm91cE9mZnNldCA9IHRoaXMuaGFzQWdncmVnYXRlcygpID8gMSA6IDA7XG4gICAgICAgIGlmICghc29ydHMgfHwgc29ydHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBzb3J0aW5nU291cmNlLmNsZWFyU29ydHMoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc29ydHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sSW5kZXggPSBNYXRoLmFicyhzb3J0c1tpXSkgLSAxO1xuICAgICAgICAgICAgICAgIHZhciB0eXBlID0gc29ydHNbaV0gPCAwID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHNvcnRpbmdTb3VyY2Uuc29ydE9uKGNvbEluZGV4IC0gZ3JvdXBPZmZzZXQsIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHNvcnRpbmdTb3VyY2UuYXBwbHlTb3J0cygpO1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgZGF0YU1vZGVscy5KU09OLnByb3RvdHlwZVxuICAgICAqIEBwYXJhbSBpbmRleFxuICAgICAqIEBwYXJhbSByZXR1cm5Bc1N0cmluZ1xuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIGdldFNvcnRJbWFnZUZvckNvbHVtbjogZnVuY3Rpb24oaW5kZXgsIHJldHVybkFzU3RyaW5nKSB7XG4gICAgICAgIGluZGV4Kys7XG4gICAgICAgIHZhciB1cCA9IHRydWU7XG4gICAgICAgIHZhciBzb3J0cyA9IHRoaXMuZ2V0UHJpdmF0ZVN0YXRlKCkuc29ydHM7XG4gICAgICAgIGlmICghc29ydHMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHZhciBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoaW5kZXgpO1xuICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IHNvcnRzLmluZGV4T2YoLTEgKiBpbmRleCk7XG4gICAgICAgICAgICB1cCA9IGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb3NpdGlvbiA8IDApIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJhbmsgPSBzb3J0cy5sZW5ndGggLSBwb3NpdGlvbjtcblxuICAgICAgICBpZiAocmV0dXJuQXNTdHJpbmcpIHtcbiAgICAgICAgICAgIHZhciBhcnJvdyA9IHVwID8gVVBXQVJEU19CTEFDS19BUlJPVyA6IERP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uICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxTZWxlY3Rpb24ucHJvdG90eXBlXG4gICAgICogQGRlc2MgSGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eS5cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIWdyaWQuaXNDZWxsU2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrIHx8ICF0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIHZhciBudW1GaXhlZENvbHVtbnMgPSBncmlkLmdldEZpeGVkQ29sdW1uQ291bnQoKTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIHZhciBkeCA9IGNlbGwueDtcbiAgICAgICAgICAgIHZhciBkeSA9IGNlbGwueTtcblxuICAgICAgICAgICAgLy9pZiB3ZSBhcmUgaW4gdGhlIGZpeGVkIGFyZWEgZG8gbm90IGFwcGx5IHRoZSBzY3JvbGwgdmFsdWVzXG4gICAgICAgICAgICAvL2NoZWNrIGJvdGggeCBhbmQgeSB2YWx1ZXMgaW5kZXBlbmRlbnRseVxuICAgICAgICAgICAgaWYgKHZpZXdDZWxsLnggPCBudW1GaXhlZENvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBkeCA9IHZpZXdDZWxsLng7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2aWV3Q2VsbC55IDwgbnVtRml4ZWRSb3dzKSB7XG4gICAgICAgICAgICAgICAgZHkgPSB2aWV3Q2VsbC55O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgZENlbGwgPSBncmlkLm5ld1BvaW50KGR4LCBkeSk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudERyYWcgPSBwcmltRXZlbnQuZGV0YWlsLm1vdXNlO1xuICAgICAgICAgICAgdGhpcy5sYXN0RHJhZ0NlbGwgPSBkQ2VsbDtcblxuICAgICAgICAgICAgdGhpcy5jaGVja0RyYWdTY3JvbGwoZ3JpZCwgdGhpcy5jdXJyZW50RHJhZyk7XG4gICAgICAgICAgICB0aGlzLmhhbmRsZU1vdXNlRHJhZ0NlbGxTZW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vaW50ID0gZ3JpZC5nZXRNb3VzZURvd24oKTtcbiAgICAgICAgdmFyIHggPSBncmlkQ2VsbC54OyAvLyAtIG51bUZpeGVkQ29sdW1ucyArIHNjcm9sbExlZnQ7XG4gICAgICAgIHZhciB5ID0gZ3JpZENlbGwueTsgLy8gLSBudW1GaXhlZFJvd3MgKyBzY3JvbGxUb3A7XG5cbiAgICAgICAgLy93ZXJlIG91dHNpZGUgb2YgdGhlIGdyaWQgZG8gbm90aGluZ1xuICAgICAgICBpZiAoeCA8IDAgfHwgeSA8IDApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vd2UgaGF2ZSByZXBlYXRlZCBhIGNsaWNrIGluIHRoZSBzYW1lIHNwb3QgZGVzbGVjdCB0aGUgdmFsdWUgZnJvbSBsYXN0IHRpbWVcbiAgICAgICAgaWYgKHggPT09IG1vdXNlUG9pbnQueCAmJiB5ID09PSBtb3VzZVBvaW50LnkpIHtcbiAgICAgICAgICAgIGdyaWQuY2xlYXJNb3N0UmVjZW50U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICBncmlkLnBvcE1vdXNlRG93bigpO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhhc0NUUkwgJiYgIWhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyU2VsZWN0aW9ucygpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc1NISUZUKSB7XG4gICAgICAgICAgICBncmlkLmNsZWFyTW9zdFJlY2VudFNlbGVjdGlvbigpO1xuICAgICAgICAgICAgZ3JpZC5zZWxlY3QobW91c2VQb2ludC54LCBtb3VzZVBvaW50LnksIHggLSBtb3VzZVBvaW50LnggKyAxLCB5IC0gbW91c2VQb2ludC55ICsgMSk7XG4gICAgICAgICAgICBncmlkLnNldERyYWdFeHRlbnQoZ3JpZC5uZ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gICAgICAgICAgICB4ID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLm1vdXNlLnggLSB0aGlzLmRyYWdPZmZzZXQ7XG4gICAgICAgICAgICAvL3kgPSBldmVudC5wcmltaXRpdmVFdmVudC5kZXRhaWwubW91c2UueTtcbiAgICAgICAgICAgIHRoaXMuZHJhZ0NvbHVtbihncmlkLCB4KTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbE1vdmluZy5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBoYW5kbGUgdGhpcyBldmVudFxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZURvd246IGZ1bmN0aW9uKGdyaWQsIGV2ZW50KSB7XG4gICAgICAgIGlmIChncmlkLmdldEJlaGF2aW9yKCkuaXNDb2x1bW5SZW9yZGVyYWJsZSgpKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5pc0hlYWRlclJvdyhncmlkLCBldmVudCkgJiYgZXZlbnQuZ3JpZENlbGwueCAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmRyYWdBcm1lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgdGhpcy5jdXJzb3IgPSB0aGlzLmdldERyYWdnaW5nQ3Vyc29yTmFtZSgpO1xuICAgICAgICAgICAgICAgIGdyaWQuY2xlYXJTZWxlY3Rpb25zKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMubmV4dCkge1xuICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENlbGxNb3ZpbmcucH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ZCwgJ3RyYW5zZm9ybScsICd0cmFuc2xhdGUoJyArIGRyYWdnZXJTdGFydFggKyAncHgsICcgKyAtMiArICdweCknKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZ3JpZC5yZXBhaW50KCk7XG4gICAgICAgICAgICAvL25lZWQgdG8gY2hhbmdlIHRoaXMgdG8ga2V5IGZyYW1lc1xuXG4gICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuc2V0Q3Jvc3NCcm93c2VyUHJvcGVydHkoZCwgJ3RyYW5zaXRpb24nLCAnJyk7XG4gICAgICAgICAgICAgICAgZ3JpZC5yZW5kZXJPdmVycmlkZXNDYWNoZS5mbG9hdGVyID0gbnVsbDtcbiAgICAgICAgICAgICAgICBncmlkLnJlcGFpbnQoKTtcbiAgICAgICAgICAgICAgICBzZWxmLmRvRmxvYXRlckFuaW1hdGlvbihncmlkKTtcbiAgICAgICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIGQuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Zsb2F0aW5nTm93ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LCBjb2x1bW5BbmltYXRpb25UaW1lICsgNTApO1xuICAgICAgICB9O1xuICAgIH0sXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyT2YgQ2VsbE1vdmluZy5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBtYW5pZmVzdCB0aGUgZmxvYXRlciBhbmltYXRpb25cbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqL1xuICAgIGRvRmxvYXRlckFuaW1hdGlvbjogZnVuY3Rpb24oZ3JpZCkge1xuICAgICAgICBpZiAodGhpcy5mbG9hdGVyQ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aGVSaWdodCk7XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIGlmICh4IDwgbWluWCAtIDEwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5jaGVja0F1dG9TY3JvbGxUb0xlZnQoZ3JpZCwgeCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA+IG1pblggLSAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdMZWZ0ID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL2xldHMgY2hlY2sgZm9yIGF1dG9zY3JvbGwgdG8gcmlnaHQgaWYgd2VyZSB1cCBhZ2FpbnN0IGl0XG4gICAgICAgICAgICBpZiAoYXRNYXggfHwgeCA+IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tBdXRvU2Nyb2xsVG9SaWdodChncmlkLCB4KTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeCA8IG1heFggKyAxMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY29sdW1uRHJhZ0F1dG9TY3JvbGxpbmdSaWdodCA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJPZiBDZWxsTW92aW5nLnByb3RvdHlwZVxuICAgICAqIEBkZXNjIGF1dG9zY3JvbGwgdG8gdGhlIHJpZ2h0IGlmIG5lY2Vzc2FyeVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHggLSB0aGUgc3RhcnQgcG9zaXRpb25cbiAgICAgKi9cbiAgICBjaGVja0F1dG9TY3JvbGxUb1JpZ2h0OiBmdW5jdGlvbihncmlkLCB4KSB7XG4gICAgICAgIGlmICh0aGlzLmNvbHVtbkRyYWdBd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coKSAmJiBkeSA9PT0gMCAmJiBkeCAhPT0gLTE7XG5cbiAgICAgICAgaWYgKGlzUmlnaHRDbGljayB8fCAhaXNIZWFkZXIpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLm5leHQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VEb3duKGdyaWQsIGV2ZW50KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgdmFyIG51bUZpeGVkQ29sdW1ucyA9IGdyaWQuZ2V0Rml4ZWRDb2x1bW5Db3VudCgpO1xuXG4gICAgICAgICAgICAvL2lmIHdlIGFyZSBpbiB0aGUgZml4ZWQgYXJlYSBkbyBub3QgYXBwbHkgdGhlIHNjcm9sbCB2YWx1ZXNcbiAgICAgICAgICAgIC8vY2hlY2sgYm90aCB4IGFuZCB5IHZhbHVlcyBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgICBpZiAodmlld0NlbGwueCA8IG51bUZpeGVkQ29sdW1ucykge1xuICAgICAgICAgICAgICAgIGR4ID0gdmlld0NlbGwueDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGRDZWxsID0gZ3JpZC5uZXdQb2ludChkeCwgMCk7XG5cbiAgICAgICAgICAgIHZhciBwcmltRXZlbnQgPSBldmVudC5wcmltaXRpdmVFdmVudDtcbiAgICAgICAgICAgIHZhciBrZXlzID0gcHJpbUV2ZW50LmRldGFpbC5rZXlzO1xuICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmV4dGVuZFNlbGVjdGlvbihncmlkLCBkQ2VsbCwga2V5cyk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIENvbHVtblNlbGVjdGlvbi5wcm90b3R5cGVcbiAgICAgKiBAZGVzYyBoYW5kbGUgdGhpcyBldmVudCBkb3duIHRoZSBmZWF0dXJ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ICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVNb3VzZVVwOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlTW91c2VVcChncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbHNcbiAgICAgKi9cbiAgICBoYW5kbGVLZXlEb3duOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICB0aGlzLm5leHQuaGFuZGxlS2V5RG93bihncmlkLCBldmVudCk7XG4gICAgICAgIH1cbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIEZlYXR1cmUucHJvdG90eXBlXG4gICAgICogQGRlc2MgaGFuZGxlIHRoaXMgZXZlbnQgZG93biB0aGUgZmVhdHVyZSBjaGFpbiBvZiByZXNwb25zaWJpbGl0eVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICogQHBhcmFtIHtPYmplY3R9IGV2ZW50IC0gdGhlIGV2ZW50IGRldGFpbH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YgKCF0aGlzLmlzQ29sdW1uUGlja2VyT3BlbigpKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3BlbkVkaXRvcikge1xuICAgICAgICAgICAgdGhpcy5vcGVuRWRpdG9yID0gZmFsc2U7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGdyaWQuZ2V0QmVoYXZpb3IoKS5jbG9zZUVkaXRvcih0aGlzLm92ZXJsYXkpID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgZG9jdW1lbnQucmVtb3ZlRXZlbnRMaXN0ZW5lcigna2V5ZG93bicsIHRoaXMuX2Nsb3NlciwgZmFsc2UpO1xuXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcblxuICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuc3R5bGUub3BhY2l0eSA9IDA7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuaW5uZXJIVE1MID0gJyc7XG4gICAgICAgICAgICBzZWxmLm92ZXJsYXkuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgICAgIGdyaWQudGFrZUZvY3VzKCk7XG4gICAgICAgIH0sIEFOSU1BVElPTl9USU1FKTtcbiAgICB9LFxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlck9mIE92ZXJsYXkucHJvdG90eXBlXG4gICAgICogQGRlc2MgaW5pdGlhbGl6ZSBteXNlbGYgaW50byB0aGUgZ3JpZFxuICAgICAqICMjIyMgcmV0dXJuczogdHlwZVxuICAgICAqIEBwYXJhbSB7SHlwZXJncmlkfSBncmlkXG4gICAgICovXG4g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VzcG9uc2liaWxpdHlcbiAgICAgKiBAcGFyYW0ge0h5cGVyZ3JpZH0gZ3JpZFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBldmVudCAtIHRoZSBldmVudCBkZXRhaWxzXG4gICAgICovXG4gICAgaGFuZGxlTW91c2VEcmFnOiBmdW5jdGlvbihncmlkLCBldmVudCkge1xuICAgICAgICB2YXIgaXNSaWdodENsaWNrID0gZXZlbnQucHJpbWl0aXZlRXZlbnQuZGV0YWlsLmlzUmlnaHRDbGljaztcblxuICAgICAgICBpZiAoIXRoaXMuZHJhZ0FybWVkIHx8ICFncmlkLmlzUm93U2VsZWN0aW9uKCkgfHwgaXNSaWdodENsaWNrKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5uZXh0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5uZXh0LmhhbmRsZU1vdXNlRHJhZyhncmlkLCBldmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmRyYWdnaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHZhciBudW1GaXhlZFJvd3MgPSBncmlkLmdldEZpeGVkUm93Q291bnQoKTtcblxuICAgICAgICAgICAgdmFyIGNlbGwgPSBldmVudC5ncmlkQ2VsbDtcbiAgICAgICAgICAgIHZhciB2aWV3Q2VsbCA9IGV2ZW50LnZpZXdQb2ludDtcbiAgICAgICAgICAgIC8vdmFyIGR4ID0gY2VsbC54O1xuICAgICAgICAgICAgdmFyIGR5ID0gY2VsbC55O1xuXG4gICAgICAgICAgICAvL2lmIHdlIGFyZSBpbiB0aGUgZml4ZWQgYXJlYSBkbyBub3QgYXBwbHkgdGhlIHNjcm9sbCB2YWx1ZXNcbiAgICAgICAgICAgIC8vY2hlY2sgYm90aCB4IGFuZCB5IHZhbHVlcyBpbmRlcGVuZGVudGx5XG4gICAgICAgICAgICBpZiAodmlld0NlbGwueSA8IG51bUZpeGVkUm93cykge1xuICAgICAgICAgICAgIC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b24tbGlzdCA+IHVsIHsgdG9wOiA0NnB4OyB9JyxcbiAgICAgICAgJ2Rpdi5kcmFnb24tbGlzdCA+IHVsID4gbGk6bm90KDpsYXN0LWNoaWxkKTo6YmVmb3JlLCBsaS5kcmFnb24tcG9wOjpiZWZvcmUgeycsXG4gICAgICAgICcgICAgY29udGVudDogXFwnXFxcXDJiMjRcXCc7JywgLy8gQkxBQ0sgTEFSR0UgQ0lSQ0xFXG4gICAgICAgICcgICAgY29sb3I6ICNiNmI2YjY7JyxcbiAgICAgICAgJyAgICBmb250LXNpemU6IDMwcHg7JyxcbiAgICAgICAgJyAgICBtYXJnaW46IDhweCAxNHB4IDhweCA4cHg7IH0nLFxuICAgICAgICAnbGkuZHJhZ29uLXBvcCB7IG9wYWNpdHk6Ljg7IH0nXG4gICAgXVxufTtcblxuZnVuY3Rpb24gYWRkU3R5bGVzaGVldChrZXksIHJlZmVyZW5jZUVsZW1lbnQpIHtcbiAgICBjc3NJbmplY3RvcihzdHlsZXNoZWV0c1trZXldLCBrZXksIHJlZmVyZW5jZUVsZW1lbnQpO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGFkZFN0eWxlc2hlZXQ7XG4iXX0= diff --git a/examples/polymerwrapper/index.min.js b/examples/polymerwrapper/index.min.js index 1d26fde82..e8e5cd6c2 100644 --- a/examples/polymerwrapper/index.min.js +++ b/examples/polymerwrapper/index.min.js @@ -1,8 +1,8 @@ !function t(e,i,n){function o(s,l){if(!i[s]){if(!e[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(r)return r(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(t){var i=e[s][1][t];return o(i?i:t)},u,u.exports,t,e,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s'+t.replace("mouse","")+""}),e.appendChild(n),t={},i.forEach(function(e){t[e]=n.getElementsByClassName(e)[0]})}return t},_addEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.add("listening"),window.addEventListener(t,this._bound["on"+t])},_removeEvt:function(t){var e=this.testPanelItem&&this.testPanelItem[t];e&&e.classList.remove("listening"),window.removeEventListener(t,this._bound["on"+t])}};var a,u={shortStop:function(t){t.stopPropagation()},onwheel:function(t){this.index+=t[this.deltaProp],t.stopPropagation(),t.preventDefault()},onclick:function(t){var e=this.thumb.getBoundingClientRect(),i=t[this.oh.coordinate].thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:31}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){var i=this;return!this.filters.find(function(n){return!n(i.dataSource.getValue(n.columnIndex,t),e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){var i=this;return this.visibleColumnMap.find(function(n,o){var r=i.dataSource.getValue(n,t);return i.filter(r,e,t)})}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":26,templex:27}],26:[function(t,e,i){e.exports=t(2)},{}],27:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;ie.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],29:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],30:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],31:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],33:[function(t,e,i){"use strict";function n(t,e){var i="f"===(typeof e)[0],n=i?e(t):e;return n||0===n?n:""}function o(t,e,i,n,o,r){var s=t.getTextWidth(e,i);switch(e.textAlign){case"center":n-=s/2;break;case"right":n-=s}e.lineWidth=r,e.moveTo(n+.5,o+.5),e.lineTo(n+s+.5,o+.5)}function r(t,e,i,n){if(1===i.length)return i;for(var o,s=[i.shift()];(o=e.getTextWidth(t,s.join(" "))1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent},setDragExtent:function(t){ -this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":35,"./SelectionModel":36,"./stylesheets":74,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":28,"object-iterators":30,rectangular:31}],35:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); -}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":30}],36:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":32}],37:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],54:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":64}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":64}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s)); -var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":64}],59:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":64}],60:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":64}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":64}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":64}],63:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":64}],64:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":64}],69:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":61}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":64}],71:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":64}],72:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":56,"./CellEditing":57,"./CellSelection":58,"./ColumnAutosizing":59,"./ColumnMoving":60,"./ColumnResizing":61,"./ColumnSelection":62,"./ColumnSorting":63,"./Feature":64,"./Filters":65,"./KeyPaging":66,"./OnHover":67,"./Overlay":68,"./RowResizing":69,"./RowSelection":70,"./ThumbwheelScrolling":71}],73:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],74:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[55]); \ No newline at end of file +}},c={vertical:{coordinate:"clientY",axis:"pageY",size:"height",outside:"right",inside:"left",leading:"top",trailing:"bottom",marginLeading:"marginTop",marginTrailing:"marginBottom",thickness:"width",delta:"deltaY"},horizontal:{coordinate:"clientX",axis:"pageX",size:"width",outside:"bottom",inside:"top",leading:"left",trailing:"right",marginLeading:"marginLeft",marginTrailing:"marginRight",thickness:"height",delta:"deltaX"}},h={top:"vertical",bottom:"vertical",height:"vertical",left:"horizontal",right:"horizontal",width:"horizontal"};a="div.finbar-horizontal,div.finbar-vertical{position:absolute;margin:3px}div.finbar-horizontal>.thumb,div.finbar-vertical>.thumb{position:absolute;background-color:#d3d3d3;-webkit-box-shadow:0 0 1px #000;-moz-box-shadow:0 0 1px #000;box-shadow:0 0 1px #000;border-radius:4px;margin:2px;opacity:.4;transition:opacity .5s}div.finbar-horizontal>.thumb.hover,div.finbar-vertical>.thumb.hover{opacity:1;transition:opacity .5s}div.finbar-vertical{top:0;bottom:0;right:0;width:11px}div.finbar-vertical>.thumb{top:0;right:0;width:7px}div.finbar-horizontal{left:0;right:0;bottom:0;height:11px}div.finbar-horizontal>.thumb{left:0;bottom:0;height:7px}",e.exports=n},{"css-injector":2}],5:[function(t,e,i){"use strict";function n(t,e){var i=this;this.div=t,this._component=e,this.dragEndtime=Date.now(),this.canvas=document.createElement("canvas"),this.div.appendChild(this.canvas),this.canvas.style.outline="none",this.canvasCTX=this.canvas.getContext("2d"),this.gc=new u(this.canvasCTX),this.buffer=document.createElement("canvas"),this.bufferCTX=this.buffer.getContext("2d"),this.bufferGC=new u(this.bufferCTX),this.mouseLocation=new l.Point(-1,-1),this.dragstart=new l.Point(-1,-1),this.bounds=new l.Rectangle(0,0,0,0),this.hasMouse=!1,document.addEventListener("mousemove",function(t){(i.hasMouse||i.isDragging())&&i.finmousemove(t)}),document.addEventListener("mouseup",function(t){i.finmouseup(t)}),document.addEventListener("wheel",function(t){i.finwheelmoved(t)}),document.addEventListener("keydown",function(t){i.finkeydown(t)}),document.addEventListener("keyup",function(t){i.finkeyup(t)}),this.canvas.onmouseover=function(){i.hasMouse=!0},this.canvas.addEventListener("focus",function(t){i.finfocusgained(t)}),this.canvas.addEventListener("blur",function(t){i.finfocuslost(t)}),this.canvas.addEventListener("mousedown",function(t){i.finmousedown(t)}),this.canvas.addEventListener("mouseout",function(t){i.hasMouse=!1,i.finmouseout(t)}),this.canvas.addEventListener("click",function(t){i.finclick(t)}),this.canvas.addEventListener("contextmenu",function(t){return i.fincontextmenu(t),t.preventDefault(),!1}),a.addEventListener(this.canvas,"tap",function(t){i.fintap(t)}),a.addEventListener(this.canvas,"holdpulse",function(t){i.finholdpulse(t)}),a.addEventListener(this.canvas,"flick",function(t){i.finflick(t)}),a.addEventListener(this.canvas,"release",function(t){i.finrelease(t)}),a.addEventListener(this.canvas,"trackstart",function(t){i.fintrackstart(t)}),a.addEventListener(this.canvas,"track",function(t){i.fintrack(t)}),a.addEventListener(this.canvas,"trackend",function(t){i.fintrackend(t)}),this.canvas.setAttribute("tabindex",0),this.canvas.contentEditable=!0,this.resize(),this.beginResizing(),this.beginPainting()}function o(t){if(g){for(var e=0;ei;i++)t[i]=e;return t[27]=["ESC","ESCSHIFT"],t[192]=["`","~"],t[49]=["1","!"],t[50]=["2","@"],t[51]=["3","#"],t[52]=["4","$"],t[53]=["5","%"],t[54]=["6","^"],t[55]=["7","&"],t[56]=["8","*"],t[57]=["9","("],t[48]=["0",")"],t[189]=["-","_"],t[187]=["=","+"],t[8]=["DELETE","DELETESHIFT"],t[9]=["TAB","TABSHIFT"],t[81]=["q","Q"],t[87]=["w","W"],t[69]=["e","E"],t[82]=["r","R"],t[84]=["t","T"],t[89]=["y","Y"],t[85]=["u","U"],t[73]=["i","I"],t[79]=["o","O"],t[80]=["p","P"],t[219]=["[","{"],t[221]=["]","}"],t[220]=["\\","|"],t[220]=["CAPSLOCK","CAPSLOCKSHIFT"],t[65]=["a","A"],t[83]=["s","S"],t[68]=["d","D"],t[70]=["f","F"],t[71]=["g","G"],t[72]=["h","H"],t[74]=["j","J"],t[75]=["k","K"],t[76]=["l","L"],t[186]=[";",":"],t[222]=["'","|"],t[13]=["RETURN","RETURNSHIFT"],t[16]=["SHIFT","SHIFT"],t[90]=["z","Z"],t[88]=["x","X"],t[67]=["c","C"],t[86]=["v","V"],t[66]=["b","B"],t[78]=["n","N"],t[77]=["m","M"],t[188]=[",","<"],t[190]=[".",">"],t[191]=["/","?"],t[16]=["SHIFT","SHIFT"],t[17]=["CTRL","CTRLSHIFT"],t[18]=["ALT","ALTSHIFT"],t[91]=["COMMANDLEFT","COMMANDLEFTSHIFT"],t[32]=["SPACE","SPACESHIFT"],t[93]=["COMMANDRIGHT","COMMANDRIGHTSHIFT"],t[18]=["ALT","ALTSHIFT"],t[38]=["UP","UPSHIFT"],t[37]=["LEFT","LEFTSHIFT"],t[40]=["DOWN","DOWNSHIFT"],t[39]=["RIGHT","RIGHTSHIFT"],t[33]=["PAGEUP","PAGEUPSHIFT"],t[34]=["PAGEDOWN","PAGEDOWNSHIFT"],t[35]=["PAGERIGHT","PAGERIGHTSHIFT"],t[36]=["PAGELEFT","PAGELEFTSHIFT"],t}var l=t("rectangular"),a=t("./js/polymergestures.dev.js"),u=t("./js/GraphicsContext.js"),c=200,h=[],d=[],g=!0,f=!0,p=s();n.prototype={constructor:n.prototype.constructor,div:null,_component:null,gestures:a,canvas:null,canvasCTX:null,focuser:null,buffer:null,ctx:null,mouseLocation:null,holdPulseCount:-1,dragstart:null,origin:null,bounds:null,dirty:!1,size:null,mousedown:!1,dragging:!1,repeatKeyCount:0,repeatKey:null,repeatKeyStartTime:0,currentKeys:[],hasMouse:!1,lastDoubleClickTime:0,dragEndTime:0,lastRepaintTime:0,addEventListener:function(t,e){this.canvas.addEventListener(t,e)},stopPaintLoop:function(){g=!1},restartPaintLoop:function(){g||(g=!0,requestAnimationFrame(o))},stopResizeLoop:function(){f=!1},restartResizeLoop:function(){f||(f=!0,setInterval(r,200))},detached:function(){this.stopPainting(),this.stopResizing()},useHiDPI:function(){return this._component.resolveProperty("useHiDPI")},useBitBlit:function(){return this._component.resolveProperty("useBitBlit")},getFPS:function(){var t=this._component.resolveProperty("repaintIntervalRate");return t?parseInt(t):0},tickPaint:function(t){var e=this.getFPS();if(0!==e){var i=1e3/e,n=t-this.lastRepaintTime;n>i&&this.dirty&&(this.lastRepaintTime=t-n%i,this.paintNow())}},beginPainting:function(){var t=this;this.dirty=!0,this.tickPainter=function(e){t.tickPaint(e)},h.push(this)},stopPainting:function(){h.splice(h.indexOf(this),1)},beginResizing:function(){var t=this;this.tickResizer=function(){t.checksize()},d.push(this)},stopResizing:function(){d.splice(d.indexOf(this),1)},start:function(){this.beginPainting(),this.beginResizing()},stop:function(){this.stopPainting(),this.stopResizing()},checksize:function(){var t=this.div.getBoundingClientRect();(t.width!==this.size.width||t.height!==this.size.height)&&this.sizeChangedNotification()},sizeChangedNotification:function(){this.resize()},resize:function(){var t=this.size=this.div.getBoundingClientRect();this.canvas.width=this.buffer.width=t.width,this.canvas.height=this.buffer.height=t.height;var e=1,i=this.useBitBlit(),n=window.devicePixelRatio&&this.useHiDPI();if(n){var o=window.devicePixelRatio||1,r=this.canvasCTX.webkitBackingStorePixelRatio||this.canvasCTX.mozBackingStorePixelRatio||this.canvasCTX.msBackingStorePixelRatio||this.canvasCTX.oBackingStorePixelRatio||this.canvasCTX.backingStorePixelRatio||1;e=o/r}var s=this.canvas.getAttribute("width"),a=this.canvas.getAttribute("height");this.canvas.width=s*e,this.canvas.height=a*e,this.buffer.width=s*e,this.buffer.height=a*e,this.canvas.style.width=s+"px",this.canvas.style.height=a+"px",this.buffer.style.width=s+"px",this.buffer.style.height=a+"px",this.bufferCTX.scale(e,e),n&&!i&&this.canvasCTX.scale(e,e),this.bounds=new l.Rectangle(0,0,t.width,t.height);var u=this._component;u&&u.setBounds(this.bounds),this.resizeNotification(),this.paintNow()},resizeNotification:function(){},getBounds:function(){return this.bounds},paintNow:function(){var t=this;this.safePaintImmediately(function(e){e.clearRect(0,0,t.canvas.width,t.canvas.height);var i=t._component;i&&i._paint(e),t.dirty=!1})},safePaintImmediately:function(t){var e=this.useBitBlit(),i=e?this.bufferGC:this.gc;try{i.save(),t(i)}catch(n){console.error(n)}finally{i.restore()}e&&this.flushBuffer()},flushBuffer:function(){this.buffer.width>0&&this.buffer.height>0&&this.canvasCTX.drawImage(this.buffer,0,0)},dispatchNewEvent:function(t,e,i){return i={detail:i||{}},i.detail.primitiveEvent=t,this.canvas.dispatchEvent(new CustomEvent(e,i))},dispatchNewMouseKeysEvent:function(t,e,i){return i=i||{},i.mouse=this.mouseLocation,i.keys=this.currentKeys,this.dispatchNewEvent(t,e,i)},finmousemove:function(t){!this.isDragging()&&this.mousedown&&(this.beDragging(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragstart",{isRightClick:this.isRightClick(t)}),this.dragstart=new l.Point(this.mouseLocation.x,this.mouseLocation.y)),this.mouseLocation=this.getLocal(t),this.isDragging()&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-drag",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.bounds.contains(this.mouseLocation)&&this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousemove")},finmousedown:function(t){this.mouseLocation=this.getLocal(t),this.mousedown=!0,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mousedown",{isRightClick:this.isRightClick(t)}),this.takeFocus()},finmouseup:function(t){this.isDragging()&&(this.dispatchNewMouseKeysEvent(t,"fin-canvas-dragend",{dragstart:this.dragstart,isRightClick:this.isRightClick(t)}),this.beNotDragging(),this.dragEndtime=Date.now()),this.mousedown=!1,this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseup",{isRightClick:this.isRightClick(t)})},finmouseout:function(t){this.mousedown||(this.mouseLocation=new l.Point(-1,-1)),this.dispatchNewMouseKeysEvent(t,"fin-canvas-mouseout")},finwheelmoved:function(t){!this.isDragging()&&this.hasFocus()&&(t.preventDefault(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-wheelmoved",{isRightClick:this.isRightClick(t)}))},finclick:function(t){return Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-click",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},finrelease:function(t){this.holdPulseCount=0,this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-release")},finflick:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-flick",{isRightClick:this.isRightClick(t)}))},fintrackstart:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackstart"))},fintrack:function(t){this.hasFocus()&&(this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-track"))},fintrackend:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-trackend")},finhold:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-hold",{isRightClick:this.isRightClick(t)})},finholdpulse:function(t){this.mouseLocation=this.getLocal(t),this.dispatchNewMouseKeysEvent(t,"fin-canvas-holdpulse",{count:this.holdPulseCount++})},fintap:function(t){var e=this,i=Date.now(),n=i-this.lastDoubleClickTime;300>n||i-this.dragEndtime<100||setTimeout(function(){e._fintap(t)},180)},_fintap:function(t){var e=Date.now(),i=e-this.lastDoubleClickTime;300>i||this.dispatchNewMouseKeysEvent(t,"fin-canvas-tap",{isRightClick:this.isRightClick(t)})},findblclick:function(t){this.mouseLocation=this.getLocal(t),this.lastDoubleClickTime=Date.now(),this.dispatchNewMouseKeysEvent(t,"fin-canvas-dblclick",{isRightClick:this.isRightClick(t)})},getCharMap:function(){return p},finkeydown:function(t){if(this.hasFocus()){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];t.repeat?this.repeatKey===e?this.repeatKeyCount++:(this.repeatKey=e,this.repeatKeyStartTime=Date.now()):(this.repeatKey=null,this.repeatKeyCount=0,this.repeatKeyStartTime=0),-1===this.currentKeys.indexOf(e)&&this.currentKeys.push(e),this.dispatchNewEvent(t,"fin-canvas-keydown",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeatCount:this.repeatKeyCount,repeatStartTime:this.repeatKeyStartTime,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)})}},finkeyup:function(t){var e=t.shiftKey?p[t.keyCode][1]:p[t.keyCode][0];this.currentKeys.splice(this.currentKeys.indexOf(e),1),this.hasFocus()&&(this.repeatKeyCount=0,this.repeatKey=null,this.repeatKeyStartTime=0,this.dispatchNewEvent(t,"fin-canvas-keyup",{alt:t.altKey,ctrl:t.ctrlKey,"char":e,code:t.charCode,key:t.keyCode,meta:t.metaKey,repeat:t.repeat,shift:t.shiftKey,identifier:t.keyIdentifier,currentKeys:this.currentKeys.slice(0)}))},finfocusgained:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-gained")},finfocuslost:function(t){this.dispatchNewEvent(t,"fin-canvas-focus-lost")},fincontextmenu:function(t){return t.ctrlKey&&-1===this.currentKeys.indexOf("CTRL")&&this.currentKeys.push("CTRL"),Date.now()-this.lastClickTime<250?void this.findblclick(t):(this.dispatchNewMouseKeysEvent(t,"fin-canvas-context-menu",{isRightClick:this.isRightClick(t)}),void(this.lastClickTime=Date.now()))},repaint:function(){var t=this.getFPS();this.dirty=!0,g&&0!==t||this.paintNow()},getMouseLocation:function(){return this.mouseLocation},getOrigin:function(){var t=this.canvas.getBoundingClientRect(),e=new l.Point(t.left,t.top);return e},getLocal:function(t){var e=this.canvas.getBoundingClientRect(),i=new l.Point(t.clientX-e.left,t.clientY-e.top);return i},hasFocus:function(){return document.activeElement===this.canvas},takeFocus:function(){var t=this;this.hasFocus()||setTimeout(function(){t.canvas.focus()},10)},beDragging:function(){this.dragging=!0,this.disableDocumentElementSelection()},beNotDragging:function(){this.dragging=!1,this.enableDocumentElementSelection()},isDragging:function(){return this.dragging},disableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText+"-webkit-user-select: none"},enableDocumentElementSelection:function(){var t=document.body.style;t.cssText=t.cssText.replace("-webkit-user-select: none","")},setFocusable:function(t){this.focuser.style.display=t?"":"none"},isRightClick:function(t){var e;return t=t||window.event,"which"in t?e=3===t.which:"button"in t&&(e=2===t.button),e},dispatchEvent:function(t){return this.canvas.dispatchEvent(t)}},requestAnimationFrame(o),setInterval(r,c),e.exports=n},{"./js/GraphicsContext.js":6,"./js/polymergestures.dev.js":8,rectangular:29}],6:[function(t,e,i){"use strict";function n(t,e){function i(i){i in n.prototype||s.test(i)||("function"==typeof t[i]?r[i]=e?function(){return e(i,arguments,t[i].apply(t,arguments))}:t[i].bind(t):Object.defineProperty(r,i,{get:function(){var n=t[i];return e?e(i,"getter",n):n},set:function(n){t[i]=e?e(i,"setter",n):n}}))}this.gc=t;var r=this,s=/^webkit/;switch(typeof e){case"string":e=o.bind(void 0,e+".");break;case"boolean":e===!0&&(e=o.bind(void 0,"gc."));break;case"function":if(3!==e.length)throw"GraphicsContext: User-supplied API logger function does not accept three parameters.";break;default:e=!1}Object.keys(Object.getPrototypeOf(t)).forEach(i),Object.keys(t).forEach(i)}var o=t("./gc-console-logger");e.exports=n},{"./gc-console-logger":7}],7:[function(t,e,i){"use strict";function n(t,e,i,n){var r=n;switch("string"==typeof n&&(r='"'+r+'"'),e=t+e,i){case"getter":console.log(e,"=",r);break;case"setter":console.log(e,o,r);break;default:e+="("+Array.prototype.slice.call(i).join(", ")+")",void 0===r?console.log(e):console.log(e,o,r)}return n}var o="⟹";e.exports=n},{}],8:[function(t,e,i){!function(t){var e=!1,i=document.createElement("meta");if(i.createShadowRoot){var n=i.createShadowRoot(),o=document.createElement("span");n.appendChild(o),i.addEventListener("testpath",function(t){t.path&&(e=t.path[0]===o),t.stopPropagation()});var r=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(i),o.dispatchEvent(r),i.parentNode.removeChild(i),n=o=null}i=null;var s={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){var e=this.shadow(t);return this.canTarget(e)?e:void 0},olderShadow:function(t){var e=t.olderShadowRoot;if(!e){var i=t.querySelector("shadow");i&&(e=i.olderShadowRoot)}return e},allShadows:function(t){for(var e=[],i=this.shadow(t);i;)e.push(i),i=this.olderShadow(i);return e},searchRoot:function(t,e,i){var n,o;return t?(n=t.elementFromPoint(e,i),n?o=this.targetingShadow(n):t!==document&&(o=this.olderShadow(t)),this.searchRoot(o,e,i)||n):void 0},owner:function(t){if(!t)return document;for(var e=t;e.parentNode;)e=e.parentNode;return e.nodeType!=Node.DOCUMENT_NODE&&e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(e=document),e},findTarget:function(t){if(e&&t.path&&t.path.length)return t.path[0];var i=t.clientX,n=t.clientY,o=this.owner(t.target);return o.elementFromPoint(i,n)||(o=document),this.searchRoot(o,i,n)},findTouchAction:function(t){var i;if(e&&t.path&&t.path.length){for(var n=t.path,o=0;o=0?t=this.walk(t,o):e=this.walk(e,-o);t&&e&&t!==e;)t=t.parentNode||t.host,e=e.parentNode||e.host;return t},walk:function(t,e){for(var i=0;t&&e>i;i++)t=t.parentNode||t.host;return t},depth:function(t){for(var e=0;t;)e++,t=t.parentNode||t.host;return e},deepContains:function(t,e){var i=this.LCA(t,e);return i===t},insideNode:function(t,e,i){var n=t.getBoundingClientRect();return n.left<=e&&e<=n.right&&n.top<=i&&i<=n.bottom},path:function(t){var i;if(e&&t.path&&t.path.length)i=t.path;else{i=[];for(var n=this.findTarget(t);n;)i.push(n),n=n.parentNode||n.host}return i}};t.targetFinding=s,t.findTarget=s.findTarget.bind(s),t.deepContains=s.deepContains.bind(s),t.insideNode=s.insideNode}(i),function(){function t(t){return"html /deep/ "+e(t)}function e(t){return'[touch-action="'+t+'"]'}function i(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+";}"}var n=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],o="",r="string"==typeof document.head.style.touchAction,s=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(r){n.forEach(function(n){String(n)===n?(o+=e(n)+i(n)+"\n",s&&(o+=t(n)+i(n)+"\n")):(o+=n.selectors.map(e)+i(n.rule)+"\n",s&&(o+=n.selectors.map(t)+i(n.rule)+"\n"))});var l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}}(),function(t){var e=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],i=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],n=function(){return function(){}},o={preventTap:n,makeBaseEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,e.bubbles||!1,e.cancelable||!1),i.preventTap=o.preventTap(i),i},makeGestureEvent:function(t,e){e=e||Object.create(null);for(var i,n=this.makeBaseEvent(t,e),o=0,r=Object.keys(e);o-1?this.values[i]=e:(this.keys.push(t),this.values.push(e))},has:function(t){return this.keys.indexOf(t)>-1},"delete":function(t){var e=this.keys.indexOf(t);e>-1&&(this.keys.splice(e,1),this.values.splice(e,1))},get:function(t){var e=this.keys.indexOf(t);return this.values[e]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(t,e){this.values.forEach(function(i,n){t.call(e,i,this.keys[n],this)},this)},pointers:function(){return this.keys.length}},t.PointerMap=e}(i),function(t){var e,i=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],o="undefined"!=typeof SVGElementInstance,r=t.eventFactory,s={IS_IOS:!1,pointermap:new t.PointerMap,requiredGestures:new t.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(t,e){var i=e,n=i.events;n&&(n.forEach(function(t){i[t]&&(this.eventMap[t]=i[t].bind(i))},this),this.eventSources[t]=i,this.eventSourceList.push(i))},registerGesture:function(t,e){var i=Object.create(null);i.listeners=0,i.index=this.gestures.length;for(var n,o=0;oo&&(i=this.eventSourceList[o]);o++)i.register.call(i,t,e)},unregister:function(t){for(var e,i=this.eventSourceList.length,n=0;i>n&&(e=this.eventSourceList[n]);n++)e.unregister.call(e,t)},down:function(t){this.requiredGestures.set(t.pointerId,e),this.fireEvent("down",t)},move:function(t){t.type="move",this.fillGestureQueue(t)},up:function(t){this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},cancel:function(t){t.tapPrevented=!0,this.fireEvent("up",t),this.requiredGestures["delete"](t.pointerId)},addGestureDependency:function(t,e){var i=t._pgEvents;if(i&&e)for(var n,o,r,s=Object.keys(i),l=0;l0&&(n=this.dependencyMap[r],o=n?n.index:-1,e[o]=!0)},eventHandler:function(i){var n=i.type;if("touchstart"===n||"mousedown"===n||"pointerdown"===n||"MSPointerDown"===n)if(i._handledByPG||(e={}),this.IS_IOS){var o=i;if("touchstart"===n){var r=i.changedTouches[0];o={target:i.target,clientX:r.clientX,clientY:r.clientY,path:i.path}}for(var s,l=i.path||t.targetFinding.path(o),a=0;an&&(i=e[n]);n++)this.addEvent(t,i)},unlisten:function(t,e){for(var i,n=0,o=e.length;o>n&&(i=e[n]);n++)this.removeEvent(t,i)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){var i=r.makePointerEvent(t,e);return i.preventDefault=e.preventDefault,i.tapPrevented=e.tapPrevented,i._target=i._target||e.target,i},fireEvent:function(t,e){var i=this.makeEvent(t,e);return this.dispatchEvent(i)},cloneEvent:function(t){for(var e,r=Object.create(null),s=0;s0&&t._pgListeners--,0===t._pgListeners&&s.unregister(t),t._pgEvents&&(t._pgEvents[i]>0?t._pgEvents[i]--:t._pgEvents[i]=0)),Boolean(n)},t.removeEventListener=function(e,i,n,o){n&&(t.deactivateGesture(e,i),e.removeEventListener(i,n,o))}}(i),function(t){var e=t.dispatcher,i=e.pointermap,n=25,o=[0,1,4,2],r=0,s=/Linux.*Firefox\//i,l=function(){if(s.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}(),a={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(t){e.listen(t,this.events)},unregister:function(t){t.nodeType!==Node.DOCUMENT_NODE&&e.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,i=this.lastTouches,o=t.clientX,r=t.clientY,s=0,l=i.length;l>s&&(e=i[s]);s++){var a=Math.abs(o-e.x),u=Math.abs(r-e.y);if(n>=a&&n>=u)return!0}},prepareEvent:function(t){var i=e.cloneEvent(t);if(i.pointerId=this.POINTER_ID,i.isPrimary=!0,i.pointerType=this.POINTER_TYPE,i._source="mouse",!l){var n=t.type,s=o[t.which]||0;"mousedown"===n?r|=s:"mouseup"===n&&(r&=~s),i.buttons=r}return i},mousedown:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=(i.has(this.POINTER_ID),this.prepareEvent(n));o.target=t.findTarget(n),i.set(this.POINTER_ID,o.target),e.down(o)}},mousemove:function(t){if(!this.isEventSimulatedFromTouch(t)){var n=i.get(this.POINTER_ID);if(n){var o=this.prepareEvent(t);o.target=n,0===(l?o.buttons:o.which)?(l||(r=o.buttons=0),e.cancel(o),this.cleanupMouse(o.buttons)):e.move(o)}}},mouseup:function(n){if(!this.isEventSimulatedFromTouch(n)){var o=this.prepareEvent(n);o.relatedTarget=t.findTarget(n),o.target=i.get(this.POINTER_ID),e.up(o),this.cleanupMouse(o.buttons)}},cleanupMouse:function(t){0===t&&i["delete"](this.POINTER_ID)}};t.mouseEvents=a}(i),function(t){var e=t.dispatcher,i=(t.targetFinding.allShadows.bind(t.targetFinding),e.pointermap),n=(Array.prototype.map.call.bind(Array.prototype.map),2500),o=25,r=200,s=20,l=!1,a={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(t,i){(this.IS_IOS?i:!i)&&e.listen(t,this.events)},unregister:function(t){this.IS_IOS||e.unlisten(t,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(t){var e=t,i=this.scrollTypes;return e===i.EMITTER?"none":e===i.XSCROLLER?"X":e===i.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===i.pointers()||1===i.pointers()&&i.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.firstTarget=t.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,r)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){var e=0;return("touchstart"===t||"touchmove"===t)&&(e=1),e},findTarget:function(e,n){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(e)){var o={clientX:e.clientX,clientY:e.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return t.findTarget(o)}return t.findTarget(e)}return i.get(n)},touchToPointer:function(t){var i=this.currentTouchEvent,n=e.cloneEvent(t),o=n.pointerId=t.identifier+2;n.target=this.findTarget(t,o),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.buttons=this.typeToButtons(i.type),n.width=t.webkitRadiusX||t.radiusX||0,n.height=t.webkitRadiusY||t.radiusY||0,n.pressure=t.webkitForce||t.force||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,n._source="touch";var r=this;return n.preventDefault=function(){r.scrolling=!1,r.firstXY=null,i.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var o,r,s=0;s=u}return i}},findTouch:function(t,e){for(var i,n=0,o=t.length;o>n&&(i=t[n]);n++)if(i.identifier===e)return!0},vacuumTouches:function(t){var e=t.touches;if(i.pointers()>=e.length){var n=[];i.forEach(function(t,i){if(1!==i&&!this.findTouch(e,i-2)){var o=t;n.push(o)}},this),n.forEach(function(t){this.cancel(t),i["delete"](t.pointerId)},this)}},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.down))},down:function(t){e.down(t)},touchmove:function(t){if(l)t.cancelable&&this.processTouches(t,this.move);else if(this.scrolling){if(this.firstXY){var e=t.changedTouches[0],i=e.clientX-this.firstXY.X,n=e.clientY-this.firstXY.Y,o=Math.sqrt(i*i+n*n);o>=s&&(this.touchcancel(t),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(t)?this.scrolling=!0:(this.scrolling=!1,t.preventDefault(),this.processTouches(t,this.move))},move:function(t){e.move(t)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.up)},up:function(i){i.relatedTarget=t.findTarget(i),e.up(i)},cancel:function(t){e.cancel(t)},touchcancel:function(t){t._cancel=!0,this.processTouches(t,this.cancel)},cleanUpPointer:function(t){i["delete"](t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(e){var i=t.mouseEvents.lastTouches,o=e.changedTouches[0];if(this.isPrimaryTouch(o)){var r={x:o.clientX,y:o.clientY};i.push(r);var s=function(t,e){var i=t.indexOf(e);i>-1&&t.splice(i,1)}.bind(null,i,r);setTimeout(s,n)}}},u=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(e){var i=e.clientX,n=e.clientY,r=function(t){var e=Math.abs(i-t.x),r=Math.abs(n-t.y);return o>=e&&o>=r},s=t.mouseEvents.lastTouches.some(r),l=t.targetFinding.path(e);if(s){for(var c=0;c0?1:-1},calcPositionDelta:function(t,e){var i=0,n=0;return t&&e&&(i=e.pageX-t.pageX,n=e.pageY-t.pageY),{x:i,y:n}},fireTrack:function(t,e,n){var o=n,r=this.calcPositionDelta(o.downEvent,e),s=this.calcPositionDelta(o.lastMoveEvent,e);if(s.x)o.xDirection=this.clampDir(s.x);else if("trackx"===t)return;if(s.y)o.yDirection=this.clampDir(s.y);else if("tracky"===t)return;var l={bubbles:!0,cancelable:!0,trackInfo:o.trackInfo,relatedTarget:e.relatedTarget,pointerType:e.pointerType,pointerId:e.pointerId,_source:"track"};"tracky"!==t&&(l.x=e.x,l.dx=r.x,l.ddx=s.x,l.clientX=e.clientX,l.pageX=e.pageX,l.screenX=e.screenX,l.xDirection=o.xDirection),"trackx"!==t&&(l.dy=r.y,l.ddy=s.y,l.y=e.y,l.clientY=e.clientY,l.pageY=e.pageY,l.screenY=e.screenY,l.yDirection=o.yDirection);var a=i.makeGestureEvent(t,l);o.downTarget.dispatchEvent(a)},down:function(t){if(t.isPrimary&&("mouse"===t.pointerType?1===t.buttons:!0)){var e={downEvent:t,downTarget:t.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};n.set(t.pointerId,e)}},move:function(t){var e=n.get(t.pointerId);if(e){if(!e.tracking){var i=this.calcPositionDelta(e.downEvent,t),o=i.x*i.x+i.y*i.y;o>this.WIGGLE_THRESHOLD&&(e.tracking=!0,e.lastMoveEvent=e.downEvent,this.fireTrack("trackstart",t,e))}e.tracking&&(this.fireTrack("track",t,e),this.fireTrack("trackx",t,e),this.fireTrack("tracky",t,e)),e.lastMoveEvent=t}},up:function(t){var e=n.get(t.pointerId);e&&(e.tracking&&this.fireTrack("trackend",t,e),n["delete"](t.pointerId))}};e.registerGesture("track",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var t=Date.now()-this.heldPointer.timeStamp,e=this.held?"holdpulse":"hold";this.fireHold(e,t),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(t){t.isPrimary&&!this.heldPointer&&(this.heldPointer=t,this.target=t.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(t){this.heldPointer&&this.heldPointer.pointerId===t.pointerId&&this.cancel()},move:function(t){if(this.heldPointer&&this.heldPointer.pointerId===t.pointerId){var e=t.clientX-this.heldPointer.clientX,i=t.clientY-this.heldPointer.clientY;e*e+i*i>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(t,e){var n={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};e&&(n.holdTime=e);var o=i.makeGestureEvent(t,n);this.target.dispatchEvent(o)}};e.registerGesture("hold",n)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o={events:["down","up"],exposes:["tap"],down:function(t){t.isPrimary&&!t.tapPrevented&&n.set(t.pointerId,{target:t.target,buttons:t.buttons,x:t.clientX,y:t.clientY})},shouldTap:function(t,e){var i=!0;return"mouse"===t.pointerType&&(i=1^t.buttons&&1&e.buttons),i&&!t.tapPrevented},up:function(e){var o=n.get(e.pointerId);if(o&&this.shouldTap(e,o)){var r=t.targetFinding.LCA(o.target,e.relatedTarget);if(r){var s=i.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:e.clientX,y:e.clientY,detail:e.detail,pointerType:e.pointerType,pointerId:e.pointerId,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,_source:"tap"});r.dispatchEvent(s)}}n["delete"](e.pointerId)}};i.preventTap=function(t){return function(){t.tapPrevented=!0,n["delete"](t.pointerId)}},e.registerGesture("tap",o)}(i),function(t){var e=t.dispatcher,i=t.eventFactory,n=new t.PointerMap,o=180/Math.PI,r={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(e){if(n.set(e.pointerId,e),2==n.pointers()){var i=this.calcChord(),o=this.calcAngle(i);this.reference={angle:o,diameter:i.diameter,target:t.targetFinding.LCA(i.a.target,i.b.target)},this.firePinch("pinchstart",i.diameter,i)}},up:function(t){var e=n.get(t.pointerId),i=n.pointers();if(e){if(2===i){var o=this.calcChord();this.firePinch("pinchend",o.diameter,o)}n["delete"](t.pointerId)}},move:function(t){n.has(t.pointerId)&&(n.set(t.pointerId,t),n.pointers()>1&&this.calcPinchRotate())},cancel:function(t){this.up(t)},firePinch:function(t,e,n){var o=e/this.reference.diameter,r=i.makeGestureEvent(t,{bubbles:!0,cancelable:!0,scale:o,centerX:n.center.x,centerY:n.center.y,_source:"pinch"});this.reference.target.dispatchEvent(r)},fireRotate:function(t,e){var n=Math.round((t-this.reference.angle)%360),o=i.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:n,centerX:e.center.x,centerY:e.center.y,_source:"pinch"});this.reference.target.dispatchEvent(o)},calcPinchRotate:function(){var t=this.calcChord(),e=t.diameter,i=this.calcAngle(t);e!=this.reference.diameter&&this.firePinch("pinch",e,t),i!=this.reference.angle&&this.fireRotate(i,t)},calcChord:function(){var t=[];n.forEach(function(e){t.push(e)});for(var e,i,o,r=0,s={a:t[0],b:t[1]},l=0;lr&&(r=o,s={a:a,b:c})}return e=Math.abs(s.a.clientX+s.b.clientX)/2,i=Math.abs(s.a.clientY+s.b.clientY)/2,s.center={x:e,y:i},s.diameter=r,s},calcAngle:function(t){var e=t.a.clientX-t.b.clientX,i=t.a.clientY-t.b.clientY;return(360+Math.atan2(i,e)*o)%360}};e.registerGesture("pinch",r)}(i)},{}],9:[function(t,e,i){"use strict";e.exports={JSDataSource:t("./js/DataSource"),DataSourceSorter:t("./js/DataSourceSorter"),DataSourceSorterComposite:t("./js/DataSourceSorterComposite"),DataSourceFilter:t("./js/DataSourceFilter"),DataSourceGlobalFilter:t("./js/DataSourceGlobalFilter"),DataSourceAggregator:t("./js/DataSourceAggregator"),util:{aggregations:t("./js/util/aggregations"),Mappy:t("./js/util/Mappy"),stableSort:t("./js/util/stableSort")}}},{"./js/DataSource":14,"./js/DataSourceAggregator":15,"./js/DataSourceFilter":16,"./js/DataSourceGlobalFilter":17,"./js/DataSourceSorter":19,"./js/DataSourceSorterComposite":20,"./js/util/Mappy":21,"./js/util/aggregations":22,"./js/util/stableSort":24}],10:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataNodeBase",{isNullObject:!1,INDENT:" ",initialize:function(t){this.label=t,this.data=[""],this.index=[],this.hasChildren=!1,this.depth=0,this.height=1,this.expanded=!1},getValue:function(t){return this.data[t]},toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+" "+this.label},computeHeight:function(){return 1},getIndex:function(){return this.index},computeAggregates:function(t){var e=this.getIndex();if(e.length){var i=Number(t.hasGroups()),n=this.data;n.length=i+t.aggregates.length;var o=t.sorterInstance;o.index=e,t.aggregates.forEach(function(t,e){n[i+e]=t(o)})}},buildView:function(t){t.addView(this)},toggleExpansionState:function(){}});e.exports=o},{"extend-me":3}],11:[function(t,e,i){"use strict";function n(t){return this.splice.bind(this,this.length,0).apply(this,t),this}var o=t("./util/Mappy"),r=t("./DataNodeBase"),s={"true":"▼","false":"▶"},l=r.extend("DataNodeGroup",{extendable:!0,initialize:function(t){this.children=new o},toArray:function(t){this.depth=t,this.children=this.children.values,this.children.forEach(function(e){e.toArray(t+1)}),this.data[0]=this.computeDepthString()},computeDepthString:function(){return Array(this.depth+1).join(this.INDENT)+s[this.expanded]+" "+this.label},getIndex:function(){return 0===this.index.length&&(this.index=this.computeIndex()),this.index},computeIndex:function(){var t=[];return t.append=n,this.children.forEach(function(e){t.append(e.getIndex())}),t},toggleExpansionState:function(t){this.expanded=!this.expanded,this.data[0]=this.computeDepthString(),this.expanded&&this.computeAggregates(t)},computeAggregates:function(t){r.prototype.computeAggregates.call(this,t),this.expanded&&this.children.forEach(function(e){e.computeAggregates(t)})},buildView:function(t){t.view.push(this),this.expanded&&this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.expanded&&this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=l},{"./DataNodeBase":10,"./util/Mappy":21}],12:[function(t,e,i){"use strict";var n=t("./DataNodeBase"),o=n.extend("DataNodeLeaf",{toArray:function(t){this.depth=t,this.data[0]=this.computeDepthString()},getIndex:function(){return this.index},buildView:function(t){t.addView(this)},computeHeight:function(){return 1}});e.exports=o},{"./DataNodeBase":10}],13:[function(t,e,i){"use strict";var n=t("./DataNodeGroup"),o=n.extend("DataNodeTree",{initialize:function(t){this.height=0,this.expanded=!0},toArray:function(){this.children=this.children.values,this.children.forEach(function(t){t.toArray(0)})},buildView:function(t){this.children.forEach(function(e){e.buildView(t)})},computeHeight:function(){var t=1;return this.children.forEach(function(e){t+=e.computeHeight()}),this.height=t}});e.exports=o},{"./DataNodeGroup":11}],14:[function(t,e,i){"use strict";function n(t,e){this.fields=e||r(t[0]),this.data=t}function o(t,e){throw new Error("DataSource."+t+": "+e)}function r(t){return Object.getOwnPropertyNames(t||[]).filter(function(t){return"__"!==t.substr(0,2)})}var s=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,getRow:function(t){return this.data[t]},getValue:function(t,e){var i=this.getRow(e);return i?i[this.fields[t]]:null},setValue:function(t,e,i){this.getRow(e)[this.fields[t]]=i},getRowCount:function(){return this.data.length},getColumnCount:function(){return this.getFields().length},getFields:function(){return this.fields},getHeaders:function(){return this.headers=this.headers||this.getDefaultHeaders().map(function(t){return s(t)})},getDefaultHeaders:function(){return this.getFields()},setFields:function(t){this.fields=t},setHeaders:function(t){t instanceof Array||o("setHeaders","param #1 `headers` not array"),this.headers=t},getGrandTotals:function(){},setData:function(t){this.data=t}},e.exports=n},{"./util/headerify":23}],15:[function(t,e,i){"use strict";function n(t){this.dataSource=t,this.tree=new l("Totals"),this.index=[],this.aggregates=[],this.headers=[],this.groupBys=[],this.view=[],this.sorterInstance={},this.presortGroups=!0,this.lastAggregate={},this.setAggregates({})}function o(t){return new u(t)}function r(t){return new a(t)}var s=t("./DataSourceSorter"),l=t("./DataNodeTree"),a=t("./DataNodeGroup"),u=t("./DataNodeLeaf"),c=t("./util/headerify");n.prototype={constructor:n.prototype.constructor,isNullObject:!1,setAggregates:function(t){this.lastAggregate=t,this.clearAggregations(),this.headers.length=0,this.hasGroups()&&this.headers.push("Tree");for(var e in t)this.addAggregate(e,t[e])},addAggregate:function(t,e){this.headers.push(c(t)),this.aggregates.push(e)},setGroupBys:function(t){var e=this.groupBys;e.length=0,t.forEach(function(t){e.push(t)}),this.setAggregates(this.lastAggregate)},addGroupBy:function(t){this.groupBys.push(t)},hasGroups:function(){return!!this.groupBys.length},hasAggregates:function(){return!!this.aggregates.length},apply:function(){this.buildGroupTree()},clearGroups:function(){this.groupBys.length=0},clearAggregations:function(){this.aggregates.length=0,this.headers.length=0},buildGroupTree:function(){var t=this.groupBys,e=t.length-1,i=this.dataSource,n=i.getRowCount(),a=this.tree=new l("Totals");this.presortGroups&&t.reverse().forEach(function(t){i=new s(i),i.sortOn(t)});for(var u=0;n>u;u++){var c=a;t.forEach(function(t,n){var s=i.getValue(t,u),l=n===e?o:r;c=c.children.getIfUndefined(s,l)}),c.index.push(u)}this.sorterInstance=new s(i),a.toArray(),a.computeAggregates(this),this.buildView()},addView:function(t){this.view.push(t)},buildView:function(){this.view.length=0,this.tree.computeHeight(),this.tree.buildView(this)},viewMakesSense:function(){return this.hasAggregates()},getValue:function(t,e){if(!this.viewMakesSense())return this.dataSource.getValue(t,e);var i=this.view[e];return i?i.getValue(t):null},setValue:function(t,e,i){return this.viewMakesSense()?void 0:this.dataSource.setValue(t,e,i)},getColumnCount:function(){return this.viewMakesSense()?this.getHeaders().length:this.dataSource.getColumnCount()},getRowCount:function(){return this.viewMakesSense()?this.view.length:this.dataSource.getRowCount()},click:function(t){var e=this.view[t];e.toggleExpansionState(this),this.buildView()},getHeaders:function(){return this.viewMakesSense()?this.headers:this.dataSource.getHeaders()},setHeaders:function(t){this.dataSource.setHeaders(t)},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},getGrandTotals:function(){var t=this.tree;return[t.data]},getRow:function(t){if(!this.viewMakesSense())return this.dataSource.getRow(t);var e=this.view[t];return e?e:this.tree},setData:function(t){this.dataSource.setData(t),this.apply()}},e.exports=n},{"./DataNodeGroup":11,"./DataNodeLeaf":12,"./DataNodeTree":13,"./DataSourceSorter":19,"./util/headerify":23}],16:[function(t,e,i){"use strict";function n(t,e){for(var i=this.filters.length;i--;)if(!this.filters[i](this.dataSource.getValue(this.filters[i].columnIndex,t),e,t))return!1;return!0}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceFilter",{initialize:function(){this.filters=[]},add:function(t,e){e.columnIndex=t,this.filters.push(e)},clearAll:function(){this.filters.length=0,this.clearIndex()},applyAll:function(){this.filters.length?this.buildIndex(n):this.clearIndex()},getRowCount:function(){return this.filters.length?this.index.length:this.dataSource.getRowCount()},aliases:{set:"add"}});e.exports=r},{"./DataSourceIndexed":18}],17:[function(t,e,i){"use strict";function n(t,e){for(var i=this.visibleColumnMap,n=i.length;n--;)if(this.filter(this.dataSource.getValue(i[n],t),e,t))return!0;return!1}var o=t("./DataSourceIndexed"),r=o.extend("DataSourceGlobalFilter",{set:function(t){this.filter=t},clear:function(){delete this.filter,this.clearIndex()},apply:function(t){if(this.filter){var e=this.visibleColumnMap=[];t.forEach(function(t){e.push(t.index)}),this.buildIndex(n)}else this.clearIndex()},getRowCount:function(){return this.filter?this.index.length:this.dataSource.getRowCount()}});e.exports=r},{"./DataSourceIndexed":18}],18:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("DataSourceIndexed",{isNullObject:!1,initialize:function(t){this.dataSource=t,this.index=[]},transposeY:function(t){return this.index.length?this.index[t]:t},getRow:function(t){return this.dataSource.getRow(this.transposeY(t))},getValue:function(t,e){return this.dataSource.getValue(t,this.transposeY(e))},setValue:function(t,e,i){this.dataSource.setValue(t,this.transposeY(e),i)},getRowCount:function(){return this.index.length||this.dataSource.getRowCount()},getColumnCount:function(){return this.dataSource.getColumnCount()},getFields:function(){return this.dataSource.getFields()},setFields:function(t){return this.dataSource.setFields(t)},setHeaders:function(t){return this.dataSource.setHeaders(t)},getHeaders:function(){return this.dataSource.getHeaders()},getGrandTotals:function(){return this.dataSource.getGrandTotals()},setData:function(t){return this.dataSource.setData(t)},clearIndex:function(){this.index.length=0},buildIndex:function(t){var e=this.dataSource.getRowCount(),i=this.index;this.clearIndex();for(var n=0;e>n;n++)(!t||t.call(this,n,this.dataSource.getRow(n)))&&i.push(n);return i}});e.exports=o},{"extend-me":3}],19:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}var o=t("./DataSourceIndexed"),r=t("./util/stableSort"),s=o.extend("DataSourceSorter",{initialize:function(){this.descendingSort=!1},sortOn:function(t,e){function i(e){return n(o.dataSource.getValue(t,e))}switch(e){case 0:this.clearIndex();break;case void 0:case 1:case-1:var o=this;r.sort(this.buildIndex(),i,e)}}});e.exports=s},{"./DataSourceIndexed":18,"./util/stableSort":24}],20:[function(t,e,i){"use strict";var n=t("./DataSourceIndexed"),o=t("./DataSourceSorter"),r=n.extend("DataSourceSorterComposite",{initialize:function(){this.sorts=[],this.last=this.dataSource},getRow:function(t){return this.last.getRow(t)},sortOn:function(t,e){this.sorts.push([t,e])},applySorts:function(){var t=this.dataSource;this.sorts.forEach(function(e){t=new o(t),t.sortOn.apply(t,e)}),this.last=t},clearSorts:function(){this.sorts.length=0,this.last=this.dataSource},getValue:function(t,e){return this.last.getValue(t,e)},setValue:function(t,e,i){this.last.setValue(t,e,i)}});e.exports=r},{"./DataSourceIndexed":18,"./DataSourceSorter":19}],21:[function(t,e,i){"use strict";function n(){this.keys=[],this.data={},this.values=[]}function o(t){var e=typeof t;switch(e){case"number":case"string":case"boolean":case"symbol":return l+e+"_"+t;case"undefined":return"UNDEFINED";case"object":if(null===t)return"NULL";case"function":return t.___finhash=t.___finhash||l+a++}}function r(t){return t}function s(t,e){if(e!=e||0===e)for(var i=t.length;i--&&!u(t[i],e););else i=[].indexOf.call(t,e);return i}n.prototype={constructor:n.prototype.constructor,set:function(t,e){var i=o(t);i in this.data||(this.keys.push(t),this.values.push(e)),this.data[i]=e},get:function(t){var e=o(t);return this.data[e]},getIfUndefined:function(t,e){var i=this.get(t);return void 0===i&&(i=e(t),this.set(t,i)),i},size:function(){return this.keys.length},clear:function(){this.keys.length=0,this.values.length=0,this.data={}},"delete":function(t){var e=o(t);if(void 0!==this.data[e]){var i=s(this.keys,t);this.keys.splice(i,1),this.values.splice(i,1),delete this.data[e]}},forEach:function(t){if("function"==typeof t){var e=this.keys,i=this;e.forEach(function(e){var n=i.get(e);t(n,e,i)})}},map:function(t){var e=this.keys,i=new n,o=this;return"function"!=typeof t&&(t=r),e.forEach(function(e){var n=o.get(e),r=t(n,e,o);i.set(e,r)}),i},copy:function(){var t=this.keys,e=new n,i=this;return t.forEach(function(t){var n=i.get(t);e.set(t,n)}),e}};var l=".~.#%_",a=0,u=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};e.exports=n},{}],22:[function(t,e,i){"use strict";function n(t){return t.getRowCount()}function o(t,e){for(var i=e.getRowCount(),n=0;i--;)n+=e.getValue(t,i);return n}function r(t,e,i,n){for(var o=n.getRowCount();o--;)i=e(i,n.getValue(t,o));return i}function s(t,e){return o(t,e)/e.getRowCount()}function l(t,e){return e.getValue(t,0)}function a(t,e){return e.getValue(t,e.getRowCount()-1)}function u(t,e){for(var i,n=e.getRowCount(),o=s(t,e),r=n,l=0;r--;l+=i*i)i=e.getValue(t,r)-o;return Math.sqrt(l/n)}e.exports={count:function(t){return n},sum:function(t){return o.bind(this,t)},min:function(t){return r.bind(this,t,Math.min,1/0)},max:function(t){return r.bind(this,t,Math.max,-(1/0))},avg:function(t){return s.bind(this,t)},first:function(t){return l.bind(this,t)},last:function(t){return a.bind(this,t)},stddev:function(t){return u.bind(this,t)}}},{}],23:[function(t,e,i){"use strict";function n(t){return(/[a-z]/.test(t)?t:t.toLowerCase()).replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g,o).replace(/[A-Z]/g," $&").trim()}function o(t,e,i){return e.toUpperCase()+i}e.exports=n},{}],24:[function(t,e,i){"use strict";function n(t,e,i,n){var o=i[0],r=n[0];if(o===r)o=e?n[1]:i[1],r=e?i[1]:n[1];else{if(null===r)return-1;if(null===o)return 1}return t(o,r)}function o(t,e){return t-e}function r(t,e){return e-t}function s(t,e){return e>t?-1:1}function l(t,e){return t>e?-1:1}function a(t){return n.bind(this,"number"===t?o:s,!1)}function u(t){return n.bind(this,"number"===t?r:l,!0)}function c(t,e,i){var n,o;if(void 0===i&&(i=1),t.length){switch(i){case 0:return;case void 0:i=1;case 1:n=a(typeof e(0));break;case-1:n=u(typeof e(0))}var r=new Array(t.length);for(o=0;op&&t>=0||0===p&&0!==t||p>0&&0>=t;p=t>0?Math.min(50,t):Math.max(-50,t),n&&(clearInterval(f),f=setInterval(function(t){var e=i.scrollTop+p;0>p&&t>e||p>0&&e>t?(i.scrollTop=t,clearInterval(f)):i.scrollTop=e},125))}else clearInterval(f),p=0}function r(t){return Array.prototype.slice.call(t)}function s(t,e){return e.top<=t.y&&t.y<=e.bottom&&e.left<=t.x&&t.x<=e.right}function l(t,e){return"translate("+Math.floor(t+window.scrollX)+"px,"+Math.floor(e+window.scrollY)+"px)"}function a(t){var e=document.createTextNode(t);return document.createElement("a").appendChild(e).parentNode.innerHTML}function u(t,e){var i=e.label||"{label}";return t.forEach(function(n,o){var r=n.label||i,s=void 0!==n.htmlEncode&&n.htmlEncode||e.htmlEncode,l=document.createElement("div"),u=document.createElement("ul");if(n.models)Object.keys(n).forEach(function(t){"models"!==t&&(n.models[t]=n[t])}),t[o]=n=n.models;else{if(!(n instanceof Array))throw d("List [{1}] not an array of models (with or without additional properties) OR an object (with a `models` property containing an array of models).",o);n.models=n}n.forEach(function(t){var i=t.label||r,o=void 0!==t.htmlEncode&&t.htmlEncode||s,l="object"==typeof t?t:{label:t},c=A.call([l,n,e],i),h=document.createElement("li");h.innerHTML=o?a(c):c,u.appendChild(h)});var c=document.createElement("li");if(c.innerHTML=" ",u.appendChild(c),n.title){var h=document.createElement("div");h.innerHTML=s?a(n.title):n.title,l.appendChild(h)}l.appendChild(u),l.className=n.cssClassNames||e.cssClassNames||"dragon-list",n.element=u,n.container=l}),t}function c(t){var e=[];return t.forEach(function(t){var i=t.parentElement,n=i.parentElement,o=[];e.find(function(t){return t.element===i})||(r(i.querySelectorAll("li")).forEach(function(t){t!==i.lastElementChild&&o.push(t.innerHTML)}),o.element=i,o.container=n,e.push(o))}),e}function h(t){t.stopPropagation()}function d(){return"list-dragon: "+A.apply(this,Array.prototype.slice.call(arguments))}var g,f,p,v,m=t("css-injector"),A=t("templex"),C=null;v="div.dragon-list{position:relative;background-color:#fff}div.dragon-list>div,div.dragon-list>ul{position:absolute;left:0;right:0}div.dragon-list>div{text-align:center;background-color:#00796b;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);overflow:hidden;white-space:nowrap}div.dragon-list>ul{overflow-y:auto;bottom:0;margin:0;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}div.dragon-list>ul>li,li.dragon-pop{white-space:nowrap;list-style-type:none;border:0 solid #f4f4f4;border-bottom:1px solid #e0e0e0;cursor:move;transition:border-top-width .2s}div.dragon-list>ul>li:last-child{height:0;border-bottom:none}li.dragon-pop{position:fixed;background-color:#fff;border:1px solid #e0e0e0;left:0;top:0;overflow-x:hidden;box-shadow:rgba(0,0,0,.188235) 0 10px 20px,rgba(0,0,0,.227451) 0 6px 6px}",n.prototype={addEvt:function(t,e,i,n){var o={handler:w[e].bind(t,this),element:i||window};return n||(this.bindings[e]=o),o.element.addEventListener(e,o.handler),o},removeEvt:function(t){var e=this.bindings[t];delete this.bindings[t],e.element.removeEventListener(t,e.handler)},removeAllEventListeners:function(){for(var t in this.bindings){var e=this.bindings[t];e.element.removeEventListener(t,e.handler)}this.items.forEach(function(t){t.handler&&t.element.removeEventListener("mousedown",t.handler)}),this.modelLists.forEach(function(t){t.element.removeEventListener("wheel",h)})},pointInListRects:function(t){return this.modelLists.find(function(e){var i=e.element.getBoundingClientRect();return i={left:window.scrollX+i.left,top:window.scrollY+i.top,right:window.scrollX+i.right,bottom:window.scrollY+i.bottom,width:i.width,height:i.height},e.rect=i,s(t,i)?(e.rect=i,!0):!1})},pointInItemRects:function(t,e,i){return this.items.find(function(n){var o=n.element;return o!==e&&o!==i&&s(t,n.rect)})},getAllItemBoundingRects:function(){var t,e=this.modelLists;this.items.forEach(function(i){var n=i.element,o=n.parentElement,r=e.find(function(t){return t.element===o});if(void 0===r.isDropTarget||"function"==typeof r.isDropTarget&&r.isDropTarget()||r.isDropTarget){var s=n.getBoundingClientRect(),l=s.bottom;n===o.lastElementChild?(l=o.getBoundingClientRect().bottom,l0&&(i.element.scrollTop>0&&(s=u-(i.rect.top+5))<0?o(s,0,i.element):i.element.scrollTop0?o(s,a,i.element):o());var c=t.pointInItemRects({x:e.clientX,y:t.rect.bottom+window.scrollY+r+i.element.scrollTop},this,t.drop);if(this.style[g]=l(t.rect.left-window.scrollX+n,t.rect.top-window.scrollY+r),c){var h=c.element;h.style.transition=C,h.style.borderTopWidth=t.drop.style.borderTopWidth,t.drop.style.borderTopWidth=null,t.drop=h}}},mouseup:function(t,e){o(),t.removeEvt("mousemove"),t.removeEvt("mouseup"),e.stopPropagation();var i=this.getBoundingClientRect();if(window.scrollX+i.left===t.rect.left&&window.scrollY+i.top===t.rect.top)t.reinsert(this);else{var n=t.drop.getBoundingClientRect();t.addEvt(this,"transitionend",this),this.style.transitionDuration=C,this.style.transitionProperty=g,this.style[g]=l(n.left-window.scrollX,n.top-window.scrollY)}},transitionend:function(t,e){if(e.propertyName===g){t.removeEvt("transitionend"),t.reinsert(this),this.style.transitionProperty=C;var i=t.modelLists[t.origin.list].splice(t.origin.item,1)[0],n=t.itemCoordinates(this);t.modelLists[n.list].splice(n.item,0,i),t.callback.dropped&&t.callback.dropped.call(this,t)}}};e.exports=n},{"css-injector":2,templex:31}],26:[function(t,e,i){!function(){function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i(){return 1}function n(t){d||"string"==typeof t||"number"==typeof t||(d=!0,console.error(new TypeError("LRU: key must be a string or number. Almost certainly a bug! "+typeof t).stack))}function o(t){return this instanceof o?("number"==typeof t&&(t={max:t}),t||(t={}),this._max=t.max,(!this._max||"number"!=typeof this._max||this._max<=0)&&(this._max=1/0),this._lengthCalculator=t.length||i,"function"!=typeof this._lengthCalculator&&(this._lengthCalculator=i),this._allowStale=t.stale||!1,this._maxAge=t.maxAge||null,this._dispose=t.dispose,void this.reset()):new o(t)}function r(t,e,i){n(e);var o=t._cache[e];return o&&(s(t,o)?(c(t,o),t._allowStale||(o=void 0)):i&&l(t,o),o&&(o=o.value)),o}function s(t,e){if(!e||!e.maxAge&&!t._maxAge)return!1;var i=!1,n=Date.now()-e.now;return i=e.maxAge?n>e.maxAge:t._maxAge&&n>t._maxAge}function l(t,e){u(t,e),e.lu=t._mru++,t._lruList[e.lu]=e}function a(t){for(;t._lrut._max;)c(t,t._lruList[t._lru])}function u(t,e){for(delete t._lruList[e.lu];t._lru=t)&&(t=1/0),this._max=t,this._length>this._max&&a(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i,this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t,this._length=0;for(var e in this._cache)this._cache[e].length=this._lengthCalculator(this._cache[e].value),this._length+=this._cache[e].length}this._length>this._max&&a(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),o.prototype.forEach=function(t,e){e=e||this;for(var i=0,n=this._itemCount,o=this._mru-1;o>=0&&n>i;o--)if(this._lruList[o]){i++;var r=this._lruList[o];s(this,r)&&(c(this,r),this._allowStale||(r=void 0)),r&&t.call(e,r.value,r.key,this)}},o.prototype.keys=function(){for(var t=new Array(this._itemCount),e=0,i=this._mru-1;i>=0&&e=0&&e=0&&ethis._max?(c(this,this._cache[e]),!1):(this._dispose&&this._dispose(e,this._cache[e].value),this._cache[e].now=r,this._cache[e].maxAge=o,this._cache[e].value=i,this._length+=s-this._cache[e].length,this._cache[e].length=s,this.get(e),this._length>this._max&&a(this),!0);var l=new h(e,i,this._mru++,s,r,o);return l.length>this._max?(this._dispose&&this._dispose(e,i),!1):(this._length+=l.length,this._lruList[l.lu]=this._cache[e]=l,this._itemCount++,this._length>this._max&&a(this),!0)},o.prototype.has=function(e){if(n(e),!t(this._cache,e))return!1;var i=this._cache[e];return s(this,i)?!1:!0},o.prototype.get=function(t){return n(t),r(this,t,!0)},o.prototype.peek=function(t){return n(t),r(this,t,!1)},o.prototype.pop=function(){var t=this._lruList[this._lru];return c(this,t),t||null},o.prototype.del=function(t){n(t),c(this,this._cache[t])},o.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var o=t[i];n(o.k);var r=o.e||0;if(0===r)this.set(o.k,o.v);else{var s=r-e;s>0&&this.set(o.k,o.v,s)}}}}()},{}],27:[function(t,e,i){!function(t,e){"object"==typeof i&&i&&"string"!=typeof i.nodeName?e(i):"function"==typeof define&&define.amd?define(["exports"],e):(t.Mustache={},e(t.Mustache))}(this,function(t){function e(t){return"function"==typeof t}function i(t){return p(t)?"array":typeof t}function n(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return v.call(t,e)}function s(t){return!r(m,t)}function l(t){return String(t).replace(/[&<>"'`=\/]/g,function(t){return A[t]})}function a(e,i){function o(){if(m&&!A)for(;v.length;)delete f[v.pop()];else v=[];m=!1,A=!1}function r(t){if("string"==typeof t&&(t=t.split(w,2)),!p(t)||2!==t.length)throw new Error("Invalid tags: "+t);l=new RegExp(n(t[0])+"\\s*"),a=new RegExp("\\s*"+n(t[1])),d=new RegExp("\\s*"+n("}"+t[1]))}if(!e)return[];var l,a,d,g=[],f=[],v=[],m=!1,A=!1;r(i||t.tags);for(var b,E,R,M,D,P,T=new h(e);!T.eos();){if(b=T.pos,R=T.scanUntil(l))for(var B=0,k=R.length;k>B;++B)M=R.charAt(B),s(M)?v.push(f.length):A=!0,f.push(["text",M,b,b+1]),b+=1,"\n"===M&&o();if(!T.scan(l))break;if(m=!0,E=T.scan(y)||"name",T.scan(C),"="===E?(R=T.scanUntil(S),T.scan(S),T.scanUntil(a)):"{"===E?(R=T.scanUntil(d),T.scan(x),T.scanUntil(a),E="&"):R=T.scanUntil(a),!T.scan(a))throw new Error("Unclosed tag at "+T.pos);if(D=[E,R,b,T.pos],f.push(D),"#"===E||"^"===E)g.push(D);else if("/"===E){if(P=g.pop(),!P)throw new Error('Unopened section "'+R+'" at '+b);if(P[1]!==R)throw new Error('Unclosed section "'+P[1]+'" at '+b)}else"name"===E||"{"===E||"&"===E?A=!0:"="===E&&r(R)}if(P=g.pop())throw new Error('Unclosed section "'+P[1]+'" at '+T.pos);return c(u(f))}function u(t){for(var e,i,n=[],o=0,r=t.length;r>o;++o)e=t[o],e&&("text"===e[0]&&i&&"text"===i[0]?(i[1]+=e[1],i[3]=e[3]):(n.push(e),i=e));return n}function c(t){for(var e,i,n=[],o=n,r=[],s=0,l=t.length;l>s;++s)switch(e=t[s],e[0]){case"#":case"^":o.push(e),r.push(e),o=e[4]=[];break;case"/":i=r.pop(),i[5]=e[2],o=r.length>0?r[r.length-1][4]:n;break;default:o.push(e)}return n}function h(t){this.string=t,this.tail=t,this.pos=0}function d(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function g(){this.cache={}}var f=Object.prototype.toString,p=Array.isArray||function(t){return"[object Array]"===f.call(t)},v=RegExp.prototype.test,m=/\S/,A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},C=/\s*/,w=/\s+/,S=/\s*=/,x=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;h.prototype.eos=function(){return""===this.tail},h.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},h.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},d.prototype.push=function(t){return new d(t,this)},d.prototype.lookup=function(t){var i,n=this.cache;if(n.hasOwnProperty(t))i=n[t];else{for(var r,s,l=this,a=!1;l;){if(t.indexOf(".")>0)for(i=l.view,r=t.split("."),s=0;null!=i&&sa;++a)s=void 0,o=t[a],r=o[0],"#"===r?s=this.renderSection(o,e,i,n):"^"===r?s=this.renderInverted(o,e,i,n):">"===r?s=this.renderPartial(o,e,i,n):"&"===r?s=this.unescapedValue(o,e):"name"===r?s=this.escapedValue(o,e):"text"===r&&(s=this.rawValue(o)),void 0!==s&&(l+=s);return l},g.prototype.renderSection=function(t,i,n,o){function r(t){return s.render(t,i,n)}var s=this,l="",a=i.lookup(t[1]);if(a){if(p(a))for(var u=0,c=a.length;c>u;++u)l+=this.renderTokens(t[4],i.push(a[u]),n,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)l+=this.renderTokens(t[4],i.push(a),n,o);else if(e(a)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");a=a.call(i.view,o.slice(t[3],t[5]),r),null!=a&&(l+=a)}else l+=this.renderTokens(t[4],i,n,o);return l}},g.prototype.renderInverted=function(t,e,i,n){var o=e.lookup(t[1]);return!o||p(o)&&0===o.length?this.renderTokens(t[4],e,i,n):void 0},g.prototype.renderPartial=function(t,i,n){if(n){var o=e(n)?n(t[1]):n[t[1]];return null!=o?this.renderTokens(this.parse(o),i,n,o):void 0}},g.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);return null!=i?i:void 0},g.prototype.escapedValue=function(e,i){var n=i.lookup(e[1]);return null!=n?t.escape(n):void 0},g.prototype.rawValue=function(t){return t[1]},t.name="mustache.js",t.version="2.2.1",t.tags=["{{","}}"];var b=new g;t.clearCache=function(){return b.clearCache()},t.parse=function(t,e){return b.parse(t,e)},t.render=function(t,e,n){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return b.render(t,e,n)},t.to_html=function(i,n,o,r){var s=t.render(i,n,o);return e(r)?void r(s):s},t.escape=l,t.Scanner=h,t.Context=d,t.Writer=g})},{}],28:[function(t,e,i){"use strict";function n(t){return t instanceof n?t:this instanceof n?(this.originalValue=t,void(this.o=t||{})):new n(t)}n.chain=function(t){var e=n(t);return e.chaining=!0,e},n.prototype={value:function(){return this.originalValue},each:function(t,e){var i=this.o;return Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)},e||i),this},find:function(t,e){var i,n=this.o;return n&&(i=Object.keys(n).find(function(e){return t.call(this,n[e],e,n)},e||n),void 0!==i&&(i=n[i])),i},filter:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){t.call(this,i[e],e,i)&&n.push(i[e])},e||i),n},map:function(t,e){var i=this.o,n=[];return i&&Object.keys(i).forEach(function(e){n.push(t.call(this,i[e],e,i))},e||i),n},reduce:function(t,e,i){var n=this.o;return n&&Object.keys(n).forEach(function(i,o){e=o||void 0!==e?t(e,n[i],i,n):n[i]},i||n),e},extend:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){if(t)for(var i in t)e[i]=t[i]}),this.chaining?this:e},extendOwn:function(t){var e=this.o;return Array.prototype.slice.call(arguments).forEach(function(t){n(t).each(function(t,i){e[i]=t})}),this.chaining?this:e}},Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e}),e.exports=n},{}],29:[function(t,e,i){"use strict";function n(t,e){Object.defineProperty(this,t,{value:e,writable:!1,enumerable:!0,configurable:!1})}function o(t,e){n.call(this,"x",Number(t)||0),n.call(this,"y",Number(e)||0)}function r(t,e,i,r){t=Number(t)||0,e=Number(e)||0,i=Number(i)||0,r=Number(r)||0,0>i&&(t+=i,i=-i),0>r&&(e+=r,r=-r),n.call(this,"origin",new o(t,e)),n.call(this,"extent",new o(i,r)),n.call(this,"corner",new o(t+i,e+r)),n.call(this,"center",new o(t+i/2,e+r/2))}o.prototype={plus:function(t){return new o(this.x+t.x,this.y+t.y)},plusXY:function(t,e){return new o(this.x+(t||0),this.y+(e||0))},minus:function(t){return new o(this.x-t.x,this.y-t.y)},min:function(t){return new o(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new o(Math.max(this.x,t.x),Math.max(this.y,t.y))},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){var e=!1;return t&&(e=this.x===t.x&&this.y===t.y),e},greaterThan:function(t){return this.x>t.x&&this.y>t.y},lessThan:function(t){return this.x=t.x&&this.y>=t.y},lessThanOrEqualTo:function(t){return this.x<=t.x&&this.y<=t.y},within:function(t){var e=t.origin.x,i=e+t.extent.x,n=t.origin.y,o=n+t.extent.y;return t.extent.x<0&&(e=i,i=t.origin.x),t.extent.y<0&&(n=o,o=t.origin.y),e<=this.x&&this.xi;i++)for(var o=this.origin.y,r=this.corner.y;r>o;o++)t.call(e,i,o)},intersect:function(t,e,i){var n=null,o=this.origin.max(t.origin),s=this.corner.min(t.corner),l=s.minus(o);return l.x>0&&l.y>0?n=new r(o.x,o.y,l.x,l.y):"function"==typeof e&&(n=e.call(i||this,t)),n},intersects:function(t){return t.corner.x>this.origin.x&&t.corner.y>this.origin.y&&t.origin.x=t?[t,e]:[e,t]}function n(t,e){return t[0]<=e[0]&&e[0]<=t[1]||t[0]<=e[1]&&e[1]<=t[1]||e[0]=o&&n>r?s.push([r+1,n]):o>i&&r>=n?s.push([i,o-1]):o>i&&n>r?(s.push([i,o-1]),s.push([r+1,n])):(i>r||o>n)&&s.push(t),s}function s(t,e){var i=Math.min(Math.min.apply(Math,t),Math.min.apply(Math,e)),n=Math.max(Math.max.apply(Math,t),Math.max.apply(Math,e));return[i,n]}e.prototype={select:function(t,e){this.storeState();var r=i(t,e),l=[0,1];return this.selection.forEach(function(t){n(t,r)||o(t,r)?r=s(t,r):l.push(t)}),l.push(r),l[1]=this.selection.length,this.selection.splice.apply(this.selection,l),this},deselect:function(t,e){var o=i(t,e),s=[0,0];return this.selection.forEach(function(t){if(n(t,o)){var e=r(t,o);s=s.concat(e)}else s.push(t)}),s[1]=this.selection.length,this.selection.splice.apply(this.selection,s),this},clear:function(){return this.states.length=0,this.selection.length=0,this},clearMostRecentSelection:function(){0!==this.states.length&&(this.selection=this.states.pop())},isSelected:function(t){return this.selection.some(function(e){return e[0]<=t&&t<=e[1]})},isEmpty:function(){return 0===this.selection.length},getSelections:function(){var t=[];return this.selection.forEach(function(e){for(var i=e[0];i<=e[1];i++)t.push(i)}),t.sort(function(t,e){return t-e}),t}},t.exports=e})("object"==typeof e&&e||(window.RangeSelectionModel={}),"object"==typeof e&&e.exports||(window.RangeSelectionModel.exports={}))||"object"==typeof e||(window.RangeSelectionModel=window.RangeSelectionModel.exports)},{}],31:[function(require,module,exports){function templex(t){var e=this instanceof Array?this:[this];return arguments.length>1&&e.unshift(arguments),t.replace(templex.regexp,templex.merger.bind(e))}templex.regexp=/\{(.*?)\}/g,templex["with"]=function(t,e){return"with(this["+t+"]){"+e+"}"},templex.cache=[],templex.deref=function(key){if(!(this.length in templex.cache)){for(var code="return eval(expr)",i=0;i1&&i.unshift(s.pop()),s=[s.join(" ")],i.length&&(s=s.concat(r(t,e,i,n))),s}function s(t,e,i,n){return r(t,e,l(i).split(" "),n)}function l(t){return t.toString().trim().replace(/\s\s+/g," ")}function a(t,e,i,n,o,r,s,l){l||(l=!0),r||(r=5),t.beginPath(),t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.quadraticCurveTo(e+n,i,e+n,i+r),t.lineTo(e+n,i+o-r),t.quadraticCurveTo(e+n,i+o,e+n-r,i+o),t.lineTo(e+r,i+o),t.quadraticCurveTo(e,i+o,e,i+o-r),t.lineTo(e,i+r),t.quadraticCurveTo(e,i,e+r,i),t.closePath(),l&&t.stroke(),s&&t.fill(),t.closePath()}var u=t("extend-me").Base,c=u.extend("CellProvider",{initialize:function(){this.cellCache={},this.initializeCells()},getCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getColumnHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},getRowHeaderCell:function(t){var e=this.cellCache.simpleCellRenderer;return e.config=t,e},paintButton:function(t,e){var i=e.value,n=e.x,o=e.y,r=e.bounds,s=r.x+2,l=r.y+2,u=r.width-3,c=r.height-3,h=c/2,d=t.createLinearGradient(s,l,s,l+c);e.mouseDown?(d.addColorStop(0,"#B5CBED"),d.addColorStop(1,"#4d74ea")):(d.addColorStop(0,"#ffffff"),d.addColorStop(1,"#aaaaaa")),t.fillStyle=d,t.strokeStyle="#000000",a(t,s,l,u,c,h,d,!0);var g=(u-e.getTextWidth(t,i))/2,f=(c-e.getTextHeight(t.font).descent)/2;"middle"!==t.textBaseline&&(t.textBaseline="middle"),t.fillStyle="#000000",e.backgroundColor="rgba(0,0,0,0)",t.fillText(i,s+g,l+f),e.buttonCells[n+","+o]=!0},defaultCellPaint:function(t,e){var i,o,r,s,l,a=e.value,u=e.bounds.x,c=e.bounds.y,h=e.bounds.width,d=e.bounds.height,g=e.headerTextWrapping,f=2,p=0===e.y;a&&a.constructor===Array&&(i=a[0],o=a[2],a=a[1],"object"==typeof a&&(r=a,a=null),i&&"IMG"!==i.nodeName&&(i=null),o&&"IMG"!==o.nodeName&&(o=null),r&&"IMG"!==r.nodeName&&(r=null)),a=n(e,a),t.font!==e.font&&(t.font=e.font),"left"!==t.textAlign&&(t.textAlign="left"),"middle"!==t.textBaseline&&(t.textBaseline="middle"),(e.backgroundColor||e.isSelected)&&(t.fillStyle=n(e,e.isSelected?e.backgroundSelectionColor:e.backgroundColor),t.fillRect(u,c,h,d));var v=n(e,e.isSelected?e.foregroundSelectionColor:e.color);t.fillStyle!==v&&(t.fillStyle=v,t.strokeStyle=v),p&&g?this.renderMultiLineText(u,c,d,h,t,e,a):this.renderSingleLineText(u,c,d,h,t,e,a),e.isInCurrentSelectionRectangle&&(t.fillStyle="rgba(0, 0, 0, 0.2)",t.fillRect(u,c,h,d));var m=0;i&&(l=Math.round((d-i.height)/2),t.drawImage(i,u+f,c+l),m=Math.max(i.width+2)),o&&(l=Math.round((d-o.height)/2),s=0,t.drawImage(o,u+h-s-o.width,c+l),m=Math.max(o.width+2)),r&&(l=Math.round((d-r.height)/2),s=Math.round((h-r.width)/2),t.drawImage(r,u+h-s-r.width,c+l),m=Math.max(r.width+2)),e.cellBorderThickness&&(t.beginPath(),t.rect(u,c,h,d),t.lineWidth=e.cellBorderThickness,t.strokeStyle=e.cellBorderStyle,t.stroke(),t.closePath()),e.minWidth=e.minWidth+2*m},renderMultiLineText:function(t,e,i,n,o,r,a){var u=s(o,r,a,n);if(1===u.length)return this.renderSingleLineText(t,e,i,n,o,r,l(a));var c=r.cellPadding,h=0,d=r.voffset,g=r.halign,f=r.getTextHeight(r.font).height;switch(g){case"right":h=n-c;break;case"center":h=n/2;break;case"left":h=c}var p=0,v=Math.ceil(f/2);d+=Math.ceil((i-(u.length-1)*f)/2),h=Math.max(p,h),d=Math.max(v,d),o.save(),o.moveTo(t,e),o.lineTo(t+n,e),o.lineTo(t+n,e+i),o.lineTo(t,e+i),o.lineTo(t,e),o.closePath(),o.clip(),o.textAlign=g;for(var m=0;m-1,this.selectionModel=new w,this.selectionModel.getGrid=function(){return i},this.localCellEditors={},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.behavior=e(this),this.div.oncontextmenu=function(t){return t.preventDefault(),!1},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.pluginsDo(function(t){t.installOn&&t.installOn(i)}),this.initRenderer(),this.initCanvas(),this.initScrollbars(),x||(x=!0,a()),this.initLocalCellEditors(),this.checkScrollbarVisibility(),document.body.addEventListener("copy",function(t){i.checkClipboardCopy(t)}),this.getCanvas().resize()}function o(t,e){if(null===e||void 0===e)return 0;if(e+="",0===e.length)return 0;var i=t.font+e,n=y.get(i);return n||(n=t.measureText(e).width,y.set(i,n)),n}function r(t){var e=r.fontData[t];if(e)return e;e={};var i=document.createElement("span");i.textContent="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px";var o=document.createElement("div");o.appendChild(i),o.appendChild(n),o.style.position="absolute",document.body.appendChild(o);try{n.style.verticalAlign="baseline";var s=n.getBoundingClientRect(),l=i.getBoundingClientRect();e.ascent=s.top-l.top,n.style.verticalAlign="bottom",e.height=s.top-l.top,e.descent=e.height-e.ascent}finally{document.body.removeChild(o)}return 0!==e.height&&(r.fontData[t]=e),e}function s(){var t={font:"13px Tahoma, Geneva, sans-serif",color:"rgb(25, 25, 25)",backgroundColor:"rgb(241, 241, 241)",foregroundSelectionColor:"rgb(25, 25, 25)",backgroundSelectionColor:"rgb(183, 219, 255)",columnHeaderFont:"12px Tahoma, Geneva, sans-serif",columnHeaderColor:"rgb(25, 25, 25)",columnHeaderBackgroundColor:"rgb(223, 227, 232)",columnHeaderForegroundSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",columnHeaderForegroundColumnSelectionColor:"rgb(25, 25, 25)",columnHeaderBackgroundColumnSelectionColor:"rgb(255, 180, 0)",rowHeaderFont:"12px Tahoma, Geneva, sans-serif",rowHeaderColor:"rgb(25, 25, 25)",rowHeaderBackgroundColor:"rgb(223, 227, 232)",rowHeaderForegroundSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundSelectionColor:"rgb(255, 220, 97)",rowHeaderForegroundRowSelectionColor:"rgb(25, 25, 25)",rowHeaderBackgroundRowSelectionColor:"rgb(255, 180, 0)",filterFont:"12px Tahoma, Geneva, sans-serif",filterColor:"rgb(25, 25, 25)",filterBackgroundColor:"white",filterForegroundSelectionColor:"rgb(25, 25, 25)",filterBackgroundSelectionColor:"rgb(255, 220, 97)",filterCellBorderStyle:"rgba(0,0,0,0.8)",filterCellBorderThickness:"0.4",treeColumnFont:"12px Tahoma, Geneva, sans-serif",treeColumnColor:"rgb(25, 25, 25)",treeColumnBackgroundColor:"rgb(223, 227, 232)",treeColumnForegroundSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundSelectionColor:"rgb(255, 220, 97)",treeColumnForegroundColumnSelectionColor:"rgb(25, 25, 25)",treeColumnBackgroundColumnSelectionColor:"rgb(255, 180, 0)",backgroundColor2:"rgb(201, 201, 201)",voffset:0,scrollbarHoverOver:"visible",scrollbarHoverOff:"hidden",scrollingEnabled:!0,vScrollbarClassPrefix:"",hScrollbarClassPrefix:"",fixedRowAlign:"center",fixedColAlign:"center",cellPadding:5,gridLinesH:!0,gridLinesV:!0,lineColor:"rgb(199, 199, 199)",lineWidth:.4,defaultRowHeight:15,defaultColumnWidth:100,repaintIntervalRate:60,repaintImmediately:!1,useBitBlit:!1,useHiDPI:!0,editorActivationKeys:["alt","esc"],readOnly:!1,getTextWidth:o,getTextHeight:r,fixedColumnCount:0,fixedRowCount:0,headerColumnCount:0,showRowNumbers:!0,showHeaderRow:!0,showFilterRow:!0,cellSelection:!0,columnSelection:!0,rowSelection:!0,singleRowSelectionMode:!0,columnAutosizing:!0,rowNumberAutosizing:!0,headerTextWrapping:!1,rowResize:!1,editOnDoubleClick:!0};return t}function l(t){var e=t.origin,i=t.corner,n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),r=Math.max(e.x,i.x),s=Math.max(e.y,i.y),l=new v(n,o,r-n,s-o);return l}function a(){u(E);var t=document.createElement("paper-button");t.style.display="none",t.setAttribute("disabled",!0),document.body.appendChild(t);var e=window.getComputedStyle(t),i=document.createElement("section");i.style.display="none",i.setAttribute("hero",!0),document.body.appendChild(i);var n=window.getComputedStyle(document.querySelector("html")),o=window.getComputedStyle(document.querySelector("html, body")),r=window.getComputedStyle(i);E.columnHeaderBackgroundColor=e.color,E.rowHeaderBackgroundColor=e.color,E.topLeftBackgroundColor=e.color,E.lineColor=e.backgroundColor,E.backgroundColor2=o.backgroundColor,E.color=n.color,E.fontFamily=n.fontFamily,E.backgroundColor=r.backgroundColor,t.setAttribute("disabled",!1),t.setAttribute("secondary",!0),t.setAttribute("raised",!0),e=window.getComputedStyle(t),E.columnHeaderColor=e.color,E.rowHeaderColor=e.color,E.topLeftColor=e.color,E.backgroundSelectionColor=e.backgroundColor,E.foregroundSelectionColor=e.color,t.setAttribute("secondary",!1),t.setAttribute("warning",!0),E.columnHeaderForegroundSelectionColor=e.color,E.columnHeaderBackgroundSelectionColor=e.backgroundColor,E.rowHeaderForegroundSelectionColor=e.color,E.fixedColumnBackgroundSelectionColor=e.backgroundColor,("rgba(0, 0, 0, 0)"===E.columnHeaderBackgroundSelectionColor||"transparent"===E.lineColor)&&u(E),document.body.removeChild(t),document.body.removeChild(i)}function u(t){for(var e in t)t.hasOwnProperty(e)&&delete t[e]}function c(t){var e="function"==typeof t?t():t;return e||0===e?e:""}function h(){Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})}var d=t("extend-me"),g=t("finbars"),f=t("fincanvas"),p=t("rectangular").Point,v=t("rectangular").Rectangle,m=t("lru-cache"),A=t("object-iterators"),C=t("./Renderer"),w=t("./SelectionModel"),S=t("./stylesheets"),x=!1,y=new m(2e3),b=s(),E=Object.create(b),R=Object.create(E);n.prototype={constructor:n.prototype.constructor,behavior:null,isWebkit:!0,mouseDown:[],dragExtent:null,vScrollValue:0,hScrollValue:0,rectangular:null,selectionModel:null,cellEditor:null,sbHScroller:null,sbVScroller:null,sbPrevVScrollValue:null,sbPrevHScrollValue:null,cellEditors:null,renderOverridesCache:{},hoverCell:null,scrollingNow:!1,lastEdgeSelection:null,setAttribute:function(t,e){this.div.setAttribute(t,e)},reset:function(){var t=this;this.lastEdgeSelection=[0,0],this.lnfProperties=Object.create(R),this.selectionModel=new w,this.selectionModel.getGrid=function(){return t},this.cellEditors=Object.create(this.localCellEditors),this.renderOverridesCache={},this.clearMouseDown(),this.dragExtent=new p(0,0),this.numRows=0,this.numColumns=0,this.vScrollValue=0,this.hScrollValue=0,this.cellEditor=null,this.sbPrevVScrollValue=null,this.sbPrevHScrollValue=null,this.hoverCell=null,this.scrollingNow=!1,this.lastEdgeSelection=[0,0],this.getBehavior().reset(),this.getRenderer().reset(),this.getCanvas().resize(),this.behaviorChanged()},resetTextWidthCache:function(){y=new m(2e3)},getProperties:function(){return this.getPrivateState()},_getProperties:function(){return this.lnfProperties},computeCellsBounds:function(){var t=this.getRenderer();t&&t.computeCellsBounds()},initCellEditor:function(t){var e=document.createElement("div");this.div.appendChild(e),this.localCellEditors[t.alias]=t},initLocalCellEditors:function(){var t=["Textfield","Choice","Color","Date","Slider","Spinner"],e=this;t.forEach(function(t){e.initCellEditor(new n.cellEditors[t])})},toggleColumnPicker:function(){this.getBehavior().toggleColumnPicker()},isHovered:function(t,e){var i=this.getHoverCell();return i?i.x===t&&i.y===e:!1},isColumnHovered:function(t){var e=this.getHoverCell();return e?e.x===t:!1},isRowResizeable:function(){return this.resolveProperty("rowResize")},isRowHovered:function(t){var e=this.getHoverCell();return e?e.y===t:!1},getHoverCell:function(){return this.hoverCell},setHoverCell:function(t){var e=this.hoverCell,i=new p(t.x,t.y);e&&e.equals(i)||(this.hoverCell=i,this.fireSyntheticOnCellEnterEvent(i),this.repaint())},addGlobalProperties:function(t){if(R)this._addGlobalProperties(t);else{var e=this;setTimeout(function(){e.addGlobalProperties(t)},10)}},_addGlobalProperties:function(t){A(t).each(function(t,e){R[e]=t})},addProperties:function(t){var e=this.getProperties();A(t).each(function(i,n){e[n]=t[n]}),this.refreshProperties()},refreshProperties:function(){this.checkScrollbarVisibility(),this.getBehavior().defaultRowHeight=null,this.isColumnAutosizing()&&this.getBehavior().autosizeAllColumns()},getPrivateState:function(){return this.getBehavior().getPrivateState()},setState:function(t){var e=this;this.getBehavior().setState(t),setTimeout(function(){e.behaviorChanged(),e.synchronizeScrollingBoundries()},100)},getState:function(){return this.getBehavior().getState()},getMouseDown:function(){var t=this.mouseDown.length-1;return 0>t?null:this.mouseDown[t]},popMouseDown:function(){0!==this.mouseDown.length&&(this.mouseDown.length=this.mouseDown.length-1)},clearMouseDown:function(){this.mouseDown=[new p(-1,-1)],this.dragExtent=null},setMouseDown:function(t){this.mouseDown.push(t)},getDragExtent:function(){return this.dragExtent; +},setDragExtent:function(t){this.dragExtent=t},pluginsDo:function(t){},getCellProvider:function(){var t=this.getBehavior().getCellProvider();return t},gridRenderedNotification:function(){this.updateRenderedSizes(),this.cellEditor&&this.cellEditor.gridRenderedNotification(),this.checkColumnAutosizing(),this.fireSyntheticGridRenderedEvent()},checkColumnAutosizing:function(){var t=this.getBehavior();t.autoSizeRowNumberColumn(),this.isColumnAutosizing()&&t.checkColumnAutosizing(!1)},updateRenderedSizes:function(){var t=this.getBehavior();t.setRenderedColumnCount(this.getVisibleColumns()+1),t.setRenderedRowCount(this.getVisibleRows()+1)},checkClipboardCopy:function(t){if(this.hasFocus()){t.preventDefault();var e=this.getSelectionAsTSV();t.clipboardData.setData("text/plain",e)}},hasSelections:function(){return this.getSelectionModel?this.getSelectionModel().hasSelections():void 0},getSelectionAsTSV:function(){var t=this.getSelectionModel();if(t.hasSelections()){var e=this.getSelectionMatrix();return e=e[e.length-1],this.getMatrixSelectionAsTSV(e)}return t.hasRowSelections()?this.getMatrixSelectionAsTSV(this.getRowSelectionMatrix()):t.hasColumnSelections()?this.getMatrixSelectionAsTSV(this.getColumnSelectionMatrix()):void 0},getMatrixSelectionAsTSV:function(t){if(t.length){var e=t.length,i=t[0].length,n=e*i,o=[];if(n>2e4)return alert("selection size is too big to copy to the paste buffer"),"";for(var r=0;i>r;r++){for(var s=0;e>s;s++)o.push(t[s][r]),e>s&&o.push(" ");i>r&&o.push("\n")}var l=o.join("");return l}return""},hasFocus:function(){return this.getCanvas().hasFocus()},clearSelections:function(){this.getSelectionModel().clear(),this.clearMouseDown()},clearMostRecentSelection:function(){this.getSelectionModel().clearMostRecentSelection()},clearMostRecentColumnSelection:function(){this.getSelectionModel().clearMostRecentColumnSelection()},clearMostRecentRowSelection:function(){this.getSelectionModel().clearMostRecentRowSelection()},select:function(t,e,i,n){0>t||0>e||this.getSelectionModel().select(t,e,i,n)},isSelected:function(t,e){return this.getSelectionModel().isSelected(t,e)},isCellSelectedInRow:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInRow(t);return i},isCellSelectedInColumn:function(t){var e=this.getSelectionModel(),i=e.isCellSelectedInColumn(t);return i},getSelectionModel:function(){return this.selectionModel},getBehavior:function(){return this.behavior},setBehavior:function(t){this.behavior=t,this.behavior.setGrid(this),this.behavior.changed=this.behaviorChanged.bind(this),this.behavior.shapeChanged=this.behaviorShapeChanged.bind(this),this.behavior.stateChanged=this.behaviorStateChanged.bind(this)},behaviorChanged:function(){(this.numColumns!==this.getColumnCount()||this.numRows!==this.getRowCount())&&(this.numColumns=this.getColumnCount(),this.numRows=this.getRowCount(),this.behaviorShapeChanged()),this.computeCellsBounds(),this.repaint()},getBounds:function(){var t=this.getRenderer();if(t)return t.getBounds()},resolveProperty:function(t){return this.getProperties()[t]},behaviorShapeChanged:function(){this.synchronizeScrollingBoundries()},behaviorStateChanged:function(){this.getRenderer().computeCellsBounds(),this.repaint()},repaint:function(){var t=this.resolveProperty("repaintImmediately"),e=this.getCanvas();e&&(t===!0?e.paintNow():e.repaint())},paintNow:function(){var t=this.getCanvas();t.paintNow()},useHiDPI:function(){return this.resolveProperty("useHiDPI")!==!1},initCanvas:function(){var t=this,e=this.divCanvas=document.createElement("div");this.div.appendChild(e),this.canvas=new f(e,this.renderer);var i=e.style;i.position="absolute",i.top=0,i.right="-200px",i.bottom=0,i.left=0,this.canvas.resizeNotification=function(){t.resized()},this.addFinEventListener("fin-canvas-mousemove",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseMove(n)}}),this.addFinEventListener("fin-canvas-mousedown",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.keys=e.detail.keys,n.primitiveEvent=e,t.mouseDownState=n,t.delegateMouseDown(n),t.fireSyntheticMouseDownEvent(n),t.repaint()}}),this.addFinEventListener("fin-canvas-mouseup",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!1,t.isScrollingNow()&&t.setScrollingNow(!1),t.columnDragAutoScrolling&&(t.columnDragAutoScrolling=!1);var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseUp(n),t.mouseDownState&&t.fireSyntheticButtonPressedEvent(t.mouseDownState),t.mouseDownState=null,t.fireSyntheticMouseUpEvent(n)}}),this.addFinEventListener("fin-canvas-tap",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,n.keys=e.detail.keys,t.fireSyntheticClickEvent(n),t.delegateTap(n)}}),this.addFinEventListener("fin-canvas-drag",function(e){if(!t.resolveProperty("readOnly")){t.dragging=!0;var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.delegateMouseDrag(n)}}),this.addFinEventListener("fin-canvas-keydown",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeydownEvent(e),t.delegateKeyDown(e))}),this.addFinEventListener("fin-canvas-keyup",function(e){t.resolveProperty("readOnly")||(t.fireSyntheticKeyupEvent(e),t.delegateKeyUp(e))}),this.addFinEventListener("fin-canvas-track",function(e){if(!t.resolveProperty("readOnly")&&!t.dragging){var i=e.detail.primitiveEvent;Math.abs(i.dy)>Math.abs(i.dx)?i.yDirection>0?t.scrollVBy(-2):i.yDirection<-0&&t.scrollVBy(2):i.xDirection>0?t.scrollHBy(-1):i.xDirection<-0&&t.scrollHBy(1)}}),this.addFinEventListener("fin-canvas-dblclick",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e,t.fireSyntheticDoubleClickEvent(n,e),t.delegateDoubleClick(n)}}),this.addFinEventListener("fin-canvas-wheelmoved",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateWheelMoved(n)}),this.addFinEventListener("fin-canvas-mouseout",function(e){if(!t.resolveProperty("readOnly")){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateMouseExit(n)}}),this.addFinEventListener("fin-canvas-context-menu",function(e){var i=e.detail.mouse,n=t.getGridCellFromMousePoint(i);n.primitiveEvent=e.detail.primitiveEvent,t.delegateContextMenu(n)}),this.div.removeAttribute("tabindex")},convertViewPointToDataPoint:function(t){return this.getBehavior().convertViewPointToDataPoint(t)},convertDataPointToViewPoint:function(t){return this.getBehavior().convertDataPointToViewPoint(t)},addFinEventListener:function(t,e){this.canvas.addEventListener(t,e)},setScrollingNow:function(t){this.scrollingNow=t},isScrollingNow:function(){return this.scrollingNow},overColumnDivider:function(t){var e=t.primitiveEvent.detail.mouse.x,i=this.getRenderer().overColumnDivider(e);return i},overRowDivider:function(t){var e=t.primitiveEvent.detail.mouse.y,i=this.getRenderer().overRowDivider(e);return i},beCursor:function(t){t||(t="default"),this.div.style.cursor=t},delegateWheelMoved:function(t){var e=this.getBehavior();e.onWheelMoved(this,t)},delegateMouseExit:function(t){var e=this.getBehavior();e.handleMouseExit(this,t)},delegateContextMenu:function(t){var e=this.getBehavior();e.onContextMenu(this,t)},delegateMouseMove:function(t){var e=this.getBehavior();e.onMouseMove(this,t)},delegateMouseDown:function(t){var e=this.getBehavior();e.handleMouseDown(this,t)},delegateMouseUp:function(t){var e=this.getBehavior();e.onMouseUp(this,t)},delegateTap:function(t){var e=this.getBehavior();e.onTap(this,t)},delegateMouseDrag:function(t){var e=this.getBehavior();e.onMouseDrag(this,t)},delegateDoubleClick:function(t){var e=this.getBehavior();e.onDoubleClick(this,t)},delegateHoldPulse:function(t){var e=this.getBehavior();e.onHoldPulse(this,t)},delegateKeyDown:function(t){var e=this.getBehavior();e.onKeyDown(this,t)},delegateKeyUp:function(t){var e=this.getBehavior();e.onKeyUp(this,t)},stopEditing:function(){this.cellEditor&&(this.cellEditor.stopEditing&&this.cellEditor.stopEditing(),this.cellEditor=null)},registerCellEditor:function(t,e){this.cellEditors[t]=e},getDataBounds:function(){var t=200,e=this.canvas.bounds,i=new v(0,0,e.origin.x+e.extent.x-t,e.origin.y+e.extent.y);return i},getRowNumbersWidth:function(){return this.isShowRowNumbers()?this.getRenderer().getRowNumbersWidth():0},getCanvas:function(){return this.canvas},editAt:function(t,e){this.cellEditor=t;var i=e.gridCell,n=i.x,o=i.y;if(!(0>n||0>o)){var r=new p(n,o);this.setMouseDown(r),this.setDragExtent(new p(0,0)),t.isAdded||(t.isAdded=!0,this.div.appendChild(t.getInput())),t.grid=this,t.beginEditAt(r)}},isColumnVisible:function(t){var e=this.getRenderer().isColumnVisible(t);return e},isDataRowVisible:function(t){var e=this.getRenderer().isRowVisible(t);return e},isDataVisible:function(t,e){var i=this.isDataRowVisible(e)&&this.isColumnVisible(t);return i},insureModelColIsVisible:function(t,e){var i=this.getColumnCount()-1,n=t;return e>0&&n++,this.isColumnVisible(n)&&t!==i?!1:(this.scrollBy(e,0),!0)},insureModelRowIsVisible:function(t,e){var i=this.getRowCount()-1,n=t;return e>0&&n++,this.isDataRowVisible(n)&&t!==i?!1:(this.scrollBy(0,e),!0)},scrollBy:function(t,e){this.scrollHBy(t),this.scrollVBy(e)},scrollVBy:function(t){var e=this.sbVScroller.range.max,i=this.getVScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setVScrollValue(n)},scrollHBy:function(t){var e=this.sbHScroller.range.max,i=this.getHScrollValue(),n=Math.min(e,Math.max(0,i+t));n!==i&&this.setHScrollValue(n)},getGridCellFromMousePoint:function(t){var e=this.getRenderer().getGridCellFromMousePoint(t);return e},getBoundsOfCell:function(t){var e=this.getRenderer().getBoundsOfCell(t),i=new v(e.x,e.y,e.width,e.height);return i},resized:function(){this.synchronizeScrollingBoundries()},cellClicked:function(t){var e=t.gridCell,i=this.getColumnCount(),n=this.getRowCount();if(!(e.x>i||e.y>n)){var o=this.getHoverCell(),r=this.getVScrollValue(),s=o.x;o.y<0&&(r=0),o=new p(s,o.y+r),this.getBehavior().cellClicked(o,t)}},setTotalsValueNotification:function(t,e,i){this.fireSyntheticSetTotalsValue(t,e,i)},fireSyntheticSetTotalsValue:function(t,e,i){var n=new CustomEvent("fin-set-totals-value",{detail:{x:t,y:e,value:i}});this.canvas.dispatchEvent(n)},fireSyntheticEditorKeyUpEvent:function(t,e){var i=new CustomEvent("fin-editor-key-up",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyDownEvent:function(t,e){var i=new CustomEvent("fin-editor-key-down",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorKeyPressEvent:function(t,e){var i=new CustomEvent("fin-editor-key-press",{detail:{input:t,keyEvent:e}});this.canvas.dispatchEvent(i)},fireSyntheticEditorDataChangeEvent:function(t,e,i){var n=new CustomEvent("fin-editor-data-change",{detail:{input:t,oldValue:e,newValue:i},cancelable:!0});return this.canvas.dispatchEvent(n)},fireSyntheticRowSelectionChangedEvent:function(){var t=new CustomEvent("fin-row-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},fireSyntheticColumnSelectionChangedEvent:function(){var t=new CustomEvent("fin-column-selection-changed",{detail:{rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(t)},selectionChanged:function(){var t=this.getSelectedRows(),e=new CustomEvent("fin-selection-changed",{detail:{rows:t,columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},getRowSelection:function(){function t(t,o){i[o]=c(n.getValue(e,t))}var e,i,n=this,o=this.getSelectionModel().getSelectedRows(),r=this.getColumnCount(),s={};for(e=0;r>e;e++)i=new Array(o.length),s[this.getField(e)]=i,o.forEach(t);return s},getRowSelectionMatrix:function(){function t(t,n){r[e][n]=c(i.getValue(e,t))}var e,i=this,n=this.getSelectionModel().getSelectedRows(),o=this.getColumnCount(),r=new Array(o);for(e=0;o>e;e++)r[e]=new Array(n.length),n.forEach(t);return r},getColumnSelectionMatrix:function(){var t=this.getSelectedColumns(),e=this.getRowCount(),i=new Array(t.length),n=this;return t.forEach(function(t,o){i[o]=new Array(e);for(var r=0;e>r;r++)i[o][r]=c(n.getValue(t,r))}),i},getColumnSelection:function(){var t=this.getSelectedColumns(),e={},i=this.getRowCount(),n=this;return t.forEach(function(t){var o=new Array(i);e[n.getField(t)]=o;for(var r=0;i>r;r++)o[r]=c(n.getValue(t,r))}),e},getSelection:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelection(e)}),i},_getSelection:function(t){t=l(t);for(var e,i=t.extent.x+1,n=t.extent.y+1,o=t.origin.x,r=t.origin.y,s={},a=0;i>a;a++){var u=new Array(n);for(s[this.getField(a+o)]=u,e=0;n>e;e++)u[e]=c(this.getValue(o+a,r+e))}return s},getSelectionMatrix:function(){var t=this,e=this.getSelections(),i=new Array(e.length);return e.forEach(function(e,n){i[n]=t._getSelectionMatrix(e)}),i},_getSelectionMatrix:function(t){t=l(t);for(var e=t.extent.x+1,i=t.extent.y+1,n=t.origin.x,o=t.origin.y,r=[],s=0;e>s;s++){var a=new Array(i);r[s]=a;for(var u=0;i>u;u++)a[u]=c(this.getValue(n+s,o+u))}return r},fireSyntheticContextMenuEvent:function(t){t.gridCell=this.convertViewPointToDataPoint(t.gridCell);var e=new CustomEvent("fin-context-menu",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseUpEvent:function(t){var e=new CustomEvent("fin-mouseup",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},fireSyntheticMouseDownEvent:function(t){var e=new CustomEvent("fin-mousedown",{detail:{gridCell:t.gridCell,mousePoint:t.mousePoint,viewPoint:t.viewPoint,primitiveEvent:t.primitiveEvent,rows:this.getSelectedRows(),columns:this.getSelectedColumns(),selections:this.getSelectionModel().getSelections()}});this.canvas.dispatchEvent(e)},isViewableButton:function(t,e){return this.getRenderer().isViewableButton(t,e)},fireSyntheticButtonPressedEvent:function(t){var e=t.dataCell,i=t.gridCell;if(this.isViewableButton(e.x,e.y)){var n=new CustomEvent("fin-button-pressed",{detail:{gridCell:i}});this.canvas.dispatchEvent(n)}},fireSyntheticKeydownEvent:function(t){var e=new CustomEvent("fin-keydown",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticKeyupEvent:function(t){var e=new CustomEvent("fin-keyup",{detail:t.detail});this.canvas.dispatchEvent(e)},fireSyntheticOnCellEnterEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-enter",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticGroupsChangedEvent:function(t){var e={groups:t,time:Date.now(),grid:this},i=new CustomEvent("fin-groups-changed",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticOnCellExitEvent:function(t){var e={gridCell:t,time:Date.now(),grid:this},i=new CustomEvent("fin-cell-exit",{detail:e});this.canvas.dispatchEvent(i)},fireSyntheticClickEvent:function(t){var e=t.gridCell,i={gridCell:e,mousePoint:t.mousePoint,keys:t.keys,primitiveEvent:t,time:Date.now(),grid:this};this.getBehavior().enhanceDoubleClickEvent(i);var n=new CustomEvent("fin-click",{detail:i});this.canvas.dispatchEvent(n)},fireSyntheticDoubleClickEvent:function(t){var e=t.gridCell,i=this.getBehavior(),n={gridCell:e,mousePoint:t.mousePoint,time:Date.now(),grid:this};i.enhanceDoubleClickEvent(t);var o=new CustomEvent("fin-double-click",{detail:n});i.cellDoubleClicked(e,t),this.canvas.dispatchEvent(o)},fireSyntheticGridRenderedEvent:function(){var t=new CustomEvent("fin-grid-rendered",{detail:{source:this,time:Date.now()}});this.canvas&&this.canvas.dispatchEvent(t)},fireScrollEvent:function(t,e,i){var n=new CustomEvent(t,{detail:{oldValue:e,value:i,time:Date.now()}});this.canvas.dispatchEvent(n)},setVScrollValue:function(t){t=Math.round(t);var e=this.sbVScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.vScrollValue){this.getBehavior()._setScrollPositionY(t);var n=this.vScrollValue;this.vScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-y",n,t)})}},getVScrollValue:function(){return this.vScrollValue},setHScrollValue:function(t){t=Math.round(t);var e=this.sbHScroller.range.max;t=Math.min(e,Math.max(0,t));var i=this;if(t!==this.hScrollValue){this.getBehavior()._setScrollPositionX(t);var n=this.hScrollValue;this.hScrollValue=t,this.scrollValueChangedNotification(),setTimeout(function(){i.fireScrollEvent("fin-scroll-x",n,t),i.synchronizeScrollingBoundries()})}},getHScrollValue:function(){return this.hScrollValue},takeFocus:function(){this.isEditing()?this.stopEditing():this.getCanvas().takeFocus()},editorTakeFocus:function(){return this.cellEditor?this.cellEditor.takeFocus():void 0},isEditing:function(){return this.cellEditor?this.cellEditor.isEditing:!1},initScrollbars:function(){var t=this,e=new g({orientation:"horizontal",onchange:t.setHScrollValue.bind(t),cssStylesheetReferenceElement:this.div}),i=new g({orientation:"vertical",onchange:t.setVScrollValue.bind(t),paging:{up:t.pageUp.bind(t),down:t.pageDown.bind(t)}});this.sbHScroller=e,this.sbVScroller=i;var n=this.resolveProperty("hScrollbarClassPrefix"),o=this.resolveProperty("vScrollbarClassPrefix");n&&""!==n&&(this.sbHScroller.classPrefix=n),o&&""!==o&&(this.sbVScroller.classPrefix=o),this.div.appendChild(e.bar),this.div.appendChild(i.bar),this.resizeScrollbars()},resizeScrollbars:function(){this.sbHScroller.shortenBy(this.sbVScroller).resize(),this.sbVScroller.resize()},setVScrollbarValues:function(t){this.sbVScroller.range={min:0,max:t}},setHScrollbarValues:function(t){this.sbHScroller.range={min:0,max:t}},scrollValueChangedNotification:function(){(this.hScrollValue!==this.sbPrevHScrollValue||this.vScrollValue!==this.sbPrevVScrollValue)&&(this.sbPrevHScrollValue=this.hScrollValue,this.sbPrevVScrollValue=this.vScrollValue,this.cellEditor&&this.cellEditor.scrollValueChangedNotification(),this.computeCellsBounds())},getValue:function(t,e){return this.getBehavior().getValue(t,e)},setValue:function(t,e,i){this.getBehavior().setValue(t,e,i)},getColumnAlignment:function(t){return this.getBehavior().getColumnAlignment(t)},synchronizeScrollingBoundries:function(){var t=this.getBehavior(),e=this.getFixedColumnCount(),i=this.getFixedRowCount(),n=this.getColumnCount(),o=this.getRowCount(),r=this.getBounds();if(r){for(var s=r.height-t.getFixedRowsMaxHeight()-15,l=r.width-200-t.getFixedColumnsMaxWidth()-15,a=0,u=0;n>a;a++){var c=this.getColumnWidth(n-a-1);if(u+=c,u>l)break}for(var h=0,d=0;o>h;h++){var g=this.getRowHeight(o-h-1);if(d+=g,d>s)break}var f=1+Math.max(0,n-e-a);this.setHScrollbarValues(f);var p=Math.max(0,o-i-h);this.setVScrollbarValues(p),this.setHScrollValue(Math.min(this.getHScrollValue(),f)),this.setVScrollValue(Math.min(this.getVScrollValue(),p)),this.computeCellsBounds(),this.repaint(),this.resizeScrollbars()}},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=new C(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(t){return this.getBehavior().getColumnWidth(t)},setColumnWidth:function(t,e){this.stopEditing(),this.getBehavior().setColumnWidth(t,e)},getColumnEdge:function(t){return this.getBehavior().getColumnEdge(t,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(t){return this.getBehavior().getRowHeight(t)},setRowHeight:function(t,e){this.stopEditing(),this.getBehavior().setRowHeight(t,e)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(t){this.getBehavior().topLeftClicked(this,t)},rowHeaderClicked:function(t){this.getBehavior().rowHeaderClicked(this,t)},columnHeaderClicked:function(t){this.getBehavior().columnHeaderClicked(this,t)},_activateEditor:function(t){var e=t.gridCell;this.activateEditor(e.x,e.y)},activateEditor:function(t,e){if(this.isEditable()||this.isFilterRow(e)){var i=this.getCellEditorAt(t,e);if(i){var n=i.editorPoint;if(i){if(n.x===t&&n.y===e&&i.isEditing)return;this.isEditing()&&this.stopEditing(),event.gridCell={x:t,y:e},this.editAt(i,event)}}}},getCellEditorAt:function(t,e){return this.getBehavior().getCellEditorAt(t,e)},toggleHiDPI:function(){this.useHiDPI()?this.removeAttribute("hidpi"):this.setAttribute("hidpi",null),this.canvas.resize()},getHiDPI:function(t){if(window.devicePixelRatio&&this.useHiDPI()){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return n}return 1},getRenderedWidth:function(t){return this.renderer.getRenderedWidth(t)},getRenderedHeight:function(t){return this.renderer.getRenderedHeight(t)},resolveCellEditor:function(t){return this.cellEditors[t]},updateCursor:function(){var t=this.getBehavior(),e=t.getCursorAt(-1,-1),i=this.getHoverCell();if(i&&i.x>-1&&i.y>-1){var n=i.x+this.getHScrollValue();e=t.getCursorAt(n,i.y+this.getVScrollValue())}this.beCursor(e)},repaintCell:function(t,e){this.getRenderer().repaintCell(t,e)},isDraggingColumn:function(){return!!this.renderOverridesCache.dragger},pageUp:function(){var t=this.getRenderer().getPageUpRow();return this.setVScrollValue(t),t},pageDown:function(){var t=this.getRenderer().getPageDownRow();return this.setVScrollValue(t),t},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var t,e=this.getBehavior(),i=this.getRenderer(),n=this.getColumnCount(),o=i.getVisibleRows(),r=new Array(n),s=new Array(o);return r.forEach(function(t,i){r[i]=e.getColumnId(i,0)}),s.forEach(function(i,n){t=s[n]={hierarchy:e.getFixedColumnValue(0,n)},r.forEach(function(i,o){t[i]=e.getValue(o,n)})}),s},getSelectedRow:function(){var t=this.getSelectionModel().getSelections();if(t.length){for(var e=this.getBehavior(),i=this.getColumnCount(),n=t[0].origin.y,o={},r=0;i>r;r++)o[e.getColumnId(r,0)]=e.getValue(r,n);return o}},fireRequestCellEdit:function(t,e){var i=new CustomEvent("fin-request-cell-edit",{cancelable:!0,detail:{value:e,gridCell:t,time:Date.now()}});return this.canvas.dispatchEvent(i)},fireBeforeCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-before-cell-edit",{cancelable:!0,detail:{oldValue:e,newValue:i,gridCell:t,time:Date.now(),input:n}}),r=this.canvas.dispatchEvent(o);return r},fireAfterCellEdit:function(t,e,i,n){var o=new CustomEvent("fin-after-cell-edit",{detail:{newValue:i,oldValue:e,gridCell:t,time:Date.now(),input:n}});this.canvas.dispatchEvent(o)},autosizeColumn:function(t){var e=this.getBehavior().getColumn(t);e.checkColumnAutosizing(!0),this.computeCellsBounds()},setFocusable:function(t){this.getCanvas().setFocusable(t)},getVisibleColumnsCount:function(){return this.getRenderer().getVisibleColumnsCount()},getVisibleRowsCount:function(){return this.getRenderer().getVisibleRowsCount()},updateSize:function(){this.canvas.checksize()},stopPaintThread:function(){this.canvas.stopPaintThread()},stopResizeThread:function(){this.canvas.stopResizeThread()},restartResizeThread:function(){this.canvas.restartResizeThread()},restartPaintThread:function(){this.canvas.restartPaintThread()},swapColumns:function(t,e){this.getBehavior().swapColumns(t,e)},endDragColumnNotification:function(){this.getBehavior().endDragColumnNotification()},getFixedColumnsMaxWidth:function(){return this.getBehavior().getFixedColumnsMaxWidth()},isMouseDownInHeaderArea:function(){var t=this.getHeaderColumnCount(),e=this.getHeaderRowCount(),i=this.getMouseDown();return i.x-1,r=e.indexOf("SHIFT")>-1;o||r?(o&&(n?i.deselectColumn(t):i.selectColumn(t)),r&&(i.clear(),i.selectColumn(this.lastEdgeSelection[0],t))):(i.clear(),n||i.selectColumn(t)),n||r||(this.lastEdgeSelection[0]=t),this.repaint(),this.fireSyntheticColumnSelectionChangedEvent()},toggleSelectRow:function(t,e){var i=this.getFilterRowIndex()+1;if(!(i>t)){e=e||[];var n=this.isSingleRowSelectionMode(),o=this.getSelectionModel(),r=o.isRowSelected(t),s=e.indexOf("CTRL")>-1,l=e.indexOf("SHIFT")>-1;s||l?(s&&(r?o.deselectRow(t):(n&&o.clearRowSelection(),o.selectRow(t))),l&&(o.clear(),o.selectRow(this.lastEdgeSelection[1],t))):(o.clear(),r||o.selectRow(t)),r||l||(this.lastEdgeSelection[1]=t),this.repaint()}},selectViewportCell:function(t,e){var i=this.getHeaderRowCount(),n=this.getRenderer(),o=n.getVisibleColumns()[t],r=n.getVisibleRows()[e];this.clearSelections(),this.select(o,r+i,0,0),this.setMouseDown(this.newPoint(o,r+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToViewportCell:function(t,e){var i=this.getSelections();if(i&&0!==i.length){var n=this.getHeaderRowCount(),o=this.getRenderer(),r=o.getVisibleColumns()[t],s=o.getVisibleRows()[e]+n,l=i[0],a=l.origin;this.setDragExtent(this.newPoint(r-a.x,s-a.y)),this.select(a.x,a.y,r-a.x,s-a.y),this.repaint()}},selectFinalCellOfCurrentRow:function(){var t=this.getColumnCount()-1,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.scrollBy(this.getColumnCount(),0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFinalCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent,o=this.getColumnCount();this.scrollBy(o,0),this.clearSelections(),this.select(i.x,i.y,o-i.x-1,n.y),this.repaint()}},selectFirstCellOfCurrentRow:function(){var t=0,e=this.getSelectedRows()[0],i=this.getHeaderRowCount();this.clearSelections(),this.setHScrollValue(0),this.select(t,e+i,0,0),this.setMouseDown(this.newPoint(t,e+i)),this.setDragExtent(this.newPoint(0,0)),this.repaint()},selectToFirstCellOfCurrentRow:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=e.extent;this.clearSelections(),this.select(i.x,i.y,-i.x,n.y),this.setHScrollValue(0),this.repaint()}},selectFinalCell:function(){this.selectCell(this.getColumnCount()-1,this.getRowCount()-1),this.scrollBy(this.getColumnCount(),this.getRowCount()),this.repaint()},selectToFinalCell:function(){var t=this.getSelections();if(t&&0!==t.length){var e=t[0],i=e.origin,n=this.getColumnCount(),o=this.getRowCount();this.clearSelections(),this.select(i.x,i.y,n-i.x-1,o-i.y-1),this.scrollBy(n,o),this.repaint()}},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isEditable:function(){return this.resolveProperty("editable")===!0},isShowFilterRow:function(){return this.resolveProperty("showFilterRow")},isShowHeaderRow:function(){return this.resolveProperty("showHeaderRow")},getHeaderRowCount:function(){return this.getBehavior().getHeaderRowCount()},isFilterRow:function(t){return t===this.getFilterRowIndex()},getFilterRowIndex:function(){return this.isShowFilterRow()?this.isShowHeaderRow()?1:0:-1},setGroups:function(t){this.getBehavior().setGroups(t)},filterClicked:function(t){this.activateEditor(t.gridCell.x,t.gridCell.y)},hasHierarchyColumn:function(){return this.getBehavior().hasHierarchyColumn()},isHierarchyColumn:function(t){return this.hasHierarchyColumn()?0===t:!1},checkScrollbarVisibility:function(){},isColumnOrRowSelected:function(){return this.getSelectionModel().isColumnOrRowSelected()},selectColumn:function(t,e){this.getSelectionModel().selectColumn(t,e)},selectRow:function(t,e){this.isSingleRowSelectionMode()?(this.getSelectionModel().clearRowSelection(),t=e):e=e||t;var i=Math.min(t,e),n=Math.max(t,e),o=this.getFilterRowIndex()+1;o>i||this.getSelectionModel().selectRow(i,n)},isRowNumberAutosizing:function(){return this.resolveProperty("rowNumberAutosizing")},isRowSelected:function(t){return this.getSelectionModel().isRowSelected(t)},isColumnSelected:function(t){return this.getSelectionModel().isColumnSelected(t)},lookupFeature:function(t){return this.getBehavior().lookupFeature(t)},getRow:function(t){return this.getBehavior().getRow(t)},getFieldName:function(t){return this.getBehavior().getFieldName(t)},getColumnIndex:function(t){return this.getBehavior().getColumnIndex(t)},isCellSelection:function(){return this.resolveProperty("cellSelection")===!0},isRowSelection:function(){return this.resolveProperty("rowSelection")===!0},isColumnSelection:function(){return this.resolveProperty("columnSelection")===!0},getComputedRow:function(t){return this.getBehavior().getComputedRow(t)},isColumnAutosizing:function(){return this.resolveProperty("columnAutosizing")===!0},setGlobalFilter:function(t){this.getBehavior().setGlobalFilter(t)},selectRowsFromCells:function(){var t=this.getSelectionModel();if(this.isSingleRowSelectionMode()){var e=t.getLastSelection();e?this.selectRow(null,e.corner.y):t.clearRowSelection()}else t.selectRowsFromCells()},selectColumnsFromCells:function(){this.getSelectionModel().selectColumnsFromCells()},getSelectedRows:function(){return this.getBehavior().getSelectedRows()},getSelectedColumns:function(){return this.getBehavior().getSelectedColumns()},getSelections:function(){return this.getBehavior().getSelections()},getLastSelectionType:function(){return this.getSelectionModel().getLastSelectionType()},isCellSelected:function(t,e){return this.getSelectionModel().isCellSelected(t,e)},isInCurrentSelectionRectangle:function(t,e){return this.getSelectionModel().isInCurrentSelectionRectangle(t,e)},selectAllRows:function(){this.getSelectionModel().selectAllRows()},areAllRowsSelected:function(){return this.getSelectionModel().areAllRowsSelected()},toggleSelectAllRows:function(){this.areAllRowsSelected()?this.getSelectionModel().clear():this.selectAllRows(),this.repaint()},getField:function(t){return this.getBehavior().getField(t)},isSingleRowSelectionMode:function(){return this.resolveProperty("singleRowSelectionMode")},newPoint:function(t,e){return new p(t,e)},newRectangle:function(t,e,i,n){return new v(t,e,i,n)}},r.fontData={},e.exports=n},{"./Renderer":34,"./SelectionModel":35,"./stylesheets":73,"extend-me":3,finbars:4,fincanvas:5,"lru-cache":26,"object-iterators":28,rectangular:29}],34:[function(t,e,i){"use strict";function n(t,e,i){var n=e.getColumnProperties(-1),o=n.rowHeader,r=e.getImage("checked");t.font=o.font,n.preferredWidth=r.width+7+o.getTextWidth(t,i+1); +}var o=t("object-iterators"),r=t("extend-me").Base,s=r.extend("Renderer",{cell:{x:0,y:0,width:0,height:0},scrollHeight:0,viewHeight:0,reset:function(){this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},initialize:function(t){this.grid=t,this.bounds={width:0,height:0},this.columnEdges=[],this.columnEdgesIndexMap={},this.renderedColumnMinWidths=[],this.renderedHeight=0,this.rowEdges=[],this.rowEdgesIndexMap={},this.visibleColumns=[],this.visibleRows=[],this.insertionBounds=[]},computeCellsBounds:function(){var t=this.getGrid(),e=this.getScrollTop(),i=this.getScrollLeft(),n=this.getColumnCount(),o=this.getFixedColumnCount(),r=this.getRowCount(),s=this.getFixedRowCount(),l=this.getBounds(),a=l.width;0===a&&(a=t.canvas.width);var u,c,h,d,g,f,p,v,m=l.height;this.getColumnEdges().length=0,this.rowEdges.length=0,this.columnEdges[0]=0,this.rowEdges[0]=0,this.scrollHeight=0,this.visibleColumns.length=0,this.visibleRows.length=0,this.columnEdgesIndexMap={},this.rowEdgesIndexMap={},this.insertionBounds=[];var A=0,C=0;u=0;var w,S,x,y,b=0;for(t.isShowRowNumbers()&&(b--,this.columnEdges[-1]=-1),h=b;n>h&&(g=h,h>=o&&(g+=i,void 0===w&&(w=g),S=g),!(u>a||g>=n));h++)p=this.getColumnWidth(g),u+=p,this.columnEdges[h+1]=Math.round(u),this.visibleColumns[h]=g,this.columnEdgesIndexMap[g]=h,A=A+Math.round(p/2)+C,this.insertionBounds.push(A),C=Math.round(p/2);for(c=0,d=0;r>d&&(f=d,d>=s&&(f+=e,void 0===x&&(x=f),y=f),!(c>m||f>=r));d++)v=this.getRowHeight(f),c+=v,this.rowEdges[d+1]=Math.round(c),this.visibleRows[d]=f,this.rowEdgesIndexMap[f]=d;this.viewHeight=m,this.dataWindow=t.newRectangle(w,x,S-w,y-x)},resolveProperty:function(t){return this.getGrid().resolveProperty(t)},getGrid:function(){return this.grid},_paint:function(t){this.grid&&(this.renderGrid(t),this.getGrid().gridRenderedNotification())},getVisibleRowsCount:function(){return this.visibleRows.length-1},getVisibleScrollHeight:function(){var t=this.getGrid(),e=t.getFixedRowsHeight();return this.viewHeight-e},getVisibleRows:function(){return this.visibleRows},getVisibleColumnsCount:function(){return this.visibleColumns.length-1},getVisibleColumns:function(){return this.visibleColumns},overColumnDivider:function(t){t=Math.round(t);var e=this.getColumnEdges(),i=e.indexOf(t-1);return 0>i&&(i=e.indexOf(t)),0>i&&(i=e.indexOf(t-2)),0>i&&(i=e.indexOf(t+1)),0>i&&(i=e.indexOf(t-3)),i},overRowDivider:function(t){t=Math.round(t);var e=this.rowEdges.indexOf(t+1);return 0>e&&(e=this.rowEdges.indexOf(t)),0>e&&(e=this.rowEdges.indexOf(t-1)),e},getBoundsOfCell:function(t){return this._getBoundsOfCell(t.x,t.y)},_getBoundsOfCell:function(t,e){var i=!1,n=!1,o=this.getColumnEdges(),r=this.getRowEdges(),s=this.columnEdgesIndexMap[t],l=this.rowEdgesIndexMap[e];void 0===s&&(s=this.columnEdgesIndexMap[t-1],i=!0),void 0===l&&(l=this.rowEdgesIndexMap[e-1],n=!0);var a=o[s],u=r[l],c=o[s+1],h=r[l+1],d=c-a,g=h-u,f=this.cell;return f.x=i?c:a,f.y=n?h:u,f.width=i?0:d,f.height=n?0:g,f},getColumnFromPixelX:function(t){var e,i=0,n=this.getGrid(),o=this.getFixedColumnCount(),r=n.getHScrollValue(),s=this.getColumnEdges();for(e=1;et)return e>o&&(e+=r),e-1;return e>o&&(e+=r),e-1},getGridCellFromMousePoint:function(t){var e,i,n,o,r=this.getGrid(),s=r.getBehavior(),l=0,a=0,u=0,c=this.getColumnEdges(),h=this.getFixedColumnCount(),d=this.getFixedRowCount(),g=this.getScrollLeft(),f=this.getScrollTop();for(n=0;n=h&&(n+=g),o>=d&&(o+=f);var v=-1,m=s.getColumn(n);return m&&(v=m.index),{gridCell:r.newPoint(n,o),mousePoint:r.newPoint(e,i),viewPoint:p,dataCell:r.newPoint(v,o)}},isColumnVisible:function(t){var e=-1!==this.visibleColumns.indexOf(t);return e},getFinalVisableColumnBoundry:function(){var t=this.isLastColumnVisible(),e=t?2:1,i=this.getColumnEdges()[this.getColumnEdges().length-e],n=Math.min(i,this.getBounds().width-200);return n},isRowVisible:function(t){var e=-1!==this.visibleRows.indexOf(t);return e},isSelected:function(t,e){return this.getGrid().isSelected(t,e)},renderGrid:function(t){t.beginPath(),this.paintCells(t),this.paintGridlines(t),this.renderOverrides(t),this.renderFocusCell(t),t.closePath()},focusLineStep:[[5,5],[0,1,5,4],[0,2,5,3],[0,3,5,2],[0,4,5,1],[0,5,5,0],[1,5,4,0],[2,5,3,0],[3,5,2,0],[4,5,1,0]],renderFocusCell:function(t){t.beginPath(),this._renderFocusCell(t),t.closePath()},_renderFocusCell:function(t){var e=this.getGrid(),i=e.getSelectionModel().getSelections();if(i&&0!==i.length){var n=i[i.length-1],o=n.origin;if(-1!==o.x){var r=this.getVisibleColumns(),s=this.getVisibleRows(),l=r[r.length-1],a=s[s.length-1],u=n.extent,c=Math.min(o.x,o.x+u.x),h=Math.min(o.y,o.y+u.y);if(!(c>l||h>a)){var d=Math.max(o.x,o.x+u.x)+1;d=Math.min(d,1+l);var g=Math.max(o.y,o.y+u.y)+1;g=Math.min(g,1+a);var f=this._getBoundsOfCell(c,h),p=Math.round(void 0===f.x?e.getFixedColumnsWidth():f.x),v=Math.round(void 0===f.y?e.getFixedRowsHeight():f.y),m=this._getBoundsOfCell(d,g),A=Math.round(void 0===m.x?e.getFixedColumnsWidth():m.x),C=Math.round(void 0===m.y?e.getFixedRowsHeight():m.y),w=Math.min(p,A),S=Math.min(v,C),x=1+A-p,y=1+C-v;w===A&&(x=p-A),S===C&&(y=v-C),1>x*y||(t.rect(w,S,x,y),t.fillStyle="rgba(0, 0, 0, 0.2)",t.fill(),t.lineWidth=1,t.strokeStyle="black",t.stroke(),t.stroke())}}}},blankOutOverflow:function(t){var e=this.isLastColumnVisible(),i=e?1:0,n=this.getColumnEdges()[this.getColumnEdges().length-i],o=this.getBounds(),r=o.width-200-n,s=o.height;t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(n+1,0,r,s)},renderOverrides:function(t){var e=this.getGrid(),i=e.renderOverridesCache;for(var n in i)if(i.hasOwnProperty(n)){var o=i[n];o&&this.renderOverride(t,o)}},renderOverride:function(t,e){var i=e.hdpiratio,n=e.startX,o=e.width+1,r=e.height,s=e.ctx,l=t.getImageData(n,0,Math.round(o*i),Math.round(r*i));s.putImageData(l,0,0),t.fillStyle=this.resolveProperty("backgroundColor2"),t.fillRect(Math.round(n/i),0,o,r)},isHovered:function(t,e){return this.getGrid().isHovered(t,e)},isRowHovered:function(t){return this.getGrid().isRowHovered(t)},isColumnHovered:function(t){return this.getGrid().isColumnHovered(t)},paintCells:function(t){try{t.save(),this._paintCells(t)}catch(e){console.error(e)}finally{t.restore()}},isCellSelectedInRow:function(t){return this.getGrid().isCellSelectedInRow(t)},isCellSelectedInColumn:function(t){return this.getGrid().isCellSelectedInColumn(t)},getScrollTop:function(){var t=this.getGrid().getVScrollValue();return t},getScrollLeft:function(){var t=this.getGrid().getHScrollValue();return t},getBehavior:function(){return this.getGrid().getBehavior()},getColumnEdges:function(){return this.columnEdges},getRowEdges:function(){return this.rowEdges},getRowHeight:function(t){var e=this.getBehavior().getRowHeight(t);return e},getColumnWidth:function(t){var e=this.getGrid().getColumnWidth(t);return e},isLastColumnVisible:function(){var t=this.getColumnCount()-1,e=-1!==this.visibleColumns.indexOf(t);return e},getRenderedWidth:function(t){return this.getColumnEdges()[t]},getRenderedHeight:function(t){return this.rowEdges[t]},getCanvas:function(){return this.getGrid().getCanvas()},isDraggingColumn:function(){return this.getGrid().isDraggingColumn()},getPageUpRow:function(){for(var t=this.getBehavior(),e=this.getVisibleScrollHeight(),i=this.getGrid().getFixedRowCount(),n=this.dataWindow.origin.y-i,o=0;e>o&&n>-1;)o+=t.getRowHeight(n),n--;return n+1},getPageDownRow:function(){var t=this.getGrid().getFixedRowCount(),e=this.dataWindow.corner.y-t-1;return e},getColumnCount:function(){return this.getGrid().getColumnCount()},getRowCount:function(){return this.getGrid().getRowCount()},getFixedColumnCount:function(){return this.getGrid().getFixedColumnCount()},getFixedRowCount:function(){return this.getGrid().getFixedRowCount()},getHeaderRowCount:function(){return this.getGrid().getHeaderRowCount()},getHeaderColumnCount:function(){return this.getGrid().getHeaderColumnCount()},_paintCells:function(t){var e,i,o,r=0,s=this.getColumnEdges(),l=this.rowEdges;this.buttonCells={};var a=this.getVisibleColumns(),u=this.getVisibleRows(),c=s[s.length-1],h=l[l.length-1];t.moveTo(0,0),t.rect(0,0,c,h),t.stroke(),t.clip();var d=a.length,g=0;for(this.getGrid().isShowRowNumbers()&&g--,e=g;d>e;e++)for(o=a[e],this.renderedColumnMinWidths[o]=0,i=0;ii,d=n.isFilterRow(i),g=n.isHierarchyColumn(e),f=n.isRowSelected(i),p=n.isColumnSelected(e),v=n.isCellSelected(e,i),m=n.isCellSelectedInColumn(e),A=n.isCellSelectedInRow(i),C=n.areAllRowsSelected();c&&-1===e||g?(f?(s=s.rowHeaderRowSelection,l=Object.create(s),l.isSelected=!0):(s=s.rowHeader,l=Object.create(s),l.isSelected=A),l.isUserDataArea=!1):h?(d?(s=s.filterProperties,l=Object.create(s),l.isSelected=!1):p?(s=s.columnHeaderColumnSelection,l=Object.create(s),l.isSelected=!0):(s=s.columnHeader,l=Object.create(s),l.isSelected=m),l.isUserDataArea=!1):g?(s=s.rowHeader,l=Object.create(s),l.isSelected=A):(l=Object.create(s),l.isSelected=v||f||p,l.isUserDataArea=!0);var w=i-u+1;if(-1===e){var S=f?"checked":"unchecked";l.value=h?"":[r.getImage(S),w,null],0===i?(S=C?"checked":"unchecked",l.value=[r.getImage(S),"",null]):d&&(l.value=[r.getImage("filter-off"),"",null]),l.halign="right"}else l.value=n.getValue(e,i),l.halign=n.getColumnAlignment(e);l.isColumnHovered=this.isRowHovered(e,i),l.isRowHovered=this.isColumnHovered(e,i),l.bounds=this._getBoundsOfCell(e,i),l.isCellSelected=v,l.isRowSelected=f,l.isColumnSelected=p,l.isInCurrentSelectionRectangle=n.isInCurrentSelectionRectangle(e,i);var x=n.mouseDownState;if(x){var y=x.gridCell;l.mouseDown=y.x===e&&y.y===i}l.x=e,l.y=i,r.cellPropertiesPrePaintNotification(l);var b=r.getCellRenderer(l,e,i),E=r.getCellProperties(e,i);o(l).extendOwn(E),l.buttonCells=this.buttonCells,b.paint(t,l),this.renderedColumnMinWidths[e]=Math.max(l.minWidth||0,this.renderedColumnMinWidths[e]),a.preferredWidth=this.renderedColumnMinWidths[e]}},isViewableButton:function(t,e){var i=t+","+e;return this.buttonCells[i]===!0},getRowNumbersWidth:function(){var t=this.getColumnEdges();return 0===t.length?0:t[0]},startAnimator:function(){var t,e=this;t=function(){e.animate(),requestAnimationFrame(t)},requestAnimationFrame(t)},animate:function(){var t=this.getCanvas().canvasCTX;t.beginPath(),t.save(),this.renderFocusCell(t),t.restore(),t.closePath()},getBounds:function(){return this.bounds},setBounds:function(t){return this.bounds=t}});e.exports=s},{"extend-me":3,"object-iterators":28}],35:[function(t,e,i){"use strict";function n(){this.selections=[],this.flattenedX=[],this.flattenedY=[],this.rowSelectionModel=new o,this.columnSelectionModel=new o,this.setLastSelectionType("")}var o=t("sparse-boolean-array");n.prototype={allRowsSelected:!1,getGrid:function(){return null},getLastSelection:function(){var t=this.selections,e=t[t.length-1];return e},getLastSelectionType:function(){return this.lastSelectionType},setLastSelectionType:function(t){this.lastSelectionType=t},select:function(t,e,i,n){var o=this.getGrid().newRectangle(t,e,i,n);this.selections.push(o),this.flattenedX.push(o.flattenXAt(0)),this.flattenedY.push(o.flattenYAt(0)),this.setLastSelectionType("cell"),this.getGrid().selectionChanged()},toggleSelect:function(t,e,i,n){var o,r;o=this.selections.find(function(o,s){return r=s,o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n}),o?(this.selections.splice(r,1),this.flattenedX.splice(r,1),this.flattenedY.splice(r,1),this.getGrid().selectionChanged()):this.select(t,e,i,n)},clearMostRecentSelection:function(){this.allRowsSelected=!1,this.selections.length=Math.max(0,this.selections.length-1),this.flattenedX.length=Math.max(0,this.flattenedX.length-1),this.flattenedY.length=Math.max(0,this.flattenedY.length-1)},clearMostRecentColumnSelection:function(){this.columnSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("column")},clearMostRecentRowSelection:function(){this.rowSelectionModel.clearMostRecentSelection(),this.setLastSelectionType("row")},clearRowSelection:function(){this.rowSelectionModel.clear(),this.setLastSelectionType("row")},getSelections:function(){return this.selections},hasSelections:function(){return 0!==this.selections.length},hasRowSelections:function(){return!this.rowSelectionModel.isEmpty()},hasColumnSelections:function(){return!this.columnSelectionModel.isEmpty()},isCellSelectedInRow:function(t){return this._isCellSelected(this.flattenedX,0,t)},isCellSelectedInColumn:function(t){return this._isCellSelected(this.flattenedY,t,0)},isSelected:function(t,e){return this.isColumnSelected(t)||this.isRowSelected(e)||this._isCellSelected(this.selections,t,e)},isCellSelected:function(t,e){return this._isCellSelected(this.selections,t,e)},_isCellSelected:function(t,e,i){var n=this;return!!t.find(function(t){return n.rectangleContains(t,e,i)})},clear:function(){this.allRowsSelected=!1,this.selections.length=0,this.flattenedX.length=0,this.flattenedY.length=0,this.rowSelectionModel.clear(),this.columnSelectionModel.clear()},isRectangleSelected:function(t,e,i,n){return!!this.selections.find(function(o){return o.origin.x===t&&o.origin.y===e&&o.extent.x===i&&o.extent.y===n})},isColumnSelected:function(t){return this.columnSelectionModel.isSelected(t)},isRowSelected:function(t){return this.allRowsSelected||this.rowSelectionModel.isSelected(t)},selectColumn:function(t,e){this.columnSelectionModel.select(t,e),this.setLastSelectionType("column")},selectAllRows:function(){this.clear(),this.allRowsSelected=!0},areAllRowsSelected:function(){return this.allRowsSelected},selectRow:function(t,e){this.rowSelectionModel.select(t,e),this.setLastSelectionType("row")},deselectColumn:function(t,e){this.columnSelectionModel.deselect(t,e),this.setLastSelectionType("column")},deselectRow:function(t,e){this.rowSelectionModel.deselect(t,e),this.setLastSelectionType("row")},getSelectedRows:function(){if(this.areAllRowsSelected()){for(var t=this.getGrid(),e=t.getHeaderRowCount(),i=t.getRowCount()-e,n=new Array(i),o=0;i>o;o++)n[o]=o+e;return n}return this.rowSelectionModel.getSelections()},getSelectedColumns:function(){return this.columnSelectionModel.getSelections()},isColumnOrRowSelected:function(){return!this.columnSelectionModel.isEmpty()||!this.rowSelectionModel.isEmpty()},getFlattenedYs:function(){var t=[],e={};return this.selections.forEach(function(i){for(var n=i.origin.y,o=i.extent.y+1,r=0;o>r;r++){var s=r+n;e[s]||(t.push(s),e[s]=!0)}}),t.sort(function(t,e){return t-e}),t},selectRowsFromCells:function(t){t=t||0;var e=this.rowSelectionModel;this.allRowsSelected=!1,e.clear(),this.selections.forEach(function(i){var n=i.origin.y,o=i.extent.y;e.select(n+t,n+o+t)})},selectColumnsFromCells:function(t){t=t||0;var e=this.columnSelectionModel;e.clear(),this.selections.forEach(function(i){var n=i.origin.x,o=i.extent.x;e.select(n+t,n+o+t)})},isInCurrentSelectionRectangle:function(t,e){var i=this.selections[this.selections.length-1];return i&&this.rectangleContains(i,t,e)},rectangleContains:function(t,e,i){var n=t.origin.x,o=t.origin.y,r=n+t.extent.x,s=o+t.extent.y;t.extent.x<0&&(n=r,r=t.origin.x),t.extent.y<0&&(o=s,s=t.origin.y);var l=e>=n&&i>=o&&r>=e&&s>=i;return l}},e.exports=n},{"sparse-boolean-array":30}],36:[function(t,e,i){"use strict";var n=t("object-iterators"),o=t("extend-me").Base,r=t("./Column"),s=t("./images"),l=t("../CellProvider"),a=["columnHeader","columnHeaderColumnSelection","filterProperties","rowHeader","rowHeaderRowSelection","rowNumbersProperties","treeColumnProperties","treeColumnPropertiesColumnSelection"],u=o.extend("Behavior",{initialize:function(t){t.setBehavior(this),this.initializeFeatureChain(t),this.getDataModel(),this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={}},initializeFeatureChain:function(t){var e=this;this.features.forEach(function(t){e.setNextFeature(new t)}),this.featureChain.initializeOn(t)},features:[],tableState:null,grid:null,editorTypes:["choice","textfield","color","slider","spinner","date"],featureChain:null,dataModel:null,baseModel:null,scrollPositionX:0,scrollPositionY:0,featureMap:{},allColumns:[],columns:[],reset:function(){this.cellProvider=this.createCellProvider(),this.renderedColumnCount=30,this.renderedRowCount=60,this.dataUpdates={},this.clearColumns(),this.clearState(),this.getDataModel().reset(),this.createColumns()},clearColumns:function(){this.columns=[],this.allColumns=[],this.columns[-1]=this.newColumn(-1,""),this.columns[-2]=this.newColumn(-2,"Tree"),this.allColumns[-1]=this.columns[-1],this.allColumns[-2]=this.columns[-2]},getColumn:function(t){return this.columns[t]},getColumnId:function(t){return this.getColumn(t).label},newColumn:function(t,e){var i=this.createColumnProperties();return this.getPrivateState().columnProperties[t]=i,new r(this,t,e)},addColumn:function(t,e){var i=this.newColumn(t,e);return this.columns.push(i),this.allColumns.push(i),i},createColumns:function(){},createColumnProperties:function(){var t=this.getPrivateState(),e=Object.create(t);return e.rowNumbersProperties=Object.create(e,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.rowHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.rowHeaderFont},set:function(t){this.rowHeaderFont=t}},color:{configurable:!0,get:function(){return this.rowHeaderColor},set:function(t){this.rowHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundColor},set:function(t){this.rowHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundSelectionColor},set:function(t){this.rowHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundSelectionColor},set:function(t){this.rowHeaderBackgroundSelectionColor=t}}}),e.columnHeader=Object.create(e,{font:{configurable:!0,get:function(){return this.columnHeaderFont},set:function(t){this.columnHeaderFont=t}},color:{configurable:!0,get:function(){return this.columnHeaderColor},set:function(t){this.columnHeaderColor=t}},backgroundColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColor},set:function(t){this.columnHeaderBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundSelectionColor},set:function(t){this.columnHeaderForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundSelectionColor},set:function(t){this.columnHeaderBackgroundSelectionColor=t}}}),e.columnHeaderColumnSelection=Object.create(e.columnHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderForegroundColumnSelectionColor},set:function(t){this.columnHeaderForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.columnHeaderBackgroundColumnSelectionColor},set:function(t){this.columnHeaderBackgroundColumnSelectionColor=t}}}),e.rowHeaderRowSelection=Object.create(e.rowHeader,{foregroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderForegroundRowSelectionColor},set:function(t){this.rowHeaderForegroundRowSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.rowHeaderBackgroundRowSelectionColor},set:function(t){this.rowHeaderBackgroundRowSelectionColor=t}}}),e.filterProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.filterFont},set:function(t){this.filterFont=t}},color:{configurable:!0,get:function(){return this.filterColor},set:function(t){this.filterColor=t}},backgroundColor:{configurable:!0,get:function(){return this.filterBackgroundColor},set:function(t){this.filterBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.filterForegroundSelectionColor},set:function(t){this.filterForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.filterBackgroundSelectionColor},set:function(t){this.filterBackgroundSelectionColor=t}},cellBorderStyle:{configurable:!0,get:function(){return this.filterCellBorderStyle},set:function(t){this.filterCellBorderStyle=t}},cellBorderThickness:{configurable:!0,get:function(){return this.filterCellBorderThickness},set:function(t){this.filterCellBorderThickness=t}}}),e.treeColumnProperties=Object.create(e,{font:{configurable:!0,get:function(){return this.treeColumnFont},set:function(t){this.treeColumnFont=t}},color:{configurable:!0,get:function(){return this.treeColumnColor},set:function(t){this.treeColumnColor=t}},backgroundColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColor},set:function(t){this.treeColumnBackgroundColor=t}},foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundSelectionColor},set:function(t){this.treeColumnForegroundSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundSelectionColor},set:function(t){this.treeColumnBackgroundSelectionColor=t}}}),e.treeColumnPropertiesColumnSelection=Object.create(e.treeColumnProperties,{foregroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnForegroundColumnSelectionColor},set:function(t){this.treeColumnForegroundColumnSelectionColor=t}},backgroundSelectionColor:{configurable:!0,get:function(){return this.treeColumnBackgroundColumnSelectionColor},set:function(t){this.treeColumnBackgroundColumnSelectionColor=t}}}),e},getColumnWidth:function(t){var e=this.getColumn(t);if(!e)return this.resolveProperty("defaultColumnWidth");var i=e.getWidth();return i},setColumnWidth:function(t,e){this.getColumn(t).setWidth(e),this.stateChanged()},getDataModel:function(){if(null===this.dataModel){var t=this.getDefaultDataModel();this.setDataModel(t)}return this.dataModel},getCellRenderer:function(t,e,i){return this.getColumn(e).getCellRenderer(t,i)},setDataModel:function(t){this.dataModel=t},clearObjectProperties:function(t,e){for(var i in t)t.hasOwnProperty(i)&&(void 0===e||!e&&a.indexOf(i)>=0||e&&a.indexOf(i)<0)&&delete t[i]},getPrivateState:function(){return this.tableState||(this.tableState=this.getDefaultState()),this.tableState},getState:function(){var t=JSON.parse(JSON.stringify(this.getPrivateState()));return this.clearObjectProperties(t.columnProperties,!0),t},clearState:function(){this.tableState=null},getDefaultState:function(){var t=this.getGrid()._getProperties(),e=Object.create(t);return n(e).extendOwn({rowHeights:{},cellProperties:{},columnProperties:[]}),e},setState:function(t){if(!t.columnIndexes){var e=this.getFields();t.columnIndexes=[];for(var i=0;ii;i++)e+=this.getRowHeight(i);return e},getRowHeight:function(t){var e=this.getPrivateState();if(e.rowHeights){var i=e.rowHeights[t];if(i)return i}return this.getDefaultRowHeight()},getDefaultRowHeight:function(){return this.defaultRowHeight||(this.defaultRowHeight=this.resolveProperty("defaultRowHeight")),this.defaultRowHeight},setRowHeight:function(t,e){var i=this.getPrivateState();i.rowHeights[t]=Math.max(5,e),this.stateChanged()},getFixedRowsMaxHeight:function(){return this.getFixedRowsHeight()},getFixedColumnsWidth:function(){var t=this.getFixedColumnCount(),e=0;this.getGrid().isShowRowNumbers()&&(e=this.getColumnWidth(-1));for(var i=0;t>i;i++)e+=this.getColumnWidth(i);return e},getFixedColumnsMaxWidth:function(){var t=this.getFixedColumnsWidth();return t},_setScrollPositionY:function(t){this.setScrollPositionY(t),this.changed()},_setScrollPositionX:function(t){this.setScrollPositionX(t),this.changed()},setRenderedColumnCount:function(t){this.renderedColumnCount=t},setRenderedRowCount:function(t){this.renderedRowCount=t},_fixedRowClicked:function(t,e){var i=this.translateColumnIndex(this.getScrollPositionX()+e.gridCell.x-this.getFixedColumnCount()),n=this.grid.newPoint(i,e.gridCell.y);e.gridCell=n,this.fixedRowClicked(t,e)},_fixedColumnClicked:function(t,e){var i=this.grid.newPoint(e.gridCell.x,this.getScrollPositionY()+e.gridCell.y-this.getFixedRowCount());e.gridCell=i,this.fixedColumnClicked(t,e)},moveSingleSelect:function(t,e,i){this.featureChain&&(this.featureChain.moveSingleSelect(t,e,i),this.setCursor(t))},setCursor:function(t){t.updateCursor(),this.featureChain.setCursor(t)},onMouseMove:function(t,e){this.featureChain&&(this.featureChain.handleMouseMove(t,e),this.setCursor(t))},onTap:function(t,e){this.featureChain&&(this.featureChain.handleTap(t,e),this.setCursor(t))},onContextMenu:function(t,e){var i=t.fireSyntheticContextMenuEvent(e);i&&this.featureChain&&(this.featureChain.handleContextMenu(t,e),this.setCursor(t))},onWheelMoved:function(t,e){this.featureChain&&(this.featureChain.handleWheelMoved(t,e),this.setCursor(t))},onMouseUp:function(t,e){this.featureChain&&(this.featureChain.handleMouseUp(t,e),this.setCursor(t))},onMouseDrag:function(t,e){this.featureChain&&(this.featureChain.handleMouseDrag(t,e),this.setCursor(t))},onKeyDown:function(t,e){this.featureChain&&(this.featureChain.handleKeyDown(t,e),this.setCursor(t))},onKeyUp:function(t,e){this.featureChain&&(this.featureChain.handleKeyUp(t,e),this.setCursor(t))},onDoubleClick:function(t,e){this.featureChain&&(this.featureChain.handleDoubleClick(t,e),this.setCursor(t))},onHoldPulse:function(t,e){this.featureChain&&(this.featureChain.handleHoldPulse(t,e),this.setCursor(t))},toggleColumnPicker:function(){this.featureChain&&this.featureChain.toggleColumnPicker(this.getGrid())},handleMouseDown:function(t,e){this.featureChain&&(this.featureChain.handleMouseDown(t,e),this.setCursor(t))},handleMouseExit:function(t,e){this.featureChain&&(this.featureChain.handleMouseExit(t,e),this.setCursor(t))},changed:function(){},shapeChanged:function(){},isColumnReorderable:function(){return!0},getColumnProperties:function(t){var e=this.columns[t];if(!e)return{isNull:!0};var i=e.getProperties();return i?i:{isNull:!0}},setColumnProperties:function(t,e){var i=this.getColumnProperties(t);n(i).extendOwn(e),this.changed()},getColumnDescriptors:function(){this.insureColumnIndexesAreInitialized();for(var t=this.getPrivateState(),e=t.columnIndexes.length,i=[],n=0;e>n;n++){var o=t.columnIndexes[n];i.push({id:o,label:this.getHeader(o),field:this.getField(o)})}return i},getField:function(t){if(-1===t)return"tree";var e=this.getColumn(t);return e.getField()},getHeader:function(t){if(-1===t)return"Tree";var e=this.getColumn(t);return e.getHeader()},setColumnDescriptors:function(t){var e,i=t.visible,n=this.getPrivateState(),o=i.length,r=[];for(e=0;o>e;e++)r.push(i[e].id);n.columnIndexes=r,this.changed()},getHiddenColumnDescriptors:function(){for(var t=this.getPrivateState(),e=t.columnIndexes,i=[],n=this.getColumnCount(),o=0;n>o;o++)-1===e.indexOf(o)&&i.push({id:o,label:this.getHeader(o),field:this.getField(o)});return i},hideColumns:function(t){for(var e=this.getPrivateState(),i=e.columnIndexes,n=0;no;o++){var r=i[o],s=this.addColumn(o,r),l=s.getProperties();l.field=n[o],l.header=r}},getDefaultDataModel:function(){var t=new s,e=new r(this.getGrid(),t);return e.setComponent(t),e},setHeaders:function(t){this.getDataModel().setHeaders(t)},getHeaders:function(){return this.getDataModel().getHeaders()},setFields:function(t){this.getDataModel().setFields(t),this.createColumns()},getFields:function(){return this.getDataModel().getFields()},setData:function(t){this.getDataModel().setData(t),this.createColumns();var e=this;this.getGrid().isColumnAutosizing()?(setTimeout(function(){e.autosizeAllColumns()},100),e.changed()):setTimeout(function(){e.allColumns[-1].checkColumnAutosizing(!0),e.changed()})},getData:function(){return this.getDataModel().getData()},getCellEditorAt:function(t,e){var i=this.getGrid();return i.isFilterRow(e)?i.cellEditors.textfield:void 0},setTopTotals:function(t){this.getDataModel().setTopTotals(t)},getTopTotals:function(){return this.getDataModel().getTopTotals()},setColumns:function(t){this.getDataModel().setColumns(t)},enhanceDoubleClickEvent:function(t){t.row=this.getRow(t.gridCell.y)},setDataProvider:function(t){this.getDataModel().setDataProvider(t)},hasHierarchyColumn:function(){return this.getDataModel().hasHierarchyColumn()},getColumnAlignment:function(t){return 0===t&&this.hasHierarchyColumn()?"left":"center"},getRowSelectionMatrix:function(t){return this.getDataModel().getRowSelectionMatrix(t)},getColumnSelectionMatrix:function(t){return this.getDataModel().getColumnSelectionMatrix(t)},getSelectionMatrix:function(t){return this.getDataModel().getSelectionMatrix(t)},getRowSelection:function(){var t=this.getSelectedRows();return this.getDataModel().getRowSelection(t)},getColumnSelection:function(){var t=this.getSelectedColumns();return this.getDataModel().getColumnSelection(t)},getSelection:function(){var t=this.getSelections();return this.getDataModel().getSelection(t)},openEditor:function(t){if(!this.isColumnReorderable())return!1;var e={cssStylesheetReferenceElement:t},i={models:this.getGroups(),title:"Groups"},o={models:this.getAvailableGroups(),title:"Available Groups"},r={models:this.getHiddenColumns(),title:"Hidden Columns"},s={models:this.getVisibleColumns(),title:"Visible Columns"},l=new n([i,o],e),u=new n([r,s],e),c=[l,u];return a("list-dragon",t),c.forEach(function(e){e.modelLists.forEach(function(e){t.appendChild(e.container)})}),t.lists={group:i.models,availableGroups:o.models,hidden:r.models,visible:s.models},!0},getGroups:function(){return this.getDataModel().getGroups()},getAvailableGroups:function(){return this.getDataModel().getAvailableGroups()},getHiddenColumns:function(){return this.getDataModel().getHiddenColumns()},getVisibleColumns:function(){return this.getDataModel().getVisibleColumns()},setColumnDescriptors:function(t){var e=this.columns[0];this.columns.length=0,e&&"Tree"===e.label&&this.columns.push(e);for(var i=0;i0&&(n+=this.alpha(e-1)),n+=this.alpha(i)},alpha:function(t){return String.fromCharCode(o+t)}});e.exports=r},{"extend-me":3}],53:[function(t,e,i){"use strict";function n(t){return"function"==typeof t?t():t}function o(t){return function(e){return e=n(e),(e+"").toLowerCase().search(t.toLowerCase())>-1}}var r=t("hyper-analytics"),s=t("./DataModel"),l="▲",a="▼",u={isNullObject:function(){return!0},getFields:function(){return[]},getHeaders:function(){return[]},getColumnCount:function(){return 0},getRowCount:function(){return 0},getGrandTotals:function(){return[]},hasAggregates:function(){return!1},hasGroups:function(){return!1},getRow:function(){return null}},c=s.extend("dataModels.JSON",{source:u,preglobalfilter:u,prefilter:u,presorter:u,analytics:u,postfilter:u,postsorter:u,topTotals:[],hasAggregates:function(){return this.analytics.hasAggregates()},hasGroups:function(){return this.analytics.hasGroups()},getDataSource:function(){return this.analytics},getFilterSource:function(){return this.prefilter},getSortingSource:function(){return this.presorter},getValue:function(t,e){var i,n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();return n&&-2===t&&(t=0),r>e?i=this.getHeaderRowValue(t,e):(n&&(e+=1),i=this.getDataSource().getValue(t,e-r))},getHeaderRowValue:function(t,e){if(void 0===e)return this.getHeaders()[Math.max(t,0)];var i=this.getGrid(),n=i.getBehavior(),o=i.isShowFilterRow(),r=i.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)return this.getTopTotals()[e-l][t];var a,u,c=this.getFilter(t),h=0===c.length?"filter-off":"filter-on";return s?0===e?(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null]):[null,c,n.getImage(h)]:o?[null,c,n.getImage(h)]:(a=this.getHeaders()[t],u=this.getSortImageForColumn(t,!0),u&&(a=u+a),[null,a,null])},setValue:function(t,e,i){var n=this.hasHierarchyColumn(),o=this.getGrid(),r=o.getHeaderRowCount();if(n){if(-2===t)return;t+=1}r>e?this.setHeaderRowValue(t,e,i):n?e+=1:this.getDataSource().setValue(t,e-r,i),this.changed()},setHeaderRowValue:function(t,e,i){if(void 0===i)return this._setHeader(t,e);var n=this.getGrid(),o=n.isShowFilterRow(),r=n.isShowHeaderRow(),s=o&&r,l=(o?1:0)+(r?1:0);if(e>=l)this.getTopTotals()[e-l][t]=i;else{if(-1===t)return;if(s){if(0===e)return this._setHeader(t,i);this.setFilter(t,i)}else{if(!o)return this._setHeader(t,i);this.setFilter(t,i)}}return""},getColumnProperties:function(t){var e=this.getBehavior().allColumns[t];return e?e.getProperties():void 0},getFilter:function(t){var e=this.getColumnProperties(t);return e?e.filter||"":""},setFilter:function(t,e){var i=this.getColumnProperties(t);i.filter=e,this.applyAnalytics()},getColumnCount:function(){return this.analytics.getColumnCount()},getRowCount:function(){var t=this.getGrid(),e=this.getDataSource().getRowCount();return e+=t.getHeaderRowCount()},getHeaders:function(){return this.analytics.getHeaders()},setHeaders:function(t){this.getDataSource().setHeaders(t)},setFields:function(t){this.getDataSource().setFields(t)},getFields:function(){return this.getDataSource().getFields()},getData:function(){return this.source},setData:function(t){this.source=new r.JSDataSource(t),this.preglobalfilter=new r.DataSourceGlobalFilter(this.source),this.prefilter=new r.DataSourceFilter(this.preglobalfilter),this.presorter=new r.DataSourceSorterComposite(this.prefilter),this.analytics=new r.DataSourceAggregator(this.presorter),this.applyAnalytics()},getTopTotals:function(){return this.hasAggregates()?this.getDataSource().getGrandTotals():this.topTotals},setTopTotals:function(t){this.topTotals=t},setGroups:function(t){this.analytics.setGroupBys(t),this.applyAnalytics(),this.getGrid().fireSyntheticGroupsChangedEvent(this.getGroups())},getGroups:function(){for(var t=this.getHeaders().slice(0),e=this.getFields().slice(0),i=this.analytics.groupBys,n=[],o=0;or;r++){var s=t[r].index,l=this.getFilter(s);l.length>0&&i.add(s-n,o(l))}i.applyAll()},toggleSort:function(t,e){this.incrementSortState(t,e),this.applyAnalytics()},incrementSortState:function(t,e){t++;var i=this.getPrivateState(),n=e.indexOf("CTRL")>-1;i.sorts=i.sorts||[];var o=i.sorts.indexOf(t);-1===o&&(o=i.sorts.indexOf(-1*t)),o>-1?i.sorts[o]>0?i.sorts[o]=-1*i.sorts[o]:i.sorts.splice(o,1):n||0===i.sorts.length?i.sorts.unshift(t):(i.sorts.length=0,i.sorts.unshift(t)),i.sorts.length>3&&(i.sorts.length=3)},applySorts:function(){var t=this.getSortingSource(),e=this.getPrivateState().sorts,i=this.hasAggregates()?1:0;if(e&&0!==e.length)for(var n=0;no&&(o=n.indexOf(-1*t),i=!1),0>o)return null;var r=n.length-o;if(e){var s=i?l:a;return r+s+" "}var u=r+(i?"-up":"-down");return this.getBehavior().getImage(u)},cellClicked:function(t,e){if(this.hasAggregates()&&0===e.gridCell.x){var i=this.getGrid(),n=i.getHeaderRowCount(),o=e.gridCell.y-n+1;this.analytics.click(o),this.changed()}},getRow:function(t){var e=this.getGrid(),i=e.getHeaderRowCount();if(i>t&&!this.hasAggregates()){var n=this.getTopTotals();return n[t-(i-n.length)]}return this.getDataSource().getRow(t-i)},buildRow:function(t){var e=this.getColumnCount(),i=[].concat(this.getFields()),n={};this.hasAggregates()&&(n.tree=this.getValue(-2,t),i.shift());for(var o=0;e>o;o++)n[i[o]]=this.getValue(o,t);return n},getComputedRow:function(t){for(var e=this.getRowContextFunction([t]),i=this.getFields(),n={},o=0;o=o&&i.x>=r?t.cellClicked(e):this.next&&this.next.handleTap(t,e)}});e.exports=o},{"./Feature.js":63}],56:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellEditing",{alias:"CellEditing",handleDoubleClick:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){var i=t.getBehavior(),n=i.getHeaderRowCount(),o=i.getHeaderColumnCount(),r=e.gridCell;r.x>=o&&r.y>=n?t._activateEditor(e):this.next&&this.next.handleHoldPulse(t,e)}});e.exports=o},{"./Feature.js":63}],57:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("CellSelection",{alias:"CellSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){this.dragging&&(this.dragging=!1),this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=t.getBehavior(),o=e.gridCell,r=e.viewPoint,s=o.x,l=o.y,a=n.getHeaderRowCount(),u=n.getHeaderColumnCount(),c=n.getColumnCount(),h=r.x>=c,d=a>l||u>s;if(!t.isCellSelection()||i||d||h)this.next&&this.next.handleMouseDown(t,e);else{var g=t.getFixedColumnCount(),f=t.getFixedRowCount();r.xn.origin.x+n.extent.x&&(o=1),this.currentDrag.y>n.origin.y+n.extent.y&&(r=1);var c=o,h=r;a&&(c=0),u&&(h=0),this.lastDragCell=i.plusXY(c,h),t.scrollBy(o,r),this.handleMouseDragCellSelection(t,i,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){var n=-1!==i.indexOf("CTRL"),o=-1!==i.indexOf("SHIFT"),r=t.getMouseDown(),s=e.x,l=e.y;if(!(0>s||0>l)){if(s===r.x&&l===r.y)return t.clearMostRecentSelection(),t.popMouseDown(),void t.repaint();n||o||t.clearSelections(),o?(t.clearMostRecentSelection(),t.select(r.x,r.y,s-r.x+1,l-r.y+1),t.setDragExtent(t.newPoint(s-r.x+1,l-r.y))):(t.select(s,l,0,0),t.setMouseDown(t.newPoint(s,l)),t.setDragExtent(t.newPoint(0,0))),t.repaint()}},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,0,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,0,-1)},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1,0)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1,0)},handleDOWN:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,i)},handleUP:function(t,e){e.primitiveEvent.preventDefault();var i=this.getAutoScrollAcceleration();this.moveSingleSelect(t,0,-i)},handleLEFT:function(t){this.moveSingleSelect(t,-1,0)},handleRIGHT:function(t){this.moveSingleSelect(t,1,0)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumns()-1,s=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r), +o=Math.min(o,s));var l=t.getMouseDown(),a=t.getDragExtent(),u=a.x+e,c=a.y+i;u=Math.min(n-l.x,Math.max(-l.x,u)),c=Math.min(o-l.y,Math.max(-l.y,c)),t.clearMostRecentSelection(),t.select(l.x,l.y,u,c),t.setDragExtent(t.newPoint(u,c)),t.insureModelColIsVisible(u+l.x,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(c+l.y,i)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e,i){var n=t.getColumnCount()-1,o=t.getRowCount()-1,r=t.getVisibleColumnsCount()-1,s=t.getVisibleRowsCount()-1,l=t.getHeaderRowCount(),a=t.getHeaderColumnCount();t.resolveProperty("scrollingEnabled")||(n=Math.min(n,r),o=Math.min(o,s));var u=t.getMouseDown().plus(t.getDragExtent()),c=u.x+e,h=u.y+i;c=Math.min(n,Math.max(a,c)),h=Math.min(o,Math.max(l,h)),t.clearSelections(),t.select(c,h,0,0),t.setMouseDown(t.newPoint(c,h)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(c,e)&&this.pingAutoScroll(),t.insureModelRowIsVisible(h,i)&&this.pingAutoScroll(),t.repaint()}});e.exports=o},{"./Feature.js":63}],58:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnAutosizing",{alias:"ColumnAutosizing",handleDoubleClick:function(t,e){var i=t.getHeaderRowCount(),n=e.gridCell;n.y<=i?t.autosizeColumn(n.x):this.next&&this.next.handleDoubleClick(t,e)}});e.exports=o},{"./Feature.js":63}],59:[function(t,e,i){"use strict";var n,o,r,s,l=t("./Feature.js"),a=150,u=l.extend("ColumnMoving",{alias:"ColumnMoving",floaterAnimationQueue:[],columnDragAutoScrollingRight:!1,columnDragAutoScrollingLeft:!1,dragArmed:!1,dragging:!1,dragCol:-1,dragOffset:0,initializeOn:function(t){this.isFloatingNow=!1,this.initializeAnimationSupport(t),this.next&&this.next.initializeOn(t)},initializeAnimationSupport:function(t){n||(n=document.createElement("canvas"),n.setAttribute("width","0px"),n.setAttribute("height","0px"),document.body.appendChild(n),o=n.getContext("2d")),r||(r=document.createElement("canvas"),r.setAttribute("width","0px"),r.setAttribute("height","0px"),document.body.appendChild(r),s=r.getContext("2d"))},getCanDragCursorName:function(){return"-webkit-grab"},getDraggingCursorName:function(){return"-webkit-grabbing"},handleMouseDrag:function(t,e){var i,n=e.gridCell,o=Math.abs(e.primitiveEvent.detail.dragstart.x-e.primitiveEvent.detail.mouse.x);return 10>o?void(this.next&&this.next.handleMouseDrag(t,e)):(this.isHeaderRow(t,e)&&this.dragArmed&&!this.dragging?(this.dragging=!0,this.dragCol=n.x,this.dragOffset=e.mousePoint.x,this.detachChain(),i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.createDragColumn(t,i,this.dragCol)):this.next&&this.next.handleMouseDrag(t,e),void(this.dragging&&(i=e.primitiveEvent.detail.mouse.x-this.dragOffset,this.dragColumn(t,i))))},handleMouseDown:function(t,e){t.getBehavior().isColumnReorderable()&&this.isHeaderRow(t,e)&&-1!==e.gridCell.x&&(this.dragArmed=!0,this.cursor=this.getDraggingCursorName(),t.clearSelections()),this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){if(this.dragging){this.cursor=null;var i=this;this.endDragColumn(t),setTimeout(function(){i.attachChain()},200)}this.dragCol=-1,this.dragging=!1,this.dragArmed=!1,this.cursor=null,t.repaint(),this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){!this.dragging&&e.mousePoint.y<5&&0===e.viewPoint.y?this.cursor=this.getCanDragCursorName():this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.isHeaderRow(t,e)&&this.dragging&&(this.cursor=this.getDraggingCursorName())},floatColumnTo:function(t,e){this.floatingNow=!0;var i,n,o=t.getRenderer(),r=o.getColumnEdges(),s=t.getHScrollValue(),l=t.renderOverridesCache.floater.columnIndex,a=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.hdpiratio,c=t.getFixedColumnCount(),h=t.getColumnWidth(a),d=t.getColumnWidth(l),g=t.getVisibleColumnsCount(),f=0,p=0;a>=c&&(f=s),l>=c&&(p=s),e?(i=r[Math.min(g,a-f)],n=r[Math.min(g,l-p)],t.renderOverridesCache.dragger.startX=(i+d)*u,t.renderOverridesCache.floater.startX=i*u):(n=r[Math.min(g,l-p)],i=n+h,t.renderOverridesCache.dragger.startX=n*u,t.renderOverridesCache.floater.startX=i*u),t.swapColumns(a,l),t.renderOverridesCache.dragger.columnIndex=l,t.renderOverridesCache.floater.columnIndex=a,this.floaterAnimationQueue.unshift(this.doColumnMoveAnimation(t,n,i)),this.doFloaterAnimation(t)},doColumnMoveAnimation:function(t,e,i){var n=this;return function(){var o=r;o.style.display="inline",n.setCrossBrowserProperty(o,"transform","translate("+e+"px, 0px)"),requestAnimationFrame(function(){n.setCrossBrowserProperty(o,"transition",(n.isWebkit?"-webkit-":"")+"transform "+a+"ms ease"),n.setCrossBrowserProperty(o,"transform","translate("+i+"px, -2px)")}),t.repaint(),setTimeout(function(){n.setCrossBrowserProperty(o,"transition",""),t.renderOverridesCache.floater=null,t.repaint(),n.doFloaterAnimation(t),requestAnimationFrame(function(){o.style.display="none",n.isFloatingNow=!1})},a+50)}},doFloaterAnimation:function(t){if(0===this.floaterAnimationQueue.length)return this.floatingNow=!1,void t.repaint();var e=this.floaterAnimationQueue.pop();e()},createFloatColumn:function(t,e){var i=t.getFixedColumnCount(),n=t.getHScrollValue();i>e&&(n=0);var o=t.getRenderer(),l=o.getColumnEdges(),a=t.getColumnWidth(e),u=t.div.clientHeight,c=r,h=c.style,d=t.div.getBoundingClientRect();h.top=d.top-2+"px",h.left=d.left+"px",h.position="fixed";var g=t.getHiDPI(s);c.setAttribute("width",Math.round(a*g)+"px"),c.setAttribute("height",Math.round(u*g)+"px"),h.boxShadow="0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)",h.width=a+"px",h.height=u+"px",h.borderTop="1px solid "+o.resolveProperty("lineColor"),h.backgroundColor=o.resolveProperty("backgroundColor");var f=l[e-n];f*=g,s.scale(g,g),t.renderOverridesCache.floater={columnIndex:e,ctx:s,startX:f,width:a,height:u,hdpiratio:g},h.zIndex="4",this.setCrossBrowserProperty(c,"transform","translate("+f+"px, -2px)"),h.cursor=this.getDraggingCursorName(),t.repaint()},setCrossBrowserProperty:function(t,e,i){var n=e[0].toUpperCase()+e.substr(1);this.setProp(t,"webkit"+n,i),this.setProp(t,"Moz"+n,i),this.setProp(t,"ms"+n,i),this.setProp(t,"O"+n,i),this.setProp(t,e,i)},setProp:function(t,e,i){e in t.style&&(t.style[e]=i)},createDragColumn:function(t,e,i){var r=t.getFixedColumnCount(),s=t.getHScrollValue();r>i&&(s=0);var l=t.getRenderer(),a=l.getColumnEdges(),u=t.getHiDPI(o),c=t.getColumnWidth(i),h=t.div.clientHeight,d=n,g=t.div.getBoundingClientRect(),f=d.style;f.top=g.top+"px",f.left=g.left+"px",f.position="fixed",f.opacity=.85,f.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",f.borderTop="1px solid "+l.resolveProperty("lineColor"),f.backgroundColor=t.renderer.resolveProperty("backgroundColor"),d.setAttribute("width",Math.round(c*u)+"px"),d.setAttribute("height",Math.round(h*u)+"px"),f.width=c+"px",f.height=h+"px";var p=a[i-s];p*=u,o.scale(u,u),t.renderOverridesCache.dragger={columnIndex:i,ctx:o,startX:p,width:c,height:h,hdpiratio:u},this.setCrossBrowserProperty(d,"transform","translate("+e+"px, -5px)"),f.zIndex="5",f.cursor=this.getDraggingCursorName(),t.repaint()},dragColumn:function(t,e){var i=this,r=this.columnDragAutoScrollingRight||this.columnDragAutoScrollingLeft,s=t.getHiDPI(o),l=t.renderOverridesCache.dragger.columnIndex,u=t.renderOverridesCache.dragger.width,c=0,h=t.renderer.getFinalVisableColumnBoundry()-u;e=Math.min(e,h+15),e=Math.max(c-15,e);var d=c>e&&0!==l,g=e>h,f=n;this.setCrossBrowserProperty(f,"transition",(i.isWebkit?"-webkit-":"")+"transform 0ms ease, box-shadow "+a+"ms ease"),this.setCrossBrowserProperty(f,"transform","translate("+e+"px, -10px)"),requestAnimationFrame(function(){f.style.display="inline"});var p=t.renderer.getColumnFromPixelX(e+f.width/2/s);d&&(p=0),g&&(p=t.getColumnCount()-1);var v=l>p;if(v=v||p-l>=1,!v||g||r){if(c-10>e&&this.checkAutoScrollToLeft(t,e),e>c-10&&(this.columnDragAutoScrollingLeft=!1),g||e>h+10)return void this.checkAutoScrollToRight(t,e);h+10>e&&(this.columnDragAutoScrollingRight=!1)}else{var m=p>l;if(this.isFloatingNow)return;this.isFloatingNow=!0,this.createFloatColumn(t,p),this.floatColumnTo(t,m)}},checkAutoScrollToRight:function(t,e){this.columnDragAutoScrollingRight||(this.columnDragAutoScrollingRight=!0,this._checkAutoScrollToRight(t,e))},_checkAutoScrollToRight:function(t,e){if(this.columnDragAutoScrollingRight){var i=t.getHScrollValue();if(t.dragging&&!(i>t.sbHScrollConfig.rangeStop-2)){var n=t.renderOverridesCache.dragger.columnIndex;t.scrollBy(1,0);var o=n+1;console.log(o,n),t.swapColumns(o,n),t.renderOverridesCache.dragger.columnIndex=o,setTimeout(this._checkAutoScrollToRight.bind(this,t,e),250)}}},checkAutoScrollToLeft:function(t,e){this.columnDragAutoScrollingLeft||(this.columnDragAutoScrollingLeft=!0,this._checkAutoScrollToLeft(t,e))},_checkAutoScrollToLeft:function(t,e){if(this.columnDragAutoScrollingLeft){var i=t.getHScrollValue();if(t.dragging&&!(1>i)){var n=t.renderOverridesCache.dragger.columnIndex;t.swapColumns(n+i,n+i-1),t.scrollBy(-1,0),setTimeout(this._checkAutoScrollToLeft.bind(this,t,e),250)}}},endDragColumn:function(t){var e=t.getFixedColumnCount(),i=t.getHScrollValue(),o=t.renderOverridesCache.dragger.columnIndex;e>o&&(i=0);var r=t.getRenderer(),s=r.getColumnEdges(),l=this,u=s[o-i],c=n;l.setCrossBrowserProperty(c,"transition",(l.isWebkit?"-webkit-":"")+"transform "+a+"ms ease, box-shadow "+a+"ms ease"),l.setCrossBrowserProperty(c,"transform","translate("+u+"px, -1px)"),c.style.boxShadow="0px 0px 0px #888888",setTimeout(function(){t.renderOverridesCache.dragger=null,t.repaint(),requestAnimationFrame(function(){c.style.display="none",t.endDragColumnNotification()})},a+50)},isHeaderRow:function(t,e){var i=e.viewPoint,n=0===i.y;return n}});e.exports=u},{"./Feature.js":63}],60:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnResizing",{alias:"ColumnResizing",dragIndex:-2,dragStart:-1,dragIndexStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.x},getGridCellValue:function(t){return t.y},getScrollValue:function(t){return t.getHScrollValue()},getAreaSize:function(t,e){return t.getColumnWidth(e)},setAreaSize:function(t,e,i){t.setColumnWidth(e,i)},getPreviousAbsoluteSize:function(t,e){return t.getRenderedWidth(e)},overAreaDivider:function(t,e){return t.overColumnDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedRow(t,e)},getCursorName:function(){return"col-resize"},handleMouseDrag:function(t,e){if(this.dragIndex>-2){var i=this.getMouseValue(e),n=this.getScrollValue(t);this.dragIndex-1&&this.isFirstFixedOtherArea(t,e)){var o=this.getScrollValue(t);n-2){this.cursor=null,this.dragIndex=-2,e.primitiveEvent.stopPropagation();var n=this;t.synchronizeScrollingBoundries(),setTimeout(function(){n.attachChain()},200)}else this.next&&this.next.handleMouseUp(t,e)},handleMouseMove:function(t,e){this.dragIndex>-2||(this.cursor=null,this.next&&this.next.handleMouseMove(t,e),this.checkForAreaResizeCursorChange(t,e))},checkForAreaResizeCursorChange:function(t,e){var i=this.isEnabled(t);i&&this.overAreaDivider(t,e)>-1&&this.isFirstFixedOtherArea(t,e)?this.cursor=this.getCursorName():this.cursor=null},getFixedAreaCount:function(t){var e=t.getFixedColumnCount()+(t.isShowRowNumbers()?1:0)+(t.hasHierarchyColumn()?1:0);return e},handleDoubleClick:function(t,e){var i=this.isEnabled(t),n=this.overAreaDivider(t,e)>-1,o=t.getHeaderRowCount(),r=e.gridCell;i&&n&&r.y<=o?t.autosizeColumn(r.x-1):this.next&&this.next.handleDoubleClick(t,e)},isEnabled:function(t){return!0}});e.exports=o},{"./Feature.js":63}],61:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSelection",{alias:"ColumnSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,handleMouseUp:function(t,e){return this.dragging&&(this.dragging=!1),this.next?void this.next.handleMouseUp(t,e):void 0},handleMouseDown:function(t,e){if((!t.isColumnSelection()||e.mousePoint.y<5)&&this.next)return void this.next.handleMouseDown(t,e);var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowHeaderRow()&&0===s&&-1!==r;if(i||!l)this.next&&this.next.handleMouseDown(t,e);else{var a=t.getFixedColumnCount();o.xi.origin.x+i.extent.x&&(n=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentColumnSelection(),t.selectColumn(r,o.x),t.setDragExtent(t.newPoint(r-o.x,0))):(t.toggleSelectColumn(r,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){},handleUPSHIFT:function(t){},handleLEFTSHIFT:function(t){this.moveShiftSelect(t,-1)},handleRIGHTSHIFT:function(t){this.moveShiftSelect(t,1)},handleDOWN:function(t){},handleUP:function(t){},handleLEFT:function(t){this.moveSingleSelect(t,-1)},handleRIGHT:function(t){this.moveSingleSelect(t,1)},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumns()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.x+e;s=Math.min(i-o.x,Math.max(-o.x,s)),t.clearMostRecentColumnSelection(),t.selectColumn(o.x,o.x+s),t.setDragExtent(t.newPoint(s,0)),t.insureModelColIsVisible(s+o.x,e)&&this.pingAutoScroll(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getColumnCount()-1,n=t.getVisibleColumnsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.x+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectColumn(r),t.setMouseDown(t.newPoint(r,0)),t.setDragExtent(t.newPoint(0,0)),t.insureModelColIsVisible(r,e)&&this.pingAutoScroll(),t.repaint()},isColumnDragging:function(t){var e=t.lookupFeature("ColumnMoving");if(!e)return!1;var i=e.dragging&&!this.dragging;return i}});e.exports=o},{"./Feature.js":63}],62:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ColumnSorting",{alias:"ColumnSorting",handleDoubleClick:function(t,e){var i=e.gridCell;if(t.isShowHeaderRow()&&0===i.y&&-1!==i.x){var n=e.primitiveEvent.detail.keys;t.toggleSort(i.x,n)}else this.next&&this.next.handleDoubleClick(t,e)},handleMouseMove:function(t,e){var i=e.gridCell.y;this.isFixedRow(t,e)&&1>i?this.cursor="pointer":this.cursor=null,this.next&&this.next.handleMouseMove(t,e)}});e.exports=o},{"./Feature.js":63}],63:[function(t,e,i){"use strict";var n=t("extend-me").Base,o=n.extend("Feature",{next:null,detached:null,cursor:null,currentHoverCell:null,setNext:function(t){this.next?this.next.setNext(t):(this.next=t,this.detached=t)},detachChain:function(){this.next=null},attachChain:function(){this.next=this.detached},handleMouseMove:function(t,e){this.next&&this.next.handleMouseMove(t,e)},handleMouseExit:function(t,e){this.next&&this.next.handleMouseExit(t,e)},handleMouseEnter:function(t,e){this.next&&this.next.handleMouseEnter(t,e)},handleMouseDown:function(t,e){this.next&&this.next.handleMouseDown(t,e)},handleMouseUp:function(t,e){this.next&&this.next.handleMouseUp(t,e)},handleKeyDown:function(t,e){this.next&&this.next.handleKeyDown(t,e)},handleKeyUp:function(t,e){this.next&&this.next.handleKeyUp(t,e)},handleWheelMoved:function(t,e){this.next&&this.next.handleWheelMoved(t,e)},handleDoubleClick:function(t,e){this.next&&this.next.handleDoubleClick(t,e)},handleHoldPulse:function(t,e){this.next&&this.next.handleHoldPulse(t,e)},handleTap:function(t,e){this.next&&this.next.handleTap(t,e)},handleMouseDrag:function(t,e){this.next&&this.next.handleMouseDrag(t,e)},handleContextMenu:function(t,e){this.next&&this.next.handleContextMenu(t,e)},toggleColumnPicker:function(t){this.next&&this.next.toggleColumnPicker(t)},moveSingleSelect:function(t,e,i){this.next&&this.next.moveSingleSelect(t,e,i)},isFixedRow:function(t,e){var i=e.viewPoint,n=i.y-1&&this.toggleColumnPicker(t)},toggleColumnPicker:function(t){this.isColumnPickerOpen(t)?this.closeColumnPicker(t):this.openColumnPicker(t)},isColumnPickerOpen:function(t){return"none"!==this.overlay.style.display},openColumnPicker:function(t){if(!this.isColumnPickerOpen()&&(this.openEditor=!0,t.getBehavior().openEditor(this.overlay)!==!1)){var e=this;this.overlay.style.backgroundColor=t.resolveProperty("backgroundColor"),this.overlay.style.top="0%",this.overlay.style.right="0%",this.overlay.style.bottom="0%",this.overlay.style.left="0%",this.overlay.style.marginTop="15px",this.overlay.style.marginRight="35px",this.overlay.style.marginBottom="35px",this.overlay.style.marginLeft="15px",e.overlay.style.display="",this._closer||(this._closer=function(i){var n=e.getCharFor(t,i.keyCode).toLowerCase(),o=t.resolveProperty("editorActivationKeys");(o.indexOf(n)>-1||27===i.keyCode)&&(i.preventDefault(),e.closeColumnPicker(t))}),requestAnimationFrame(function(){e.overlay.style.opacity=.95,document.addEventListener("keydown",e._closer,!1)}),setTimeout(function(){e.overlay.focus()},100)}},closeColumnPicker:function(t){if(this.isColumnPickerOpen()&&this.openEditor&&(this.openEditor=!1,t.getBehavior().closeEditor(this.overlay)!==!1)){document.removeEventListener("keydown",this._closer,!1);var e=this;requestAnimationFrame(function(){e.overlay.style.opacity=0}),setTimeout(function(){e.overlay.innerHTML="",e.overlay.style.display="none",t.takeFocus()},o)}},initializeOn:function(t){this.initializeOverlaySurface(t),this.next&&this.next.initializeOn(t)},initializeOverlaySurface:function(t){this.overlay=document.createElement("div"),this.overlay.setAttribute("tabindex",0),this.overlay.style.outline="none",this.overlay.style.boxShadow="0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22)",this.overlay.style.position="absolute",this.overlay.style.display="none",this.overlay.style.transition="opacity "+o+"ms ease-in",this.overlay.style.opacity=0,this.overlay.style.zIndex=10,t.div.appendChild(this.overlay)},getCharFor:function(t,e){var i=t.getCanvas().getCharMap();return i[e][0]}});e.exports=r},{"./Feature.js":63}],68:[function(t,e,i){"use strict";var n=t("./ColumnResizing"),o=n.extend("RowResizing",{alias:"RowResizing",dragArea:-1,dragStart:-1,dragAreaStartingSize:-1,getMouseValue:function(t){return t.primitiveEvent.detail.mouse.y},getGridCellValue:function(t){return t.x},getScrollValue:function(t){return t.getVScrollValue()},getAreaSize:function(t,e){return t.getRowHeight(e)},setAreaSize:function(t,e,i){t.setRowHeight(e,i)},overAreaDivider:function(t,e){return t.overRowDivider(e)},isFirstFixedOtherArea:function(t,e){return this.isFirstFixedColumn(t,e)},getCursorName:function(){return"row-resize"},getPreviousAbsoluteSize:function(t,e){return t.getRenderedHeight(e)},getOtherFixedAreaCount:function(t){return t.getFixedColumnCount()},getFixedAreaCount:function(t){return t.getFixedRowCount()+t.getHeaderRowCount()},isEnabled:function(t){return t.isRowResizeable()}});e.exports=o},{"./ColumnResizing":60}],69:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("RowSelection",{alias:"RowSelection",currentDrag:null,lastDragCell:null,sbLastAuto:0,sbAutoStart:0,dragArmed:!1,handleMouseUp:function(t,e){this.dragArmed?(this.dragArmed=!1,-1===e.gridCell.x&&0===e.gridCell.y&&t.toggleSelectAllRows(),t.fireSyntheticRowSelectionChangedEvent()):this.dragging?(this.dragging=!1,t.fireSyntheticRowSelectionChangedEvent()):this.next&&this.next.handleMouseUp(t,e)},handleMouseDown:function(t,e){var i=e.primitiveEvent.detail.isRightClick,n=e.gridCell,o=e.viewPoint,r=n.x,s=n.y,l=t.isShowRowNumbers()&&0>r;if(t.isRowSelection()&&!i&&l){var a=t.getFixedRowCount();o.yi.origin.y+i.extent.y&&(o=1);var u=n,c=o;l&&(u=0),a&&(c=0),this.lastDragCell=e.plusXY(u,c),t.scrollBy(n,o),this.handleMouseDragCellSelection(t,e,[]),t.repaint(),setTimeout(this.scrollDrag.bind(this,t),25)}},extendSelection:function(t,e,i){t.stopEditing();var n=-1!==i.indexOf("SHIFT"),o=t.getMouseDown(),r=e.x,s=e.y;0>r||0>s||(n?(t.clearMostRecentRowSelection(),t.selectRow(s,o.y),t.setDragExtent(t.newPoint(0,s-o.y))):(t.toggleSelectRow(s,i),t.setMouseDown(t.newPoint(r,s)),t.setDragExtent(t.newPoint(0,0))),t.repaint())},handleDOWNSHIFT:function(t){this.moveShiftSelect(t,1)},handleUPSHIFT:function(t){this.moveShiftSelect(t,-1)},handleLEFTSHIFT:function(t){},handleRIGHTSHIFT:function(t){},handleDOWN:function(t){this.moveSingleSelect(t,1)},handleUP:function(t){this.moveSingleSelect(t,-1)},handleLEFT:function(t){},handleRIGHT:function(t){var e=t.getMouseDown().plus(t.getDragExtent()),i=t.getColumnCount()-1,n=t.getHeaderColumnCount()+t.getHScrollValue(),o=e.y;n=Math.min(i,n),t.clearSelections(),t.select(n,o,0,0),t.setMouseDown(t.newPoint(n,o)),t.setDragExtent(t.newPoint(0,0)),t.repaint()},getAutoScrollAcceleration:function(){var t=1,e=this.getAutoScrollDuration()/2e3;return t=Math.max(1,Math.floor(e*e*e*e))},setAutoScrollStartTime:function(){this.sbAutoStart=Date.now()},pingAutoScroll:function(){var t=Date.now();t-this.sbLastAuto>500&&this.setAutoScrollStartTime(),this.sbLastAuto=Date.now()},getAutoScrollDuration:function(){return Date.now()-this.sbLastAuto>500?0:Date.now()-this.sbAutoStart},moveShiftSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRows()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown(),r=t.getDragExtent(),s=r.y+e;s=Math.min(i-o.y,Math.max(-o.y,s)),t.clearMostRecentRowSelection(),t.selectRow(o.y,o.y+s),t.setDragExtent(t.newPoint(0,s)),t.insureModelRowIsVisible(s+o.y,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},moveSingleSelect:function(t,e){var i=t.getRowCount()-1,n=t.getVisibleRowsCount()-1;t.resolveProperty("scrollingEnabled")||(i=Math.min(i,n));var o=t.getMouseDown().plus(t.getDragExtent()),r=o.y+e;r=Math.min(i,Math.max(0,r)),t.clearSelections(),t.selectRow(r),t.setMouseDown(t.newPoint(0,r)),t.setDragExtent(t.newPoint(0,0)),t.insureModelRowIsVisible(r,e)&&this.pingAutoScroll(),t.fireSyntheticRowSelectionChangedEvent(),t.repaint()},isSingleRowSelection:function(){return!0}});e.exports=o},{"./Feature.js":63}],70:[function(t,e,i){"use strict";var n=t("./Feature.js"),o=n.extend("ThumbwheelScrolling",{alias:"ThumbwheelScrolling",handleWheelMoved:function(t,e){if(t.resolveProperty("scrollingEnabled")){var i=e.primitiveEvent,n=i.wheelDeltaY||-i.deltaY,o=i.wheelDeltaX||-i.deltaX;n>0?t.scrollBy(0,-1):-0>n?t.scrollBy(0,1):o>0?t.scrollBy(-1,0):-0>o&&t.scrollBy(1,0)}}});e.exports=o},{"./Feature.js":63}],71:[function(t,e,i){"use strict";e.exports={Feature:t("./Feature"),CellClick:t("./CellClick"),CellEditing:t("./CellEditing"),CellSelection:t("./CellSelection"),ColumnAutosizing:t("./ColumnAutosizing"),ColumnMoving:t("./ColumnMoving"),ColumnResizing:t("./ColumnResizing"),ColumnSelection:t("./ColumnSelection"),ColumnSorting:t("./ColumnSorting"),Filters:t("./Filters"),KeyPaging:t("./KeyPaging"),OnHover:t("./OnHover"),Overlay:t("./Overlay"),RowResizing:t("./RowResizing"),RowSelection:t("./RowSelection"),ThumbwheelScrolling:t("./ThumbwheelScrolling")}},{"./CellClick":55,"./CellEditing":56,"./CellSelection":57,"./ColumnAutosizing":58,"./ColumnMoving":59,"./ColumnResizing":60,"./ColumnSelection":61,"./ColumnSorting":62,"./Feature":63,"./Filters":64,"./KeyPaging":65,"./OnHover":66,"./Overlay":67,"./RowResizing":68,"./RowSelection":69,"./ThumbwheelScrolling":70}],72:[function(t,e,i){"use strict";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;n>r;r++)if(e=i[r],t.call(o,e,r,i))return e})},{}],73:[function(t,e,i){"use strict";function n(t,e){o(r[t],t,e)}var o=t("css-injector"),r={grid:["div#grid-container {"," position: relative;"," display: inline-block;"," -webkit-user-select: none;"," -moz-user-select: none;"," -ms-user-select: none;"," -o-user-select: none;"," user-select: none;"," overflow: hidden; }","visible { opacity: 0.75; }","hidden { opacity: 0.0; }","editor {"," position: absolute;"," display: none;"," border: solid 2px black;"," outline: 0;"," padding: 0;"," z-index: 1000; }"],"list-dragon":["div.dragon-list, li.dragon-pop {"," font-family: Roboto, sans-serif;"," text-transform: capitalize; }","div.dragon-list {"," position: absolute;"," top: 4%;"," left: 4%;"," height: 92%;"," width: 20%; }","div.dragon-list:nth-child(2) { left: 28%; }","div.dragon-list:nth-child(3) { left: 52%; }","div.dragon-list:nth-child(4) { left: 76%; }","div.dragon-list > div, div.dragon-list > ul > li, li.dragon-pop { line-height: 46px; }","div.dragon-list > ul { top: 46px; }","div.dragon-list > ul > li:not(:last-child)::before, li.dragon-pop::before {"," content: '\\2b24';"," color: #b6b6b6;"," font-size: 30px;"," margin: 8px 14px 8px 8px; }","li.dragon-pop { opacity:.8; }"]};e.exports=n},{"css-injector":2}]},{},[54]); \ No newline at end of file