/* THIS IS A GENERATED/BUNDLED FILE BY ROLLUP if you want to view the source visit the plugins github repository */ 'use strict'; var obsidian = require('obsidian'); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } /* * Filename: multi-column-markdown/src/regionSettings.ts * Created Date: Tuesday, February 1st 2022, 12:23:53 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ var BorderOption; (function (BorderOption) { BorderOption[BorderOption["enabled"] = 0] = "enabled"; BorderOption[BorderOption["on"] = 1] = "on"; BorderOption[BorderOption["true"] = 2] = "true"; BorderOption[BorderOption["disabled"] = 3] = "disabled"; BorderOption[BorderOption["off"] = 4] = "off"; BorderOption[BorderOption["false"] = 5] = "false"; })(BorderOption || (BorderOption = {})); var ShadowOption; (function (ShadowOption) { ShadowOption[ShadowOption["enabled"] = 0] = "enabled"; ShadowOption[ShadowOption["on"] = 1] = "on"; ShadowOption[ShadowOption["true"] = 2] = "true"; ShadowOption[ShadowOption["disabled"] = 3] = "disabled"; ShadowOption[ShadowOption["off"] = 4] = "off"; ShadowOption[ShadowOption["false"] = 5] = "false"; })(ShadowOption || (ShadowOption = {})); var ColumnLayout; (function (ColumnLayout) { ColumnLayout[ColumnLayout["standard"] = 0] = "standard"; ColumnLayout[ColumnLayout["left"] = 1] = "left"; ColumnLayout[ColumnLayout["first"] = 2] = "first"; ColumnLayout[ColumnLayout["center"] = 3] = "center"; ColumnLayout[ColumnLayout["middle"] = 4] = "middle"; ColumnLayout[ColumnLayout["second"] = 5] = "second"; ColumnLayout[ColumnLayout["right"] = 6] = "right"; ColumnLayout[ColumnLayout["third"] = 7] = "third"; ColumnLayout[ColumnLayout["last"] = 8] = "last"; })(ColumnLayout || (ColumnLayout = {})); /* * File: multi-column-markdown/src/MultiColumnParser.ts * Created Date: Saturday, January 22nd 2022, 6:02:46 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ const START_REGEX_STRS = ["=== *start-multi-column", "=== *multi-column-start"]; const START_REGEX_ARR = []; for (let i = 0; i < START_REGEX_STRS.length; i++) { START_REGEX_ARR.push(new RegExp(START_REGEX_STRS[i])); } function findStartTag(text) { let found = false; let startPosition = -1; for (let i = 0; i < START_REGEX_ARR.length; i++) { if (START_REGEX_ARR[i].test(text)) { found = true; startPosition = text.search(START_REGEX_STRS[i]); break; } } return { found, startPosition }; } function containsStartTag(text) { return findStartTag(text).found; } function isStartTagWithID(text) { let startTagData = findStartTag(text); if (startTagData.found === true) { let key = getStartTagKey(text); if (key === null || key === "") { return { isStartTag: true, hasKey: false }; } return { isStartTag: true, hasKey: true }; } return { isStartTag: false, hasKey: false }; } const END_REGEX_STRS = ["=== *end-multi-column", "=== *multi-column-end"]; const END_REGEX_ARR = []; for (let i = 0; i < END_REGEX_STRS.length; i++) { END_REGEX_ARR.push(new RegExp(END_REGEX_STRS[i])); } function findEndTag(text) { let found = false; let startPosition = -1; for (let i = 0; i < END_REGEX_ARR.length; i++) { if (END_REGEX_ARR[i].test(text)) { found = true; startPosition = text.search(END_REGEX_STRS[i]); break; } } return { found, startPosition }; } function containsEndTag(text) { return findEndTag(text).found; } const COL_REGEX_STRS = ["=== *column-end *===", "=== *end-column *===", "=== *column-break *===", "=== *break-column *==="]; const COL_REGEX_ARR = []; for (let i = 0; i < COL_REGEX_STRS.length; i++) { COL_REGEX_ARR.push(new RegExp(COL_REGEX_STRS[i])); } function containsColEndTag(text) { let found = false; for (let i = 0; i < COL_REGEX_ARR.length; i++) { if (COL_REGEX_ARR[i].test(text)) { found = true; break; } } return found; } const COL_SETTINGS_REGEX_STRS = ["```settings", "```column-settings", "```multi-column-settings"]; const COL_SETTINGS_REGEX_ARR = []; for (let i = 0; i < COL_SETTINGS_REGEX_STRS.length; i++) { COL_SETTINGS_REGEX_ARR.push(new RegExp(COL_SETTINGS_REGEX_STRS[i])); } function containsColSettingsTag(text) { let found = false; for (let i = 0; i < COL_SETTINGS_REGEX_ARR.length; i++) { if (COL_SETTINGS_REGEX_ARR[i].test(text)) { found = true; break; } } return found; } function parseColumnSettings(settingsStr) { // Set the minimum number of columnds to 2. let numberOfColumns = 2; let columnLayout = ColumnLayout.standard; let borderDrawn = true; let shadowDrawn = true; let settingsLines = settingsStr.split("\n"); for (let i = 0; i < settingsLines.length; i++) { if (settingsLines[i].toLowerCase().replace(/\s/g, "").contains("numberofcolumns:")) { let userDefNumberOfCols = parseInt(settingsLines[i].split(":")[1]); if (Number.isNaN(userDefNumberOfCols) === false) { if (userDefNumberOfCols === 3) { numberOfColumns = 3; } else if (userDefNumberOfCols === 2) { numberOfColumns = 2; } } break; } } for (let i = 0; i < settingsLines.length; i++) { if (settingsLines[i].toLowerCase().replace(/\s/g, "").contains("largestcolumn:")) { let setting = settingsLines[i].split(":")[1].trimStart().trimEnd().toLowerCase(); let userDefLayout = ColumnLayout[setting]; if (userDefLayout !== undefined) { columnLayout = userDefLayout; } } } for (let i = 0; i < settingsLines.length; i++) { if (settingsLines[i].toLowerCase().replace(/\s/g, "").contains("border:")) { let setting = settingsLines[i].split(":")[1].trimStart().trimEnd().toLowerCase(); let isBorderDrawn = BorderOption[setting]; if (isBorderDrawn !== undefined) { switch (isBorderDrawn) { case (BorderOption.disabled): case (BorderOption.off): case (BorderOption.false): borderDrawn = false; break; } } } } for (let i = 0; i < settingsLines.length; i++) { if (settingsLines[i].toLowerCase().replace(/\s/g, "").contains("shadow:")) { let setting = settingsLines[i].split(":")[1].trimStart().trimEnd().toLowerCase(); let isShadowDrawn = ShadowOption[setting]; if (isShadowDrawn !== undefined) { switch (isShadowDrawn) { case (ShadowOption.disabled): case (ShadowOption.off): case (ShadowOption.false): shadowDrawn = false; break; } } } } let settings = { numberOfColumns, columnLayout, drawBorder: borderDrawn, drawShadow: shadowDrawn }; return settings; } function countStartTags(text) { let keys = []; let startTagData = findStartTag(text); while (startTagData.found) { // Slice off everything before the tag text = text.slice(startTagData.startPosition); /** * Get just the start tag line and then set text to everything just * after the start tag. */ let tag = text.split("\n")[0]; text = text.slice(1); // This moves the text 1 character so we dont match the same tag. // Parse out the key and append to the list. let key = getStartTagKey(tag); if (key === null) { key = ""; } keys.push(key); // Search again for another tag before looping. startTagData = findStartTag(text); } return { numberOfTags: keys.length, keys }; } /** * This function will filter a set of strings, returning all items starting * from the closest open start tag through the last item in the set. * * The function filters out all end tags to make sure that the start tag we * find is the proper start tag for the list sent. * @param linesAboveArray * @returns */ function getStartBlockAboveLine(linesAboveArray) { // Reduce the array down into a single string so that we can // easily RegEx over the string and find the indicies we're looking for. let linesAboveStr = linesAboveArray.reduce((prev, current) => { return prev + "\n" + current; }, ""); /* * First thing we need to do is check if there are any end tags in the * set of strings (which logically would close start tags and therefore * the start tag it closes is not what we want). If there are we want to * slowly narrow down our set of strings until the last end tag is * removed. This makes it easier to find the closest open start tag * in the data. */ let endTagSerachData = findEndTag(linesAboveStr); while (endTagSerachData.found === true) { // Get the index of where the first regex match in the // string is. then we slice from 0 to index off of the string // split it by newline, cut off the first line (which actually // contains the regex) then reduce back down to a single string. // // TODO: This could be simplified if we just slice the text after // the end tag instead of the begining. let indexOfRegex = endTagSerachData.startPosition; linesAboveArray = linesAboveStr.slice(indexOfRegex).split("\n").splice(1); linesAboveStr = linesAboveArray.reduce((prev, current) => { return prev + "\n" + current; }, ""); endTagSerachData = findEndTag(linesAboveStr); } /** * Now we have the set of lines after all other end tags. We now * need to check if there is still a start tag left in the data. If * there is no start tag then we want to return an empty array and empty * key. */ let startBlockKey = ""; let startTagSearchData = findStartTag(linesAboveStr); if (startTagSearchData.found === false) { return null; } else { /** * Now we know there is at least 1 start key left, however there * may be multiple start keys if the user is not closing their * blocks. We currently dont allow recusive splitting so we * want to get the last key in our remaining set. Same idea as * above. */ while (startTagSearchData.found === true) { // Get the index of where the first regex match in the // string is. then we slice from 0 to index off of the string // split it by newline, cut off the first line (which actually // contains the regex) then reduce back down to a single string. // // TODO: This could be simplified if we just slice the text after // the end tag instead of the begining. let startIndex = startTagSearchData.startPosition; linesAboveArray = linesAboveStr.slice(startIndex).split("\n"); let startTag = linesAboveArray[0]; let key = getStartTagKey(startTag); if (key !== null) { startBlockKey = key; } linesAboveArray = linesAboveArray.splice(1); linesAboveStr = linesAboveArray.reduce((prev, current) => { return prev + "\n" + current; }, ""); startTagSearchData = findStartTag(linesAboveStr); } } return { startBlockKey, linesAboveArray }; } function getStartTagKey(startTag) { let keySplit = startTag.split(":"); if (keySplit.length > 1) { return keySplit[1].replace(" ", ""); } return null; } /* * Filename: multi-column-markdown/src/utilities/utils.ts * Created Date: Tuesday, January 30th 2022, 4:02:19 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ function getUID(length = 10) { if (length > 10) { length = 10; } let UID = Math.random().toString(36).substring(2); UID = UID.slice(0, length); return UID; } /* * Filename: multi-column-markdown/src/domObject.ts * Created Date: Tuesday, February 1st 2022, 12:04:00 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ var DOMObjectTag; (function (DOMObjectTag) { DOMObjectTag[DOMObjectTag["none"] = 0] = "none"; DOMObjectTag[DOMObjectTag["startRegion"] = 1] = "startRegion"; DOMObjectTag[DOMObjectTag["regionSettings"] = 2] = "regionSettings"; DOMObjectTag[DOMObjectTag["columnBreak"] = 3] = "columnBreak"; DOMObjectTag[DOMObjectTag["endRegion"] = 4] = "endRegion"; })(DOMObjectTag || (DOMObjectTag = {})); class DOMObject { constructor(nodeKey, element, randomID = getUID(), tag = DOMObjectTag.none) { this.nodeKey = nodeKey; this.element = element; this.UID = randomID; this.tag = tag; } } class DOMRegionSettingsObject extends DOMObject { constructor(baseDOMObject, regionSettings) { super(baseDOMObject.nodeKey, baseDOMObject.element, baseDOMObject.UID, DOMObjectTag.regionSettings); this.regionSettings = regionSettings; } } /* * File: multi-column-markdown/src/domManager.ts * Created Date: Saturday, January 30th 2022, 3:16:32 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ class GlobalDOMManager { constructor() { this.managers = new Map(); } removeFileManagerCallback(key) { if (this.managers.has(key) === true) { this.managers.delete(key); } } getFileManager(key) { let fileManager = null; if (this.managers.has(key) === true) { fileManager = this.managers.get(key); } else { fileManager = createFileDOMManager(this, key); this.managers.set(key, fileManager); } return fileManager; } } function createFileDOMManager(parentManager, fileKey) { let regionMap = new Map(); let hasStartTag = false; function removeRegion(regionKey) { let regionManager = regionMap.get(regionKey); if (regionManager) { regionManager.displayOriginalElements(); } regionMap.delete(regionKey); if (regionMap.size === 0) { parentManager.removeFileManagerCallback(fileKey); } } function createRegionalManager(regionKey, errorElement, regionElement) { //TODO: Use the error element whenever there is an error. let regonalManager = createRegionalDomManager(this, regionKey, regionElement); regionMap.set(regionKey, regonalManager); return regonalManager; } function getRegionalManager(regionKey) { let regonalManager = null; if (regionMap.has(regionKey) === true) { regonalManager = regionMap.get(regionKey); } return regonalManager; } function setHasStartTag() { hasStartTag = true; } function getHasStartTag() { return hasStartTag; } function getNumberOfRegions() { return regionMap.size; } function checkKeyExists(checkKey) { return regionMap.has(checkKey); } return { regionMap: regionMap, hasStartTag: hasStartTag, createRegionalManager: createRegionalManager, getRegionalManager: getRegionalManager, removeRegion: removeRegion, setHasStartTag: setHasStartTag, getHasStartTag: getHasStartTag, getNumberOfRegions: getNumberOfRegions, checkKeyExists: checkKeyExists }; } function createRegionalDomManager(fileManager, regionKey, startRegionElement) { /** * We use a list and a map to help keep track of the objects. Requires * more memory but makes processing things a little cleaner and presumably * faster. * * Use the map to look up object by key and the list is used to track objects * in the order they are in the document. */ let domList = []; let domObjectMap = new Map(); let regionParent = startRegionElement; let regionSettings = []; function addObject(siblingsAbove, obj) { let addAtIndex = siblingsAbove.children.length; // console.log("Attempting to add:", obj, `at index: ${addAtIndex}`); domList.splice(addAtIndex, 0, obj); domObjectMap.set(obj.UID, obj); // /** // * Make a copy of the list to log, only because // * console log updates its references with updates in memory. // */ // let x = domList.slice(0); // console.log(x); return addAtIndex; } function removeObject(objectUID) { // /** // * Make a copy of the list to log // */ // let x = domList.slice(0); // console.log(x); // Get the object by key, remove it from the map and then // from the list. let obj = domObjectMap.get(objectUID); domObjectMap.delete(objectUID); if (domList.contains(obj)) { domList.remove(obj); } // If the object is a settings object we need to remove from the // settings list. if (obj.tag === DOMObjectTag.regionSettings) { let settingsObj = obj; if (regionSettings.contains(settingsObj)) { regionSettings.remove(settingsObj); } } if (domList.length === 0) { fileManager.removeRegion(regionKey); } // x = domList.slice(0); // console.log(x); } function updateElementTag(objectUID, newTag) { let obj = domObjectMap.get(objectUID); let index = domList.indexOf(obj); if (index !== -1) { domList[index].tag = newTag; } } function setElementToSettingsBlock(objectUID, settingsText) { let obj = domObjectMap.get(objectUID); let index = domList.indexOf(obj); if (index !== -1) { let settings = parseColumnSettings(settingsText); let regionSettingsObj = new DOMRegionSettingsObject(domList[index], settings); domObjectMap.set(regionSettingsObj.UID, regionSettingsObj); domList[index] = regionSettingsObj; regionSettings.push(regionSettingsObj); } } /** * Creates an object containing all necessary information for the region * to be rendered to the preview pane. * * @returns a MultiColumnRenderData object with the root DOM element, settings object, and * all child objects in the order they should be rendered. */ function getRegionRenderData() { // Set defaults before attempting to get settings. let settings = { numberOfColumns: 2, columnLayout: ColumnLayout.standard, drawBorder: true, drawShadow: true }; if (regionSettings.length > 0) { /** * Since we append settings onto the end of the array we want the last * item in the array as that would be the most recent settings we parsed. */ settings = regionSettings[regionSettings.length - 1].regionSettings; } return { parentRenderElement: regionParent, parentRenderSettings: settings, domObjects: domList }; } /** * This fuction is called when a start tag is removed from view meaning * our parent element storing the multi-column region is removed. It * removes the CSS class from all of the elements so they will be * re-rendered in the preview window. */ function displayOriginalElements() { for (let i = 0; i < domList.length; i++) { domList[i].element.removeClass("multiColumnDataHidden"); } for (let i = 0; i < regionSettings.length; i++) { regionSettings[i].element.removeClass("multiColumnDataHidden"); } } return { addObject: addObject, removeObject: removeObject, updateElementTag: updateElementTag, setElementToSettingsBlock: setElementToSettingsBlock, getRegionRenderData: getRegionRenderData, displayOriginalElements: displayOriginalElements }; } /* * File: multi-column-markdown/src/main.ts * Created Date: Tuesday, October 5th 2021, 1:09 pm * Author: Cameron Robinson * * Copyright (c) 2022 Cameron Robinson */ class MultiColumnMarkdown extends obsidian.Plugin { constructor() { // settings: SplitColumnMarkdownSettings; super(...arguments); this.globalManager = new GlobalDOMManager(); } onload() { return __awaiter(this, void 0, void 0, function* () { console.log("Loading multi-column markdown"); this.setupMarkdownPostProcessor(); //TODO: Set up this as a modal to set settings automatically this.addCommand({ id: `insert-multi-column-region`, name: `Insert Multi-Column Region`, editorCallback: (editor, view) => { try { editor.getDoc().replaceSelection(` === multi-column-start: ID_${getUID(4)} \`\`\`column-settings Number of Columns: 2 Largest Column: standard \`\`\` === end-column === === multi-column-end ${editor.getDoc().getSelection()}`); } catch (e) { new obsidian.Notice("Encountered an error inserting a multi-column region. Please try again later."); } } }); this.addCommand({ id: `add-IDs-To-multi-column-region`, name: `Fix Missing IDs for Multi-Column Regions`, editorCallback: (editor, view) => { try { /** * Not sure if there is an easier way to do this. * * Get all of the lines of the document split by newlines. */ let lines = editor.getRange({ line: 0, ch: 0 }, { line: editor.getDoc().lineCount(), ch: 0 }).split("\n"); /** * Loop through all of the lines checking if the line is a * start tag and if so is it missing an ID. */ let linesWithoutIDs = []; let textWithoutIDs = []; for (let i = 0; i < lines.length; i++) { let data = isStartTagWithID(lines[i]); if (data.isStartTag === true && data.hasKey === false) { linesWithoutIDs.push(i); textWithoutIDs.push(lines[i]); } } if (linesWithoutIDs.length === 0) { new obsidian.Notice("Found 0 missing IDs in the current document."); return; } /** * Now loop through each line that is missing an ID and * generate a random ID and replace the original text. */ for (let i = 0; i < linesWithoutIDs.length; i++) { let originalText = textWithoutIDs[i]; let text = originalText; text = text.trimEnd(); if (text.charAt(text.length - 1) === ":") { text = text.slice(0, text.length - 1); } text = `${text}: ID_${getUID(4)}`; editor.replaceRange(text, { line: linesWithoutIDs[i], ch: 0 }, { line: linesWithoutIDs[i], ch: originalText.length }); } new obsidian.Notice(`Replaced ${linesWithoutIDs.length} missing ID(s) in the current document.`); } catch (e) { new obsidian.Notice("Encountered an error addign IDs to multi-column regions. Please try again later."); } } }); }); } setupMarkdownPostProcessor() { this.registerMarkdownPostProcessor((el, ctx) => __awaiter(this, void 0, void 0, function* () { // Get the info for our current context and then check // if the entire text contains a start tag. If there is // no start tag in the document we can just return and // ignore the rest of the parsing. let info = ctx.getSectionInfo(el); /** * We need the context info to properly parse so returning here * info is null. TODO: Set error in view if this occurs. */ if (!info) { return; } const sourcePath = ctx.sourcePath; let fileDOMManager = this.globalManager.getFileManager(sourcePath); if (fileDOMManager === null) { console.log("Found null DOM manager. Could not process multi-column markdown."); return; } /** * If we encounter a start tag on the document we set the flag to start * parsing the rest of the document. */ if (containsStartTag(el.textContent)) { fileDOMManager.setHasStartTag(); } /** * If the document does not contain any start tags we ignore the * rest of the parsing. This is only set to true once the first * start tag element is parsed above. */ if (fileDOMManager.getHasStartTag() === false) { return; } /** * Take the info provided and generate the required variables from * the line start and end values. */ let linesOfElement = info.text.split("\n").splice(info.lineStart, (info.lineEnd + 1 - info.lineStart)); let elementTextSpaced = linesOfElement.reduce((prev, curr) => { return prev + "\n" + curr; }); let elementText = linesOfElement.reduce((prev, curr) => { // TODO: This can probably be removed as it is only used to identify DOMObjects. return prev + curr; }); /** * If the current line is a start tag we want to set up the * region manager. The regional manager takes care * of all items between it's start and end tags while the * file manager we got above above takes care of all regional * managers in each file. */ if (containsStartTag(el.textContent)) { /** * Set up the current element to act as the parent for the * multi-column region. */ el.id = `TwoColumnContainer-${getUID()}`; el.children[0].detach(); el.classList.add("multiColumnContainer"); let renderErrorRegion = el.createDiv({ cls: `multiColumnErrorMessage`, }); let renderColumnRegion = el.createDiv({ cls: `RenderColRegion` }); let startBlockData = getStartBlockAboveLine(linesOfElement); let regionKey = startBlockData.startBlockKey; if (fileDOMManager.checkKeyExists(regionKey) === true) { let { numberOfTags, keys } = countStartTags(info.text); let index = 0; for (; index < numberOfTags; index++) { // Because we checked if key exists one of these has to match. if (keys[index] === regionKey) { break; } } if (keys[index] === "") { renderErrorRegion.innerText = "Found multiple regions with empty IDs. Please set a unique ID after each start tag.\nEG: '=== multi-column-start: randomID'\nOr use 'Fix Missing IDs' in the command palette and reload the document."; } else { renderErrorRegion.innerText = "Region ID already exists in document, please set a unique ID.\nEG: '=== multi-column-start: randomID'"; } return; } let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(el); fileDOMManager.createRegionalManager(regionKey, renderErrorRegion, renderColumnRegion); elementMarkdownRenderer.onunload = () => { if (fileDOMManager) { fileDOMManager.removeRegion(startBlockData.startBlockKey); } }; ctx.addChild(elementMarkdownRenderer); /** * Now we have created our regional manager and defined what elements * need to be rendered into. So we can return without any more processing. */ return; } /** * Get a list of all of the lines above our current element. * We will use this to determine if the element is within a block so * we can otherwise ignore the element and keep compute time down. */ let linesAboveArray = info.text.split("\n").slice(0, info.lineStart); linesAboveArray.reduce((prev, curr) => { return prev + "\n" + curr; }, ""); /** * A line above us contains a start tag now see if we're within that * block. */ let startBockAbove = getStartBlockAboveLine(linesAboveArray); if (startBockAbove == null) { return; } /** * Here we now know we're within a regional block. */ // Now we only want to work with the lines within the current region. linesAboveArray = startBockAbove.linesAboveArray; let regionalManager = fileDOMManager.getRegionalManager(startBockAbove.startBlockKey); /** * If we can not get the start block and this region's dom manager * we can not continue something has gone wrong. */ if (regionalManager === null) { return; } /** * Now we take the lines above our current element up until the * start region tag and render that into an HTML element. We will * use this element to determine where to place our current element. */ let siblingsAbove = findSiblingsAboveEl(linesAboveArray, sourcePath); /** * Set up our dom object to be added to the manager. */ let currentObject = new DOMObject(elementText, el); /** * Now we add the object to the manager and then setup the * callback for when the object is removed from view that will remove * the item from the manager. */ regionalManager.addObject(siblingsAbove, currentObject); let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(el); elementMarkdownRenderer.onunload = () => { if (regionalManager) { // We can attempt to update the view here after the item is removed // but need to get the item's parent element before removing object from manager. let regionRenderData = regionalManager.getRegionRenderData(); regionalManager.removeObject(currentObject.UID); /** * Need to check here if element is null as this closure will be called * repeatedly on file change. */ if (regionRenderData.parentRenderElement === null) { return; } this.renderColumnMarkdown(regionRenderData.parentRenderElement, regionRenderData.domObjects, regionRenderData.parentRenderSettings); } }; ctx.addChild(elementMarkdownRenderer); /** * Now we check if our current element is a special flag so we can * properly set the element tag within the regional manager. */ if (containsEndTag(el.textContent) === true) { regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.endRegion); } else if (containsColEndTag(elementTextSpaced) === true) { regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.columnBreak); } else if (containsColSettingsTag(elementTextSpaced) === true) { regionalManager.setElementToSettingsBlock(currentObject.UID, elementTextSpaced); } /** * Use our regional manager to get everything needed to render the region. */ let parentElementData = regionalManager.getRegionRenderData(); /** * We want to hide all of the original elements that are now going to be * rendered within our mutli-column region */ el.addClass("multiColumnDataHidden"); this.renderColumnMarkdown(parentElementData.parentRenderElement, parentElementData.domObjects, parentElementData.parentRenderSettings); return; })); } /** * This function takes in the data for the multi-column region and sets up the * user defined number of children with the proper css classes to be rendered properly. * * @param parentElement The element that the multi-column region will be rendered under. * @param regionElements The list of DOM objects that will be coppied under the parent object * @param settings The settings the user has defined for the region. */ renderColumnMarkdown(parentElement, regionElements, settings) { let multiColumnParent = createDiv({ cls: `multiColumnParent rowC`, }); if (settings.drawShadow === true) { multiColumnParent.addClass("multiColumnParentShadow"); } /** * Pass our parent div and settings to parser to create the required * column divs as children of the parent. */ let columnContentDivs = getColumnContentDivs(settings, multiColumnParent); for (let i = 0; i < columnContentDivs.length; i++) { if (settings.drawBorder === true) { columnContentDivs[i].addClass("columnBorder"); } if (settings.drawShadow === true) { columnContentDivs[i].addClass("columnShadow"); } } // Create markdown renderer to parse the passed markdown // between the tags. let markdownRenderChild = new obsidian.MarkdownRenderChild(multiColumnParent); // Remove every other child from the parent so // we dont end up with multiple sets of data. This should // really only need to loop once for i = 0 but loop just // in case. for (let i = parentElement.children.length - 1; i >= 0; i--) { parentElement.children[i].detach(); } parentElement.appendChild(markdownRenderChild.containerEl); let columnIndex = 0; for (let i = 0; i < regionElements.length; i++) { // We want to skip column break tags but only if we have columns // left to enter data for. if (regionElements[i].tag === DOMObjectTag.columnBreak && (columnIndex + 1) < settings.numberOfColumns) { columnIndex++; } else if (regionElements[i].tag !== DOMObjectTag.startRegion && regionElements[i].tag !== DOMObjectTag.endRegion && regionElements[i].tag !== DOMObjectTag.regionSettings) { /** * Make a deep copy of the element so we can remove the hidden class before * appending to our column div. */ let clonedElement = regionElements[i].element.cloneNode(true); clonedElement.removeClass("multiColumnDataHidden"); clonedElement.style.display = "block"; columnContentDivs[columnIndex].appendChild(clonedElement); } } } } /** * Sets up the CSS classes and the number of columns based on the passed settings. * @param settings The user defined settings that determine what CSS is set here. * @param multiColumnParent The parent object that the column divs will be created under. * @returns The list of column divs created under the passed parent element. */ function getColumnContentDivs(settings, multiColumnParent) { let columnContentDivs = []; if (settings.numberOfColumns === 2) { switch (settings.columnLayout) { case (ColumnLayout.standard): case (ColumnLayout.middle): case (ColumnLayout.center): case (ColumnLayout.third): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoEqualColumns_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoEqualColumns_Right` })); break; case (ColumnLayout.left): case (ColumnLayout.first): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoColumnsHeavyLeft_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoColumnsHeavyLeft_Right` })); break; case (ColumnLayout.right): case (ColumnLayout.second): case (ColumnLayout.last): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoColumnsHeavyRight_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent twoColumnsHeavyRight_Right` })); break; } } else if (settings.numberOfColumns === 3) { switch (settings.columnLayout) { case (ColumnLayout.standard): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threeEqualColumns_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threeEqualColumns_Middle` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threeEqualColumns_Right` })); break; case (ColumnLayout.left): case (ColumnLayout.first): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyLeft_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyLeft_Middle` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyLeft_Right` })); break; case (ColumnLayout.middle): case (ColumnLayout.center): case (ColumnLayout.second): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyMiddle_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyMiddle_Middle` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyMiddle_Right` })); break; case (ColumnLayout.right): case (ColumnLayout.third): case (ColumnLayout.last): columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyRight_Left` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyRight_Middle` })); columnContentDivs.push(multiColumnParent.createDiv({ cls: `columnContent threColumnsHeavyRight_Right` })); break; } } return columnContentDivs; } function findSiblingsAboveEl(linesAbove, sourcePath) { /** * We re-render all of the items above our element, until the start tag, * so we can determine where to place the new item in the manager. * * TODO: Can reduce the amount needing to be rendered by only rendering to * the start tag or a column-break whichever is closer. */ let siblingsAbove = createDiv(); let markdownRenderChild = new obsidian.MarkdownRenderChild(siblingsAbove); obsidian.MarkdownRenderer.renderMarkdown(linesAbove.reduce((prev, current) => { return prev + "\n" + current; }, ""), siblingsAbove, sourcePath, markdownRenderChild); return siblingsAbove; } module.exports = MultiColumnMarkdown; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsInNyYy9yZWdpb25TZXR0aW5ncy50cyIsInNyYy91dGlsaXRpZXMvdGV4dFBhcnNlci50cyIsInNyYy91dGlsaXRpZXMvdXRpbHMudHMiLCJzcmMvZG9tX21hbmFnZXIvZG9tT2JqZWN0LnRzIiwic3JjL2RvbV9tYW5hZ2VyL2RvbU1hbmFnZXIudHMiLCJzcmMvbWFpbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiEgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcclxuQ29weXJpZ2h0IChjKSBNaWNyb3NvZnQgQ29ycG9yYXRpb24uXHJcblxyXG5QZXJtaXNzaW9uIHRvIHVzZSwgY29weSwgbW9kaWZ5LCBhbmQvb3IgZGlzdHJpYnV0ZSB0aG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KVsxXS50cmltU3RhcnQoKS50cmltRW5kKCkudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgIGxldCBpc0JvcmRlckRyYXduOiBCb3JkZXJPcHRpb24gPSAoPGFueT5Cb3JkZXJPcHRpb24pW3NldHRpbmddXG5cbiAgICAgICAgICAgIGlmKGlzQm9yZGVyRHJhd24gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHN3aXRjaChpc0JvcmRlckRyYXduKXtcbiAgICAgICAgICAgICAgICAgICAgY2FzZShCb3JkZXJPcHRpb24uZGlzYWJsZWQpOlxuICAgICAgICAgICAgICAgICAgICBjYXNlKEJvcmRlck9wdGlvbi5vZmYpOlxuICAgICAgICAgICAgICAgICAgICBjYXNlKEJvcmRlck9wdGlvbi5mYWxzZSk6XG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJEcmF3biA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZm9yKGxldCBpID0gMDsgaSA8IHNldHRpbmdzTGluZXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYoc2V0dGluZ3NMaW5lc1tpXS50b0xvd2VyQ2FzZSgpLnJlcGxhY2UoL1xccy9nLCBcIlwiKS5jb250YWlucyhcInNoYWRvdzpcIikpIHtcblxuICAgICAgICAgICAgbGV0IHNldHRpbmcgPSBzZXR0aW5nc0xpbmVzW2ldLnNwbGl0KFwiOlwiKVsxXS50cmltU3RhcnQoKS50cmltRW5kKCkudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgIGxldCBpc1NoYWRvd0RyYXduOiBTaGFkb3dPcHRpb24gPSAoPGFueT5TaGFkb3dPcHRpb24pW3NldHRpbmddXG5cbiAgICAgICAgICAgIGlmKGlzU2hhZG93RHJhd24gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHN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ge1xyXG5cclxuICAgICAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZWRpdG9yLmdldERvYygpLnJlcGxhY2VTZWxlY3Rpb24oXHJcbmBcclxuPT09IG11bHRpLWNvbHVtbi1zdGFydDogSURfJHtnZXRVSUQoNCl9XHJcblxcYFxcYFxcYGNvbHVtbi1zZXR0aW5nc1xyXG5OdW1iZXIgb2YgQ29sdW1uczogMlxyXG5MYXJnZXN0IENvbHVtbjogc3RhbmRhcmRcclxuXFxgXFxgXFxgXHJcblxyXG49PT0gZW5kLWNvbHVtbiA9PT1cclxuXHJcbj09PSBtdWx0aS1jb2x1bW4tZW5kXHJcblxyXG4ke2VkaXRvci5nZXREb2MoKS5nZXRTZWxlY3Rpb24oKX1gXHJcbiAgICAgICAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXcgTm90aWNlKFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcIkVuY291bnRlcmVkIGFuIGVycm9yIGluc2VydGluZyBhIG11bHRpLWNvbHVtbiByZWdpb24uIFBsZWFzZSB0cnkgYWdhaW4gbGF0ZXIuXCJcclxuICAgICAgICAgICAgICAgICAgICApO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIHRoaXMuYWRkQ29tbWFuZCh7ICAgICAgICAgICAgXHJcbiAgICAgICAgICAgIGlkOiBgYWRkLUlEcy1Uby1tdWx0aS1jb2x1bW4tcmVnaW9uYCxcclxuICAgICAgICAgICAgbmFtZTogYEZpeCBNaXNzaW5nIElEcyBmb3IgTXVsdGktQ29sdW1uIFJlZ2lvbnNgLFxyXG4gICAgICAgICAgICBlZGl0b3JDYWxsYmFjazogKGVkaXRvciwgdmlldykgPT4ge1xyXG5cclxuICAgICAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgICAgICogTm90IHN1cmUgaWYgdGhlcmUgaXMgYW4gZWFzaWVyIHdheSB0byBkbyB0aGlzLlxyXG4gICAgICAgICAgICAgICAgICAgICAqIFxyXG4gICAgICAgICAgICAgICAgICAgICAqIEdldCBhbGwgb2YgdGhlIGxpbmVzIG9mIHRoZSBkb2N1bWVudCBzcGxpdCBieSBuZXdsaW5lcy5cclxuICAgICAgICAgICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgICAgICAgICBsZXQgbGluZXMgPSBlZGl0b3IuZ2V0UmFuZ2UoeyBsaW5lOiAwLCBjaDogMCB9LCB7IGxpbmU6IGVkaXRvci5nZXREb2MoKS5saW5lQ291bnQoKSwgY2g6IDB9KS5zcGxpdChcIlxcblwiKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgICAgICogTG9vcCB0aHJvdWdoIGFsbCBvZiB0aGUgbGluZXMgY2hlY2tpbmcgaWYgdGhlIGxpbmUgaXMgYSBcclxuICAgICAgICAgICAgICAgICAgICAgKiBzdGFydCB0YWcgYW5kIGlmIHNvIGlzIGl0IG1pc3NpbmcgYW4gSUQuXHJcbiAgICAgICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmVzV2l0aG91dElEcyA9IFtdXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRleHRXaXRob3V0SURzID0gW11cclxuICAgICAgICAgICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgbGluZXMubGVuZ3RoOyBpKyspIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gbXVsdGlDb2x1bW5QYXJzZXIuaXNTdGFydFRhZ1dpdGhJRChsaW5lc1tpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKGRhdGEuaXNTdGFydFRhZyA9PT0gdHJ1ZSAmJiBkYXRhLmhhc0tleSA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzV2l0aG91dElEcy5wdXNoKGkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dFdpdGhvdXRJRHMucHVzaChsaW5lc1tpXSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgIFxyXG5cclxuICAgICAgICAgICAgICAgICAgICBpZihsaW5lc1dpdGhvdXRJRHMubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBOb3RpY2UgKFwiRm91bmQgMCBtaXNzaW5nIElEcyBpbiB0aGUgY3VycmVudCBkb2N1bWVudC5cIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgICAgICAgICAqIE5vdyBsb29wIHRocm91Z2ggZWFjaCBsaW5lIHRoYXQgaXMgbWlzc2luZyBhbiBJRCBhbmRcclxuICAgICAgICAgICAgICAgICAgICAgKiBnZW5lcmF0ZSBhIHJhbmRvbSBJRCBhbmQgcmVwbGFjZSB0aGUgb3JpZ2luYWwgdGV4dC5cclxuICAgICAgICAgICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgbGluZXNXaXRob3V0SURzLmxlbmd0aDsgaSsrKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb3JpZ2luYWxUZXh0ID0gdGV4dFdpdGhvdXRJRHNbaV1cclxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRleHQgPSBvcmlnaW5hbFRleHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQgPSB0ZXh0LnRyaW1FbmQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYodGV4dC5jaGFyQXQodGV4dC5sZW5ndGggLSAxKSA9PT0gXCI6XCIpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQgPSB0ZXh0LnNsaWNlKDAsIHRleHQubGVuZ3RoLTEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQgPSBgJHt0ZXh0fTogSURfJHtnZXRVSUQoNCl9YDtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGVkaXRvci5yZXBsYWNlUmFuZ2UodGV4dCwgeyBsaW5lOiBsaW5lc1dpdGhvdXRJRHNbaV0sIGNoOiAwIH0sIFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgbGluZTogbGluZXNXaXRob3V0SURzW2ldLCBjaDogb3JpZ2luYWxUZXh0Lmxlbmd0aH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBuZXcgTm90aWNlIChgUmVwbGFjZWQgJHtsaW5lc1dpdGhvdXRJRHMubGVuZ3RofSBtaXNzaW5nIElEKHMpIGluIHRoZSBjdXJyZW50IGRvY3VtZW50LmApO1xyXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIG5ldyBOb3RpY2UoXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiRW5jb3VudGVyZWQgYW4gZXJyb3IgYWRkaWduIElEcyB0byBtdWx0aS1jb2x1bW4gcmVnaW9ucy4gUGxlYXNlIHRyeSBhZ2FpbiBsYXRlci5cIlxyXG4gICAgICAgICAgICAgICAgICAgICk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9KTtcclxuXHR9XHJcblxyXG4gICAgc2V0dXBNYXJrZG93blBvc3RQcm9j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0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJGb3VuZCBudWxsIERPTSBtYW5hZ2VyLiBDb3VsZCBub3QgcHJvY2VzcyBtdWx0aS1jb2x1bW4gbWFya2Rvd24uXCIpXHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBJZiB3ZSBlbmNvdW50ZXIgYSBzdGFydCB0YWcgb24gdGhlIGRvY3VtZW50IHdlIHNldCB0aGUgZmxhZyB0byBzdGFydFxyXG4gICAgICAgICAgICAgKiBwYXJzaW5nIHRoZSByZXN0IG9mIHRoZSBkb2N1bWVudC5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGlmKG11bHRpQ29sdW1uUGFyc2VyLmNvbnRhaW5zU3RhcnRUYWcoZWwudGV4dENvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICBmaWxlRE9NTWFuYWdlci5zZXRIYXNTdGFydFRhZygpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAvKiogXHJcbiAgICAgICAgICAgICAqIElmIHRoZSBkb2N1bWVudCBkb2VzIG5vdCBjb250YWluIGFueSBzdGFydCB0YWdzIHdlIGlnbm9yZSB0aGVcclxuICAgICAgICAgICAgICogcmVzdCBvZiB0aGUgcGFyc2luZy4gVGhpcyBpcyBvbmx5IHNldCB0byB0cnVlIG9uY2UgdGhlIGZpcnN0XHJcbiAgICAgICAgICAgICAqIHN0YXJ0IHRhZyBlbGVtZW50IGlzIHBhcnNlZCBhYm92ZS5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGlmKGZpbGVET01NYW5hZ2VyLmdldEhhc1N0YXJ0VGFnKCkgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogVGFrZSB0aGUgaW5mbyBwcm92aWRlZCBhbmQgZ2VuZXJhdGUgdGhlIHJlcXVpcmVkIHZhcmlhYmxlcyBmcm9tIFxyXG4gICAgICAgICAgICAgKiB0aGUgbGluZSBzdGFydCBhbmQgZW5kIHZhbHVlcy5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBsaW5lc09mRWxlbWVudCA9IGluZm8udGV4dC5zcGxpdChcIlxcblwiKS5zcGxpY2UoaW5mby5saW5lU3RhcnQsIChpbmZvLmxpbmVFbmQgKyAxIC0gaW5mby5saW5lU3RhcnQpKTtcclxuICAgICAgICAgICAgbGV0IGVsZW1lbnRUZXh0U3BhY2VkID0gbGluZXNPZkVsZW1lbnQucmVkdWNlKChwcmV2LCBjdXJyKSA9PiB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcHJldiArIFwiXFxuXCIgKyBjdXJyO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgbGV0IGVsZW1lbnRUZXh0ID0gbGluZXNPZkVsZW1lbnQucmVkdWNlKChwcmV2LCBjdXJyKSA9PiB7IFxyXG4gICAgICAgICAgICAgICAgLy8gVE9ETzogVGhpcyBjYW4gcHJvYmFibHkgYmUgcmVtb3ZlZCBhcyBpdCBpcyBvbmx5IHVzZWQgdG8gaWRlbnRpZnkgRE9NT2JqZWN0cy5cclxuICAgICAgICAgICAgICAgIHJldHVybiBwcmV2ICsgY3VycjtcclxuICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogSWYgdGhlIGN1cnJlbnQgbGluZSBpcyBhIHN0YXJ0IHRhZyB3ZSB3YW50IHRvIHNldCB1cCB0aGVcclxuICAgICAgICAgICAgICogcmVnaW9uIG1hbmFnZXIuIFRoZSByZWdpb25hbCBtYW5hZ2VyIHRha2VzIGNhcmVcclxuICAgICAgICAgICAgICogb2YgYWxsIGl0ZW1zIGJldHdlZW4gaXQncyBzdGFydCBhbmQgZW5kIHRhZ3Mgd2hpbGUgdGhlXHJcbiAgICAgICAgICAgICAqIGZpbGUgbWFuYWdlciB3ZSBnb3QgYWJvdmUgYWJvdmUgdGFrZXMgY2FyZSBvZiBhbGwgcmVnaW9uYWwgXHJcbiAgICAgICAgICAgICAqIG1hbmFnZXJzIGluIGVhY2ggZmlsZS5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGlmKG11bHRpQ29sdW1uUGFyc2VyLmNvbnRhaW5zU3RhcnRUYWcoZWwudGV4dENvbnRlbnQpKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgLyoqIFxyXG4gICAgICAgICAgICAgICAgICogU2V0IHVwIHRoZSBjdXJyZW50IGVsZW1lbnQgdG8gYWN0IGFzIHRoZSBwYXJlbnQgZm9yIHRoZSBcclxuICAgICAgICAgICAgICAgICAqIG11bHRpLWNvbHVtbiByZWdpb24uXHJcbiAgICAgICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgICAgIGVsLmlkID0gYFR3b0NvbHVtbkNvbnRhaW5lci0ke2dldFVJRCgpfWBcclxuICAgICAgICAgICAgICAgIGVsLmNoaWxkcmVuWzBdLmRldGFjaCgpO1xyXG4gICAgICAgICAgICAgICAgZWwuY2xhc3NMaXN0LmFkZChcIm11bHRpQ29sdW1uQ29udGFpbmVyXCIpXHJcbiAgICAgICAgICAgICAgICBsZXQgcmVuZGVyRXJyb3JSZWdpb24gPSBlbC5jcmVhdGVEaXYoe1xyXG4gICAgICAgICAgICAgICAgICAgIGNsczogYG11bHRpQ29sdW1uRXJyb3JNZXNzYWdlYCxcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgbGV0IHJlbmRlckNvbHVtblJlZ2lvbiA9IGVsLmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgUmVuZGVyQ29sUmVnaW9uYFxyXG4gICAgICAgICAgICAgICAgfSlcclxuXHJcbiAgICAgICAgICAgICAgICBsZXQgc3RhcnRCbG9ja0RhdGEgPSBtdWx0aUNvbHVtblBhcnNlci5nZXRTdGFydEJsb2NrQWJvdmVMaW5lKGxpbmVzT2ZFbGVtZW50KVxyXG4gICAgICAgICAgICAgICAgbGV0IHJlZ2lvbktleSA9IHN0YXJ0QmxvY2tEYXRhLnN0YXJ0QmxvY2tLZXk7XHJcbiAgICAgICAgICAgICAgICBpZihmaWxlRE9NTWFuYWdlci5jaGVja0tleUV4aXN0cyhyZWdpb25LZXkpID09PSB0cnVlKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGxldCB7IG51bWJlck9mVGFncywga2V5cyB9ID0gbXVsdGlDb2x1bW5QYXJzZXIuY291bnRTdGFydFRhZ3MoaW5mby50ZXh0KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGluZGV4ID0gMDtcclxuICAgICAgICAgICAgICAgICAgICBmb3IoOyBpbmRleCA8IG51bWJlck9mVGFnczsgaW5kZXgrKykge1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gQmVjYXVzZSB3ZSBjaGVja2VkIGlmIGtleSBleGlzdHMgb25lIG9mIHRoZXNlIGhhcyB0byBtYXRjaC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoa2V5c1tpbmRleF0gPT09IHJlZ2lvbktleSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmKGtleXNbaW5kZXhdID09PSBcIlwiICkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZW5kZXJFcnJvclJlZ2lvbi5pbm5lclRleHQgPSBcIkZvdW5kIG11bHRpcGxlIHJlZ2lvbnMgd2l0aCBlbXB0eSBJRHMuIFBsZWFzZSBzZXQgYSB1bmlxdWUgSUQgYWZ0ZXIgZWFjaCBzdGFydCB0YWcuXFxuRUc6ICc9PT0gbXVsdGktY29sdW1uLXN0YXJ0OiByYW5kb21JRCdcXG5PciB1c2UgJ0ZpeCBNaXNzaW5nIElEcycgaW4gdGhlIGNvbW1hbmQgcGFsZXR0ZSBhbmQgcmVsb2FkIHRoZSBkb2N1bWVudC5cIlxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVuZGVyRXJyb3JSZWdpb24uaW5uZXJUZXh0ID0gXCJSZWdpb24gSUQgYWxyZWFkeSBleGlzdHMgaW4gZG9jdW1lbnQsIHBsZWFzZSBzZXQgYSB1bmlxdWUgSUQuXFxuRUc6ICc9PT0gbXVsdGktY29sdW1uLXN0YXJ0OiByYW5kb21JRCdcIlxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGxldCBlbGVtZW50TWFya2Rvd25SZW5kZXJlciA9IG5ldyBNYXJrZG93blJlbmRlckNoaWxkKGVsKTtcclxuICAgICAgICAgICAgICAgIGZpbGVET01NYW5hZ2VyLmNyZWF0ZVJlZ2lvbmFsTWFuYWdlcihyZWdpb25LZXksIHJlbmRlckVycm9yUmVnaW9uLCByZW5kZXJDb2x1bW5SZWdpb24pO1xyXG4gICAgICAgICAgICAgICAgZWxlbWVudE1hcmtkb3duUmVuZGVyZXIub251bmxvYWQgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYoZmlsZURPTU1hbmFnZXIpIHtcclxuICAgIFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlRE9NTWFuYWdlci5yZW1vdmVSZWdpb24oc3RhcnRCbG9ja0RhdGEuc3RhcnRCbG9ja0tleSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIGN0eC5hZGRDaGlsZChlbGVtZW50TWFya2Rvd25SZW5kZXJlcik7XHJcblxyXG4gICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgKiBOb3cgd2UgaGF2ZSBjcmVhdGVkIG91ciByZWdpb25hbCBtYW5hZ2VyIGFuZCBkZWZpbmVkIHdoYXQgZWxlbWVudHMgXHJcbiAgICAgICAgICAgICAgICAgKiBuZWVkIHRvIGJlIHJlbmRlcmVkIGludG8uIFNvIHdlIGNhbiByZXR1cm4gd2l0aG91dCBhbnkgbW9yZSBwcm9jZXNzaW5nLlxyXG4gICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICByZXR1cm5cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIEdldCBhIGxpc3Qgb2YgYWxsIG9mIHRoZSBsaW5lcyBhYm92ZSBvdXIgY3VycmVudCBlbGVtZW50LlxyXG4gICAgICAgICAgICAgKiBXZSB3aWxsIHVzZSB0aGlzIHRvIGRldGVybWluZSBpZiB0aGUgZWxlbWVudCBpcyB3aXRoaW4gYSBibG9jayBzb1xyXG4gICAgICAgICAgICAgKiB3ZSBjYW4gb3RoZXJ3aXNlIGlnbm9yZSB0aGUgZWxlbWVudCBhbmQga2VlcCBjb21wdXRlIHRpbWUgZG93bi5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBsaW5lc0Fib3ZlQXJyYXkgPSBpbmZvLnRleHQuc3BsaXQoXCJcXG5cIikuc2xpY2UoMCwgaW5mby5saW5lU3RhcnQpXHJcbiAgICAgICAgICAgIGxldCB0ZXh0QWJvdmVBcnJheSA9IGxpbmVzQWJvdmVBcnJheS5yZWR1Y2UoKHByZXYsIGN1cnIpID0+IHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBwcmV2ICsgXCJcXG5cIiArIGN1cnJcclxuICAgICAgICAgICAgfSwgXCJcIilcclxuXHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBBIGxpbmUgYWJvdmUgdXMgY29udGFpbnMgYSBzdGFydCB0YWcgbm93IHNlZSBpZiB3ZSdyZSB3aXRoaW4gdGhhdFxyXG4gICAgICAgICAgICAgKiBibG9jay5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBzdGFydEJvY2tBYm92ZSA9IG11bHRpQ29sdW1uUGFyc2VyLmdldFN0YXJ0QmxvY2tBYm92ZUxpbmUobGluZXNBYm92ZUFycmF5KTtcclxuICAgICAgICAgICAgaWYoc3RhcnRCb2NrQWJvdmUgPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogSGVyZSB3ZSBub3cga25vdyB3ZSdyZSB3aXRoaW4gYSByZWdpb25hbCBibG9jay5cclxuICAgICAgICAgICAgICovXHJcblxyXG4gICAgICAgICAgICAvLyBOb3cgd2Ugb25seSB3YW50IHRvIHdvcmsgd2l0aCB0aGUgbGluZXMgd2l0aGluIHRoZSBjdXJyZW50IHJlZ2lvbi5cclxuICAgICAgICAgICAgbGluZXNBYm92ZUFycmF5ID0gc3RhcnRCb2NrQWJvdmUubGluZXNBYm92ZUFycmF5O1xyXG4gICAgICAgICAgICBsZXQgcmVnaW9uYWxNYW5hZ2VyOiBSZWdpb25ET01NYW5hZ2VyID0gZmlsZURPTU1hbmFnZXIuZ2V0UmVnaW9uYWxNYW5hZ2VyKHN0YXJ0Qm9ja0Fib3ZlLnN0YXJ0QmxvY2tLZXkpO1xyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIElmIHdlIGNhbiBub3QgZ2V0IHRoZSBzdGFydCBibG9jayBhbmQgdGhpcyByZWdpb24ncyBkb20gbWFuYWdlciBcclxuICAgICAgICAgICAgICogd2UgY2FuIG5vdCBjb250aW51ZSBzb21ldGhpbmcgaGFzIGdvbmUgd3JvbmcuXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBpZihyZWdpb25hbE1hbmFnZXIgPT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIHJldHVyblxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogTm93IHdlIHRha2UgdGhlIGxpbmVzIGFib3ZlIG91ciBjdXJyZW50IGVsZW1lbnQgdXAgdW50aWwgdGhlXHJcbiAgICAgICAgICAgICAqIHN0YXJ0IHJlZ2lvbiB0YWcgYW5kIHJlbmRlciB0aGF0IGludG8gYW4gSFRNTCBlbGVtZW50LiBXZSB3aWxsIFxyXG4gICAgICAgICAgICAgKiB1c2UgdGhpcyBlbGVtZW50IHRvIGRldGVybWluZSB3aGVyZSB0byBwbGFjZSBvdXIgY3VycmVudCBlbGVtZW50LlxyXG4gICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgbGV0IHNpYmxpbmdzQWJvdmU6IEhUTUxEaXZFbGVtZW50ID0gZmluZFNpYmxpbmdzQWJvdmVFbChsaW5lc0Fib3ZlQXJyYXksIHNvdXJjZVBhdGgpO1xyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIFNldCB1cCBvdXIgZG9tIG9iamVjdCB0byBiZSBhZGRlZCB0byB0aGUgbWFuYWdlci5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBjdXJyZW50T2JqZWN0OiBET01PYmplY3QgPSBuZXcgRE9NT2JqZWN0KGVsZW1lbnRUZXh0LCBlbClcclxuXHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBOb3cgd2UgYWRkIHRoZSBvYmplY3QgdG8gdGhlIG1hbmFnZXIgYW5kIHRoZW4gc2V0dXAgdGhlXHJcbi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ICAgICAgICAgICAgICogTmVlZCB0byBjaGVjayBoZXJlIGlmIGVsZW1lbnQgaXMgbnVsbCBhcyB0aGlzIGNsb3N1cmUgd2lsbCBiZSBjYWxsZWRcclxuICAgICAgICAgICAgICAgICAgICAgKiByZXBlYXRlZGx5IG9uIGZpbGUgY2hhbmdlLlxyXG4gICAgICAgICAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICAgICAgICAgIGlmKHJlZ2lvblJlbmRlckRhdGEucGFyZW50UmVuZGVyRWxlbWVudCA9PT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVuZGVyQ29sdW1uTWFya2Rvd24ocmVnaW9uUmVuZGVyRGF0YS5wYXJlbnRSZW5kZXJFbGVtZW50LCByZWdpb25SZW5kZXJEYXRhLmRvbU9iamVjdHMsIHJlZ2lvblJlbmRlckRhdGEucGFyZW50UmVuZGVyU2V0dGluZ3MpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBjdHguYWRkQ2hpbGQoZWxlbWVudE1hcmtkb3duUmVuZGVyZXIpO1xyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIE5vdyB3ZSBjaGVjayBpZiBvdXIgY3VycmVudCBlbGVtZW50IGlzIGEgc3BlY2lhbCBmbGFnIHNvIHdlIGNhblxyXG4gICAgICAgICAgICAgKiBwcm9wZXJseSBzZXQgdGhlIGVsZW1lbnQgdGFnIHdpdGhpbiB0aGUgcmVnaW9uYWwgbWFuYWdlci5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGlmKG11bHRpQ29sdW1uUGFyc2VyLmNvbnRhaW5zRW5kVGFnKGVsLnRleHRDb250ZW50KSA9PT0gdHJ1ZSkge1xyXG5cclxuICAgICAgICAgICAgICAgIHJlZ2lvbmFsTWFuYWdlci51cGRhdGVFbGVtZW50VGFnKGN1cnJlbnRPYmplY3QuVUlELCBET01PYmplY3RUYWcuZW5kUmVnaW9uKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlbHNlIGlmKG11bHRpQ29sdW1uUGFyc2VyLmNvbnRhaW5zQ29sRW5kVGFnKGVsZW1lbnRUZXh0U3BhY2VkKSA9PT0gdHJ1ZSkge1xyXG5cclxuICAgICAgICAgICAgICAgIHJlZ2lvbmFsTWFuYWdlci51cGRhdGVFbGVtZW50VGFnKGN1cnJlbnRPYmplY3QuVUlELCBET01PYmplY3RUYWcuY29sdW1uQnJlYWspO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2UgaWYobXVsdGlDb2x1bW5QYXJzZXIuY29udGFpbnNDb2xTZXR0aW5nc1RhZyhlbGVtZW50VGV4dFNwYWNlZCkgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIuc2V0RWxlbWVudFRvU2V0dGluZ3NCbG9jayhjdXJyZW50T2JqZWN0LlVJRCwgZWxlbWVudFRleHRTcGFjZWQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogVXNlIG91ciByZWdpb25hbCBtYW5hZ2VyIHRvIGdldCBldmVyeXRoaW5nIG5lZWRlZCB0byByZW5kZXIgdGhlIHJlZ2lvbi5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBwYXJlbnRFbGVtZW50RGF0YTogTXVsdGlDb2x1bW5SZW5kZXJEYXRhID0gcmVnaW9uYWxNYW5hZ2VyLmdldFJlZ2lvblJlbmRlckRhdGEoKTtcclxuICAgIFxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogV2Ugd2FudCB0byBoaWRlIGFsbCBvZiB0aGUgb3JpZ2luYWwgZWxlbWVudHMgdGhhdCB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Zm9yIHRoZSByZWdpb24uXHJcbiAgICAgKi9cclxuICAgIHJlbmRlckNvbHVtbk1hcmtkb3duKHBhcmVudEVsZW1lbnQ6IEhUTUxFbGVtZW50LCByZWdpb25FbGVtZW50czogRE9NT2JqZWN0W10sIHNldHRpbmdzOiBNdWx0aUNvbHVtblNldHRpbmdzKSB7XHJcblxyXG4gICAgICAgIGxldCBtdWx0aUNvbHVtblBhcmVudCA9IGNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgIGNsczogYG11bHRpQ29sdW1uUGFyZW50IHJvd0NgLFxyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIGlmKHNldHRpbmdzLmRyYXdTaGFkb3cgPT09IHRydWUpIHtcclxuICAgICAgICAgICAgbXVsdGlDb2x1bW5QYXJlbnQuYWRkQ2xhc3MoXCJtdWx0aUNvbHVtblBhcmVudFNoYWRvd1wiKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIFBhc3Mgb3VyIHBhcmVudCBkaXYgYW5kIHNldHRpbmdzIHRvIHBhcnNlciB0byBjcmVhdGUgdGhlIHJlcXVpcmVkXHJcbiAgICAgICAgICogY29sdW1uIGRpdnMgYXMgY2hpbGRyZW4gb2YgdGhlIHBhcmVudC5cclxuICAgICAgICAgKi9cclxuICAgICAgICBsZXQgY29sdW1uQ29udGVudERpdnMgPSBnZXRDb2x1bW5Db250ZW50RGl2cyhzZXR0aW5ncywgbXVsdGlDb2x1bW5QYXJlbnQpO1xyXG4gICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCBjb2x1bW5Db250ZW50RGl2cy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICBpZihzZXR0aW5ncy5kcmF3Qm9yZGVyID09PSB0cnVlKSB7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2c1tpXS5hZGRDbGFzcyhcImNvbHVtbkJvcmRlclwiKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICA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GkgPSAwOyBpIDwgcmVnaW9uRWxlbWVudHMubGVuZ3RoOyBpKyspIHtcclxuXHJcbiAgICAgICAgICAgIC8vIFdlIHdhbnQgdG8gc2tpcCBjb2x1bW4gYnJlYWsgdGFncyBidXQgb25seSBpZiB3ZSBoYXZlIGNvbHVtbnMgXHJcbiAgICAgICAgICAgIC8vIGxlZnQgdG8gZW50ZXIgZGF0YSBmb3IuXHJcbiAgICAgICAgICAgIGlmKHJlZ2lvbkVsZW1lbnRzW2ldLnRhZyA9PT0gRE9NT2JqZWN0VGFnLmNvbHVtbkJyZWFrICYmIFxyXG4gICAgICAgICAgICAgICAoY29sdW1uSW5kZXggKyAxKSA8IHNldHRpbmdzLm51bWJlck9mQ29sdW1ucykge1xyXG5cclxuICAgICAgICAgICAgICAgIGNvbHVtbkluZGV4Kys7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAocmVnaW9uRWxlbWVudHNbaV0udGFnICE9PSBET01PYmplY3RUYWcuc3RhcnRSZWdpb24gJiYgXHJcbiAgICAgICAgICAgICAgICAgICAgIHJlZ2lvbkVsZW1lbnRzW2ldLnRhZyAhPT0gRE9NT2JqZWN0VGFnLmVuZFJlZ2lvbiAmJiBcclxuICAgICAgICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0udGFnICE9PSBET01PYmplY3RUYWcucmVnaW9uU2V0dGluZ3MpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICAgICAqIE1ha2UgYSBkZWVwIGNvcHkgb2YgdGhlIGVsZW1lbnQgc28gd2UgY2FuIHJlbW92ZSB0aGUgaGlkZGVuIGNsYXNzIGJlZm9yZVxyXG4gICAgICAgICAgICAgICAgICogYXBwZW5kaW5nIHRvIG91ciBjb2x1bW4gZGl2LlxyXG4gICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICBsZXQgY2xvbmVkRWxlbWVudCA9IHJlZ2lvbkVsZW1lb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TUxEaXZFbGVtZW50W10gPSBbXVxyXG4gICAgaWYoc2V0dGluZ3MubnVtYmVyT2ZDb2x1bW5zID09PSAyKSB7XHJcblxyXG4gICAgICAgIHN3aXRjaChzZXR0aW5ncy5jb2x1bW5MYXlvdXQpIHtcclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc3RhbmRhcmQpOlxyXG4gICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5taWRkbGUpOlxyXG4gICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5jZW50ZXIpOlxyXG4gICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC50aGlyZCk6XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0d29FcXVhbENvbHVtbnNfTGVmdGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHR3b0VxdWFsQ29sdW1uc19SaWdodGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQubGVmdCk6XHJcbiAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmZpcnN0KTpcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHR3b0NvbHVtbnNIZWF2eUxlZnRfTGVmdGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHR3b0NvbHVtbnNIZWF2eUxlZnRfUmlnaHRgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuXHJcbiAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LnJpZ2h0KTpcclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc2Vjb25kKTpcclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQubGFzdCk6XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0d29Db2x1bW5zSGVhdnlSaWdodF9MZWZ0YFxyXG4gICAgICAgICAgICAgICAgfSkpO1xyXG4gICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xyXG4gICAgICAgICAgICAgICAgICAgIGNsczogYGNvbHVtbkNvbnRlbnQgdHdvQ29sdW1uc0hlYXZ5UmlnaHRfUmlnaHRgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICB9XHJcbiAgICB9XHJcbiAgICBlbHNlIGlmKHNldHRpbmdzLm51bWJlck9mQ29sdW1ucyA9PT0gMykge1xyXG5cclxuICAgICAgICBzd2l0Y2goc2V0dGluZ3MuY29sdW1uTGF5b3V0KSB7XHJcbiAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LnN0YW5kYXJkKTpcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHRocmVlRXF1YWxDb2x1bW5zX0xlZnRgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0aHJlZUVxdWFsQ29sdW1uc19NaWRkbGVgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0aHJlZUVxdWFsQ29sdW1uc19SaWdodGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQubGVmdCk6XHJcbiAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmZpcnN0KTpcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHRocmVDb2x1bW5zSGVhdnlMZWZ0X0xlZnRgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0aHJlQ29sdW1uc0hlYXZ5TGVmdF9NaWRkbGVgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0aHJlQ29sdW1uc0hlYXZ5TGVmdF9SaWdodGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQubWlkZGxlKTpcclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuY2VudGVyKTpcclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc2Vjb25kKTpcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHRocmVDb2x1bW5zSGVhdnlNaWRkbGVfTGVmdGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IGBjb2x1bW5Db250ZW50IHRocmVDb2x1bW5zSGVhdnlNaWRkbGVfTWlkZGxlYFxyXG4gICAgICAgICAgICAgICAgfSkpO1xyXG4gICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xyXG4gICAgICAgICAgICAgICAgICAgIGNsczogYGNvbHVtbkNvbnRlbnQgdGhyZUNvbHVtbnNIZWF2eU1pZGRsZV9SaWdodGBcclxuICAgICAgICAgICAgICAgIH0pKTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQucmlnaHQpOlxyXG4gICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC50aGlyZCk6XHJcbiAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0Lmxhc3QpOlxyXG4gICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xyXG4gICAgICAgICAgICAgICAgICAgIGNsczogYGNvbHVtbkNvbnRlbnQgdGhyZUNvbHVtbnNIZWF2eVJpZ2h0X0xlZnRgXHJcbiAgICAgICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgY29sdW1uQ29udGVudCB0aHJlQ29sdW1uc0hlYXZ5UmlnaHRfTWlkZGxlYFxyXG4gICAgICAgICAgICAgICAgfSkpO1xyXG4gICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xyXG4gICAgICAgICAgICAgICAgICAgIGNsczogYGNvbHVtbkNvbnRlbnQgdGhyZUNvbHVtbnNIZWF2eVJpZ2h0X1JpZ2h0YFxyXG4gICAgICAgICAgICAgICAgfSkpO1xyXG4gICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHJldHVybiBjb2x1bW5Db250ZW50RGl2cztcclxufVxyXG5cclxuXHJcbmV4cG9ydCB0eXBlIG5lYXJieVNpYmxpbmdzID0geyBcclxuICAgIHNpYmxpbmdzQWJvdmU6IEhUTUxEaXZFbGVtZW50LFxyXG4gICA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