TranslatePress – Translate Multilingual sites - Version 1.7.0

Version Description

  • Fixed compatibility issue with JetPack plugin in some cases
  • Fixed JS undefined controls error for some setups
  • Fixed translation memory not working properly for gettext in attributes
  • Added support for Dublin Core meta-data
  • Added support to ignore Elementor encoded url for popup action
  • Improved queries for the database upgrade process
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.9 to 1.7.0

assets/js/trp-editor.js CHANGED
@@ -762,7 +762,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var axio
762
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
763
 
764
  "use strict";
765
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! select2/dist/js/select2.min.js */ \"./node_modules/select2/dist/js/select2.min.js\");\n/* harmony import */ var select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./assets/src/js/utils.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _components_language_boxes_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/language-boxes.vue */ \"./assets/src/js/components/language-boxes.vue\");\n/* harmony import */ var _components_save_translations_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/save-translations.vue */ \"./assets/src/js/components/save-translations.vue\");\n/* harmony import */ var _components_hover_actions_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/hover-actions.vue */ \"./assets/src/js/components/hover-actions.vue\");\n/* harmony import */ var _components_extra_content_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/extra-content.vue */ \"./assets/src/js/components/extra-content.vue\");\n/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! he */ \"./node_modules/he/he.js\");\n/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(he__WEBPACK_IMPORTED_MODULE_7__);\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n props: ['trp_settings', 'language_names', 'ordered_secondary_languages', 'current_language', 'on_screen_language', 'view_as_roles', 'url_to_load', 'string_selectors', 'data_attributes', 'ajax_url', 'editor_nonces', 'string_group_order', 'merge_rules', 'localized_text', 'paid_version', 'flags_path'],\n components: {\n languageBoxes: _components_language_boxes_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n saveTranslations: _components_save_translations_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n hoverActions: _components_hover_actions_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n extraContent: _components_extra_content_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n },\n data: function data() {\n return {\n //props\n settings: JSON.parse(this.trp_settings),\n languageNames: JSON.parse(this.language_names),\n orderedSecondaryLanguages: JSON.parse(this.ordered_secondary_languages),\n roles: JSON.parse(this.view_as_roles),\n nonces: JSON.parse(this.editor_nonces),\n stringGroupOrder: JSON.parse(this.string_group_order),\n selectors: JSON.parse(this.string_selectors),\n dataAttributes: JSON.parse(this.data_attributes),\n mergeRules: JSON.parse(this.merge_rules),\n editorStrings: trp_localized_strings,\n flagsPath: JSON.parse(this.flags_path),\n //data\n currentLanguage: this.current_language,\n onScreenLanguage: this.on_screen_language,\n currentURL: this.url_to_load,\n urlToLoad: this.url_to_load,\n iframe: '',\n dictionary: [],\n selectedString: null,\n selectedIndexesArray: [],\n detectedSelectorAndId: [],\n stringGroups: [],\n mergingString: false,\n mergeData: [],\n showChangesUnsavedMessage: false,\n viewAs: '',\n loading_strings: 0,\n translationNotLoadedYet: false\n };\n },\n created: function created() {\n this.settings['default-language-name'] = this.languageNames[this.settings['default-language']]; //set default value for the View As select\n\n var params = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getUrlParameters(this.currentURL);\n if (Object.keys(params).length > 1 && params['trp-view-as']) this.viewAs = params['trp-view-as'];else this.viewAs = 'current_user';\n },\n mounted: function mounted() {\n this.addKeyboardShortcutsListener();\n var self = this; // initialize select2\n\n jQuery('#trp-language-select, #trp-view-as-select').select2({\n width: '100%'\n }); //init strings dropdown\n\n this.stringsDropdownLoading(); // show overlay when select is opened\n\n jQuery('#trp-language-select, #trp-string-categories').on('select2:open', function () {\n jQuery('#trp_select2_overlay').fadeIn('100');\n }).on('select2:close', function () {\n jQuery('#trp_select2_overlay').hide();\n }).on('select2:opening', function (e) {\n /* when we have unsaved changes prevent the strings dropdown from opening so we do not have a disconnect between the textareas and the dropdown */\n if (self.hasUnsavedChanges()) {\n e.preventDefault();\n }\n }); // resize sidebar and consequently the iframe\n\n var previewContainer = jQuery('#trp-preview');\n var total_width = jQuery(window).width();\n jQuery('#trp-controls').resizable({\n start: function start() {\n previewContainer.toggle();\n },\n stop: function stop() {\n previewContainer.toggle();\n },\n handles: 'e',\n minWidth: 285,\n maxWidth: total_width - 20\n }).bind(\"resize\", this.resizeIframe); // resize iframe when resizing window\n\n jQuery(window).resize(function () {\n self.resizeIframe();\n });\n },\n watch: {\n currentLanguage: function currentLanguage(_currentLanguage) {\n var self = this; //grab the correct URL from the iFrame\n\n var newURL = this.iframe.querySelector('link[hreflang=\"' + _currentLanguage.replace('_', '-') + '\"]').getAttribute('href');\n this.currentURL = newURL;\n this.iframe.location = newURL; //reset vue props\n\n this.selectedString = '';\n this.selectedIndexesArray = []; //set strings dropdown to loading state\n\n jQuery('#trp-string-categories').val('').trigger('change');\n this.stringsDropdownLoading();\n this.onScreenLanguage = _currentLanguage;\n\n if (this.settings['default-language'] == this.currentLanguage && this.settings['translation-languages'].length > 1) {\n this.settings['translation-languages'].some(function (language) {\n if (language != self.settings['default-language']) {\n // return the first language not default\n self.onScreenLanguage = language;\n return true;\n }\n });\n }\n },\n currentURL: function currentURL(newUrl, oldUrl) {\n window.history.replaceState(null, null, this.parentURL(newUrl));\n },\n viewAs: function viewAs(role) {\n if (!this.currentURL || !this.iframe) return;\n var url = this.cleanURL(this.currentURL);\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-edit-translation', 'preview');\n\n if (role == 'current_user') {\n this.iframe.location = url;\n return;\n } //if nonce not available, an update to the Browse as Other Roles add-on is required\n\n\n if (!this.nonces[role]) {\n alert(this.editorStrings.bor_update_notice);\n return;\n }\n\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-view-as', role);\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-view-as-nonce', this.nonces[role]);\n this.iframe.location = url;\n },\n selectedString: function selectedString(selectedStringArrayIndex, oldString) {\n if (this.hasUnsavedChanges() || !selectedStringArrayIndex && selectedStringArrayIndex !== 0) return;\n jQuery('#trp-string-categories').val(selectedStringArrayIndex !== null ? selectedStringArrayIndex : '').trigger('change');\n var selectedString = this.dictionary[selectedStringArrayIndex];\n if (!selectedString) return;\n var currentNode = this.iframe.querySelector(\"[\" + selectedString.selector + \"='\" + selectedString.dbID + \"']\");\n var selectedIndexesArray = []; //when merging we do not have a valid current node, so we just add the fake id\n\n if (currentNode) {\n var self = this;\n var selectors = self.getAllSelectors();\n var nodes = [];\n nodes.push(currentNode);\n\n if (currentNode.tagName != \"A\") {\n // include the anchor's translatable attributes\n var anchorParent = currentNode.closest('a');\n\n if (anchorParent != null) {\n nodes.push(anchorParent);\n }\n }\n\n if (currentNode.tagName == \"A\" && currentNode.children.length > 0) {\n // include all the translatable attributes inside the anchor\n var childrenArray = _toConsumableArray(currentNode.children);\n\n childrenArray.forEach(function (child) {\n nodes.push(child);\n });\n }\n\n nodes.forEach(function (node) {\n selectors.forEach(function (selector) {\n var stringId = node.getAttribute(selector);\n\n if (stringId) {\n var found = false;\n var i;\n\n for (i = 0; i < selectedIndexesArray.length; i++) {\n if (typeof self.dictionary[selectedIndexesArray[i]] !== 'undefined' && self.dictionary[selectedIndexesArray[i]].dbID !== 'undefined' && self.dictionary[selectedIndexesArray[i]].dbID === stringId) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n selectedIndexesArray.push(self.getStringIndex(selector, stringId));\n }\n }\n });\n });\n } else selectedIndexesArray.push(selectedStringArrayIndex);\n\n this.selectedIndexesArray = selectedIndexesArray;\n }\n },\n computed: {\n closeURL: function closeURL() {\n return this.cleanURL(this.currentURL);\n }\n },\n methods: {\n iFrameLoaded: function iFrameLoaded() {\n var self = this;\n var iframeElement = document.querySelector('#trp-preview-iframe');\n this.iframe = iframeElement.contentDocument || iframeElement.contentWindow.document; //sync iFrame URL with parent\n\n if (this.currentURL != this.iframe.URL) this.currentURL = this.iframe.URL; //hide iFrame loader\n\n this.iframeLoader('hide');\n self.detectedSelectorAndId = [];\n self.dictionary = [];\n this.scanIframeForStrings();\n window.addEventListener('trp_iframe_page_updated', this.scanIframeForStrings); //event that is fired when the iFrame is navigated\n\n iframeElement.contentWindow.onbeforeunload = function () {\n self.iframeLoader('show');\n self.selectedString = null;\n self.selectedIndexesArray = [];\n self.translationNotLoadedYet = false;\n self.stringsDropdownLoading();\n };\n },\n scanIframeForStrings: function scanIframeForStrings() {\n this.scanForSelector('data-trp-translate-id', 'regular', this.onScreenLanguage);\n this.scanForSelector('data-trpgettextoriginal', 'gettext', this.currentLanguage);\n this.scanForSelector('data-trp-post-slug', 'postslug', this.currentLanguage);\n },\n scanForSelector: function scanForSelector(baseSelector, typeSlug, languageOfIds) {\n this.loading_strings++;\n var self = this;\n var selectors = this.prepareSelectorStrings(baseSelector);\n\n var nodes = _toConsumableArray(this.iframe.querySelectorAll('[' + selectors.join('],[') + ']'));\n\n var stringIdsArray = [],\n nodeData = [],\n nodeEntries = [];\n nodes.forEach(function (node) {\n nodeEntries = self.getNodeInfo(node, baseSelector);\n nodeEntries.forEach(function (entry) {\n // this check ensures that we don't create duplicates when rescanning after ajax complete\n if (!self.alreadyDetected(entry.selector, entry.dbID)) {\n stringIdsArray.push(entry.dbID);\n nodeData.push(entry);\n }\n });\n self.setupEventListener(node);\n }); //unique ids only\n\n stringIdsArray = _toConsumableArray(new Set(stringIdsArray));\n\n if (stringIdsArray.length > 0) {\n var data = new FormData();\n data.append('action', 'trp_get_translations_' + typeSlug);\n data.append('all_languages', 'true');\n data.append('security', this.nonces['gettranslationsnonce' + typeSlug]);\n data.append('language', languageOfIds);\n data.append('string_ids', JSON.stringify(stringIdsArray));\n axios__WEBPACK_IMPORTED_MODULE_2___default.a.post(this.ajax_url, data).then(function (response) {\n self.loading_strings--;\n self.addToDictionary(response.data, nodeData);\n })[\"catch\"](function (error) {\n console.log(error);\n });\n } else {\n self.loading_strings--;\n }\n },\n alreadyDetected: function alreadyDetected(selector, dbId) {\n var combined = selector + '=' + dbId;\n\n if (_utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].arrayContainsItem(this.detectedSelectorAndId, combined)) {\n return true;\n } else {\n this.detectedSelectorAndId.push(combined);\n return false;\n }\n },\n setupEventListener: function setupEventListener(node) {\n if (node.tagName == 'A' && !node.hasAttribute('data-trpgettextoriginal')) return false;\n var self = this;\n node.addEventListener('mouseenter', self.$refs.hoverActions.showPencilIcon);\n },\n addToDictionary: function addToDictionary(responseData) {\n var nodeInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var self = this;\n\n if (responseData != null) {\n if (nodeInfo) {\n nodeInfo.forEach(function (infoRow, index) {\n responseData.some(function (responseDataRow) {\n if (infoRow.dbID == responseDataRow.dbID) {\n //bring block_type to the top level object\n if (responseDataRow.type != 'gettext' && typeof responseDataRow.block_type == 'undefined') {\n var firstLanguage = self.orderedSecondaryLanguages[0];\n if (typeof responseDataRow.translationsArray[firstLanguage].block_type != 'undefined') responseDataRow.block_type = responseDataRow.translationsArray[firstLanguage].block_type;\n }\n\n nodeInfo[index] = Object.assign({}, responseDataRow, infoRow);\n return true; // a sort of break\n }\n });\n });\n } else {\n nodeInfo = responseData;\n }\n\n this.stringGroups = this.addToStringGroups(nodeInfo);\n this.dictionary = this.dictionary.concat(nodeInfo);\n this.initStringsDropdown();\n }\n },\n addToStringGroups: function addToStringGroups(strings) {\n // see what node groups are found\n var foundStringGroups = this.stringGroups;\n strings.forEach(function (string) {\n if (foundStringGroups.indexOf(string.group) === -1 && (typeof string.blockType === 'undefined' || string.blockType !== '2')) {\n foundStringGroups.push(string.group);\n }\n }); // put the node groups in the order that we want, according to the prop this.stringGroupOrder\n\n var orderedStringGroups = [];\n\n if (this.editorStrings.seo_update_notice != 'seo_pack_update_not_needed') {\n orderedStringGroups.push(this.editorStrings.seo_update_notice);\n }\n\n this.stringGroupOrder.forEach(function (group) {\n if (foundStringGroups.indexOf(group) !== -1) {\n orderedStringGroups.push(group);\n }\n }); // if there were any other string groups that were not in the prop, add them at the end.\n\n foundStringGroups.forEach(function (group) {\n if (orderedStringGroups.indexOf(group) === -1) {\n orderedStringGroups.push(group);\n }\n });\n return orderedStringGroups;\n },\n getStringIndex: function getStringIndex(selector, dbID) {\n var found = null;\n this.dictionary.some(function (string, index) {\n if (string.dbID == dbID && string.selector == selector) {\n found = index;\n return true;\n }\n });\n return found;\n },\n getNodeInfo: function getNodeInfo(node) {\n var baseSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var stringId;\n var nodeData = [];\n var selectors = this.prepareSelectorStrings(baseSelector);\n selectors.forEach(function (selector) {\n stringId = node.getAttribute(selector);\n\n if (stringId) {\n var nodeAttribute = selector.replace(baseSelector, '');\n var nodeGroup = node.getAttribute('data-trp-node-group' + nodeAttribute);\n var nodeDescription = node.getAttribute('data-trp-node-description' + nodeAttribute);\n var entry = {\n dbID: stringId,\n selector: selector,\n attribute: nodeAttribute.substr(1) // substr(1) is used to trim prefixing line - ex. -alt will result in alt (no line)\n\n };\n if (nodeGroup) entry.group = nodeGroup;\n if (nodeDescription) entry.description = nodeDescription;\n nodeData.push(entry);\n }\n });\n return nodeData;\n },\n getAllSelectors: function getAllSelectors() {\n var selectors = [];\n var self = this;\n this.dataAttributes.forEach(function (dataAttribute) {\n selectors = selectors.concat(self.prepareSelectorStrings(dataAttribute));\n });\n return selectors;\n },\n prepareSelectorStrings: function prepareSelectorStrings(baseNameSelector) {\n var parsed_selectors = [];\n this.selectors.forEach(function (selectorSuffix, index) {\n parsed_selectors.push(baseNameSelector + selectorSuffix);\n });\n return parsed_selectors;\n },\n parentURL: function parentURL(url) {\n return url.replace('trp-edit-translation=preview', 'trp-edit-translation=true');\n },\n cleanURL: function cleanURL(url) {\n //make removeUrlParameter recursive and only call it once with all the parameters that\n //need to stripped ?\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'lang');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-view-as');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-view-as-nonce');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-edit-translation');\n return url;\n },\n showString: function showString(string, type) {\n if (typeof string.blockType !== 'undefined' && string.blockType === '2') {\n // don't show deprecated translation blocks in the dropdown\n return false;\n }\n\n if (type === this.editorStrings.images && typeof string.attribute != 'undefined' && string.attribute == 'src') return true;\n if (typeof string.attribute !== 'undefined' && (string.attribute == 'href' || string.attribute == 'src')) return false;\n if (string.group === type) return true;\n return false;\n },\n initStringsDropdown: function initStringsDropdown() {\n var self = this;\n\n if (!this.isStringsDropdownOpen()) {\n jQuery('#trp-string-categories').select2('destroy');\n jQuery('#trp-string-categories').select2({\n placeholder: self.editorStrings.select_string,\n templateResult: function templateResult(option) {\n var original = he__WEBPACK_IMPORTED_MODULE_7___default.a.decode(option.text.substring(0, 90)) + (option.text.length <= 90 ? '' : '...');\n var description = option.title ? '(' + option.title + ')' : '';\n return jQuery('<div>' + original + '</div><div class=\"string-selector-description\">' + description + '</div>');\n },\n width: '100%'\n }).prop('disabled', false);\n jQuery('#trp_select2_overlay').hide();\n }\n },\n stringsDropdownLoading: function stringsDropdownLoading() {\n jQuery('#trp-string-categories').select2({\n placeholder: this.editorStrings.strings_loading,\n width: '100%'\n }).prop('disabled', true);\n },\n processOptionName: function processOptionName(name, type) {\n if (type == 'Images') return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getFilename(name);\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].escapeHtml(name);\n },\n isStringsDropdownOpen: function isStringsDropdownOpen() {\n return jQuery('#trp-string-categories').select2('isOpen');\n },\n hasUnsavedChanges: function hasUnsavedChanges() {\n var unsavedChanges = false;\n var self = this;\n\n if (this.selectedIndexesArray.length > 0) {\n this.selectedIndexesArray.forEach(function (selectedIndex) {\n self.settings['translation-languages'].forEach(function (languageCode) {\n if (self.dictionary[selectedIndex] && self.dictionary[selectedIndex].translationsArray[languageCode] && self.dictionary[selectedIndex].translationsArray[languageCode].translated !== self.dictionary[selectedIndex].translationsArray[languageCode].editedTranslation) {\n unsavedChanges = true;\n }\n });\n });\n }\n\n this.showChangesUnsavedMessage = unsavedChanges;\n return unsavedChanges;\n },\n iframeLoader: function iframeLoader(status) {\n var loader = document.getElementById('trp-preview-loader');\n if (status == 'show') loader.style.display = 'flex';else if (status == 'hide') loader.style.display = 'none';\n },\n previousString: function previousString() {\n var currentValue = document.getElementById('trp-string-categories').value;\n var newValue = +currentValue - 1;\n\n while (newValue >= 0 && document.querySelectorAll('#trp-string-categories option[value=\"' + newValue + '\"]').length === 0) {\n newValue--;\n }\n\n if (newValue < 0) return;\n this.selectedString = newValue.toString();\n },\n nextString: function nextString() {\n var currentValue = document.getElementById('trp-string-categories').value,\n newValue = 0;\n if (currentValue != '') newValue = +currentValue + 1;\n\n while (newValue < this.dictionary.length && document.querySelectorAll('#trp-string-categories option[value=\"' + newValue + '\"]').length === 0) {\n newValue++;\n }\n\n if (newValue >= this.dictionary.length) {\n return;\n }\n\n this.selectedString = newValue.toString();\n },\n addKeyboardShortcutsListener: function addKeyboardShortcutsListener() {\n document.addEventListener(\"keydown\", function (e) {\n if ((window.navigator.platform.match(\"Mac\") ? e.metaKey : e.ctrlKey) && e.altKey) {\n // CTRL + ALT + right arrow\n if (e.keyCode === 39) {\n e.preventDefault();\n window.dispatchEvent(new Event('trp_trigger_next_string_event'));\n } else {\n // CTRL + ALT + left arrow\n if (e.keyCode === 37) {\n e.preventDefault();\n window.dispatchEvent(new Event('trp_trigger_previous_string_event'));\n }\n }\n }\n }, false);\n window.addEventListener('trp_trigger_next_string_event', this.nextString);\n window.addEventListener('trp_trigger_previous_string_event', this.previousString);\n },\n resizeIframe: function resizeIframe(event, ui) {\n var total_width = jQuery(window).width();\n var width = jQuery('#trp-controls').width();\n\n if (width > total_width) {\n width = total_width;\n controls.css('width', width);\n }\n\n var previewContainer = jQuery('#trp-preview');\n previewContainer.css('right', width);\n previewContainer.css('left', width - 348);\n previewContainer.css('width', total_width - width);\n }\n },\n //add support for v-model in select2\n directives: {\n select2: {\n inserted: function inserted(el) {\n jQuery(el).on('select2:select', function () {\n var event = new Event('change', {\n bubbles: true,\n cancelable: true\n });\n el.dispatchEvent(event);\n });\n jQuery(el).on('select2:unselect', function () {\n var event = new Event('change', {\n bubbles: true,\n cancelable: true\n });\n el.dispatchEvent(event);\n });\n }\n }\n }\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vYXNzZXRzL3NyYy9qcy9lZGl0b3IudnVlP2E3NjUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBMEhBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBLFVBQ0EsY0FEQSxFQUVB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5XCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOnNldHRpbmdzPVwic2V0dGluZ3NcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6bm9uY2VzPVwibm9uY2VzXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmFqYXhfdXJsPVwiYWpheF91cmxcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Y3VycmVudExhbmd1YWdlPVwiY3VycmVudExhbmd1YWdlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm9uU2NyZWVuTGFuZ3VhZ2U9XCJvblNjcmVlbkxhbmd1YWdlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmlmcmFtZT1cImlmcmFtZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpjdXJyZW50VVJMPVwiY3VycmVudFVSTFwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDptZXJnaW5nU3RyaW5nPVwibWVyZ2luZ1N0cmluZ1wiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDptZXJnZURhdGE9XCJtZXJnZURhdGFcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAdHJhbnNsYXRpb25zLXNhdmVkPVwic2hvd0NoYW5nZXNVbnNhdmVkTWVzc2FnZSA9IGZhbHNlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmVkaXRvclN0cmluZ3M9XCJlZGl0b3JTdHJpbmdzXCJcbiAgICAgICAgICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvc2F2ZS10cmFuc2xhdGlvbnM+XG4gICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRycC1jb250cm9scy1zZWN0aW9uXCI+XG5cbiAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRycC1jb250cm9scy1zZWN0aW9uLWNvbnRlbnRcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9XCJ0cnAtbGFuZ3VhZ2Utc3dpdGNoXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNlbGVjdCBpZD1cInRycC1sYW5ndWFnZS1zZWxlY3RcIiBuYW1lPVwibGFuZ1wiIHYtbW9kZWw9XCJjdXJyZW50TGFuZ3VhZ2VcIiB2LXNlbGVjdDI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxvcHRpb24gdi1mb3I9XCIobGFuZywgbGFuZ0luZGV4KSBpbiBsYW5ndWFnZU5hbWVzXCIgOnZhbHVlPVwibGFuZ0luZGV4XCI+e3tsYW5nfX08L29wdGlvbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3NlbGVjdD5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwidHJwLXN0cmluZy1saXN0XCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNlbGVjdCBpZD1cInRycC1zdHJpbmctY2F0ZWdvcmllc1wiIHYtbW9kZWw9XCJzZWxlY3RlZFN0cmluZ1wiIHYtc2VsZWN0Mj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGdyb3VwIHYtZm9yPVwiKGdyb3VwKSBpbiBzdHJpbmdHcm91cHNcIiA6bGFiZWw9XCJncm91cFwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiB2LWZvcj1cIihzdHJpbmcsIGluZGV4KSBpbiBkaWN0aW9uYXJ5XCIgOnZhbHVlPVwiaW5kZXhcIiB2LWlmPVwic2hvd1N0cmluZyggc3RyaW5nLCBncm91cCApXCIgOnRpdGxlPVwic3RyaW5nLmRlc2NyaXB0aW9uX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aWQ9XCJ0cnAtdmlldy1hc1wiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9XCJ0cnAtdmlldy1hcy1kZXNjcmlwdGlvblwiPnt7IGVkaXRvclN0cmluZ3Mudmlld19hcyB9fTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9XCJ0cnAtdmlldy1hcy1zZWxlY3RcIiB2LW1vZGVsPVwidmlld0FzXCIgdi1zZWxlY3QyPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8b3B0aW9uIHYtZm9yPVwiKHJvbGUsIHJvbGVJbmRleCkgaW4gcm9sZXNcIiA6dmFsdWU9XCJyb2xlXCIgOmRpc2FibGVkPVwiIXJvbGVcIiA6dGl0bGU9XCIhcm9sZSA/IGVkaXRvclN0cmluZ3Mudmlld19hc19wcm8gOiAnJ1wiPnt7cm9sZUluZGV4fX08L29wdGlvbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3NlbGVjdD5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cblxuICAgICAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRycC1jb250cm9scy1zZWN0aW9uXCIgdi1zaG93PVwic2VsZWN0ZWRTdHJpbmcgIT09IG51bGxcIj5cbiAgICAgICAgICAgICAgICAgICAgPGxhbmd1YWdlLWJveGVzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOnNlbGVjdGVkSW5kZXhlc0FycmF5PVwic2VsZWN0ZWRJbmRleGVzQXJyYXlcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpkaWN0aW9uYXJ5PVwiZGljdGlvbmFyeVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmN1cnJlbnRMYW5ndWFnZT1cImN1cnJlbnRMYW5ndWFnZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOm9uU2NyZWVuTGFuZ3VhZ2U9XCJvblNjcmVlbkxhbmd1YWdlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6bGFuZ3VhZ2VOYW1lcz1cImxhbmd1YWdlTmFtZXNcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpzZXR0aW5ncz1cInNldHRpbmdzXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6c2hvd0NoYW5nZXNVbnNhdmVkTWVzc2FnZT1cInNob3dDaGFuZ2VzVW5zYXZlZE1lc3NhZ2VcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEBkaXNjYXJkZWQtY2hhbmdlcz1cImhhc1Vuc2F2ZWRDaGFuZ2VzKClcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDplZGl0b3JTdHJpbmdzPVwiZWRpdG9yU3RyaW5nc1wiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmZsYWdzUGF0aD1cImZsYWdzUGF0aFwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmlmcmFtZT1cImlmcmFtZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOm5vbmNlcz1cIm5vbmNlc1wiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmFqYXhfdXJsPVwiYWpheF91cmxcIlxuICAgICAgICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAgICAgIDwvbGFuZ3VhZ2UtYm94ZXM+XG4gICAgICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgICAgICA8ZXh0cmEtY29udGVudCA6bGFuZ3VhZ2VOYW1lcz1cImxhbmd1YWdlTmFtZXNcIiA6ZWRpdG9yU3RyaW5ncz1cImVkaXRvclN0cmluZ3NcIiA6cGFpZFZlcnNpb249XCJwYWlkX3ZlcnNpb25cIj48L2V4dHJhLWNvbnRlbnQ+XG5cbiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidHJwLWNvbnRyb2xzLXNlY3Rpb25cIiB2LXNob3c9XCJ0cmFuc2xhdGlvbk5vdExvYWRlZFlldFwiPlxuICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwidHJwLXRyYW5zbGF0aW9uLW5vdC1yZWFkeS1zZWN0aW9uXCIgY2xhc3M9XCJ0cnAtY29udHJvbHMtc2VjdGlvbi1jb250ZW50XCI+XG4gICAgICAgICAgICAgICAgICAgICAgICA8cCB2LWh0bWw9XCJlZGl0b3JTdHJpbmdzLnRyYW5zbGF0aW9uX25vdF9sb2FkZWRfeWV0XCI+PC9wPlxuICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICA8ZGl2IGlkPVwidHJwX3NlbGVjdDJfb3ZlcmxheVwiPjwvZGl2PlxuXG4gICAgICAgICAgICA8aG92ZXItYWN0aW9uc1xuICAgICAgICAgICAgICAgIHJlZj1cImhvdmVyQWN0aW9uc1wiXG4gICAgICAgICAgICAgICAgOmRpY3Rpb25hcnk9XCJkaWN0aW9uYXJ5XCJcbiAgICAgICAgICAgICAgICA6c2V0dGluZ3M9XCJzZXR0aW5nc1wiXG4gICAgICAgICAgICAgICAgOmlmcmFtZT1cImlmcmFtZVwiXG4gICAgICAgICAgICAgICAgOmRhdGFBdHRyaWJ1dGVzPVwiZGF0YUF0dHJpYnV0ZXNcIlxuICAgICAgICAgICAgICAgIDptZXJnZVJ1bGVzPVwibWVyZ2VSdWxlc1wiXG4gICAgICAgICAgICAgICAgOm5vbmNlcz1cIm5vbmNlc1wiXG4gICAgICAgICAgICAgICAgOmFqYXhfdXJsPVwiYWpheF91cmxcIlxuICAgICAgICAgICAgICAgIDptZXJnZURhdGE9XCJtZXJnZURhdGFcIlxuICAgICAgICAgICAgICAgIDplZGl0b3JTdHJpbmdzPVwiZWRpdG9yU3RyaW5nc1wiXG4gICAgICAgICAgICAg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ICBdLFxuICAgICAgICBjb21wb25lbnRzOntcbiAgICAgICAgICAgIGxhbmd1YWdlQm94ZXMsXG4gICAgICAgICAgICBzYXZlVHJhbnNsYXRpb25zLFxuICAgICAgICAgICAgaG92ZXJBY3Rpb25zLFxuICAgICAgICAgICAgZXh0cmFDb250ZW50XG4gICAgICAgIH0sXG4gICAgICAgIGRhdGEoKXtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgLy9wcm9wc1xuICAgICAgICAgICAgICAgIHNldHRpbmdzICAgICAgICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLnRycF9zZXR0aW5ncyApLFxuICAgICAgICAgICAgICAgIGxhbmd1YWdlTmFtZXMgICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLmxhbmd1YWdlX25hbWVzICksXG4gICAgICAgICAgICAgICAgb3JkZXJlZFNlY29uZGFyeUxhbmd1YWdlcyA6IEpTT04ucGFyc2UoIHRoaXMub3JkZXJlZF9zZWNvbmRhcnlfbGFuZ3VhZ2VzICksXG4gICAgICAgICAgICAgICAgcm9sZXMgICAgICAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMudmlld19hc19yb2xlcyApLFxuICAgICAgICAgICAgICAgIG5vbmNlcyAgICAgICAgICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLmVkaXRvcl9ub25jZXMpLFxuICAgICAgICAgICAgICAgIHN0cmluZ0dyb3VwT3JkZXIgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLnN0cmluZ19ncm91cF9vcmRlciksXG4gICAgICAgICAgICAgICAgc2VsZWN0b3JzICAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMuc3RyaW5nX3NlbGVjdG9ycyApLFxuICAgICAgICAgICAgICAgIGRhdGFBdHRyaWJ1dGVzICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLmRhdGFfYXR0cmlidXRlcyApLFxuICAgICAgICAgICAgICAgIG1lcmdlUnVsZXMgICAgICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLm1lcmdlX3J1bGVzICksXG4gICAgICAgICAgICAgICAgZWRpdG9yU3RyaW5ncyAgICAgICAgICAgICA6IHRycF9sb2NhbGl6ZWRfc3RyaW5ncyxcbiAgICAgICAgICAgICAgICBmbGFnc1BhdGggICAgICAgICAgICAgICAgIDogSlNPTi5wYXJzZSggdGhpcy5mbGFnc19wYXRoICksXG4gICAgICAgICAgICAgICAgLy9kYXRhXG4gICAgICAgICAgICAgICAgY3VycmVudExhbmd1YWdlICAgICAgICAgICA6IHRoaXMuY3VycmVudF9sYW5ndWFnZSxcbiAgICAgICAgICAgICAgICBvblNjcmVlbkxhbmd1YWdlICAgICAgICAgIDogdGhpcy5vbl9zY3JlZW5fbGFuZ3VhZ2UsXG4gICAgICAgICAgICAgICAgY3VycmVudFVSTCAgICAgICAgICAgICAgICA6IHRoaXMudXJsX3RvX2xvYWQsXG4gICAgICAgICAgICAgICAgdXJsVG9Mb2FkICAgICAgICAgICAgICAgICA6IHRoaXMudXJsX3RvX2xvYWQsXG4gICAgICAgICAgICAgICAgaWZyYW1lICAgICAgICAgICAgICAgICAgICA6ICcnLFxuICAgICAgICAgICAgICAgIGRpY3Rpb25hcnkgICAgICAgICAgICAgICAgOiBbXSxcbiAgICAgICAgICAgICAgICBzZWxlY3RlZFN0cmluZyAgICAgICAgICAgIDogbnVsbCxcbiAgICAgICAgICAgICAgICBzZWxlY3RlZEluZGV4ZXNBcnJheSAgICAgIDogW10sXG4gICAgICAgICAgICAgICAgZGV0ZWN0ZWRTZWxlY3RvckFuZElkICAgICA6IFtdLFxuICAgICAgICAgICAgICAgIHN0cmluZ0dyb3VwcyAgICAgICAgICAgICAgOiBbXSxcbiAgICAgICAgICAgICAgICBtZXJnaW5nU3RyaW5nICAgICAgICAgICAgIDogZmFsc2UsXG4gICAgICAgICAgICAgICAgbWVyZ2VEYXRhICAgICAgICAgICAgICAgICA6IFtdLFxuICAgICAgICAgICAgICAgIHNob3dDaGFuZ2VzVW5zYXZlZE1lc3NhZ2UgOiBmYWxzZSxcbiAgICAgICAgICAgICAgICB2aWV3QXMgICAgICAgICAgICAgICAgICAgIDogJycsXG4gICAgICAgICAgICAgICAgbG9hZGluZ19zdHJpbmdzICAgICAgICAgICA6IDAsXG4gICAgICAgICAgICAgICAgdHJhbnNsYXRpb25Ob3RMb2FkZWRZZXQgICA6IGZhbHNlLFxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBjcmVhdGVkKCl7XG4gICAgICAgICAgICB0aGlzLnNldHRpbmdzWydkZWZhdWx0LWxhbmd1YWdlLW5hbWUnXSA9IHRoaXMubGFuZ3VhZ2VOYW1lc1sgdGhpcy5zZXR0aW5nc1snZGVmYXVsdC1sYW5ndWFnZSddIF1cblxuICAgICAgICAgICAgLy9zZXQgZGVmYXVsdCB2YWx1ZSBmb3IgdGhlIFZpZXcgQXMgc2VsZWN0XG4gICAgICAgICAgICBsZXQgcGFyYW1zID0gdXRpbHMuZ2V0VXJsUGFyYW1ldGVycyggdGhpcy5jdXJyZW50VVJMIClcblxuICAgICAgICAgICAgaWYoIE9iamVjdC5rZXlzKHBhcmFtcykubGVuZ3RoID4gMSAmJiBwYXJhbXNbJ3RycC12aWV3LWFzJ10gKVxuICAgICAgICAgICAgICAgIHRoaXMudmlld0FzID0gcGFyYW1zWyd0cnAtdmlldy1hcyddXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3QXMgPSAnY3VycmVudF91c2VyJ1xuICAgICAgICB9LFxuICAgICAgICBtb3VudGVkKCl7XG4gICAgICAgICAgICB0aGlzLmFkZEtleWJvYXJkU2hvcnRjdXRzTGlzdGVuZXIoKVxuICAgICAgICAgICAgbGV0IHNlbGYgPSB0aGlzXG4gICAgICAgICAgICAvLyBpbml0aWFsaXplIHNlbGVjdDJcbiAgICAgICAgICAgIGpRdWVyeSggJyN0cnAt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ByZXNpemUgc2lkZWJhciBhbmQgY29uc2VxdWVudGx5IHRoZSBpZnJhbWVcbiAgICAgICAgICAgIGxldCBwcmV2aWV3Q29udGFpbmVyID0galF1ZXJ5KCAnI3RycC1wcmV2aWV3JyApO1xuICAgICAgICAgICAgbGV0IHRvdGFsX3dpZHRoID0galF1ZXJ5KHdpbmRvdykud2lkdGgoKTtcbiAgICAgICAgICAgIGpRdWVyeSggJyN0cnAtY29udHJvbHMnICkucmVzaXphYmxlKHtcbiAgICAgICAgICAgICAgICBzdGFydDogZnVuY3Rpb24oICkgeyBwcmV2aWV3Q29udGFpbmVyLnRvZ2dsZSgpOyB9LFxuICAgICAgICAgICAgICAgIHN0b3A6IGZ1bmN0aW9uKCApIHsgcHJldmlld0NvbnRhaW5lci50b2dnbGUoKTsgfSxcbiAgICAgICAgICAgICAgICBoYW5kbGVzOiAnZScsXG4gICAgICAgICAgICAgICAgbWluV2lkdGg6IDI4NSxcbiAgICAgICAgICAgICAgICBtYXhXaWR0aDogdG90YWxfd2lkdGggLSAyMFxuICAgICAgICAgICAgfSkuYmluZCggXCJyZXNpemVcIiwgdGhpcy5yZXNpemVJZnJhbWUgKTtcblxuICAgICAgICAgICAgLy8gcmVzaXplIGlmcmFtZSB3aGVuIHJlc2l6aW5nIHdpbmRvd1xuICAgICAgICAgICAgalF1ZXJ5KCB3aW5kb3cgKS5yZXNpemUoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHNlbGYucmVzaXplSWZyYW1lKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSxcbiAgICAgICAgd2F0Y2g6IHtcbiAgICAgICAgICAgIGN1cnJlbnRMYW5ndWFnZTogZnVuY3Rpb24oIGN1cnJlbnRMYW5ndWFnZSApIHtcbiAgICAgICAgICAgICAgICBsZXQgc2VsZiA9IHRoaXNcbiAgICAgICAgICAgICAgICAvL2dyYWIgdGhlIGNvcnJlY3QgVVJMIGZyb20gdGhlIGlGcmFtZVxuICAgICAgICAg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cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggbGFuZ3VhZ2UgIT0gc2VsZi5zZXR0aW5nc1snZGVmYXVsdC1sYW5ndWFnZSddICl7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmV0dXJuIHRoZSBmaXJzdCBsYW5ndWFnZSBub3QgZGVmYXVsdFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYub25TY3JlZW5MYW5ndWFnZSA9IGxhbmd1YWdlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY3VycmVudFVSTDogZnVuY3Rpb24gKCBuZXdVcmwsIG9sZFVybCApIHtcbiAgICAgICAgICAgICAgICB3aW5kb3cuaGlzdG9yeS5yZXBsYWNlU3RhdGUoIG51bGwsIG51bGwsIHRoaXMucGFyZW50VVJMKCBuZXdVcmwgKSApXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgdmlld0FzOiBmdW5jdGlvbiggcm9sZSApIHtcbiAgICAgICAgICAgICAgICBpZiggIXRoaXMuY3VycmVudFVSTCB8fCAhdGhpcy5pZnJhbWUgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cblxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSB0aGlzLmNsZWFuVVJMKCB0aGlzLmN1cnJlbnRVUkwgKVxuXG4gICAgICAgICAgICAgICAgdXJsID0gdXRpbHMudXBkYXRlVXJsUGFyYW1ldGVyKCB1cmwsICd0cnAtZWRpdC10cmFuc2xhdGlvbicsICdwcmV2aWV3JyApXG5cbiAgICAgICAgICAgICAgICBpZiggcm9sZSA9PSAnY3VycmVudF91c2VyJyApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5pZnJhbWUubG9jYXRpb24gPSB1cmxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy9pZiBub25jZSBub3QgYXZhaWxhYmxlLCBhbiB1cGRhdGUgdG8gdGhlIEJyb3dzZSBhcyBPdGhlciBSb2xlcyBhZGQtb24gaXMgcmVxdWlyZWRcbiAgICAgICAgICAgICAgICBpZiggIXRoaXMubm9uY2VzW3JvbGVdICkge1xuICAgICAgICAgICAgICAgICAgICBhbGVydCggdGhpcy5lZGl0b3JTdHJpbmdzLmJvcl91cGRhdGVfbm90aWNlIClcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdXJsID0gdXRpbHMudXBkYXRlVXJsUGFyYW1ldGVyKCB1cmwsICd0cnAtdmlldy1hcycsIHJvbGUgKVxuICAgICAgICAgICAgICAgIHVybCA9IHV0aWxzLnVwZGF0ZVVybFBhcmFtZXRlciggdXJsLCAndHJwLXZpZXctYXMtbm9uY2UnLCB0aGlzLm5vbmNlc1tyb2xlXSApXG5cbiAgICAgICAgICAgICAgICB0aGlzLmlmcmFtZS5sb2NhdGlvbiA9IHVybFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHNlbGVjdGVkU3RyaW5nOiBmdW5jdGlvbiAoIHNlbGVjdGVkU3RyaW5nQXJyYXlJbmRleCwgb2xkU3RyaW5nICl7XG5cbiAgICAgICAgICAgICAgICBpZiggdGhpcy5oYXNVbnNhdmVkQ2hhbmdlcygpIHx8ICggIXNlbGVjdGVkU3RyaW5nQXJyYXlJbmRleCAmJiBzZWxlY3RlZFN0cmluZ0FycmF5SW5kZXggIT09IDAgKSApXG4gICAgICAgICAgICAgICAgICAgIHJldHVyblxuXG4gICAgICAgICAgICAgICAgalF1ZXJ5KCAnI3RycC1zdHJpbmctY2F0ZWdvcmllcycgKS52YWwoIHNlbGVjdGVkU3RyaW5nQXJyYXlJbmRleCAhPT0gbnVsbCA/IHNlbGVjdGVkU3RyaW5nQXJyYXlJbmRleCA6ICcnICkudHJpZ2dlciggJ2NoYW5nZScgKVxuXG4gICAgICAgICAgICAgICAgbGV0IHNlbGVjdGVkU3RyaW5nICAgICAgID0gdGhpcy5kaWN0aW9uYXJ5W3NlbGVjdGVkU3RyaW5nQXJyYXlJbmRleF1cblxuICAgICAgICAgICAgICAgIGlmKCAhc2VsZWN0ZWRTdHJpbmcgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cblxuICAgICAgICAgICAgICAgIGxldCBjdXJyZW50Tm9kZSAgICAgICAgICA9IHRoaXMuaWZyYW1lLnF1ZXJ5U2VsZWN0b3IoIFwiW1wiICsgc2VsZWN0ZWRTdHJpbmcuc2VsZWN0b3IgKyBcIj0nXCIgKyBzZWxlY3RlZFN0cmluZy5kYklEICsgXCInXVwiKVxuICAgICAgICAgICAgICAgIGxldCBzZWxlY3RlZEluZGV4ZXNBcnJheSA9IFtdXG5cbiAgICAgICAgICAgICAgICAvL3doZW4gbWVyZ2luZyB3ZSBkbyBub3QgaGF2ZSBhIHZhbGlkIGN1cnJlbnQgbm9kZSwgc28gd2UganVzdCBhZGQgdGhlIGZha2UgaWRcbiAgICAgICAgICAgICAgICBpZiggY3VycmVudE5vZGUgKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBzZWxmID0gdGhpc1xuICAgICAgICAgICAgICAgICAgICBsZXQgc2VsZWN0b3JzID0gc2VsZi5nZXRBbGxTZWxlY3RvcnMoKVxuICAgICAgICAgICAgICAgICAgICBsZXQgbm9kZXMgPSBbXVxuXG4gICAgICAgICAgICAgICAgICAgIG5vZGVzLnB1c2goIGN1cnJlbnROb2RlIClcblxuICAgICAgICAgICAgICAgICAgICBpZiAoIGN1cnJlbnROb2RlLnRhZ05hbWUgIT0gXCJBXCIgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGluY2x1ZGUgdGhlIGFuY2hvcidzIHRyYW5zbGF0YWJsZSBhdHRyaWJ1dGVzXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgYW5jaG9yUGFyZW50ICA9IGN1cnJlbnROb2RlLmNsb3Nlc3QoJ2EnKVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoICBhbmNob3JQYXJlbnQgIT0gbnVsbCApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2Rlcy5wdXNoKGFuY2hvclBhcmVudClcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGlmICggY3VycmVudE5vZGUudGFnTmFtZSA9PSBcIkFcIiAmJiBjdXJyZW50Tm9kZS5jaGlsZHJlbi5sZW5ndGggPiAwICl7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBpbmNsdWRlIGFsbCB0aGUgdHJhbnNsYXRhYmxlIGF0dHJpYnV0ZXMgaW5zaWRlIHRoZSBhbmNob3JcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjaGlsZHJlbkFycmF5ID0gWyAuLi5jdXJyZW50Tm9kZS5jaGlsZHJlbiBdO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW5BcnJheS5mb3JFYWNoKCBmdW5jdGlvbiAoIGNoaWxkICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVzLnB1c2goY2hpbGQpXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBub2Rlcy5mb3JFYWNoKCBmdW5jdGlvbiggbm9kZSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9ycy5mb3JFYWNoKGZ1bmN0aW9uIChzZWxlY3Rvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBzdHJpbmdJZCA9IG5vZGUuZ2V0QXR0cmlidXRlKHNlbGVjdG9yKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdHJpbmdJZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZm91bmQgPSBmYWxzZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgaVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IoIGkgPSAwOyBpIDwgc2VsZWN0ZWRJbmRleGVzQXJyYXkubGVuZ3RoOyBpKysgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggdHlwZW9mIHNlbGYuZGljdGlvbmFyeVtzZWxlY3RlZEluZGV4ZXNBcnJheVtpXV0gIT09ICd1bmRlZmluZWQnICYmIHNlbGYuZGljdGlvbmFyeVtzZWxlY3RlZEluZGV4ZXNBcnJheVtpXV0uZGJJRCAhPT0gJ3VuZGVmaW5lZCcgJiYgc2VsZi5kaWN0aW9uYXJ5W3NlbGVjdGVkSW5kZXhlc0FycmF5W2ldXS5kYklEID09PSBzdHJpbmdJZCApe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggISBmb3VuZCApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkSW5kZXhlc0FycmF5LnB1c2goc2VsZi5nZXRTdHJpbmdJbmRleChzZWxlY3Rvciwgc3RyaW5nSWQpKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9IGVsc2VcbiAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWRJbmRleGVzQXJyYXkucHVzaCggc2VsZWN0ZWRTdHJpbmdBcnJheUluZGV4IClcblxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0ZWRJbmRleGVzQXJyYXkgPSBzZWxlY3RlZEluZGV4ZXNBcnJheVxuICAgICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgY29tcHV0ZWQ6IHtcbiAgICAgICAgICAgIGNsb3NlVVJMOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jbGVhblVSTCggdGhpcy5jdXJyZW50VVJMIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgbWV0aG9kczoge1xuICAgICAgICAgICAgaUZyYW1lTG9hZGVkKCl7XG4gICAgICAgICAgICAgICAgbGV0IHNlbGYgPSB0aGlzXG4gICAgICAgICAgICAgICAgbGV0IGlmcmFtZUVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCcjdHJwLXByZXZpZXctaWZyYW1lJylcblxuICAgICAgICAgICAgICAgIHRoaXMuaWZyYW1lID0gaWZyYW1lRWxlbWVudC5jb250ZW50RG9jdW1lbnQgfHwgaWZyYW1lRWxlbWVudC5jb250ZW50V2luZG93LmRvY3VtZW50XG5cbiAgICAgICAgICAgICAgICAvL3N5bmMgaUZyYW1lIFVSTCB3aXRoIHBhcmVudFxuICAgICAgICAgICAgICAgIGlmICggdGhpcy5jdXJyZW50VVJMICE9IHRoaXMuaWZyYW1lLlVSTCApXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFVSTCA9IHRoaXMuaWZyYW1lLlVSTFxuXG4gICAgICAgICAgICAgICAgLy9oaWRlIGlGcmFtZSBsb2FkZXJcbiAgICAgICAgICAgICAgICB0aGlzLmlmcmFtZUxvYWRlciggJ2hpZGUnIClcblxuICAgICAgICAgICAgICAgIHNlbGYuZGV0ZWN0ZWRTZWxlY3RvckFuZElkID0gW11cbiAgICAgICAgICAgICAgICBzZWxmLmRpY3Rpb25hcnkgICAgICAgICAgICA9IFtdXG4gICAgICAgICAgICAgICAgdGhpcy5zY2FuSWZyYW1lRm9yU3RyaW5ncygpXG5cbiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lciggJ3RycF9pZnJhbWVfcGFnZV91cGRhdGVkJywgdGhpcy5zY2FuSWZyYW1lRm9yU3RyaW5ncyApXG5cbiAgICAgICAgICAgICAgICAvL2V2ZW50IHRoYXQgaXMgZmlyZWQgd2hlbiB0aGUgaUZyYW1lIGlzIG5hdmlnYXRlZFxuICAgICAgICAgICAgICAgIGlmcmFtZUVsZW1lbnQuY29udGVudFdpbmRvdy5vbmJlZm9yZXVubG9hZCA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmlmcmFtZUxvYWRlciggJ3Nob3cnIClcblxuICAgICAgICAgICAgICAgICAgICBzZWxmLnNlbGVjdGVkU3RyaW5nID0gbnVsbFxuICAgICAgICAgICAgICAgICAgICBzZWxmLnNlbGVjdGVkSW5kZXhlc0FycmF5ID0gW11cbiAgICAgICAgICAgICAgICAgICAgc2VsZi50cmFuc2xhdGlvbk5vdExvYWRlZFlldCA9IGZhbHNlXG5cbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zdHJpbmdzRHJvcGRvd25Mb2FkaW5nKClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBzY2FuSWZyYW1lRm9yU3RyaW5ncygpe1xuICAgICAgICAgICAgICAgIHRoaXMuc2NhbkZvclNlbGVjdG9yKCAnZGF0YS10cnAtdHJhbnNsYXRlLWlkJywgJ3JlZ3VsYXInLCB0aGlzLm9uU2NyZWVuTGFuZ3VhZ2UgKVxuICAgICAgICAgICAgICAgIHRoaXMuc2NhbkZvclNlbGVjdG9yKCAnZGF0YS10cnBnZXR0ZXh0b3JpZ2luYWwnLCAnZ2V0dGV4dCcsIHRoaXMuY3VycmVudExhbmd1YWdlIClcbiAgICAgICAgICAgICAgICB0aGlzLnNjYW5Gb3JTZWxlY3RvciggJ2RhdGEtdHJwLXBvc3Qtc2x1ZycsICdwb3N0c2x1ZycsIHRoaXMuY3VycmVudExhbmd1YWdlIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBzY2FuRm9yU2VsZWN0b3IoIGJhc2VTZWxlY3RvciwgdHlwZVNsdWcsIGxhbmd1YWdlT2ZJZHMgKXtcbiAgICAgICAgICAgICAgICB0aGlzLmxvYWRpbmdfc3RyaW5ncysrXG4gICAgICAgICAgICAgICAgbGV0IHNlbGYgICAgICAgICAgID0gdGhpc1xuICAgICAgICAgICAgICAgIGxldCBzZWxlY3RvcnMgICAgICA9IHRoaXMucHJlcGFyZVNlbGVjdG9yU3RyaW5ncyggYmFzZVNlbGVjdG9yIClcbiAgICAgICAgICAgICAgICBsZXQgbm9kZXMgICAgICAgICAgPSBbLi4udGhpcy5pZnJhbWUucXVlcnlTZWxlY3RvckFsbCggJ1snICsgc2VsZWN0b3JzLmpvaW4oJ10sWycpICsgJ10nICldXG4gICAgICAgICAgICAgICAgbGV0IHN0cmluZ0lkc0FycmF5ID0gW10sIG5vZGVEYXRhID0gW10sIG5vZGVFbnRyaWVzID0gW11cblxuICAgICAgICAgICAgICAgIG5vZGVzLmZvckVhY2goIGZ1bmN0aW9uICggbm9kZSApe1xuICAgICAgICAgICAgICAgICAgICBub2RlRW50cmllcyA9IHNlbGYuZ2V0Tm9kZUluZm8oIG5vZGUsIGJhc2VTZWxlY3RvciApXG5cbiAgICAgICAgICAgICAgICAgICAgbm9kZUVudHJpZXMuZm9yRWFjaCggZnVuY3Rpb24oIGVudHJ5ICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBjaGVjayBlbnN1cmVzIHRoYXQgd2UgZG9uJ3QgY3JlYXRlIGR1cGxpY2F0ZXMgd2hlbiByZXNjYW5uaW5nIGFmdGVyIGFqYXggY29tcGxldGVcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggIXNlbGYuYWxyZWFkeURldGVjdGVkKCBlbnRyeS5zZWxlY3RvciwgZW50cnkuZGJJRCApICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZ0lkc0FycmF5LnB1c2goZW50cnkuZGJJRClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlRGF0YS5wdXNoKGVudHJ5KVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dXBFdmVudExpc3RlbmVyKCBub2RlIClcbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgLy91bmlxdWUgaWRzIG9ubHlcbiAgICAgICAgICAgICAgICBzdHJpbmdJZHNBcnJheSA9IFsuLi5uZXcgU2V0KHN0cmluZ0lkc0FycmF5KV1cbiAgICAgICAgICAgICAgICBpZiAoIHN0cmluZ0lkc0FycmF5Lmxlbmd0aCA+IDAgKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gbmV3IEZvcm1EYXRhKClcbiAgICAgICAgICAgICAgICAgICAgZGF0YS5hcHBlbmQoJ2FjdGlvbicgICAgICAgLCAndHJwX2dldF90cmFuc2xhdGlvbnNfJyArIHR5cGVTbHVnKVxuICAgICAgICAgICAgICAgICAgICBkYXRhLmFwcGVuZCgnYWxsX2xhbmd1YWdlcycsICd0cnVlJylcbiAgICAgICAgICAgICAgICAgICAgZGF0YS5hcHBlbmQoJ3NlY3VyaXR5JyAgICAgLCB0aGlzLm5vbmNlc1snZ2V0dHJhbnNsYXRpb25zbm9uY2UnICsgdHlwZVNsdWddKVxuICAgICAgICAgICAgICAgICAgICBkYXRhLmFwcGVuZCgnbGFuZ3VhZ2UnICAgICAsIGxhbmd1YWdlT2ZJZHMpXG4gICAgICAgICAgICAgICAgICAgIGRhdGEuYXBwZW5kKCdzdHJpbmdfaWRzJyAgICwgSlNPTi5zdHJpbmdpZnkoc3RyaW5nSWRzQXJyYXkpKVxuXG4gICAgICAgICAgICAgICAgICAgIGF4aW9zLnBvc3QodGhpcy5hamF4X3VybCwgZGF0YSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYubG9hZGluZ19zdHJpbmdzLS1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvRGljdGlvbmFyeShyZXNwb25zZS5kYXRhLCBub2RlRGF0YSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goZnVuY3Rpb24gKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfWVsc2V7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYubG9hZGluZ19zdHJpbmdzLS1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBhbHJlYWR5RGV0ZWN0ZWQoIHNlbGVjdG9yLCBkYklkICl7XG4gICAgICAgICAgICAgICAgbGV0IGNvbWJpbmVkID0gc2VsZWN0b3IgKyAnPScgKyBkYklkXG4gICAgICAgICAgICAgICAgaWYgKCB1dGlscy5hcnJheUNvbnRhaW5zSXRlbSggdGhpcy5kZXRlY3RlZFNlbGVjdG9yQW5kSWQsIGNvbWJpbmVkICkgKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgICAgICAgfWVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmRldGVjdGVkU2VsZWN0b3JBbmRJZC5wdXNoKGNvbWJpbmVkKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgc2V0dXBFdmVudExpc3RlbmVyKCBub2RlICl7XG4gICAgICAgICAgICAgICAgaWYgKCBub2RlLnRhZ05hbWUgPT0gJ0EnICYmICFub2RlLmhhc0F0dHJpYnV0ZSggJ2RhdGEtdHJwZ2V0dGV4dG9yaWdpbmFsJyApIClcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG5cbiAgICAgICAgICAgICAgICBsZXQgc2VsZiA9IHRoaXNcblxuICAgICAgICAgICAgICAgIG5vZGUuYWRkRXZlbnRMaXN0ZW5lciggJ21vdXNlZW50ZXInLCBzZWxmLiRyZWZzLmhvdmVyQWN0aW9ucy5zaG93UGVuY2lsSWNvbiApXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkVG9EaWN0aW9uYXJ5KCByZXNwb25zZURhdGEsIG5vZGVJbmZvID0gbnVsbCApe1xuICAgICAgICAgICAgICAgIGxldCBzZWxmID0gdGhpc1xuXG4gICAgICAgICAgICAgICAgaWYgKCByZXNwb25zZURhdGEgIT0gbnVsbCApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBub2RlSW5mbyApe1xuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZUluZm8uZm9yRWFjaChmdW5jdGlvbiAoIGluZm9Sb3csIGluZGV4ICl7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2VEYXRhLnNvbWUoIGZ1bmN0aW9uICggcmVzcG9uc2VEYXRhUm93ICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggaW5mb1Jvdy5kYklEID09IHJlc3BvbnNlRGF0YVJvdy5kYklEICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9icmluZyBibG9ja190eXBlIHRvIHRoZSB0b3AgbGV2ZWwgb2JqZWN0XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIHJlc3BvbnNlRGF0YVJvdy50eXBlICE9ICdnZXR0ZXh0JyAmJiB0eXBlb2YgcmVzcG9uc2VEYXRhUm93LmJsb2NrX3R5cGUgPT0gJ3VuZGVmaW5lZCcgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZpcnN0TGFuZ3VhZ2UgPSBzZWxmLm9yZGVyZWRTZWNvbmRhcnlMYW5ndWFnZXNbMF1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggdHlwZW9mIHJlc3BvbnNlRGF0YVJvdy50cmFuc2xhdGlvbnNBcnJheVtmaXJzdExhbmd1YWdlXS5ibG9ja190eXBlICE9ICd1bmRlZmluZWQnIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2VEYXRhUm93LmJsb2NrX3R5cGUgPSByZXNwb25zZURhdGFSb3cudHJhbnNsYXRpb25zQXJyYXlbZmlyc3RMYW5ndWFnZV0uYmxvY2tfdHlwZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlSW5mb1tpbmRleF0gPSBPYmplY3QuYXNzaWduKCB7fSwgcmVzcG9uc2VEYXRhUm93LCBpbmZvUm93IClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlIC8vIGEgc29ydCBvZiBicmVha1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZUluZm8gPSByZXNwb25zZURhdGFcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc3RyaW5nR3JvdXBzID0gdGhpcy5hZGRUb1N0cmluZ0dyb3Vwcyggbm9kZUluZm8gKVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmRpY3Rpb25hcnkgPSB0aGlzLmRpY3Rpb25hcnkuY29uY2F0KCBub2RlSW5mbyApXG5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5pbml0U3RyaW5nc0Ryb3Bkb3duKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkVG9TdHJpbmdHcm91cHMoIHN0cmluZ3MgKXtcblxuICAgICAgICAgICAgICAgIC8vIHNlZSB3aGF0IG5vZGUgZ3JvdXBzIGFyZSBmb3VuZFxuICAgICAgICAgICAgICAgIGxldCBmb3VuZFN0cmluZ0dyb3VwcyA9IHRoaXMuc3RyaW5nR3JvdXBzO1xuICAgICAgICAgICAgICAgIHN0cmluZ3MuZm9yRWFjaCggZnVuY3Rpb24gKCBzdHJpbmcgKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICggZm91bmRTdHJpbmdHcm91cHMuaW5kZXhPZiggc3RyaW5nLmdyb3VwICkgPT09IC0xICYmICggKCB0eXBlb2Ygc3RyaW5nLmJsb2NrVHlwZSA9PT0gJ3VuZGVmaW5lZCcgKSB8fCBzdHJpbmcuYmxvY2tUeXBlICE9PSAnMicgKSApe1xuICAgICAgICAgICAgICAgICAgICAgICAgZm91bmRTdHJpbmdHcm91cHMucHVzaCggc3RyaW5nLmdyb3VwIClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAvLyBwdXQgdGhlIG5vZGUgZ3JvdXBzIGluIHRoZSBvcmRlciB0aGF0IHdlIHdhbnQsIGFjY29yZGluZyB0byB0aGUgcHJvcCB0aGlzLnN0cmluZ0dyb3VwT3JkZXJcbiAgICAgICAgICAgICAgICBsZXQgb3JkZXJlZFN0cmluZ0dyb3VwcyA9IFtdO1xuXG4gICAgICAgICAgICAgICAgaWYgKCB0aGlzLmVkaXRvclN0cmluZ3Muc2VvX3VwZGF0ZV9ub3RpY2UgIT0gJ3Nlb19wYWNrX3VwZGF0ZV9ub3RfbmVlZGVkJyApe1xuICAgICAgICAgICAgICAgICAgICBvcmRlcmVkU3RyaW5nR3JvdXBzLnB1c2goIHRoaXMuZWRpdG9yU3RyaW5ncy5zZW9fdXBkYXRlX25vdGljZSApO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuc3RyaW5nR3JvdXBPcmRlci5mb3JFYWNoKCBmdW5jdGlvbiggZ3JvdXAgKXtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBmb3VuZFN0cmluZ0dyb3Vwcy5pbmRleE9mKCBncm91cCApICE9PSAtMSApe1xuICAgICAgICAgICAgICAgICAgICAgICAgb3JkZXJlZFN0cmluZ0dyb3Vwcy5wdXNoKCBncm91cCApXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgLy8gaWYgdGhlcmUgd2VyZSBhbnkgb3RoZXIgc3RyaW5nIGdyb3VwcyB0aGF0IHdlcmUgbm90IGluIHRoZSBwcm9wLCBhZGQgdGhlbSBhdCB0aGUgZW5kLlxuICAgICAgICAgICAgICAgIGZvdW5kU3RyaW5nR3JvdXBzLmZvckVhY2goIGZ1bmN0aW9uIChncm91cCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIG9yZGVyZWRTdHJpbmdHcm91cHMuaW5kZXhPZiggZ3JvdXAgKSA9PT0gLTEgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyZWRTdHJpbmdHcm91cHMucHVzaChncm91cCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG9yZGVyZWRTdHJpbmdHcm91cHM7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZ2V0U3RyaW5nSW5kZXgoIHNlbGVjdG9yLCBkYklEICl7XG4gICAgICAgICAgICAgICAgbGV0IGZvdW5kID0gbnVsbFxuXG4gICAgICAgICAgICAgICAgdGhpcy5kaWN0aW9uYXJ5LnNvbWUoZnVuY3Rpb24gKCBzdHJpbmcsIGluZGV4ICkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIHN0cmluZy5kYklEID09IGRiSUQgJiYgc3RyaW5nLnNlbGVjdG9yID09IHNlbGVjdG9yICl7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3VuZCA9IGluZGV4XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHJldHVybiBmb3VuZFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdldE5vZGVJbmZvKCBub2RlLCBiYXNlU2VsZWN0b3IgPSAnJyApe1xuICAgICAgICAgICAgICAgIGxldCBzdHJpbmdJZFxuICAgICAgICAgICAgICAgIGxldCBub2RlRGF0YSAgPSBbXVxuICAgICAgICAgICAgICAgIGxldCBzZWxlY3RvcnMgPSB0aGlzLnByZXBhcmVTZWxlY3RvclN0cmluZ3MoIGJhc2VTZWxlY3RvciApXG5cbiAgICAgICAgICAgICAgICBzZWxlY3RvcnMuZm9yRWFjaCggZnVuY3Rpb24gKCBzZWxlY3RvciApIHtcblxuICAgICAgICAgICAgICAgICAgICBzdHJpbmdJZCA9IG5vZGUuZ2V0QXR0cmlidXRlKCBzZWxlY3RvciApXG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCBzdHJpbmdJZCApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5vZGVBdHRyaWJ1dGUgICA9IHNlbGVjdG9yLnJlcGxhY2UoIGJhc2VTZWxlY3RvciwgJycgKVxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5vZGVHcm91cCAgICAgICA9IG5vZGUuZ2V0QXR0cmlidXRlKCAnZGF0YS10cnAtbm9kZS1ncm91cCcgKyBub2RlQXR0cmlidXRlIClcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBub2RlRGVzY3JpcHRpb24gPSBub2RlLmdldEF0dHJpYnV0ZSggJ2RhdGEtdHJwLW5vZGUtZGVzY3JpcHRpb24nICsgbm9kZUF0dHJpYnV0ZSApXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBlbnRyeSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYklEICAgICAgOiBzdHJpbmdJZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RvciAgOiBzZWxlY3RvcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGUgOiBub2RlQXR0cmlidXRlLnN1YnN0cigxKSwgLy8gc3Vic3RyKDEpIGlzIHVzZWQgdG8gdHJpbSBwcmVmaXhpbmcgbGluZSAtIGV4LiAtYWx0IHdpbGwgcmVzdWx0IGluIGFsdCAobm8gbGluZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBub2RlR3JvdXAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5Lmdyb3VwID0gbm9kZUdyb3VwXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggbm9kZURlc2NyaXB0aW9uIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnRyeS5kZXNjcmlwdGlvbiA9IG5vZGVEZXNjcmlwdGlvblxuXG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlRGF0YS5wdXNoKCBlbnRyeSApXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZURhdGFcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBnZXRBbGxTZWxlY3RvcnMoKXtcbiAgICAgICAgICAgICAgICBsZXQgc2VsZWN0b3JzID0gW11cbiAgICAgICAgICAgICAgICBsZXQgc2VsZiAgICAgID0gdGhpc1xuXG4gICAgICAgICAgICAgICAgdGhpcy5kYXRhQXR0cmlidXRlcy5mb3JFYWNoKCBmdW5jdGlvbiAoIGRhdGFBdHRyaWJ1dGUgKXtcbiAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3JzID0gc2VsZWN0b3JzLmNvbmNhdCggc2VsZi5wcmVwYXJlU2VsZWN0b3JTdHJpbmdzKCBkYXRhQXR0cmlidXRlICkgKVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gc2VsZWN0b3JzXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcHJlcGFyZVNlbGVjdG9yU3RyaW5ncyggYmFzZU5hbWVTZWxlY3RvciApe1xuICAgICAgICAgICAgICAgIGxldCBwYXJzZWRfc2VsZWN0b3JzID0gW11cblxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0b3JzLmZvckVhY2goIGZ1bmN0aW9uICggc2VsZWN0b3JTdWZmaXgsIGluZGV4ICl7XG4gICAgICAgICAgICAgICAgICAgIHBhcnNlZF9zZWxlY3RvcnMucHVzaCggYmFzZU5hbWVTZWxlY3RvciArIHNlbGVjdG9yU3VmZml4ICApXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZWRfc2VsZWN0b3JzXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcGFyZW50VVJMKCB1cmwgKXtcbiAgICAgICAgICAgICAgICByZXR1cm4gdXJsLnJlcGxhY2UoICd0cnAtZWRpdC10cmFuc2xhdGlvbj1wcmV2aWV3JywgJ3RycC1lZGl0LXRyYW5zbGF0aW9uPXRydWUnIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjbGVhblVSTCggdXJsICl7XG4gICAgICAgICAgICAgICAgLy9tYWtlIHJlbW92ZVVybFBhcmFtZXRlciByZWN1cnNpdmUgYW5kIG9ubHkgY2FsbCBpdCBvbmNlIHdpdGggYWxsIHRoZSBwYXJhbWV0ZXJzIHRoYXRcbiAgICAgICAgICAgICAgICAvL25lZWQgdG8gc3RyaXBwZWQgP1xuICAgICAgICAgICAgICAgIHVybCA9IHV0aWxzLnJlbW92ZVVybFBhcmFtZXRlciggdXJsLCAnbGFuZycgKVxuICAgICAgICAgICAgICAgIHVybCA9IHV0aWxzLnJlbW92ZVVybFBhcmFtZXRlciggdXJsLCAndHJwLXZpZXctYXMnIClcbiAgICAgICAgICAgICAgICB1cmwgPSB1dGlscy5yZW1vdmVVcmxQYXJhbWV0ZXIoIHVybCwgJ3RycC12aWV3LWFzLW5vbmNlJyApXG4gICAgICAgICAgICAgICAgdXJsID0gdXRpbHMucmVtb3ZlVXJsUGFyYW1ldGVyKCB1cmwsICd0cnAtZWRpdC10cmFuc2xhdGlvbicgKVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVybFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHNob3dTdHJpbmcoIHN0cmluZywgdHlwZSApe1xuICAgICAgICAgICAgICAgIGlmICggdHlwZW9mIHN0cmluZy5ibG9ja1R5cGUgIT09ICd1bmRlZmluZWQnICYmIHN0cmluZy5ibG9ja1R5cGUgPT09ICcyJyApe1xuICAgICAgICAgICAgICAgICAgICAvLyBkb24ndCBzaG93IGRlcHJlY2F0ZWQgdHJhbnNsYXRpb24gYmxvY2tzIGluIHRoZSBkcm9wZG93blxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKCB0eXBlID09PSB0aGlzLmVkaXRvclN0cmluZ3MuaW1hZ2VzICYmIHR5cGVvZiBzdHJpbmcuYXR0cmlidXRlICE9ICd1bmRlZmluZWQnICYmIHN0cmluZy5hdHRyaWJ1dGUgPT0gJ3NyYycgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuXG4gICAgICAgICAgICAgICAgaWYgKCB0eXBlb2Ygc3RyaW5nLmF0dHJpYnV0ZSAhPT0gJ3VuZGVmaW5lZCcgJiYgKCBzdHJpbmcuYXR0cmlidXRlID09ICdocmVmJyB8fCBzdHJpbmcuYXR0cmlidXRlID09ICdzcmMnICkgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcblxuICAgICAgICAgICAgICAgIGlmICggc3RyaW5nLmdyb3VwID09PSB0eXBlIClcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWVcblxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGluaXRTdHJpbmdzRHJvcGRvd24oKXtcbiAgICAgICAgICAgICAgICBsZXQgc2VsZiA9IHRoaXNcblxuICAgICAgICAgICAgICAgIGlmICggIXRoaXMuaXNTdHJpbmdzRHJvcGRvd25PcGVuKCkgKSB7XG4gICAgICAgICAgICAgICAgICAgIGpRdWVyeSggJyN0cnAtc3RyaW5nLWNhdGVnb3JpZXMnICkuc2VsZWN0MiggJ2Rlc3Ryb3knIClcblxuICAgICAgICAgICAgICAgICAgICBqUXVlcnkoICcjdHJwLXN0cmluZy1jYXRlZ29yaWVzJyApLnNlbGVjdDIoIHsgcGxhY2Vob2xkZXIgOiBzZWxmLmVkaXRvclN0cmluZ3Muc2VsZWN0X3N0cmluZywgdGVtcGxhdGVSZXN1bHQ6IGZ1bmN0aW9uKG9wdGlvbil7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb3JpZ2luYWwgICAgPSBoZS5kZWNvZGUoIG9wdGlvbi50ZXh0LnN1YnN0cmluZygwLCA5MCkgKSArICggKCBvcHRpb24udGV4dC5sZW5ndGggPD0gOTApID8gJycgOiAnLi4uJyApXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGVzY3JpcHRpb24gPSAoIG9wdGlvbi50aXRsZSApID8gICcoJyArIG9wdGlvbi50aXRsZSArICcpJyA6ICcnXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqUXVlcnkoICc8ZGl2PicgKyBvcmlnaW5hbCArICc8L2Rpdj48ZGl2IGNsYXNzPVwic3RyaW5nLXNlbGVjdG9yLWRlc2NyaXB0aW9uXCI+JyArIGRlc2NyaXB0aW9uICsgJzwvZGl2PicgKTtcbiAgICAgICAgICAgICAgICAgICAgfSwgd2lkdGggOiAnMTAwJScgfSApLnByb3AoICdkaXNhYmxlZCcsIGZhbHNlIClcblxuICAgICAgICAgICAgICAgICAgICBqUXVlcnkoICcjdHJwX3NlbGVjdDJfb3ZlcmxheScgKS5oaWRlKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgc3RyaW5nc0Ryb3Bkb3duTG9hZGluZygpe1xuICAgICAgICAgICAgICAgIGpRdWVyeSggJyN0cnAtc3RyaW5nLWNhdGVnb3JpZXMnICkuc2VsZWN0MiggeyBwbGFjZWhvbGRlciA6IHRoaXMuZWRpdG9yU3RyaW5ncy5zdHJpbmdzX2xvYWRpbmcsIHdpZHRoIDogJzEwMCUnIH0gKS5wcm9wKCAnZGlzYWJsZWQnLCB0cnVlIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBwcm9jZXNzT3B0aW9uTmFtZSggbmFtZSwgdHlwZSApe1xuICAgICAgICAgICAgICAgIGlmICggdHlwZSA9PSAnSW1hZ2VzJyApXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB1dGlscy5nZXRGaWxlbmFtZSggbmFtZSApXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdXRpbHMuZXNjYXBlSHRtbCggbmFtZSApXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaXNTdHJpbmdzRHJvcGRvd25PcGVuKCl7XG4gICAgICAgICAgICAg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YXZlZENoYW5nZXMgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5zaG93Q2hhbmdlc1Vuc2F2ZWRNZXNzYWdlID0gdW5zYXZlZENoYW5nZXNcblxuICAgICAgICAgICAgICAgIHJldHVybiB1bnNhdmVkQ2hhbmdlc1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGlmcmFtZUxvYWRlciggc3RhdHVzICkge1xuICAgICAgICAgICAgICAgIGxldCBsb2FkZXIgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCggJ3RycC1wcmV2aWV3LWxvYWRlcicgKVxuXG4gICAgICAgICAgICAgICAgaWYoIHN0YXR1cyA9PSAnc2hvdycgKVxuICAgICAgICAgICAgICAgICAgICBsb2FkZXIuc3R5bGUuZGlzcGxheSA9ICdmbGV4J1xuICAgICAgICAgICAgICAgIGVsc2UgaWYoIHN0YXR1cyA9PSAnaGlkZScgKVxuICAgICAgICAgICAgICAgICAgICBsb2FkZXIuc3R5bGUuZGlzcGxheSA9ICdub25lJ1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHByZXZpb3VzU3RyaW5nKCl7XG4gICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd0cnAtc3RyaW5nLWNhdGVnb3JpZXMnKS52YWx1ZVxuXG4gICAgICAgICAgICAgICAgbGV0IG5ld1ZhbHVlID0gK2N1cnJlbnRWYWx1ZSAtIDFcblxuICAgICAgICAgICAgICAgIHdoaWxlKCBuZXdWYWx1ZSA+PSAwICYmIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoJyN0cnAtc3RyaW5nLWNhdGVnb3JpZXMgb3B0aW9uW3ZhbHVlPVwiJyArIG5ld1ZhbHVlICsgJ1wiXScpLmxlbmd0aCA9PT0gMCApe1xuICAgICAgICAgICAgICAgICAgICBuZXdWYWx1ZS0tO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKCBuZXdWYWx1ZSA8IDAgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cblxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0ZWRTdHJpbmcgPSBuZXdWYWx1ZS50b1N0cmluZygpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmV4dFN0cmluZygpe1xuICAgICAgICAgICAgICAgIGxldCBjdXJyZW50VmFsdWUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgndHJwLXN0cmluZy1jYXRlZ29yaWVzJykudmFsdWUsIG5ld1ZhbHVlID0gMFxuXG4gICAgICAgICAgICAgICAgaWYoIGN1cnJlbnRWYWx1ZSAhPSAnJyApXG4gICAgICAgICAgICAgICAgICAgIG5ld1ZhbHVlID0gK2N1cnJlbnRWYWx1ZSArIDFcblxuICAgICAgICAgICAgICAgIHdoaWxlKCBuZXdWYWx1ZSA8IHRoaXMuZGljdGlvbmFyeS5sZW5ndGggJiYgZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgnI3RycC1zdHJpbmctY2F0ZWdvcmllcyBvcHRpb25bdmFsdWU9XCInICsgbmV3VmFsdWUgKyAnXCJdJykubGVuZ3RoID09PSAwICl7XG4gICAgICAgICAgICAgICAgICAgIG5ld1ZhbHVlKys7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKCBuZXdWYWx1ZSA+PSB0aGlzLmRpY3Rpb25hcnkubGVuZ3RoICl7XG4gICAgICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0ZWRTdHJpbmcgPSBuZXdWYWx1ZS50b1N0cmluZygpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkS2V5Ym9hcmRTaG9ydGN1dHNMaXN0ZW5lcigpe1xuICAgICAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoXCJrZXlkb3duXCIsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh3aW5kb3cubmF2aWdhdG9yLnBsYXRmb3JtLm1hdGNoKFwiTWFjXCIpID8gZS5tZXRhS2V5IDogZS5jdHJsS2V5KSAmJiBlLmFsdEtleSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIENUUkwgKyBBTFQgKyByaWdodCBhcnJvd1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYoIGUua2V5Q29kZSA9PT0gMzkgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmRpc3BhdGNoRXZlbnQoIG5ldyBFdmVudCggJ3RycF90cmlnZ2VyX25leHRfc3RyaW5nX2V2ZW50JyApICk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDVFJMICsgQUxUICsgbGVmdCBhcnJvd1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBlLmtleUNvZGUgPT09IDM3ICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5kaXNwYXRjaEV2ZW50KCBuZXcgRXZlbnQoICd0cnBfdHJpZ2dlcl9wcmV2aW91c19zdHJpbmdfZXZlbnQnICkgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LCBmYWxzZSk7XG5cbiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lciggJ3RycF90cmlnZ2VyX25leHRfc3RyaW5nX2V2ZW50JywgdGhpcy5uZXh0U3RyaW5nIClcbiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lciggJ3RycF90cmlnZ2VyX3ByZXZpb3VzX3N0cmluZ19ldmVudCcsIHRoaXMucHJldmlvdXNTdHJpbmcgKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHJlc2l6ZUlmcmFtZSAoZXZlbnQsIHVpKSB7XG4gICAgICAgICAgICAgICAgbGV0IHRvdGFsX3dpZHRoID0galF1ZXJ5KHdpbmRvdykud2lkdGgoKTtcbiAgICAgICAgICAgICAgICBsZXQgd2lkdGggPSBqUXVlcnkoICcjdHJwLWNvbnRyb2xzJyApLndpZHRoKCk7XG5cbiAgICAgICAgICAgICAgICBpZih3aWR0aCA+IHRvdGFsX3dpZHRoKSB7XG4gICAgICAgICAgICAgICAgICAgIHdpZHRoID0gdG90YWxfd2lkdGg7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRyb2xzLmNzcygnd2lkdGgnLCB3aWR0aCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxldCBwcmV2aWV3Q29udGFpbmVyID0galF1ZXJ5KCAnI3RycC1wcmV2aWV3JyApO1xuICAgICAgICAgICAgICAgIHByZXZpZXdDb250YWluZXIuY3NzKCdyaWdodCcsIHdpZHRoICk7XG4gICAgICAgICAgICAgICAgcHJldmlld0NvbnRhaW5lci5jc3MoJ2xlZnQnLCAoIHdpZHRoIC0gMzQ4ICkgKTtcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGFpbmVyLmNzcygnd2lkdGgnLCAodG90YWxfd2lkdGggLSB3aWR0aCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvL2FkZCBzdXBwb3J0IGZvciB2LW1vZGVsIGluIHNlbGVjdDJcbiAgICAgICAgZGlyZWN0aXZlczoge1xuICAgICAgICAgICAgc2VsZWN0Mjoge1xuICAgICAgICAgICAgICAgIGluc2VydGVkKGVsKSB7XG4gICAgICAgICAgICAgICAgICAgIGpRdWVyeShlbCkub24oJ3NlbGVjdDI6c2VsZWN0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXZlbnQgPSBuZXcgRXZlbnQoJ2NoYW5nZScsIHsgYnViYmxlczogdHJ1ZSwgY2FuY2VsYWJsZTogdHJ1ZSB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgZWwuZGlzcGF0Y2hFdmVudChldmVudClcbiAgICAgICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgICAgICBqUXVlcnkoZWwpLm9uKCdzZWxlY3QyOnVuc2VsZWN0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXZlbnQgPSBuZXcgRXZlbnQoJ2NoYW5nZScsIHsgYnViYmxlczogdHJ1ZSwgY2FuY2VsYWJsZTogdHJ1ZSB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgZWwuZGlzcGF0Y2hFdmVudChldmVudClcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuPC9zY3JpcHQ+XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./assets/src/js/editor.vue?vue&type=script&lang=js&\n");
766
 
