diff --git a/dist/tribute.css b/dist/tribute.css deleted file mode 100644 index 9a4bb39d..00000000 --- a/dist/tribute.css +++ /dev/null @@ -1,24 +0,0 @@ -.tribute-container { - position: absolute; - top: 0; - left: 0; - height: auto; - max-height: 300px; - max-width: 500px; - overflow: auto; - display: block; - z-index: 999999; } - .tribute-container ul { - margin: 0; - margin-top: 2px; - list-style: none; - background: #efefef; } - .tribute-container li { - padding: 5px 5px; - cursor: pointer; } - .tribute-container li.highlight, .tribute-container li:hover { - background: #ddd; } - .tribute-container li span { - font-weight: bold; } - .tribute-container .menu-highlighted { - font-weight: bold; } diff --git a/dist/tribute.js b/dist/tribute.js deleted file mode 100644 index dc28d5f3..00000000 --- a/dist/tribute.js +++ /dev/null @@ -1,1353 +0,0 @@ -(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o', - post: '', - extract: function extract(el) { - return el[_this2.current.collection.lookup]; - } - }); - - this.current.filteredItems = items; - - var ul = this.menu.querySelector('ul'); - - if (!items.length) { - var noMatchEvent = new CustomEvent('tribute-no-match', { detail: this.menu }); - this.current.element.dispatchEvent(noMatchEvent); - if (!this.current.collection.noMatchTemplate) { - this.hideMenu(); - } else { - ul.innerHTML = this.current.collection.noMatchTemplate(); - } - - return; - } - - ul.innerHTML = ''; - - items.forEach(function (item, index) { - var li = _this2.range.getDocument().createElement('li'); - li.setAttribute('data-index', index); - if (_this2.menuSelected === index) { - li.className = _this2.current.collection.selectClass; - } - li.innerHTML = _this2.current.collection.menuItemTemplate(item); - ul.appendChild(li); - }); - - this.range.positionMenuAtCaret(scrollTo); - } - }, { - key: "hideMenu", - value: function hideMenu() { - if (this.menu) { - this.menu.style.cssText = 'display: none;'; - this.isActive = false; - this.menuSelected = 0; - this.current = {}; - } - } - }, { - key: "selectItemAtIndex", - value: function selectItemAtIndex(index) { - index = parseInt(index); - if (typeof index !== 'number') return; - var item = this.current.filteredItems[index]; - var content = this.current.collection.selectTemplate(item); - this.replaceText(content); - } - }, { - key: "replaceText", - value: function replaceText(content) { - this.range.replaceTriggerText(content, true, true); - } - }, { - key: "_append", - value: function _append(collection, element, newValues, replace) { - if (this.isActive) { - if (!replace) { - collection.values = collection.values.concat(newValues); - } else { - collection.values = newValues; - } - } - } - }, { - key: "append", - value: function append(collectionIndex, newValues, replace) { - var index = parseInt(collectionIndex); - if (typeof index !== 'number') throw new Error('please provide an index for the collection to update.'); - - var collection = this.collection[index]; - - this._append(this.current.collection, this.current.element, newValues, replace); - } - }, { - key: "appendCurrent", - value: function appendCurrent(newValues, replace) { - this._append(this.current.collection, this.current.element, newValues, replace); - } - }], [{ - key: "defaultSelectTemplate", - value: function defaultSelectTemplate(item) { - return "@" + item.original[this.current.collection.fillAttr]; - } - }, { - key: "defaultMenuItemTemplate", - value: function defaultMenuItemTemplate(matchItem) { - return matchItem.string; - } - }, { - key: "inputTypes", - value: function inputTypes() { - return ['TEXTAREA', 'INPUT']; - } - }]); - - return Tribute; -}(); - -global.Tribute = Tribute; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"./TributeEvents":2,"./TributeMenuEvents":3,"./TributeRange":4,"./TributeSearch":5,"./utils":6}],2:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var TributeEvents = function () { - function TributeEvents(tribute) { - _classCallCheck(this, TributeEvents); - - this.tribute = tribute; - this.tribute.events = this; - } - - _createClass(TributeEvents, [{ - key: 'bind', - value: function bind(element) { - element.addEventListener('keydown', this.keydown.bind(element, this), false); - element.addEventListener('keyup', this.keyup.bind(element, this), false); - element.addEventListener('input', this.input.bind(element, this), false); - } - }, { - key: 'keydown', - value: function keydown(instance, event) { - if (instance.shouldDeactivate(event)) { - instance.tribute.isActive = false; - } - - var element = this; - instance.commandEvent = false; - - TributeEvents.keys().forEach(function (o) { - if (o.key === event.keyCode) { - instance.commandEvent = true; - instance.callbacks()[o.value.toLowerCase()](event, element); - } - }); - } - }, { - key: 'input', - value: function input(instance, event) { - instance.inputEvent = true; - instance.keyup.call(this, instance, event); - } - }, { - key: 'click', - value: function click(instance, event) { - var tribute = instance.tribute; - - if (tribute.menu && tribute.menu.contains(event.target)) { - var li = event.target; - while (li.nodeName.toLowerCase() !== 'li') { - li = li.parentNode; - if (!li || li === tribute.menu) { - throw new Error('cannot find the
  • container for the click'); - } - } - tribute.selectItemAtIndex(li.getAttribute('data-index')); - tribute.hideMenu(); - } else if (tribute.current.element) { - tribute.hideMenu(); - } - } - }, { - key: 'keyup', - value: function keyup(instance, event) { - var _this = this; - - if (instance.inputEvent) { - instance.inputEvent = false; - } - instance.updateSelection(this); - - if (event.keyCode === 27) return; - - if (!instance.tribute.isActive) { - var _ret = function () { - var keyCode = instance.getKeyCode(instance, _this, event); - - if (isNaN(keyCode)) return { - v: void 0 - }; - - var trigger = instance.tribute.triggers().find(function (trigger) { - return trigger.charCodeAt(0) === keyCode; - }); - - if (typeof trigger !== 'undefined') { - instance.callbacks().triggerChar(event, _this, trigger); - } - }(); - - if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; - } - - if (instance.tribute.current.trigger && instance.commandEvent === false || instance.tribute.isActive && event.keyCode === 8) { - instance.tribute.showMenuFor(this, true); - } - } - }, { - key: 'shouldDeactivate', - value: function shouldDeactivate(event) { - if (!this.tribute.isActive) return false; - - if (this.tribute.current.mentionText.length === 0) { - var eventKeyPressed = false; - TributeEvents.keys().forEach(function (o) { - if (event.keyCode === o.key) eventKeyPressed = true; - }); - - return !eventKeyPressed; - } - - return false; - } - }, { - key: 'getKeyCode', - value: function getKeyCode(instance, el, event) { - var char = void 0; - var tribute = instance.tribute; - var info = tribute.range.getTriggerInfo(false, false, true); - - if (info) { - return info.mentionTriggerChar.charCodeAt(0); - } else { - return false; - } - } - }, { - key: 'updateSelection', - value: function updateSelection(el) { - this.tribute.current.element = el; - var info = this.tribute.range.getTriggerInfo(false, false, true); - - if (info) { - this.tribute.current.selectedPath = info.mentionSelectedPath; - this.tribute.current.mentionText = info.mentionText; - this.tribute.current.selectedOffset = info.mentionSelectedOffset; - } - } - }, { - key: 'callbacks', - value: function callbacks() { - var _this2 = this; - - return { - triggerChar: function triggerChar(e, el, trigger) { - var tribute = _this2.tribute; - tribute.current.trigger = trigger; - - var collectionItem = tribute.collection.find(function (item) { - return item.trigger === trigger; - }); - - tribute.current.collection = collectionItem; - - tribute.showMenuFor(el, true); - }, - enter: function enter(e, el) { - // choose selection - if (_this2.tribute.isActive) { - e.preventDefault(); - setTimeout(function () { - _this2.tribute.selectItemAtIndex(_this2.tribute.menuSelected); - _this2.tribute.hideMenu(); - }, 0); - } - }, - escape: function escape(e, el) { - if (_this2.tribute.isActive) { - e.preventDefault(); - _this2.tribute.hideMenu(); - } - }, - tab: function tab(e, el) { - // choose first match - _this2.callbacks().enter(e, el); - }, - up: function up(e, el) { - // navigate up ul - if (_this2.tribute.isActive) { - e.preventDefault(); - var count = _this2.tribute.current.filteredItems.length, - selected = _this2.tribute.menuSelected; - - if (count > selected && selected > 0) { - _this2.tribute.menuSelected--; - _this2.setActiveLi(); - } - } - }, - down: function down(e, el) { - // navigate down ul - if (_this2.tribute.isActive) { - e.preventDefault(); - var count = _this2.tribute.current.filteredItems.length - 1, - selected = _this2.tribute.menuSelected; - - if (count > selected) { - _this2.tribute.menuSelected++; - _this2.setActiveLi(); - } - } - }, - delete: function _delete(e, el) { - if (_this2.tribute.isActive && _this2.tribute.current.mentionText.length < 1) { - _this2.tribute.hideMenu(); - } else if (_this2.tribute.isActive) { - tribute.showMenuFor(el); - } - } - }; - } - }, { - key: 'setActiveLi', - value: function setActiveLi(index) { - var lis = this.tribute.menu.querySelectorAll('li'), - length = lis.length >>> 0; - - for (var i = 0; i < length; i++) { - var li = lis[i]; - if (i === this.tribute.menuSelected) { - li.className = this.tribute.current.collection.selectClass; - } else { - li.className = ''; - } - } - } - }], [{ - key: 'keys', - value: function keys() { - return [{ - key: 9, - value: 'TAB' - }, { - key: 8, - value: 'DELETE' - }, { - key: 13, - value: 'ENTER' - }, { - key: 27, - value: 'ESCAPE' - }, { - key: 38, - value: 'UP' - }, { - key: 40, - value: 'DOWN' - }]; - } - }]); - - return TributeEvents; -}(); - -exports.default = TributeEvents; - -},{}],3:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var TributeMenuEvents = function () { - function TributeMenuEvents(tribute) { - _classCallCheck(this, TributeMenuEvents); - - this.tribute = tribute; - this.tribute.menuEvents = this; - this.menu = this.tribute.menu; - } - - _createClass(TributeMenuEvents, [{ - key: 'bind', - value: function bind(menu) { - var _this = this; - - menu.addEventListener('keydown', this.tribute.events.keydown.bind(this.menu, this), false); - this.tribute.range.getDocument().addEventListener('click', this.tribute.events.click.bind(null, this), false); - window.addEventListener('resize', this.debounce(function () { - if (_this.tribute.isActive) { - _this.tribute.showMenuFor(_this.tribute.current.element, true); - } - }, 300, false)); - - if (this.menuContainer) { - this.menuContainer.addEventListener('scroll', this.debounce(function () { - if (_this.tribute.isActive) { - _this.tribute.showMenuFor(_this.tribute.current.element, false); - } - }, 300, false), false); - } else { - window.onscroll = this.debounce(function () { - if (_this.tribute.isActive) { - _this.tribute.showMenuFor(_this.tribute.current.element, false); - } - }, 300, false); - } - } - }, { - key: 'debounce', - value: function debounce(func, wait, immediate) { - var _this2 = this, - _arguments = arguments; - - var timeout; - return function () { - var context = _this2, - args = _arguments; - var later = function later() { - timeout = null; - if (!immediate) func.apply(context, args); - }; - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); - }; - } - }]); - - return TributeMenuEvents; -}(); - -exports.default = TributeMenuEvents; - -},{}],4:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// Thanks to https://github.com/jeff-collins/ment.io - -var TributeRange = function () { - function TributeRange(tribute) { - _classCallCheck(this, TributeRange); - - this.tribute = tribute; - this.tribute.range = this; - } - - _createClass(TributeRange, [{ - key: 'getDocument', - value: function getDocument() { - var iframe = void 0; - if (this.tribute.current.collection) { - iframe = this.tribute.current.collection.iframe; - } - - if (!iframe) { - return document; - } - - return iframe.contentWindow.document; - } - }, { - key: 'positionMenuAtCaret', - value: function positionMenuAtCaret(scrollTo) { - var _this = this; - - var context = this.tribute.current, - coordinates = void 0; - var info = this.getTriggerInfo(false, false, true); - - if (info !== undefined) { - if (!this.isContentEditable(context.element)) { - coordinates = this.getTextAreaOrInputUnderlinePosition(this.getDocument().activeElement, info.mentionPosition); - } else { - coordinates = this.getContentEditableCaretPosition(info.mentionPosition); - } - - // Move the button into place. - this.tribute.menu.style.cssText = 'top: ' + coordinates.top + 'px;\n left: ' + coordinates.left + 'px;\n position: absolute;\n zIndex: 10000;\n display: block;'; - - setTimeout(function () { - if (scrollTo) _this.scrollIntoView(_this.getDocument().activeElement); - }, 0); - } else { - this.tribute.menu.style.cssText = 'display: none'; - } - } - }, { - key: 'selectElement', - value: function selectElement(targetElement, path, offset) { - var range = void 0; - var elem = targetElement; - - if (path) { - for (var i = 0; i < path.length; i++) { - elem = elem.childNodes[path[i]]; - if (elem === undefined) { - return; - } - while (elem.length < offset) { - offset -= elem.length; - elem = elem.nextSibling; - } - if (elem.childNodes.length === 0 && !elem.length) { - elem = elem.previousSibling; - } - } - } - var sel = this.getWindowSelection(); - - range = this.getDocument().createRange(); - range.setStart(elem, offset); - range.setEnd(elem, offset); - range.collapse(true); - - try { - sel.removeAllRanges(); - } catch (error) {} - - sel.addRange(range); - targetElement.focus(); - } - }, { - key: 'resetSelection', - value: function resetSelection(targetElement, path, offset) { - if (!this.isContentEditable(targetElement)) { - if (targetElement !== this.getDocument().activeElement) { - targetElement.focus(); - } - } else { - this.selectElement(targetElement, path, offset); - } - } - }, { - key: 'replaceTriggerText', - value: function replaceTriggerText(text, requireLeadingSpace, hasTrailingSpace) { - var context = this.tribute.current; - this.resetSelection(context.element, context.selectedPath, context.selectedOffset); - - var info = this.getTriggerInfo(requireLeadingSpace, true, hasTrailingSpace); - - // Create the event - var replaceEvent = new CustomEvent('tribute-replaced', { - detail: text - }); - - if (info !== undefined) { - if (!this.isContentEditable(context.element)) { - var myField = this.getDocument().activeElement; - text += ' '; - var startPos = info.mentionPosition; - var endPos = info.mentionPosition + info.mentionText.length + 1; - myField.value = myField.value.substring(0, startPos) + text + myField.value.substring(endPos, myField.value.length); - myField.selectionStart = startPos + text.length; - myField.selectionEnd = startPos + text.length; - } else { - // add a space to the end of the pasted text - text += '\xA0'; - this.pasteHtml(text, info.mentionPosition, info.mentionPosition + info.mentionText.length + 1); - } - - context.element.dispatchEvent(replaceEvent); - } - } - }, { - key: 'pasteHtml', - value: function pasteHtml(html, startPos, endPos) { - var range = void 0, - sel = void 0; - sel = this.getWindowSelection(); - range = this.getDocument().createRange(); - range.setStart(sel.anchorNode, startPos); - range.setEnd(sel.anchorNode, endPos); - range.deleteContents(); - - var el = this.getDocument().createElement('div'); - el.innerHTML = html; - var frag = this.getDocument().createDocumentFragment(), - node = void 0, - lastNode = void 0; - while (node = el.firstChild) { - lastNode = frag.appendChild(node); - } - range.insertNode(frag); - - // Preserve the selection - if (lastNode) { - range = range.cloneRange(); - range.setStartAfter(lastNode); - range.collapse(true); - sel.removeAllRanges(); - sel.addRange(range); - } - } - }, { - key: 'getWindowSelection', - value: function getWindowSelection() { - if (this.tribute.collection.iframe) { - return this.tribute.collection.iframe.contentWindow.getSelection(); - } - - return window.getSelection(); - } - }, { - key: 'getNodePositionInParent', - value: function getNodePositionInParent(element) { - if (element.parentNode === null) { - return 0; - } - - for (var i = 0; i < element.parentNode.childNodes.length; i++) { - var node = element.parentNode.childNodes[i]; - - if (node === element) { - return i; - } - } - } - }, { - key: 'getContentEditableSelectedPath', - value: function getContentEditableSelectedPath() { - // content editable - var sel = this.getWindowSelection(); - var selected = sel.anchorNode; - var path = []; - var offset = void 0; - - if (selected != null) { - var i = void 0; - var ce = selected.contentEditable; - while (selected !== null && ce !== 'true') { - i = this.getNodePositionInParent(selected); - path.push(i); - selected = selected.parentNode; - if (selected !== null) { - ce = selected.contentEditable; - } - } - path.reverse(); - - // getRangeAt may not exist, need alternative - offset = sel.getRangeAt(0).startOffset; - - return { - selected: selected, - path: path, - offset: offset - }; - } - } - }, { - key: 'getTextPrecedingCurrentSelection', - value: function getTextPrecedingCurrentSelection() { - var context = this.tribute.current, - text = void 0; - - if (!this.isContentEditable(context.element)) { - var textComponent = this.getDocument().activeElement; - var startPos = textComponent.selectionStart; - text = textComponent.value.substring(0, startPos); - } else { - var selectedElem = this.getWindowSelection().anchorNode; - - if (selectedElem != null) { - var workingNodeContent = selectedElem.textContent; - var selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset; - - if (selectStartOffset >= 0) { - text = workingNodeContent.substring(0, selectStartOffset); - } - } - } - - return text; - } - }, { - key: 'getTriggerInfo', - value: function getTriggerInfo(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace) { - var _this2 = this; - - var ctx = this.tribute.current; - var selected = void 0, - path = void 0, - offset = void 0; - - if (!this.isContentEditable(ctx.element)) { - selected = this.getDocument().activeElement; - } else { - // content editable - var selectionInfo = this.getContentEditableSelectedPath(); - - if (selectionInfo) { - selected = selectionInfo.selected; - path = selectionInfo.path; - offset = selectionInfo.offset; - } - } - - var effectiveRange = this.getTextPrecedingCurrentSelection(); - - if (effectiveRange !== undefined && effectiveRange !== null) { - var _ret = function () { - var mostRecentTriggerCharPos = -1; - var triggerChar = void 0; - - _this2.tribute.triggers().forEach(function (c) { - var idx = effectiveRange.lastIndexOf(c); - - if (idx > mostRecentTriggerCharPos) { - mostRecentTriggerCharPos = idx; - triggerChar = c; - } - }); - - if (mostRecentTriggerCharPos >= 0 && (mostRecentTriggerCharPos === 0 || !requireLeadingSpace || /[\xA0\s]/g.test(effectiveRange.substring(mostRecentTriggerCharPos - 1, mostRecentTriggerCharPos)))) { - var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1, effectiveRange.length); - - triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + 1); - var firstSnippetChar = currentTriggerSnippet.substring(0, 1); - var leadingSpace = currentTriggerSnippet.length > 0 && (firstSnippetChar === ' ' || firstSnippetChar === '\xA0'); - if (hasTrailingSpace) { - currentTriggerSnippet = currentTriggerSnippet.trim(); - } - if (!leadingSpace && (menuAlreadyActive || !/[\xA0\s]/g.test(currentTriggerSnippet))) { - return { - v: { - mentionPosition: mostRecentTriggerCharPos, - mentionText: currentTriggerSnippet, - mentionSelectedElement: selected, - mentionSelectedPath: path, - mentionSelectedOffset: offset, - mentionTriggerChar: triggerChar - } - }; - } - } - }(); - - if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; - } - } - }, { - key: 'isContentEditable', - value: function isContentEditable(element) { - return element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA'; - } - }, { - key: 'getTextAreaOrInputUnderlinePosition', - value: function getTextAreaOrInputUnderlinePosition(element, position) { - var properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing']; - - var isFirefox = window.mozInnerScreenX !== null; - - var div = this.getDocument().createElement('div'); - div.id = 'input-textarea-caret-position-mirror-div'; - this.getDocument().body.appendChild(div); - - var style = div.style; - var computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle; - - style.whiteSpace = 'pre-wrap'; - if (element.nodeName !== 'INPUT') { - style.wordWrap = 'break-word'; - } - - // position off-screen - style.position = 'absolute'; - style.visibility = 'hidden'; - - // transfer the element's properties to the div - properties.forEach(function (prop) { - style[prop] = computed[prop]; - }); - - if (isFirefox) { - style.width = parseInt(computed.width) - 2 + 'px'; - if (element.scrollHeight > parseInt(computed.height)) style.overflowY = 'scroll'; - } else { - style.overflow = 'hidden'; - } - - div.textContent = element.value.substring(0, position); - - if (element.nodeName === 'INPUT') { - div.textContent = div.textContent.replace(/\s/g, ' '); - } - - var span = this.getDocument().createElement('span'); - span.textContent = element.value.substring(position) || '.'; - div.appendChild(span); - - var rect = element.getBoundingClientRect(); - var doc = document.documentElement; - var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); - var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - - var coordinates = { - top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize), - left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth) - }; - - this.getDocument().body.removeChild(div); - - return coordinates; - } - }, { - key: 'getContentEditableCaretPosition', - value: function getContentEditableCaretPosition(selectedNodePosition) { - var markerTextChar = ''; - var markerEl = void 0, - markerId = 'sel_' + new Date().getTime() + '_' + Math.random().toString().substr(2); - var range = void 0; - var sel = this.getWindowSelection(); - var prevRange = sel.getRangeAt(0); - - range = this.getDocument().createRange(); - range.setStart(sel.anchorNode, selectedNodePosition); - range.setEnd(sel.anchorNode, selectedNodePosition); - - range.collapse(false); - - // Create the marker element containing a single invisible character using DOM methods and insert it - markerEl = this.getDocument().createElement('span'); - markerEl.id = markerId; - markerEl.appendChild(this.getDocument().createTextNode(markerTextChar)); - range.insertNode(markerEl); - sel.removeAllRanges(); - sel.addRange(prevRange); - - var rect = markerEl.getBoundingClientRect(); - var doc = document.documentElement; - var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); - var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - var coordinates = { - left: rect.left + windowLeft, - top: rect.top + markerEl.offsetHeight + windowTop - }; - - markerEl.parentNode.removeChild(markerEl); - return coordinates; - } - }, { - key: 'scrollIntoView', - value: function scrollIntoView(elem) { - var reasonableBuffer = 20, - clientRect = void 0; - var maxScrollDisplacement = 100; - var e = elem; - - while (clientRect === undefined || clientRect.height === 0) { - clientRect = e.getBoundingClientRect(); - - if (clientRect.height === 0) { - e = e.childNodes[0]; - if (e === undefined || !e.getBoundingClientRect) { - return; - } - } - } - - var elemTop = clientRect.top; - var elemBottom = elemTop + clientRect.height; - - if (elemTop < 0) { - window.scrollTo(0, window.pageYOffset + clientRect.top - reasonableBuffer); - } else if (elemBottom > window.innerHeight) { - var maxY = window.pageYOffset + clientRect.top - reasonableBuffer; - - if (maxY - window.pageYOffset > maxScrollDisplacement) { - maxY = window.pageYOffset + maxScrollDisplacement; - } - - var targetY = window.pageYOffset - (window.innerHeight - elemBottom); - - if (targetY > maxY) { - targetY = maxY; - } - - window.scrollTo(0, targetY); - } - } - }]); - - return TributeRange; -}(); - -exports.default = TributeRange; - -},{}],5:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// Thanks to https://github.com/mattyork/fuzzy - -var TributeSearch = function () { - function TributeSearch(tribute) { - _classCallCheck(this, TributeSearch); - - this.tribute = tribute; - this.tribute.search = this; - } - - _createClass(TributeSearch, [{ - key: 'simpleFilter', - value: function simpleFilter(pattern, array) { - var _this = this; - - return array.filter(function (string) { - return _this.test(pattern, string); - }); - } - }, { - key: 'test', - value: function test(pattern, string) { - return this.match(pattern, string) !== null; - } - }, { - key: 'match', - value: function match(pattern, string, opts) { - opts = opts || {}; - var patternIdx = 0, - result = [], - len = string.length, - totalScore = 0, - currScore = 0, - pre = opts.pre || '', - post = opts.post || '', - compareString = opts.caseSensitive && string || string.toLowerCase(), - ch = void 0, - compareChar = void 0; - - pattern = opts.caseSensitive && pattern || pattern.toLowerCase(); - - var patternCache = this.traverse(compareString, pattern, 0, 0, []); - if (!patternCache) { - return null; - } - - return { - rendered: this.render(string, patternCache.cache, pre, post), - score: patternCache.score - }; - } - }, { - key: 'traverse', - value: function traverse(string, pattern, stringIndex, patternIndex, patternCache) { - // if the pattern search at end - if (pattern.length === patternIndex) { - - // calculate socre and copy the cache containing the indices where it's found - return { - score: this.calculateScore(patternCache), - cache: patternCache.slice() - }; - } - - // if string at end or remaining pattern > remaining string - if (string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex) { - return undefined; - } - - var c = pattern[patternIndex]; - var index = string.indexOf(c, stringIndex); - var best = void 0, - temp = void 0; - - while (index > -1) { - patternCache.push(index); - temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache); - patternCache.pop(); - - // if downstream traversal failed, return best answer so far - if (!temp) { - return best; - } - - if (!best || best.score < temp.score) { - best = temp; - } - - index = string.indexOf(c, index + 1); - } - - return best; - } - }, { - key: 'calculateScore', - value: function calculateScore(patternCache) { - var score = 0; - var temp = 1; - - patternCache.forEach(function (index, i) { - if (i > 0) { - if (patternCache[i - 1] + 1 === index) { - temp += temp + 1; - } else { - temp = 1; - } - } - - score += temp; - }); - - return score; - } - }, { - key: 'render', - value: function render(string, indices, pre, post) { - var rendered = string.substring(0, indices[0]); - - indices.forEach(function (index, i) { - rendered += pre + string[index] + post + string.substring(index + 1, indices[i + 1] ? indices[i + 1] : string.length); - }); - - return rendered; - } - }, { - key: 'filter', - value: function filter(pattern, arr, opts) { - var _this2 = this; - - opts = opts || {}; - return arr.reduce(function (prev, element, idx, arr) { - var str = element; - - if (opts.extract) { - str = opts.extract(element); - - if (!str) { - // take care of undefineds / nulls / etc. - str = ''; - } - } - - var rendered = _this2.match(pattern, str, opts); - - if (rendered != null) { - prev[prev.length] = { - string: rendered.rendered, - score: rendered.score, - index: idx, - original: element - }; - } - - return prev; - }, []).sort(function (a, b) { - var compare = b.score - a.score; - if (compare) return compare; - return a.index - b.index; - }); - } - }]); - - return TributeSearch; -}(); - -exports.default = TributeSearch; - -},{}],6:[function(require,module,exports){ -'use strict'; - -if (!Array.prototype.find) { - Array.prototype.find = function (predicate) { - if (this === null) { - throw new TypeError('Array.prototype.find called on null or undefined'); - } - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - var list = Object(this); - var length = list.length >>> 0; - var thisArg = arguments[1]; - var value; - - for (var i = 0; i < length; i++) { - value = list[i]; - if (predicate.call(thisArg, value, i, list)) { - return value; - } - } - return undefined; - }; -} - -(function () { - - if (typeof window.CustomEvent === "function") return false; - - function CustomEvent(event, params) { - params = params || { - bubbles: false, - cancelable: false, - detail: undefined - }; - var evt = document.createEvent('CustomEvent'); - evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); - return evt; - } - - CustomEvent.prototype = window.Event.prototype; - - window.CustomEvent = CustomEvent; -})(); - -},{}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvVHJpYnV0ZS5qcyIsInNyYy9UcmlidXRlRXZlbnRzLmpzIiwic3JjL1RyaWJ1dGVNZW51RXZlbnRzLmpzIiwic3JjL1RyaWJ1dGVSYW5nZS5qcyIsInNyYy9UcmlidXRlU2VhcmNoLmpz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lZmF1bHRNZW51SXRlbVRlbXBsYXRlKS5iaW5kKHRoaXMpLFxuXG4gICAgICAgICAgICAgICAgLy8gZnVuY3Rpb24gY2FsbGVkIHdoZW4gbWVudSBpcyBlbXB0eSwgZGlzYWJsZXMgaGlkaW5nIG9mIG1lbnUuXG4gICAgICAgICAgICAgICAgbm9NYXRjaFRlbXBsYXRlOiAoKHQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0ID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5iaW5kKHRoaXMpXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgIH0pKG5vTWF0Y2hUZW1wbGF0ZSksXG5cbiAgICAgICAgICAgICAgICAvLyBjb2x1bW4gdG8gc2VhcmNoIGFnYWluc3QgaW4gdGhlIG9iamVjdFxuICAgICAgICAgICAgICAgIGxvb2t1cDogbG9va3VwLFxuXG4gICAgICAgICAgICAgICAgLy8gY29sdW1uIHRoYXQgY29udGFpbnMgdGhlIGNvbnRlbnQgdG8gaW5zZXJ0IGJ5IGRlZmF1bHRcbiAgICAgICAgICAgICAgICBmaWxsQXR0cjogZmlsbEF0dHIsXG5cbiAgICAgICAgICAgICAgICAvLyBhcnJheSBvZiBvYmplY3RzXG4gICAgICAgICAgICAgICAgdmFsdWVzOiB2YWx1ZXNcbiAgICAgICAgICAgIH1dXG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoY29sbGVjdGlvbikge1xuICAgICAgICAgICAgdGhpcy5jb2xsZWN0aW9uID0gY29sbGVjdGlvbi5tYXAoaXRlbSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlcjogaXRlbS50cmlnZ2VyIHx8IHRyaWdnZXIsXG4gICAgICAgICAgICAgICAgICAgIGlmcmFtZTogaXRlbS5pZnJhbWUgfHwgaWZyYW1lLFxuICAgICAgICAgICAgICAgICAgICBzZWxlY3RDbGFzczogaXRlbS5zZWxlY3RDbGFzcyB8fCBzZWxlY3RDbGFzcyxcbiAgICAgICAgICAgICAgICAgICAgc2VsZWN0VGVtcGxhdGU6IChpdGVtLnNlbGVjdFRlbXBsYXRlIHx8IFRyaWJ1dGUuZGVmYXVsdFNlbGVjdFRlbXBsYXRlKS5iaW5kKHRoaXMpLFxuICAgICAgICAgICAgICAgICAgICBtZW51SXRlbVRlbXBsYXRlOiAoaXRlbS5tZW51SXRlbVRlbXBsYXRlIHx8IFRyaWJ1dGUuZGVmYXVsdE1lbnVJdGVtVGVtcGxhdGUpLmJpbmQodGhpcyksXG4gICAgICAgICAgICAgICAgICAgIC8vIGZ1bmN0aW9uIGNhbGxlZCB3aGVuIG1lbnUgaXMgZW1wdHksIGRpc2FibGVzIGhpZGluZyBvZiBtZW51LlxuICAgICAgICAgICAgICAgICAgICBub01hdGNoVGVtcGxhdGU6ICgodCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0ID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYmluZCh0aGlzKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgICAgICB9KShub01hdGNoVGVtcGxhdGUpLFxuICAgICAgICAgICAgICAgICAgICBsb29rdXA6IGl0ZW0ubG9va3VwIHx8IGxvb2t1cCxcbiAgICAgICAgICAgICAgICAgICAgZmlsbEF0dHI6IGl0ZW0uZmlsbEF0dHIgfHwgZmlsbEF0dHIsXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlczogaXRlbS52YWx1ZXNcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICAgIGVsc2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dGUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmhpZGVNZW51KClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdWwuaW5uZXJIVE1MID0gdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24ubm9NYXRjaFRlbXBsYXRlKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB1bC5pbm5lckhUTUwgPSAnJ1xuXG4gICAgICAgIGl0ZW1zLmZvckVhY2goKGl0ZW0sIGluZGV4KSA9PiB7XG4gICAgICAgICAgICBsZXQgbGkgPSB0aGlzLnJhbmdlLmdldERvY3VtZW50KCkuY3JlYXRlRWxlbWVudCgnbGknKVxuICAgICAgICAgICAgbGkuc2V0QXR0cmlidXRlKCdkYXRhLWluZGV4JywgaW5kZXgpXG4gICAgICAgICAgICBpZiAodGhpcy5tZW51U2VsZWN0ZWQgPT09IGluZGV4KSB7XG4gICAgICAgICAgICAgICAgbGkuY2xhc3NOYW1lID0gdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24uc2VsZWN0Q2xhc3NcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxpLmlubmVySFRNTCA9IHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLm1lbnVJdGVtVGVtcGxhdGUoaXRlbSlcbiAgICAgICAgICAgIHVsLmFwcGVuZENoaWxkKGxpKVxuICAgICAgICB9KVxuXG4gICAgICAgIHRoaXMucmFuZ2UucG9zaXRpb25NZW51QXRDYXJldChzY3JvbGxUbylcblxuICAgIH1cblxuICAgIGhpZGVNZW51KCkge1xuICAgICAgICBpZiAodGhpcy5tZW51KSB7XG4gICAgICAgICAgICB0aGlzLm1lbnUuc3R5bGUuY3NzVGV4dCA9ICdkaXNwbGF5OiBub25lOydcbiAgICAgICAgICAgIHRoaXMuaXNBY3RpdmUgPSBmYWxzZVxuICAgICAgICAgICAgdGhpcy5tZW51U2VsZWN0ZWQgPSAwXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnQgPSB7fVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgc2VsZWN0SXRlbUF0SW5kZXgoaW5kZXgpIHtcbiAgICAgICAgaW5kZXggPSBwYXJzZUludChpbmRleClcbiAgICAgICAgaWYgKHR5cGVvZiBpbmRleCAhPT0gJ251bWJlcicpIHJldHVyblxuICAgICAgICBsZXQgaXRlbSA9IHRoaXMuY3VycmVudC5maWx0ZXJlZEl0ZW1zW2luZGV4XVxuICAgICAgICBsZXQgY29udGVudCA9IHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLnNlbGVjdFRlbXBsYXRlKGl0ZW0pXG4gICAgICAgIHRoaXMucmVwbGFjZVRleHQoY29udGVudClcbiAgICB9XG5cbiAgICByZXBsYWNlVGV4dChjb250ZW50KSB7XG4gICAgICAgIHRoaXMucmFuZ2UucmVwbGFjZVRyaWdnZXJUZXh0KGNvbnRlbnQsIHRydWUsIHRydWUpXG4gICAgfVxuXG4gICAgX2FwcGVuZChjb2xsZWN0aW9uLCBlbGVtZW50LCBuZXdWYWx1ZXMsIHJlcGxhY2UpIHtcbiAgICAgICAgaWYgKHRoaXMuaXNBY3RpdmUpIHtcbiAgICAgICAgICAgIGlmICghcmVwbGFjZSkge1xuICAgICAgICAgICAgICAgIGNvbGxlY3Rpb24udmFsdWVzID0gY29sbGVjdGlvbi52YWx1ZXMuY29uY2F0KG5ld1ZhbHVlcylcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29sbGVjdGlvbi52YWx1ZXMgPSBuZXdWYWx1ZXNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGFwcGVuZChjb2xsZWN0aW9uSW5kZXgsIG5ld1ZhbHVlcywgcmVwbGFjZSkge1xuICAgICAgICBsZXQgaW5kZXggPSBwYXJzZUludChjb2xsZWN0aW9uSW5kZXgpXG4gICAgICAgIGlmICh0eXBlb2YgaW5kZXggIT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BrZXk6IDM4LFxuICAgICAgICAgICAgdmFsdWU6ICdVUCdcbiAgICAgICAgfSwge1xuICAgICAgICAgICAga2V5OiA0MCxcbiAgICAgICAgICAgIHZhbHVlOiAnRE9XTidcbiAgICAgICAgfV1cbiAgICB9XG5cbiAgICBiaW5kKGVsZW1lbnQpIHtcbiAgICAgICAgZWxlbWVudC5hZGRFdmVudExpc3RlbmVyKCdrZXlkb3duJyxcbiAgICAgICAgICAgIHRoaXMua2V5ZG93bi5iaW5kKGVsZW1lbnQsIHRoaXMpLCBmYWxzZSlcbiAgICAgICAgZWxlbWVudC5hZGRFdmVudExpc3RlbmVyKCdrZXl1cCcsXG4gICAgICAgICAgICB0aGlzLmtleXVwLmJpbmQoZWxlbWVudCwgdGhpcyksIGZhbHNlKVxuICAgICAgICBlbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0JyxcbiAgICAgICAgICAgIHRoaXMuaW5wdXQuYmluZChlbGVtZW50LCB0aGlzKSwgZmFsc2UpXG4gICAgfVxuXG4gICAga2V5ZG93bihpbnN0YW5jZSwgZXZlbnQpIHtcbiAgICAgICAgaWYgKGluc3RhbmNlLnNob3VsZERlYWN0aXZhdGUoZXZlbnQpKSB7XG4gICAgICAgICAgICBpbnN0YW5jZS50cmlidXRlLmlzQWN0aXZlID0gZmFsc2VcbiAgICAgICAgfVxuXG4gICAgICAgIGxldCBlbGVtZW50ID0gdGhpc1xuICAgICAgICBpbnN0YW5jZS5jb21tYW5kRXZlbnQgPSBmYWxzZVxuXG4gICAgICAgIFRyaWJ1dGVFdmVudHMua2V5cygpLmZvckVhY2gobyA9PiB7XG4gICAgICAgICAgICBpZiAoby5rZXkgPT09IGV2ZW50LmtleUNvZGUpIHtcbiAgICAgICAgICAgICAgICBpbnN0YW5jZS5jb21tYW5kRXZlbnQgPSB0cnVlXG4gICAgICAgICAgICAgICAgaW5zdGFuY2UuY2FsbGJhY2tzKClbby52YWx1ZS50b0xvd2VyQ2FzZSgpXShldmVud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lKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgc2hvdWxkRGVhY3RpdmF0ZShldmVudCkge1xuICAgICAgICBpZiAoIXRoaXMudHJpYnV0ZS5pc0FjdGl2ZSkgcmV0dXJuIGZhbHNlXG5cbiAgICAgICAgaWYgKHRoaXMudHJpYnV0ZS5jdXJyZW50Lm1lbnRpb25UZXh0Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgbGV0IGV2ZW50S2V5UHJlc3NlZCA9IGZhbHNlXG4gICAgICAgICAgICBUcmlidXRlRXZlbnRzLmtleXMoKS5mb3JFYWNoKG8gPT4ge1xuICAgICAgICAgICAgICAgIGlmIChldmVudC5rZXlDb2RlID09PSBvLmtleSkgZXZlbnRLZXlQcmVzc2VkID0gdHJ1ZVxuICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgcmV0dXJuICFldmVudEtleVByZXNzZWRcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBmYWxzZVxuICAgIH1cblxuICAgIGdldEtleUNvZGUoaW5zdGFuY2UsIGVsLCBldmVudCkge1xuICAgICAgICBsZXQgY2hhclxuICAgICAgICBsZXQgdHJpYnV0ZSA9IGluc3RhbmNlLnRyaWJ1dGVcbiAgICAgICAgbGV0IGluZm8gPSB0cmlidXRlLnJhbmdlLmdldFRyaWdnZXJJbmZvKGZhbHNlLCBmYWxzZSwgdHJ1ZSlcblxuICAgICAgICBpZiAoaW5mbykge1xuICAgICAgICAgICAgcmV0dXJuIGluZm8ubWVudGlvblRyaWdnZXJDaGFyLmNoYXJDb2RlQXQoMClcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgdXBkYXRlU2VsZWN0aW9uKGVsKSB7XG4gICAgICAgIHRoaXMudHJpYnV0ZS5jdXJyZW50LmVsZW1lbnQgPSBlbFxuICAgICAgICBsZXQgaW5mbyA9IHRoaXMudHJpYnV0ZS5yYW5nZS5nZXRUcmlnZ2VySW5mbyhmYWxzZSwgZmFsc2UsIHRydWUpXG5cbiAgICAgICAgaWYgKGluZm8pIHtcbiAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5jdXJyZW50LnNlbGVjdGVkUGF0aCA9IGluZm8ubWVudGlvblNlbGVjdGVkUGF0aFxuICAgICAgICAgICAgdGhpcy50cmlidXRlLmN1cnJlbnQubWVudGlvblRleHQgPSBpbmZvLm1lbnRpb25UZXh0XG4gICAgICAgICAgICB0aGlzLnRyaWJ1dGUuY3VycmVudC5zZWxlY3RlZE9mZnNldCA9IGluZm8ubWVudGlvblNlbGVjdGVkT2Zmc2V0XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjYWxsYmFja3MoKSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB0cmlnZ2VyQ2hhcjogKGUsIGVsLCB0cmlnZ2VyKSA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IHRyaWJ1dGUgPSB0aGlzLnRyaWJ1dGVcbiAgICAgICAgICAgICAgICB0cmlidXRlLmN1cnJlbnQudHJpZ2dlciA9IHRyaWdnZXJcblxuICAgICAgICAgICAgICAgIGxldCBjb2xsZWN0aW9uSXRlbSA9IHRyaWJ1dGUuY29sbGVjdGlvbi5maW5kKGl0ZW0gPT4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXRlbS50cmlnZ2VyID09PSB0cmlnZ2VyXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHRyaWJ1dGUuY3VycmVudC5jb2xsZWN0aW9uID0gY29sbGVjdGlvbkl0ZW1cblxuICAgICAgICAgICAgICAgIHRyaWJ1dGUuc2hvd01lbnVGb3IoZWwsIHRydWUpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZW50ZXI6IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGNob29zZSBzZWxlY3Rpb25cbiAgICAgICAgICAgICAgICBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKVxuICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5zZWxlY3RJdGVtQXRJbmRleCh0aGlzLnRyaWJ1dGUubWVudVNlbGVjdGVkKVxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlidXRlLmhpZGVNZW51KClcbiAgICAgICAgICAgICAgICAgICAgfSwgMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZXNjYXBlOiAoZSwgZWwpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKVxuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWJ1dGUuaGlkZU1lbnUoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB0YWI6IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIGNob29zZSBmaXJzdCBtYXRjaFxuICAgICAgICAgICAgICAgIHRoaXMuY2FsbGJhY2tzKCkuZW50ZXIoZSwgZWwpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgdXA6IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIG5hdmlnYXRlIHVwIHVsXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudHJpYnV0ZS5pc0FjdGl2ZSkge1xuICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KClcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvdW50ID0gdGhpcy50cmlidXRlLmN1cnJlbnQuZmlsdGVyZWRJdGVtcy5sZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RlZCA9IHRoaXMudHJpYnV0ZS5tZW51U2VsZWN0ZWRcblxuICAgICAgICAgICAgICAgICAgICBpZiAoY291bnQgPiBzZWxlY3RlZCAmJiBzZWxlY3RlZCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5tZW51U2VsZWN0ZWQtLVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0QWN0aXZlTGkoKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGRvd246IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIG5hdmlnYXRlIGRvd24gdWxcbiAgICAgICAgICAgICAgICBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKVxuICAgICAgICAgICAgICAgICAgICBsZXQgY291bnQgPSB0aGlzLnRyaWJ1dGUuY3VycmVudC5maWx0ZXJlZEl0ZW1zLmxlbmd0aCAtIDEsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RlZCA9IHRoaXMudHJpYnV0ZS5tZW51U2VsZWN0ZWRcblxuICAgICAgICAgICAgICAgICAgICBpZiAoY291bnQgPiBzZWxlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlidXRlLm1lbnVTZWxlY3RlZCsrXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRBY3RpdmVMaSgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZGVsZXRlOiAoZSwgZWwpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlICYmIHRoaXMudHJpYnV0ZS5jdXJyZW50Lm1lbnRpb25UZXh0Lmxlbmd0aCA8IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlidXRlLmhpZGVNZW51KCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLnRyaWJ1dGUuaXNBY3RpdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgdHJpYnV0ZS5zaG93TWVudUZvcihlbClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXRBY3RpdmVMaShpbmRleCkge1xuICAgICAgICBsZXQgbGlzID0gdGhpcy50cmlidXRlLm1lbnUucXVlcnlTZWxlY3RvckFsbCgnbGknKSxcbiAgICAgICAgICAgIGxlbmd0aCA9IGxpcy5sZW5ndGggPj4+IDBcblxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBsZXQgbGkgPSBsaXNbaV1cbiAgICAgICAgICAgIGlmIChpID09PSB0aGlzLnRyaWJ1dGUubWVudVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgbGkuY2xhc3NOYW1lID0gdGhpcy50cmlidXRlLmN1cnJlbnQuY29sbGVjdGlvbi5zZWxlY3RDbGFzc1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbGkuY2xhc3NOYW1lID0gJydcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxufVxuXG5cbmV4cG9ydCBkZWZhdWx0IFRyaWJ1dGVFdmVudHM7XG4iLCJjbGFzcyBUcmlidXRlTWVudUV2ZW50cyB7XG4gICAgY29uc3RydWN0b3IodHJpYnV0ZSkge1xuICAgICAgICB0aGlzLnRyaWJ1dGUgPSB0cmlidXRlXG4gICAgICAgIHRoaXMudHJpYnV0ZS5tZW51RXZlbnRzID0gdGhpc1xuICAgICAgICB0aGlzLm1lbnUgPSB0aGlzLnRyaWJ1dGUubWVudVxuICAgIH1cblxuICAg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m9sbCA9IHRoaXMuZGVib3VuY2UoKCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyaWJ1dGUuaXNBY3RpdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlidXRlLnNob3dNZW51Rm9yKHRoaXMudHJpYnV0ZS5jdXJyZW50LmVsZW1lbnQsIGZhbHNlKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sIDMwMCwgZmFsc2UpXG4gICAgICAgIH1cblxuICAgIH1cblxuICAgIGRlYm91bmNlKGZ1bmMsIHdhaXQsIGltbWVkaWF0ZSkge1xuICAgICAgICB2YXIgdGltZW91dFxuICAgICAgICByZXR1cm4gKCkgPT4ge1xuICAgICAgICAgICAgdmFyIGNvbnRleHQgPSB0aGlzLFxuICAgICAgICAgICAgICAgIGFyZ3MgPSBhcmd1bWVudHNcbiAgICAgICAgICAgIHZhciBsYXRlciA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICB0aW1lb3V0ID0gbnVsbFxuICAgICAgICAgICAgICAgIGlmICghaW1tZWRpYXRlKSBmdW5jLmFwcGx5KGNvbnRleHQsIGFyZ3MpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgY2FsbE5vdyA9IGltbWVkaWF0ZSAmJiAhdGltZW91dFxuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXQpXG4gICAgICAgICAgICB0aW1lb3V0ID0gc2V0VGltZW91dChsYXRlciwgd2FpdClcbiAgICAgICAgICAgIGlmIChjYWxsTm93KSBmdW5jLmFwcGx5KGNvbnRleHQsIGFyZ3MpXG4gICAgICAgIH1cbiAgICB9XG59XG5cblxuZXhwb3J0IGRlZmF1bHQgVHJpYnV0ZU1lbnVFdmVudHM7IiwiLy8gVGhhbmtzIHRvIGh0dHBzOi8vZ2l0aHViLmNvbS9qZWZmLWNvbGxpbnMvbWVudC5pb1xuY2xhc3MgVHJpYnV0ZVJhbmdlIHtcbiAgICBjb25zdHJ1Y3Rvcih0cmlidXRlKSB7XG4gICAgICAgIHRoaXMudHJpYnV0ZSA9IHRyaWJ1dGVcbiAgICAgICAgdGhpcy50cmlidXRlLnJhbmdlID0gdGhpc1xuICAgIH1cblxuICAgIGdldERvY3VtZW50KCkge1xuICAgICAgICBsZXQgaWZyYW1lXG4gICAgICAgIGlmICh0aGlzLnRyaWJ1dGUuY3VycmVudC5jb2xsZWN0aW9uKSB7XG4gICAgICAgICAgICBpZnJhbWUgPSB0aGlzLnRyaWJ1dGUuY3VycmVudC5jb2xsZWN0aW9uLmlmcmFtZVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFpZnJhbWUpIHtcbiAgICAgICAgICAgIHJldHVybiBkb2N1bWVudFxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGlmcmFtZS5jb250ZW50V2luZG93LmRvY3VtZW50XG4gICAgfVxuXG4gICAgcG9zaXRpb25NZW51QXRDYXJldChzY3JvbGxUbykge1xuICAgICAgICBsZXQgY29udGV4dCA9IHRoaXMudHJpYnV0ZS5jdXJyZW50LFxuICAgICAgICAgICAgY29vcmRpbmF0ZXNcbiAgICAgICAgbGV0IGluZm8gPSB0aGlzLmdldFRyaWdnZXJJbmZvKGZhbHNlLCBmYWxzZSwgdHJ1ZSlcblxuICAgICAgICBpZiAoaW5mbyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuaXNDb250ZW50RWRpdGFibGUoY29udGV4dC5lbGVtZW50KSkge1xuICAgICAgICAgICAgICAgIGNvb3JkaW5hdGVzID0gdGhpcy5nZXRUZXh0QXJlYU9ySW5wdXRVbmRlcmxpbmVQb3NpdGlvbih0aGlzLmdldERvY3VtZW50KCkuYWN0aXZlRWxlbWVudCxcbiAgICAgICAgICAgICAgICAgICAgaW5mby5tZW50aW9uUG9zaXRpb24pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb29yZGluYXRlcyA9IHRoaXMuZ2V0Q29udGVudEVkaXRhYmxlQ2FyZXRQb3NpdGlvbihpbmZvLm1lbnRpb25Qb3NpdGlvbilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gTW92ZSB0aGUgYnV0dG9uIGludG8gcGxhY2UuXG4gICAgICAgICAgICB0aGlzLnRyaWJ1dGUubWVudS5zdHlsZS5jc3NUZXh0ID0gYHRvcDogJHtjb29yZGluYXRlcy50b3B9cHg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiAke2Nvb3JkaW5hdGVzLmxlZnR9cHg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6SW5kZXg6IDEwMDAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogYmxvY2s7YFxuXG4gICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsVG8pIHRoaXMuc2Nyb2xsSW50b1ZpZXcodGhpcy5nZXREb2N1bWVudCgpLmFjdGl2ZUVsZW1lbnQpXG4gICAgICAgICAgICB9LCAwKVxuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdGhpcy50cmlidXRlLm1lbnUuc3R5bGUuY3NzVGV4dCA9ICdkaXNwbGF5OiBub25lJ1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgc2VsZWN0RWxlbWVudCh0YXJnZXRFbGVtZW50LCBwYXRoLCBvZmZzZXQpIHtcbiAgICAgICAgbGV0IHJhbmdlXG4gICAgICAgIGxldCBlbGVtID0gdGFyZ2V0RWxlbWVudFxuXG4gICAgICAgIGlmIChwYXRoKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBhdGgubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBlbGVtID0gZWxlbS5jaGlsZE5vZGVzW3BhdGhbaV1dXG4gICAgICAgICAgICAgICAgaWYgKGVsZW0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgd2hpbGUgKGVsZW0ubGVuZ3RoIDwgb2Zmc2V0KSB7XG4gICAgICAgICAgICAgICAgICAgIG9mZnNldCAtPSBlbGVtLmxlbmd0aFxuICAgICAgICAgICAgICAgICAgICBlbGVtID0gZWxlbS5uZXh0U2libGluZ1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoZWxlbS5jaGlsZE5vZGVzLmxlbmd0aCA9PT0gMCAmJiAhZWxlbS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgZWxlbSA9IGVsZW0ucHJldmlvdXNTaWJsaW5nXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxldCBzZWwgPSB0aGlzLmdldFdpbmRvd1NlbGVjdGlvbigpXG5cbiAgICAgICAgcmFuZ2UgPSB0aGlzLmdldERvY3VtZW50KCkuY3JlYXRlUmFuZ2UoKVxuICAgICAgICByYW5nZS5zZXRTdGFydChlbGVtLCBvZmZzZXQpXG4gICAgICAgIHJhbmdlLnNldEVuZChlbGVtLCBvZmZzZXQpXG4gICAgICAgIHJhbmdlLmNvbGxhcHNlKHRydWUpXG5cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHNlbC5yZW1vdmVBbGxSYW5nZXMoKVxuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnJvcikge31cblxuICAgICAgICBzZWwuYWRkUmFuZ2UocmFuZ2UpXG4gICAgICAgIHRhcmdldEVsZW1lbnQuZm9jdXMoKVxuICAgIH1cblxuICAgIHJlc2V0U2VsZWN0aW9uKHRhcmdldEVsZW1lbn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4gICAgICAgICAgICAgICAgbGV0IG15RmllbGQgPSB0aGlzLmdldERvY3VtZW50KCkuYWN0aXZlRWxlbWVudFxuICAgICAgICAgICAgICAgIHRleHQgKz0gJyAnXG4gICAgICAgICAgICAgICAgbGV0IHN0YXJ0UG9zID0gaW5mby5tZW50aW9uUG9zaXRpb25cbiAgICAgICAgICAgICAgICBsZXQgZW5kUG9zID0gaW5mby5tZW50aW9uUG9zaXRpb24gKyBpbmZvLm1lbnRpb25UZXh0Lmxlbmd0aCArIDFcbiAgICAgICAgICAgICAgICBteUZpZWxkLnZhbHVlID0gbXlGaWVsZC52YWx1ZS5zdWJzdHJpbmcoMCwgc3RhcnRQb3MpICsgdGV4dCArXG4gICAgICAgICAgICAgICAgICAgIG15RmllbGQudmFsdWUuc3Vic3RyaW5nKGVuZFBvcywgbXlGaWVsZC52YWx1ZS5sZW5ndGgpXG4gICAgICAgICAgICAgICAgbXlGaWVsZC5zZWxlY3Rpb25TdGFydCA9IHN0YXJ0UG9zICsgdGV4dC5sZW5ndGhcbiAgICAgICAgICAgICAgICBteUZpZWxkLnNlbGVjdGlvbkVuZCA9IHN0YXJ0UG9zICsgdGV4dC5sZW5ndGhcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIGFkZCBhIHNwYWNlIHRvIHRoZSBlbmQgb2YgdGhlIHBhc3RlZCB0ZXh0XG4gICAgICAgICAgICAgICAgdGV4dCArPSAnXFx4QTAnXG4gICAgICAgICAgICAgICAgdGhpcy5wYXN0ZUh0bWwodGV4dCwgaW5mby5tZW50aW9uUG9zaXRpb24sXG4gICAgICAgICAgICAgICAgICAgIGluZm8ubWVudGlvblBvc2l0aW9uICsgaW5mby5tZW50aW9uVGV4dC5sZW5ndGggKyAxKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjb250ZXh0LmVsZW1lbnQuZGlzcGF0Y2hFdmVudChyZXBsYWNlRXZlbnQpXG4gICAgICAgI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ICAgICAgICAgc2VsLmFkZFJhbmdlKHJhbmdlKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZ2V0V2luZG93U2VsZWN0aW9uKCkge1xuICAgICAgICBpZiAodGhpcy50cmlidXRlLmNvbGxlY3Rpb24uaWZyYW1lKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy50cmlidXRlLmNvbGxlY3Rpb24uaWZyYW1lLmNvbnRlbnRXaW5kb3cuZ2V0U2VsZWN0aW9uKClcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB3aW5kb3cuZ2V0U2VsZWN0aW9uKClcbiAgICB9XG5cbiAgICBnZXROb2RlUG9zaXRpb25JblBhcmVudChlbGVtZW50KSB7XG4gICAgICAgIGlmIChlbGVtZW50LnBhcmVudE5vZGUgPT09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGVsZW1lbnQucGFyZW50Tm9kZS5jaGlsZE5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBsZXQgbm9kZSA9IGVsZW1lbnQucGFyZW50Tm9kZS5jaGlsZE5vZGVzW2ldXG5cbiAgICAgICAgICAgIGlmIChub2RlID09PSBlbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldENvbnRlbnRFZGl0YWJsZVNlbGVjdGVkUGF0aCgpIHtcbiAgICAgICAgLy8gY29udGVudCBlZGl0YWJsZVxuICAgICAgICBsZXQgc2VsID0gdGhpcy5nZXRXaW5kb3dTZWxlY3Rpb24oKVxuICAgICAgICBsZXQgc2VsZWN0ZWQgPSBzZWwuYW5jaG9yTm9kZVxuICAgICAgICBsZXQgcGF0aCA9IFtdXG4gICAgICAgIGxldCBvZmZzZXRcblxuICAgICAgICBpZiAoc2VsZWN0ZWQgIT0gbnVsbCkge1xuICAgICAgICAgICAgbGV0IGlcbiAgICAgICAgICAgIGxldCBjZSA9IHNlbGVjdGVkLmNvbnRlbnRFZGl0YWJsZVxuICAgICAgICAgICAgd2hpbGUgKHNlbGVjdGVkICE9PSBudWxsICYmIGNlICE9PSAndHJ1ZScpIHtcbiAgICAgICAgICAgICAgICBpID0gdGhpcy5nZXROb2RlUG9zaXRpb25JblBhcmVudChzZWxlY3RlZClcbiAgICAgICAgICAgICAgICBwYXRoLnB1c2goaSlcbiAgICAgICAgICAgICAgICBzZWxlY3RlZCA9IHNlbGVjdGVkLnBhcmVudE5vZGVcbiAgICAgICAgICAgICAgICBpZiAoc2VsZWN0ZWQgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgY2UgPSBzZWxlY3RlZC5jb250ZW50RWRpdGFibGVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwYXRoLnJldmVyc2UoKVxuXG4gICAgICAgICAgICAvLyBnZXRSYW5nZUF0IG1heSBub3QgZXhpc3QsIG5lZWQgYWx0ZXJuYXRpdmVcbiAgICAgICAgICAgIG9mZnNldCA9IHNlbC5nZXRSYW5nZUF0KDApLnN0YXJ0T2Zmc2V0XG5cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgc2VsZWN0ZWQ6IHNlbGVjdGVkLFxuICAgICAgICAgICAgICAgIHBhdGg6IHBhdGgsXG4gICAgICAgICAgICAgICAgb2Zmc2V0OiBvZmZzZXRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldFRleHRQcmVjZWRpbmdDdXJyZW50U2VsZWN0aW9uKCkge1xuICAgICAgICBsZXQgY29udGV4dCA9IHRoaXMudHJpYnV0ZS5jdXJyZW50LFxuICAgICAgICAgICAgdGV4dFxuXG4gICAgICAgIGlmICghdGhpcy5pc0NvbnRlbnRFZGl0YWJsZShjb250ZXh0LmVsZW1lbnQpKSB7XG4gICAgICAgICAgICBsZ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cykge1xuICAgICAgICAgICAgICAgICAgICBtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MgPSBpZHhcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlckNoYXIgPSBjXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgaWYgKG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyA+PSAwICYmXG4gICAgICAgICAgICAgICAgKFxuICAgICAgICAgICAgICAgICAgICBtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MgPT09IDAgfHxcbiAgICAgICAgICAgICAgICAgICAgIXJlcXVpcmVMZWFkaW5nU3BhY2UgfHxcbiAgICAgICAgICAgICAgICAgICAgL1tcXHhBMFxcc10vZy50ZXN0KFxuICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0aXZlUmFuZ2Uuc3Vic3RyaW5nKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyAtIDEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9zdFJlY2VudFRyaWdnZXJDaGFyUG9zKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRUcmlnZ2VyU25pcHBldCA9IGVmZmVjdGl2ZVJhbmdlLnN1YnN0cmluZyhtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MgKyAxLFxuICAgICAgICAgICAgICAgICAgICBlZmZlY3RpdmVSYW5nZS5sZW5ndGgpXG5cbiAgICAgICAgICAgICAgICB0cmlnZ2VyQ2hhciA9IGVmZmVjdGl2ZVJhbmdlLnN1YnN0cmluZyhtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MsIG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyArIDEpXG4gICAgICAgICAgICAgICAgbGV0IGZpcnN0U25pcHBldENoYXIgPSBjdXJyZW50VHJpZ2dlclNuaXBwZXQuc3Vic3RyaW5nKDAsIDEpXG4gICAgICAgICAgICAgICAgbGV0IGxlYWRpbmdTcGFjZSA9IGN1cnJlbnRUcmlnZ2VyU25pcHBldC5sZW5ndGggPiAwICYmXG4gICAgICAgICAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0U25pcHBldENoYXIgPT09ICcgJyB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RTbmlwcGV0Q2hhciA9PT0gJ1xceEEwJ1xuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgaWYgKGhhc1RyYWlsaW5nU3BhY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudFRyaWdnZXJTbmlwcGV0ID0gY3VycmVudFRyaWdnZXJTbmlwcGV0LnRyaW0oKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIWxlYWRpbmdTcGFjZSAmJiAobWVudUFscmVhZHlBY3RpdmUgfHwgISgvW1xceEEwXFxzXS9nLnRlc3QoY3VycmVudFRyaWdnZXJTbmlwcGV0KSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uUG9zaXRpb246IG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25UZXh0OiBjdXJyZW50VHJpZ2dlclNuaXBwZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uU2VsZWN0ZWRFbGVtZW50OiBzZWxlY3RlZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25TZWxlY3RlZFBhdGg6IHBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uU2VsZWN0ZWRPZmZzZXQ6IG9mZnNldCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25Ucml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ArIG1hcmtlckVsLm9mZnNldEhlaWdodCArIHdpbmRvd1RvcFxuICAgICAgICB9XG5cbiAgICAgICAgbWFya2VyRWwucGFyZW50Tm9kZS5yZW1vdmVDaGlsZChtYXJrZXJFbClcbiAgICAgICAgcmV0dXJuIGNvb3JkaW5hdGVzXG4gICAgfVxuXG4gICAgc2Nyb2xsSW50b1ZpZXcoZWxlbSkge1xuICAgICAgICBsZXQgcmVhc29uYWJsZUJ1ZmZlciA9IDIwLFxuICAgICAgICAgICAgY2xpZW50UmVjdFxuICAgICAgICBsZXQgbWF4U2Nyb2xsRGlzcGxhY2VtZW50ID0gMTAwXG4gICAgICAgIGxldCBlID0gZWxlbVxuXG4gICAgICAgIHdoaWxlIChjbGllbnRSZWN0ID09PSB1bmRlZmluZWQgfHwgY2xpZW50UmVjdC5oZWlnaHQgPT09IDApIHtcbiAgICAgICAgICAgIGNsaWVudFJlY3QgPSBlLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpXG5cbiAgICAgICAgICAgIGlmIChjbGllbnRSZWN0LmhlaWdodCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGUgPSBlLmNoaWxkTm9kZXNbMF1cbiAgICAgICAgICAgICAgICBpZiAoZSA9PT0gdW5kZWZpbmVkIHx8ICFlLmdldEJvdW5kaW5nQ2xpZW50UmVjdCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgZWxlbVRvcCA9IGNsaWVudFJlY3QudG9wXG4gICAgICAgIGxldCBlbGVtQm90dG9tID0gZWxlbVRvcCArIGNsaWVudFJlY3QuaGVpZ2h0XG5cbiAgICAgICAgaWYgKGVsZW1Ub3AgPCAwKSB7XG4gICAgICAgICAgICB3aW5kb3cuc2Nyb2xsVG8oMCwgd2luZG93LnBhZ2VZT2Zmc2V0ICsgY2xpZW50UmVjdC50b3AgLSByZWFzb25hYmxlQnVmZmV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gd2hpbGUgKGluZGV4ID4gLTEpIHtcbiAgICAgICAgICAgIHBhdHRlcm5DYWNoZS5wdXNoKGluZGV4KVxuICAgICAgICAgICAgdGVtcCA9IHRoaXMudHJhdmVyc2Uoc3RyaW5nLCBwYXR0ZXJuLCBpbmRleCArIDEsIHBhdHRlcm5JbmRleCArIDEsIHBhdHRlcm5DYWNoZSlcbiAgICAgICAgICAgIHBhdHRlcm5DYWNoZS5wb3AoKVxuXG4gICAgICAgICAgICAvLyBpZiBkb3duc3RyZWFtIHRyYXZlcnNhbCBmYWlsZWQsIHJldHVybiBiZXN0IGFuc3dlciBzbyBmYXJcbiAgICAgICAgICAgIGlmICghdGVtcCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiZXN0XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghYmVzdCB8fCBiZXN0LnNjb3JlIDwgdGVtcC5zY29yZSkge1xuICAgICAgICAgICAgICAgIGJlc3QgPSB0ZW1wXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGluZGV4ID0gc3RyaW5nLmluZGV4T2YoYywgaW5kZXggKyAxKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGJlc3RcbiAgICB9XG5cbiAgICBjYWxjdWxhdGVTY29yZShwYXR0ZXJuQ2FjaGUpIHtcbiAgICAgICAgbGV0IHNjb3JlID0gMFxuICAgICAgICBsZXQgdGVtcCA9IDFcblxuICAgICAgICBwYXR0ZXJuQ2FjaGUuZm9yRWFjaCgoaW5kZXgsIGkpID0+IHtcbiAgICAgICAgICAgIGlmIChpID4gMCkge1xuICAgICAgICAgICAgICAgIGlmIChwYXR0ZXJuQ2FjaGVbaSAtIDFdICsgMSA9PT0gaW5kZXgpIHtcbiAgICAgICAgICAgICAgICAgICAgdGVtcCArPSB0ZW1wICsgMVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGVtcCA9IDFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHNjb3JlICs9IHRlbXBcbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4gc2NvcmVcbiAgICB9XG5cbiAgICByZW5kZXIoc3RyaW5nLCBpbmRpY2VzLCBwcmUsIHBvc3QpIHtcbiAgICAgICAgdmFyIHJlbmRlcmVkID0gc3RyaW5nLnN1YnN0cmluZygwLCBpbmRpY2VzWzBdKVxuXG4gICAgICAgIGluZGljZXMuZm9yRWFjaCgoaW5kZXgsIGkpID0+IHtcbiAgICAgICAgICAgIHJlbmRlcmVkICs9IHByZSArIHN0cmluZ1tpbmRleF0gKyBwb3N0ICtcbiAgICAgICAgICAgICAgICBzdHJpbmcuc3Vic3RyaW5nKGluZGV4ICsgMSwgKGluZGljZXNbaSArIDFdKSA/IGluZGljZXNbaSArIDFdIDogc3RyaW5nLmxlbmd0aClcbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4gcmVuZGVyZWRcbiAgICB9XG5cbiAgICBmaWx0ZXIocGF0dGVybiwgYXJyLCBvcHRzKSB7XG4gICAgICAgIG9wdHMgPSBvcHRzIHx8IHt9XG4gICAgICAgIHJldHVybiBhcnJcbiAgICAgICAgICAgIC5yZWR1Y2UoKHByZXYsIGVsZW1lbnQsIGlkeCwgYXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IHN0ciA9IGVsZW1lbnRcblxuICAgICAgICAgICAgICAgIGlmIChvcHRzLmV4dHJhY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RyID0gb3B0cy5leHRyYWN0KGVsZW1lbnQpXG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzdHIpIHsgLy8gdGFrZSBjYXJlIG9mIHVuZGVmaW5lZHMgLyBudWxscyAvIGV0Yy5cbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9ICcnXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBsZXQgcmVuZGVyZWQgPSB0aGlzLm1hdGNoKHBhdHRlcm4sIHN0ciwgb3B0cylcblxuICAgICAgICAgICAgICAgIGlmIChyZW5kZXJlZCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHByZXZbcHJldi5sZW5ndGhdID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nOiByZW5kZXJlZC5yZW5kZXJlZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3JlOiByZW5kZXJlZC5zY29yZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBpZHgsXG4gICAgICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbDogZWxlbWVudFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHByZXZcbiAgICAgICAgICAgIH0sIFtdKVxuXG4gICAgICAgIC5zb3J0KChhLCBiKSA9PiB7XG4gICAgICAgICAgICBsZXQgY29tcGFyZSA9IGIuc2NvcmUgLSBhLnNjb3JlXG4gICAgICAgICAgICBpZiAoY29tcGFyZSkgcmV0dXJuIGNvbXBhcmVcbiAgICAgICAgICAgIHJldHVybiBhLmluZGV4IC0gYi5pbmRleFxuICAgICAgICB9KVxuICAgIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgVHJpYnV0ZVNlYXJjaDsiLCJpZiAoIUFycmF5LnByb3RvdHlwZS5maW5kKSB7XG4gICAgQXJyYXkucHJvdG90eXBlLmZpbmQgPSBmdW5jdGlvbihwcmVkaWNhdGUpIHtcbiAgICAgICAgaWYgKHRoaXMgPT09IG51bGwpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0FycmF5LnByb3RvdHlwZS5maW5kIGNhbGxlZCBvbiBudWxsIG9yIHVuZGVmaW5lZCcpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKHR5cGVvZiBwcmVkaWNh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