/*
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');
var state = require('@codemirror/state');
var view = require('@codemirror/view');
var language = require('@codemirror/language');
/******************************************************************************
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 = {}));
var SingleColumnSize;
(function (SingleColumnSize) {
SingleColumnSize[SingleColumnSize["small"] = 0] = "small";
SingleColumnSize[SingleColumnSize["medium"] = 1] = "medium";
SingleColumnSize[SingleColumnSize["large"] = 2] = "large";
SingleColumnSize[SingleColumnSize["full"] = 3] = "full";
})(SingleColumnSize || (SingleColumnSize = {}));
var ContentOverflowType;
(function (ContentOverflowType) {
ContentOverflowType[ContentOverflowType["scroll"] = 0] = "scroll";
ContentOverflowType[ContentOverflowType["hidden"] = 1] = "hidden";
})(ContentOverflowType || (ContentOverflowType = {}));
var AlignmentType;
(function (AlignmentType) {
AlignmentType[AlignmentType["left"] = 0] = "left";
AlignmentType[AlignmentType["center"] = 1] = "center";
AlignmentType[AlignmentType["right"] = 2] = "right";
})(AlignmentType || (AlignmentType = {}));
function getDefaultMultiColumnSettings() {
return {
numberOfColumns: 2,
columnLayout: ColumnLayout.standard,
drawBorder: true,
drawShadow: true,
autoLayout: false,
columnSize: SingleColumnSize.medium,
columnPosition: ColumnLayout.standard,
columnSpacing: "",
contentOverflow: ContentOverflowType.scroll,
alignment: AlignmentType.left
};
}
/**
* File: /src/utilities/settingsParser.ts
* Created Date: Friday, June 3rd 2022, 8:16 pm
* Author: Cameron Robinson
*
* Copyright (c) 2022 Cameron Robinson
*/
/**
* Here we define all of the valid settings strings that the user can enter for each setting type.
* The strings are then mapped twice, first to a valid regex string that searches for the setting
* name, ignoring all extra spaces and letter case, and then maped to a RegEx object to be used
* when parsing.
*/
const COL_POSITION_OPTION_STRS = [
"column position",
"col position",
"column location",
"col location",
"single column location",
"single column position",
];
const COL_POSITION_REGEX_ARR = COL_POSITION_OPTION_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const COL_SIZE_OPTION_STRS = [
"column size",
"column width",
"col size",
"col width",
"single column size",
"single col size",
"single column width",
"single col width"
];
const COL_SIZE_OPTION_REGEX_ARR = COL_SIZE_OPTION_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const NUMBER_OF_COLUMNS_STRS = [
"number of columns"
];
const NUMBER_OF_COLUMNS_REGEX_ARR = NUMBER_OF_COLUMNS_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const LARGEST_COLUMN_STRS = [
"largest column"
];
const LARGEST_COLUMN_REGEX_ARR = LARGEST_COLUMN_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const DRAW_BORDER_STRS = [
"border"
];
const DRAW_BORDER_REGEX_ARR = DRAW_BORDER_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const DRAW_SHADOW_STRS = [
"shadow"
];
const DRAW_SHADOW_REGEX_ARR = DRAW_SHADOW_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const AUTO_LAYOUT_SETTING_STRS = [
"auto layout"
];
const AUTO_LAYOUT_REGEX_ARR = AUTO_LAYOUT_SETTING_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
const COLUMN_SPACING_REGEX_ARR = [
"column spacing",
].map((value) => {
return new RegExp(convertStringToSettingsRegex(value), "i");
});
const CONTENT_OVERFLOW_REGEX_ARR = [
"overflow",
"content overflow"
].map((value) => {
return new RegExp(convertStringToSettingsRegex(value), "i");
});
const ALIGNMENT_REGEX_ARR = [
"alignment",
"align",
"content align",
"align content",
"text align",
"align text"
].map((value) => {
return new RegExp(convertStringToSettingsRegex(value), "i");
});
/**
* This function searches the settings string through each regex option. If one of the regex
* values match, it returns the first group found by the regex. This is depended on proper
* regex formatting which is done by the convertStringToSettingsRegex function defined below.
*
* @param settingsString The value that may match one of the setting options.
* @param validSettingFormatRegEx The settings options through which to check all options. If one of these regex
* values match on the string we break from the loop returning the found value.
*
* @returns the user entered data if the setting is a match, or null if non of the options matched.
*/
function getSettingsDataFromKeys(settingsString, validSettingFormatRegEx) {
for (let i = 0; i < validSettingFormatRegEx.length; i++) {
let regexSearchData = validSettingFormatRegEx[i].exec(settingsString);
if (regexSearchData !== null) {
return regexSearchData[1].trim();
}
}
return null;
}
function parseSingleColumnSettings(settingsStr, originalSettings) {
let settingsLines = settingsStr.split("\n");
for (let i = 0; i < settingsLines.length; i++) {
let settingsLine = settingsLines[i];
let settingsData = getSettingsDataFromKeys(settingsLine, COL_POSITION_REGEX_ARR);
if (settingsData !== null) {
originalSettings.columnPosition = parseForSingleColumnLocation(settingsData);
}
settingsData = getSettingsDataFromKeys(settingsLine, COL_SIZE_OPTION_REGEX_ARR);
if (settingsData !== null) {
originalSettings.columnSize = parseForSingleColumnSize(settingsData);
}
}
return originalSettings;
}
function parseColumnSettings(settingsStr) {
let parsedSettings = getDefaultMultiColumnSettings();
let settingsLines = settingsStr.split("\n");
for (let i = 0; i < settingsLines.length; i++) {
let settingsLine = settingsLines[i];
let settingsData = getSettingsDataFromKeys(settingsLine, NUMBER_OF_COLUMNS_REGEX_ARR);
if (settingsData !== null) {
let numOfCols = parseInt(settingsData);
if (Number.isNaN(numOfCols) === false) {
if (numOfCols >= 1 && numOfCols <= 3) {
parsedSettings.numberOfColumns = numOfCols;
}
}
}
settingsData = getSettingsDataFromKeys(settingsLine, LARGEST_COLUMN_REGEX_ARR);
if (settingsData !== null) {
let userDefLayout = ColumnLayout[settingsData];
if (userDefLayout !== undefined) {
parsedSettings.columnLayout = userDefLayout;
parsedSettings.columnPosition = userDefLayout;
}
}
settingsData = getSettingsDataFromKeys(settingsLine, DRAW_BORDER_REGEX_ARR);
if (settingsData !== null) {
let isBorderDrawn = BorderOption[settingsData];
if (isBorderDrawn !== undefined) {
switch (isBorderDrawn) {
case (BorderOption.disabled):
case (BorderOption.off):
case (BorderOption.false):
parsedSettings.drawBorder = false;
break;
}
}
}
settingsData = getSettingsDataFromKeys(settingsLine, DRAW_SHADOW_REGEX_ARR);
if (settingsData !== null) {
let isShadowDrawn = ShadowOption[settingsData];
if (isShadowDrawn !== undefined) {
switch (isShadowDrawn) {
case (ShadowOption.disabled):
case (ShadowOption.off):
case (ShadowOption.false):
parsedSettings.drawShadow = false;
break;
}
}
}
settingsData = getSettingsDataFromKeys(settingsLine, AUTO_LAYOUT_REGEX_ARR);
if (settingsData !== null) {
if (settingsData === "true") {
parsedSettings.autoLayout = true;
}
}
settingsData = getSettingsDataFromKeys(settingsLine, COLUMN_SPACING_REGEX_ARR);
if (settingsData !== null) {
let parsed = getLengthUnit(settingsData.trim());
let spacingStr = "";
if (parsed.isValid) {
let noUnitsStr = settingsData.replace(parsed.unitStr, "").trim();
let noUnitsNum = parseInt(noUnitsStr);
if (isNaN(noUnitsNum) === false) {
spacingStr = `${noUnitsStr}${parsed.unitStr}`;
}
}
else {
let noUnitsNum = parseInt(settingsData.trim());
if (isNaN(noUnitsNum) === false) {
spacingStr = `${noUnitsNum}pt`;
}
}
parsedSettings.columnSpacing = spacingStr;
}
settingsData = getSettingsDataFromKeys(settingsLine, CONTENT_OVERFLOW_REGEX_ARR);
if (settingsData !== null) {
let overflowType = ContentOverflowType.scroll;
settingsData = settingsData.toLowerCase().trim();
if (settingsData === "hidden") {
overflowType = ContentOverflowType.hidden;
}
parsedSettings.contentOverflow = overflowType;
}
settingsData = getSettingsDataFromKeys(settingsLine, ALIGNMENT_REGEX_ARR);
if (settingsData !== null) {
let alignmentType = AlignmentType.left;
settingsData = settingsData.toLowerCase().trim();
if (settingsData === "center") {
alignmentType = AlignmentType.center;
}
if (settingsData === "right") {
alignmentType = AlignmentType.right;
}
parsedSettings.alignment = alignmentType;
}
}
return parsedSettings;
}
function getLengthUnit(lengthStr) {
let lastChar = lengthStr.slice(lengthStr.length - 1);
let lastTwoChars = lengthStr.slice(lengthStr.length - 2);
let unitStr = "";
let isValid = false;
if (lastChar === "%") {
unitStr = lastChar;
isValid = true;
}
else if (lastTwoChars === "cm" ||
lastTwoChars === "mm" ||
lastTwoChars === "in" ||
lastTwoChars === "px" ||
lastTwoChars === "pt" ||
lastTwoChars === "pc" ||
lastTwoChars === "em" ||
lastTwoChars === "ex" ||
lastTwoChars === "ch" ||
lastTwoChars === "vw" ||
lastTwoChars === "vh") {
unitStr = lastTwoChars;
isValid = true;
}
return { isValid: isValid, unitStr: unitStr };
}
const CODEBLOCK_REGION_ID_REGEX_STRS = [
"id",
"region id"
];
const CODEBLOCK_REGION_ID_REGEX_ARR = CODEBLOCK_REGION_ID_REGEX_STRS.map(convertStringToSettingsRegex).map((value) => {
return new RegExp(value, "i");
});
function parseStartRegionCodeBlockID(settingsStr) {
let codeBlockRegionID = "";
let settingsLines = settingsStr.split("\n");
for (let i = 0; i < settingsLines.length; i++) {
let settingsLine = settingsLines[i];
let settingsData = getSettingsDataFromKeys(settingsLine, CODEBLOCK_REGION_ID_REGEX_ARR);
if (settingsData !== null) {
codeBlockRegionID = settingsData;
}
}
return codeBlockRegionID;
}
function parseForSingleColumnLocation(locationString) {
switch (locationString.toLowerCase().trim().replace(" ", "")) {
case "left":
case "leftside":
case "leftmargin":
case "leftalign":
case "leftaligned":
case "leftalignement":
case "first":
case "start":
case "beginning":
return ColumnLayout.left;
case "middle":
case "middlealigned":
case "middlealignment":
case "center":
case "centeraligned":
case "centeralignment":
case "centered":
case "standard":
return ColumnLayout.center;
case "right":
case "rightside":
case "rightmargin":
case "rightalign":
case "rightaligned":
case "rightalignment":
case "last":
case "end":
return ColumnLayout.right;
}
return ColumnLayout.center;
}
function parseForSingleColumnSize(sizeString) {
switch (sizeString = sizeString.toLowerCase().trim().replace(" ", "")) {
case "small":
case "sm":
return SingleColumnSize.small;
case "medium":
case "med":
return SingleColumnSize.medium;
case "large":
case "lg":
return SingleColumnSize.large;
case "full":
case "full size":
return SingleColumnSize.full;
}
return SingleColumnSize.medium;
}
function convertStringToSettingsRegex(originalString) {
originalString = originalString.replace(" ", " *");
let regexString = `(?:${originalString} *: *)(.*)`;
return regexString;
}
/*
* 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(:?[a-zA-Z0-9-_\\s]*)?",
"=== *multi-column-start(:?[a-zA-Z0-9-_\\s]*)?"];
const START_REGEX_ARR = [];
for (let i = 0; i < START_REGEX_STRS.length; i++) {
START_REGEX_ARR.push(new RegExp(START_REGEX_STRS[i]));
}
const START_REGEX_STRS_WHOLE_LINE = ["^=== *start-multi-column(:?[a-zA-Z0-9-_\\s]*)?$",
"^=== *multi-column-start(:?[a-zA-Z0-9-_\\s]*)?$"];
const START_REGEX_ARR_WHOLE_LINE = [];
for (let i = 0; i < START_REGEX_STRS_WHOLE_LINE.length; i++) {
START_REGEX_ARR_WHOLE_LINE.push(new RegExp(START_REGEX_STRS_WHOLE_LINE[i]));
}
function findStartTag(text) {
let found = false;
let startPosition = -1;
let matchLength = 0;
for (let i = 0; i < START_REGEX_ARR.length; i++) {
let regexData = START_REGEX_ARR[i].exec(text);
if (regexData !== null && regexData.length > 0) {
startPosition = regexData.index;
matchLength = regexData[0].length;
let line = text.slice(startPosition, startPosition + matchLength);
if (START_REGEX_ARR_WHOLE_LINE[i].test(line)) {
found = true;
break;
}
}
}
let endPosition = startPosition + matchLength;
return { found, startPosition, endPosition, matchLength };
}
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) {
// We want to find the first end tag in the text.
// So here we loop backwards, slicing off the tail until
// there are no more end tags available
let lastValidData = getEndTagData(text);
let workingRegexData = lastValidData;
while (workingRegexData.found === true) {
lastValidData = workingRegexData;
text = text.slice(0, workingRegexData.startPosition);
workingRegexData = getEndTagData(text);
}
return lastValidData;
}
function containsEndTag(text) {
return findEndTag(text).found;
}
function getEndTagData(text) {
let found = false;
let startPosition = -1;
let endPosition = -1;
let matchLength = 0;
for (let i = 0; i < END_REGEX_ARR.length; i++) {
let regexData = END_REGEX_ARR[i].exec(text);
if (regexData !== null && regexData.length > 0) {
found = true;
startPosition = regexData.index;
matchLength = regexData[0].length;
break;
}
}
endPosition = startPosition + matchLength;
return { found, startPosition, endPosition, matchLength };
}
const COL_REGEX_STRS = ["=== *column-end *===",
"=== *end-column *===",
"=== *column-break *===",
"=== *break-column *===",
"--- *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_ELEMENT_INNER_TEXT_REGEX_STRS = ["= *column-end *=",
"= *end-column *=",
"= *column-break *=",
"= *break-column *="];
const COL_ELEMENT_INNER_TEXT_REGEX_ARR = [];
for (let i = 0; i < COL_ELEMENT_INNER_TEXT_REGEX_STRS.length; i++) {
COL_ELEMENT_INNER_TEXT_REGEX_ARR.push(new RegExp(COL_ELEMENT_INNER_TEXT_REGEX_STRS[i]));
}
function elInnerTextContainsColEndTag(text) {
let found = false;
for (let i = 0; i < COL_ELEMENT_INNER_TEXT_REGEX_ARR.length; i++) {
if (COL_ELEMENT_INNER_TEXT_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 findSettingsCodeblock(text) {
let found = false;
let startPosition = -1;
let endPosition = -1;
let matchLength = 0;
for (let i = 0; i < COL_SETTINGS_REGEX_ARR.length; i++) {
let regexData = COL_SETTINGS_REGEX_ARR[i].exec(text);
if (regexData !== null && regexData.length > 0) {
found = true;
startPosition = regexData.index;
matchLength = regexData[0].length;
endPosition = startPosition + matchLength;
let remainingText = text.slice(endPosition);
regexData = CODEBLOCK_END_REGEX.exec(remainingText);
if (regexData !== null && regexData.length > 0) {
found = true;
endPosition += regexData.index + regexData[0].length;
}
break;
}
}
return { found, startPosition, endPosition, matchLength };
}
const CODEBLOCK_START_REGEX_STR = [
"multi-column-start",
"start-multi-column"
].reduce((prev, cur) => {
if (prev === "") {
return cur;
}
return `${prev}|${cur}`;
}, "");
const START_CODEBLOCK_REGEX = new RegExp(`\`\`\`(:?${CODEBLOCK_START_REGEX_STR})(.*?)\`\`\``, "ms");
function findStartCodeblock(text) {
let found = false;
let startPosition = -1;
let endPosition = -1;
let matchLength = 0;
let regexData = START_CODEBLOCK_REGEX.exec(text);
if (regexData !== null && regexData.length > 0) {
found = true;
startPosition = regexData.index;
matchLength = regexData[0].length;
endPosition = startPosition + matchLength;
}
return { found, startPosition, endPosition, matchLength };
}
function containsStartCodeBlock(text) {
return findStartCodeblock(text).found;
}
function containsRegionStart(text) {
return containsStartCodeBlock(text) || containsStartTag(text);
}
function countStartTags(initialText) {
let keys = [];
let text = initialText;
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);
}
text = initialText;
startTagData = findStartCodeblock(text);
while (startTagData.found) {
let settingsText = text.slice(startTagData.startPosition, startTagData.endPosition);
text = text.slice(startTagData.endPosition);
let key = parseStartRegionCodeBlockID(settingsText);
if (key === null) {
key = "";
}
keys.push(key);
// Search again for another tag before looping.
startTagData = findStartCodeblock(text);
}
return { numberOfTags: keys.length, keys };
}
function getStartBlockOrCodeblockAboveLine(linesAboveArray) {
let startBlock = getStartBlockAboveLine(linesAboveArray);
if (startBlock !== null) {
return startBlock;
}
let codeBlock = getStartCodeBlockAboveLine(linesAboveArray);
if (codeBlock !== null) {
return codeBlock;
}
return null;
}
/**
* 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);
}
}
if (startBlockKey === "") {
let codeBlockData = parseCodeBlockStart(linesAboveArray);
if (codeBlockData !== null) {
startBlockKey = codeBlockData.id;
if (codeBlockData.index > 0) {
linesAboveArray = linesAboveArray.slice(codeBlockData.index + 1);
}
}
}
return { startBlockKey, linesAboveArray };
}
function getStartCodeBlockAboveLine(linesAboveArray) {
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.
linesAboveStr = linesAboveStr.slice(endTagSerachData.endPosition);
endTagSerachData = findEndTag(linesAboveStr);
}
let startCodeBlockData = findStartCodeblock(linesAboveStr);
let codeBlockText = linesAboveStr.slice(startCodeBlockData.startPosition, startCodeBlockData.endPosition);
let startBlockKey = "";
if (startCodeBlockData.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 (startCodeBlockData.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.
codeBlockText = linesAboveStr.slice(startCodeBlockData.startPosition, startCodeBlockData.endPosition);
startBlockKey = parseStartRegionCodeBlockID(codeBlockText);
linesAboveStr = linesAboveStr.slice(startCodeBlockData.endPosition);
startCodeBlockData = findStartCodeblock(linesAboveStr);
}
}
let retLinesAboveArray = linesAboveStr.split("\n");
return { startBlockKey, linesAboveArray: retLinesAboveArray };
}
function getEndBlockBelow(linesBelow) {
// 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 linesBelowStr = linesBelow.reduce((prev, current) => {
return prev + "\n" + current;
}, "");
let endTagSerachData = findEndTag(linesBelowStr);
let startTagSearchData = findStartTag(linesBelowStr);
let sliceEndIndex = -1; // If neither start or end found we return the entire array.
if (endTagSerachData.found === true && startTagSearchData.found === false) {
sliceEndIndex = endTagSerachData.startPosition;
}
else if (endTagSerachData.found === false && startTagSearchData.found === true) {
sliceEndIndex = startTagSearchData.startPosition;
}
else if (endTagSerachData.found === true && startTagSearchData.found === true) {
sliceEndIndex = endTagSerachData.startPosition;
if (startTagSearchData.startPosition < endTagSerachData.startPosition) {
/**
* If we found a start tag before an end tag we want to use the start tag
* our current block is not properly ended and we use the next start tag
* as our limit
*/
sliceEndIndex = startTagSearchData.startPosition;
}
}
return linesBelow.slice(0, sliceEndIndex);
}
function getStartTagKey(startTag) {
let keySplit = startTag.split(":");
if (keySplit.length > 1) {
return keySplit[1].replace(" ", "");
}
return null;
}
const TAB_HEADER_END_REGEX_STR = "^```$";
const TAB_HEADER_END_REGEX = new RegExp(TAB_HEADER_END_REGEX_STR);
function parseCodeBlockStart(codeBlockLines) {
let id = null;
for (let i = 0; i < codeBlockLines.length; i++) {
let line = codeBlockLines[i];
if (id === null) {
let key = line.split(":")[0];
if (key.toLowerCase() === "region id") {
id = line.split(":")[1].trim();
}
}
else {
if (TAB_HEADER_END_REGEX.test(line)) {
return { id: id, index: i };
}
}
}
if (id === null) {
return null;
}
else {
return { id: id, index: -1 };
}
}
const CODEBLOCK_END_REGEX_STR = "```";
const CODEBLOCK_END_REGEX = new RegExp(CODEBLOCK_END_REGEX_STR);
/*
* 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;
}
/**
* BFS on the child nodes of the passed element searching for the first instance of the
* node type passed. Returning the element found or null if none found.
*
* @param root
* @param nodeTypeName
* @returns
*/
function searchChildrenForNodeType(root, nodeTypeName) {
nodeTypeName = nodeTypeName.toLowerCase();
let queue = [root];
while (queue.length > 0) {
for (let i = 0; i < queue.length; i++) {
let node = queue.shift();
let nodeName = node.nodeName.toLowerCase();
if (nodeName === nodeTypeName) {
return node;
}
for (let i = 0; i < node.children.length; i++) {
queue.push(node.children[i]);
}
}
}
return null;
}
function getLeafSourceMode(fileLeaf) {
return fileLeaf.getViewState().state.mode;
}
function fileStillInView(sourcePath) {
let fileLeaf = getFileLeaf(sourcePath);
if (fileLeaf === null) {
return false;
}
return true;
}
function getFileLeaf(sourcePath) {
let markdownLeaves = app.workspace.getLeavesOfType("markdown");
if (markdownLeaves.length === 0) {
return null;
}
for (let i = 0; i < markdownLeaves.length; i++) {
if (markdownLeaves[i].getViewState().state.file === sourcePath) {
return markdownLeaves[i];
}
}
return null;
}
var ElementRenderType;
(function (ElementRenderType) {
ElementRenderType[ElementRenderType["undefined"] = 0] = "undefined";
ElementRenderType[ElementRenderType["normalRender"] = 1] = "normalRender";
ElementRenderType[ElementRenderType["specialRender"] = 2] = "specialRender";
ElementRenderType[ElementRenderType["specialSingleElementRender"] = 3] = "specialSingleElementRender";
ElementRenderType[ElementRenderType["canvasRenderElement"] = 4] = "canvasRenderElement";
ElementRenderType[ElementRenderType["unRendered"] = 5] = "unRendered";
})(ElementRenderType || (ElementRenderType = {}));
function getElementRenderType(element) {
/**
* The Dataview plugin needs to be constantly checked if the clone should be
* updated but should not always update the "dual render" aspect, so we add
* a special case for that plugin and maybe others in the future.
*/
if (hasDataview(element) === true ||
isInternalEmbed(element)) {
return ElementRenderType.specialSingleElementRender;
}
/**
* Some types of content are rendered in canvases which are not rendered properly
* when we clone the original node. Here we are flagging the element as a canvas
* element so we can clone the canvas to a copy element within the region.
*
*/
if (hasDataviewJS(element) === true) {
return ElementRenderType.canvasRenderElement;
}
/**
* Look for specific kinds of elements by their CSS class names here. These
* are going to be brittle links as they rely on other plugin definitions but
* as this is only adding in extra compatability to the plugins defined here
* it should be ok.
*
* These may be classes on one of the simple elements (such as a paragraph)
* that we search for below so need to look for these first.
*/
if (hasDiceRoller(element) === true ||
hasCopyButton(element) === true ||
hasAdmonitionFold(element) === true) {
return ElementRenderType.specialRender;
}
/**
* This checks for special types of elements that should be rendered normally. Is
* slightly redundant with next check but differentiates between types of ements
* being checked.
*/
if (hasAdmonition(element) === true ||
isIFrame(element) === true) {
return ElementRenderType.normalRender;
}
/**
* If we didnt find a special element we want to check for simple elements
* such as paragraphs or lists. In the current implementation we only set up
* the special case for "specialRender" elements so this *should* be saving
* some rendering time by setting these tags properly.
*/
if (hasParagraph(element) ||
hasHeader(element) ||
hasList(element) ||
isHorizontalRule(element) ||
isTable(element)) {
return ElementRenderType.normalRender;
}
// If still nothing found we return other as the default response if nothing else found.
return ElementRenderType.specialRender;
}
function hasParagraph(element) {
return element.innerHTML.startsWith("
0) {
return element.firstChild.nodeName.toLowerCase() === "iframe";
}
return false;
}
function isHorizontalRule(element) {
return element.innerHTML.startsWith("
1) {
console.debug("Found multiple heading collapse indicators in element.");
}
return null;
}
/*
* 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
*/
const UPDATE_TIMES = [250, 20000];
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(element, linesOfElement, randomID = getUID(), tag = DOMObjectTag.none) {
this.clonedElement = null;
this.elementType = ElementRenderType.undefined;
this.elementContainer = null;
this.elementRenderedHeight = 0;
this.canvasElementUpdateTime = Date.now();
this.canvasTimerIndex = 0;
this.lastClonedElementUpdateTime = Date.now();
this.updateTimerIndex = 0;
this.nodeKey = element.innerText.trim();
this.originalElement = element;
this.UID = randomID;
this.tag = tag;
this.usingOriginalElement = false;
this.linesOfElement = linesOfElement;
if (this.tag === DOMObjectTag.none) {
this.setDomObjectTag();
}
}
setMainDOMElement(domElement) {
this.originalElement = domElement;
this.usingOriginalElement = true;
}
clonedElementReadyForUpdate() {
let deltaTime = Date.now() - this.lastClonedElementUpdateTime;
if (deltaTime > UPDATE_TIMES[this.updateTimerIndex]) {
return true;
}
return false;
}
canvasReadyForUpdate() {
let deltaTime = Date.now() - this.canvasElementUpdateTime;
if (deltaTime > UPDATE_TIMES[this.canvasTimerIndex]) {
this.canvasElementUpdateTime = Date.now();
this.canvasTimerIndex = Math.clamp(this.canvasTimerIndex + 1, 0, UPDATE_TIMES.length - 1);
return true;
}
return false;
}
updateClonedElement(newClonedElement) {
this.clonedElement = newClonedElement;
this.lastClonedElementUpdateTime = Date.now();
this.updateTimerIndex = Math.clamp(this.updateTimerIndex + 1, 0, UPDATE_TIMES.length - 1);
}
setDomObjectTag() {
let elementTextSpaced = this.linesOfElement.reduce((prev, curr) => {
return prev + "\n" + curr;
});
if (containsEndTag(this.originalElement.textContent) === true) {
this.elementType = ElementRenderType.unRendered;
this.tag = DOMObjectTag.endRegion;
// el.addClass(MultiColumnStyleCSS.RegionEndTag)
// regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.endRegion);
}
else if (containsColEndTag(this.originalElement.textContent) === true ||
(this.originalElement.innerHTML.startsWith("")) && elInnerTextContainsColEndTag(this.originalElement.textContent)) {
this.elementType = ElementRenderType.unRendered;
this.tag = DOMObjectTag.columnBreak;
// el.addClass(MultiColumnStyleCSS.ColumnEndTag)
// regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.columnBreak);
}
else if (containsStartTag(this.originalElement.textContent) === true) {
this.elementType = ElementRenderType.unRendered;
this.tag = DOMObjectTag.startRegion;
// el.addClass(MultiColumnStyleCSS.ColumnEndTag)
// regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.columnBreak);
}
else if (containsColSettingsTag(elementTextSpaced) === true) {
this.elementType = ElementRenderType.unRendered;
// el.addClass(MultiColumnStyleCSS.RegionSettings)
// regionalManager = regionalContainer.setRegionSettings(elementTextSpaced)
// regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.regionSettings);
}
}
}
class TaskListDOMObject extends DOMObject {
constructor(baseDOMObject) {
super(baseDOMObject.originalElement, baseDOMObject.linesOfElement, baseDOMObject.UID, DOMObjectTag.none);
this.originalCheckboxes = [];
}
checkboxClicked(index) {
if (index < this.originalCheckboxes.length) {
let originalInput = this.originalCheckboxes[index].firstChild;
originalInput.click();
}
}
static checkForTaskListElement(domElement) {
if (domElement.originalElement.getElementsByClassName("task-list-item").length > 0) {
return new TaskListDOMObject(domElement);
}
return domElement;
}
}
/*
* File: multi-column-markdown/src/utilities/cssDefinitions.ts
* Created Date: Wednesday, February 16th 2022, 11:09:06 am
* Author: Cameron Robinson
*
* Copyright (c) 2022 Cameron Robinson
*/
var MultiColumnLayoutCSS;
(function (MultiColumnLayoutCSS) {
MultiColumnLayoutCSS["RegionRootContainerDiv"] = "mcm-column-root-container";
MultiColumnLayoutCSS["RegionErrorContainerDiv"] = "mcm-column-error-region-wrapper";
MultiColumnLayoutCSS["RegionContentContainerDiv"] = "mcm-column-region-wrapper";
MultiColumnLayoutCSS["RegionColumnContainerDiv"] = "mcm-column-parent-container";
MultiColumnLayoutCSS["ColumnDualElementContainer"] = "mcm-column-element-wrapper";
MultiColumnLayoutCSS["OriginalElementType"] = "mcm-original-column-element";
MultiColumnLayoutCSS["ClonedElementType"] = "mcm-cloned-column-element";
MultiColumnLayoutCSS["ContentOverflowAutoScroll"] = "mcm-content-overflow-auto-scroll";
MultiColumnLayoutCSS["ContentOverflowHidden"] = "mcm-content-overflow-hidden";
MultiColumnLayoutCSS["AlignmentLeft"] = "mcm-content-alignment-left";
MultiColumnLayoutCSS["AlignmentCenter"] = "mcm-content-alignment-center";
MultiColumnLayoutCSS["AlignmentRight"] = "mcm-content-alignment-right";
// ------------------------------------------------------ //
MultiColumnLayoutCSS["SingleColumnSmall"] = "mcm-single-column-small";
MultiColumnLayoutCSS["SingleColumnMed"] = "mcm-single-column-medium";
MultiColumnLayoutCSS["SingleColumnLarge"] = "mcm-single-column-large";
MultiColumnLayoutCSS["SingleColumnFull"] = "mcm-single-column-full";
MultiColumnLayoutCSS["SingleColumnLeftLayout"] = "mcm-singlecol-layout-left";
MultiColumnLayoutCSS["SingleColumnCenterLayout"] = "mcm-singlecol-layout-center";
MultiColumnLayoutCSS["SingleColumnRightLayout"] = "mcm-singlecol-layout-right";
// ------------------------------------------------------ //
MultiColumnLayoutCSS["TwoEqualColumns"] = "mcm-two-equal-columns";
MultiColumnLayoutCSS["TwoColumnSmall"] = "mcm-two-column-small";
MultiColumnLayoutCSS["TwoColumnLarge"] = "mcm-two-column-large";
// ------------------------------------------------------ //
MultiColumnLayoutCSS["ThreeEqualColumns"] = "mcm-three-equal-columns";
MultiColumnLayoutCSS["ThreeColumn_Large"] = "mcm-three-column-large";
MultiColumnLayoutCSS["ThreeColumn_Small"] = "mcm-three-column-small";
})(MultiColumnLayoutCSS || (MultiColumnLayoutCSS = {}));
var MultiColumnStyleCSS;
(function (MultiColumnStyleCSS) {
MultiColumnStyleCSS["RegionErrorMessage"] = "mcm-column-error-message";
MultiColumnStyleCSS["RegionSettings"] = "mcm-column-settings-wrapper";
MultiColumnStyleCSS["RegionContent"] = "mcm-column-content-wrapper";
MultiColumnStyleCSS["RegionEndTag"] = "mcm-column-end-tag-wrapper";
MultiColumnStyleCSS["ColumnEndTag"] = "mcm-column-break-tag-wrapper";
MultiColumnStyleCSS["RegionShadow"] = "mcm-region-shadow";
MultiColumnStyleCSS["ColumnShadow"] = "mcm-column-shadow";
MultiColumnStyleCSS["ColumnBorder"] = "mcm-column-border";
MultiColumnStyleCSS["ColumnContent"] = "mcm-column-div";
})(MultiColumnStyleCSS || (MultiColumnStyleCSS = {}));
/**
* File: /src/dom_manager/regional_managers/RegionManager.ts *
* Created Date: Sunday, May 22nd 2022, 7:49 pm *
* Author: Cameron Robinson *
* *
* Copyright (c) 2022 Cameron Robinson *
*/
class RegionManager {
constructor(data) {
this.domList = [];
this.domObjectMap = new Map();
this.regionalSettings = getDefaultMultiColumnSettings();
this.domList = data.domList;
this.domObjectMap = data.domObjectMap;
this.regionParent = data.regionParent;
this.fileManager = data.fileManager;
this.regionalSettings = data.regionalSettings;
this.regionKey = data.regionKey;
}
get regionParent() {
return this._regionParent;
}
set regionParent(value) {
this._regionParent = value;
}
getRegionData() {
return {
domList: this.domList,
domObjectMap: this.domObjectMap,
regionParent: this.regionParent,
fileManager: this.fileManager,
regionalSettings: this.regionalSettings,
regionKey: this.regionKey,
rootElement: null
};
}
addObject(siblingsAbove, siblingsBelow, obj) {
let nextObj = siblingsBelow.children[0];
let addAtIndex = siblingsAbove.children.length;
if (siblingsAbove.children.length > 0) {
/**
* We want to find the first sibling withouth "" for an inner text so we can use that to anchor our
* element into the domList. For most items the first element before our new element will have the proper
* innerText. Sometimes other elements are empty and were causing issues.
*
* Now we loop back through the previous siblings looking for the first one with a valid inner text and using that
* as the anchor and offsetting our addAtIndex by the number of empty string elements we found.
*/
let prevSiblingInnerText = "";
let prevSiblingOffset = 0;
for (let i = siblingsAbove.children.length - 1; i >= 0; i--) {
let obj = siblingsAbove.children[i];
if (obj.innerText !== "") {
prevSiblingInnerText = obj.innerText;
break;
}
prevSiblingOffset++;
}
for (let i = this.domList.length - 1; i >= 0; i--) {
if (this.domList[i].nodeKey === prevSiblingInnerText) {
addAtIndex = i + 1 + prevSiblingOffset;
break;
}
}
}
let nextElIndex = addAtIndex;
if (nextObj !== undefined) {
nextObj.innerText;
for (let i = addAtIndex; i < this.domList.length; i++) {
if (this.domList[i].nodeKey === nextObj.innerText.trim()) {
nextElIndex = i;
break;
}
}
}
// console.log(" Prev: ", Array.from(siblingsAbove.children).slice(-3), "Adding: ", obj.originalElement, " Next: ", siblingsBelow.children[0], "Overwriting:", this.domList.slice(addAtIndex, nextElIndex));
this.domList.splice(addAtIndex, nextElIndex - addAtIndex, obj);
this.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 = this.domList.slice(0);
// console.log(x);
return addAtIndex;
}
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 = this.domObjectMap.get(objectUID);
this.domObjectMap.delete(objectUID);
if (obj === undefined) {
return;
}
if (this.domList.contains(obj)) {
this.domList.remove(obj);
}
if (this.domList.length === 0 && this.fileManager !== null) {
this.fileManager.removeRegion(this.regionKey);
}
// x = domList.slice(0);
// console.log(x);
}
updateElementTag(objectUID, newTag) {
let obj = this.domObjectMap.get(objectUID);
let index = this.domList.indexOf(obj);
if (index !== -1) {
this.domList[index].tag = newTag;
}
}
setRegionalSettings(regionSettings) {
this.regionalSettings = regionSettings;
}
/**
* 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.
*/
getRegionRenderData() {
return {
parentRenderElement: this.regionParent,
parentRenderSettings: this.regionalSettings,
domObjects: this.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.
*/
displayOriginalElements() {
for (let i = 0; i < this.domList.length; i++) {
if (this.domList[i].originalElement) {
this.domList[i].originalElement.removeClasses([MultiColumnStyleCSS.RegionEndTag,
MultiColumnStyleCSS.ColumnEndTag,
MultiColumnStyleCSS.RegionSettings,
MultiColumnStyleCSS.RegionContent]);
if (this.domList[i].originalElement.parentElement) {
this.domList[i].originalElement.parentElement.removeChild(this.domList[i].originalElement);
}
}
}
}
getID() {
return this.regionKey;
}
updateRenderedMarkdown() {
/**
* This function acts as the update loop for the multi-column regions.
* Here we loop through all of the elements within the rendered region and
* potentially update how things are rendered. We need to do this for
* compatability with other plugins.
*
* If the multi-column region is rendered before other plugins that effect
* content within the region our rendered data may not properly display
* the content from the other plugin. Here we loop through the elements
* after all plugins have had a chance to run and can make changes to the
* DOM at this point.
*/
for (let i = 0; i < this.domList.length; i++) {
/**
* Here we check for special cases
*/
if (this.domList[i] instanceof TaskListDOMObject) {
this.fixClonedCheckListButtons(this.domList[i]);
}
let elementType = this.domList[i].elementType;
/**
* If the element is not currently a special render element we check again
* as the original element may have been updated.
*
* TODO: find a way to "Officially" mark normal elements rather than
* continuously search for special render types.
*/
if (elementType !== ElementRenderType.specialRender &&
elementType !== ElementRenderType.specialSingleElementRender &&
elementType !== ElementRenderType.unRendered) {
// If the new result returns as a special renderer we update so
// this wont run again for this item.
elementType = getElementRenderType(this.domList[i].originalElement);
this.domList[i].originalElement.clientHeight;
}
if (elementType === ElementRenderType.specialRender ||
elementType === ElementRenderType.specialSingleElementRender ||
elementType === ElementRenderType.canvasRenderElement) {
this.domList[i].elementType = elementType;
this.setUpDualRender(this.domList[i]);
}
}
}
/**
* This function takes in the original element and its clone and checks if
* the element contains a task-list-item class. If so it loops through all
* items in the list and fixes their checkboxes to properly fire an event.
* The new checkbox calls the click function on the original checkbox so
* compatability with other plugins *should* remain.
* @param domElement
* @param initalizeCheckboxes
*/
fixClonedCheckListButtons(domElement, initalizeCheckboxes = false) {
if (domElement.originalElement === null || domElement.clonedElement === null) {
return;
}
let element = domElement.originalElement;
let clonedElement = domElement.clonedElement;
let clonedListCheckboxes = Array.from(clonedElement.getElementsByClassName("task-list-item"));
let originalListCheckboxes = Array.from(element.getElementsByClassName("task-list-item"));
if (initalizeCheckboxes === true) {
// When we initalize we remove the old input checkbox that contains
// the weird callback situation causing the bug. Then we create a new
// checkbox to replace it and set it up to fire the click event on
// the original checkbox so functionality is restored.
for (let i = 0; i < originalListCheckboxes.length; i++) {
const checkbox = createEl('input');
let originalInput = originalListCheckboxes[i].firstChild;
checkbox.checked = originalInput.checked;
clonedListCheckboxes[i].replaceChild(checkbox, clonedListCheckboxes[i].children[0]);
checkbox.addClass('task-list-item-checkbox');
checkbox.type = 'checkbox';
checkbox.onClickEvent(() => {
domElement.checkboxClicked(i);
});
}
}
else {
// Whenever we reach this point we update our list of original checkboxes
// that may be different from our cache. This is due to how obsidian
// changes the DOM underneath us so we need to constantly update our cache.
domElement.originalCheckboxes = originalListCheckboxes;
}
// When the Tasks plugin is installed the cloned copy of the original element contains
// an extra element for some reason. If this occurs for other reasons here we adjust
// that to keep the clone the same as the original.
if (clonedListCheckboxes.length > originalListCheckboxes.length) {
for (let i = originalListCheckboxes.length; i < clonedListCheckboxes.length; i++) {
domElement.clonedElement.removeChild(clonedListCheckboxes[i]);
}
}
}
setUpDualRender(domElement) {
/**
* If our element is of "specialRender" type it *may* need to be rendered
* using the original element rather than a copy. For example, an element
* may have an onClick event that would not get coppied to the clone.
*
* If we just moved these elements into the region it would get
* moved back out into the original location in the DOM by obsidian
* when scrolling or when the file is updated. On the next refresh it
* would be moved back but that can lead to a region jumping
* around as the item is moved in and out.
*
* Here we set up the div to contain the element and create
* a visual only clone of it. The clone will only be visible
* when the original is not in the multi-column region so it
* saves us from the visual noise of the region jumping around.
*/
let originalElement = domElement.originalElement;
let clonedElement = domElement.clonedElement;
let containerElement = domElement.elementContainer;
// Get height of the original and cloned element. If the element is not currently rendered
// it will have 0 height so we need to temporarily render it to get the height.
let originalElementHeight = getElementClientHeight(originalElement, containerElement);
let clonedElementHeight = getElementClientHeight(clonedElement, containerElement);
/**
* We only want to clone the element once to reduce GC. But if the cloned
* element's height is not equal to the original element, this means the
* item element has been updated somewhere else without the dom being
* refreshed. This can occur when elements are updated by other plugins,
* such as Dataview.
*/
if ((clonedElement === null ||
Math.abs(clonedElementHeight - originalElementHeight) > 10 ||
domElement.clonedElementReadyForUpdate() === true) &&
domElement.elementType !== ElementRenderType.canvasRenderElement) {
// console.log("Updating Cloned Element.", clonedElementHeight, originalElementHeight)
// Update clone and reference.
cloneElement();
}
if (domElement.elementType === ElementRenderType.canvasRenderElement &&
domElement.canvasReadyForUpdate()) {
// console.log("Updating canvas re-render")
containerElement.appendChild(originalElement);
function cloneCanvas(originalCanvas) {
//create a new canvas
let clonedCanvas = originalCanvas.cloneNode(true);
let context = clonedCanvas.getContext('2d');
//set dimensions
clonedCanvas.width = originalCanvas.width;
clonedCanvas.height = originalCanvas.height;
if (clonedCanvas.width === 0 || clonedCanvas.height === 0) {
// Dont want to render if the width is 0 as it throws an error
// would happen if the old canvas hasnt been rendered yet.
return clonedCanvas;
}
//apply the old canvas to the new one
context.drawImage(originalCanvas, 0, 0);
//return the new canvas
return clonedCanvas;
}
let canvas = searchChildrenForNodeType(originalElement, "canvas");
if (canvas !== null) {
domElement.updateClonedElement(originalElement.cloneNode(true));
clonedElement = domElement.clonedElement;
clonedElement.addClass(MultiColumnLayoutCSS.ClonedElementType);
clonedElement.removeClasses([MultiColumnStyleCSS.RegionContent, MultiColumnLayoutCSS.OriginalElementType]);
containerElement.appendChild(clonedElement);
for (let i = clonedElement.children.length - 1; i >= 0; i--) {
clonedElement.children[i].detach();
}
clonedElement.appendChild(cloneCanvas(canvas));
}
containerElement.removeChild(originalElement);
}
/**
* If the container element has less than 2 children we need to move the
* original element back into it. However some elements constantly get moved
* in and out causing some unwanted behavior. Those element will be tagged
* as specialSingleElementRender so we ignore those elements here.
*/
if (domElement.elementContainer.children.length < 2 &&
domElement.elementType !== ElementRenderType.specialSingleElementRender &&
domElement.elementType !== ElementRenderType.canvasRenderElement) {
// console.log("Updating dual rendering.", domElement, domElement.originalElement.parentElement, domElement.originalElement.parentElement?.childElementCount);
// Make sure our CSS is up to date.
originalElement.addClass(MultiColumnLayoutCSS.OriginalElementType);
clonedElement.addClass(MultiColumnLayoutCSS.ClonedElementType);
clonedElement.removeClasses([MultiColumnStyleCSS.RegionContent, MultiColumnLayoutCSS.OriginalElementType]);
for (let i = containerElement.children.length - 1; i >= 0; i--) {
containerElement.children[i].detach();
}
containerElement.appendChild(originalElement);
containerElement.appendChild(clonedElement);
}
function cloneElement() {
domElement.updateClonedElement(originalElement.cloneNode(true));
clonedElement = domElement.clonedElement;
/**
* If we updated the cloned element, we want to also update the
* element rendered in the parent container.
*/
for (let i = containerElement.children.length - 1; i >= 0; i--) {
containerElement.children[i].detach();
}
// Update CSS, we add cloned class and remove classes from originalElement that do not apply.
clonedElement.addClass(MultiColumnLayoutCSS.ClonedElementType);
clonedElement.removeClasses([MultiColumnStyleCSS.RegionContent, MultiColumnLayoutCSS.OriginalElementType]);
containerElement.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.
*/
getColumnContentDivs(settings, multiColumnParent) {
let columnContentDivs = [];
let styleStr = "";
if (settings.columnSpacing !== "") {
styleStr = `margin-inline: ${settings.columnSpacing};`;
}
if (settings.numberOfColumns === 2) {
switch (settings.columnLayout) {
case (ColumnLayout.standard):
case (ColumnLayout.middle):
case (ColumnLayout.center):
case (ColumnLayout.third):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoEqualColumns}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoEqualColumns}`
}));
break;
case (ColumnLayout.left):
case (ColumnLayout.first):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoColumnLarge}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoColumnSmall}`
}));
break;
case (ColumnLayout.right):
case (ColumnLayout.second):
case (ColumnLayout.last):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoColumnSmall}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.TwoColumnLarge}`
}));
break;
}
}
else if (settings.numberOfColumns === 3) {
switch (settings.columnLayout) {
case (ColumnLayout.standard):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeEqualColumns}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeEqualColumns}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeEqualColumns}`
}));
break;
case (ColumnLayout.left):
case (ColumnLayout.first):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Large}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
break;
case (ColumnLayout.middle):
case (ColumnLayout.center):
case (ColumnLayout.second):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Large}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
break;
case (ColumnLayout.right):
case (ColumnLayout.third):
case (ColumnLayout.last):
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Small}`
}));
multiColumnParent.createDiv({
cls: `mcm-column-spacer`,
attr: { "style": styleStr }
});
columnContentDivs.push(multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent} ${MultiColumnLayoutCSS.ThreeColumn_Large}`
}));
break;
}
}
return columnContentDivs;
}
}
function getElementClientHeight(element, parentRenderElement) {
let height = element.clientHeight;
if (height === 0) {
parentRenderElement.appendChild(element);
height = element.clientHeight;
parentRenderElement.removeChild(element);
}
return height;
}
/**
* File: /src/dom_manager/regional_managers/regionDOMManager.ts *
* Created Date: Sunday, May 22nd 2022, 7:46 pm *
* Author: Cameron Robinson *
* *
* Copyright (c) 2022 Cameron Robinson *
*/
class StandardMultiColumnRegionManager extends RegionManager {
renderRegionElementsToScreen() {
this.renderColumnMarkdown(this.regionParent, this.domList, this.regionalSettings);
}
exportRegionElementsToPDF(pdfParentElement) {
// Default set shadow to off for exporting PDFs
let renderSettings = this.regionalSettings;
renderSettings.drawShadow = false;
this.renderColumnMarkdown(pdfParentElement, this.domList.slice(), renderSettings);
}
renderRegionElementsToLivePreview(parentElement) {
this.renderColumnMarkdown(parentElement, this.domList, this.regionalSettings);
}
/**
* 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: MultiColumnLayoutCSS.RegionColumnContainerDiv,
});
/**
* Pass our parent div and settings to parser to create the required
* column divs as children of the parent.
*/
let columnContentDivs = this.getColumnContentDivs(settings, multiColumnParent);
if (settings.drawShadow === true) {
multiColumnParent.addClass(MultiColumnStyleCSS.RegionShadow);
}
for (let i = 0; i < columnContentDivs.length; i++) {
if (settings.drawBorder === true) {
columnContentDivs[i].addClass(MultiColumnStyleCSS.ColumnBorder);
}
if (settings.drawShadow === true) {
columnContentDivs[i].addClass(MultiColumnStyleCSS.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);
this.appendElementsToColumns(regionElements, columnContentDivs, settings);
}
appendElementsToColumns(regionElements, columnContentDivs, settings) {
let columnIndex = 0;
for (let i = 0; i < regionElements.length; i++) {
if (regionElements[i].tag === DOMObjectTag.none ||
regionElements[i].tag === DOMObjectTag.columnBreak) {
// We store the elements in a wrapper container until we determine
let element = createDiv({
cls: MultiColumnLayoutCSS.ColumnDualElementContainer,
});
if (settings.contentOverflow === ContentOverflowType.hidden) {
element.addClass(MultiColumnLayoutCSS.ContentOverflowHidden);
}
else {
element.addClass(MultiColumnLayoutCSS.ContentOverflowAutoScroll);
}
if (settings.alignment === AlignmentType.center) {
element.addClass(MultiColumnLayoutCSS.AlignmentCenter);
}
else if (settings.alignment === AlignmentType.right) {
element.addClass(MultiColumnLayoutCSS.AlignmentRight);
}
else {
element.addClass(MultiColumnLayoutCSS.AlignmentLeft);
}
regionElements[i].elementContainer = element;
// Otherwise we just make a copy of the original element to display.
let clonedElement = regionElements[i].originalElement.cloneNode(true);
let headingCollapseElement = getHeadingCollapseElement(clonedElement);
if (headingCollapseElement !== null) {
// This removes the collapse arrow from the view if it exists.
headingCollapseElement.detach();
}
regionElements[i].clonedElement = clonedElement;
element.appendChild(clonedElement);
if (regionElements[i] instanceof TaskListDOMObject) {
this.fixClonedCheckListButtons(regionElements[i], true);
}
if (element !== null && regionElements[i].tag !== DOMObjectTag.columnBreak) {
columnContentDivs[columnIndex].appendChild(element);
}
/**
* If the tag is a column break we update the column index after
* appending the item to the column div. This keeps the main DOM
* cleaner by removing other items and placing them all within
* a region container.
*/
if (regionElements[i].tag === DOMObjectTag.columnBreak &&
(columnIndex + 1) < settings.numberOfColumns) {
columnIndex++;
}
}
}
}
}
class SingleColumnRegionManager extends RegionManager {
renderRegionElementsToScreen() {
this.renderColumnMarkdown(this.regionParent, this.domList, this.regionalSettings);
}
exportRegionElementsToPDF(pdfParentElement) {
// Default set shadow to off for exporting PDFs
let renderSettings = this.regionalSettings;
renderSettings.drawShadow = false;
this.renderColumnMarkdown(pdfParentElement, this.domList.slice(), renderSettings);
}
renderRegionElementsToLivePreview(parentElement) {
this.renderColumnMarkdown(parentElement, this.domList, this.regionalSettings);
}
/**
* 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: MultiColumnLayoutCSS.RegionColumnContainerDiv,
});
if (isLeftLayout(this.regionalSettings.columnPosition)) {
multiColumnParent.addClass(MultiColumnLayoutCSS.SingleColumnLeftLayout);
}
else if (isRightLayout(this.regionalSettings.columnPosition)) {
multiColumnParent.addClass(MultiColumnLayoutCSS.SingleColumnRightLayout);
}
else {
multiColumnParent.addClass(MultiColumnLayoutCSS.SingleColumnCenterLayout);
}
/**
* Pass our parent div and settings to parser to create the required
* column divs as children of the parent.
*/
let columnContentDiv = this.createColumnContentDivs(multiColumnParent);
if (settings.drawBorder === true) {
columnContentDiv.addClass(MultiColumnStyleCSS.ColumnBorder);
}
if (settings.drawShadow === true) {
columnContentDiv.addClass(MultiColumnStyleCSS.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);
this.appendElementsToColumns(regionElements, columnContentDiv, settings);
}
appendElementsToColumns(regionElements, columnContentDiv, settings) {
for (let i = 0; i < regionElements.length; i++) {
if (regionElements[i].tag === DOMObjectTag.none ||
regionElements[i].tag === DOMObjectTag.columnBreak) {
// We store the elements in a wrapper container until we determine
let element = createDiv({
cls: MultiColumnLayoutCSS.ColumnDualElementContainer,
});
regionElements[i].elementContainer = element;
// Otherwise we just make a copy of the original element to display.
let clonedElement = regionElements[i].originalElement.cloneNode(true);
let headingCollapseElement = getHeadingCollapseElement(clonedElement);
if (headingCollapseElement !== null) {
// This removes the collapse arrow from the view if it exists.
headingCollapseElement.detach();
}
regionElements[i].clonedElement = clonedElement;
element.appendChild(clonedElement);
if (regionElements[i] instanceof TaskListDOMObject) {
this.fixClonedCheckListButtons(regionElements[i], true);
}
if (element !== null) {
columnContentDiv.appendChild(element);
}
}
}
}
createColumnContentDivs(multiColumnParent) {
let contentDiv = multiColumnParent.createDiv({
cls: `${MultiColumnStyleCSS.ColumnContent}`
});
if (this.regionalSettings.columnSize === SingleColumnSize.small) {
contentDiv.addClass(`${MultiColumnLayoutCSS.SingleColumnSmall}`);
}
else if (this.regionalSettings.columnSize === SingleColumnSize.large) {
contentDiv.addClass(`${MultiColumnLayoutCSS.SingleColumnLarge}`);
}
else if (this.regionalSettings.columnSize === SingleColumnSize.full) {
contentDiv.addClass(`${MultiColumnLayoutCSS.SingleColumnFull}`);
}
else {
contentDiv.addClass(`${MultiColumnLayoutCSS.SingleColumnMed}`);
}
return contentDiv;
}
}
function isLeftLayout(layout) {
if (layout === ColumnLayout.left ||
layout === ColumnLayout.first) {
return true;
}
return false;
}
function isRightLayout(layout) {
if (layout === ColumnLayout.right ||
layout === ColumnLayout.third ||
layout === ColumnLayout.last) {
return true;
}
return false;
}
/**
* File: /src/dom_manager/regional_managers/autoLayoutRegionManager.ts *
* Created Date: Sunday, May 22nd 2022, 10:23 pm *
* Author: Cameron Robinson *
* *
* Copyright (c) 2022 Cameron Robinson *
*/
class AutoLayoutRegionManager extends RegionManager {
constructor() {
super(...arguments);
this.previousColumnHeights = [];
}
renderRegionElementsToScreen() {
this.renderColumnMarkdown(this.regionParent, this.domList, this.regionalSettings);
}
exportRegionElementsToPDF(pdfParentElement) {
// Default set shadow to off for exporting PDFs
let renderSettings = this.regionalSettings;
renderSettings.drawShadow = false;
this.renderColumnMarkdown(pdfParentElement, this.domList.slice(), renderSettings);
}
renderRegionElementsToLivePreview(parentElement) {
this.renderColumnMarkdown(parentElement, this.domList, this.regionalSettings);
}
/**
* 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: MultiColumnLayoutCSS.RegionColumnContainerDiv,
});
this.columnParent = multiColumnParent;
/**
* Pass our parent div and settings to parser to create the required
* column divs as children of the parent.
*/
this.columnDivs = this.getColumnContentDivs(settings, multiColumnParent);
if (settings.drawShadow === true) {
multiColumnParent.addClass(MultiColumnStyleCSS.RegionShadow);
}
for (let i = 0; i < this.columnDivs.length; i++) {
if (settings.drawBorder === true) {
this.columnDivs[i].addClass(MultiColumnStyleCSS.ColumnBorder);
}
if (settings.drawShadow === true) {
this.columnDivs[i].addClass(MultiColumnStyleCSS.ColumnShadow);
}
}
// 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(multiColumnParent);
this.appendElementsToColumns(regionElements, this.columnDivs, settings);
}
appendElementsToColumns(regionElements, columnContentDivs, settings) {
function balanceElements() {
let totalHeight = regionElements.map((el, index) => {
// We only want to attempt to update the elementRenderedHeight if it is 0 and if it is not an unrendered element such as a endregion tag.
if (el.elementRenderedHeight === 0 &&
el.tag !== DOMObjectTag.columnBreak &&
el.tag !== DOMObjectTag.endRegion &&
el.tag !== DOMObjectTag.regionSettings &&
el.tag !== DOMObjectTag.startRegion) {
// Add element to rendered div so we can extract the rendered height.
columnContentDivs[0].appendChild(el.originalElement);
el.elementRenderedHeight = el.originalElement.clientHeight;
columnContentDivs[0].removeChild(el.originalElement);
}
return el.elementRenderedHeight;
}).reduce((prev, curr) => { return prev + curr; }, 0);
let maxColumnContentHeight = Math.trunc(totalHeight / settings.numberOfColumns);
for (let i = 0; i < columnContentDivs.length; i++) {
for (let j = columnContentDivs[i].children.length - 1; j >= 0; j--) {
columnContentDivs[i].children[j].detach();
}
}
let columnIndex = 0;
let currentColumnHeight = 0;
function checkShouldSwitchColumns(nextElementHeight) {
if (currentColumnHeight + nextElementHeight > maxColumnContentHeight &&
(columnIndex + 1) < settings.numberOfColumns) {
columnIndex++;
currentColumnHeight = 0;
}
}
for (let i = 0; i < regionElements.length; i++) {
if (regionElements[i].tag === DOMObjectTag.none ||
regionElements[i].tag === DOMObjectTag.columnBreak) {
/**
* Here we check if we need to swap to the next column for the current element.
* If the user wants to keep headings with the content below it we also make sure
* that the last item in a column is not a header element by using the header and
* the next element's height as the height value.
*/
if (hasHeader(regionElements[i].originalElement) === true) { // TODO: Add this as selectable option.
let headerAndNextElementHeight = regionElements[i].elementRenderedHeight;
if (i < regionElements.length - 1) {
headerAndNextElementHeight += regionElements[i + 1].elementRenderedHeight;
}
checkShouldSwitchColumns(headerAndNextElementHeight);
}
else {
checkShouldSwitchColumns(regionElements[i].elementRenderedHeight);
}
currentColumnHeight += regionElements[i].elementRenderedHeight;
/**
* We store the elements in a wrapper container until we determine if we want to
* use the original element or a clone of the element. This helps us by allowing
* us to create a visual only clone while the update loop moves the original element
* into the columns.
*/
let element = createDiv({
cls: MultiColumnLayoutCSS.ColumnDualElementContainer,
});
regionElements[i].elementContainer = element;
let clonedElement = regionElements[i].clonedElement;
if (regionElements[i].clonedElement === null) {
clonedElement = regionElements[i].originalElement.cloneNode(true);
let headingCollapseElement = getHeadingCollapseElement(clonedElement);
if (headingCollapseElement !== null) {
// This removes the collapse arrow from the view if it exists.
headingCollapseElement.detach();
}
regionElements[i].clonedElement = clonedElement;
}
element.appendChild(clonedElement);
if (regionElements[i] instanceof TaskListDOMObject) {
this.fixClonedCheckListButtons(regionElements[i], true);
}
if (element !== null &&
columnContentDivs[columnIndex] &&
regionElements[i].tag !== DOMObjectTag.columnBreak) {
columnContentDivs[columnIndex].appendChild(element);
regionElements[i].elementRenderedHeight = element.clientHeight;
}
/**
* If the tag is a column break we update the column index after
* appending the item to the column div. This keeps the main DOM
* cleaner by removing other items and placing them all within
* a region container.
*
* Removing the end column tag as an option for now.
*/
// if (regionElements[i].tag === DOMObjectTag.columnBreak &&
// (columnIndex + 1) < settings.numberOfColumns) {
// columnIndex++;
// currentColumnHeight = 0;
// }
}
}
}
/**
* Attempt to balanced the elements. We need to iterate over the elements multiple times because
* our initial balance estimate may not be perfectly balanced due to different column widths causing
* elements within them to be of different heights. This can cause the elements to jump around on
* subsiquent update loops which is not ideal. Here we render the elements to the screen and update
* their height after being rendered into the estimated position.
*
* Once everything is rendered we check all of the column heights against our last iteration and
* if nothing has changed we know we are balanced.
*
* There is probably a better way of accomplishing this task but this works for the time being.
*/
for (let i = 0; i < 5; i++) {
balanceElements();
let balanced = true;
for (let j = 0; j < columnContentDivs.length; j++) {
// If the column heights are undefined we set default to zero so not to encounter an error.
if (!this.previousColumnHeights[j]) {
this.previousColumnHeights.push(0);
}
// if this render height is not the same as the previous height we are still balancing.
if (this.previousColumnHeights[j] !== columnContentDivs[j].clientHeight) {
this.previousColumnHeights[j] = columnContentDivs[j].clientHeight;
balanced = false;
}
}
// if we made it out of the loop and all of the columns are the same height as last update
// we're balanced so we can break out of the loop.
if (balanced === true) {
break;
}
}
}
updateRenderedMarkdown() {
for (let i = 0; i < this.domList.length; i++) {
let el = this.domList[i];
let originalClientHeight = 0;
if (el.originalElement) {
originalClientHeight = el.originalElement.clientHeight;
}
let clonedClientHeight = 0;
if (el.clonedElement) {
clonedClientHeight = el.clonedElement.clientHeight;
}
if (originalClientHeight < clonedClientHeight) {
this.domList[i].elementRenderedHeight = clonedClientHeight;
}
else {
this.domList[i].elementRenderedHeight = originalClientHeight;
}
}
let validColumns = true;
if (this.columnParent !== null && this.columnDivs !== null && this.columnDivs !== undefined &&
this.columnDivs.length === this.regionalSettings.numberOfColumns) {
let totalHeight = this.domList.map((el, index) => {
// We only want to attempt to update the elementRenderedHeight if it is 0 and if it is not an unrendered element such as a endregion tag.
if (el.elementRenderedHeight === 0 &&
el.tag !== DOMObjectTag.columnBreak &&
el.tag !== DOMObjectTag.endRegion &&
el.tag !== DOMObjectTag.regionSettings &&
el.tag !== DOMObjectTag.startRegion) {
// Add element to rendered div so we can extract the rendered height.
this.columnParent.appendChild(el.originalElement);
el.elementRenderedHeight = el.originalElement.clientHeight;
this.columnParent.removeChild(el.originalElement);
}
return el.elementRenderedHeight;
}).reduce((prev, curr) => { return prev + curr; }, 0);
let maxColumnContentHeight = Math.trunc(totalHeight / this.regionalSettings.numberOfColumns);
for (let i = 0; i < this.columnDivs.length - 1; i++) {
let columnHeight = 0;
for (let j = 0; j < this.columnDivs[i].children.length; j++) {
columnHeight += this.columnDivs[i].children[j].clientHeight;
}
if (columnHeight > maxColumnContentHeight) {
validColumns = false;
break;
}
}
}
if (validColumns === false) {
this.renderColumnMarkdown(this.regionParent, this.domList, this.regionalSettings);
}
super.updateRenderedMarkdown();
}
}
/**
* File: /src/dom_manager/regional_managers/regionManagerContainer.ts *
* Created Date: Sunday, May 22nd 2022, 7:50 pm *
* Author: Cameron Robinson *
* *
* Copyright (c) 2022 Cameron Robinson *
*/
/**
* This class acts as an abstraction for the actual regional manager. It is used to update the
* subclass of RegionalManager depending on user preferences to make rendering more simplified.
*/
class RegionManagerContainer {
constructor(parentFileManager, regionKey, rootElement, regionParent) {
this.region = new StandardMultiColumnRegionManager(createDefaultRegionManagerData(regionParent, parentFileManager, regionKey, rootElement));
}
getRegion() {
return this.region;
}
setRegionSettings(settingsText) {
let regionalSettings = parseColumnSettings(settingsText);
if (regionalSettings.numberOfColumns === 1) {
regionalSettings = parseSingleColumnSettings(settingsText, regionalSettings);
}
this.region.setRegionalSettings(regionalSettings);
if (regionalSettings.numberOfColumns === 1) {
if (this.region instanceof SingleColumnRegionManager === false) {
// console.debug("Converting region to single column.")
this.convertToSingleColumn();
}
}
else if (regionalSettings.autoLayout === true) {
if (this.region instanceof AutoLayoutRegionManager === false) {
// console.debug("Converting region to auto layout.")
this.convertToAutoLayout();
}
}
else if (regionalSettings.numberOfColumns >= 2) {
if (this.region instanceof StandardMultiColumnRegionManager === false) {
// console.debug("Converting region to standard multi-column")
this.convertToStandardMultiColumn();
}
}
return this.region;
}
convertToSingleColumn() {
let data = this.region.getRegionData();
this.region = new SingleColumnRegionManager(data);
return this.region;
}
convertToStandardMultiColumn() {
let data = this.region.getRegionData();
this.region = new StandardMultiColumnRegionManager(data);
return this.region;
}
convertToAutoLayout() {
let data = this.region.getRegionData();
this.region = new AutoLayoutRegionManager(data);
return this.region;
}
}
function createDefaultRegionManagerData(regionParent, fileManager, regionKey, rootElement) {
return {
domList: [],
domObjectMap: new Map(),
regionParent: regionParent,
fileManager: fileManager,
regionalSettings: getDefaultMultiColumnSettings(),
regionKey: regionKey,
rootElement: rootElement
};
}
/*
* 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
*/
/**
* This class handles the global managers keeping track of all open files that
* contain MCM-Regions.
*/
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;
}
getAllFileManagers() {
return Array.from(this.managers.values());
}
}
function createFileDOMManager(parentManager, fileKey) {
let regionMap = new Map();
let hasStartTag = false;
function removeRegion(regionKey) {
let regionContainer = regionMap.get(regionKey);
if (regionContainer) {
let regionalManager = regionContainer.getRegion();
regionalManager.displayOriginalElements();
}
regionMap.delete(regionKey);
if (regionMap.size === 0) {
parentManager.removeFileManagerCallback(fileKey);
}
}
function createRegionalManager(regionKey, rootElement, errorElement, renderRegionElement) {
//TODO: Use the error element whenever there is an error.
let regonalContainer = new RegionManagerContainer(this, regionKey, rootElement, renderRegionElement);
regionMap.set(regionKey, regonalContainer);
return regonalContainer.getRegion();
}
function getRegionalContainer(regionKey) {
let regonalManager = null;
if (regionMap.has(regionKey) === true) {
regonalManager = regionMap.get(regionKey);
}
return regonalManager;
}
function getAllRegionalManagers() {
let containers = Array.from(regionMap.values());
let regions = containers.map((curr) => { return curr.getRegion(); });
return regions;
}
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,
getRegionalContainer: getRegionalContainer,
getAllRegionalManagers: getAllRegionalManagers,
removeRegion: removeRegion,
setHasStartTag: setHasStartTag,
getHasStartTag: getHasStartTag,
getNumberOfRegions: getNumberOfRegions,
checkKeyExists: checkKeyExists
};
}
/*
* Filename: multi-column-markdown/src/live_preview/MultiColumnMarkdown_Widget.ts
* Created Date: Tuesday, August 16th 2022, 4:38:43 pm
* Author: Cameron Robinson
*
* Copyright (c) 2022 Cameron Robinson
*/
class MultiColumnMarkdown_LivePreview_Widget extends view.WidgetType {
constructor(contentData) {
super();
this.domList = [];
this.regionSettings = getDefaultMultiColumnSettings();
this.contentData = contentData;
// Find the settings defined in the content, if it exists.
// If the settings codeblock isnt defined attempt to get the region codeblock type.
let settingsStartData = findSettingsCodeblock(this.contentData);
if (settingsStartData.found === false) {
settingsStartData = findStartCodeblock(this.contentData);
}
if (settingsStartData.found === true) {
this.settingsText = this.contentData.slice(settingsStartData.startPosition, settingsStartData.endPosition);
this.contentData = this.contentData.replace(this.settingsText, "");
// Parse the settings, updating the default settings.
this.regionSettings = parseColumnSettings(this.settingsText);
}
// Render the markdown content to our temp parent element.
this.tempParent = createDiv();
let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(this.tempParent);
obsidian.MarkdownRenderer.renderMarkdown(this.contentData, this.tempParent, "", elementMarkdownRenderer);
// take all elements, in order, and create our DOM list.
let arr = Array.from(this.tempParent.children);
for (let i = 0; i < arr.length; i++) {
let el = this.fixElementRender(arr[i]);
this.domList.push(new DOMObject(el, [""]));
}
// Set up the region manager data before then creating our region manager.
let regionData = {
domList: this.domList,
domObjectMap: new Map(),
regionParent: createDiv(),
fileManager: null,
regionalSettings: this.regionSettings,
regionKey: getUID(),
rootElement: createDiv()
};
// Finally setup the type of region manager required.
if (this.regionSettings.numberOfColumns === 1) {
this.regionSettings = parseSingleColumnSettings(this.settingsText, this.regionSettings);
this.regionManager = new SingleColumnRegionManager(regionData);
}
else if (this.regionSettings.autoLayout === true) {
this.regionManager = new AutoLayoutRegionManager(regionData);
}
else {
this.regionManager = new StandardMultiColumnRegionManager(regionData);
}
}
fixElementRender(el) {
let fixedEl = fixImageRender(el);
return fixedEl;
}
toDOM() {
// Create our element to hold all of the live preview elements.
let el = document.createElement("div");
el.className = "mcm-cm-preview";
/**
* For situations where we need to know the rendered height, AutoLayout,
* the element must be rendered onto the screen to get the info, even if
* only for a moment. Here we attempt to get a leaf from the app so we
* can briefly append our element, check any data if required, and then
* remove it.
*/
let leaf = null;
if (app) {
let leaves = app.workspace.getLeavesOfType("markdown");
if (leaves.length > 0) {
leaf = leaves[0];
}
}
if (this.regionManager) {
if (leaf) {
leaf.view.containerEl.appendChild(el);
}
this.regionManager.renderRegionElementsToLivePreview(el);
if (leaf) {
leaf.view.containerEl.removeChild(el);
}
}
fixExternalLinks(el);
return el;
}
}
class MultiColumnMarkdown_DefinedSettings_LivePreview_Widget extends view.WidgetType {
constructor(contentData) {
super();
this.contentData = contentData;
}
toDOM() {
// Create our element to hold all of the live preview elements.
let el = document.createElement("div");
el.className = "mcm-cm-settings-preview";
let labelDiv = el.createDiv();
let label = labelDiv.createSpan({
cls: "mcm-col-settings-preview"
});
label.textContent = "Column Settings:";
let list = el.createEl("ul");
let lines = this.contentData.split("\n");
for (let i = 1; i < lines.length - 1; i++) {
let item = list.createEl("li");
item.textContent = lines[i];
}
return el;
}
}
function fixImageRender(el) {
let fixedEl = el;
let items = el.getElementsByClassName("internal-embed");
if (items.length !== 1) {
return el;
}
let embed = items[0];
let customWidth = embed.attributes.getNamedItem("width");
let alt = embed.getAttr("alt");
let src = embed.getAttr("src");
// If the link source is not an image we dont want to make any adjustments.
if (filenameIsImage(src) === false) {
return el;
}
// Try to find the image file in the vault. This is very inefficient but works for now.
let aTFiles = app.vault.getAllLoadedFiles();
let resourcePath = "";
for (let i = 0; i < aTFiles.length; i++) {
let abstractFile = aTFiles[i];
if (abstractFile instanceof obsidian.TFile === false) {
continue;
}
let file = abstractFile;
if (file.name === src && isImageExtension(file.extension) === true) {
resourcePath = app.vault.getResourcePath(file);
break;
}
}
// If we found the resource path then we update the element to be a proper image render.
if (resourcePath !== "") {
fixedEl = createDiv({
cls: "internal-embed image-embed is-loaded",
});
fixedEl.setAttr("alt", alt);
let image = fixedEl.createEl("img");
image.setAttr("src", resourcePath);
if (customWidth !== null) {
image.setAttr("width", customWidth.value);
}
}
return fixedEl;
}
function fixExternalLinks(el) {
let items = el.getElementsByClassName("external-link");
for (let linkEl of Array.from(items)) {
let link = linkEl;
if (link === undefined ||
link === null) {
continue;
}
// Remove the href from the link and setup an event listener to open the link in the default browser.
let href = link.getAttr("href");
link.removeAttribute("href");
link.addEventListener("click", (ev) => {
window.open(href);
});
}
items = el.getElementsByClassName("internal-link");
for (let linkEl of Array.from(items)) {
let link = linkEl;
if (link === undefined ||
link === null) {
continue;
}
// Removing the href from internal links is all that seems to be required to fix the onclick.
link.removeAttribute("href");
}
return el;
}
function filenameIsImage(filename) {
let parts = filename.split(".");
if (parts.length <= 1) {
return false;
}
let extension = parts.last();
return isImageExtension(extension);
}
function isImageExtension(extension) {
extension = extension.toLowerCase();
switch (extension) {
case "png":
case "jpg":
case "jpeg":
case "gif":
case "bmp":
case "svg":
return true;
}
return false;
}
/*
* Filename: multi-column-markdown/src/live_preview/cm6_livePreview.ts
* Created Date: Monday, August 1st 2022, 1:51:16 pm
* Author: Cameron Robinson
*
* Copyright (c) 2022 Cameron Robinson
*/
const multiColumnMarkdown_StateField = state.StateField.define({
create(state) {
return view.Decoration.none;
},
update(oldState, transaction) {
const builder = new state.RangeSetBuilder();
let generated = false;
language.syntaxTree(transaction.state).iterate({
enter(node) {
// We only want to run the generation once per state change. If
// a previous node has sucessfully generated regions we ignore all
// other nodes in the state.
if (generated === true) {
return;
}
// Check if view is in live preview state.
if (transaction.state.field(obsidian.editorLivePreviewField) === false) {
// console.debug("User disabled live preview.")
return;
}
// We want to run on the whole file so we dont just look for a single token.
const tokenProps = node.type.prop(language.tokenClassNodeProp);
if (tokenProps !== undefined) {
return;
}
/**
* When we have the while file we then get the entire doc text and check if it
* contains a MCM region so we know to break or not.
*/
let docLength = transaction.state.doc.length;
let docText = transaction.state.doc.sliceString(0, docLength);
if (containsRegionStart(docText) === false) {
// console.debug("No start tag in document.")
return;
}
// We want to know where the user's cursor is, it can be
// selecting multiple regions of text as well so we need to know
// all locations. Used to know if we should render region as text or as preview.
let ranges = getCursorLineLocations();
// Setup our loop to render the regions as MCM.
let workingFileText = docText;
let loopIndex = 0;
let startIndexOffset = 0;
while (true) {
// If there are multiple kinds of start blocks, the old way of parsing would cause issues.
// Now search for both kinds and determine what to do after search.
let startTagData_codeblockStart = findStartCodeblock(workingFileText);
let startTagData_depreciatedStart = findStartTag(workingFileText);
// Default to codeblock Style. Then check, if codeblock was not found and depreciated Start was, set startTag to depreciated.
let startTagData = startTagData_codeblockStart;
if (startTagData_codeblockStart.found === false && startTagData_depreciatedStart.found === true) {
startTagData = startTagData_depreciatedStart;
}
else if (startTagData_codeblockStart.found === true && startTagData_depreciatedStart.found === true) {
// If both kinds were found we want to start with the one closer to the top of the document as CM6 requires we work in order.
if (startTagData_codeblockStart.startPosition > startTagData_depreciatedStart.startPosition) {
startTagData = startTagData_depreciatedStart;
}
}
if (startTagData.found === false) {
break;
}
// Search for the first end tag after a start block. (No recursive columns.)
let endTagData = findEndTag(workingFileText.slice(startTagData.startPosition));
if (endTagData.found === false) {
break;
}
/**
* For the region we found get the start and end position of the tags so we
* can slice it out of the document.
*/
let startIndex = startIndexOffset + startTagData.startPosition;
let endIndex = startIndex + endTagData.startPosition + endTagData.matchLength; // Without the matchLength will leave the end tag on the screen.
// This text is the entire region data including the start and end tags.
let elementText = docText.slice(startIndex, endIndex);
/**
* Update our start offset and the working text of the file so our next
* iteration knows where we left off
*/
startIndexOffset = endIndex;
workingFileText = docText.slice(endIndex);
// Here we check if the cursor is in this specific region.
let cursorInRegion = checkCursorInRegion(startIndex, endIndex, ranges);
if (cursorInRegion === true) {
// If the cursor is within the region we then need to know if
// it is within our settings block (if it exists.)
let settingsStartData = findStartCodeblock(elementText);
if (settingsStartData.found === false) {
settingsStartData = findSettingsCodeblock(elementText);
}
if (settingsStartData.found === true) {
// Since the settings block exists check if the cursor is within that region.
let codeblockStartIndex = startIndex + settingsStartData.startPosition;
let codeblockEndIndex = startIndex + settingsStartData.endPosition;
let settingsText = docText.slice(codeblockStartIndex, codeblockEndIndex);
let cursorInCodeblock = checkCursorInRegion(codeblockStartIndex, codeblockEndIndex, ranges);
if (cursorInCodeblock === false) {
// If the cursor is not within the region we pass the data to the
// settings view so it can be displayed in the region.
builder.add(codeblockStartIndex, codeblockEndIndex + 1, view.Decoration.replace({
widget: new MultiColumnMarkdown_DefinedSettings_LivePreview_Widget(settingsText),
}));
}
}
}
else {
// At this point if the cursor isnt in the region we pass the data to the
// element to be rendered.
builder.add(startIndex, endIndex, view.Decoration.replace({
widget: new MultiColumnMarkdown_LivePreview_Widget(elementText),
}));
}
generated = true;
// Infinite loop protection.
loopIndex++;
if (loopIndex > 100) {
console.warn("Potential issue with rendering Multi-Column Markdown live preview regions. If problem persists please file a bug report with developer.");
break;
}
}
},
});
return builder.finish();
function getCursorLineLocations() {
let ranges = [];
if (transaction.state.selection.ranges) {
ranges = transaction.state.selection.ranges.filter((range) => {
return range.empty;
}).map((range) => {
let line = transaction.state.doc.lineAt(range.head);
`${line.number}:${range.head - line.from}`;
return {
line: line,
position: range.head
};
});
}
return ranges;
}
function valueIsInRange(value, minVal, maxVal, inclusive = true) {
if (inclusive === true && (value === minVal || value === maxVal)) {
return true;
}
if (minVal < value && value < maxVal) {
return true;
}
return false;
}
function checkCursorInRegion(startIndex, endIndex, ranges) {
for (let i = 0; i < ranges.length; i++) {
// TODO: Maybe look into limiting this to the second and second to last line
// of the region as clicking right at the top or bottom of the region
// swaps it to unrendered.
let range = ranges[i];
if (valueIsInRange(range.position, startIndex, endIndex) === true) {
return true;
}
}
if (transaction.state.selection) {
for (let i = 0; i < transaction.state.selection.ranges.length; i++) {
let range = transaction.state.selection.ranges[i];
// If either the start or end of the selection is within the
// region range we do not render live preview.
if (valueIsInRange(range.from, startIndex, endIndex) ||
valueIsInRange(range.to, startIndex, endIndex)) {
return true;
}
// // Or if the entire region is within the selection range
// we do not render the live preview.
if (valueIsInRange(startIndex, range.from, range.to) &&
valueIsInRange(endIndex, range.from, range.to)) {
return true;
}
}
}
return false;
}
},
provide(field) {
return view.EditorView.decorations.from(field);
},
});
/*
* File: multi-column-markdown/src/main.ts
* Created Date: Tuesday, October 5th 2021, 1:09 pm
* Author: Cameron Robinson
*
* Copyright (c) 2022 Cameron Robinson
*/
const DEFAULT_SETTINGS = {
renderOnMobile: true
};
const CODEBLOCK_START_STRS = [
"start-multi-column",
"multi-column-start"
];
class MultiColumnMarkdown extends obsidian.Plugin {
constructor() {
super(...arguments);
this.settings = DEFAULT_SETTINGS;
this.globalManager = new GlobalDOMManager();
}
onload() {
return __awaiter(this, void 0, void 0, function* () {
console.log("Loading multi-column markdown");
yield this.loadSettings();
this.globalManager = new GlobalDOMManager();
this.registerEditorExtension(multiColumnMarkdown_StateField);
for (let i = 0; i < CODEBLOCK_START_STRS.length; i++) {
let startStr = CODEBLOCK_START_STRS[i];
this.setupMarkdownCodeblockPostProcessor(startStr);
}
this.setupMarkdownPostProcessor();
this.addCommand({
id: `toggle-mobile-rendering-mcm`,
name: `Toggle Mobile Rendering - Multi-Column Markdown`,
callback: () => __awaiter(this, void 0, void 0, function* () {
this.settings.renderOnMobile = !this.settings.renderOnMobile;
yield this.saveSettings();
console.log("render on mobile:", this.settings.renderOnMobile);
let noticeString = `Toggled mobile rendering ${this.settings.renderOnMobile ? "on" : "off"}.`;
if (obsidian.Platform.isMobile === true) {
noticeString += ` Please reload any open files for change to take effect.`;
}
new obsidian.Notice(noticeString);
})
});
//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 {
let cursorStartPosition = editor.getCursor("from");
editor.getDoc().replaceSelection(`
\`\`\`start-multi-column
ID: ID_${getUID(4)}
Number of Columns: 2
Largest Column: standard
\`\`\`
--- column-end ---
=== end-multi-column
${editor.getDoc().getSelection()}`);
cursorStartPosition.line = cursorStartPosition.line + 7;
cursorStartPosition.ch = 0;
editor.setCursor(cursorStartPosition);
}
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 docText = editor.getRange({ line: 0, ch: 0 }, { line: editor.getDoc().lineCount(), ch: 0 });
let lines = docText.split("\n");
let startCodeblock = findStartCodeblock(docText);
let lineOffset = 0;
let numCodeblocksUpdated = 0;
while (startCodeblock.found === true) {
// Get the text of the settings block so we can check if it contains an ID,
// also so we can get the length of the first line, used to calculate where to append a new ID if needed
let settingsText = docText.slice(startCodeblock.startPosition, startCodeblock.endPosition);
let firstLineOfCodeblockLength = settingsText.split("\n")[0].length;
// We need the lines before the block to know where to start replacing text
// and the lines including the block to know where to set our offset to after this iteration.
let linesBefore = docText.slice(0, startCodeblock.startPosition);
let startReplacementLineIndex = (linesBefore.split("\n").length - 1) + lineOffset;
let linesOf = docText.slice(0, startCodeblock.endPosition);
let endReplacementLineIndex = (linesOf.split("\n").length - 1) + lineOffset;
let settingsID = parseStartRegionCodeBlockID(settingsText);
if (settingsID === "") {
// copy the first line of the codeblock and append a new ID, then replace the first line of the block
let replacementText = editor.getRange({ line: startReplacementLineIndex, ch: 0 }, { line: startReplacementLineIndex, ch: firstLineOfCodeblockLength }) + `\nID: ID_${getUID(4)}`;
editor.replaceRange(replacementText, { line: startReplacementLineIndex, ch: 0 }, { line: startReplacementLineIndex, ch: firstLineOfCodeblockLength });
endReplacementLineIndex += 1;
numCodeblocksUpdated += 1;
}
lineOffset = endReplacementLineIndex;
docText = docText.slice(startCodeblock.endPosition);
startCodeblock = findStartCodeblock(docText);
}
/**
* 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 && numCodeblocksUpdated === 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 + numCodeblocksUpdated} 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.");
}
}
});
this.registerInterval(window.setInterval(() => {
this.UpdateOpenFilePreviews();
}, 500));
});
}
UpdateOpenFilePreviews() {
let fileManagers = this.globalManager.getAllFileManagers();
fileManagers.forEach(element => {
let regionalManagers = element.getAllRegionalManagers();
regionalManagers.forEach(regionManager => {
regionManager.updateRenderedMarkdown();
});
});
}
setupMarkdownPostProcessor() {
this.registerMarkdownPostProcessor((el, ctx) => __awaiter(this, void 0, void 0, function* () {
if (this.settings.renderOnMobile === false &&
obsidian.Platform.isMobile === true) {
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;
}
/**
* Here we check if the export "print" flag is in the DOM so we can determine if we
* are exporting and handle that case.
*/
if (this.checkExporting(el)) {
this.exportDocumentToPDF(el, fileDOMManager, sourcePath);
}
// 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;
}
let docString = info.text;
let docLines = docString.split("\n");
/**
* 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) ||
containsStartCodeBlock(docString)) {
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 linesAboveArray = docLines.slice(0, info.lineStart);
let linesOfElement = docLines.slice(info.lineStart, info.lineEnd + 1);
let textOfElement = linesOfElement.join("\n");
let linesBelowArray = docLines.slice(info.lineEnd + 1);
//#region Depreciated Start Tag
/**
* 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(textOfElement)) {
/**
* Set up the current element to act as the parent for the
* multi-column region.
*/
el.children[0].detach();
el.classList.add(MultiColumnLayoutCSS.RegionRootContainerDiv);
let renderErrorRegion = el.createDiv({
cls: `${MultiColumnLayoutCSS.RegionErrorContainerDiv} ${MultiColumnStyleCSS.RegionErrorMessage}`,
});
let renderColumnRegion = el.createDiv({
cls: MultiColumnLayoutCSS.RegionContentContainerDiv
});
let startBlockData = getStartBlockAboveLine(linesOfElement);
if (startBlockData === null) {
return;
}
let regionKey = startBlockData.startBlockKey;
if (fileDOMManager.checkKeyExists(regionKey) === true) {
let { numberOfTags, keys } = countStartTags(info.text);
let numMatches = 0;
for (let i = 0; i < numberOfTags; i++) {
// Because we checked if key exists one of these has to match.
if (keys[i] === regionKey) {
numMatches++;
}
}
// We only want to display an error if there are more than 2 of the same id across
// the whole document. This prevents erros when obsidian reloads the whole document
// and there are two of the same key in the map.
if (numMatches >= 2) {
if (regionKey === "") {
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;
}
}
el.id = `MultiColumnID:${regionKey}`;
let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(el);
fileDOMManager.createRegionalManager(regionKey, el, 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;
}
//#endregion Depreciated Start Tag
/**
* Check if any of the lines above us contain a start block, and if
* so get the lines from our current element to the start block.
*/
let startBockAbove = getStartBlockOrCodeblockAboveLine(linesAboveArray);
if (startBockAbove === null) {
return;
}
/**
* We now know we're within a multi-column region, so we update our
* list of lines above to just be the items within this region.
*/
linesAboveArray = startBockAbove.linesAboveArray;
/**
* We use the start block's key to get our regional manager. If this
* lookup fails we can not continue processing this element.
*/
let regionalContainer = fileDOMManager.getRegionalContainer(startBockAbove.startBlockKey);
if (regionalContainer === null) {
return;
}
let regionalManager = regionalContainer.getRegion();
/**
* To make sure we're placing the item in the right location (and
* overwrite elements that are now gone) we now want all of the
* lines after this element up to the end tag.
*/
linesBelowArray = getEndBlockBelow(linesBelowArray);
/**
* 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 these elements to determine where to place our current element.
*/
let siblingsAbove = renderMarkdownFromLines(linesAboveArray, sourcePath);
let siblingsBelow = renderMarkdownFromLines(linesBelowArray, sourcePath);
/**
* Set up our dom object to be added to the manager.
*/
let currentObject = new DOMObject(el, linesOfElement);
el.id = currentObject.UID;
currentObject = TaskListDOMObject.checkForTaskListElement(currentObject);
/**
* 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, siblingsBelow, currentObject);
let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(el);
elementMarkdownRenderer.onunload = () => {
if (regionalContainer === null) {
return;
}
let regionalManager = regionalContainer.getRegion();
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;
}
regionalManager.renderRegionElementsToScreen();
}
};
ctx.addChild(elementMarkdownRenderer);
let elementTextSpaced = linesOfElement.reduce((prev, curr) => {
return prev + "\n" + curr;
});
/**
* 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) {
currentObject.elementType = ElementRenderType.unRendered;
el.addClass(MultiColumnStyleCSS.RegionEndTag);
regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.endRegion);
}
else if (containsColEndTag(elementTextSpaced) === true) {
currentObject.elementType = ElementRenderType.unRendered;
el.addClass(MultiColumnStyleCSS.ColumnEndTag);
regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.columnBreak);
}
else if (containsColSettingsTag(elementTextSpaced) === true) {
currentObject.elementType = ElementRenderType.unRendered;
el.addClass(MultiColumnStyleCSS.RegionSettings);
regionalManager = regionalContainer.setRegionSettings(elementTextSpaced);
regionalManager.updateElementTag(currentObject.UID, DOMObjectTag.regionSettings);
}
else {
el.addClass(MultiColumnStyleCSS.RegionContent);
}
regionalManager.renderRegionElementsToScreen();
return;
}));
}
isStartCodeblockInExport(node) {
for (let i = 0; i < CODEBLOCK_START_STRS.length; i++) {
if (node.hasClass(`block-language-${CODEBLOCK_START_STRS[i]}`)) {
return true;
}
}
return false;
}
exportDocumentToPDF(el, fileDOMManager, sourcePath) {
return __awaiter(this, void 0, void 0, function* () {
// A true export will be passed an element with all other items in the doc as children.
// So if there are no children we can just return
let docChildren = Array.from(el.childNodes);
if (docChildren.length === 0) {
return;
}
let childrenToRemove = [];
// To export codeblocks we need to get the IDs so we can get the data from our managers.
// however since the ID isnt being stored in the element yet this means we need to read
// all of the IDs out of the full document.
let codeblockStartBlocks = [];
let aFile = this.app.vault.getAbstractFileByPath(sourcePath);
if (aFile instanceof obsidian.TFile) {
let file = aFile;
let fileText = yield this.app.vault.cachedRead(file); // Is cached read Ok here? It should be.
// Once we have our data we search the text for all codeblock start values.
// storing them into our queue.
let codeBlockData = findStartCodeblock(fileText);
while (codeBlockData.found === true) {
let codeblockText = fileText.slice(codeBlockData.startPosition, codeBlockData.endPosition);
fileText = fileText.slice(codeBlockData.endPosition);
codeblockStartBlocks.push(codeblockText);
codeBlockData = findStartCodeblock(fileText);
}
}
else {
console.error(`Error getting file from source path: ${sourcePath}`);
}
let inBlock = false;
for (let i = 0; i < docChildren.length; i++) {
let child = docChildren[i];
if (child instanceof HTMLElement) {
if (inBlock === false) {
let foundBlockData = false;
let regionKey = "";
let blockData = isStartTagWithID(child.textContent);
if (blockData.isStartTag === true) {
// If an old-style start tag.
foundBlockData = true;
if (blockData.hasKey === true) {
let foundKey = getStartTagKey(child.textContent);
if (foundKey !== null) {
regionKey = foundKey;
}
}
}
else if (blockData.isStartTag === false && this.isStartCodeblockInExport(child)) {
// If the start tag from the old version is null we then check to see if the element is
// a codeblock start. If it is we use the next available codeblock data to retrieve our ID.
let codeblockText = codeblockStartBlocks.shift();
if (codeblockText === undefined) {
console.error("Found undefined codeblock data when exporting.");
return;
}
let id = parseStartRegionCodeBlockID(codeblockText);
if (id !== "") {
foundBlockData = true;
regionKey = id;
}
}
if (foundBlockData === true && regionKey !== "") {
inBlock = true;
for (let i = child.children.length - 1; i >= 0; i--) {
child.children[i].detach();
}
child.innerText = "";
child.classList.add(MultiColumnLayoutCSS.RegionRootContainerDiv);
let renderErrorRegion = child.createDiv({
cls: `${MultiColumnLayoutCSS.RegionErrorContainerDiv}, ${MultiColumnStyleCSS.RegionErrorMessage}`,
});
let renderColumnRegion = child.createDiv({
cls: MultiColumnLayoutCSS.RegionContentContainerDiv
});
let regionalContainer = fileDOMManager.getRegionalContainer(regionKey);
if (regionalContainer === null) {
renderErrorRegion.innerText = "Error rendering multi-column region.\nPlease close and reopen the file, then make sure you are in reading mode before exporting.";
}
else {
let regionalManager = regionalContainer.getRegion();
regionalManager.exportRegionElementsToPDF(renderColumnRegion);
}
}
}
else {
if (containsEndTag(child.textContent) === true) {
inBlock = false;
}
childrenToRemove.push(child);
}
}
}
childrenToRemove.forEach(child => {
if (child.parentElement === el) {
el.removeChild(child);
}
});
});
}
checkExporting(element) {
if (element === null) {
return false;
}
if (element.classList.contains("print")) {
return true;
}
if (element.parentNode !== null) {
return this.checkExporting(element.parentElement);
}
return false;
}
setupMarkdownCodeblockPostProcessor(startStr) {
this.registerMarkdownCodeBlockProcessor(startStr, (source, el, ctx) => {
var _a;
if (this.settings.renderOnMobile === false &&
obsidian.Platform.isMobile === true) {
return;
}
const sourcePath = ctx.sourcePath;
// Set up our CSS so that the codeblock only renders this data in reading mode
// source/live preview mode is handled by the CM6 implementation.
(_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.addClass("preivew-mcm-start-block");
// To determine what kind of view we are rendering in we need a markdown leaf.
// Really this should never return here since rendering is only done in markdown leaves.
let markdownLeaves = app.workspace.getLeavesOfType("markdown");
if (markdownLeaves.length === 0) {
return;
}
for (let i = 0; i < markdownLeaves.length; i++) {
let fileLeaf = getFileLeaf(sourcePath);
if (fileLeaf === null) {
continue;
}
if (getLeafSourceMode(fileLeaf) === "source") {
// This was added when implementing live preview, but the reason it was originally added appears to no longer be an issue.
// Removing the return from here to fix bug where opening multiple copies of the document causes regions to not render.
console.debug("Leaf of file is in source mode. Should we be ignoring post processing here?");
// return;
}
}
if (this.globalManager === null || this.globalManager === undefined) {
// console.log("Global manager is undefined?");
return;
}
let fileDOMManager = this.globalManager.getFileManager(sourcePath);
if (fileDOMManager === null) {
return;
}
// Set file to have start tag.
fileDOMManager.setHasStartTag();
// 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;
}
/**
* Set up the current element to act as the parent for the
* multi-column region.
*/
el.classList.add(MultiColumnLayoutCSS.RegionRootContainerDiv);
let renderErrorRegion = el.createDiv({
cls: `${MultiColumnLayoutCSS.RegionErrorContainerDiv} ${MultiColumnStyleCSS.RegionErrorMessage}`,
});
let renderColumnRegion = el.createDiv({
cls: MultiColumnLayoutCSS.RegionContentContainerDiv
});
let regionKey = parseStartRegionCodeBlockID(source);
let createNewRegionManager = true;
if (fileDOMManager.checkKeyExists(regionKey) === true) {
createNewRegionManager = false;
let { numberOfTags, keys } = countStartTags(info.text);
let numMatches = 0;
for (let i = 0; i < numberOfTags; i++) {
// Because we checked if key exists one of these has to match.
if (keys[i] === regionKey) {
numMatches++;
}
}
// We only want to display an error if there are more than 2 of the same id across
// the whole document. This prevents erros when obsidian reloads the whole document
// and there are two of the same key in the map.
if (numMatches >= 2) {
if (regionKey === "") {
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;
}
}
el.id = `MultiColumnID:${regionKey}`;
// If something changes in the codeblock we dont necessarily want to update our
// old reference to the region manager. This could be a potential bug area.
if (createNewRegionManager === true) {
// Create a new regional manager.
let elementMarkdownRenderer = new obsidian.MarkdownRenderChild(el);
fileDOMManager.createRegionalManager(regionKey, el, renderErrorRegion, renderColumnRegion);
// Set up the on unload callback. This can be called if the user changes
// the start/settings codeblock in any way. We only want to unload
// if the file is being removed from view.
elementMarkdownRenderer.onunload = () => {
if (fileDOMManager && fileStillInView(sourcePath) === false) {
// console.debug("File not in any markdown leaf. Removing region from dom manager.")
fileDOMManager.removeRegion(regionKey);
}
};
ctx.addChild(elementMarkdownRenderer);
}
let regionalManagerContainer = fileDOMManager.getRegionalContainer(regionKey);
if (regionalManagerContainer !== null) {
let regionalManager = regionalManagerContainer.setRegionSettings(source);
regionalManager.regionParent = el;
}
});
}
loadSettings() {
return __awaiter(this, void 0, void 0, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __awaiter(this, void 0, void 0, function* () {
yield this.saveData(this.settings);
});
}
}
function renderMarkdownFromLines(mdLines, 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 siblings = createDiv();
let markdownRenderChild = new obsidian.MarkdownRenderChild(siblings);
obsidian.MarkdownRenderer.renderMarkdown(mdLines.reduce((prev, current) => {
return prev + "\n" + current;
}, ""), siblings, sourcePath, markdownRenderChild);
return siblings;
}
module.exports = MultiColumnMarkdown;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5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Wx0aUNvbHVtblNldHRpbmdzIHtcblxuICAgIHJldHVybiB7XG4gICAgICAgIG51bWJlck9mQ29sdW1uczogMixcbiAgICAgICAgY29sdW1uTGF5b3V0OiBDb2x1bW5MYXlvdXQuc3RhbmRhcmQsXG4gICAgICAgIGRyYXdCb3JkZXI6IHRydWUsXG4gICAgICAgIGRyYXdTaGFkb3c6IHRydWUsXG4gICAgICAgIGF1dG9MYXlvdXQ6IGZhbHNlLFxuICAgICAgICBjb2x1bW5TaXplOiBTaW5nbGVDb2x1bW5TaXplLm1lZGl1bSxcbiAgICAgICAgY29sdW1uUG9zaXRpb246IENvbHVtbkxheW91dC5zdGFuZGFyZCxcbiAgICAgICAgY29sdW1uU3BhY2luZzogXCJcIixcbiAgICAgICAgY29udGVudE92ZXJmbG93OiBDb250ZW50T3ZlcmZsb3dUeXBlLnNjcm9sbCxcbiAgICAgICAgYWxpZ25tZW50OiBBbGlnbm1lbnRUeXBlLmxlZnRcbiAgICB9XG59IiwiLyoqXG4gKiBGaWxlOiAvc3JjL3V0aWxpdGllcy9zZXR0aW5nc1BhcnNlci50cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gKiBDcmVhdGVkIERhdGU6IEZyaWRheSwgSnVuZSAzcmQgMjAyMiwgODoxNiBwbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gKiBBdXRob3I6IENhbWVyb24gUm9iaW5zb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjIgQ2FtZXJvbiBSb2JpbnNvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gKi9cblxuaW1wb3J0IHsgTXVsdGlDb2x1bW5TZXR0aW5ncywgQ29sdW1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OiBDb2x1bW5MYXlvdXQgPSAoPGFueT5Db2x1bW5MYXlvdXQpW3NldHRpbmdzRGF0YV07XG4gICAgICAgICAgICBpZiAodXNlckRlZkxheW91dCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgcGFyc2VkU2V0dGluZ3MuY29sdW1uTGF5b3V0ID0gdXNlckRlZkxheW91dDtcbiAgICAgICAgICAgICAgICBwYXJzZWRTZXR0aW5ncy5jb2x1bW5Qb3NpdGlvbiA9IHVzZXJEZWZMYXlvdXQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBzZXR0aW5nc0RhdGEgPSBnZXRTZXR0aW5nc0RhdGFGcm9tS2V5cyhzZXR0aW5nc0xpbmUsIERSQVdfQk9SREVSX1JFR0VYX0FSUilcbiAgICAgICAgaWYgKHNldHRpbmdzRGF0YSAhPT0gbnVsbCkge1xuXG4gICAgICAgICAgICBsZXQgaXNCb3JkZXJEcmF3bjogQm9yZGVyT3B0aW9uID0gKDxhbnk+Qm9yZGVyT3B0aW9uKVtzZXR0aW5nc0RhdGFdO1xuICAgICAgICAgICAgaWYgKGlzQm9yZGVyRHJhd24gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoaXNCb3JkZXJEcmF3bikge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIChCb3JkZXJPcHRpb24uZGlzYWJsZWQpOlxuICAgICAgICAgICAgICAgICAgICBjYXNlIChCb3JkZXJPcHRpb24ub2ZmKTpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAoQm9yZGVyT3B0aW9uLmZhbHNlKTpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlZFNldHRpbmdzLmRyYXdCb3JkZXIgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHNldHRpbmdzRGF0YSA9IGdldFNldHRpbmdzRGF0YUZyb21LZXlzKHNldHRpbmdzTGluZSwgRFJBV19TSEFET1dfUkVHRVhfQVJSKVxuICAgICAgICBpZiAoc2V0dGluZ3NEYXRhICE9PSBudWxsKSB7XG5cbiAgICAgICAgICAgIGxldCBpc1NoYWRvd0RyYXduOiBTaGFkb3dPcHRpb24gPSAoPGFueT5TaGFkb3dPcHRpb24pW3NldHRpbmdzRGF0YV07XG4gICAgICAgICAgICBpZiAoaXNTaGFkb3dEcmF3biAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgc3dpdGNoIChpc1NoYWRvd0RyYXduKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgKFNoYWRvd09wdGlvbi5kaXNhYmxlZCk6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgKFNoYWRvd09wdGlvbi5vZmYpOlxuICAgICAgICAgICAgICAgICAgICBjYXNlIChTaGFkb3dPcHRpb24uZmFsc2UpOlxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VkU2V0dGluZ3MuZHJhd1NoYWRvdyA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgc2V0dGluZ3NEYXRhID0gZ2V0U2V0dGluZ3NEYXRhRnJvbUtleXMoc2V0dGluZ3NMaW5lLCBBVVRPX0xBWU9VVF9SRUdFWF9BUlIpXG4gICAgICAgIGlmIChzZXR0aW5nc0RhdGEgIT09IG51bGwpIHtcblxuICAgICAgICAgICAgaWYoc2V0dGluZ3NEYXRhID09PSBcInRydWVcIikge1xuICAgICAgICAgICAgICAgIHBhcnNlZFNldHRpbmdzLmF1dG9MYXlvdXQgPSB0cnVlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBzZXR0aW5nc0RhdGEgPSBnZXRTZXR0aW5nc0RhdGFGcm9tS2V5cyhzZXR0aW5nc0xpbmUsIENPTFVNTl9TUEFDSU5HX1JFR0VYX0FSUik7XG4gICAgICAgIGlmKHNldHRpbmdzRGF0YSAhPT0gbnVsbCkge1xuXG4gICAgICAgICAgICBsZXQgcGFyc2VkID0gZ2V0TGVuZ3RoVW5pdChzZXR0aW5nc0RhdGEudHJpbSgpKTtcbiAgICAgICAgICAgIGxldCBzcGFjaW5nU3RyID0gXCJcIjtcblxuICAgICAgICAgICAgaWYocGFyc2VkLmlzVmFsaWQpIHtcblxuICAgICAgICAgICAgICAgIGxldCBub1VuaXRzU3RyID0gc2V0dGluZ3NEYXRhLnJlcGxhY2UocGFyc2VkLnVuaXRTdHIsIFwiXCIpLnRyaW0oKTtcbiAgICAgICAgICAgICAgICBsZXQgbm9Vbml0c051bSA9IHBhcnNlSW50KG5vVW5pdHNTdHIpO1xuICAgICAgICAgICAgICAgIGlmKGlzTmFOKG5vVW5pdHNOdW0pID09PSBmYWxzZSkge1xuXG4gICAgICAgICAgICAgICAgICAgIHNwYWNpbmdTdHIgPSBgJHtub1VuaXRzU3RyfSR7cGFyc2VkLnVuaXRTdHJ9YFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGxldCBub1VuaXRzTnVtID0gcGFyc2VJbnQoc2V0dGluZ3NEYXRhLnRyaW0oKSk7XG4gICAgICAgICAgICAgICAgaWYoaXNOYU4obm9Vbml0c051bSkgPT09IGZhbHNlKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgc3BhY2luZ1N0ciA9IGAke25vVW5pdHNOdW19cHRgXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBwYXJzZWRTZXR0aW5ncy5jb2x1bW5TcGFjaW5nID0gc3BhY2luZ1N0cjtcbiAgICAgICAgfVxuXG4gICAgICAgIHNldHRpbmdzRGF0YSA9IGdldFNldHRpbmdzRGF0YUZyb21LZXlzKHNldHRpbmdzTGluZSwgQ09OVEVOVF9PVkVSRkxPV19SRUdFWF9BUlIpO1xuICAgICAgICBpZihzZXR0aW5nc0RhdGEgIT09IG51bGwpIHtcblxuICAgICAgICAgICAgbGV0IG92ZXJmbG93VHlwZSA9IENvbnRlbnRPdmVyZmxvd1R5cGUuc2Nyb2xsO1xuXG4gICAgICAgICAgICBzZXR0aW5nc0RhdGEgPSBzZXR0aW5nc0RhdGEudG9Mb3dlckNhc2UoKS50cmltKCk7XG4gICAgICAgICAgICBpZihzZXR0aW5nc0RhdGEgPT09IFwiaGlkZGVuXCIpIHtcbiAgICAgICAgICAgICAgICBvdmVyZmxvd1R5cGUgPSBDb250ZW50T3ZlcmZsb3dUeXBlLmhpZGRlbjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcGFyc2VkU2V0dGluZ3MuY29udGVudE92ZXJmbG93ID0gb3ZlcmZsb3dUeXBlO1xuICAgICAgICB9XG4gICAgICAgIHNldHRpbmdzRGF0YSA9IGdldFNldHRpbmdzRGF0YUZyb21LZXlzKHNldHRpbmdzTGluZSwgQUxJR05NRU5UX1JFR0VYX0FSUik7XG4gICAgICAgIGlmIChzZXR0aW5nc0RhdGEgIT09IG51bGwpIHtcbiAgICAgICAgICAgIGxldCBhbGlnbm1lbnRUeXBlID0gQWxpZ25tZW50VHlwZS5sZWZ0O1xuICAgICAgICAgICAgc2V0dGluZ3NEYXRhID0gc2V0dGluZ3NEYXRhLnRvTG93ZXJDYXNlKCkudHJpbSgpO1xuICAgICAgICAgICAgaWYgKHNldHRpbmdzRGF0YSA9PT0gXCJjZW50ZXJcIikge1xuICAgICAgICAgICAgICAgIGFsaWdubWVudFR5cGUgPSBBbGlnbm1lbnRUeXBlLmNlbnRlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzZXR0aW5nc0RhdGEgPT09IFwicmlnaHRcIikge1xuICAgICAgICAgICAgICAgIGFsaWdub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c3RhcnRQb3NpdGlvbiA9IHJlZ2V4RGF0YS5pbmRleFxuICAgICAgICAgICAgbWF0Y2hMZW5ndGggPSByZWdleERhdGFbMF0ubGVuZ3RoO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZW5kUG9zaXRpb24gPSBzdGFydFBvc2l0aW9uICsgbWF0Y2hMZW5ndGg7XG5cbiAgICByZXR1cm4geyBmb3VuZCwgc3RhcnRQb3NpdGlvbiwgZW5kUG9zaXRpb24sIG1hdGNoTGVuZ3RoIH07XG59XG5cbmNvbnN0IENPTF9SRUdFWF9TVFJTOiBzdHJpbmdbXSA9IFtcIj09PSAqY29sdW1uLWVuZCAqPT09XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCI9PT0gKmVuZC1jb2x1bW4gKj09PVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPT09ICpjb2x1bW4tYnJlYWsgKj09PVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPT09ICpicmVhay1jb2x1bW4gKj09PVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLS0tICpjb2x1bW4tZW5kICotLS1cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIi0tLSAqZW5kLWNvbHVtbiAqLS0tXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCItLS0gKmNvbHVtbi1icmVhayAqLS0tXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCItLS0gKmJyZWFrLWNvbHVtbiAqLS0tXCJdO1xuY29uc3QgQ09MX1JFR0VYX0FSUjogUmVnRXhwW10gPSBbXTtcbmZvcihsZXQgaSA9IDA7IGkgPCBDT0xfUkVHRVhfU1RSUy5sZW5ndGg7IGkrKykge1xuICAgIENPTF9SRUdFWF9BUlIucHVzaChuZXcgUmVnRXhwKENPTF9SRUdFWF9TVFJTW2ldKSk7XG59XG5leHBvcnQgZnVuY3Rpb24gY29udGFpbnNDb2xFbmRUYWcodGV4dDogc3RyaW5nKTogYm9vbGVhbiB7XG5cbiAgICBsZXQgZm91bmQgPSBmYWxzZTtcbiAgICBmb3IobGV0IGkgPSAwOyBpPCBDT0xfUkVHRVhfQVJSLmxlbmd0aDsgaSsrKSB7XG5cbiAgICAgICAgaWYoQ09MX1JFR0VYX0FSUltpXS50ZXN0KHRleHQpKSB7XG4gICAgICAgICAgICBmb3VuZCA9IHRydWU7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBmb3VuZDtcbn1cblxuY29uc3QgQ09MX0VMRU1FTlRfSU5ORVJfVEVYVF9SRUdFWF9TVFJTOiBzdHJpbmdbXSA9IFtcIj0gKmNvbHVtbi1lbmQgKj1cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIj0gKmVuZC1jb2x1bW4gKj1cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIj0gKmNvbHVtbi1icmVhayAqPVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiPSAqYnJlYWstY29sdW1uICo9XCJdXG5jb25zdCBDT0xfRUxFTUVOVF9JTk5FUl9URVhUX1JFR0VYX0FSUjogUmVnRXhwW10gPSBbXTtcbmZvcihsZXQgaSA9IDA7IGkgPCBDT0xfRUxFTUVOVF9JTk5FUl9URVhUX1JFR0VYX1NUUlMubGVuZ3RoOyBpKyspIHtcbiAgICBDT0xfRUxFTUVOVF9JTk5FUl9URVhUX1JFR0VYX0FSUi5wdXNoKG5ldyBSZWdFeHAoQ09MX0VMRU1FTlRfSU5ORVJfVEVYVF9SRUdFWF9TVFJTW2ldKSk7XG59XG5leHBvcnQgZnVuY3Rpb24gZWxJbm5lclRleHRDb250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Db250ZW50ID0gXCJtY20tY29sdW1uLWRpdlwiXG59IiwiLyoqXG4gKiBGaWxlOiAvc3JjL2RvbV9tYW5hZ2VyL3JlZ2lvbmFsX21hbmFnZXJzL1JlZ2lvbk1hbmFnZXIudHMgICAgICAgICAgICAgICAgICAgKlxuICogQ3JlYXRlZCBEYXRlOiBTdW5kYXksIE1heSAyMm5kIDIwMjIsIDc6NDkgcG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpcbiAqIEF1dGhvcjogQ2FtZXJvbiBSb2JpbnNvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKlxuICogQ29weXJpZ2h0IChjKSAyMDIyIENhbWVyb24gUm9iaW5zb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpcbiAqL1xuXG5pbXBvcnQgeyBET01PYmplY3QsIERPTU9iamVjdFRhZywgVGFza0xpc3RET01PYmplY3QgfSBmcm9tICcuLi9kb21PYmplY3QnO1xuaW1wb3J0IHsgTXVsdGlDb2x1bW5TZXR0aW5ncywgQ29sdW1uTGF5b3V0LCBnZXREZWZhdWx0TXVsdGlDb2x1bW5TZXR0aW5ncyB9IGZyb20gXCIuLi8uLi9yZWdpb25TZXR0aW5nc1wiO1xuaW1wb3J0IHsgTXVsdGlDb2x1bW5MYXlvdXRDU1MsIE11bHRpQ29sdW1uU3R5bGVDU1MgfSBmcm9tICcuLi8uLi91dGlsaXRpZXMvY3NzRGVmaW5pdGlvbnMnO1xuaW1wb3J0IHsgRmlsZURPTU1hbmFnZXIgfSBmcm9tICcuLi9kb21NYW5hZ2VyJztcbmltcG9ydCB7IEVsZW1lbnRSZW5kZXJUeXBlLCBnZXRFbGVtZW50UmVuZGVyVHlwZSB9IGZyb20gJ3NyYy91dGlsaXRpZXM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iAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgbGV0IHByZXZTaWJsaW5nSW5uZXJUZXh0ID0gXCJcIlxuICAgICAgICAgICAgbGV0IHByZXZTaWJsaW5nT2Zmc2V0ID0gMDtcbiAgICAgICAgICAgIGZvcihsZXQgaSA9IHNpYmxpbmdzQWJvdmUuY2hpbGRyZW4ubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcblxuICAgICAgICAgICAgICAgIGxldCBvYmogPSBzaWJsaW5nc0Fib3ZlLmNoaWxkcmVuW2ldIGFzIEhUTUxFbGVtZW50O1xuICAgICAgICAgICAgICAgIGlmKG9iai5pbm5lclRleHQgIT09IFwiXCIpIHtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICAgICAgcHJldlNpYmxpbmdJbm5lclRleHQgPSBvYmouaW5uZXJUZXh0O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwcmV2U2libGluZ09mZnNldCsrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gdGhpcy5kb21MaXN0Lmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZG9tTGlzdFtpXS5ub2RlS2V5ID09PSBwcmV2U2libGluZ0lubmVyVGV4dCkge1xuICAgICAgICAgICAgICAgICAgICBhZGRBdEluZGV4ID0gaSArIDEgKyBwcmV2U2libGluZ09mZnNldDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgbGV0IG5leHRFbEluZGV4ID0gYWRkQXRJbmRleDtcbiAgICAgICAgbGV0IG5leHRPYmpUZXh0ID0gXCJcIjtcbiAgICAgICAgaWYgKG5leHRPYmogIT09IHVuZGVmaW5lZCkge1xuXG4gICAgICAgICAg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5nIGNhbnZhcyByZS1yZW5kZXJcIilcbiAgICAgICAgICAgIGNvbnRhaW5lckVsZW1lbnQuYXBwZW5kQ2hpbGQob3JpZ2luYWxFbGVtZW50KTtcblxuICAgICAgICAgICAgZnVuY3Rpb24gY2xvbmVDYW52YXMob3JpZ2luYWxDYW52YXM6IEhUTUxDYW52YXNFbGVtZW50KTogSFRNTENhbnZhc0VsZW1lbnQge1xuXG4gICAgICAgICAgICAgICAgLy9jcmVhdGUgYSBuZXcgY2FudmFzXG4gICAgICAgICAgICAgICAgbGV0IGNsb25lZENhbnZhczogSFRNTENhbnZhc0VsZW1lbnQgPSBvcmlnaW5hbENhbnZhcy5jbG9uZU5vZGUodHJ1ZSkgYXMgSFRNTENhbnZhc0VsZW1lbnQ7XG4gICAgICAgICAgICAgICAgbGV0IGNvbnRleHQ6IENhbnZhc1JlbmRlcmluZ0NvbnRleHQyRCA9IGNsb25lZENhbnZhcy5nZXRDb250ZXh0KCcyZCcpO1xuICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgLy9zZXQgZGltZW5zaW9uc1xuICAgICAgICAgICAgICAgIGNsb25lZENhbnZhcy53aWR0aCA9IG9yaWdpbmFsQ2FudmFzLndpZHRoO1xuICAgICAgICAgICAgICAgIGNsb25lZENhbnZhcy5oZWlnaHQgPSBvcmlnaW5hbENhbnZhcy5oZWlnaHQ7XG5cbiAgICAgICAgICAgICAgICBpZihjbG9uZWRDYW52YXMud2lkdGggPT09IDAgfHwgY2xvbmVkQ2FudmFzLmhlaWdodCA9PT0gMCl7XG4gICAgICAgICAgICAgICAgICAgIC8vIERvbnQgd2FudCB0byByZW5kZXIgaWYgdGhlIHdpZHRoIGlzIDAgYXMgaXQgdGhyb3dzIGFuIGVycm9yXG4gICAgICAgICAgICAgICAgICAgIC8vIHdvdWxkIGhhcHBlbiBpZiB0aGUgb2xkIGNhbnZhcyBoYXNudCBiZWVuIHJlbmRlcmVkIHlldC5cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsb25lZENhbnZhcztcbiAgICAgICAgICAgICAgICB9IFxuXG4gICAgICAgICAgICAgICAgLy9hcHBseSB0aGUgb2xkIGNhbnZhcyB0byB0aGUgbmV3IG9uZVxuICAgICAgICAgICAgICAgIGNvbnRleHQuZHJhd0ltYWdlKG9yaWdpbmFsQ2FudmFzLCAwLCAwKTtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIC8vcmV0dXJuIHRoZSBuZXcgY2FudmFzXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNsb25lZENhbnZhcztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbGV0IGNhbnZhcyA9IHNlYXJjaENoaWxkcmVuRm9yTm9kZVR5cGUob3JpZ2luYWxFbGVtZW50LCBcImNhbnZhc1wiKTtcbiAgICAgICAgICAgIGlmKGNhbnZhcyAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGRvbUVsZW1lbnQudXBkYXRlQ2xvbmVkRWxlbWVudChvcmlnaW5hbEVsZW1lbnQuY2xvbmVOb2RlKHRydWUpIGFzIEhUTUxEaXZFbGVtZW50KTtcbiAgICAgICAgICAgICAgICBjbG9uZWRFbGVtZW50ID0gZG9tRWxlbWVudC5jbG9uZWRFbGVtZW50O1xuICAgICAgICAgICAgICAgIGNsb25lZEVsZW1lbnQuYWRkQ2xhc3MoTXVsdGlDb2x1bW5MYXlvdXRDU1MuQ2xvbmVkRWxlbWVudFR5cGUpO1xuICAgICAgICAgICAgICAgIGNsb25lZEVsZW1lbnQucmVtb3ZlQ2xhc3NlcyhbTXVsdGlDb2x1bW5TdHlsZUNTUy5SZWdpb25Db250ZW50LCBNdWx0aUNvbHVtbkxheW91dENTUy5PcmlnaW5hbEVsZW1lbnRUeXBlXSk7XG4gICAgICAgICAgICAgICAgY29udGFpbmVyRWxlbWVudC5hcHBlbmRDaGlsZChjbG9uZWRFbGVtZW50KTtcblxuICAgICAgICAgICAgICAgIGZvciAobGV0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IDIpIHtcblxuICAgICAgICAgICAgc3dpdGNoKHNldHRpbmdzLmNvbHVtbkxheW91dCkge1xuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LnN0YW5kYXJkKTpcbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5taWRkbGUpOlxuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmNlbnRlcik6XG4gICAgICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQudGhpcmQpOlxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5Ud29FcXVhbENvbHVtbnN9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlR3b0VxdWFsQ29sdW1uc31gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5sZWZ0KTpcbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5maXJzdCk6XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlR3b0NvbHVtbkxhcmdlfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgbWNtLWNvbHVtbi1zcGFjZXJgLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXR0cjoge1wic3R5bGVcIjogc3R5bGVTdHJ9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5Ud29Db2x1bW5TbWFsbH1gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5yaWdodCk6XG4gICAgICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc2Vjb25kKTpcbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5sYXN0KTpcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtblN0eWxlQ1NTLkNvbHVtbkNvbnRlbnR9ICR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuVHdvQ29sdW1uU21hbGx9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlR3b0NvbHVtbkxhcmdlfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmKHNldHRpbmdzLm51bWJlck9mQ29sdW1ucyA9PT0gMykge1xuXG4gICAgICAgICAgICBzd2l0Y2goc2V0dGluZ3MuY29sdW1uTGF5b3V0KSB7XG4gICAgICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc3RhbmRhcmQpOlxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5UaHJlZUVxdWFsQ29sdW1uc31gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYG1jbS1jb2x1bW4tc3BhY2VyYCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGF0dHI6IHtcInN0eWxlXCI6IHN0eWxlU3RyfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtblN0eWxlQ1NTLkNvbHVtbkNvbnRlbnR9ICR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuVGhyZWVFcXVhbENvbHVtbnN9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlRocmVlRXF1YWxDb2x1bW5zfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmxlZnQpOlxuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmZpcnN0KTpcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtblN0eWxlQ1NTLkNvbHVtbkNvbnRlbnR9ICR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuVGhyZWVDb2x1bW5fTGFyZ2V9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlRocmVlQ29sdW1uX1NtYWxsfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgbWNtLWNvbHVtbi1zcGFjZXJgLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXR0cjoge1wic3R5bGVcIjogc3R5bGVTdHJ9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5UaHJlZUNvbHVtbl9TbWFsbH1gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5taWRkbGUpOlxuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0LmNlbnRlcik6XG4gICAgICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQuc2Vjb25kKTpcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtblN0eWxlQ1NTLkNvbHVtbkNvbnRlbnR9ICR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuVGhyZWVDb2x1bW5fU21hbGx9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlRocmVlQ29sdW1uX0xhcmdlfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgbWNtLWNvbHVtbi1zcGFjZXJgLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXR0cjoge1wic3R5bGVcIjogc3R5bGVTdHJ9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5UaHJlZUNvbHVtbl9TbWFsbH1gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlKENvbHVtbkxheW91dC5yaWdodCk6XG4gICAgICAgICAgICAgICAgY2FzZShDb2x1bW5MYXlvdXQudGhpcmQpOlxuICAgICAgICAgICAgICAgIGNhc2UoQ29sdW1uTGF5b3V0Lmxhc3QpOlxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2cy5wdXNoKG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uU3R5bGVDU1MuQ29sdW1uQ29udGVudH0gJHtNdWx0aUNvbHVtbkxheW91dENTUy5UaHJlZUNvbHVtbl9TbWFsbH1gXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYG1jbS1jb2x1bW4tc3BhY2VyYCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGF0dHI6IHtcInN0eWxlXCI6IHN0eWxlU3RyfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnMucHVzaChtdWx0aUNvbHVtblBhcmVudC5jcmVhdGVEaXYoe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtblN0eWxlQ1NTLkNvbHVtbkNvbnRlbnR9ICR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuVGhyZWVDb2x1bW5fU21hbGx9YFxuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIG11bHRpQ29sdW1uUGFyZW50LmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGBtY20tY29sdW1uLXNwYWNlcmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiB7XCJzdHlsZVwiOiBzdHlsZVN0cn1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzLnB1c2gobXVsdGlDb2x1bW5QYXJlbnQuY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5Db250ZW50fSAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlRocmVlQ29sdW1uX0xhcmdlfWBcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjb2x1bW5Db250ZW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GVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcbiAgICAgICAgICAgIHBhcmVudEVsZW1lbnQuY2hpbGRyZW5baV0uZGV0YWNoKCk7XG4gICAgICAgIH1cbiAgICAgICAgcGFyZW50RWxlbWVudC5hcHBlbmRDaGlsZChtYXJrZG93blJlbmRlckNoaWxkLmNvbnRhaW5lckVsKTtcblxuICAgICAgICB0aGlzLmFwcGVuZEVsZW1lbnRzVG9Db2x1bW5zKHJlZ2lvbkVsZW1lbnRzLCBjb2x1bW5Db250ZW50RGl2cywgc2V0dGluZ3MpO1xuICAgIH1cblxuICAgIHByaXZhdGUgYXBwZW5kRWxlbWVudHNUb0NvbHVtbnMocmVnaW9uRWxlbWVudHM6IERPTU9iamVjdFtdLCBjb2x1bW5Db250ZW50RGl2czogSFRNTERpdkVsZW1lbnRbXSwgc2V0dGluZ3M6IE11bHRpQ29sdW1uU2V0dGluZ3MpIHtcblxuICAgICAgICBsZXQgY29sdW1uSW5kZXggPSAwO1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJlZ2lvbkVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XG5cbiAgICAgICAgICAgIGlmIChyZWdpb25FbGVtZW50c1tpXS50YWcgPT09IERPTU9iamVjdFRhZy5ub25lIHx8XG4gICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0udGFnID09PSBET01PYmplY3RUYWcuY29sdW1uQnJlYWspIHtcblxuICAgICAgICAgICAgICAgIC8vIFdlIHN0b3JlIHRoZSBlbGVtZW50cyBpbiBhIHdyYXBwZXIgY29udGFpbmVyIHVudGlsIHdlIGRldGVybWluZVxuICAgICAgICAgICAgICAgIGxldCBlbGVtZW50ID0gY3JlYXRlRGl2KHtcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBNdWx0aUNvbHVtbkxheW91dENTUy5Db2x1bW5EdWFsRWxlbWVudENvbnRhaW5lcixcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIGlmKHNldHRpbmdzLmNvbnRlbnRPdmVyZmxvdyA9PT0gQ29udGVudE92ZXJmbG93VHlwZS5oaWRkZW4pIHtcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5hZGRDbGFzcyhNdWx0aUNvbHVtbkxheW91dENTUy5Db250ZW50T3ZlcmZsb3dIaWRkZW4pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmFkZENsYXNzKE11bHRpQ29sdW1uTGF5b3V0Q1NTLkNvbnRlbnRPdmVyZmxvd0F1dG9TY3JvbGwpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYoc2V0dGluZ3MuYWxpZ25tZW50ID09PSBBbGlnbm1lbnRUeXBlLmNlbnRlcikge1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmFkZENsYXNzKE11bHRpQ29sdW1uTGF5b3V0Q1NTLkFsaWdubWVudENlbnRlcilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoc2V0dGluZ3MuYWxpZ25tZW50ID09PSBBbGlnbm1lbnRUeXBlLnJpZ2h0KSB7XG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuYWRkQ2xhc3MoTXVsdGlDb2x1bW5MYXlvdXRDU1MuQWxpZ25tZW50UmlnaHQpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmFkZENsYXNzKE11bHRpQ29sdW1uTGF5b3V0Q1NTLkFsaWdubWVudExlZnQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0uZWxlbWVudENvbnRhaW5lciA9IGVsZW1lbnQ7XG5cbiAgICAgICAgICAgICAgICAvLyBPdGhlcndpc2Ugd2UganVzdCBtYWtlIGEgY29we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W1uQnJlYWspIHtcblxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2c1tjb2x1bW5JbmRleF0uYXBwZW5kQ2hpbGQoZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLyoqXG4gICAgICAgICAgICAgICAgICogSWYgdGhlIHRhZyBpcyBhIGNvbHVtbiBicmVhayB3ZSB1cGRhdGUgdGhlIGNvbHVtbiBpbmRleCBhZnRlclxuICAgICAgICAgICAgICAgICAqIGFwcGVuZGluZyB0aGUgaXRlbSB0byB0aGUgY29sdW1uIGRpdi4gVGhpcyBrZWVwcyB0aGUgbWFpbiBET01cbiAgICAgICAgICAgICAgICAgKiBjbGVhbmVyIGJ5IHJlbW92aW5nIG90aGVyIGl0ZW1zIGFuZCBwbGFjaW5nIHRoZW0gYWxsIHdpdGhpblxuICAgICAgICAgICAgICAgICAqIGEgcmVnaW9uIGNvbnRhaW5lci5cbiAgICAgICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICAgICBpZiAocmVnaW9uRWxlbWVudHNbaV0udGFnID09PSBET01PYmplY3RUYWcuY29sdW1uQnJlYWsgJiZcbiAgICAgICAgICAgICAgICAgICAgKGNvbHVtbkluZGV4ICsgMSkgPCBzZXR0aW5ncy5udW1iZXJPZkNvbHVtbnMpIHtcblxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5JbmRleCsrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuIiwiaW1wb3J0IHsgRE9NT2JqZWN0LCBET01PYmplY3RUYWcsIFRhc2tMaXN0RE9NT2JqZWN0IH0gZnJvbSAnLi4vZG9tT2JqZWN0JztcbmltcG9ydCB7IE11bHRpQ29sdW1uU2V0dGluZ3MsIENvbHVtbkxheW91dCwgU2luZ2xlQ29sdW1uU2l6ZSB9IGZyb20gXCIuLi8uLi9yZWdpb25TZXR0aW5nc1wiO1xuaW1wb3J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ZW1lbnRzW2ldLm9yaWdpbmFsRWxlbWVudC5jbG9uZU5vZGUodHJ1ZSkgYXMgSFRNTERpdkVsZW1lbnQ7XG4gICAgICAgICAgICAgICAgbGV0IGhlYWRpbmdDb2xsYXBzZUVsZW1lbnQgPSBnZXRIZWFkaW5nQ29sbGFwc2VFbGVtZW50KGNsb25lZEVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIGlmKGhlYWRpbmdDb2xsYXBzZUVsZW1lbnQgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyByZW1vdmVzIHRoZSBjb2xsYXBzZSBhcnJvdyBmcm9tIHRoZSB2aWV3IGlmIGl0IGV4aXN0cy5cbiAgICAgICAgICAgICAgICAgICAgaGVhZGluZ0NvbGxhcHNlRWxlbWVudC5kZXRhY2goKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZWdpb25FbGVtZW50c1tpXS5jbG9uZWRFbGVtZW50ID0gY2xvbmVkRWxlbWVudDtcbiAgICAgICAgICAgICAgICBlbGVtZW50LmFwcGVuZENoaWxkKGNsb25lZEVsZW1lbnQpO1xuXG4gICAgICAgICAgICAgICAgaWYgKHJlZ2lvbkVsZW1lbnRzW2ldIGluc3RhbmNlb2YgVGFza0xpc3RET01PYmplY3QpIHtcblxuICAgICAgICAgICAgICAgICAgICB0aGlzLmZpeENsb25lZENoZWNrTGlzdEJ1dHRvbnMocmVnaW9uRWxlbWVudHNbaV0gYXMgVGFza0xpc3RET01PYmplY3QsIHRydWUpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChlbGVtZW50ICE9PSBudWxsKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdi5hcHBlbmRDaGlsZChlbGVtZW50KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjcmVhdGVDb2x1bW5Db250ZW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GF5LCBNYXkgMjJuZCAyMDIyLCAxMDoyMyBwbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqXG4gKiBBdXRob3I6IENhbWVyb24gUm9iaW5zb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKlxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpcbiAqIENvcHlyaWdodCAoYykgMjAyMiBDYW1lcm9uIFJvYmluc29uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqXG4gKi9cblxuaW1wb3J0IHsgRE9NT2JqZWN0LCBET01PYmplY3RUYWcsIFRhc2tMaXN0RE9NT2JqZWN0IH0gZnJvbSAnLi4vZG9tT2JqZWN0JztcbmltcG9ydCB7IE11bHRpQ29sdW1uU2V0dGluZ3MgfSBmcm9tIFwiLi4vLi4vcmVnaW9uU2V0dGluZ3NcIjtcbmltcG9ydCB7IE11bHRpQ29sdW1uTGF5b3V0Q1NTLCBNdWx0aUNvbHVtblN0eWxlQ1NTIH0gZnJvbSAnLi4vLi4vdXRpbGl0aWVzL2Nzc0RlZmluaXRpb25zJztcbmltcG9ydCB7IFJlZ2lvbk1hbmFnZXIgfSBmcm9tICcuL3JlZ2lvbk1hbmFnZXInO1xuaW1wb3J0IHsgZ2V0SGVhZGluZ0NvbGxhcHNlRWxlbWVudCwgaGFzSGVhZGVyIH0gZnJvbSAnc3JjL3V0aWxpdGllcy9lbGVtZW50UmVuZGVyVHlwZVBhcnNlcic7XG5cbmV4cG9ydCBjbGFzcyBBdXRvTGF5b3V0UmVnaW9uTWFuYWdlciBleHRlbmRzIFJlZ2lvbk1hbmFnZXIge1xuXG4gICAgcHJpdmF0ZSBwcmV2aW91c0NvbHVtbkhlaWdodHM6IG51bWJlcltdID0gW11cblxuICAgIHByaXZhdGUgY29sdW1uUGFyZW50OiBIVE1MRGl2RWxlbW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FJlZ2lvbiAmJlxuICAgICAgICAgICAgICAgICAgICBlbC50YWcgIT09IERPTU9iamVjdFRhZy5yZWdpb25TZXR0aW5ncyAmJlxuICAgICAgICAgICAgICAgICAgICBlbC50YWcgIT09IERPTU9iamVjdFRhZy5zdGFydFJlZ2lvbikge1xuICAgIFxuICAgICAgICAgICAgICAgICAgICAvLyBBZGQgZWxlbWVudCB0byByZW5kZXJlZCBkaXYgc28gd2UgY2FuIGV4dHJhY3QgdGhlIHJlbmRlcmVkIGhlaWdodC5cbiAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnNbMF0uYXBwZW5kQ2hpbGQoZWwub3JpZ2luYWxFbGVtZW50KVxuICAgICAgICAgICAgICAgICAgICBlbC5lbGVtZW50UmVuZGVyZWRIZWlnaHQgPSBlbC5vcmlnaW5hbEVsZW1lbnQuY2xpZW50SGVpZ2h0XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzWzBdLnJlbW92ZUNoaWxkKGVsLm9yaWdpbmFsRWxlbWVudClcbiAgICAgICAgICAgICAgICB9XG4gICAgXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVsLmVsZW1lbnRSZW5kZXJlZEhlaWdodCBcbiAgICAgICAgICAgIH0pLnJlZHVjZSgocHJldjogbnVtYmVyLCBjdXJyOiBudW1iZXIpID0+IHsgcmV0dXJuIHByZXYgKyBjdXJyIH0sIDApO1xuICAgICAgICAgICAgbGV0IG1heENvbHVtbkNvbnRlbnRIZWlnaHQgPSBNYXRoLnRydW5jKHRvdGFsSGVpZ2h0IC8gc2V0dGluZ3MubnVtYmVyT2ZDb2x1bW5zKTtcblxuICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IGNvbHVtbkNvbnRlbnREaXZzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IGNvbHVtbkNvbnRlbnREaXZzW2ldLmNoaWxkcmVuLmxlbmd0aCAtIDE7IGogPj0gMDsgai0tKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbkNvbnRlbnREaXZzW2ldLmNoaWxkcmVuW2pdLmRldGFjaCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbGV0IGNvbHVtbkluZGV4ID0gMDtcbiAgICAgICAgICAgIGxldCBjdXJyZW50Q29sdW1uSGVpZ2h0ID0gMDtcbiAgICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrU2hvdWxkU3dpdGNoQ29sdW1ucyhuZXh0RWxlbWVudEhlaWdodDogbnVtYmVyKSB7XG4gICAgXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5IZWlnaHQgKyBuZXh0RWxlbWVudEhlaWdodCA+IG1heENvbHVtbkNvbnRlbnRIZWlnaHQgJiZcbiAgICAgICAgICAgICAgICAgICAgKGNvbHVtbkluZGV4ICsgMSkgPCBzZXR0aW5ncy5udW1iZXJPZkNvbHVtbnMpIHtcbiAgICBcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uSW5kZXgrKztcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudENvbHVtbkhlaWdodCA9IDA7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJlZ2lvbkVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XG5cbiAgICAgICAgICAgICAgICBpZiAocmVnaW9uRWxlbWVudHNbaV0udGFnID09PSBET01PYmplY3RUYWcubm9uZSB8fFxuICAgICAgICAgICAgICAgICAgICByZWdpb25FbGVtZW50c1tpXS50YWcgPT09IERPTU9iamVjdFRhZy5jb2x1bW5CcmVhaykge1xuICAgIFxuICAgICAgICAgICAgICAgICAgICAvKipcbiAgICAgICAgICAgICAgICAgICAgICogSGVyZSB3ZSBjaGVjayBpZiB3ZSBuZWVkIHRvIHN3YXAgdG8gdGhlIG5leHQgY29sdW1uIGZvciB0aGUgY3VycmVudCBlbGVtZW50LlxuICAgICAgICAgICAgICAgICAgICAgKiBJZiB0aGUgdXNlciB3YW50cyB0byBrZWVwIGhlYWRpbmdzIHdpdGggdGhlIGNvbnRlbnQgYmVsb3cgaXQgd2UgYWxzbyBtYWtlIHN1cmVcbiAgICAgICAgICAgICAgICAgICAgICogdGhhdCB0aGUgbGFzdCBpdGVtIGluIGEgY29sdW1uIGlzIG5vdCBhIGhlYWRlciBlbGVtZW50IGJ5IHVzaW5nIHRoZSBoZWFkZXIgYW5kXG4gICAgICAgICAgICAgICAgICAgICAqIHRoZSBuZXh0IGVsZW1lbnQncyBoZWlnaHQgYXMgdGhlIGhlaWdodCB2YWx1ZS4gXG4gICAgICAgICAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgICAgICAgICBpZihoYXNIZWFkZXIocmVnaW9uRWxlbWVudHNbaV0ub3JpZ2luYWxFbGVtZW50KSA9PT0gdHJ1ZSkgeyAvLyBUT0RPOiBBZGQgdGhpcyBhcyBzZWxlY3RhYmxlIG9wdGlvbi5cbiAgICBcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBoZWFkZXJBbmROZXh0RWxlbWVudEhlaWdodCA9IHJlZ2lvbkVsZW1lbnRzW2ldLmVsZW1lbnRSZW5kZXJlZEhlaWdodDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKGkgPCByZWdpb25FbGVtZW50cy5sZW5ndGggLSAxKSB7XG4gICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyQW5kTmV4dEVsZW1lbnRIZWlnaHQgKz0gcmVnaW9uRWxlbWVudHNbaSArIDFdLmVsZW1lbnRSZW5kZXJlZEhlaWdodDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICBcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrU2hvdWxkU3dpdGNoQ29sdW1ucyhoZWFkZXJBbmROZXh0RWxlbWVudEhlaWdodCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Nob3VsZFN3aXRjaENvbHVtbnMocmVnaW9uRWxlbWVudHNbaV0uZWxlbWVudFJlbmRlcmVkSGVpZ2h0KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50Q29sdW1uSGVpZ2h0ICs9IHJlZ2lvbkVsZW1lbnRzW2ldLmVsZW1lbnRSZW5kZXJlZEhlaWdodFxuICAgIFxuICAgIFxuICAgICAgICAgICAgICAgICAgICAvKipcbiAgICAgICAgICAgICAgICAgICAgICogV2Ugc3RvcmUgdGhlIGVsZW1lbnRzIGluIGEgd3JhcHBlciBjb250YWluZXIgdW50aWwgd2UgZGV0ZXJtaW5lIGlmIHdlIHdhbnQgdG8gXG4gICAgICAgICAgICAgICAgICAgICAqIHVzZSB0aGUgb3JpZ2luYWwgZWxlbWVudCBvciBhIGNsb25lIG9mIHRoZSBlbGVtZW50LiBUaGlzIGhlbHBzIHVzIGJ5IGFsbG93aW5nIFxuICAgICAgICAgICAgICAgICAgICAgKiB1cyB0byBjcmVhdGUgYSB2aXN1YWwgb25seSBjbG9uZSB3aGlsZSB0aGUgdXBkYXRlIGxvb3AgbW92ZXMgdGhlIG9yaWdpbmFsIGVsZW1lbnQgXG4gICAgICAgICAgICAgICAgICAgICAqIGludG8gdGhlIGNvbHVtbnMuXG4gICAgICAgICAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgICAgICAgICBsZXQgZWxlbWVudCA9IGNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE11bHRpQ29sdW1uTGF5b3V0Q1NTLkNvbHVtbkR1YWxFbGVtZW50Q29udGFpbmVyLFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0uZWxlbWVudENvbnRhaW5lciA9IGVsZW1lbnQ7XG4gICAgXG4gICAgICAgICAgICAgICAgICAgIGxldCBjbG9uZWRFbGVtZW50ID0gcmVnaW9uRWxlbWVudHNbaV0uY2xvbmVkRWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgaWYocmVnaW9uRWxlbWVudHNbaV0uY2xvbmVkRWxlbWVudCA9PT0gbnVsbCkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBjbG9uZWRFbGVtZW50ID0gcmVnaW9uRWxlbWVudHNbaV0ub3JpZ2luYWxFbGVtZW50LmNsb25lTm9kZSh0cnVlKSBhcyBIVE1MRGl2RWxlbWVudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBoZWFkaW5nQ29sbGFwc2VFbGVtZW50ID0gZ2V0SGVhZGluZ0NvbGxhcHNlRWxlbWVudChjbG9uZWRFbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKGhlYWRpbmdDb2xsYXBzZUVsZW1lbnQgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHJlbW92ZXMgdGhlIGNvbGxhcHNlIGFycm93IGZyb20gdGhlIHZpZXcgaWYgaXQgZXhpc3RzLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRpbmdDb2xsYXBzZUVsZW1lbnQuZGV0YWNoKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0uY2xvbmVkRWxlbWVudCA9IGNsb25lZEVsZW1lbnQ7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5hcHBlbmRDaGlsZChjbG9uZWRFbGVtZW50KTtcbiAgICBcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlZ2lvbkVsZW1lbnRzW2ldIGluc3RhbmNlb2YgVGFza0xpc3RET01PYmplY3QpIHtcbiAgICBcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZml4Q2xvbmVkQ2hlY2tMaXN0QnV0dG9ucyhyZWdpb25FbGVtZW50c1tpXSBhcyBUYXNrTGlzdERPTU9iamVjdCwgdHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICBcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQgIT09IG51bGwgJiYgXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db250ZW50RGl2c1tjb2x1bW5JbmRleF0gJiYgXG4gICAgICAgICAgICAgICAgICAgICAgICByZWdpb25FbGVtZW50c1tpXS50YWcgIT09IERPTU9iamVjdFRhZy5jb2x1bW5CcmVhaykge1xuICAgIFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uQ29udGVudERpdnNbY29sdW1uSW5kZXhdLmFwcGVuZENoaWxkKGVsZW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVnaW9uRWxlbWVudHNbaV0uZWxlbWVudFJlbmRlcmVkSGVpZ2h0ID0gZWxlbWVudC5jbGllbnRIZWlnaHQ7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICBcbiAgICAgICAgICAgICAgICAgICAgLyoqXG4gICAgICAgICAgICAgICAgICAgICAqIElmIHRoZSB0YWcgaXMgYSBjb2x1bW4gYnJlYWsgd2UgdXBkYXRlIHRoZSBjb2x1bW4gaW5kZXggYWZ0ZXJcbiAgICAgICAgICAgICAgICAgICAgICogYXBwZW5kaW5nIHRoZSBpdGVtIHRvIHRoZSBjb2x1bW4gZGl2LiBUaGlzIGtlZXBzIHRoZSBtYWluIERPTVxuICAgICAgICAgICAgICAgICAgICAgKiBjbGVhbmVyIGJ5IHJlbW92aW5nIG90aGVyIGl0ZW1zIGFuZCBwbGFjaW5nIHRoZW0gYWxsIHdpdGhpblxuICAgICAgICAgICAgICAgICAgICAgKiBhIHJlZ2lvbiBjb250YWluZXIuXG4gICAgICAgICAgICAgICAgICAgICAqIFxuICAgICAgICAgICAgICAgICAgICAgKiBSZW1vdmluZyB0aGUgZW5kIGNvbHVtbiB0YWcgYXMgYW4gb3B0aW9uIGZvciBub3cuXG4gICAgICAgICAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgICAgICAgICAvLyBpZiAocmVnaW9uRWxlbWVudHNbaV0udGFnID09PSBET01PYmplY3RUYWcuY29sdW1uQnJlYWsgJiZcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgKGNvbHVtbkluZGV4ICsgMSkgPCBzZXR0aW5ncy5udW1iZXJPZkNvbHVtbnMpIHtcbiAgICBcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgIGNvbHVtbkluZGV4Kys7XG4gICAgICAgICAgICAgICAgICAgIC8vICAgICBjdXJyZW50Q29sdW1uSGVpZ2h0ID0gMDtcbiAgICAgICAgICAgICAgICAgICAgLy8gfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBBdHRlbXB0IHRvIGJhbGFuY2VkIHRoZSBlbGVtZW50cy4gV2UgbmVlZCB0byBpdGVyYXRlIG92ZXIgdGhlIGVsZW1lbnRzIG11bHRpcGxlIHRpbWVzIGJlY2F1c2VcbiAgICAgICAgICogb3VyIGluaXRpYWwgYmFsYW5jZSBlc3RpbWF0ZSBtYXkgbm90IGJlIHBlcmZlY3RseSBiYWxhbmNlZCBkdWUgdG8gZGlmZmVyZW50IGNvbHVtbiB3aWR0aHMgY2F1c2luZyBcbiAgICAgICAgICogZWxlbWVudHMgd2l0aGluIHRoZW0gdG8gYmUgb2YgZGlmZmVyZW50IGhlaWdodHMuIFRoaXMgY2FuIGNhdXNlIHRoZSBlbGVtZW50cyB0byBqdW1wIGFyb3VuZCBvbiBcbiAgICAgICAgICogc3Vic2lxdWVudCB1cGRhdGUgbG9vcHMgd2hpY2ggaXMgbm90IGlkZWFsLiBIZXJlIHdlIHJl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RlcmVkSGVpZ2h0IFxuICAgICAgICAgICAgfSkucmVkdWNlKChwcmV2OiBudW1iZXIsIGN1cnI6IG51bWJlcikgPT4geyByZXR1cm4gcHJldiArIGN1cnIgfSwgMCk7XG4gICAgICAgICAgICBsZXQgbWF4Q29sdW1uQ29udGVudEhlaWdodCA9IE1hdGgudHJ1bmModG90YWxIZWlnaHQgLyB0aGlzLnJlZ2lvbmFsU2V0dGluZ3MubnVtYmVyT2ZDb2x1bW5zKTtcblxuICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IHRoaXMuY29sdW1uRGl2cy5sZW5ndGggLSAxOyBpKyspIHtcblxuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5IZWlnaHQgPSAwXG4gICAgICAgICAgICAgICAgZm9yKGxldCBqID0gMDsgaiA8IHRoaXMuY29sdW1uRGl2c1tpXS5jaGlsZHJlbi5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgICAgICBjb2x1bW5IZWlnaHQgKz0gdGhpcy5jb2x1bW5EaXZzW2ldLmNoaWxkcmVuW2pdLmNsaWVudEhlaWdodFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKGNvbHVtbkhlaWdodCA+IG1heENvbHVtbkNvbnRlbnRIZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsaWRDb2x1bW5zID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmKHZhbGlkQ29sdW1ucyA9PT0gZmFsc2UpIHtcblxuICAgICAgICAgICAgdGhpcy5yZW5kZXJDb2x1bW5NYXJrZG93bih0aGlzLnJlZ2lvblBhcmVudCwgdGhpcy5kb21MaXN0LCB0aGlzLnJlZ2lvbmFsU2V0dGluZ3MpO1xuICAgICAgICB9XG5cbiAgICAgICAgc3VwZXIudXBkYXRlUmVuZGVyZWRNYXJrZG93bigpO1xuICAgIH1cbn1cblxuIiwiLyoqXG4gKiBGaWxlOiAvc3JjL2RvbV9tYW5hZ2VyL3JlZ2lvbmFsX21hbmFnZXJzL3JlZ2lvbk1hbmFnZXJDb250YWluZXIudHMgICAgICAgICAgKlxuICogQ3JlYXRlZCBEYXRlOiBTdW5kYXksIE1heSAyMm5kIDIwMjIsIDc6NTAgcG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpcbiAqIEF1dGhvcjogQ2FtZXJvbiBSb2JpbnNvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKlxuICogQ29weXJpZ2h0IChjKSAyMDIyIENhbWVyb24gUm9iaW5zb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpcbiAqL1xuXG5pbXBvcnQgeyBwYXJzZUNvbHVtblNldHRpbmdzLCBwYXJzZVNpbmdsZUNvbHVtblNldHRpbmdzIH0gZnJvbSBcIi4uLy4uL3V0aWxpdGllcy9zZXR0aW5nc1BhcnNlclwiO1xuaW1wb3J0IHsgRE9NT2JqZWN0IH0gZnJvbSAnLi4vZG9tT2JqZWN0JztcbmltcG9ydCB7IE11bHRpQ29sdW1uU2V0dGluZ3MsIGdldERlZmF1bHRNdWx0aUNvbHVtblNldHRpbmdzIH0gZnJvbSBcIi4uLy4uL3JlZ2lvblNldHRpbmdzXCI7XG5pbXBvcnQgeyBGaWxlRE9NTWFuYWdlciB9IGZyb20gJy4uL2RvbU1hbmFnZXInO1xuaW1wb3J0IHsgU3RhbmRhcmRNdWx0aUNvbHVtblJlZ2lvbk1hbmFnZXIgYXMgU3RhbmRhcmRNdWx0aUNvbHVtblJlZ2lvbk1hbmFnZXIgfSBmcm9tICcuL3N0YW5kYXJkTXVsdGlDb2x1bW5SZWdp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blxyXG4gICAgICAgICAgICAgICAgbGV0IG5vdGljZVN0cmluZyA9IGBUb2dnbGVkIG1vYmlsZSByZW5kZXJpbmcgJHt0aGlzLnNldHRpbmdzLnJlbmRlck9uTW9iaWxlID8gXCJvblwiIDogXCJvZmZcIn0uYFxyXG4gICAgICAgICAgICAgICAgaWYoUGxhdGZvcm0uaXNNb2JpbGUgPT09IHRydWUpIHtcclxuICAgICAgICAgICAgICAgICAgICBub3RpY2VTdHJpbmcgKz0gYCBQbGVhc2UgcmVsb2FkIGFueSBvcGVuIGZpbGVzIGZvciBjaGFuZ2UgdG8gdGFrZSBlZmZlY3QuYFxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgbmV3IE5vdGljZSAobm90aWNlU3RyaW5nKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICAvL1RPRE86IFNldCB1cCB0aGlzIGFzIGEgbW9kYWwgdG8gc2V0IHNldHRpbmdzIGF1dG9tYXRpY2FsbHlcclxuICAgICAgICB0aGlzLmFkZENvbW1hbmQoeyAgICAgICAgICAgIFxyXG4gICAgICAgICAgICBpZDogYGluc2VydC1tdWx0aS1jb2x1bW4tcmVnaW9uYCxcclxuICAgICAgICAgICAgbmFtZTogYEluc2VydCBNdWx0aS1Db2x1bW4gUmVnaW9uYCxcclxuICAgICAgICAgICAgZWRpdG9yQ2FsbGJhY2s6IChlZGl0b3IsIHZpZXcpID0+IHtcclxuXHJcbiAgICAgICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBjdXJzb3JTdGFydFBvc2l0aW9uID0gZWRpdG9yLmdldEN1cnNvcihcImZyb21cIik7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGVkaXRvci5nZXREb2MoKS5yZXBsYWNlU2VsZWN0aW9uKFxyXG5gXHJcblxcYFxcYFxcYHN0YXJ0LW11bHRpLWNvbHVtblxyXG5JRDogSURfJHtnZXRVSUQoNCl9XHJcbk51bWJlciBvZiBDb2x1bW5zOiAyXHJcbkxhcmdlc3QgQ29sdW1uOiBzdGFuZGFyZFxyXG5cXGBcXGBcXGBcclxuXHJcblxyXG5cclxuLS0tIGNvbHVtbi1lbmQgLS0tXHJcblxyXG5cclxuXHJcbj09PSBlbmQtbXVsdGktY29sdW1uXHJcblxyXG4ke2VkaXRvci5nZXREb2MoKS5nZXRTZWxlY3Rpb24oKX1gXHJcbiAgICAgICAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICBjdXJzb3JTdGFydFBvc2l0aW9uLmxpbmUgPSBjdXJzb3JTdGFydFBvc2l0aW9uLmxpbmUgKyA3XHJcbiAgICAgICAgICAgICAgICAgICAgY3Vyc29yU3RhcnRQb3NpdGlvbi5jaCA9IDA7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGVkaXRvci5zZXRDdXJzb3IoY3Vyc29yU3RhcnRQb3NpdGlvbik7XHJcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3IE5vdGljZShcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJFbmNvdW50ZXJlZCBhbiBlcnJvciBpbnNlcnRpbmcgYSBtdWx0aS1jb2x1bW4gcmVnaW9uLiBQbGVhc2UgdHJ5IGFnYWluIGxhdGVyLlwiXHJcbiAgICAgICAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB0aGlzLmFkZENvbW1hbmQoeyAgICAgICAgICAgIFxyXG4gICAgICAgICAgICBpZDogYGFkZC1JRHMtVG8tbXVsdGktY29sdW1uLXJlZ2lvbmAsXHJcbiAgICAgICAgICAgIG5hbWU6IGBGaXggTWlzc2luZyBJRHMgZm9yIE11bHRpLUNvbHVtbiBSZWdpb25zYCxcclxuICAgICAgICAgICAgZWRpdG9yQ2FsbGJhY2s6IChlZGl0b3IsIHZpZXcpID0+IHtcclxuXHJcbiAgICAgICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgICAgICAgICAqIE5vdCBzdXJlIGlmIHRoZXJlIGlzIGFuIGVhc2llciB3YXkgdG8gZG8gdGhpcy5cclxuICAgICAgICAgICAgICAgICAgICAgKiBcclxuICAgICAgICAgICAgICAgICAgICAgKiBHZXQgYWxsIG9mIHRoZSBsaW5lcyBvZiB0aGUgZG9jdW1lbnQgc3BsaXQgYnkgbmV3bGluZXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRvY1RleHQgPSBlZGl0b3IuZ2V0UmFuZ2UoeyBsaW5lOiAwLCBjaDogMCB9LCB7IGxpbmU6IGVkaXRvci5nZXREb2MoKS5saW5lQ291bnQoKSwgY2g6IDB9KTtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgbGluZXMgPSBkb2NUZXh0LnNwbGl0KFwiXFxuXCIpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICBsZXQgc3RhcnRDb2RlYmxvY2sgPSBtdWx0aUNvbHVtblBhcnNlci5maW5kU3RhcnRDb2RlYmxvY2soZG9jVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmVPZmZzZXQgPSAwO1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBudW1Db2RlYmxvY2tzVXBkYXRlZCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUoc3RhcnRDb2RlYmxvY2suZm91bmQgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEdldCB0aGUgdGV4dCBvZiB0aGUgc2V0dGluZ3MgYmxvY2sgc28gd2UgY2FuIGNoZWNrIGlmIGl0IGNvbnRhaW5zIGFuIElELFxyXG4gICAgICAgICAgICAgIC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RleCwgY2g6IGZpcnN0TGluZU9mQ29kZWJsb2NrTGVuZ3RofSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRSZXBsYWNlbWVudExpbmVJbmRleCArPSAxO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtQ29kZWJsb2Nrc1VwZGF0ZWQgKz0gMTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZU9mZnNldCA9IGVuZFJlcGxhY2VtZW50TGluZUluZGV4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvY1RleHQgPSBkb2NUZXh0LnNsaWNlKHN0YXJ0Q29kZWJsb2NrLmVuZFBvc2l0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRDb2RlYmxvY2sgPSBtdWx0aUNvbHVtblBhcnNlci5maW5kU3RhcnRDb2RlYmxvY2soZG9jVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICAgICAgICAgKiBMb29wIHRocm91Z2ggYWxsIG9mIHRoZSBsaW5lcyBjaGVja2luZyBpZiB0aGUgbGluZSBpcyBhIFxyXG4gICAgICAgICAgICAgICAgICAgICAqIHN0YXJ0IHRhZyBhbmQgaWYgc28gaXMgaXQgbWlzc2luZyBhbiBJRC5cclxuICAgICAgICAgICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgICAgICAgICBsZXQgbGluZXNXaXRob3V0SURzID0gW11cclxuICAgICAgICAgICAgICAgICAgICBsZXQgdGV4dFdpdGhvdXRJRHMgPSBbXVxyXG4gICAgICAgICAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCBsaW5lcy5sZW5ndGg7IGkrKykge1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBtdWx0aUNvbHVtblBhcnNlci5pc1N0YXJ0VGFnV2l0aElEKGxpbmVzW2ldKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoZGF0YS5pc1N0YXJ0VGFnID09PSB0cnVlICYmIGRhdGEuaGFzS2V5ID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZXNXaXRob3V0SURzLnB1c2goaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0V2l0aG91dElEcy5wdXNoKGxpbmVzW2ldKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgXHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmKGxpbmVzV2l0aG91dElEcy5sZW5ndGggPT09IDAgJiYgbnVtQ29kZWJsb2Nrc1VwZGF0ZWQgPT09IDApIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbmV3IE5vdGljZSAoXCJGb3VuZCAwIG1pc3NpbmcgSURzIGluIHRoZSBjdXJyZW50IGRvY3VtZW50LlwiKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgICAgICogTm93IGxvb3AgdGhyb3VnaCBlYWNoIGxpbmUgdGhhdCBpcyBtaXNzaW5nIGFuIElEIGFuZFxyXG4gICAgICAgICAgICAgICAgICAgICAqIGdlbmVyYXRlIGEgcmFuZG9tIElEIGFuZCByZXBsYWNlIHRoZSBvcmlnaW5hbCB0ZXh0LlxyXG4gICAgICAgICAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCBsaW5lc1dpdGhvdXRJRHMubGVuZ3RoOyBpKyspIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvcmlnaW5hbFRleHQgPSB0ZXh0V2l0aG91dElEc1tpXVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGV4dCA9IG9yaWdpbmFsVGV4dDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGV4dCA9IHRleHQudHJpbUVuZCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZih0ZXh0LmNoYXJBdCh0ZXh0Lmxlbmd0aCAtIDEpID09PSBcIjpcIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dCA9IHRleHQuc2xpY2UoMCwgdGV4dC5sZW5ndGgtMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgdGV4dCA9IGAke3RleHR9OiBJRF8ke2dldFVJRCg0KX1gO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgZWRpdG9yLnJlcGxhY2VSYW5nZSh0ZXh0LCB7IGxpbmU6IGxpbmVzV2l0aG91dElEc1tpXSwgY2g6IDAgfSwgXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBsaW5lOiBsaW5lc1dpdGhvdXRJRHNbaV0sIGNoOiBvcmlnaW5hbFRleHQubGVuZ3RofSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICBuZXcgTm90aWNlIChgUmVwbGFjZWQgJHtsaW5lc1dpdGhvdXRJRHMubGVuZ3RoICsgbnVtQ29kZWJsb2Nrc1VwZGF0ZWR9IG1pc3NpbmcgSUQocykgaW4gdGhlIGN1cnJlbnQgZG9jdW1lbnQuYCk7XHJcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3IE5vdGljZShcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJFbmNvdW50ZXJlZCBhbiBlcnJvciBhZGRpZ24gSURzIHRvIG11bHRpLWNvbHVtbiByZWdpb25zLiBQbGVhc2UgdHJ5IGFnYWluIGxhdGVyLlwiXHJcbiAgICAgICAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB0aGlzLnJlZ2lzdGVySW50ZXJ2YWwod2luZG93LnNldEludGVydmFsKCgpID0+IHtcclxuICAgICAgICAgICAgXHJcbiAgICAgICAgICAgIHRoaXMuVXBkYXRlT3BlbkZpbGVQcmV2aWV3cygpO1xyXG4gICAgICAgIH0sIDUwMCkpO1xyXG4gICAgfVxyXG5cclxuICAgIFVwZGF0ZU9wZW5GaWxlUHJldmlld3MoKSB7XHJcblxyXG4gICAgICAgIGxldCBmaWxlTWFuYWdlcnMgPSB0aGlzLmdsb2JhbE1hbmFnZXIuZ2V0QWxsRmlsZU1hbmFnZXJzKCk7XHJcbiAgICAgICAgZmlsZU1hbmFnZXJzLmZvckVhY2goZWxlbWVudCA9PiB7XHJcbiAgICAgICAgICAgIFxyXG4gICAgICAgICAgICBsZXQgcmVnaW9uYWxNYW5hZ2VycyA9IGVsZW1lbnQuZ2V0QWxsUmVnaW9uYWxNYW5hZ2VycygpO1xyXG4gICAgICAgICAgICByZWdpb25hbE1hbmFnZXJzLmZvckVhY2gocmVnaW9uTWFuYWdlciA9PiB7XHJcbiAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgIHJlZ2lvbk1hbmFnZXIudXBkYXRlUmVuZGVyZWRNYXJrZG93bigpXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG5cclxuICAgIHNldHVwTWFya2Rvd25Qb3N0UHJvY2Vzc29yKCkge1xyXG4gICAgICAgIHRoaXMucmVnaXN0ZXJNYXJrZG93blBvc3RQcm9jZXNzb3IoYXN5bmMgKGVsLCBjdHgpID0+IHtcclxuXHJcbiAgICAgICAgICAgIGlmKHRoaXMuc2V0dGluZ3MucmVuZGVyT25Nb2JpbGUgPT09IGZhbHNlICYmXHJcbiAgICAgICAgICAgICAgIFBsYXRmb3JtLmlzTW9iaWxlID09PSB0cnVlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGNvbnN0IHNvdXJjZVBhdGggPSBjdHguc291cmNlUGF0aDtcclxuXHJcbiAgICAgICAgICAgIGxldCBmaWxlRE9NTWFuYWdlciA9IHRoaXMuZ2xvYmFsTWFuYWdlci5nZXRGaWxlTWFuYWdlcihzb3VyY2VQYXRoKTtcclxuICAgICAgICAgICAgaWYoZmlsZURPTU1hbmFnZXIgPT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiRm91bmQgbnVsbCBET00gbWFuYWdlci4gQ291bGQgbm90IHByb2Nlc3MgbXVsdGktY29sdW1uIG1hcmtkb3duLlwiKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogSGVyZSB3ZSBjaGVjayBpZiB0aGUgZXhwb3J0IFwicHJpbnRcIiBmbGFnIGlzIGluIHRoZSBET00gc28gd2UgY2FuIGRldGVybWluZSBpZiB3ZVxyXG4gICAgICAgICAgICAgKiBhcmUgZXhwb3J0aW5nIGFuZCBoYW5kbGUgdGhhdCBjYXNlLlxyXG4gICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgaWYodGhpcy5jaGVja0V4cG9ydGluZyhlbCkpIHtcclxuXHJcbiAgICAgICAgICAgICAgICB0aGlzLmV4cG9ydERvY3VtZW50VG9QREYoZWwsIGZpbGVET01NYW5hZ2VyLCBzb3VyY2VQYXRoKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gR2V0IHRoZSBpbmZvIGZvciBvdXIgY3VycmVudCBjb250ZXh0IGFuZCB0aGVuIGNoZWNrXHJcbiAgICAgICAgICAgIC8vIGlmIHRoZSBlbnRpcmUgdGV4dCBjb250YWlucyBhIHN0YXJ0IHRhZy4gSWYgdGhlcmUgaXNcclxuICAgICAgICAgICAgLy8gbm8gc3RhcnQgdGFnIGluIHRoZSBkb2N1bWVudCB3ZSBjYW4ganVzdCByZXR1cm4gYW5kXHJcbiAgICAgICAgICAgIC8vIGlnbm9yZSB0aGUgcmVzdCBvZiB0aGUgcGFyc2luZy5cclxuICAgICAgICAgICAgbGV0IGluZm8gPSBjdHguZ2V0U2VjdGlvbkluZm8oZWwpO1xyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIFdlIG5lZWQgdGhlIGNvbnRleHQgaW5mbyB0byBwcm9wZXJseSBwYXJzZSBzbyByZXR1cm5pbmcgaGVyZSBcclxuICAgICAgICAgICAgICogaW5mbyBpcyBudWxsLiBUT0RPOiBTZXQgZXJyb3IgaW4gdmlldyBpZiB0aGlzIG9jY3Vycy5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGlmKCFpbmZvKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBsZXQgZG9jU3RyaW5nID0gaW5mby50ZXh0O1xyXG4gICAgICAgICAgICBsZXQgZG9jTGluZXMgPSBkb2NTdHJpbmcuc3BsaXQoXCJcXG5cIik7XHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogSWYgd2UgZW5jb3VudGVyIGEgc3RhcnQgdGFnIG9uIHRoZSBkb2N1bWVudCB3ZSBzZXQgdGhlIGZsYWcgdG8gc3RhcnRcclxuICAgICAgICAgICAgICogcGFyc2luZyB0aGUgcmVzdCBvZiB0aGUgZG9jdW1lbnQuXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBpZihtdWx0aUNvbHVtblBhcnNlci5jb250YWluc1N0YXJ0VGFnKGVsLnRleHRDb250ZW50KSB8fCBcclxuICAgICAgICAgICAgICAgbXVsdGlDb2x1bW5QYXJzZXIuY29udGFpbnNTdGFydENvZGVCbG9jayhkb2NTdHJpbmcpKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgZmlsZURPTU1hbmFnZXIuc2V0SGFzU3RhcnRUYWcoKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLyoqIFxyXG4gICAgICAgICAgICAgKiBJZiB0aGUgZG9jdW1lbnQgZG9lcyBub3QgY29udGFpbiBhbnkgc3RhcnQgdGFncyB3ZSBpZ25vcmUgdGhlXHJcbiAgICAgICAgICAgICAqIHJlc3Qgb2YgdGhlIHBhcnNpbmcuIFRoaXMgaXMgb25seSBzZXQgdG8gdHJ1ZSBvbmNlIHRoZSBmaXJzdFxyXG4gICAgICAgICAgICAgKiBzdGFydCB0YWcgZWxlbWVudCBpcyBwYXJzZWQgYWJvdmUuXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBpZihmaWxlRE9NTWFuYWdlci5nZXRIYXNTdGFydFRhZygpID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogVGFrZSB0aGUgaW5mbyBwcm92aWRlZCBhbmQgZ2VuZXJhdGUgdGhlIHJlcXVpcmVkIHZhcmlhYmxlcyBmcm9tIFxyXG4gICAgICAgICAgICAgKiB0aGUgbGluZSBzdGFydCBhbmQgZW5kIHZhbHVlcy5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBsaW5lc0Fib3ZlQXJyYXkgPSBkb2NMaW5lcy5zbGljZSgwLCBpbmZvLmxpbmVTdGFydClcclxuICAgICAgICAgICAgbGV0IGxpbmVzT2ZFbGVtZW50ID0gZG9jTGluZXMuc2xpY2UoaW5mby5saW5lU3RhcnQsIGluZm8ubGluZUVuZCArIDEpO1xyXG4gICAgICAgICAgICBsZXQgdGV4dE9mRWxlbWVudCA9IGxpbmVzT2ZFbGVtZW50LmpvaW4oXCJcXG5cIilcclxuICAgICAgICAgICAgbGV0IGxpbmVzQmVsb3dBcnJheSA9IGRvY0xpbmVzLnNsaWNlKGluZm8ubGluZUVuZCArIDEpXHJcblxyXG4gICAgICAgICAgICAvLyNyZWdpb24gRGVwcmVjaWF0ZWQgU3RhcnQgVGFnXHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBJZiB0aGUgY3VycmVudCBsaW5lIGlzIGEgc3RhcnQgdGFnIHdlIHdhbnQgdG8gc2V0IHVwIHRoZVxyXG4gICAgICAgICAgICAgKiByZWdpb24gbWFuYWdlci4gVGhlIHJlZ2lvbmFsIG1hbmFnZXIgdGFrZXMgY2FyZVxyXG4gICAgICAgICAgICAgKiBvZiBhbGwgaXRlbXMgYmV0d2VlbiBpdCdzIHN0YXJ0IGFuZCBlbmQgdGFncyB3aGlsZSB0aGVcclxuICAgICAgICAgICAgICogZmlsZSBtYW5hZ2VyIHdlIGdvdCBhYm92ZSBhYm92ZSB0YWtlcyBjYXJlIG9mIGFsbCByZWdpb25hbCBcclxuICAgICAgICAgICAgICogbWFuYWdlcnMgaW4gZWFjaCBmaWxlLlxyXG4gICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgaWYobXVsdGlDb2x1bW5QYXJzZXIuY29udGFpbnNTdGFydFRhZyh0ZXh0T2ZFbGVtZW50KSkge1xyXG5cclxuICAgICAgICAgICAgICAgIC8qKiBcclxuICAgICAgICAgICAgICAgICAqIFNldCB1cCB0aGUgY3VycmVudCBlbGVtZW50IHRvIGFjdCBhcyB0aGUgcGFyZW50IGZvciB0aGUgXHJcbiAgICAgICAgICAgICAgICAgKiBtdWx0aS1jb2x1bW4gcmVnaW9uLlxyXG4gICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICBlbC5jaGlsZHJlblswXS5kZXRhY2goKTtcclxuICAgICAgICAgICAgICAgIGVsLmNsYXNzTGlzdC5hZGQoTXVsdGlDb2x1bW5MYXlvdXRDU1MuUmVnaW9uUm9vdENvbnRhaW5lckRpdilcclxuICAgICAgICAgICAgICAgIGxldCByZW5kZXJFcnJvclJlZ2lvbiA9IGVsLmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBgJHtNdWx0aUNvbHVtbkxheW91dENTUy5SZWdpb25FcnJvckNvbnRhaW5lckRpdn0gJHtNdWx0aUNvbHVtblN0eWxlQ1NTLlJlZ2lvbkVycm9yTWVzc2FnZX1gLFxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBsZXQgcmVuZGVyQ29sdW1uUmVnaW9uID0gZWwuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICBjbHM6IE11bHRpQ29sdW1uTGF5b3V0Q1NTLlJlZ2lvbkNvbnRlbnRDb250YWluZXJEaXZcclxuICAgICAgICAgICAgICAgIH0pXHJcblxyXG4gICAgICAgICAgICAgICAgbGV0IHN0YXJ0QmxvY2tEYXRhID0gbXVsdGlDb2x1bW5QYXJzZXIuZ2V0U3RhcnRCbG9ja0Fib3ZlTGluZShsaW5lc09mRWxlbWVudClcclxuICAgICAgICAgICAgICAgIGlmKHN0YXJ0QmxvY2tEYXRhID09PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgXHJcbiAgICAgICAgICAgICAgICBsZXQgcmVnaW9uS2V5ID0gc3RhcnRCbG9ja0RhdGEuc3RhcnRCbG9ja0tleTtcclxuICAgICAgICAgICAgICAgIGlmKGZpbGVET01NYW5hZ2VyLmNoZWNrS2V5RXhpc3RzKHJlZ2lvbktleSkgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHsgbnVtYmVyT2ZUYWdzLCBrZXlzIH0gPSBtdWx0aUNvbHVtblBhcnNlci5jb3VudFN0YXJ0VGFncyhpbmZvLnRleHQpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICBsZXQgbnVtTWF0Y2hlcyA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IG51bWJlck9mVGFnczsgaSsrKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBCZWNhdXNlIHdlIGNoZWNrZWQgaWYga2V5IGV4aXN0cyBvbmUgb2YgdGhlc2UgaGFzIHRvIG1hdGNoLlxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZihrZXlzW2ldID09PSByZWdpb25LZXkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bU1hdGNoZXMrKztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLy8gV2Ugb25seSB3YW50IHRvIGRpc3BsYXkgYW4gZXJyb3IgaWYgdGhlcmUgYXJlIG1vcmUgdGhhbiAyIG9mIHRoZSBzYW1lIGlkIGFjcm9zc1xyXG4gICAgICAgICAgICAgICAgICAgIC8vIHRoZSB3aG9sZSBkb2N1bWVudC4gVGhpcyBwcmV2ZW50cyBlcnJvcyB3aGVuIG9ic2lkaWFuIHJlbG9hZHMgdGhlIHdob2xlIGRvY3VtZW50XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gYW5kIHRoZXJlIGFyZSB0d28gb2YgdGhlIHNhbWUga2V5IGluIHRoZSBtYXAuXHJcbiAgICAgICAgICAgICAgICAgICAgaWYobnVtTWF0Y2hlcyA+PSAyKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlZ2lvbktleSA9PT0gXCJcIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVuZGVyRXJyb3JSZWdpb24uaW5uZXJUZXh0ID0gXCJGb3VuZCBtdWx0aXBsZSByZWdpb25zIHdpdGggZW1wdHkgSURzLiBQbGVhc2Ugc2V0IGEgdW5pcXVlIElEIGFmdGVyIGVhY2ggc3RhcnQgdGFnLlxcbkVHOiAnPT09IG11bHRpLWNvbHVtbi1zdGFydDogcmFuZG9tSUQnXFxuT3IgdXNlICdGaXggTWlzc2luZyBJRHMnIGluIHRoZSBjb21tYW5kIHBhbGV0dGUgYW5kIHJlbG9hZCB0aGUgZG9jdW1lbnQuXCJcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmRlckVycm9yUmVnaW9uLmlubmVyVGV4dCA9IFwiUmVnaW9uIElEIGFscmVhZHkgZXhpc3RzIGluIGRvY3VtZW50LCBwbGVhc2Ugc2V0IGEgdW5pcXVlIElELlxcbkVHOiAnPT09IG11bHRpLWNvbHVtbi1zdGFydDogcmFuZG9tSUQnXCJcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZWwuaWQgPSBgTXVsdGlDb2x1bW5JRDoke3JlZ2lvbktleX1gXHJcblxyXG4gICAgICAgICAgICAgICAgbGV0IGVsZW1lbnRNYXJrZG93blJlbmRlcmVyID0gbmV3IE1hcmtkb3duUmVuZGVyQ2hpbGQoZWwpO1xyXG4gICAgICAgICAgICAgICAgZmlsZURPTU1hbmFnZXIuY3JlYXRlUmVnaW9uYWxNYW5hZ2VyKHJlZ2lvbktleSwgZWwsIHJlbmRlckVycm9yUmVnaW9uLCByZW5kZXJDb2x1bW5SZWdpb24pO1xyXG4gICAgICAgICAgICAgICAgZWxlbWVudE1hcmtkb3duUmVuZGVyZXIub251bmxvYWQgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYoZmlsZURPTU1hbmFnZXIpIHtcclxuICAgIFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlRE9NTWFuYWdlci5yZW1vdmVSZWdpb24oc3RhcnRCbG9ja0RhdGEuc3RhcnRCbG9ja0tleSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIGN0eC5hZGRDaGlsZChlbGVtZW50TWFya2Rvd25SZW5kZXJlcik7XHJcblxyXG4gICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgKiBOb3cgd2UgaGF2ZSBjcmVhdGVkIG91ciByZWdpb25hbCBtYW5hZ2VyIGFuZCBkZWZpbmVkIHdoYXQgZWxlbWVudHMgXHJcbiAgICAgICAgICAgICAgICAgKiBuZWVkIHRvIGJlIHJlbmRlcmVkIGludG8uIFNvIHdlIGNhbiByZXR1cm4gd2l0aG91dCBhbnkgbW9yZSBwcm9jZXNzaW5nLlxyXG4gICAgICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICAgICByZXR1cm5cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvLyNlbmRyZWdpb24gRGVwcmVjaWF0ZWQgU3RhcnQgVGFnXHJcblxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogQ2hlY2sgaWYgYW55IG9mIHRoZSBsaW5lcyBhYm92ZSB1cyBjb250YWluIGEgc3RhcnQgYmxvY2ssIGFuZCBpZlxyXG4gICAgICAgICAgICAgKiBzbyBnZXQgdGhlIGxpbmVzIGZyb20gb3VyIGN1cnJlbnQgZWxlbWVudCB0byB0aGUgc3RhcnQgYmxvY2suXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBsZXQgc3RhcnRCb2NrQWJvdmUgPSBtdWx0aUNvbHVtblBhcnNlci5nZXRTdGFydEJsb2NrT3JDb2RlYmxvY2tBYm92ZUxpbmUobGluZXNBYm92ZUFycmF5KTtcclxuICAgICAgICAgICAgaWYoc3RhcnRCb2NrQWJvdmUgPT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogV2Ugbm93IGtub3cgd2UncmUgd2l0aGluIGEgbXVsdGktY29sdW1uIHJlZ2lvbiwgc28gd2UgdXBkYXRlIG91clxyXG4gICAgICAgICAgICAgKiBsaXN0IG9mIGxpbmVzIGFib3ZlIHRvIGp1c3QgYmUgdGhlIGl0ZW1zIHdpdGhpbiB0aGlzIHJlZ2lvbi5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxpbmVzQWJvdmVBcnJheSA9IHN0YXJ0Qm9ja0Fib3ZlLmxpbmVzQWJvdmVBcnJheTtcclxuXHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBXZSB1c2UgdGhlIHN0YXJ0IGJsb2NrJ3Mga2V5IHRvIGdldCBvdXIgcmVnaW9uYWwgbWFuYWdlci4gSWYgdGhpc1xyXG4gICAgICAgICAgICAgKiBsb29rdXAgZmFpbHMgd2UgY2FuIG5vdCBjb250aW51ZSBwcm9jZXNzaW5nIHRoaXMgZWxlbWVudC5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCByZWdpb25hbENvbnRhaW5lcjogUmVnaW9uTWFuYWdlckNvbnRhaW5lciA9IGZpbGVET01NYW5hZ2VyLmdldFJlZ2lvbmFsQ29udGFpbmVyKHN0YXJ0Qm9ja0Fib3ZlLnN0YXJ0QmxvY2tLZXkpO1xyXG4gICAgICAgICAgICBpZihyZWdpb25hbENvbnRhaW5lciA9PT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgbGV0IHJlZ2lvbmFsTWFuYWdlcjogUmVnaW9uTWFuYWdlciA9IHJlZ2lvbmFsQ29udG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aW5lcyhsaW5lc0JlbG93QXJyYXksIHNvdXJjZVBhdGgpO1xyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIFNldCB1cCBvdXIgZG9tIG9iamVjdCB0byBiZSBhZGRlZCB0byB0aGUgbWFuYWdlci5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIGxldCBjdXJyZW50T2JqZWN0OiBET01PYmplY3QgPSBuZXcgRE9NT2JqZWN0KGVsLCBsaW5lc09mRWxlbWVudClcclxuICAgICAgICAgICAgZWwuaWQgPSBjdXJyZW50T2JqZWN0LlVJRDtcclxuXHJcbiAgICAgICAgICAgIGN1cnJlbnRPYmplY3QgPSBUYXNrTGlzdERPTU9iamVjdC5jaGVja0ZvclRhc2tMaXN0RWxlbWVudChjdXJyZW50T2JqZWN0KVxyXG5cclxuICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAqIE5vdyB3ZSBhZGQgdGhlIG9iamVjdCB0byB0aGUgbWFuYWdlciBhbmQgdGhlbiBzZXR1cCB0aGVcclxuICAgICAgICAgICAgICogY2FsbGJhY2sgZm9yIHdoZW4gdGhlIG9iamVjdCBpcyByZW1vdmVkIGZyb20gdmlldyB0aGF0IHdpbGwgcmVtb3ZlIFxyXG4gICAgICAgICAgICAgKiB0aGUgaXRlbSBmcm9tIHRoZSBtYW5hZ2VyLlxyXG4gICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgcmVnaW9uYWxNYW5hZ2VyLmFkZE9iamVjdChzaWJsaW5nc0Fib3ZlLCBzaWJsaW5nc0JlbG93LCBjdXJyZW50T2JqZWN0KTtcclxuXHJcbiAgICAgICAgICAgIGxldCBlbGVtZW50TWFya2Rvd25SZW5kZXJlciA9IG5ldyBNYXJrZG93blJlbmRlckNoaWxkKGVsKTtcclxuICAgICAgICAgICAgZWxlbWVudE1hcmtkb3duUmVuZGVyZXIub251bmxvYWQgPSAoKSA9PiB7XHJcblxyXG4gICAgICAgICAgICAgICAgaWYocmVnaW9uYWxDb250YWluZXIgPT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm5cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAgICAgbGV0IHJlZ2lvbmFsTWFuYWdlcjogUmVnaW9uTWFuYWdlciA9IHJlZ2lvbmFsQ29udGFpbmVyLmdldFJlZ2lvbigpO1xyXG4gICAgICAgICAgICAgICAgaWYocmVnaW9uYWxNYW5hZ2VyKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgXHJcbiAgICAgICAgICAgICAgICAgICAgLy8gV2UgY2FuIGF0dGVtcHQgdG8gdXBkYXRlIHRoZSB2aWV3IGhlcmUgYWZ0ZXIgdGhlIGl0ZW0gaXMgcmVtb3ZlZFxyXG4gICAgICAgICAgICAgICAgICAgIC8vIGJ1dCBuZWVkIHRvIGdldCB0aGUgaXRlbSdzIHBhcmVudCBlbGVtZW50IGJlZm9yZSByZW1vdmluZyBvYmplY3QgZnJvbSBtYW5hZ2VyLlxyXG4gICAgICAgICAgICAgICAgICAgIGxldCByZWdpb25SZW5kZXJEYXRhOiBNdWx0aUNvbHVtblJlbmRlckRhdGEgPSByZWdpb25hbE1hbmFnZXIuZ2V0UmVnaW9uUmVuZGVyRGF0YSgpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIucmVtb3ZlT2JqZWN0KGN1cnJlbnRPYmplY3QuVUlEKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLyoqXHJcbiAgICAgICAgICAgICAgICAgICAgICogTmVlZCB0byBjaGVjayBoZXJlIGlmIGVsZW1lbnQgaXMgbnVsbCBhcyB0aGlzIGNsb3N1cmUgd2lsbCBiZSBjYWxsZWRcclxuICAgICAgICAgICAgICAgICAgICAgKiByZXBlYXRlZGx5IG9uIGZpbGUgY2hhbmdlLlxyXG4gICAgICAgICAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICAgICAgICAgIGlmKHJlZ2lvblJlbmRlckRhdGEucGFyZW50UmVuZGVyRWxlbWVudCA9PT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHJlZ2lvbmFsTWFuYWdlci5yZW5kZXJSZWdpb25FbGVtZW50c1RvU2NyZWVuKClcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgY3R4LmFkZENoaWxkKGVsZW1lbnRNYXJrZG93blJlbmRlcmVyKTtcclxuXHJcbiAgICAgICAgICAgIGxldCBlbGVtZW50VGV4dFNwYWNlZCA9IGxpbmVzT2ZFbGVtZW50LnJlZHVjZSgocHJldiwgY3VycikgPT4ge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHByZXYgKyBcIlxcblwiICsgY3VycjtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIC8qKlxyXG4gICAgICAgICAgICAgKiBOb3cgd2UgY2hlY2sgaWYgb3VyIGN1cnJlbnQgZWxlbWVudCBpcyBhIHNwZWNpYWwgZmxhZyBzbyB3ZSBjYW5cclxuICAgICAgICAgICAgICogcHJvcGVybHkgc2V0IHRoZSBlbGVtZW50IHRhZyB3aXRoaW4gdGhlIHJlZ2lvbmFsIG1hbmFnZXIuXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBpZihtdWx0aUNvbHVtblBhcnNlci5jb250YWluc0VuZFRhZyhlbC50ZXh0Q29udGVudCkgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICBjdXJyZW50T2JqZWN0LmVsZW1lbnRUeXBlID0gRWxlbWVudFJlbmRlclR5cGUudW5SZW5kZXJlZFxyXG4gICAgICAgICAgICAgICAgZWwuYWRkQ2xhc3MoTXVsdGlDb2x1bW5TdHlsZUNTUy5SZWdpb25FbmRUYWcpXHJcbiAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIudXBkYXRlRWxlbWVudFRhZyhjdXJyZW50T2JqZWN0LlVJRCwgRE9NT2JqZWN0VGFnLmVuZFJlZ2lvbik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZihtdWx0aUNvbHVtblBhcnNlci5jb250YWluc0NvbEVuZFRhZyhlbGVtZW50VGV4dFNwYWNlZCkgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICBjdXJyZW50T2JqZWN0LmVsZW1lbnRUeXBlID0gRWxlbWVudFJlbmRlclR5cGUudW5SZW5kZXJlZFxyXG4gICAgICAgICAgICAgICAgZWwuYWRkQ2xhc3MoTXVsdGlDb2x1bW5TdHlsZUNTUy5Db2x1bW5FbmRUYWcpXHJcbiAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIudXBkYXRlRWxlbWVudFRhZyhjdXJyZW50T2JqZWN0LlVJRCwgRE9NT2JqZWN0VGFnLmNvbHVtbkJyZWFrKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlbHNlIGlmKG11bHRpQ29sdW1uUGFyc2VyLmNvbnRhaW5zQ29sU2V0dGluZ3NUYWcoZWxlbWVudFRleHRTcGFjZWQpID09PSB0cnVlKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgY3VycmVudE9iamVjdC5lbGVtZW50VHlwZSA9IEVsZW1lbnRSZW5kZXJUeXBlLnVuUmVuZGVyZWRcclxuICAgICAgICAgICAgICAgIGVsLmFkZENsYXNzKE11bHRpQ29sdW1uU3R5bGVDU1MuUmVnaW9uU2V0dGluZ3MpXHJcbiAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIgPSByZWdpb25hbENvbnRhaW5lci5zZXRSZWdpb25TZXR0aW5ncyhlbGVtZW50VGV4dFNwYWNlZClcclxuICAgICAgICAgICAgICAgIHJlZ2lvbmFsTWFuYWdlci51cGRhdGVFbGVtZW50VGFnKGN1cnJl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xuICAgICAgICAgICAgbGV0IGNoaWxkID0gZG9jQ2hpbGRyZW5baV07XHJcbiAgICAgICAgICAgIGlmIChjaGlsZCBpbnN0YW5jZW9mIEhUTUxFbGVtZW50KSB7XHJcbiAgICAgICAgICAgICAgICBsZXQgY2hpbGRFbCA9IGNoaWxkIGFzIEhUTUxFbGVtZW50O1xyXG4gICAgICAgICAgICAgICAgaWYgKGluQmxvY2sgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgXHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGZvdW5kQmxvY2tEYXRhID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlZ2lvbktleSA9IFwiXCI7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGxldCBibG9ja0RhdGEgPSBtdWx0aUNvbHVtblBhcnNlci5pc1N0YXJ0VGFnV2l0aElEKGNoaWxkLnRleHRDb250ZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYmxvY2tEYXRhLmlzU3RhcnRUYWcgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGFuIG9sZC1zdHlsZSBzdGFydCB0YWcuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kQmxvY2tEYXRhID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJsb2NrRGF0YS5oYXNLZXkgPT09IHRydWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmb3VuZEtleSA9IG11bHRpQ29sdW1uUGFyc2VyLmdldFN0YXJ0VGFnS2V5KGNoaWxkLnRleHRDb250ZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmb3VuZEtleSAhPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lvbktleSA9IGZvdW5kS2V5O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgaWYoYmxvY2tEYXRhLmlzU3RhcnRUYWcgPT09IGZhbHNlICYmIHRoaXMuaXNTdGFydENvZGVibG9ja0luRXhwb3J0KGNoaWxkKSkge1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIHN0YXJ0IHRhZyBmcm9tIHRoZSBvbGQgdmVyc2lvbiBpcyBudWxsIHdlIHRoZW4gY2hlY2sgdG8gc2VlIGlmIHRoZSBlbGVtZW50IGlzXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGEgY29kZWJsb2NrIHN0YXJ0LiBJZiBpdCBpcyB3ZSB1c2UgdGhlIG5leHQgYXZhaWxhYmxlIGNvZGVibG9jayBkYXRhIHRvIHJldHJpZXZlIG91ciBJRC5cclxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNvZGVibG9ja1RleHQgPSBjb2RlYmxvY2tTdGFydEJsb2Nrcy5zaGlmdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZihjb2RlYmxvY2tUZXh0ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXCJGb3VuZCB1bmRlZmluZWQgY29kZWJsb2NrIGRhdGEgd2hlbiBleHBvcnRpbmcuXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpZCA9IHBhcnNlU3RhcnRSZWdpb25Db2RlQmxvY2tJRChjb2RlYmxvY2tUZXh0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoaWQgIT09IFwiXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kQmxvY2tEYXRhID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lvbktleSA9IGlkO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICBpZihmb3VuZEJsb2NrRGF0YSA9PT0gdHJ1ZSAmJiByZWdpb25LZXkgIT09IFwiXCIpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluQmxvY2sgPSB0cnVlO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IGNoaWxkLmNoaWxkcmVuLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZC5jaGlsZHJlbltpXS5kZXRhY2goKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGlsZC5pbm5lclRleHQgPSBcIlwiO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQuY2xhc3NMaXN0LmFkZChNdWx0aUNvbHVtbkxheW91dENTUy5SZWdpb25Sb290Q29udGFpbmVyRGl2KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlbmRlckVycm9yUmVnaW9uID0gY2hpbGQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogYCR7TXVsdGlDb2x1bW5MYXlvdXRDU1MuUmVnaW9uRXJyb3JDb250YWluZXJEaXZ9LCAke011bHRpQ29sdW1uU3R5bGVDU1MuUmVnaW9uRXJyb3JNZXNzYWdlfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVuZGVyQ29sdW1uUmVnaW9uID0gY2hpbGQuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTXVsdGlDb2x1bW5MYXlvdXRDU1MuUmVnaW9uQ29udGVudENvbnRhaW5lckRpdlxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuXHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVnaW9uYWxDb250YWluZXI6IFJlZ2lvbk1hbmFnZXJDb250YWluZXIgPSBmaWxlRE9NTWFuYWdlci5nZXRSZWdpb25hbENvbnRhaW5lcihyZWdpb25LZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVnaW9uYWxDb250YWluZXIgPT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmRlckVycm9yUmVnaW9uLmlubmVyVGV4dCA9IFwiRXJyb3IgcmVuZGVyaW5nIG11bHRpLWNvbHVtbiByZWdpb24uXFxuUGxlYXNlIGNsb3NlIGFuZCByZW9wZW4gdGhlIGZpbGUsIHRoZW4gbWFrZSBzdXJlIHlvdSBhcmUgaW4gcmVhZGluZyBtb2RlIGJlZm9yZSBleHBvcnRpbmcuXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVnaW9uYWxNYW5hZ2VyOiBSZWdpb25NYW5hZ2VyID0gcmVnaW9uYWxDb250YWluZXIuZ2V0UmVnaW9uKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpb25hbE1hbmFnZXIuZXhwb3J0UmVnaW9uRWxlbWVudHNUb1BERihyZW5kZXJDb2x1bW5SZWdpb24pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChtdWx0aUNvbHVtblBhcnNlci5jb250YWluc0VuZFRhZyhjaGlsZC50ZXh0Q29udGVudCkgPT09IHRydWUpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluQmxvY2sgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuVG9SZW1vdmUucHVzaChjaGlsZCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGNoaWxkcmVuVG9SZW1vdmUuZm9yRWFjaChjaGlsZCA9PiB7XHJcbiAgICAgICAgICAgIGlmKGNoaWxkLnBhcmVudEVsZW1lbnQgPT09IGVsKSB7XHJcbiAgICAgICAgICAgICAgICBlbC5yZW1vdmVDaGlsZChjaGlsZCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBjaGVja0V4cG9ydGluZyhlbGVtZW50OiBIVE1MRWxlbWVudCk6IGJvb2xlYW4ge1xyXG5cclxuICAgICAgICBpZihlbGVtZW50ID09PSBudWxsKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmKGVsZW1lbnQuY2xhc3NMaXN0LmNvbnRhaW5zKFwicHJpbnRcIikpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZihlbGVtZW50LnBhcmVudE5vZGUgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2hlY2tFeHBvcnRpbmcoZWxlbWVudC5wYXJlbnRFbGVtZW50KTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgIH1cclxuXHJcbiAgICBzZXR1cE1hcmtkb3duQ29kZWJsb2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kxlYXZlcyA9IGFwcC53b3Jrc3BhY2UuZ2V0TGVhdmVzT2ZUeXBlKFwibWFya2Rvd25cIik7XHJcbiAgICAgICAgICAgIGlmKG1hcmtkb3duTGVhdmVzLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgIC8vIENoZWNrIHRoZSB0eXBlIG9mIHRoZSBsZWFmXHJcbiAgICAgICAgICAgIGxldCBmb3VuZEZpbGVMZWFmID0gZmFsc2U7XHJcbiAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCBtYXJrZG93bkxlYXZlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgIFxyXG4gICAgICAgICAgICAgICAgbGV0IGZpbGVMZWFmID0gZ2V0RmlsZUxlYWYoc291cmNlUGF0aCk7XHJcbiAgICAgICAgICAgICAgICBpZihmaWxlTGVhZiA9PT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZm91bmRGaWxlTGVhZiA9IHRydWU7XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgICAgICBpZihnZXRMZWFmU291cmNlTW9kZShmaWxlTGVhZikgPT09IFwic291cmNlXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHdhcyBhZGRlZCB3aGVuIGltcGxlbWVudGluZyBsaXZlIHByZXZpZXcsIGJ1dCB0aGUgcmVhc29uIGl0IHdhcyBvcmlnaW5hbGx5IGFkZGVkIGFwcGVhcnMgdG8gbm8gbG9uZ2VyIGJlIGFuIGlzc3VlLlxyXG4gICAgICAgICAgICAgICAgICAgIC8vIFJlbW92aW5nIHRoZSByZXR1cm4gZnJvbSBoZXJlIHRvIGZpeCBidWcgd2hlcmUgb3BlbmluZyBtdWx0aXBsZSBjb3BpZXMgb2YgdGhlIGRvY3VtZW50IGNhdXNlcyByZWdpb25zIHRvIG5vdCByZW5kZXIuXHJcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5kZWJ1ZyhcIkxlYWYgb2YgZmlsZSBpcyBpbiBzb3VyY2UgbW9kZS4gU2hvdWxkIHdlIGJlIGlnbm9yaW5nIHBvc3QgcHJvY2Vzc2luZyBoZXJlP1wiKVxyXG4gICAgICAgICAgICAgICAgICAgIC8vIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIFxyXG4gICAgICAgICAgICBpZih0aGlzLmdsb2JhbE1hbmFnZXIgPT09IG51bGwgfHwgdGhpcy5nbG9iYWxNYW5hZ2VyID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUubG9nKFwiR2xvYmFsIG1hbmFnZXIgaXMgdW5kZWZpbmVkP1wiKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgbGV0IGZpbGVET01NYW5hZ2VyID0gdGhpcy5nbG9iYWxNYW5hZ2VyLmdldEZpbGVNYW5hZ2VyKHNvdXJjZVBhdGgpO1xyXG4gICAgICAgICAgICBpZihmaWxlRE9NTWFuYWdlciA9PT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIFxyXG4gICAgICAgICAgICAvLyBTZXQgZmlsZSB0byBoYXZlIHN0YXJ0IHRhZy5cclxuICAgICAgICAgICAgZmlsZURPTU1hbmFnZXIuc2V0SGFzU3RhcnRUYWcoKTtcclxuICAgICAgICBcclxuICAgICAgICAgICAgLy8gR2V0IHRoZSBpbmZvIGZvciBvdXIgY3VycmVudCBjb250ZXh0IGFuZCB0aGVuIGNoZWNrXHJcbiAgICAgICAgICAgIC8vIGlmIHRoZSBlbnRpcmUgdGV4dCBjb250YWlucyBhIHN0YXJ0IHRhZy4gSWYgdGhlcmUgaXNcclxuICAgICAgICAgICAgLy8gbm8gc3RhcnQgdGFnIGluIHRoZSBkb2N1bWVudCB3ZSBjYW4ganVzdCByZXR1cm4gYW5kXHJcbiAgICAgICAgICAgIC8vIGlnbm9yZSB0aGUgcmVzdCBvZiB0aGUgcGFyc2luZy5cclxuICAgICAgICAgICAgbGV0IGluZm8gPSBjdHguZ2V0U2VjdGlvbkluZm8oZWwpO1xyXG4gICAgICAgIFxyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogV2UgbmVlZCB0aGUgY29udGV4dCBpbmZvIHRvIHByb3Blcmx5IHBhcnNlIHNvIHJldHVybmluZyBoZXJlIFxyXG4gICAgICAgICAgICAgKiBpbmZvIGlzIG51bGwuIFRPRE86IFNldCBlcnJvciBpbiB2aWV3IGlmIHRoaXMgb2NjdXJzLlxyXG4gICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgaWYoIWluZm8pIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIFxyXG4gICAgICAgICAgICAvKiogXHJcbiAgICAgICAgICAgICAqIFNldCB1cCB0aGUgY3VycmVudCBlbGVtZW50IHRvIGFjdCBhcyB0aGUgcGFyZW50IGZvciB0aGUgXHJcbiAgICAgICAgICAgICAqIG11bHRpLWNvbHVtbiByZWdpb24uXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBlbC5jbGFzc0xpc3QuYWRkKE11bHRpQ29sdW1uTGF5b3V0Q1NTLlJlZ2lvblJvb3RDb250YWluZXJEaXYpXHJcbiAgICAgICAgICAgIGxldCByZW5kZXJFcnJvclJlZ2lvbiA9IGVsLmNyZWF0ZURpdih7XHJcbiAgICAgICAgICAgICAgICBjbHM6IGAke011bHRpQ29sdW1uTGF5b3V0Q1NTLlJlZ2lvbkVycm9yQ29udGFpbmVyRGl2fSAke011bHRpQ29sdW1uU3R5bGVDU1MuUmVnaW9uRXJyb3JNZXNzYWdlfWAsXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBsZXQgcmVuZGVyQ29sdW1uUmVnaW9uID0gZWwuY3JlYXRlRGl2KHtcclxuICAgICAgICAgICAgICAgIGNsczogTXVsdGlDb2x1bW5MYXlvdXRDU1MuUmVnaW9uQ29udGVudENvbnRhaW5lckRpdlxyXG4gICAgICAgICAgICB9KVxyXG4gICAgICAgIFxyXG4gICAgICAgICAgICBsZXQgcmVnaW9uS2V5ID0gcGFyc2VTdGFydFJlZ2lvbkNvZGVCbG9ja0lEKHNvdXJjZSk7XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgIGxldCBjcmVhdGVOZXdSZWdpb25NYW5hZ2VyID0gdHJ1ZTtcclxuICAgICAgICAgICAgaWYoZmlsZURPTU1hbmFnZXIuY2hlY2tLZXlFeGlzdHMocmVnaW9uS2V5KSA9PT0gdHJ1ZSkge1xyXG4gICAgICAgICAgICAgICAgXHJcbiAgICAgICAgICAgICAgICBjcmVhdGVOZXdSZWdpb25NYW5hZ2VyID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBsZXQgeyBudW1iZXJPZlRhZ3MsIGtleXMgfSA9IG11bHRpQ29sdW1uUGFyc2VyLmNvdW50U3RhcnRUYWdzKGluZm8udGV4dCk7XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgICAgICBsZXQgbnVtTWF0Y2hlcyA9IDA7XHJcbiAgICAgICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgbnVtYmVyT2ZUYWdzOyBpKyspIHtcclxuICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICAvLyBCZWNhdXNlIHdlIGNoZWNrZWQgaWYga2V5IGV4aXN0cyBvbmUgb2YgdGhlc2UgaGFzIHRvIG1hdGNoLlxyXG4gICAgICAgICAgICAgICAgICAgIGlmKGtleXNbaV0gPT09IHJlZ2lvbktleSkge1xyXG4gICAgICAgICAgICAgICAgICA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xuICAgICAgICAgICAgICAgIC8vIHRoZSBzdGFydC9zZXR0aW5ncyBjb2RlYmxvY2sgaW4gYW55IHdheS4gV2Ugb25seSB3YW50IHRvIHVubG9hZFxyXG4gICAgICAgICAgICAgICAgLy8gaWYgdGhlIGZpbGUgaXMgYmVpbmcgcmVtb3ZlZCBmcm9tIHZpZXcuXHJcbiAgICAgICAgICAgICAgICBlbGVtZW50TWFya2Rvd25SZW5kZXJlci5vbnVubG9hZCA9ICgpID0+IHtcclxuICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICBpZihmaWxlRE9NTWFuYWdlciAmJiBmaWxlU3RpbGxJblZpZXcoc291cmNlUGF0aCkgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUuZGVidWcoXCJGaWxlIG5vdCBpbiBhbnkgbWFya2Rvd24gbGVhZi4gUmVtb3ZpbmcgcmVnaW9uIGZyb20gZG9tIG1hbmFnZXIuXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVET01NYW5hZ2VyLnJlbW92ZVJlZ2lvbihyZWdpb25LZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBjdHguYWRkQ2hpbGQoZWxlbWVudE1hcmtkb3duUmVuZGVyZXIpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgIGxldCByZWdpb25hbE1hbmFnZXJDb250YWluZXIgPSBmaWxlRE9NTWFuYWdlci5nZXRSZWdpb25hbENvbnRhaW5lcihyZWdpb25LZXkpO1xyXG4gICAgICAgICAgICBpZihyZWdpb25hbE1hbmFnZXJDb250YWluZXIgIT09IG51bGwpIHtcclxuICAgICAgICBcclxuICAgICAgICAgICAgICAgIGxldCByZWdpb25hbE1hbmFnZXIgPSByZWdpb25hbE1hbmFnZXJDb250YWluZXIuc2V0UmVnaW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