767
  /***/ }),
768
 
762
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
763
 
764
  "use strict";
765
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! select2/dist/js/select2.min.js */ \"./node_modules/select2/dist/js/select2.min.js\");\n/* harmony import */ var select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./assets/src/js/utils.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _components_language_boxes_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/language-boxes.vue */ \"./assets/src/js/components/language-boxes.vue\");\n/* harmony import */ var _components_save_translations_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/save-translations.vue */ \"./assets/src/js/components/save-translations.vue\");\n/* harmony import */ var _components_hover_actions_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/hover-actions.vue */ \"./assets/src/js/components/hover-actions.vue\");\n/* harmony import */ var _components_extra_content_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/extra-content.vue */ \"./assets/src/js/components/extra-content.vue\");\n/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! he */ \"./node_modules/he/he.js\");\n/* harmony import */ var he__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(he__WEBPACK_IMPORTED_MODULE_7__);\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n props: ['trp_settings', 'language_names', 'ordered_secondary_languages', 'current_language', 'on_screen_language', 'view_as_roles', 'url_to_load', 'string_selectors', 'data_attributes', 'ajax_url', 'editor_nonces', 'string_group_order', 'merge_rules', 'localized_text', 'paid_version', 'flags_path'],\n components: {\n languageBoxes: _components_language_boxes_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n saveTranslations: _components_save_translations_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n hoverActions: _components_hover_actions_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n extraContent: _components_extra_content_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n },\n data: function data() {\n return {\n //props\n settings: JSON.parse(this.trp_settings),\n languageNames: JSON.parse(this.language_names),\n orderedSecondaryLanguages: JSON.parse(this.ordered_secondary_languages),\n roles: JSON.parse(this.view_as_roles),\n nonces: JSON.parse(this.editor_nonces),\n stringGroupOrder: JSON.parse(this.string_group_order),\n selectors: JSON.parse(this.string_selectors),\n dataAttributes: JSON.parse(this.data_attributes),\n mergeRules: JSON.parse(this.merge_rules),\n editorStrings: trp_localized_strings,\n flagsPath: JSON.parse(this.flags_path),\n //data\n currentLanguage: this.current_language,\n onScreenLanguage: this.on_screen_language,\n currentURL: this.url_to_load,\n urlToLoad: this.url_to_load,\n iframe: '',\n dictionary: [],\n selectedString: null,\n selectedIndexesArray: [],\n detectedSelectorAndId: [],\n stringGroups: [],\n mergingString: false,\n mergeData: [],\n showChangesUnsavedMessage: false,\n viewAs: '',\n loading_strings: 0,\n translationNotLoadedYet: false\n };\n },\n created: function created() {\n this.settings['default-language-name'] = this.languageNames[this.settings['default-language']]; //set default value for the View As select\n\n var params = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getUrlParameters(this.currentURL);\n if (Object.keys(params).length > 1 && params['trp-view-as']) this.viewAs = params['trp-view-as'];else this.viewAs = 'current_user';\n },\n mounted: function mounted() {\n this.addKeyboardShortcutsListener();\n var self = this; // initialize select2\n\n jQuery('#trp-language-select, #trp-view-as-select').select2({\n width: '100%'\n }); //init strings dropdown\n\n this.stringsDropdownLoading(); // show overlay when select is opened\n\n jQuery('#trp-language-select, #trp-string-categories').on('select2:open', function () {\n jQuery('#trp_select2_overlay').fadeIn('100');\n }).on('select2:close', function () {\n jQuery('#trp_select2_overlay').hide();\n }).on('select2:opening', function (e) {\n /* when we have unsaved changes prevent the strings dropdown from opening so we do not have a disconnect between the textareas and the dropdown */\n if (self.hasUnsavedChanges()) {\n e.preventDefault();\n }\n }); // resize sidebar and consequently the iframe\n\n var previewContainer = jQuery('#trp-preview');\n var total_width = jQuery(window).width();\n jQuery('#trp-controls').resizable({\n start: function start() {\n previewContainer.toggle();\n },\n stop: function stop() {\n previewContainer.toggle();\n },\n handles: 'e',\n minWidth: 285,\n maxWidth: total_width - 20\n }).bind(\"resize\", this.resizeIframe); // resize iframe when resizing window\n\n jQuery(window).resize(function () {\n self.resizeIframe();\n });\n },\n watch: {\n currentLanguage: function currentLanguage(_currentLanguage) {\n var self = this; //grab the correct URL from the iFrame\n\n var newURL = this.iframe.querySelector('link[hreflang=\"' + _currentLanguage.replace('_', '-') + '\"]').getAttribute('href');\n this.currentURL = newURL;\n this.iframe.location = newURL; //reset vue props\n\n this.selectedString = '';\n this.selectedIndexesArray = []; //set strings dropdown to loading state\n\n jQuery('#trp-string-categories').val('').trigger('change');\n this.stringsDropdownLoading();\n this.onScreenLanguage = _currentLanguage;\n\n if (this.settings['default-language'] == this.currentLanguage && this.settings['translation-languages'].length > 1) {\n this.settings['translation-languages'].some(function (language) {\n if (language != self.settings['default-language']) {\n // return the first language not default\n self.onScreenLanguage = language;\n return true;\n }\n });\n }\n },\n currentURL: function currentURL(newUrl, oldUrl) {\n window.history.replaceState(null, null, this.parentURL(newUrl));\n },\n viewAs: function viewAs(role) {\n if (!this.currentURL || !this.iframe) return;\n var url = this.cleanURL(this.currentURL);\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-edit-translation', 'preview');\n\n if (role == 'current_user') {\n this.iframe.location = url;\n return;\n } //if nonce not available, an update to the Browse as Other Roles add-on is required\n\n\n if (!this.nonces[role]) {\n alert(this.editorStrings.bor_update_notice);\n return;\n }\n\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-view-as', role);\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].updateUrlParameter(url, 'trp-view-as-nonce', this.nonces[role]);\n this.iframe.location = url;\n },\n selectedString: function selectedString(selectedStringArrayIndex, oldString) {\n if (this.hasUnsavedChanges() || !selectedStringArrayIndex && selectedStringArrayIndex !== 0) return;\n jQuery('#trp-string-categories').val(selectedStringArrayIndex !== null ? selectedStringArrayIndex : '').trigger('change');\n var selectedString = this.dictionary[selectedStringArrayIndex];\n if (!selectedString) return;\n var currentNode = this.iframe.querySelector(\"[\" + selectedString.selector + \"='\" + selectedString.dbID + \"']\");\n var selectedIndexesArray = []; //when merging we do not have a valid current node, so we just add the fake id\n\n if (currentNode) {\n var self = this;\n var selectors = self.getAllSelectors();\n var nodes = [];\n nodes.push(currentNode);\n\n if (currentNode.tagName != \"A\") {\n // include the anchor's translatable attributes\n var anchorParent = currentNode.closest('a');\n\n if (anchorParent != null) {\n nodes.push(anchorParent);\n }\n }\n\n if (currentNode.tagName == \"A\" && currentNode.children.length > 0) {\n // include all the translatable attributes inside the anchor\n var childrenArray = _toConsumableArray(currentNode.children);\n\n childrenArray.forEach(function (child) {\n nodes.push(child);\n });\n }\n\n nodes.forEach(function (node) {\n selectors.forEach(function (selector) {\n var stringId = node.getAttribute(selector);\n\n if (stringId) {\n var found = false;\n var i;\n\n for (i = 0; i < selectedIndexesArray.length; i++) {\n if (typeof self.dictionary[selectedIndexesArray[i]] !== 'undefined' && self.dictionary[selectedIndexesArray[i]].dbID !== 'undefined' && self.dictionary[selectedIndexesArray[i]].dbID === stringId) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n selectedIndexesArray.push(self.getStringIndex(selector, stringId));\n }\n }\n });\n });\n } else selectedIndexesArray.push(selectedStringArrayIndex);\n\n this.selectedIndexesArray = selectedIndexesArray;\n }\n },\n computed: {\n closeURL: function closeURL() {\n return this.cleanURL(this.currentURL);\n }\n },\n methods: {\n iFrameLoaded: function iFrameLoaded() {\n var self = this;\n var iframeElement = document.querySelector('#trp-preview-iframe');\n this.iframe = iframeElement.contentDocument || iframeElement.contentWindow.document; //sync iFrame URL with parent\n\n if (this.currentURL != this.iframe.URL) this.currentURL = this.iframe.URL; //hide iFrame loader\n\n this.iframeLoader('hide');\n self.detectedSelectorAndId = [];\n self.dictionary = [];\n this.scanIframeForStrings();\n window.addEventListener('trp_iframe_page_updated', this.scanIframeForStrings); //event that is fired when the iFrame is navigated\n\n iframeElement.contentWindow.onbeforeunload = function () {\n self.iframeLoader('show');\n self.selectedString = null;\n self.selectedIndexesArray = [];\n self.translationNotLoadedYet = false;\n self.stringsDropdownLoading();\n };\n },\n scanIframeForStrings: function scanIframeForStrings() {\n this.scanForSelector('data-trp-translate-id', 'regular', this.onScreenLanguage);\n this.scanForSelector('data-trpgettextoriginal', 'gettext', this.currentLanguage);\n this.scanForSelector('data-trp-post-slug', 'postslug', this.currentLanguage);\n },\n scanForSelector: function scanForSelector(baseSelector, typeSlug, languageOfIds) {\n this.loading_strings++;\n var self = this;\n var selectors = this.prepareSelectorStrings(baseSelector);\n\n var nodes = _toConsumableArray(this.iframe.querySelectorAll('[' + selectors.join('],[') + ']'));\n\n var stringIdsArray = [],\n nodeData = [],\n nodeEntries = [];\n nodes.forEach(function (node) {\n nodeEntries = self.getNodeInfo(node, baseSelector);\n nodeEntries.forEach(function (entry) {\n // this check ensures that we don't create duplicates when rescanning after ajax complete\n if (!self.alreadyDetected(entry.selector, entry.dbID)) {\n stringIdsArray.push(entry.dbID);\n nodeData.push(entry);\n }\n });\n self.setupEventListener(node);\n }); //unique ids only\n\n stringIdsArray = _toConsumableArray(new Set(stringIdsArray));\n\n if (stringIdsArray.length > 0) {\n var data = new FormData();\n data.append('action', 'trp_get_translations_' + typeSlug);\n data.append('all_languages', 'true');\n data.append('security', this.nonces['gettranslationsnonce' + typeSlug]);\n data.append('language', languageOfIds);\n data.append('string_ids', JSON.stringify(stringIdsArray));\n axios__WEBPACK_IMPORTED_MODULE_2___default.a.post(this.ajax_url, data).then(function (response) {\n self.loading_strings--;\n self.addToDictionary(response.data, nodeData);\n })[\"catch\"](function (error) {\n console.log(error);\n });\n } else {\n self.loading_strings--;\n }\n },\n alreadyDetected: function alreadyDetected(selector, dbId) {\n var combined = selector + '=' + dbId;\n\n if (_utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].arrayContainsItem(this.detectedSelectorAndId, combined)) {\n return true;\n } else {\n this.detectedSelectorAndId.push(combined);\n return false;\n }\n },\n setupEventListener: function setupEventListener(node) {\n if (node.tagName == 'A' && !node.hasAttribute('data-trpgettextoriginal')) return false;\n var self = this;\n node.addEventListener('mouseenter', self.$refs.hoverActions.showPencilIcon);\n },\n addToDictionary: function addToDictionary(responseData) {\n var nodeInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var self = this;\n\n if (responseData != null) {\n if (nodeInfo) {\n nodeInfo.forEach(function (infoRow, index) {\n responseData.some(function (responseDataRow) {\n if (infoRow.dbID == responseDataRow.dbID) {\n //bring block_type to the top level object\n if (responseDataRow.type != 'gettext' && typeof responseDataRow.block_type == 'undefined') {\n var firstLanguage = self.orderedSecondaryLanguages[0];\n if (typeof responseDataRow.translationsArray[firstLanguage].block_type != 'undefined') responseDataRow.block_type = responseDataRow.translationsArray[firstLanguage].block_type;\n }\n\n nodeInfo[index] = Object.assign({}, responseDataRow, infoRow);\n return true; // a sort of break\n }\n });\n });\n } else {\n nodeInfo = responseData;\n }\n\n this.stringGroups = this.addToStringGroups(nodeInfo);\n this.dictionary = this.dictionary.concat(nodeInfo);\n this.initStringsDropdown();\n }\n },\n addToStringGroups: function addToStringGroups(strings) {\n // see what node groups are found\n var foundStringGroups = this.stringGroups;\n strings.forEach(function (string) {\n if (foundStringGroups.indexOf(string.group) === -1 && (typeof string.blockType === 'undefined' || string.blockType !== '2')) {\n foundStringGroups.push(string.group);\n }\n }); // put the node groups in the order that we want, according to the prop this.stringGroupOrder\n\n var orderedStringGroups = [];\n\n if (this.editorStrings.seo_update_notice != 'seo_pack_update_not_needed') {\n orderedStringGroups.push(this.editorStrings.seo_update_notice);\n }\n\n this.stringGroupOrder.forEach(function (group) {\n if (foundStringGroups.indexOf(group) !== -1) {\n orderedStringGroups.push(group);\n }\n }); // if there were any other string groups that were not in the prop, add them at the end.\n\n foundStringGroups.forEach(function (group) {\n if (orderedStringGroups.indexOf(group) === -1) {\n orderedStringGroups.push(group);\n }\n });\n return orderedStringGroups;\n },\n getStringIndex: function getStringIndex(selector, dbID) {\n var found = null;\n this.dictionary.some(function (string, index) {\n if (string.dbID == dbID && string.selector == selector) {\n found = index;\n return true;\n }\n });\n return found;\n },\n getNodeInfo: function getNodeInfo(node) {\n var baseSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var stringId;\n var nodeData = [];\n var selectors = this.prepareSelectorStrings(baseSelector);\n selectors.forEach(function (selector) {\n stringId = node.getAttribute(selector);\n\n if (stringId) {\n var nodeAttribute = selector.replace(baseSelector, '');\n var nodeGroup = node.getAttribute('data-trp-node-group' + nodeAttribute);\n var nodeDescription = node.getAttribute('data-trp-node-description' + nodeAttribute);\n var entry = {\n dbID: stringId,\n selector: selector,\n attribute: nodeAttribute.substr(1) // substr(1) is used to trim prefixing line - ex. -alt will result in alt (no line)\n\n };\n if (nodeGroup) entry.group = nodeGroup;\n if (nodeDescription) entry.description = nodeDescription;\n nodeData.push(entry);\n }\n });\n return nodeData;\n },\n getAllSelectors: function getAllSelectors() {\n var selectors = [];\n var self = this;\n this.dataAttributes.forEach(function (dataAttribute) {\n selectors = selectors.concat(self.prepareSelectorStrings(dataAttribute));\n });\n return selectors;\n },\n prepareSelectorStrings: function prepareSelectorStrings(baseNameSelector) {\n var parsed_selectors = [];\n this.selectors.forEach(function (selectorSuffix, index) {\n parsed_selectors.push(baseNameSelector + selectorSuffix);\n });\n return parsed_selectors;\n },\n parentURL: function parentURL(url) {\n return url.replace('trp-edit-translation=preview', 'trp-edit-translation=true');\n },\n cleanURL: function cleanURL(url) {\n //make removeUrlParameter recursive and only call it once with all the parameters that\n //need to stripped ?\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'lang');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-view-as');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-view-as-nonce');\n url = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].removeUrlParameter(url, 'trp-edit-translation');\n return url;\n },\n showString: function showString(string, type) {\n if (typeof string.blockType !== 'undefined' && string.blockType === '2') {\n // don't show deprecated translation blocks in the dropdown\n return false;\n }\n\n if (type === this.editorStrings.images && typeof string.attribute != 'undefined' && string.attribute == 'src') return true;\n if (typeof string.attribute !== 'undefined' && (string.attribute == 'href' || string.attribute == 'src')) return false;\n if (string.group === type) return true;\n return false;\n },\n initStringsDropdown: function initStringsDropdown() {\n var self = this;\n\n if (!this.isStringsDropdownOpen()) {\n jQuery('#trp-string-categories').select2('destroy');\n jQuery('#trp-string-categories').select2({\n placeholder: self.editorStrings.select_string,\n templateResult: function templateResult(option) {\n var original = he__WEBPACK_IMPORTED_MODULE_7___default.a.decode(option.text.substring(0, 90)) + (option.text.length <= 90 ? '' : '...');\n var description = option.title ? '(' + option.title + ')' : '';\n return jQuery('<div>' + original + '</div><div class=\"string-selector-description\">' + description + '</div>');\n },\n width: '100%'\n }).prop('disabled', false);\n jQuery('#trp_select2_overlay').hide();\n }\n },\n stringsDropdownLoading: function stringsDropdownLoading() {\n jQuery('#trp-string-categories').select2({\n placeholder: this.editorStrings.strings_loading,\n width: '100%'\n }).prop('disabled', true);\n },\n processOptionName: function processOptionName(name, type) {\n if (type == 'Images') return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getFilename(name);\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].escapeHtml(name);\n },\n isStringsDropdownOpen: function isStringsDropdownOpen() {\n return jQuery('#trp-string-categories').select2('isOpen');\n },\n hasUnsavedChanges: function hasUnsavedChanges() {\n var unsavedChanges = false;\n var self = this;\n\n if (this.selectedIndexesArray.length > 0) {\n this.selectedIndexesArray.forEach(function (selectedIndex) {\n self.settings['translation-languages'].forEach(function (languageCode) {\n if (self.dictionary[selectedIndex] && self.dictionary[selectedIndex].translationsArray[languageCode] && self.dictionary[selectedIndex].translationsArray[languageCode].translated !== self.dictionary[selectedIndex].translationsArray[languageCode].editedTranslation) {\n unsavedChanges = true;\n }\n });\n });\n }\n\n this.showChangesUnsavedMessage = unsavedChanges;\n return unsavedChanges;\n },\n iframeLoader: function iframeLoader(status) {\n var loader = document.getElementById('trp-preview-loader');\n if (status == 'show') loader.style.display = 'flex';else if (status == 'hide') loader.style.display = 'none';\n },\n previousString: function previousString() {\n var currentValue = document.getElementById('trp-string-categories').value;\n var newValue = +currentValue - 1;\n\n while (newValue >= 0 && document.querySelectorAll('#trp-string-categories option[value=\"' + newValue + '\"]').length === 0) {\n newValue--;\n }\n\n if (newValue < 0) return;\n this.selectedString = newValue.toString();\n },\n nextString: function nextString() {\n var currentValue = document.getElementById('trp-string-categories').value,\n newValue = 0;\n if (currentValue != '') newValue = +currentValue + 1;\n\n while (newValue < this.dictionary.length && document.querySelectorAll('#trp-string-categories option[value=\"' + newValue + '\"]').length === 0) {\n newValue++;\n }\n\n if (newValue >= this.dictionary.length) {\n return;\n }\n\n this.selectedString = newValue.toString();\n },\n addKeyboardShortcutsListener: function addKeyboardShortcutsListener() {\n document.addEventListener(\"keydown\", function (e) {\n if ((window.navigator.platform.match(\"Mac\") ? e.metaKey : e.ctrlKey) && e.altKey) {\n // CTRL + ALT + right arrow\n if (e.keyCode === 39) {\n e.preventDefault();\n window.dispatchEvent(new Event('trp_trigger_next_string_event'));\n } else {\n // CTRL + ALT + left arrow\n if (e.keyCode === 37) {\n e.preventDefault();\n window.dispatchEvent(new Event('trp_trigger_previous_string_event'));\n }\n }\n }\n }, false);\n window.addEventListener('trp_trigger_next_string_event', this.nextString);\n window.addEventListener('trp_trigger_previous_string_event', this.previousString);\n },\n resizeIframe: function resizeIframe(event, ui) {\n var total_width = jQuery(window).width();\n var width = jQuery('#trp-controls').width();\n var previewContainer = jQuery('#trp-preview');\n previewContainer.css('right', width);\n previewContainer.css('left', width - 348);\n previewContainer.css('width', total_width - width);\n }\n },\n //add support for v-model in select2\n directives: {\n select2: {\n inserted: function inserted(el) {\n jQuery(el).on('select2:select', function () {\n var event = new Event('change', {\n bubbles: true,\n cancelable: true\n });\n el.dispatchEvent(event);\n });\n jQuery(el).on('select2:unselect', function () {\n var event = new Event('change', {\n bubbles: true,\n cancelable: true\n });\n el.dispatchEvent(event);\n });\n }\n }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AgICAgICAgICAgICAgICAgPHNwYW4gY2xhc3M9XCJ0cnAtYWpheC1sb2FkZXJcIiB2LXNob3c9XCJsb2FkaW5nX3N0cmluZ3MgPiAwXCIgaWQ9XCJ0cnAtc3RyaW5nLXNhdmVkLWFqYXgtbG9hZGVyXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRycC1zcGlubmVyXCI+PC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICA8L3NwYW4+XG4gICAgICAgICAgICAgICAgICAgICAgICA8c2F2ZS10cmFuc2xhdGlvbnNcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOnNlbGVjdGVkSW5kZXhlc0FycmF5PVwic2VsZWN0ZWRJbmRleGVzQXJyYXlcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6ZGljdGlvbmFyeT1cImRpY3Rpb25hcnlcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6c2V0dGluZ3M9XCJzZXR0aW5nc1wiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpub25jZXM9XCJub25jZXNcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6YWpheF91cmw9XCJhamF4X3VybFwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpjdXJyZW50TGFuZ3VhZ2U9XCJjdXJyZW50TGFuZ3VhZ2VcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6b25TY3JlZW5MYW5ndWFnZT1cIm9uU2NyZWVuTGFuZ3VhZ2VcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6aWZyYW1lPVwiaWZyYW1lXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmN1cnJlbnRVUkw9XCJjdXJyZW50VVJMXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm1lcmdpbmdTdHJpbmc9XCJtZXJnaW5nU3RyaW5nXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm1lcmdlRGF0YT1cIm1lcmdlRGF0YVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEB0cmFuc2xhdGlvbnMtc2F2ZWQ9XCJzaG93Q2hhbmdlc1Vuc2F2ZWRNZXNzYWdlID0gZmFsc2VcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6ZWRpdG9yU3RyaW5ncz1cImVkaXRvclN0cmluZ3NcIlxuICAgICAgICAgICAgICAgICAgICAgICAgPlxuICAgICAgICAgICAgICAgICAgICAgICAgPC9zYXZlLXRyYW5zbGF0aW9ucz5cbiAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidHJwLWNvbnRyb2xzLXNlY3Rpb25cIj5cblxuICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidHJwLWNvbnRyb2xzLXNlY3Rpb24tY29udGVudFwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBpZD1cInRycC1sYW5ndWFnZS1zd2l0Y2hcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8c2VsZWN0IGlkPVwidHJwLWxhbmd1YWdlLXNlbGVjdFwiIG5hbWU9XCJsYW5nXCIgdi1tb2RlbD1cImN1cnJlbnRMYW5ndWFnZVwiIHYtc2VsZWN0Mj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiB2LWZvcj1cIihsYW5nLCBsYW5nSW5kZXgpIGluIGxhbmd1YWdlTmFtZXNcIiA6dmFsdWU9XCJsYW5nSW5kZXhcIj57e2xhbmd9fTwvb3B0aW9uPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvc2VsZWN0PlxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgICAgICAgICAgICAg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RsZT1cImVkaXRvclN0cmluZ3MucHJldmlvdXNfdGl0bGVfYXR0clwiPjxzcGFuPiZsYXF1bzs8L3NwYW4+IHt7IGVkaXRvclN0cmluZ3MucHJldmlvdXMgfX08L2J1dHRvbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBpZD1cInRycC1uZXh0XCIgY2xhc3M9XCJ0cnAtbmV4dC1wcmV2aW91cy1idXR0b25zXCIgdi1vbjpjbGljaz1cIm5leHRTdHJpbmcoKVwiIDp0aXRsZT1cImVkaXRvclN0cmluZ3MubmV4dF90aXRsZV9hdHRyXCI+e3sgZWRpdG9yU3RyaW5ncy5uZXh0IH19IDxzcGFuPiZyYXF1bzs8L3NwYW4+PC9idXR0b24+XG4gICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cblxuICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBpZD1cInRycC12aWV3LWFzXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBpZD1cInRycC12aWV3LWFzLWRlc2NyaXB0aW9uXCI+e3sgZWRpdG9yU3RyaW5ncy52aWV3X2FzIH19PC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNlbGVjdCBpZD1cInRycC12aWV3LWFzLXNlbGVjdFwiIHYtbW9kZWw9XCJ2aWV3QXNcIiB2LXNlbGVjdDI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxvcHRpb24gdi1mb3I9XCIocm9sZSwgcm9sZUluZGV4KSBpbiByb2xlc1wiIDp2YWx1ZT1cInJvbGVcIiA6ZGlzYWJsZWQ9XCIhcm9sZVwiIDp0aXRsZT1cIiFyb2xlID8gZWRpdG9yU3RyaW5ncy52aWV3X2FzX3BybyA6ICcnXCI+e3tyb2xlSW5kZXh9fTwvb3B0aW9uPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvc2VsZWN0PlxuICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidHJwLWNvbnRyb2xzLXNlY3Rpb25cIiB2LXNob3c9XCJzZWxlY3RlZFN0cmluZyAhPT0gbnVsbFwiPlxuICAgICAgICAgICAgICAgICAgICA8bGFuZ3VhZ2UtYm94ZXNcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6c2VsZWN0ZWRJbmRleGVzQXJyYXk9XCJzZWxlY3RlZEluZGV4ZXNBcnJheVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmRpY3Rpb25hcnk9XCJkaWN0aW9uYXJ5XCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Y3VycmVudExhbmd1YWdlPVwiY3VycmVudExhbmd1YWdlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6b25TY3JlZW5MYW5ndWFnZT1cIm9uU2NyZWVuTGFuZ3VhZ2VcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpsYW5ndWFnZU5hbWVzPVwibGFuZ3VhZ2VOYW1lc1wiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOnNldHRpbmdzPVwic2V0dGluZ3NcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpzaG93Q2hhbmdlc1Vuc2F2ZWRNZXNzYWdlPVwic2hvd0NoYW5nZXNVbnNhdmVkTWVzc2FnZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgQGRpc2NhcmRlZC1jaGFuZ2VzPVwiaGFzVW5zYXZlZENoYW5nZXMoKVwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOmVkaXRvclN0cmluZ3M9XCJlZGl0b3JTdHJpbmdzXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6ZmxhZ3NQYXRoPVwiZmxhZ3NQYXRoXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6aWZyYW1lPVwiaWZyYW1lXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6bm9uY2VzPVwibm9uY2VzXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6YWpheF91cmw9XCJhamF4X3VybFwiXG4gICAgICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgICAgPC9sYW5ndWFnZS1ib3hlcz5cbiAgICAgICAgICAgICAgICA8L2Rpdj5cblxuICAgICAgICAgICAgICAgIDxleHRyYS1jb250ZW50IDpsYW5ndWFnZU5hbWVzPVwibGFuZ3VhZ2VOYW1lc1wiIDplZGl0b3JTdHJpbmdzPVwiZWRpdG9yU3RyaW5nc1wiIDpwYWlkVmVyc2lvbj1cInBhaWRfdmVyc2lvblwiPjwvZXh0cmEtY29udGVudD5cblxuICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0cnAtY29udHJvbHMtc2VjdGlvblwiIHYtc2hvdz1cInRyYW5zbGF0aW9uTm90TG9hZGVkWWV0XCI+XG4gICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9XCJ0cnAtdHJhbnNsYXRpb24tbm90LXJlYWR5LXNlY3Rpb25cIiBjbGFzcz1cInRycC1jb250cm9scy1zZWN0aW9uLWNvbnRlbnRcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgIDxwIHYtaHRtbD1cImVkaXRvclN0cmluZ3MudHJhbnNsYXRpb25fbm90X2xvYWRlZF95ZXRcIj48L3A+XG4gICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgIDxkaXYgaWQ9XCJ0cnBfc2VsZWN0Ml9vdmVybGF5XCI+PC9kaXY+XG5cbiAgICAgICAgICAgIDxob3Zlci1hY3Rpb25zXG4gICAgICAgICAgICAgICAgcmVmPVwiaG92ZXJBY3Rpb25zXCJcbiAgICAgICAgICAgICAgICA6ZGljdGlvbmFyeT1cImRpY3Rpb25hcnlcIlxuICAgICAgICAgICAgICAgIDpzZXR0aW5ncz1cInNldHRpbmdzXCJcbiAgICAgICAgICAgICAgICA6aWZyYW1lPVwiaWZyYW1lXCJcbiAgICAgICAgICAgICAgICA6ZGF0YUF0dHJpYnV0ZXM9XCJkYXRhQXR0cmlidXRlc1wiXG4gICAgICAgICAgICAgICAgOm1lcmdlUnVsZXM9XCJtZXJnZVJ1bGVzXCJcbiAgICAgICAgICAgICAgICA6bm9uY2VzPVwibm9uY2VzXCJcbiAgICAgICAgICAgICAgICA6YWpheF91cmw9XCJhamF4X3VybFwiXG4gICAgICAgICAgICAgICAgOm1lcmdlRGF0YT1cIm1lcmdlRGF0YVwiXG4gICAgICAgICAgICAgICAgOmVkaXRvclN0cmluZ3M9XCJlZGl0b3JTdHJpbmdzXCJcbiAgICAgICAgICAgICAgICA6Y3VycmVudExhbmd1YWdlPVwiY3VycmVudExhbmd1YWdlXCJcbiAgICAgICAgICAgID5cbiAgICAgICAgICAgIDwvaG92ZXItYWN0aW9ucz5cbiAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgPGRpdiBpZD1cInRycC1wcmV2aWV3XCI+XG4gICAgICAgICAgICA8aWZyYW1lIGlkPVwidHJwLXByZXZpZXctaWZyYW1lXCIgOnNyYz1cInVybFRvTG9hZFwiIHYtb246bG9hZD1cImlGcmFtZUxvYWRlZFwiPjwvaWZyYW1lPlxuXG4gICAgICAgICAgICA8ZGl2IGlkPVwidHJwLXByZXZpZXctbG9hZGVyXCI+XG4gICAgICAgICAgICAgICAgPHN2ZyBjbGFzcz1cInRycC1sb2FkZXJcIiB3aWR0aD1cIjY1cHhcIiBoZWlnaHQ9XCI2NXB4XCIgdmlld0JveD1cIjAgMCA2NiA2NlwiIHhtbG5zPVwiaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmdcIj5cbiAgICAgICAgICAgICAgICAgICAgPGNpcmNsZSBjbGFzcz1cInR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FxuICAgICAgICAgICAgJ29uX3NjcmVlbl9sYW5ndWFnZScsXG4gICAgICAgICAgICAndmlld19hc19yb2xlcycsXG4gICAgICAgICAgICAndXJsX3RvX2xvYWQnLFxuICAgICAgICAgICAgJ3N0cmluZ19zZWxlY3RvcnMnLFxuICAgICAgICAgICAgJ2RhdGFfYXR0cmlidXRlcycsXG4gICAgICAgICAgICAnYWpheF91cmwnLFxuICAgICAgICAgICAgJ2VkaXRvcl9ub25jZXMnLFxuICAgICAgICAgICAgJ3N0cmluZ19ncm91cF9vcmRlcicsXG4gICAgICAgICAgICAnbWVyZ2VfcnVsZXMnLFxuICAgICAgICAgICAgJ2xvY2FsaXplZF90ZXh0JyxcbiAgICAgICAgICAgICdwYWlkX3ZlcnNpb24nLFxuICAgICAgICAgICAgJ2ZsYWdzX3BhdGgnXG4gICAgICAgIF0sXG4gICAgICAgIGNvbXBvbmVudHM6e1xuICAgICAgICAgICAgbGFuZ3VhZ2VCb3hlcyxcbiAgICAgICAgICAgIHNhdmVUcmFuc2xhdGlvbnMsXG4gICAgICAgICAgICBob3ZlckFjdGlvbnMsXG4gICAgICAgICAgICBleHRyYUNvbnRlbnRcbiAgICAgICAgfSxcbiAgICAgICAgZGF0YSgpe1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAvL3Byb3BzXG4gICAgICAgICAgICAgICAgc2V0dGluZ3MgICAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMudHJwX3NldHRpbmdzICksXG4gICAgICAgICAgICAgICAgbGFuZ3VhZ2VOYW1lcyAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMubGFuZ3VhZ2VfbmFtZXMgKSxcbiAgICAgICAgICAgICAgICBvcmRlcmVkU2Vjb25kYXJ5TGFuZ3VhZ2VzIDogSlNPTi5wYXJzZSggdGhpcy5vcmRlcmVkX3NlY29uZGFyeV9sYW5ndWFnZXMgKSxcbiAgICAgICAgICAgICAgICByb2xlcyAgICAgICAgICAgICAgICAgICAgIDogSlNPTi5wYXJzZSggdGhpcy52aWV3X2FzX3JvbGVzICksXG4gICAgICAgICAgICAgICAgbm9uY2VzICAgICAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMuZWRpdG9yX25vbmNlcyksXG4gICAgICAgICAgICAgICAgc3RyaW5nR3JvdXBPcmRlciAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMuc3RyaW5nX2dyb3VwX29yZGVyKSxcbiAgICAgICAgICAgICAgICBzZWxlY3RvcnMgICAgICAgICAgICAgICAgIDogSlNPTi5wYXJzZSggdGhpcy5zdHJpbmdfc2VsZWN0b3JzICksXG4gICAgICAgICAgICAgICAgZGF0YUF0dHJpYnV0ZXMgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMuZGF0YV9hdHRyaWJ1dGVzICksXG4gICAgICAgICAgICAgICAgbWVyZ2VSdWxlcyAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoIHRoaXMubWVyZ2VfcnVsZXMgKSxcbiAgICAgICAgICAgICAgICBlZGl0b3JTdHJpbmdzICAgICAgICAgICAgIDogdHJwX2xvY2FsaXplZF9zdHJpbmdzLFxuICAgICAgICAgICAgICAgIGZsYWdzUGF0aCAgICAgICAgICAgICAgICAgOiBKU09OLnBhcnNlKCB0aGlzLmZsYWdzX3BhdGggKSxcbiAgICAgICAgICAgICAgICAvL2RhdGFcbiAgICAgICAgICAgICAgICBjdXJyZW50TGFuZ3VhZ2UgICAgICAgICAgIDogdGhpcy5jdXJyZW50X2xhbmd1YWdlLFxuICAgICAgICAgICAgICAgIG9uU2NyZWVuTGFuZ3VhZ2UgICAgICAgICAgOiB0aGlzLm9uX3NjcmVlbl9sYW5ndWFnZSxcbiAgICAgICAgICAgICAgICBjdXJyZW50VVJMICAgICAgICAgICAgICAgIDogdGhpcy51cmxfdG9fbG9hZCxcbiAgICAgICAgICAgICAgICB1cmxUb0xvYWQgICAgICAgICAgICAgICAgIDogdGhpcy51cmxfdG9fbG9hZCxcbiAgICAgICAgICAgICAgICBpZnJhbWUgICAgICAgICAgICAgICAgICAgIDogJycsXG4gICAgICAgICAgICAgICAgZGljdGlvbmFyeSAgICAgICAgICAgICAgICA6IFtdLFxuICAgICAgICAgICAgICAgIHNlbGVjdGVkU3RyaW5nICAgICAgICAgICAgOiBudWxsLFxuICAgICAgICAgICAgICAgIHNlbGVjdGVkSW5kZXhlc0FycmF5ICAgICAgOiBbXSxcbiAgICAgICAgICAgICAgICBkZXRlY3RlZFNlbGVjdG9yQW5kSWQgICAgIDogW10sXG4gICAgICAgICAgICAgICAgc3RyaW5nR3JvdXBzICAgICAgICAgICAgICA6IFtdLFxuICAgICAgICAgICAgICAgIG1lcmdpbmdTdHJpbmcgICAgICAgICAgICAgOiBmYWxzZSxcbiAgICAgICAgICAgICAgICBtZXJnZURhdGEgICAgICAgICAgICAgICAgIDogW10sXG4gICAgICAgICAgICAgICAgc2hvd0NoYW5nZXNVbnNhdmVkTWVzc2FnZSA6IGZhbHNlLFxuICAgICAgICAgICAgICAgIHZpZXdBcyAgICAgICAgICAgICAgICAgICAgOiAnJyxcbiAgICAgICAgICAgICAgICBsb2FkaW5nX3N0cmluZ3MgICAgICAgICAgIDogMCxcbiAgICAgICAgICAgICAgICB0cmFuc2xhdGlvbk5vdExvYWRlZFlldCAgIDogZmFsc2UsXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGNyZWF0ZWQoKXtcbiAgICAgICAgICAgIHRoaXMuc2V0dGluZ3NbJ2RlZmF1bHQtbGFuZ3VhZ2UtbmFtZSddID0gdGhpcy5sYW5ndWFnZU5hbWVzWyB0aGlzLnNldHRpbmdzWydkZWZhdWx0LWxhbmd1YWdlJ10gXVxuXG4gICAgICAgICAgICAvL3NldCBkZWZhdWx0IHZhbHVlIGZvciB0aGUgVmlldyBBcyBzZWxlY3RcbiAgICAgICAgICAgIGxldCBwYXJhbXMgPSB1dGlscy5nZXRVcmxQYXJhb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0cnBfc2VsZWN0Ml9vdmVybGF5JyApLmhpZGUoKVxuICAgICAgICAgICAgfSkub24oICdzZWxlY3QyOm9wZW5pbmcnLCBmdW5jdGlvbihlKSB7XG4gICAgICAgICAgICAgICAgLyogd2hlbiB3ZSBoYXZlIHVuc2F2ZWQgY2hhbmdlcyBwcmV2ZW50IHRoZSBzdHJpbmdzIGRyb3Bkb3duIGZyb20gb3BlbmluZyBzbyB3ZSBkbyBub3QgaGF2ZSBhIGRpc2Nvbm5lY3QgYmV0d2VlbiB0aGUgdGV4dGFyZWFzIGFuZCB0aGUgZHJvcGRvd24gKi9cbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5oYXNVbnNhdmVkQ2hhbmdlcygpKSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIC8vIHJlc2l6ZSBzaWRlYmFyIGFuZCBjb25zZXF1ZW50bHkgdGhlIGlmcmFtZVxuICAgICAgICAgICAgbGV0IHByZXZpZXdDb250YWluZXIgPSBqUXVlcnkoICcjdHJwLXByZXZpZXcnICk7XG4gICAgICAgICAgICBsZXQgdG90YWxfd2lkdGggPSBqUXVlcnkod2luZG93KS53aWR0aCgpO1xuICAgICAgICAgICAgalF1ZXJ5KCAnI3RycC1jb250cm9scycgKS5yZXNpemFibGUoe1xuICAgICAgICAgICAgICAgIHN0YXJ0OiBmdW5jdGlvbiggKSB7IHByZXZpZXdDb250YWluZXIudG9nZ2xlKCk7IH0sXG4gICAgICAgICAgICAgICAgc3RvcDogZnVuY3Rpb24oICkgeyBwcmV2aWV3Q29udGFpbmVyLnRvZ2dsZSgpOyB9LFxuICAgICAgICAgICAgICAgIGhhbmRsZXM6ICdlJyxcbiAgICAgICAgICAgICAgICBtaW5XaWR0aDogMjg1LFxuICAgICAgICAgICAgICAgIG1heFdpZHRoOiB0b3RhbF93aWR0aCAtIDIwXG4gICAgICAgICAgICB9KS5iaW5kKCBcInJlc2l6ZVwiLCB0aGlzLnJlc2l6ZUlmcmFtZSApO1xuXG4gICAgICAgICAgICAvLyByZXNpemUgaWZyYW1lIHdoZW4gcmVzaXppbmcgd2luZG93XG4gICAgICAgICAgICBqUXVlcnkoIHdpbmRvdyApLnJlc2l6ZShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5yZXNpemVJZnJhbWUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICB3YXRjaDoge1xuICAgICAgICAgICAgY3VycmVudExhbmd1YWdlOiBmdW5jdGlvbiggY3VycmVudExhbmd1YWdlICkge1xuICAgICAgICAgICAgICAgIGxldCBzZWxmID0gdGhpc1xuICAgICAgICAgICAgICAgIC8vZ3JhYiB0aGUgY29ycmVjdCBVUkwgZnJvbSB0aGUgaUZyYW1lXG4gICAgICAgICAgICAgICAgbGV0IG5ld1VSTCA9IHRoaXMuaWZyYW1lLnF1ZXJ5U2VsZWN0b3IoICdsaW5rW2hyZWZsYW5nPVwiJyArIGN1cnJlbnRMYW5ndWFnZS5yZXBsYWNlKCAnXycsICctJyApICsnXCJdJyApLmdldEF0dHJpYnV0ZSgnaHJlZicpXG5cbiAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRVUkwgICAgICAgICAgID0gbmV3VVJMXG4gICAgICAgICAgICAgICAgdGhpcy5pZnJhbWUubG9jYXRpb24gICAgICA9IG5ld1VSTFxuXG4gICAgICAgICAgICAgICAgLy9yZXNldCB2dWUgcHJvcHNcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdGVkU3RyaW5nICAgICAgID0gJydcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdGVkSW5kZXhlc0FycmF5ID0gW11cblxuICAgICAgICAgICAgICAgIC8vc2V0IHN0cmluZ3MgZHJvcGRvd24gdG8gbG9hZGluZyBzdGF0ZVxuICAgICAgICAgICAgICAgIGpRdWVyeSgnI3RycC1zdHJpbmctY2F0ZWdvcmllcycpLnZhbCgnJykudHJpZ2dlcignY2hhbmdlJylcbiAgICAgICAgICAgICAgICB0aGlzLnN0cmluZ3NEcm9wZG93bkxvYWRpbmcoKVxuXG4gICAgICAgICAgICAgICAgdGhpcy5vblNjcmVlbkxhbmd1YWdlID0gY3VycmVudExhbmd1YWdlXG4gICAgICAgICAgICAgICAgaWYoIHRoaXMuc2V0dGluZ3NbJ2RlZmF1bHQtbGFuZ3VhZ2UnXSA9PSB0aGlzLmN1cnJlbnRMYW5ndWFnZSAmJiB0aGlzLnNldHRpbmdzWyd0cmFuc2xhdGlvbi1sYW5ndWFnZXMnXS5sZW5ndGggPiAxICl7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0dGluZ3NbJ3RyYW5zbGF0aW9uLWxhbmd1YWdlcyddLnNvbWUoZnVuY3Rpb24obGFuZ3VhZ2Upe1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBsYW5ndWFnZSAhPSBzZWxmLnNldHRpbmdzWydkZWZhdWx0LWxhbmd1YWdlJ10gKXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdGhlIGZpcnN0IGxhbmd1YWdlIG5vdCBkZWZhdWx0XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5vblNjcmVlbkxhbmd1YWdlID0gbGFuZ3VhZ2VcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBjdXJyZW50VVJMOiBmdW5jdGlvbiAoIG5ld1VybCwgb2xkVXJsICkge1xuICAgICAgICAgICAgICAgIHdpbmRvdy5oaXN0b3J5LnJlcGxhY2VTdGF0ZSggbnVsbCwgbnVsbCwgdGhpcy5wYXJlbnRVUkwoIG5ld1VybCApIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB2aWV3QXM6IGZ1bmN0aW9uKCByb2xlICkge1xuICAgICAgICAgICAgICAgIGlmKCAhdGhpcy5jdXJyZW50VVJMIHx8ICF0aGlzLmlmcmFtZSApXG4gICAgICAgICAgICAgICAgICAgIHJldHVyblxuXG4gICAgICAgICAgICAgICAgbGV0IHVybCA9IHRoaXMuY2xlYW5VUkwoIHRoaXMuY3VycmVudFVSTCApXG5cbiAgICAgICAgICAgICAgICB1cmwgPSB1dGlscy51cGRhdGVVcmxQYXJhbWV0ZXIoIHVybCwgJ3RycC1lZGl0LXRyYW5zbGF0aW9uJywgJ3ByZXZpZXcnIClcblxuICAgICAgICAgICAgICAgIGlmKCByb2xlID09ICdjdXJyZW50X3VzZXInICkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmlmcmFtZS5sb2NhdGlvbiA9IHVybFxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAvL2lmIG5vbmNlIG5vdCBhdmFpbGFibGUsIGFuIHVwZGF0ZSB0byB0aGUgQnJvd3NlIGFzIE90aGVyIFJvbGVzIGFkZC1vbiBpcyByZXF1aXJlZFxuICAgICAgICAgICAgICAgIGlmKCAhdGhpcy5ub25jZXNbcm9sZV0gKSB7XG4gICAgICAgICAgICAgICAgICAgIGFsZXJ0KCB0aGlzLmVkaXRvclN0cmluZ3MuYm9yX3VwZGF0ZV9ub3RpY2UgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB1cmwgPSB1dGlscy51cGRhdGVVcmxQYXJhbWV0ZXIoIHVybCwgJ3RycC12aWV3LWFzJywgcm9sZSApXG4gICAgICAgICAgICAgICAgdXJsID0gdXRpbHMudXBkYXRlVXJsUGFyYW1ldGVyKCB1cmwsICd0cnAtdmlldy1hcy1ub25jZScsIHRoaXMubm9uY2VzW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mFsaWQgY3VycmVudCBub2RlLCBzbyB3ZSBqdXN0IGFkZCB0aGUgZmFrZSBpZFxuICAgICAgICAgICAgICAgIGlmKCBjdXJyZW50Tm9kZSApIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IHNlbGYgPSB0aGlzXG4gICAgICAgICAgICAgICAgICAgIGxldCBzZWxlY3RvcnMgPSBzZWxmLmdldEFsbFNlbGVjdG9ycygpXG4gICAgICAgICAgICAgICAgICAgIGxldCBub2RlcyA9IFtdXG5cbiAgICAgICAgICAgICAgICAgICAgbm9kZXMucHVzaCggY3VycmVudE5vZGUgKVxuXG4gICAgICAgICAgICAgICAgICAgIGlmICggY3VycmVudE5vZGUudGFnTmFtZSAhPSBcIkFcIiApe1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaW5jbHVkZSB0aGUgYW5jaG9yJ3MgdHJhbnNsYXRhYmxlIGF0dHJpYnV0ZXNcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhbmNob3JQYXJlbnQgID0gY3VycmVudE5vZGUuY2xvc2VzdCgnYScpXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiggIGFuY2hvclBhcmVudCAhPSBudWxsICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVzLnB1c2goYW5jaG9yUGFyZW50KVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCBjdXJyZW50Tm9kZS50YWdOYW1lID09IFwiQVwiICYmIGN1cnJlbnROb2RlLmNoaWxkcmVuLmxlbmd0aCA+IDAgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGluY2x1ZGUgYWxsIHRoZSB0cmFuc2xhdGFibGUgYXR0cmlidXRlcyBpbnNpZGUgdGhlIGFuY2hvclxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNoaWxkcmVuQXJyYXkgPSBbIC4uLmN1cnJlbnROb2RlLmNoaWxkcmVuIF07XG4gICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbkFycmF5LmZvckVhY2goIGZ1bmN0aW9uICggY2hpbGQgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZXMucHVzaChjaGlsZClcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIG5vZGVzLmZvckVhY2goIGZ1bmN0aW9uKCBub2RlICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3JzLmZvckVhY2goZnVuY3Rpb24gKHNlbGVjdG9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHN0cmluZ0lkID0gbm9kZS5nZXRBdHRyaWJ1dGUoc2VsZWN0b3IpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0cmluZ0lkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmb3VuZCA9IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciggaSA9IDA7IGkgPCBzZWxlY3RlZEluZGV4ZXNBcnJheS5sZW5ndGg7IGkrKyApe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCB0eXBlb2Ygc2VsZi5kaWN0aW9uYXJ5W3NlbGVjdGVkSW5kZXhlc0FycmF5W2ldXSAhPT0gJ3VuZGVmaW5lZCcgJiYgc2VsZi5kaWN0aW9uYXJ5W3NlbGVjdGVkSW5kZXhlc0FycmF5W2ldXS5kYklEICE9PSAndW5kZWZpbmVkJyAmJiBzZWxmLmRpY3Rpb25hcnlbc2VsZWN0ZWRJbmRleGVzQXJyYXlbaV1dLmRiSUQgPT09IHN0cmluZ0lkICl7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCAhIGZvdW5kICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWRJbmRleGVzQXJyYXkucHVzaChzZWxmLmdldFN0cmluZ0luZGV4KHNlbGVjdG9yLCBzdHJpbmdJZCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH0gZWxzZVxuICAgICAgICAgICAgICAgICAgICBzZWxlY3RlZEluZGV4ZXNBcnJheS5wdXNoKCBzZWxlY3RlZFN0cmluZ0FycmF5SW5kZXggKVxuXG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZEluZGV4ZXNBcnJheSA9IHNlbGVjdGVkSW5kZXhlc0FycmF5XG4gICAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgICBjb21wdXRlZDoge1xuICAgICAgICAgICAgY2xvc2VVUkw6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsZWFuVVJMKCB0aGlzLmN1cnJlbnRVUkwgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBtZXRob2RzOiB7XG4gICAgICAgICAgICBpRnJhbWVMb2FkZWQoKXtcbiAgICAgICAgICAgICAgICBsZXQgc2VsZiA9IHRoaXNcbiAgICAgICAgICAgICAgICBsZXQgaWZyYW1lRWxlbWVudCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyN0cnAtcHJldmlldy1pZnJhbWUnKVxuXG4gICAgICAgICAgICAgICAgdGhpcy5pZnJhbWUgPSBpZnJhbWVFbGVtZW50LmNvbnRlbnREb2N1bWVudCB8fCBpZnJhbWVFbGVtZW50LmNvbnRlbnRXaW5kb3cuZG9jdW1lbnRcblxuICAgICAgICAgICAgICAgIC8vc3luYyBpRnJhbWUgVVJMIHdpdGggcGFyZW50XG4gICAgICAgICAgICAgICAgaWYgKCB0aGlzLmN1cnJlbnRVUkwgIT0gdGhpcy5pZnJhbWUuVVJMIClcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50VVJMID0gdGhpcy5pZnJhbWUuVVJMXG5cbiAgICAgICAgICAgICAgICAvL2hpZGUgaUZyYW1lIGxvYWRlclxuICAgICAgICAgICAgICAgIHRoaXMuaWZyYW1lTG9hZGVyKCAnaGlkZScgKVxuXG4gICAgICAgICAgICAgICAgc2VsZi5kZXRlY3RlZFNlbGVjdG9yQW5kSWQgPSBbXVxuICAgICAgICAgICAgICAgIHNlbGYuZGljdGlvbmFyeSAgICAgICAgICAgID0gW11cbiAgICAgICAgICAgICAgICB0aGlzLnNjYW5JZnJhbWVGb3JTdHJpbmdzKClcblxuICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCAndHJwX2lmcmFtZV9wYWdlX3VwZGF0ZWQnLCB0aGlzLnNjYW5JZnJhbWVGb3JTdHJpbmdzIClcblxuICAgICAgICAgICAgICAgIC8vZXZlbnQgdGhhdCBpcyBmaXJlZCB3aGVuIHRoZSBpRnJhbWUgaXMgbmF2aWdhdGVkXG4gICAgICAgICAgICAgICAgaWZyYW1lRWxlbWVudC5jb250ZW50V2luZG93Lm9uYmVmb3JldW5sb2FkID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuaWZyYW1lTG9hZGVyKCAnc2hvdycgKVxuXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2VsZWN0ZWRTdHJpbmcgPSBudWxsXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuc2VsZWN0ZWRJbmRleGVzQXJyYXkgPSBbXVxuICAgICAgICAgICAgICAgICAgICBzZWxmLnRyYW5zbGF0aW9uTm90TG9hZGVkWWV0ID0gZmFsc2VcblxuICAgICAgICAgICAgICAgICAgICBzZWxmLnN0cmluZ3NEcm9wZG93bkxvYWRpbmcoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHNjYW5JZnJhbWVGb3JTdHJpbmdzKCl7XG4gICAgICAgICAgICAgICAgdGhpcy5zY2FuRm9yU2VsZWN0b3IoICdkYXRhLXRycC10cmFuc2xhdGUtaWQnLCAncmVndWxhcicsIHRoaXMub25TY3JlZW5MYW5ndWFnZSApXG4gICAgICAgICAgICAgICAgdGhpcy5zY2FuRm9yU2VsZWN0b3IoICdkYXRhLXRycGdldHRleHRvcmlnaW5hbCcsICdnZXR0ZXh0JywgdGhpcy5jdXJyZW50TGFuZ3VhZ2UgKVxuICAgICAgICAgICAgICAgIHRoaXMuc2NhbkZvclNlbGVjdG9yKCAnZGF0YS10cnAtcG9zdC1zbHVnJywgJ3Bvc3RzbHVnJywgdGhpcy5jdXJyZW50TGFuZ3VhZ2UgKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHNjYW5Gb3JTZWxlY3RvciggYmFzZVNlbGVjdG9yLCB0eXBlU2x1ZywgbGFuZ3VhZ2VPZklkcyApe1xuICAgICAgICAgICAgICAgIHRoaXMubG9hZGluZ19zdHJpbmdzKytcbiAgICAgICAgICAgICAgICBsZXQgc2VsZiAgICAgICAgICAgPSB0aGlzXG4gICAgICAgICAgICAgICAgbGV0IHNlbGVjdG9ycyAgICAgID0gdGhpcy5wcmVwYXJlU2VsZWN0b3JTdHJpbmdzKCBiYXNlU2VsZWN0b3IgKVxuICAgICAgICAgICAgICAgIGxldCBub2RlcyAgICAgICAgICA9IFsuLi50aGlzLmlmcmFtZS5xdWVyeVNlbGVjdG9yQWxsKCAnWycgKyBzZWxlY3RvcnMuam9pbignXSxbJykgKyAnXScgKV1cbiAgICAgICAgICAgICAgICBsZXQgc3RyaW5nSWRzQXJyYXkgPSBbXSwgbm9kZURhdGEgPSBbXSwgbm9kZUVudHJpZXMgPSBbXVxuXG4gICAgICAgICAgICAgICAgbm9kZXMuZm9yRWFjaCggZnVuY3Rpb24gKCBub2RlICl7XG4gICAgICAgICAgICAgICAgICAgIG5vZGVFbnRyaWVzID0gc2VsZi5nZXROb2RlSW5mbyggbm9kZSwgYmFzZVNlbGVjdG9yIClcblxuICAgICAgICAgICAgICAgICAgICBub2RlRW50cmllcy5mb3JFYWNoKCBmdW5jdGlvbiggZW50cnkgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIGNoZWNrIGVuc3VyZXMgdGhhdCB3ZSBkb24ndCBjcmVhdGUgZHVwbGljYXRlcyB3aGVuIHJlc2Nhbm5pbmcgYWZ0ZXIgYWpheCBjb21wbGV0ZVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCAhc2VsZi5hbHJlYWR5RGV0ZWN0ZWQoIGVudHJ5LnNlbGVjdG9yLCBlbnRyeS5kYklEICkgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nSWRzQXJyYXkucHVzaChlbnRyeS5kYklEKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVEYXRhLnB1c2goZW50cnkpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgc2VsZi5zZXR1cEV2ZW50TGlzdGVuZXIoIG5vZGUgKVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAvL3VuaXF1ZSBpZHMgb25seVxuICAgICAgICAgICAgICAgIHN0cmluZ0lkc0FycmF5ID0gWy4uLm5ldyBTZXQoc3RyaW5nSWRzQXJyYXkpXVxuICAgICAgICAgICAgICAgIGlmICggc3RyaW5nSWRzQXJyYXkubGVuZ3RoID4gMCApIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBuZXcgRm9ybURhdGEoKVxuICAgICAgICAgICAgICAgICAgICBkYXRhLmFwcGVuZCgnYWN0aW9uJyAgICAgICAsICd0cnBfZ2V0X3RyYW5zbGF0aW9uc18nICsgdHlwZVNsdWcpXG4gICAgICAgICAgICAgICAgICAgIGRhdGEuYXBwZW5kKCdhbGxfbGFuZ3VhZ2VzJywgJ3RydWUnKVxuICAgICAgICAgICAgICAgICAgICBkYXRhLmFwcGVuZCgnc2VjdXJpdHknICAgICAsIHRoaXMubm9uY2VzWydnZXR0cmFuc2xhdGlvbnNub25jZScgKyB0eXBlU2x1Z10pXG4gICAgICAgICAgICAgICAgICAgIGRhdGEuYXBwZW5kKCdsYW5ndWFnZScgICAgICwgbGFuZ3VhZ2VPZklkcylcbiAgICAgICAgICAgICAgICAgICAgZGF0YS5hcHBlbmQoJ3N0cmluZ19pZHMnICAgLCBKU09OLnN0cmluZ2lmeShzdHJpbmdJZHNBcnJheSkpXG5cbiAgICAgICAgICAgICAgICAgICAgYXhpb3MucG9zdCh0aGlzLmFqYXhfdXJsLCBkYXRhKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5sb2FkaW5nX3N0cmluZ3MtLVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWRkVG9EaWN0aW9uYXJ5KHJlc3BvbnNlLmRhdGEsIG5vZGVEYXRhKVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaChmdW5jdGlvbiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvcik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5sb2FkaW5nX3N0cmluZ3MtLVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGFscmVhZHlEZXRlY3RlZCggc2VsZWN0b3IsIGRiSWQgKXtcbiAgICAgICAgICAgICAgICBsZXQgY29tYmluZWQgPSBzZWxlY3RvciArICc9JyArIGRiSWRcbiAgICAgICAgICAgICAgICBpZiAoIHV0aWxzLmFycmF5Q29udGFpbnNJdGVtKCB0aGlzLmRldGVjdGVkU2VsZWN0b3JBbmRJZCwgY29tYmluZWQgKSApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgICAgICAgICB9ZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGV0ZWN0ZWRTZWxlY3RvckFuZElkLnB1c2goY29tYmluZWQpXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBzZXR1cEV2ZW50TGlzdGVuZXIoIG5vZGUgKXtcbiAgICAgICAgICAgICAgICBpZiAoIG5vZGUudGFnTmFtZSA9PSAnQScgJiYgIW5vZGUuaGFzQXR0cmlidXRlKCAnZGF0YS10cnBnZXR0ZXh0b3JpZ2luYWwnICkgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcblxuICAgICAgICAgICAgICAgIGxldCBzZWxmID0gdGhpc1xuXG4gICAgICAgICAgICAgICAgbm9kZS5hZGRFdmVudExpc3RlbmVyKCAnbW91c2VlbnRlcicsIHNlbGYuJHJlZnMuaG92ZXJBY3Rpb25zLnNob3dQZW5jaWxJY29uIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBhZGRUb0RpY3Rpb25hcnkoIHJlc3BvbnNlRGF0YSwgbm9kZUluZm8gPSBudWxsICl7XG4gICAgICAgICAgICAgICAgbGV0IHNlbGYgPSB0aGlzXG5cbiAgICAgICAgICAgICAgICBpZiAoIHJlc3BvbnNlRGF0YSAhPSBudWxsICkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIG5vZGVJbmZvICl7XG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlSW5mby5mb3JFYWNoKGZ1bmN0aW9uICggaW5mb1JvdywgaW5kZXggKXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZURhdGEuc29tZSggZnVuY3Rpb24gKCByZXNwb25zZURhdGFSb3cgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBpbmZvUm93LmRiSUQgPT0gcmVzcG9uc2VEYXRhUm93LmRiSUQgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2JyaW5nIGJsb2NrX3R5cGUgdG8gdGhlIHRvcCBsZXZlbCBvYmplY3RcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggcmVzcG9uc2VEYXRhUm93LnR5cGUgIT0gJ2dldHRleHQnICYmIHR5cGVvZiByZXNwb25zZURhdGFSb3cuYmxvY2tfdHlwZSA9PSAndW5kZWZpbmVkJyApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZmlyc3RMYW5ndWFnZSA9IHNlbGYub3JkZXJlZFNlY29uZGFyeUxhbmd1YWdlc1swXVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCB0eXBlb2YgcmVzcG9uc2VEYXRhUm93LnRyYW5zbGF0aW9uc0FycmF5W2ZpcnN0TGFuZ3VhZ2VdLmJsb2NrX3R5cGUgIT0gJ3VuZGVmaW5lZCcgKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZURhdGFSb3cuYmxvY2tfdHlwZSA9IHJlc3BvbnNlRGF0YVJvdy50cmFuc2xhdGlvbnNBcnJheVtmaXJzdExhbmd1YWdlXS5ibG9ja190eXBlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVJbmZvW2luZGV4XSA9IE9iamVjdC5hc3NpZ24oIHt9LCByZXNwb25zZURhdGFSb3csIGluZm9Sb3cgKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWUgLy8gYSBzb3J0IG9mIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlSW5mbyA9IHJlc3BvbnNlRGF0YVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHJpbmdHcm91cHMgPSB0aGlzLmFkZFRvU3RyaW5nR3JvdXBzKCBub2RlSW5mbyApXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGljdGlvbmFyeSA9IHRoaXMuZGljdGlvbmFyeS5jb25jYXQoIG5vZGVJbmZvIClcblxuICAgICAgICAgICAgICAgICAgICB0aGlzLmluaXRTdHJpbmdzRHJvcGRvd24oKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBhZGRUb1N0cmluZ0dyb3Vwcyggc3RyaW5ncyApe1xuXG4gICAgICAgICAgICAgICAgLy8gc2VlIHdoYXQgbm9kZSBncm91cHMgYXJlIGZvdW5kXG4gICAgICAgICAgICAgICAgbGV0IGZvdW5kU3RyaW5nR3JvdXBzID0gdGhpcy5zdHJpbmdHcm91cHM7XG4gICAgICAgICAgICAgICAgc3RyaW5ncy5mb3JFYWNoKCBmdW5jdGlvbiAoIHN0cmluZyApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBmb3VuZFN0cmluZ0dyb3Vwcy5pbmRleE9mKCBzdHJpbmcuZ3JvdXAgKSA9PT0gLTEgJiYgKCAoIHR5cGVvZiBzdHJpbmcuYmxvY2tUeXBlID09PSAndW5kZWZpbmVkJyApIHx8IHN0cmluZy5ibG9ja1R5cGUgIT09ICcyJyApICl7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3VuZFN0cmluZ0dyb3Vwcy5wdXNoKCBzdHJpbmcuZ3JvdXAgKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIC8vIHB1dCB0aGUgbm9kZSBncm91cHMgaW4gdGhlIG9yZGVyIHRoYXQgd2Ugd2FudCwgYWNjb3JkaW5nIHRvIHRoZSBwcm9wIHRoaXMuc3RyaW5nR3JvdXBPcmRlclxuICAgICAgICAgICAgICAgIGxldCBvcmRlcmVkU3RyaW5nR3JvdXBzID0gW107XG5cbiAgICAgICAgICAgICAgICBpZiAoIHRoaXMuZWRpdG9yU3RyaW5ncy5zZW9fdXBkYXRlX25vdGljZSAhPSAnc2VvX3BhY2tfdXBkYXRlX25vdF9uZWVkZWQnICl7XG4gICAgICAgICAgICAgICAgICAgIG9yZGVyZWRTdHJpbmdHcm91cHMucHVzaCggdGhpcy5lZGl0b3JTdHJpbmdzLnNlb191cGRhdGVfbm90aWNlICk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGhpcy5zdHJpbmdHcm91cE9yZGVyLmZvckVhY2goIGZ1bmN0aW9uKCBncm91cCApe1xuICAgICAgICAgICAgICAgICAgICBpZiAoIGZvdW5kU3RyaW5nR3JvdXBzLmluZGV4T2YoIGdyb3VwICkgIT09IC0xICl7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcmRlcmVkU3RyaW5nR3JvdXBzLnB1c2goIGdyb3VwIClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAvLyBpZiB0aGVyZSB3ZXJlIGFueSBvdGhlciBzdHJpbmcgZ3JvdXBzIHRoYXQgd2VyZSBub3QgaW4gdGhlIHByb3AsIGFkZCB0aGVtIGF0IHRoZSBlbmQuXG4gICAgICAgICAgICAgICAgZm91bmRTdHJpbmdHcm91cHMuZm9yRWFjaCggZnVuY3Rpb24gKGdyb3VwKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICggb3JkZXJlZFN0cmluZ0dyb3Vwcy5pbmRleE9mKCBncm91cCApID09PSAtMSApe1xuICAgICAgICAgICAgICAgICAgICAgICAgb3JkZXJlZFN0cmluZ0dyb3Vwcy5wdXNoKGdyb3VwKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gb3JkZXJlZFN0cmluZ0dyb3VwcztcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBnZXRTdHJpbmdJbmRleCggc2VsZWN0b3IsIGRiSUQgKXtcbiAgICAgICAgICAgICAgICBsZXQgZm91bmQgPSBudWxsXG5cbiAgICAgICAgICAgICAgICB0aGlzLmRpY3Rpb25hcnkuc29tZShmdW5jdGlvbiAoIHN0cmluZywgaW5kZXggKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICggc3RyaW5nLmRiSUQgPT0gZGJJRCAmJiBzdHJpbmcuc2VsZWN0b3IgPT0gc2VsZWN0b3IgKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kID0gaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZvdW5kXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZ2V0Tm9kZUluZm8oIG5vZGUsIGJhc2VTZWxlY3RvciA9ICcnICl7XG4gICAgICAgICAgICAgICAgbGV0IHN0cmluZ0lkXG4gICAgICAgICAgICAgICAgbGV0IG5vZGVEYXRhICA9IFtdXG4gICAgICAgICAgICAgICAgbGV0IHNlbGVjdG9ycyA9IHRoaXMucHJlcGFyZVNlbGVjdG9yU3RyaW5ncyggYmFzZVNlbGVjdG9yIClcblxuICAgICAgICAgICAgICAgIHNlbGVjdG9ycy5mb3JFYWNoKCBmdW5jdGlvbiAoIHNlbGVjdG9yICkge1xuXG4gICAgICAgICAgICAgICAgICAgIHN0cmluZ0lkID0gbm9kZS5nZXRBdHRyaWJ1dGUoIHNlbGVjdG9yIClcblxuICAgICAgICAgICAgICAgICAgICBpZiAoIHN0cmluZ0lkICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbm9kZUF0dHJpYnV0ZSAgID0gc2VsZWN0b3IucmVwbGFjZSggYmFzZVNlbGVjdG9yLCAnJyApXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbm9kZUdyb3VwICAgICAgID0gbm9kZS5nZXRBdHRyaWJ1dGUoICdkYXRhLXRycC1ub2RlLWdyb3VwJyArIG5vZGVBdHRyaWJ1dGUgKVxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5vZGVEZXNjcmlwdGlvbiA9IG5vZGUuZ2V0QXR0cmlidXRlKCAnZGF0YS10cnAtbm9kZS1kZXNjcmlwdGlvbicgKyBub2RlQXR0cmlidXRlIClcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGVudHJ5ID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiSUQgICAgICA6IHN0cmluZ0lkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9yICA6IHNlbGVjdG9yLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZSA6IG5vZGVBdHRyaWJ1dGUuc3Vic3RyKDEpLCAvLyBzdWJzdHIoMSkgaXMgdXNlZCB0byB0cmltIHByZWZpeGluZyBsaW5lIC0gZXguIC1hbHQgd2lsbCByZXN1bHQgaW4gYWx0IChubyBsaW5lKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIG5vZGVHcm91cCApXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW50cnkuZ3JvdXAgPSBub2RlR3JvdXBcblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBub2RlRGVzY3JpcHRpb24gKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5LmRlc2NyaXB0aW9uID0gbm9kZURlc2NyaXB0aW9uXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVEYXRhLnB1c2goIGVudHJ5IClcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHJldHVybiBub2RlRGF0YVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdldEFsbFNlbGVjdG9ycygpe1xuICAgICAgICAgICAgICAgIGxldCBzZWxlY3RvcnMgPSBbXVxuICAgICAgICAgICAgICAgIGxldCBzZWxmICAgICAgPSB0aGlzXG5cbiAgICAgICAgICAgICAgICB0aGlzLmRhdGFBdHRyaWJ1dGVzLmZvckVhY2goIGZ1bmN0aW9uICggZGF0YUF0dHJpYnV0ZSApe1xuICAgICAgICAgICAgICAgICAgICBzZWxlY3RvcnMgPSBzZWxlY3RvcnMuY29uY2F0KCBzZWxmLnByZXBhcmVTZWxlY3RvclN0cmluZ3MoIGRhdGFBdHRyaWJ1dGUgKSApXG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIHJldHVybiBzZWxlY3RvcnNcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBwcmVwYXJlU2VsZWN0b3JTdHJpbmdzKCBiYXNlTmFtZVNlbGVjdG9yICl7XG4gICAgICAgICAgICAgIC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IHVybCwgJ3RycC1lZGl0LXRyYW5zbGF0aW9uJyApXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdXJsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgc2hvd1N0cmluZyggc3RyaW5nLCB0eXBlICl7XG4gICAgICAgICAgICAgICAgaWYgKCB0eXBlb2Ygc3RyaW5nLmJsb2NrVHlwZSAhPT0gJ3VuZGVmaW5lZCcgJiYgc3RyaW5nLmJsb2NrVHlwZSA9PT0gJzInICl7XG4gICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IHNob3cgZGVwcmVjYXRlZCB0cmFuc2xhdGlvbiBibG9ja3MgaW4gdGhlIGRyb3Bkb3duXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIHR5cGUgPT09IHRoaXMuZWRpdG9yU3RyaW5ncy5pbWFnZXMgJiYgdHlwZW9mIHN0cmluZy5hdHRyaWJ1dGUgIT0gJ3VuZGVmaW5lZCcgJiYgc3RyaW5nLmF0dHJpYnV0ZSA9PSAnc3JjJyApXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG5cbiAgICAgICAgICAgICAgICBpZiAoIHR5cGVvZiBzdHJpbmcuYXR0cmlidXRlICE9PSAndW5kZWZpbmVkJyAmJiAoIHN0cmluZy5hdHRyaWJ1dGUgPT0gJ2hyZWYnIHx8IHN0cmluZy5hdHRyaWJ1dGUgPT0gJ3NyYycgKSApXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuXG4gICAgICAgICAgICAgICAgaWYgKCBzdHJpbmcuZ3JvdXAgPT09IHR5cGUgKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaW5pdFN0cmluZ3NEcm9wZG93bigpe1xuICAgICAgICAg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G4gICAgICAgICAgICBzdHJpbmdzRHJvcGRvd25Mb2FkaW5nKCl7XG4gICAgICAgICAgICAgICAgalF1ZXJ5KCAnI3RycC1zdHJpbmctY2F0ZWdvcmllcycgKS5zZWxlY3QyKCB7IHBsYWNlaG9sZGVyIDogdGhpcy5lZGl0b3JTdHJpbmdzLnN0cmluZ3NfbG9hZGluZywgd2lkdGggOiAnMTAwJScgfSApLnByb3AoICdkaXNhYmxlZCcsIHRydWUgKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHByb2Nlc3NPcHRpb25OYW1lKCBuYW1lLCB0eXBlICl7XG4gICAgICAgICAgICAgICAgaWYgKCB0eXBlID09ICdJbWFnZXMnIClcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHV0aWxzLmdldEZpbGVuYW1lKCBuYW1lIClcblxuICAgICAgICAgICAgICAgIHJldHVybiB1dGlscy5lc2NhcGVIdG1sKCBuYW1lIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBpc1N0cmluZ3NEcm9wZG93bk9wZW4oKXtcbiAgICAgICAgICAgICAgICByZXR1cm4galF1ZXJ5KCAnI3RycC1zdHJpbmctY2F0ZWdvcmllcycgKS5zZWxlY3QyKCAnaXNPcGVuJyApXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaGFzVW5zYXZlZENoYW5nZXMoKXtcbiAgICAgICAgICAgICAgICBsZXQgdW5zYXZlZENoYW5nZXMgPSBmYWxzZVxuICAgICAgICAgICAgICAgIGxldCBzZWxmID0gdGhpc1xuICAgICAgICAgICAgICAgIGlmICggdGhpcy5zZWxlY3RlZEluZGV4ZXNBcnJheS5sZW5ndGggPiAwICkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdGVkSW5kZXhlc0FycmF5LmZvckVhY2goZnVuY3Rpb24gKHNlbGVjdGVkSW5kZXgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dGluZ3NbJ3RyYW5zbGF0aW9uLWxhbmd1YWdlcyddLmZvckVhY2goZnVuY3Rpb24gKGxhbmd1YWdlQ29kZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmRpY3Rpb25hcnlbc2VsZWN0ZWRJbmRleF0gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5kaWN0aW9uYXJ5W3NlbGVjdGVkSW5kZXhdLnRyYW5zbGF0aW9uc0FycmF5W2xhbmd1YWdlQ29kZV0gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNlbGYuZGljdGlvbmFyeVtzZWxlY3RlZEluZGV4XS50cmFuc2xhdGlvbnNBcnJheVtsYW5ndWFnZUNvZGVdLnRyYW5zbGF0ZWQgIT09IHNlbGYuZGljdGlvbmFyeVtzZWxlY3RlZEluZGV4XS50cmFuc2xhdGlvbnNBcnJheVtsYW5ndWFnZUNvZGVdLmVkaXRlZFRyYW5zbGF0aW9uKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNhdmVkQ2hhbmdlcyA9IHRydWVcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLnNob3dDaGFuZ2VzVW5zYXZlZE1lc3NhZ2UgPSB1bnNhdmVkQ2hhbmdlc1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVuc2F2ZWRDaGFuZ2VzXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaWZyYW1lTG9hZGVyKCBzdGF0dXMgKSB7XG4gICAgICAgICAgICAgICAgbGV0IGxvYWRlciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCAndHJwLXByZXZpZXctbG9hZGVyJyApXG5cbiAgICAgICAgICAgICAgICBpZiggc3RhdHVzID09ICdzaG93JyApXG4gICAgICAgICAgICAgICAgICAgIGxvYWRlci5zdHlsZS5kaXNwbGF5ID0gJ2ZsZXgnXG4gICAgICAgICAgICAgICAgZWxzZSBpZiggc3RhdHVzID09ICdoaWRlJyApXG4gICAgICAgICAgICAgICAgICAgIGxvYWRlci5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcHJldmlvdXNTdHJpbmcoKXtcbiAgICAgICAgICAgICAgICBsZXQgY3VycmVudFZhbHVlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3RycC1zdHJpbmctY2F0ZWdvcmllcycpLnZhbHVlXG5cbiAgICAgICAgICAgICAgICBsZXQgbmV3VmFsdWUgPSArY3VycmVudFZhbHVlIC0gMVxuXG4gICAgICAgICAgICAgICAgd2hpbGUoIG5ld1ZhbHVlID49IDAgJiYgZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgnI3RycC1zdHJpbmctY2F0ZWdvcmllcyBvcHRpb25bdmFsdWU9XCInICsgbmV3VmFsdWUgKyAnXCJdJykubGVuZ3RoID09PSAwICl7XG4gICAgICAgICAgICAgICAgICAgIG5ld1ZhbHVlLS07XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYoIG5ld1ZhbHVlIDwgMCApXG4gICAgICAgICAgICAgICAgICAgIHJldHVyblxuXG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZFN0cmluZyA9IG5ld1ZhbHVlLnRvU3RyaW5nKClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBuZXh0U3RyaW5nKCl7XG4gICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd0cnAtc3RyaW5nLWNhdGVnb3JpZXMnKS52YWx1ZSwgbmV3VmFsdWUgPSAwXG5cbiAgICAgICAgICAgICAgICBpZiggY3VycmVudFZhbHVlICE9ICcnIClcbiAgICAgICAgICAgICAgICAgICAgbmV3VmFsdWUgPSArY3VycmVudFZhbHVlICsgMVxuXG4gICAgICAgICAgICAgICAgd2hpbGUoIG5ld1ZhbHVlIDwgdGhpcy5kaWN0aW9uYXJ5Lmxlbmd0aCAmJiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCcjdHJwLXN0cmluZy1jYXRlZ29yaWVzIG9wdGlvblt2YWx1ZT1cIicgKyBuZXdWYWx1ZSArICdcIl0nKS5sZW5ndGggPT09IDAgKXtcbiAgICAgICAgICAgICAgICAgICAgbmV3VmFsdWUrKztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIG5ld1ZhbHVlID49IHRoaXMuZGljdGlvbmFyeS5sZW5ndGggKXtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZFN0cmluZyA9IG5ld1ZhbHVlLnRvU3RyaW5nKClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBhZGRLZXlib2FyZFNob3J0Y3V0c0xpc3RlbmVyKCl7XG4gICAgICAgICAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcihcImtleWRvd25cIiwgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoKHdpbmRvdy5uYXZpZ2F0b3IucGxhdGZvcm0ubWF0Y2goXCJNYWNcIikgPyBlLm1ldGFLZXkgOiBlLmN0cmxLZXkpICYmIGUuYWx0S2V5ICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ1RSTCArIEFMVCArIHJpZ2h0IGFycm93XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiggZS5rZXlDb2RlID09PSAzOSApe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuZGlzcGF0Y2hFdmVudCggbmV3IEV2ZW50KCAndHJwX3RyaWdnZXJfbmV4dF9zdHJpbmdfZXZlbnQnICkgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENUUkwgKyBBTFQgKyBsZWZ0IGFycm93XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoIGUua2V5Q29kZSA9PT0gMzcgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmRpc3BhdGNoRXZlbnQoIG5ldyBFdmVudCggJ3RycF90cmlnZ2VyX3ByZXZpb3VzX3N0cmluZ19ldmVudCcgKSApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcblxuICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCAndHJwX3RyaWdnZXJfbmV4dF9zdHJpbmdfZXZlbnQnLCB0aGlzLm5leHRTdHJpbmcgKVxuICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCAndHJwX3RyaWdnZXJfcHJldmlvdXNfc3RyaW5nX2V2ZW50JywgdGhpcy5wcmV2aW91c1N0cmluZyApXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcmVzaXplSWZyYW1lIChldmVudCwgdWkpIHtcbiAgICAgICAgICAgICAgICBsZXQgdG90YWxfd2lkdGggPSBqUXVlcnkod2luZG93KS53aWR0aCgpO1xuICAgICAgICAgICAgICAgIGxldCB3aWR0aCA9IGpRdWVyeSggJyN0cnAtY29udHJvbHMnICkud2lkdGgoKTtcblxuICAgICAgICAgICAgICAgIGxldCBwcmV2aWV3Q29udGFpbmVyID0galF1ZXJ5KCAnI3RycC1wcmV2aWV3JyApO1xuICAgICAgICAgICAgICAgIHByZXZpZXdDb250YWluZXIuY3NzKCdyaWdodCcsIHdpZHRoICk7XG4gICAgICAgICAgICAgICAgcHJldmlld0NvbnRhaW5lci5jc3MoJ2xlZnQnLCAoIHdpZHRoIC0gMzQ4ICkgKTtcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGFpbmVyLmNzcygnd2lkdGgnLCAodG90YWxfd2lkdGggLSB3aWR0aCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAvL2FkZCBzdXBwb3J0IGZvciB2LW1vZGVsIGluIHNlbGVjdDJcbiAgICAgICAgZGlyZWN0aXZlczoge1xuICAgICAgICAgICAgc2VsZWN0Mjoge1xuICAgICAgICAgICAgICAgIGluc2VydGVkKGVsKSB7XG4gICAgICAgICAgICAgICAgICAgIGpRdWVyeShlbCkub24oJ3NlbGVjdDI6c2VsZWN0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXZlbnQgPSBuZXcgRXZlbnQoJ2NoYW5nZScsIHsgYnViYmxlczogdHJ1ZSwgY2FuY2VsYWJsZTogdHJ1ZSB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgZWwuZGlzcGF0Y2hFdmVudChldmVudClcbiAgICAgICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgICAgICBqUXVlcnkoZWwpLm9uKCdzZWxlY3QyOnVuc2VsZWN0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXZlbnQgPSBuZXcgRXZlbnQoJ2NoYW5nZScsIHsgYnViYmxlczogdHJ1ZSwgY2FuY2VsYWJsZTogdHJ1ZSB9KVxuICAgICAgICAgICAgICAgICAgICAgICAgZWwuZGlzcGF0Y2hFdmVudChldmVudClcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuPC9zY3JpcHQ+XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./assets/src/js/editor.vue?vue&type=script&lang=js&\n");
766
 
767
  /***/ }),
768
 
class-translate-press.php CHANGED
@@ -53,7 +53,7 @@ class TRP_Translate_Press{
53
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
54
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
55
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
56
- define( 'TRP_PLUGIN_VERSION', '1.6.9' );
57
 
58
  wp_cache_add_non_persistent_groups(array('trp'));
59
 
53
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
54
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
55
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
56
+ define( 'TRP_PLUGIN_VERSION', '1.7.0' );
57
 
58
  wp_cache_add_non_persistent_groups(array('trp'));
59
 
includes/class-query.php CHANGED
@@ -333,7 +333,7 @@ class TRP_Query{
333
  /*
334
  * select all string that are in the dictionary table and are not in the original tables and insert them in the original
335
  */
336
- $insert_records = $this->db->query( $this->db->prepare( "INSERT INTO `$originals_table` (original) SELECT DISTINCT ( BINARY t1.original ) FROM `$table_name` t1 LEFT JOIN `$originals_table` t2 on t2.original = BINARY t1.original WHERE t2.original IS NULL AND t1.id > %d AND t1.id <= %d AND LENGTH(t1.original) < 20000", $inferior_limit, ($inferior_limit + $batch_size) ) );
337
 
338
  if (!empty($this->db->last_error)) {
339
  $this->error_manager->record_error(array('last_error_insert_original_strings' => $this->db->last_error));
@@ -354,7 +354,12 @@ class TRP_Query{
354
  }
355
 
356
  $originals_table = $this->get_table_name_for_original_strings();
357
- $this->db->query( "DELETE t1 FROM `$originals_table` t1 INNER JOIN `$originals_table` t2 WHERE t1.id > t2.id AND t1.original = BINARY t2.original" );
 
 
 
 
 
358
 
359
  if (!empty($this->db->last_error)) {
360
  $this->error_manager->record_error(array('last_error_cleaning_original_strings' => $this->db->last_error));
@@ -378,11 +383,15 @@ class TRP_Query{
378
 
379
  $originals_table = $this->get_table_name_for_original_strings();
380
  $table_name = sanitize_text_field( $this->get_table_name( $language_code, $this->settings['default-language'] ) );
 
 
 
 
381
 
382
  /*
383
  * perform a UPDATE JOIN with the original table https://www.mysqltutorial.org/mysql-update-join/
384
  */
385
- $update_records = $this->db->query( $this->db->prepare( "UPDATE $table_name, $originals_table SET $table_name.original_id = $originals_table.id WHERE $table_name.original = BINARY $originals_table.original AND $table_name.id > %d AND $table_name.id <= %d", $inferior_limit, ($inferior_limit + $batch_size) ) );
386
 
387
  if (!empty($this->db->last_error)) {
388
  $this->error_manager->record_error(array('last_error_reindex_original_ids' => $this->db->last_error));
333
  /*
334
  * select all string that are in the dictionary table and are not in the original tables and insert them in the original
335
  */
336
+ $insert_records = $this->db->query( $this->db->prepare( "INSERT INTO `$originals_table` (original) SELECT DISTINCT ( BINARY t1.original ) FROM `$table_name` t1 LEFT JOIN `$originals_table` t2 ON ( t2.original = t1.original AND t2.original = BINARY t1.original ) WHERE t2.original IS NULL AND t1.id > %d AND t1.id <= %d AND LENGTH(t1.original) < 20000", $inferior_limit, ($inferior_limit + $batch_size) ) );
337
 
338
  if (!empty($this->db->last_error)) {
339
  $this->error_manager->record_error(array('last_error_insert_original_strings' => $this->db->last_error));
354
  }
355
 
356
  $originals_table = $this->get_table_name_for_original_strings();
357
+ $charset_collate = $this->db->get_charset_collate();
358
+ $charset = "utf8mb4";
359
+ if( strpos( 'latin1', $charset_collate ) === 0 )
360
+ $charset = "latin1";
361
+
362
+ $this->db->query( "DELETE t1 FROM `$originals_table` t1 INNER JOIN `$originals_table` t2 WHERE t1.id > t2.id AND t1.original COLLATE ".$charset."_bin = t2.original" );
363
 
364
  if (!empty($this->db->last_error)) {
365
  $this->error_manager->record_error(array('last_error_cleaning_original_strings' => $this->db->last_error));
383
 
384
  $originals_table = $this->get_table_name_for_original_strings();
385
  $table_name = sanitize_text_field( $this->get_table_name( $language_code, $this->settings['default-language'] ) );
386
+ $charset_collate = $this->db->get_charset_collate();
387
+ $charset = "utf8mb4";
388
+ if( strpos( 'latin1', $charset_collate ) === 0 )
389
+ $charset = "latin1";
390
 
391
  /*
392
  * perform a UPDATE JOIN with the original table https://www.mysqltutorial.org/mysql-update-join/
393
  */
394
+ $update_records = $this->db->query( $this->db->prepare( "UPDATE $table_name, $originals_table SET $table_name.original_id = $originals_table.id WHERE $table_name.original COLLATE ". $charset ."_bin = $originals_table.original AND $table_name.id > %d AND $table_name.id <= %d", $inferior_limit, ($inferior_limit + $batch_size) ) );
395
 
396
  if (!empty($this->db->last_error)) {
397
  $this->error_manager->record_error(array('last_error_reindex_original_ids' => $this->db->last_error));
includes/class-translation-manager.php CHANGED
@@ -395,8 +395,8 @@ class TRP_Translation_Manager{
395
  $this->is_admin_request = $this->url_converter->is_admin_request();
396
  }
397
 
398
- // Do not process gettext strings on wp-login pages. Do not process strings in admin area except for when when is_ajax_on_frontend. Do not process gettext strings when is rest api from admin url referer.
399
- if( ( $pagenow != 'wp-login.php' ) && ( !is_admin() || $this::is_ajax_on_frontend() ) && !$this->is_admin_request ) {
400
  add_filter('gettext', array($this, $prefix.'process_gettext_strings'), 100, 3);
401
  add_filter('gettext_with_context', array($this, $prefix.'process_gettext_strings_with_context'), 100, 4);
402
  add_filter('ngettext', array($this, $prefix.'process_ngettext_strings'), 100, 5);
395
  $this->is_admin_request = $this->url_converter->is_admin_request();
396
  }
397
 
398
+ // Do not process gettext strings on wp-login pages. Do not process strings in admin area except for when when is_ajax_on_frontend. Do not process gettext strings when is rest api from admin url referer. Do not process gettext on xmlrpc.pho
399
+ if( ( $pagenow != 'wp-login.php' ) && ( !is_admin() || $this::is_ajax_on_frontend() ) && !$this->is_admin_request && $pagenow != 'xmlrpc.php' ) {
400
  add_filter('gettext', array($this, $prefix.'process_gettext_strings'), 100, 3);
401
  add_filter('gettext_with_context', array($this, $prefix.'process_gettext_strings_with_context'), 100, 4);
402
  add_filter('ngettext', array($this, $prefix.'process_ngettext_strings'), 100, 5);
includes/class-translation-memory.php CHANGED
@@ -23,12 +23,11 @@ class TRP_Translation_Memory {
23
  *
24
  *
25
  * @param string $string The original string we're searching a similar one.
26
- * @param string $language_code The language in which we want to search for the similar translated string.
27
  * @param string $table_name The table where we should look for similar strings in. Default dictionary.
28
  * @param int $number The number of similar strings we want to return.
29
  * @return array Array with (original => translated ) pairs based on the number of strings we should account for. Empty array if nothing is found.
30
  */
31
- public function get_similar_string_translation( $string, $language_code, $number, $table_name ){
32
  if( empty($table_name) ){
33
  return array();
34
  }
@@ -58,12 +57,12 @@ class TRP_Translation_Memory {
58
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
59
  if (isset($_POST['action']) && $_POST['action'] === 'trp_get_similar_string_translation' && !empty($_POST['original_string']) && !empty($_POST['language']) && !empty($_POST['selector']) && in_array($_POST['language'], $this->settings['translation-languages']) )
60
  {
 
61
  check_ajax_referer('getsimilarstring', 'security');
62
  $string = ( isset($_POST['original_string']) ) ? $_POST['original_string'] : '';
63
- $language_code = ( isset($_POST['language']) ) ? $_POST['language'] : TRP_LANGUAGE;
64
- $selector = ( isset($_POST['selector']) ) ? $_POST['selector'] : '';
65
- $number = ( isset($_POST['number']) ) ? $_POST['number'] : 3;
66
- $current_language = sanitize_text_field($_POST['language']);
67
 
68
  $trp = TRP_Translate_Press::get_trp_instance();
69
  if ( ! $this->trp_query ) {
@@ -73,16 +72,16 @@ class TRP_Translation_Memory {
73
  // data-trp-translate-id, data-trp-translate-id-innertext are in the wp_trp_dictionary_* tables
74
  $table_name = $this->trp_query->get_table_name( $language_code );
75
 
76
- if($selector === "data-trpgettextoriginal"){
77
  $table_name = $this->trp_query->get_gettext_table_name( $language_code );
78
  }
79
 
80
- $dictionary = $this->get_similar_string_translation($string, $language_code, $number, $table_name);
81
  echo json_encode($dictionary);
82
  wp_die();
83
  }
84
  }
85
- return json_encode(array());
86
  wp_die();
87
  }
88
  }
23
  *
24
  *
25
  * @param string $string The original string we're searching a similar one.
 
26
  * @param string $table_name The table where we should look for similar strings in. Default dictionary.
27
  * @param int $number The number of similar strings we want to return.
28
  * @return array Array with (original => translated ) pairs based on the number of strings we should account for. Empty array if nothing is found.
29
  */
30
+ public function get_similar_string_translation( $string, $number, $table_name ){
31
  if( empty($table_name) ){
32
  return array();
33
  }
57
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
58
  if (isset($_POST['action']) && $_POST['action'] === 'trp_get_similar_string_translation' && !empty($_POST['original_string']) && !empty($_POST['language']) && !empty($_POST['selector']) && in_array($_POST['language'], $this->settings['translation-languages']) )
59
  {
60
+ global $TRP_LANGUAGE;
61
  check_ajax_referer('getsimilarstring', 'security');
62
  $string = ( isset($_POST['original_string']) ) ? $_POST['original_string'] : '';
63
+ $language_code = ( isset($_POST['language']) ) ? $_POST['language'] : $TRP_LANGUAGE;
64
+ $selector = ( isset($_POST['selector']) ) ? sanitize_text_field( $_POST['selector'] ) : '';
65
+ $number = ( isset($_POST['number']) ) ? (int) $_POST['number'] : 3;
 
66
 
67
  $trp = TRP_Translate_Press::get_trp_instance();
68
  if ( ! $this->trp_query ) {
72
  // data-trp-translate-id, data-trp-translate-id-innertext are in the wp_trp_dictionary_* tables
73
  $table_name = $this->trp_query->get_table_name( $language_code );
74
 
75
+ if( strpos($selector, "data-trpgettextoriginal" ) !== false ){
76
  $table_name = $this->trp_query->get_gettext_table_name( $language_code );
77
  }
78
 
79
+ $dictionary = $this->get_similar_string_translation($string, $number, $table_name);
80
  echo json_encode($dictionary);
81
  wp_die();
82
  }
83
  }
84
+ echo json_encode(array());
85
  wp_die();
86
  }
87
  }
includes/class-translation-render.php CHANGED
@@ -180,6 +180,18 @@ class TRP_Translation_Render{
180
  'type' => 'page_title',
181
  'description' => __( 'Page Title', 'translatepress-multilingual' )
182
  ),
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  ));
185
 
@@ -336,6 +348,12 @@ class TRP_Translation_Render{
336
  }
337
  }
338
 
 
 
 
 
 
 
339
  global $TRP_LANGUAGE;
340
  $language_code = $this->force_language_in_preview();
341
  if ($language_code === false) {
180
  'type' => 'page_title',
181
  'description' => __( 'Page Title', 'translatepress-multilingual' )
182
  ),
183
+ array(
184
+ 'type' => 'meta_desc',
185
+ 'attribute' => 'name',
186
+ 'value' => 'DC.Title',
187
+ 'description' => __( 'Dublin Core Title', 'translatepress-multilingual' )
188
+ ),
189
+ array(
190
+ 'type' => 'meta_desc',
191
+ 'attribute' => 'name',
192
+ 'value' => 'DC.Description',
193
+ 'description' => __( 'Dublin Core Description', 'translatepress-multilingual' )
194
+ ),
195
 
196
  ));
197
 
348
  }
349
  }
350
 
351
+ /* don't do anything on xmlrpc.php */
352
+ if( strpos( $this->url_converter->cur_page_url(), 'xmlrpc.php' ) !== false ){
353
+ $trpremoved = $this->remove_trp_html_tags( $output );
354
+ return $trpremoved;
355
+ }
356
+
357
  global $TRP_LANGUAGE;
358
  $language_code = $this->force_language_in_preview();
359
  if ($language_code === false) {
includes/class-upgrade.php CHANGED
@@ -289,6 +289,7 @@ class TRP_Upgrade {
289
  }
290
  }else{
291
  $request['trp_updb_lang'] = $language_code;
 
292
  }
293
 
294
  $query_arguments = array(
289
  }
290
  }else{
291
  $request['trp_updb_lang'] = $language_code;
292
+ $request['progress_message'] = '.';
293
  }
294
 
295
  $query_arguments = array(
includes/class-url-converter.php CHANGED
@@ -174,9 +174,18 @@ class TRP_Url_Converter {
174
  */
175
 
176
  public function get_url_for_language ( $language = null, $url = null, $trp_link_is_processed = '#TRPLINKPROCESSED') {
177
- $debug = false;
178
- // initializations
179
- global $TRP_LANGUAGE;
 
 
 
 
 
 
 
 
 
180
  $hash = hash( 'md4', (string)$language . (string)$url . (string)$trp_link_is_processed . (string)$TRP_LANGUAGE );
181
  $new_url = wp_cache_get('get_url_for_language_' . $hash, 'trp');
182
  if ( $new_url !== false ){
@@ -188,10 +197,6 @@ class TRP_Url_Converter {
188
  $language = $TRP_LANGUAGE;
189
  }
190
 
191
- if ( empty($url) ){
192
- $url = $this->cur_page_url();
193
- }
194
-
195
  $url_obj = wp_cache_get('url_obj_' . hash('md4', $url), 'trp');
196
  if( $url_obj === false ){
197
  $url_obj = new \TranslatePress\Uri($url);
174
  */
175
 
176
  public function get_url_for_language ( $language = null, $url = null, $trp_link_is_processed = '#TRPLINKPROCESSED') {
177
+ $debug = false;
178
+ // initializations
179
+ global $TRP_LANGUAGE;
180
+
181
+ if ( empty($url) ){
182
+ $url = $this->cur_page_url();
183
+ }
184
+
185
+ if(apply_filters('trp_skip_url_for_language', false, $url)){
186
+ return (string)$url;
187
+ }
188
+
189
  $hash = hash( 'md4', (string)$language . (string)$url . (string)$trp_link_is_processed . (string)$TRP_LANGUAGE );
190
  $new_url = wp_cache_get('get_url_for_language_' . $hash, 'trp');
191
  if ( $new_url !== false ){
197
  $language = $TRP_LANGUAGE;
198
  }
199
 
 
 
 
 
200
  $url_obj = wp_cache_get('url_obj_' . hash('md4', $url), 'trp');
201
  if( $url_obj === false ){
202
  $url_obj = new \TranslatePress\Uri($url);
includes/compatibility-functions.php CHANGED
@@ -543,3 +543,15 @@ function trp_woo_fondy_payment_gateway_exclude_gettext_strings($translation, $te
543
  }
544
 
545
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  }
544
 
545
 
546
+ /**
547
+ * Compatibility with Elementor Popups Links
548
+ *
549
+ * The url is urlencoded so we add the language to it but we shouldn't.
550
+ *
551
+ */
552
+ add_filter('trp_skip_url_for_language', 'trp_skip_elementor_popup_action_from_url_converter', 10, 2);
553
+ function trp_skip_elementor_popup_action_from_url_converter($value, $url){
554
+ if(strpos($url, '%23elementor-action') !== false){
555
+ return true;
556
+ }
557
+ }
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
- Version: 1.6.9
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
+ Version: 1.7.0
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
languages/translatepress-multilingual.catalog.php CHANGED
@@ -2,7 +2,6 @@
2
  <?php __("Error! Duplicate URL slug values.", "translatepress-multilingual"); ?>
3
  <?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
4
  <?php __("All Languages", "translatepress-multilingual"); ?>
5
- <?php __("The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when submitting the sitemap to Google.", "translatepress-multilingual"); ?>
6
  <?php __("<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.", "translatepress-multilingual"); ?>
7
  <?php __("First by browser language, then IP address (recommended)", "translatepress-multilingual"); ?>
8
  <?php __("First by IP address, then by browser language", "translatepress-multilingual"); ?>
@@ -154,6 +153,8 @@
154
  <?php __("Twitter Title", "translatepress-multilingual"); ?>
155
  <?php __("Twitter Description", "translatepress-multilingual"); ?>
156
  <?php __("Page Title", "translatepress-multilingual"); ?>
 
 
157
  <?php __("Inserting original strings for language %s...", "translatepress-multilingual"); ?>
158
  <?php __("Cleaning original strings table for language %s...", "translatepress-multilingual"); ?>
159
  <?php __("Updating original string ids for language %s...", "translatepress-multilingual"); ?>
2
  <?php __("Error! Duplicate URL slug values.", "translatepress-multilingual"); ?>
3
  <?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
4
  <?php __("All Languages", "translatepress-multilingual"); ?>
 
5
  <?php __("<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.", "translatepress-multilingual"); ?>
6
  <?php __("First by browser language, then IP address (recommended)", "translatepress-multilingual"); ?>
7
  <?php __("First by IP address, then by browser language", "translatepress-multilingual"); ?>
153
  <?php __("Twitter Title", "translatepress-multilingual"); ?>
154
  <?php __("Twitter Description", "translatepress-multilingual"); ?>
155
  <?php __("Page Title", "translatepress-multilingual"); ?>
156
+ <?php __("Dublin Core Title", "translatepress-multilingual"); ?>
157
+ <?php __("Dublin Core Description", "translatepress-multilingual"); ?>
158
  <?php __("Inserting original strings for language %s...", "translatepress-multilingual"); ?>
159
  <?php __("Cleaning original strings table for language %s...", "translatepress-multilingual"); ?>
160
  <?php __("Updating original string ids for language %s...", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -25,10 +25,6 @@ msgstr ""
25
  msgid "All Languages"
26
  msgstr ""
27
 
28
- #: ../tp-add-on-seo-pack/class-seo-pack.php:145
29
- msgid "The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when submitting the sitemap to Google."
30
- msgstr ""
31
-
32
  #: ../translatepress/index.php:62
33
  msgid "<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version."
34
  msgstr ""
@@ -633,6 +629,14 @@ msgstr ""
633
  msgid "Page Title"
634
  msgstr ""
635
 
 
 
 
 
 
 
 
 
636
  #: ../translatepress/includes/class-upgrade.php:115
637
  msgid "Inserting original strings for language %s..."
638
  msgstr ""
@@ -669,7 +673,7 @@ msgstr ""
669
  msgid "Update aborted! Invalid nonce."
670
  msgstr ""
671
 
672
- #: ../translatepress/includes/class-upgrade.php:203, ../translatepress/includes/class-upgrade.php:308, ../translatepress/includes/class-upgrade.php:456, ../translatepress/includes/class-upgrade.php:461
673
  msgid "Back to TranslatePress Settings"
674
  msgstr ""
675
 
@@ -697,27 +701,27 @@ msgstr ""
697
  msgid " done."
698
  msgstr ""
699
 
700
- #: ../translatepress/includes/class-upgrade.php:456
701
  msgid "Done."
702
  msgstr ""
703
 
704
- #: ../translatepress/includes/class-upgrade.php:461
705
  msgid "Invalid nonce."
706
  msgstr ""
707
 
708
- #: ../translatepress/includes/class-upgrade.php:481
709
  msgid "Querying table <strong>%s</strong>"
710
  msgstr ""
711
 
712
- #: ../translatepress/includes/class-upgrade.php:511
713
  msgid "%s duplicates removed"
714
  msgstr ""
715
 
716
- #: ../translatepress/includes/class-upgrade.php:541
717
  msgid "If the page does not redirect automatically"
718
  msgstr ""
719
 
720
- #: ../translatepress/includes/class-upgrade.php:541
721
  msgid "click here"
722
  msgstr ""
723
 
25
  msgid "All Languages"
26
  msgstr ""
27
 
 
 
 
 
28
  #: ../translatepress/index.php:62
29
  msgid "<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version."
30
  msgstr ""
629
  msgid "Page Title"
630
  msgstr ""
631
 
632
+ #: ../translatepress/includes/class-translation-render.php:187
633
+ msgid "Dublin Core Title"
634
+ msgstr ""
635
+
636
+ #: ../translatepress/includes/class-translation-render.php:193
637
+ msgid "Dublin Core Description"
638
+ msgstr ""
639
+
640
  #: ../translatepress/includes/class-upgrade.php:115
641
  msgid "Inserting original strings for language %s..."
642
  msgstr ""
673
  msgid "Update aborted! Invalid nonce."
674
  msgstr ""
675
 
676
+ #: ../translatepress/includes/class-upgrade.php:203, ../translatepress/includes/class-upgrade.php:309, ../translatepress/includes/class-upgrade.php:457, ../translatepress/includes/class-upgrade.php:462
677
  msgid "Back to TranslatePress Settings"
678
  msgstr ""
679
 
701
  msgid " done."
702
  msgstr ""
703
 
704
+ #: ../translatepress/includes/class-upgrade.php:457
705
  msgid "Done."
706
  msgstr ""
707
 
708
+ #: ../translatepress/includes/class-upgrade.php:462
709
  msgid "Invalid nonce."
710
  msgstr ""
711
 
712
+ #: ../translatepress/includes/class-upgrade.php:482
713
  msgid "Querying table <strong>%s</strong>"
714
  msgstr ""
715
 
716
+ #: ../translatepress/includes/class-upgrade.php:512
717
  msgid "%s duplicates removed"
718
  msgstr ""
719
 
720
+ #: ../translatepress/includes/class-upgrade.php:542
721
  msgid "If the page does not redirect automatically"
722
  msgstr ""
723
 
724
+ #: ../translatepress/includes/class-upgrade.php:542
725
  msgid "click here"
726
  msgstr ""
727
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
3
  Donate link: https://www.translatepress.com/
4
  Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
5
  Requires at least: 3.1.0
6
- Tested up to: 5.3.2
7
  Requires PHP: 5.6.20
8
- Stable tag: 1.6.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -143,6 +143,14 @@ For more information please check out [TranslatePress - Multilingual plugin docu
143
 
144
 
145
  == Changelog ==
 
 
 
 
 
 
 
 
146
  = 1.6.9 =
147
  * Fixed a conflict with Contact Form 7 plugin
148
  * Fixed some broken html issues caused by a custom trp wrap. Some Revolution Slider plugin issues are fixed by this.
3
  Donate link: https://www.translatepress.com/
4
  Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
5
  Requires at least: 3.1.0
6
+ Tested up to: 5.4.0
7
  Requires PHP: 5.6.20
8
+ Stable tag: 1.7.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
143
 
144
 
145
  == Changelog ==
146
+ = 1.7.0 =
147
+ * Fixed compatibility issue with JetPack plugin in some cases
148
+ * Fixed JS undefined controls error for some setups
149
+ * Fixed translation memory not working properly for gettext in attributes
150
+ * Added support for Dublin Core meta-data
151
+ * Added support to ignore Elementor encoded url for popup action
152
+ * Improved queries for the database upgrade process
153
+
154
  = 1.6.9 =
155
  * Fixed a conflict with Contact Form 7 plugin
156
  * Fixed some broken html issues caused by a custom trp wrap. Some Revolution Slider plugin issues are fixed by this.