From b5684c1d7e468d98a461ae4951cbcdefdbb66104 Mon Sep 17 00:00:00 2001 From: JP Cen Date: Sun, 16 Jun 2024 01:28:33 -0400 Subject: [PATCH] 0.9.30 --- main.js | 50209 +++++++++++++++++++++++++++++------------------- manifest.json | 2 +- styles.css | 4 +- 3 files changed, 30572 insertions(+), 19643 deletions(-) diff --git a/main.js b/main.js index 540bae5..dadc772 100644 --- a/main.js +++ b/main.js @@ -13,15 +13,15 @@ var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod3) => function __require() { return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports; }; -var __export = (target, all2) => { - for (var name317 in all2) - __defProp(target, name317, { get: all2[name317], enumerable: true }); +var __export = (target, all6) => { + for (var name317 in all6) + __defProp(target, name317, { get: all6[name317], enumerable: true }); }; var __copyProps = (to2, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { - for (let key2 of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to2, key2) && key2 !== except) - __defProp(to2, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); + for (let key3 of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to2, key3) && key3 !== except) + __defProp(to2, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable }); } return to2; }; @@ -32,14 +32,14 @@ var __toESM = (mod3, isNodeMode, target) => (target = mod3 != null ? __create(__ )); var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3); var __toBinary = /* @__PURE__ */ (() => { - var table = new Uint8Array(128); + var table2 = new Uint8Array(128); for (var i4 = 0; i4 < 64; i4++) - table[i4 < 26 ? i4 + 65 : i4 < 52 ? i4 + 71 : i4 < 62 ? i4 - 4 : i4 * 4 - 205] = i4; + table2[i4 < 26 ? i4 + 65 : i4 < 52 ? i4 + 71 : i4 < 62 ? i4 - 4 : i4 * 4 - 205] = i4; return (base64) => { var n3 = base64.length, bytes = new Uint8Array((n3 - (base64[n3 - 1] == "=") - (base64[n3 - 2] == "=")) * 3 / 4 | 0); for (var i5 = 0, j = 0; i5 < n3; ) { - var c0 = table[base64.charCodeAt(i5++)], c1 = table[base64.charCodeAt(i5++)]; - var c22 = table[base64.charCodeAt(i5++)], c3 = table[base64.charCodeAt(i5++)]; + var c0 = table2[base64.charCodeAt(i5++)], c1 = table2[base64.charCodeAt(i5++)]; + var c22 = table2[base64.charCodeAt(i5++)], c3 = table2[base64.charCodeAt(i5++)]; bytes[j++] = c0 << 2 | c1 >> 4; bytes[j++] = c1 << 4 | c22 >> 2; bytes[j++] = c22 << 6 | c3; @@ -54,7 +54,7 @@ var require_react_production_min = __commonJS({ "use strict"; var l2 = Symbol.for("react.element"); var n3 = Symbol.for("react.portal"); - var p = Symbol.for("react.fragment"); + var p2 = Symbol.for("react.fragment"); var q2 = Symbol.for("react.strict_mode"); var r2 = Symbol.for("react.profiler"); var t5 = Symbol.for("react.provider"); @@ -232,7 +232,7 @@ var require_react_production_min = __commonJS({ return a4; } }; exports.Component = E2; - exports.Fragment = p; + exports.Fragment = p2; exports.Profiler = r2; exports.PureComponent = G2; exports.StrictMode = q2; @@ -402,14 +402,14 @@ var require_moment = __commonJS({ function isDate4(input) { return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]"; } - function map4(arr, fn) { + function map6(arr, fn) { var res = [], i4, arrLen = arr.length; for (i4 = 0; i4 < arrLen; ++i4) { res.push(fn(arr[i4], i4)); } return res; } - function extend3(a4, b2) { + function extend4(a4, b2) { for (var i4 in b2) { if (hasOwnProp(b2, i4)) { a4[i4] = b2[i4]; @@ -485,7 +485,7 @@ var require_moment = __commonJS({ function createInvalid(flags) { var m4 = createUTC(NaN); if (flags != null) { - extend3(getParsingFlags(m4), flags); + extend4(getParsingFlags(m4), flags); } else { getParsingFlags(m4).userInvalidated = true; } @@ -557,19 +557,19 @@ var require_moment = __commonJS({ } function deprecate(msg, fn) { var firstTime = true; - return extend3(function() { + return extend4(function() { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { - var args = [], arg2, i4, key2, argLen = arguments.length; + var args = [], arg2, i4, key3, argLen = arguments.length; for (i4 = 0; i4 < argLen; i4++) { arg2 = ""; if (typeof arguments[i4] === "object") { arg2 += "\n[" + i4 + "] "; - for (key2 in arguments[0]) { - if (hasOwnProp(arguments[0], key2)) { - arg2 += key2 + ": " + arguments[0][key2] + ", "; + for (key3 in arguments[0]) { + if (hasOwnProp(arguments[0], key3)) { + arg2 += key3 + ": " + arguments[0][key3] + ", "; } } arg2 = arg2.slice(0, -2); @@ -619,13 +619,13 @@ var require_moment = __commonJS({ ); } function mergeConfigs(parentConfig, childConfig) { - var res = extend3({}, parentConfig), prop2; + var res = extend4({}, parentConfig), prop2; for (prop2 in childConfig) { if (hasOwnProp(childConfig, prop2)) { if (isObject4(parentConfig[prop2]) && isObject4(childConfig[prop2])) { res[prop2] = {}; - extend3(res[prop2], parentConfig[prop2]); - extend3(res[prop2], childConfig[prop2]); + extend4(res[prop2], parentConfig[prop2]); + extend4(res[prop2], childConfig[prop2]); } else if (childConfig[prop2] != null) { res[prop2] = childConfig[prop2]; } else { @@ -635,7 +635,7 @@ var require_moment = __commonJS({ } for (prop2 in parentConfig) { if (hasOwnProp(parentConfig, prop2) && !hasOwnProp(childConfig, prop2) && isObject4(parentConfig[prop2])) { - res[prop2] = extend3({}, res[prop2]); + res[prop2] = extend4({}, res[prop2]); } } return res; @@ -645,11 +645,11 @@ var require_moment = __commonJS({ this.set(config4); } } - var keys; + var keys2; if (Object.keys) { - keys = Object.keys; + keys2 = Object.keys; } else { - keys = function(obj) { + keys2 = function(obj) { var i4, res = []; for (i4 in obj) { if (hasOwnProp(obj, i4)) { @@ -667,12 +667,12 @@ var require_moment = __commonJS({ lastWeek: "[Last] dddd [at] LT", sameElse: "L" }; - function calendar(key2, mom, now2) { - var output = this._calendar[key2] || this._calendar["sameElse"]; + function calendar(key3, mom, now2) { + var output = this._calendar[key3] || this._calendar["sameElse"]; return isFunction3(output) ? output.call(mom, now2) : output; } - function zeroFill(number4, targetLength, forceSign) { - var absNumber2 = "" + Math.abs(number4), zerosToFill = targetLength - absNumber2.length, sign5 = number4 >= 0; + function zeroFill(number5, targetLength, forceSign) { + var absNumber2 = "" + Math.abs(number5), zerosToFill = targetLength - absNumber2.length, sign5 = number5 >= 0; return (sign5 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber2; } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; @@ -755,26 +755,26 @@ var require_moment = __commonJS({ LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }; - function longDateFormat(key2) { - var format9 = this._longDateFormat[key2], formatUpper = this._longDateFormat[key2.toUpperCase()]; + function longDateFormat(key3) { + var format9 = this._longDateFormat[key3], formatUpper = this._longDateFormat[key3.toUpperCase()]; if (format9 || !formatUpper) { return format9; } - this._longDateFormat[key2] = formatUpper.match(formattingTokens).map(function(tok) { + this._longDateFormat[key3] = formatUpper.match(formattingTokens).map(function(tok) { if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") { return tok.slice(1); } return tok; }).join(""); - return this._longDateFormat[key2]; + return this._longDateFormat[key3]; } var defaultInvalidDate = "Invalid date"; function invalidDate() { return this._invalidDate; } var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/; - function ordinal(number4) { - return this._ordinal.replace("%d", number4); + function ordinal(number5) { + return this._ordinal.replace("%d", number5); } var defaultRelativeTime = { future: "in %s", @@ -794,9 +794,9 @@ var require_moment = __commonJS({ y: "a year", yy: "%d years" }; - function relativeTime(number4, withoutSuffix, string4, isFuture) { - var output = this._relativeTime[string4]; - return isFunction3(output) ? output(number4, withoutSuffix, string4, isFuture) : output.replace(/%d/i, number4); + function relativeTime(number5, withoutSuffix, string6, isFuture) { + var output = this._relativeTime[string6]; + return isFunction3(output) ? output(number5, withoutSuffix, string6, isFuture) : output.replace(/%d/i, number5); } function pastFuture(diff3, output) { var format9 = this._relativeTime[diff3 > 0 ? "future" : "past"]; @@ -841,11 +841,11 @@ var require_moment = __commonJS({ function isLeapYear(year) { return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; } - function absFloor(number4) { - if (number4 < 0) { - return Math.ceil(number4) || 0; + function absFloor(number5) { + if (number5 < 0) { + return Math.ceil(number5) || 0; } else { - return Math.floor(number4); + return Math.floor(number5); } } function toInt(argumentForCoercion) { @@ -1768,8 +1768,8 @@ var require_moment = __commonJS({ } return minl; } - function normalizeLocale(key2) { - return key2 ? key2.toLowerCase().replace("_", "-") : key2; + function normalizeLocale(key3) { + return key3 ? key3.toLowerCase().replace("_", "-") : key3; } function chooseLocale(names) { var i4 = 0, j, next, locale3, split; @@ -1809,20 +1809,20 @@ var require_moment = __commonJS({ } return locales[name317]; } - function getSetGlobalLocale(key2, values2) { - var data2; - if (key2) { + function getSetGlobalLocale(key3, values2) { + var data3; + if (key3) { if (isUndefined2(values2)) { - data2 = getLocale(key2); + data3 = getLocale(key3); } else { - data2 = defineLocale(key2, values2); + data3 = defineLocale(key3, values2); } - if (data2) { - globalLocale = data2; + if (data3) { + globalLocale = data3; } else { if (typeof console !== "undefined" && console.warn) { console.warn( - "Locale " + key2 + " not found. Did you forget to load it?" + "Locale " + key3 + " not found. Did you forget to load it?" ); } } @@ -1904,25 +1904,25 @@ var require_moment = __commonJS({ } return locales[name317]; } - function getLocale(key2) { + function getLocale(key3) { var locale3; - if (key2 && key2._locale && key2._locale._abbr) { - key2 = key2._locale._abbr; + if (key3 && key3._locale && key3._locale._abbr) { + key3 = key3._locale._abbr; } - if (!key2) { + if (!key3) { return globalLocale; } - if (!isArray5(key2)) { - locale3 = loadLocale(key2); + if (!isArray5(key3)) { + locale3 = loadLocale(key3); if (locale3) { return locale3; } - key2 = [key2]; + key3 = [key3]; } - return chooseLocale(key2); + return chooseLocale(key3); } function listLocales() { - return keys(locales); + return keys2(locales); } function checkOverflow(m4) { var overflow, a4 = m4._a; @@ -1978,7 +1978,7 @@ var require_moment = __commonJS({ PST: -8 * 60 }; function configFromISO(config4) { - var i4, l2, string4 = config4._i, match5 = extendedIsoRegex.exec(string4) || basicIsoRegex.exec(string4), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; + var i4, l2, string6 = config4._i, match5 = extendedIsoRegex.exec(string6) || basicIsoRegex.exec(string6), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; if (match5) { getParsingFlags(config4).iso = true; for (i4 = 0, l2 = isoDatesLen; i4 < l2; i4++) { @@ -2249,19 +2249,19 @@ var require_moment = __commonJS({ } config4._a = []; getParsingFlags(config4).empty = true; - var string4 = "" + config4._i, i4, parsedInput, tokens2, token2, skipped, stringLength = string4.length, totalParsedInputLength = 0, era, tokenLen; + var string6 = "" + config4._i, i4, parsedInput, tokens2, token2, skipped, stringLength = string6.length, totalParsedInputLength = 0, era, tokenLen; tokens2 = expandFormat(config4._f, config4._locale).match(formattingTokens) || []; tokenLen = tokens2.length; for (i4 = 0; i4 < tokenLen; i4++) { token2 = tokens2[i4]; - parsedInput = (string4.match(getParseRegexForToken(token2, config4)) || [])[0]; + parsedInput = (string6.match(getParseRegexForToken(token2, config4)) || [])[0]; if (parsedInput) { - skipped = string4.substr(0, string4.indexOf(parsedInput)); + skipped = string6.substr(0, string6.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config4).unusedInput.push(skipped); } - string4 = string4.slice( - string4.indexOf(parsedInput) + parsedInput.length + string6 = string6.slice( + string6.indexOf(parsedInput) + parsedInput.length ); totalParsedInputLength += parsedInput.length; } @@ -2277,8 +2277,8 @@ var require_moment = __commonJS({ } } getParsingFlags(config4).charsLeftOver = stringLength - totalParsedInputLength; - if (string4.length > 0) { - getParsingFlags(config4).unusedInput.push(string4); + if (string6.length > 0) { + getParsingFlags(config4).unusedInput.push(string6); } if (config4._a[HOUR] <= 12 && getParsingFlags(config4).bigHour === true && config4._a[HOUR] > 0) { getParsingFlags(config4).bigHour = void 0; @@ -2354,14 +2354,14 @@ var require_moment = __commonJS({ } } } - extend3(config4, bestMoment || tempConfig); + extend4(config4, bestMoment || tempConfig); } function configFromObject(config4) { if (config4._d) { return; } var i4 = normalizeObjectUnits(config4._i), dayOrDate = i4.day === void 0 ? i4.date : i4.day; - config4._a = map4( + config4._a = map6( [i4.year, i4.month, dayOrDate, i4.hour, i4.minute, i4.second, i4.millisecond], function(obj) { return obj && parseInt(obj, 10); @@ -2411,7 +2411,7 @@ var require_moment = __commonJS({ } else if (typeof input === "string") { configFromString(config4); } else if (isArray5(input)) { - config4._a = map4(input.slice(0), function(obj) { + config4._a = map6(input.slice(0), function(obj) { return parseInt(obj, 10); }); configFromArray(config4); @@ -2507,9 +2507,9 @@ var require_moment = __commonJS({ "millisecond" ]; function isDurationValid(m4) { - var key2, unitHasDecimal = false, i4, orderLen = ordering.length; - for (key2 in m4) { - if (hasOwnProp(m4, key2) && !(indexOf.call(ordering, key2) !== -1 && (m4[key2] == null || !isNaN(m4[key2])))) { + var key3, unitHasDecimal = false, i4, orderLen = ordering.length; + for (key3 in m4) { + if (hasOwnProp(m4, key3) && !(indexOf.call(ordering, key3) !== -1 && (m4[key3] == null || !isNaN(m4[key3])))) { return false; } } @@ -2544,11 +2544,11 @@ var require_moment = __commonJS({ function isDuration(obj) { return obj instanceof Duration; } - function absRound(number4) { - if (number4 < 0) { - return Math.round(-1 * number4) * -1; + function absRound(number5) { + if (number5 < 0) { + return Math.round(-1 * number5) * -1; } else { - return Math.round(number4); + return Math.round(number5); } } function compareArrays(array1, array2, dontConvert) { @@ -2579,8 +2579,8 @@ var require_moment = __commonJS({ config4._tzm = offsetFromString(matchShortOffset, input); }); var chunkOffset = /([\+\-]|\d\d)/gi; - function offsetFromString(matcher, string4) { - var matches = (string4 || "").match(matcher), chunk, parts, minutes2; + function offsetFromString(matcher, string6) { + var matches = (string6 || "").match(matcher), chunk, parts, minutes2; if (matches === null) { return null; } @@ -2719,7 +2719,7 @@ var require_moment = __commonJS({ return this.isValid() ? this._isUTC && this._offset === 0 : false; } var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - function createDuration(input, key2) { + function createDuration(input, key3) { var duration = input, match5 = null, sign5, ret, diffRes; if (isDuration(input)) { duration = { @@ -2729,8 +2729,8 @@ var require_moment = __commonJS({ }; } else if (isNumber4(input) || !isNaN(+input)) { duration = {}; - if (key2) { - duration[key2] = +input; + if (key3) { + duration[key3] = +input; } else { duration.milliseconds = +input; } @@ -2781,25 +2781,25 @@ var require_moment = __commonJS({ var res = inp && parseFloat(inp.replace(",", ".")); return (isNaN(res) ? 0 : res) * sign5; } - function positiveMomentsDifference(base2, other) { + function positiveMomentsDifference(base3, other) { var res = {}; - res.months = other.month() - base2.month() + (other.year() - base2.year()) * 12; - if (base2.clone().add(res.months, "M").isAfter(other)) { + res.months = other.month() - base3.month() + (other.year() - base3.year()) * 12; + if (base3.clone().add(res.months, "M").isAfter(other)) { --res.months; } - res.milliseconds = +other - +base2.clone().add(res.months, "M"); + res.milliseconds = +other - +base3.clone().add(res.months, "M"); return res; } - function momentsDifference(base2, other) { + function momentsDifference(base3, other) { var res; - if (!(base2.isValid() && other.isValid())) { + if (!(base3.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } - other = cloneWithOffset(other, base2); - if (base2.isBefore(other)) { - res = positiveMomentsDifference(base2, other); + other = cloneWithOffset(other, base3); + if (base3.isBefore(other)) { + res = positiveMomentsDifference(base3, other); } else { - res = positiveMomentsDifference(other, base2); + res = positiveMomentsDifference(other, base3); res.milliseconds = -res.milliseconds; res.months = -res.months; } @@ -3038,7 +3038,7 @@ var require_moment = __commonJS({ } hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ"; hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; - function toString4() { + function toString5() { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); } function toISOString(keepOffset) { @@ -3106,12 +3106,12 @@ var require_moment = __commonJS({ function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } - function locale2(key2) { + function locale2(key3) { var newLocaleData; - if (key2 === void 0) { + if (key3 === void 0) { return this._locale._abbr; } else { - newLocaleData = getLocale(key2); + newLocaleData = getLocale(key3); if (newLocaleData != null) { this._locale = newLocaleData; } @@ -3120,11 +3120,11 @@ var require_moment = __commonJS({ } var lang = deprecate( "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", - function(key2) { - if (key2 === void 0) { + function(key3) { + if (key3 === void 0) { return this.localeData(); } else { - return this.locale(key2); + return this.locale(key3); } } ); @@ -3307,7 +3307,7 @@ var require_moment = __commonJS({ return isValid2(this); } function parsingFlags() { - return extend3({}, getParsingFlags(this)); + return extend4({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; @@ -3749,7 +3749,7 @@ var require_moment = __commonJS({ }; } proto.toJSON = toJSON; - proto.toString = toString4; + proto.toString = toString5; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; @@ -3817,8 +3817,8 @@ var require_moment = __commonJS({ function createInZone() { return createLocal.apply(null, arguments).parseZone(); } - function preParsePostFormat(string4) { - return string4; + function preParsePostFormat(string6) { + return string6; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; @@ -3853,18 +3853,18 @@ var require_moment = __commonJS({ proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; - function get$1(format9, index2, field, setter) { - var locale3 = getLocale(), utc = createUTC().set(setter, index2); + function get$1(format9, index3, field, setter) { + var locale3 = getLocale(), utc = createUTC().set(setter, index3); return locale3[field](utc, format9); } - function listMonthsImpl(format9, index2, field) { + function listMonthsImpl(format9, index3, field) { if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; - if (index2 != null) { - return get$1(format9, index2, field, "month"); + if (index3 != null) { + return get$1(format9, index3, field, "month"); } var i4, out = []; for (i4 = 0; i4 < 12; i4++) { @@ -3872,46 +3872,46 @@ var require_moment = __commonJS({ } return out; } - function listWeekdaysImpl(localeSorted, format9, index2, field) { + function listWeekdaysImpl(localeSorted, format9, index3, field) { if (typeof localeSorted === "boolean") { if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; } else { format9 = localeSorted; - index2 = format9; + index3 = format9; localeSorted = false; if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; } var locale3 = getLocale(), shift = localeSorted ? locale3._week.dow : 0, i4, out = []; - if (index2 != null) { - return get$1(format9, (index2 + shift) % 7, field, "day"); + if (index3 != null) { + return get$1(format9, (index3 + shift) % 7, field, "day"); } for (i4 = 0; i4 < 7; i4++) { out[i4] = get$1(format9, (i4 + shift) % 7, field, "day"); } return out; } - function listMonths(format9, index2) { - return listMonthsImpl(format9, index2, "months"); + function listMonths(format9, index3) { + return listMonthsImpl(format9, index3, "months"); } - function listMonthsShort(format9, index2) { - return listMonthsImpl(format9, index2, "monthsShort"); + function listMonthsShort(format9, index3) { + return listMonthsImpl(format9, index3, "monthsShort"); } - function listWeekdays(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdays"); + function listWeekdays(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdays"); } - function listWeekdaysShort(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysShort"); + function listWeekdaysShort(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysShort"); } - function listWeekdaysMin(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysMin"); + function listWeekdaysMin(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysMin"); } getSetGlobalLocale("en", { eras: [ @@ -3933,9 +3933,9 @@ var require_moment = __commonJS({ } ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal: function(number4) { - var b2 = number4 % 10, output = toInt(number4 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th"; - return number4 + output; + ordinal: function(number5) { + var b2 = number5 % 10, output = toInt(number5 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th"; + return number5 + output; } }); hooks.lang = deprecate( @@ -3948,16 +3948,16 @@ var require_moment = __commonJS({ ); var mathAbs = Math.abs; function abs3() { - var data2 = this._data; + var data3 = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); - data2.milliseconds = mathAbs(data2.milliseconds); - data2.seconds = mathAbs(data2.seconds); - data2.minutes = mathAbs(data2.minutes); - data2.hours = mathAbs(data2.hours); - data2.months = mathAbs(data2.months); - data2.years = mathAbs(data2.years); + data3.milliseconds = mathAbs(data3.milliseconds); + data3.seconds = mathAbs(data3.seconds); + data3.minutes = mathAbs(data3.minutes); + data3.hours = mathAbs(data3.hours); + data3.months = mathAbs(data3.months); + data3.years = mathAbs(data3.years); return this; } function addSubtract$1(duration, input, value, direction) { @@ -3973,36 +3973,36 @@ var require_moment = __commonJS({ function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); } - function absCeil(number4) { - if (number4 < 0) { - return Math.floor(number4); + function absCeil(number5) { + if (number5 < 0) { + return Math.floor(number5); } else { - return Math.ceil(number4); + return Math.ceil(number5); } } function bubble() { - var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data2 = this._data, seconds2, minutes2, hours2, years2, monthsFromDays; + var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data3 = this._data, seconds2, minutes2, hours2, years2, monthsFromDays; if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) { milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5; days2 = 0; months2 = 0; } - data2.milliseconds = milliseconds2 % 1e3; + data3.milliseconds = milliseconds2 % 1e3; seconds2 = absFloor(milliseconds2 / 1e3); - data2.seconds = seconds2 % 60; + data3.seconds = seconds2 % 60; minutes2 = absFloor(seconds2 / 60); - data2.minutes = minutes2 % 60; + data3.minutes = minutes2 % 60; hours2 = absFloor(minutes2 / 60); - data2.hours = hours2 % 24; + data3.hours = hours2 % 24; days2 += absFloor(hours2 / 24); monthsFromDays = absFloor(daysToMonths(days2)); months2 += monthsFromDays; days2 -= absCeil(monthsToDays(monthsFromDays)); years2 = absFloor(months2 / 12); months2 %= 12; - data2.days = days2; - data2.months = months2; - data2.years = years2; + data3.days = days2; + data3.months = months2; + data3.years = years2; return this; } function daysToMonths(days2) { @@ -4085,8 +4085,8 @@ var require_moment = __commonJS({ w: null, M: 11 }; - function substituteTimeAgo(string4, number4, withoutSuffix, isFuture, locale3) { - return locale3.relativeTime(number4 || 1, !!withoutSuffix, string4, isFuture); + function substituteTimeAgo(string6, number5, withoutSuffix, isFuture, locale3) { + return locale3.relativeTime(number5 || 1, !!withoutSuffix, string6, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale3) { var duration = createDuration(posNegDuration).abs(), seconds2 = round3(duration.as("s")), minutes2 = round3(duration.as("m")), hours2 = round3(duration.as("h")), days2 = round3(duration.as("d")), months2 = round3(duration.as("M")), weeks2 = round3(duration.as("w")), years2 = round3(duration.as("y")), a4 = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2]; @@ -4592,7 +4592,7 @@ var require_lodash = __commonJS({ var freeParseFloat = parseFloat, freeParseInt = parseInt; var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeSelf = typeof self == "object" && self && self.Object === Object && self; - var root = freeGlobal || freeSelf || Function("return this")(); + var root4 = freeGlobal || freeSelf || Function("return this")(); var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; var moduleExports = freeModule && freeModule.exports === freeExports; @@ -4622,17 +4622,17 @@ var require_lodash = __commonJS({ return func.apply(thisArg, args); } function arrayAggregator(array, setter, iteratee, accumulator) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + var value = array[index3]; setter(accumulator, value, iteratee(value), array); } return accumulator; } function arrayEach(array, iteratee) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (iteratee(array[index2], index2, array) === false) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (iteratee(array[index3], index3, array) === false) { break; } } @@ -4648,19 +4648,19 @@ var require_lodash = __commonJS({ return array; } function arrayEvery(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (!predicate(array[index2], index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (!predicate(array[index3], index3, array)) { return false; } } return true; } function arrayFilter(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; - while (++index2 < length) { - var value = array[index2]; - if (predicate(value, index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; + while (++index3 < length) { + var value = array[index3]; + if (predicate(value, index3, array)) { result[resIndex++] = value; } } @@ -4671,35 +4671,35 @@ var require_lodash = __commonJS({ return !!length && baseIndexOf(array, value, 0) > -1; } function arrayIncludesWith(array, value, comparator) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (comparator(value, array[index2])) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (comparator(value, array[index3])) { return true; } } return false; } function arrayMap(array, iteratee) { - var index2 = -1, length = array == null ? 0 : array.length, result = Array(length); - while (++index2 < length) { - result[index2] = iteratee(array[index2], index2, array); + var index3 = -1, length = array == null ? 0 : array.length, result = Array(length); + while (++index3 < length) { + result[index3] = iteratee(array[index3], index3, array); } return result; } function arrayPush(array, values2) { - var index2 = -1, length = values2.length, offset2 = array.length; - while (++index2 < length) { - array[offset2 + index2] = values2[index2]; + var index3 = -1, length = values2.length, offset2 = array.length; + while (++index3 < length) { + array[offset2 + index3] = values2[index3]; } return array; } function arrayReduce(array, iteratee, accumulator, initAccum) { - var index2 = -1, length = array == null ? 0 : array.length; + var index3 = -1, length = array == null ? 0 : array.length; if (initAccum && length) { - accumulator = array[++index2]; + accumulator = array[++index3]; } - while (++index2 < length) { - accumulator = iteratee(accumulator, array[index2], index2, array); + while (++index3 < length) { + accumulator = iteratee(accumulator, array[index3], index3, array); } return accumulator; } @@ -4714,36 +4714,36 @@ var require_lodash = __commonJS({ return accumulator; } function arraySome(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (predicate(array[index2], index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (predicate(array[index3], index3, array)) { return true; } } return false; } var asciiSize = baseProperty("length"); - function asciiToArray(string4) { - return string4.split(""); + function asciiToArray(string6) { + return string6.split(""); } - function asciiWords(string4) { - return string4.match(reAsciiWord) || []; + function asciiWords(string6) { + return string6.match(reAsciiWord) || []; } function baseFindKey(collection, predicate, eachFunc) { var result; - eachFunc(collection, function(value, key2, collection2) { - if (predicate(value, key2, collection2)) { - result = key2; + eachFunc(collection, function(value, key3, collection2) { + if (predicate(value, key3, collection2)) { + result = key3; return false; } }); return result; } function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1); - while (fromRight ? index2-- : ++index2 < length) { - if (predicate(array[index2], index2, array)) { - return index2; + var length = array.length, index3 = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index3-- : ++index3 < length) { + if (predicate(array[index3], index3, array)) { + return index3; } } return -1; @@ -4752,10 +4752,10 @@ var require_lodash = __commonJS({ return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } function baseIndexOfWith(array, value, fromIndex, comparator) { - var index2 = fromIndex - 1, length = array.length; - while (++index2 < length) { - if (comparator(array[index2], value)) { - return index2; + var index3 = fromIndex - 1, length = array.length; + while (++index3 < length) { + if (comparator(array[index3], value)) { + return index3; } } return -1; @@ -4767,19 +4767,19 @@ var require_lodash = __commonJS({ var length = array == null ? 0 : array.length; return length ? baseSum(array, iteratee) / length : NAN; } - function baseProperty(key2) { + function baseProperty(key3) { return function(object) { - return object == null ? undefined2 : object[key2]; + return object == null ? undefined2 : object[key3]; }; } function basePropertyOf(object) { - return function(key2) { - return object == null ? undefined2 : object[key2]; + return function(key3) { + return object == null ? undefined2 : object[key3]; }; } function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index2, collection2) { - accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index2, collection2); + eachFunc(collection, function(value, index3, collection2) { + accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index3, collection2); }); return accumulator; } @@ -4792,9 +4792,9 @@ var require_lodash = __commonJS({ return array; } function baseSum(array, iteratee) { - var result, index2 = -1, length = array.length; - while (++index2 < length) { - var current3 = iteratee(array[index2]); + var result, index3 = -1, length = array.length; + while (++index3 < length) { + var current3 = iteratee(array[index3]); if (current3 !== undefined2) { result = result === undefined2 ? current3 : result + current3; } @@ -4802,19 +4802,19 @@ var require_lodash = __commonJS({ return result; } function baseTimes(n3, iteratee) { - var index2 = -1, result = Array(n3); - while (++index2 < n3) { - result[index2] = iteratee(index2); + var index3 = -1, result = Array(n3); + while (++index3 < n3) { + result[index3] = iteratee(index3); } return result; } function baseToPairs(object, props) { - return arrayMap(props, function(key2) { - return [key2, object[key2]]; + return arrayMap(props, function(key3) { + return [key3, object[key3]]; }); } - function baseTrim(string4) { - return string4 ? string4.slice(0, trimmedEndIndex(string4) + 1).replace(reTrimStart, "") : string4; + function baseTrim(string6) { + return string6 ? string6.slice(0, trimmedEndIndex(string6) + 1).replace(reTrimStart, "") : string6; } function baseUnary(func) { return function(value) { @@ -4822,24 +4822,24 @@ var require_lodash = __commonJS({ }; } function baseValues(object, props) { - return arrayMap(props, function(key2) { - return object[key2]; + return arrayMap(props, function(key3) { + return object[key3]; }); } - function cacheHas(cache2, key2) { - return cache2.has(key2); + function cacheHas(cache2, key3) { + return cache2.has(key3); } function charsStartIndex(strSymbols, chrSymbols) { - var index2 = -1, length = strSymbols.length; - while (++index2 < length && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) { + var index3 = -1, length = strSymbols.length; + while (++index3 < length && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) { } - return index2; + return index3; } function charsEndIndex(strSymbols, chrSymbols) { - var index2 = strSymbols.length; - while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) { + var index3 = strSymbols.length; + while (index3-- && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) { } - return index2; + return index3; } function countHolders(array, placeholder2) { var length = array.length, result = 0; @@ -4855,26 +4855,26 @@ var require_lodash = __commonJS({ function escapeStringChar(chr) { return "\\" + stringEscapes[chr]; } - function getValue(object, key2) { - return object == null ? undefined2 : object[key2]; + function getValue(object, key3) { + return object == null ? undefined2 : object[key3]; } - function hasUnicode(string4) { - return reHasUnicode.test(string4); + function hasUnicode(string6) { + return reHasUnicode.test(string6); } - function hasUnicodeWord(string4) { - return reHasUnicodeWord.test(string4); + function hasUnicodeWord(string6) { + return reHasUnicodeWord.test(string6); } function iteratorToArray(iterator) { - var data2, result = []; - while (!(data2 = iterator.next()).done) { - result.push(data2.value); + var data3, result = []; + while (!(data3 = iterator.next()).done) { + result.push(data3.value); } return result; } - function mapToArray(map4) { - var index2 = -1, result = Array(map4.size); - map4.forEach(function(value, key2) { - result[++index2] = [key2, value]; + function mapToArray(map6) { + var index3 = -1, result = Array(map6.size); + map6.forEach(function(value, key3) { + result[++index3] = [key3, value]; }); return result; } @@ -4884,81 +4884,81 @@ var require_lodash = __commonJS({ }; } function replaceHolders(array, placeholder2) { - var index2 = -1, length = array.length, resIndex = 0, result = []; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array.length, resIndex = 0, result = []; + while (++index3 < length) { + var value = array[index3]; if (value === placeholder2 || value === PLACEHOLDER) { - array[index2] = PLACEHOLDER; - result[resIndex++] = index2; + array[index3] = PLACEHOLDER; + result[resIndex++] = index3; } } return result; } function setToArray(set) { - var index2 = -1, result = Array(set.size); + var index3 = -1, result = Array(set.size); set.forEach(function(value) { - result[++index2] = value; + result[++index3] = value; }); return result; } function setToPairs(set) { - var index2 = -1, result = Array(set.size); + var index3 = -1, result = Array(set.size); set.forEach(function(value) { - result[++index2] = [value, value]; + result[++index3] = [value, value]; }); return result; } function strictIndexOf(array, value, fromIndex) { - var index2 = fromIndex - 1, length = array.length; - while (++index2 < length) { - if (array[index2] === value) { - return index2; + var index3 = fromIndex - 1, length = array.length; + while (++index3 < length) { + if (array[index3] === value) { + return index3; } } return -1; } function strictLastIndexOf(array, value, fromIndex) { - var index2 = fromIndex + 1; - while (index2--) { - if (array[index2] === value) { - return index2; + var index3 = fromIndex + 1; + while (index3--) { + if (array[index3] === value) { + return index3; } } - return index2; + return index3; } - function stringSize(string4) { - return hasUnicode(string4) ? unicodeSize(string4) : asciiSize(string4); + function stringSize(string6) { + return hasUnicode(string6) ? unicodeSize(string6) : asciiSize(string6); } - function stringToArray(string4) { - return hasUnicode(string4) ? unicodeToArray(string4) : asciiToArray(string4); + function stringToArray(string6) { + return hasUnicode(string6) ? unicodeToArray(string6) : asciiToArray(string6); } - function trimmedEndIndex(string4) { - var index2 = string4.length; - while (index2-- && reWhitespace.test(string4.charAt(index2))) { + function trimmedEndIndex(string6) { + var index3 = string6.length; + while (index3-- && reWhitespace.test(string6.charAt(index3))) { } - return index2; + return index3; } var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - function unicodeSize(string4) { + function unicodeSize(string6) { var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string4)) { + while (reUnicode.test(string6)) { ++result; } return result; } - function unicodeToArray(string4) { - return string4.match(reUnicode) || []; + function unicodeToArray(string6) { + return string6.match(reUnicode) || []; } - function unicodeWords(string4) { - return string4.match(reUnicodeWord) || []; + function unicodeWords(string6) { + return string6.match(reUnicodeWord) || []; } var runInContext = function runInContext2(context) { - context = context == null ? root : _15.defaults(root.Object(), context, _15.pick(root, contextProps)); + context = context == null ? root4 : _15.defaults(root4.Object(), context, _15.pick(root4, contextProps)); var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; var coreJsData = context["__core-js_shared__"]; var funcToString = funcProto.toString; - var hasOwnProperty3 = objectProto.hasOwnProperty; + var hasOwnProperty4 = objectProto.hasOwnProperty; var idCounter = 0; var maskSrcKey = function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); @@ -4966,11 +4966,11 @@ var require_lodash = __commonJS({ }(); var nativeObjectToString = objectProto.toString; var objectCtorString = funcToString.call(Object2); - var oldDash = root._; + var oldDash = root4._; var reIsNative = RegExp2( - "^" + funcToString.call(hasOwnProperty3).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + "^" + funcToString.call(hasOwnProperty4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); - var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; + var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice2 = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; var defineProperty = function() { try { var func = getNative(Object2, "defineProperty"); @@ -4979,7 +4979,7 @@ var require_lodash = __commonJS({ } catch (e5) { } }(); - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + var ctxClearTimeout = context.clearTimeout !== root4.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root4.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root4.setTimeout && context.setTimeout; var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); var metaMap = WeakMap2 && new WeakMap2(); @@ -4991,7 +4991,7 @@ var require_lodash = __commonJS({ if (value instanceof LodashWrapper) { return value; } - if (hasOwnProperty3.call(value, "__wrapped__")) { + if (hasOwnProperty4.call(value, "__wrapped__")) { return wrapperClone(value); } } @@ -5066,17 +5066,17 @@ var require_lodash = __commonJS({ return result2; } function lazyValue() { - var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray5(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index2 = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); + var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray5(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index3 = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || !isRight && arrLength == length && takeCount == length) { return baseWrapperValue(array, this.__actions__); } var result2 = []; outer: while (length-- && resIndex < takeCount) { - index2 += dir; - var iterIndex = -1, value = array[index2]; + index3 += dir; + var iterIndex = -1, value = array[index3]; while (++iterIndex < iterLength) { - var data2 = iteratees[iterIndex], iteratee2 = data2.iteratee, type = data2.type, computed = iteratee2(value); + var data3 = iteratees[iterIndex], iteratee2 = data3.iteratee, type = data3.type, computed = iteratee2(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { @@ -5094,10 +5094,10 @@ var require_lodash = __commonJS({ LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; function Hash(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5105,27 +5105,27 @@ var require_lodash = __commonJS({ this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } - function hashDelete(key2) { - var result2 = this.has(key2) && delete this.__data__[key2]; + function hashDelete(key3) { + var result2 = this.has(key3) && delete this.__data__[key3]; this.size -= result2 ? 1 : 0; return result2; } - function hashGet(key2) { - var data2 = this.__data__; + function hashGet(key3) { + var data3 = this.__data__; if (nativeCreate) { - var result2 = data2[key2]; + var result2 = data3[key3]; return result2 === HASH_UNDEFINED ? undefined2 : result2; } - return hasOwnProperty3.call(data2, key2) ? data2[key2] : undefined2; + return hasOwnProperty4.call(data3, key3) ? data3[key3] : undefined2; } - function hashHas(key2) { - var data2 = this.__data__; - return nativeCreate ? data2[key2] !== undefined2 : hasOwnProperty3.call(data2, key2); + function hashHas(key3) { + var data3 = this.__data__; + return nativeCreate ? data3[key3] !== undefined2 : hasOwnProperty4.call(data3, key3); } - function hashSet(key2, value) { - var data2 = this.__data__; - this.size += this.has(key2) ? 0 : 1; - data2[key2] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; + function hashSet(key3, value) { + var data3 = this.__data__; + this.size += this.has(key3) ? 0 : 1; + data3[key3] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; @@ -5134,10 +5134,10 @@ var require_lodash = __commonJS({ Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5145,34 +5145,34 @@ var require_lodash = __commonJS({ this.__data__ = []; this.size = 0; } - function listCacheDelete(key2) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - if (index2 < 0) { + function listCacheDelete(key3) { + var data3 = this.__data__, index3 = assocIndexOf(data3, key3); + if (index3 < 0) { return false; } - var lastIndex = data2.length - 1; - if (index2 == lastIndex) { - data2.pop(); + var lastIndex = data3.length - 1; + if (index3 == lastIndex) { + data3.pop(); } else { - splice.call(data2, index2, 1); + splice2.call(data3, index3, 1); } --this.size; return true; } - function listCacheGet(key2) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - return index2 < 0 ? undefined2 : data2[index2][1]; + function listCacheGet(key3) { + var data3 = this.__data__, index3 = assocIndexOf(data3, key3); + return index3 < 0 ? undefined2 : data3[index3][1]; } - function listCacheHas(key2) { - return assocIndexOf(this.__data__, key2) > -1; + function listCacheHas(key3) { + return assocIndexOf(this.__data__, key3) > -1; } - function listCacheSet(key2, value) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - if (index2 < 0) { + function listCacheSet(key3, value) { + var data3 = this.__data__, index3 = assocIndexOf(data3, key3); + if (index3 < 0) { ++this.size; - data2.push([key2, value]); + data3.push([key3, value]); } else { - data2[index2][1] = value; + data3[index3][1] = value; } return this; } @@ -5182,10 +5182,10 @@ var require_lodash = __commonJS({ ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5197,21 +5197,21 @@ var require_lodash = __commonJS({ "string": new Hash() }; } - function mapCacheDelete(key2) { - var result2 = getMapData(this, key2)["delete"](key2); + function mapCacheDelete(key3) { + var result2 = getMapData(this, key3)["delete"](key3); this.size -= result2 ? 1 : 0; return result2; } - function mapCacheGet(key2) { - return getMapData(this, key2).get(key2); + function mapCacheGet(key3) { + return getMapData(this, key3).get(key3); } - function mapCacheHas(key2) { - return getMapData(this, key2).has(key2); + function mapCacheHas(key3) { + return getMapData(this, key3).has(key3); } - function mapCacheSet(key2, value) { - var data2 = getMapData(this, key2), size3 = data2.size; - data2.set(key2, value); - this.size += data2.size == size3 ? 0 : 1; + function mapCacheSet(key3, value) { + var data3 = getMapData(this, key3), size3 = data3.size; + data3.set(key3, value); + this.size += data3.size == size3 ? 0 : 1; return this; } MapCache.prototype.clear = mapCacheClear; @@ -5220,10 +5220,10 @@ var require_lodash = __commonJS({ MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values3) { - var index2 = -1, length = values3 == null ? 0 : values3.length; + var index3 = -1, length = values3 == null ? 0 : values3.length; this.__data__ = new MapCache(); - while (++index2 < length) { - this.add(values3[index2]); + while (++index3 < length) { + this.add(values3[index3]); } } function setCacheAdd(value) { @@ -5236,37 +5236,37 @@ var require_lodash = __commonJS({ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack2(entries) { - var data2 = this.__data__ = new ListCache(entries); - this.size = data2.size; + var data3 = this.__data__ = new ListCache(entries); + this.size = data3.size; } function stackClear() { this.__data__ = new ListCache(); this.size = 0; } - function stackDelete(key2) { - var data2 = this.__data__, result2 = data2["delete"](key2); - this.size = data2.size; + function stackDelete(key3) { + var data3 = this.__data__, result2 = data3["delete"](key3); + this.size = data3.size; return result2; } - function stackGet(key2) { - return this.__data__.get(key2); + function stackGet(key3) { + return this.__data__.get(key3); } - function stackHas(key2) { - return this.__data__.has(key2); + function stackHas(key3) { + return this.__data__.has(key3); } - function stackSet(key2, value) { - var data2 = this.__data__; - if (data2 instanceof ListCache) { - var pairs = data2.__data__; + function stackSet(key3, value) { + var data3 = this.__data__; + if (data3 instanceof ListCache) { + var pairs = data3.__data__; if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { - pairs.push([key2, value]); - this.size = ++data2.size; + pairs.push([key3, value]); + this.size = ++data3.size; return this; } - data2 = this.__data__ = new MapCache(pairs); + data3 = this.__data__ = new MapCache(pairs); } - data2.set(key2, value); - this.size = data2.size; + data3.set(key3, value); + this.size = data3.size; return this; } Stack2.prototype.clear = stackClear; @@ -5275,10 +5275,10 @@ var require_lodash = __commonJS({ Stack2.prototype.has = stackHas; Stack2.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { - var isArr = isArray5(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; - for (var key2 in value) { - if ((inherited || hasOwnProperty3.call(value, key2)) && !(skipIndexes && (key2 == "length" || isBuff && (key2 == "offset" || key2 == "parent") || isType && (key2 == "buffer" || key2 == "byteLength" || key2 == "byteOffset") || isIndex2(key2, length)))) { - result2.push(key2); + var isArr = isArray5(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; + for (var key3 in value) { + if ((inherited || hasOwnProperty4.call(value, key3)) && !(skipIndexes && (key3 == "length" || isBuff && (key3 == "offset" || key3 == "parent") || isType && (key3 == "buffer" || key3 == "byteLength" || key3 == "byteOffset") || isIndex2(key3, length)))) { + result2.push(key3); } } return result2; @@ -5293,72 +5293,72 @@ var require_lodash = __commonJS({ function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } - function assignMergeValue(object, key2, value) { - if (value !== undefined2 && !eq(object[key2], value) || value === undefined2 && !(key2 in object)) { - baseAssignValue(object, key2, value); + function assignMergeValue(object, key3, value) { + if (value !== undefined2 && !eq(object[key3], value) || value === undefined2 && !(key3 in object)) { + baseAssignValue(object, key3, value); } } - function assignValue(object, key2, value) { - var objValue = object[key2]; - if (!(hasOwnProperty3.call(object, key2) && eq(objValue, value)) || value === undefined2 && !(key2 in object)) { - baseAssignValue(object, key2, value); + function assignValue(object, key3, value) { + var objValue = object[key3]; + if (!(hasOwnProperty4.call(object, key3) && eq(objValue, value)) || value === undefined2 && !(key3 in object)) { + baseAssignValue(object, key3, value); } } - function assocIndexOf(array, key2) { + function assocIndexOf(array, key3) { var length = array.length; while (length--) { - if (eq(array[length][0], key2)) { + if (eq(array[length][0], key3)) { return length; } } return -1; } function baseAggregator(collection, setter, iteratee2, accumulator) { - baseEach(collection, function(value, key2, collection2) { + baseEach(collection, function(value, key3, collection2) { setter(accumulator, value, iteratee2(value), collection2); }); return accumulator; } function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); + return object && copyObject(source, keys2(source), object); } function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } - function baseAssignValue(object, key2, value) { - if (key2 == "__proto__" && defineProperty) { - defineProperty(object, key2, { + function baseAssignValue(object, key3, value) { + if (key3 == "__proto__" && defineProperty) { + defineProperty(object, key3, { "configurable": true, "enumerable": true, "value": value, "writable": true }); } else { - object[key2] = value; + object[key3] = value; } } function baseAt(object, paths) { - var index2 = -1, length = paths.length, result2 = Array2(length), skip = object == null; - while (++index2 < length) { - result2[index2] = skip ? undefined2 : get2(object, paths[index2]); + var index3 = -1, length = paths.length, result2 = Array2(length), skip = object == null; + while (++index3 < length) { + result2[index3] = skip ? undefined2 : get2(object, paths[index3]); } return result2; } - function baseClamp(number4, lower, upper) { - if (number4 === number4) { + function baseClamp(number5, lower, upper) { + if (number5 === number5) { if (upper !== undefined2) { - number4 = number4 <= upper ? number4 : upper; + number5 = number5 <= upper ? number5 : upper; } if (lower !== undefined2) { - number4 = number4 >= lower ? number4 : lower; + number5 = number5 >= lower ? number5 : lower; } } - return number4; + return number5; } - function baseClone(value, bitmask, customizer, key2, object, stack) { + function baseClone(value, bitmask, customizer, key3, object, stack) { var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { - result2 = object ? customizer(value, key2, object, stack) : customizer(value); + result2 = object ? customizer(value, key3, object, stack) : customizer(value); } if (result2 !== undefined2) { return result2; @@ -5374,7 +5374,7 @@ var require_lodash = __commonJS({ } } else { var tag2 = getTag2(value), isFunc = tag2 == funcTag || tag2 == genTag; - if (isBuffer(value)) { + if (isBuffer2(value)) { return cloneBuffer(value, isDeep); } if (tag2 == objectTag || tag2 == argsTag || isFunc && !object) { @@ -5400,23 +5400,23 @@ var require_lodash = __commonJS({ result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap2(value)) { - value.forEach(function(subValue, key3) { - result2.set(key3, baseClone(subValue, bitmask, customizer, key3, value, stack)); + value.forEach(function(subValue, key4) { + result2.set(key4, baseClone(subValue, bitmask, customizer, key4, value, stack)); }); } - var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; + var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys2; var props = isArr ? undefined2 : keysFunc(value); - arrayEach(props || value, function(subValue, key3) { + arrayEach(props || value, function(subValue, key4) { if (props) { - key3 = subValue; - subValue = value[key3]; + key4 = subValue; + subValue = value[key4]; } - assignValue(result2, key3, baseClone(subValue, bitmask, customizer, key3, value, stack)); + assignValue(result2, key4, baseClone(subValue, bitmask, customizer, key4, value, stack)); }); return result2; } function baseConforms(source) { - var props = keys(source); + var props = keys2(source); return function(object) { return baseConformsTo(object, source, props); }; @@ -5428,8 +5428,8 @@ var require_lodash = __commonJS({ } object = Object2(object); while (length--) { - var key2 = props[length], predicate = source[key2], value = object[key2]; - if (value === undefined2 && !(key2 in object) || !predicate(value)) { + var key3 = props[length], predicate = source[key3], value = object[key3]; + if (value === undefined2 && !(key3 in object) || !predicate(value)) { return false; } } @@ -5444,7 +5444,7 @@ var require_lodash = __commonJS({ }, wait); } function baseDifference(array, values3, iteratee2, comparator) { - var index2 = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values3.length; + var index3 = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values3.length; if (!length) { return result2; } @@ -5460,8 +5460,8 @@ var require_lodash = __commonJS({ values3 = new SetCache(values3); } outer: - while (++index2 < length) { - var value = array[index2], computed = iteratee2 == null ? value : iteratee2(value); + while (++index3 < length) { + var value = array[index3], computed = iteratee2 == null ? value : iteratee2(value); value = comparator || value !== 0 ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; @@ -5481,16 +5481,16 @@ var require_lodash = __commonJS({ var baseEachRight = createBaseEach(baseForOwnRight, true); function baseEvery(collection, predicate) { var result2 = true; - baseEach(collection, function(value, index2, collection2) { - result2 = !!predicate(value, index2, collection2); + baseEach(collection, function(value, index3, collection2) { + result2 = !!predicate(value, index3, collection2); return result2; }); return result2; } function baseExtremum(array, iteratee2, comparator) { - var index2 = -1, length = array.length; - while (++index2 < length) { - var value = array[index2], current3 = iteratee2(value); + var index3 = -1, length = array.length; + while (++index3 < length) { + var value = array[index3], current3 = iteratee2(value); if (current3 != null && (computed === undefined2 ? current3 === current3 && !isSymbol(current3) : comparator(current3, computed))) { var computed = current3, result2 = value; } @@ -5515,19 +5515,19 @@ var require_lodash = __commonJS({ } function baseFilter(collection, predicate) { var result2 = []; - baseEach(collection, function(value, index2, collection2) { - if (predicate(value, index2, collection2)) { + baseEach(collection, function(value, index3, collection2) { + if (predicate(value, index3, collection2)) { result2.push(value); } }); return result2; } function baseFlatten(array, depth, predicate, isStrict, result2) { - var index2 = -1, length = array.length; + var index3 = -1, length = array.length; predicate || (predicate = isFlattenable); result2 || (result2 = []); - while (++index2 < length) { - var value = array[index2]; + while (++index3 < length) { + var value = array[index3]; if (depth > 0 && predicate(value)) { if (depth > 1) { baseFlatten(value, depth - 1, predicate, isStrict, result2); @@ -5543,23 +5543,23 @@ var require_lodash = __commonJS({ var baseFor = createBaseFor(); var baseForRight = createBaseFor(true); function baseForOwn(object, iteratee2) { - return object && baseFor(object, iteratee2, keys); + return object && baseFor(object, iteratee2, keys2); } function baseForOwnRight(object, iteratee2) { - return object && baseForRight(object, iteratee2, keys); + return object && baseForRight(object, iteratee2, keys2); } function baseFunctions(object, props) { - return arrayFilter(props, function(key2) { - return isFunction3(object[key2]); + return arrayFilter(props, function(key3) { + return isFunction3(object[key3]); }); } - function baseGet(object, path2) { - path2 = castPath(path2, object); - var index2 = 0, length = path2.length; - while (object != null && index2 < length) { - object = object[toKey(path2[index2++])]; + function baseGet(object, path3) { + path3 = castPath(path3, object); + var index3 = 0, length = path3.length; + while (object != null && index3 < length) { + object = object[toKey(path3[index3++])]; } - return index2 && index2 == length ? object : undefined2; + return index3 && index3 == length ? object : undefined2; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result2 = keysFunc(object); @@ -5574,14 +5574,14 @@ var require_lodash = __commonJS({ function baseGt(value, other) { return value > other; } - function baseHas(object, key2) { - return object != null && hasOwnProperty3.call(object, key2); + function baseHas(object, key3) { + return object != null && hasOwnProperty4.call(object, key3); } - function baseHasIn(object, key2) { - return object != null && key2 in Object2(object); + function baseHasIn(object, key3) { + return object != null && key3 in Object2(object); } - function baseInRange(number4, start, end) { - return number4 >= nativeMin(start, end) && number4 < nativeMax(start, end); + function baseInRange(number5, start, end) { + return number5 >= nativeMin(start, end) && number5 < nativeMax(start, end); } function baseIntersection(arrays, iteratee2, comparator) { var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; @@ -5594,10 +5594,10 @@ var require_lodash = __commonJS({ caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; } array = arrays[0]; - var index2 = -1, seen = caches[0]; + var index3 = -1, seen = caches[0]; outer: - while (++index2 < length && result2.length < maxLength) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length && result2.length < maxLength) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { othIndex = othLength; @@ -5616,15 +5616,15 @@ var require_lodash = __commonJS({ return result2; } function baseInverter(object, setter, iteratee2, accumulator) { - baseForOwn(object, function(value, key2, object2) { - setter(accumulator, iteratee2(value), key2, object2); + baseForOwn(object, function(value, key3, object2) { + setter(accumulator, iteratee2(value), key3, object2); }); return accumulator; } - function baseInvoke(object, path2, args) { - path2 = castPath(path2, object); - object = parent(object, path2); - var func = object == null ? object : object[toKey(last(path2))]; + function baseInvoke(object, path3, args) { + path3 = castPath(path3, object); + object = parent(object, path3); + var func = object == null ? object : object[toKey(last(path3))]; return func == null ? undefined2 : apply2(func, object, args); } function baseIsArguments(value) { @@ -5650,8 +5650,8 @@ var require_lodash = __commonJS({ objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { + if (isSameTag && isBuffer2(object)) { + if (!isBuffer2(other)) { return false; } objIsArr = true; @@ -5662,7 +5662,7 @@ var require_lodash = __commonJS({ return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty3.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty3.call(other, "__wrapped__"); + var objIsWrapped = objIsObj && hasOwnProperty4.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty4.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack2()); @@ -5679,28 +5679,28 @@ var require_lodash = __commonJS({ return isObjectLike2(value) && getTag2(value) == mapTag; } function baseIsMatch(object, source, matchData, customizer) { - var index2 = matchData.length, length = index2, noCustomizer = !customizer; + var index3 = matchData.length, length = index3, noCustomizer = !customizer; if (object == null) { return !length; } object = Object2(object); - while (index2--) { - var data2 = matchData[index2]; - if (noCustomizer && data2[2] ? data2[1] !== object[data2[0]] : !(data2[0] in object)) { + while (index3--) { + var data3 = matchData[index3]; + if (noCustomizer && data3[2] ? data3[1] !== object[data3[0]] : !(data3[0] in object)) { return false; } } - while (++index2 < length) { - data2 = matchData[index2]; - var key2 = data2[0], objValue = object[key2], srcValue = data2[1]; - if (noCustomizer && data2[2]) { - if (objValue === undefined2 && !(key2 in object)) { + while (++index3 < length) { + data3 = matchData[index3]; + var key3 = data3[0], objValue = object[key3], srcValue = data3[1]; + if (noCustomizer && data3[2]) { + if (objValue === undefined2 && !(key3 in object)) { return false; } } else { var stack = new Stack2(); if (customizer) { - var result2 = customizer(objValue, srcValue, key2, object, source, stack); + var result2 = customizer(objValue, srcValue, key3, object, source, stack); } if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { return false; @@ -5742,9 +5742,9 @@ var require_lodash = __commonJS({ return nativeKeys(object); } var result2 = []; - for (var key2 in Object2(object)) { - if (hasOwnProperty3.call(object, key2) && key2 != "constructor") { - result2.push(key2); + for (var key3 in Object2(object)) { + if (hasOwnProperty4.call(object, key3) && key3 != "constructor") { + result2.push(key3); } } return result2; @@ -5754,9 +5754,9 @@ var require_lodash = __commonJS({ return nativeKeysIn(object); } var isProto = isPrototype(object), result2 = []; - for (var key2 in object) { - if (!(key2 == "constructor" && (isProto || !hasOwnProperty3.call(object, key2)))) { - result2.push(key2); + for (var key3 in object) { + if (!(key3 == "constructor" && (isProto || !hasOwnProperty4.call(object, key3)))) { + result2.push(key3); } } return result2; @@ -5765,9 +5765,9 @@ var require_lodash = __commonJS({ return value < other; } function baseMap(collection, iteratee2) { - var index2 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; - baseEach(collection, function(value, key2, collection2) { - result2[++index2] = iteratee2(value, key2, collection2); + var index3 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; + baseEach(collection, function(value, key3, collection2) { + result2[++index3] = iteratee2(value, key3, collection2); }); return result2; } @@ -5780,42 +5780,42 @@ var require_lodash = __commonJS({ return object === source || baseIsMatch(object, source, matchData); }; } - function baseMatchesProperty(path2, srcValue) { - if (isKey(path2) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path2), srcValue); + function baseMatchesProperty(path3, srcValue) { + if (isKey(path3) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path3), srcValue); } return function(object) { - var objValue = get2(object, path2); - return objValue === undefined2 && objValue === srcValue ? hasIn(object, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + var objValue = get2(object, path3); + return objValue === undefined2 && objValue === srcValue ? hasIn(object, path3) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - baseFor(source, function(srcValue, key2) { + baseFor(source, function(srcValue, key3) { stack || (stack = new Stack2()); if (isObject4(srcValue)) { - baseMergeDeep(object, source, key2, srcIndex, baseMerge, customizer, stack); + baseMergeDeep(object, source, key3, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(safeGet(object, key2), srcValue, key2 + "", object, source, stack) : undefined2; + var newValue = customizer ? customizer(safeGet(object, key3), srcValue, key3 + "", object, source, stack) : undefined2; if (newValue === undefined2) { newValue = srcValue; } - assignMergeValue(object, key2, newValue); + assignMergeValue(object, key3, newValue); } }, keysIn); } - function baseMergeDeep(object, source, key2, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key2), srcValue = safeGet(source, key2), stacked = stack.get(srcValue); + function baseMergeDeep(object, source, key3, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key3), srcValue = safeGet(source, key3), stacked = stack.get(srcValue); if (stacked) { - assignMergeValue(object, key2, stacked); + assignMergeValue(object, key3, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, key2 + "", object, source, stack) : undefined2; + var newValue = customizer ? customizer(objValue, srcValue, key3 + "", object, source, stack) : undefined2; var isCommon = newValue === undefined2; if (isCommon) { - var isArr = isArray5(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); + var isArr = isArray5(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray5(objValue)) { @@ -5831,7 +5831,7 @@ var require_lodash = __commonJS({ } else { newValue = []; } - } else if (isPlainObject2(srcValue) || isArguments(srcValue)) { + } else if (isPlainObject3(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); @@ -5847,7 +5847,7 @@ var require_lodash = __commonJS({ mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack["delete"](srcValue); } - assignMergeValue(object, key2, newValue); + assignMergeValue(object, key3, newValue); } function baseNth(array, n3) { var length = array.length; @@ -5870,53 +5870,53 @@ var require_lodash = __commonJS({ } else { iteratees = [identity2]; } - var index2 = -1; + var index3 = -1; iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - var result2 = baseMap(collection, function(value, key2, collection2) { + var result2 = baseMap(collection, function(value, key3, collection2) { var criteria = arrayMap(iteratees, function(iteratee2) { return iteratee2(value); }); - return { "criteria": criteria, "index": ++index2, "value": value }; + return { "criteria": criteria, "index": ++index3, "value": value }; }); return baseSortBy(result2, function(object, other) { return compareMultiple(object, other, orders); }); } function basePick(object, paths) { - return basePickBy(object, paths, function(value, path2) { - return hasIn(object, path2); + return basePickBy(object, paths, function(value, path3) { + return hasIn(object, path3); }); } function basePickBy(object, paths, predicate) { - var index2 = -1, length = paths.length, result2 = {}; - while (++index2 < length) { - var path2 = paths[index2], value = baseGet(object, path2); - if (predicate(value, path2)) { - baseSet(result2, castPath(path2, object), value); + var index3 = -1, length = paths.length, result2 = {}; + while (++index3 < length) { + var path3 = paths[index3], value = baseGet(object, path3); + if (predicate(value, path3)) { + baseSet(result2, castPath(path3, object), value); } } return result2; } - function basePropertyDeep(path2) { + function basePropertyDeep(path3) { return function(object) { - return baseGet(object, path2); + return baseGet(object, path3); }; } function basePullAll(array, values3, iteratee2, comparator) { - var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length = values3.length, seen = array; + var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index3 = -1, length = values3.length, seen = array; if (array === values3) { values3 = copyArray(values3); } if (iteratee2) { seen = arrayMap(array, baseUnary(iteratee2)); } - while (++index2 < length) { - var fromIndex = 0, value = values3[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length) { + var fromIndex = 0, value = values3[index3], computed = iteratee2 ? iteratee2(value) : value; while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { - splice.call(seen, fromIndex, 1); + splice2.call(seen, fromIndex, 1); } - splice.call(array, fromIndex, 1); + splice2.call(array, fromIndex, 1); } } return array; @@ -5924,13 +5924,13 @@ var require_lodash = __commonJS({ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { - var index2 = indexes[length]; - if (length == lastIndex || index2 !== previous) { - var previous = index2; - if (isIndex2(index2)) { - splice.call(array, index2, 1); + var index3 = indexes[length]; + if (length == lastIndex || index3 !== previous2) { + var previous2 = index3; + if (isIndex2(index3)) { + splice2.call(array, index3, 1); } else { - baseUnset(array, index2); + baseUnset(array, index3); } } } @@ -5940,25 +5940,25 @@ var require_lodash = __commonJS({ return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } function baseRange(start, end, step, fromRight) { - var index2 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); + var index3 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); while (length--) { - result2[fromRight ? length : ++index2] = start; + result2[fromRight ? length : ++index3] = start; start += step; } return result2; } - function baseRepeat(string4, n3) { + function baseRepeat(string6, n3) { var result2 = ""; - if (!string4 || n3 < 1 || n3 > MAX_SAFE_INTEGER2) { + if (!string6 || n3 < 1 || n3 > MAX_SAFE_INTEGER2) { return result2; } do { if (n3 % 2) { - result2 += string4; + result2 += string6; } n3 = nativeFloor(n3 / 2); if (n3) { - string4 += string4; + string6 += string6; } } while (n3); return result2; @@ -5973,38 +5973,38 @@ var require_lodash = __commonJS({ var array = values2(collection); return shuffleSelf(array, baseClamp(n3, 0, array.length)); } - function baseSet(object, path2, value, customizer) { + function baseSet(object, path3, value, customizer) { if (!isObject4(object)) { return object; } - path2 = castPath(path2, object); - var index2 = -1, length = path2.length, lastIndex = length - 1, nested = object; - while (nested != null && ++index2 < length) { - var key2 = toKey(path2[index2]), newValue = value; - if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") { + path3 = castPath(path3, object); + var index3 = -1, length = path3.length, lastIndex = length - 1, nested = object; + while (nested != null && ++index3 < length) { + var key3 = toKey(path3[index3]), newValue = value; + if (key3 === "__proto__" || key3 === "constructor" || key3 === "prototype") { return object; } - if (index2 != lastIndex) { - var objValue = nested[key2]; - newValue = customizer ? customizer(objValue, key2, nested) : undefined2; + if (index3 != lastIndex) { + var objValue = nested[key3]; + newValue = customizer ? customizer(objValue, key3, nested) : undefined2; if (newValue === undefined2) { - newValue = isObject4(objValue) ? objValue : isIndex2(path2[index2 + 1]) ? [] : {}; + newValue = isObject4(objValue) ? objValue : isIndex2(path3[index3 + 1]) ? [] : {}; } } - assignValue(nested, key2, newValue); - nested = nested[key2]; + assignValue(nested, key3, newValue); + nested = nested[key3]; } return object; } - var baseSetData = !metaMap ? identity2 : function(func, data2) { - metaMap.set(func, data2); + var baseSetData = !metaMap ? identity2 : function(func, data3) { + metaMap.set(func, data3); return func; }; - var baseSetToString = !defineProperty ? identity2 : function(func, string4) { + var baseSetToString = !defineProperty ? identity2 : function(func, string6) { return defineProperty(func, "toString", { "configurable": true, "enumerable": false, - "value": constant(string4), + "value": constant(string6), "writable": true }); }; @@ -6012,7 +6012,7 @@ var require_lodash = __commonJS({ return shuffleSelf(values2(collection)); } function baseSlice(array, start, end) { - var index2 = -1, length = array.length; + var index3 = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : length + start; } @@ -6023,15 +6023,15 @@ var require_lodash = __commonJS({ length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result2 = Array2(length); - while (++index2 < length) { - result2[index2] = array[index2 + start]; + while (++index3 < length) { + result2[index3] = array[index3 + start]; } return result2; } function baseSome(collection, predicate) { var result2; - baseEach(collection, function(value, index2, collection2) { - result2 = predicate(value, index2, collection2); + baseEach(collection, function(value, index3, collection2) { + result2 = predicate(value, index3, collection2); return !result2; }); return !!result2; @@ -6082,10 +6082,10 @@ var require_lodash = __commonJS({ return nativeMin(high, MAX_ARRAY_INDEX); } function baseSortedUniq(array, iteratee2) { - var index2 = -1, length = array.length, resIndex = 0, result2 = []; - while (++index2 < length) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; - if (!index2 || !eq(computed, seen)) { + var index3 = -1, length = array.length, resIndex = 0, result2 = []; + while (++index3 < length) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; + if (!index3 || !eq(computed, seen)) { var seen = computed; result2[resIndex++] = value === 0 ? 0 : value; } @@ -6115,7 +6115,7 @@ var require_lodash = __commonJS({ return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2; } function baseUniq(array, iteratee2, comparator) { - var index2 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; + var index3 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; if (comparator) { isCommon = false; includes2 = arrayIncludesWith; @@ -6131,8 +6131,8 @@ var require_lodash = __commonJS({ seen = iteratee2 ? [] : result2; } outer: - while (++index2 < length) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; @@ -6154,19 +6154,19 @@ var require_lodash = __commonJS({ } return result2; } - function baseUnset(object, path2) { - path2 = castPath(path2, object); - object = parent(object, path2); - return object == null || delete object[toKey(last(path2))]; + function baseUnset(object, path3) { + path3 = castPath(path3, object); + object = parent(object, path3); + return object == null || delete object[toKey(last(path3))]; } - function baseUpdate(object, path2, updater, customizer) { - return baseSet(object, path2, updater(baseGet(object, path2)), customizer); + function baseUpdate(object, path3, updater, customizer) { + return baseSet(object, path3, updater(baseGet(object, path3)), customizer); } function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, index2 = fromRight ? length : -1; - while ((fromRight ? index2-- : ++index2 < length) && predicate(array[index2], index2, array)) { + var length = array.length, index3 = fromRight ? length : -1; + while ((fromRight ? index3-- : ++index3 < length) && predicate(array[index3], index3, array)) { } - return isDrop ? baseSlice(array, fromRight ? 0 : index2, fromRight ? index2 + 1 : length) : baseSlice(array, fromRight ? index2 + 1 : 0, fromRight ? length : index2); + return isDrop ? baseSlice(array, fromRight ? 0 : index3, fromRight ? index3 + 1 : length) : baseSlice(array, fromRight ? index3 + 1 : 0, fromRight ? length : index3); } function baseWrapperValue(value, actions) { var result2 = value; @@ -6182,22 +6182,22 @@ var require_lodash = __commonJS({ if (length < 2) { return length ? baseUniq(arrays[0]) : []; } - var index2 = -1, result2 = Array2(length); - while (++index2 < length) { - var array = arrays[index2], othIndex = -1; + var index3 = -1, result2 = Array2(length); + while (++index3 < length) { + var array = arrays[index3], othIndex = -1; while (++othIndex < length) { - if (othIndex != index2) { - result2[index2] = baseDifference(result2[index2] || array, arrays[othIndex], iteratee2, comparator); + if (othIndex != index3) { + result2[index3] = baseDifference(result2[index3] || array, arrays[othIndex], iteratee2, comparator); } } } return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); } function baseZipObject(props, values3, assignFunc) { - var index2 = -1, length = props.length, valsLength = values3.length, result2 = {}; - while (++index2 < length) { - var value = index2 < valsLength ? values3[index2] : undefined2; - assignFunc(result2, props[index2], value); + var index3 = -1, length = props.length, valsLength = values3.length, result2 = {}; + while (++index3 < length) { + var value = index3 < valsLength ? values3[index3] : undefined2; + assignFunc(result2, props[index3], value); } return result2; } @@ -6211,7 +6211,7 @@ var require_lodash = __commonJS({ if (isArray5(value)) { return value; } - return isKey(value, object) ? [value] : stringToPath(toString4(value)); + return isKey(value, object) ? [value] : stringToPath(toString5(value)); } var castRest = baseRest; function castSlice(array, start, end) { @@ -6220,14 +6220,14 @@ var require_lodash = __commonJS({ return !start && end >= length ? array : baseSlice(array, start, end); } var clearTimeout2 = ctxClearTimeout || function(id3) { - return root.clearTimeout(id3); + return root4.clearTimeout(id3); }; - function cloneBuffer(buffer, isDeep) { + function cloneBuffer(buffer2, isDeep) { if (isDeep) { - return buffer.slice(); + return buffer2.slice(); } - var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - buffer.copy(result2); + var length = buffer2.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer2.constructor(length); + buffer2.copy(result2); return result2; } function cloneArrayBuffer(arrayBuffer) { @@ -6236,8 +6236,8 @@ var require_lodash = __commonJS({ return result2; } function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + var buffer2 = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength); } function cloneRegExp(regexp) { var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); @@ -6248,8 +6248,8 @@ var require_lodash = __commonJS({ return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; } function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + var buffer2 = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); } function compareAscending(value, other) { if (value !== other) { @@ -6265,15 +6265,15 @@ var require_lodash = __commonJS({ return 0; } function compareMultiple(object, other, orders) { - var index2 = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; - while (++index2 < length) { - var result2 = compareAscending(objCriteria[index2], othCriteria[index2]); + var index3 = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; + while (++index3 < length) { + var result2 = compareAscending(objCriteria[index3], othCriteria[index3]); if (result2) { - if (index2 >= ordersLength) { + if (index3 >= ordersLength) { return result2; } - var order = orders[index2]; - return result2 * (order == "desc" ? -1 : 1); + var order2 = orders[index3]; + return result2 * (order2 == "desc" ? -1 : 1); } } return object.index - other.index; @@ -6310,27 +6310,27 @@ var require_lodash = __commonJS({ return result2; } function copyArray(source, array) { - var index2 = -1, length = source.length; + var index3 = -1, length = source.length; array || (array = Array2(length)); - while (++index2 < length) { - array[index2] = source[index2]; + while (++index3 < length) { + array[index3] = source[index3]; } return array; } function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); - var index2 = -1, length = props.length; - while (++index2 < length) { - var key2 = props[index2]; - var newValue = customizer ? customizer(object[key2], source[key2], key2, object, source) : undefined2; + var index3 = -1, length = props.length; + while (++index3 < length) { + var key3 = props[index3]; + var newValue = customizer ? customizer(object[key3], source[key3], key3, object, source) : undefined2; if (newValue === undefined2) { - newValue = source[key2]; + newValue = source[key3]; } if (isNew) { - baseAssignValue(object, key2, newValue); + baseAssignValue(object, key3, newValue); } else { - assignValue(object, key2, newValue); + assignValue(object, key3, newValue); } } return object; @@ -6349,17 +6349,17 @@ var require_lodash = __commonJS({ } function createAssigner(assigner) { return baseRest(function(object, sources) { - var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; + var index3 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined2 : customizer; length = 1; } object = Object2(object); - while (++index2 < length) { - var source = sources[index2]; + while (++index3 < length) { + var source = sources[index3]; if (source) { - assigner(object, source, index2, customizer); + assigner(object, source, index3, customizer); } } return object; @@ -6373,9 +6373,9 @@ var require_lodash = __commonJS({ if (!isArrayLike(collection)) { return eachFunc(collection, iteratee2); } - var length = collection.length, index2 = fromRight ? length : -1, iterable = Object2(collection); - while (fromRight ? index2-- : ++index2 < length) { - if (iteratee2(iterable[index2], index2, iterable) === false) { + var length = collection.length, index3 = fromRight ? length : -1, iterable = Object2(collection); + while (fromRight ? index3-- : ++index3 < length) { + if (iteratee2(iterable[index3], index3, iterable) === false) { break; } } @@ -6384,10 +6384,10 @@ var require_lodash = __commonJS({ } function createBaseFor(fromRight) { return function(object, iteratee2, keysFunc) { - var index2 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; + var index3 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; while (length--) { - var key2 = props[fromRight ? length : ++index2]; - if (iteratee2(iterable[key2], key2, iterable) === false) { + var key3 = props[fromRight ? length : ++index3]; + if (iteratee2(iterable[key3], key3, iterable) === false) { break; } } @@ -6397,23 +6397,23 @@ var require_lodash = __commonJS({ function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { - var fn = this && this !== root && this instanceof wrapper ? Ctor : func; + var fn = this && this !== root4 && this instanceof wrapper ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } function createCaseFirst(methodName) { - return function(string4) { - string4 = toString4(string4); - var strSymbols = hasUnicode(string4) ? stringToArray(string4) : undefined2; - var chr = strSymbols ? strSymbols[0] : string4.charAt(0); - var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string4.slice(1); + return function(string6) { + string6 = toString5(string6); + var strSymbols = hasUnicode(string6) ? stringToArray(string6) : undefined2; + var chr = strSymbols ? strSymbols[0] : string6.charAt(0); + var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string6.slice(1); return chr[methodName]() + trailing; }; } function createCompounder(callback) { - return function(string4) { - return arrayReduce(words(deburr(string4).replace(reApos, "")), callback, ""); + return function(string6) { + return arrayReduce(words(deburr(string6).replace(reApos, "")), callback, ""); }; } function createCtor(Ctor) { @@ -6444,9 +6444,9 @@ var require_lodash = __commonJS({ function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { - var length = arguments.length, args = Array2(length), index2 = length, placeholder2 = getHolder(wrapper); - while (index2--) { - args[index2] = arguments[index2]; + var length = arguments.length, args = Array2(length), index3 = length, placeholder2 = getHolder(wrapper); + while (index3--) { + args[index3] = arguments[index3]; } var holders = length < 3 && args[0] !== placeholder2 && args[length - 1] !== placeholder2 ? [] : replaceHolders(args, placeholder2); length -= holders.length; @@ -6464,7 +6464,7 @@ var require_lodash = __commonJS({ arity - length ); } - var fn = this && this !== root && this instanceof wrapper ? Ctor : func; + var fn = this && this !== root4 && this instanceof wrapper ? Ctor : func; return apply2(fn, this, args); } return wrapper; @@ -6474,23 +6474,23 @@ var require_lodash = __commonJS({ var iterable = Object2(collection); if (!isArrayLike(collection)) { var iteratee2 = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key2) { - return iteratee2(iterable[key2], key2, iterable); + collection = keys2(collection); + predicate = function(key3) { + return iteratee2(iterable[key3], key3, iterable); }; } - var index2 = findIndexFunc(collection, predicate, fromIndex); - return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined2; + var index3 = findIndexFunc(collection, predicate, fromIndex); + return index3 > -1 ? iterable[iteratee2 ? collection[index3] : index3] : undefined2; }; } function createFlow(fromRight) { return flatRest(function(funcs) { - var length = funcs.length, index2 = length, prereq = LodashWrapper.prototype.thru; + var length = funcs.length, index3 = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } - while (index2--) { - var func = funcs[index2]; + while (index3--) { + var func = funcs[index3]; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } @@ -6498,12 +6498,12 @@ var require_lodash = __commonJS({ var wrapper = new LodashWrapper([], true); } } - index2 = wrapper ? index2 : length; - while (++index2 < length) { - func = funcs[index2]; - var funcName = getFuncName(func), data2 = funcName == "wrapper" ? getData(func) : undefined2; - if (data2 && isLaziable(data2[0]) && data2[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data2[4].length && data2[9] == 1) { - wrapper = wrapper[getFuncName(data2[0])].apply(wrapper, data2[3]); + index3 = wrapper ? index3 : length; + while (++index3 < length) { + func = funcs[index3]; + var funcName = getFuncName(func), data3 = funcName == "wrapper" ? getData(func) : undefined2; + if (data3 && isLaziable(data3[0]) && data3[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data3[4].length && data3[9] == 1) { + wrapper = wrapper[getFuncName(data3[0])].apply(wrapper, data3[3]); } else { wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); } @@ -6513,9 +6513,9 @@ var require_lodash = __commonJS({ if (wrapper && args.length == 1 && isArray5(value)) { return wrapper.plant(value).value(); } - var index3 = 0, result2 = length ? funcs[index3].apply(this, args) : value; - while (++index3 < length) { - result2 = funcs[index3].call(this, result2); + var index4 = 0, result2 = length ? funcs[index4].apply(this, args) : value; + while (++index4 < length) { + result2 = funcs[index4].call(this, result2); } return result2; }; @@ -6524,9 +6524,9 @@ var require_lodash = __commonJS({ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); function wrapper() { - var length = arguments.length, args = Array2(length), index2 = length; - while (index2--) { - args[index2] = arguments[index2]; + var length = arguments.length, args = Array2(length), index3 = length; + while (index3--) { + args[index3] = arguments[index3]; } if (isCurried) { var placeholder2 = getHolder(wrapper), holdersCount = countHolders(args, placeholder2); @@ -6563,7 +6563,7 @@ var require_lodash = __commonJS({ if (isAry && ary2 < length) { args.length = ary2; } - if (this && this !== root && this instanceof wrapper) { + if (this && this !== root4 && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); @@ -6623,7 +6623,7 @@ var require_lodash = __commonJS({ function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { - var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; + var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root4 && this instanceof wrapper ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } @@ -6687,15 +6687,15 @@ var require_lodash = __commonJS({ } function createRound2(methodName) { var func = Math2[methodName]; - return function(number4, precision) { - number4 = toNumber(number4); + return function(number5, precision) { + number5 = toNumber(number5); precision = precision == null ? 0 : nativeMin(toInteger2(precision), 292); - if (precision && nativeIsFinite(number4)) { - var pair2 = (toString4(number4) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision)); - pair2 = (toString4(value) + "e").split("e"); + if (precision && nativeIsFinite(number5)) { + var pair2 = (toString5(number5) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision)); + pair2 = (toString5(value) + "e").split("e"); return +(pair2[0] + "e" + (+pair2[1] - precision)); } - return func(number4); + return func(number5); }; } var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values3) { @@ -6730,7 +6730,7 @@ var require_lodash = __commonJS({ var partialsRight = partials, holdersRight = holders; partials = holders = undefined2; } - var data2 = isBindKey ? undefined2 : getData(func); + var data3 = isBindKey ? undefined2 : getData(func); var newData = [ func, bitmask, @@ -6743,8 +6743,8 @@ var require_lodash = __commonJS({ ary2, arity ]; - if (data2) { - mergeData(newData, data2); + if (data3) { + mergeData(newData, data3); } func = newData[0]; bitmask = newData[1]; @@ -6764,16 +6764,16 @@ var require_lodash = __commonJS({ } else { result2 = createHybrid.apply(undefined2, newData); } - var setter = data2 ? baseSetData : setData; + var setter = data3 ? baseSetData : setData; return setWrapToString(setter(result2, newData), func, bitmask); } - function customDefaultsAssignIn(objValue, srcValue, key2, object) { - if (objValue === undefined2 || eq(objValue, objectProto[key2]) && !hasOwnProperty3.call(object, key2)) { + function customDefaultsAssignIn(objValue, srcValue, key3, object) { + if (objValue === undefined2 || eq(objValue, objectProto[key3]) && !hasOwnProperty4.call(object, key3)) { return srcValue; } return objValue; } - function customDefaultsMerge(objValue, srcValue, key2, object, source, stack) { + function customDefaultsMerge(objValue, srcValue, key3, object, source, stack) { if (isObject4(objValue) && isObject4(srcValue)) { stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); @@ -6782,7 +6782,7 @@ var require_lodash = __commonJS({ return objValue; } function customOmitClone(value) { - return isPlainObject2(value) ? undefined2 : value; + return isPlainObject3(value) ? undefined2 : value; } function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; @@ -6794,13 +6794,13 @@ var require_lodash = __commonJS({ if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } - var index2 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; + var index3 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; stack.set(array, other); stack.set(other, array); - while (++index2 < arrLength) { - var arrValue = array[index2], othValue = other[index2]; + while (++index3 < arrLength) { + var arrValue = array[index3], othValue = other[index3]; if (customizer) { - var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack); + var compared = isPartial ? customizer(othValue, arrValue, index3, other, array, stack) : customizer(arrValue, othValue, index3, array, other, stack); } if (compared !== undefined2) { if (compared) { @@ -6850,10 +6850,10 @@ var require_lodash = __commonJS({ case stringTag: return object == other + ""; case mapTag: - var convert = mapToArray; + var convert2 = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); + convert2 || (convert2 = setToArray); if (object.size != other.size && !isPartial) { return false; } @@ -6863,7 +6863,7 @@ var require_lodash = __commonJS({ } bitmask |= COMPARE_UNORDERED_FLAG; stack.set(object, other); - var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack); stack["delete"](object); return result2; case symbolTag: @@ -6878,10 +6878,10 @@ var require_lodash = __commonJS({ if (objLength != othLength && !isPartial) { return false; } - var index2 = objLength; - while (index2--) { - var key2 = objProps[index2]; - if (!(isPartial ? key2 in other : hasOwnProperty3.call(other, key2))) { + var index3 = objLength; + while (index3--) { + var key3 = objProps[index3]; + if (!(isPartial ? key3 in other : hasOwnProperty4.call(other, key3))) { return false; } } @@ -6894,17 +6894,17 @@ var require_lodash = __commonJS({ stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; - while (++index2 < objLength) { - key2 = objProps[index2]; - var objValue = object[key2], othValue = other[key2]; + while (++index3 < objLength) { + key3 = objProps[index3]; + var objValue = object[key3], othValue = other[key3]; if (customizer) { - var compared = isPartial ? customizer(othValue, objValue, key2, other, object, stack) : customizer(objValue, othValue, key2, object, other, stack); + var compared = isPartial ? customizer(othValue, objValue, key3, other, object, stack) : customizer(objValue, othValue, key3, object, other, stack); } if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { result2 = false; break; } - skipCtor || (skipCtor = key2 == "constructor"); + skipCtor || (skipCtor = key3 == "constructor"); } if (result2 && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; @@ -6920,7 +6920,7 @@ var require_lodash = __commonJS({ return setToString(overRest(func, undefined2, flatten4), func + ""); } function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); + return baseGetAllKeys(object, keys2, getSymbols); } function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); @@ -6929,17 +6929,17 @@ var require_lodash = __commonJS({ return metaMap.get(func); }; function getFuncName(func) { - var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty3.call(realNames, result2) ? array.length : 0; + var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty4.call(realNames, result2) ? array.length : 0; while (length--) { - var data2 = array[length], otherFunc = data2.func; + var data3 = array[length], otherFunc = data3.func; if (otherFunc == null || otherFunc == func) { - return data2.name; + return data3.name; } } return result2; } function getHolder(func) { - var object = hasOwnProperty3.call(lodash, "placeholder") ? lodash : func; + var object = hasOwnProperty4.call(lodash, "placeholder") ? lodash : func; return object.placeholder; } function getIteratee() { @@ -6947,24 +6947,24 @@ var require_lodash = __commonJS({ result2 = result2 === iteratee ? baseIteratee : result2; return arguments.length ? result2(arguments[0], arguments[1]) : result2; } - function getMapData(map5, key2) { - var data2 = map5.__data__; - return isKeyable(key2) ? data2[typeof key2 == "string" ? "string" : "hash"] : data2.map; + function getMapData(map7, key3) { + var data3 = map7.__data__; + return isKeyable(key3) ? data3[typeof key3 == "string" ? "string" : "hash"] : data3.map; } function getMatchData(object) { - var result2 = keys(object), length = result2.length; + var result2 = keys2(object), length = result2.length; while (length--) { - var key2 = result2[length], value = object[key2]; - result2[length] = [key2, value, isStrictComparable(value)]; + var key3 = result2[length], value = object[key3]; + result2[length] = [key3, value, isStrictComparable(value)]; } return result2; } - function getNative(object, key2) { - var value = getValue(object, key2); + function getNative(object, key3) { + var value = getValue(object, key3); return baseIsNative(value) ? value : undefined2; } function getRawTag(value) { - var isOwn = hasOwnProperty3.call(value, symToStringTag), tag2 = value[symToStringTag]; + var isOwn = hasOwnProperty4.call(value, symToStringTag), tag2 = value[symToStringTag]; try { value[symToStringTag] = undefined2; var unmasked = true; @@ -7019,10 +7019,10 @@ var require_lodash = __commonJS({ }; } function getView(start, end, transforms) { - var index2 = -1, length = transforms.length; - while (++index2 < length) { - var data2 = transforms[index2], size3 = data2.size; - switch (data2.type) { + var index3 = -1, length = transforms.length; + while (++index3 < length) { + var data3 = transforms[index3], size3 = data3.size; + switch (data3.type) { case "drop": start += size3; break; @@ -7043,25 +7043,25 @@ var require_lodash = __commonJS({ var match2 = source.match(reWrapDetails); return match2 ? match2[1].split(reSplitDetails) : []; } - function hasPath(object, path2, hasFunc) { - path2 = castPath(path2, object); - var index2 = -1, length = path2.length, result2 = false; - while (++index2 < length) { - var key2 = toKey(path2[index2]); - if (!(result2 = object != null && hasFunc(object, key2))) { + function hasPath(object, path3, hasFunc) { + path3 = castPath(path3, object); + var index3 = -1, length = path3.length, result2 = false; + while (++index3 < length) { + var key3 = toKey(path3[index3]); + if (!(result2 = object != null && hasFunc(object, key3))) { break; } - object = object[key2]; + object = object[key3]; } - if (result2 || ++index2 != length) { + if (result2 || ++index3 != length) { return result2; } length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex2(key2, length) && (isArray5(object) || isArguments(object)); + return !!length && isLength(length) && isIndex2(key3, length) && (isArray5(object) || isArguments(object)); } function initCloneArray(array) { var length = array.length, result2 = new array.constructor(length); - if (length && typeof array[0] == "string" && hasOwnProperty3.call(array, "index")) { + if (length && typeof array[0] == "string" && hasOwnProperty4.call(array, "index")) { result2.index = array.index; result2.input = array.input; } @@ -7121,13 +7121,13 @@ var require_lodash = __commonJS({ length = length == null ? MAX_SAFE_INTEGER2 : length; return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } - function isIterateeCall(value, index2, object) { + function isIterateeCall(value, index3, object) { if (!isObject4(object)) { return false; } - var type = typeof index2; - if (type == "number" ? isArrayLike(object) && isIndex2(index2, object.length) : type == "string" && index2 in object) { - return eq(object[index2], value); + var type = typeof index3; + if (type == "number" ? isArrayLike(object) && isIndex2(index3, object.length) : type == "string" && index3 in object) { + return eq(object[index3], value); } return false; } @@ -7153,8 +7153,8 @@ var require_lodash = __commonJS({ if (func === other) { return true; } - var data2 = getData(other); - return !!data2 && func === data2[0]; + var data3 = getData(other); + return !!data3 && func === data3[0]; } function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; @@ -7167,65 +7167,65 @@ var require_lodash = __commonJS({ function isStrictComparable(value) { return value === value && !isObject4(value); } - function matchesStrictComparable(key2, srcValue) { + function matchesStrictComparable(key3, srcValue) { return function(object) { if (object == null) { return false; } - return object[key2] === srcValue && (srcValue !== undefined2 || key2 in Object2(object)); + return object[key3] === srcValue && (srcValue !== undefined2 || key3 in Object2(object)); }; } function memoizeCapped(func) { - var result2 = memoize2(func, function(key2) { + var result2 = memoize2(func, function(key3) { if (cache2.size === MAX_MEMOIZE_SIZE) { cache2.clear(); } - return key2; + return key3; }); var cache2 = result2.cache; return result2; } - function mergeData(data2, source) { - var bitmask = data2[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data2[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; + function mergeData(data3, source) { + var bitmask = data3[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data3[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; if (!(isCommon || isCombo)) { - return data2; + return data3; } if (srcBitmask & WRAP_BIND_FLAG) { - data2[2] = source[2]; + data3[2] = source[2]; newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } var value = source[3]; if (value) { - var partials = data2[3]; - data2[3] = partials ? composeArgs(partials, value, source[4]) : value; - data2[4] = partials ? replaceHolders(data2[3], PLACEHOLDER) : source[4]; + var partials = data3[3]; + data3[3] = partials ? composeArgs(partials, value, source[4]) : value; + data3[4] = partials ? replaceHolders(data3[3], PLACEHOLDER) : source[4]; } value = source[5]; if (value) { - partials = data2[5]; - data2[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data2[6] = partials ? replaceHolders(data2[5], PLACEHOLDER) : source[6]; + partials = data3[5]; + data3[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data3[6] = partials ? replaceHolders(data3[5], PLACEHOLDER) : source[6]; } value = source[7]; if (value) { - data2[7] = value; + data3[7] = value; } if (srcBitmask & WRAP_ARY_FLAG) { - data2[8] = data2[8] == null ? source[8] : nativeMin(data2[8], source[8]); + data3[8] = data3[8] == null ? source[8] : nativeMin(data3[8], source[8]); } - if (data2[9] == null) { - data2[9] = source[9]; + if (data3[9] == null) { + data3[9] = source[9]; } - data2[0] = source[0]; - data2[1] = newBitmask; - return data2; + data3[0] = source[0]; + data3[1] = newBitmask; + return data3; } function nativeKeysIn(object) { var result2 = []; if (object != null) { - for (var key2 in Object2(object)) { - result2.push(key2); + for (var key3 in Object2(object)) { + result2.push(key3); } } return result2; @@ -7236,42 +7236,42 @@ var require_lodash = __commonJS({ function overRest(func, start, transform2) { start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); return function() { - var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array2(length); - while (++index2 < length) { - array[index2] = args[start + index2]; + var args = arguments, index3 = -1, length = nativeMax(args.length - start, 0), array = Array2(length); + while (++index3 < length) { + array[index3] = args[start + index3]; } - index2 = -1; + index3 = -1; var otherArgs = Array2(start + 1); - while (++index2 < start) { - otherArgs[index2] = args[index2]; + while (++index3 < start) { + otherArgs[index3] = args[index3]; } otherArgs[start] = transform2(array); return apply2(func, this, otherArgs); }; } - function parent(object, path2) { - return path2.length < 2 ? object : baseGet(object, baseSlice(path2, 0, -1)); + function parent(object, path3) { + return path3.length < 2 ? object : baseGet(object, baseSlice(path3, 0, -1)); } function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { - var index2 = indexes[length]; - array[length] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined2; + var index3 = indexes[length]; + array[length] = isIndex2(index3, arrLength) ? oldArray[index3] : undefined2; } return array; } - function safeGet(object, key2) { - if (key2 === "constructor" && typeof object[key2] === "function") { + function safeGet(object, key3) { + if (key3 === "constructor" && typeof object[key3] === "function") { return; } - if (key2 == "__proto__") { + if (key3 == "__proto__") { return; } - return object[key2]; + return object[key3]; } var setData = shortOut(baseSetData); var setTimeout2 = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); + return root4.setTimeout(func, wait); }; var setToString = shortOut(baseSetToString); function setWrapToString(wrapper, reference, bitmask) { @@ -7294,23 +7294,23 @@ var require_lodash = __commonJS({ }; } function shuffleSelf(array, size3) { - var index2 = -1, length = array.length, lastIndex = length - 1; + var index3 = -1, length = array.length, lastIndex = length - 1; size3 = size3 === undefined2 ? length : size3; - while (++index2 < size3) { - var rand = baseRandom(index2, lastIndex), value = array[rand]; - array[rand] = array[index2]; - array[index2] = value; + while (++index3 < size3) { + var rand = baseRandom(index3, lastIndex), value = array[rand]; + array[rand] = array[index3]; + array[index3] = value; } array.length = size3; return array; } - var stringToPath = memoizeCapped(function(string4) { + var stringToPath = memoizeCapped(function(string6) { var result2 = []; - if (string4.charCodeAt(0) === 46) { + if (string6.charCodeAt(0) === 46) { result2.push(""); } - string4.replace(rePropName, function(match2, number4, quote, subString) { - result2.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match2); + string6.replace(rePropName, function(match2, number5, quote, subString) { + result2.push(quote ? subString.replace(reEscapeChar, "$1") : number5 || match2); }); return result2; }); @@ -7363,16 +7363,16 @@ var require_lodash = __commonJS({ if (!length || size3 < 1) { return []; } - var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3)); - while (index2 < length) { - result2[resIndex++] = baseSlice(array, index2, index2 += size3); + var index3 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3)); + while (index3 < length) { + result2[resIndex++] = baseSlice(array, index3, index3 += size3); } return result2; } function compact(array) { - var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; + while (++index3 < length) { + var value = array[index3]; if (value) { result2[resIndex++] = value; } @@ -7384,9 +7384,9 @@ var require_lodash = __commonJS({ if (!length) { return []; } - var args = Array2(length - 1), array = arguments[0], index2 = length; - while (index2--) { - args[index2 - 1] = arguments[index2]; + var args = Array2(length - 1), array = arguments[0], index3 = length; + while (index3--) { + args[index3 - 1] = arguments[index3]; } return arrayPush(isArray5(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } @@ -7446,23 +7446,23 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = fromIndex == null ? 0 : toInteger2(fromIndex); - if (index2 < 0) { - index2 = nativeMax(length + index2, 0); + var index3 = fromIndex == null ? 0 : toInteger2(fromIndex); + if (index3 < 0) { + index3 = nativeMax(length + index3, 0); } - return baseFindIndex(array, getIteratee(predicate, 3), index2); + return baseFindIndex(array, getIteratee(predicate, 3), index3); } function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } - var index2 = length - 1; + var index3 = length - 1; if (fromIndex !== undefined2) { - index2 = toInteger2(fromIndex); - index2 = fromIndex < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1); + index3 = toInteger2(fromIndex); + index3 = fromIndex < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1); } - return baseFindIndex(array, getIteratee(predicate, 3), index2, true); + return baseFindIndex(array, getIteratee(predicate, 3), index3, true); } function flatten4(array) { var length = array == null ? 0 : array.length; @@ -7481,14 +7481,14 @@ var require_lodash = __commonJS({ return baseFlatten(array, depth); } function fromPairs(pairs) { - var index2 = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; - while (++index2 < length) { - var pair2 = pairs[index2]; + var index3 = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; + while (++index3 < length) { + var pair2 = pairs[index3]; result2[pair2[0]] = pair2[1]; } return result2; } - function head(array) { + function head2(array) { return array && array.length ? array[0] : undefined2; } function indexOf(array, value, fromIndex) { @@ -7496,11 +7496,11 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = fromIndex == null ? 0 : toInteger2(fromIndex); - if (index2 < 0) { - index2 = nativeMax(length + index2, 0); + var index3 = fromIndex == null ? 0 : toInteger2(fromIndex); + if (index3 < 0) { + index3 = nativeMax(length + index3, 0); } - return baseIndexOf(array, value, index2); + return baseIndexOf(array, value, index3); } function initial(array) { var length = array == null ? 0 : array.length; @@ -7527,7 +7527,7 @@ var require_lodash = __commonJS({ } return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; }); - function join2(array, separator) { + function join4(array, separator) { return array == null ? "" : nativeJoin.call(array, separator); } function last(array) { @@ -7539,12 +7539,12 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = length; + var index3 = length; if (fromIndex !== undefined2) { - index2 = toInteger2(fromIndex); - index2 = index2 < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1); + index3 = toInteger2(fromIndex); + index3 = index3 < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1); } - return value === value ? strictLastIndexOf(array, value, index2) : baseFindIndex(array, baseIsNaN, index2, true); + return value === value ? strictLastIndexOf(array, value, index3) : baseFindIndex(array, baseIsNaN, index3, true); } function nth(array, n3) { return array && array.length ? baseNth(array, toInteger2(n3)) : undefined2; @@ -7561,8 +7561,8 @@ var require_lodash = __commonJS({ } var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); - basePullAt(array, arrayMap(indexes, function(index2) { - return isIndex2(index2, length) ? +index2 : index2; + basePullAt(array, arrayMap(indexes, function(index3) { + return isIndex2(index3, length) ? +index3 : index3; }).sort(compareAscending)); return result2; }); @@ -7571,13 +7571,13 @@ var require_lodash = __commonJS({ if (!(array && array.length)) { return result2; } - var index2 = -1, indexes = [], length = array.length; + var index3 = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); - while (++index2 < length) { - var value = array[index2]; - if (predicate(value, index2, array)) { + while (++index3 < length) { + var value = array[index3]; + if (predicate(value, index3, array)) { result2.push(value); - indexes.push(index2); + indexes.push(index3); } } basePullAt(array, indexes); @@ -7609,9 +7609,9 @@ var require_lodash = __commonJS({ function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { - var index2 = baseSortedIndex(array, value); - if (index2 < length && eq(array[index2], value)) { - return index2; + var index3 = baseSortedIndex(array, value); + if (index3 < length && eq(array[index3], value)) { + return index3; } } return -1; @@ -7625,9 +7625,9 @@ var require_lodash = __commonJS({ function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { - var index2 = baseSortedIndex(array, value, true) - 1; - if (eq(array[index2], value)) { - return index2; + var index3 = baseSortedIndex(array, value, true) - 1; + if (eq(array[index3], value)) { + return index3; } } return -1; @@ -7700,8 +7700,8 @@ var require_lodash = __commonJS({ return true; } }); - return baseTimes(length, function(index2) { - return arrayMap(array, baseProperty(index2)); + return baseTimes(length, function(index3) { + return arrayMap(array, baseProperty(index3)); }); } function unzipWith(array, iteratee2) { @@ -7801,14 +7801,14 @@ var require_lodash = __commonJS({ clone6.__index__ = 0; clone6.__values__ = undefined2; if (result2) { - previous.__wrapped__ = clone6; + previous2.__wrapped__ = clone6; } else { result2 = clone6; } - var previous = clone6; + var previous2 = clone6; parent2 = parent2.__wrapped__; } - previous.__wrapped__ = value; + previous2.__wrapped__ = value; return result2; } function wrapperReverse() { @@ -7831,11 +7831,11 @@ var require_lodash = __commonJS({ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } - var countBy = createAggregator(function(result2, value, key2) { - if (hasOwnProperty3.call(result2, key2)) { - ++result2[key2]; + var countBy = createAggregator(function(result2, value, key3) { + if (hasOwnProperty4.call(result2, key3)) { + ++result2[key3]; } else { - baseAssignValue(result2, key2, 1); + baseAssignValue(result2, key3, 1); } }); function every2(collection, predicate, guard) { @@ -7849,17 +7849,17 @@ var require_lodash = __commonJS({ var func = isArray5(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } - var find2 = createFind(findIndex3); + var find3 = createFind(findIndex3); var findLast = createFind(findLastIndex); function flatMap(collection, iteratee2) { - return baseFlatten(map4(collection, iteratee2), 1); + return baseFlatten(map6(collection, iteratee2), 1); } function flatMapDeep(collection, iteratee2) { - return baseFlatten(map4(collection, iteratee2), INFINITY2); + return baseFlatten(map6(collection, iteratee2), INFINITY2); } function flatMapDepth(collection, iteratee2, depth) { depth = depth === undefined2 ? 1 : toInteger2(depth); - return baseFlatten(map4(collection, iteratee2), depth); + return baseFlatten(map6(collection, iteratee2), depth); } function forEach3(collection, iteratee2) { var func = isArray5(collection) ? arrayEach : baseEach; @@ -7869,11 +7869,11 @@ var require_lodash = __commonJS({ var func = isArray5(collection) ? arrayEachRight : baseEachRight; return func(collection, getIteratee(iteratee2, 3)); } - var groupBy2 = createAggregator(function(result2, value, key2) { - if (hasOwnProperty3.call(result2, key2)) { - result2[key2].push(value); + var groupBy2 = createAggregator(function(result2, value, key3) { + if (hasOwnProperty4.call(result2, key3)) { + result2[key3].push(value); } else { - baseAssignValue(result2, key2, [value]); + baseAssignValue(result2, key3, [value]); } }); function includes(collection, value, fromIndex, guard) { @@ -7885,17 +7885,17 @@ var require_lodash = __commonJS({ } return isString5(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; } - var invokeMap = baseRest(function(collection, path2, args) { - var index2 = -1, isFunc = typeof path2 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var invokeMap = baseRest(function(collection, path3, args) { + var index3 = -1, isFunc = typeof path3 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; baseEach(collection, function(value) { - result2[++index2] = isFunc ? apply2(path2, value, args) : baseInvoke(value, path2, args); + result2[++index3] = isFunc ? apply2(path3, value, args) : baseInvoke(value, path3, args); }); return result2; }); - var keyBy = createAggregator(function(result2, value, key2) { - baseAssignValue(result2, key2, value); + var keyBy = createAggregator(function(result2, value, key3) { + baseAssignValue(result2, key3, value); }); - function map4(collection, iteratee2) { + function map6(collection, iteratee2) { var func = isArray5(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee2, 3)); } @@ -7912,8 +7912,8 @@ var require_lodash = __commonJS({ } return baseOrderBy(collection, iteratees, orders); } - var partition = createAggregator(function(result2, value, key2) { - result2[key2 ? 0 : 1].push(value); + var partition = createAggregator(function(result2, value, key3) { + result2[key3 ? 0 : 1].push(value); }, function() { return [[], []]; }); @@ -7979,7 +7979,7 @@ var require_lodash = __commonJS({ return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); var now = ctxNow || function() { - return root.Date.now(); + return root4.Date.now(); }; function after(n3, func) { if (typeof func != "function") { @@ -8021,13 +8021,13 @@ var require_lodash = __commonJS({ } return createWrap(func, bitmask, thisArg, partials, holders); }); - var bindKey = baseRest(function(object, key2, partials) { + var bindKey = baseRest(function(object, key3, partials) { var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= WRAP_PARTIAL_FLAG; } - return createWrap(key2, bitmask, object, partials, holders); + return createWrap(key3, bitmask, object, partials, holders); }); function curry(func, arity, guard) { arity = guard ? undefined2 : arity; @@ -8131,17 +8131,17 @@ var require_lodash = __commonJS({ function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); } - function memoize2(func, resolver) { - if (typeof func != "function" || resolver != null && typeof resolver != "function") { + function memoize2(func, resolver2) { + if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } var memoized = function() { - var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; - if (cache2.has(key2)) { - return cache2.get(key2); + var args = arguments, key3 = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache; + if (cache2.has(key3)) { + return cache2.get(key3); } var result2 = func.apply(this, args); - memoized.cache = cache2.set(key2, result2) || cache2; + memoized.cache = cache2.set(key3, result2) || cache2; return result2; }; memoized.cache = new (memoize2.Cache || MapCache)(); @@ -8174,9 +8174,9 @@ var require_lodash = __commonJS({ transforms = transforms.length == 1 && isArray5(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { - var index2 = -1, length = nativeMin(args.length, funcsLength); - while (++index2 < length) { - args[index2] = transforms[index2].call(this, args[index2]); + var index3 = -1, length = nativeMin(args.length, funcsLength); + while (++index3 < length) { + args[index3] = transforms[index3].call(this, args[index3]); } return apply2(func, this, args); }); @@ -8230,7 +8230,7 @@ var require_lodash = __commonJS({ function unary(func) { return ary(func, 1); } - function wrap(value, wrapper) { + function wrap3(value, wrapper) { return partial(castFunction(wrapper), value); } function castArray() { @@ -8255,7 +8255,7 @@ var require_lodash = __commonJS({ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); + return source == null || baseConformsTo(object, source, keys2(source)); } function eq(value, other) { return value === other || value !== value && other !== other; @@ -8267,7 +8267,7 @@ var require_lodash = __commonJS({ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike2(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); + return isObjectLike2(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); }; var isArray5 = Array2.isArray; var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; @@ -8280,16 +8280,16 @@ var require_lodash = __commonJS({ function isBoolean3(value) { return value === true || value === false || isObjectLike2(value) && baseGetTag(value) == boolTag; } - var isBuffer = nativeIsBuffer || stubFalse; + var isBuffer2 = nativeIsBuffer || stubFalse; var isDate4 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; function isElement(value) { - return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject2(value); + return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject3(value); } function isEmpty(value) { if (value == null) { return true; } - if (isArrayLike(value) && (isArray5(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { + if (isArrayLike(value) && (isArray5(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag2 = getTag2(value); @@ -8299,8 +8299,8 @@ var require_lodash = __commonJS({ if (isPrototype(value)) { return !baseKeys(value).length; } - for (var key2 in value) { - if (hasOwnProperty3.call(value, key2)) { + for (var key3 in value) { + if (hasOwnProperty4.call(value, key3)) { return false; } } @@ -8319,7 +8319,7 @@ var require_lodash = __commonJS({ return false; } var tag2 = baseGetTag(value); - return tag2 == errorTag || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value); + return tag2 == errorTag || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject3(value); } function isFinite2(value) { return typeof value == "number" && nativeIsFinite(value); @@ -8370,7 +8370,7 @@ var require_lodash = __commonJS({ function isNumber4(value) { return typeof value == "number" || isObjectLike2(value) && baseGetTag(value) == numberTag; } - function isPlainObject2(value) { + function isPlainObject3(value) { if (!isObjectLike2(value) || baseGetTag(value) != objectTag) { return false; } @@ -8378,7 +8378,7 @@ var require_lodash = __commonJS({ if (proto === null) { return true; } - var Ctor = hasOwnProperty3.call(proto, "constructor") && proto.constructor; + var Ctor = hasOwnProperty4.call(proto, "constructor") && proto.constructor; return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } var isRegExp2 = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; @@ -8461,17 +8461,17 @@ var require_lodash = __commonJS({ function toSafeInteger(value) { return value ? baseClamp(toInteger2(value), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value === 0 ? value : 0; } - function toString4(value) { + function toString5(value) { return value == null ? "" : baseToString2(value); } var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); + copyObject(source, keys2(source), object); return; } - for (var key2 in source) { - if (hasOwnProperty3.call(source, key2)) { - assignValue(object, key2, source[key2]); + for (var key3 in source) { + if (hasOwnProperty4.call(source, key3)) { + assignValue(object, key3, source[key3]); } } }); @@ -8482,31 +8482,31 @@ var require_lodash = __commonJS({ copyObject(source, keysIn(source), object, customizer); }); var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); + copyObject(source, keys2(source), object, customizer); }); var at2 = flatRest(baseAt); - function create2(prototype, properties3) { + function create3(prototype, properties3) { var result2 = baseCreate(prototype); return properties3 == null ? result2 : baseAssign(result2, properties3); } var defaults = baseRest(function(object, sources) { object = Object2(object); - var index2 = -1; + var index3 = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } - while (++index2 < length) { - var source = sources[index2]; + while (++index3 < length) { + var source = sources[index3]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { - var key2 = props[propsIndex]; - var value = object[key2]; - if (value === undefined2 || eq(value, objectProto[key2]) && !hasOwnProperty3.call(object, key2)) { - object[key2] = source[key2]; + var key3 = props[propsIndex]; + var value = object[key3]; + if (value === undefined2 || eq(value, objectProto[key3]) && !hasOwnProperty4.call(object, key3)) { + object[key3] = source[key3]; } } } @@ -8535,39 +8535,39 @@ var require_lodash = __commonJS({ return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); } function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); + return object == null ? [] : baseFunctions(object, keys2(object)); } function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } - function get2(object, path2, defaultValue2) { - var result2 = object == null ? undefined2 : baseGet(object, path2); + function get2(object, path3, defaultValue2) { + var result2 = object == null ? undefined2 : baseGet(object, path3); return result2 === undefined2 ? defaultValue2 : result2; } - function has(object, path2) { - return object != null && hasPath(object, path2, baseHas); + function has(object, path3) { + return object != null && hasPath(object, path3, baseHas); } - function hasIn(object, path2) { - return object != null && hasPath(object, path2, baseHasIn); + function hasIn(object, path3) { + return object != null && hasPath(object, path3, baseHasIn); } - var invert = createInverter(function(result2, value, key2) { + var invert = createInverter(function(result2, value, key3) { if (value != null && typeof value.toString != "function") { value = nativeObjectToString.call(value); } - result2[value] = key2; + result2[value] = key3; }, constant(identity2)); - var invertBy = createInverter(function(result2, value, key2) { + var invertBy = createInverter(function(result2, value, key3) { if (value != null && typeof value.toString != "function") { value = nativeObjectToString.call(value); } - if (hasOwnProperty3.call(result2, value)) { - result2[value].push(key2); + if (hasOwnProperty4.call(result2, value)) { + result2[value].push(key3); } else { - result2[value] = [key2]; + result2[value] = [key3]; } }, getIteratee); var invoke = baseRest(baseInvoke); - function keys(object) { + function keys2(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } function keysIn(object) { @@ -8576,20 +8576,20 @@ var require_lodash = __commonJS({ function mapKeys(object, iteratee2) { var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); - baseForOwn(object, function(value, key2, object2) { - baseAssignValue(result2, iteratee2(value, key2, object2), value); + baseForOwn(object, function(value, key3, object2) { + baseAssignValue(result2, iteratee2(value, key3, object2), value); }); return result2; } function mapValues(object, iteratee2) { var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); - baseForOwn(object, function(value, key2, object2) { - baseAssignValue(result2, key2, iteratee2(value, key2, object2)); + baseForOwn(object, function(value, key3, object2) { + baseAssignValue(result2, key3, iteratee2(value, key3, object2)); }); return result2; } - var merge = createAssigner(function(object, source, srcIndex) { + var merge2 = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { @@ -8601,10 +8601,10 @@ var require_lodash = __commonJS({ return result2; } var isDeep = false; - paths = arrayMap(paths, function(path2) { - path2 = castPath(path2, object); - isDeep || (isDeep = path2.length > 1); - return path2; + paths = arrayMap(paths, function(path3) { + path3 = castPath(path3, object); + isDeep || (isDeep = path3.length > 1); + return path3; }); copyObject(object, getAllKeysIn(object), result2); if (isDeep) { @@ -8630,38 +8630,38 @@ var require_lodash = __commonJS({ return [prop2]; }); predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path2) { - return predicate(value, path2[0]); + return basePickBy(object, props, function(value, path3) { + return predicate(value, path3[0]); }); } - function result(object, path2, defaultValue2) { - path2 = castPath(path2, object); - var index2 = -1, length = path2.length; + function result(object, path3, defaultValue2) { + path3 = castPath(path3, object); + var index3 = -1, length = path3.length; if (!length) { length = 1; object = undefined2; } - while (++index2 < length) { - var value = object == null ? undefined2 : object[toKey(path2[index2])]; + while (++index3 < length) { + var value = object == null ? undefined2 : object[toKey(path3[index3])]; if (value === undefined2) { - index2 = length; + index3 = length; value = defaultValue2; } object = isFunction3(value) ? value.call(object) : value; } return object; } - function set(object, path2, value) { - return object == null ? object : baseSet(object, path2, value); + function set(object, path3, value) { + return object == null ? object : baseSet(object, path3, value); } - function setWith(object, path2, value, customizer) { + function setWith(object, path3, value, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; - return object == null ? object : baseSet(object, path2, value, customizer); + return object == null ? object : baseSet(object, path3, value, customizer); } - var toPairs = createToPairs(keys); + var toPairs = createToPairs(keys2); var toPairsIn = createToPairs(keysIn); function transform(object, iteratee2, accumulator) { - var isArr = isArray5(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); + var isArr = isArray5(object), isArrLike = isArr || isBuffer2(object) || isTypedArray(object); iteratee2 = getIteratee(iteratee2, 4); if (accumulator == null) { var Ctor = object && object.constructor; @@ -8673,28 +8673,28 @@ var require_lodash = __commonJS({ accumulator = {}; } } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index2, object2) { - return iteratee2(accumulator, value, index2, object2); + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index3, object2) { + return iteratee2(accumulator, value, index3, object2); }); return accumulator; } - function unset(object, path2) { - return object == null ? true : baseUnset(object, path2); + function unset(object, path3) { + return object == null ? true : baseUnset(object, path3); } - function update(object, path2, updater) { - return object == null ? object : baseUpdate(object, path2, castFunction(updater)); + function update(object, path3, updater) { + return object == null ? object : baseUpdate(object, path3, castFunction(updater)); } - function updateWith(object, path2, updater, customizer) { + function updateWith(object, path3, updater, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; - return object == null ? object : baseUpdate(object, path2, castFunction(updater), customizer); + return object == null ? object : baseUpdate(object, path3, castFunction(updater), customizer); } function values2(object) { - return object == null ? [] : baseValues(object, keys(object)); + return object == null ? [] : baseValues(object, keys2(object)); } function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } - function clamp3(number4, lower, upper) { + function clamp3(number5, lower, upper) { if (upper === undefined2) { upper = lower; lower = undefined2; @@ -8707,9 +8707,9 @@ var require_lodash = __commonJS({ lower = toNumber(lower); lower = lower === lower ? lower : 0; } - return baseClamp(toNumber(number4), lower, upper); + return baseClamp(toNumber(number5), lower, upper); } - function inRange(number4, start, end) { + function inRange(number5, start, end) { start = toFinite(start); if (end === undefined2) { end = start; @@ -8717,8 +8717,8 @@ var require_lodash = __commonJS({ } else { end = toFinite(end); } - number4 = toNumber(number4); - return baseInRange(number4, start, end); + number5 = toNumber(number5); + return baseInRange(number5, start, end); } function random3(lower, upper, floating) { if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { @@ -8756,129 +8756,129 @@ var require_lodash = __commonJS({ } return baseRandom(lower, upper); } - var camelCase = createCompounder(function(result2, word, index2) { + var camelCase = createCompounder(function(result2, word, index3) { word = word.toLowerCase(); - return result2 + (index2 ? capitalize(word) : word); + return result2 + (index3 ? capitalize(word) : word); }); - function capitalize(string4) { - return upperFirst(toString4(string4).toLowerCase()); + function capitalize(string6) { + return upperFirst(toString5(string6).toLowerCase()); } - function deburr(string4) { - string4 = toString4(string4); - return string4 && string4.replace(reLatin, deburrLetter).replace(reComboMark, ""); + function deburr(string6) { + string6 = toString5(string6); + return string6 && string6.replace(reLatin, deburrLetter).replace(reComboMark, ""); } - function endsWith2(string4, target, position) { - string4 = toString4(string4); + function endsWith2(string6, target, position3) { + string6 = toString5(string6); target = baseToString2(target); - var length = string4.length; - position = position === undefined2 ? length : baseClamp(toInteger2(position), 0, length); - var end = position; - position -= target.length; - return position >= 0 && string4.slice(position, end) == target; - } - function escape2(string4) { - string4 = toString4(string4); - return string4 && reHasUnescapedHtml.test(string4) ? string4.replace(reUnescapedHtml, escapeHtmlChar) : string4; - } - function escapeRegExp(string4) { - string4 = toString4(string4); - return string4 && reHasRegExpChar.test(string4) ? string4.replace(reRegExpChar, "\\$&") : string4; - } - var kebabCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? "-" : "") + word.toLowerCase(); + var length = string6.length; + position3 = position3 === undefined2 ? length : baseClamp(toInteger2(position3), 0, length); + var end = position3; + position3 -= target.length; + return position3 >= 0 && string6.slice(position3, end) == target; + } + function escape2(string6) { + string6 = toString5(string6); + return string6 && reHasUnescapedHtml.test(string6) ? string6.replace(reUnescapedHtml, escapeHtmlChar) : string6; + } + function escapeRegExp(string6) { + string6 = toString5(string6); + return string6 && reHasRegExpChar.test(string6) ? string6.replace(reRegExpChar, "\\$&") : string6; + } + var kebabCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? "-" : "") + word.toLowerCase(); }); - var lowerCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + word.toLowerCase(); + var lowerCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + word.toLowerCase(); }); var lowerFirst = createCaseFirst("toLowerCase"); - function pad(string4, length, chars) { - string4 = toString4(string4); + function pad(string6, length, chars) { + string6 = toString5(string6); length = toInteger2(length); - var strLength = length ? stringSize(string4) : 0; + var strLength = length ? stringSize(string6) : 0; if (!length || strLength >= length) { - return string4; + return string6; } var mid = (length - strLength) / 2; - return createPadding(nativeFloor(mid), chars) + string4 + createPadding(nativeCeil(mid), chars); + return createPadding(nativeFloor(mid), chars) + string6 + createPadding(nativeCeil(mid), chars); } - function padEnd(string4, length, chars) { - string4 = toString4(string4); + function padEnd(string6, length, chars) { + string6 = toString5(string6); length = toInteger2(length); - var strLength = length ? stringSize(string4) : 0; - return length && strLength < length ? string4 + createPadding(length - strLength, chars) : string4; + var strLength = length ? stringSize(string6) : 0; + return length && strLength < length ? string6 + createPadding(length - strLength, chars) : string6; } - function padStart(string4, length, chars) { - string4 = toString4(string4); + function padStart(string6, length, chars) { + string6 = toString5(string6); length = toInteger2(length); - var strLength = length ? stringSize(string4) : 0; - return length && strLength < length ? createPadding(length - strLength, chars) + string4 : string4; + var strLength = length ? stringSize(string6) : 0; + return length && strLength < length ? createPadding(length - strLength, chars) + string6 : string6; } - function parseInt2(string4, radix, guard) { + function parseInt2(string6, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } - return nativeParseInt(toString4(string4).replace(reTrimStart, ""), radix || 0); + return nativeParseInt(toString5(string6).replace(reTrimStart, ""), radix || 0); } - function repeat(string4, n3, guard) { - if (guard ? isIterateeCall(string4, n3, guard) : n3 === undefined2) { + function repeat(string6, n3, guard) { + if (guard ? isIterateeCall(string6, n3, guard) : n3 === undefined2) { n3 = 1; } else { n3 = toInteger2(n3); } - return baseRepeat(toString4(string4), n3); + return baseRepeat(toString5(string6), n3); } function replace() { - var args = arguments, string4 = toString4(args[0]); - return args.length < 3 ? string4 : string4.replace(args[1], args[2]); + var args = arguments, string6 = toString5(args[0]); + return args.length < 3 ? string6 : string6.replace(args[1], args[2]); } - var snakeCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? "_" : "") + word.toLowerCase(); + var snakeCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? "_" : "") + word.toLowerCase(); }); - function split(string4, separator, limit) { - if (limit && typeof limit != "number" && isIterateeCall(string4, separator, limit)) { + function split(string6, separator, limit) { + if (limit && typeof limit != "number" && isIterateeCall(string6, separator, limit)) { separator = limit = undefined2; } limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; if (!limit) { return []; } - string4 = toString4(string4); - if (string4 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) { + string6 = toString5(string6); + if (string6 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) { separator = baseToString2(separator); - if (!separator && hasUnicode(string4)) { - return castSlice(stringToArray(string4), 0, limit); + if (!separator && hasUnicode(string6)) { + return castSlice(stringToArray(string6), 0, limit); } } - return string4.split(separator, limit); + return string6.split(separator, limit); } - var startCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + upperFirst(word); + var startCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + upperFirst(word); }); - function startsWith(string4, target, position) { - string4 = toString4(string4); - position = position == null ? 0 : baseClamp(toInteger2(position), 0, string4.length); + function startsWith(string6, target, position3) { + string6 = toString5(string6); + position3 = position3 == null ? 0 : baseClamp(toInteger2(position3), 0, string6.length); target = baseToString2(target); - return string4.slice(position, position + target.length) == target; + return string6.slice(position3, position3 + target.length) == target; } - function template2(string4, options, guard) { + function template2(string6, options, guard) { var settings = lodash.templateSettings; - if (guard && isIterateeCall(string4, options, guard)) { + if (guard && isIterateeCall(string6, options, guard)) { options = undefined2; } - string4 = toString4(string4); + string6 = toString5(string6); options = assignInWith({}, options, settings, customDefaultsAssignIn); - var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); - var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; + var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys); + var isEscaping, isEvaluating, index3 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp2( (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g" ); - var sourceURL = "//# sourceURL=" + (hasOwnProperty3.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; - string4.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { + var sourceURL = "//# sourceURL=" + (hasOwnProperty4.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; + string6.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { interpolateValue || (interpolateValue = esTemplateValue); - source += string4.slice(index2, offset2).replace(reUnescapedString, escapeStringChar); + source += string6.slice(index3, offset2).replace(reUnescapedString, escapeStringChar); if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; @@ -8890,11 +8890,11 @@ var require_lodash = __commonJS({ if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } - index2 = offset2 + match2.length; + index3 = offset2 + match2.length; return match2; }); source += "';\n"; - var variable = hasOwnProperty3.call(options, "variable") && options.variable; + var variable = hasOwnProperty4.call(options, "variable") && options.variable; if (!variable) { source = "with (obj) {\n" + source + "\n}\n"; } else if (reForbiddenIdentifierChars.test(variable)) { @@ -8912,76 +8912,76 @@ var require_lodash = __commonJS({ return result2; } function toLower(value) { - return toString4(value).toLowerCase(); + return toString5(value).toLowerCase(); } function toUpper(value) { - return toString4(value).toUpperCase(); + return toString5(value).toUpperCase(); } - function trim(string4, chars, guard) { - string4 = toString4(string4); - if (string4 && (guard || chars === undefined2)) { - return baseTrim(string4); + function trim(string6, chars, guard) { + string6 = toString5(string6); + if (string6 && (guard || chars === undefined2)) { + return baseTrim(string6); } - if (!string4 || !(chars = baseToString2(chars))) { - return string4; + if (!string6 || !(chars = baseToString2(chars))) { + return string6; } - var strSymbols = stringToArray(string4), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; + var strSymbols = stringToArray(string6), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(""); } - function trimEnd(string4, chars, guard) { - string4 = toString4(string4); - if (string4 && (guard || chars === undefined2)) { - return string4.slice(0, trimmedEndIndex(string4) + 1); + function trimEnd(string6, chars, guard) { + string6 = toString5(string6); + if (string6 && (guard || chars === undefined2)) { + return string6.slice(0, trimmedEndIndex(string6) + 1); } - if (!string4 || !(chars = baseToString2(chars))) { - return string4; + if (!string6 || !(chars = baseToString2(chars))) { + return string6; } - var strSymbols = stringToArray(string4), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; + var strSymbols = stringToArray(string6), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; return castSlice(strSymbols, 0, end).join(""); } - function trimStart(string4, chars, guard) { - string4 = toString4(string4); - if (string4 && (guard || chars === undefined2)) { - return string4.replace(reTrimStart, ""); + function trimStart(string6, chars, guard) { + string6 = toString5(string6); + if (string6 && (guard || chars === undefined2)) { + return string6.replace(reTrimStart, ""); } - if (!string4 || !(chars = baseToString2(chars))) { - return string4; + if (!string6 || !(chars = baseToString2(chars))) { + return string6; } - var strSymbols = stringToArray(string4), start = charsStartIndex(strSymbols, stringToArray(chars)); + var strSymbols = stringToArray(string6), start = charsStartIndex(strSymbols, stringToArray(chars)); return castSlice(strSymbols, start).join(""); } - function truncate2(string4, options) { - var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; + function truncate2(string6, options) { + var length = DEFAULT_TRUNC_LENGTH, omission2 = DEFAULT_TRUNC_OMISSION; if (isObject4(options)) { var separator = "separator" in options ? options.separator : separator; length = "length" in options ? toInteger2(options.length) : length; - omission = "omission" in options ? baseToString2(options.omission) : omission; + omission2 = "omission" in options ? baseToString2(options.omission) : omission2; } - string4 = toString4(string4); - var strLength = string4.length; - if (hasUnicode(string4)) { - var strSymbols = stringToArray(string4); + string6 = toString5(string6); + var strLength = string6.length; + if (hasUnicode(string6)) { + var strSymbols = stringToArray(string6); strLength = strSymbols.length; } if (length >= strLength) { - return string4; + return string6; } - var end = length - stringSize(omission); + var end = length - stringSize(omission2); if (end < 1) { - return omission; + return omission2; } - var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string4.slice(0, end); + var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string6.slice(0, end); if (separator === undefined2) { - return result2 + omission; + return result2 + omission2; } if (strSymbols) { end += result2.length - end; } if (isRegExp2(separator)) { - if (string4.slice(end).search(separator)) { + if (string6.slice(end).search(separator)) { var match2, substring = result2; if (!separator.global) { - separator = RegExp2(separator.source, toString4(reFlags.exec(separator)) + "g"); + separator = RegExp2(separator.source, toString5(reFlags.exec(separator)) + "g"); } separator.lastIndex = 0; while (match2 = separator.exec(substring)) { @@ -8989,29 +8989,29 @@ var require_lodash = __commonJS({ } result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); } - } else if (string4.indexOf(baseToString2(separator), end) != end) { - var index2 = result2.lastIndexOf(separator); - if (index2 > -1) { - result2 = result2.slice(0, index2); + } else if (string6.indexOf(baseToString2(separator), end) != end) { + var index3 = result2.lastIndexOf(separator); + if (index3 > -1) { + result2 = result2.slice(0, index3); } } - return result2 + omission; + return result2 + omission2; } - function unescape(string4) { - string4 = toString4(string4); - return string4 && reHasEscapedHtml.test(string4) ? string4.replace(reEscapedHtml, unescapeHtmlChar) : string4; + function unescape(string6) { + string6 = toString5(string6); + return string6 && reHasEscapedHtml.test(string6) ? string6.replace(reEscapedHtml, unescapeHtmlChar) : string6; } - var upperCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + word.toUpperCase(); + var upperCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + word.toUpperCase(); }); var upperFirst = createCaseFirst("toUpperCase"); - function words(string4, pattern, guard) { - string4 = toString4(string4); + function words(string6, pattern, guard) { + string6 = toString5(string6); pattern = guard ? undefined2 : pattern; if (pattern === undefined2) { - return hasUnicodeWord(string4) ? unicodeWords(string4) : asciiWords(string4); + return hasUnicodeWord(string6) ? unicodeWords(string6) : asciiWords(string6); } - return string4.match(pattern) || []; + return string6.match(pattern) || []; } var attempt = baseRest(function(func, args) { try { @@ -9021,9 +9021,9 @@ var require_lodash = __commonJS({ } }); var bindAll = flatRest(function(object, methodNames) { - arrayEach(methodNames, function(key2) { - key2 = toKey(key2); - baseAssignValue(object, key2, bind(object[key2], object)); + arrayEach(methodNames, function(key3) { + key3 = toKey(key3); + baseAssignValue(object, key3, bind(object[key3], object)); }); return object; }); @@ -9036,9 +9036,9 @@ var require_lodash = __commonJS({ return [toIteratee(pair2[0]), pair2[1]]; }); return baseRest(function(args) { - var index2 = -1; - while (++index2 < length) { - var pair2 = pairs[index2]; + var index3 = -1; + while (++index3 < length) { + var pair2 = pairs[index3]; if (apply2(pair2[0], this, args)) { return apply2(pair2[1], this, args); } @@ -9056,7 +9056,7 @@ var require_lodash = __commonJS({ function defaultTo(value, defaultValue2) { return value == null || value !== value ? defaultValue2 : value; } - var flow = createFlow(); + var flow3 = createFlow(); var flowRight = createFlow(true); function identity2(value) { return value; @@ -9067,26 +9067,26 @@ var require_lodash = __commonJS({ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); } - function matchesProperty(path2, srcValue) { - return baseMatchesProperty(path2, baseClone(srcValue, CLONE_DEEP_FLAG)); + function matchesProperty(path3, srcValue) { + return baseMatchesProperty(path3, baseClone(srcValue, CLONE_DEEP_FLAG)); } - var method = baseRest(function(path2, args) { + var method = baseRest(function(path3, args) { return function(object) { - return baseInvoke(object, path2, args); + return baseInvoke(object, path3, args); }; }); var methodOf = baseRest(function(object, args) { - return function(path2) { - return baseInvoke(object, path2, args); + return function(path3) { + return baseInvoke(object, path3, args); }; }); function mixin2(object, source, options) { - var props = keys(source), methodNames = baseFunctions(source, props); + var props = keys2(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject4(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; - methodNames = baseFunctions(source, keys(source)); + methodNames = baseFunctions(source, keys2(source)); } var chain3 = !(isObject4(options) && "chain" in options) || !!options.chain, isFunc = isFunction3(object); arrayEach(methodNames, function(methodName) { @@ -9108,8 +9108,8 @@ var require_lodash = __commonJS({ return object; } function noConflict() { - if (root._ === this) { - root._ = oldDash; + if (root4._ === this) { + root4._ = oldDash; } return this; } @@ -9124,12 +9124,12 @@ var require_lodash = __commonJS({ var over = createOver(arrayMap); var overEvery = createOver(arrayEvery); var overSome = createOver(arraySome); - function property(path2) { - return isKey(path2) ? baseProperty(toKey(path2)) : basePropertyDeep(path2); + function property(path3) { + return isKey(path3) ? baseProperty(toKey(path3)) : basePropertyDeep(path3); } function propertyOf(object) { - return function(path2) { - return object == null ? undefined2 : baseGet(object, path2); + return function(path3) { + return object == null ? undefined2 : baseGet(object, path3); }; } var range2 = createRange2(); @@ -9154,12 +9154,12 @@ var require_lodash = __commonJS({ if (n3 < 1 || n3 > MAX_SAFE_INTEGER2) { return []; } - var index2 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH); + var index3 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH); iteratee2 = getIteratee(iteratee2); n3 -= MAX_ARRAY_LENGTH; var result2 = baseTimes(length, iteratee2); - while (++index2 < n3) { - iteratee2(index2); + while (++index3 < n3) { + iteratee2(index3); } return result2; } @@ -9167,11 +9167,11 @@ var require_lodash = __commonJS({ if (isArray5(value)) { return arrayMap(value, toKey); } - return isSymbol(value) ? [value] : copyArray(stringToPath(toString4(value))); + return isSymbol(value) ? [value] : copyArray(stringToPath(toString5(value))); } function uniqueId3(prefix) { var id3 = ++idCounter; - return toString4(prefix) + id3; + return toString5(prefix) + id3; } var add4 = createMathOperation(function(augend, addend) { return augend + addend; @@ -9232,7 +9232,7 @@ var require_lodash = __commonJS({ lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; - lodash.create = create2; + lodash.create = create3; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce7; @@ -9256,7 +9256,7 @@ var require_lodash = __commonJS({ lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; - lodash.flow = flow; + lodash.flow = flow3; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; @@ -9271,15 +9271,15 @@ var require_lodash = __commonJS({ lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; - lodash.keys = keys; + lodash.keys = keys2; lodash.keysIn = keysIn; - lodash.map = map4; + lodash.map = map6; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize2; - lodash.merge = merge; + lodash.merge = merge2; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; @@ -9353,7 +9353,7 @@ var require_lodash = __commonJS({ lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; - lodash.wrap = wrap; + lodash.wrap = wrap3; lodash.xor = xor2; lodash.xorBy = xorBy; lodash.xorWith = xorWith; @@ -9385,7 +9385,7 @@ var require_lodash = __commonJS({ lodash.escape = escape2; lodash.escapeRegExp = escapeRegExp; lodash.every = every2; - lodash.find = find2; + lodash.find = find3; lodash.findIndex = findIndex3; lodash.findKey = findKey2; lodash.findLast = findLast; @@ -9403,7 +9403,7 @@ var require_lodash = __commonJS({ lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; - lodash.head = head; + lodash.head = head2; lodash.identity = identity2; lodash.includes = includes; lodash.indexOf = indexOf; @@ -9415,7 +9415,7 @@ var require_lodash = __commonJS({ lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean3; - lodash.isBuffer = isBuffer; + lodash.isBuffer = isBuffer2; lodash.isDate = isDate4; lodash.isElement = isElement; lodash.isEmpty = isEmpty; @@ -9436,7 +9436,7 @@ var require_lodash = __commonJS({ lodash.isNumber = isNumber4; lodash.isObject = isObject4; lodash.isObjectLike = isObjectLike2; - lodash.isPlainObject = isPlainObject2; + lodash.isPlainObject = isPlainObject3; lodash.isRegExp = isRegExp2; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet; @@ -9446,7 +9446,7 @@ var require_lodash = __commonJS({ lodash.isUndefined = isUndefined2; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; - lodash.join = join2; + lodash.join = join4; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; @@ -9505,7 +9505,7 @@ var require_lodash = __commonJS({ lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; - lodash.toString = toString4; + lodash.toString = toString5; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; @@ -9517,11 +9517,11 @@ var require_lodash = __commonJS({ lodash.upperFirst = upperFirst; lodash.each = forEach3; lodash.eachRight = forEachRight; - lodash.first = head; + lodash.first = head2; mixin2(lodash, function() { var source = {}; baseForOwn(lodash, function(func, methodName) { - if (!hasOwnProperty3.call(lodash.prototype, methodName)) { + if (!hasOwnProperty4.call(lodash.prototype, methodName)) { source[methodName] = func; } }); @@ -9531,10 +9531,10 @@ var require_lodash = __commonJS({ arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { lodash[methodName].placeholder = lodash; }); - arrayEach(["drop", "take"], function(methodName, index2) { + arrayEach(["drop", "take"], function(methodName, index3) { LazyWrapper.prototype[methodName] = function(n3) { n3 = n3 === undefined2 ? 1 : nativeMax(toInteger2(n3), 0); - var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone(); + var result2 = this.__filtered__ && !index3 ? new LazyWrapper(this) : this.clone(); if (result2.__filtered__) { result2.__takeCount__ = nativeMin(n3, result2.__takeCount__); } else { @@ -9549,8 +9549,8 @@ var require_lodash = __commonJS({ return this.reverse()[methodName](n3).reverse(); }; }); - arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) { - var type = index2 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; + arrayEach(["filter", "map", "takeWhile"], function(methodName, index3) { + var type = index3 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee2) { var result2 = this.clone(); result2.__iteratees__.push({ @@ -9561,14 +9561,14 @@ var require_lodash = __commonJS({ return result2; }; }); - arrayEach(["head", "last"], function(methodName, index2) { - var takeName = "take" + (index2 ? "Right" : ""); + arrayEach(["head", "last"], function(methodName, index3) { + var takeName = "take" + (index3 ? "Right" : ""); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); - arrayEach(["initial", "tail"], function(methodName, index2) { - var dropName = "drop" + (index2 ? "" : "Right"); + arrayEach(["initial", "tail"], function(methodName, index3) { + var dropName = "drop" + (index3 ? "" : "Right"); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; @@ -9582,12 +9582,12 @@ var require_lodash = __commonJS({ LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; - LazyWrapper.prototype.invokeMap = baseRest(function(path2, args) { - if (typeof path2 == "function") { + LazyWrapper.prototype.invokeMap = baseRest(function(path3, args) { + if (typeof path3 == "function") { return new LazyWrapper(this); } return this.map(function(value) { - return baseInvoke(value, path2, args); + return baseInvoke(value, path3, args); }); }); LazyWrapper.prototype.reject = function(predicate) { @@ -9660,11 +9660,11 @@ var require_lodash = __commonJS({ baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { - var key2 = lodashFunc.name + ""; - if (!hasOwnProperty3.call(realNames, key2)) { - realNames[key2] = []; + var key3 = lodashFunc.name + ""; + if (!hasOwnProperty4.call(realNames, key3)) { + realNames[key3] = []; } - realNames[key2].push({ "name": methodName, "func": lodashFunc }); + realNames[key3].push({ "name": methodName, "func": lodashFunc }); } }); realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ @@ -9689,7 +9689,7 @@ var require_lodash = __commonJS({ }; var _15 = runInContext(); if (typeof define == "function" && typeof define.amd == "object" && define.amd) { - root._ = _15; + root4._ = _15; define(function() { return _15; }); @@ -9697,7 +9697,7 @@ var require_lodash = __commonJS({ (freeModule.exports = _15)._ = _15; freeExports._ = _15; } else { - root._ = _15; + root4._ = _15; } }).call(exports); } @@ -9751,13 +9751,13 @@ var require_scheduler_production_min = __commonJS({ return l2.now(); }; } else { - p = Date, q2 = p.now(); + p2 = Date, q2 = p2.now(); exports.unstable_now = function() { - return p.now() - q2; + return p2.now() - q2; }; } var l2; - var p; + var p2; var q2; var r2 = []; var t5 = []; @@ -9992,7 +9992,7 @@ var require_react_dom_production_min = __commonJS({ "use strict"; var aa = require_react(); var ca = require_scheduler(); - function p(a4) { + function p2(a4) { for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a4, c3 = 1; c3 < arguments.length; c3++) b2 += "&args[]=" + encodeURIComponent(arguments[c3]); return "Minified React error #" + a4 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; @@ -10479,7 +10479,7 @@ var require_react_dom_production_min = __commonJS({ } function gb(a4, b2) { if (null != b2.dangerouslySetInnerHTML) - throw Error(p(91)); + throw Error(p2(91)); return A({}, b2, { value: void 0, defaultValue: void 0, children: "" + a4._wrapperState.initialValue }); } function hb(a4, b2) { @@ -10489,10 +10489,10 @@ var require_react_dom_production_min = __commonJS({ b2 = b2.defaultValue; if (null != c3) { if (null != b2) - throw Error(p(92)); + throw Error(p2(92)); if (eb(c3)) { if (1 < c3.length) - throw Error(p(93)); + throw Error(p2(93)); c3 = c3[0]; } b2 = c3; @@ -10621,15 +10621,15 @@ var require_react_dom_production_min = __commonJS({ function ub(a4, b2) { if (b2) { if (tb[a4] && (null != b2.children || null != b2.dangerouslySetInnerHTML)) - throw Error(p(137, a4)); + throw Error(p2(137, a4)); if (null != b2.dangerouslySetInnerHTML) { if (null != b2.children) - throw Error(p(60)); + throw Error(p2(60)); if ("object" !== typeof b2.dangerouslySetInnerHTML || !("__html" in b2.dangerouslySetInnerHTML)) - throw Error(p(61)); + throw Error(p2(61)); } if (null != b2.style && "object" !== typeof b2.style) - throw Error(p(62)); + throw Error(p2(62)); } } function vb(a4, b2) { @@ -10661,7 +10661,7 @@ var require_react_dom_production_min = __commonJS({ function Bb(a4) { if (a4 = Cb(a4)) { if ("function" !== typeof yb) - throw Error(p(280)); + throw Error(p2(280)); var b2 = a4.stateNode; b2 && (b2 = Db(b2), yb(a4.stateNode, a4.type, b2)); } @@ -10726,7 +10726,7 @@ var require_react_dom_production_min = __commonJS({ if (a4) return null; if (c3 && "function" !== typeof c3) - throw Error(p(231, b2, typeof c3)); + throw Error(p2(231, b2, typeof c3)); return c3; } var Lb = false; @@ -10771,7 +10771,7 @@ var require_react_dom_production_min = __commonJS({ Ob = false; Pb = null; } else - throw Error(p(198)); + throw Error(p2(198)); Qb || (Qb = true, Rb = l2); } } @@ -10799,14 +10799,14 @@ var require_react_dom_production_min = __commonJS({ } function Xb(a4) { if (Vb(a4) !== a4) - throw Error(p(188)); + throw Error(p2(188)); } function Yb(a4) { var b2 = a4.alternate; if (!b2) { b2 = Vb(a4); if (null === b2) - throw Error(p(188)); + throw Error(p2(188)); return b2 !== a4 ? null : a4; } for (var c3 = a4, d4 = b2; ; ) { @@ -10830,7 +10830,7 @@ var require_react_dom_production_min = __commonJS({ return Xb(e5), b2; f2 = f2.sibling; } - throw Error(p(188)); + throw Error(p2(188)); } if (c3.return !== d4.return) c3 = e5, d4 = f2; @@ -10867,14 +10867,14 @@ var require_react_dom_production_min = __commonJS({ h3 = h3.sibling; } if (!g) - throw Error(p(189)); + throw Error(p2(189)); } } if (c3.alternate !== d4) - throw Error(p(190)); + throw Error(p2(190)); } if (3 !== c3.tag) - throw Error(p(188)); + throw Error(p2(188)); return c3.stateNode.current === c3 ? a4 : b2; } function Zb(a4) { @@ -11232,7 +11232,7 @@ var require_react_dom_production_min = __commonJS({ Vc(c3), null === c3.blockedOn && Qc.shift(); } var cd = ua.ReactCurrentBatchConfig; - var dd = true; + var dd2 = true; function ed(a4, b2, c3, d4) { var e5 = C, f2 = cd.transition; cd.transition = null; @@ -11252,7 +11252,7 @@ var require_react_dom_production_min = __commonJS({ } } function fd(a4, b2, c3, d4) { - if (dd) { + if (dd2) { var e5 = Yc(a4, b2, c3, d4); if (null === e5) hd(a4, b2, d4, id3, c3), Sc(a4, d4); @@ -12227,7 +12227,7 @@ var require_react_dom_production_min = __commonJS({ function Af(a4, b2, c3) { b2 = zf(b2); if (zf(a4) !== b2 && c3) - throw Error(p(425)); + throw Error(p2(425)); } function Bf() { } @@ -12331,7 +12331,7 @@ var require_react_dom_production_min = __commonJS({ function ue(a4) { if (5 === a4.tag || 6 === a4.tag) return a4.stateNode; - throw Error(p(33)); + throw Error(p2(33)); } function Db(a4) { return a4[Pf] || null; @@ -12376,7 +12376,7 @@ var require_react_dom_production_min = __commonJS({ } function ag(a4, b2, c3) { if (H3.current !== Vf) - throw Error(p(168)); + throw Error(p2(168)); G2(H3, b2); G2(Wf, c3); } @@ -12388,7 +12388,7 @@ var require_react_dom_production_min = __commonJS({ d4 = d4.getChildContext(); for (var e5 in d4) if (!(e5 in b2)) - throw Error(p(108, Ra(a4) || "Unknown", e5)); + throw Error(p2(108, Ra(a4) || "Unknown", e5)); return A({}, c3, d4); } function cg(a4) { @@ -12401,7 +12401,7 @@ var require_react_dom_production_min = __commonJS({ function dg(a4, b2, c3) { var d4 = a4.stateNode; if (!d4) - throw Error(p(169)); + throw Error(p2(169)); c3 ? (a4 = bg(a4, b2, Xf), d4.__reactInternalMemoizedMergedChildContext = a4, E2(Wf), E2(H3), G2(H3, a4)) : E2(Wf); G2(Wf, c3); } @@ -12518,14 +12518,14 @@ var require_react_dom_production_min = __commonJS({ var c3 = b2; if (!Cg(a4, b2)) { if (Dg(a4)) - throw Error(p(418)); + throw Error(p2(418)); b2 = Lf(c3.nextSibling); var d4 = xg; b2 && Cg(a4, b2) ? Ag(d4, c3) : (a4.flags = a4.flags & -4097 | 2, I2 = false, xg = a4); } } else { if (Dg(a4)) - throw Error(p(418)); + throw Error(p2(418)); a4.flags = a4.flags & -4097 | 2; I2 = false; xg = a4; @@ -12546,7 +12546,7 @@ var require_react_dom_production_min = __commonJS({ (b2 = 3 !== a4.tag) && !(b2 = 5 !== a4.tag) && (b2 = a4.type, b2 = "head" !== b2 && "body" !== b2 && !Ef(a4.type, a4.memoizedProps)); if (b2 && (b2 = yg)) { if (Dg(a4)) - throw Hg(), Error(p(418)); + throw Hg(), Error(p2(418)); for (; b2; ) Ag(a4, b2), b2 = Lf(b2.nextSibling); } @@ -12555,7 +12555,7 @@ var require_react_dom_production_min = __commonJS({ a4 = a4.memoizedState; a4 = null !== a4 ? a4.dehydrated : null; if (!a4) - throw Error(p(317)); + throw Error(p2(317)); a: { a4 = a4.nextSibling; for (b2 = 0; a4; ) { @@ -12632,7 +12632,7 @@ var require_react_dom_production_min = __commonJS({ if (Pg !== a4) if (a4 = { context: a4, memoizedValue: b2, next: null }, null === Og) { if (null === Ng) - throw Error(p(308)); + throw Error(p2(308)); Og = a4; Ng.dependencies = { lanes: 0, firstContext: a4 }; } else @@ -12809,7 +12809,7 @@ var require_react_dom_production_min = __commonJS({ d4.callback = null; d4 = c3; if ("function" !== typeof e5) - throw Error(p(191, e5)); + throw Error(p2(191, e5)); e5.call(d4); } } @@ -12890,11 +12890,11 @@ var require_react_dom_production_min = __commonJS({ c3 = c3._owner; if (c3) { if (1 !== c3.tag) - throw Error(p(309)); + throw Error(p2(309)); var d4 = c3.stateNode; } if (!d4) - throw Error(p(147, a4)); + throw Error(p2(147, a4)); var e5 = d4, f2 = "" + a4; if (null !== b2 && null !== b2.ref && "function" === typeof b2.ref && b2.ref._stringRef === f2) return b2.ref; @@ -12907,15 +12907,15 @@ var require_react_dom_production_min = __commonJS({ return b2; } if ("string" !== typeof a4) - throw Error(p(284)); + throw Error(p2(284)); if (!c3._owner) - throw Error(p(290, a4)); + throw Error(p2(290, a4)); } return a4; } function th(a4, b2) { a4 = Object.prototype.toString.call(b2); - throw Error(p(31, "[object Object]" === a4 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a4)); + throw Error(p2(31, "[object Object]" === a4 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a4)); } function uh(a4) { var b2 = a4._init; @@ -13087,10 +13087,10 @@ var require_react_dom_production_min = __commonJS({ function t5(e6, g2, h4, k3) { var l3 = Ka(h4); if ("function" !== typeof l3) - throw Error(p(150)); + throw Error(p2(150)); h4 = l3.call(h4); if (null == h4) - throw Error(p(151)); + throw Error(p2(151)); for (var u3 = l3 = null, m5 = g2, w2 = g2 = 0, x2 = null, n4 = h4.next(); null !== m5 && !n4.done; w2++, n4 = h4.next()) { m5.index > w2 ? (x2 = m5, m5 = null) : x2 = m5.sibling; var t6 = r2(e6, m5, n4.value, k3); @@ -13201,7 +13201,7 @@ var require_react_dom_production_min = __commonJS({ var Gh = Uf(Dh); function Hh(a4) { if (a4 === Dh) - throw Error(p(174)); + throw Error(p2(174)); return a4; } function Ih(a4, b2) { @@ -13278,7 +13278,7 @@ var require_react_dom_production_min = __commonJS({ var Uh = 0; var Vh = 0; function Q3() { - throw Error(p(321)); + throw Error(p2(321)); } function Wh(a4, b2) { if (null === b2) @@ -13302,7 +13302,7 @@ var require_react_dom_production_min = __commonJS({ Th = false; Uh = 0; if (25 <= f2) - throw Error(p(301)); + throw Error(p2(301)); f2 += 1; P3 = O2 = null; b2.updateQueue = null; @@ -13316,7 +13316,7 @@ var require_react_dom_production_min = __commonJS({ P3 = O2 = N = null; Sh = false; if (b2) - throw Error(p(300)); + throw Error(p2(300)); return a4; } function bi() { @@ -13340,7 +13340,7 @@ var require_react_dom_production_min = __commonJS({ P3 = b2, O2 = a4; else { if (null === a4) - throw Error(p(310)); + throw Error(p2(310)); O2 = a4; a4 = { memoizedState: O2.memoizedState, baseState: O2.baseState, baseQueue: O2.baseQueue, queue: O2.queue, next: null }; null === P3 ? N.memoizedState = P3 = a4 : P3 = P3.next = a4; @@ -13353,7 +13353,7 @@ var require_react_dom_production_min = __commonJS({ function fi(a4) { var b2 = di(), c3 = b2.queue; if (null === c3) - throw Error(p(311)); + throw Error(p2(311)); c3.lastRenderedReducer = a4; var d4 = O2, e5 = d4.baseQueue, f2 = c3.pending; if (null !== f2) { @@ -13407,7 +13407,7 @@ var require_react_dom_production_min = __commonJS({ function gi(a4) { var b2 = di(), c3 = b2.queue; if (null === c3) - throw Error(p(311)); + throw Error(p2(311)); c3.lastRenderedReducer = a4; var d4 = c3.dispatch, e5 = c3.pending, f2 = b2.memoizedState; if (null !== e5) { @@ -13432,9 +13432,9 @@ var require_react_dom_production_min = __commonJS({ ji(ki.bind(null, c3, d4, a4), [a4]); if (d4.getSnapshot !== b2 || f2 || null !== P3 && P3.memoizedState.tag & 1) { c3.flags |= 2048; - li(9, mi.bind(null, c3, d4, e5, b2), void 0, null); + li2(9, mi.bind(null, c3, d4, e5, b2), void 0, null); if (null === R2) - throw Error(p(349)); + throw Error(p2(349)); 0 !== (Rh & 30) || ni(c3, b2, e5); } return e5; @@ -13478,7 +13478,7 @@ var require_react_dom_production_min = __commonJS({ a4 = a4.dispatch = ri.bind(null, N, a4); return [b2.memoizedState, a4]; } - function li(a4, b2, c3, d4) { + function li2(a4, b2, c3, d4) { a4 = { tag: a4, create: b2, destroy: c3, deps: d4, next: null }; b2 = N.updateQueue; null === b2 ? (b2 = { lastEffect: null, stores: null }, N.updateQueue = b2, b2.lastEffect = a4.next = a4) : (c3 = b2.lastEffect, null === c3 ? b2.lastEffect = a4.next = a4 : (d4 = c3.next, c3.next = a4, a4.next = d4, b2.lastEffect = a4)); @@ -13490,7 +13490,7 @@ var require_react_dom_production_min = __commonJS({ function ti(a4, b2, c3, d4) { var e5 = ci(); N.flags |= a4; - e5.memoizedState = li(1 | b2, c3, void 0, void 0 === d4 ? null : d4); + e5.memoizedState = li2(1 | b2, c3, void 0, void 0 === d4 ? null : d4); } function ui(a4, b2, c3, d4) { var e5 = di(); @@ -13500,12 +13500,12 @@ var require_react_dom_production_min = __commonJS({ var g = O2.memoizedState; f2 = g.destroy; if (null !== d4 && Wh(d4, g.deps)) { - e5.memoizedState = li(b2, c3, f2, d4); + e5.memoizedState = li2(b2, c3, f2, d4); return; } } N.flags |= a4; - e5.memoizedState = li(1 | b2, c3, f2, d4); + e5.memoizedState = li2(1 | b2, c3, f2, d4); } function vi(a4, b2) { return ti(8390656, 8, a4, b2); @@ -13675,12 +13675,12 @@ var require_react_dom_production_min = __commonJS({ var d4 = N, e5 = ci(); if (I2) { if (void 0 === c3) - throw Error(p(407)); + throw Error(p2(407)); c3 = c3(); } else { c3 = b2(); if (null === R2) - throw Error(p(349)); + throw Error(p2(349)); 0 !== (Rh & 30) || ni(d4, b2, c3); } e5.memoizedState = c3; @@ -13693,7 +13693,7 @@ var require_react_dom_production_min = __commonJS({ a4 ), [a4]); d4.flags |= 2048; - li(9, mi.bind(null, d4, f2, c3, b2), void 0, null); + li2(9, mi.bind(null, d4, f2, c3, b2), void 0, null); return c3; }, useId: function() { var a4 = ci(), b2 = R2.identifierPrefix; @@ -14062,7 +14062,7 @@ var require_react_dom_production_min = __commonJS({ function sj(a4, b2, c3, d4, e5, f2, g) { if (c3) { if (b2.flags & 256) - return b2.flags &= -257, d4 = Li(Error(p(422))), tj(a4, b2, g, d4); + return b2.flags &= -257, d4 = Li(Error(p2(422))), tj(a4, b2, g, d4); if (null !== b2.memoizedState) return b2.child = a4.child, b2.flags |= 128, null; f2 = d4.fallback; @@ -14086,7 +14086,7 @@ var require_react_dom_production_min = __commonJS({ if (d4) var h3 = d4.dgst; d4 = h3; - f2 = Error(p(419)); + f2 = Error(p2(419)); d4 = Li(f2, d4, void 0); return tj(a4, b2, g, d4); } @@ -14134,7 +14134,7 @@ var require_react_dom_production_min = __commonJS({ 0 !== e5 && e5 !== f2.retryLane && (f2.retryLane = e5, Zg(a4, e5), mh(d4, a4, e5, -1)); } uj(); - d4 = Li(Error(p(421))); + d4 = Li(Error(p2(421))); return tj(a4, b2, g, d4); } if ("$?" === e5.data) @@ -14236,7 +14236,7 @@ var require_react_dom_production_min = __commonJS({ if (0 === (c3 & b2.childLanes)) return null; if (null !== a4 && b2.child !== a4.child) - throw Error(p(153)); + throw Error(p2(153)); if (null !== b2.child) { a4 = b2.child; c3 = wh(a4, a4.pendingProps); @@ -14455,7 +14455,7 @@ var require_react_dom_production_min = __commonJS({ else { if (!d4) { if (null === b2.stateNode) - throw Error(p(166)); + throw Error(p2(166)); S3(b2); return null; } @@ -14661,7 +14661,7 @@ var require_react_dom_production_min = __commonJS({ Dj(a4, b2, a4.memoizedProps, d4); else { if ("string" !== typeof d4 && null === b2.stateNode) - throw Error(p(166)); + throw Error(p2(166)); c3 = Hh(Gh.current); Hh(Eh.current); if (Gg(b2)) { @@ -14693,11 +14693,11 @@ var require_react_dom_production_min = __commonJS({ else if (f2 = Gg(b2), null !== d4 && null !== d4.dehydrated) { if (null === a4) { if (!f2) - throw Error(p(318)); + throw Error(p2(318)); f2 = b2.memoizedState; f2 = null !== f2 ? f2.dehydrated : null; if (!f2) - throw Error(p(317)); + throw Error(p2(317)); f2[Of] = b2; } else Ig(), 0 === (b2.flags & 128) && (b2.memoizedState = null), b2.flags |= 4; @@ -14772,7 +14772,7 @@ var require_react_dom_production_min = __commonJS({ case 25: return null; } - throw Error(p(156, b2.tag)); + throw Error(p2(156, b2.tag)); } function Jj(a4, b2) { wg(b2); @@ -14788,7 +14788,7 @@ var require_react_dom_production_min = __commonJS({ a4 = b2.memoizedState; if (null !== a4 && null !== a4.dehydrated) { if (null === b2.alternate) - throw Error(p(340)); + throw Error(p2(340)); Ig(); } a4 = b2.flags; @@ -14833,7 +14833,7 @@ var require_react_dom_production_min = __commonJS({ } var Oj = false; function Pj(a4, b2) { - Cf = dd; + Cf = dd2; a4 = Me(); if (Ne(a4)) { if ("selectionStart" in a4) @@ -14884,7 +14884,7 @@ var require_react_dom_production_min = __commonJS({ } else c3 = null; Df = { focusedElem: a4, selectionRange: c3 }; - dd = false; + dd2 = false; for (V = b2; null !== V; ) if (b2 = V, a4 = b2.child, 0 !== (b2.subtreeFlags & 1028) && null !== a4) a4.return = b2, V = a4; @@ -14915,7 +14915,7 @@ var require_react_dom_production_min = __commonJS({ case 17: break; default: - throw Error(p(163)); + throw Error(p2(163)); } } catch (F) { W(b2, b2.return, F); @@ -15138,7 +15138,7 @@ var require_react_dom_production_min = __commonJS({ h3 = h3.return; } if (null === X2) - throw Error(p(160)); + throw Error(p2(160)); ak(f2, g, e5); X2 = null; Yj = false; @@ -15233,7 +15233,7 @@ var require_react_dom_production_min = __commonJS({ fk(a4); if (d4 & 4) { if (null === a4.stateNode) - throw Error(p(162)); + throw Error(p2(162)); e5 = a4.stateNode; f2 = a4.memoizedProps; try { @@ -15371,7 +15371,7 @@ var require_react_dom_production_min = __commonJS({ } c3 = c3.return; } - throw Error(p(160)); + throw Error(p2(160)); } switch (d4.tag) { case 5: @@ -15386,7 +15386,7 @@ var require_react_dom_production_min = __commonJS({ Wj(a4, h3, g); break; default: - throw Error(p(161)); + throw Error(p2(161)); } } catch (k2) { W(a4, a4.return, k2); @@ -15506,7 +15506,7 @@ var require_react_dom_production_min = __commonJS({ case 25: break; default: - throw Error(p(163)); + throw Error(p2(163)); } U || b2.flags & 512 && Sj(b2); } catch (r2) { @@ -15600,7 +15600,7 @@ var require_react_dom_production_min = __commonJS({ } var mk = Math.ceil; var nk = ua.ReactCurrentDispatcher; - var ok = ua.ReactCurrentOwner; + var ok2 = ua.ReactCurrentOwner; var pk = ua.ReactCurrentBatchConfig; var K2 = 0; var R2 = null; @@ -15647,7 +15647,7 @@ var require_react_dom_production_min = __commonJS({ } function mh(a4, b2, c3, d4) { if (50 < zk) - throw zk = 0, Ak = null, Error(p(185)); + throw zk = 0, Ak = null, Error(p2(185)); Ac(a4, c3, d4); if (0 === (K2 & 2) || a4 !== R2) a4 === R2 && (0 === (K2 & 2) && (rk |= c3), 4 === T3 && Dk(a4, Z)), Ek(a4, d4), 1 === c3 && 0 === K2 && 0 === (b2.mode & 1) && (Hj = B2() + 500, fg && jg()); @@ -15691,7 +15691,7 @@ var require_react_dom_production_min = __commonJS({ Bk = -1; Ck = 0; if (0 !== (K2 & 6)) - throw Error(p(327)); + throw Error(p2(327)); var c3 = a4.callbackNode; if (Ik() && a4.callbackNode !== c3) return null; @@ -15735,7 +15735,7 @@ var require_react_dom_production_min = __commonJS({ switch (b2) { case 0: case 1: - throw Error(p(345)); + throw Error(p2(345)); case 2: Qk(a4, uk, vk); break; @@ -15780,7 +15780,7 @@ var require_react_dom_production_min = __commonJS({ Qk(a4, uk, vk); break; default: - throw Error(p(329)); + throw Error(p2(329)); } } } @@ -15843,7 +15843,7 @@ var require_react_dom_production_min = __commonJS({ } function Fk(a4) { if (0 !== (K2 & 6)) - throw Error(p(327)); + throw Error(p2(327)); Ik(); var b2 = uc(a4, 0); if (0 === (b2 & 1)) @@ -15856,7 +15856,7 @@ var require_react_dom_production_min = __commonJS({ if (1 === c3) throw c3 = qk, Lk(a4, 0), Dk(a4, b2), Ek(a4, B2()), c3; if (6 === c3) - throw Error(p(345)); + throw Error(p2(345)); a4.finishedWork = a4.current.alternate; a4.finishedLanes = b2; Qk(a4, uk, vk); @@ -15970,7 +15970,7 @@ var require_react_dom_production_min = __commonJS({ P3 = O2 = N = null; Th = false; Uh = 0; - ok.current = null; + ok2.current = null; if (null === c3 || null === c3.return) { T3 = 1; qk = b2; @@ -16008,7 +16008,7 @@ var require_react_dom_production_min = __commonJS({ uj(); break a; } - k2 = Error(p(426)); + k2 = Error(p2(426)); } } else if (I2 && h3.mode & 1) { var J = Vi(g); @@ -16084,7 +16084,7 @@ var require_react_dom_production_min = __commonJS({ K2 = c3; nk.current = d4; if (null !== Y2) - throw Error(p(261)); + throw Error(p2(261)); R2 = null; Z = 0; return T3; @@ -16101,7 +16101,7 @@ var require_react_dom_production_min = __commonJS({ var b2 = Wk(a4.alternate, a4, gj); a4.memoizedProps = a4.pendingProps; null === b2 ? Tk(a4) : Y2 = b2; - ok.current = null; + ok2.current = null; } function Tk(a4) { var b2 = a4; @@ -16151,7 +16151,7 @@ var require_react_dom_production_min = __commonJS({ Ik(); while (null !== xk); if (0 !== (K2 & 6)) - throw Error(p(327)); + throw Error(p2(327)); c3 = a4.finishedWork; var e5 = a4.finishedLanes; if (null === c3) @@ -16159,7 +16159,7 @@ var require_react_dom_production_min = __commonJS({ a4.finishedWork = null; a4.finishedLanes = 0; if (c3 === a4.current) - throw Error(p(177)); + throw Error(p2(177)); a4.callbackNode = null; a4.callbackPriority = 0; var f2 = c3.lanes | c3.childLanes; @@ -16177,11 +16177,11 @@ var require_react_dom_production_min = __commonJS({ C = 1; var h3 = K2; K2 |= 4; - ok.current = null; + ok2.current = null; Pj(a4, c3); ek(c3, a4); Oe(Df); - dd = !!Cf; + dd2 = !!Cf; Df = Cf = null; a4.current = c3; ik(c3, a4, e5); @@ -16220,7 +16220,7 @@ var require_react_dom_production_min = __commonJS({ xk = null; yk = 0; if (0 !== (K2 & 6)) - throw Error(p(331)); + throw Error(p2(331)); var e5 = K2; K2 |= 4; for (V = a4.current; null !== V; ) { @@ -16406,7 +16406,7 @@ var require_react_dom_production_min = __commonJS({ d4 = a4.stateNode; break; default: - throw Error(p(314)); + throw Error(p2(314)); } null !== d4 && d4.delete(b2); Zk(a4, c3); @@ -16460,7 +16460,7 @@ var require_react_dom_production_min = __commonJS({ b2 = aj(null, b2, d4, Lg(d4.type, a4), c3); break a; } - throw Error(p( + throw Error(p2( 306, d4, "" @@ -16475,7 +16475,7 @@ var require_react_dom_production_min = __commonJS({ a: { lj(b2); if (null === a4) - throw Error(p(387)); + throw Error(p2(387)); d4 = b2.pendingProps; f2 = b2.memoizedState; e5 = f2.element; @@ -16485,11 +16485,11 @@ var require_react_dom_production_min = __commonJS({ d4 = g.element; if (f2.isDehydrated) if (f2 = { element: d4, isDehydrated: false, cache: g.cache, pendingSuspenseBoundaries: g.pendingSuspenseBoundaries, transitions: g.transitions }, b2.updateQueue.baseState = f2, b2.memoizedState = f2, b2.flags & 256) { - e5 = Ki(Error(p(423)), b2); + e5 = Ki(Error(p2(423)), b2); b2 = mj(a4, b2, d4, c3, e5); break a; } else if (d4 !== e5) { - e5 = Ki(Error(p(424)), b2); + e5 = Ki(Error(p2(424)), b2); b2 = mj(a4, b2, d4, c3, e5); break a; } else @@ -16572,7 +16572,7 @@ var require_react_dom_production_min = __commonJS({ else if (18 === f2.tag) { g = f2.return; if (null === g) - throw Error(p(341)); + throw Error(p2(341)); g.lanes |= c3; h3 = g.alternate; null !== h3 && (h3.lanes |= c3); @@ -16615,7 +16615,7 @@ var require_react_dom_production_min = __commonJS({ case 22: return ej(a4, b2, c3); } - throw Error(p(156, b2.tag)); + throw Error(p2(156, b2.tag)); }; function Gk(a4, b2) { return ac(a4, b2); @@ -16714,7 +16714,7 @@ var require_react_dom_production_min = __commonJS({ d4 = null; break a; } - throw Error(p(130, null == a4 ? a4 : typeof a4, "")); + throw Error(p2(130, null == a4 ? a4 : typeof a4, "")); } b2 = Bg(g, c3, b2, e5); b2.elementType = a4; @@ -16780,7 +16780,7 @@ var require_react_dom_production_min = __commonJS({ a4 = a4._reactInternals; a: { if (Vb(a4) !== a4 || 1 !== a4.tag) - throw Error(p(170)); + throw Error(p2(170)); var b2 = a4; do { switch (b2.tag) { @@ -16795,7 +16795,7 @@ var require_react_dom_production_min = __commonJS({ } b2 = b2.return; } while (null !== b2); - throw Error(p(171)); + throw Error(p2(171)); } if (1 === a4.tag) { var c3 = a4.type; @@ -16864,7 +16864,7 @@ var require_react_dom_production_min = __commonJS({ nl.prototype.render = ml.prototype.render = function(a4) { var b2 = this._internalRoot; if (null === b2) - throw Error(p(409)); + throw Error(p2(409)); gl(a4, b2, null, null); }; nl.prototype.unmount = ml.prototype.unmount = function() { @@ -17013,7 +17013,7 @@ var require_react_dom_production_min = __commonJS({ if (d4 !== a4 && d4.form === a4.form) { var e5 = Db(d4); if (!e5) - throw Error(p(90)); + throw Error(p2(90)); Wa(d4); bb(d4, e5); } @@ -17048,12 +17048,12 @@ var require_react_dom_production_min = __commonJS({ exports.createPortal = function(a4, b2) { var c3 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; if (!ol(b2)) - throw Error(p(200)); + throw Error(p2(200)); return dl(a4, b2, null, c3); }; exports.createRoot = function(a4, b2) { if (!ol(a4)) - throw Error(p(299)); + throw Error(p2(299)); var c3 = false, d4 = "", e5 = ll; null !== b2 && void 0 !== b2 && (true === b2.unstable_strictMode && (c3 = true), void 0 !== b2.identifierPrefix && (d4 = b2.identifierPrefix), void 0 !== b2.onRecoverableError && (e5 = b2.onRecoverableError)); b2 = cl(a4, 1, false, null, null, c3, false, d4, e5); @@ -17069,9 +17069,9 @@ var require_react_dom_production_min = __commonJS({ var b2 = a4._reactInternals; if (void 0 === b2) { if ("function" === typeof a4.render) - throw Error(p(188)); + throw Error(p2(188)); a4 = Object.keys(a4).join(","); - throw Error(p(268, a4)); + throw Error(p2(268, a4)); } a4 = Zb(b2); a4 = null === a4 ? null : a4.stateNode; @@ -17082,12 +17082,12 @@ var require_react_dom_production_min = __commonJS({ }; exports.hydrate = function(a4, b2, c3) { if (!pl(b2)) - throw Error(p(200)); + throw Error(p2(200)); return sl(null, a4, b2, true, c3); }; exports.hydrateRoot = function(a4, b2, c3) { if (!ol(a4)) - throw Error(p(405)); + throw Error(p2(405)); var d4 = null != c3 && c3.hydratedSources || null, e5 = false, f2 = "", g = ll; null !== c3 && void 0 !== c3 && (true === c3.unstable_strictMode && (e5 = true), void 0 !== c3.identifierPrefix && (f2 = c3.identifierPrefix), void 0 !== c3.onRecoverableError && (g = c3.onRecoverableError)); b2 = fl(b2, null, a4, 1, null != c3 ? c3 : null, e5, false, f2, g); @@ -17103,12 +17103,12 @@ var require_react_dom_production_min = __commonJS({ }; exports.render = function(a4, b2, c3) { if (!pl(b2)) - throw Error(p(200)); + throw Error(p2(200)); return sl(null, a4, b2, false, c3); }; exports.unmountComponentAtNode = function(a4) { if (!pl(a4)) - throw Error(p(40)); + throw Error(p2(40)); return a4._reactRootContainer ? (Sk(function() { sl(null, null, a4, false, function() { a4._reactRootContainer = null; @@ -17119,9 +17119,9 @@ var require_react_dom_production_min = __commonJS({ exports.unstable_batchedUpdates = Rk; exports.unstable_renderSubtreeIntoContainer = function(a4, b2, c3, d4) { if (!pl(c3)) - throw Error(p(200)); + throw Error(p2(200)); if (null == a4 || void 0 === a4._reactInternals) - throw Error(p(38)); + throw Error(p2(38)); return sl(a4, b2, c3, false, d4); }; exports.version = "18.2.0-next-9e3b772b8-20220608"; @@ -17161,7 +17161,7 @@ var require_typed_function = __commonJS({ typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory2() : typeof define === "function" && define.amd ? define(factory2) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2["'typed'"] = factory2()); })(exports, function() { "use strict"; - function ok() { + function ok2() { return true; } function notOk() { @@ -17171,8 +17171,8 @@ var require_typed_function = __commonJS({ return void 0; } const NOT_TYPED_FUNCTION = "Argument is not a typed-function."; - function create2() { - function isPlainObject2(x2) { + function create3() { + function isPlainObject3(x2) { return typeof x2 === "object" && x2 !== null && x2.constructor === Object; } const _types = [{ @@ -17210,7 +17210,7 @@ var require_typed_function = __commonJS({ } }, { name: "Object", - test: isPlainObject2 + test: isPlainObject3 }, { name: "null", test: function(x2) { @@ -17224,7 +17224,7 @@ var require_typed_function = __commonJS({ }]; const anyType = { name: "any", - test: ok, + test: ok2, isAny: true }; let typeMap; @@ -17358,10 +17358,10 @@ var require_typed_function = __commonJS({ } throw new TypeError("Signature not found (signature: " + (fn.name || "unnamed") + "(" + stringifyParams(params, ", ") + "))"); } - function find2(fn, signature, options) { + function find3(fn, signature, options) { return findSignature(fn, signature, options).implementation; } - function convert(value, typeName4) { + function convert2(value, typeName4) { const type = findType(typeName4); if (type.test(value)) { return value; @@ -17380,7 +17380,7 @@ var require_typed_function = __commonJS({ } function stringifyParams(params) { let separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ","; - return params.map((p) => p.name).join(separator); + return params.map((p2) => p2.name).join(separator); } function parseParam(param) { const restParam = param.indexOf("...") === 0; @@ -17469,7 +17469,7 @@ var require_typed_function = __commonJS({ } function compileTest(param) { if (!param || param.types.length === 0) { - return ok; + return ok2; } else if (param.types.length === 1) { return findType(param.types[0].name).test; } else if (param.types.length === 2) { @@ -17543,11 +17543,11 @@ var require_typed_function = __commonJS({ } } } - function getParamAtIndex(params, index2) { - return index2 < params.length ? params[index2] : hasRestParam(params) ? last(params) : null; + function getParamAtIndex(params, index3) { + return index3 < params.length ? params[index3] : hasRestParam(params) ? last(params) : null; } - function getTypeSetAtIndex(params, index2) { - const param = getParamAtIndex(params, index2); + function getTypeSetAtIndex(params, index3) { + const param = getParamAtIndex(params, index3); if (!param) { return /* @__PURE__ */ new Set(); } @@ -17556,10 +17556,10 @@ var require_typed_function = __commonJS({ function isExactType(type) { return type.conversion === null || type.conversion === void 0; } - function mergeExpectedParams(signatures, index2) { + function mergeExpectedParams(signatures, index3) { const typeSet = /* @__PURE__ */ new Set(); signatures.forEach((signature) => { - const paramSet = getTypeSetAtIndex(signature.params, index2); + const paramSet = getTypeSetAtIndex(signature.params, index3); let name317; for (name317 of paramSet) { typeSet.add(name317); @@ -17571,25 +17571,25 @@ var require_typed_function = __commonJS({ let err, expected; const _name = name317 || "unnamed"; let matchingSignatures = signatures; - let index2; - for (index2 = 0; index2 < args.length; index2++) { + let index3; + for (index3 = 0; index3 < args.length; index3++) { const nextMatchingDefs = []; matchingSignatures.forEach((signature) => { - const param = getParamAtIndex(signature.params, index2); + const param = getParamAtIndex(signature.params, index3); const test = compileTest(param); - if ((index2 < signature.params.length || hasRestParam(signature.params)) && test(args[index2])) { + if ((index3 < signature.params.length || hasRestParam(signature.params)) && test(args[index3])) { nextMatchingDefs.push(signature); } }); if (nextMatchingDefs.length === 0) { - expected = mergeExpectedParams(matchingSignatures, index2); + expected = mergeExpectedParams(matchingSignatures, index3); if (expected.length > 0) { - const actualTypes = findTypeNames(args[index2]); - err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index2 + ")"); + const actualTypes = findTypeNames(args[index3]); + err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index3 + ")"); err.data = { category: "wrongType", fn: _name, - index: index2, + index: index3, actual: actualTypes, expected }; @@ -17603,7 +17603,7 @@ var require_typed_function = __commonJS({ return hasRestParam(signature.params) ? Infinity : signature.params.length; }); if (args.length < Math.min.apply(null, lengths)) { - expected = mergeExpectedParams(matchingSignatures, index2); + expected = mergeExpectedParams(matchingSignatures, index3); err = new TypeError("Too few arguments in function " + _name + " (expected: " + expected.join(" or ") + ", index: " + args.length + ")"); err.data = { category: "tooFewArgs", @@ -17791,7 +17791,7 @@ var require_typed_function = __commonJS({ } function compileArgsPreprocessing(params, fn) { let fnConvert = fn; - if (params.some((p) => p.hasConversion)) { + if (params.some((p2) => p2.hasConversion)) { const restParam = hasRestParam(params); const compiledConversions = params.map(compileArgConversion); fnConvert = function convertArgs() { @@ -17865,9 +17865,9 @@ var require_typed_function = __commonJS({ } } function splitParams(params) { - function _splitParams(params2, index2, paramsSoFar) { - if (index2 < params2.length) { - const param = params2[index2]; + function _splitParams(params2, index3, paramsSoFar) { + if (index3 < params2.length) { + const param = params2[index3]; let resultingParams = []; if (param.restParam) { const exactTypes = param.types.filter(isExactType); @@ -17893,7 +17893,7 @@ var require_typed_function = __commonJS({ }); } return flatMap(resultingParams, function(nextParam) { - return _splitParams(params2, index2 + 1, paramsSoFar.concat([nextParam])); + return _splitParams(params2, index3 + 1, paramsSoFar.concat([nextParam])); }); } else { return [paramsSoFar]; @@ -18031,7 +18031,7 @@ var require_typed_function = __commonJS({ name: spName, fn: functionIndex }); - if (sp.every((p) => !p.hasConversion)) { + if (sp.every((p2) => !p2.hasConversion)) { signaturesMap[spName] = functionIndex; } } @@ -18055,23 +18055,23 @@ var require_typed_function = __commonJS({ } const ok0 = signatures[0] && signatures[0].params.length <= 2 && !hasRestParam(signatures[0].params); const ok1 = signatures[1] && signatures[1].params.length <= 2 && !hasRestParam(signatures[1].params); - const ok2 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params); + const ok22 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params); const ok3 = signatures[3] && signatures[3].params.length <= 2 && !hasRestParam(signatures[3].params); const ok4 = signatures[4] && signatures[4].params.length <= 2 && !hasRestParam(signatures[4].params); const ok5 = signatures[5] && signatures[5].params.length <= 2 && !hasRestParam(signatures[5].params); - const allOk = ok0 && ok1 && ok2 && ok3 && ok4 && ok5; + const allOk = ok0 && ok1 && ok22 && ok3 && ok4 && ok5; for (let i4 = 0; i4 < signatures.length; ++i4) { signatures[i4].test = compileTests(signatures[i4].params); } const test00 = ok0 ? compileTest(signatures[0].params[0]) : notOk; const test10 = ok1 ? compileTest(signatures[1].params[0]) : notOk; - const test20 = ok2 ? compileTest(signatures[2].params[0]) : notOk; + const test20 = ok22 ? compileTest(signatures[2].params[0]) : notOk; const test30 = ok3 ? compileTest(signatures[3].params[0]) : notOk; const test40 = ok4 ? compileTest(signatures[4].params[0]) : notOk; const test50 = ok5 ? compileTest(signatures[5].params[0]) : notOk; const test01 = ok0 ? compileTest(signatures[0].params[1]) : notOk; const test11 = ok1 ? compileTest(signatures[1].params[1]) : notOk; - const test21 = ok2 ? compileTest(signatures[2].params[1]) : notOk; + const test21 = ok22 ? compileTest(signatures[2].params[1]) : notOk; const test31 = ok3 ? compileTest(signatures[3].params[1]) : notOk; const test41 = ok4 ? compileTest(signatures[4].params[1]) : notOk; const test51 = ok5 ? compileTest(signatures[5].params[1]) : notOk; @@ -18080,13 +18080,13 @@ var require_typed_function = __commonJS({ } const fn0 = ok0 ? signatures[0].implementation : undef; const fn1 = ok1 ? signatures[1].implementation : undef; - const fn2 = ok2 ? signatures[2].implementation : undef; + const fn2 = ok22 ? signatures[2].implementation : undef; const fn3 = ok3 ? signatures[3].implementation : undef; const fn4 = ok4 ? signatures[4].implementation : undef; const fn5 = ok5 ? signatures[5].implementation : undef; const len0 = ok0 ? signatures[0].params.length : -1; const len1 = ok1 ? signatures[1].params.length : -1; - const len2 = ok2 ? signatures[2].params.length : -1; + const len2 = ok22 ? signatures[2].params.length : -1; const len3 = ok3 ? signatures[3].params.length : -1; const len4 = ok4 ? signatures[4].params.length : -1; const len5 = ok5 ? signatures[5].params.length : -1; @@ -18207,29 +18207,29 @@ var require_typed_function = __commonJS({ } function getObjectName(obj) { let name317; - for (const key2 in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key2) && (isTypedFunction(obj[key2]) || typeof obj[key2].signature === "string")) { - name317 = checkName(name317, obj[key2].name); + for (const key3 in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key3) && (isTypedFunction(obj[key3]) || typeof obj[key3].signature === "string")) { + name317 = checkName(name317, obj[key3].name); } } return name317; } function mergeSignatures(dest, source) { - let key2; - for (key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - if (key2 in dest) { - if (source[key2] !== dest[key2]) { - const err = new Error('Signature "' + key2 + '" is defined twice'); + let key3; + for (key3 in source) { + if (Object.prototype.hasOwnProperty.call(source, key3)) { + if (key3 in dest) { + if (source[key3] !== dest[key3]) { + const err = new Error('Signature "' + key3 + '" is defined twice'); err.data = { - signature: key2, - sourceFunction: source[key2], - destFunction: dest[key2] + signature: key3, + sourceFunction: source[key3], + destFunction: dest[key3] }; throw err; } } - dest[key2] = source[key2]; + dest[key3] = source[key3]; } } } @@ -18250,7 +18250,7 @@ var require_typed_function = __commonJS({ } else if (isTypedFunction(item)) { theseSignatures = item.signatures; } - } else if (isPlainObject2(item)) { + } else if (isPlainObject3(item)) { theseSignatures = item; if (!named) { thisName = getObjectName(item); @@ -18271,7 +18271,7 @@ var require_typed_function = __commonJS({ } return createTypedFunction(name317 || "", allSignatures); }; - typed3.create = create2; + typed3.create = create3; typed3.createCount = saveTyped.createCount; typed3.onMismatch = _onMismatch; typed3.throwMismatchError = _onMismatch; @@ -18282,9 +18282,9 @@ var require_typed_function = __commonJS({ typed3._findType = findType; typed3.referTo = referTo; typed3.referToSelf = referToSelf; - typed3.convert = convert; + typed3.convert = convert2; typed3.findSignature = findSignature; - typed3.find = find2; + typed3.find = find3; typed3.isTypedFunction = isTypedFunction; typed3.warnAgainstDeprecatedThis = true; typed3.addType = function(type, beforeObjectTest) { @@ -18330,8 +18330,8 @@ var require_typed_function = __commonJS({ if (existingConversion.convert !== conversion.convert) { throw new Error("Conversion to remove does not match existing conversion"); } - const index2 = to2.conversionsTo.indexOf(existingConversion); - to2.conversionsTo.splice(index2, 1); + const index3 = to2.conversionsTo.indexOf(existingConversion); + to2.conversionsTo.splice(index3, 1); }; typed3.resolve = function(tf, argList) { if (!isTypedFunction(tf)) { @@ -18347,7 +18347,7 @@ var require_typed_function = __commonJS({ }; return typed3; } - var typedFunction3 = create2(); + var typedFunction3 = create3(); return typedFunction3; }); } @@ -18356,7 +18356,7 @@ var require_typed_function = __commonJS({ // node_modules/complex.js/complex.js var require_complex = __commonJS({ "node_modules/complex.js/complex.js"(exports, module2) { - (function(root) { + (function(root4) { "use strict"; var cosh4 = Math.cosh || function(x2) { return Math.abs(x2) < 1e-9 ? 1 - x2 : (Math.exp(x2) + Math.exp(-x2)) * 0.5; @@ -18405,7 +18405,7 @@ var require_complex = __commonJS({ b2 = b2 / 2; return 0.5 * Math.log(a4 * a4 + b2 * b2) + Math.LN2; } - var parse7 = function(a4, b2) { + var parse8 = function(a4, b2) { var z2 = { "re": 0, "im": 0 }; if (a4 === void 0 || a4 === null) { z2["re"] = z2["im"] = 0; @@ -18495,7 +18495,7 @@ var require_complex = __commonJS({ if (!(this instanceof Complex3)) { return new Complex3(a4, b2); } - var z2 = parse7(a4, b2); + var z2 = parse8(a4, b2); this["re"] = z2["re"]; this["im"] = z2["im"]; } @@ -19086,7 +19086,7 @@ var require_complex = __commonJS({ Complex3["Complex"] = Complex3; module2["exports"] = Complex3; } else { - root["Complex"] = Complex3; + root4["Complex"] = Complex3; } })(exports); } @@ -19095,7 +19095,7 @@ var require_complex = __commonJS({ // node_modules/fraction.js/fraction.js var require_fraction = __commonJS({ "node_modules/fraction.js/fraction.js"(exports, module2) { - (function(root) { + (function(root4) { "use strict"; var MAX_CYCLE_LEN = 2e3; var P3 = { @@ -19141,7 +19141,7 @@ var require_fraction = __commonJS({ } return factors; } - var parse7 = function(p1, p2) { + var parse8 = function(p1, p2) { var n3 = 0, d4 = 1, s4 = 1; var v2 = 0, w2 = 0, x2 = 0, y3 = 1, z2 = 1; var A = 0, B2 = 1; @@ -19328,7 +19328,7 @@ var require_fraction = __commonJS({ } ; function Fraction3(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); if (this instanceof Fraction3) { a4 = gcd2(P3["d"], P3["n"]); this["s"] = P3["s"]; @@ -19358,28 +19358,28 @@ var require_fraction = __commonJS({ return newFraction(-this["s"] * this["n"], this["d"]); }, "add": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return newFraction( this["s"] * this["n"] * P3["d"] + P3["s"] * this["d"] * P3["n"], this["d"] * P3["d"] ); }, "sub": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return newFraction( this["s"] * this["n"] * P3["d"] - P3["s"] * this["d"] * P3["n"], this["d"] * P3["d"] ); }, "mul": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return newFraction( this["s"] * P3["s"] * this["n"] * P3["n"], this["d"] * P3["d"] ); }, "div": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return newFraction( this["s"] * P3["s"] * this["n"] * P3["d"], this["d"] * P3["n"] @@ -19395,7 +19395,7 @@ var require_fraction = __commonJS({ if (a4 === void 0) { return newFraction(this["s"] * this["n"] % this["d"], 1); } - parse7(a4, b2); + parse8(a4, b2); if (0 === P3["n"] && 0 === this["d"]) { throw DivisionByZero(); } @@ -19405,11 +19405,11 @@ var require_fraction = __commonJS({ ); }, "gcd": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return newFraction(gcd2(P3["n"], this["n"]) * gcd2(P3["d"], this["d"]), P3["d"] * this["d"]); }, "lcm": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); if (P3["n"] === 0 && this["n"] === 0) { return newFraction(0, 1); } @@ -19440,7 +19440,7 @@ var require_fraction = __commonJS({ return newFraction(this["s"] * this["d"], this["n"]); }, "pow": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); if (P3["d"] === 1) { if (P3["s"] < 0) { return newFraction(Math.pow(this["s"] * this["d"], P3["n"]), Math.pow(this["n"], P3["n"])); @@ -19484,11 +19484,11 @@ var require_fraction = __commonJS({ return newFraction(n3, d4); }, "equals": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return this["s"] * this["n"] * P3["d"] === P3["s"] * P3["n"] * this["d"]; }, "compare": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); var t5 = this["s"] * this["n"] * P3["d"] - P3["s"] * P3["n"] * this["d"]; return (0 < t5) - (t5 < 0); }, @@ -19511,7 +19511,7 @@ var require_fraction = __commonJS({ return this; }, "divisible": function(a4, b2) { - parse7(a4, b2); + parse8(a4, b2); return !(!(P3["n"] * this["d"]) || this["n"] * P3["d"] % (P3["n"] * this["d"])); }, "valueOf": function() { @@ -19620,7 +19620,7 @@ var require_fraction = __commonJS({ Fraction3["Fraction"] = Fraction3; module2["exports"] = Fraction3; } else { - root["Fraction"] = Fraction3; + root4["Fraction"] = Fraction3; } })(exports); } @@ -19669,9 +19669,9 @@ var require_dist = __commonJS({ var _extends2 = Object.assign || function(target) { for (var i4 = 1; i4 < arguments.length; i4++) { var source = arguments[i4]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; + for (var key3 in source) { + if (Object.prototype.hasOwnProperty.call(source, key3)) { + target[key3] = source[key3]; } } } @@ -19708,13 +19708,13 @@ var require_dist = __commonJS({ var escapeKeys = Object.keys(escapes); var _loop = function _loop2() { var specialCharFound = false; - escapeKeys.forEach(function(key2, index2) { + escapeKeys.forEach(function(key3, index3) { if (specialCharFound) { return; } - if (runningStr.length >= key2.length && runningStr.slice(0, key2.length) === key2) { - result += escapes[escapeKeys[index2]]; - runningStr = runningStr.slice(key2.length, runningStr.length); + if (runningStr.length >= key3.length && runningStr.slice(0, key3.length) === key3) { + result += escapes[escapeKeys[index3]]; + runningStr = runningStr.slice(key3.length, runningStr.length); specialCharFound = true; } }); @@ -19788,10 +19788,10 @@ var require_alea = __commonJS({ } function Mash() { var n3 = 4022871197; - var mash = function(data2) { - data2 = String(data2); - for (var i4 = 0; i4 < data2.length; i4++) { - n3 += data2.charCodeAt(i4); + var mash = function(data3) { + data3 = String(data3); + for (var i4 = 0; i4 < data3.length; i4++) { + n3 += data3.charCodeAt(i4); var h3 = 0.02519603282416938 * n3; n3 = h3 >>> 0; h3 -= n3; @@ -20261,13 +20261,13 @@ var require_seedrandom = __commonJS({ (function(global2, pool, math2) { var width = 256, chunks = 6, digits2 = 52, rngname = "random", startdenom = math2.pow(width, chunks), significance = math2.pow(2, digits2), overflow = significance * 2, mask = width - 1, nodecrypto; function seedrandom2(seed, options, callback) { - var key2 = []; + var key3 = []; options = options == true ? { entropy: true } : options || {}; var shortseed = mixkey(flatten4( options.entropy ? [seed, tostring(pool)] : seed == null ? autoseed() : seed, 3 - ), key2); - var arc4 = new ARC4(key2); + ), key3); + var arc4 = new ARC4(key3); var prng = function() { var n3 = arc4.g(chunks), d4 = startdenom, x2 = 0; while (n3 < significance) { @@ -20311,16 +20311,16 @@ var require_seedrandom = __commonJS({ options.state ); } - function ARC4(key2) { - var t5, keylen = key2.length, me = this, i4 = 0, j = me.i = me.j = 0, s4 = me.S = []; + function ARC4(key3) { + var t5, keylen = key3.length, me = this, i4 = 0, j = me.i = me.j = 0, s4 = me.S = []; if (!keylen) { - key2 = [keylen++]; + key3 = [keylen++]; } while (i4 < width) { s4[i4] = i4++; } for (i4 = 0; i4 < width; i4++) { - s4[i4] = s4[j = mask & j + key2[i4 % keylen] + (t5 = s4[i4])]; + s4[i4] = s4[j = mask & j + key3[i4 % keylen] + (t5 = s4[i4])]; s4[j] = t5; } (me.g = function(count3) { @@ -20353,12 +20353,12 @@ var require_seedrandom = __commonJS({ } return result.length ? result : typ == "string" ? obj : obj + "\0"; } - function mixkey(seed, key2) { + function mixkey(seed, key3) { var stringseed = seed + "", smear, j = 0; while (j < stringseed.length) { - key2[mask & j] = mask & (smear ^= key2[mask & j] * 19) + stringseed.charCodeAt(j++); + key3[mask & j] = mask & (smear ^= key3[mask & j] * 19) + stringseed.charCodeAt(j++); } - return tostring(key2); + return tostring(key3); } function autoseed() { try { @@ -20445,12 +20445,12 @@ var require_tiny_emitter = __commonJS({ return this.on(name317, listener, ctx); }, emit: function(name317) { - var data2 = [].slice.call(arguments, 1); + var data3 = [].slice.call(arguments, 1); var evtArr = ((this.e || (this.e = {}))[name317] || []).slice(); var i4 = 0; var len = evtArr.length; for (i4; i4 < len; i4++) { - evtArr[i4].fn.apply(evtArr[i4].ctx, data2); + evtArr[i4].fn.apply(evtArr[i4].ctx, data3); } return this; }, @@ -20482,14 +20482,14 @@ var require_react_jsx_runtime_production_min = __commonJS({ var l2 = Symbol.for("react.fragment"); var m4 = Object.prototype.hasOwnProperty; var n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner; - var p = { key: true, ref: true, __self: true, __source: true }; + var p2 = { key: true, ref: true, __self: true, __source: true }; function q2(c3, a4, g) { var b2, d4 = {}, e5 = null, h3 = null; void 0 !== g && (e5 = "" + g); void 0 !== a4.key && (e5 = "" + a4.key); void 0 !== a4.ref && (h3 = a4.ref); for (b2 in a4) - m4.call(a4, b2) && !p.hasOwnProperty(b2) && (d4[b2] = a4[b2]); + m4.call(a4, b2) && !p2.hasOwnProperty(b2) && (d4[b2] = a4[b2]); if (c3 && c3.defaultProps) for (b2 in a4 = c3.defaultProps, a4) void 0 === d4[b2] && (d4[b2] = a4[b2]); @@ -20543,9 +20543,9 @@ var require_classnames = __commonJS({ return arg2.toString(); } var classes2 = ""; - for (var key2 in arg2) { - if (hasOwn3.call(arg2, key2) && arg2[key2]) { - classes2 = appendClass(classes2, key2); + for (var key3 in arg2) { + if (hasOwn3.call(arg2, key3) && arg2[key3]) { + classes2 = appendClass(classes2, key3); } } return classes2; @@ -20573,6 +20573,247 @@ var require_classnames = __commonJS({ } }); +// node_modules/react-style-object-to-css/lib/CSSProperty.js +var require_CSSProperty = __commonJS({ + "node_modules/react-style-object-to-css/lib/CSSProperty.js"(exports, module2) { + "use strict"; + var isUnitlessNumber = { + boxFlex: true, + boxFlexGroup: true, + columnCount: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + widows: true, + zIndex: true, + zoom: true, + fillOpacity: true, + strokeDashoffset: true, + strokeOpacity: true, + strokeWidth: true + }; + function prefixKey(prefix, key3) { + return prefix + key3.charAt(0).toUpperCase() + key3.substring(1); + } + var prefixes = ["Webkit", "ms", "Moz", "O"]; + Object.keys(isUnitlessNumber).forEach(function(prop2) { + prefixes.forEach(function(prefix) { + isUnitlessNumber[prefixKey(prefix, prop2)] = isUnitlessNumber[prop2]; + }); + }); + var shorthandPropertyExpansions = { + background: { + backgroundImage: true, + backgroundPosition: true, + backgroundRepeat: true, + backgroundColor: true + }, + border: { + borderWidth: true, + borderStyle: true, + borderColor: true + }, + borderBottom: { + borderBottomWidth: true, + borderBottomStyle: true, + borderBottomColor: true + }, + borderLeft: { + borderLeftWidth: true, + borderLeftStyle: true, + borderLeftColor: true + }, + borderRight: { + borderRightWidth: true, + borderRightStyle: true, + borderRightColor: true + }, + borderTop: { + borderTopWidth: true, + borderTopStyle: true, + borderTopColor: true + }, + font: { + fontStyle: true, + fontVariant: true, + fontWeight: true, + fontSize: true, + lineHeight: true, + fontFamily: true + } + }; + var CSSProperty = { + isUnitlessNumber, + shorthandPropertyExpansions + }; + module2.exports = CSSProperty; + } +}); + +// node_modules/react-style-object-to-css/lib/hyphenateStyleName.js +var require_hyphenateStyleName = __commonJS({ + "node_modules/react-style-object-to-css/lib/hyphenateStyleName.js"(exports, module2) { + "use strict"; + var msPattern = /^ms-/; + var _uppercasePattern = /([A-Z])/g; + function hyphenate(string6) { + return string6.replace(_uppercasePattern, "-$1").toLowerCase(); + } + function hyphenateStyleName(string6) { + return hyphenate(string6).replace(msPattern, "-ms-"); + } + module2.exports = hyphenateStyleName; + } +}); + +// node_modules/react-style-object-to-css/index.js +var require_react_style_object_to_css = __commonJS({ + "node_modules/react-style-object-to-css/index.js"(exports, module2) { + "use strict"; + var isUnitlessNumber = require_CSSProperty().isUnitlessNumber; + var hyphenateStyleName = require_hyphenateStyleName(); + var isArray5 = Array.isArray; + var keys2 = Object.keys; + var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/; + function buildRule(key3, value) { + if (!isUnitlessNumber[key3] && typeof value === "number") { + value = "" + value + "px"; + } else if (key3 === "content" && !unquotedContentValueRegex.test(value)) { + value = "'" + value.replace(/'/g, "\\'") + "'"; + } + return hyphenateStyleName(key3) + ": " + value + "; "; + } + function styleToCssString(rules) { + var result = ""; + if (!rules || keys2(rules).length === 0) { + return result; + } + var styleKeys = keys2(rules); + for (var j = 0, l2 = styleKeys.length; j < l2; j++) { + var styleKey = styleKeys[j]; + var value = rules[styleKey]; + if (isArray5(value)) { + for (var i4 = 0, len = value.length; i4 < len; i4++) { + result += buildRule(styleKey, value[i4]); + } + } else { + result += buildRule(styleKey, value); + } + } + return result; + } + module2.exports = styleToCssString; + } +}); + +// node_modules/is-buffer/index.js +var require_is_buffer = __commonJS({ + "node_modules/is-buffer/index.js"(exports, module2) { + module2.exports = function isBuffer2(obj) { + return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); + }; + } +}); + +// node_modules/extend/index.js +var require_extend = __commonJS({ + "node_modules/extend/index.js"(exports, module2) { + "use strict"; + var hasOwn3 = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var defineProperty = Object.defineProperty; + var gOPD = Object.getOwnPropertyDescriptor; + var isArray5 = function isArray6(arr) { + if (typeof Array.isArray === "function") { + return Array.isArray(arr); + } + return toStr.call(arr) === "[object Array]"; + }; + var isPlainObject3 = function isPlainObject4(obj) { + if (!obj || toStr.call(obj) !== "[object Object]") { + return false; + } + var hasOwnConstructor = hasOwn3.call(obj, "constructor"); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn3.call(obj.constructor.prototype, "isPrototypeOf"); + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + var key3; + for (key3 in obj) { + } + return typeof key3 === "undefined" || hasOwn3.call(obj, key3); + }; + var setProperty = function setProperty2(target, options) { + if (defineProperty && options.name === "__proto__") { + defineProperty(target, options.name, { + enumerable: true, + configurable: true, + value: options.newValue, + writable: true + }); + } else { + target[options.name] = options.newValue; + } + }; + var getProperty = function getProperty2(obj, name317) { + if (name317 === "__proto__") { + if (!hasOwn3.call(obj, name317)) { + return void 0; + } else if (gOPD) { + return gOPD(obj, name317).value; + } + } + return obj[name317]; + }; + module2.exports = function extend4() { + var options, name317, src, copy, copyIsArray, clone5; + var target = arguments[0]; + var i4 = 1; + var length = arguments.length; + var deep = false; + if (typeof target === "boolean") { + deep = target; + target = arguments[1] || {}; + i4 = 2; + } + if (target == null || typeof target !== "object" && typeof target !== "function") { + target = {}; + } + for (; i4 < length; ++i4) { + options = arguments[i4]; + if (options != null) { + for (name317 in options) { + src = getProperty(target, name317); + copy = getProperty(options, name317); + if (target !== copy) { + if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray5(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone5 = src && isArray5(src) ? src : []; + } else { + clone5 = src && isPlainObject3(src) ? src : {}; + } + setProperty(target, { name: name317, newValue: extend4(deep, clone5, copy) }); + } else if (typeof copy !== "undefined") { + setProperty(target, { name: name317, newValue: copy }); + } + } + } + } + } + return target; + }; + } +}); + // node_modules/react-error-boundary/dist/react-error-boundary.cjs.js var require_react_error_boundary_cjs = __commonJS({ "node_modules/react-error-boundary/dist/react-error-boundary.cjs.js"(exports) { @@ -20673,7 +20914,7 @@ var require_react_error_boundary_cjs = __commonJS({ function hasArrayChanged() { let a4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; let b2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; - return a4.length !== b2.length || a4.some((item, index2) => !Object.is(item, b2[index2])); + return a4.length !== b2.length || a4.some((item, index3) => !Object.is(item, b2[index3])); } function assertErrorBoundaryContext(value) { if (value == null || typeof value.didCatch !== "boolean" || typeof value.resetErrorBoundary !== "function") { @@ -20827,147 +21068,6 @@ var require_es = __commonJS({ } }); -// node_modules/react-style-object-to-css/lib/CSSProperty.js -var require_CSSProperty = __commonJS({ - "node_modules/react-style-object-to-css/lib/CSSProperty.js"(exports, module2) { - "use strict"; - var isUnitlessNumber = { - boxFlex: true, - boxFlexGroup: true, - columnCount: true, - flex: true, - flexGrow: true, - flexPositive: true, - flexShrink: true, - flexNegative: true, - fontWeight: true, - lineClamp: true, - lineHeight: true, - opacity: true, - order: true, - orphans: true, - widows: true, - zIndex: true, - zoom: true, - fillOpacity: true, - strokeDashoffset: true, - strokeOpacity: true, - strokeWidth: true - }; - function prefixKey(prefix, key2) { - return prefix + key2.charAt(0).toUpperCase() + key2.substring(1); - } - var prefixes = ["Webkit", "ms", "Moz", "O"]; - Object.keys(isUnitlessNumber).forEach(function(prop2) { - prefixes.forEach(function(prefix) { - isUnitlessNumber[prefixKey(prefix, prop2)] = isUnitlessNumber[prop2]; - }); - }); - var shorthandPropertyExpansions = { - background: { - backgroundImage: true, - backgroundPosition: true, - backgroundRepeat: true, - backgroundColor: true - }, - border: { - borderWidth: true, - borderStyle: true, - borderColor: true - }, - borderBottom: { - borderBottomWidth: true, - borderBottomStyle: true, - borderBottomColor: true - }, - borderLeft: { - borderLeftWidth: true, - borderLeftStyle: true, - borderLeftColor: true - }, - borderRight: { - borderRightWidth: true, - borderRightStyle: true, - borderRightColor: true - }, - borderTop: { - borderTopWidth: true, - borderTopStyle: true, - borderTopColor: true - }, - font: { - fontStyle: true, - fontVariant: true, - fontWeight: true, - fontSize: true, - lineHeight: true, - fontFamily: true - } - }; - var CSSProperty = { - isUnitlessNumber, - shorthandPropertyExpansions - }; - module2.exports = CSSProperty; - } -}); - -// node_modules/react-style-object-to-css/lib/hyphenateStyleName.js -var require_hyphenateStyleName = __commonJS({ - "node_modules/react-style-object-to-css/lib/hyphenateStyleName.js"(exports, module2) { - "use strict"; - var msPattern = /^ms-/; - var _uppercasePattern = /([A-Z])/g; - function hyphenate(string4) { - return string4.replace(_uppercasePattern, "-$1").toLowerCase(); - } - function hyphenateStyleName(string4) { - return hyphenate(string4).replace(msPattern, "-ms-"); - } - module2.exports = hyphenateStyleName; - } -}); - -// node_modules/react-style-object-to-css/index.js -var require_react_style_object_to_css = __commonJS({ - "node_modules/react-style-object-to-css/index.js"(exports, module2) { - "use strict"; - var isUnitlessNumber = require_CSSProperty().isUnitlessNumber; - var hyphenateStyleName = require_hyphenateStyleName(); - var isArray5 = Array.isArray; - var keys = Object.keys; - var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/; - function buildRule(key2, value) { - if (!isUnitlessNumber[key2] && typeof value === "number") { - value = "" + value + "px"; - } else if (key2 === "content" && !unquotedContentValueRegex.test(value)) { - value = "'" + value.replace(/'/g, "\\'") + "'"; - } - return hyphenateStyleName(key2) + ": " + value + "; "; - } - function styleToCssString(rules) { - var result = ""; - if (!rules || keys(rules).length === 0) { - return result; - } - var styleKeys = keys(rules); - for (var j = 0, l2 = styleKeys.length; j < l2; j++) { - var styleKey = styleKeys[j]; - var value = rules[styleKey]; - if (isArray5(value)) { - for (var i4 = 0, len = value.length; i4 < len; i4++) { - result += buildRule(styleKey, value[i4]); - } - } else { - result += buildRule(styleKey, value); - } - } - return result; - } - module2.exports = styleToCssString; - } -}); - // node_modules/jszip/dist/jszip.min.js var require_jszip_min = __commonJS({ "node_modules/jszip/dist/jszip.min.js"(exports, module2) { @@ -21005,20 +21105,20 @@ var require_jszip_min = __commonJS({ return u3; }({ 1: [function(e5, t5, r2) { "use strict"; - var d4 = e5("./utils"), c3 = e5("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var d4 = e5("./utils"), c3 = e5("./support"), p2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; r2.encode = function(e6) { for (var t6, r3, n3, i4, s4, a4, o2, h3 = [], u3 = 0, l2 = e6.length, f2 = l2, c4 = "string" !== d4.getTypeOf(e6); u3 < e6.length; ) - f2 = l2 - u3, n3 = c4 ? (t6 = e6[u3++], r3 = u3 < l2 ? e6[u3++] : 0, u3 < l2 ? e6[u3++] : 0) : (t6 = e6.charCodeAt(u3++), r3 = u3 < l2 ? e6.charCodeAt(u3++) : 0, u3 < l2 ? e6.charCodeAt(u3++) : 0), i4 = t6 >> 2, s4 = (3 & t6) << 4 | r3 >> 4, a4 = 1 < f2 ? (15 & r3) << 2 | n3 >> 6 : 64, o2 = 2 < f2 ? 63 & n3 : 64, h3.push(p.charAt(i4) + p.charAt(s4) + p.charAt(a4) + p.charAt(o2)); + f2 = l2 - u3, n3 = c4 ? (t6 = e6[u3++], r3 = u3 < l2 ? e6[u3++] : 0, u3 < l2 ? e6[u3++] : 0) : (t6 = e6.charCodeAt(u3++), r3 = u3 < l2 ? e6.charCodeAt(u3++) : 0, u3 < l2 ? e6.charCodeAt(u3++) : 0), i4 = t6 >> 2, s4 = (3 & t6) << 4 | r3 >> 4, a4 = 1 < f2 ? (15 & r3) << 2 | n3 >> 6 : 64, o2 = 2 < f2 ? 63 & n3 : 64, h3.push(p2.charAt(i4) + p2.charAt(s4) + p2.charAt(a4) + p2.charAt(o2)); return h3.join(""); }, r2.decode = function(e6) { var t6, r3, n3, i4, s4, a4, o2 = 0, h3 = 0, u3 = "data:"; if (e6.substr(0, u3.length) === u3) throw new Error("Invalid base64 input, it looks like a data url."); var l2, f2 = 3 * (e6 = e6.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; - if (e6.charAt(e6.length - 1) === p.charAt(64) && f2--, e6.charAt(e6.length - 2) === p.charAt(64) && f2--, f2 % 1 != 0) + if (e6.charAt(e6.length - 1) === p2.charAt(64) && f2--, e6.charAt(e6.length - 2) === p2.charAt(64) && f2--, f2 % 1 != 0) throw new Error("Invalid base64 input, bad content length."); for (l2 = c3.uint8array ? new Uint8Array(0 | f2) : new Array(0 | f2); o2 < e6.length; ) - t6 = p.indexOf(e6.charAt(o2++)) << 2 | (i4 = p.indexOf(e6.charAt(o2++))) >> 4, r3 = (15 & i4) << 4 | (s4 = p.indexOf(e6.charAt(o2++))) >> 2, n3 = (3 & s4) << 6 | (a4 = p.indexOf(e6.charAt(o2++))), l2[h3++] = t6, 64 !== s4 && (l2[h3++] = r3), 64 !== a4 && (l2[h3++] = n3); + t6 = p2.indexOf(e6.charAt(o2++)) << 2 | (i4 = p2.indexOf(e6.charAt(o2++))) >> 4, r3 = (15 & i4) << 4 | (s4 = p2.indexOf(e6.charAt(o2++))) >> 2, n3 = (3 & s4) << 6 | (a4 = p2.indexOf(e6.charAt(o2++))), l2[h3++] = t6, 64 !== s4 && (l2[h3++] = r3), 64 !== a4 && (l2[h3++] = n3); return l2; }; }, { "./support": 30, "./utils": 32 }], 2: [function(e5, t5, r2) { @@ -21112,7 +21212,7 @@ var require_jszip_min = __commonJS({ return n4; } function n3(e6, t6, r3, n4, i5, s5) { - var a4, o2, h3 = e6.file, u3 = e6.compression, l2 = s5 !== O2.utf8encode, f2 = I2.transformTo("string", s5(h3.name)), c3 = I2.transformTo("string", O2.utf8encode(h3.name)), d4 = h3.comment, p = I2.transformTo("string", s5(d4)), m4 = I2.transformTo("string", O2.utf8encode(d4)), _15 = c3.length !== h3.name.length, g = m4.length !== d4.length, b2 = "", v2 = "", y3 = "", w2 = h3.dir, k2 = h3.date, x2 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; + var a4, o2, h3 = e6.file, u3 = e6.compression, l2 = s5 !== O2.utf8encode, f2 = I2.transformTo("string", s5(h3.name)), c3 = I2.transformTo("string", O2.utf8encode(h3.name)), d4 = h3.comment, p2 = I2.transformTo("string", s5(d4)), m4 = I2.transformTo("string", O2.utf8encode(d4)), _15 = c3.length !== h3.name.length, g = m4.length !== d4.length, b2 = "", v2 = "", y3 = "", w2 = h3.dir, k2 = h3.date, x2 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; t6 && !r3 || (x2.crc32 = e6.crc32, x2.compressedSize = e6.compressedSize, x2.uncompressedSize = e6.uncompressedSize); var S3 = 0; t6 && (S3 |= 8), l2 || !_15 && !g || (S3 |= 2048); @@ -21122,9 +21222,9 @@ var require_jszip_min = __commonJS({ return e7 || (r4 = t7 ? 16893 : 33204), (65535 & r4) << 16; }(h3.unixPermissions, w2)) : (C = 20, z2 |= function(e7) { return 63 & (e7 || 0); - }(h3.dosPermissions)), a4 = k2.getUTCHours(), a4 <<= 6, a4 |= k2.getUTCMinutes(), a4 <<= 5, a4 |= k2.getUTCSeconds() / 2, o2 = k2.getUTCFullYear() - 1980, o2 <<= 4, o2 |= k2.getUTCMonth() + 1, o2 <<= 5, o2 |= k2.getUTCDate(), _15 && (v2 = A(1, 1) + A(B2(f2), 4) + c3, b2 += "up" + A(v2.length, 2) + v2), g && (y3 = A(1, 1) + A(B2(p), 4) + m4, b2 += "uc" + A(y3.length, 2) + y3); + }(h3.dosPermissions)), a4 = k2.getUTCHours(), a4 <<= 6, a4 |= k2.getUTCMinutes(), a4 <<= 5, a4 |= k2.getUTCSeconds() / 2, o2 = k2.getUTCFullYear() - 1980, o2 <<= 4, o2 |= k2.getUTCMonth() + 1, o2 <<= 5, o2 |= k2.getUTCDate(), _15 && (v2 = A(1, 1) + A(B2(f2), 4) + c3, b2 += "up" + A(v2.length, 2) + v2), g && (y3 = A(1, 1) + A(B2(p2), 4) + m4, b2 += "uc" + A(y3.length, 2) + y3); var E2 = ""; - return E2 += "\n\0", E2 += A(S3, 2), E2 += u3.magic, E2 += A(a4, 2), E2 += A(o2, 2), E2 += A(x2.crc32, 4), E2 += A(x2.compressedSize, 4), E2 += A(x2.uncompressedSize, 4), E2 += A(f2.length, 2), E2 += A(b2.length, 2), { fileRecord: R2.LOCAL_FILE_HEADER + E2 + f2 + b2, dirRecord: R2.CENTRAL_FILE_HEADER + A(C, 2) + E2 + A(p.length, 2) + "\0\0\0\0" + A(z2, 4) + A(n4, 4) + f2 + b2 + p }; + return E2 += "\n\0", E2 += A(S3, 2), E2 += u3.magic, E2 += A(a4, 2), E2 += A(o2, 2), E2 += A(x2.crc32, 4), E2 += A(x2.compressedSize, 4), E2 += A(x2.uncompressedSize, 4), E2 += A(f2.length, 2), E2 += A(b2.length, 2), { fileRecord: R2.LOCAL_FILE_HEADER + E2 + f2 + b2, dirRecord: R2.CENTRAL_FILE_HEADER + A(C, 2) + E2 + A(p2.length, 2) + "\0\0\0\0" + A(z2, 4) + A(n4, 4) + f2 + b2 + p2 }; } var I2 = e5("../utils"), i4 = e5("../stream/GenericWorker"), O2 = e5("../utf8"), B2 = e5("../crc32"), R2 = e5("../signature"); function s4(e6, t6, r3, n4) { @@ -21322,11 +21422,11 @@ var require_jszip_min = __commonJS({ var a5 = "string" === i5 && false === s5.binary && false === s5.base64; r3 && void 0 !== r3.binary || (s5.binary = !a5), (t6 instanceof c3 && 0 === t6.uncompressedSize || s5.dir || !t6 || 0 === t6.length) && (s5.base64 = false, s5.binary = true, t6 = "", s5.compression = "STORE", i5 = "string"); var o3 = null; - o3 = t6 instanceof c3 || t6 instanceof l2 ? t6 : p.isNode && p.isStream(t6) ? new m4(e6, t6) : u3.prepareContent(e6, t6, s5.binary, s5.optimizedBinaryString, s5.base64); + o3 = t6 instanceof c3 || t6 instanceof l2 ? t6 : p2.isNode && p2.isStream(t6) ? new m4(e6, t6) : u3.prepareContent(e6, t6, s5.binary, s5.optimizedBinaryString, s5.base64); var h4 = new d4(e6, o3, s5); this.files[e6] = h4; } - var i4 = e5("./utf8"), u3 = e5("./utils"), l2 = e5("./stream/GenericWorker"), a4 = e5("./stream/StreamHelper"), f2 = e5("./defaults"), c3 = e5("./compressedObject"), d4 = e5("./zipObject"), o2 = e5("./generate"), p = e5("./nodejsUtils"), m4 = e5("./nodejs/NodejsStreamInputAdapter"), _15 = function(e6) { + var i4 = e5("./utf8"), u3 = e5("./utils"), l2 = e5("./stream/GenericWorker"), a4 = e5("./stream/StreamHelper"), f2 = e5("./defaults"), c3 = e5("./compressedObject"), d4 = e5("./zipObject"), o2 = e5("./generate"), p2 = e5("./nodejsUtils"), m4 = e5("./nodejs/NodejsStreamInputAdapter"), _15 = function(e6) { "/" === e6.slice(-1) && (e6 = e6.substring(0, e6.length - 1)); var t6 = e6.lastIndexOf("/"); return 0 < t6 ? e6.substring(0, t6) : ""; @@ -22213,12 +22313,12 @@ var require_jszip_min = __commonJS({ function i5(e7) { r3 || (r3 = true, l2.resolve(t6, e7)); } - var s5 = p(function() { + var s5 = p2(function() { e6(i5, n4); }); "error" === s5.status && n4(s5.value); } - function p(e6, t6) { + function p2(e6, t6) { var r3 = {}; try { r3.value = e6(t6), r3.status = "success"; @@ -22257,7 +22357,7 @@ var require_jszip_min = __commonJS({ }, h3.prototype.otherCallRejected = function(e6) { f2(this.promise, this.onRejected, e6); }, l2.resolve = function(e6, t6) { - var r3 = p(c3, t6); + var r3 = p2(c3, t6); if ("error" === r3.status) return l2.reject(e6, r3.value); var n4 = r3.value; @@ -22323,9 +22423,9 @@ var require_jszip_min = __commonJS({ }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e5, t5, r2) { "use strict"; var a4 = e5("./zlib/deflate"), o2 = e5("./utils/common"), h3 = e5("./utils/strings"), i4 = e5("./zlib/messages"), s4 = e5("./zlib/zstream"), u3 = Object.prototype.toString, l2 = 0, f2 = -1, c3 = 0, d4 = 8; - function p(e6) { - if (!(this instanceof p)) - return new p(e6); + function p2(e6) { + if (!(this instanceof p2)) + return new p2(e6); this.options = o2.assign({ level: f2, method: d4, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c3, to: "" }, e6 || {}); var t6 = this.options; t6.raw && 0 < t6.windowBits ? t6.windowBits = -t6.windowBits : t6.gzip && 0 < t6.windowBits && t6.windowBits < 16 && (t6.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s4(), this.strm.avail_out = 0; @@ -22340,12 +22440,12 @@ var require_jszip_min = __commonJS({ } } function n3(e6, t6) { - var r3 = new p(t6); + var r3 = new p2(t6); if (r3.push(e6, true), r3.err) throw r3.msg || i4[r3.err]; return r3.result; } - p.prototype.push = function(e6, t6) { + p2.prototype.push = function(e6, t6) { var r3, n4, i5 = this.strm, s5 = this.options.chunkSize; if (this.ended) return false; @@ -22356,18 +22456,18 @@ var require_jszip_min = __commonJS({ 0 !== i5.avail_out && (0 !== i5.avail_in || 4 !== n4 && 2 !== n4) || ("string" === this.options.to ? this.onData(h3.buf2binstring(o2.shrinkBuf(i5.output, i5.next_out))) : this.onData(o2.shrinkBuf(i5.output, i5.next_out))); } while ((0 < i5.avail_in || 0 === i5.avail_out) && 1 !== r3); return 4 === n4 ? (r3 = a4.deflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === l2) : 2 !== n4 || (this.onEnd(l2), !(i5.avail_out = 0)); - }, p.prototype.onData = function(e6) { + }, p2.prototype.onData = function(e6) { this.chunks.push(e6); - }, p.prototype.onEnd = function(e6) { + }, p2.prototype.onEnd = function(e6) { e6 === l2 && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o2.flattenChunks(this.chunks)), this.chunks = [], this.err = e6, this.msg = this.strm.msg; - }, r2.Deflate = p, r2.deflate = n3, r2.deflateRaw = function(e6, t6) { + }, r2.Deflate = p2, r2.deflate = n3, r2.deflateRaw = function(e6, t6) { return (t6 = t6 || {}).raw = true, n3(e6, t6); }, r2.gzip = function(e6, t6) { return (t6 = t6 || {}).gzip = true, n3(e6, t6); }; }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e5, t5, r2) { "use strict"; - var c3 = e5("./zlib/inflate"), d4 = e5("./utils/common"), p = e5("./utils/strings"), m4 = e5("./zlib/constants"), n3 = e5("./zlib/messages"), i4 = e5("./zlib/zstream"), s4 = e5("./zlib/gzheader"), _15 = Object.prototype.toString; + var c3 = e5("./zlib/inflate"), d4 = e5("./utils/common"), p2 = e5("./utils/strings"), m4 = e5("./zlib/constants"), n3 = e5("./zlib/messages"), i4 = e5("./zlib/zstream"), s4 = e5("./zlib/gzheader"), _15 = Object.prototype.toString; function a4(e6) { if (!(this instanceof a4)) return new a4(e6); @@ -22389,11 +22489,11 @@ var require_jszip_min = __commonJS({ var r3, n4, i5, s5, a5, o3, h3 = this.strm, u3 = this.options.chunkSize, l2 = this.options.dictionary, f2 = false; if (this.ended) return false; - n4 = t6 === ~~t6 ? t6 : true === t6 ? m4.Z_FINISH : m4.Z_NO_FLUSH, "string" == typeof e6 ? h3.input = p.binstring2buf(e6) : "[object ArrayBuffer]" === _15.call(e6) ? h3.input = new Uint8Array(e6) : h3.input = e6, h3.next_in = 0, h3.avail_in = h3.input.length; + n4 = t6 === ~~t6 ? t6 : true === t6 ? m4.Z_FINISH : m4.Z_NO_FLUSH, "string" == typeof e6 ? h3.input = p2.binstring2buf(e6) : "[object ArrayBuffer]" === _15.call(e6) ? h3.input = new Uint8Array(e6) : h3.input = e6, h3.next_in = 0, h3.avail_in = h3.input.length; do { - if (0 === h3.avail_out && (h3.output = new d4.Buf8(u3), h3.next_out = 0, h3.avail_out = u3), (r3 = c3.inflate(h3, m4.Z_NO_FLUSH)) === m4.Z_NEED_DICT && l2 && (o3 = "string" == typeof l2 ? p.string2buf(l2) : "[object ArrayBuffer]" === _15.call(l2) ? new Uint8Array(l2) : l2, r3 = c3.inflateSetDictionary(this.strm, o3)), r3 === m4.Z_BUF_ERROR && true === f2 && (r3 = m4.Z_OK, f2 = false), r3 !== m4.Z_STREAM_END && r3 !== m4.Z_OK) + if (0 === h3.avail_out && (h3.output = new d4.Buf8(u3), h3.next_out = 0, h3.avail_out = u3), (r3 = c3.inflate(h3, m4.Z_NO_FLUSH)) === m4.Z_NEED_DICT && l2 && (o3 = "string" == typeof l2 ? p2.string2buf(l2) : "[object ArrayBuffer]" === _15.call(l2) ? new Uint8Array(l2) : l2, r3 = c3.inflateSetDictionary(this.strm, o3)), r3 === m4.Z_BUF_ERROR && true === f2 && (r3 = m4.Z_OK, f2 = false), r3 !== m4.Z_STREAM_END && r3 !== m4.Z_OK) return this.onEnd(r3), !(this.ended = true); - h3.next_out && (0 !== h3.avail_out && r3 !== m4.Z_STREAM_END && (0 !== h3.avail_in || n4 !== m4.Z_FINISH && n4 !== m4.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i5 = p.utf8border(h3.output, h3.next_out), s5 = h3.next_out - i5, a5 = p.buf2string(h3.output, i5), h3.next_out = s5, h3.avail_out = u3 - s5, s5 && d4.arraySet(h3.output, h3.output, i5, s5, 0), this.onData(a5)) : this.onData(d4.shrinkBuf(h3.output, h3.next_out)))), 0 === h3.avail_in && 0 === h3.avail_out && (f2 = true); + h3.next_out && (0 !== h3.avail_out && r3 !== m4.Z_STREAM_END && (0 !== h3.avail_in || n4 !== m4.Z_FINISH && n4 !== m4.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i5 = p2.utf8border(h3.output, h3.next_out), s5 = h3.next_out - i5, a5 = p2.buf2string(h3.output, i5), h3.next_out = s5, h3.avail_out = u3 - s5, s5 && d4.arraySet(h3.output, h3.output, i5, s5, 0), this.onData(a5)) : this.onData(d4.shrinkBuf(h3.output, h3.next_out)))), 0 === h3.avail_in && 0 === h3.avail_out && (f2 = true); } while ((0 < h3.avail_in || 0 === h3.avail_out) && r3 !== m4.Z_STREAM_END); return r3 === m4.Z_STREAM_END && (n4 = m4.Z_FINISH), n4 === m4.Z_FINISH ? (r3 = c3.inflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === m4.Z_OK) : n4 !== m4.Z_SYNC_FLUSH || (this.onEnd(m4.Z_OK), !(h3.avail_out = 0)); }, a4.prototype.onData = function(e6) { @@ -22529,7 +22629,7 @@ var require_jszip_min = __commonJS({ }; }, {}], 46: [function(e5, t5, r2) { "use strict"; - var h3, c3 = e5("../utils/common"), u3 = e5("./trees"), d4 = e5("./adler32"), p = e5("./crc32"), n3 = e5("./messages"), l2 = 0, f2 = 4, m4 = 0, _15 = -2, g = -1, b2 = 4, i4 = 2, v2 = 8, y3 = 9, s4 = 286, a4 = 30, o2 = 19, w2 = 2 * s4 + 1, k2 = 15, x2 = 3, S3 = 258, z2 = S3 + x2 + 1, C = 42, E2 = 113, A = 1, I2 = 2, O2 = 3, B2 = 4; + var h3, c3 = e5("../utils/common"), u3 = e5("./trees"), d4 = e5("./adler32"), p2 = e5("./crc32"), n3 = e5("./messages"), l2 = 0, f2 = 4, m4 = 0, _15 = -2, g = -1, b2 = 4, i4 = 2, v2 = 8, y3 = 9, s4 = 286, a4 = 30, o2 = 19, w2 = 2 * s4 + 1, k2 = 15, x2 = 3, S3 = 258, z2 = S3 + x2 + 1, C = 42, E2 = 113, A = 1, I2 = 2, O2 = 3, B2 = 4; function R2(e6, t6) { return e6.msg = n3[t6], t6; } @@ -22554,17 +22654,17 @@ var require_jszip_min = __commonJS({ e6.pending_buf[e6.pending++] = t6 >>> 8 & 255, e6.pending_buf[e6.pending++] = 255 & t6; } function L2(e6, t6) { - var r3, n4, i5 = e6.max_chain_length, s5 = e6.strstart, a5 = e6.prev_length, o3 = e6.nice_match, h4 = e6.strstart > e6.w_size - z2 ? e6.strstart - (e6.w_size - z2) : 0, u4 = e6.window, l3 = e6.w_mask, f3 = e6.prev, c4 = e6.strstart + S3, d5 = u4[s5 + a5 - 1], p2 = u4[s5 + a5]; + var r3, n4, i5 = e6.max_chain_length, s5 = e6.strstart, a5 = e6.prev_length, o3 = e6.nice_match, h4 = e6.strstart > e6.w_size - z2 ? e6.strstart - (e6.w_size - z2) : 0, u4 = e6.window, l3 = e6.w_mask, f3 = e6.prev, c4 = e6.strstart + S3, d5 = u4[s5 + a5 - 1], p3 = u4[s5 + a5]; e6.prev_length >= e6.good_match && (i5 >>= 2), o3 > e6.lookahead && (o3 = e6.lookahead); do { - if (u4[(r3 = t6) + a5] === p2 && u4[r3 + a5 - 1] === d5 && u4[r3] === u4[s5] && u4[++r3] === u4[s5 + 1]) { + if (u4[(r3 = t6) + a5] === p3 && u4[r3 + a5 - 1] === d5 && u4[r3] === u4[s5] && u4[++r3] === u4[s5 + 1]) { s5 += 2, r3++; do { } while (u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && u4[++s5] === u4[++r3] && s5 < c4); if (n4 = S3 - (c4 - s5), s5 = c4 - S3, a5 < n4) { if (e6.match_start = t6, o3 <= (a5 = n4)) break; - d5 = u4[s5 + a5 - 1], p2 = u4[s5 + a5]; + d5 = u4[s5 + a5 - 1], p3 = u4[s5 + a5]; } } } while ((t6 = f3[t6 & l3]) > h4 && 0 != --i5); @@ -22582,7 +22682,7 @@ var require_jszip_min = __commonJS({ } if (0 === e6.strm.avail_in) break; - if (a5 = e6.strm, o3 = e6.window, h4 = e6.strstart + e6.lookahead, u4 = i5, l3 = void 0, l3 = a5.avail_in, u4 < l3 && (l3 = u4), r3 = 0 === l3 ? 0 : (a5.avail_in -= l3, c3.arraySet(o3, a5.input, a5.next_in, l3, h4), 1 === a5.state.wrap ? a5.adler = d4(a5.adler, o3, l3, h4) : 2 === a5.state.wrap && (a5.adler = p(a5.adler, o3, l3, h4)), a5.next_in += l3, a5.total_in += l3, l3), e6.lookahead += r3, e6.lookahead + e6.insert >= x2) + if (a5 = e6.strm, o3 = e6.window, h4 = e6.strstart + e6.lookahead, u4 = i5, l3 = void 0, l3 = a5.avail_in, u4 < l3 && (l3 = u4), r3 = 0 === l3 ? 0 : (a5.avail_in -= l3, c3.arraySet(o3, a5.input, a5.next_in, l3, h4), 1 === a5.state.wrap ? a5.adler = d4(a5.adler, o3, l3, h4) : 2 === a5.state.wrap && (a5.adler = p2(a5.adler, o3, l3, h4)), a5.next_in += l3, a5.total_in += l3, l3), e6.lookahead += r3, e6.lookahead + e6.insert >= x2) for (s5 = e6.strstart - e6.insert, e6.ins_h = e6.window[s5], e6.ins_h = (e6.ins_h << e6.hash_shift ^ e6.window[s5 + 1]) & e6.hash_mask; e6.insert && (e6.ins_h = (e6.ins_h << e6.hash_shift ^ e6.window[s5 + x2 - 1]) & e6.hash_mask, e6.prev[s5 & e6.w_mask] = e6.head[e6.ins_h], e6.head[e6.ins_h] = s5, s5++, e6.insert--, !(e6.lookahead + e6.insert < x2)); ) ; } while (e6.lookahead < z2 && 0 !== e6.strm.avail_in); @@ -22685,42 +22785,42 @@ var require_jszip_min = __commonJS({ return R2(e6, 0 === e6.avail_out ? -5 : _15); if (n4.strm = e6, r3 = n4.last_flush, n4.last_flush = t6, n4.status === C) if (2 === n4.wrap) - e6.adler = 0, U(n4, 31), U(n4, 139), U(n4, 8), n4.gzhead ? (U(n4, (n4.gzhead.text ? 1 : 0) + (n4.gzhead.hcrc ? 2 : 0) + (n4.gzhead.extra ? 4 : 0) + (n4.gzhead.name ? 8 : 0) + (n4.gzhead.comment ? 16 : 0)), U(n4, 255 & n4.gzhead.time), U(n4, n4.gzhead.time >> 8 & 255), U(n4, n4.gzhead.time >> 16 & 255), U(n4, n4.gzhead.time >> 24 & 255), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 255 & n4.gzhead.os), n4.gzhead.extra && n4.gzhead.extra.length && (U(n4, 255 & n4.gzhead.extra.length), U(n4, n4.gzhead.extra.length >> 8 & 255)), n4.gzhead.hcrc && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending, 0)), n4.gzindex = 0, n4.status = 69) : (U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 3), n4.status = E2); + e6.adler = 0, U(n4, 31), U(n4, 139), U(n4, 8), n4.gzhead ? (U(n4, (n4.gzhead.text ? 1 : 0) + (n4.gzhead.hcrc ? 2 : 0) + (n4.gzhead.extra ? 4 : 0) + (n4.gzhead.name ? 8 : 0) + (n4.gzhead.comment ? 16 : 0)), U(n4, 255 & n4.gzhead.time), U(n4, n4.gzhead.time >> 8 & 255), U(n4, n4.gzhead.time >> 16 & 255), U(n4, n4.gzhead.time >> 24 & 255), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 255 & n4.gzhead.os), n4.gzhead.extra && n4.gzhead.extra.length && (U(n4, 255 & n4.gzhead.extra.length), U(n4, n4.gzhead.extra.length >> 8 & 255)), n4.gzhead.hcrc && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending, 0)), n4.gzindex = 0, n4.status = 69) : (U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 3), n4.status = E2); else { var a5 = v2 + (n4.w_bits - 8 << 4) << 8; a5 |= (2 <= n4.strategy || n4.level < 2 ? 0 : n4.level < 6 ? 1 : 6 === n4.level ? 2 : 3) << 6, 0 !== n4.strstart && (a5 |= 32), a5 += 31 - a5 % 31, n4.status = E2, P3(n4, a5), 0 !== n4.strstart && (P3(n4, e6.adler >>> 16), P3(n4, 65535 & e6.adler)), e6.adler = 1; } if (69 === n4.status) if (n4.gzhead.extra) { - for (i5 = n4.pending; n4.gzindex < (65535 & n4.gzhead.extra.length) && (n4.pending !== n4.pending_buf_size || (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending !== n4.pending_buf_size)); ) + for (i5 = n4.pending; n4.gzindex < (65535 & n4.gzhead.extra.length) && (n4.pending !== n4.pending_buf_size || (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending !== n4.pending_buf_size)); ) U(n4, 255 & n4.gzhead.extra[n4.gzindex]), n4.gzindex++; - n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), n4.gzindex === n4.gzhead.extra.length && (n4.gzindex = 0, n4.status = 73); + n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), n4.gzindex === n4.gzhead.extra.length && (n4.gzindex = 0, n4.status = 73); } else n4.status = 73; if (73 === n4.status) if (n4.gzhead.name) { i5 = n4.pending; do { - if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) { + if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) { s5 = 1; break; } s5 = n4.gzindex < n4.gzhead.name.length ? 255 & n4.gzhead.name.charCodeAt(n4.gzindex++) : 0, U(n4, s5); } while (0 !== s5); - n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.gzindex = 0, n4.status = 91); + n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.gzindex = 0, n4.status = 91); } else n4.status = 91; if (91 === n4.status) if (n4.gzhead.comment) { i5 = n4.pending; do { - if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) { + if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), F(e6), i5 = n4.pending, n4.pending === n4.pending_buf_size)) { s5 = 1; break; } s5 = n4.gzindex < n4.gzhead.comment.length ? 255 & n4.gzhead.comment.charCodeAt(n4.gzindex++) : 0, U(n4, s5); } while (0 !== s5); - n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.status = 103); + n4.gzhead.hcrc && n4.pending > i5 && (e6.adler = p2(e6.adler, n4.pending_buf, n4.pending - i5, i5)), 0 === s5 && (n4.status = 103); } else n4.status = 103; if (103 === n4.status && (n4.gzhead.hcrc ? (n4.pending + 2 > n4.pending_buf_size && F(e6), n4.pending + 2 <= n4.pending_buf_size && (U(n4, 255 & e6.adler), U(n4, e6.adler >> 8 & 255), e6.adler = 0, n4.status = E2)) : n4.status = E2), 0 !== n4.pending) { @@ -22791,14 +22891,14 @@ var require_jszip_min = __commonJS({ }, {}], 48: [function(e5, t5, r2) { "use strict"; t5.exports = function(e6, t6) { - var r3, n3, i4, s4, a4, o2, h3, u3, l2, f2, c3, d4, p, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C; - r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C = e6.output, a4 = s4 - (t6 - e6.avail_out), o2 = s4 + (e6.avail_out - 257), h3 = r3.dmax, u3 = r3.wsize, l2 = r3.whave, f2 = r3.wnext, c3 = r3.window, d4 = r3.hold, p = r3.bits, m4 = r3.lencode, _15 = r3.distcode, g = (1 << r3.lenbits) - 1, b2 = (1 << r3.distbits) - 1; + var r3, n3, i4, s4, a4, o2, h3, u3, l2, f2, c3, d4, p2, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C; + r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C = e6.output, a4 = s4 - (t6 - e6.avail_out), o2 = s4 + (e6.avail_out - 257), h3 = r3.dmax, u3 = r3.wsize, l2 = r3.whave, f2 = r3.wnext, c3 = r3.window, d4 = r3.hold, p2 = r3.bits, m4 = r3.lencode, _15 = r3.distcode, g = (1 << r3.lenbits) - 1, b2 = (1 << r3.distbits) - 1; e: do { - p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = m4[d4 & g]; + p2 < 15 && (d4 += z2[n3++] << p2, p2 += 8, d4 += z2[n3++] << p2, p2 += 8), v2 = m4[d4 & g]; t: for (; ; ) { - if (d4 >>>= y3 = v2 >>> 24, p -= y3, 0 === (y3 = v2 >>> 16 & 255)) + if (d4 >>>= y3 = v2 >>> 24, p2 -= y3, 0 === (y3 = v2 >>> 16 & 255)) C[s4++] = 65535 & v2; else { if (!(16 & y3)) { @@ -22813,10 +22913,10 @@ var require_jszip_min = __commonJS({ e6.msg = "invalid literal/length code", r3.mode = 30; break e; } - w2 = 65535 & v2, (y3 &= 15) && (p < y3 && (d4 += z2[n3++] << p, p += 8), w2 += d4 & (1 << y3) - 1, d4 >>>= y3, p -= y3), p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = _15[d4 & b2]; + w2 = 65535 & v2, (y3 &= 15) && (p2 < y3 && (d4 += z2[n3++] << p2, p2 += 8), w2 += d4 & (1 << y3) - 1, d4 >>>= y3, p2 -= y3), p2 < 15 && (d4 += z2[n3++] << p2, p2 += 8, d4 += z2[n3++] << p2, p2 += 8), v2 = _15[d4 & b2]; r: for (; ; ) { - if (d4 >>>= y3 = v2 >>> 24, p -= y3, !(16 & (y3 = v2 >>> 16 & 255))) { + if (d4 >>>= y3 = v2 >>> 24, p2 -= y3, !(16 & (y3 = v2 >>> 16 & 255))) { if (0 == (64 & y3)) { v2 = _15[(65535 & v2) + (d4 & (1 << y3) - 1)]; continue r; @@ -22824,11 +22924,11 @@ var require_jszip_min = __commonJS({ e6.msg = "invalid distance code", r3.mode = 30; break e; } - if (k2 = 65535 & v2, p < (y3 &= 15) && (d4 += z2[n3++] << p, (p += 8) < y3 && (d4 += z2[n3++] << p, p += 8)), h3 < (k2 += d4 & (1 << y3) - 1)) { + if (k2 = 65535 & v2, p2 < (y3 &= 15) && (d4 += z2[n3++] << p2, (p2 += 8) < y3 && (d4 += z2[n3++] << p2, p2 += 8)), h3 < (k2 += d4 & (1 << y3) - 1)) { e6.msg = "invalid distance too far back", r3.mode = 30; break e; } - if (d4 >>>= y3, p -= y3, (y3 = s4 - a4) < k2) { + if (d4 >>>= y3, p2 -= y3, (y3 = s4 - a4) < k2) { if (l2 < (y3 = k2 - y3) && r3.sane) { e6.msg = "invalid distance too far back", r3.mode = 30; break e; @@ -22868,7 +22968,7 @@ var require_jszip_min = __commonJS({ break; } } while (n3 < i4 && s4 < o2); - n3 -= w2 = p >> 3, d4 &= (1 << (p -= w2 << 3)) - 1, e6.next_in = n3, e6.next_out = s4, e6.avail_in = n3 < i4 ? i4 - n3 + 5 : 5 - (n3 - i4), e6.avail_out = s4 < o2 ? o2 - s4 + 257 : 257 - (s4 - o2), r3.hold = d4, r3.bits = p; + n3 -= w2 = p2 >> 3, d4 &= (1 << (p2 -= w2 << 3)) - 1, e6.next_in = n3, e6.next_out = s4, e6.avail_in = n3 < i4 ? i4 - n3 + 5 : 5 - (n3 - i4), e6.avail_out = s4 < o2 ? o2 - s4 + 257 : 257 - (s4 - o2), r3.hold = d4, r3.bits = p2; }; }, {}], 49: [function(e5, t5, r2) { "use strict"; @@ -22920,7 +23020,7 @@ var require_jszip_min = __commonJS({ r2.inflateReset = o2, r2.inflateReset2 = h3, r2.inflateResetKeep = a4, r2.inflateInit = function(e6) { return u3(e6, 15); }, r2.inflateInit2 = u3, r2.inflate = function(e6, t6) { - var r3, n4, i5, s5, a5, o3, h4, u4, l3, f3, c4, d4, p, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C = 0, E2 = new I2.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + var r3, n4, i5, s5, a5, o3, h4, u4, l3, f3, c4, d4, p2, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C = 0, E2 = new I2.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!e6 || !e6.state || !e6.output || !e6.input && 0 !== e6.avail_in) return U; 12 === (r3 = e6.state).mode && (r3.mode = 13), a5 = e6.next_out, i5 = e6.output, h4 = e6.avail_out, s5 = e6.next_in, n4 = e6.input, o3 = e6.avail_in, u4 = r3.hold, l3 = r3.bits, f3 = o3, c4 = h4, x2 = N; @@ -23273,10 +23373,10 @@ var require_jszip_min = __commonJS({ e6.msg = "invalid distance too far back", r3.mode = 30; break; } - p = d4 > r3.wnext ? (d4 -= r3.wnext, r3.wsize - d4) : r3.wnext - d4, d4 > r3.length && (d4 = r3.length), m4 = r3.window; + p2 = d4 > r3.wnext ? (d4 -= r3.wnext, r3.wsize - d4) : r3.wnext - d4, d4 > r3.length && (d4 = r3.length), m4 = r3.window; } else - m4 = i5, p = a5 - r3.offset, d4 = r3.length; - for (h4 < d4 && (d4 = h4), h4 -= d4, r3.length -= d4; i5[a5++] = m4[p++], --d4; ) + m4 = i5, p2 = a5 - r3.offset, d4 = r3.length; + for (h4 < d4 && (d4 = h4), h4 -= d4, r3.length -= d4; i5[a5++] = m4[p2++], --d4; ) ; 0 === r3.length && (r3.mode = 21); break; @@ -23342,7 +23442,7 @@ var require_jszip_min = __commonJS({ "use strict"; var D2 = e5("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P3 = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; t5.exports = function(e6, t6, r3, n3, i4, s4, a4, o2) { - var h3, u3, l2, f2, c3, d4, p, m4, _15, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C = 0, E2 = 0, A = null, I2 = 0, O2 = new D2.Buf16(16), B2 = new D2.Buf16(16), R2 = null, T3 = 0; + var h3, u3, l2, f2, c3, d4, p2, m4, _15, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C = 0, E2 = 0, A = null, I2 = 0, O2 = new D2.Buf16(16), B2 = new D2.Buf16(16), R2 = null, T3 = 0; for (b2 = 0; b2 <= 15; b2++) O2[b2] = 0; for (v2 = 0; v2 < n3; v2++) @@ -23365,7 +23465,7 @@ var require_jszip_min = __commonJS({ if (d4 = 0 === e6 ? (A = R2 = a4, 19) : 1 === e6 ? (A = F, I2 -= 257, R2 = N, T3 -= 257, 256) : (A = U, R2 = P3, -1), b2 = y3, c3 = s4, S3 = v2 = E2 = 0, l2 = -1, f2 = (C = 1 << (x2 = k2)) - 1, 1 === e6 && 852 < C || 2 === e6 && 592 < C) return 1; for (; ; ) { - for (p = b2 - S3, _15 = a4[v2] < d4 ? (m4 = 0, a4[v2]) : a4[v2] > d4 ? (m4 = R2[T3 + a4[v2]], A[I2 + a4[v2]]) : (m4 = 96, 0), h3 = 1 << b2 - S3, y3 = u3 = 1 << x2; i4[c3 + (E2 >> S3) + (u3 -= h3)] = p << 24 | m4 << 16 | _15 | 0, 0 !== u3; ) + for (p2 = b2 - S3, _15 = a4[v2] < d4 ? (m4 = 0, a4[v2]) : a4[v2] > d4 ? (m4 = R2[T3 + a4[v2]], A[I2 + a4[v2]]) : (m4 = 96, 0), h3 = 1 << b2 - S3, y3 = u3 = 1 << x2; i4[c3 + (E2 >> S3) + (u3 -= h3)] = p2 << 24 | m4 << 16 | _15 | 0, 0 !== u3; ) ; for (h3 = 1 << b2 - 1; E2 & h3; ) h3 >>= 1; @@ -23394,7 +23494,7 @@ var require_jszip_min = __commonJS({ for (var t6 = e6.length; 0 <= --t6; ) e6[t6] = 0; } - var s4 = 0, a4 = 29, u3 = 256, l2 = u3 + 1 + a4, f2 = 30, c3 = 19, _15 = 2 * l2 + 1, g = 15, d4 = 16, p = 7, m4 = 256, b2 = 16, v2 = 17, y3 = 18, w2 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k2 = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S3 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z2 = new Array(2 * (l2 + 2)); + var s4 = 0, a4 = 29, u3 = 256, l2 = u3 + 1 + a4, f2 = 30, c3 = 19, _15 = 2 * l2 + 1, g = 15, d4 = 16, p2 = 7, m4 = 256, b2 = 16, v2 = 17, y3 = 18, w2 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k2 = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S3 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z2 = new Array(2 * (l2 + 2)); n3(z2); var C = new Array(2 * f2); n3(C); @@ -23477,18 +23577,18 @@ var require_jszip_min = __commonJS({ for (i5 = h4; r3 = e6.heap[1], e6.heap[1] = e6.heap[e6.heap_len--], G2(e6, s5, 1), n4 = e6.heap[1], e6.heap[--e6.heap_max] = r3, e6.heap[--e6.heap_max] = n4, s5[2 * i5] = s5[2 * r3] + s5[2 * n4], e6.depth[i5] = (e6.depth[r3] >= e6.depth[n4] ? e6.depth[r3] : e6.depth[n4]) + 1, s5[2 * r3 + 1] = s5[2 * n4 + 1] = i5, e6.heap[1] = i5++, G2(e6, s5, 1), 2 <= e6.heap_len; ) ; e6.heap[--e6.heap_max] = e6.heap[1], function(e7, t7) { - var r4, n5, i6, s6, a6, o4, h5 = t7.dyn_tree, u5 = t7.max_code, l3 = t7.stat_desc.static_tree, f3 = t7.stat_desc.has_stree, c4 = t7.stat_desc.extra_bits, d5 = t7.stat_desc.extra_base, p2 = t7.stat_desc.max_length, m5 = 0; + var r4, n5, i6, s6, a6, o4, h5 = t7.dyn_tree, u5 = t7.max_code, l3 = t7.stat_desc.static_tree, f3 = t7.stat_desc.has_stree, c4 = t7.stat_desc.extra_bits, d5 = t7.stat_desc.extra_base, p3 = t7.stat_desc.max_length, m5 = 0; for (s6 = 0; s6 <= g; s6++) e7.bl_count[s6] = 0; for (h5[2 * e7.heap[e7.heap_max] + 1] = 0, r4 = e7.heap_max + 1; r4 < _15; r4++) - p2 < (s6 = h5[2 * h5[2 * (n5 = e7.heap[r4]) + 1] + 1] + 1) && (s6 = p2, m5++), h5[2 * n5 + 1] = s6, u5 < n5 || (e7.bl_count[s6]++, a6 = 0, d5 <= n5 && (a6 = c4[n5 - d5]), o4 = h5[2 * n5], e7.opt_len += o4 * (s6 + a6), f3 && (e7.static_len += o4 * (l3[2 * n5 + 1] + a6))); + p3 < (s6 = h5[2 * h5[2 * (n5 = e7.heap[r4]) + 1] + 1] + 1) && (s6 = p3, m5++), h5[2 * n5 + 1] = s6, u5 < n5 || (e7.bl_count[s6]++, a6 = 0, d5 <= n5 && (a6 = c4[n5 - d5]), o4 = h5[2 * n5], e7.opt_len += o4 * (s6 + a6), f3 && (e7.static_len += o4 * (l3[2 * n5 + 1] + a6))); if (0 !== m5) { do { - for (s6 = p2 - 1; 0 === e7.bl_count[s6]; ) + for (s6 = p3 - 1; 0 === e7.bl_count[s6]; ) s6--; - e7.bl_count[s6]--, e7.bl_count[s6 + 1] += 2, e7.bl_count[p2]--, m5 -= 2; + e7.bl_count[s6]--, e7.bl_count[s6 + 1] += 2, e7.bl_count[p3]--, m5 -= 2; } while (0 < m5); - for (s6 = p2; 0 !== s6; s6--) + for (s6 = p3; 0 !== s6; s6--) for (n5 = e7.bl_count[s6]; 0 !== n5; ) u5 < (i6 = e7.heap[--r4]) || (h5[2 * i6 + 1] !== s6 && (e7.opt_len += (s6 - h5[2 * i6 + 1]) * h5[2 * i6], h5[2 * i6 + 1] = s6), n5--); } @@ -23542,7 +23642,7 @@ var require_jszip_min = __commonJS({ z2[2 * e7 + 1] = 8, e7++, s5[8]++; for (Z(z2, l2 + 1, s5), e7 = 0; e7 < f2; e7++) C[2 * e7 + 1] = 5, C[2 * e7] = j(e7, 5); - O2 = new D2(z2, w2, u3 + 1, l2, g), B2 = new D2(C, k2, 0, f2, g), R2 = new D2(new Array(0), x2, 0, c3, p); + O2 = new D2(z2, w2, u3 + 1, l2, g), B2 = new D2(C, k2, 0, f2, g), R2 = new D2(new Array(0), x2, 0, c3, p2); }(), q2 = true), e6.l_desc = new F(e6.dyn_ltree, O2), e6.d_desc = new F(e6.dyn_dtree, B2), e6.bl_desc = new F(e6.bl_tree, R2), e6.bi_buf = 0, e6.bi_valid = 0, W(e6); }, r2._tr_stored_block = J, r2._tr_flush_block = function(e6, t6, r3, n4) { var i5, s5, a5 = 0; @@ -23716,8 +23816,8 @@ var require_sql_wasm = __commonJS({ } } function b2(g, m4) { - for (var n3 = [], p = 0; p < g; p += 1) { - var v2 = l2(m4 + 4 * p, "i32"), y3 = kc(v2); + for (var n3 = [], p2 = 0; p2 < g; p2 += 1) { + var v2 = l2(m4 + 4 * p2, "i32"), y3 = kc(v2); if (1 === y3 || 2 === y3) v2 = lc(v2); else if (3 === y3) @@ -23754,13 +23854,13 @@ var require_sql_wasm = __commonJS({ function f2(g) { this.filename = "dbfile_" + (4294967295 * Math.random() >>> 0); if (null != g) { - var m4 = this.filename, n3 = "/", p = m4; - n3 && (n3 = "string" == typeof n3 ? n3 : ea(n3), p = m4 ? z2(n3 + "/" + m4) : n3); + var m4 = this.filename, n3 = "/", p2 = m4; + n3 && (n3 = "string" == typeof n3 ? n3 : ea(n3), p2 = m4 ? z2(n3 + "/" + m4) : n3); m4 = fa( true, true ); - p = ha(p, (void 0 !== m4 ? m4 : 438) & 4095 | 32768, 0); + p2 = ha(p2, (void 0 !== m4 ? m4 : 438) & 4095 | 32768, 0); if (g) { if ("string" == typeof g) { n3 = Array(g.length); @@ -23768,11 +23868,11 @@ var require_sql_wasm = __commonJS({ n3[v2] = g.charCodeAt(v2); g = n3; } - ia(p, m4 | 146); - n3 = ja(p, 577); + ia(p2, m4 | 146); + n3 = ja(p2, 577); ka(n3, g, 0, g.length, 0); la(n3); - ia(p, m4); + ia(p2, m4); } } this.handleError(q2(this.filename, h3)); @@ -23837,28 +23937,28 @@ var require_sql_wasm = __commonJS({ null == g && (g = this.Ja, this.Ja += 1); var m4 = Bc(this.La, g); g = Ac(this.La, g); - for (var n3 = new Uint8Array(m4), p = 0; p < m4; p += 1) - n3[p] = r2[g + p]; + for (var n3 = new Uint8Array(m4), p2 = 0; p2 < m4; p2 += 1) + n3[p2] = r2[g + p2]; return n3; }; c3.prototype.get = function(g, m4) { m4 = m4 || {}; null != g && this.bind(g) && this.step(); g = []; - for (var n3 = yc(this.La), p = 0; p < n3; p += 1) - switch (Cc(this.La, p)) { + for (var n3 = yc(this.La), p2 = 0; p2 < n3; p2 += 1) + switch (Cc(this.La, p2)) { case 1: - var v2 = m4.useBigInt ? this.Cb(p) : this.sb(p); + var v2 = m4.useBigInt ? this.Cb(p2) : this.sb(p2); g.push(v2); break; case 2: - g.push(this.sb(p)); + g.push(this.sb(p2)); break; case 3: - g.push(this.Db(p)); + g.push(this.Db(p2)); break; case 4: - g.push(this.getBlob(p)); + g.push(this.getBlob(p2)); break; default: g.push(null); @@ -23873,8 +23973,8 @@ var require_sql_wasm = __commonJS({ c3.prototype.getAsObject = function(g, m4) { g = this.get(g, m4); m4 = this.getColumnNames(); - for (var n3 = {}, p = 0; p < m4.length; p += 1) - n3[m4[p]] = g[p]; + for (var n3 = {}, p2 = 0; p2 < m4.length; p2 += 1) + n3[m4[p2]] = g[p2]; return n3; }; c3.prototype.getSQL = function() { @@ -23939,8 +24039,8 @@ var require_sql_wasm = __commonJS({ c3.prototype.yb = function(g) { var m4 = this; Object.keys(g).forEach(function(n3) { - var p = uc(m4.La, n3); - 0 !== p && m4.ob(g[n3], p); + var p2 = uc(m4.La, n3); + 0 !== p2 && m4.ob(g[n3], p2); }); return true; }; @@ -23982,8 +24082,8 @@ var require_sql_wasm = __commonJS({ this.Ua = new c3(n3, this.db); this.db.Za[n3] = this.Ua; return { value: this.Ua, done: false }; - } catch (p) { - throw this.ib = C(this.eb), this.gb(), p; + } catch (p2) { + throw this.ib = C(this.eb), this.gb(), p2; } finally { qa(g); } @@ -24015,7 +24115,7 @@ var require_sql_wasm = __commonJS({ f2.prototype.exec = function(g, m4, n3) { if (!this.db) throw "Database closed"; - var p = oa(), v2 = null; + var p2 = oa(), v2 = null; try { var y3 = ca(g) + 1, L2 = B2(y3); t5(g, r2, L2, y3); @@ -24039,11 +24139,11 @@ var require_sql_wasm = __commonJS({ } catch (na) { throw v2 && v2.free(), na; } finally { - qa(p); + qa(p2); } }; - f2.prototype.each = function(g, m4, n3, p, v2) { - "function" === typeof m4 && (p = n3, n3 = m4, m4 = void 0); + f2.prototype.each = function(g, m4, n3, p2, v2) { + "function" === typeof m4 && (p2 = n3, n3 = m4, m4 = void 0); g = this.prepare(g, m4); try { for (; g.step(); ) @@ -24051,8 +24151,8 @@ var require_sql_wasm = __commonJS({ } finally { g.free(); } - if ("function" === typeof p) - return p(); + if ("function" === typeof p2) + return p2(); }; f2.prototype.prepare = function(g, m4) { pa(h3); @@ -24095,15 +24195,15 @@ var require_sql_wasm = __commonJS({ }; f2.prototype.create_function = function(g, m4) { Object.prototype.hasOwnProperty.call(this.Na, g) && (ra(this.Na[g]), delete this.Na[g]); - var n3 = ua(function(p, v2, y3) { + var n3 = ua(function(p2, v2, y3) { v2 = b2(v2, y3); try { var L2 = m4.apply(null, v2); } catch (G2) { - xa(p, G2, -1); + xa(p2, G2, -1); return; } - a4(p, L2); + a4(p2, L2); }, "viii"); this.Na[g] = n3; this.handleError(rb(this.db, g, m4.length, 1, 0, n3, 0, 0, 0)); @@ -24112,7 +24212,7 @@ var require_sql_wasm = __commonJS({ f2.prototype.create_aggregate = function(g, m4) { var n3 = m4.init || function() { return null; - }, p = m4.finalize || function(H3) { + }, p2 = m4.finalize || function(H3) { return H3; }, v2 = m4.step; if (!v2) @@ -24134,7 +24234,7 @@ var require_sql_wasm = __commonJS({ }, "viii"), G2 = ua(function(H3) { var I2 = sb(H3, 1); try { - var na = p(y3[I2]); + var na = p2(y3[I2]); } catch (Z) { delete y3[I2]; xa(H3, Z, -1); @@ -26113,11 +26213,11 @@ var require_pica = __commonJS({ var a4 = new Error("Cannot find module '" + i5 + "'"); throw a4.code = "MODULE_NOT_FOUND", a4; } - var p = n3[i5] = { exports: {} }; - e5[i5][0].call(p.exports, function(r3) { + var p2 = n3[i5] = { exports: {} }; + e5[i5][0].call(p2.exports, function(r3) { var n4 = e5[i5][1][r3]; return o2(n4 || r3); - }, p, p.exports, r2, e5, n3, t5); + }, p2, p2.exports, r2, e5, n3, t5); } return n3[i5].exports; } @@ -26545,9 +26645,9 @@ var require_pica = __commonJS({ return; } for (var ptr = target_offset, i4 = 0; i4 < src.length; i4++) { - var data2 = src[i4]; - target[ptr++] = data2 & 255; - target[ptr++] = data2 >> 8 & 255; + var data3 = src[i4]; + target[ptr++] = data3 & 255; + target[ptr++] = data3 >> 8 & 255; } } module4.exports = function resize_wasm(options) { @@ -26684,8 +26784,8 @@ var require_pica = __commonJS({ }, {}], 13: [function(_dereq_, module4, exports3) { "use strict"; var GC_INTERVAL = 100; - function Pool(create2, idle) { - this.create = create2; + function Pool(create3, idle) { + this.create = create3; this.available = []; this.acquired = {}; this.lastId = 1; @@ -26832,15 +26932,15 @@ var require_pica = __commonJS({ function objClass(obj) { return Object.prototype.toString.call(obj); } - module4.exports.isCanvas = function isCanvas(element) { - var cname = objClass(element); + module4.exports.isCanvas = function isCanvas(element3) { + var cname = objClass(element3); return cname === "[object HTMLCanvasElement]" || cname === "[object OffscreenCanvas]" || cname === "[object Canvas]"; }; - module4.exports.isImage = function isImage(element) { - return objClass(element) === "[object HTMLImageElement]"; + module4.exports.isImage = function isImage(element3) { + return objClass(element3) === "[object HTMLImageElement]"; }; - module4.exports.isImageBitmap = function isImageBitmap(element) { - return objClass(element) === "[object ImageBitmap]"; + module4.exports.isImageBitmap = function isImageBitmap(element3) { + return objClass(element3) === "[object ImageBitmap]"; }; module4.exports.limiter = function limiter(concurrency) { var active = 0, queue = []; @@ -26920,8 +27020,8 @@ var require_pica = __commonJS({ return self2.postMessage(false); }); } - var code = btoa("(".concat(workerPayload.toString(), ")(self);")); - var w2 = new Worker("data:text/javascript;base64,".concat(code)); + var code3 = btoa("(".concat(workerPayload.toString(), ")(self);")); + var w2 = new Worker("data:text/javascript;base64,".concat(code3)); w2.onmessage = function(ev) { return resolve2(ev.data); }; @@ -26962,11 +27062,11 @@ var require_pica = __commonJS({ resolve2(false); return; } - var image = new Image(); - image.src = "data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z"; - image.onload = function() { - createImageBitmap(image, 0, 0, image.width, image.height).then(function(bitmap) { - if (bitmap.width === image.width && bitmap.height === image.height) { + var image3 = new Image(); + image3.src = "data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z"; + image3.onload = function() { + createImageBitmap(image3, 0, 0, image3.width, image3.height).then(function(bitmap) { + if (bitmap.width === image3.width && bitmap.height === image3.height) { resolve2(true); } else { resolve2(false); @@ -26975,7 +27075,7 @@ var require_pica = __commonJS({ return resolve2(false); }); }; - image.onerror = function() { + image3.onerror = function() { return resolve2(false); }; }); @@ -27000,9 +27100,9 @@ var require_pica = __commonJS({ } if (!mathLib) mathLib = new MathLib(ev.data.features); - var data2 = mathLib.resizeAndUnsharp(tileOpts); + var data3 = mathLib.resizeAndUnsharp(tileOpts); if (returnBitmap) { - var toImageData = new ImageData(new Uint8ClampedArray(data2), tileOpts.toWidth, tileOpts.toHeight); + var toImageData = new ImageData(new Uint8ClampedArray(data3), tileOpts.toWidth, tileOpts.toHeight); var _canvas = new OffscreenCanvas(tileOpts.toWidth, tileOpts.toHeight); var _ctx = _canvas.getContext("2d"); _ctx.putImageData(toImageData, 0, 0); @@ -27013,8 +27113,8 @@ var require_pica = __commonJS({ }); } else { postMessage({ - data: data2 - }, [data2.buffer]); + data: data3 + }, [data3.buffer]); } }; }; @@ -27182,10 +27282,10 @@ var require_pica = __commonJS({ } return this.__cache[name317]; }; - MultiMath.prototype.__align = function align(number4, base2) { - base2 = base2 || 8; - var reminder = number4 % base2; - return number4 + (reminder ? base2 - reminder : 0); + MultiMath.prototype.__align = function align(number5, base3) { + base3 = base3 || 8; + var reminder = number5 % base3; + return number5 + (reminder ? base3 - reminder : 0); }; module4.exports = MultiMath; }, { "./lib/base64decode": 20, "./lib/wa_detect": 21, "object-assign": 22 }], 20: [function(_dereq_, module4, exports3) { @@ -27240,7 +27340,7 @@ var require_pica = __commonJS({ }, {}], 22: [function(_dereq_, module4, exports3) { "use strict"; var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty3 = Object.prototype.hasOwnProperty; + var hasOwnProperty4 = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject2(val) { if (val === null || val === void 0) { @@ -27286,9 +27386,9 @@ var require_pica = __commonJS({ var symbols; for (var s4 = 1; s4 < arguments.length; s4++) { from = Object(arguments[s4]); - for (var key2 in from) { - if (hasOwnProperty3.call(from, key2)) { - to2[key2] = from[key2]; + for (var key3 in from) { + if (hasOwnProperty4.call(from, key3)) { + to2[key3] = from[key3]; } } if (getOwnPropertySymbols) { @@ -27306,15 +27406,15 @@ var require_pica = __commonJS({ var bundleFn = arguments[3]; var sources = arguments[4]; var cache2 = arguments[5]; - var stringify3 = JSON.stringify; + var stringify5 = JSON.stringify; module4.exports = function(fn, options) { var wkey; var cacheKeys = Object.keys(cache2); for (var i4 = 0, l2 = cacheKeys.length; i4 < l2; i4++) { - var key2 = cacheKeys[i4]; - var exp3 = cache2[key2].exports; + var key3 = cacheKeys[i4]; + var exp3 = cache2[key3].exports; if (exp3 === fn || exp3 && exp3.default === fn) { - wkey = key2; + wkey = key3; break; } } @@ -27322,8 +27422,8 @@ var require_pica = __commonJS({ wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); var wcache = {}; for (var i4 = 0, l2 = cacheKeys.length; i4 < l2; i4++) { - var key2 = cacheKeys[i4]; - wcache[key2] = key2; + var key3 = cacheKeys[i4]; + wcache[key3] = key3; } sources[wkey] = [ "function(require,module,exports){" + fn + "(self); }", @@ -27334,23 +27434,23 @@ var require_pica = __commonJS({ var scache = {}; scache[wkey] = wkey; sources[skey] = [ - "function(require,module,exports){var f = require(" + stringify3(wkey) + ");(f.default ? f.default : f)(self);}", + "function(require,module,exports){var f = require(" + stringify5(wkey) + ");(f.default ? f.default : f)(self);}", scache ]; var workerSources = {}; resolveSources(skey); - function resolveSources(key3) { - workerSources[key3] = true; - for (var depPath in sources[key3][1]) { - var depKey = sources[key3][1][depPath]; + function resolveSources(key4) { + workerSources[key4] = true; + for (var depPath in sources[key4][1]) { + var depKey = sources[key4][1][depPath]; if (!workerSources[depKey]) { resolveSources(depKey); } } } - var src = "(" + bundleFn + ")({" + Object.keys(workerSources).map(function(key3) { - return stringify3(key3) + ":[" + sources[key3][0] + "," + stringify3(sources[key3][1]) + "]"; - }).join(",") + "},{},[" + stringify3(skey) + "])"; + var src = "(" + bundleFn + ")({" + Object.keys(workerSources).map(function(key4) { + return stringify5(key4) + ":[" + sources[key4][0] + "," + stringify5(sources[key4][1]) + "]"; + }).join(",") + "},{},[" + stringify5(skey) + "])"; var URL2 = window.URL || window.webkitURL || window.mozURL || window.msURL; var blob = new Blob([src], { type: "text/javascript" }); if (options && options.bare) { @@ -27851,9 +27951,9 @@ var require_pica = __commonJS({ opts.unsharpRadius = 2; opts.canceled = false; if (opts.cancelToken) { - opts.cancelToken = opts.cancelToken.then(function(data2) { + opts.cancelToken = opts.cancelToken.then(function(data3) { opts.canceled = true; - throw data2; + throw data3; }, function(err) { opts.canceled = true; throw err; @@ -27935,7 +28035,7 @@ __export(main_exports, { module.exports = __toCommonJS(main_exports); // src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx -var import_state10 = require("@codemirror/state"); +var import_state11 = require("@codemirror/state"); var import_view10 = require("@codemirror/view"); // src/adapters/obsidian/ui/editors/markdownView/tooltip.ts @@ -28142,12 +28242,12 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( }; } writeMeasure(measured) { - const { editor, space: space2 } = measured; + const { editor, space: space3 } = measured; const others = []; for (let i4 = 0; i4 < this.manager.tooltips.length; i4++) { const tooltip = this.manager.tooltips[i4], tView = this.manager.tooltipViews[i4], { dom } = tView; const pos = measured.pos[i4], size2 = measured.size[i4]; - if (!pos || pos.bottom <= Math.max(editor.top, space2.top) || pos.top >= Math.min(editor.bottom, space2.bottom) || pos.right < Math.max(editor.left, space2.left) - 0.1 || pos.left > Math.min(editor.right, space2.right) + 0.1) { + if (!pos || pos.bottom <= Math.max(editor.top, space3.top) || pos.top >= Math.min(editor.bottom, space3.bottom) || pos.right < Math.max(editor.left, space3.left) - 0.1 || pos.left > Math.min(editor.right, space3.right) + 0.1) { dom.style.top = Outside; continue; } @@ -28155,15 +28255,15 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( const arrowHeight = arrow ? 7 /* Size */ : 0; const width = size2.right - size2.left, height = size2.bottom - size2.top; const offset2 = tView.offset || noOffset, ltr = this.view.textDirection == import_view.Direction.LTR; - const left = size2.width > space2.right - space2.left ? ltr ? space2.left : space2.right - size2.width : ltr ? Math.min( + const left = size2.width > space3.right - space3.left ? ltr ? space3.left : space3.right - size2.width : ltr ? Math.min( pos.left - (arrow ? 14 /* Offset */ : 0) + offset2.x, - space2.right - width + space3.right - width ) : Math.max( - space2.left, + space3.left, pos.left - width + (arrow ? 14 /* Offset */ : 0) - offset2.x ); let above = !!tooltip.above; - if (!tooltip.strictSide && (above ? pos.top - (size2.bottom - size2.top) - offset2.y < space2.top : pos.bottom + (size2.bottom - size2.top) + offset2.y > space2.bottom) && above == space2.bottom - pos.bottom > pos.top - space2.top) + if (!tooltip.strictSide && (above ? pos.top - (size2.bottom - size2.top) - offset2.y < space3.top : pos.bottom + (size2.bottom - size2.top) + offset2.y > space3.bottom) && above == space3.bottom - pos.bottom > pos.top - space3.top) above = !above; let top = above ? pos.top - height - arrowHeight - offset2.y : pos.bottom + arrowHeight + offset2.y; const right = left + width; @@ -28504,24 +28604,24 @@ function hoverTooltip(source, options = {}) { create() { return null; }, - update(value, tr) { - if (value && options.hideOnChange && (tr.docChanged || tr.selection)) + update(value, tr2) { + if (value && options.hideOnChange && (tr2.docChanged || tr2.selection)) return null; - for (const effect of tr.effects) { + for (const effect of tr2.effects) { if (effect.is(setHover)) { return effect.value; } if (effect.is(closeHoverTooltipEffect)) return null; } - if (value && tr.docChanged) { - const newPos = tr.changes.mapPos(value.pos, -1, import_state.MapMode.TrackDel); + if (value && tr2.docChanged) { + const newPos = tr2.changes.mapPos(value.pos, -1, import_state.MapMode.TrackDel); if (newPos == null) return null; const copy = Object.assign(/* @__PURE__ */ Object.create(null), value); copy.pos = newPos; if (value.end != null) - copy.end = tr.changes.mapPos(value.end); + copy.end = tr2.changes.mapPos(value.end); return copy; } return value; @@ -28589,17 +28689,17 @@ var portalTypeAnnotation = import_state2.Annotation.define(); var flowIDAnnotation = import_state2.Annotation.define(); var flowIDStateField = import_state2.StateField.define({ create: () => void 0, - update(value, tr) { - if (tr.annotation(flowIDAnnotation)) - return tr.annotation(flowIDAnnotation); + update(value, tr2) { + if (tr2.annotation(flowIDAnnotation)) + return tr2.annotation(flowIDAnnotation); return value; } }); var flowTypeStateField = import_state2.StateField.define({ create: (state) => "none", - update(value, tr) { - if (tr.annotation(portalTypeAnnotation)) - return tr.annotation(portalTypeAnnotation); + update(value, tr2) { + if (tr2.annotation(portalTypeAnnotation)) + return tr2.annotation(portalTypeAnnotation); return value; } }); @@ -29510,20 +29610,20 @@ var T = class { var i18n_default = new T().texts; // src/core/utils/spaces/space.ts -var pathIsSpace = (superstate, path2) => { - if (!path2) +var pathIsSpace = (superstate, path3) => { + if (!path3) return false; - return superstate.spacesIndex.has(path2); + return superstate.spacesIndex.has(path3); }; -var spaceFolderPathFromSpace = (path2, manager) => { +var spaceFolderPathFromSpace = (path3, manager) => { if (manager.superstate.settings.spacesMDBInHidden) { - if (path2 == "/") + if (path3 == "/") return ".space/"; - return path2 + ".space/"; + return path3 + ".space/"; } - return path2; + return path3; }; -var folderForTagSpace = (space2, settings) => settings.spacesFolder + "/" + space2; +var folderForTagSpace = (space3, settings) => settings.spacesFolder + "/" + space3; // src/core/types/context.ts var PathPropertyName = "File"; @@ -29543,11 +29643,11 @@ function toInteger(dirtyNumber) { if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { return NaN; } - var number4 = Number(dirtyNumber); - if (isNaN(number4)) { - return number4; + var number5 = Number(dirtyNumber); + if (isNaN(number5)) { + return number5; } - return number4 < 0 ? Math.ceil(number4) : Math.floor(number4); + return number5 < 0 ? Math.ceil(number5) : Math.floor(number5); } // node_modules/date-fns/esm/_lib/requiredArgs/index.js @@ -30022,9 +30122,9 @@ function getUTCWeek(dirtyDate, options) { } // node_modules/date-fns/esm/_lib/addLeadingZeros/index.js -function addLeadingZeros(number4, targetLength) { - var sign4 = number4 < 0 ? "-" : ""; - var output = Math.abs(number4).toString(); +function addLeadingZeros(number5, targetLength) { + var sign4 = number5 < 0 ? "-" : ""; + var output = Math.abs(number5).toString(); while (output.length < targetLength) { output = "0" + output; } @@ -30941,8 +31041,8 @@ function buildLocalizeFn(args) { var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; valuesArray = args.values[_width] || args.values[_defaultWidth]; } - var index2 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - return valuesArray[index2]; + var index3 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; + return valuesArray[index3]; }; } @@ -31033,19 +31133,19 @@ var formattingDayPeriodValues = { } }; var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) { - var number4 = Number(dirtyNumber); - var rem100 = number4 % 100; + var number5 = Number(dirtyNumber); + var rem100 = number5 % 100; if (rem100 > 20 || rem100 < 10) { switch (rem100 % 10) { case 1: - return number4 + "st"; + return number5 + "st"; case 2: - return number4 + "nd"; + return number5 + "nd"; case 3: - return number4 + "rd"; + return number5 + "rd"; } } - return number4 + "th"; + return number5 + "th"; }; var localize = { ordinalNumber, @@ -31079,25 +31179,25 @@ var localize_default = localize; // node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js function buildMatchFn(args) { - return function(string4) { + return function(string6) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var width = options.width; var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; - var matchResult = string4.match(matchPattern); + var matchResult = string6.match(matchPattern); if (!matchResult) { return null; } var matchedString = matchResult[0]; var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; - var key2 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) { + var key3 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) { return pattern.test(matchedString); }) : findKey(parsePatterns, function(pattern) { return pattern.test(matchedString); }); var value; - value = args.valueCallback ? args.valueCallback(key2) : key2; + value = args.valueCallback ? args.valueCallback(key3) : key3; value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string4.slice(matchedString.length); + var rest = string6.slice(matchedString.length); return { value, rest @@ -31105,17 +31205,17 @@ function buildMatchFn(args) { }; } function findKey(object, predicate) { - for (var key2 in object) { - if (object.hasOwnProperty(key2) && predicate(object[key2])) { - return key2; + for (var key3 in object) { + if (object.hasOwnProperty(key3) && predicate(object[key3])) { + return key3; } } return void 0; } function findIndex(array, predicate) { - for (var key2 = 0; key2 < array.length; key2++) { - if (predicate(array[key2])) { - return key2; + for (var key3 = 0; key3 < array.length; key3++) { + if (predicate(array[key3])) { + return key3; } } return void 0; @@ -31123,18 +31223,18 @@ function findIndex(array, predicate) { // node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js function buildMatchPatternFn(args) { - return function(string4) { + return function(string6) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var matchResult = string4.match(args.matchPattern); + var matchResult = string6.match(args.matchPattern); if (!matchResult) return null; var matchedString = matchResult[0]; - var parseResult = string4.match(args.parsePattern); + var parseResult = string6.match(args.parsePattern); if (!parseResult) return null; var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string4.slice(matchedString.length); + var rest = string6.slice(matchedString.length); return { value, rest @@ -31215,8 +31315,8 @@ var match = { defaultMatchWidth: "wide", parsePatterns: parseQuarterPatterns, defaultParseWidth: "any", - valueCallback: function valueCallback2(index2) { - return index2 + 1; + valueCallback: function valueCallback2(index3) { + return index3 + 1; } }), month: buildMatchFn({ @@ -31475,17 +31575,17 @@ function toPropertyKey(t5) { } // node_modules/@babel/runtime/helpers/esm/defineProperty.js -function _defineProperty(obj, key2, value) { - key2 = toPropertyKey(key2); - if (key2 in obj) { - Object.defineProperty(obj, key2, { +function _defineProperty(obj, key3, value) { + key3 = toPropertyKey(key3); + if (key3 in obj) { + Object.defineProperty(obj, key3, { value, enumerable: true, configurable: true, writable: true }); } else { - obj[key2] = value; + obj[key3] = value; } return obj; } @@ -31724,21 +31824,21 @@ function setYear(dirtyDate, dirtyYear) { } // src/utils/array.ts -var insert = (arr, index2, newItem) => !index2 || index2 <= 0 ? [ +var insert = (arr, index3, newItem) => !index3 || index3 <= 0 ? [ newItem, ...arr ] : [ - ...arr.slice(0, index2), + ...arr.slice(0, index3), newItem, - ...arr.slice(index2) + ...arr.slice(index3) ]; -var insertMulti = (arr, index2, newItem) => !index2 || index2 <= 0 ? [ +var insertMulti = (arr, index3, newItem) => !index3 || index3 <= 0 ? [ ...newItem, ...arr ] : [ - ...arr.slice(0, index2), + ...arr.slice(0, index3), ...newItem, - ...arr.slice(index2) + ...arr.slice(index3) ]; var uniq = (a4) => [...new Set(a4)]; var uniqCaseInsensitive = (a4) => [ @@ -31755,12 +31855,12 @@ var uniqueNameFromString = (name317, cols) => { } return newName; }; -var onlyUniqueProp = (prop2) => (value, index2, self2) => { - return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index2; +var onlyUniqueProp = (prop2) => (value, index3, self2) => { + return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index3; }; -var orderArrayByArrayWithKey = (array, order, key2) => { +var orderArrayByArrayWithKey = (array, order2, key3) => { return array.sort(function(a4, b2) { - const A = order.indexOf(a4[key2]), B2 = order.indexOf(b2[key2]); + const A = order2.indexOf(a4[key3]), B2 = order2.indexOf(b2[key3]); if (A > B2) { if (A != -1 && B2 == -1) { return -1; @@ -31776,7 +31876,7 @@ var orderArrayByArrayWithKey = (array, order, key2) => { }; // src/utils/properties.ts -var detectPropertyType = (value, key2) => { +var detectPropertyType = (value, key3) => { if (value instanceof Date) { return "date"; } @@ -31787,7 +31887,7 @@ var detectPropertyType = (value, key2) => { if (/^\d{4}-\d{2}-\d{2}$/.test(value)) { return "date"; } - if (key2 == "tag" || key2 == "tags") { + if (key3 == "tag" || key3 == "tags") { return "tags-multi"; } if (/\[\[.*?\]\]/.test(value)) { @@ -31804,13 +31904,13 @@ var detectPropertyType = (value, key2) => { if (typeof value === "string" && value.indexOf(",") > -1) { arrayValue = parseMultiString(value); } - if (key2 == "tag" || key2 == "tags") { + if (key3 == "tag" || key3 == "tags") { return "tags-multi"; } if (arrayValue.length == 1 && Array.isArray(arrayValue[0]) && arrayValue[0].length == 1 && typeof arrayValue[0][0] === "string") { return "link"; } - const types2 = uniq(arrayValue.map((f2) => detectPropertyType(f2, key2))); + const types2 = uniq(arrayValue.map((f2) => detectPropertyType(f2, key3))); if (types2.length == 1 && types2[0] == "link") { return "link-multi"; } @@ -31943,8 +32043,8 @@ var parseProperty = (field, value) => { break; case "duration": return serializeMultiDisplayString(Object.keys(value.values).reduce( - (p, c3) => [ - ...p, + (p2, c3) => [ + ...p2, ...value.values[c3] > 0 ? [value.values[c3] + " " + c3] : [] ], [] @@ -32002,20 +32102,20 @@ var safelyParseJSON = (json) => { } return parsed; }; -var parseLinkString = (string4) => { - if (!string4) +var parseLinkString = (string6) => { + if (!string6) return ""; - const match2 = /\[\[(.*?)\]\]/g.exec(string4); - const stringValue = match2?.length > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string4; + const match2 = /\[\[(.*?)\]\]/g.exec(string6); + const stringValue = match2?.length > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string6; if (stringValue) return stringValue; - return string4; + return string6; }; // src/core/utils/strings.ts -var defaultString = (value, string4) => { +var defaultString = (value, string6) => { if (!value || value.length == 0) - return string4; + return string6; return value; }; function ensureArray(value) { @@ -32085,12 +32185,12 @@ var removeQuotes = (s4) => { } }; var initiateString = (s4, defaultString2) => !s4 || s4.length == 0 ? defaultString2 : s4; -var removeLeadingSlash = (path2) => path2.charAt(0) == "/" ? path2.substring(1) : path2; -var pathToParentPath = (path2) => removeLeadingSlash(path2.substring(0, path2.lastIndexOf("/"))) || path2; +var removeLeadingSlash = (path3) => path3.charAt(0) == "/" ? path3.substring(1) : path3; +var pathToParentPath = (path3) => removeLeadingSlash(path3.substring(0, path3.lastIndexOf("/"))) || path3; // src/utils/path.ts -var schemaForPath = (superstate, path2) => { - const uri = superstate.spaceManager.uriByString(path2); +var schemaForPath = (superstate, path3) => { + const uri = superstate.spaceManager.uriByString(path3); if (uri.refType == "context") { return superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref); } @@ -32101,49 +32201,49 @@ var schemaForPath = (superstate, path2) => { return superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema; } }; -var removeTrailingSlashFromFolder = (path2) => path2 == "/" ? path2 : path2.slice(-1) == "/" ? path2.substring(0, path2.length - 1) : path2; -var pathDisplayName = (path2, superstate) => { - if (!path2) +var removeTrailingSlashFromFolder = (path3) => path3 == "/" ? path3 : path3.slice(-1) == "/" ? path3.substring(0, path3.length - 1) : path3; +var pathDisplayName = (path3, superstate) => { + if (!path3) return ""; - const uri = superstate.spaceManager.uriByString(path2); + const uri = superstate.spaceManager.uriByString(path3); if (uri.refType) { - const schema = schemaForPath(superstate, path2); + const schema = schemaForPath(superstate, path3); if (schema) { return schema.name; } } - return superstate.pathsIndex.get(path2)?.name || path2; + return superstate.pathsIndex.get(path3)?.name || path3; }; -var folderPathToString = (path2) => removeLeadingSlash(path2.substring(path2.lastIndexOf("/"))) || path2; -var getParentFolderPaths = (path2) => { +var folderPathToString = (path3) => removeLeadingSlash(path3.substring(path3.lastIndexOf("/"))) || path3; +var getParentFolderPaths = (path3) => { const folderPaths = []; - const parts = path2.split("/"); + const parts = path3.split("/"); let current3 = ""; for (let i4 = 0; i4 < parts.length; i4++) { current3 += `${i4 === 0 ? "" : "/"}` + parts[i4]; - if (current3 != path2) { + if (current3 != path3) { folderPaths.push(current3); } } return folderPaths; }; -var pathToString = (path2) => { - if (path2.lastIndexOf("/") != -1) { - if (path2.lastIndexOf(".") != -1) +var pathToString = (path3) => { + if (path3.lastIndexOf("/") != -1) { + if (path3.lastIndexOf(".") != -1) return removeLeadingSlash( - path2.substring( - path2.lastIndexOf("/") + 1, - path2.lastIndexOf(".") + path3.substring( + path3.lastIndexOf("/") + 1, + path3.lastIndexOf(".") ) ); - return path2.substring(path2.lastIndexOf("/") + 1); + return path3.substring(path3.lastIndexOf("/") + 1); } - if (path2.lastIndexOf(".") != -1) { - return path2.substring(0, path2.lastIndexOf(".")); + if (path3.lastIndexOf(".") != -1) { + return path3.substring(0, path3.lastIndexOf(".")); } - return path2; + return path3; }; -var pathNameToString = (path2) => path2.substring(0, path2.lastIndexOf(".")) || path2; +var pathNameToString = (path3) => path3.substring(0, path3.lastIndexOf(".")) || path3; var getParentPathFromString = (file) => { const indexOfLastSlash = file.lastIndexOf("/"); if (indexOfLastSlash == -1) { @@ -32159,8 +32259,8 @@ var parseURI = (uri) => { const parseQuery2 = (queryString) => { const query2 = {}; queryString.split("&").forEach((param) => { - const [key2, value] = param.split("="); - query2[decodeURIComponent(key2)] = decodeURIComponent(value); + const [key3, value] = param.split("="); + query2[decodeURIComponent(key3)] = decodeURIComponent(value); }); return query2; }; @@ -32173,8 +32273,8 @@ var parseURI = (uri) => { return "action"; return null; }; - let space2 = null; - let path2 = null; + let space3 = null; + let path3 = null; let alias = null; let reference = null; let refType = null; @@ -32186,15 +32286,15 @@ var parseURI = (uri) => { if (spaceStr.charAt(0) == "#") { const endIndex = spaceStr.lastIndexOf("/#"); if (endIndex != -1) { - space2 = spaceStr.slice(0, endIndex); + space3 = spaceStr.slice(0, endIndex); uri = spaceStr.slice(endIndex); } else { - space2 = spaceStr; + space3 = spaceStr; uri = "/"; } } else { const spaceParts = spaceStr.split("/"); - space2 = spaceParts[0]; + space3 = spaceParts[0]; uri = spaceParts.slice(1).join("/") || ""; } } @@ -32223,10 +32323,10 @@ var parseURI = (uri) => { alias = uri.slice(lastPipeIndex + 1); uri = uri.slice(0, lastPipeIndex); } - path2 = uri; + path3 = uri; return { - basePath: removeTrailingSlashFromFolder(`${space2 ? `${scheme}://${space2}/${path2 != "/" ? path2 : ""}` : path2}`), - authority: space2, + basePath: removeTrailingSlashFromFolder(`${space3 ? `${scheme}://${space3}/${path3 != "/" ? path3 : ""}` : path3}`), + authority: space3, fullPath, scheme, path: removeTrailingSlashFromFolder(uri), @@ -32237,18 +32337,18 @@ var parseURI = (uri) => { query }; }; -var movePath = (path2, newParent) => { - const parts = path2.split("/"); +var movePath = (path3, newParent) => { + const parts = path3.split("/"); const newPath = newParent + "/" + parts[parts.length - 1]; return newPath; }; -var renamePathWithoutExtension = (path2, newName) => { - const dir = path2.substring(0, path2.lastIndexOf("/")); +var renamePathWithoutExtension = (path3, newName) => { + const dir = path3.substring(0, path3.lastIndexOf("/")); return dir.length > 0 ? `${dir}/${newName}` : `${newName}`; }; -var renamePathWithExtension = (path2, newName) => { - const dir = path2.substring(0, path2.lastIndexOf("/")); - const ext = path2.lastIndexOf(".") != -1 ? path2.substring(path2.lastIndexOf(".")) : ""; +var renamePathWithExtension = (path3, newName) => { + const dir = path3.substring(0, path3.lastIndexOf("/")); + const ext = path3.lastIndexOf(".") != -1 ? path3.substring(path3.lastIndexOf(".")) : ""; return dir.length > 0 ? `${dir}/${newName}${ext}` : `${newName}${ext}`; }; @@ -32264,13 +32364,13 @@ var renamePathByName = async (superstate, oldPath, newName) => { return superstate.spaceManager.renamePath(oldPath, renamePathWithExtension(oldPath, newName)); } }; -var hidePath = async (superstate, path2) => { +var hidePath = async (superstate, path3) => { superstate.settings.hiddenFiles = uniq([ ...superstate.settings.hiddenFiles, - path2 + path3 ]); superstate.saveSettings(); - superstate.reloadPath(path2, true).then((f2) => superstate.dispatchEvent("superstateUpdated", null)); + superstate.reloadPath(path3, true).then((f2) => superstate.dispatchEvent("superstateUpdated", null)); }; var hidePaths = async (superstate, paths) => { superstate.settings.hiddenFiles = uniq([ @@ -32278,25 +32378,25 @@ var hidePaths = async (superstate, paths) => { ...paths ]); superstate.saveSettings(); - Promise.all(paths.map((path2) => { - superstate.reloadPath(path2, true); + Promise.all(paths.map((path3) => { + superstate.reloadPath(path3, true); })).then((f2) => superstate.dispatchEvent("superstateUpdated", null)); }; -var deletePath = async (superstate, path2) => { - superstate.spaceManager.deletePath(path2); - superstate.onPathDeleted(path2); +var deletePath = async (superstate, path3) => { + superstate.spaceManager.deletePath(path3); + superstate.onPathDeleted(path3); }; var movePathToSpace = async (superstate, oldPath, newParent) => { return superstate.spaceManager.renamePath(oldPath, movePath(oldPath, newParent)); }; -var convertPathToSpace = async (superstate, path2, open) => { - const pathState = superstate.pathsIndex.get(path2); +var convertPathToSpace = async (superstate, path3, open) => { + const pathState = superstate.pathsIndex.get(path3); if (!pathState) { return; } const newPath = pathState.parent + "/" + pathState.name; await superstate.spaceManager.createSpace(pathState.name, pathState.parent, {}); - await superstate.spaceManager.renamePath(path2, newPath + "/" + pathState.metadata?.file?.name + ".md"); + await superstate.spaceManager.renamePath(path3, newPath + "/" + pathState.metadata?.file?.name + ".md"); if (open) { superstate.ui.openPath(newPath, false); } @@ -32306,7 +32406,7 @@ var convertPathToSpace = async (superstate, path2, open) => { var import_lodash = __toESM(require_lodash()); // src/core/schemas/parseFieldValue.ts -var allActions = (superstate, path2) => { +var allActions = (superstate, path3) => { const stringForType = (type) => { if (type == "builtin") { return "Builtin"; @@ -32316,14 +32416,14 @@ var allActions = (superstate, path2) => { } return "Action"; }; - return [...(superstate.actionsIndex.get(path2) ?? []).map((g) => ({ name: g.schema.name, description: "Action", value: `${path2}/#;${g.schema.id}`, section: "Action" })) ?? [], ...[...superstate.cli.allCommands()].map((g) => ({ name: g.schema.name, description: stringForType(g.schema.type), value: g.path, section: stringForType(g.schema.type) }))]; + return [...(superstate.actionsIndex.get(path3) ?? []).map((g) => ({ name: g.schema.name, description: "Action", value: `${path3}/#;${g.schema.id}`, section: "Action" })) ?? [], ...[...superstate.cli.allCommands()].map((g) => ({ name: g.schema.name, description: stringForType(g.schema.type), value: g.path, section: stringForType(g.schema.type) }))]; }; var convertFileProp = ({ field, value }) => { if (value == "ctime") return { value: `parseDate(prop('${field}')['metadata']['file']['${value}'])`, type: "date" }; return { value: `prop('${field}')['metadata']['file']['${value}']`, type: "string" }; }; -var parseFieldValue = (value, type, superstate, path2) => { +var parseFieldValue = (value, type, superstate, path3) => { let valueProp = safelyParseJSON(value); if (valueProp) { if (type == "fileprop") { @@ -32336,12 +32436,12 @@ var parseFieldValue = (value, type, superstate, path2) => { } else if (valueProp.source == "$links") { valueProp.options = superstate.spaceManager.allPaths().map((f2) => ({ name: f2, value: f2 })); } else if (valueProp.source == "$super") { - valueProp.options = allActions(superstate, path2); + valueProp.options = allActions(superstate, path3); } else if (valueProp.source == "$properties") { - valueProp.options = superstate.contextsIndex.get(path2)?.cols?.map((f2) => ({ name: f2.name, value: f2.name })) ?? []; + valueProp.options = superstate.contextsIndex.get(path3)?.cols?.map((f2) => ({ name: f2.name, value: f2.name })) ?? []; } } - return [...fieldTypeForType(type).configKeys ?? [], "alias", "default"].reduce((p, c3) => ({ ...p, [c3]: valueProp[c3] }), {}); + return [...fieldTypeForType(type).configKeys ?? [], "alias", "default"].reduce((p2, c3) => ({ ...p2, [c3]: valueProp[c3] }), {}); } if (!type) return {}; @@ -32609,7 +32709,7 @@ var defaultContextFields = { } ] }; -var defaultFieldsForContext = (space2) => { +var defaultFieldsForContext = (space3) => { return defaultContextFields; }; var defaultTableFields = [ @@ -32635,7 +32735,7 @@ var defaultTagFields = { } ] }; -var defaultMDBTableForContext = (space2) => { +var defaultMDBTableForContext = (space3) => { return defaultFolderMDBTable; }; var defaultFolderMDBTable = { @@ -32654,13 +32754,13 @@ var defaultTagMDBTable = { rows: [] }; var fieldsToTable = (fields, schemas) => { - return fields.filter((s4) => schemas.find((g) => g.id == s4.schemaId && g.type == "db")).reduce((p, c3) => { + return fields.filter((s4) => schemas.find((g) => g.id == s4.schemaId && g.type == "db")).reduce((p2, c3) => { return { - ...p, - ...p[c3.schemaId] ? { + ...p2, + ...p2[c3.schemaId] ? { [c3.schemaId]: { - uniques: c3.unique == "true" ? [...p[c3.schemaId].uniques, c3.name] : p[c3.schemaId].uniques, - cols: [...p[c3.schemaId].cols, c3.name], + uniques: c3.unique == "true" ? [...p2[c3.schemaId].uniques, c3.name] : p2[c3.schemaId].uniques, + cols: [...p2[c3.schemaId].cols, c3.name], rows: [] } } : { @@ -32673,7 +32773,7 @@ var fieldsToTable = (fields, schemas) => { }; }, {}); }; -var defaultTablesForContext = (space2) => { +var defaultTablesForContext = (space3) => { return defaultFolderTables; }; var defaultFolderTables = { @@ -32694,27 +32794,27 @@ var defaultTagTables = { }; // src/core/utils/contexts/optionValuesForColumn.ts -var optionValuesForColumn = (column2, table) => { +var optionValuesForColumn = (column2, table2) => { return uniq( - table?.rows.reduce((p, c3) => { + table2?.rows.reduce((p2, c3) => { if (!(0, import_lodash.isString)(c3[column2])) - return [...p]; - return [...p, ...parseMultiString(c3[column2])]; + return [...p2]; + return [...p2, ...parseMultiString(c3[column2])]; }, []) ?? [] ); }; -var defaultTableDataForContext = (superstate, space2) => { - const paths = [...superstate.getSpaceItems(space2.path, true)]; +var defaultTableDataForContext = (superstate, space3) => { + const paths = [...superstate.getSpaceItems(space3.path, true)]; return { - ...defaultMDBTableForContext(space2), + ...defaultMDBTableForContext(space3), rows: paths.map((f2) => ({ [PathPropertyName]: f2.path })) }; }; -var createNewRow = (mdb, row2, index2) => { - if (index2) { +var createNewRow = (mdb, row2, index3) => { + if (index3) { return { ...mdb, - rows: insert(mdb.rows, index2, row2) + rows: insert(mdb.rows, index3, row2) }; } return { @@ -32737,8 +32837,8 @@ var renameTag = async (superstate, tag2, toTag) => { const tags3 = getAllSubtags(superstate, tag2); const newTag = ensureTag(validateName(toTag)); const paths = superstate.spaceManager.pathsForTag(tag2); - for (const path2 of paths) { - superstate.spaceManager.renameTag(path2, tag2, newTag); + for (const path3 of paths) { + superstate.spaceManager.renameTag(path3, tag2, newTag); } await renameTagSpacePath(superstate, tag2, newTag); for (const subtag of tags3) { @@ -32770,34 +32870,34 @@ var getAllSubtags = (superstate, tag2) => { var tagToTagPath = (tag2) => { return encodeSpaceName(ensureTag(tag2)); }; -var tagPathToTag = (string4) => { - return pathToString(string4).replace(/\+/g, "/"); +var tagPathToTag = (string6) => { + return pathToString(string6).replace(/\+/g, "/"); }; var ensureTag = (tag2) => { if (!tag2) return null; - let string4 = tag2; - if (string4.charAt(0) != "#") - string4 = "#" + string4; - return string4; + let string6 = tag2; + if (string6.charAt(0) != "#") + string6 = "#" + string6; + return string6; }; -var stringFromTag = (string4) => { - if (string4.charAt(0) == "#") { - if (string4.charAt(1) == "#") { - return string4.substring(2, string4.length); +var stringFromTag = (string6) => { + if (string6.charAt(0) == "#") { + if (string6.charAt(1) == "#") { + return string6.substring(2, string6.length); } - return string4.substring(1, string4.length); + return string6.substring(1, string6.length); } - return string4; + return string6; }; // src/core/spaceManager/filesystemAdapter/spaceInfo.ts var fileSystemSpaceInfoFromTag = (manager, tag2, readOnly) => { - const path2 = tagSpacePathFromTag(tag2); + const path3 = tagSpacePathFromTag(tag2); const folderPath = manager.superstate.settings.spacesFolder + "/" + tagToTagPath(tag2); return { name: tag2, - path: path2, + path: path3, isRemote: false, readOnly, folderPath, @@ -32914,34 +33014,34 @@ var SpaceManager = class { this.saveSystemCommand = (lib, action) => { return this.primarySpaceAdapter.saveSystemCommand(lib, action).then((f2) => this.superstate.reloadSystemActions()); }; - this.onPathCreated = async (path2) => { - this.superstate.onPathCreated(path2); + this.onPathCreated = async (path3) => { + this.superstate.onPathCreated(path3); }; - this.onPathDeleted = async (path2) => { - this.superstate.onPathDeleted(path2); + this.onPathDeleted = async (path3) => { + this.superstate.onPathDeleted(path3); }; - this.onPathChanged = async (path2, oldPath) => { - this.superstate.onPathRename(oldPath, path2); + this.onPathChanged = async (path3, oldPath) => { + this.superstate.onPathRename(oldPath, path3); }; - this.onSpaceCreated = async (path2) => { - if (path2.startsWith(this.superstate.settings.spacesFolder)) { - this.onSpaceCreated(path2.replace(this.superstate.settings.spacesFolder, "spaces:/")); + this.onSpaceCreated = async (path3) => { + if (path3.startsWith(this.superstate.settings.spacesFolder)) { + this.onSpaceCreated(path3.replace(this.superstate.settings.spacesFolder, "spaces:/")); return; } - const space2 = await this.superstate.reloadSpace(this.spaceInfoForPath(path2), null, true); - await this.superstate.onSpaceDefinitionChanged(space2); - this.superstate.onPathCreated(path2); + const space3 = await this.superstate.reloadSpace(this.spaceInfoForPath(path3), null, true); + await this.superstate.onSpaceDefinitionChanged(space3); + await this.superstate.onPathCreated(path3); }; - this.onSpaceRenamed = async (path2, oldPath) => { - await this.superstate.onSpaceRenamed(oldPath, this.spaceInfoForPath(path2)); - await this.superstate.onPathRename(oldPath, path2); + this.onSpaceRenamed = async (path3, oldPath) => { + await this.superstate.onSpaceRenamed(oldPath, this.spaceInfoForPath(path3)); + await this.superstate.onPathRename(oldPath, path3); }; - this.onSpaceDeleted = async (path2) => { - this.superstate.onSpaceDeleted(path2); - this.superstate.onPathDeleted(path2); + this.onSpaceDeleted = async (path3) => { + this.superstate.onSpaceDeleted(path3); + this.superstate.onPathDeleted(path3); }; - this.onPathPropertyChanged = async (path2) => { - this.superstate.onMetadataChange(path2); + this.onPathPropertyChanged = async (path3) => { + this.superstate.onMetadataChange(path3); }; this.spaceTypeByString = (uri) => { if (uri.fullPath == tagsSpacePath) { @@ -32967,27 +33067,27 @@ var SpaceManager = class { saveSpaceTemplate(frames, name317) { return this.primarySpaceAdapter.saveSpaceTemplate(frames, name317); } - resolvePath(path2, source) { - if (!source || !path2) - return path2; - if (path2.indexOf("http") == 0) - return path2; - if (path2.indexOf("./") == 0 && source) { + resolvePath(path3, source) { + if (!source || !path3) + return path3; + if (path3.indexOf("http") == 0) + return path3; + if (path3.indexOf("./") == 0 && source) { if (this.superstate.spacesIndex.has(source)) - return source + path2.slice(1); - return source.slice(0, source.lastIndexOf("/")) + path2.slice(1); - } else if (path2.indexOf("../") == 0 && source) { + return source + path3.slice(1); + return source.slice(0, source.lastIndexOf("/")) + path3.slice(1); + } else if (path3.indexOf("../") == 0 && source) { const sourceParts = source.split("/"); - const pathParts = path2.split("/"); + const pathParts = path3.split("/"); while (pathParts[0] === "..") { sourceParts.pop(); pathParts.shift(); } return [...sourceParts, ...pathParts].join("/"); } - if (this.superstate.spacesIndex.has(path2)) - return path2; - return this.primarySpaceAdapter.resolvePath(path2, source) ?? path2; + if (this.superstate.spacesIndex.has(path3)) + return path3; + return this.primarySpaceAdapter.resolvePath(path3, source) ?? path3; } uriByString(uri, source) { if (!uri) @@ -33005,8 +33105,8 @@ var SpaceManager = class { keysForCacheType(type) { return this.primarySpaceAdapter.keysForCacheType(type); } - pathExists(path2) { - return this.primarySpaceAdapter.pathExists(path2); + pathExists(path3) { + return this.primarySpaceAdapter.pathExists(path3); } addSpaceAdapter(spaceAdapter, primary) { spaceAdapter.initiateAdapter(this); @@ -33014,57 +33114,62 @@ var SpaceManager = class { this.primarySpaceAdapter = spaceAdapter; this.spaceAdapters.push(spaceAdapter); } - adapterForPath(path2) { - const uri = this.uriByString(path2); + adapterForPath(path3) { + const uri = this.uriByString(path3); + if (!uri) + return this.primarySpaceAdapter; return this.spaceAdapters.find((f2) => f2.schemes.includes(uri.scheme)) ?? this.primarySpaceAdapter; } - createSpace(name317, parentPath, definition) { - return this.adapterForPath(parentPath).createSpace(name317, parentPath, definition); + createSpace(name317, parentPath, definition3) { + return this.adapterForPath(parentPath).createSpace(name317, parentPath, definition3); + } + saveSpace(path3, definition3, properties3) { + return this.adapterForPath(path3).saveSpace(path3, definition3, properties3); } - saveSpace(path2, definition, properties3) { - return this.adapterForPath(path2).saveSpace(path2, definition, properties3); + renameSpace(path3, newPath) { + return this.adapterForPath(path3).renameSpace(path3, newPath); } - renameSpace(path2, newPath) { - return this.adapterForPath(path2).renameSpace(path2, newPath); + deleteSpace(path3) { + return this.adapterForPath(path3).deleteSpace(path3); } - deleteSpace(path2) { - return this.adapterForPath(path2).deleteSpace(path2); + childrenForSpace(path3) { + return this.adapterForPath(path3).childrenForSpace(path3); } - childrenForSpace(path2) { - return this.adapterForPath(path2).childrenForSpace(path2); + contextForSpace(path3) { + return this.adapterForPath(path3).contextForSpace(path3); } - contextForSpace(path2) { - return this.adapterForPath(path2).contextForSpace(path2); + async tablesForSpace(path3) { + return this.adapterForPath(path3).tablesForSpace(path3); } - async tablesForSpace(path2) { - return this.adapterForPath(path2).tablesForSpace(path2); + spaceInitiated(path3) { + return this.adapterForPath(path3).spaceInitiated(path3); } - spaceInitiated(path2) { - return this.adapterForPath(path2).spaceInitiated(path2); + contextInitiated(path3) { + return this.adapterForPath(path3).contextInitiated(path3); } - readTable(path2, schema) { - return this.adapterForPath(path2).readTable(path2, schema); + readTable(path3, schema) { + return this.adapterForPath(path3).readTable(path3, schema); } - createTable(path2, schema) { - return this.adapterForPath(path2).createTable(path2, schema).then((f2) => this.superstate.reloadContextByPath(path2)); + createTable(path3, schema) { + return this.adapterForPath(path3).createTable(path3, schema).then((f2) => this.superstate.reloadContextByPath(path3)); } - saveTableSchema(path2, schemaId, saveSchema) { - return this.adapterForPath(path2).saveTableSchema(path2, schemaId, saveSchema).then((f2) => { + saveTableSchema(path3, schemaId, saveSchema) { + return this.adapterForPath(path3).saveTableSchema(path3, schemaId, saveSchema).then((f2) => { if (f2) - return this.superstate.reloadContextByPath(path2); + return this.superstate.reloadContextByPath(path3); return f2; }); } - saveTable(path2, table, force) { - return this.adapterForPath(path2).saveTable(path2, table, force).then((f2) => { + saveTable(path3, table2, force) { + return this.adapterForPath(path3).saveTable(path3, table2, force).then((f2) => { if (f2) - return this.superstate.reloadContextByPath(path2); + return this.superstate.reloadContextByPath(path3); return f2; }); } - deleteTable(path2, name317) { - return this.adapterForPath(path2).deleteTable(path2, name317).then((f2) => { - return this.superstate.reloadContextByPath(path2); + deleteTable(path3, name317) { + return this.adapterForPath(path3).deleteTable(path3, name317).then((f2) => { + return this.superstate.reloadContextByPath(path3); }); } readAllKits() { @@ -33073,50 +33178,50 @@ var SpaceManager = class { readAllTemplates() { return this.primarySpaceAdapter.readAllTemplates(); } - readAllTables(path2) { - return this.primarySpaceAdapter.readAllTables(path2); + readAllTables(path3) { + return this.primarySpaceAdapter.readAllTables(path3); } - framesForSpace(path2) { - return this.adapterForPath(path2).framesForSpace(path2); + framesForSpace(path3) { + return this.adapterForPath(path3).framesForSpace(path3); } - readFrame(path2, schema) { - return this.adapterForPath(path2).readFrame(path2, schema); + readFrame(path3, schema) { + return this.adapterForPath(path3).readFrame(path3, schema); } - readAllFrames(path2) { - return this.adapterForPath(path2).readAllFrames(path2); + readAllFrames(path3) { + return this.adapterForPath(path3).readAllFrames(path3); } - createFrame(path2, schema) { - return this.adapterForPath(path2).createFrame(path2, schema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2))); + createFrame(path3, schema) { + return this.adapterForPath(path3).createFrame(path3, schema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3))); } - deleteFrame(path2, name317) { - return this.adapterForPath(path2).deleteFrame(path2, name317); + deleteFrame(path3, name317) { + return this.adapterForPath(path3).deleteFrame(path3, name317); } - saveFrameSchema(path2, schemaId, saveSchema) { - return this.adapterForPath(path2).saveFrameSchema(path2, schemaId, saveSchema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2))); + saveFrameSchema(path3, schemaId, saveSchema) { + return this.adapterForPath(path3).saveFrameSchema(path3, schemaId, saveSchema).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3))); } - saveFrame(path2, frame) { - return this.adapterForPath(path2).saveFrame(path2, frame).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path2))).then((f2) => this.superstate.dispatchEvent("frameStateUpdated", { path: this.spaceInfoForPath(path2).path, schemaId: frame.schema.id })); + saveFrame(path3, frame) { + return this.adapterForPath(path3).saveFrame(path3, frame).then((f2) => this.superstate.reloadFrames(this.spaceInfoForPath(path3))).then((f2) => this.superstate.dispatchEvent("frameStateUpdated", { path: this.spaceInfoForPath(path3).path, schemaId: frame.schema.id })); } - commandsForSpace(path2) { - return this.adapterForPath(path2).commandsForSpace(path2); + commandsForSpace(path3) { + return this.adapterForPath(path3).commandsForSpace(path3); } - runCommand(path2, name317, instance) { - return this.adapterForPath(path2).runCommand(path2, name317, instance); + runCommand(path3, name317, instance) { + return this.adapterForPath(path3).runCommand(path3, name317, instance); } - createCommand(path2, schema) { - return this.adapterForPath(path2).createCommand(path2, schema).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2))); + createCommand(path3, schema) { + return this.adapterForPath(path3).createCommand(path3, schema).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3))); } - deleteCommand(path2, name317) { - return this.adapterForPath(path2).deleteCommand(path2, name317).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2))); + deleteCommand(path3, name317) { + return this.adapterForPath(path3).deleteCommand(path3, name317).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3))); } - saveCommand(path2, schemaId, saveCommand) { - return this.adapterForPath(path2).saveCommand(path2, schemaId, saveCommand).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path2))); + saveCommand(path3, schemaId, saveCommand) { + return this.adapterForPath(path3).saveCommand(path3, schemaId, saveCommand).then((f2) => this.superstate.reloadActions(this.spaceInfoForPath(path3))); } allPaths(type) { return this.primarySpaceAdapter.allPaths(type); } - createItemAtPath(parent, type, name317, content3) { - return this.adapterForPath(parent).createItemAtPath(parent, type, name317, content3); + createItemAtPath(parent, type, name317, content5) { + return this.adapterForPath(parent).createItemAtPath(parent, type, name317, content5); } renamePath(oldPath, newPath) { return this.adapterForPath(oldPath).renamePath(oldPath, newPath); @@ -33124,80 +33229,80 @@ var SpaceManager = class { copyPath(source, destination, newName) { return this.adapterForPath(source).copyPath(source, destination, newName); } - getPathInfo(path2) { - return this.adapterForPath(path2).getPathInfo(path2); + getPathInfo(path3) { + return this.adapterForPath(path3).getPathInfo(path3); } - deletePath(path2) { - return this.adapterForPath(path2).deletePath(path2); + deletePath(path3) { + return this.adapterForPath(path3).deletePath(path3); } - readPath(path2) { - return this.adapterForPath(path2).readPath(path2); + readPath(path3) { + return this.adapterForPath(path3).readPath(path3); } - writeToPath(path2, content3, binary) { - return this.adapterForPath(path2).writeToPath(path2, content3, binary); + writeToPath(path3, content5, binary) { + return this.adapterForPath(path3).writeToPath(path3, content5, binary); } - parentPathForPath(path2) { - return this.adapterForPath(path2).parentPathForPath(path2); + parentPathForPath(path3) { + return this.adapterForPath(path3).parentPathForPath(path3); } - readPathCache(path2) { - return this.adapterForPath(path2).readPathCache(path2); + readPathCache(path3) { + return this.adapterForPath(path3).readPathCache(path3); } allSpaces() { return this.primarySpaceAdapter.allSpaces(); } - spaceInfoForPath(path2) { - return this.adapterForPath(path2).spaceInfoForPath(path2); + spaceInfoForPath(path3) { + return this.adapterForPath(path3).spaceInfoForPath(path3); } - spaceDefForSpace(path2) { - return this.adapterForPath(path2).spaceDefForSpace(path2); + spaceDefForSpace(path3) { + return this.adapterForPath(path3).spaceDefForSpace(path3); } - readLabel(path2) { - return this.adapterForPath(path2).readLabel(path2); + readLabel(path3) { + return this.adapterForPath(path3).readLabel(path3); } - saveLabel(path2, key2, value) { - return this.adapterForPath(path2).saveLabel(path2, key2, value); + saveLabel(path3, key3, value) { + return this.adapterForPath(path3).saveLabel(path3, key3, value); } - addProperty(path2, property) { - return this.adapterForPath(path2).addProperty(path2, property); + addProperty(path3, property) { + return this.adapterForPath(path3).addProperty(path3, property); } - saveProperties(path2, properties3) { - if (!path2) + saveProperties(path3, properties3) { + if (!path3) return; - return this.adapterForPath(path2).saveProperties(path2, properties3); + return this.adapterForPath(path3).saveProperties(path3, properties3); } - readProperties(path2) { - return this.adapterForPath(path2).readProperties(path2); + readProperties(path3) { + return this.adapterForPath(path3).readProperties(path3); } - renameProperty(path2, property, newProperty) { - return this.adapterForPath(path2).renameProperty(path2, property, newProperty); + renameProperty(path3, property, newProperty) { + return this.adapterForPath(path3).renameProperty(path3, property, newProperty); } - deleteProperty(path2, property) { - return this.adapterForPath(path2).deleteProperty(path2, property); + deleteProperty(path3, property) { + return this.adapterForPath(path3).deleteProperty(path3, property); } - addSpaceProperty(path2, property) { - return this.adapterForPath(path2).addSpaceProperty(path2, property).then((f2) => this.superstate.reloadContextByPath(path2)); + addSpaceProperty(path3, property) { + return this.adapterForPath(path3).addSpaceProperty(path3, property).then((f2) => this.superstate.reloadContextByPath(path3)); } - deleteSpaceProperty(path2, property) { - return this.adapterForPath(path2).deleteSpaceProperty(path2, property).then((f2) => this.superstate.reloadContextByPath(path2)); + deleteSpaceProperty(path3, property) { + return this.adapterForPath(path3).deleteSpaceProperty(path3, property).then((f2) => this.superstate.reloadContextByPath(path3)); } - saveSpaceProperty(path2, property, oldProperty) { - return this.adapterForPath(path2).saveSpaceProperty(path2, property, oldProperty).then((f2) => { + saveSpaceProperty(path3, property, oldProperty) { + return this.adapterForPath(path3).saveSpaceProperty(path3, property, oldProperty).then((f2) => { if (oldProperty.name != property.name) { - this.superstate.contextsIndex.get(path2).paths.forEach((f3) => { + this.superstate.contextsIndex.get(path3).paths.forEach((f3) => { this.renameProperty(f3, oldProperty.name, property.name); }); } - return this.superstate.reloadContextByPath(path2); + return this.superstate.reloadContextByPath(path3); }); } - addTag(path2, tag2) { - return this.adapterForPath(path2).addTag(path2, tag2); + addTag(path3, tag2) { + return this.adapterForPath(path3).addTag(path3, tag2); } - deleteTag(path2, tag2) { - return this.adapterForPath(path2).deleteTag(path2, tag2); + deleteTag(path3, tag2) { + return this.adapterForPath(path3).deleteTag(path3, tag2); } - renameTag(path2, tag2, newTag) { - return this.adapterForPath(path2).renameTag(path2, tag2, newTag); + renameTag(path3, tag2, newTag) { + return this.adapterForPath(path3).renameTag(path3, tag2, newTag); } readTags() { return this.primarySpaceAdapter.readTags(); @@ -33205,8 +33310,8 @@ var SpaceManager = class { pathsForTag(tag2) { return this.primarySpaceAdapter.pathsForTag(tag2); } - childrenForPath(path2, type) { - return this.adapterForPath(path2).childrenForPath(path2, type); + childrenForPath(path3, type) { + return this.adapterForPath(path3).childrenForPath(path3, type); } readWaypoints() { return this.primarySpaceAdapter.readWaypoints(); @@ -33216,55 +33321,55 @@ var SpaceManager = class { this.superstate.dispatchEvent("superstateUpdated", null); return this.primarySpaceAdapter.saveWaypoints(waypoints); } - readTemplates(path2) { - return this.adapterForPath(path2).readTemplates(path2); + readTemplates(path3) { + return this.adapterForPath(path3).readTemplates(path3); } - saveTemplate(path2, space2) { - return this.adapterForPath(path2).saveTemplate(path2, space2).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space2), null, true)); + saveTemplate(path3, space3) { + return this.adapterForPath(path3).saveTemplate(path3, space3).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space3), null, true)); } - deleteTemplate(template2, space2) { - return this.primarySpaceAdapter.deleteTemplate(template2, space2).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space2), null, true)); + deleteTemplate(template2, space3) { + return this.primarySpaceAdapter.deleteTemplate(template2, space3).then((f2) => this.superstate.reloadSpace(this.spaceInfoForPath(space3), null, true)); } }; // src/core/utils/contexts/links.ts -var valueContainsLink = (link, value) => { - return parseMultiString(value).some((f2) => link == parseLinkString(f2)); +var valueContainsLink = (link3, value) => { + return parseMultiString(value).some((f2) => link3 == parseLinkString(f2)); }; -var replaceLinkInValue = (link, newLink, value) => { - return serializeMultiString(parseMultiString(value).map((f2) => parseLinkString(f2) == link ? newLink : link)); +var replaceLinkInValue = (link3, newLink, value) => { + return serializeMultiString(parseMultiString(value).map((f2) => parseLinkString(f2) == link3 ? newLink : link3)); }; -var removeLinkInValue = (link, value) => { - return serializeMultiString(parseMultiString(value).filter((f2) => f2 != link)); +var removeLinkInValue = (link3, value) => { + return serializeMultiString(parseMultiString(value).filter((f2) => f2 != link3)); }; var linkColumns = (cols) => { return cols.filter((f2) => f2.type.startsWith("link") || f2.type.startsWith("context")); }; -var removeLinksInRow = (manager, row2, link, cols) => { +var removeLinksInRow = (manager, row2, link3, cols) => { if (cols.length == 0) { return row2; } - const deltaRow = cols.reduce((p, c3) => { - if (valueContainsLink(link, row2[c3.name])) { - const newValue = removeLinkInValue(link, row2[c3.name]); + const deltaRow = cols.reduce((p2, c3) => { + if (valueContainsLink(link3, row2[c3.name])) { + const newValue = removeLinkInValue(link3, row2[c3.name]); manager.saveProperties(row2[PathPropertyName], { [c3.name]: parseMDBValue(c3.type, newValue) }); - return { ...p, [c3.name]: newValue }; + return { ...p2, [c3.name]: newValue }; } - return p; + return p2; }, {}); return { ...row2, ...deltaRow }; }; -var renameLinksInRow = (manager, row2, link, newLink, cols) => { +var renameLinksInRow = (manager, row2, link3, newLink, cols) => { if (cols.length == 0) { return row2; } - const deltaRow = cols.reduce((p, c3) => { - if (valueContainsLink(link, row2[c3.name])) { - const newValue = replaceLinkInValue(link, newLink, row2[c3.name]); + const deltaRow = cols.reduce((p2, c3) => { + if (valueContainsLink(link3, row2[c3.name])) { + const newValue = replaceLinkInValue(link3, newLink, row2[c3.name]); manager.saveProperties(row2[PathPropertyName], { [c3.name]: parseMDBValue(c3.type, newValue) }); - return { ...p, [c3.name]: newValue }; + return { ...p2, [c3.name]: newValue }; } - return p; + return p2; }, {}); return { ...row2, ...deltaRow }; }; @@ -33294,7 +33399,7 @@ var removeRowsForPath = (spaceTable, paths) => { ) }; }; -var reorderRowsForPath = (spaceTable, paths, index2) => { +var reorderRowsForPath = (spaceTable, paths, index3) => { const rows = spaceTable.rows.filter( (f2) => paths.includes(f2[PathPropertyName]) ); @@ -33302,7 +33407,7 @@ var reorderRowsForPath = (spaceTable, paths, index2) => { ...spaceTable, rows: insertMulti(spaceTable.rows.filter( (f2) => !paths.includes(f2[PathPropertyName]) - ), index2, rows) + ), index3, rows) }; }; @@ -33323,19 +33428,19 @@ function useCombinedRefs() { refs[_key] = arguments[_key]; } return (0, import_react.useMemo)( - () => (node) => { - refs.forEach((ref2) => ref2(node)); + () => (node2) => { + refs.forEach((ref2) => ref2(node2)); }, refs ); } var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; -function isWindow(element) { - const elementString = Object.prototype.toString.call(element); +function isWindow(element3) { + const elementString = Object.prototype.toString.call(element3); return elementString === "[object Window]" || elementString === "[object global]"; } -function isNode(node) { - return "nodeType" in node; +function isNode(node2) { + return "nodeType" in node2; } function getWindow(target) { var _target$ownerDocument, _target$ownerDocument2; @@ -33350,20 +33455,20 @@ function getWindow(target) { } return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; } -function isDocument(node) { +function isDocument(node2) { const { Document - } = getWindow(node); - return node instanceof Document; + } = getWindow(node2); + return node2 instanceof Document; } -function isHTMLElement(node) { - if (isWindow(node)) { +function isHTMLElement(node2) { + if (isWindow(node2)) { return false; } - return node instanceof getWindow(node).HTMLElement; + return node2 instanceof getWindow(node2).HTMLElement; } -function isSVGElement(node) { - return node instanceof getWindow(node).SVGElement; +function isSVGElement(node2) { + return node2 instanceof getWindow(node2).SVGElement; } function getOwnerDocument(target) { if (!target) { @@ -33434,17 +33539,17 @@ function useLazyMemo(callback, dependencies314) { } function useNodeRef(onChange) { const onChangeHandler = useEvent(onChange); - const node = (0, import_react.useRef)(null); + const node2 = (0, import_react.useRef)(null); const setNodeRef = (0, import_react.useCallback)( - (element) => { - if (element !== node.current) { - onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); + (element3) => { + if (element3 !== node2.current) { + onChangeHandler == null ? void 0 : onChangeHandler(element3, node2.current); } - node.current = element; + node2.current = element3; }, [] ); - return [node, setNodeRef]; + return [node2, setNodeRef]; } function usePrevious(value) { const ref2 = (0, import_react.useRef)(); @@ -33471,10 +33576,10 @@ function createAdjustmentFn(modifier) { } return adjustments.reduce((accumulator, adjustment) => { const entries = Object.entries(adjustment); - for (const [key2, valueAdjustment] of entries) { - const value = accumulator[key2]; + for (const [key3, valueAdjustment] of entries) { + const value = accumulator[key3]; if (value != null) { - accumulator[key2] = value + modifier * valueAdjustment; + accumulator[key3] = value + modifier * valueAdjustment; } } return accumulator; @@ -33581,11 +33686,11 @@ var CSS = /* @__PURE__ */ Object.freeze({ } }); var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"; -function findFirstFocusableNode(element) { - if (element.matches(SELECTOR)) { - return element; +function findFirstFocusableNode(element3) { + if (element3.matches(SELECTOR)) { + return element3; } - return element.querySelector(SELECTOR); + return element3.querySelector(SELECTOR); } // node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js @@ -33945,8 +34050,8 @@ var closestCorners = (_ref) => { const rect = droppableRects.get(id3); if (rect) { const rectCorners = cornersOfRectangle(rect); - const distances = corners.reduce((accumulator, corner, index2) => { - return accumulator + distanceBetween(rectCorners[index2], corner); + const distances = corners.reduce((accumulator, corner, index3) => { + return accumulator + distanceBetween(rectCorners[index3], corner); }, 0); const effectiveDistance = Number((distances / 4).toFixed(4)); collisions.push({ @@ -34080,16 +34185,16 @@ function inverseTransform(rect, transform, transformOrigin) { var defaultOptions2 = { ignoreTransform: false }; -function getClientRect(element, options) { +function getClientRect(element3, options) { if (options === void 0) { options = defaultOptions2; } - let rect = element.getBoundingClientRect(); + let rect = element3.getBoundingClientRect(); if (options.ignoreTransform) { const { transform, transformOrigin - } = getWindow(element).getComputedStyle(element); + } = getWindow(element3).getComputedStyle(element3); if (transform) { rect = inverseTransform(rect, transform, transformOrigin); } @@ -34111,14 +34216,14 @@ function getClientRect(element, options) { right }; } -function getTransformAgnosticClientRect(element) { - return getClientRect(element, { +function getTransformAgnosticClientRect(element3) { + return getClientRect(element3, { ignoreTransform: true }); } -function getWindowClientRect(element) { - const width = element.innerWidth; - const height = element.innerHeight; +function getWindowClientRect(element3) { + const width = element3.innerWidth; + const height = element3.innerHeight; return { top: 0, left: 0, @@ -34128,15 +34233,15 @@ function getWindowClientRect(element) { height }; } -function isFixed(node, computedStyle) { +function isFixed(node2, computedStyle) { if (computedStyle === void 0) { - computedStyle = getWindow(node).getComputedStyle(node); + computedStyle = getWindow(node2).getComputedStyle(node2); } return computedStyle.position === "fixed"; } -function isScrollable(element, computedStyle) { +function isScrollable(element3, computedStyle) { if (computedStyle === void 0) { - computedStyle = getWindow(element).getComputedStyle(element); + computedStyle = getWindow(element3).getComputedStyle(element3); } const overflowRegex = /(auto|scroll|overlay)/; const properties3 = ["overflow", "overflowX", "overflowY"]; @@ -34145,79 +34250,79 @@ function isScrollable(element, computedStyle) { return typeof value === "string" ? overflowRegex.test(value) : false; }); } -function getScrollableAncestors(element, limit) { +function getScrollableAncestors(element3, limit) { const scrollParents = []; - function findScrollableAncestors(node) { + function findScrollableAncestors(node2) { if (limit != null && scrollParents.length >= limit) { return scrollParents; } - if (!node) { + if (!node2) { return scrollParents; } - if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { - scrollParents.push(node.scrollingElement); + if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) { + scrollParents.push(node2.scrollingElement); return scrollParents; } - if (!isHTMLElement(node) || isSVGElement(node)) { + if (!isHTMLElement(node2) || isSVGElement(node2)) { return scrollParents; } - if (scrollParents.includes(node)) { + if (scrollParents.includes(node2)) { return scrollParents; } - const computedStyle = getWindow(element).getComputedStyle(node); - if (node !== element) { - if (isScrollable(node, computedStyle)) { - scrollParents.push(node); + const computedStyle = getWindow(element3).getComputedStyle(node2); + if (node2 !== element3) { + if (isScrollable(node2, computedStyle)) { + scrollParents.push(node2); } } - if (isFixed(node, computedStyle)) { + if (isFixed(node2, computedStyle)) { return scrollParents; } - return findScrollableAncestors(node.parentNode); + return findScrollableAncestors(node2.parentNode); } - if (!element) { + if (!element3) { return scrollParents; } - return findScrollableAncestors(element); + return findScrollableAncestors(element3); } -function getFirstScrollableAncestor(node) { - const [firstScrollableAncestor] = getScrollableAncestors(node, 1); +function getFirstScrollableAncestor(node2) { + const [firstScrollableAncestor] = getScrollableAncestors(node2, 1); return firstScrollableAncestor != null ? firstScrollableAncestor : null; } -function getScrollableElement(element) { - if (!canUseDOM || !element) { +function getScrollableElement(element3) { + if (!canUseDOM || !element3) { return null; } - if (isWindow(element)) { - return element; + if (isWindow(element3)) { + return element3; } - if (!isNode(element)) { + if (!isNode(element3)) { return null; } - if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) { + if (isDocument(element3) || element3 === getOwnerDocument(element3).scrollingElement) { return window; } - if (isHTMLElement(element)) { - return element; + if (isHTMLElement(element3)) { + return element3; } return null; } -function getScrollXCoordinate(element) { - if (isWindow(element)) { - return element.scrollX; +function getScrollXCoordinate(element3) { + if (isWindow(element3)) { + return element3.scrollX; } - return element.scrollLeft; + return element3.scrollLeft; } -function getScrollYCoordinate(element) { - if (isWindow(element)) { - return element.scrollY; +function getScrollYCoordinate(element3) { + if (isWindow(element3)) { + return element3.scrollY; } - return element.scrollTop; + return element3.scrollTop; } -function getScrollCoordinates(element) { +function getScrollCoordinates(element3) { return { - x: getScrollXCoordinate(element), - y: getScrollYCoordinate(element) + x: getScrollXCoordinate(element3), + y: getScrollYCoordinate(element3) }; } var Direction2; @@ -34225,11 +34330,11 @@ var Direction2; Direction3[Direction3["Forward"] = 1] = "Forward"; Direction3[Direction3["Backward"] = -1] = "Backward"; })(Direction2 || (Direction2 = {})); -function isDocumentScrollingElement(element) { - if (!canUseDOM || !element) { +function isDocumentScrollingElement(element3) { + if (!canUseDOM || !element3) { return false; } - return element === document.scrollingElement; + return element3 === document.scrollingElement; } function getScrollPosition(scrollingContainer) { const minScroll = { @@ -34314,8 +34419,8 @@ function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, speed }; } -function getScrollElementRect(element) { - if (element === document.scrollingElement) { +function getScrollElementRect(element3) { + if (element3 === document.scrollingElement) { const { innerWidth: innerWidth2, innerHeight: innerHeight2 @@ -34334,36 +34439,36 @@ function getScrollElementRect(element) { left, right, bottom - } = element.getBoundingClientRect(); + } = element3.getBoundingClientRect(); return { top, left, right, bottom, - width: element.clientWidth, - height: element.clientHeight + width: element3.clientWidth, + height: element3.clientHeight }; } function getScrollOffsets(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return add(acc, getScrollCoordinates(node)); + return scrollableAncestors.reduce((acc, node2) => { + return add(acc, getScrollCoordinates(node2)); }, defaultCoordinates); } function getScrollXOffset(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return acc + getScrollXCoordinate(node); + return scrollableAncestors.reduce((acc, node2) => { + return acc + getScrollXCoordinate(node2); }, 0); } function getScrollYOffset(scrollableAncestors) { - return scrollableAncestors.reduce((acc, node) => { - return acc + getScrollYCoordinate(node); + return scrollableAncestors.reduce((acc, node2) => { + return acc + getScrollYCoordinate(node2); }, 0); } -function scrollIntoViewIfNeeded(element, measure) { +function scrollIntoViewIfNeeded(element3, measure) { if (measure === void 0) { measure = getClientRect; } - if (!element) { + if (!element3) { return; } const { @@ -34371,13 +34476,13 @@ function scrollIntoViewIfNeeded(element, measure) { left, bottom, right - } = measure(element); - const firstScrollableAncestor = getFirstScrollableAncestor(element); + } = measure(element3); + const firstScrollableAncestor = getFirstScrollableAncestor(element3); if (!firstScrollableAncestor) { return; } if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { - element.scrollIntoView({ + element3.scrollIntoView({ block: "center", inline: "center" }); @@ -34385,7 +34490,7 @@ function scrollIntoViewIfNeeded(element, measure) { } var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]]; var Rect = class { - constructor(rect, element) { + constructor(rect, element3) { this.rect = void 0; this.width = void 0; this.height = void 0; @@ -34393,20 +34498,20 @@ var Rect = class { this.bottom = void 0; this.right = void 0; this.left = void 0; - const scrollableAncestors = getScrollableAncestors(element); + const scrollableAncestors = getScrollableAncestors(element3); const scrollOffsets = getScrollOffsets(scrollableAncestors); this.rect = { ...rect }; this.width = rect.width; this.height = rect.height; - for (const [axis, keys, getScrollOffset] of properties) { - for (const key2 of keys) { - Object.defineProperty(this, key2, { + for (const [axis, keys2, getScrollOffset] of properties) { + for (const key3 of keys2) { + Object.defineProperty(this, key3, { get: () => { const currentOffsets = getScrollOffset(scrollableAncestors); const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets; - return this.rect[key2] + scrollOffsetsDeltla; + return this.rect[key3] + scrollOffsetsDeltla; }, enumerable: true }); @@ -34548,9 +34653,9 @@ var KeyboardSensor = class { activeNode, onStart } = this.props; - const node = activeNode.node.current; - if (node) { - scrollIntoViewIfNeeded(node); + const node2 = activeNode.node.current; + if (node2) { + scrollIntoViewIfNeeded(node2); } onStart(defaultCoordinates); } @@ -34567,13 +34672,13 @@ var KeyboardSensor = class { scrollBehavior = "smooth" } = options; const { - code + code: code3 } = event; - if (keyboardCodes.end.includes(code)) { + if (keyboardCodes.end.includes(code3)) { this.handleEnd(event); return; } - if (keyboardCodes.cancel.includes(code)) { + if (keyboardCodes.cancel.includes(code3)) { this.handleCancel(event); return; } @@ -34707,9 +34812,9 @@ KeyboardSensor.activators = [{ active } = _ref2; const { - code + code: code3 } = event.nativeEvent; - if (keyboardCodes.start.includes(code)) { + if (keyboardCodes.start.includes(code3)) { const activator = active.activatorNode.current; if (activator && event.target !== activator) { return false; @@ -35027,7 +35132,7 @@ function useAutoScroller(_ref) { draggingRect, enabled, interval = 5, - order = TraversalOrder.TreeOrder, + order: order2 = TraversalOrder.TreeOrder, pointerCoordinates, scrollableAncestors, scrollableAncestorRects, @@ -35070,7 +35175,7 @@ function useAutoScroller(_ref) { const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; scrollContainer.scrollBy(scrollLeft, scrollTop); }, []); - const sortedScrollableAncestors = (0, import_react3.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); + const sortedScrollableAncestors = (0, import_react3.useMemo)(() => order2 === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order2, scrollableAncestors]); (0, import_react3.useEffect)( () => { if (!enabled || !scrollableAncestors.length || !rect) { @@ -35081,8 +35186,8 @@ function useAutoScroller(_ref) { if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { continue; } - const index2 = scrollableAncestors.indexOf(scrollContainer); - const scrollContainerRect = scrollableAncestorRects[index2]; + const index3 = scrollableAncestors.indexOf(scrollContainer); + const scrollContainerRect = scrollableAncestorRects[index3]; if (!scrollContainerRect) { continue; } @@ -35170,14 +35275,14 @@ function useScrollIntent(_ref2) { } function useCachedNode(draggableNodes, id3) { const draggableNode = id3 !== null ? draggableNodes.get(id3) : void 0; - const node = draggableNode ? draggableNode.node.current : null; + const node2 = draggableNode ? draggableNode.node.current : null; return useLazyMemo((cachedNode) => { var _ref; if (id3 === null) { return null; } - return (_ref = node != null ? node : cachedNode) != null ? _ref : null; - }, [node, id3]); + return (_ref = node2 != null ? node2 : cachedNode) != null ? _ref : null; + }, [node2, id3]); } function useCombineActivators(sensors, getSyntheticHandler) { return (0, import_react3.useMemo)(() => sensors.reduce((accumulator, sensor) => { @@ -35237,23 +35342,23 @@ function useDroppableMeasuring(containers, _ref) { return defaultValue; } if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) { - const map4 = /* @__PURE__ */ new Map(); + const map6 = /* @__PURE__ */ new Map(); for (let container of containers) { if (!container) { continue; } if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { - map4.set(container.id, container.rect.current); + map6.set(container.id, container.rect.current); continue; } - const node = container.node.current; - const rect = node ? new Rect(measure(node), node) : null; + const node2 = container.node.current; + const rect = node2 ? new Rect(measure(node2), node2) : null; container.rect.current = rect; if (rect) { - map4.set(container.id, rect); + map6.set(container.id, rect); } } - return map4; + return map6; } return previousValue; }, [containers, queue, dragging, disabled, measure]); @@ -35316,8 +35421,8 @@ function useInitialValue(value, computeFn) { return typeof computeFn === "function" ? computeFn(value) : value; }, [computeFn, value]); } -function useInitialRect(node, measure) { - return useInitialValue(node, measure); +function useInitialRect(node2, measure) { + return useInitialValue(node2, measure); } function useMutationObserver(_ref) { let { @@ -35330,9 +35435,9 @@ function useMutationObserver(_ref) { return void 0; } const { - MutationObserver: MutationObserver2 + MutationObserver } = window; - return new MutationObserver2(handleMutations); + return new MutationObserver(handleMutations); }, [handleMutations, disabled]); (0, import_react3.useEffect)(() => { return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); @@ -35362,17 +35467,17 @@ function useResizeObserver(_ref) { }, [resizeObserver]); return resizeObserver; } -function defaultMeasure(element) { - return new Rect(getClientRect(element), element); +function defaultMeasure(element3) { + return new Rect(getClientRect(element3), element3); } -function useRect(element, measure, fallbackRect) { +function useRect(element3, measure, fallbackRect) { if (measure === void 0) { measure = defaultMeasure; } const [rect, measureRect] = (0, import_react3.useReducer)(reducer3, null); const mutationObserver = useMutationObserver({ callback(records) { - if (!element) { + if (!element3) { return; } for (const record of records) { @@ -35380,7 +35485,7 @@ function useRect(element, measure, fallbackRect) { type, target } = record; - if (type === "childList" && target instanceof HTMLElement && target.contains(element)) { + if (type === "childList" && target instanceof HTMLElement && target.contains(element3)) { measureRect(); break; } @@ -35392,8 +35497,8 @@ function useRect(element, measure, fallbackRect) { }); useIsomorphicLayoutEffect(() => { measureRect(); - if (element) { - resizeObserver == null ? void 0 : resizeObserver.observe(element); + if (element3) { + resizeObserver == null ? void 0 : resizeObserver.observe(element3); mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { childList: true, subtree: true @@ -35402,17 +35507,17 @@ function useRect(element, measure, fallbackRect) { resizeObserver == null ? void 0 : resizeObserver.disconnect(); mutationObserver == null ? void 0 : mutationObserver.disconnect(); } - }, [element]); + }, [element3]); return rect; function reducer3(currentRect) { - if (!element) { + if (!element3) { return null; } - if (element.isConnected === false) { + if (element3.isConnected === false) { var _ref; return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; } - const newRect = measure(element); + const newRect = measure(element3); if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { return currentRect; } @@ -35424,20 +35529,20 @@ function useRectDelta(rect) { return getRectDelta(rect, initialRect); } var defaultValue$1 = []; -function useScrollableAncestors(node) { - const previousNode = (0, import_react3.useRef)(node); +function useScrollableAncestors(node2) { + const previousNode = (0, import_react3.useRef)(node2); const ancestors = useLazyMemo((previousValue) => { - if (!node) { + if (!node2) { return defaultValue$1; } - if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { + if (previousValue && previousValue !== defaultValue$1 && node2 && previousNode.current && node2.parentNode === previousNode.current.parentNode) { return previousValue; } - return getScrollableAncestors(node); - }, [node]); + return getScrollableAncestors(node2); + }, [node2]); (0, import_react3.useEffect)(() => { - previousNode.current = node; - }, [node]); + previousNode.current = node2; + }, [node2]); return ancestors; } function useScrollOffsets(elements) { @@ -35460,8 +35565,8 @@ function useScrollOffsets(elements) { const previousElements = prevElements.current; if (elements !== previousElements) { cleanup(previousElements); - const entries = elements.map((element) => { - const scrollableElement = getScrollableElement(element); + const entries = elements.map((element3) => { + const scrollableElement = getScrollableElement(element3); if (scrollableElement) { scrollableElement.addEventListener("scroll", handleScroll, { passive: true @@ -35478,8 +35583,8 @@ function useScrollOffsets(elements) { cleanup(previousElements); }; function cleanup(elements2) { - elements2.forEach((element) => { - const scrollableElement = getScrollableElement(element); + elements2.forEach((element3) => { + const scrollableElement = getScrollableElement(element3); scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll); }); } @@ -35553,8 +35658,8 @@ function useSyntheticListeners(listeners, id3) { }, {}); }, [listeners, id3]); } -function useWindowRect(element) { - return (0, import_react3.useMemo)(() => element ? getWindowClientRect(element) : null, [element]); +function useWindowRect(element3) { + return (0, import_react3.useMemo)(() => element3 ? getWindowClientRect(element3) : null, [element3]); } var defaultValue$2 = []; function useRects(elements, measure) { @@ -35572,7 +35677,7 @@ function useRects(elements, measure) { } useIsomorphicLayoutEffect(() => { if (elements.length) { - elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element)); + elements.forEach((element3) => resizeObserver == null ? void 0 : resizeObserver.observe(element3)); } else { resizeObserver == null ? void 0 : resizeObserver.disconnect(); measureRects(); @@ -35583,18 +35688,18 @@ function useRects(elements, measure) { if (!elements.length) { return defaultValue$2; } - return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)); + return elements.map((element3) => isDocumentScrollingElement(element3) ? windowRect : new Rect(measure(element3), element3)); } } -function getMeasurableNode(node) { - if (!node) { +function getMeasurableNode(node2) { + if (!node2) { return null; } - if (node.children.length > 1) { - return node; + if (node2.children.length > 1) { + return node2; } - const firstChild = node.children[0]; - return isHTMLElement(firstChild) ? firstChild : node; + const firstChild = node2.children[0]; + return isHTMLElement(firstChild) ? firstChild : node2; } function useDragOverlayMeasuring(_ref) { let { @@ -35621,13 +35726,13 @@ function useDragOverlayMeasuring(_ref) { const resizeObserver = useResizeObserver({ callback: handleResize }); - const handleNodeChange = (0, import_react3.useCallback)((element) => { - const node = getMeasurableNode(element); + const handleNodeChange = (0, import_react3.useCallback)((element3) => { + const node2 = getMeasurableNode(element3); resizeObserver == null ? void 0 : resizeObserver.disconnect(); - if (node) { - resizeObserver == null ? void 0 : resizeObserver.observe(node); + if (node2) { + resizeObserver == null ? void 0 : resizeObserver.observe(node2); } - setRect(node ? measure(node) : null); + setRect(node2 ? measure(node2) : null); }, [measure, resizeObserver]); const [nodeRef, setRef] = useNodeRef(handleNodeChange); return (0, import_react3.useMemo)(() => ({ @@ -35783,13 +35888,13 @@ function reducer(state, action) { }; case Action.RegisterDroppable: { const { - element + element: element3 } = action; const { id: id3 - } = element; + } = element3; const containers = new DroppableContainersMap(state.droppable.containers); - containers.set(id3, element); + containers.set(id3, element3); return { ...state, droppable: { @@ -35801,16 +35906,16 @@ function reducer(state, action) { case Action.SetDroppableDisabled: { const { id: id3, - key: key2, + key: key3, disabled } = action; - const element = state.droppable.containers.get(id3); - if (!element || key2 !== element.key) { + const element3 = state.droppable.containers.get(id3); + if (!element3 || key3 !== element3.key) { return state; } const containers = new DroppableContainersMap(state.droppable.containers); containers.set(id3, { - ...element, + ...element3, disabled }); return { @@ -35824,10 +35929,10 @@ function reducer(state, action) { case Action.UnregisterDroppable: { const { id: id3, - key: key2 + key: key3 } = action; - const element = state.droppable.containers.get(id3); - if (!element || key2 !== element.key) { + const element3 = state.droppable.containers.get(id3); + if (!element3 || key3 !== element3.key) { return state; } const containers = new DroppableContainersMap(state.droppable.containers); @@ -35873,17 +35978,17 @@ function RestoreFocus(_ref) { } const { activatorNode, - node + node: node2 } = draggableNode; - if (!activatorNode.current && !node.current) { + if (!activatorNode.current && !node2.current) { return; } requestAnimationFrame(() => { - for (const element of [activatorNode.current, node.current]) { - if (!element) { + for (const element3 of [activatorNode.current, node2.current]) { + if (!element3) { continue; } - const focusableNode = findFirstFocusableNode(element); + const focusableNode = findFirstFocusableNode(element3); if (focusableNode) { focusableNode.focus(); break; @@ -35949,11 +36054,11 @@ function useLayoutShiftScrollCompensation(_ref) { if (initialized.current || !initialRect) { return; } - const node = activeNode == null ? void 0 : activeNode.node.current; - if (!node || node.isConnected === false) { + const node2 = activeNode == null ? void 0 : activeNode.node.current; + if (!node2 || node2.isConnected === false) { return; } - const rect = measure(node); + const rect = measure(node2); const rectDelta = getRectDelta(rect, initialRect); if (!x2) { rectDelta.x = 0; @@ -35963,7 +36068,7 @@ function useLayoutShiftScrollCompensation(_ref) { } initialized.current = true; if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { - const firstScrollableAncestor = getFirstScrollableAncestor(node); + const firstScrollableAncestor = getFirstScrollableAncestor(node2); if (firstScrollableAncestor) { firstScrollableAncestor.scrollBy({ top: rectDelta.y, @@ -36012,7 +36117,7 @@ var DndContext = /* @__PURE__ */ (0, import_react3.memo)(function DndContext2(_r containers: droppableContainers } } = state; - const node = activeId ? draggableNodes.get(activeId) : null; + const node2 = activeId ? draggableNodes.get(activeId) : null; const activeRects = (0, import_react3.useRef)({ initial: null, translated: null @@ -36021,10 +36126,10 @@ var DndContext = /* @__PURE__ */ (0, import_react3.memo)(function DndContext2(_r var _node$data; return activeId != null ? { id: activeId, - data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, + data: (_node$data = node2 == null ? void 0 : node2.data) != null ? _node$data : defaultData, rect: activeRects } : null; - }, [activeId, node]); + }, [activeId, node2]); const activeRef = (0, import_react3.useRef)(null); const [activeSensor, setActiveSensor] = (0, import_react3.useState)(null); const [activatorEvent, setActivatorEvent] = (0, import_react3.useState)(null); @@ -36437,11 +36542,11 @@ var ID_PREFIX = "Droppable"; function useDraggable(_ref) { let { id: id3, - data: data2, + data: data3, disabled = false, attributes } = _ref; - const key2 = useUniqueId(ID_PREFIX); + const key3 = useUniqueId(ID_PREFIX); const { activators, activatorEvent, @@ -36458,22 +36563,22 @@ function useDraggable(_ref) { } = attributes != null ? attributes : {}; const isDragging = (active == null ? void 0 : active.id) === id3; const transform = (0, import_react3.useContext)(isDragging ? ActiveDraggableContext : NullContext); - const [node, setNodeRef] = useNodeRef(); + const [node2, setNodeRef] = useNodeRef(); const [activatorNode, setActivatorNodeRef] = useNodeRef(); const listeners = useSyntheticListeners(activators, id3); - const dataRef = useLatestValue(data2); + const dataRef = useLatestValue(data3); useIsomorphicLayoutEffect( () => { draggableNodes.set(id3, { id: id3, - key: key2, - node, + key: key3, + node: node2, activatorNode, data: dataRef }); return () => { - const node2 = draggableNodes.get(id3); - if (node2 && node2.key === key2) { + const node3 = draggableNodes.get(id3); + if (node3 && node3.key === key3) { draggableNodes.delete(id3); } }; @@ -36495,7 +36600,7 @@ function useDraggable(_ref) { attributes: memoizedAttributes, isDragging, listeners: disabled ? void 0 : listeners, - node, + node: node2, over, setNodeRef, setActivatorNodeRef, @@ -36511,19 +36616,19 @@ var defaultResizeObserverConfig = { }; function useDroppable(_ref) { let { - data: data2, + data: data3, disabled = false, id: id3, resizeObserverConfig } = _ref; - const key2 = useUniqueId(ID_PREFIX$1); + const key3 = useUniqueId(ID_PREFIX$1); const { active, dispatch, over, measureDroppableContainers } = (0, import_react3.useContext)(InternalContext); - const previous = (0, import_react3.useRef)({ + const previous2 = (0, import_react3.useRef)({ disabled }); const resizeObserverConnected = (0, import_react3.useRef)(false); @@ -36571,7 +36676,7 @@ function useDroppable(_ref) { } }, [resizeObserver]); const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange); - const dataRef = useLatestValue(data2); + const dataRef = useLatestValue(data3); (0, import_react3.useEffect)(() => { if (!resizeObserver || !nodeRef.current) { return; @@ -36586,7 +36691,7 @@ function useDroppable(_ref) { type: Action.RegisterDroppable, element: { id: id3, - key: key2, + key: key3, disabled, node: nodeRef, rect, @@ -36595,23 +36700,23 @@ function useDroppable(_ref) { }); return () => dispatch({ type: Action.UnregisterDroppable, - key: key2, + key: key3, id: id3 }); }, [id3] ); (0, import_react3.useEffect)(() => { - if (disabled !== previous.current.disabled) { + if (disabled !== previous2.current.disabled) { dispatch({ type: Action.SetDroppableDisabled, id: id3, - key: key2, + key: key3, disabled }); - previous.current.disabled = disabled; + previous2.current.disabled = disabled; } - }, [id3, key2, disabled, dispatch]); + }, [id3, key3, disabled, dispatch]); return { active, rect, @@ -36627,25 +36732,25 @@ function AnimationManager(_ref) { children } = _ref; const [clonedChildren, setClonedChildren] = (0, import_react3.useState)(null); - const [element, setElement] = (0, import_react3.useState)(null); + const [element3, setElement] = (0, import_react3.useState)(null); const previousChildren = usePrevious(children); if (!children && !clonedChildren && previousChildren) { setClonedChildren(previousChildren); } useIsomorphicLayoutEffect(() => { - if (!element) { + if (!element3) { return; } - const key2 = clonedChildren == null ? void 0 : clonedChildren.key; + const key3 = clonedChildren == null ? void 0 : clonedChildren.key; const id3 = clonedChildren == null ? void 0 : clonedChildren.props.id; - if (key2 == null || id3 == null) { + if (key3 == null || id3 == null) { setClonedChildren(null); return; } - Promise.resolve(animation(id3, element)).then(() => { + Promise.resolve(animation(id3, element3)).then(() => { setClonedChildren(null); }); - }, [animation, clonedChildren, element]); + }, [animation, clonedChildren, element3]); return import_react3.default.createElement(import_react3.default.Fragment, null, children, clonedChildren ? (0, import_react3.cloneElement)(clonedChildren, { ref: setElement }) : null); @@ -36722,20 +36827,20 @@ var defaultDropAnimationSideEffects = (options) => (_ref) => { className } = options; if (styles2 != null && styles2.active) { - for (const [key2, value] of Object.entries(styles2.active)) { + for (const [key3, value] of Object.entries(styles2.active)) { if (value === void 0) { continue; } - originalStyles[key2] = active.node.style.getPropertyValue(key2); - active.node.style.setProperty(key2, value); + originalStyles[key3] = active.node.style.getPropertyValue(key3); + active.node.style.setProperty(key3, value); } } if (styles2 != null && styles2.dragOverlay) { - for (const [key2, value] of Object.entries(styles2.dragOverlay)) { + for (const [key3, value] of Object.entries(styles2.dragOverlay)) { if (value === void 0) { continue; } - dragOverlay.node.style.setProperty(key2, value); + dragOverlay.node.style.setProperty(key3, value); } } if (className != null && className.active) { @@ -36745,8 +36850,8 @@ var defaultDropAnimationSideEffects = (options) => (_ref) => { dragOverlay.node.classList.add(className.dragOverlay); } return function cleanup() { - for (const [key2, value] of Object.entries(originalStyles)) { - active.node.style.setProperty(key2, value); + for (const [key3, value] of Object.entries(originalStyles)) { + active.node.style.setProperty(key3, value); } if (className != null && className.active) { active.node.classList.remove(className.active); @@ -36785,7 +36890,7 @@ function useDropAnimation(_ref3) { droppableContainers, measuringConfiguration } = _ref3; - return useEvent((id3, node) => { + return useEvent((id3, node2) => { if (config4 === null) { return; } @@ -36797,13 +36902,13 @@ function useDropAnimation(_ref3) { if (!activeNode) { return; } - const measurableNode = getMeasurableNode(node); + const measurableNode = getMeasurableNode(node2); if (!measurableNode) { return; } const { transform - } = getWindow(node).getComputedStyle(node); + } = getWindow(node2).getComputedStyle(node2); const parsedTransform = parseTransform(transform); if (!parsedTransform) { return; @@ -36819,7 +36924,7 @@ function useDropAnimation(_ref3) { }, draggableNodes, dragOverlay: { - node, + node: node2, rect: measuringConfiguration.dragOverlay.measure(measurableNode) }, droppableContainers, @@ -36930,7 +37035,7 @@ var DragOverlay = /* @__PURE__ */ import_react3.default.memo((_ref) => { windowRect } = useDndContext(); const transform = (0, import_react3.useContext)(ActiveDraggableContext); - const key2 = useKey(active == null ? void 0 : active.id); + const key3 = useKey(active == null ? void 0 : active.id); const modifiedTransform = applyModifiers(modifiers, { activatorEvent, active, @@ -36954,8 +37059,8 @@ var DragOverlay = /* @__PURE__ */ import_react3.default.memo((_ref) => { const ref2 = initialRect ? dragOverlay.setRef : void 0; return import_react3.default.createElement(NullifiedContextProvider, null, import_react3.default.createElement(AnimationManager, { animation: dropAnimation - }, active && key2 ? import_react3.default.createElement(PositionedOverlay, { - key: key2, + }, active && key3 ? import_react3.default.createElement(PositionedOverlay, { + key: key3, id: active.id, ref: ref2, as: wrapperElement, @@ -36979,16 +37084,16 @@ function arrayMove(array, from, to2) { return newArray; } function getSortedRects(items, rects) { - return items.reduce((accumulator, id3, index2) => { + return items.reduce((accumulator, id3, index3) => { const rect = rects.get(id3); if (rect) { - accumulator[index2] = rect; + accumulator[index3] = rect; } return accumulator; }, Array(items.length)); } -function isValidIndex(index2) { - return index2 !== null && index2 >= 0; +function isValidIndex(index3) { + return index3 !== null && index3 >= 0; } function itemsEqual(a4, b2) { if (a4 === b2) { @@ -37018,11 +37123,11 @@ var rectSortingStrategy = (_ref) => { rects, activeIndex, overIndex, - index: index2 + index: index3 } = _ref; const newRects = arrayMove(rects, overIndex, activeIndex); - const oldRect = rects[index2]; - const newRect = newRects[index2]; + const oldRect = rects[index3]; + const newRect = newRects[index3]; if (!newRect || !oldRect) { return null; } @@ -37042,7 +37147,7 @@ var verticalListSortingStrategy = (_ref) => { let { activeIndex, activeNodeRect: fallbackActiveRect, - index: index2, + index: index3, rects, overIndex } = _ref; @@ -37050,7 +37155,7 @@ var verticalListSortingStrategy = (_ref) => { if (!activeNodeRect) { return null; } - if (index2 === activeIndex) { + if (index3 === activeIndex) { const overIndexRect = rects[overIndex]; if (!overIndexRect) { return null; @@ -37061,15 +37166,15 @@ var verticalListSortingStrategy = (_ref) => { ...defaultScale$1 }; } - const itemGap = getItemGap$1(rects, index2, activeIndex); - if (index2 > activeIndex && index2 <= overIndex) { + const itemGap = getItemGap$1(rects, index3, activeIndex); + if (index3 > activeIndex && index3 <= overIndex) { return { x: 0, y: -activeNodeRect.height - itemGap, ...defaultScale$1 }; } - if (index2 < activeIndex && index2 >= overIndex) { + if (index3 < activeIndex && index3 >= overIndex) { return { x: 0, y: activeNodeRect.height + itemGap, @@ -37082,14 +37187,14 @@ var verticalListSortingStrategy = (_ref) => { ...defaultScale$1 }; }; -function getItemGap$1(clientRects, index2, activeIndex) { - const currentRect = clientRects[index2]; - const previousRect = clientRects[index2 - 1]; - const nextRect = clientRects[index2 + 1]; +function getItemGap$1(clientRects, index3, activeIndex) { + const currentRect = clientRects[index3]; + const previousRect = clientRects[index3 - 1]; + const nextRect = clientRects[index3 + 1]; if (!currentRect) { return 0; } - if (activeIndex < index2) { + if (activeIndex < index3) { return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0; } return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0; @@ -37174,7 +37279,7 @@ var defaultAnimateLayoutChanges = (_ref2) => { containerId, isSorting, wasDragging, - index: index2, + index: index3, items, newIndex, previousItems, @@ -37184,13 +37289,13 @@ var defaultAnimateLayoutChanges = (_ref2) => { if (!transition || !wasDragging) { return false; } - if (previousItems !== items && index2 === newIndex) { + if (previousItems !== items && index3 === newIndex) { return false; } if (isSorting) { return true; } - return newIndex !== index2 && containerId === previousContainerId; + return newIndex !== index3 && containerId === previousContainerId; }; var defaultTransition2 = { duration: 200, @@ -37208,17 +37313,17 @@ var defaultAttributes = { function useDerivedTransform(_ref) { let { disabled, - index: index2, - node, + index: index3, + node: node2, rect } = _ref; const [derivedTransform, setDerivedtransform] = (0, import_react4.useState)(null); - const previousIndex = (0, import_react4.useRef)(index2); + const previousIndex = (0, import_react4.useRef)(index3); useIsomorphicLayoutEffect(() => { - if (!disabled && index2 !== previousIndex.current && node.current) { + if (!disabled && index3 !== previousIndex.current && node2.current) { const initial = rect.current; if (initial) { - const current3 = getClientRect(node.current, { + const current3 = getClientRect(node2.current, { ignoreTransform: true }); const delta = { @@ -37232,10 +37337,10 @@ function useDerivedTransform(_ref) { } } } - if (index2 !== previousIndex.current) { - previousIndex.current = index2; + if (index3 !== previousIndex.current) { + previousIndex.current = index3; } - }, [disabled, index2, node, rect]); + }, [disabled, index3, node2, rect]); (0, import_react4.useEffect)(() => { if (derivedTransform) { setDerivedtransform(null); @@ -37267,24 +37372,24 @@ function useSortable(_ref) { strategy: globalStrategy } = (0, import_react4.useContext)(Context); const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); - const index2 = items.indexOf(id3); - const data2 = (0, import_react4.useMemo)(() => ({ + const index3 = items.indexOf(id3); + const data3 = (0, import_react4.useMemo)(() => ({ sortable: { containerId, - index: index2, + index: index3, items }, ...customData - }), [containerId, customData, index2, items]); + }), [containerId, customData, index3, items]); const itemsAfterCurrentSortable = (0, import_react4.useMemo)(() => items.slice(items.indexOf(id3)), [items, id3]); const { rect, - node, + node: node2, isOver, setNodeRef: setDroppableNodeRef } = useDroppable({ id: id3, - data: data2, + data: data3, disabled: disabled.droppable, resizeObserverConfig: { updateMeasurementsFor: itemsAfterCurrentSortable, @@ -37304,7 +37409,7 @@ function useSortable(_ref) { transform } = useDraggable({ id: id3, - data: data2, + data: data3, attributes: { ...defaultAttributes, ...userDefinedAttributes @@ -37322,63 +37427,63 @@ function useSortable(_ref) { activeNodeRect, activeIndex, overIndex, - index: index2 + index: index3 }) : null; const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ id: id3, items, activeIndex, overIndex - }) : index2; + }) : index3; const activeId = active == null ? void 0 : active.id; - const previous = (0, import_react4.useRef)({ + const previous2 = (0, import_react4.useRef)({ activeId, items, newIndex, containerId }); - const itemsHaveChanged = items !== previous.current.items; + const itemsHaveChanged = items !== previous2.current.items; const shouldAnimateLayoutChanges = animateLayoutChanges({ active, containerId, isDragging, isSorting, id: id3, - index: index2, + index: index3, items, - newIndex: previous.current.newIndex, - previousItems: previous.current.items, - previousContainerId: previous.current.containerId, + newIndex: previous2.current.newIndex, + previousItems: previous2.current.items, + previousContainerId: previous2.current.containerId, transition, - wasDragging: previous.current.activeId != null + wasDragging: previous2.current.activeId != null }); const derivedTransform = useDerivedTransform({ disabled: !shouldAnimateLayoutChanges, - index: index2, - node, + index: index3, + node: node2, rect }); (0, import_react4.useEffect)(() => { - if (isSorting && previous.current.newIndex !== newIndex) { - previous.current.newIndex = newIndex; + if (isSorting && previous2.current.newIndex !== newIndex) { + previous2.current.newIndex = newIndex; } - if (containerId !== previous.current.containerId) { - previous.current.containerId = containerId; + if (containerId !== previous2.current.containerId) { + previous2.current.containerId = containerId; } - if (items !== previous.current.items) { - previous.current.items = items; + if (items !== previous2.current.items) { + previous2.current.items = items; } }, [isSorting, newIndex, containerId, items]); (0, import_react4.useEffect)(() => { - if (activeId === previous.current.activeId) { + if (activeId === previous2.current.activeId) { return; } - if (activeId && !previous.current.activeId) { - previous.current.activeId = activeId; + if (activeId && !previous2.current.activeId) { + previous2.current.activeId = activeId; return; } const timeoutId = setTimeout(() => { - previous.current.activeId = activeId; + previous2.current.activeId = activeId; }, 50); return () => clearTimeout(timeoutId); }, [activeId]); @@ -37386,16 +37491,16 @@ function useSortable(_ref) { active, activeIndex, attributes, - data: data2, + data: data3, rect, - index: index2, + index: index3, newIndex, items, isOver, isSorting, isDragging, listeners, - node, + node: node2, overIndex, over, setNodeRef, @@ -37406,7 +37511,7 @@ function useSortable(_ref) { transition: getTransition() }; function getTransition() { - if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index2) { + if (derivedTransform || itemsHaveChanged && previous2.current.newIndex === index3) { return disabledTransition; } if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) { @@ -37438,8 +37543,8 @@ function hasSortableData(entry) { if (!entry) { return false; } - const data2 = entry.data.current; - if (data2 && "sortable" in data2 && typeof data2.sortable === "object" && "containerId" in data2.sortable && "items" in data2.sortable && "index" in data2.sortable) { + const data3 = entry.data.current; + if (data3 && "sortable" in data3 && typeof data3.sortable === "object" && "containerId" in data3.sortable && "items" in data3.sortable && "index" in data3.sortable) { return true; } return false; @@ -37511,7 +37616,7 @@ var sortableKeyboardCoordinates = (event, _ref) => { const newNode2 = newDroppable == null ? void 0 : newDroppable.node.current; if (newNode2 && newRect && activeDroppable && newDroppable) { const newScrollAncestors = getScrollableAncestors(newNode2); - const hasDifferentScrollAncestors = newScrollAncestors.some((element, index2) => scrollableAncestors[index2] !== element); + const hasDifferentScrollAncestors = newScrollAncestors.some((element3, index3) => scrollableAncestors[index3] !== element3); const hasSameContainer = isSameContainer(activeDroppable, newDroppable); const isAfterActive = isAfter2(activeDroppable, newDroppable); const offset2 = hasDifferentScrollAncestors || !hasSameContainer ? { @@ -37691,15 +37796,15 @@ var showMenu = (props) => { return; hasBeenCalled = true; setTimeout(() => { - root.unmount(); + root4.unmount(); document.body.removeChild(portalElement); }, 50); }; }; const hide = hideFunction(); - const root = props.ui.createRoot(portalElement); + const root4 = props.ui.createRoot(portalElement); const updateRoot = (newProps) => { - root.render( + root4.render( /* @__PURE__ */ import_react5.default.createElement(MenuWrapper, { rect: props.rect, ui: props.ui, @@ -37820,14 +37925,14 @@ var InputManager = class { this.events[eventName] = listeners.filter((l2) => l2 !== listener); } } - emit(eventName, data2) { + emit(eventName, data3) { const listeners = this.events[eventName]; if (listeners) { let propagate = false; listeners.slice().reverse().forEach((listener) => { if (propagate) return; - propagate = listener(data2); + propagate = listener(data3); }); } } @@ -37873,12 +37978,12 @@ var UIManager2 = class { availableViews() { return this.mainFrame.availableViews(); } - setActivePath(path2) { - this.activePath = path2; - this.eventsDispatch.dispatchEvent("activePathChanged", path2); + setActivePath(path3) { + this.activePath = path3; + this.eventsDispatch.dispatchEvent("activePathChanged", path3); } - setActiveSelection(path2, content3) { - this.eventsDispatch.dispatchEvent("activeSelectionChanged", { path: path2, content: content3 }); + setActiveSelection(path3, content5) { + this.eventsDispatch.dispatchEvent("activeSelectionChanged", { path: path3, content: content5 }); } mainMenu(el, superstate) { this.mainFrame.mainMenu(el, superstate); @@ -37889,8 +37994,8 @@ var UIManager2 = class { allViews() { return []; } - viewsByPath(path2) { - return this.mainFrame.viewsByPath(path2); + viewsByPath(path3) { + return this.mainFrame.viewsByPath(path3); } static create(adapter, adapters) { return new UIManager2(adapter, adapters); @@ -37904,12 +38009,12 @@ var UIManager2 = class { openCustomMenu(rect, fc, props, defaultAnchor = "right") { return showMenu({ rect, anchor: defaultAnchor, ui: this, fc, props }); } - notify(content3, destination) { + notify(content5, destination) { if (destination == "console") { - console.log(content3); + console.log(content5); return; } - this.mainFrame.openToast(content3); + this.mainFrame.openToast(content5); } error(error) { console.log(error); @@ -37920,11 +38025,11 @@ var UIManager2 = class { openModal(title, modal, className, props) { return this.mainFrame.openModal(title, modal, className, props); } - openPopover(position, popover) { - this.mainFrame.openPopover(position, popover); + openPopover(position3, popover) { + this.mainFrame.openPopover(position3, popover); } - openPath(path2, newLeaf, source, props) { - this.mainFrame.openPath(path2, newLeaf, source, props); + openPath(path3, newLeaf, source, props) { + this.mainFrame.openPath(path3, newLeaf, source, props); } primaryInteractionType() { return this.mainFrame.primaryInteractionType(); @@ -37941,10 +38046,10 @@ var UIManager2 = class { allStickers() { return this.mainFrame.allStickers(); } - getUIPath(path2, thumbnail) { - if (!path2) + getUIPath(path3, thumbnail) { + if (!path3) return null; - return this.mainFrame.getUIPath(path2, thumbnail); + return this.mainFrame.getUIPath(path3, thumbnail); } dragStarted(e5, paths) { this.mainFrame.dragStarted(e5, paths); @@ -37984,67 +38089,67 @@ var keywords$1 = { var keywordRelationalOperator = /^in(stanceof)?$/; var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); -function isInAstralSet(code, set) { +function isInAstralSet(code3, set) { var pos = 65536; for (var i4 = 0; i4 < set.length; i4 += 2) { pos += set[i4]; - if (pos > code) { + if (pos > code3) { return false; } pos += set[i4 + 1]; - if (pos >= code) { + if (pos >= code3) { return true; } } return false; } -function isIdentifierStart(code, astral) { - if (code < 65) { - return code === 36; +function isIdentifierStart(code3, astral) { + if (code3 < 65) { + return code3 === 36; } - if (code < 91) { + if (code3 < 91) { return true; } - if (code < 97) { - return code === 95; + if (code3 < 97) { + return code3 === 95; } - if (code < 123) { + if (code3 < 123) { return true; } - if (code <= 65535) { - return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code)); + if (code3 <= 65535) { + return code3 >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code3)); } if (astral === false) { return false; } - return isInAstralSet(code, astralIdentifierStartCodes); + return isInAstralSet(code3, astralIdentifierStartCodes); } -function isIdentifierChar(code, astral) { - if (code < 48) { - return code === 36; +function isIdentifierChar(code3, astral) { + if (code3 < 48) { + return code3 === 36; } - if (code < 58) { + if (code3 < 58) { return true; } - if (code < 65) { + if (code3 < 65) { return false; } - if (code < 91) { + if (code3 < 91) { return true; } - if (code < 97) { - return code === 95; + if (code3 < 97) { + return code3 === 95; } - if (code < 123) { + if (code3 < 123) { return true; } - if (code <= 65535) { - return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code)); + if (code3 <= 65535) { + return code3 >= 170 && nonASCIIidentifier.test(String.fromCharCode(code3)); } if (astral === false) { return false; } - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); + return isInAstralSet(code3, astralIdentifierStartCodes) || isInAstralSet(code3, astralIdentifierCodes); } var TokenType = function TokenType2(label, conf) { if (conf === void 0) @@ -38153,16 +38258,16 @@ var types$1 = { }; var lineBreak = /\r\n?|\n|\u2028|\u2029/; var lineBreakG = new RegExp(lineBreak.source, "g"); -function isNewLine(code) { - return code === 10 || code === 13 || code === 8232 || code === 8233; +function isNewLine(code3) { + return code3 === 10 || code3 === 13 || code3 === 8232 || code3 === 8233; } -function nextLineBreak(code, from, end) { +function nextLineBreak(code3, from, end) { if (end === void 0) - end = code.length; + end = code3.length; for (var i4 = from; i4 < end; i4++) { - var next = code.charCodeAt(i4); + var next = code3.charCodeAt(i4); if (isNewLine(next)) { - return i4 < end - 1 && next === 13 && code.charCodeAt(i4 + 1) === 10 ? i4 + 2 : i4 + 1; + return i4 < end - 1 && next === 13 && code3.charCodeAt(i4 + 1) === 10 ? i4 + 2 : i4 + 1; } } return -1; @@ -38182,12 +38287,12 @@ var regexpCache = /* @__PURE__ */ Object.create(null); function wordsRegexp(words) { return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")); } -function codePointToString(code) { - if (code <= 65535) { - return String.fromCharCode(code); +function codePointToString(code3) { + if (code3 <= 65535) { + return String.fromCharCode(code3); } - code -= 65536; - return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); + code3 -= 65536; + return String.fromCharCode((code3 >> 10) + 55296, (code3 & 1023) + 56320); } var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; var Position = function Position2(line, col) { @@ -38197,11 +38302,11 @@ var Position = function Position2(line, col) { Position.prototype.offset = function offset(n3) { return new Position(this.line, this.column + n3); }; -var SourceLocation = function SourceLocation2(p, start, end) { +var SourceLocation = function SourceLocation2(p2, start, end) { this.start = start; this.end = end; - if (p.sourceFile !== null) { - this.source = p.sourceFile; + if (p2.sourceFile !== null) { + this.source = p2.sourceFile; } }; function getLineInfo(input, offset2) { @@ -38270,20 +38375,20 @@ function getOptions(opts) { return options; } function pushComment(options, array) { - return function(block, text2, start, end, startLoc, endLoc) { - var comment3 = { + return function(block, text7, start, end, startLoc, endLoc) { + var comment4 = { type: block ? "Block" : "Line", - value: text2, + value: text7, start, end }; if (options.locations) { - comment3.loc = new SourceLocation(this, startLoc, endLoc); + comment4.loc = new SourceLocation(this, startLoc, endLoc); } if (options.ranges) { - comment3.range = [start, end]; + comment4.range = [start, end]; } - array.push(comment3); + array.push(comment4); }; } var SCOPE_TOP = 1; @@ -38355,9 +38460,9 @@ var Parser = function Parser2(options, input, startPos) { }; var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } }; Parser.prototype.parse = function parse() { - var node = this.options.program || this.startNode(); + var node2 = this.options.program || this.startNode(); this.nextToken(); - return this.parseTopLevel(node); + return this.parseTopLevel(node2); }; prototypeAccessors.inFunction.get = function() { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; @@ -38552,25 +38657,25 @@ pp$9.isSimpleAssignTarget = function(expr) { return expr.type === "Identifier" || expr.type === "MemberExpression"; }; var pp$8 = Parser.prototype; -pp$8.parseTopLevel = function(node) { +pp$8.parseTopLevel = function(node2) { var exports = /* @__PURE__ */ Object.create(null); - if (!node.body) { - node.body = []; + if (!node2.body) { + node2.body = []; } while (this.type !== types$1.eof) { var stmt = this.parseStatement(null, true, exports); - node.body.push(stmt); + node2.body.push(stmt); } if (this.inModule) { - for (var i4 = 0, list = Object.keys(this.undefinedExports); i4 < list.length; i4 += 1) { - var name317 = list[i4]; + for (var i4 = 0, list4 = Object.keys(this.undefinedExports); i4 < list4.length; i4 += 1) { + var name317 = list4[i4]; this.raiseRecoverable(this.undefinedExports[name317].start, "Export '" + name317 + "' is not defined"); } } - this.adaptDirectivePrologue(node.body); + this.adaptDirectivePrologue(node2.body); this.next(); - node.sourceType = this.options.sourceType; - return this.finishNode(node, "Program"); + node2.sourceType = this.options.sourceType; + return this.finishNode(node2, "Program"); }; var loopLabel = { kind: "loop" }; var switchLabel = { kind: "switch" }; @@ -38615,7 +38720,7 @@ pp$8.isAsyncFunction = function() { return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320)); }; pp$8.parseStatement = function(context, topLevel, exports) { - var starttype = this.type, node = this.startNode(), kind; + var starttype = this.type, node2 = this.startNode(), kind; if (this.isLet(context)) { starttype = types$1._var; kind = "let"; @@ -38623,48 +38728,48 @@ pp$8.parseStatement = function(context, topLevel, exports) { switch (starttype) { case types$1._break: case types$1._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); + return this.parseBreakContinueStatement(node2, starttype.keyword); case types$1._debugger: - return this.parseDebuggerStatement(node); + return this.parseDebuggerStatement(node2); case types$1._do: - return this.parseDoStatement(node); + return this.parseDoStatement(node2); case types$1._for: - return this.parseForStatement(node); + return this.parseForStatement(node2); case types$1._function: if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) { this.unexpected(); } - return this.parseFunctionStatement(node, false, !context); + return this.parseFunctionStatement(node2, false, !context); case types$1._class: if (context) { this.unexpected(); } - return this.parseClass(node, true); + return this.parseClass(node2, true); case types$1._if: - return this.parseIfStatement(node); + return this.parseIfStatement(node2); case types$1._return: - return this.parseReturnStatement(node); + return this.parseReturnStatement(node2); case types$1._switch: - return this.parseSwitchStatement(node); + return this.parseSwitchStatement(node2); case types$1._throw: - return this.parseThrowStatement(node); + return this.parseThrowStatement(node2); case types$1._try: - return this.parseTryStatement(node); + return this.parseTryStatement(node2); case types$1._const: case types$1._var: kind = kind || this.value; if (context && kind !== "var") { this.unexpected(); } - return this.parseVarStatement(node, kind); + return this.parseVarStatement(node2, kind); case types$1._while: - return this.parseWhileStatement(node); + return this.parseWhileStatement(node2); case types$1._with: - return this.parseWithStatement(node); + return this.parseWithStatement(node2); case types$1.braceL: - return this.parseBlock(true, node); + return this.parseBlock(true, node2); case types$1.semi: - return this.parseEmptyStatement(node); + return this.parseEmptyStatement(node2); case types$1._export: case types$1._import: if (this.options.ecmaVersion > 10 && starttype === types$1._import) { @@ -38672,7 +38777,7 @@ pp$8.parseStatement = function(context, topLevel, exports) { var skip = skipWhiteSpace.exec(this.input); var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); if (nextCh === 40 || nextCh === 46) { - return this.parseExpressionStatement(node, this.parseExpression()); + return this.parseExpressionStatement(node2, this.parseExpression()); } } if (!this.options.allowImportExportEverywhere) { @@ -38683,71 +38788,71 @@ pp$8.parseStatement = function(context, topLevel, exports) { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); } } - return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports); + return starttype === types$1._import ? this.parseImport(node2) : this.parseExport(node2, exports); default: if (this.isAsyncFunction()) { if (context) { this.unexpected(); } this.next(); - return this.parseFunctionStatement(node, true, !context); + return this.parseFunctionStatement(node2, true, !context); } var maybeName = this.value, expr = this.parseExpression(); if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { - return this.parseLabeledStatement(node, maybeName, expr, context); + return this.parseLabeledStatement(node2, maybeName, expr, context); } else { - return this.parseExpressionStatement(node, expr); + return this.parseExpressionStatement(node2, expr); } } }; -pp$8.parseBreakContinueStatement = function(node, keyword3) { +pp$8.parseBreakContinueStatement = function(node2, keyword3) { var isBreak = keyword3 === "break"; this.next(); if (this.eat(types$1.semi) || this.insertSemicolon()) { - node.label = null; + node2.label = null; } else if (this.type !== types$1.name) { this.unexpected(); } else { - node.label = this.parseIdent(); + node2.label = this.parseIdent(); this.semicolon(); } var i4 = 0; for (; i4 < this.labels.length; ++i4) { var lab = this.labels[i4]; - if (node.label == null || lab.name === node.label.name) { + if (node2.label == null || lab.name === node2.label.name) { if (lab.kind != null && (isBreak || lab.kind === "loop")) { break; } - if (node.label && isBreak) { + if (node2.label && isBreak) { break; } } } if (i4 === this.labels.length) { - this.raise(node.start, "Unsyntactic " + keyword3); + this.raise(node2.start, "Unsyntactic " + keyword3); } - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); + return this.finishNode(node2, isBreak ? "BreakStatement" : "ContinueStatement"); }; -pp$8.parseDebuggerStatement = function(node) { +pp$8.parseDebuggerStatement = function(node2) { this.next(); this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); + return this.finishNode(node2, "DebuggerStatement"); }; -pp$8.parseDoStatement = function(node) { +pp$8.parseDoStatement = function(node2) { this.next(); this.labels.push(loopLabel); - node.body = this.parseStatement("do"); + node2.body = this.parseStatement("do"); this.labels.pop(); this.expect(types$1._while); - node.test = this.parseParenExpression(); + node2.test = this.parseParenExpression(); if (this.options.ecmaVersion >= 6) { this.eat(types$1.semi); } else { this.semicolon(); } - return this.finishNode(node, "DoWhileStatement"); + return this.finishNode(node2, "DoWhileStatement"); }; -pp$8.parseForStatement = function(node) { +pp$8.parseForStatement = function(node2) { this.next(); var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; this.labels.push(loopLabel); @@ -38757,7 +38862,7 @@ pp$8.parseForStatement = function(node) { if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, null); + return this.parseFor(node2, null); } var isLet = this.isLet(); if (this.type === types$1._var || this.type === types$1._const || isLet) { @@ -38772,15 +38877,15 @@ pp$8.parseForStatement = function(node) { this.unexpected(awaitAt); } } else { - node.await = awaitAt > -1; + node2.await = awaitAt > -1; } } - return this.parseForIn(node, init$1); + return this.parseForIn(node2, init$1); } if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, init$1); + return this.parseFor(node2, init$1); } var startsWithLet = this.isContextual("let"), isForOf = false; var refDestructuringErrors = new DestructuringErrors(); @@ -38792,7 +38897,7 @@ pp$8.parseForStatement = function(node) { this.unexpected(awaitAt); } } else { - node.await = awaitAt > -1; + node2.await = awaitAt > -1; } } if (startsWithLet && isForOf) { @@ -38800,43 +38905,43 @@ pp$8.parseForStatement = function(node) { } this.toAssignable(init, false, refDestructuringErrors); this.checkLValPattern(init); - return this.parseForIn(node, init); + return this.parseForIn(node2, init); } else { this.checkExpressionErrors(refDestructuringErrors, true); } if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, init); + return this.parseFor(node2, init); }; -pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { +pp$8.parseFunctionStatement = function(node2, isAsync, declarationPosition) { this.next(); - return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); + return this.parseFunction(node2, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); }; -pp$8.parseIfStatement = function(node) { +pp$8.parseIfStatement = function(node2) { this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement("if"); - node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; - return this.finishNode(node, "IfStatement"); + node2.test = this.parseParenExpression(); + node2.consequent = this.parseStatement("if"); + node2.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; + return this.finishNode(node2, "IfStatement"); }; -pp$8.parseReturnStatement = function(node) { +pp$8.parseReturnStatement = function(node2) { if (!this.inFunction && !this.options.allowReturnOutsideFunction) { this.raise(this.start, "'return' outside of function"); } this.next(); if (this.eat(types$1.semi) || this.insertSemicolon()) { - node.argument = null; + node2.argument = null; } else { - node.argument = this.parseExpression(); + node2.argument = this.parseExpression(); this.semicolon(); } - return this.finishNode(node, "ReturnStatement"); + return this.finishNode(node2, "ReturnStatement"); }; -pp$8.parseSwitchStatement = function(node) { +pp$8.parseSwitchStatement = function(node2) { this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; + node2.discriminant = this.parseParenExpression(); + node2.cases = []; this.expect(types$1.braceL); this.labels.push(switchLabel); this.enterScope(0); @@ -38847,7 +38952,7 @@ pp$8.parseSwitchStatement = function(node) { if (cur) { this.finishNode(cur, "SwitchCase"); } - node.cases.push(cur = this.startNode()); + node2.cases.push(cur = this.startNode()); cur.consequent = []; this.next(); if (isCase) { @@ -38873,16 +38978,16 @@ pp$8.parseSwitchStatement = function(node) { } this.next(); this.labels.pop(); - return this.finishNode(node, "SwitchStatement"); + return this.finishNode(node2, "SwitchStatement"); }; -pp$8.parseThrowStatement = function(node) { +pp$8.parseThrowStatement = function(node2) { this.next(); if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) { this.raise(this.lastTokEnd, "Illegal newline after throw"); } - node.argument = this.parseExpression(); + node2.argument = this.parseExpression(); this.semicolon(); - return this.finishNode(node, "ThrowStatement"); + return this.finishNode(node2, "ThrowStatement"); }; var empty$1 = []; pp$8.parseCatchClauseParam = function() { @@ -38893,10 +38998,10 @@ pp$8.parseCatchClauseParam = function() { this.expect(types$1.parenR); return param; }; -pp$8.parseTryStatement = function(node) { +pp$8.parseTryStatement = function(node2) { this.next(); - node.block = this.parseBlock(); - node.handler = null; + node2.block = this.parseBlock(); + node2.handler = null; if (this.type === types$1._catch) { var clause = this.startNode(); this.next(); @@ -38911,44 +39016,44 @@ pp$8.parseTryStatement = function(node) { } clause.body = this.parseBlock(false); this.exitScope(); - node.handler = this.finishNode(clause, "CatchClause"); + node2.handler = this.finishNode(clause, "CatchClause"); } - node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; - if (!node.handler && !node.finalizer) { - this.raise(node.start, "Missing catch or finally clause"); + node2.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; + if (!node2.handler && !node2.finalizer) { + this.raise(node2.start, "Missing catch or finally clause"); } - return this.finishNode(node, "TryStatement"); + return this.finishNode(node2, "TryStatement"); }; -pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) { +pp$8.parseVarStatement = function(node2, kind, allowMissingInitializer) { this.next(); - this.parseVar(node, false, kind, allowMissingInitializer); + this.parseVar(node2, false, kind, allowMissingInitializer); this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); + return this.finishNode(node2, "VariableDeclaration"); }; -pp$8.parseWhileStatement = function(node) { +pp$8.parseWhileStatement = function(node2) { this.next(); - node.test = this.parseParenExpression(); + node2.test = this.parseParenExpression(); this.labels.push(loopLabel); - node.body = this.parseStatement("while"); + node2.body = this.parseStatement("while"); this.labels.pop(); - return this.finishNode(node, "WhileStatement"); + return this.finishNode(node2, "WhileStatement"); }; -pp$8.parseWithStatement = function(node) { +pp$8.parseWithStatement = function(node2) { if (this.strict) { this.raise(this.start, "'with' in strict mode"); } this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement("with"); - return this.finishNode(node, "WithStatement"); + node2.object = this.parseParenExpression(); + node2.body = this.parseStatement("with"); + return this.finishNode(node2, "WithStatement"); }; -pp$8.parseEmptyStatement = function(node) { +pp$8.parseEmptyStatement = function(node2) { this.next(); - return this.finishNode(node, "EmptyStatement"); + return this.finishNode(node2, "EmptyStatement"); }; -pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { - for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) { - var label = list[i$1]; +pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) { + for (var i$1 = 0, list4 = this.labels; i$1 < list4.length; i$1 += 1) { + var label = list4[i$1]; if (label.name === maybeName) { this.raise(expr.start, "Label '" + maybeName + "' is already declared"); } @@ -38956,7 +39061,7 @@ pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; for (var i4 = this.labels.length - 1; i4 >= 0; i4--) { var label$1 = this.labels[i4]; - if (label$1.statementStart === node.start) { + if (label$1.statementStart === node2.start) { label$1.statementStart = this.start; label$1.kind = kind; } else { @@ -38964,29 +39069,29 @@ pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { } } this.labels.push({ name: maybeName, kind, statementStart: this.start }); - node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + node2.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); this.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); + node2.label = expr; + return this.finishNode(node2, "LabeledStatement"); }; -pp$8.parseExpressionStatement = function(node, expr) { - node.expression = expr; +pp$8.parseExpressionStatement = function(node2, expr) { + node2.expression = expr; this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); + return this.finishNode(node2, "ExpressionStatement"); }; -pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { +pp$8.parseBlock = function(createNewLexicalScope, node2, exitStrict) { if (createNewLexicalScope === void 0) createNewLexicalScope = true; - if (node === void 0) - node = this.startNode(); - node.body = []; + if (node2 === void 0) + node2 = this.startNode(); + node2.body = []; this.expect(types$1.braceL); if (createNewLexicalScope) { this.enterScope(0); } while (this.type !== types$1.braceR) { var stmt = this.parseStatement(null); - node.body.push(stmt); + node2.body.push(stmt); } if (exitStrict) { this.strict = false; @@ -38995,21 +39100,21 @@ pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { if (createNewLexicalScope) { this.exitScope(); } - return this.finishNode(node, "BlockStatement"); + return this.finishNode(node2, "BlockStatement"); }; -pp$8.parseFor = function(node, init) { - node.init = init; +pp$8.parseFor = function(node2, init) { + node2.init = init; this.expect(types$1.semi); - node.test = this.type === types$1.semi ? null : this.parseExpression(); + node2.test = this.type === types$1.semi ? null : this.parseExpression(); this.expect(types$1.semi); - node.update = this.type === types$1.parenR ? null : this.parseExpression(); + node2.update = this.type === types$1.parenR ? null : this.parseExpression(); this.expect(types$1.parenR); - node.body = this.parseStatement("for"); + node2.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); - return this.finishNode(node, "ForStatement"); + return this.finishNode(node2, "ForStatement"); }; -pp$8.parseForIn = function(node, init) { +pp$8.parseForIn = function(node2, init) { var isForIn = this.type === types$1._in; this.next(); if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { @@ -39018,17 +39123,17 @@ pp$8.parseForIn = function(node, init) { (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer" ); } - node.left = init; - node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + node2.left = init; + node2.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); this.expect(types$1.parenR); - node.body = this.parseStatement("for"); + node2.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); - return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); + return this.finishNode(node2, isForIn ? "ForInStatement" : "ForOfStatement"); }; -pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) { - node.declarations = []; - node.kind = kind; +pp$8.parseVar = function(node2, isFor, kind, allowMissingInitializer) { + node2.declarations = []; + node2.kind = kind; for (; ; ) { var decl = this.startNode(); this.parseVarId(decl, kind); @@ -39041,12 +39146,12 @@ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) { } else { decl.init = null; } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + node2.declarations.push(this.finishNode(decl, "VariableDeclarator")); if (!this.eat(types$1.comma)) { break; } } - return node; + return node2; }; pp$8.parseVarId = function(decl, kind) { decl.id = this.parseBindingAtom(); @@ -39055,80 +39160,80 @@ pp$8.parseVarId = function(decl, kind) { var FUNC_STATEMENT = 1; var FUNC_HANGING_STATEMENT = 2; var FUNC_NULLABLE_ID = 4; -pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { - this.initFunction(node); +pp$8.parseFunction = function(node2, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node2); if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) { this.unexpected(); } - node.generator = this.eat(types$1.star); + node2.generator = this.eat(types$1.star); } if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } if (statement & FUNC_STATEMENT) { - node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); - if (node.id && !(statement & FUNC_HANGING_STATEMENT)) { - this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); + node2.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); + if (node2.id && !(statement & FUNC_HANGING_STATEMENT)) { + this.checkLValSimple(node2.id, this.strict || node2.generator || node2.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); } } var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - this.enterScope(functionFlags(node.async, node.generator)); + this.enterScope(functionFlags(node2.async, node2.generator)); if (!(statement & FUNC_STATEMENT)) { - node.id = this.type === types$1.name ? this.parseIdent() : null; + node2.id = this.type === types$1.name ? this.parseIdent() : null; } - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody, false, forInit); + this.parseFunctionParams(node2); + this.parseFunctionBody(node2, allowExpressionBody, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); + return this.finishNode(node2, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); }; -pp$8.parseFunctionParams = function(node) { +pp$8.parseFunctionParams = function(node2) { this.expect(types$1.parenL); - node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); }; -pp$8.parseClass = function(node, isStatement) { +pp$8.parseClass = function(node2, isStatement) { this.next(); var oldStrict = this.strict; this.strict = true; - this.parseClassId(node, isStatement); - this.parseClassSuper(node); + this.parseClassId(node2, isStatement); + this.parseClassSuper(node2); var privateNameMap = this.enterClassBody(); var classBody = this.startNode(); var hadConstructor = false; classBody.body = []; this.expect(types$1.braceL); while (this.type !== types$1.braceR) { - var element = this.parseClassElement(node.superClass !== null); - if (element) { - classBody.body.push(element); - if (element.type === "MethodDefinition" && element.kind === "constructor") { + var element3 = this.parseClassElement(node2.superClass !== null); + if (element3) { + classBody.body.push(element3); + if (element3.type === "MethodDefinition" && element3.kind === "constructor") { if (hadConstructor) { - this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); + this.raiseRecoverable(element3.start, "Duplicate constructor in the same class"); } hadConstructor = true; - } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { - this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared"); + } else if (element3.key && element3.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element3)) { + this.raiseRecoverable(element3.key.start, "Identifier '#" + element3.key.name + "' has already been declared"); } } } this.strict = oldStrict; this.next(); - node.body = this.finishNode(classBody, "ClassBody"); + node2.body = this.finishNode(classBody, "ClassBody"); this.exitClassBody(); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); + return this.finishNode(node2, isStatement ? "ClassDeclaration" : "ClassExpression"); }; pp$8.parseClassElement = function(constructorAllowsSuper) { if (this.eat(types$1.semi)) { return null; } var ecmaVersion = this.options.ecmaVersion; - var node = this.startNode(); + var node2 = this.startNode(); var keyName = ""; var isGenerator = false; var isAsync = false; @@ -39136,8 +39241,8 @@ pp$8.parseClassElement = function(constructorAllowsSuper) { var isStatic = false; if (this.eatContextual("static")) { if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { - this.parseClassStaticBlock(node); - return node; + this.parseClassStaticBlock(node2); + return node2; } if (this.isClassElementNameStart() || this.type === types$1.star) { isStatic = true; @@ -39145,7 +39250,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) { keyName = "static"; } } - node.static = isStatic; + node2.static = isStatic; if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { isAsync = true; @@ -39167,51 +39272,51 @@ pp$8.parseClassElement = function(constructorAllowsSuper) { } } if (keyName) { - node.computed = false; - node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); - node.key.name = keyName; - this.finishNode(node.key, "Identifier"); + node2.computed = false; + node2.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node2.key.name = keyName; + this.finishNode(node2.key, "Identifier"); } else { - this.parseClassElementName(node); + this.parseClassElementName(node2); } if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { - var isConstructor = !node.static && checkKeyName(node, "constructor"); + var isConstructor = !node2.static && checkKeyName(node2, "constructor"); var allowsDirectSuper = isConstructor && constructorAllowsSuper; if (isConstructor && kind !== "method") { - this.raise(node.key.start, "Constructor can't have get/set modifier"); + this.raise(node2.key.start, "Constructor can't have get/set modifier"); } - node.kind = isConstructor ? "constructor" : kind; - this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + node2.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node2, isGenerator, isAsync, allowsDirectSuper); } else { - this.parseClassField(node); + this.parseClassField(node2); } - return node; + return node2; }; pp$8.isClassElementNameStart = function() { return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword; }; -pp$8.parseClassElementName = function(element) { +pp$8.parseClassElementName = function(element3) { if (this.type === types$1.privateId) { if (this.value === "constructor") { this.raise(this.start, "Classes can't have an element named '#constructor'"); } - element.computed = false; - element.key = this.parsePrivateIdent(); + element3.computed = false; + element3.key = this.parsePrivateIdent(); } else { - this.parsePropertyName(element); + this.parsePropertyName(element3); } }; pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { - var key2 = method.key; + var key3 = method.key; if (method.kind === "constructor") { if (isGenerator) { - this.raise(key2.start, "Constructor can't be a generator"); + this.raise(key3.start, "Constructor can't be a generator"); } if (isAsync) { - this.raise(key2.start, "Constructor can't be an async method"); + this.raise(key3.start, "Constructor can't be an async method"); } } else if (method.static && checkKeyName(method, "prototype")) { - this.raise(key2.start, "Classes may not have a static property named prototype"); + this.raise(key3.start, "Classes may not have a static property named prototype"); } var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); if (method.kind === "get" && value.params.length !== 0) { @@ -39243,40 +39348,40 @@ pp$8.parseClassField = function(field) { this.semicolon(); return this.finishNode(field, "PropertyDefinition"); }; -pp$8.parseClassStaticBlock = function(node) { - node.body = []; +pp$8.parseClassStaticBlock = function(node2) { + node2.body = []; var oldLabels = this.labels; this.labels = []; this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); while (this.type !== types$1.braceR) { var stmt = this.parseStatement(null); - node.body.push(stmt); + node2.body.push(stmt); } this.next(); this.exitScope(); this.labels = oldLabels; - return this.finishNode(node, "StaticBlock"); + return this.finishNode(node2, "StaticBlock"); }; -pp$8.parseClassId = function(node, isStatement) { +pp$8.parseClassId = function(node2, isStatement) { if (this.type === types$1.name) { - node.id = this.parseIdent(); + node2.id = this.parseIdent(); if (isStatement) { - this.checkLValSimple(node.id, BIND_LEXICAL, false); + this.checkLValSimple(node2.id, BIND_LEXICAL, false); } } else { if (isStatement === true) { this.unexpected(); } - node.id = null; + node2.id = null; } }; -pp$8.parseClassSuper = function(node) { - node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null; +pp$8.parseClassSuper = function(node2) { + node2.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null; }; pp$8.enterClassBody = function() { - var element = { declared: /* @__PURE__ */ Object.create(null), used: [] }; - this.privateNameStack.push(element); - return element.declared; + var element3 = { declared: /* @__PURE__ */ Object.create(null), used: [] }; + this.privateNameStack.push(element3); + return element3.declared; }; pp$8.exitClassBody = function() { var ref2 = this.privateNameStack.pop(); @@ -39298,12 +39403,12 @@ pp$8.exitClassBody = function() { } } }; -function isPrivateNameConflicted(privateNameMap, element) { - var name317 = element.key.name; +function isPrivateNameConflicted(privateNameMap, element3) { + var name317 = element3.key.name; var curr = privateNameMap[name317]; var next = "true"; - if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { - next = (element.static ? "s" : "i") + element.kind; + if (element3.type === "MethodDefinition" && (element3.kind === "get" || element3.kind === "set")) { + next = (element3.static ? "s" : "i") + element3.kind; } if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { privateNameMap[name317] = "true"; @@ -39315,71 +39420,71 @@ function isPrivateNameConflicted(privateNameMap, element) { return true; } } -function checkKeyName(node, name317) { - var computed = node.computed; - var key2 = node.key; - return !computed && (key2.type === "Identifier" && key2.name === name317 || key2.type === "Literal" && key2.value === name317); +function checkKeyName(node2, name317) { + var computed = node2.computed; + var key3 = node2.key; + return !computed && (key3.type === "Identifier" && key3.name === name317 || key3.type === "Literal" && key3.value === name317); } -pp$8.parseExportAllDeclaration = function(node, exports) { +pp$8.parseExportAllDeclaration = function(node2, exports) { if (this.options.ecmaVersion >= 11) { if (this.eatContextual("as")) { - node.exported = this.parseModuleExportName(); - this.checkExport(exports, node.exported, this.lastTokStart); + node2.exported = this.parseModuleExportName(); + this.checkExport(exports, node2.exported, this.lastTokStart); } else { - node.exported = null; + node2.exported = null; } } this.expectContextual("from"); if (this.type !== types$1.string) { this.unexpected(); } - node.source = this.parseExprAtom(); + node2.source = this.parseExprAtom(); this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); + return this.finishNode(node2, "ExportAllDeclaration"); }; -pp$8.parseExport = function(node, exports) { +pp$8.parseExport = function(node2, exports) { this.next(); if (this.eat(types$1.star)) { - return this.parseExportAllDeclaration(node, exports); + return this.parseExportAllDeclaration(node2, exports); } if (this.eat(types$1._default)) { this.checkExport(exports, "default", this.lastTokStart); - node.declaration = this.parseExportDefaultDeclaration(); - return this.finishNode(node, "ExportDefaultDeclaration"); + node2.declaration = this.parseExportDefaultDeclaration(); + return this.finishNode(node2, "ExportDefaultDeclaration"); } if (this.shouldParseExportStatement()) { - node.declaration = this.parseExportDeclaration(node); - if (node.declaration.type === "VariableDeclaration") { - this.checkVariableExport(exports, node.declaration.declarations); + node2.declaration = this.parseExportDeclaration(node2); + if (node2.declaration.type === "VariableDeclaration") { + this.checkVariableExport(exports, node2.declaration.declarations); } else { - this.checkExport(exports, node.declaration.id, node.declaration.id.start); + this.checkExport(exports, node2.declaration.id, node2.declaration.id.start); } - node.specifiers = []; - node.source = null; + node2.specifiers = []; + node2.source = null; } else { - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(exports); + node2.declaration = null; + node2.specifiers = this.parseExportSpecifiers(exports); if (this.eatContextual("from")) { if (this.type !== types$1.string) { this.unexpected(); } - node.source = this.parseExprAtom(); + node2.source = this.parseExprAtom(); } else { - for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) { - var spec = list[i4]; + for (var i4 = 0, list4 = node2.specifiers; i4 < list4.length; i4 += 1) { + var spec = list4[i4]; this.checkUnreserved(spec.local); this.checkLocalExport(spec.local); if (spec.local.type === "Literal") { this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); } } - node.source = null; + node2.source = null; } this.semicolon(); } - return this.finishNode(node, "ExportNamedDeclaration"); + return this.finishNode(node2, "ExportNamedDeclaration"); }; -pp$8.parseExportDeclaration = function(node) { +pp$8.parseExportDeclaration = function(node2) { return this.parseStatement(null); }; pp$8.parseExportDefaultDeclaration = function() { @@ -39417,8 +39522,8 @@ pp$8.checkPatternExport = function(exports, pat) { if (type === "Identifier") { this.checkExport(exports, pat, pat.start); } else if (type === "ObjectPattern") { - for (var i4 = 0, list = pat.properties; i4 < list.length; i4 += 1) { - var prop2 = list[i4]; + for (var i4 = 0, list4 = pat.properties; i4 < list4.length; i4 += 1) { + var prop2 = list4[i4]; this.checkPatternExport(exports, prop2); } } else if (type === "ArrayPattern") { @@ -39440,8 +39545,8 @@ pp$8.checkVariableExport = function(exports, decls) { if (!exports) { return; } - for (var i4 = 0, list = decls; i4 < list.length; i4 += 1) { - var decl = list[i4]; + for (var i4 = 0, list4 = decls; i4 < list4.length; i4 += 1) { + var decl = list4[i4]; this.checkPatternExport(exports, decl.id); } }; @@ -39449,15 +39554,15 @@ pp$8.shouldParseExportStatement = function() { return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); }; pp$8.parseExportSpecifier = function(exports) { - var node = this.startNode(); - node.local = this.parseModuleExportName(); - node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; + var node2 = this.startNode(); + node2.local = this.parseModuleExportName(); + node2.exported = this.eatContextual("as") ? this.parseModuleExportName() : node2.local; this.checkExport( exports, - node.exported, - node.exported.start + node2.exported, + node2.exported.start ); - return this.finishNode(node, "ExportSpecifier"); + return this.finishNode(node2, "ExportSpecifier"); }; pp$8.parseExportSpecifiers = function(exports) { var nodes = [], first = true; @@ -39475,44 +39580,44 @@ pp$8.parseExportSpecifiers = function(exports) { } return nodes; }; -pp$8.parseImport = function(node) { +pp$8.parseImport = function(node2) { this.next(); if (this.type === types$1.string) { - node.specifiers = empty$1; - node.source = this.parseExprAtom(); + node2.specifiers = empty$1; + node2.source = this.parseExprAtom(); } else { - node.specifiers = this.parseImportSpecifiers(); + node2.specifiers = this.parseImportSpecifiers(); this.expectContextual("from"); - node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); + node2.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); } this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); + return this.finishNode(node2, "ImportDeclaration"); }; pp$8.parseImportSpecifier = function() { - var node = this.startNode(); - node.imported = this.parseModuleExportName(); + var node2 = this.startNode(); + node2.imported = this.parseModuleExportName(); if (this.eatContextual("as")) { - node.local = this.parseIdent(); + node2.local = this.parseIdent(); } else { - this.checkUnreserved(node.imported); - node.local = node.imported; + this.checkUnreserved(node2.imported); + node2.local = node2.imported; } - this.checkLValSimple(node.local, BIND_LEXICAL); - return this.finishNode(node, "ImportSpecifier"); + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportSpecifier"); }; pp$8.parseImportDefaultSpecifier = function() { - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL); - return this.finishNode(node, "ImportDefaultSpecifier"); + var node2 = this.startNode(); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportDefaultSpecifier"); }; pp$8.parseImportNamespaceSpecifier = function() { - var node = this.startNode(); + var node2 = this.startNode(); this.next(); this.expectContextual("as"); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL); - return this.finishNode(node, "ImportNamespaceSpecifier"); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportNamespaceSpecifier"); }; pp$8.parseImportSpecifiers = function() { var nodes = [], first = true; @@ -39559,12 +39664,12 @@ pp$8.isDirectiveCandidate = function(statement) { return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === '"' || this.input[statement.start] === "'"); }; var pp$7 = Parser.prototype; -pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { +pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node2) { + switch (node2.type) { case "Identifier": - if (this.inAsync && node.name === "await") { - this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); + if (this.inAsync && node2.name === "await") { + this.raise(node2.start, "Cannot use 'await' as identifier inside an async function"); } break; case "ObjectPattern": @@ -39573,12 +39678,12 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { case "RestElement": break; case "ObjectExpression": - node.type = "ObjectPattern"; + node2.type = "ObjectPattern"; if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop2 = list[i4]; + for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) { + var prop2 = list4[i4]; this.toAssignable(prop2, isBinding); if (prop2.type === "RestElement" && (prop2.argument.type === "ArrayPattern" || prop2.argument.type === "ObjectPattern")) { this.raise(prop2.argument.start, "Unexpected token"); @@ -39586,50 +39691,50 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { } break; case "Property": - if (node.kind !== "init") { - this.raise(node.key.start, "Object pattern can't contain getter or setter"); + if (node2.kind !== "init") { + this.raise(node2.key.start, "Object pattern can't contain getter or setter"); } - this.toAssignable(node.value, isBinding); + this.toAssignable(node2.value, isBinding); break; case "ArrayExpression": - node.type = "ArrayPattern"; + node2.type = "ArrayPattern"; if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - this.toAssignableList(node.elements, isBinding); + this.toAssignableList(node2.elements, isBinding); break; case "SpreadElement": - node.type = "RestElement"; - this.toAssignable(node.argument, isBinding); - if (node.argument.type === "AssignmentPattern") { - this.raise(node.argument.start, "Rest elements cannot have a default value"); + node2.type = "RestElement"; + this.toAssignable(node2.argument, isBinding); + if (node2.argument.type === "AssignmentPattern") { + this.raise(node2.argument.start, "Rest elements cannot have a default value"); } break; case "AssignmentExpression": - if (node.operator !== "=") { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); + if (node2.operator !== "=") { + this.raise(node2.left.end, "Only '=' operator can be used for specifying default value."); } - node.type = "AssignmentPattern"; - delete node.operator; - this.toAssignable(node.left, isBinding); + node2.type = "AssignmentPattern"; + delete node2.operator; + this.toAssignable(node2.left, isBinding); break; case "ParenthesizedExpression": - this.toAssignable(node.expression, isBinding, refDestructuringErrors); + this.toAssignable(node2.expression, isBinding, refDestructuringErrors); break; case "ChainExpression": - this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); + this.raiseRecoverable(node2.start, "Optional chaining cannot appear in left-hand side"); break; case "MemberExpression": if (!isBinding) { break; } default: - this.raise(node.start, "Assigning to rvalue"); + this.raise(node2.start, "Assigning to rvalue"); } } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - return node; + return node2; }; pp$7.toAssignableList = function(exprList, isBinding) { var end = exprList.length; @@ -39648,28 +39753,28 @@ pp$7.toAssignableList = function(exprList, isBinding) { return exprList; }; pp$7.parseSpread = function(refDestructuringErrors) { - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.argument = this.parseMaybeAssign(false, refDestructuringErrors); - return this.finishNode(node, "SpreadElement"); + node2.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node2, "SpreadElement"); }; pp$7.parseRestBinding = function() { - var node = this.startNode(); + var node2 = this.startNode(); this.next(); if (this.options.ecmaVersion === 6 && this.type !== types$1.name) { this.unexpected(); } - node.argument = this.parseBindingAtom(); - return this.finishNode(node, "RestElement"); + node2.argument = this.parseBindingAtom(); + return this.finishNode(node2, "RestElement"); }; pp$7.parseBindingAtom = function() { if (this.options.ecmaVersion >= 6) { switch (this.type) { case types$1.bracketL: - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.elements = this.parseBindingList(types$1.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); + node2.elements = this.parseBindingList(types$1.bracketR, true, true); + return this.finishNode(node2, "ArrayPattern"); case types$1.braceL: return this.parseObj(true); } @@ -39716,10 +39821,10 @@ pp$7.parseMaybeDefault = function(startPos, startLoc, left) { if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left; } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.right = this.parseMaybeAssign(); + return this.finishNode(node2, "AssignmentPattern"); }; pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { if (bindingType === void 0) @@ -39767,8 +39872,8 @@ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { bindingType = BIND_NONE; switch (expr.type) { case "ObjectPattern": - for (var i4 = 0, list = expr.properties; i4 < list.length; i4 += 1) { - var prop2 = list[i4]; + for (var i4 = 0, list4 = expr.properties; i4 < list4.length; i4 += 1) { + var prop2 = list4[i4]; this.checkLValInnerPattern(prop2, bindingType, checkClashes); } break; @@ -39814,8 +39919,8 @@ var types = { b_tmpl: new TokContext("${", false), p_stat: new TokContext("(", false), p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function(p) { - return p.tryReadTemplateToken(); + q_tmpl: new TokContext("`", true, true, function(p2) { + return p2.tryReadTemplateToken(); }), f_stat: new TokContext("function", false), f_expr: new TokContext("function", true), @@ -39925,11 +40030,11 @@ types$1.backQuote.updateContext = function() { }; types$1.star.updateContext = function(prevType) { if (prevType === types$1._function) { - var index2 = this.context.length - 1; - if (this.context[index2] === types.f_expr) { - this.context[index2] = types.f_expr_gen; + var index3 = this.context.length - 1; + if (this.context[index3] === types.f_expr) { + this.context[index3] = types.f_expr_gen; } else { - this.context[index2] = types.f_gen; + this.context[index3] = types.f_gen; } } this.exprAllowed = true; @@ -39951,14 +40056,14 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) { if (this.options.ecmaVersion >= 6 && (prop2.computed || prop2.method || prop2.shorthand)) { return; } - var key2 = prop2.key; + var key3 = prop2.key; var name317; - switch (key2.type) { + switch (key3.type) { case "Identifier": - name317 = key2.name; + name317 = key3.name; break; case "Literal": - name317 = String(key2.value); + name317 = String(key3.value); break; default: return; @@ -39969,10 +40074,10 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) { if (propHash.proto) { if (refDestructuringErrors) { if (refDestructuringErrors.doubleProto < 0) { - refDestructuringErrors.doubleProto = key2.start; + refDestructuringErrors.doubleProto = key3.start; } } else { - this.raiseRecoverable(key2.start, "Redefinition of __proto__ property"); + this.raiseRecoverable(key3.start, "Redefinition of __proto__ property"); } } propHash.proto = true; @@ -39989,7 +40094,7 @@ pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) { redefinition = other.init || other[kind]; } if (redefinition) { - this.raiseRecoverable(key2.start, "Redefinition of property"); + this.raiseRecoverable(key3.start, "Redefinition of property"); } } else { other = propHash[name317] = { @@ -40004,12 +40109,12 @@ pp$5.parseExpression = function(forInit, refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); if (this.type === types$1.comma) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; + var node2 = this.startNodeAt(startPos, startLoc); + node2.expressions = [expr]; while (this.eat(types$1.comma)) { - node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); + node2.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } - return this.finishNode(node, "SequenceExpression"); + return this.finishNode(node2, "SequenceExpression"); } return expr; }; @@ -40041,8 +40146,8 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse left = afterLeftParse.call(this, left, startPos, startLoc); } if (this.type.isAssign) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; + var node2 = this.startNodeAt(startPos, startLoc); + node2.operator = this.value; if (this.type === types$1.eq) { left = this.toAssignable(left, false, refDestructuringErrors); } @@ -40057,13 +40162,13 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse } else { this.checkLValSimple(left); } - node.left = left; + node2.left = left; this.next(); - node.right = this.parseMaybeAssign(forInit); + node2.right = this.parseMaybeAssign(forInit); if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; } - return this.finishNode(node, "AssignmentExpression"); + return this.finishNode(node2, "AssignmentExpression"); } else { if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); @@ -40084,12 +40189,12 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { return expr; } if (this.eat(types$1.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); + var node2 = this.startNodeAt(startPos, startLoc); + node2.test = expr; + node2.consequent = this.parseMaybeAssign(); this.expect(types$1.colon); - node.alternate = this.parseMaybeAssign(forInit); - return this.finishNode(node, "ConditionalExpression"); + node2.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node2, "ConditionalExpression"); } return expr; }; @@ -40114,11 +40219,11 @@ pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) this.next(); var startPos = this.start, startLoc = this.startLoc; var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); - var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + var node2 = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) { this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); } - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); + return this.parseExprOp(node2, leftStartPos, leftStartLoc, minPrec, forInit); } } return left; @@ -40127,11 +40232,11 @@ pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.operator = op; - node.right = right; - return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.operator = op; + node2.right = right; + return this.finishNode(node2, logical ? "LogicalExpression" : "BinaryExpression"); }; pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { var startPos = this.start, startLoc = this.startLoc, expr; @@ -40139,22 +40244,22 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni expr = this.parseAwait(forInit); sawUnary = true; } else if (this.type.prefix) { - var node = this.startNode(), update = this.type === types$1.incDec; - node.operator = this.value; - node.prefix = true; + var node2 = this.startNode(), update = this.type === types$1.incDec; + node2.operator = this.value; + node2.prefix = true; this.next(); - node.argument = this.parseMaybeUnary(null, true, update, forInit); + node2.argument = this.parseMaybeUnary(null, true, update, forInit); this.checkExpressionErrors(refDestructuringErrors, true); if (update) { - this.checkLValSimple(node.argument); - } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { - this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); - } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) { - this.raiseRecoverable(node.start, "Private fields can not be deleted"); + this.checkLValSimple(node2.argument); + } else if (this.strict && node2.operator === "delete" && node2.argument.type === "Identifier") { + this.raiseRecoverable(node2.start, "Deleting local variable in strict mode"); + } else if (node2.operator === "delete" && isPrivateFieldAccess(node2.argument)) { + this.raiseRecoverable(node2.start, "Private fields can not be deleted"); } else { sawUnary = true; } - expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + expr = this.finishNode(node2, update ? "UpdateExpression" : "UnaryExpression"); } else if (!sawUnary && this.type === types$1.privateId) { if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); @@ -40188,8 +40293,8 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni return expr; } }; -function isPrivateFieldAccess(node) { - return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression); +function isPrivateFieldAccess(node2) { + return node2.type === "MemberExpression" && node2.property.type === "PrivateIdentifier" || node2.type === "ChainExpression" && isPrivateFieldAccess(node2.expression); } pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { var startPos = this.start, startLoc = this.startLoc; @@ -40211,23 +40316,23 @@ pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { } return result; }; -pp$5.parseSubscripts = function(base2, startPos, startLoc, noCalls, forInit) { - var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base2.type === "Identifier" && base2.name === "async" && this.lastTokEnd === base2.end && !this.canInsertSemicolon() && base2.end - base2.start === 5 && this.potentialArrowAt === base2.start; +pp$5.parseSubscripts = function(base3, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base3.type === "Identifier" && base3.name === "async" && this.lastTokEnd === base3.end && !this.canInsertSemicolon() && base3.end - base3.start === 5 && this.potentialArrowAt === base3.start; var optionalChained = false; while (true) { - var element = this.parseSubscript(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); - if (element.optional) { + var element3 = this.parseSubscript(base3, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + if (element3.optional) { optionalChained = true; } - if (element === base2 || element.type === "ArrowFunctionExpression") { + if (element3 === base3 || element3.type === "ArrowFunctionExpression") { if (optionalChained) { var chainNode = this.startNodeAt(startPos, startLoc); - chainNode.expression = element; - element = this.finishNode(chainNode, "ChainExpression"); + chainNode.expression = element3; + element3 = this.finishNode(chainNode, "ChainExpression"); } - return element; + return element3; } - base2 = element; + base3 = element3; } }; pp$5.shouldParseAsyncArrow = function() { @@ -40236,7 +40341,7 @@ pp$5.shouldParseAsyncArrow = function() { pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); }; -pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { +pp$5.parseSubscript = function(base3, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { var optionalSupported = this.options.ecmaVersion >= 11; var optional = optionalSupported && this.eat(types$1.questionDot); if (noCalls && optional) { @@ -40244,21 +40349,21 @@ pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArr } var computed = this.eat(types$1.bracketL); if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base2; + var node2 = this.startNodeAt(startPos, startLoc); + node2.object = base3; if (computed) { - node.property = this.parseExpression(); + node2.property = this.parseExpression(); this.expect(types$1.bracketR); - } else if (this.type === types$1.privateId && base2.type !== "Super") { - node.property = this.parsePrivateIdent(); + } else if (this.type === types$1.privateId && base3.type !== "Super") { + node2.property = this.parsePrivateIdent(); } else { - node.property = this.parseIdent(this.options.allowReserved !== "never"); + node2.property = this.parseIdent(this.options.allowReserved !== "never"); } - node.computed = !!computed; + node2.computed = !!computed; if (optionalSupported) { - node.optional = optional; + node2.optional = optional; } - base2 = this.finishNode(node, "MemberExpression"); + base3 = this.finishNode(node2, "MemberExpression"); } else if (!noCalls && this.eat(types$1.parenL)) { var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.yieldPos = 0; @@ -40281,46 +40386,46 @@ pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArr this.awaitPos = oldAwaitPos || this.awaitPos; this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; var node$1 = this.startNodeAt(startPos, startLoc); - node$1.callee = base2; + node$1.callee = base3; node$1.arguments = exprList; if (optionalSupported) { node$1.optional = optional; } - base2 = this.finishNode(node$1, "CallExpression"); + base3 = this.finishNode(node$1, "CallExpression"); } else if (this.type === types$1.backQuote) { if (optional || optionalChained) { this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); } var node$2 = this.startNodeAt(startPos, startLoc); - node$2.tag = base2; + node$2.tag = base3; node$2.quasi = this.parseTemplate({ isTagged: true }); - base2 = this.finishNode(node$2, "TaggedTemplateExpression"); + base3 = this.finishNode(node$2, "TaggedTemplateExpression"); } - return base2; + return base3; }; pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { if (this.type === types$1.slash) { this.readRegexp(); } - var node, canBeArrow = this.potentialArrowAt === this.start; + var node2, canBeArrow = this.potentialArrowAt === this.start; switch (this.type) { case types$1._super: if (!this.allowSuper) { this.raise(this.start, "'super' keyword outside a method"); } - node = this.startNode(); + node2 = this.startNode(); this.next(); if (this.type === types$1.parenL && !this.allowDirectSuper) { - this.raise(node.start, "super() call outside constructor of a subclass"); + this.raise(node2.start, "super() call outside constructor of a subclass"); } if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) { this.unexpected(); } - return this.finishNode(node, "Super"); + return this.finishNode(node2, "Super"); case types$1._this: - node = this.startNode(); + node2 = this.startNode(); this.next(); - return this.finishNode(node, "ThisExpression"); + return this.finishNode(node2, "ThisExpression"); case types$1.name: var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; var id3 = this.parseIdent(false); @@ -40343,20 +40448,20 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { return id3; case types$1.regexp: var value = this.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; + node2 = this.parseLiteral(value.value); + node2.regex = { pattern: value.pattern, flags: value.flags }; + return node2; case types$1.num: case types$1.string: return this.parseLiteral(this.value); case types$1._null: case types$1._true: case types$1._false: - node = this.startNode(); - node.value = this.type === types$1._null ? null : this.type === types$1._true; - node.raw = this.type.keyword; + node2 = this.startNode(); + node2.value = this.type === types$1._null ? null : this.type === types$1._true; + node2.raw = this.type.keyword; this.next(); - return this.finishNode(node, "Literal"); + return this.finishNode(node2, "Literal"); case types$1.parenL: var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); if (refDestructuringErrors) { @@ -40369,17 +40474,17 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { } return expr; case types$1.bracketL: - node = this.startNode(); + node2 = this.startNode(); this.next(); - node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); - return this.finishNode(node, "ArrayExpression"); + node2.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node2, "ArrayExpression"); case types$1.braceL: this.overrideContext(types.b_expr); return this.parseObj(false, refDestructuringErrors); case types$1._function: - node = this.startNode(); + node2 = this.startNode(); this.next(); - return this.parseFunction(node, 0); + return this.parseFunction(node2, 0); case types$1._class: return this.parseClass(this.startNode(), false); case types$1._new: @@ -40400,25 +40505,25 @@ pp$5.parseExprAtomDefault = function() { this.unexpected(); }; pp$5.parseExprImport = function(forNew) { - var node = this.startNode(); + var node2 = this.startNode(); if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } this.next(); if (this.type === types$1.parenL && !forNew) { - return this.parseDynamicImport(node); + return this.parseDynamicImport(node2); } else if (this.type === types$1.dot) { - var meta3 = this.startNodeAt(node.start, node.loc && node.loc.start); + var meta3 = this.startNodeAt(node2.start, node2.loc && node2.loc.start); meta3.name = "import"; - node.meta = this.finishNode(meta3, "Identifier"); - return this.parseImportMeta(node); + node2.meta = this.finishNode(meta3, "Identifier"); + return this.parseImportMeta(node2); } else { this.unexpected(); } }; -pp$5.parseDynamicImport = function(node) { +pp$5.parseDynamicImport = function(node2) { this.next(); - node.source = this.parseMaybeAssign(); + node2.source = this.parseMaybeAssign(); if (!this.eat(types$1.parenR)) { var errorPos = this.start; if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { @@ -40427,32 +40532,32 @@ pp$5.parseDynamicImport = function(node) { this.unexpected(errorPos); } } - return this.finishNode(node, "ImportExpression"); + return this.finishNode(node2, "ImportExpression"); }; -pp$5.parseImportMeta = function(node) { +pp$5.parseImportMeta = function(node2) { this.next(); var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "meta") { - this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); + node2.property = this.parseIdent(true); + if (node2.property.name !== "meta") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for import is 'import.meta'"); } if (containsEsc) { - this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); + this.raiseRecoverable(node2.start, "'import.meta' must not contain escaped characters"); } if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { - this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); + this.raiseRecoverable(node2.start, "Cannot use 'import.meta' outside a module"); } - return this.finishNode(node, "MetaProperty"); + return this.finishNode(node2, "MetaProperty"); }; pp$5.parseLiteral = function(value) { - var node = this.startNode(); - node.value = value; - node.raw = this.input.slice(this.start, this.end); - if (node.raw.charCodeAt(node.raw.length - 1) === 110) { - node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); + var node2 = this.startNode(); + node2.value = value; + node2.raw = this.input.slice(this.start, this.end); + if (node2.raw.charCodeAt(node2.raw.length - 1) === 110) { + node2.bigint = node2.raw.slice(0, -1).replace(/_/g, ""); } this.next(); - return this.finishNode(node, "Literal"); + return this.finishNode(node2, "Literal"); }; pp$5.parseParenExpression = function() { this.expect(types$1.parenL); @@ -40538,34 +40643,34 @@ pp$5.parseNew = function() { if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } - var node = this.startNode(); + var node2 = this.startNode(); this.next(); if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) { - var meta3 = this.startNodeAt(node.start, node.loc && node.loc.start); + var meta3 = this.startNodeAt(node2.start, node2.loc && node2.loc.start); meta3.name = "new"; - node.meta = this.finishNode(meta3, "Identifier"); + node2.meta = this.finishNode(meta3, "Identifier"); this.next(); var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "target") { - this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); + node2.property = this.parseIdent(true); + if (node2.property.name !== "target") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for new is 'new.target'"); } if (containsEsc) { - this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); + this.raiseRecoverable(node2.start, "'new.target' must not contain escaped characters"); } if (!this.allowNewDotTarget) { - this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); + this.raiseRecoverable(node2.start, "'new.target' can only be used in functions and class static block"); } - return this.finishNode(node, "MetaProperty"); + return this.finishNode(node2, "MetaProperty"); } var startPos = this.start, startLoc = this.startLoc; - node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); + node2.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); if (this.eat(types$1.parenL)) { - node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); + node2.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); } else { - node.arguments = empty; + node2.arguments = empty; } - return this.finishNode(node, "NewExpression"); + return this.finishNode(node2, "NewExpression"); }; pp$5.parseTemplateElement = function(ref2) { var isTagged = ref2.isTagged; @@ -40594,29 +40699,29 @@ pp$5.parseTemplate = function(ref2) { var isTagged = ref2.isTagged; if (isTagged === void 0) isTagged = false; - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.expressions = []; + node2.expressions = []; var curElt = this.parseTemplateElement({ isTagged }); - node.quasis = [curElt]; + node2.quasis = [curElt]; while (!curElt.tail) { if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); } this.expect(types$1.dollarBraceL); - node.expressions.push(this.parseExpression()); + node2.expressions.push(this.parseExpression()); this.expect(types$1.braceR); - node.quasis.push(curElt = this.parseTemplateElement({ isTagged })); + node2.quasis.push(curElt = this.parseTemplateElement({ isTagged })); } this.next(); - return this.finishNode(node, "TemplateLiteral"); + return this.finishNode(node2, "TemplateLiteral"); }; pp$5.isAsyncProp = function(prop2) { return !prop2.computed && prop2.key.type === "Identifier" && prop2.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); }; pp$5.parseObj = function(isPattern, refDestructuringErrors) { - var node = this.startNode(), first = true, propHash = {}; - node.properties = []; + var node2 = this.startNode(), first = true, propHash = {}; + node2.properties = []; this.next(); while (!this.eat(types$1.braceR)) { if (!first) { @@ -40631,9 +40736,9 @@ pp$5.parseObj = function(isPattern, refDestructuringErrors) { if (!isPattern) { this.checkPropClash(prop2, propHash, refDestructuringErrors); } - node.properties.push(prop2); + node2.properties.push(prop2); } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); + return this.finishNode(node2, isPattern ? "ObjectPattern" : "ObjectExpression"); }; pp$5.parseProperty = function(isPattern, refDestructuringErrors) { var prop2 = this.startNode(), isGenerator, isAsync, startPos, startLoc; @@ -40748,67 +40853,67 @@ pp$5.parsePropertyName = function(prop2) { } return prop2.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); }; -pp$5.initFunction = function(node) { - node.id = null; +pp$5.initFunction = function(node2) { + node2.id = null; if (this.options.ecmaVersion >= 6) { - node.generator = node.expression = false; + node2.generator = node2.expression = false; } if (this.options.ecmaVersion >= 8) { - node.async = false; + node2.async = false; } }; pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { - var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.initFunction(node); + var node2 = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.initFunction(node2); if (this.options.ecmaVersion >= 6) { - node.generator = isGenerator; + node2.generator = isGenerator; } if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + this.enterScope(functionFlags(isAsync, node2.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); this.expect(types$1.parenL); - node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false, true, false); + this.parseFunctionBody(node2, false, true, false); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "FunctionExpression"); + return this.finishNode(node2, "FunctionExpression"); }; -pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { +pp$5.parseArrowExpression = function(node2, params, isAsync, forInit) { var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); - this.initFunction(node); + this.initFunction(node2); if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true, false, forInit); + node2.params = this.toAssignableList(params, true); + this.parseFunctionBody(node2, true, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "ArrowFunctionExpression"); + return this.finishNode(node2, "ArrowFunctionExpression"); }; -pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { +pp$5.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) { var isExpression2 = isArrowFunction && this.type !== types$1.braceL; var oldStrict = this.strict, useStrict = false; if (isExpression2) { - node.body = this.parseMaybeAssign(forInit); - node.expression = true; - this.checkParams(node, false); + node2.body = this.parseMaybeAssign(forInit); + node2.expression = true; + this.checkParams(node2, false); } else { - var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node2.params); if (!oldStrict || nonSimple) { useStrict = this.strictDirective(this.end); if (useStrict && nonSimple) { - this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); + this.raiseRecoverable(node2.start, "Illegal 'use strict' directive in function with non-simple parameter list"); } } var oldLabels = this.labels; @@ -40816,30 +40921,30 @@ pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { if (useStrict) { this.strict = true; } - this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); - if (this.strict && node.id) { - this.checkLValSimple(node.id, BIND_OUTSIDE); + this.checkParams(node2, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node2.params)); + if (this.strict && node2.id) { + this.checkLValSimple(node2.id, BIND_OUTSIDE); } - node.body = this.parseBlock(false, void 0, useStrict && !oldStrict); - node.expression = false; - this.adaptDirectivePrologue(node.body.body); + node2.body = this.parseBlock(false, void 0, useStrict && !oldStrict); + node2.expression = false; + this.adaptDirectivePrologue(node2.body.body); this.labels = oldLabels; } this.exitScope(); }; pp$5.isSimpleParamList = function(params) { - for (var i4 = 0, list = params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i4 = 0, list4 = params; i4 < list4.length; i4 += 1) { + var param = list4[i4]; if (param.type !== "Identifier") { return false; } } return true; }; -pp$5.checkParams = function(node, allowDuplicates) { +pp$5.checkParams = function(node2, allowDuplicates) { var nameHash = /* @__PURE__ */ Object.create(null); - for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i4 = 0, list4 = node2.params; i4 < list4.length; i4 += 1) { + var param = list4[i4]; this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); } }; @@ -40900,73 +41005,73 @@ pp$5.checkUnreserved = function(ref2) { } }; pp$5.parseIdent = function(liberal) { - var node = this.parseIdentNode(); + var node2 = this.parseIdentNode(); this.next(!!liberal); - this.finishNode(node, "Identifier"); + this.finishNode(node2, "Identifier"); if (!liberal) { - this.checkUnreserved(node); - if (node.name === "await" && !this.awaitIdentPos) { - this.awaitIdentPos = node.start; + this.checkUnreserved(node2); + if (node2.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = node2.start; } } - return node; + return node2; }; pp$5.parseIdentNode = function() { - var node = this.startNode(); + var node2 = this.startNode(); if (this.type === types$1.name) { - node.name = this.value; + node2.name = this.value; } else if (this.type.keyword) { - node.name = this.type.keyword; - if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + node2.name = this.type.keyword; + if ((node2.name === "class" || node2.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { this.context.pop(); } this.type = types$1.name; } else { this.unexpected(); } - return node; + return node2; }; pp$5.parsePrivateIdent = function() { - var node = this.startNode(); + var node2 = this.startNode(); if (this.type === types$1.privateId) { - node.name = this.value; + node2.name = this.value; } else { this.unexpected(); } this.next(); - this.finishNode(node, "PrivateIdentifier"); + this.finishNode(node2, "PrivateIdentifier"); if (this.options.checkPrivateFields) { if (this.privateNameStack.length === 0) { - this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); + this.raise(node2.start, "Private field '#" + node2.name + "' must be declared in an enclosing class"); } else { - this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + this.privateNameStack[this.privateNameStack.length - 1].used.push(node2); } } - return node; + return node2; }; pp$5.parseYield = function(forInit) { if (!this.yieldPos) { this.yieldPos = this.start; } - var node = this.startNode(); + var node2 = this.startNode(); this.next(); if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) { - node.delegate = false; - node.argument = null; + node2.delegate = false; + node2.argument = null; } else { - node.delegate = this.eat(types$1.star); - node.argument = this.parseMaybeAssign(forInit); + node2.delegate = this.eat(types$1.star); + node2.argument = this.parseMaybeAssign(forInit); } - return this.finishNode(node, "YieldExpression"); + return this.finishNode(node2, "YieldExpression"); }; pp$5.parseAwait = function(forInit) { if (!this.awaitPos) { this.awaitPos = this.start; } - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, true, false, forInit); - return this.finishNode(node, "AwaitExpression"); + node2.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node2, "AwaitExpression"); }; var pp$4 = Parser.prototype; pp$4.raise = function(pos, message) { @@ -41086,27 +41191,27 @@ pp$2.startNode = function() { pp$2.startNodeAt = function(pos, loc) { return new Node(this, pos, loc); }; -function finishNodeAt(node, type, pos, loc) { - node.type = type; - node.end = pos; +function finishNodeAt(node2, type, pos, loc) { + node2.type = type; + node2.end = pos; if (this.options.locations) { - node.loc.end = loc; + node2.loc.end = loc; } if (this.options.ranges) { - node.range[1] = pos; + node2.range[1] = pos; } - return node; + return node2; } -pp$2.finishNode = function(node, type) { - return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); +pp$2.finishNode = function(node2, type) { + return finishNodeAt.call(this, node2, type, this.lastTokEnd, this.lastTokEndLoc); }; -pp$2.finishNodeAt = function(node, type, pos, loc) { - return finishNodeAt.call(this, node, type, pos, loc); +pp$2.finishNodeAt = function(node2, type, pos, loc) { + return finishNodeAt.call(this, node2, type, pos, loc); }; -pp$2.copyNode = function(node) { - var newNode2 = new Node(this, node.start, this.startLoc); - for (var prop2 in node) { - newNode2[prop2] = node[prop2]; +pp$2.copyNode = function(node2) { + var newNode2 = new Node(this, node2.start, this.startLoc); + for (var prop2 in node2) { + newNode2[prop2] = node2[prop2]; } return newNode2; }; @@ -41163,13 +41268,13 @@ function buildUnicodeData(ecmaVersion) { d4.nonBinary.sc = d4.nonBinary.Script; d4.nonBinary.scx = d4.nonBinary.Script_Extensions; } -for (i4 = 0, list = [9, 10, 11, 12, 13, 14]; i4 < list.length; i4 += 1) { - ecmaVersion = list[i4]; +for (i4 = 0, list4 = [9, 10, 11, 12, 13, 14]; i4 < list4.length; i4 += 1) { + ecmaVersion = list4[i4]; buildUnicodeData(ecmaVersion); } var ecmaVersion; var i4; -var list; +var list4; var pp$1 = Parser.prototype; var RegExpValidationState = function RegExpValidationState2(parser3) { this.parser = parser3; @@ -41266,8 +41371,8 @@ RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) { if (forceU === void 0) forceU = false; var pos = this.pos; - for (var i4 = 0, list = chs; i4 < list.length; i4 += 1) { - var ch = list[i4]; + for (var i4 = 0, list4 = chs; i4 < list4.length; i4 += 1) { + var ch = list4[i4]; var current3 = this.at(pos, forceU); if (current3 === -1 || current3 !== ch) { return false; @@ -41329,8 +41434,8 @@ pp$1.regexp_pattern = function(state) { if (state.maxBackReference > state.numCapturingParens) { state.raise("Invalid escape"); } - for (var i4 = 0, list = state.backReferenceNames; i4 < list.length; i4 += 1) { - var name317 = list[i4]; + for (var i4 = 0, list4 = state.backReferenceNames; i4 < list4.length; i4 += 1) { + var name317 = list4[i4]; if (state.groupNames.indexOf(name317) === -1) { state.raise("Invalid named capture referenced"); } @@ -42178,16 +42283,16 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) { } return true; }; -var Token = function Token2(p) { - this.type = p.type; - this.value = p.value; - this.start = p.start; - this.end = p.end; - if (p.options.locations) { - this.loc = new SourceLocation(p, p.startLoc, p.endLoc); +var Token = function Token2(p2) { + this.type = p2.type; + this.value = p2.value; + this.start = p2.start; + this.end = p2.end; + if (p2.options.locations) { + this.loc = new SourceLocation(p2, p2.startLoc, p2.endLoc); } - if (p.options.ranges) { - this.range = [p.start, p.end]; + if (p2.options.ranges) { + this.range = [p2.start, p2.end]; } }; var pp = Parser.prototype; @@ -42240,19 +42345,19 @@ pp.nextToken = function() { this.readToken(this.fullCharCodeAtPos()); } }; -pp.readToken = function(code) { - if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) { +pp.readToken = function(code3) { + if (isIdentifierStart(code3, this.options.ecmaVersion >= 6) || code3 === 92) { return this.readWord(); } - return this.getTokenFromCode(code); + return this.getTokenFromCode(code3); }; pp.fullCharCodeAtPos = function() { - var code = this.input.charCodeAt(this.pos); - if (code <= 55295 || code >= 56320) { - return code; + var code3 = this.input.charCodeAt(this.pos); + if (code3 <= 55295 || code3 >= 56320) { + return code3; } var next = this.input.charCodeAt(this.pos + 1); - return next <= 56319 || next >= 57344 ? code : (code << 10) + next - 56613888; + return next <= 56319 || next >= 57344 ? code3 : (code3 << 10) + next - 56613888; }; pp.skipBlockComment = function() { var startLoc = this.options.onComment && this.curPosition(); @@ -42374,11 +42479,11 @@ pp.readToken_slash = function() { } return this.finishOp(types$1.slash, 1); }; -pp.readToken_mult_modulo_exp = function(code) { +pp.readToken_mult_modulo_exp = function(code3) { var next = this.input.charCodeAt(this.pos + 1); var size2 = 1; - var tokentype = code === 42 ? types$1.star : types$1.modulo; - if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { + var tokentype = code3 === 42 ? types$1.star : types$1.modulo; + if (this.options.ecmaVersion >= 7 && code3 === 42 && next === 42) { ++size2; tokentype = types$1.starstar; next = this.input.charCodeAt(this.pos + 2); @@ -42388,21 +42493,21 @@ pp.readToken_mult_modulo_exp = function(code) { } return this.finishOp(tokentype, size2); }; -pp.readToken_pipe_amp = function(code) { +pp.readToken_pipe_amp = function(code3) { var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { + if (next === code3) { if (this.options.ecmaVersion >= 12) { var next2 = this.input.charCodeAt(this.pos + 2); if (next2 === 61) { return this.finishOp(types$1.assign, 3); } } - return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2); + return this.finishOp(code3 === 124 ? types$1.logicalOR : types$1.logicalAND, 2); } if (next === 61) { return this.finishOp(types$1.assign, 2); } - return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); + return this.finishOp(code3 === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); }; pp.readToken_caret = function() { var next = this.input.charCodeAt(this.pos + 1); @@ -42411,9 +42516,9 @@ pp.readToken_caret = function() { } return this.finishOp(types$1.bitwiseXOR, 1); }; -pp.readToken_plus_min = function(code) { +pp.readToken_plus_min = function(code3) { var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { + if (next === code3) { if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { this.skipLineComment(3); this.skipSpace(); @@ -42426,17 +42531,17 @@ pp.readToken_plus_min = function(code) { } return this.finishOp(types$1.plusMin, 1); }; -pp.readToken_lt_gt = function(code) { +pp.readToken_lt_gt = function(code3) { var next = this.input.charCodeAt(this.pos + 1); var size2 = 1; - if (next === code) { - size2 = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (next === code3) { + size2 = code3 === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; if (this.input.charCodeAt(this.pos + size2) === 61) { return this.finishOp(types$1.assign, size2 + 1); } return this.finishOp(types$1.bitShift, size2); } - if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { + if (next === 33 && code3 === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { this.skipLineComment(4); this.skipSpace(); return this.nextToken(); @@ -42446,16 +42551,16 @@ pp.readToken_lt_gt = function(code) { } return this.finishOp(types$1.relational, size2); }; -pp.readToken_eq_excl = function(code) { +pp.readToken_eq_excl = function(code3) { var next = this.input.charCodeAt(this.pos + 1); if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); } - if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { + if (code3 === 61 && next === 62 && this.options.ecmaVersion >= 6) { this.pos += 2; return this.finishToken(types$1.arrow); } - return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1); + return this.finishOp(code3 === 61 ? types$1.eq : types$1.prefix, 1); }; pp.readToken_question = function() { var ecmaVersion = this.options.ecmaVersion; @@ -42481,18 +42586,18 @@ pp.readToken_question = function() { }; pp.readToken_numberSign = function() { var ecmaVersion = this.options.ecmaVersion; - var code = 35; + var code3 = 35; if (ecmaVersion >= 13) { ++this.pos; - code = this.fullCharCodeAtPos(); - if (isIdentifierStart(code, true) || code === 92) { + code3 = this.fullCharCodeAtPos(); + if (isIdentifierStart(code3, true) || code3 === 92) { return this.finishToken(types$1.privateId, this.readWord1()); } } - this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); + this.raise(this.pos, "Unexpected character '" + codePointToString(code3) + "'"); }; -pp.getTokenFromCode = function(code) { - switch (code) { +pp.getTokenFromCode = function(code3) { + switch (code3) { case 46: return this.readToken_dot(); case 40: @@ -42553,26 +42658,26 @@ pp.getTokenFromCode = function(code) { return this.readNumber(false); case 34: case 39: - return this.readString(code); + return this.readString(code3); case 47: return this.readToken_slash(); case 37: case 42: - return this.readToken_mult_modulo_exp(code); + return this.readToken_mult_modulo_exp(code3); case 124: case 38: - return this.readToken_pipe_amp(code); + return this.readToken_pipe_amp(code3); case 94: return this.readToken_caret(); case 43: case 45: - return this.readToken_plus_min(code); + return this.readToken_plus_min(code3); case 60: case 62: - return this.readToken_lt_gt(code); + return this.readToken_lt_gt(code3); case 61: case 33: - return this.readToken_eq_excl(code); + return this.readToken_eq_excl(code3); case 63: return this.readToken_question(); case 126: @@ -42580,7 +42685,7 @@ pp.getTokenFromCode = function(code) { case 35: return this.readToken_numberSign(); } - this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); + this.raise(this.pos, "Unexpected character '" + codePointToString(code3) + "'"); }; pp.finishOp = function(type, size2) { var str = this.input.slice(this.pos, this.pos + size2); @@ -42634,8 +42739,8 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; var start = this.pos, total = 0, lastCode = 0; for (var i4 = 0, e5 = len == null ? Infinity : len; i4 < e5; ++i4, ++this.pos) { - var code = this.input.charCodeAt(this.pos), val = void 0; - if (allowSeparators && code === 95) { + var code3 = this.input.charCodeAt(this.pos), val = void 0; + if (allowSeparators && code3 === 95) { if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); } @@ -42645,22 +42750,22 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { if (i4 === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); } - lastCode = code; + lastCode = code3; continue; } - if (code >= 97) { - val = code - 97 + 10; - } else if (code >= 65) { - val = code - 65 + 10; - } else if (code >= 48 && code <= 57) { - val = code - 48; + if (code3 >= 97) { + val = code3 - 97 + 10; + } else if (code3 >= 65) { + val = code3 - 65 + 10; + } else if (code3 >= 48 && code3 <= 57) { + val = code3 - 48; } else { val = Infinity; } if (val >= radix) { break; } - lastCode = code; + lastCode = code3; total = total * radix + val; } if (allowSeparators && lastCode === 95) { @@ -42740,21 +42845,21 @@ pp.readNumber = function(startsWithDot) { return this.finishToken(types$1.num, val); }; pp.readCodePoint = function() { - var ch = this.input.charCodeAt(this.pos), code; + var ch = this.input.charCodeAt(this.pos), code3; if (ch === 123) { if (this.options.ecmaVersion < 6) { this.unexpected(); } var codePos = ++this.pos; - code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos); + code3 = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos); ++this.pos; - if (code > 1114111) { + if (code3 > 1114111) { this.invalidStringToken(codePos, "Code point out of bounds"); } } else { - code = this.readHexChar(4); + code3 = this.readHexChar(4); } - return code; + return code3; }; pp.readString = function(quote) { var out = "", chunkStart = ++this.pos; @@ -42803,11 +42908,11 @@ pp.tryReadTemplateToken = function() { } this.inTemplateElement = false; }; -pp.invalidStringToken = function(position, message) { +pp.invalidStringToken = function(position3, message) { if (this.inTemplateElement && this.options.ecmaVersion >= 9) { throw INVALID_TEMPLATE_ESCAPE_ERROR; } else { - this.raise(position, message); + this.raise(position3, message); } }; pp.readTmplToken = function() { @@ -43020,11 +43125,11 @@ var import_lodash2 = __toESM(require_lodash()); function deepOmit(obj, keysToOmit) { const keysToOmitIndex = import_lodash2.default.keyBy(Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit]); function omitFromObject(obj2) { - return import_lodash2.default.transform(obj2, function(result, value, key2) { - if (key2 in keysToOmitIndex) { + return import_lodash2.default.transform(obj2, function(result, value, key3) { + if (key3 in keysToOmitIndex) { return; } - result[key2] = import_lodash2.default.isObject(value) ? omitFromObject(value) : value; + result[key3] = import_lodash2.default.isObject(value) ? omitFromObject(value) : value; }); } return omitFromObject(obj); @@ -43043,9 +43148,9 @@ var renameKey = (object, oldKey, newKey) => { }; function applyFunctionToObject(object, func) { const newObject = {}; - for (const key2 in object) { - if (Object.prototype.hasOwnProperty.call(object, key2)) { - newObject[key2] = func(object[key2], key2); + for (const key3 in object) { + if (Object.prototype.hasOwnProperty.call(object, key3)) { + newObject[key3] = func(object[key3], key3); } } return newObject; @@ -43079,36 +43184,36 @@ var stringIsConst = (str) => { const isNumber4 = !isNaN(parseFloat(fixedStr)) && !isNaN(fixedStr); return hasQuotesAtStartEndOnly || isNumber4 || fixedStr == "false" || fixedStr == "true" || str == null || str == ""; }; -var kitWithProps = (root, props, styles2, actions) => { - return frameRootWithProps({ ...root, node: { ...root.node, type: "frame", ref: "spaces://$kit/#*" + root.id }, children: [] }, props, styles2, actions); +var kitWithProps = (root4, props, styles2, actions) => { + return frameRootWithProps({ ...root4, node: { ...root4.node, type: "frame", ref: "spaces://$kit/#*" + root4.id }, children: [] }, props, styles2, actions); }; -var frameRootWithProps = (root, props, styles2, actions) => { +var frameRootWithProps = (root4, props, styles2, actions) => { return { - ...root, + ...root4, node: { - ...root.node, + ...root4.node, props: { - ...root.node.props, + ...root4.node.props, ...props }, styles: { - ...root.node.styles, + ...root4.node.styles, ...styles2 }, actions: { - ...root.node.actions, + ...root4.node.actions, ...actions } } }; }; -var newUniqueNode = (node, parent, otherNodes, schemaId) => { +var newUniqueNode = (node2, parent, otherNodes, schemaId) => { const id3 = uniqueNameFromString( - node.node.id, + node2.node.id, otherNodes.map((f2) => f2.id) ); return { - ...node.node, + ...node2.node, id: id3, schemaId, parentId: parent @@ -43128,8 +43233,8 @@ var generateCodeForProp = (value, isClosure, type) => { } return func; }; -var buildExecutable = (root) => { - const treeNode = { ...root, execActions: {}, execProps: {}, execStyles: {}, execPropsOptions: {} }; +var buildExecutable = (root4) => { + const treeNode = { ...root4, execActions: {}, execProps: {}, execStyles: {}, execPropsOptions: {} }; const { sortedKeys, dependencies: dependencies314 } = sortKeysByDependencies(treeNode.node.props, `${treeNode.id}.props`); const { sortedKeys: _15, dependencies: styleDependencies } = sortKeysByDependencies(treeNode.node.styles, `${treeNode.id}.styles`); treeNode.execPropsOptions.props = sortedKeys.map((f2) => { @@ -43157,55 +43262,55 @@ var buildExecutable = (root) => { } return treeNode; }; -function extractDependencies(code) { +function extractDependencies(code3) { const dependencies314 = []; - function visit(node, parts = []) { - if (node.type === "Identifier") { - parts.push(node.name); + function visit2(node2, parts = []) { + if (node2.type === "Identifier") { + parts.push(node2.name); return parts; - } else if (node.type === "MemberExpression") { - const objectParts = visit(node.object, parts); - if (objectParts && node.computed) { - if (node.property.type === "Literal") { - objectParts.push(String(node.property.value)); + } else if (node2.type === "MemberExpression") { + const objectParts = visit2(node2.object, parts); + if (objectParts && node2.computed) { + if (node2.property.type === "Literal") { + objectParts.push(String(node2.property.value)); return objectParts; - } else if (node.property.type === "Identifier") { - objectParts.push(node.property.name); + } else if (node2.property.type === "Identifier") { + objectParts.push(node2.property.name); return objectParts; - } else if (node.property.type === "MemberExpression") { - explore(node.property); + } else if (node2.property.type === "MemberExpression") { + explore(node2.property); return objectParts; } else { return null; } } else if (objectParts) { - return visit(node.property, objectParts); + return visit2(node2.property, objectParts); } - } else if (node.type === "Literal") { - parts.push(String(node.value)); + } else if (node2.type === "Literal") { + parts.push(String(node2.value)); return parts; - } else if (node.type === "ChainExpression" || node.type == "ExpressionStatement") { - explore(node.expression); + } else if (node2.type === "ChainExpression" || node2.type == "ExpressionStatement") { + explore(node2.expression); return; - } else if (node.type === "CallExpression") { - explore(node); + } else if (node2.type === "CallExpression") { + explore(node2); return; } return null; } - function explore(node) { - if (node.type === "MemberExpression") { - const parts = visit(node); + function explore(node2) { + if (node2.type === "MemberExpression") { + const parts = visit2(node2); if (parts) { dependencies314.push(parts); } return; } - for (const key2 in node) { - if (typeof node[key2] === "object" && node[key2] !== null) { - explore(node[key2]); - } else if (Array.isArray(node[key2])) { - for (const item of node[key2]) { + for (const key3 in node2) { + if (typeof node2[key3] === "object" && node2[key3] !== null) { + explore(node2[key3]); + } else if (Array.isArray(node2[key3])) { + for (const item of node2[key3]) { if (typeof item === "object" && item !== null) { explore(item); } @@ -43214,7 +43319,7 @@ function extractDependencies(code) { } } try { - const ast = parse3(code.replace("return ", ""), { ecmaVersion: 2020 }); + const ast = parse3(code3.replace("return ", ""), { ecmaVersion: 2020 }); explore(ast); } catch (e5) { return []; @@ -43225,238 +43330,238 @@ function sortKeysByDependencies(codeBlockStore, identifier) { const graph = /* @__PURE__ */ new Map(); const dependencies314 = /* @__PURE__ */ new Map(); const allDependencies = /* @__PURE__ */ new Map(); - for (const key2 in codeBlockStore) { - const code = codeBlockStore[key2]; - const extractedDependencies = extractDependencies(code); + for (const key3 in codeBlockStore) { + const code3 = codeBlockStore[key3]; + const extractedDependencies = extractDependencies(code3); const localDependencies = extractedDependencies.filter((dep) => { return dep.slice(0, -1).join(".") === identifier; }); - dependencies314.set(key2, localDependencies); - allDependencies.set(key2, extractedDependencies); - if (!graph.has(key2)) { - graph.set(key2, /* @__PURE__ */ new Set()); + dependencies314.set(key3, localDependencies); + allDependencies.set(key3, extractedDependencies); + if (!graph.has(key3)) { + graph.set(key3, /* @__PURE__ */ new Set()); } for (const dep of localDependencies) { const depStr = dep[dep.length - 1]; - if (depStr === key2) + if (depStr === key3) continue; - graph.get(key2).add(depStr); + graph.get(key3).add(depStr); } } const visited = /* @__PURE__ */ new Set(); const result = []; const temp = /* @__PURE__ */ new Set(); - const visit = (key2) => { - if (temp.has(key2)) + const visit2 = (key3) => { + if (temp.has(key3)) throw new Error("Circular dependency detected"); - if (!visited.has(key2)) { - temp.add(key2); - const edges = graph.get(key2) || /* @__PURE__ */ new Set(); + if (!visited.has(key3)) { + temp.add(key3); + const edges = graph.get(key3) || /* @__PURE__ */ new Set(); for (const dep of edges) { - visit(dep); + visit2(dep); } - visited.add(key2); - temp.delete(key2); - result.push(key2); + visited.add(key3); + temp.delete(key3); + result.push(key3); } }; - for (const key2 in codeBlockStore) { - if (!visited.has(key2)) { - visit(key2); + for (const key3 in codeBlockStore) { + if (!visited.has(key3)) { + visit2(key3); } } return { sortedKeys: result, dependencies: allDependencies }; } // node_modules/acorn-walk/dist/walk.mjs -function simple(node, visitors, baseVisitor, state, override) { +function simple(node2, visitors, baseVisitor, state, override) { if (!baseVisitor) { baseVisitor = base; } - (function c3(node2, st, override2) { - var type = override2 || node2.type; - baseVisitor[type](node2, st, c3); + (function c3(node3, st, override2) { + var type = override2 || node3.type; + baseVisitor[type](node3, st, c3); if (visitors[type]) { - visitors[type](node2, st); + visitors[type](node3, st); } - })(node, state, override); + })(node2, state, override); } -function ancestor(node, visitors, baseVisitor, state, override) { +function ancestor(node2, visitors, baseVisitor, state, override) { var ancestors = []; if (!baseVisitor) { baseVisitor = base; } - (function c3(node2, st, override2) { - var type = override2 || node2.type; - var isNew = node2 !== ancestors[ancestors.length - 1]; + (function c3(node3, st, override2) { + var type = override2 || node3.type; + var isNew = node3 !== ancestors[ancestors.length - 1]; if (isNew) { - ancestors.push(node2); + ancestors.push(node3); } - baseVisitor[type](node2, st, c3); + baseVisitor[type](node3, st, c3); if (visitors[type]) { - visitors[type](node2, st || ancestors, ancestors); + visitors[type](node3, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } - })(node, state, override); + })(node2, state, override); } -function skipThrough(node, st, c3) { - c3(node, st); +function skipThrough(node2, st, c3) { + c3(node2, st); } function ignore(_node, _st, _c) { } var base = {}; -base.Program = base.BlockStatement = base.StaticBlock = function(node, st, c3) { - for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) { - var stmt = list[i4]; +base.Program = base.BlockStatement = base.StaticBlock = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.body; i4 < list4.length; i4 += 1) { + var stmt = list4[i4]; c3(stmt, st, "Statement"); } }; base.Statement = skipThrough; base.EmptyStatement = ignore; -base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = function(node, st, c3) { - return c3(node.expression, st, "Expression"); +base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = function(node2, st, c3) { + return c3(node2.expression, st, "Expression"); }; -base.IfStatement = function(node, st, c3) { - c3(node.test, st, "Expression"); - c3(node.consequent, st, "Statement"); - if (node.alternate) { - c3(node.alternate, st, "Statement"); +base.IfStatement = function(node2, st, c3) { + c3(node2.test, st, "Expression"); + c3(node2.consequent, st, "Statement"); + if (node2.alternate) { + c3(node2.alternate, st, "Statement"); } }; -base.LabeledStatement = function(node, st, c3) { - return c3(node.body, st, "Statement"); +base.LabeledStatement = function(node2, st, c3) { + return c3(node2.body, st, "Statement"); }; base.BreakStatement = base.ContinueStatement = ignore; -base.WithStatement = function(node, st, c3) { - c3(node.object, st, "Expression"); - c3(node.body, st, "Statement"); +base.WithStatement = function(node2, st, c3) { + c3(node2.object, st, "Expression"); + c3(node2.body, st, "Statement"); }; -base.SwitchStatement = function(node, st, c3) { - c3(node.discriminant, st, "Expression"); - for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) { +base.SwitchStatement = function(node2, st, c3) { + c3(node2.discriminant, st, "Expression"); + for (var i$1 = 0, list$1 = node2.cases; i$1 < list$1.length; i$1 += 1) { var cs = list$1[i$1]; if (cs.test) { c3(cs.test, st, "Expression"); } - for (var i4 = 0, list = cs.consequent; i4 < list.length; i4 += 1) { - var cons = list[i4]; + for (var i4 = 0, list4 = cs.consequent; i4 < list4.length; i4 += 1) { + var cons = list4[i4]; c3(cons, st, "Statement"); } } }; -base.SwitchCase = function(node, st, c3) { - if (node.test) { - c3(node.test, st, "Expression"); +base.SwitchCase = function(node2, st, c3) { + if (node2.test) { + c3(node2.test, st, "Expression"); } - for (var i4 = 0, list = node.consequent; i4 < list.length; i4 += 1) { - var cons = list[i4]; + for (var i4 = 0, list4 = node2.consequent; i4 < list4.length; i4 += 1) { + var cons = list4[i4]; c3(cons, st, "Statement"); } }; -base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function(node, st, c3) { - if (node.argument) { - c3(node.argument, st, "Expression"); +base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function(node2, st, c3) { + if (node2.argument) { + c3(node2.argument, st, "Expression"); } }; -base.ThrowStatement = base.SpreadElement = function(node, st, c3) { - return c3(node.argument, st, "Expression"); +base.ThrowStatement = base.SpreadElement = function(node2, st, c3) { + return c3(node2.argument, st, "Expression"); }; -base.TryStatement = function(node, st, c3) { - c3(node.block, st, "Statement"); - if (node.handler) { - c3(node.handler, st); +base.TryStatement = function(node2, st, c3) { + c3(node2.block, st, "Statement"); + if (node2.handler) { + c3(node2.handler, st); } - if (node.finalizer) { - c3(node.finalizer, st, "Statement"); + if (node2.finalizer) { + c3(node2.finalizer, st, "Statement"); } }; -base.CatchClause = function(node, st, c3) { - if (node.param) { - c3(node.param, st, "Pattern"); +base.CatchClause = function(node2, st, c3) { + if (node2.param) { + c3(node2.param, st, "Pattern"); } - c3(node.body, st, "Statement"); + c3(node2.body, st, "Statement"); }; -base.WhileStatement = base.DoWhileStatement = function(node, st, c3) { - c3(node.test, st, "Expression"); - c3(node.body, st, "Statement"); +base.WhileStatement = base.DoWhileStatement = function(node2, st, c3) { + c3(node2.test, st, "Expression"); + c3(node2.body, st, "Statement"); }; -base.ForStatement = function(node, st, c3) { - if (node.init) { - c3(node.init, st, "ForInit"); +base.ForStatement = function(node2, st, c3) { + if (node2.init) { + c3(node2.init, st, "ForInit"); } - if (node.test) { - c3(node.test, st, "Expression"); + if (node2.test) { + c3(node2.test, st, "Expression"); } - if (node.update) { - c3(node.update, st, "Expression"); + if (node2.update) { + c3(node2.update, st, "Expression"); } - c3(node.body, st, "Statement"); + c3(node2.body, st, "Statement"); }; -base.ForInStatement = base.ForOfStatement = function(node, st, c3) { - c3(node.left, st, "ForInit"); - c3(node.right, st, "Expression"); - c3(node.body, st, "Statement"); +base.ForInStatement = base.ForOfStatement = function(node2, st, c3) { + c3(node2.left, st, "ForInit"); + c3(node2.right, st, "Expression"); + c3(node2.body, st, "Statement"); }; -base.ForInit = function(node, st, c3) { - if (node.type === "VariableDeclaration") { - c3(node, st); +base.ForInit = function(node2, st, c3) { + if (node2.type === "VariableDeclaration") { + c3(node2, st); } else { - c3(node, st, "Expression"); + c3(node2, st, "Expression"); } }; base.DebuggerStatement = ignore; -base.FunctionDeclaration = function(node, st, c3) { - return c3(node, st, "Function"); +base.FunctionDeclaration = function(node2, st, c3) { + return c3(node2, st, "Function"); }; -base.VariableDeclaration = function(node, st, c3) { - for (var i4 = 0, list = node.declarations; i4 < list.length; i4 += 1) { - var decl = list[i4]; +base.VariableDeclaration = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.declarations; i4 < list4.length; i4 += 1) { + var decl = list4[i4]; c3(decl, st); } }; -base.VariableDeclarator = function(node, st, c3) { - c3(node.id, st, "Pattern"); - if (node.init) { - c3(node.init, st, "Expression"); +base.VariableDeclarator = function(node2, st, c3) { + c3(node2.id, st, "Pattern"); + if (node2.init) { + c3(node2.init, st, "Expression"); } }; -base.Function = function(node, st, c3) { - if (node.id) { - c3(node.id, st, "Pattern"); +base.Function = function(node2, st, c3) { + if (node2.id) { + c3(node2.id, st, "Pattern"); } - for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i4 = 0, list4 = node2.params; i4 < list4.length; i4 += 1) { + var param = list4[i4]; c3(param, st, "Pattern"); } - c3(node.body, st, node.expression ? "Expression" : "Statement"); + c3(node2.body, st, node2.expression ? "Expression" : "Statement"); }; -base.Pattern = function(node, st, c3) { - if (node.type === "Identifier") { - c3(node, st, "VariablePattern"); - } else if (node.type === "MemberExpression") { - c3(node, st, "MemberPattern"); +base.Pattern = function(node2, st, c3) { + if (node2.type === "Identifier") { + c3(node2, st, "VariablePattern"); + } else if (node2.type === "MemberExpression") { + c3(node2, st, "MemberPattern"); } else { - c3(node, st); + c3(node2, st); } }; base.VariablePattern = ignore; base.MemberPattern = skipThrough; -base.RestElement = function(node, st, c3) { - return c3(node.argument, st, "Pattern"); +base.RestElement = function(node2, st, c3) { + return c3(node2.argument, st, "Pattern"); }; -base.ArrayPattern = function(node, st, c3) { - for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) { - var elt = list[i4]; +base.ArrayPattern = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.elements; i4 < list4.length; i4 += 1) { + var elt = list4[i4]; if (elt) { c3(elt, st, "Pattern"); } } }; -base.ObjectPattern = function(node, st, c3) { - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop2 = list[i4]; +base.ObjectPattern = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) { + var prop2 = list4[i4]; if (prop2.type === "Property") { if (prop2.computed) { c3(prop2.key, st, "Expression"); @@ -43469,122 +43574,122 @@ base.ObjectPattern = function(node, st, c3) { }; base.Expression = skipThrough; base.ThisExpression = base.Super = base.MetaProperty = ignore; -base.ArrayExpression = function(node, st, c3) { - for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) { - var elt = list[i4]; +base.ArrayExpression = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.elements; i4 < list4.length; i4 += 1) { + var elt = list4[i4]; if (elt) { c3(elt, st, "Expression"); } } }; -base.ObjectExpression = function(node, st, c3) { - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop2 = list[i4]; +base.ObjectExpression = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.properties; i4 < list4.length; i4 += 1) { + var prop2 = list4[i4]; c3(prop2, st); } }; base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; -base.SequenceExpression = function(node, st, c3) { - for (var i4 = 0, list = node.expressions; i4 < list.length; i4 += 1) { - var expr = list[i4]; +base.SequenceExpression = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.expressions; i4 < list4.length; i4 += 1) { + var expr = list4[i4]; c3(expr, st, "Expression"); } }; -base.TemplateLiteral = function(node, st, c3) { - for (var i4 = 0, list = node.quasis; i4 < list.length; i4 += 1) { - var quasi = list[i4]; +base.TemplateLiteral = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.quasis; i4 < list4.length; i4 += 1) { + var quasi = list4[i4]; c3(quasi, st); } - for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) { + for (var i$1 = 0, list$1 = node2.expressions; i$1 < list$1.length; i$1 += 1) { var expr = list$1[i$1]; c3(expr, st, "Expression"); } }; base.TemplateElement = ignore; -base.UnaryExpression = base.UpdateExpression = function(node, st, c3) { - c3(node.argument, st, "Expression"); -}; -base.BinaryExpression = base.LogicalExpression = function(node, st, c3) { - c3(node.left, st, "Expression"); - c3(node.right, st, "Expression"); -}; -base.AssignmentExpression = base.AssignmentPattern = function(node, st, c3) { - c3(node.left, st, "Pattern"); - c3(node.right, st, "Expression"); -}; -base.ConditionalExpression = function(node, st, c3) { - c3(node.test, st, "Expression"); - c3(node.consequent, st, "Expression"); - c3(node.alternate, st, "Expression"); -}; -base.NewExpression = base.CallExpression = function(node, st, c3) { - c3(node.callee, st, "Expression"); - if (node.arguments) { - for (var i4 = 0, list = node.arguments; i4 < list.length; i4 += 1) { - var arg2 = list[i4]; +base.UnaryExpression = base.UpdateExpression = function(node2, st, c3) { + c3(node2.argument, st, "Expression"); +}; +base.BinaryExpression = base.LogicalExpression = function(node2, st, c3) { + c3(node2.left, st, "Expression"); + c3(node2.right, st, "Expression"); +}; +base.AssignmentExpression = base.AssignmentPattern = function(node2, st, c3) { + c3(node2.left, st, "Pattern"); + c3(node2.right, st, "Expression"); +}; +base.ConditionalExpression = function(node2, st, c3) { + c3(node2.test, st, "Expression"); + c3(node2.consequent, st, "Expression"); + c3(node2.alternate, st, "Expression"); +}; +base.NewExpression = base.CallExpression = function(node2, st, c3) { + c3(node2.callee, st, "Expression"); + if (node2.arguments) { + for (var i4 = 0, list4 = node2.arguments; i4 < list4.length; i4 += 1) { + var arg2 = list4[i4]; c3(arg2, st, "Expression"); } } }; -base.MemberExpression = function(node, st, c3) { - c3(node.object, st, "Expression"); - if (node.computed) { - c3(node.property, st, "Expression"); +base.MemberExpression = function(node2, st, c3) { + c3(node2.object, st, "Expression"); + if (node2.computed) { + c3(node2.property, st, "Expression"); } }; -base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function(node, st, c3) { - if (node.declaration) { - c3(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); +base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function(node2, st, c3) { + if (node2.declaration) { + c3(node2.declaration, st, node2.type === "ExportNamedDeclaration" || node2.declaration.id ? "Statement" : "Expression"); } - if (node.source) { - c3(node.source, st, "Expression"); + if (node2.source) { + c3(node2.source, st, "Expression"); } }; -base.ExportAllDeclaration = function(node, st, c3) { - if (node.exported) { - c3(node.exported, st); +base.ExportAllDeclaration = function(node2, st, c3) { + if (node2.exported) { + c3(node2.exported, st); } - c3(node.source, st, "Expression"); + c3(node2.source, st, "Expression"); }; -base.ImportDeclaration = function(node, st, c3) { - for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) { - var spec = list[i4]; +base.ImportDeclaration = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.specifiers; i4 < list4.length; i4 += 1) { + var spec = list4[i4]; c3(spec, st); } - c3(node.source, st, "Expression"); + c3(node2.source, st, "Expression"); }; -base.ImportExpression = function(node, st, c3) { - c3(node.source, st, "Expression"); +base.ImportExpression = function(node2, st, c3) { + c3(node2.source, st, "Expression"); }; base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore; -base.TaggedTemplateExpression = function(node, st, c3) { - c3(node.tag, st, "Expression"); - c3(node.quasi, st, "Expression"); +base.TaggedTemplateExpression = function(node2, st, c3) { + c3(node2.tag, st, "Expression"); + c3(node2.quasi, st, "Expression"); }; -base.ClassDeclaration = base.ClassExpression = function(node, st, c3) { - return c3(node, st, "Class"); +base.ClassDeclaration = base.ClassExpression = function(node2, st, c3) { + return c3(node2, st, "Class"); }; -base.Class = function(node, st, c3) { - if (node.id) { - c3(node.id, st, "Pattern"); +base.Class = function(node2, st, c3) { + if (node2.id) { + c3(node2.id, st, "Pattern"); } - if (node.superClass) { - c3(node.superClass, st, "Expression"); + if (node2.superClass) { + c3(node2.superClass, st, "Expression"); } - c3(node.body, st); + c3(node2.body, st); }; -base.ClassBody = function(node, st, c3) { - for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) { - var elt = list[i4]; +base.ClassBody = function(node2, st, c3) { + for (var i4 = 0, list4 = node2.body; i4 < list4.length; i4 += 1) { + var elt = list4[i4]; c3(elt, st); } }; -base.MethodDefinition = base.PropertyDefinition = base.Property = function(node, st, c3) { - if (node.computed) { - c3(node.key, st, "Expression"); +base.MethodDefinition = base.PropertyDefinition = base.Property = function(node2, st, c3) { + if (node2.computed) { + c3(node2.key, st, "Expression"); } - if (node.value) { - c3(node.value, st, "Expression"); + if (node2.value) { + c3(node2.value, st, "Expression"); } }; @@ -43673,8 +43778,8 @@ function formatSequence(state, nodes) { } state.write(")"); } -function expressionNeedsParenthesis(state, node, parentNode, isRightHand) { - const nodePrecedence = state.expressionsPrecedence[node.type]; +function expressionNeedsParenthesis(state, node2, parentNode, isRightHand) { + const nodePrecedence = state.expressionsPrecedence[node2.type]; if (nodePrecedence === NEEDS_PARENTHESES) { return true; } @@ -43685,29 +43790,29 @@ function expressionNeedsParenthesis(state, node, parentNode, isRightHand) { if (nodePrecedence !== 13 && nodePrecedence !== 14) { return false; } - if (node.operator === "**" && parentNode.operator === "**") { + if (node2.operator === "**" && parentNode.operator === "**") { return !isRightHand; } - if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node.operator === "??" || parentNode.operator === "??")) { + if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node2.operator === "??" || parentNode.operator === "??")) { return true; } if (isRightHand) { - return OPERATOR_PRECEDENCE[node.operator] <= OPERATOR_PRECEDENCE[parentNode.operator]; + return OPERATOR_PRECEDENCE[node2.operator] <= OPERATOR_PRECEDENCE[parentNode.operator]; } - return OPERATOR_PRECEDENCE[node.operator] < OPERATOR_PRECEDENCE[parentNode.operator]; + return OPERATOR_PRECEDENCE[node2.operator] < OPERATOR_PRECEDENCE[parentNode.operator]; } -function formatExpression(state, node, parentNode, isRightHand) { +function formatExpression(state, node2, parentNode, isRightHand) { const { generator } = state; - if (expressionNeedsParenthesis(state, node, parentNode, isRightHand)) { + if (expressionNeedsParenthesis(state, node2, parentNode, isRightHand)) { state.write("("); - generator[node.type](node, state); + generator[node2.type](node2, state); state.write(")"); } else { - generator[node.type](node, state); + generator[node2.type](node2, state); } } -function reindent(state, text2, indent, lineEnd) { - const lines = text2.split("\n"); +function reindent(state, text7, indent, lineEnd) { + const lines = text7.split("\n"); const end = lines.length - 1; state.write(lines[0].trim()); if (end > 0) { @@ -43721,19 +43826,19 @@ function reindent(state, text2, indent, lineEnd) { function formatComments(state, comments, indent, lineEnd) { const { length } = comments; for (let i4 = 0; i4 < length; i4++) { - const comment3 = comments[i4]; + const comment4 = comments[i4]; state.write(indent); - if (comment3.type[0] === "L") { - state.write("// " + comment3.value.trim() + "\n", comment3); + if (comment4.type[0] === "L") { + state.write("// " + comment4.value.trim() + "\n", comment4); } else { state.write("/*"); - reindent(state, comment3.value, indent, lineEnd); + reindent(state, comment4.value, indent, lineEnd); state.write("*/" + lineEnd); } } } -function hasCallExpression(node) { - let currentNode = node; +function hasCallExpression(node2) { + let currentNode = node2; while (currentNode != null) { const { type } = currentNode; if (type[0] === "C" && type[1] === "a") { @@ -43745,10 +43850,10 @@ function hasCallExpression(node) { } } } -function formatVariableDeclaration(state, node) { +function formatVariableDeclaration(state, node2) { const { generator } = state; - const { declarations } = node; - state.write(node.kind + " "); + const { declarations } = node2; + state.write(node2.kind + " "); const { length } = declarations; if (length > 0) { generator.VariableDeclarator(declarations[0], state); @@ -43765,13 +43870,13 @@ var BinaryExpression; var ArrayExpression; var BlockStatement; var GENERATOR = { - Program(node, state) { + Program(node2, state) { const indent = state.indent.repeat(state.indentLevel); const { lineEnd, writeComments } = state; - if (writeComments && node.comments != null) { - formatComments(state, node.comments, indent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, indent, lineEnd); } - const statements = node.body; + const statements = node2.body; const { length } = statements; for (let i4 = 0; i4 < length; i4++) { const statement = statements[i4]; @@ -43782,20 +43887,20 @@ var GENERATOR = { this[statement.type](statement, state); state.write(lineEnd); } - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, indent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, indent, lineEnd); } }, - BlockStatement: BlockStatement = function(node, state) { + BlockStatement: BlockStatement = function(node2, state) { const indent = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; const statementIndent = indent + state.indent; state.write("{"); - const statements = node.body; + const statements = node2.body; if (statements != null && statements.length > 0) { state.write(lineEnd); - if (writeComments && node.comments != null) { - formatComments(state, node.comments, statementIndent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, statementIndent, lineEnd); } const { length } = statements; for (let i4 = 0; i4 < length; i4++) { @@ -43809,84 +43914,84 @@ var GENERATOR = { } state.write(indent); } else { - if (writeComments && node.comments != null) { + if (writeComments && node2.comments != null) { state.write(lineEnd); - formatComments(state, node.comments, statementIndent, lineEnd); + formatComments(state, node2.comments, statementIndent, lineEnd); state.write(indent); } } - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, statementIndent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, statementIndent, lineEnd); } state.write("}"); state.indentLevel--; }, ClassBody: BlockStatement, - StaticBlock(node, state) { + StaticBlock(node2, state) { state.write("static "); - this.BlockStatement(node, state); + this.BlockStatement(node2, state); }, - EmptyStatement(node, state) { + EmptyStatement(node2, state) { state.write(";"); }, - ExpressionStatement(node, state) { - const precedence = state.expressionsPrecedence[node.expression.type]; - if (precedence === NEEDS_PARENTHESES || precedence === 3 && node.expression.left.type[0] === "O") { + ExpressionStatement(node2, state) { + const precedence = state.expressionsPrecedence[node2.expression.type]; + if (precedence === NEEDS_PARENTHESES || precedence === 3 && node2.expression.left.type[0] === "O") { state.write("("); - this[node.expression.type](node.expression, state); + this[node2.expression.type](node2.expression, state); state.write(")"); } else { - this[node.expression.type](node.expression, state); + this[node2.expression.type](node2.expression, state); } state.write(";"); }, - IfStatement(node, state) { + IfStatement(node2, state) { state.write("if ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(") "); - this[node.consequent.type](node.consequent, state); - if (node.alternate != null) { + this[node2.consequent.type](node2.consequent, state); + if (node2.alternate != null) { state.write(" else "); - this[node.alternate.type](node.alternate, state); + this[node2.alternate.type](node2.alternate, state); } }, - LabeledStatement(node, state) { - this[node.label.type](node.label, state); + LabeledStatement(node2, state) { + this[node2.label.type](node2.label, state); state.write(": "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - BreakStatement(node, state) { + BreakStatement(node2, state) { state.write("break"); - if (node.label != null) { + if (node2.label != null) { state.write(" "); - this[node.label.type](node.label, state); + this[node2.label.type](node2.label, state); } state.write(";"); }, - ContinueStatement(node, state) { + ContinueStatement(node2, state) { state.write("continue"); - if (node.label != null) { + if (node2.label != null) { state.write(" "); - this[node.label.type](node.label, state); + this[node2.label.type](node2.label, state); } state.write(";"); }, - WithStatement(node, state) { + WithStatement(node2, state) { state.write("with ("); - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - SwitchStatement(node, state) { + SwitchStatement(node2, state) { const indent = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; state.indentLevel++; const caseIndent = indent + state.indent; const statementIndent = caseIndent + state.indent; state.write("switch ("); - this[node.discriminant.type](node.discriminant, state); + this[node2.discriminant.type](node2.discriminant, state); state.write(") {" + lineEnd); - const { cases: occurences } = node; + const { cases: occurences } = node2; const { length: occurencesCount } = occurences; for (let i4 = 0; i4 < occurencesCount; i4++) { const occurence = occurences[i4]; @@ -43915,24 +44020,24 @@ var GENERATOR = { state.indentLevel -= 2; state.write(indent + "}"); }, - ReturnStatement(node, state) { + ReturnStatement(node2, state) { state.write("return"); - if (node.argument) { + if (node2.argument) { state.write(" "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); } state.write(";"); }, - ThrowStatement(node, state) { + ThrowStatement(node2, state) { state.write("throw "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); state.write(";"); }, - TryStatement(node, state) { + TryStatement(node2, state) { state.write("try "); - this[node.block.type](node.block, state); - if (node.handler) { - const { handler } = node; + this[node2.block.type](node2.block, state); + if (node2.handler) { + const { handler } = node2; if (handler.param == null) { state.write(" catch "); } else { @@ -43942,28 +44047,28 @@ var GENERATOR = { } this[handler.body.type](handler.body, state); } - if (node.finalizer) { + if (node2.finalizer) { state.write(" finally "); - this[node.finalizer.type](node.finalizer, state); + this[node2.finalizer.type](node2.finalizer, state); } }, - WhileStatement(node, state) { + WhileStatement(node2, state) { state.write("while ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - DoWhileStatement(node, state) { + DoWhileStatement(node2, state) { state.write("do "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); state.write(" while ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(");"); }, - ForStatement(node, state) { + ForStatement(node2, state) { state.write("for ("); - if (node.init != null) { - const { init } = node; + if (node2.init != null) { + const { init } = node2; if (init.type[0] === "V") { formatVariableDeclaration(state, init); } else { @@ -43971,75 +44076,75 @@ var GENERATOR = { } } state.write("; "); - if (node.test) { - this[node.test.type](node.test, state); + if (node2.test) { + this[node2.test.type](node2.test, state); } state.write("; "); - if (node.update) { - this[node.update.type](node.update, state); + if (node2.update) { + this[node2.update.type](node2.update, state); } state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - ForInStatement: ForInStatement = function(node, state) { - state.write(`for ${node.await ? "await " : ""}(`); - const { left } = node; + ForInStatement: ForInStatement = function(node2, state) { + state.write(`for ${node2.await ? "await " : ""}(`); + const { left } = node2; if (left.type[0] === "V") { formatVariableDeclaration(state, left); } else { this[left.type](left, state); } - state.write(node.type[3] === "I" ? " in " : " of "); - this[node.right.type](node.right, state); + state.write(node2.type[3] === "I" ? " in " : " of "); + this[node2.right.type](node2.right, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, ForOfStatement: ForInStatement, - DebuggerStatement(node, state) { - state.write("debugger;", node); + DebuggerStatement(node2, state) { + state.write("debugger;", node2); }, - FunctionDeclaration: FunctionDeclaration = function(node, state) { + FunctionDeclaration: FunctionDeclaration = function(node2, state) { state.write( - (node.async ? "async " : "") + (node.generator ? "function* " : "function ") + (node.id ? node.id.name : ""), - node + (node2.async ? "async " : "") + (node2.generator ? "function* " : "function ") + (node2.id ? node2.id.name : ""), + node2 ); - formatSequence(state, node.params); + formatSequence(state, node2.params); state.write(" "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, FunctionExpression: FunctionDeclaration, - VariableDeclaration(node, state) { - formatVariableDeclaration(state, node); + VariableDeclaration(node2, state) { + formatVariableDeclaration(state, node2); state.write(";"); }, - VariableDeclarator(node, state) { - this[node.id.type](node.id, state); - if (node.init != null) { + VariableDeclarator(node2, state) { + this[node2.id.type](node2.id, state); + if (node2.init != null) { state.write(" = "); - this[node.init.type](node.init, state); + this[node2.init.type](node2.init, state); } }, - ClassDeclaration(node, state) { - state.write("class " + (node.id ? `${node.id.name} ` : ""), node); - if (node.superClass) { + ClassDeclaration(node2, state) { + state.write("class " + (node2.id ? `${node2.id.name} ` : ""), node2); + if (node2.superClass) { state.write("extends "); - const { superClass } = node; + const { superClass } = node2; const { type } = superClass; const precedence = state.expressionsPrecedence[type]; if ((type[0] !== "C" || type[1] !== "l" || type[5] !== "E") && (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.ClassExpression)) { state.write("("); - this[node.superClass.type](superClass, state); + this[node2.superClass.type](superClass, state); state.write(")"); } else { this[superClass.type](superClass, state); } state.write(" "); } - this.ClassBody(node.body, state); + this.ClassBody(node2.body, state); }, - ImportDeclaration(node, state) { + ImportDeclaration(node2, state) { state.write("import "); - const { specifiers } = node; + const { specifiers } = node2; const { length } = specifiers; let i4 = 0; if (length > 0) { @@ -44078,28 +44183,28 @@ var GENERATOR = { } state.write(" from "); } - this.Literal(node.source, state); + this.Literal(node2.source, state); state.write(";"); }, - ImportExpression(node, state) { + ImportExpression(node2, state) { state.write("import("); - this[node.source.type](node.source, state); + this[node2.source.type](node2.source, state); state.write(")"); }, - ExportDefaultDeclaration(node, state) { + ExportDefaultDeclaration(node2, state) { state.write("export default "); - this[node.declaration.type](node.declaration, state); - if (state.expressionsPrecedence[node.declaration.type] != null && node.declaration.type[0] !== "F") { + this[node2.declaration.type](node2.declaration, state); + if (state.expressionsPrecedence[node2.declaration.type] != null && node2.declaration.type[0] !== "F") { state.write(";"); } }, - ExportNamedDeclaration(node, state) { + ExportNamedDeclaration(node2, state) { state.write("export "); - if (node.declaration) { - this[node.declaration.type](node.declaration, state); + if (node2.declaration) { + this[node2.declaration.type](node2.declaration, state); } else { state.write("{"); - const { specifiers } = node, { length } = specifiers; + const { specifiers } = node2, { length } = specifiers; if (length > 0) { for (let i4 = 0; ; ) { const specifier = specifiers[i4]; @@ -44116,93 +44221,93 @@ var GENERATOR = { } } state.write("}"); - if (node.source) { + if (node2.source) { state.write(" from "); - this.Literal(node.source, state); + this.Literal(node2.source, state); } state.write(";"); } }, - ExportAllDeclaration(node, state) { - if (node.exported != null) { - state.write("export * as " + node.exported.name + " from "); + ExportAllDeclaration(node2, state) { + if (node2.exported != null) { + state.write("export * as " + node2.exported.name + " from "); } else { state.write("export * from "); } - this.Literal(node.source, state); + this.Literal(node2.source, state); state.write(";"); }, - MethodDefinition(node, state) { - if (node.static) { + MethodDefinition(node2, state) { + if (node2.static) { state.write("static "); } - const kind = node.kind[0]; + const kind = node2.kind[0]; if (kind === "g" || kind === "s") { - state.write(node.kind + " "); + state.write(node2.kind + " "); } - if (node.value.async) { + if (node2.value.async) { state.write("async "); } - if (node.value.generator) { + if (node2.value.generator) { state.write("*"); } - if (node.computed) { + if (node2.computed) { state.write("["); - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); state.write("]"); } else { - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); } - formatSequence(state, node.value.params); + formatSequence(state, node2.value.params); state.write(" "); - this[node.value.body.type](node.value.body, state); + this[node2.value.body.type](node2.value.body, state); }, - ClassExpression(node, state) { - this.ClassDeclaration(node, state); + ClassExpression(node2, state) { + this.ClassDeclaration(node2, state); }, - ArrowFunctionExpression(node, state) { - state.write(node.async ? "async " : "", node); - const { params } = node; + ArrowFunctionExpression(node2, state) { + state.write(node2.async ? "async " : "", node2); + const { params } = node2; if (params != null) { if (params.length === 1 && params[0].type[0] === "I") { state.write(params[0].name, params[0]); } else { - formatSequence(state, node.params); + formatSequence(state, node2.params); } } state.write(" => "); - if (node.body.type[0] === "O") { + if (node2.body.type[0] === "O") { state.write("("); - this.ObjectExpression(node.body, state); + this.ObjectExpression(node2.body, state); state.write(")"); } else { - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); } }, - ThisExpression(node, state) { - state.write("this", node); + ThisExpression(node2, state) { + state.write("this", node2); }, - Super(node, state) { - state.write("super", node); + Super(node2, state) { + state.write("super", node2); }, - RestElement: RestElement = function(node, state) { + RestElement: RestElement = function(node2, state) { state.write("..."); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); }, SpreadElement: RestElement, - YieldExpression(node, state) { - state.write(node.delegate ? "yield*" : "yield"); - if (node.argument) { + YieldExpression(node2, state) { + state.write(node2.delegate ? "yield*" : "yield"); + if (node2.argument) { state.write(" "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); } }, - AwaitExpression(node, state) { - state.write("await ", node); - formatExpression(state, node.argument, node); + AwaitExpression(node2, state) { + state.write("await ", node2); + formatExpression(state, node2.argument, node2); }, - TemplateLiteral(node, state) { - const { quasis, expressions } = node; + TemplateLiteral(node2, state) { + const { quasis, expressions } = node2; state.write("`"); const { length } = expressions; for (let i4 = 0; i4 < length; i4++) { @@ -44217,26 +44322,26 @@ var GENERATOR = { state.write(quasi.value.raw, quasi); state.write("`"); }, - TemplateElement(node, state) { - state.write(node.value.raw, node); + TemplateElement(node2, state) { + state.write(node2.value.raw, node2); }, - TaggedTemplateExpression(node, state) { - formatExpression(state, node.tag, node); - this[node.quasi.type](node.quasi, state); + TaggedTemplateExpression(node2, state) { + formatExpression(state, node2.tag, node2); + this[node2.quasi.type](node2.quasi, state); }, - ArrayExpression: ArrayExpression = function(node, state) { + ArrayExpression: ArrayExpression = function(node2, state) { state.write("["); - if (node.elements.length > 0) { - const { elements } = node, { length } = elements; + if (node2.elements.length > 0) { + const { elements } = node2, { length } = elements; for (let i4 = 0; ; ) { - const element = elements[i4]; - if (element != null) { - this[element.type](element, state); + const element3 = elements[i4]; + if (element3 != null) { + this[element3.type](element3, state); } if (++i4 < length) { state.write(", "); } else { - if (element == null) { + if (element3 == null) { state.write(", "); } break; @@ -44246,18 +44351,18 @@ var GENERATOR = { state.write("]"); }, ArrayPattern: ArrayExpression, - ObjectExpression(node, state) { + ObjectExpression(node2, state) { const indent = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; const propertyIndent = indent + state.indent; state.write("{"); - if (node.properties.length > 0) { + if (node2.properties.length > 0) { state.write(lineEnd); - if (writeComments && node.comments != null) { - formatComments(state, node.comments, propertyIndent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, propertyIndent, lineEnd); } const comma = "," + lineEnd; - const { properties: properties3 } = node, { length } = properties3; + const { properties: properties3 } = node2, { length } = properties3; for (let i4 = 0; ; ) { const property = properties3[i4]; if (writeComments && property.comments != null) { @@ -44272,21 +44377,21 @@ var GENERATOR = { } } state.write(lineEnd); - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, propertyIndent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); } state.write(indent + "}"); } else if (writeComments) { - if (node.comments != null) { + if (node2.comments != null) { state.write(lineEnd); - formatComments(state, node.comments, propertyIndent, lineEnd); - if (node.trailingComments != null) { - formatComments(state, node.trailingComments, propertyIndent, lineEnd); + formatComments(state, node2.comments, propertyIndent, lineEnd); + if (node2.trailingComments != null) { + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); } state.write(indent + "}"); - } else if (node.trailingComments != null) { + } else if (node2.trailingComments != null) { state.write(lineEnd); - formatComments(state, node.trailingComments, propertyIndent, lineEnd); + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); state.write(indent + "}"); } else { state.write("}"); @@ -44296,48 +44401,48 @@ var GENERATOR = { } state.indentLevel--; }, - Property(node, state) { - if (node.method || node.kind[0] !== "i") { - this.MethodDefinition(node, state); + Property(node2, state) { + if (node2.method || node2.kind[0] !== "i") { + this.MethodDefinition(node2, state); } else { - if (!node.shorthand) { - if (node.computed) { + if (!node2.shorthand) { + if (node2.computed) { state.write("["); - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); state.write("]"); } else { - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); } state.write(": "); } - this[node.value.type](node.value, state); + this[node2.value.type](node2.value, state); } }, - PropertyDefinition(node, state) { - if (node.static) { + PropertyDefinition(node2, state) { + if (node2.static) { state.write("static "); } - if (node.computed) { + if (node2.computed) { state.write("["); } - this[node.key.type](node.key, state); - if (node.computed) { + this[node2.key.type](node2.key, state); + if (node2.computed) { state.write("]"); } - if (node.value == null) { - if (node.key.type[0] !== "F") { + if (node2.value == null) { + if (node2.key.type[0] !== "F") { state.write(";"); } return; } state.write(" = "); - this[node.value.type](node.value, state); + this[node2.value.type](node2.value, state); state.write(";"); }, - ObjectPattern(node, state) { + ObjectPattern(node2, state) { state.write("{"); - if (node.properties.length > 0) { - const { properties: properties3 } = node, { length } = properties3; + if (node2.properties.length > 0) { + const { properties: properties3 } = node2, { length } = properties3; for (let i4 = 0; ; ) { this[properties3[i4].type](properties3[i4], state); if (++i4 < length) { @@ -44349,18 +44454,18 @@ var GENERATOR = { } state.write("}"); }, - SequenceExpression(node, state) { - formatSequence(state, node.expressions); + SequenceExpression(node2, state) { + formatSequence(state, node2.expressions); }, - UnaryExpression(node, state) { - if (node.prefix) { + UnaryExpression(node2, state) { + if (node2.prefix) { const { operator: operator3, argument, argument: { type } - } = node; + } = node2; state.write(operator3); - const needsParentheses = expressionNeedsParenthesis(state, argument, node); + const needsParentheses = expressionNeedsParenthesis(state, argument, node2); if (!needsParentheses && (operator3.length > 1 || type[0] === "U" && (type[1] === "n" || type[1] === "p") && argument.prefix && argument.operator[0] === operator3 && (operator3 === "+" || operator3 === "-"))) { state.write(" "); } @@ -44372,44 +44477,44 @@ var GENERATOR = { this[type](argument, state); } } else { - this[node.argument.type](node.argument, state); - state.write(node.operator); + this[node2.argument.type](node2.argument, state); + state.write(node2.operator); } }, - UpdateExpression(node, state) { - if (node.prefix) { - state.write(node.operator); - this[node.argument.type](node.argument, state); + UpdateExpression(node2, state) { + if (node2.prefix) { + state.write(node2.operator); + this[node2.argument.type](node2.argument, state); } else { - this[node.argument.type](node.argument, state); - state.write(node.operator); + this[node2.argument.type](node2.argument, state); + state.write(node2.operator); } }, - AssignmentExpression(node, state) { - this[node.left.type](node.left, state); - state.write(" " + node.operator + " "); - this[node.right.type](node.right, state); + AssignmentExpression(node2, state) { + this[node2.left.type](node2.left, state); + state.write(" " + node2.operator + " "); + this[node2.right.type](node2.right, state); }, - AssignmentPattern(node, state) { - this[node.left.type](node.left, state); + AssignmentPattern(node2, state) { + this[node2.left.type](node2.left, state); state.write(" = "); - this[node.right.type](node.right, state); + this[node2.right.type](node2.right, state); }, - BinaryExpression: BinaryExpression = function(node, state) { - const isIn = node.operator === "in"; + BinaryExpression: BinaryExpression = function(node2, state) { + const isIn = node2.operator === "in"; if (isIn) { state.write("("); } - formatExpression(state, node.left, node, false); - state.write(" " + node.operator + " "); - formatExpression(state, node.right, node, true); + formatExpression(state, node2.left, node2, false); + state.write(" " + node2.operator + " "); + formatExpression(state, node2.right, node2, true); if (isIn) { state.write(")"); } }, LogicalExpression: BinaryExpression, - ConditionalExpression(node, state) { - const { test } = node; + ConditionalExpression(node2, state) { + const { test } = node2; const precedence = state.expressionsPrecedence[test.type]; if (precedence === NEEDS_PARENTHESES || precedence <= state.expressionsPrecedence.ConditionalExpression) { state.write("("); @@ -44419,87 +44524,87 @@ var GENERATOR = { this[test.type](test, state); } state.write(" ? "); - this[node.consequent.type](node.consequent, state); + this[node2.consequent.type](node2.consequent, state); state.write(" : "); - this[node.alternate.type](node.alternate, state); + this[node2.alternate.type](node2.alternate, state); }, - NewExpression(node, state) { + NewExpression(node2, state) { state.write("new "); - const precedence = state.expressionsPrecedence[node.callee.type]; - if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node.callee)) { + const precedence = state.expressionsPrecedence[node2.callee.type]; + if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node2.callee)) { state.write("("); - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); state.write(")"); } else { - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); } - formatSequence(state, node["arguments"]); + formatSequence(state, node2["arguments"]); }, - CallExpression(node, state) { - const precedence = state.expressionsPrecedence[node.callee.type]; + CallExpression(node2, state) { + const precedence = state.expressionsPrecedence[node2.callee.type]; if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression) { state.write("("); - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); state.write(")"); } else { - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); } - if (node.optional) { + if (node2.optional) { state.write("?."); } - formatSequence(state, node["arguments"]); + formatSequence(state, node2["arguments"]); }, - ChainExpression(node, state) { - this[node.expression.type](node.expression, state); + ChainExpression(node2, state) { + this[node2.expression.type](node2.expression, state); }, - MemberExpression(node, state) { - const precedence = state.expressionsPrecedence[node.object.type]; + MemberExpression(node2, state) { + const precedence = state.expressionsPrecedence[node2.object.type]; if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.MemberExpression) { state.write("("); - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); state.write(")"); } else { - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); } - if (node.computed) { - if (node.optional) { + if (node2.computed) { + if (node2.optional) { state.write("?."); } state.write("["); - this[node.property.type](node.property, state); + this[node2.property.type](node2.property, state); state.write("]"); } else { - if (node.optional) { + if (node2.optional) { state.write("?."); } else { state.write("."); } - this[node.property.type](node.property, state); + this[node2.property.type](node2.property, state); } }, - MetaProperty(node, state) { - state.write(node.meta.name + "." + node.property.name, node); + MetaProperty(node2, state) { + state.write(node2.meta.name + "." + node2.property.name, node2); }, - Identifier(node, state) { - state.write(node.name, node); + Identifier(node2, state) { + state.write(node2.name, node2); }, - PrivateIdentifier(node, state) { - state.write(`#${node.name}`, node); + PrivateIdentifier(node2, state) { + state.write(`#${node2.name}`, node2); }, - Literal(node, state) { - if (node.raw != null) { - state.write(node.raw, node); - } else if (node.regex != null) { - this.RegExpLiteral(node, state); - } else if (node.bigint != null) { - state.write(node.bigint + "n", node); + Literal(node2, state) { + if (node2.raw != null) { + state.write(node2.raw, node2); + } else if (node2.regex != null) { + this.RegExpLiteral(node2, state); + } else if (node2.bigint != null) { + state.write(node2.bigint + "n", node2); } else { - state.write(stringify(node.value), node); + state.write(stringify(node2.value), node2); } }, - RegExpLiteral(node, state) { - const { regex } = node; - state.write(`/${regex.pattern}/${regex.flags}`, node); + RegExpLiteral(node2, state) { + const { regex } = node2; + state.write(`/${regex.pattern}/${regex.flags}`, node2); } }; var EMPTY_OBJECT = {}; @@ -44533,39 +44638,39 @@ var State = class { }; } } - write(code) { - this.output += code; + write(code3) { + this.output += code3; } - writeToStream(code) { - this.output.write(code); + writeToStream(code3) { + this.output.write(code3); } - writeAndMap(code, node) { - this.output += code; - this.map(code, node); + writeAndMap(code3, node2) { + this.output += code3; + this.map(code3, node2); } - writeToStreamAndMap(code, node) { - this.output.write(code); - this.map(code, node); + writeToStreamAndMap(code3, node2) { + this.output.write(code3); + this.map(code3, node2); } - map(code, node) { - if (node != null) { - const { type } = node; + map(code3, node2) { + if (node2 != null) { + const { type } = node2; if (type[0] === "L" && type[2] === "n") { this.column = 0; this.line++; return; } - if (node.loc != null) { + if (node2.loc != null) { const { mapping } = this; - mapping.original = node.loc.start; - mapping.name = node.name; + mapping.original = node2.loc.start; + mapping.name = node2.name; this.sourceMap.addMapping(mapping); } - if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") { - const { length: length2 } = code; + if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node2.value === "string") { + const { length: length2 } = code3; let { column: column2, line } = this; for (let i4 = 0; i4 < length2; i4++) { - if (code[i4] === "\n") { + if (code3[i4] === "\n") { column2 = 0; line++; } else { @@ -44577,10 +44682,10 @@ var State = class { return; } } - const { length } = code; + const { length } = code3; const { lineEnd } = this; if (length > 0) { - if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code[length - 1] === lineEnd : code.endsWith(lineEnd))) { + if (this.lineEndSize > 0 && (lineEnd.length === 1 ? code3[length - 1] === lineEnd : code3.endsWith(lineEnd))) { this.line += this.lineEndSize; this.column = 0; } else { @@ -44592,16 +44697,16 @@ var State = class { return this.output; } }; -function generate(node, options) { +function generate(node2, options) { const state = new State(options); - state.generator[node.type](node, state); + state.generator[node2.type](node2, state); return state.output; } // src/core/utils/frames/linker.ts -var preprocessCode = (code, oldName, newName) => { - let string4; - let codeBlock = ensureString(code); +var preprocessCode = (code3, oldName, newName) => { + let string6; + let codeBlock = ensureString(code3); const isMultiLine = codeBlock.includes("\n"); let hasReturn = false; if (isMultiLine) { @@ -44614,78 +44719,78 @@ var preprocessCode = (code, oldName, newName) => { try { const ast = parse3(codeBlock, { ecmaVersion: 2020, locations: true }); ancestor(ast, { - Identifier(node, ancestors) { + Identifier(node2, ancestors) { const parent = ancestors[ancestors.length - 2]; - if (parent.type !== "MemberExpression" || parent.object === node) { - if (node.name == oldName) { - node.name = newName; + if (parent.type !== "MemberExpression" || parent.object === node2) { + if (node2.name == oldName) { + node2.name = newName; } } }, - Property(node) { - if (node.key.type === "Identifier" && node.key.name === oldName) { - node.key.name = newName; + Property(node2) { + if (node2.key.type === "Identifier" && node2.key.name === oldName) { + node2.key.name = newName; } }, - ObjectExpression(node) { - node.properties.forEach((property) => { + ObjectExpression(node2) { + node2.properties.forEach((property) => { if (property.key.type === "Identifier" && property.key.name === oldName) { property.key.name = newName; } }); } }); - string4 = generate(ast).trimEnd(); + string6 = generate(ast).trimEnd(); } catch (e5) { - console.log(e5, code, name); - string4 = `"error"`; + console.log(e5, code3, name); + string6 = `"error"`; } if (isMultiLine && hasReturn) { - const lines = string4.split("\n").filter((line) => line.trim() !== ""); + const lines = string6.split("\n").filter((line) => line.trim() !== ""); lines[lines.length - 1] = `return ${lines[lines.length - 1]}`; - string4 = lines.join("\n"); + string6 = lines.join("\n"); } - return string4; + return string6; }; -var relinkProps = (oldParent, newParent, node, rootId) => { +var relinkProps = (oldParent, newParent, node2, rootId) => { return { - ...node, - id: node.id == oldParent ? newParent : node.id, - parentId: node.id == rootId ? node.parentId : node.parentId == oldParent ? newParent : node.parentId, - ref: node.ref == oldParent ? newParent : node.ref, - props: Object.keys(node?.props ?? {}).reduce( - (p, c3) => { + ...node2, + id: node2.id == oldParent ? newParent : node2.id, + parentId: node2.id == rootId ? node2.parentId : node2.parentId == oldParent ? newParent : node2.parentId, + ref: node2.ref == oldParent ? newParent : node2.ref, + props: Object.keys(node2?.props ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.props[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.props[c3], oldParent, newParent) }; }, - node.props + node2.props ), - actions: Object.keys(node?.actions ?? {}).reduce( - (p, c3) => { + actions: Object.keys(node2?.actions ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.actions[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.actions[c3], oldParent, newParent) }; }, - node.actions + node2.actions ), - styles: Object.keys(node?.styles ?? {}).reduce( - (p, c3) => { + styles: Object.keys(node2?.styles ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.styles[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.styles[c3], oldParent, newParent) }; }, - node.styles + node2.styles ) }; }; var linkNodes = (parent, schemaId, props, flattenedTree, uniqueID) => { const assignIDs = (parent2, nodes) => { - const [newNodes, newID] = nodes.reduce((p, c3, i4) => { - const [oldNodes, id3] = p; + const [newNodes, newID] = nodes.reduce((p2, c3, i4) => { + const [oldNodes, id3] = p2; const newNodeID = c3.parentId ? c3.id + id3 : parent2.id; const newNode2 = { ...c3.parentId == "" ? parent2 : oldNodes[i4], @@ -44703,7 +44808,7 @@ var linkNodes = (parent, schemaId, props, flattenedTree, uniqueID) => { var linkTreeNodes = (parent, uniqueID) => { const relinkProps2 = (oldParent, newParent, treenode) => { let children; - const node = treenode.node; + const node2 = treenode.node; if (treenode.children) { children = treenode.children.map((child) => relinkProps2(oldParent, newParent, child)); } @@ -44712,42 +44817,42 @@ var linkTreeNodes = (parent, uniqueID) => { children, node: { ...treenode.node, - parentId: node.parentId == oldParent ? newParent : node.parentId, - props: Object.keys(node?.props ?? {}).reduce( - (p, c3) => { + parentId: node2.parentId == oldParent ? newParent : node2.parentId, + props: Object.keys(node2?.props ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.props[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.props[c3], oldParent, newParent) }; }, - node.props + node2.props ), - actions: Object.keys(node?.actions ?? {}).reduce( - (p, c3) => { + actions: Object.keys(node2?.actions ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.actions[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.actions[c3], oldParent, newParent) }; }, - node.actions + node2.actions ), - styles: Object.keys(node?.styles ?? {}).reduce( - (p, c3) => { + styles: Object.keys(node2?.styles ?? {}).reduce( + (p2, c3) => { return { - ...p, - [c3]: preprocessCode(node.styles[c3], oldParent, newParent) + ...p2, + [c3]: preprocessCode(node2.styles[c3], oldParent, newParent) }; }, - node.styles + node2.styles ) } }; }; - const assignIDs = (parent2, node, uniqueID2) => { - const assignIDToTree = (parent3, node2, id3) => { - const newNodeID = node2.node.parentId ? node2.id + id3 : parent3.id; - let newNode2 = { ...node2, node: { ...node2.node, id: newNodeID }, id: newNodeID }; - newNode2 = relinkProps2(node2.id, newNodeID, newNode2); + const assignIDs = (parent2, node2, uniqueID2) => { + const assignIDToTree = (parent3, node3, id3) => { + const newNodeID = node3.node.parentId ? node3.id + id3 : parent3.id; + let newNode2 = { ...node3, node: { ...node3.node, id: newNodeID }, id: newNodeID }; + newNode2 = relinkProps2(node3.id, newNodeID, newNode2); if (newNode2.children) { const [newChildren, newID] = newNode2.children.reduce( (acc, child, i4) => { @@ -44762,7 +44867,7 @@ var linkTreeNodes = (parent, uniqueID) => { } return [newNode2, id3 + 1]; }; - return assignIDToTree(parent2, node, uniqueID2); + return assignIDToTree(parent2, node2, uniqueID2); }; return assignIDs(parent, parent, uniqueID); }; @@ -44805,7 +44910,7 @@ var parseLinkedPropertyToValue = (property) => { var parseContextNode = (pathString) => { if (!pathString || stringIsConst(pathString)) return null; - const path2 = []; + const path3 = []; const isMultiLine = pathString.includes("\n"); if (isMultiLine) { const lines = pathString.split("\n").filter((line) => line.trim() !== ""); @@ -44815,31 +44920,31 @@ var parseContextNode = (pathString) => { try { const ast = parse3(pathString, { ecmaVersion: 2020 }); simple(ast, { - MemberExpression(node) { - if (node.object.type === "Identifier" && !path2.includes(node.object.name)) { - path2.push(node.object.name); + MemberExpression(node2) { + if (node2.object.type === "Identifier" && !path3.includes(node2.object.name)) { + path3.push(node2.object.name); } - if (node.computed) { - path2.push(node.property.value); + if (node2.computed) { + path3.push(node2.property.value); } else { - path2.push(node.property.name); + path3.push(node2.property.name); } } }); } catch (e5) { console.log(e5); } - if (path2.length < 3) + if (path3.length < 3) return null; return { - context: path2[1], - prop: path2[2] + context: path3[1], + prop: path3[2] }; }; var parseLinkedNode = (pathString) => { if (!pathString || stringIsConst(pathString)) return null; - const path2 = []; + const path3 = []; const isMultiLine = pathString.includes("\n"); if (isMultiLine) { const lines = pathString.split("\n").filter((line) => line.trim() !== ""); @@ -44849,28 +44954,28 @@ var parseLinkedNode = (pathString) => { try { const ast = parse3(pathString, { ecmaVersion: 2020 }); simple(ast, { - MemberExpression(node) { - if (node.object.type === "Identifier" && !path2.includes(node.object.name)) { - path2.push(node.object.name); + MemberExpression(node2) { + if (node2.object.type === "Identifier" && !path3.includes(node2.object.name)) { + path3.push(node2.object.name); } - if (node.computed) { - path2.push(node.property.value); + if (node2.computed) { + path3.push(node2.property.value); } else { - path2.push(node.property.name); + path3.push(node2.property.name); } } }); } catch (e5) { console.log(e5); } - if (path2.length < 3) + if (path3.length < 3) return null; return { - node: path2[0], - prop: path2[2] + node: path3[0], + prop: path3[2] }; }; -var saveFrameRoot = async (superstate, tableData, space2, frameRoot) => { +var saveFrameRoot = async (superstate, tableData, space3, frameRoot) => { if (!tableData) return; const treeNodes = flattenToFrameNodes(frameRoot, tableData.schema.id); @@ -44881,17 +44986,17 @@ var saveFrameRoot = async (superstate, tableData, space2, frameRoot) => { ...treeNodes ].map((f2) => nodeToFrame(relinkProps("$root", tableData.schema.id, f2, tableData.schema.id))) }; - await superstate.spaceManager.saveFrame(space2.path, newTable); + await superstate.spaceManager.saveFrame(space3.path, newTable); }; -var replaceFrameWithFrameRoot = async (superstate, space2, schema, root) => { - return superstate.spaceManager.readFrame(space2.path, schema).then( - (tagDB) => saveFrameRoot(superstate, tagDB, space2, root) +var replaceFrameWithFrameRoot = async (superstate, space3, schema, root4) => { + return superstate.spaceManager.readFrame(space3.path, schema).then( + (tagDB) => saveFrameRoot(superstate, tagDB, space3, root4) ); }; var mdbFrameToDBTables = (tables, uniques) => { - return Object.keys(tables).reduce((p, c3) => { + return Object.keys(tables).reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { uniques: defaultFrameSchema.uniques, cols: defaultFrameSchema.cols, @@ -44938,42 +45043,42 @@ var calculateEditorProps = (props, treeNode) => { }; }; var getFrameNodesByPath = (superstate, ref2) => { - const path2 = superstate.spaceManager.uriByString(ref2); - if (!path2) + const path3 = superstate.spaceManager.uriByString(ref2); + if (!path3) return; - if (path2.authority == "$kit") { - const kit = superstate.kit.find((f2) => f2.def.id == path2.ref); + if (path3.authority == "$kit") { + const kit = superstate.kit.find((f2) => f2.def.id == path3.ref); if (!kit) return; return rootToFrame(kit); } - const context = superstate.framesIndex.get(path2.basePath); - return context?.frames[path2.ref]; + const context = superstate.framesIndex.get(path3.basePath); + return context?.frames[path3.ref]; }; -function flattenToFrameNodes(root, schemaId) { +function flattenToFrameNodes(root4, schemaId) { const flattenedTree = []; const ids2 = []; - function traverseAndFlatten(node, parent) { - const id3 = uniqueNameFromString(node.node.id, ids2); + function traverseAndFlatten(node2, parent) { + const id3 = uniqueNameFromString(node2.node.id, ids2); ids2.push(id3); - flattenedTree.push({ ...node.node, id: id3, parentId: parent, schemaId }); - (node.children ?? []).forEach((child) => { + flattenedTree.push({ ...node2.node, id: id3, parentId: parent, schemaId }); + (node2.children ?? []).forEach((child) => { traverseAndFlatten(child, id3); }); } - traverseAndFlatten(root, ""); + traverseAndFlatten(root4, ""); return flattenedTree; } -function insertFrameChildren(root, newChildren) { - function traverseAndInsert(node) { +function insertFrameChildren(root4, newChildren) { + function traverseAndInsert(node2) { return { - ...node, - children: node.node.type === "content" && newChildren.length > 0 ? newChildren.map((f2) => ({ ...f2, node: { ...f2.node, parentId: node.id } })) : node.children.map((child) => { + ...node2, + children: node2.node.type === "content" && newChildren.length > 0 ? newChildren.map((f2) => ({ ...f2, node: { ...f2.node, parentId: node2.id } })) : node2.children.map((child) => { return traverseAndInsert(child); }) }; } - const newRoot = traverseAndInsert(root); + const newRoot = traverseAndInsert(root4); return newRoot; } var expandNode = (treeNode, id3, superstate) => { @@ -45007,30 +45112,30 @@ var expandNode = (treeNode, id3, superstate) => { } return [treeNode, id3]; }; -var expandFrame = (node, superstate, uniqueID = 0, editorProps) => { - const [children, lastID] = node.children.reduce((f2, c3) => { +var expandFrame = (node2, superstate, uniqueID = 0, editorProps) => { + const [children, lastID] = node2.children.reduce((f2, c3) => { const [nodes, id3] = f2; - const _editorProps = calculateEditorProps({ ...editorProps, parentType: node.node.type, parentLastChildID: node.children[node.children.length - 1]?.id }, c3); + const _editorProps = calculateEditorProps({ ...editorProps, parentType: node2.node.type, parentLastChildID: node2.children[node2.children.length - 1]?.id }, c3); const [newNode3, fid] = expandFrame(c3, superstate, id3 + 1, _editorProps); return [[...nodes, newNode3], fid + 1]; }, [[], uniqueID]); - const [newNode2, newID] = expandNode({ ...node, children, editorProps }, lastID, superstate); + const [newNode2, newID] = expandNode({ ...node2, children, editorProps }, lastID, superstate); return [{ ...newNode2, editorProps: calculateEditorProps(newNode2.editorProps, newNode2) }, newID]; }; -var linkProps = (fields, root) => { - const props = fields.reduce((p, c3) => ({ ...p, [c3.name]: "" }), {}); - const types2 = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.type }), {}); - const propsValue = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.value }), {}); - const propsAttrs = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3.attrs }), {}); - return { ...root, node: { - ...root.node, - props: { ...props, ...root.node.props }, - types: { ...types2, ...root.node.types }, - propsValue: { ...propsValue, ...root.node.propsValue }, - propsAttrs: { ...propsAttrs, ...root.node.propsAttrs } +var linkProps = (fields, root4) => { + const props = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: "" }), {}); + const types2 = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.type }), {}); + const propsValue = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.value }), {}); + const propsAttrs = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3.attrs }), {}); + return { ...root4, node: { + ...root4.node, + props: { ...props, ...root4.node.props }, + types: { ...types2, ...root4.node.types }, + propsValue: { ...propsValue, ...root4.node.propsValue }, + propsAttrs: { ...propsAttrs, ...root4.node.propsAttrs } } }; }; var applyPropsToState = (state, props, rootID) => import_lodash4.default.cloneDeep({ @@ -45068,39 +45173,39 @@ var buildRootFromMDBFrame = (superstate, frame, editorProps = defaultFrameEditor }; var buildRoot = (schema, fields, nodes, superstate, editorProps = defaultFrameEditorProps) => { const rootNode = nodes.find((f2) => f2.id == schema.id) ?? schemaToRoot(schema); - const root = buildFrameTree(rootNode, nodes, superstate, nodes.length, false, { ...editorProps, rootId: schema.id })[0]; - return root && buildExecutable(linkProps(fields, root)); + const root4 = buildFrameTree(rootNode, nodes, superstate, nodes.length, false, { ...editorProps, rootId: schema.id })[0]; + return root4 && buildExecutable(linkProps(fields, root4)); }; -var propertiesForNode = (node) => Object.keys(node.types).map((f2) => ({ - type: node.types[f2], +var propertiesForNode = (node2) => Object.keys(node2.types).map((f2) => ({ + type: node2.types[f2], name: f2, schemaId: f2, - value: node.propsValue?.[f2], - attrs: node.propsAttrs?.[f2] + value: node2.propsValue?.[f2], + attrs: node2.propsAttrs?.[f2] })); -var buildFrameTree = (root, nodes, superstate, uniqueID = 0, isRef, editorProps = defaultFrameEditorProps, dontExpand) => { - const rootNode = { node: root, id: root.id, children: [], isRef, editorProps, parent: null }; - const idToNodeMap = { [root.id]: rootNode }; - nodes.forEach((node) => { - idToNodeMap[node.id] = { id: node.id, node, children: [], isRef, editorProps, parent: null }; - }); - nodes.forEach((node) => { - if (node.parentId) { - idToNodeMap[node.id].parent = idToNodeMap[node.parentId]; - const parentNode = idToNodeMap[node.parentId]; +var buildFrameTree = (root4, nodes, superstate, uniqueID = 0, isRef, editorProps = defaultFrameEditorProps, dontExpand) => { + const rootNode = { node: root4, id: root4.id, children: [], isRef, editorProps, parent: null }; + const idToNodeMap = { [root4.id]: rootNode }; + nodes.forEach((node2) => { + idToNodeMap[node2.id] = { id: node2.id, node: node2, children: [], isRef, editorProps, parent: null }; + }); + nodes.forEach((node2) => { + if (node2.parentId) { + idToNodeMap[node2.id].parent = idToNodeMap[node2.parentId]; + const parentNode = idToNodeMap[node2.parentId]; if (parentNode) { - parentNode.children.push({ ...idToNodeMap[node.id], editorProps: { ...editorProps, parentType: parentNode.node.type, parentLastChildID: parentNode.children[parentNode.children.length - 1]?.id } }); + parentNode.children.push({ ...idToNodeMap[node2.id], editorProps: { ...editorProps, parentType: parentNode.node.type, parentLastChildID: parentNode.children[parentNode.children.length - 1]?.id } }); parentNode.children.sort((a4, b2) => a4.node.rank - b2.node.rank); } } else { - if (node.id == root.id) - rootNode.node = idToNodeMap[node.id].node; + if (node2.id == root4.id) + rootNode.node = idToNodeMap[node2.id].node; } }); if (dontExpand) { - return [idToNodeMap[root.id], uniqueID]; + return [idToNodeMap[root4.id], uniqueID]; } - const [treeNode, newID] = expandFrame(idToNodeMap[root.id], superstate, uniqueID, editorProps); + const [treeNode, newID] = expandFrame(idToNodeMap[root4.id], superstate, uniqueID, editorProps); return [treeNode, newID]; }; var findParent = (tree, targetId, parentId = null) => { @@ -45160,21 +45265,21 @@ var valueAliasForType = (type) => { var nodeToPropValue = (type) => { return type == "container" || type == "group" || type == "content" || type == "frame" ? {} : { value: JSON.stringify({ alias: valueAliasForType(type) }) }; }; -var rootToFrame = (root, schemaId) => { +var rootToFrame = (root4, schemaId) => { if (!schemaId) - schemaId = root.node.id; + schemaId = root4.node.id; return { - schema: { id: schemaId, name: root.node.name, type: "frame", def: JSON.stringify(root.def) }, - cols: Object.keys(root.node.types ?? {}).map((f2) => { + schema: { id: schemaId, name: root4.node.name, type: "frame", def: JSON.stringify(root4.def) }, + cols: Object.keys(root4.node.types ?? {}).map((f2) => { return { name: f2, schemaId, - type: root.node.types[f2], - value: root.node.propsValue?.[f2], - attrs: root.node.propsAttrs?.[f2] + type: root4.node.types[f2], + value: root4.node.propsValue?.[f2], + attrs: root4.node.propsAttrs?.[f2] }; }), - rows: flattenToFrameNodes({ ...root, id: schemaId, node: { ...root.node, id: schemaId } }, schemaId).map((f2) => nodeToFrame(relinkProps("$root", schemaId, f2, schemaId))) + rows: flattenToFrameNodes({ ...root4, id: schemaId, node: { ...root4.node, id: schemaId } }, schemaId).map((f2) => nodeToFrame(relinkProps("$root", schemaId, f2, schemaId))) }; }; @@ -45205,11 +45310,11 @@ var frameToNode = (frame) => { propsValue: nodeToPropValue(frame.type) }; }; -var nodeToFrame = (node) => { - const { contexts, styles: styles2, props, actions, ...otherProps } = node; +var nodeToFrame = (node2) => { + const { contexts, styles: styles2, props, actions, ...otherProps } = node2; return { ...otherProps, - rank: node.rank?.toString() ?? "0", + rank: node2.rank?.toString() ?? "0", contexts: JSON.stringify(contexts), styles: JSON.stringify(styles2), actions: JSON.stringify(actions), @@ -45557,11 +45662,11 @@ var DefaultSpaceCols = [{ name: "space", type: "space", schemaId: "main", value: }) }]; // src/core/utils/contexts/context.ts -var contextPathFromPath = (superstate, path2) => { - const uri = superstate.spaceManager.uriByString(path2); +var contextPathFromPath = (superstate, path3) => { + const uri = superstate.spaceManager.uriByString(path3); if (!uri) return null; - const space2 = uri.basePath; + const space3 = uri.basePath; const spaceState = superstate.spacesIndex.get(uri.basePath); if (!spaceState) return null; @@ -45571,18 +45676,18 @@ var contextPathFromPath = (superstate, path2) => { let viewName; if (uri.refType == "frame") { view = uri.ref; - const frame = superstate.framesIndex.get(space2); + const frame = superstate.framesIndex.get(space3); if (view && frame) { viewName = frame.schemas.find((f2) => f2.id == view)?.name; schema = safelyParseJSON(frame.schemas.find((f2) => f2.id == view)?.def)?.db; - schemaName = superstate.contextsIndex.get(space2)?.schemas.find((f2) => f2.id == schema)?.name; + schemaName = superstate.contextsIndex.get(space3)?.schemas.find((f2) => f2.id == schema)?.name; } } else if (uri.refType == "context") { schema = uri.ref; - schemaName = superstate.contextsIndex.get(space2)?.schemas.find((f2) => f2.id == schema)?.name; + schemaName = superstate.contextsIndex.get(space3)?.schemas.find((f2) => f2.id == schema)?.name; } return { - space: space2, + space: space3, spaceName: spaceState.name, schema, schemaName, @@ -45590,16 +45695,16 @@ var contextPathFromPath = (superstate, path2) => { viewName }; }; -var processTable = async (manager, space2, table, processor) => { - const contextDB = await manager.readTable(space2.path, table); +var processTable = async (manager, space3, table2, processor) => { + const contextDB = await manager.readTable(space3.path, table2); if (contextDB) { - await processor(contextDB, space2); + await processor(contextDB, space3); } }; -var processContext = async (manager, space2, processor) => { - const contextDB = await manager.contextForSpace(space2.path); +var processContext = async (manager, space3, processor) => { + const contextDB = await manager.contextForSpace(space3.path); if (contextDB) { - await processor(contextDB, space2); + await processor(contextDB, space3); } }; var saveContext = async (manager, spaceInfo, newTable, force) => { @@ -45627,25 +45732,25 @@ var updateValue = (folder, lookupField, lookupValue, field, value) => { ) }; }; -var insertRowsIfUnique = (folder, rows, index2) => { - return { ...folder, rows: index2 ? insertMulti(folder.rows, index2, rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName]))) : [...rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName])), ...folder.rows] }; +var insertRowsIfUnique = (folder, rows, index3) => { + return { ...folder, rows: index3 ? insertMulti(folder.rows, index3, rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName]))) : [...rows.filter((f2) => !folder.rows.some((g) => g[PathPropertyName] == f2[PathPropertyName])), ...folder.rows] }; }; -var insertRows = (folder, rows, index2) => { - return { ...folder, rows: index2 ? insertMulti(folder.rows, index2, rows) : [...folder.rows, ...rows] }; +var insertRows = (folder, rows, index3) => { + return { ...folder, rows: index3 ? insertMulti(folder.rows, index3, rows) : [...folder.rows, ...rows] }; }; -var updateRowAtIndex = (folder, row2, index2) => { - return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index2 ? row2 : f2) }; +var updateRowAtIndex = (folder, row2, index3) => { + return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index3 ? row2 : f2) }; }; -var updateTableValue = async (manager, space2, schema, index2, field, value, rank) => { +var updateTableValue = async (manager, space3, schema, index3, field, value, rank) => { processTable( manager, - space2, + space3, schema, async (f2) => { let newMDB = { ...f2, rows: f2.rows.map( - (f3, i4) => i4 == index2 ? { + (f3, i4) => i4 == index3 ? { ...f3, [field]: value } : f3 @@ -45654,30 +45759,30 @@ var updateTableValue = async (manager, space2, schema, index2, field, value, ran if (rank) newMDB = { ...newMDB, - rows: arrayMove(newMDB.rows, index2, rank) + rows: arrayMove(newMDB.rows, index3, rank) }; if (!import_lodash5.default.isEqual(f2, newMDB)) { - await saveContext(manager, space2, newMDB); + await saveContext(manager, space3, newMDB); } return newMDB; } ); }; -var updateContextValue = async (manager, space2, path2, field, value, _updateFunction, rank) => { - manager.contextForSpace(space2.path).then( +var updateContextValue = async (manager, space3, path3, field, value, _updateFunction, rank) => { + manager.contextForSpace(space3.path).then( (f2) => { const updateFunction = _updateFunction ?? updateValue; - let newMDB = updateFunction(f2, PathPropertyName, path2, field, value); + let newMDB = updateFunction(f2, PathPropertyName, path3, field, value); if (rank) - newMDB = reorderRowsForPath(newMDB, [path2], rank); - return saveContext(manager, space2, newMDB).then((f3) => newMDB); + newMDB = reorderRowsForPath(newMDB, [path3], rank); + return saveContext(manager, space3, newMDB).then((f3) => newMDB); } ); }; var insertContextItems = async (manager, newPaths, t5) => { - const saveNewContextRows = async (tag2, space2) => { + const saveNewContextRows = async (tag2, space3) => { const newRow = newPaths.map((newPath) => ({ [PathPropertyName]: newPath })); - await saveContext(manager, space2, insertRowsIfUnique(tag2, newRow)); + await saveContext(manager, space3, insertRowsIfUnique(tag2, newRow)); }; const spaceInfo = manager.spaceInfoForPath(t5); await manager.contextForSpace(t5).then( @@ -45685,18 +45790,18 @@ var insertContextItems = async (manager, newPaths, t5) => { ); }; var getPathProperties = async (superstate, _path, cols) => { - let path2 = _path; - if (superstate.spacesIndex.has(path2)) { - path2 = superstate.spacesIndex.get(path2).defPath; + let path3 = _path; + if (superstate.spacesIndex.has(path3)) { + path3 = superstate.spacesIndex.get(path3).defPath; } - const properties3 = await superstate.spaceManager.readProperties(path2); + const properties3 = await superstate.spaceManager.readProperties(path3); if (!properties3) return {}; - return Object.keys(properties3).reduce((p, c3) => { + return Object.keys(properties3).reduce((p2, c3) => { if (cols.includes(c3)) { - return { ...p, [c3]: properties3[c3] }; + return { ...p2, [c3]: properties3[c3] }; } - return p; + return p2; }, {}); }; var getContextProperties = (superstate, context) => { @@ -45708,17 +45813,17 @@ var getContextProperties = (superstate, context) => { } return superstate.contextsIndex.get(context)?.cols ?? []; }; -var updateContextWithProperties = async (superstate, path2, spaces2) => { +var updateContextWithProperties = async (superstate, path3, spaces2) => { const updatePath = async (mdb) => { - const objectExists = mdb.rows.some((item) => item[PathPropertyName] === path2); + const objectExists = mdb.rows.some((item) => item[PathPropertyName] === path3); const properties3 = await getPathProperties( superstate, - path2, + path3, mdb.cols.map((f2) => f2.name) ); if (objectExists) { return mdb.rows.map( - (f2) => f2[PathPropertyName] == path2 ? { + (f2) => f2[PathPropertyName] == path3 ? { ...f2, ...properties3 } : f2 @@ -45727,21 +45832,21 @@ var updateContextWithProperties = async (superstate, path2, spaces2) => { return [ ...mdb.rows, { - [PathPropertyName]: path2, + [PathPropertyName]: path3, ...properties3 } ]; } }; - const promises = spaces2.map((space2) => { - return processContext(superstate.spaceManager, space2, async (mdb, space3) => { + const promises = spaces2.map((space3) => { + return processContext(superstate.spaceManager, space3, async (mdb, space4) => { const newRows = await updatePath(mdb); const newDB = { ...mdb, rows: newRows }; if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(superstate.spaceManager, space3, newDB); + await saveContext(superstate.spaceManager, space4, newDB); } return newDB; }); @@ -45749,23 +45854,23 @@ var updateContextWithProperties = async (superstate, path2, spaces2) => { await Promise.all(promises); return; }; -var updateTableRow = async (manager, space2, table, index2, row2) => { - return processTable(manager, space2, table, async (mdb, space3) => { - const newDB = updateRowAtIndex(mdb, row2, index2); +var updateTableRow = async (manager, space3, table2, index3, row2) => { + return processTable(manager, space3, table2, async (mdb, space4) => { + const newDB = updateRowAtIndex(mdb, row2, index3); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); }; -var updateValueInContext = async (manager, row2, field, value, space2) => { +var updateValueInContext = async (manager, row2, field, value, space3) => { const changeTagInContextMDB = (mdb) => { return { ...mdb, rows: mdb.rows.map((f2) => f2[PathPropertyName] == row2 ? { ...f2, [field]: value } : f2) }; }; - return processContext(manager, space2, async (mdb, space3) => { + return processContext(manager, space3, async (mdb, space4) => { const newDB = changeTagInContextMDB(mdb); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); @@ -45775,11 +45880,11 @@ var renameTagInContexts = async (manager, oldTag, newTag, spaces2) => { const cols = mdb.cols.map((f2) => f2.type.startsWith("context") && f2.value == oldTag ? { ...f2, value: newTag } : f2); return { ...mdb, cols }; }; - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { const newDB = changeTagInContextMDB(mdb); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); @@ -45791,61 +45896,61 @@ var removeTagInContexts = async (manager, tag2, spaces2) => { const cols = mdb.cols.map((f2) => f2.type.startsWith("context") && f2.value == tag2 ? { ...f2, type: "link-multi" } : f2); return { ...mdb, cols }; }; - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { const newDB = deleteTagInContextMDB(mdb); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); }); return Promise.all(promises); }; -var addRowInTable = async (manager, row2, context, table, index2) => { - return processTable(manager, context, table, async (mdb, space2) => { - const newDB = insertRows(mdb, [row2], index2); +var addRowInTable = async (manager, row2, context, table2, index3) => { + return processTable(manager, context, table2, async (mdb, space3) => { + const newDB = insertRows(mdb, [row2], index3); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space2, newDB); + await saveContext(manager, space3, newDB); } return newDB; }); }; -var deleteRowInTable = async (manager, context, table, index2) => { - return processTable(manager, context, table, async (mdb, space2) => { - const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index2) }; +var deleteRowInTable = async (manager, context, table2, index3) => { + return processTable(manager, context, table2, async (mdb, space3) => { + const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index3) }; if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space2, newDB); + await saveContext(manager, space3, newDB); } return newDB; }); }; var renameLinkInContexts = async (manager, oldPath, newPath, spaces2) => { - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { const linkCols = linkColumns(mdb.cols); const newDB = { ...mdb, rows: mdb.rows.map((r2) => renameLinksInRow(manager, r2, oldPath, newPath, linkCols)) }; if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removeLinkInContexts = async (manager, path2, spaces2) => { - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { +var removeLinkInContexts = async (manager, path3, spaces2) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { const linkCols = linkColumns(mdb.cols); const newDB = { ...mdb, - rows: mdb.rows.map((r2) => removeLinksInRow(manager, r2, path2, linkCols)) + rows: mdb.rows.map((r2) => removeLinksInRow(manager, r2, path3, linkCols)) }; if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); @@ -45853,40 +45958,40 @@ var removeLinkInContexts = async (manager, path2, spaces2) => { return Promise.all(promises); }; var renamePathInContexts = async (manager, oldPath, newPath, spaces2) => { - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { const newDB = renameRowForPath(mdb, oldPath, newPath); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removePathInContexts = async (manager, path2, spaces2) => { - const promises = spaces2.map((space2) => { - return processContext(manager, space2, async (mdb, space3) => { - const newDB = removeRowForPath(mdb, path2); +var removePathInContexts = async (manager, path3, spaces2) => { + const promises = spaces2.map((space3) => { + return processContext(manager, space3, async (mdb, space4) => { + const newDB = removeRowForPath(mdb, path3); if (!import_lodash5.default.isEqual(mdb, newDB)) { - await saveContext(manager, space3, newDB); + await saveContext(manager, space4, newDB); } return newDB; }); }); return Promise.all(promises); }; -var reorderPathsInContext = async (manager, paths, index2, space2) => { - return processContext(manager, space2, async (mdb, context) => { - const newDB = reorderRowsForPath(mdb, paths, index2); +var reorderPathsInContext = async (manager, paths, index3, space3) => { + return processContext(manager, space3, async (mdb, context) => { + const newDB = reorderRowsForPath(mdb, paths, index3); if (!import_lodash5.default.isEqual(mdb, newDB)) { await saveContext(manager, context, newDB, true); } return newDB; }); }; -var removePathsInContext = async (manager, paths, space2) => { - return processContext(manager, space2, async (mdb, context) => { +var removePathsInContext = async (manager, paths, space3) => { + return processContext(manager, space3, async (mdb, context) => { const newDB = removeRowsForPath(mdb, paths); if (!import_lodash5.default.isEqual(mdb, newDB)) { await saveContext(manager, context, newDB); @@ -45968,13 +46073,13 @@ var import_react8 = __toESM(require_react()); // src/utils/stickers.ts var emojiFromString = (emoji) => { - let html; + let html7; try { - html = unifiedToNative(emoji); + html7 = unifiedToNative(emoji); } catch { - html = emoji; + html7 = emoji; } - return html; + return html7; }; function parseStickerString(input) { if (!input) { @@ -45987,8 +46092,8 @@ function parseStickerString(input) { return ["", input]; } } -var unifiedToNative = (unified) => { - const unicodes = unified.split("-"); +var unifiedToNative = (unified2) => { + const unicodes = unified2.split("-"); const codePoints = unicodes.map((u3) => `0x${u3}`); return String.fromCodePoint(...codePoints); }; @@ -46016,7 +46121,7 @@ var StickerModal = (props) => { ); const [page, setPage] = (0, import_react8.useState)(1); const loadNextPage = (0, import_react8.useCallback)(() => { - setPage((p) => p + 1); + setPage((p2) => p2 + 1); }, [page]); const loaderRef = (0, import_react8.useRef)(null); (0, import_react8.useEffect)(() => { @@ -46106,9 +46211,9 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function(target) { for (var i4 = 1; i4 < arguments.length; i4++) { var source = arguments[i4]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; + for (var key3 in source) { + if (Object.prototype.hasOwnProperty.call(source, key3)) { + target[key3] = source[key3]; } } } @@ -46219,8 +46324,8 @@ function isConditionalNode(x2) { function isConstantNode(x2) { return x2 && x2.isConstantNode === true && x2.constructor.prototype.isNode === true || false; } -function rule2Node(node) { - return isConstantNode(node) || isOperatorNode(node) && node.args.length === 1 && isConstantNode(node.args[0]) && "-+~".includes(node.op); +function rule2Node(node2) { + return isConstantNode(node2) || isOperatorNode(node2) && node2.args.length === 1 && isConstantNode(node2.args[0]) && "-+~".includes(node2.op); } function isFunctionAssignmentNode(x2) { return x2 && x2.isFunctionAssignmentNode === true && x2.constructor.prototype.isNode === true || false; @@ -46294,9 +46399,9 @@ function clone(x2) { } function mapObject(object, callback) { var clone5 = {}; - for (var key2 in object) { - if (hasOwnProperty2(object, key2)) { - clone5[key2] = callback(object[key2]); + for (var key3 in object) { + if (hasOwnProperty2(object, key3)) { + clone5[key3] = callback(object[key3]); } } return clone5; @@ -46414,16 +46519,16 @@ function isLegacyFactory(object) { function pickShallow(object, properties3) { var copy = {}; for (var i4 = 0; i4 < properties3.length; i4++) { - var key2 = properties3[i4]; - var value = object[key2]; + var key3 = properties3[i4]; + var value = object[key3]; if (value !== void 0) { - copy[key2] = value; + copy[key3] = value; } } return copy; } function values(object) { - return Object.keys(object).map((key2) => object[key2]); + return Object.keys(object).map((key3) => object[key3]); } // node_modules/mathjs/lib/esm/core/function/config.js @@ -46446,9 +46551,9 @@ function configFactory(config4, emit) { } _config.MATRIX_OPTIONS = MATRIX_OPTIONS; _config.NUMBER_OPTIONS = NUMBER_OPTIONS; - Object.keys(DEFAULT_CONFIG).forEach((key2) => { - Object.defineProperty(_config, key2, { - get: () => config4[key2], + Object.keys(DEFAULT_CONFIG).forEach((key3) => { + Object.defineProperty(_config, key3, { + get: () => config4[key3], enumerable: true, configurable: true }); @@ -46890,13 +46995,13 @@ var cbrt = Math.cbrt || function cbrt2(x2) { var expm1 = Math.expm1 || function expm12(x2) { return x2 >= 2e-4 || x2 <= -2e-4 ? Math.exp(x2) - 1 : x2 + x2 * x2 / 2 + x2 * x2 * x2 / 6; }; -function formatNumberToBase(n3, base2, size2) { +function formatNumberToBase(n3, base3, size2) { var prefixes = { 2: "0b", 8: "0o", 16: "0x" }; - var prefix = prefixes[base2]; + var prefix = prefixes[base3]; var suffix = ""; if (size2) { if (size2 < 1) { @@ -46921,7 +47026,7 @@ function formatNumberToBase(n3, base2, size2) { n3 = -n3; sign4 = "-"; } - return "".concat(sign4).concat(prefix).concat(n3.toString(base2)).concat(suffix); + return "".concat(sign4).concat(prefix).concat(n3.toString(base3)).concat(suffix); } function format2(value, options) { if (typeof options === "function") { @@ -47058,17 +47163,17 @@ function toFixed(value, precision) { var splitValue = splitNumber(value); var rounded = typeof precision === "number" ? roundDigits(splitValue, splitValue.exponent + 1 + precision) : splitValue; var c3 = rounded.coefficients; - var p = rounded.exponent + 1; - var pp2 = p + (precision || 0); + var p2 = rounded.exponent + 1; + var pp2 = p2 + (precision || 0); if (c3.length < pp2) { c3 = c3.concat(zeros(pp2 - c3.length)); } - if (p < 0) { - c3 = zeros(-p + 1).concat(c3); - p = 1; + if (p2 < 0) { + c3 = zeros(-p2 + 1).concat(c3); + p2 = 1; } - if (p < c3.length) { - c3.splice(p, 0, p === 0 ? "0." : "."); + if (p2 < c3.length) { + c3.splice(p2, 0, p2 === 0 ? "0." : "."); } return rounded.sign + c3.join(""); } @@ -47217,7 +47322,7 @@ function _toNumberOrDefault(value, defaultValue2) { } // node_modules/mathjs/lib/esm/utils/bignumber/formatter.js -function formatBigNumberToBase(n3, base2, size2) { +function formatBigNumberToBase(n3, base3, size2) { var BigNumberCtor = n3.constructor; var big2 = new BigNumberCtor(2); var suffix = ""; @@ -47239,7 +47344,7 @@ function formatBigNumberToBase(n3, base2, size2) { } suffix = "i".concat(size2); } - switch (base2) { + switch (base3) { case 2: return "".concat(n3.toBinary()).concat(suffix); case 8: @@ -47247,7 +47352,7 @@ function formatBigNumberToBase(n3, base2, size2) { case 16: return "".concat(n3.toHexadecimal()).concat(suffix); default: - throw new Error("Base ".concat(base2, " not supported ")); + throw new Error("Base ".concat(base3, " not supported ")); } } function format3(value, options) { @@ -47330,10 +47435,10 @@ function _toNumberOrDefault2(value, defaultValue2) { } // node_modules/mathjs/lib/esm/utils/string.js -function endsWith(text2, search2) { - var start = text2.length - search2.length; - var end = text2.length; - return text2.substring(start, end) === search2; +function endsWith(text7, search3) { + var start = text7.length - search3.length; + var end = text7.length; + return text7.substring(start, end) === search3; } function format4(value, options) { var result = _format(value, options); @@ -47371,8 +47476,8 @@ function _format(value, options) { } else if (value && value.toString(options) !== {}.toString()) { return value.toString(options); } else { - var entries = Object.keys(value).map((key2) => { - return stringify2(key2) + ": " + format4(value[key2], options); + var entries = Object.keys(value).map((key3) => { + return stringify2(key3) + ": " + format4(value[key3], options); }); return "{" + entries.join(", ") + "}"; } @@ -47380,11 +47485,11 @@ function _format(value, options) { return String(value); } function stringify2(value) { - var text2 = String(value); + var text7 = String(value); var escaped = ""; var i4 = 0; - while (i4 < text2.length) { - var c3 = text2.charAt(i4); + while (i4 < text7.length) { + var c3 = text7.charAt(i4); escaped += c3 in controlCharacters ? controlCharacters[c3] : c3; i4++; } @@ -47400,9 +47505,9 @@ var controlCharacters = { " ": "\\t" }; function escape(value) { - var text2 = String(value); - text2 = text2.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"); - return text2; + var text7 = String(value); + text7 = text7.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"); + return text7; } function formatArray(array, options) { if (Array.isArray(array)) { @@ -47450,11 +47555,11 @@ DimensionError.prototype.name = "DimensionError"; DimensionError.prototype.isDimensionError = true; // node_modules/mathjs/lib/esm/error/IndexError.js -function IndexError(index2, min5, max5) { +function IndexError(index3, min5, max5) { if (!(this instanceof IndexError)) { throw new SyntaxError("Constructor must be called with the new operator"); } - this.index = index2; + this.index = index3; if (arguments.length < 3) { this.min = 0; this.max = min5; @@ -47518,28 +47623,28 @@ function validate(array, size2) { _validate(array, size2, 0); } } -function validateIndexSourceSize(value, index2) { +function validateIndexSourceSize(value, index3) { var valueSize = value.isMatrix ? value._size : arraySize(value); - var sourceSize = index2._sourceSize; + var sourceSize = index3._sourceSize; sourceSize.forEach((sourceDim, i4) => { if (sourceDim !== null && sourceDim !== valueSize[i4]) { throw new DimensionError(sourceDim, valueSize[i4]); } }); } -function validateIndex(index2, length) { - if (index2 !== void 0) { - if (!isNumber(index2) || !isInteger(index2)) { - throw new TypeError("Index must be an integer (value: " + index2 + ")"); +function validateIndex(index3, length) { + if (index3 !== void 0) { + if (!isNumber(index3) || !isInteger(index3)) { + throw new TypeError("Index must be an integer (value: " + index3 + ")"); } - if (index2 < 0 || typeof length === "number" && index2 >= length) { - throw new IndexError(index2, length); + if (index3 < 0 || typeof length === "number" && index3 >= length) { + throw new IndexError(index3, length); } } } -function isEmptyIndex(index2) { - for (var i4 = 0; i4 < index2._dimensions.length; ++i4) { - var dimension = index2._dimensions[i4]; +function isEmptyIndex(index3) { + for (var i4 = 0; i4 < index3._dimensions.length; ++i4) { + var dimension = index3._dimensions[i4]; if (dimension._data && isArray2(dimension._data)) { if (dimension._size[0] === 0) { return true; @@ -47915,11 +48020,11 @@ function clone2(array) { } // node_modules/mathjs/lib/esm/utils/factory.js -function factory(name317, dependencies314, create2, meta3) { +function factory(name317, dependencies314, create3, meta3) { function assertAndCreate(scope) { var deps = pickShallow(scope, dependencies314.map(stripOptionalNotation)); assertDependencies(name317, dependencies314, scope); - return create2(deps); + return create3(deps); } assertAndCreate.isFactory = true; assertAndCreate.fn = name317; @@ -48027,30 +48132,30 @@ var ObjectWrappingMap = class { keys() { return Object.keys(this.wrappedObject).values(); } - get(key2) { - return getSafeProperty(this.wrappedObject, key2); + get(key3) { + return getSafeProperty(this.wrappedObject, key3); } - set(key2, value) { - setSafeProperty(this.wrappedObject, key2, value); + set(key3, value) { + setSafeProperty(this.wrappedObject, key3, value); return this; } - has(key2) { - return hasSafeProperty(this.wrappedObject, key2); + has(key3) { + return hasSafeProperty(this.wrappedObject, key3); } entries() { - return mapIterator(this.keys(), (key2) => [key2, this.get(key2)]); + return mapIterator(this.keys(), (key3) => [key3, this.get(key3)]); } forEach(callback) { - for (var key2 of this.keys()) { - callback(this.get(key2), key2, this); + for (var key3 of this.keys()) { + callback(this.get(key3), key3, this); } } - delete(key2) { - delete this.wrappedObject[key2]; + delete(key3) { + delete this.wrappedObject[key3]; } clear() { - for (var key2 of this.keys()) { - this.delete(key2); + for (var key3 of this.keys()) { + this.delete(key3); } } get size() { @@ -48064,33 +48169,33 @@ var PartitionedMap = class { this.bKeys = bKeys; this[Symbol.iterator] = this.entries; } - get(key2) { - return this.bKeys.has(key2) ? this.b.get(key2) : this.a.get(key2); + get(key3) { + return this.bKeys.has(key3) ? this.b.get(key3) : this.a.get(key3); } - set(key2, value) { - if (this.bKeys.has(key2)) { - this.b.set(key2, value); + set(key3, value) { + if (this.bKeys.has(key3)) { + this.b.set(key3, value); } else { - this.a.set(key2, value); + this.a.set(key3, value); } return this; } - has(key2) { - return this.b.has(key2) || this.a.has(key2); + has(key3) { + return this.b.has(key3) || this.a.has(key3); } keys() { return (/* @__PURE__ */ new Set([...this.a.keys(), ...this.b.keys()]))[Symbol.iterator](); } entries() { - return mapIterator(this.keys(), (key2) => [key2, this.get(key2)]); + return mapIterator(this.keys(), (key3) => [key3, this.get(key3)]); } forEach(callback) { - for (var key2 of this.keys()) { - callback(this.get(key2), key2, this); + for (var key3 of this.keys()) { + callback(this.get(key3), key3, this); } } - delete(key2) { - return this.bKeys.has(key2) ? this.b.delete(key2) : this.a.delete(key2); + delete(key3) { + return this.bKeys.has(key3) ? this.b.delete(key3) : this.a.delete(key3); } clear() { this.a.clear(); @@ -48126,14 +48231,14 @@ function createMap(mapOrObject) { } throw new Error("createMap can create maps from objects or Maps"); } -function toObject(map4) { - if (map4 instanceof ObjectWrappingMap) { - return map4.wrappedObject; +function toObject(map6) { + if (map6 instanceof ObjectWrappingMap) { + return map6.wrappedObject; } var object = {}; - for (var key2 of map4.keys()) { - var value = map4.get(key2); - setSafeProperty(object, key2, value); + for (var key3 of map6.keys()) { + var value = map6.get(key3); + setSafeProperty(object, key3, value); } return object; } @@ -48324,7 +48429,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create typed3.addConversions([{ from: "number", to: "BigNumber", - convert: function convert(x2) { + convert: function convert2(x2) { if (!BigNumber2) { throwNoBignumber(x2); } @@ -48336,7 +48441,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "number", to: "Complex", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Complex3) { throwNoComplex(x2); } @@ -48345,7 +48450,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "BigNumber", to: "Complex", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Complex3) { throwNoComplex(x2); } @@ -48354,13 +48459,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "Fraction", to: "BigNumber", - convert: function convert(x2) { + convert: function convert2(x2) { throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction."); } }, { from: "Fraction", to: "Complex", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Complex3) { throwNoComplex(x2); } @@ -48369,7 +48474,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "number", to: "Fraction", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Fraction3) { throwNoFraction(x2); } @@ -48382,7 +48487,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "string", to: "number", - convert: function convert(x2) { + convert: function convert2(x2) { var n3 = Number(x2); if (isNaN(n3)) { throw new Error('Cannot convert "' + x2 + '" to a number'); @@ -48392,7 +48497,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "string", to: "BigNumber", - convert: function convert(x2) { + convert: function convert2(x2) { if (!BigNumber2) { throwNoBignumber(x2); } @@ -48405,7 +48510,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "string", to: "Fraction", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Fraction3) { throwNoFraction(x2); } @@ -48418,7 +48523,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "string", to: "Complex", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Complex3) { throwNoComplex(x2); } @@ -48431,13 +48536,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "boolean", to: "number", - convert: function convert(x2) { + convert: function convert2(x2) { return +x2; } }, { from: "boolean", to: "BigNumber", - convert: function convert(x2) { + convert: function convert2(x2) { if (!BigNumber2) { throwNoBignumber(x2); } @@ -48446,7 +48551,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "boolean", to: "Fraction", - convert: function convert(x2) { + convert: function convert2(x2) { if (!Fraction3) { throwNoFraction(x2); } @@ -48455,13 +48560,13 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "boolean", to: "string", - convert: function convert(x2) { + convert: function convert2(x2) { return String(x2); } }, { from: "Array", to: "Matrix", - convert: function convert(array) { + convert: function convert2(array) { if (!DenseMatrix2) { throwNoMatrix(); } @@ -48470,7 +48575,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies, function create }, { from: "Matrix", to: "Array", - convert: function convert(matrix2) { + convert: function convert2(matrix2) { return matrix2.valueOf(); } }]); @@ -48718,11 +48823,11 @@ P.greaterThanOrEqualTo = P.gte = function(y3) { return k2 == 1 || k2 === 0; }; P.hyperbolicCosine = P.cosh = function() { - var k2, n3, pr, rm, len, x2 = this, Ctor = x2.constructor, one = new Ctor(1); + var k2, n3, pr, rm, len, x2 = this, Ctor = x2.constructor, one5 = new Ctor(1); if (!x2.isFinite()) return new Ctor(x2.s ? 1 / 0 : NaN); if (x2.isZero()) - return one; + return one5; pr = Ctor.precision; rm = Ctor.rounding; Ctor.precision = pr + Math.max(x2.e, x2.sd()) + 4; @@ -48739,7 +48844,7 @@ P.hyperbolicCosine = P.cosh = function() { var cosh2_x, i4 = k2, d8 = new Ctor(8); for (; i4--; ) { cosh2_x = x2.times(x2); - x2 = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + x2 = one5.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); } return finalise(x2, Ctor.precision = pr, Ctor.rounding = rm, true); }; @@ -48936,17 +49041,17 @@ P.lessThan = P.lt = function(y3) { P.lessThanOrEqualTo = P.lte = function(y3) { return this.cmp(y3) < 1; }; -P.logarithm = P.log = function(base2) { +P.logarithm = P.log = function(base3) { var isBase10, d4, denominator, k2, inf, num, sd, r2, arg2 = this, Ctor = arg2.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5; - if (base2 == null) { - base2 = new Ctor(10); + if (base3 == null) { + base3 = new Ctor(10); isBase10 = true; } else { - base2 = new Ctor(base2); - d4 = base2.d; - if (base2.s < 0 || !d4 || !d4[0] || base2.eq(1)) + base3 = new Ctor(base3); + d4 = base3.d; + if (base3.s < 0 || !d4 || !d4[0] || base3.eq(1)) return new Ctor(NaN); - isBase10 = base2.eq(10); + isBase10 = base3.eq(10); } d4 = arg2.d; if (arg2.s < 0 || !d4 || !d4[0] || arg2.eq(1)) { @@ -48964,13 +49069,13 @@ P.logarithm = P.log = function(base2) { external = false; sd = pr + guard; num = naturalLogarithm(arg2, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base2, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base3, sd); r2 = divide(num, denominator, sd, 1); if (checkRoundingDigits(r2.d, k2 = pr, rm)) { do { sd += 10; num = naturalLogarithm(arg2, sd); - denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base2, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base3, sd); r2 = divide(num, denominator, sd, 1); if (!inf) { if (+digitsToString(r2.d).slice(k2 + 1, k2 + 15) + 1 == 1e14) { @@ -49646,12 +49751,12 @@ function cosine(Ctor, x2) { return x2; } var divide = function() { - function multiplyInteger(x2, k2, base2) { + function multiplyInteger(x2, k2, base3) { var temp, carry = 0, i4 = x2.length; for (x2 = x2.slice(); i4--; ) { temp = x2[i4] * k2 + carry; - x2[i4] = temp % base2 | 0; - carry = temp / base2 | 0; + x2[i4] = temp % base3 | 0; + carry = temp / base3 | 0; } if (carry) x2.unshift(carry); @@ -49671,28 +49776,28 @@ var divide = function() { } return r2; } - function subtract3(a4, b2, aL, base2) { + function subtract3(a4, b2, aL, base3) { var i4 = 0; for (; aL--; ) { a4[aL] -= i4; i4 = a4[aL] < b2[aL] ? 1 : 0; - a4[aL] = i4 * base2 + a4[aL] - b2[aL]; + a4[aL] = i4 * base3 + a4[aL] - b2[aL]; } for (; !a4[0] && a4.length > 1; ) a4.shift(); } - return function(x2, y3, pr, rm, dp, base2) { + return function(x2, y3, pr, rm, dp, base3) { var cmp, e5, i4, k2, logBase, more, prod2, prodL, q2, qd, rem, remL, rem0, sd, t5, xi, xL, yd0, yL, yz, Ctor = x2.constructor, sign4 = x2.s == y3.s ? 1 : -1, xd = x2.d, yd = y3.d; if (!xd || !xd[0] || !yd || !yd[0]) { return new Ctor( !x2.s || !y3.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : xd && xd[0] == 0 || !yd ? sign4 * 0 : sign4 / 0 ); } - if (base2) { + if (base3) { logBase = 1; e5 = x2.e - y3.e; } else { - base2 = BASE; + base3 = BASE; logBase = LOG_BASE; e5 = mathfloor(x2.e / logBase) - mathfloor(y3.e / logBase); } @@ -49723,16 +49828,16 @@ var divide = function() { yd = yd[0]; sd++; for (; (i4 < xL || k2) && sd--; i4++) { - t5 = k2 * base2 + (xd[i4] || 0); + t5 = k2 * base3 + (xd[i4] || 0); qd[i4] = t5 / yd | 0; k2 = t5 % yd | 0; } more = k2 || i4 < xL; } else { - k2 = base2 / (yd[0] + 1) | 0; + k2 = base3 / (yd[0] + 1) | 0; if (k2 > 1) { - yd = multiplyInteger(yd, k2, base2); - xd = multiplyInteger(xd, k2, base2); + yd = multiplyInteger(yd, k2, base3); + xd = multiplyInteger(xd, k2, base3); yL = yd.length; xL = xd.length; } @@ -49744,7 +49849,7 @@ var divide = function() { yz = yd.slice(); yz.unshift(0); yd0 = yd[0]; - if (yd[1] >= base2 / 2) + if (yd[1] >= base3 / 2) ++yd0; do { k2 = 0; @@ -49752,18 +49857,18 @@ var divide = function() { if (cmp < 0) { rem0 = rem[0]; if (yL != remL) - rem0 = rem0 * base2 + (rem[1] || 0); + rem0 = rem0 * base3 + (rem[1] || 0); k2 = rem0 / yd0 | 0; if (k2 > 1) { - if (k2 >= base2) - k2 = base2 - 1; - prod2 = multiplyInteger(yd, k2, base2); + if (k2 >= base3) + k2 = base3 - 1; + prod2 = multiplyInteger(yd, k2, base3); prodL = prod2.length; remL = rem.length; cmp = compare2(prod2, rem, prodL, remL); if (cmp == 1) { k2--; - subtract3(prod2, yL < prodL ? yz : yd, prodL, base2); + subtract3(prod2, yL < prodL ? yz : yd, prodL, base3); } } else { if (k2 == 0) @@ -49773,13 +49878,13 @@ var divide = function() { prodL = prod2.length; if (prodL < remL) prod2.unshift(0); - subtract3(rem, prod2, remL, base2); + subtract3(rem, prod2, remL, base3); if (cmp == -1) { remL = rem.length; cmp = compare2(yd, rem, yL, remL); if (cmp < 1) { k2++; - subtract3(rem, yL < remL ? yz : yd, remL, base2); + subtract3(rem, yL < remL ? yz : yd, remL, base3); } } remL = rem.length; @@ -50179,7 +50284,7 @@ function parseDecimal(x2, str) { return x2; } function parseOther(x2, str) { - var base2, Ctor, divisor, i4, isFloat, len, p, xd, xe; + var base3, Ctor, divisor, i4, isFloat, len, p2, xd, xe; if (str.indexOf("_") > -1) { str = str.replace(/(\d)_(?=\d)/g, "$1"); if (isDecimal.test(str)) @@ -50192,18 +50297,18 @@ function parseOther(x2, str) { return x2; } if (isHex.test(str)) { - base2 = 16; + base3 = 16; str = str.toLowerCase(); } else if (isBinary.test(str)) { - base2 = 2; + base3 = 2; } else if (isOctal.test(str)) { - base2 = 8; + base3 = 8; } else { throw Error(invalidArgument + str); } i4 = str.search(/p/i); if (i4 > 0) { - p = +str.slice(i4 + 1); + p2 = +str.slice(i4 + 1); str = str.substring(2, i4); } else { str = str.slice(2); @@ -50215,9 +50320,9 @@ function parseOther(x2, str) { str = str.replace(".", ""); len = str.length; i4 = len - i4; - divisor = intPow(Ctor, new Ctor(base2), i4, i4 * 2); + divisor = intPow(Ctor, new Ctor(base3), i4, i4 * 2); } - xd = convertBase(str, base2, BASE); + xd = convertBase(str, base3, BASE); xe = xd.length - 1; for (i4 = xe; xd[i4] === 0; --i4) xd.pop(); @@ -50228,8 +50333,8 @@ function parseOther(x2, str) { external = false; if (isFloat) x2 = divide(x2, divisor, len * 4); - if (p) - x2 = x2.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); + if (p2) + x2 = x2.times(Math.abs(p2) < 54 ? mathpow(2, p2) : Decimal.pow(2, p2)); external = true; return x2; } @@ -50302,7 +50407,7 @@ function toLessThanHalfPi(Ctor, x2) { return x2.minus(pi3).abs(); } function toStringBinary(x2, baseOut, sd, rm) { - var base2, e5, i4, k2, len, roundUp, str, xd, y3, Ctor = x2.constructor, isExp = sd !== void 0; + var base3, e5, i4, k2, len, roundUp, str, xd, y3, Ctor = x2.constructor, isExp = sd !== void 0; if (isExp) { checkInt32(sd, 1, MAX_DIGITS); if (rm === void 0) @@ -50319,23 +50424,23 @@ function toStringBinary(x2, baseOut, sd, rm) { str = finiteToString(x2); i4 = str.indexOf("."); if (isExp) { - base2 = 2; + base3 = 2; if (baseOut == 16) { sd = sd * 4 - 3; } else if (baseOut == 8) { sd = sd * 3 - 2; } } else { - base2 = baseOut; + base3 = baseOut; } if (i4 >= 0) { str = str.replace(".", ""); y3 = new Ctor(1); y3.e = str.length - i4; - y3.d = convertBase(finiteToString(y3), 10, base2); + y3.d = convertBase(finiteToString(y3), 10, base3); y3.e = y3.d.length; } - xd = convertBase(str, 10, base2); + xd = convertBase(str, 10, base3); e5 = len = xd.length; for (; xd[--len] == 0; ) xd.pop(); @@ -50348,18 +50453,18 @@ function toStringBinary(x2, baseOut, sd, rm) { x2 = new Ctor(x2); x2.d = xd; x2.e = e5; - x2 = divide(x2, y3, sd, rm, 0, base2); + x2 = divide(x2, y3, sd, rm, 0, base3); xd = x2.d; e5 = x2.e; roundUp = inexact; } i4 = xd[sd]; - k2 = base2 / 2; + k2 = base3 / 2; roundUp = roundUp || xd[sd + 1] !== void 0; roundUp = rm < 4 ? (i4 !== void 0 || roundUp) && (rm === 0 || rm === (x2.s < 0 ? 3 : 2)) : i4 > k2 || i4 === k2 && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x2.s < 0 ? 8 : 7)); xd.length = sd; if (roundUp) { - for (; ++xd[--sd] > base2 - 1; ) { + for (; ++xd[--sd] > base3 - 1; ) { xd[sd] = 0; if (!sd) { ++e5; @@ -50377,7 +50482,7 @@ function toStringBinary(x2, baseOut, sd, rm) { i4 = baseOut == 16 ? 4 : 3; for (--len; len % i4; len++) str += "0"; - xd = convertBase(str, base2, baseOut); + xd = convertBase(str, base3, baseOut); for (len = xd.length; !xd[len - 1]; --len) ; for (i4 = 1, str = "1."; i4 < len; i4++) @@ -50473,7 +50578,7 @@ function clamp(x2, min5, max5) { function config3(obj) { if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected"); - var i4, p, v2, useDefaults = obj.defaults === true, ps = [ + var i4, p2, v2, useDefaults = obj.defaults === true, ps = [ "precision", 1, MAX_DIGITS, @@ -50497,30 +50602,30 @@ function config3(obj) { 9 ]; for (i4 = 0; i4 < ps.length; i4 += 3) { - if (p = ps[i4], useDefaults) - this[p] = DEFAULTS[p]; - if ((v2 = obj[p]) !== void 0) { + if (p2 = ps[i4], useDefaults) + this[p2] = DEFAULTS[p2]; + if ((v2 = obj[p2]) !== void 0) { if (mathfloor(v2) === v2 && v2 >= ps[i4 + 1] && v2 <= ps[i4 + 2]) - this[p] = v2; + this[p2] = v2; else - throw Error(invalidArgument + p + ": " + v2); + throw Error(invalidArgument + p2 + ": " + v2); } } - if (p = "crypto", useDefaults) - this[p] = DEFAULTS[p]; - if ((v2 = obj[p]) !== void 0) { + if (p2 = "crypto", useDefaults) + this[p2] = DEFAULTS[p2]; + if ((v2 = obj[p2]) !== void 0) { if (v2 === true || v2 === false || v2 === 0 || v2 === 1) { if (v2) { if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { - this[p] = true; + this[p2] = true; } else { throw Error(cryptoUnavailable); } } else { - this[p] = false; + this[p2] = false; } } else { - throw Error(invalidArgument + p + ": " + v2); + throw Error(invalidArgument + p2 + ": " + v2); } } return this; @@ -50532,7 +50637,7 @@ function cosh2(x2) { return new this(x2).cosh(); } function clone3(obj) { - var i4, p, ps; + var i4, p2, ps; function Decimal2(v2) { var e5, i5, t5, x2 = this; if (!(x2 instanceof Decimal2)) @@ -50669,8 +50774,8 @@ function clone3(obj) { if (obj.defaults !== true) { ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"]; for (i4 = 0; i4 < ps.length; ) - if (!obj.hasOwnProperty(p = ps[i4++])) - obj[p] = this[p]; + if (!obj.hasOwnProperty(p2 = ps[i4++])) + obj[p2] = this[p2]; } } Decimal2.config(obj); @@ -51068,10 +51173,10 @@ var createRangeClass = /* @__PURE__ */ factory(name6, dependencies6, () => { var nums = args.map(function(arg2) { return parseFloat(arg2); }); - var invalid2 = nums.some(function(num) { + var invalid4 = nums.some(function(num) { return isNaN(num); }); - if (invalid2) { + if (invalid4) { return null; } switch (nums.length) { @@ -51147,15 +51252,15 @@ var createRangeClass = /* @__PURE__ */ factory(name6, dependencies6, () => { }; Range3.prototype.map = function(callback) { var array = []; - this.forEach(function(value, index2, obj) { - array[index2[0]] = callback(value, index2, obj); + this.forEach(function(value, index3, obj) { + array[index3[0]] = callback(value, index3, obj); }); return array; }; Range3.prototype.toArray = function() { var array = []; - this.forEach(function(value, index2) { - array[index2[0]] = value; + this.forEach(function(value, index3) { + array[index3[0]] = value; }); return array; }; @@ -51206,16 +51311,16 @@ var createMatrixClass = /* @__PURE__ */ factory(name7, dependencies7, () => { Matrix2.prototype.datatype = function() { throw new Error("Cannot invoke datatype on a Matrix interface"); }; - Matrix2.prototype.create = function(data2, datatype) { + Matrix2.prototype.create = function(data3, datatype) { throw new Error("Cannot invoke create on a Matrix interface"); }; - Matrix2.prototype.subset = function(index2, replacement, defaultValue2) { + Matrix2.prototype.subset = function(index3, replacement, defaultValue2) { throw new Error("Cannot invoke subset on a Matrix interface"); }; - Matrix2.prototype.get = function(index2) { + Matrix2.prototype.get = function(index3) { throw new Error("Cannot invoke get on a Matrix interface"); }; - Matrix2.prototype.set = function(index2, value, defaultValue2) { + Matrix2.prototype.set = function(index3, value, defaultValue2) { throw new Error("Cannot invoke set on a Matrix interface"); }; Matrix2.prototype.resize = function(size2, defaultValue2) { @@ -51259,55 +51364,55 @@ var createMatrixClass = /* @__PURE__ */ factory(name7, dependencies7, () => { // node_modules/mathjs/lib/esm/utils/lruQueue.js function lruQueue(limit) { var size2 = 0; - var base2 = 1; + var base3 = 1; var queue = /* @__PURE__ */ Object.create(null); - var map4 = /* @__PURE__ */ Object.create(null); - var index2 = 0; + var map6 = /* @__PURE__ */ Object.create(null); + var index3 = 0; var del = function del2(id3) { - var oldIndex = map4[id3]; + var oldIndex = map6[id3]; if (!oldIndex) return; delete queue[oldIndex]; - delete map4[id3]; + delete map6[id3]; --size2; - if (base2 !== oldIndex) + if (base3 !== oldIndex) return; if (!size2) { - index2 = 0; - base2 = 1; + index3 = 0; + base3 = 1; return; } - while (!Object.prototype.hasOwnProperty.call(queue, ++base2)) { + while (!Object.prototype.hasOwnProperty.call(queue, ++base3)) { } }; limit = Math.abs(limit); return { hit: function hit(id3) { - var oldIndex = map4[id3]; - var nuIndex = ++index2; + var oldIndex = map6[id3]; + var nuIndex = ++index3; queue[nuIndex] = id3; - map4[id3] = nuIndex; + map6[id3] = nuIndex; if (!oldIndex) { ++size2; if (size2 <= limit) return void 0; - id3 = queue[base2]; + id3 = queue[base3]; del(id3); return id3; } delete queue[oldIndex]; - if (base2 !== oldIndex) + if (base3 !== oldIndex) return void 0; - while (!Object.prototype.hasOwnProperty.call(queue, ++base2)) { + while (!Object.prototype.hasOwnProperty.call(queue, ++base3)) { } return void 0; }, delete: del, clear: function clear() { - size2 = index2 = 0; - base2 = 1; + size2 = index3 = 0; + base3 = 1; queue = /* @__PURE__ */ Object.create(null); - map4 = /* @__PURE__ */ Object.create(null); + map6 = /* @__PURE__ */ Object.create(null); } }; } @@ -51356,35 +51461,35 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref var { Matrix: Matrix2 } = _ref; - function DenseMatrix2(data2, datatype) { + function DenseMatrix2(data3, datatype) { if (!(this instanceof DenseMatrix2)) { throw new SyntaxError("Constructor must be called with the new operator"); } if (datatype && !isString2(datatype)) { throw new Error("Invalid datatype: " + datatype); } - if (isMatrix(data2)) { - if (data2.type === "DenseMatrix") { - this._data = clone(data2._data); - this._size = clone(data2._size); - this._datatype = datatype || data2._datatype; + if (isMatrix(data3)) { + if (data3.type === "DenseMatrix") { + this._data = clone(data3._data); + this._size = clone(data3._size); + this._datatype = datatype || data3._datatype; } else { - this._data = data2.toArray(); - this._size = data2.size(); - this._datatype = datatype || data2._datatype; + this._data = data3.toArray(); + this._size = data3.size(); + this._datatype = datatype || data3._datatype; } - } else if (data2 && isArray2(data2.data) && isArray2(data2.size)) { - this._data = data2.data; - this._size = data2.size; + } else if (data3 && isArray2(data3.data) && isArray2(data3.size)) { + this._data = data3.data; + this._size = data3.size; validate(this._data, this._size); - this._datatype = datatype || data2.datatype; - } else if (isArray2(data2)) { - this._data = preprocess(data2); + this._datatype = datatype || data3.datatype; + } else if (isArray2(data3)) { + this._data = preprocess2(data3); this._size = arraySize(this._data); validate(this._data, this._size); this._datatype = datatype; - } else if (data2) { - throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")"); + } else if (data3) { + throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")"); } else { this._data = []; this._size = [0]; @@ -51392,8 +51497,8 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref } } DenseMatrix2.prototype = new Matrix2(); - DenseMatrix2.prototype.createDenseMatrix = function(data2, datatype) { - return new DenseMatrix2(data2, datatype); + DenseMatrix2.prototype.createDenseMatrix = function(data3, datatype) { + return new DenseMatrix2(data3, datatype); }; Object.defineProperty(DenseMatrix2, "name", { value: "DenseMatrix" @@ -51410,104 +51515,104 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref DenseMatrix2.prototype.datatype = function() { return this._datatype; }; - DenseMatrix2.prototype.create = function(data2, datatype) { - return new DenseMatrix2(data2, datatype); + DenseMatrix2.prototype.create = function(data3, datatype) { + return new DenseMatrix2(data3, datatype); }; - DenseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) { + DenseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) { switch (arguments.length) { case 1: - return _get(this, index2); + return _get(this, index3); case 2: case 3: - return _set(this, index2, replacement, defaultValue2); + return _set(this, index3, replacement, defaultValue2); default: throw new SyntaxError("Wrong number of arguments"); } }; - DenseMatrix2.prototype.get = function(index2) { - if (!isArray2(index2)) { + DenseMatrix2.prototype.get = function(index3) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } - for (var x2 = 0; x2 < index2.length; x2++) { - validateIndex(index2[x2], this._size[x2]); + for (var x2 = 0; x2 < index3.length; x2++) { + validateIndex(index3[x2], this._size[x2]); } - var data2 = this._data; - for (var i4 = 0, ii = index2.length; i4 < ii; i4++) { - var indexI = index2[i4]; - validateIndex(indexI, data2.length); - data2 = data2[indexI]; + var data3 = this._data; + for (var i4 = 0, ii = index3.length; i4 < ii; i4++) { + var indexI = index3[i4]; + validateIndex(indexI, data3.length); + data3 = data3[indexI]; } - return data2; + return data3; }; - DenseMatrix2.prototype.set = function(index2, value, defaultValue2) { - if (!isArray2(index2)) { + DenseMatrix2.prototype.set = function(index3, value, defaultValue2) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length < this._size.length) { - throw new DimensionError(index2.length, this._size.length, "<"); + if (index3.length < this._size.length) { + throw new DimensionError(index3.length, this._size.length, "<"); } var i4, ii, indexI; - var size2 = index2.map(function(i5) { + var size2 = index3.map(function(i5) { return i5 + 1; }); _fit(this, size2, defaultValue2); - var data2 = this._data; - for (i4 = 0, ii = index2.length - 1; i4 < ii; i4++) { - indexI = index2[i4]; - validateIndex(indexI, data2.length); - data2 = data2[indexI]; - } - indexI = index2[index2.length - 1]; - validateIndex(indexI, data2.length); - data2[indexI] = value; + var data3 = this._data; + for (i4 = 0, ii = index3.length - 1; i4 < ii; i4++) { + indexI = index3[i4]; + validateIndex(indexI, data3.length); + data3 = data3[indexI]; + } + indexI = index3[index3.length - 1]; + validateIndex(indexI, data3.length); + data3[indexI] = value; return this; }; - function _get(matrix2, index2) { - if (!isIndex(index2)) { + function _get(matrix2, index3) { + if (!isIndex(index3)) { throw new TypeError("Invalid index"); } - var isScalar = index2.isScalar(); + var isScalar = index3.isScalar(); if (isScalar) { - return matrix2.get(index2.min()); + return matrix2.get(index3.min()); } else { - var size2 = index2.size(); + var size2 = index3.size(); if (size2.length !== matrix2._size.length) { throw new DimensionError(size2.length, matrix2._size.length); } - var min5 = index2.min(); - var max5 = index2.max(); + var min5 = index3.min(); + var max5 = index3.max(); for (var i4 = 0, ii = matrix2._size.length; i4 < ii; i4++) { validateIndex(min5[i4], matrix2._size[i4]); validateIndex(max5[i4], matrix2._size[i4]); } - return new DenseMatrix2(_getSubmatrix(matrix2._data, index2, size2.length, 0), matrix2._datatype); + return new DenseMatrix2(_getSubmatrix(matrix2._data, index3, size2.length, 0), matrix2._datatype); } } - function _getSubmatrix(data2, index2, dims, dim) { + function _getSubmatrix(data3, index3, dims, dim) { var last = dim === dims - 1; - var range2 = index2.dimension(dim); + var range2 = index3.dimension(dim); if (last) { return range2.map(function(i4) { - validateIndex(i4, data2.length); - return data2[i4]; + validateIndex(i4, data3.length); + return data3[i4]; }).valueOf(); } else { return range2.map(function(i4) { - validateIndex(i4, data2.length); - var child = data2[i4]; - return _getSubmatrix(child, index2, dims, dim + 1); + validateIndex(i4, data3.length); + var child = data3[i4]; + return _getSubmatrix(child, index3, dims, dim + 1); }).valueOf(); } } - function _set(matrix2, index2, submatrix, defaultValue2) { - if (!index2 || index2.isIndex !== true) { + function _set(matrix2, index3, submatrix, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Invalid index"); } - var iSize = index2.size(); - var isScalar = index2.isScalar(); + var iSize = index3.size(); + var isScalar = index3.isScalar(); var sSize; if (isMatrix(submatrix)) { sSize = submatrix.size(); @@ -51519,7 +51624,7 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref if (sSize.length !== 0) { throw new TypeError("Scalar expected"); } - matrix2.set(index2.min(), submatrix, defaultValue2); + matrix2.set(index3.min(), submatrix, defaultValue2); } else { if (!deepStrictEqual(sSize, iSize)) { try { @@ -51550,28 +51655,28 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref if (!deepStrictEqual(iSize, sSize)) { throw new DimensionError(iSize, sSize, ">"); } - var size2 = index2.max().map(function(i5) { + var size2 = index3.max().map(function(i5) { return i5 + 1; }); _fit(matrix2, size2, defaultValue2); var dims = iSize.length; var dim = 0; - _setSubmatrix(matrix2._data, index2, submatrix, dims, dim); + _setSubmatrix(matrix2._data, index3, submatrix, dims, dim); } return matrix2; } - function _setSubmatrix(data2, index2, submatrix, dims, dim) { + function _setSubmatrix(data3, index3, submatrix, dims, dim) { var last = dim === dims - 1; - var range2 = index2.dimension(dim); + var range2 = index3.dimension(dim); if (last) { range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); - data2[dataIndex] = submatrix[subIndex[0]]; + data3[dataIndex] = submatrix[subIndex[0]]; }); } else { range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); - _setSubmatrix(data2[dataIndex], index2, submatrix[subIndex[0]], dims, dim + 1); + _setSubmatrix(data3[dataIndex], index3, submatrix[subIndex[0]], dims, dim + 1); }); } } @@ -51635,48 +51740,48 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref DenseMatrix2.prototype.map = function(callback) { var me = this; var args = maxArgumentCount(callback); - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (isArray2(value)) { return value.map(function(child, i4) { - return recurse2(child, index2.concat(i4)); + return recurse2(child, index3.concat(i4)); }); } else { if (args === 1) { return callback(value); } else if (args === 2) { - return callback(value, index2); + return callback(value, index3); } else { - return callback(value, index2, me); + return callback(value, index3, me); } } }; - var data2 = recurse(this._data, []); - var datatype = this._datatype !== void 0 ? getArrayDataType(data2, typeOf) : void 0; - return new DenseMatrix2(data2, datatype); + var data3 = recurse(this._data, []); + var datatype = this._datatype !== void 0 ? getArrayDataType(data3, typeOf) : void 0; + return new DenseMatrix2(data3, datatype); }; DenseMatrix2.prototype.forEach = function(callback) { var me = this; - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (isArray2(value)) { value.forEach(function(child, i4) { - recurse2(child, index2.concat(i4)); + recurse2(child, index3.concat(i4)); }); } else { - callback(value, index2, me); + callback(value, index3, me); } }; recurse(this._data, []); }; DenseMatrix2.prototype[Symbol.iterator] = function* () { - var recurse = function* recurse2(value, index2) { + var recurse = function* recurse2(value, index3) { if (isArray2(value)) { for (var i4 = 0; i4 < value.length; i4++) { - yield* recurse2(value[i4], index2.concat(i4)); + yield* recurse2(value[i4], index3.concat(i4)); } } else { yield { value, - index: index2 + index: index3 }; } }; @@ -51688,8 +51793,8 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref if (s4.length !== 2) { throw new TypeError("Rows can only be returned for a 2D matrix."); } - var data2 = this._data; - for (var row2 of data2) { + var data3 = this._data; + for (var row2 of data3) { result.push(new DenseMatrix2([row2], this._datatype)); } return result; @@ -51701,9 +51806,9 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref if (s4.length !== 2) { throw new TypeError("Rows can only be returned for a 2D matrix."); } - var data2 = this._data; + var data3 = this._data; var _loop = function _loop2(i5) { - var col = data2.map((row2) => [row2[i5]]); + var col = data3.map((row2) => [row2[i5]]); result.push(new DenseMatrix2(col, _this._datatype)); }; for (var i4 = 0; i4 < s4[1]; i4++) { @@ -51747,12 +51852,12 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref var rows = this._size[0]; var columns = this._size[1]; var n3 = Math.min(rows - kSub, columns - kSuper); - var data2 = []; + var data3 = []; for (var i4 = 0; i4 < n3; i4++) { - data2[i4] = this._data[i4 + kSub][i4 + kSuper]; + data3[i4] = this._data[i4 + kSub][i4 + kSuper]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [n3], datatype: this._datatype }); @@ -51812,15 +51917,15 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref if (!defaultValue2) { defaultValue2 = isBigNumber(_value(0)) ? _value(0).mul(0) : 0; } - var data2 = []; + var data3 = []; if (size2.length > 0) { - data2 = resize(data2, size2, defaultValue2); + data3 = resize(data3, size2, defaultValue2); for (var d4 = 0; d4 < n3; d4++) { - data2[d4 + kSub][d4 + kSuper] = _value(d4); + data3[d4 + kSub][d4 + kSuper] = _value(d4); } } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, columns] }); }; @@ -51839,19 +51944,19 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name8, dependencies8, (_ref DenseMatrix2._swapRows(i4, j, this._data); return this; }; - DenseMatrix2._swapRows = function(i4, j, data2) { - var vi = data2[i4]; - data2[i4] = data2[j]; - data2[j] = vi; + DenseMatrix2._swapRows = function(i4, j, data3) { + var vi = data3[i4]; + data3[i4] = data3[j]; + data3[j] = vi; }; - function preprocess(data2) { - if (isMatrix(data2)) { - return preprocess(data2.valueOf()); + function preprocess2(data3) { + if (isMatrix(data3)) { + return preprocess2(data3.valueOf()); } - if (isArray2(data2)) { - return data2.map(preprocess); + if (isArray2(data3)) { + return data3.map(preprocess2); } - return data2; + return data3; } return DenseMatrix2; }, { @@ -51953,7 +52058,7 @@ function _reduce(mat, dim, callback) { return ret; } } -function scatter(a4, j, w2, x2, u3, mark, cindex, f2, inverse, update, value) { +function scatter(a4, j, w2, x2, u3, mark2, cindex, f2, inverse, update, value) { var avalues = a4._values; var aindex = a4._index; var aptr = a4._ptr; @@ -51961,28 +52066,28 @@ function scatter(a4, j, w2, x2, u3, mark, cindex, f2, inverse, update, value) { if (x2) { for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = aindex[k2]; - if (w2[i4] !== mark) { - w2[i4] = mark; + if (w2[i4] !== mark2) { + w2[i4] = mark2; cindex.push(i4); if (update) { x2[i4] = inverse ? f2(avalues[k2], value) : f2(value, avalues[k2]); - u3[i4] = mark; + u3[i4] = mark2; } else { x2[i4] = avalues[k2]; } } else { x2[i4] = inverse ? f2(avalues[k2], x2[i4]) : f2(x2[i4], avalues[k2]); - u3[i4] = mark; + u3[i4] = mark2; } } } else { for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = aindex[k2]; - if (w2[i4] !== mark) { - w2[i4] = mark; + if (w2[i4] !== mark2) { + w2[i4] = mark2; cindex.push(i4); } else { - u3[i4] = mark; + u3[i4] = mark2; } } } @@ -52107,15 +52212,15 @@ function modNumber(x2, y3) { } modNumber.signature = n2; function nthRootNumber(a4) { - var root = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2; - var inv2 = root < 0; + var root4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2; + var inv2 = root4 < 0; if (inv2) { - root = -root; + root4 = -root4; } - if (root === 0) { + if (root4 === 0) { throw new Error("Root must be non-zero"); } - if (a4 < 0 && Math.abs(root) % 2 !== 1) { + if (a4 < 0 && Math.abs(root4) % 2 !== 1) { throw new Error("Root must be odd when a is negative."); } if (a4 === 0) { @@ -52124,7 +52229,7 @@ function nthRootNumber(a4) { if (!isFinite(a4)) { return inv2 ? 0 : a4; } - var x2 = Math.pow(Math.abs(a4), 1 / root); + var x2 = Math.pow(Math.abs(a4), 1 / root4); x2 = a4 < 0 ? -x2 : x2; return inv2 ? 1 / x2 : x2; } @@ -52363,12 +52468,12 @@ function lgammaNumber(n3) { return Math.log(Math.PI / Math.sin(Math.PI * n3)) - lgammaNumber(1 - n3); } n3 = n3 - 1; - var base2 = n3 + lgammaG + 0.5; + var base3 = n3 + lgammaG + 0.5; var sum4 = lgammaSeries[0]; for (var i4 = lgammaN - 1; i4 >= 1; i4--) { sum4 += lgammaSeries[i4] / (n3 + i4); } - return lnSqrt2PI + (n3 + 0.5) * Math.log(base2) - base2 + Math.log(sum4); + return lnSqrt2PI + (n3 + 0.5) * Math.log(base3) - base3 + Math.log(sum4); } lgammaNumber.signature = "number"; @@ -52551,7 +52656,7 @@ var createHasNumericValue = /* @__PURE__ */ factory(name13, dependencies13, (_re } = _ref; return typed3(name13, { boolean: () => true, - string: function string4(x2) { + string: function string6(x2) { return x2.trim().length > 0 && !isNaN(Number(x2)); }, any: function any(x2) { @@ -52735,25 +52840,25 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ equalScalar: equalScalar2, Matrix: Matrix2 } = _ref; - function SparseMatrix2(data2, datatype) { + function SparseMatrix2(data3, datatype) { if (!(this instanceof SparseMatrix2)) { throw new SyntaxError("Constructor must be called with the new operator"); } if (datatype && !isString2(datatype)) { throw new Error("Invalid datatype: " + datatype); } - if (isMatrix(data2)) { - _createFromMatrix(this, data2, datatype); - } else if (data2 && isArray2(data2.index) && isArray2(data2.ptr) && isArray2(data2.size)) { - this._values = data2.values; - this._index = data2.index; - this._ptr = data2.ptr; - this._size = data2.size; - this._datatype = datatype || data2.datatype; - } else if (isArray2(data2)) { - _createFromArray(this, data2, datatype); - } else if (data2) { - throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")"); + if (isMatrix(data3)) { + _createFromMatrix(this, data3, datatype); + } else if (data3 && isArray2(data3.index) && isArray2(data3.ptr) && isArray2(data3.size)) { + this._values = data3.values; + this._index = data3.index; + this._ptr = data3.ptr; + this._size = data3.size; + this._datatype = datatype || data3.datatype; + } else if (isArray2(data3)) { + _createFromArray(this, data3, datatype); + } else if (data3) { + throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")"); } else { this._values = []; this._index = []; @@ -52773,12 +52878,12 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ _createFromArray(matrix2, source.valueOf(), datatype || source._datatype); } } - function _createFromArray(matrix2, data2, datatype) { + function _createFromArray(matrix2, data3, datatype) { matrix2._values = []; matrix2._index = []; matrix2._ptr = []; matrix2._datatype = datatype; - var rows = data2.length; + var rows = data3.length; var columns = 0; var eq = equalScalar2; var zero = 0; @@ -52791,7 +52896,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ do { matrix2._ptr.push(matrix2._index.length); for (var i4 = 0; i4 < rows; i4++) { - var row2 = data2[i4]; + var row2 = data3[i4]; if (isArray2(row2)) { if (j === 0 && columns < row2.length) { columns = row2.length; @@ -52820,8 +52925,8 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ matrix2._size = [rows, columns]; } SparseMatrix2.prototype = new Matrix2(); - SparseMatrix2.prototype.createSparseMatrix = function(data2, datatype) { - return new SparseMatrix2(data2, datatype); + SparseMatrix2.prototype.createSparseMatrix = function(data3, datatype) { + return new SparseMatrix2(data3, datatype); }; Object.defineProperty(SparseMatrix2, "name", { value: "SparseMatrix" @@ -52838,24 +52943,24 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ SparseMatrix2.prototype.datatype = function() { return this._datatype; }; - SparseMatrix2.prototype.create = function(data2, datatype) { - return new SparseMatrix2(data2, datatype); + SparseMatrix2.prototype.create = function(data3, datatype) { + return new SparseMatrix2(data3, datatype); }; SparseMatrix2.prototype.density = function() { var rows = this._size[0]; var columns = this._size[1]; return rows !== 0 && columns !== 0 ? this._index.length / (rows * columns) : 0; }; - SparseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) { + SparseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) { if (!this._values) { throw new Error("Cannot invoke subset on a Pattern only matrix"); } switch (arguments.length) { case 1: - return _getsubset(this, index2); + return _getsubset(this, index3); case 2: case 3: - return _setsubset(this, index2, replacement, defaultValue2); + return _setsubset(this, index3, replacement, defaultValue2); default: throw new SyntaxError("Wrong number of arguments"); } @@ -52891,35 +52996,35 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ w2[i5] = true; }); var values2 = mvalues ? [] : void 0; - var index2 = []; + var index3 = []; var ptr = []; columns.forEach(function(j) { - ptr.push(index2.length); + ptr.push(index3.length); for (k2 = mptr[j], kk = mptr[j + 1]; k2 < kk; k2++) { i4 = mindex[k2]; if (w2[i4] === true) { - index2.push(pv[i4]); + index3.push(pv[i4]); if (values2) { values2.push(mvalues[k2]); } } } }); - ptr.push(index2.length); + ptr.push(index3.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: size2, datatype: matrix2._datatype }); } - function _setsubset(matrix2, index2, submatrix, defaultValue2) { - if (!index2 || index2.isIndex !== true) { + function _setsubset(matrix2, index3, submatrix, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Invalid index"); } - var iSize = index2.size(); - var isScalar = index2.isScalar(); + var iSize = index3.size(); + var isScalar = index3.isScalar(); var sSize; if (isMatrix(submatrix)) { sSize = submatrix.size(); @@ -52931,7 +53036,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ if (sSize.length !== 0) { throw new TypeError("Scalar expected"); } - matrix2.set(index2.min(), submatrix, defaultValue2); + matrix2.set(index3.min(), submatrix, defaultValue2); } else { if (iSize.length !== 1 && iSize.length !== 2) { throw new DimensionError(iSize.length, matrix2._size.length, "<"); @@ -52952,14 +53057,14 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ throw new DimensionError(iSize, sSize, ">"); } if (iSize.length === 1) { - var range2 = index2.dimension(0); + var range2 = index3.dimension(0); range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); matrix2.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue2); }); } else { - var firstDimensionRange = index2.dimension(0); - var secondDimensionRange = index2.dimension(1); + var firstDimensionRange = index3.dimension(0); + var secondDimensionRange = index3.dimension(1); firstDimensionRange.forEach(function(firstDataIndex, firstSubIndex) { validateIndex(firstDataIndex); secondDimensionRange.forEach(function(secondDataIndex, secondSubIndex) { @@ -52971,18 +53076,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ } return matrix2; } - SparseMatrix2.prototype.get = function(index2) { - if (!isArray2(index2)) { + SparseMatrix2.prototype.get = function(index3) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } if (!this._values) { throw new Error("Cannot invoke get on a Pattern only matrix"); } - var i4 = index2[0]; - var j = index2[1]; + var i4 = index3[0]; + var j = index3[1]; validateIndex(i4, this._size[0]); validateIndex(j, this._size[1]); var k2 = _getValueIndex(i4, this._ptr[j], this._ptr[j + 1], this._index); @@ -52991,18 +53096,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ } return 0; }; - SparseMatrix2.prototype.set = function(index2, v2, defaultValue2) { - if (!isArray2(index2)) { + SparseMatrix2.prototype.set = function(index3, v2, defaultValue2) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } if (!this._values) { throw new Error("Cannot invoke set on a Pattern only matrix"); } - var i4 = index2[0]; - var j = index2[1]; + var i4 = index3[0]; + var j = index3[1]; var rows = this._size[0]; var columns = this._size[1]; var eq = equalScalar2; @@ -53032,27 +53137,27 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ } return this; }; - function _getValueIndex(i4, top, bottom, index2) { + function _getValueIndex(i4, top, bottom, index3) { if (bottom - top === 0) { return bottom; } for (var r2 = top; r2 < bottom; r2++) { - if (index2[r2] === i4) { + if (index3[r2] === i4) { return r2; } } return top; } - function _remove(k2, j, values2, index2, ptr) { + function _remove(k2, j, values2, index3, ptr) { values2.splice(k2, 1); - index2.splice(k2, 1); + index3.splice(k2, 1); for (var x2 = j + 1; x2 < ptr.length; x2++) { ptr[x2]--; } } - function _insert(k2, i4, j, v2, values2, index2, ptr) { + function _insert(k2, i4, j, v2, values2, index3, ptr) { values2.splice(k2, 0, v2); - index2.splice(k2, 0, i4); + index3.splice(k2, 0, i4); for (var x2 = j + 1; x2 < ptr.length; x2++) { ptr[x2]++; } @@ -53111,10 +53216,10 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ for (j = 0; j < c3; j++) { matrix2._ptr[j] = matrix2._ptr[j] + n3; k2 = matrix2._ptr[j + 1] + n3; - var p = 0; - for (i4 = r2; i4 < rows; i4++, p++) { - matrix2._values.splice(k2 + p, 0, value); - matrix2._index.splice(k2 + p, 0, i4); + var p2 = 0; + for (i4 = r2; i4 < rows; i4++, p2++) { + matrix2._values.splice(k2 + p2, 0, value); + matrix2._index.splice(k2 + p2, 0, i4); n3++; } } @@ -53226,7 +53331,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ }; function _map3(matrix2, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) { var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; var eq = equalScalar2; var zero = 0; @@ -53238,7 +53343,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ v2 = callback(v2, x2, y3); if (!eq(v2, zero)) { values2.push(v2); - index2.push(x2); + index3.push(x2); } }; for (var j = minColumn; j <= maxColumn; j++) { @@ -53267,7 +53372,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [maxRow - minRow + 1, maxColumn - minColumn + 1] }); @@ -53323,7 +53428,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ SparseMatrix2.prototype.valueOf = function() { return _toArray(this._values, this._index, this._ptr, this._size, false); }; - function _toArray(values2, index2, ptr, size2, copy) { + function _toArray(values2, index3, ptr, size2, copy) { var rows = size2[0]; var columns = size2[1]; var a4 = []; @@ -53338,7 +53443,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - i4 = index2[k2]; + i4 = index3[k2]; a4[i4][j] = values2 ? copy ? clone(values2[k2]) : values2[k2] : 1; } } @@ -53389,7 +53494,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ var columns = this._size[1]; var n3 = Math.min(rows - kSub, columns - kSuper); var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; ptr[0] = 0; for (var j = kSuper; j < columns && values2.length < n3; j++) { @@ -53399,7 +53504,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ var i4 = this._index[x2]; if (i4 === j - kSuper + kSub) { values2.push(this._values[x2]); - index2[values2.length - 1] = i4 - kSub; + index3[values2.length - 1] = i4 - kSub; break; } } @@ -53407,7 +53512,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [n3, 1] }); @@ -53474,7 +53579,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ }; } var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; for (var j = 0; j < columns; j++) { ptr.push(values2.length); @@ -53482,7 +53587,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ if (i4 >= 0 && i4 < n3) { var v2 = _value(i4); if (!eq(v2, zero)) { - index2.push(i4 + kSub); + index3.push(i4 + kSub); values2.push(v2); } } @@ -53490,7 +53595,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [rows, columns] }); @@ -53507,20 +53612,20 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ SparseMatrix2._swapRows(i4, j, this._size[1], this._values, this._index, this._ptr); return this; }; - SparseMatrix2._forEachRow = function(j, values2, index2, ptr, callback) { + SparseMatrix2._forEachRow = function(j, values2, index3, ptr, callback) { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - callback(index2[k2], values2[k2]); + callback(index3[k2], values2[k2]); } }; - SparseMatrix2._swapRows = function(x2, y3, columns, values2, index2, ptr) { + SparseMatrix2._swapRows = function(x2, y3, columns, values2, index3, ptr) { for (var j = 0; j < columns; j++) { var k0 = ptr[j]; var k1 = ptr[j + 1]; - var kx = _getValueIndex(x2, k0, k1, index2); - var ky = _getValueIndex(y3, k0, k1, index2); - if (kx < k1 && ky < k1 && index2[kx] === x2 && index2[ky] === y3) { + var kx = _getValueIndex(x2, k0, k1, index3); + var ky = _getValueIndex(y3, k0, k1, index3); + if (kx < k1 && ky < k1 && index3[kx] === x2 && index3[ky] === y3) { if (values2) { var v2 = values2[kx]; values2[kx] = values2[ky]; @@ -53528,25 +53633,25 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name19, dependencies19, (_ } continue; } - if (kx < k1 && index2[kx] === x2 && (ky >= k1 || index2[ky] !== y3)) { + if (kx < k1 && index3[kx] === x2 && (ky >= k1 || index3[ky] !== y3)) { var vx = values2 ? values2[kx] : void 0; - index2.splice(ky, 0, y3); + index3.splice(ky, 0, y3); if (values2) { values2.splice(ky, 0, vx); } - index2.splice(ky <= kx ? kx + 1 : kx, 1); + index3.splice(ky <= kx ? kx + 1 : kx, 1); if (values2) { values2.splice(ky <= kx ? kx + 1 : kx, 1); } continue; } - if (ky < k1 && index2[ky] === y3 && (kx >= k1 || index2[kx] !== x2)) { + if (ky < k1 && index3[ky] === y3 && (kx >= k1 || index3[kx] !== x2)) { var vy = values2 ? values2[ky] : void 0; - index2.splice(kx, 0, x2); + index3.splice(kx, 0, x2); if (values2) { values2.splice(kx, 0, vy); } - index2.splice(kx <= ky ? ky + 1 : ky, 1); + index3.splice(kx <= ky ? ky + 1 : ky, 1); if (values2) { values2.splice(kx <= ky ? ky + 1 : ky, 1); } @@ -53598,14 +53703,14 @@ var createNumber = /* @__PURE__ */ factory(name20, dependencies20, (_ref) => { var { typed: typed3 } = _ref; - var number4 = typed3("number", { + var number5 = typed3("number", { "": function _15() { return 0; }, - number: function number5(x2) { + number: function number6(x2) { return x2; }, - string: function string4(x2) { + string: function string6(x2) { if (x2 === "NaN") return NaN; var nonDecimalNumberParts = getNonDecimalNumberParts(x2); @@ -53651,10 +53756,10 @@ var createNumber = /* @__PURE__ */ factory(name20, dependencies20, (_ref) => { }, "Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2)) }); - number4.fromJSON = function(json) { + number5.fromJSON = function(json) { return parseFloat(json.value); }; - return number4; + return number5; }); // node_modules/mathjs/lib/esm/type/string.js @@ -53672,10 +53777,10 @@ var createString = /* @__PURE__ */ factory(name21, dependencies21, (_ref) => { null: function _null2(x2) { return "null"; }, - boolean: function boolean2(x2) { + boolean: function boolean3(x2) { return x2 + ""; }, - string: function string4(x2) { + string: function string6(x2) { return x2; }, "Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2)), @@ -53696,10 +53801,10 @@ var createBoolean = /* @__PURE__ */ factory(name22, dependencies22, (_ref) => { "": function _15() { return false; }, - boolean: function boolean2(x2) { + boolean: function boolean3(x2) { return x2; }, - number: function number4(x2) { + number: function number5(x2) { return !!x2; }, null: function _null2(x2) { @@ -53708,7 +53813,7 @@ var createBoolean = /* @__PURE__ */ factory(name22, dependencies22, (_ref) => { BigNumber: function BigNumber2(x2) { return !x2.isZero(); }, - string: function string4(x2) { + string: function string6(x2) { var lcase = x2.toLowerCase(); if (lcase === "true") { return true; @@ -53737,10 +53842,10 @@ var createBignumber = /* @__PURE__ */ factory(name23, dependencies23, (_ref) => "": function _15() { return new BigNumber2(0); }, - number: function number4(x2) { + number: function number5(x2) { return new BigNumber2(x2 + ""); }, - string: function string4(x2) { + string: function string6(x2) { var wordSizeSuffixMatch = x2.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/); if (wordSizeSuffixMatch) { var size2 = wordSizeSuffixMatch[2]; @@ -53788,7 +53893,7 @@ var createComplex = /* @__PURE__ */ factory(name24, dependencies24, (_ref) => { "": function _15() { return Complex3.ZERO; }, - number: function number4(x2) { + number: function number5(x2) { return new Complex3(x2, 0); }, "number, number": function numberNumber(re2, im2) { @@ -53803,7 +53908,7 @@ var createComplex = /* @__PURE__ */ factory(name24, dependencies24, (_ref) => { Complex: function Complex4(x2) { return x2.clone(); }, - string: function string4(x2) { + string: function string6(x2) { return Complex3(x2); }, null: function _null2(x2) { @@ -53831,13 +53936,13 @@ var createFraction = /* @__PURE__ */ factory(name25, dependencies25, (_ref) => { Fraction: Fraction3 } = _ref; return typed3("fraction", { - number: function number4(x2) { + number: function number5(x2) { if (!isFinite(x2) || isNaN(x2)) { throw new Error(x2 + " cannot be represented as a fraction"); } return new Fraction3(x2); }, - string: function string4(x2) { + string: function string6(x2) { return new Fraction3(x2); }, "number, number": function numberNumber(numerator, denominator) { @@ -53878,27 +53983,27 @@ var createMatrix = /* @__PURE__ */ factory(name26, dependencies26, (_ref) => { "": function _15() { return _create([]); }, - string: function string4(format8) { + string: function string6(format8) { return _create([], format8); }, "string, string": function stringString(format8, datatype) { return _create([], format8, datatype); }, - Array: function Array2(data2) { - return _create(data2); + Array: function Array2(data3) { + return _create(data3); }, - Matrix: function Matrix3(data2) { - return _create(data2, data2.storage()); + Matrix: function Matrix3(data3) { + return _create(data3, data3.storage()); }, "Array | Matrix, string": _create, "Array | Matrix, string, string": _create }); - function _create(data2, format8, datatype) { + function _create(data3, format8, datatype) { if (format8 === "dense" || format8 === "default" || format8 === void 0) { - return new DenseMatrix2(data2, datatype); + return new DenseMatrix2(data3, datatype); } if (format8 === "sparse") { - return new SparseMatrix2(data2, datatype); + return new SparseMatrix2(data3, datatype); } throw new TypeError("Unknown matrix type " + JSON.stringify(format8) + "."); } @@ -53941,11 +54046,11 @@ var createMatrixFromFunction = /* @__PURE__ */ factory(name27, dependencies27, ( m4 = matrix2(format8); } m4.resize(size2); - m4.forEach(function(_15, index2) { - var val = fn(index2); + m4.forEach(function(_15, index3) { + var val = fn(index3); if (isZero2(val)) return; - m4.set(index2, val); + m4.set(index3, val); }); return m4; } @@ -54293,8 +54398,8 @@ var createCbrt = /* @__PURE__ */ factory(name37, dependencies37, (_ref) => { var abs3 = x2.abs(); var principal = new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3).exp()); if (allRoots) { - var all2 = [principal, new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 + Math.PI * 2 / 3).exp()), new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 - Math.PI * 2 / 3).exp())]; - return config4.matrix === "Array" ? all2 : matrix2(all2); + var all6 = [principal, new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 + Math.PI * 2 / 3).exp()), new Complex3(cbrtNumber(abs3), 0).mul(new Complex3(0, arg3 - Math.PI * 2 / 3).exp())]; + return config4.matrix === "Array" ? all6 : matrix2(all6); } else { return principal; } @@ -54347,16 +54452,16 @@ var createMatAlgo11xS0s = /* @__PURE__ */ factory(name38, dependencies38, (_ref) } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - b2 = typed3.convert(b2, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + b2 = typed3.convert(b2, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = []; var cindex = []; @@ -54378,7 +54483,7 @@ var createMatAlgo11xS0s = /* @__PURE__ */ factory(name38, dependencies38, (_ref) index: cindex, ptr: cptr, size: [rows, columns], - datatype: dt + datatype: dt2 }); }; }); @@ -54402,28 +54507,28 @@ var createMatAlgo12xSfs = /* @__PURE__ */ factory(name39, dependencies39, (_ref) } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var cf = callback; if (typeof adt === "string") { - dt = adt; - b2 = typed3.convert(b2, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + b2 = typed3.convert(b2, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cdata = []; var x2 = []; var w2 = []; for (var j = 0; j < columns; j++) { - var mark = j + 1; + var mark2 = j + 1; for (var k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { var r2 = aindex[k2]; x2[r2] = avalues[k2]; - w2[r2] = mark; + w2[r2] = mark2; } for (var i4 = 0; i4 < rows; i4++) { if (j === 0) { cdata[i4] = []; } - if (w2[i4] === mark) { + if (w2[i4] === mark2) { cdata[i4][j] = inverse ? cf(b2, x2[i4]) : cf(x2[i4], b2); } else { cdata[i4][j] = inverse ? cf(b2, 0) : cf(0, b2); @@ -54433,7 +54538,7 @@ var createMatAlgo12xSfs = /* @__PURE__ */ factory(name39, dependencies39, (_ref) return new DenseMatrix2({ data: cdata, size: [rows, columns], - datatype: dt + datatype: dt2 }); }; }); @@ -54449,18 +54554,18 @@ var createMatAlgo14xDs = /* @__PURE__ */ factory(name40, dependencies40, (_ref) var adata = a4._data; var asize = a4._size; var adt = a4._datatype; - var dt; + var dt2; var cf = callback; if (typeof adt === "string") { - dt = adt; - b2 = typed3.convert(b2, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + b2 = typed3.convert(b2, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cdata = asize.length > 0 ? _iterate(cf, 0, asize, asize[0], adata, b2, inverse) : []; return a4.createDenseMatrix({ data: cdata, size: clone(asize), - datatype: dt + datatype: dt2 }); }; function _iterate(f2, level, s4, n3, av, bv, inverse) { @@ -54488,7 +54593,7 @@ var createCeilNumber = /* @__PURE__ */ factory(name41, ["typed", "config", "roun round: round3 } = _ref; return typed3(name41, { - number: function number4(x2) { + number: function number5(x2) { if (nearlyEqual(x2, round3(x2), config4.epsilon)) { return round3(x2); } else { @@ -54499,10 +54604,10 @@ var createCeilNumber = /* @__PURE__ */ factory(name41, ["typed", "config", "roun if (nearlyEqual(x2, round3(x2, n3), config4.epsilon)) { return round3(x2, n3); } else { - var [number4, exponent] = "".concat(x2, "e").split("e"); - var result = Math.ceil(Number("".concat(number4, "e").concat(Number(exponent) + n3))); - [number4, exponent] = "".concat(result, "e").split("e"); - return Number("".concat(number4, "e").concat(Number(exponent) - n3)); + var [number5, exponent] = "".concat(x2, "e").split("e"); + var result = Math.ceil(Number("".concat(number5, "e").concat(Number(exponent) + n3))); + [number5, exponent] = "".concat(result, "e").split("e"); + return Number("".concat(number5, "e").concat(Number(exponent) - n3)); } } }); @@ -54666,7 +54771,7 @@ var createFixNumber = /* @__PURE__ */ factory(name45, ["typed", "ceil", "floor"] floor: floor3 } = _ref; return typed3(name45, { - number: function number4(x2) { + number: function number5(x2) { return x2 > 0 ? floor3(x2) : ceil3(x2); }, "number, number": function numberNumber(x2, n3) { @@ -54752,7 +54857,7 @@ var createFloorNumber = /* @__PURE__ */ factory(name46, ["typed", "config", "rou round: round3 } = _ref; return typed3(name46, { - number: function number4(x2) { + number: function number5(x2) { if (nearlyEqual(x2, round3(x2), config4.epsilon)) { return round3(x2); } else { @@ -54763,10 +54868,10 @@ var createFloorNumber = /* @__PURE__ */ factory(name46, ["typed", "config", "rou if (nearlyEqual(x2, round3(x2, n3), config4.epsilon)) { return round3(x2, n3); } else { - var [number4, exponent] = "".concat(x2, "e").split("e"); - var result = Math.floor(Number("".concat(number4, "e").concat(Number(exponent) + n3))); - [number4, exponent] = "".concat(result, "e").split("e"); - return Number("".concat(number4, "e").concat(Number(exponent) - n3)); + var [number5, exponent] = "".concat(x2, "e").split("e"); + var result = Math.floor(Number("".concat(number5, "e").concat(Number(exponent) + n3))); + [number5, exponent] = "".concat(result, "e").split("e"); + return Number("".concat(number5, "e").concat(Number(exponent) - n3)); } } }); @@ -54886,15 +54991,15 @@ var createMatAlgo02xDS0 = /* @__PURE__ */ factory(name47, dependencies47, (_ref) } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = []; var cindex = []; @@ -54916,7 +55021,7 @@ var createMatAlgo02xDS0 = /* @__PURE__ */ factory(name47, dependencies47, (_ref) index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0 + datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0 }); }; }); @@ -54948,13 +55053,13 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref) } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cdata = []; for (var z2 = 0; z2 < rows; z2++) { @@ -54963,14 +55068,14 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref) var x2 = []; var w2 = []; for (var j = 0; j < columns; j++) { - var mark = j + 1; + var mark2 = j + 1; for (var k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) { var i4 = bindex[k2]; x2[i4] = inverse ? cf(bvalues[k2], adata[i4][j]) : cf(adata[i4][j], bvalues[k2]); - w2[i4] = mark; + w2[i4] = mark2; } for (var y3 = 0; y3 < rows; y3++) { - if (w2[y3] === mark) { + if (w2[y3] === mark2) { cdata[y3][j] = x2[y3]; } else { cdata[y3][j] = inverse ? cf(zero, adata[y3][j]) : cf(adata[y3][j], zero); @@ -54980,7 +55085,7 @@ var createMatAlgo03xDSf = /* @__PURE__ */ factory(name48, dependencies48, (_ref) return denseMatrix.createDenseMatrix({ data: cdata, size: [rows, columns], - datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0 + datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0 }); }; }); @@ -55012,15 +55117,15 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = avalues && bvalues ? [] : void 0; var cindex = []; @@ -55032,21 +55137,21 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref var i4, j, k2, k1; for (j = 0; j < columns; j++) { cptr[j] = cindex.length; - var mark = j + 1; + var mark2 = j + 1; for (k2 = aptr[j], k1 = aptr[j + 1]; k2 < k1; k2++) { i4 = aindex[k2]; cindex.push(i4); - wa[i4] = mark; + wa[i4] = mark2; if (xa) { xa[i4] = avalues[k2]; } } for (k2 = bptr[j], k1 = bptr[j + 1]; k2 < k1; k2++) { i4 = bindex[k2]; - if (wa[i4] !== mark) { + if (wa[i4] !== mark2) { cindex.push(i4); } - wb[i4] = mark; + wb[i4] = mark2; if (xb) { xb[i4] = bvalues[k2]; } @@ -55057,9 +55162,9 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref i4 = cindex[k2]; var wai = wa[i4]; var wbi = wb[i4]; - if (wai === mark || wbi === mark) { - var va = wai === mark ? xa[i4] : zero; - var vb = wbi === mark ? xb[i4] : zero; + if (wai === mark2 || wbi === mark2) { + var va = wai === mark2 ? xa[i4] : zero; + var vb = wbi === mark2 ? xb[i4] : zero; var vc = cf(va, vb); if (!eq(vc, zero)) { cvalues.push(vc); @@ -55077,7 +55182,7 @@ var createMatAlgo05xSfSf = /* @__PURE__ */ factory(name49, dependencies49, (_ref index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; }); @@ -55106,17 +55211,17 @@ var createMatAlgo13xDD = /* @__PURE__ */ factory(name50, dependencies50, (_ref) } csize[s4] = asize[s4]; } - var dt; + var dt2; var cf = callback; if (typeof adt === "string" && adt === bdt) { - dt = adt; - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + cf = typed3.find(callback, [dt2, dt2]); } var cdata = csize.length > 0 ? _iterate(cf, 0, csize, csize[0], adata, bdata) : []; return a4.createDenseMatrix({ data: cdata, size: csize, - datatype: dt + datatype: dt2 }); }; function _iterate(f2, level, s4, n3, av, bv) { @@ -55402,8 +55507,8 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref } var rows = asize[0]; var columns = asize[1]; - var dt = typeof adt === "string" && adt !== "mixed" && adt === bdt ? adt : void 0; - var cf = dt ? typed3.find(callback, [dt, dt]) : callback; + var dt2 = typeof adt === "string" && adt !== "mixed" && adt === bdt ? adt : void 0; + var cf = dt2 ? typed3.find(callback, [dt2, dt2]) : callback; var i4, j; var cdata = []; for (i4 = 0; i4 < rows; i4++) { @@ -55412,14 +55517,14 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref var x2 = []; var w2 = []; for (j = 0; j < columns; j++) { - var mark = j + 1; + var mark2 = j + 1; for (var k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = bindex[k2]; x2[i4] = inverse ? cf(bvalues[k2], adata[i4][j]) : cf(adata[i4][j], bvalues[k2]); - w2[i4] = mark; + w2[i4] = mark2; } for (i4 = 0; i4 < rows; i4++) { - if (w2[i4] === mark) { + if (w2[i4] === mark2) { cdata[i4][j] = x2[i4]; } else { cdata[i4][j] = adata[i4][j]; @@ -55429,7 +55534,7 @@ var createMatAlgo01xDSid = /* @__PURE__ */ factory(name54, dependencies53, (_ref return denseMatrix.createDenseMatrix({ data: cdata, size: [rows, columns], - datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : void 0 + datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt2 : void 0 }); }; }); @@ -55461,15 +55566,15 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = avalues && bvalues ? [] : void 0; var cindex = []; @@ -55481,18 +55586,18 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r var i4, j, k2, k0, k1; for (j = 0; j < columns; j++) { cptr[j] = cindex.length; - var mark = j + 1; + var mark2 = j + 1; for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = aindex[k2]; cindex.push(i4); - wa[i4] = mark; + wa[i4] = mark2; if (xa) { xa[i4] = avalues[k2]; } } for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = bindex[k2]; - if (wa[i4] === mark) { + if (wa[i4] === mark2) { if (xa) { var v2 = cf(xa[i4], bvalues[k2]); if (!eq(v2, zero)) { @@ -55503,7 +55608,7 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r } } else { cindex.push(i4); - wb[i4] = mark; + wb[i4] = mark2; if (xb) { xb[i4] = bvalues[k2]; } @@ -55513,10 +55618,10 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r k2 = cptr[j]; while (k2 < cindex.length) { i4 = cindex[k2]; - if (wa[i4] === mark) { + if (wa[i4] === mark2) { cvalues[k2] = xa[i4]; k2++; - } else if (wb[i4] === mark) { + } else if (wb[i4] === mark2) { cvalues[k2] = xb[i4]; k2++; } else { @@ -55531,7 +55636,7 @@ var createMatAlgo04xSidSid = /* @__PURE__ */ factory(name55, dependencies54, (_r index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; }); @@ -55555,28 +55660,28 @@ var createMatAlgo10xSids = /* @__PURE__ */ factory(name56, dependencies55, (_ref } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var cf = callback; if (typeof adt === "string") { - dt = adt; - b2 = typed3.convert(b2, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + b2 = typed3.convert(b2, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cdata = []; var x2 = []; var w2 = []; for (var j = 0; j < columns; j++) { - var mark = j + 1; + var mark2 = j + 1; for (var k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { var r2 = aindex[k2]; x2[r2] = avalues[k2]; - w2[r2] = mark; + w2[r2] = mark2; } for (var i4 = 0; i4 < rows; i4++) { if (j === 0) { cdata[i4] = []; } - if (w2[i4] === mark) { + if (w2[i4] === mark2) { cdata[i4][j] = inverse ? cf(b2, x2[i4]) : cf(x2[i4], b2); } else { cdata[i4][j] = b2; @@ -55586,7 +55691,7 @@ var createMatAlgo10xSids = /* @__PURE__ */ factory(name56, dependencies55, (_ref return new DenseMatrix2({ data: cdata, size: [rows, columns], - datatype: dt + datatype: dt2 }); }; }); @@ -55614,7 +55719,7 @@ var dependencies56 = ["typed", "config", "round", "matrix", "equalScalar", "zero var gcdTypes = "number | BigNumber | Fraction | Matrix | Array"; var gcdManyTypesSignature = "".concat(gcdTypes, ", ").concat(gcdTypes, ", ...").concat(gcdTypes); function is1d(array) { - return !array.some((element) => Array.isArray(element)); + return !array.some((element3) => Array.isArray(element3)); } var createGcd = /* @__PURE__ */ factory(name57, dependencies56, (_ref) => { var { @@ -55732,15 +55837,15 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = avalues && bvalues ? [] : void 0; var cindex = []; @@ -55750,14 +55855,14 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref var u3 = []; for (var j = 0; j < columns; j++) { cptr[j] = cindex.length; - var mark = j + 1; - scatter(a4, j, w2, x2, u3, mark, cindex, cf); - scatter(b2, j, w2, x2, u3, mark, cindex, cf); + var mark2 = j + 1; + scatter(a4, j, w2, x2, u3, mark2, cindex, cf); + scatter(b2, j, w2, x2, u3, mark2, cindex, cf); if (x2) { var k2 = cptr[j]; while (k2 < cindex.length) { var i4 = cindex[k2]; - if (u3[i4] === mark) { + if (u3[i4] === mark2) { var v2 = x2[i4]; if (!eq(v2, zero)) { cvalues.push(v2); @@ -55770,13 +55875,13 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref } } } else { - var p = cptr[j]; - while (p < cindex.length) { - var r2 = cindex[p]; - if (u3[r2] !== mark) { - cindex.splice(p, 1); + var p2 = cptr[j]; + while (p2 < cindex.length) { + var r2 = cindex[p2]; + if (u3[r2] !== mark2) { + cindex.splice(p2, 1); } else { - p++; + p2++; } } } @@ -55787,7 +55892,7 @@ var createMatAlgo06xS0S0 = /* @__PURE__ */ factory(name58, dependencies57, (_ref index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; }); @@ -55867,7 +55972,7 @@ var createLog10 = /* @__PURE__ */ factory(name60, dependencies59, (_ref) => { Complex: _Complex } = _ref; return typed3(name60, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= 0 || config4.predictable) { return log10Number(x2); } else { @@ -55898,7 +56003,7 @@ var createLog2 = /* @__PURE__ */ factory(name61, dependencies60, (_ref) => { Complex: Complex3 } = _ref; return typed3(name61, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= 0 || config4.predictable) { return log2Number(x2); } else { @@ -56022,13 +56127,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var bdt = b2._datatype || b2.getDataType(); var alength = asize[0]; var bcolumns = bsize[1]; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); } var c3 = []; for (var j = 0; j < bcolumns; j++) { @@ -56041,7 +56146,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { return a4.createDenseMatrix({ data: c3, size: [bcolumns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); } var _multiplyMatrixVector = typed3("_multiplyMatrixVector", { @@ -56062,13 +56167,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var bdt = b2._datatype || b2.getDataType(); var arows = asize[0]; var acolumns = asize[1]; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); } var c3 = []; for (var i4 = 0; i4 < arows; i4++) { @@ -56082,7 +56187,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { return a4.createDenseMatrix({ data: c3, size: [arows], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); } function _multiplyDenseMatrixDenseMatrix(a4, b2) { @@ -56095,13 +56200,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var arows = asize[0]; var acolumns = asize[1]; var bcolumns = bsize[1]; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); } var c3 = []; for (var i4 = 0; i4 < arows; i4++) { @@ -56118,7 +56223,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { return a4.createDenseMatrix({ data: c3, size: [arows, bcolumns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); } function _multiplyDenseMatrixSparseMatrix(a4, b2) { @@ -56135,17 +56240,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { } var arows = asize[0]; var bcolumns = bsize[1]; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; var eq = equalScalar2; var zero = 0; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); } var cvalues = []; var cindex = []; @@ -56155,7 +56260,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { index: cindex, ptr: cptr, size: [arows, bcolumns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); for (var jb = 0; jb < bcolumns; jb++) { cptr[jb] = cindex.length; @@ -56164,18 +56269,18 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { if (kb1 > kb0) { var last = 0; for (var i4 = 0; i4 < arows; i4++) { - var mark = i4 + 1; + var mark2 = i4 + 1; var cij = void 0; for (var kb = kb0; kb < kb1; kb++) { var ib = bindex[kb]; - if (last !== mark) { + if (last !== mark2) { cij = mf(adata[i4][ib], bvalues[kb]); - last = mark; + last = mark2; } else { cij = af(cij, mf(adata[i4][ib], bvalues[kb])); } } - if (last === mark && !eq(cij, zero)) { + if (last === mark2 && !eq(cij, zero)) { cindex.push(i4); cvalues.push(cij); } @@ -56200,17 +56305,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var cvalues = []; var cindex = []; var cptr = []; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; var eq = equalScalar2; var zero = 0; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); } var x2 = []; var w2 = []; @@ -56230,9 +56335,9 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { } } } - for (var p1 = cindex.length, p = 0; p < p1; p++) { - var ic = cindex[p]; - cvalues[p] = x2[ic]; + for (var p1 = cindex.length, p2 = 0; p2 < p1; p2++) { + var ic = cindex[p2]; + cvalues[p2] = x2[ic]; } cptr[1] = cindex.length; return a4.createSparseMatrix({ @@ -56240,7 +56345,7 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { index: cindex, ptr: cptr, size: [arows, 1], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); } function _multiplySparseMatrixDenseMatrix(a4, b2) { @@ -56256,17 +56361,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var arows = a4._size[0]; var brows = b2._size[0]; var bcolumns = b2._size[1]; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; var eq = equalScalar2; var zero = 0; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); } var cvalues = []; var cindex = []; @@ -56276,20 +56381,20 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { index: cindex, ptr: cptr, size: [arows, bcolumns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); var x2 = []; var w2 = []; for (var jb = 0; jb < bcolumns; jb++) { cptr[jb] = cindex.length; - var mark = jb + 1; + var mark2 = jb + 1; for (var ib = 0; ib < brows; ib++) { var vbij = bdata[ib][jb]; if (!eq(vbij, zero)) { for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { var ia = aindex[ka]; - if (w2[ia] !== mark) { - w2[ia] = mark; + if (w2[ia] !== mark2) { + w2[ia] = mark2; cindex.push(ia); x2[ia] = mf(vbij, avalues[ka]); } else { @@ -56298,9 +56403,9 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { } } } - for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) { - var ic = cindex[p]; - cvalues[p] = x2[ic]; + for (var p0 = cptr[jb], p1 = cindex.length, p2 = p0; p2 < p1; p2++) { + var ic = cindex[p2]; + cvalues[p2] = x2[ic]; } } cptr[bcolumns] = cindex.length; @@ -56318,13 +56423,13 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { var arows = a4._size[0]; var bcolumns = b2._size[1]; var values2 = avalues && bvalues; - var dt; + var dt2; var af = addScalar2; var mf = multiplyScalar2; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - dt = adt; - af = typed3.find(addScalar2, [dt, dt]); - mf = typed3.find(multiplyScalar2, [dt, dt]); + dt2 = adt; + af = typed3.find(addScalar2, [dt2, dt2]); + mf = typed3.find(multiplyScalar2, [dt2, dt2]); } var cvalues = values2 ? [] : void 0; var cindex = []; @@ -56334,21 +56439,21 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { index: cindex, ptr: cptr, size: [arows, bcolumns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); var x2 = values2 ? [] : void 0; var w2 = []; var ka, ka0, ka1, kb, kb0, kb1, ia, ib; for (var jb = 0; jb < bcolumns; jb++) { cptr[jb] = cindex.length; - var mark = jb + 1; + var mark2 = jb + 1; for (kb0 = bptr[jb], kb1 = bptr[jb + 1], kb = kb0; kb < kb1; kb++) { ib = bindex[kb]; if (values2) { for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { ia = aindex[ka]; - if (w2[ia] !== mark) { - w2[ia] = mark; + if (w2[ia] !== mark2) { + w2[ia] = mark2; cindex.push(ia); x2[ia] = mf(bvalues[kb], avalues[ka]); } else { @@ -56358,17 +56463,17 @@ var createMultiply = /* @__PURE__ */ factory(name63, dependencies62, (_ref) => { } else { for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { ia = aindex[ka]; - if (w2[ia] !== mark) { - w2[ia] = mark; + if (w2[ia] !== mark2) { + w2[ia] = mark2; cindex.push(ia); } } } } if (values2) { - for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) { - var ic = cindex[p]; - cvalues[p] = x2[ic]; + for (var p0 = cptr[jb], p1 = cindex.length, p2 = p0; p2 < p1; p2++) { + var ic = cindex[p2]; + cvalues[p2] = x2[ic]; } } } @@ -56501,21 +56606,21 @@ var createNthRoot = /* @__PURE__ */ factory(name64, dependencies63, (_ref) => { Ss: matAlgo11xS0s, sS: false })); - function _bigNthRoot(a4, root) { + function _bigNthRoot(a4, root4) { var precision = _BigNumber.precision; var Big = _BigNumber.clone({ precision: precision + 2 }); var zero = new _BigNumber(0); - var one = new Big(1); - var inv2 = root.isNegative(); + var one5 = new Big(1); + var inv2 = root4.isNegative(); if (inv2) { - root = root.neg(); + root4 = root4.neg(); } - if (root.isZero()) { + if (root4.isZero()) { throw new Error("Root must be non-zero"); } - if (a4.isNegative() && !root.abs().mod(2).equals(1)) { + if (a4.isNegative() && !root4.abs().mod(2).equals(1)) { throw new Error("Root must be odd when a is negative."); } if (a4.isZero()) { @@ -56524,9 +56629,9 @@ var createNthRoot = /* @__PURE__ */ factory(name64, dependencies63, (_ref) => { if (!a4.isFinite()) { return inv2 ? zero : a4; } - var x2 = a4.abs().pow(one.div(root)); + var x2 = a4.abs().pow(one5.div(root4)); x2 = a4.isNeg() ? x2.neg() : x2; - return new _BigNumber((inv2 ? one.div(x2) : x2).toPrecision(precision)); + return new _BigNumber((inv2 ? one5.div(x2) : x2).toPrecision(precision)); } }); @@ -56691,10 +56796,10 @@ var createXgcd = /* @__PURE__ */ factory(name69, dependencies68, (_ref) => { var q2; var r2; var zero = new BigNumber2(0); - var one = new BigNumber2(1); + var one5 = new BigNumber2(1); var x2 = zero; - var lastx = one; - var y3 = one; + var lastx = one5; + var y3 = one5; var lasty = zero; if (!a4.isInt() || !b2.isInt()) { throw new Error("Parameters in function xgcd must be integer numbers"); @@ -56785,15 +56890,15 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = avalues && bvalues ? [] : void 0; var cindex = []; @@ -56803,18 +56908,18 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref var i4, j, k2, k0, k1; for (j = 0; j < columns; j++) { cptr[j] = cindex.length; - var mark = j + 1; + var mark2 = j + 1; if (x2) { for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = bindex[k2]; - w2[i4] = mark; + w2[i4] = mark2; x2[i4] = bvalues[k2]; } } for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = aindex[k2]; if (x2) { - var vb = w2[i4] === mark ? x2[i4] : zero; + var vb = w2[i4] === mark2 ? x2[i4] : zero; var vc = cf(avalues[k2], vb); if (!eq(vc, zero)) { cindex.push(i4); @@ -56831,7 +56936,7 @@ var createMatAlgo09xS0Sf = /* @__PURE__ */ factory(name71, dependencies70, (_ref index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; }); @@ -57256,13 +57361,13 @@ var createMatAlgo07xSSf = /* @__PURE__ */ factory(name76, dependencies75, (_ref) } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var i4, j; var cdata = []; @@ -57274,28 +57379,28 @@ var createMatAlgo07xSSf = /* @__PURE__ */ factory(name76, dependencies75, (_ref) var wa = []; var wb = []; for (j = 0; j < columns; j++) { - var mark = j + 1; - _scatter(a4, j, wa, xa, mark); - _scatter(b2, j, wb, xb, mark); + var mark2 = j + 1; + _scatter(a4, j, wa, xa, mark2); + _scatter(b2, j, wb, xb, mark2); for (i4 = 0; i4 < rows; i4++) { - var va = wa[i4] === mark ? xa[i4] : zero; - var vb = wb[i4] === mark ? xb[i4] : zero; + var va = wa[i4] === mark2 ? xa[i4] : zero; + var vb = wb[i4] === mark2 ? xb[i4] : zero; cdata[i4][j] = cf(va, vb); } } return new DenseMatrix2({ data: cdata, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; - function _scatter(m4, j, w2, x2, mark) { + function _scatter(m4, j, w2, x2, mark2) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var k2 = ptr[j], k1 = ptr[j + 1]; k2 < k1; k2++) { - var i4 = index2[k2]; - w2[i4] = mark; + var i4 = index3[k2]; + w2[i4] = mark2; x2[i4] = values2[k2]; } } @@ -57345,7 +57450,7 @@ var createArg = /* @__PURE__ */ factory(name78, dependencies77, (_ref) => { typed: typed3 } = _ref; return typed3(name78, { - number: function number4(x2) { + number: function number5(x2) { return Math.atan2(0, x2); }, BigNumber: function BigNumber2(x2) { @@ -57561,7 +57666,7 @@ var createConcat = /* @__PURE__ */ factory(name85, dependencies84, (_ref) => { } return asMatrix ? matrix2(res) : res; }, - "...string": function string4(args) { + "...string": function string6(args) { return args.join(""); } }); @@ -57589,8 +57694,8 @@ var createColumn = /* @__PURE__ */ factory(name86, dependencies85, (_ref) => { } validateIndex(column2, value.size()[1]); var rowRange = range2(0, value.size()[0]); - var index2 = new Index2(rowRange, column2); - var result = value.subset(index2); + var index3 = new Index2(rowRange, column2); + var result = value.subset(index3); return isMatrix(result) ? result : matrix2([[result]]); } }); @@ -57605,7 +57710,7 @@ var createCount = /* @__PURE__ */ factory(name87, dependencies86, (_ref) => { prod: prod2 } = _ref; return typed3(name87, { - string: function string4(x2) { + string: function string6(x2) { return x2.length; }, "Matrix | Array": function MatrixArray(x2) { @@ -57746,14 +57851,14 @@ var createDiag = /* @__PURE__ */ factory(name89, dependencies88, (_ref) => { // node_modules/mathjs/lib/esm/utils/applyCallback.js var import_typed_function2 = __toESM(require_typed_function(), 1); -function applyCallback(callback, value, index2, array, mappingFnName) { +function applyCallback(callback, value, index3, array, mappingFnName) { if (import_typed_function2.default.isTypedFunction(callback)) { - var args3 = [value, index2, array]; + var args3 = [value, index3, array]; var signature3 = import_typed_function2.default.resolve(callback, args3); if (signature3) { return tryWithArgs(signature3.implementation, args3); } - var args2 = [value, index2]; + var args2 = [value, index3]; var signature2 = import_typed_function2.default.resolve(callback, args2); if (signature2) { return tryWithArgs(signature2.implementation, args2); @@ -57765,7 +57870,7 @@ function applyCallback(callback, value, index2, array, mappingFnName) { } return tryWithArgs(callback, args3); } else { - return callback(value, index2, array); + return callback(value, index3, array); } function tryWithArgs(signature, args) { try { @@ -57776,12 +57881,12 @@ function applyCallback(callback, value, index2, array, mappingFnName) { var argsDesc = []; argsDesc.push("value: ".concat(typeOf(value))); if (args.length >= 2) { - argsDesc.push("index: ".concat(typeOf(index2))); + argsDesc.push("index: ".concat(typeOf(index3))); } if (args.length >= 3) { argsDesc.push("array: ".concat(typeOf(array))); } - throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callback.name, "(").concat(argsDesc.join(", "), ") at index ").concat(JSON.stringify(index2))); + throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callback.name, "(").concat(argsDesc.join(", "), ") at index ").concat(JSON.stringify(index3))); } else { throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "to function ".concat(callback.name, ": ").concat(err.message)); } @@ -57808,8 +57913,8 @@ var createFilter = /* @__PURE__ */ factory(name90, dependencies89, (_ref) => { }); }); function _filterCallback(x2, callback) { - return filter(x2, function(value, index2, array) { - return applyCallback(callback, value, [index2], array, "filter"); + return filter(x2, function(value, index3, array) { + return applyCallback(callback, value, [index3], array, "filter"); }); } @@ -57847,13 +57952,13 @@ var createForEach = /* @__PURE__ */ factory(name92, dependencies91, (_ref) => { }); }); function _forEach(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { forEach(value, function(child, i4) { - recurse2(child, index2.concat(i4)); + recurse2(child, index3.concat(i4)); }); } else { - return applyCallback(callback, value, index2, array, "forEach"); + return applyCallback(callback, value, index3, array, "forEach"); } }; recurse(array, []); @@ -57892,7 +57997,7 @@ var createIdentity = /* @__PURE__ */ factory(name94, dependencies93, (_ref) => { "": function _15() { return config4.matrix === "Matrix" ? matrix2([]) : []; }, - string: function string4(format8) { + string: function string6(format8) { return matrix2(format8); }, "number | BigNumber": function numberBigNumber(rows) { @@ -57944,22 +58049,22 @@ var createIdentity = /* @__PURE__ */ factory(name94, dependencies93, (_ref) => { if (!isInteger(cols) || cols < 1) { throw new Error("Parameters in function identity must be positive integers"); } - var one = Big ? new BigNumber2(1) : 1; + var one5 = Big ? new BigNumber2(1) : 1; var defaultValue2 = Big ? new Big(0) : 0; var size2 = [rows, cols]; if (format8) { if (format8 === "sparse") { - return SparseMatrix2.diagonal(size2, one, 0, defaultValue2); + return SparseMatrix2.diagonal(size2, one5, 0, defaultValue2); } if (format8 === "dense") { - return DenseMatrix2.diagonal(size2, one, 0, defaultValue2); + return DenseMatrix2.diagonal(size2, one5, 0, defaultValue2); } throw new TypeError('Unknown matrix type "'.concat(format8, '"')); } var res = resize([], size2, defaultValue2); var minimum = rows < cols ? rows : cols; for (var d4 = 0; d4 < minimum; d4++) { - res[d4][d4] = one; + res[d4][d4] = one5; } return res; } @@ -58027,13 +58132,13 @@ var createMap2 = /* @__PURE__ */ factory(name96, dependencies95, (_ref) => { }); }); function _map(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { return value.map(function(child, i4) { - return recurse2(child, index2.concat(i4)); + return recurse2(child, index3.concat(i4)); }); } else { - return applyCallback(callback, value, index2, array, "map"); + return applyCallback(callback, value, index3, array, "map"); } }; return recurse(array, []); @@ -58047,7 +58152,7 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => { typed: typed3, matrix: matrix2, subtract: subtract3, - number: number4 + number: number5 } = _ref; return typed3(name97, { "Array | Matrix": function ArrayMatrix(arr) { @@ -58066,8 +58171,8 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => { return _recursive(arr, dim); } }, - "Array, BigNumber": typed3.referTo("Array,number", (selfAn) => (arr, dim) => selfAn(arr, number4(dim))), - "Matrix, BigNumber": typed3.referTo("Matrix,number", (selfMn) => (arr, dim) => selfMn(arr, number4(dim))) + "Array, BigNumber": typed3.referTo("Array,number", (selfAn) => (arr, dim) => selfAn(arr, number5(dim))), + "Matrix, BigNumber": typed3.referTo("Matrix,number", (selfMn) => (arr, dim) => selfMn(arr, number5(dim))) }); function _recursive(arr, dim) { if (isMatrix(arr)) { @@ -58078,8 +58183,8 @@ var createDiff = /* @__PURE__ */ factory(name97, dependencies96, (_ref) => { } if (dim > 0) { var result = []; - arr.forEach((element) => { - result.push(_recursive(element, dim - 1)); + arr.forEach((element3) => { + result.push(_recursive(element3, dim - 1)); }); return result; } else if (dim === 0) { @@ -58178,10 +58283,10 @@ var createOnes = /* @__PURE__ */ factory(name98, dependencies97, (_ref) => { } function _normalize(size2) { var hasBigNumbers = false; - size2.forEach(function(value, index2, arr) { + size2.forEach(function(value, index3, arr) { if (isBigNumber(value)) { hasBigNumbers = true; - arr[index2] = value.toNumber(); + arr[index3] = value.toNumber(); } }); return hasBigNumbers; @@ -58293,10 +58398,10 @@ var createRange = /* @__PURE__ */ factory(name99, dependencies98, (_ref) => { var nums = args.map(function(arg2) { return Number(arg2); }); - var invalid2 = nums.some(function(num) { + var invalid4 = nums.some(function(num) { return isNaN(num); }); - if (invalid2) { + if (invalid4) { return null; } switch (nums.length) { @@ -58476,7 +58581,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r "": function _15() { return config4.matrix === "Matrix" ? matrix2([]) : []; }, - string: function string4(format8) { + string: function string6(format8) { return matrix2(format8); }, "number | BigNumber | Complex | Unit": function numberBigNumberComplexUnit(theta) { @@ -58510,8 +58615,8 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r var minusOne = Big ? new BigNumber2(-1) : -1; var cosTheta = cos3(theta); var sinTheta = sin3(theta); - var data2 = [[cosTheta, multiplyScalar2(minusOne, sinTheta)], [sinTheta, cosTheta]]; - return _convertToFormat(data2, format8); + var data3 = [[cosTheta, multiplyScalar2(minusOne, sinTheta)], [sinTheta, cosTheta]]; + return _convertToFormat(data3, format8); } function _validateVector(v2) { var size2 = v2.size(); @@ -58520,19 +58625,19 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r } } function _mul(array) { - return array.reduce((p, curr) => multiplyScalar2(p, curr)); + return array.reduce((p2, curr) => multiplyScalar2(p2, curr)); } - function _convertToFormat(data2, format8) { + function _convertToFormat(data3, format8) { if (format8) { if (format8 === "sparse") { - return new SparseMatrix2(data2); + return new SparseMatrix2(data3); } if (format8 === "dense") { - return new DenseMatrix2(data2); + return new DenseMatrix2(data3); } throw new TypeError('Unknown matrix type "'.concat(format8, '"')); } - return data2; + return data3; } function _rotationMatrix3x3(theta, v2, format8) { var normV = norm3(v2); @@ -58540,13 +58645,13 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r throw new RangeError("Rotation around zero vector"); } var Big = isBigNumber(theta) ? BigNumber2 : null; - var one = Big ? new Big(1) : 1; + var one5 = Big ? new Big(1) : 1; var minusOne = Big ? new Big(-1) : -1; var vx = Big ? new Big(v2.get([0]) / normV) : v2.get([0]) / normV; var vy = Big ? new Big(v2.get([1]) / normV) : v2.get([1]) / normV; var vz = Big ? new Big(v2.get([2]) / normV) : v2.get([2]) / normV; var c3 = cos3(theta); - var oneMinusC = addScalar2(one, unaryMinus2(c3)); + var oneMinusC = addScalar2(one5, unaryMinus2(c3)); var s4 = sin3(theta); var r11 = addScalar2(c3, _mul([vx, vx, oneMinusC])); var r12 = addScalar2(_mul([vx, vy, oneMinusC]), _mul([minusOne, vz, s4])); @@ -58557,8 +58662,8 @@ var createRotationMatrix = /* @__PURE__ */ factory(name103, dependencies102, (_r var r31 = addScalar2(_mul([vx, vz, oneMinusC]), _mul([minusOne, vy, s4])); var r32 = addScalar2(_mul([vy, vz, oneMinusC]), _mul([vx, s4])); var r33 = addScalar2(c3, _mul([vz, vz, oneMinusC])); - var data2 = [[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]]; - return _convertToFormat(data2, format8); + var data3 = [[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]]; + return _convertToFormat(data3, format8); } }); @@ -58584,8 +58689,8 @@ var createRow = /* @__PURE__ */ factory(name104, dependencies103, (_ref) => { } validateIndex(row2, value.size()[0]); var columnRange = range2(0, value.size()[1]); - var index2 = new Index2(row2, columnRange); - var result = value.subset(index2); + var index3 = new Index2(row2, columnRange); + var result = value.subset(index3); return isMatrix(result) ? result : matrix2([[result]]); } }); @@ -58604,7 +58709,7 @@ var createSize = /* @__PURE__ */ factory(name105, dependencies104, (_ref) => { return x2.create(x2.size()); }, Array: arraySize, - string: function string4(x2) { + string: function string6(x2) { return config4.matrix === "Array" ? [x2.length] : matrix2([x2.length]); }, "number | Complex | BigNumber | Unit | boolean | null": function numberComplexBigNumberUnitBooleanNull(x2) { @@ -58646,56 +58751,56 @@ var createSubset = /* @__PURE__ */ factory(name107, dependencies106, (_ref) => { add: add4 } = _ref; return typed3(name107, { - "Matrix, Index": function MatrixIndex(value, index2) { - if (isEmptyIndex(index2)) { + "Matrix, Index": function MatrixIndex(value, index3) { + if (isEmptyIndex(index3)) { return matrix2(); } - validateIndexSourceSize(value, index2); - return value.subset(index2); + validateIndexSourceSize(value, index3); + return value.subset(index3); }, "Array, Index": typed3.referTo("Matrix, Index", function(subsetRef) { - return function(value, index2) { - var subsetResult = subsetRef(matrix2(value), index2); - return index2.isScalar() ? subsetResult : subsetResult.valueOf(); + return function(value, index3) { + var subsetResult = subsetRef(matrix2(value), index3); + return index3.isScalar() ? subsetResult : subsetResult.valueOf(); }; }), "Object, Index": _getObjectProperty, "string, Index": _getSubstring, - "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index2, replacement, defaultValue2) { - if (isEmptyIndex(index2)) { + "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index3, replacement, defaultValue2) { + if (isEmptyIndex(index3)) { return value; } - validateIndexSourceSize(value, index2); - return value.clone().subset(index2, _broadcastReplacement(replacement, index2), defaultValue2); + validateIndexSourceSize(value, index3); + return value.clone().subset(index3, _broadcastReplacement(replacement, index3), defaultValue2); }, "Array, Index, any, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement, defaultValue2) { - var subsetResult = subsetRef(matrix2(value), index2, replacement, defaultValue2); + return function(value, index3, replacement, defaultValue2) { + var subsetResult = subsetRef(matrix2(value), index3, replacement, defaultValue2); return subsetResult.isMatrix ? subsetResult.valueOf() : subsetResult; }; }), "Array, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement) { - return subsetRef(matrix2(value), index2, replacement, void 0).valueOf(); + return function(value, index3, replacement) { + return subsetRef(matrix2(value), index3, replacement, void 0).valueOf(); }; }), "Matrix, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement) { - return subsetRef(value, index2, replacement, void 0); + return function(value, index3, replacement) { + return subsetRef(value, index3, replacement, void 0); }; }), "string, Index, string": _setSubstring, "string, Index, string, string": _setSubstring, "Object, Index, any": _setObjectProperty }); - function _broadcastReplacement(replacement, index2) { + function _broadcastReplacement(replacement, index3) { if (typeof replacement === "string") { throw new Error("can't boradcast a string"); } - if (index2._isScalar) { + if (index3._isScalar) { return replacement; } - var indexSize = index2.size(); + var indexSize = index3.size(); if (indexSize.every((d4) => d4 > 0)) { try { return add4(replacement, zeros3(indexSize)); @@ -58707,37 +58812,37 @@ var createSubset = /* @__PURE__ */ factory(name107, dependencies106, (_ref) => { } } }); -function _getSubstring(str, index2) { - if (!isIndex(index2)) { +function _getSubstring(str, index3) { + if (!isIndex(index3)) { throw new TypeError("Index expected"); } - if (isEmptyIndex(index2)) { + if (isEmptyIndex(index3)) { return ""; } - validateIndexSourceSize(Array.from(str), index2); - if (index2.size().length !== 1) { - throw new DimensionError(index2.size().length, 1); + validateIndexSourceSize(Array.from(str), index3); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size().length, 1); } var strLen = str.length; - validateIndex(index2.min()[0], strLen); - validateIndex(index2.max()[0], strLen); - var range2 = index2.dimension(0); + validateIndex(index3.min()[0], strLen); + validateIndex(index3.max()[0], strLen); + var range2 = index3.dimension(0); var substr = ""; range2.forEach(function(v2) { substr += str.charAt(v2); }); return substr; } -function _setSubstring(str, index2, replacement, defaultValue2) { - if (!index2 || index2.isIndex !== true) { +function _setSubstring(str, index3, replacement, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Index expected"); } - if (isEmptyIndex(index2)) { + if (isEmptyIndex(index3)) { return str; } - validateIndexSourceSize(Array.from(str), index2); - if (index2.size().length !== 1) { - throw new DimensionError(index2.size().length, 1); + validateIndexSourceSize(Array.from(str), index3); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size().length, 1); } if (defaultValue2 !== void 0) { if (typeof defaultValue2 !== "string" || defaultValue2.length !== 1) { @@ -58746,14 +58851,14 @@ function _setSubstring(str, index2, replacement, defaultValue2) { } else { defaultValue2 = " "; } - var range2 = index2.dimension(0); + var range2 = index3.dimension(0); var len = range2.size()[0]; if (len !== replacement.length) { throw new DimensionError(range2.size()[0], replacement.length); } var strLen = str.length; - validateIndex(index2.min()[0]); - validateIndex(index2.max()[0]); + validateIndex(index3.min()[0]); + validateIndex(index3.max()[0]); var chars = []; for (var i4 = 0; i4 < strLen; i4++) { chars[i4] = str.charAt(i4); @@ -58770,32 +58875,32 @@ function _setSubstring(str, index2, replacement, defaultValue2) { } return chars.join(""); } -function _getObjectProperty(object, index2) { - if (isEmptyIndex(index2)) { +function _getObjectProperty(object, index3) { + if (isEmptyIndex(index3)) { return void 0; } - if (index2.size().length !== 1) { - throw new DimensionError(index2.size(), 1); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size(), 1); } - var key2 = index2.dimension(0); - if (typeof key2 !== "string") { + var key3 = index3.dimension(0); + if (typeof key3 !== "string") { throw new TypeError("String expected as index to retrieve an object property"); } - return getSafeProperty(object, key2); + return getSafeProperty(object, key3); } -function _setObjectProperty(object, index2, replacement) { - if (isEmptyIndex(index2)) { +function _setObjectProperty(object, index3, replacement) { + if (isEmptyIndex(index3)) { return object; } - if (index2.size().length !== 1) { - throw new DimensionError(index2.size(), 1); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size(), 1); } - var key2 = index2.dimension(0); - if (typeof key2 !== "string") { + var key3 = index3.dimension(0); + if (typeof key3 !== "string") { throw new TypeError("String expected as index to retrieve an object property"); } var updated = clone(object); - setSafeProperty(updated, key2, replacement); + setSafeProperty(updated, key3, replacement); return updated; } @@ -58842,13 +58947,13 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) = return c3; } function _denseTranspose(m4, rows, columns) { - var data2 = m4._data; + var data3 = m4._data; var transposed = []; var transposedRow; for (var j = 0; j < columns; j++) { transposedRow = transposed[j] = []; for (var i4 = 0; i4 < rows; i4++) { - transposedRow[i4] = clone(data2[i4][j]); + transposedRow[i4] = clone(data3[i4][j]); } } return m4.createDenseMatrix({ @@ -58859,7 +58964,7 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) = } function _sparseTranspose(m4, rows, columns) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var cvalues = values2 ? [] : void 0; var cindex = []; @@ -58868,9 +58973,9 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) = for (var x2 = 0; x2 < rows; x2++) { w2[x2] = 0; } - var p, l2, j; - for (p = 0, l2 = index2.length; p < l2; p++) { - w2[index2[p]]++; + var p2, l2, j; + for (p2 = 0, l2 = index3.length; p2 < l2; p2++) { + w2[index3[p2]]++; } var sum4 = 0; for (var i4 = 0; i4 < rows; i4++) { @@ -58881,7 +58986,7 @@ var createTranspose = /* @__PURE__ */ factory(name108, dependencies107, (_ref) = cptr.push(sum4); for (j = 0; j < columns; j++) { for (var k0 = ptr[j], k1 = ptr[j + 1], k2 = k0; k2 < k1; k2++) { - var q2 = w2[index2[k2]]++; + var q2 = w2[index3[k2]]++; cindex[q2] = j; if (values2) { cvalues[q2] = clone(values2[k2]); @@ -58968,10 +59073,10 @@ var createZeros = /* @__PURE__ */ factory(name110, dependencies109, (_ref) => { } function _normalize(size2) { var hasBigNumbers = false; - size2.forEach(function(value, index2, arr) { + size2.forEach(function(value, index3, arr) { if (isBigNumber(value)) { hasBigNumbers = true; - arr[index2] = value.toNumber(); + arr[index3] = value.toNumber(); } }); return hasBigNumbers; @@ -59055,10 +59160,10 @@ var createFft = /* @__PURE__ */ factory(name111, dependencies110, (_ref) => { if (len % 2 === 0) { var ret = [..._fft(arr.filter((_15, i4) => i4 % 2 === 0), len / 2), ..._fft(arr.filter((_15, i4) => i4 % 2 === 1), len / 2)]; for (var k2 = 0; k2 < len / 2; k2++) { - var p = ret[k2]; + var p2 = ret[k2]; var q2 = multiplyScalar2(ret[k2 + len / 2], exp3(multiplyScalar2(multiplyScalar2(tau3, I2), divideScalar2(-k2, len)))); - ret[k2] = addScalar2(p, q2); - ret[k2 + len / 2] = addScalar2(p, multiplyScalar2(-1, q2)); + ret[k2] = addScalar2(p2, q2); + ret[k2 + len / 2] = addScalar2(p2, multiplyScalar2(-1, q2)); } return ret; } else { @@ -59117,7 +59222,7 @@ var createSolveODE = /* @__PURE__ */ factory(name113, dependencies112, (_ref) => multiply: multiply2, divide: divide3, max: max5, - map: map4, + map: map6, abs: abs3, isPositive: isPositive2, isNegative: isNegative2, @@ -59174,7 +59279,7 @@ var createSolveODE = /* @__PURE__ */ factory(name113, dependencies112, (_ref) => for (var i4 = 1; i4 < c3.length; ++i4) { k2.push(f2(add4(t5[n3], multiply2(c3[i4], h3)), add4(y3[n3], multiply2(h3, a4[i4], k2)))); } - var TE = max5(abs3(map4(multiply2(deltaB, k2), (X2) => isUnit(X2) ? X2.value : X2))); + var TE = max5(abs3(map6(multiply2(deltaB, k2), (X2) => isUnit(X2) ? X2.value : X2))); if (TE < tol && tol / TE > 1 / 4) { t5.push(add4(t5[n3], h3)); y3.push(add4(y3[n3], multiply2(h3, b2, k2))); @@ -59310,7 +59415,7 @@ var createErf = /* @__PURE__ */ factory(name114, dependencies113, (_ref) => { typed: typed3 } = _ref; return typed3("name", { - number: function number4(x2) { + number: function number5(x2) { var y3 = Math.abs(x2); if (y3 >= MAX_NUM) { return sign(x2); @@ -59650,14 +59755,14 @@ var createPrint = /* @__PURE__ */ factory(name122, dependencies121, (_ref) => { }); }); function _print(template2, values2, options) { - return template2.replace(printTemplate, function(original, key2) { - var keys = key2.split("."); - var value = values2[keys.shift()]; + return template2.replace(printTemplate, function(original, key3) { + var keys2 = key3.split("."); + var value = values2[keys2.shift()]; if (value !== void 0 && value.isMatrix) { value = value.toArray(); } - while (keys.length && value !== void 0) { - var k2 = keys.shift(); + while (keys2.length && value !== void 0) { + var k2 = keys2.shift(); value = k2 ? value[k2] : value + "."; } if (value !== void 0) { @@ -59700,7 +59805,7 @@ var createIsPrime = /* @__PURE__ */ factory(name124, dependencies123, (_ref) => typed: typed3 } = _ref; return typed3(name124, { - number: function number4(x2) { + number: function number5(x2) { if (x2 * 0 !== 0) { return false; } @@ -59734,15 +59839,15 @@ var createIsPrime = /* @__PURE__ */ factory(name124, dependencies123, (_ref) => } return true; } - function modPow(base2, exponent, modulus) { + function modPow(base3, exponent, modulus) { var accumulator = 1; while (!exponent.eq(0)) { if (exponent.mod(2).eq(0)) { exponent = exponent.div(2); - base2 = base2.mul(base2).mod(modulus); + base3 = base3.mul(base3).mod(modulus); } else { exponent = exponent.sub(1); - accumulator = base2.mul(accumulator).mod(modulus); + accumulator = base3.mul(accumulator).mod(modulus); } } return accumulator; @@ -59862,7 +59967,7 @@ var createPow = /* @__PURE__ */ factory(name127, dependencies126, (_ref) => { multiply: multiply2, matrix: matrix2, inv: inv2, - number: number4, + number: number5, fraction: fraction2, Complex: Complex3 } = _ref; @@ -59905,7 +60010,7 @@ var createPow = /* @__PURE__ */ factory(name127, dependencies126, (_ref) => { if (config4.predictable && !isInteger(y3) && x2 < 0) { try { var yFrac = fraction2(y3); - var yNum = number4(yFrac); + var yNum = number5(yFrac); if (y3 === yNum || Math.abs((y3 - yNum) / y3) < 1e-14) { if (yFrac.d % 2 === 1) { return (yFrac.n % 2 === 0 ? 1 : -1) * Math.pow(-x2, y3); @@ -59992,7 +60097,7 @@ var createRound = /* @__PURE__ */ factory(name128, dependencies127, (_ref) => { return Math.abs(splitNumber(epsilon).exponent); } return typed3(name128, { - number: function number4(x2) { + number: function number5(x2) { var xEpsilon = roundNumber(x2, toExponent(config4.epsilon)); var xSelected = nearlyEqual(x2, xEpsilon, config4.epsilon) ? xEpsilon : x2; return roundNumber(xSelected); @@ -60112,7 +60217,7 @@ var createLog = /* @__PURE__ */ factory(name129, dependencies128, (_ref) => { Complex: Complex3 } = _ref; return typed3(name129, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= 0 || config4.predictable) { return logNumber(x2); } else { @@ -60129,8 +60234,8 @@ var createLog = /* @__PURE__ */ factory(name129, dependencies128, (_ref) => { return new Complex3(x2.toNumber(), 0).log(); } }, - "any, any": typed3.referToSelf((self2) => (x2, base2) => { - return divideScalar2(self2(x2), self2(base2)); + "any, any": typed3.referToSelf((self2) => (x2, base3) => { + return divideScalar2(self2(x2), self2(base3)); }) }); }); @@ -60147,7 +60252,7 @@ var createLog1p = /* @__PURE__ */ factory(name130, dependencies129, (_ref) => { Complex: Complex3 } = _ref; return typed3(name130, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= -1 || config4.predictable) { return log1p(x2); } else { @@ -60164,8 +60269,8 @@ var createLog1p = /* @__PURE__ */ factory(name130, dependencies129, (_ref) => { } }, "Array | Matrix": typed3.referToSelf((self2) => (x2) => deepMap(x2, self2)), - "any, any": typed3.referToSelf((self2) => (x2, base2) => { - return divideScalar2(self2(x2), log4(base2)); + "any, any": typed3.referToSelf((self2) => (x2, base3) => { + return divideScalar2(self2(x2), log4(base3)); }) }); function _log1pComplex(x2) { @@ -60193,12 +60298,12 @@ var createNthRoots = /* @__PURE__ */ factory(name131, dependencies130, (_ref) => }, function imagNeg(val) { return new Complex3(0, -val); }]; - function _nthComplexRoots(a4, root) { - if (root < 0) + function _nthComplexRoots(a4, root4) { + if (root4 < 0) throw new Error("Root must be greater than zero"); - if (root === 0) + if (root4 === 0) throw new Error("Root must be non-zero"); - if (root % 1 !== 0) + if (root4 % 1 !== 0) throw new Error("Root must be an integer"); if (a4 === 0 || a4.abs() === 0) return [new Complex3(0, 0)]; @@ -60216,16 +60321,16 @@ var createNthRoots = /* @__PURE__ */ factory(name131, dependencies130, (_ref) => var arg2 = a4.arg(); var abs3 = a4.abs(); var roots = []; - var r2 = Math.pow(abs3, 1 / root); - for (var k2 = 0; k2 < root; k2++) { - var halfPiFactor = (offset2 + 4 * k2) / root; + var r2 = Math.pow(abs3, 1 / root4); + for (var k2 = 0; k2 < root4; k2++) { + var halfPiFactor = (offset2 + 4 * k2) / root4; if (halfPiFactor === Math.round(halfPiFactor)) { roots.push(_calculateExactResult[halfPiFactor % 4](r2)); continue; } roots.push(new Complex3({ r: r2, - phi: (arg2 + 2 * Math.PI * k2) / root + phi: (arg2 + 2 * Math.PI * k2) / root4 })); } return roots; @@ -60349,7 +60454,7 @@ function createSolveValidation(_ref) { if (rows !== columns) { throw new RangeError("Matrix must be square (size: " + format4(mSize) + ")"); } - var data2 = []; + var data3 = []; if (isMatrix(b2)) { var bSize = b2.size(); var bdata = b2._data; @@ -60358,10 +60463,10 @@ function createSolveValidation(_ref) { throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); } for (var i4 = 0; i4 < rows; i4++) { - data2[i4] = [bdata[i4]]; + data3[i4] = [bdata[i4]]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, 1], datatype: b2._datatype }); @@ -60372,12 +60477,12 @@ function createSolveValidation(_ref) { } if (isDenseMatrix(b2)) { if (copy) { - data2 = []; + data3 = []; for (var _i = 0; _i < rows; _i++) { - data2[_i] = [bdata[_i][0]]; + data3[_i] = [bdata[_i][0]]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, 1], datatype: b2._datatype }); @@ -60386,17 +60491,17 @@ function createSolveValidation(_ref) { } if (isSparseMatrix(b2)) { for (var _i2 = 0; _i2 < rows; _i2++) { - data2[_i2] = [0]; + data3[_i2] = [0]; } var values2 = b2._values; - var index2 = b2._index; + var index3 = b2._index; var ptr = b2._ptr; for (var k1 = ptr[1], k2 = ptr[0]; k2 < k1; k2++) { - var _i3 = index2[k2]; - data2[_i3][0] = values2[k2]; + var _i3 = index3[k2]; + data3[_i3][0] = values2[k2]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, 1], datatype: b2._datatype }); @@ -60411,10 +60516,10 @@ function createSolveValidation(_ref) { throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); } for (var _i4 = 0; _i4 < rows; _i4++) { - data2[_i4] = [b2[_i4]]; + data3[_i4] = [b2[_i4]]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, 1] }); } @@ -60423,10 +60528,10 @@ function createSolveValidation(_ref) { throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); } for (var _i5 = 0; _i5 < rows; _i5++) { - data2[_i5] = [b2[_i5][0]]; + data3[_i5] = [b2[_i5][0]]; } return new DenseMatrix2({ - data: data2, + data: data3, size: [rows, 1] }); } @@ -60499,7 +60604,7 @@ var createLsolve = /* @__PURE__ */ factory(name134, dependencies133, (_ref) => { var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var x2 = []; for (var j = 0; j < columns; j++) { @@ -60511,7 +60616,7 @@ var createLsolve = /* @__PURE__ */ factory(name134, dependencies133, (_ref) => { var firstIndex = ptr[j]; var lastIndex = ptr[j + 1]; for (var k2 = firstIndex; k2 < lastIndex; k2++) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { vjj = values2[k2]; } else if (i4 > j) { @@ -60603,7 +60708,7 @@ var createUsolve = /* @__PURE__ */ factory(name135, dependencies134, (_ref) => { var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var x2 = []; for (var j = columns - 1; j >= 0; j--) { @@ -60615,7 +60720,7 @@ var createUsolve = /* @__PURE__ */ factory(name135, dependencies134, (_ref) => { var firstIndex = ptr[j]; var lastIndex = ptr[j + 1]; for (var k2 = lastIndex - 1; k2 >= firstIndex; k2--) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { vjj = values2[k2]; } else if (i4 < j) { @@ -60714,7 +60819,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name136, dependencies135, (_ref) = var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var i4 = 0; i4 < columns; i4++) { var L2 = B2.length; @@ -60726,7 +60831,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name136, dependencies135, (_ref) = var lastIndex = ptr[i4 + 1]; var Mii = 0; for (var j = firstIndex; j < lastIndex; j++) { - var J = index2[j]; + var J = index3[j]; if (J === i4) { Mii = values2[j]; } else if (J > i4) { @@ -60837,7 +60942,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name137, dependencies136, (_ref) = var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var i4 = columns - 1; i4 >= 0; i4--) { var L2 = B2.length; @@ -60849,7 +60954,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name137, dependencies136, (_ref) = var lastIndex = ptr[i4 + 1]; var Mii = 0; for (var j = lastIndex - 1; j >= firstIndex; j--) { - var J = index2[j]; + var J = index3[j]; if (J === i4) { Mii = values2[j]; } else if (J < i4) { @@ -60919,15 +61024,15 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_ } var rows = asize[0]; var columns = asize[1]; - var dt; + var dt2; var eq = equalScalar2; var zero = 0; var cf = callback; if (typeof adt === "string" && adt === bdt && adt !== "mixed") { - dt = adt; - eq = typed3.find(equalScalar2, [dt, dt]); - zero = typed3.convert(0, dt); - cf = typed3.find(callback, [dt, dt]); + dt2 = adt; + eq = typed3.find(equalScalar2, [dt2, dt2]); + zero = typed3.convert(0, dt2); + cf = typed3.find(callback, [dt2, dt2]); } var cvalues = []; var cindex = []; @@ -60937,16 +61042,16 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_ var k2, k0, k1, i4; for (var j = 0; j < columns; j++) { cptr[j] = cindex.length; - var mark = j + 1; + var mark2 = j + 1; for (k0 = aptr[j], k1 = aptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = aindex[k2]; - w2[i4] = mark; + w2[i4] = mark2; x2[i4] = avalues[k2]; cindex.push(i4); } for (k0 = bptr[j], k1 = bptr[j + 1], k2 = k0; k2 < k1; k2++) { i4 = bindex[k2]; - if (w2[i4] === mark) { + if (w2[i4] === mark2) { x2[i4] = cf(x2[i4], bvalues[k2]); } } @@ -60968,7 +61073,7 @@ var createMatAlgo08xS0Sid = /* @__PURE__ */ factory(name138, dependencies137, (_ index: cindex, ptr: cptr, size: [rows, columns], - datatype: adt === a4._datatype && bdt === b2._datatype ? dt : void 0 + datatype: adt === a4._datatype && bdt === b2._datatype ? dt2 : void 0 }); }; }); @@ -62048,21 +62153,21 @@ var createSort = /* @__PURE__ */ factory(name155, dependencies154, (_ref) => { _matrixIsVector(x2); return matrix2(x2.toArray().sort(_comparator2), x2.storage()); }, - "Array, string": function ArrayString(x2, order) { + "Array, string": function ArrayString(x2, order2) { _arrayIsVector(x2); - return x2.sort(_comparator(order)); + return x2.sort(_comparator(order2)); }, - "Matrix, string": function MatrixString(x2, order) { + "Matrix, string": function MatrixString(x2, order2) { _matrixIsVector(x2); - return matrix2(x2.toArray().sort(_comparator(order)), x2.storage()); + return matrix2(x2.toArray().sort(_comparator(order2)), x2.storage()); } }); - function _comparator(order) { - if (order === "asc") { + function _comparator(order2) { + if (order2 === "asc") { return compareAsc; - } else if (order === "desc") { + } else if (order2 === "desc") { return compareDesc; - } else if (order === "natural") { + } else if (order2 === "natural") { return compareNatural2; } else { throw new Error('String "asc", "desc", or "natural" expected'); @@ -62192,28 +62297,28 @@ var createImmutableDenseMatrixClass = /* @__PURE__ */ factory(name158, dependenc smaller: smaller2, DenseMatrix: DenseMatrix2 } = _ref; - function ImmutableDenseMatrix2(data2, datatype) { + function ImmutableDenseMatrix2(data3, datatype) { if (!(this instanceof ImmutableDenseMatrix2)) { throw new SyntaxError("Constructor must be called with the new operator"); } if (datatype && !isString2(datatype)) { throw new Error("Invalid datatype: " + datatype); } - if (isMatrix(data2) || isArray2(data2)) { - var matrix2 = new DenseMatrix2(data2, datatype); + if (isMatrix(data3) || isArray2(data3)) { + var matrix2 = new DenseMatrix2(data3, datatype); this._data = matrix2._data; this._size = matrix2._size; this._datatype = matrix2._datatype; this._min = null; this._max = null; - } else if (data2 && isArray2(data2.data) && isArray2(data2.size)) { - this._data = data2.data; - this._size = data2.size; - this._datatype = data2.datatype; - this._min = typeof data2.min !== "undefined" ? data2.min : null; - this._max = typeof data2.max !== "undefined" ? data2.max : null; - } else if (data2) { - throw new TypeError("Unsupported type of data (" + typeOf(data2) + ")"); + } else if (data3 && isArray2(data3.data) && isArray2(data3.size)) { + this._data = data3.data; + this._size = data3.size; + this._datatype = data3.datatype; + this._min = typeof data3.min !== "undefined" ? data3.min : null; + this._max = typeof data3.max !== "undefined" ? data3.max : null; + } else if (data3) { + throw new TypeError("Unsupported type of data (" + typeOf(data3) + ")"); } else { this._data = []; this._size = [0]; @@ -62225,10 +62330,10 @@ var createImmutableDenseMatrixClass = /* @__PURE__ */ factory(name158, dependenc ImmutableDenseMatrix2.prototype = new DenseMatrix2(); ImmutableDenseMatrix2.prototype.type = "ImmutableDenseMatrix"; ImmutableDenseMatrix2.prototype.isImmutableDenseMatrix = true; - ImmutableDenseMatrix2.prototype.subset = function(index2) { + ImmutableDenseMatrix2.prototype.subset = function(index3) { switch (arguments.length) { case 1: { - var m4 = DenseMatrix2.prototype.subset.call(this, index2); + var m4 = DenseMatrix2.prototype.subset.call(this, index3); if (isMatrix(m4)) { return new ImmutableDenseMatrix2({ data: m4._data, @@ -62364,16 +62469,16 @@ var createIndexClass = /* @__PURE__ */ factory(name159, dependencies158, (_ref) return new ImmutableDenseMatrix2(arg2); } Index2.prototype.clone = function() { - var index2 = new Index2(); - index2._dimensions = clone(this._dimensions); - index2._isScalar = this._isScalar; - index2._sourceSize = this._sourceSize; - return index2; + var index3 = new Index2(); + index3._dimensions = clone(this._dimensions); + index3._isScalar = this._isScalar; + index3._sourceSize = this._sourceSize; + return index3; }; Index2.create = function(ranges) { - var index2 = new Index2(); - Index2.apply(index2, ranges); - return index2; + var index3 = new Index2(); + Index2.apply(index3, ranges); + return index3; }; Index2.prototype.size = function() { var size2 = []; @@ -62478,28 +62583,28 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159, } FibonacciHeap2.prototype.type = "FibonacciHeap"; FibonacciHeap2.prototype.isFibonacciHeap = true; - FibonacciHeap2.prototype.insert = function(key2, value) { - var node = { - key: key2, + FibonacciHeap2.prototype.insert = function(key3, value) { + var node2 = { + key: key3, value, degree: 0 }; if (this._minimum) { var minimum = this._minimum; - node.left = minimum; - node.right = minimum.right; - minimum.right = node; - node.right.left = node; - if (smaller2(key2, minimum.key)) { - this._minimum = node; + node2.left = minimum; + node2.right = minimum.right; + minimum.right = node2; + node2.right.left = node2; + if (smaller2(key3, minimum.key)) { + this._minimum = node2; } } else { - node.left = node; - node.right = node; - this._minimum = node; + node2.left = node2; + node2.right = node2; + this._minimum = node2; } this._size++; - return node; + return node2; }; FibonacciHeap2.prototype.size = function() { return this._size; @@ -62512,13 +62617,13 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159, return this._size === 0; }; FibonacciHeap2.prototype.extractMinimum = function() { - var node = this._minimum; - if (node === null) { - return node; + var node2 = this._minimum; + if (node2 === null) { + return node2; } var minimum = this._minimum; - var numberOfChildren = node.degree; - var x2 = node.child; + var numberOfChildren = node2.degree; + var x2 = node2.child; while (numberOfChildren > 0) { var tempRight = x2.right; x2.left.right = x2.right; @@ -62531,79 +62636,79 @@ var createFibonacciHeapClass = /* @__PURE__ */ factory(name160, dependencies159, x2 = tempRight; numberOfChildren--; } - node.left.right = node.right; - node.right.left = node.left; - if (node === node.right) { + node2.left.right = node2.right; + node2.right.left = node2.left; + if (node2 === node2.right) { minimum = null; } else { - minimum = node.right; + minimum = node2.right; minimum = _findMinimumNode(minimum, this._size); } this._size--; this._minimum = minimum; - return node; + return node2; }; - FibonacciHeap2.prototype.remove = function(node) { - this._minimum = _decreaseKey(this._minimum, node, -1); + FibonacciHeap2.prototype.remove = function(node2) { + this._minimum = _decreaseKey(this._minimum, node2, -1); this.extractMinimum(); }; - function _decreaseKey(minimum, node, key2) { - node.key = key2; - var parent = node.parent; - if (parent && smaller2(node.key, parent.key)) { - _cut(minimum, node, parent); + function _decreaseKey(minimum, node2, key3) { + node2.key = key3; + var parent = node2.parent; + if (parent && smaller2(node2.key, parent.key)) { + _cut(minimum, node2, parent); _cascadingCut(minimum, parent); } - if (smaller2(node.key, minimum.key)) { - minimum = node; + if (smaller2(node2.key, minimum.key)) { + minimum = node2; } return minimum; } - function _cut(minimum, node, parent) { - node.left.right = node.right; - node.right.left = node.left; + function _cut(minimum, node2, parent) { + node2.left.right = node2.right; + node2.right.left = node2.left; parent.degree--; - if (parent.child === node) { - parent.child = node.right; + if (parent.child === node2) { + parent.child = node2.right; } if (parent.degree === 0) { parent.child = null; } - node.left = minimum; - node.right = minimum.right; - minimum.right = node; - node.right.left = node; - node.parent = null; - node.mark = false; + node2.left = minimum; + node2.right = minimum.right; + minimum.right = node2; + node2.right.left = node2; + node2.parent = null; + node2.mark = false; } - function _cascadingCut(minimum, node) { - var parent = node.parent; + function _cascadingCut(minimum, node2) { + var parent = node2.parent; if (!parent) { return; } - if (!node.mark) { - node.mark = true; + if (!node2.mark) { + node2.mark = true; } else { - _cut(minimum, node, parent); + _cut(minimum, node2, parent); _cascadingCut(parent); } } - var _linkNodes = function _linkNodes2(node, parent) { - node.left.right = node.right; - node.right.left = node.left; - node.parent = parent; + var _linkNodes = function _linkNodes2(node2, parent) { + node2.left.right = node2.right; + node2.right.left = node2.left; + node2.parent = parent; if (!parent.child) { - parent.child = node; - node.right = node; - node.left = node; + parent.child = node2; + node2.right = node2; + node2.left = node2; } else { - node.left = parent.child; - node.right = parent.child.right; - parent.child.right = node; - node.right.left = node; + node2.left = parent.child; + node2.right = parent.child.right; + parent.child.right = node2; + node2.right.left = node2; } parent.degree++; - node.mark = false; + node2.mark = false; }; function _findMinimumNode(minimum, size2) { var arraySize2 = Math.floor(Math.log(size2) * oneOverLogPhi) + 1; @@ -62687,51 +62792,51 @@ var createSpaClass = /* @__PURE__ */ factory(name161, dependencies160, (_ref) => Spa2.prototype.isSpa = true; Spa2.prototype.set = function(i4, v2) { if (!this._values[i4]) { - var node = this._heap.insert(i4, v2); - this._values[i4] = node; + var node2 = this._heap.insert(i4, v2); + this._values[i4] = node2; } else { this._values[i4].value = v2; } }; Spa2.prototype.get = function(i4) { - var node = this._values[i4]; - if (node) { - return node.value; + var node2 = this._values[i4]; + if (node2) { + return node2.value; } return 0; }; Spa2.prototype.accumulate = function(i4, v2) { - var node = this._values[i4]; - if (!node) { - node = this._heap.insert(i4, v2); - this._values[i4] = node; + var node2 = this._values[i4]; + if (!node2) { + node2 = this._heap.insert(i4, v2); + this._values[i4] = node2; } else { - node.value = addScalar2(node.value, v2); + node2.value = addScalar2(node2.value, v2); } }; Spa2.prototype.forEach = function(from, to2, callback) { var heap = this._heap; var values2 = this._values; var nodes = []; - var node = heap.extractMinimum(); - if (node) { - nodes.push(node); + var node2 = heap.extractMinimum(); + if (node2) { + nodes.push(node2); } - while (node && node.key <= to2) { - if (node.key >= from) { - if (!equalScalar2(node.value, 0)) { - callback(node.key, node.value, this); + while (node2 && node2.key <= to2) { + if (node2.key >= from) { + if (!equalScalar2(node2.value, 0)) { + callback(node2.key, node2.value, this); } } - node = heap.extractMinimum(); - if (node) { - nodes.push(node); + node2 = heap.extractMinimum(); + if (node2) { + nodes.push(node2); } } for (var i4 = 0; i4 < nodes.length; i4++) { var n3 = nodes[i4]; - node = heap.insert(n3.key, n3.value); - values2[node.key] = node; + node2 = heap.insert(n3.key, n3.value); + values2[node2.key] = node2; } }; Spa2.prototype.swap = function(i4, j) { @@ -62860,7 +62965,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = Unit2.prototype.constructor = Unit2; Unit2.prototype.type = "Unit"; Unit2.prototype.isUnit = true; - var text2, index2, c3; + var text7, index3, c3; function skipWhitespace() { while (c3 === " " || c3 === " ") { next(); @@ -62873,50 +62978,50 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = return c4 >= "0" && c4 <= "9"; } function next() { - index2++; - c3 = text2.charAt(index2); + index3++; + c3 = text7.charAt(index3); } - function revert(oldIndex) { - index2 = oldIndex; - c3 = text2.charAt(index2); + function revert2(oldIndex) { + index3 = oldIndex; + c3 = text7.charAt(index3); } function parseNumber() { - var number4 = ""; - var oldIndex = index2; + var number5 = ""; + var oldIndex = index3; if (c3 === "+") { next(); } else if (c3 === "-") { - number4 += c3; + number5 += c3; next(); } if (!isDigitDot(c3)) { - revert(oldIndex); + revert2(oldIndex); return null; } if (c3 === ".") { - number4 += c3; + number5 += c3; next(); if (!isDigit(c3)) { - revert(oldIndex); + revert2(oldIndex); return null; } } else { while (isDigit(c3)) { - number4 += c3; + number5 += c3; next(); } if (c3 === ".") { - number4 += c3; + number5 += c3; next(); } } while (isDigit(c3)) { - number4 += c3; + number5 += c3; next(); } if (c3 === "E" || c3 === "e") { var tentativeNumber = ""; - var tentativeIndex = index2; + var tentativeIndex = index3; tentativeNumber += c3; next(); if (c3 === "+" || c3 === "-") { @@ -62924,16 +63029,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = next(); } if (!isDigit(c3)) { - revert(tentativeIndex); - return number4; + revert2(tentativeIndex); + return number5; } - number4 = number4 + tentativeNumber; + number5 = number5 + tentativeNumber; while (isDigit(c3)) { - number4 += c3; + number5 += c3; next(); } } - return number4; + return number5; } function parseUnit() { var unitName = ""; @@ -62958,10 +63063,10 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = } Unit2.parse = function(str, options) { options = options || {}; - text2 = str; - index2 = -1; + text7 = str; + index3 = -1; c3 = ""; - if (typeof text2 !== "string") { + if (typeof text7 !== "string") { throw new TypeError("Invalid argument in Unit.parse, string expected"); } var unit3 = new Unit2(); @@ -63009,7 +63114,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = var oldC = c3; uStr = parseUnit(); if (uStr === null) { - throw new SyntaxError('Unexpected "' + oldC + '" in "' + text2 + '" at index ' + index2.toString()); + throw new SyntaxError('Unexpected "' + oldC + '" in "' + text7 + '" at index ' + index3.toString()); } } else { break; @@ -63022,11 +63127,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = skipWhitespace(); if (parseCharacter("^")) { skipWhitespace(); - var p = parseNumber(); - if (p === null) { + var p2 = parseNumber(); + if (p2 === null) { throw new SyntaxError('In "' + str + '", "^" must be followed by a floating-point number'); } - power *= p; + power *= p2; } unit3.units.push({ unit: res.unit, @@ -63039,7 +63144,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = skipWhitespace(); while (c3 === ")") { if (powerMultiplierStack.length === 0) { - throw new SyntaxError('Unmatched ")" in "' + text2 + '" at index ' + index2.toString()); + throw new SyntaxError('Unmatched ")" in "' + text7 + '" at index ' + index3.toString()); } powerMultiplierStackProduct /= powerMultiplierStack.pop(); next(); @@ -63071,7 +63176,7 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = throw new SyntaxError('Trailing characters: "' + str + '"'); } if (powerMultiplierStack.length !== 0) { - throw new SyntaxError('Unmatched "(" in "' + text2 + '"'); + throw new SyntaxError('Unmatched "(" in "' + text7 + '"'); } if (unit3.units.length === 0 && !options.allowNoUnits) { throw new SyntaxError('"' + str + '" contains no units'); @@ -63088,9 +63193,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = unit3.units = []; for (var i4 = 0; i4 < this.units.length; i4++) { unit3.units[i4] = {}; - for (var p in this.units[i4]) { - if (hasOwnProperty2(this.units[i4], p)) { - unit3.units[i4][p] = this.units[i4][p]; + for (var p2 in this.units[i4]) { + if (hasOwnProperty2(this.units[i4], p2)) { + unit3.units[i4][p2] = this.units[i4][p2]; } } } @@ -63110,11 +63215,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = return value; } var res = value; - var convert = Unit2._getNumberConverter(typeOf(value)); + var convert2 = Unit2._getNumberConverter(typeOf(value)); for (var i4 = 0; i4 < this.units.length; i4++) { - var unitValue = convert(this.units[i4].unit.value); - var unitPrefixValue = convert(this.units[i4].prefix.value); - var unitPower = convert(this.units[i4].power); + var unitValue = convert2(this.units[i4].unit.value); + var unitPrefixValue = convert2(this.units[i4].prefix.value); + var unitPower = convert2(this.units[i4].power); res = multiplyScalar2(res, pow3(multiplyScalar2(unitValue, unitPrefixValue), unitPower)); } return res; @@ -63124,11 +63229,11 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = return value; } var res = value; - var convert = Unit2._getNumberConverter(typeOf(value)); + var convert2 = Unit2._getNumberConverter(typeOf(value)); for (var i4 = 0; i4 < this.units.length; i4++) { - var unitValue = convert(this.units[i4].unit.value); - var unitPrefixValue = convert(this.units[i4].prefix.value); - var unitPower = convert(this.units[i4].power); + var unitValue = convert2(this.units[i4].unit.value); + var unitPrefixValue = convert2(this.units[i4].prefix.value); + var unitPower = convert2(this.units[i4].power); res = divideScalar2(res, pow3(multiplyScalar2(unitValue, unitPrefixValue), unitPower)); } return res; @@ -63166,15 +63271,15 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = Unit2.isValuelessUnit = function(name317) { return _findUnit(name317) !== null; }; - Unit2.prototype.hasBase = function(base2) { - if (typeof base2 === "string") { - base2 = BASE_UNITS[base2]; + Unit2.prototype.hasBase = function(base3) { + if (typeof base3 === "string") { + base3 = BASE_UNITS[base3]; } - if (!base2) { + if (!base3) { return false; } for (var i4 = 0; i4 < BASE_DIMENSIONS.length; i4++) { - if (Math.abs((this.dimensions[i4] || 0) - (base2.dimensions[i4] || 0)) > 1e-12) { + if (Math.abs((this.dimensions[i4] || 0) - (base3.dimensions[i4] || 0)) > 1e-12) { return false; } } @@ -63240,16 +63345,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = } return getNumericIfUnitless(res); }; - Unit2.prototype.pow = function(p) { + Unit2.prototype.pow = function(p2) { var res = this.clone(); for (var i4 = 0; i4 < BASE_DIMENSIONS.length; i4++) { - res.dimensions[i4] = (this.dimensions[i4] || 0) * p; + res.dimensions[i4] = (this.dimensions[i4] || 0) * p2; } for (var _i3 = 0; _i3 < res.units.length; _i3++) { - res.units[_i3].power *= p; + res.units[_i3].power *= p2; } if (res.value !== null) { - res.value = pow3(res.value, p); + res.value = pow3(res.value, p2); } else { res.value = null; } @@ -63269,9 +63374,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) { ret.value = abs3(ret.value); } else { - var convert = ret._numberConverter(); - var unitValue = convert(ret.units[0].unit.value); - var nominalOffset = convert(ret.units[0].unit.offset); + var convert2 = ret._numberConverter(); + var unitValue = convert2(ret.units[0].unit.value); + var nominalOffset = convert2(ret.units[0].unit.offset); var unitOffset = multiplyScalar2(unitValue, nominalOffset); ret.value = subtractScalar2(abs3(addScalar2(ret.value, unitOffset)), unitOffset); } @@ -63302,14 +63407,14 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) { other.value = clone(value); } else { - var convert = Unit2._getNumberConverter(typeOf(value)); + var convert2 = Unit2._getNumberConverter(typeOf(value)); var thisUnitValue = this.units[0].unit.value; var thisNominalOffset = this.units[0].unit.offset; var thisUnitOffset = multiplyScalar2(thisUnitValue, thisNominalOffset); var otherUnitValue = other.units[0].unit.value; var otherNominalOffset = other.units[0].unit.offset; var otherUnitOffset = multiplyScalar2(otherUnitValue, otherNominalOffset); - other.value = addScalar2(value, convert(subtractScalar2(thisUnitOffset, otherUnitOffset))); + other.value = addScalar2(value, convert2(subtractScalar2(thisUnitOffset, otherUnitOffset))); } other.fixPrefix = true; other.skipAutomaticSimplification = true; @@ -63352,10 +63457,10 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = var ret = this.clone(); var proposedUnitList = []; var matchingBase; - for (var key3 in currentUnitSystem) { - if (hasOwnProperty2(currentUnitSystem, key3)) { - if (ret.hasBase(BASE_UNITS[key3])) { - matchingBase = key3; + for (var key4 in currentUnitSystem) { + if (hasOwnProperty2(currentUnitSystem, key4)) { + if (ret.hasBase(BASE_UNITS[key4])) { + matchingBase = key4; break; } } @@ -63523,9 +63628,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = return bestPrefix; bestDiff = Math.abs(bestDiff); var prefixes = this.units[0].unit.prefixes; - for (var p in prefixes) { - if (hasOwnProperty2(prefixes, p)) { - var prefix = prefixes[p]; + for (var p2 in prefixes) { + if (hasOwnProperty2(prefixes, p2)) { + var prefix = prefixes[p2]; if (prefix.scientific) { var diff2 = Math.abs(Math.log(absValue / Math.pow(prefix.value * absUnitValue, power)) / Math.LN10 - 1.2); if (diff2 < bestDiff || diff2 === bestDiff && prefix.name.length < bestPrefix.name.length) { @@ -64365,9 +64470,9 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1] } }; - for (var key2 in BASE_UNITS) { - if (hasOwnProperty2(BASE_UNITS, key2)) { - BASE_UNITS[key2].key = key2; + for (var key3 in BASE_UNITS) { + if (hasOwnProperty2(BASE_UNITS, key3)) { + BASE_UNITS[key3].key = key3; } } var BASE_UNIT_NONE = {}; @@ -65814,16 +65919,16 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = Complex: function Complex4(x2) { return x2; }, - number: function number4(x2) { + number: function number5(x2) { if (x2 !== null && x2 !== void 0 && x2.isFraction) return _number(x2); return x2; } }; Unit2.prototype._numberConverter = function() { - var convert = Unit2.typeConverters[this.valueType()]; - if (convert) { - return convert; + var convert2 = Unit2.typeConverters[this.valueType()]; + if (convert2) { + return convert2; } throw new TypeError('Unsupported Unit value type "' + this.valueType() + '"'); }; @@ -65904,17 +66009,17 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = var defUnit = null; var aliases = []; var offset2 = 0; - var definition; + var definition3; var prefixes; var baseName; if (obj && obj.type === "Unit") { defUnit = obj.clone(); } else if (typeof obj === "string") { if (obj !== "") { - definition = obj; + definition3 = obj; } } else if (typeof obj === "object") { - definition = obj.definition; + definition3 = obj.definition; prefixes = obj.prefixes; offset2 = obj.offset; baseName = obj.baseName; @@ -65931,17 +66036,17 @@ var createUnitClass = /* @__PURE__ */ factory(name162, dependencies161, (_ref) = } } } - if (definition && typeof definition === "string" && !defUnit) { + if (definition3 && typeof definition3 === "string" && !defUnit) { try { - defUnit = Unit2.parse(definition, { + defUnit = Unit2.parse(definition3, { allowNoUnits: true }); } catch (ex) { - ex.message = 'Could not create unit "' + name317 + '" from "' + definition + '": ' + ex.message; + ex.message = 'Could not create unit "' + name317 + '" from "' + definition3 + '": ' + ex.message; throw ex; } - } else if (definition && definition.type === "Unit") { - defUnit = definition.clone(); + } else if (definition3 && definition3.type === "Unit") { + defUnit = definition3.clone(); } aliases = aliases || []; offset2 = offset2 || 0; @@ -66063,7 +66168,7 @@ var createUnitFunction = /* @__PURE__ */ factory(name163, dependencies162, (_ref Unit: function Unit3(x2) { return x2.clone(); }, - string: function string4(x2) { + string: function string6(x2) { if (Unit2.isValuelessUnit(x2)) { return new Unit2(null, x2); } @@ -66093,14 +66198,14 @@ var createSparse = /* @__PURE__ */ factory(name164, dependencies163, (_ref) => { "": function _15() { return new SparseMatrix2([]); }, - string: function string4(datatype) { + string: function string6(datatype) { return new SparseMatrix2([], datatype); }, - "Array | Matrix": function ArrayMatrix(data2) { - return new SparseMatrix2(data2); + "Array | Matrix": function ArrayMatrix(data3) { + return new SparseMatrix2(data3); }, - "Array | Matrix, string": function ArrayMatrixString(data2, datatype) { - return new SparseMatrix2(data2, datatype); + "Array | Matrix, string": function ArrayMatrixString(data3, datatype) { + return new SparseMatrix2(data3, datatype); } }); }); @@ -66130,7 +66235,7 @@ var createCreateUnit = /* @__PURE__ */ factory(name165, dependencies164, (_ref) obj[name317] = def; return Unit2.createUnit(obj, {}); }, - string: function string4(name317) { + string: function string6(name317) { var obj = {}; obj[name317] = {}; return Unit2.createUnit(obj, {}); @@ -66148,7 +66253,7 @@ var createAcos = /* @__PURE__ */ factory(name166, dependencies165, (_ref) => { Complex: Complex3 } = _ref; return typed3(name166, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= -1 && x2 <= 1 || config4.predictable) { return Math.acos(x2); } else { @@ -66174,7 +66279,7 @@ var createAcosh = /* @__PURE__ */ factory(name167, dependencies166, (_ref) => { Complex: Complex3 } = _ref; return typed3(name167, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= 1 || config4.predictable) { return acoshNumber(x2); } @@ -66222,7 +66327,7 @@ var createAcoth = /* @__PURE__ */ factory(name169, dependencies168, (_ref) => { BigNumber: _BigNumber } = _ref; return typed3(name169, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= 1 || x2 <= -1 || config4.predictable) { return acothNumber(x2); } @@ -66248,7 +66353,7 @@ var createAcsc = /* @__PURE__ */ factory(name170, dependencies169, (_ref) => { BigNumber: _BigNumber } = _ref; return typed3(name170, { - number: function number4(x2) { + number: function number5(x2) { if (x2 <= -1 || x2 >= 1 || config4.predictable) { return acscNumber(x2); } @@ -66293,7 +66398,7 @@ var createAsec = /* @__PURE__ */ factory(name172, dependencies171, (_ref) => { BigNumber: _BigNumber } = _ref; return typed3(name172, { - number: function number4(x2) { + number: function number5(x2) { if (x2 <= -1 || x2 >= 1 || config4.predictable) { return asecNumber(x2); } @@ -66319,7 +66424,7 @@ var createAsech = /* @__PURE__ */ factory(name173, dependencies172, (_ref) => { BigNumber: _BigNumber } = _ref; return typed3(name173, { - number: function number4(x2) { + number: function number5(x2) { if (x2 <= 1 && x2 >= -1 || config4.predictable) { var xInv = 1 / x2; if (xInv > 0 || config4.predictable) { @@ -66349,7 +66454,7 @@ var createAsin = /* @__PURE__ */ factory(name174, dependencies173, (_ref) => { Complex: Complex3 } = _ref; return typed3(name174, { - number: function number4(x2) { + number: function number5(x2) { if (x2 >= -1 && x2 <= 1 || config4.predictable) { return Math.asin(x2); } else { @@ -66391,7 +66496,7 @@ var createAtan = /* @__PURE__ */ factory(name176, dependencies175, (_ref) => { typed: typed3 } = _ref; return typed3("atan", { - number: function number4(x2) { + number: function number5(x2) { return Math.atan(x2); }, Complex: function Complex3(x2) { @@ -66462,7 +66567,7 @@ var createAtanh = /* @__PURE__ */ factory(name178, dependencies177, (_ref) => { Complex: Complex3 } = _ref; return typed3(name178, { - number: function number4(x2) { + number: function number5(x2) { if (x2 <= 1 && x2 >= -1 || config4.predictable) { return atanhNumber(x2); } @@ -66913,10 +67018,10 @@ var createSetPowerset = /* @__PURE__ */ factory(name197, dependencies196, (_ref) } var b2 = flatten(Array.isArray(a4) ? a4 : a4.toArray()).sort(compareNatural2); var result = []; - var number4 = 0; - while (number4.toString(2).length <= b2.length) { - result.push(_subset(b2, number4.toString(2).split("").reverse())); - number4++; + var number5 = 0; + while (number5.toString(2).length <= b2.length) { + result.push(_subset(b2, number5.toString(2).split("").reverse())); + number5++; } return _sort(result); } @@ -67139,7 +67244,7 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { BigNumber: function BigNumber2(x2) { return x2.abs(); }, - boolean: function boolean2(x2) { + boolean: function boolean3(x2) { return Math.abs(x2); }, Array: function Array2(x2) { @@ -67148,11 +67253,11 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { Matrix: function Matrix2(x2) { return _norm(x2, 2); }, - "Array, number | BigNumber | string": function ArrayNumberBigNumberString(x2, p) { - return _norm(matrix2(x2), p); + "Array, number | BigNumber | string": function ArrayNumberBigNumberString(x2, p2) { + return _norm(matrix2(x2), p2); }, - "Matrix, number | BigNumber | string": function MatrixNumberBigNumberString(x2, p) { - return _norm(x2, p); + "Matrix, number | BigNumber | string": function MatrixNumberBigNumberString(x2, p2) { + return _norm(x2, p2); } }); function _vectorNormPlusInfinity(x2) { @@ -67175,23 +67280,23 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { }, true); return ninf || 0; } - function _vectorNorm(x2, p) { - if (p === Number.POSITIVE_INFINITY || p === "inf") { + function _vectorNorm(x2, p2) { + if (p2 === Number.POSITIVE_INFINITY || p2 === "inf") { return _vectorNormPlusInfinity(x2); } - if (p === Number.NEGATIVE_INFINITY || p === "-inf") { + if (p2 === Number.NEGATIVE_INFINITY || p2 === "-inf") { return _vectorNormMinusInfinity(x2); } - if (p === "fro") { + if (p2 === "fro") { return _norm(x2, 2); } - if (typeof p === "number" && !isNaN(p)) { - if (!equalScalar2(p, 0)) { + if (typeof p2 === "number" && !isNaN(p2)) { + if (!equalScalar2(p2, 0)) { var n3 = 0; x2.forEach(function(value) { - n3 = add4(pow3(abs3(value), p), n3); + n3 = add4(pow3(abs3(value), p2), n3); }, true); - return pow3(n3, 1 / p); + return pow3(n3, 1 / p2); } return Number.POSITIVE_INFINITY; } @@ -67199,7 +67304,7 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { } function _matrixNormFrobenius(x2) { var fro = 0; - x2.forEach(function(value, index2) { + x2.forEach(function(value, index3) { fro = add4(fro, multiply2(value, conj2(value))); }); return abs3(sqrt3(fro)); @@ -67207,8 +67312,8 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { function _matrixNormOne(x2) { var c3 = []; var maxc = 0; - x2.forEach(function(value, index2) { - var j = index2[1]; + x2.forEach(function(value, index3) { + var j = index3[1]; var cj = add4(c3[j] || 0, abs3(value)); if (larger2(cj, maxc)) { maxc = cj; @@ -67231,8 +67336,8 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { function _matrixNormInfinity(x2) { var r2 = []; var maxr = 0; - x2.forEach(function(value, index2) { - var i4 = index2[0]; + x2.forEach(function(value, index3) { + var i4 = index3[0]; var ri = add4(r2[i4] || 0, abs3(value)); if (larger2(ri, maxr)) { maxr = ri; @@ -67241,29 +67346,29 @@ var createNorm = /* @__PURE__ */ factory(name203, dependencies202, (_ref) => { }, true); return maxr; } - function _matrixNorm(x2, p) { - if (p === 1) { + function _matrixNorm(x2, p2) { + if (p2 === 1) { return _matrixNormOne(x2); } - if (p === Number.POSITIVE_INFINITY || p === "inf") { + if (p2 === Number.POSITIVE_INFINITY || p2 === "inf") { return _matrixNormInfinity(x2); } - if (p === "fro") { + if (p2 === "fro") { return _matrixNormFrobenius(x2); } - if (p === 2) { + if (p2 === 2) { return _matrixNormTwo(x2); } - throw new Error("Unsupported parameter value " + p); + throw new Error("Unsupported parameter value " + p2); } - function _norm(x2, p) { + function _norm(x2, p2) { var sizeX = x2.size(); if (sizeX.length === 1) { - return _vectorNorm(x2, p); + return _vectorNorm(x2, p2); } if (sizeX.length === 2) { if (sizeX[0] && sizeX[1]) { - return _matrixNorm(x2, p); + return _matrixNorm(x2, p2); } else { throw new RangeError("Invalid matrix dimensions"); } @@ -67321,9 +67426,9 @@ var createDot = /* @__PURE__ */ factory(name204, dependencies203, (_ref) => { var add4 = addScalar2; var mul2 = multiplyScalar2; if (adt && bdt && adt === bdt && typeof adt === "string" && adt !== "mixed") { - var dt = adt; - add4 = typed3.find(addScalar2, [dt, dt]); - mul2 = typed3.find(multiplyScalar2, [dt, dt]); + var dt2 = adt; + add4 = typed3.find(addScalar2, [dt2, dt2]); + mul2 = typed3.find(multiplyScalar2, [dt2, dt2]); } if (!aIsColumn && !bIsColumn) { var c3 = mul2(conj2(adata[0]), bdata[0]); @@ -67408,11 +67513,11 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => { }); function _denseTrace(m4) { var size2 = m4._size; - var data2 = m4._data; + var data3 = m4._data; switch (size2.length) { case 1: if (size2[0] === 1) { - return clone(data2[0]); + return clone(data3[0]); } throw new RangeError("Matrix must be square (size: " + format4(size2) + ")"); case 2: { @@ -67421,7 +67526,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => { if (rows === cols) { var sum4 = 0; for (var i4 = 0; i4 < rows; i4++) { - sum4 = add4(sum4, data2[i4][i4]); + sum4 = add4(sum4, data3[i4][i4]); } return sum4; } else { @@ -67434,7 +67539,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => { } function _sparseTrace(m4) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var size2 = m4._size; var rows = size2[0]; @@ -67446,7 +67551,7 @@ var createTrace = /* @__PURE__ */ factory(name205, dependencies204, (_ref) => { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { sum4 = add4(sum4, values2[k2]); break; @@ -67540,25 +67645,25 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => { map(callback) { throw new Error("Cannot run map on a Node interface"); } - _ifNode(node) { - if (!isNode2(node)) { + _ifNode(node2) { + if (!isNode2(node2)) { throw new TypeError("Callback function must return a Node"); } - return node; + return node2; } traverse(callback) { callback(this, null, null); - function _traverse(node, callback2) { - node.forEach(function(child, path2, parent) { - callback2(child, path2, parent); + function _traverse(node2, callback2) { + node2.forEach(function(child, path3, parent) { + callback2(child, path3, parent); _traverse(child, callback2); }); } _traverse(this, callback); } transform(callback) { - function _transform(child, path2, parent) { - var replacement = callback(child, path2, parent); + function _transform(child, path3, parent) { + var replacement = callback(child, path3, parent); if (replacement !== child) { return replacement; } @@ -67568,9 +67673,9 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => { } filter(callback) { var nodes = []; - this.traverse(function(node, path2, parent) { - if (callback(node, path2, parent)) { - nodes.push(node); + this.traverse(function(node2, path3, parent) { + if (callback(node2, path3, parent)) { + nodes.push(node2); } }); return nodes; @@ -67579,8 +67684,8 @@ var createNode = /* @__PURE__ */ factory(name207, dependencies206, (_ref) => { throw new Error("Cannot clone a Node interface"); } cloneDeep() { - return this.map(function(node) { - return node.cloneDeep(); + return this.map(function(node2) { + return node2.cloneDeep(); }); } equals(other) { @@ -67658,19 +67763,19 @@ function accessFactory(_ref) { var { subset: subset2 } = _ref; - return function access(object, index2) { + return function access(object, index3) { try { if (Array.isArray(object)) { - return subset2(object, index2); + return subset2(object, index3); } else if (object && typeof object.subset === "function") { - return object.subset(index2); + return object.subset(index3); } else if (typeof object === "string") { - return subset2(object, index2); + return subset2(object, index3); } else if (typeof object === "object") { - if (!index2.isObjectProperty()) { + if (!index3.isObjectProperty()) { throw new TypeError("Cannot apply a numeric index as object property"); } - return getSafeProperty(object, index2.getObjectProperty()); + return getSafeProperty(object, index3.getObjectProperty()); } else { throw new TypeError("Cannot apply index: unsupported type of object"); } @@ -67691,20 +67796,20 @@ var createAccessorNode = /* @__PURE__ */ factory(name208, dependencies207, (_ref var access = accessFactory({ subset: subset2 }); - function needParenthesis(node) { - return !(isAccessorNode(node) || isArrayNode(node) || isConstantNode(node) || isFunctionNode(node) || isObjectNode(node) || isParenthesisNode(node) || isSymbolNode(node)); + function needParenthesis(node2) { + return !(isAccessorNode(node2) || isArrayNode(node2) || isConstantNode(node2) || isFunctionNode(node2) || isObjectNode(node2) || isParenthesisNode(node2) || isSymbolNode(node2)); } class AccessorNode2 extends Node4 { - constructor(object, index2) { + constructor(object, index3) { super(); if (!isNode2(object)) { throw new TypeError('Node expected for parameter "object"'); } - if (!isIndexNode(index2)) { + if (!isIndexNode(index3)) { throw new TypeError('IndexNode expected for parameter "index"'); } this.object = object; - this.index = index2; + this.index = index3; } get name() { if (this.index) { @@ -67730,8 +67835,8 @@ var createAccessorNode = /* @__PURE__ */ factory(name208, dependencies207, (_ref } else { return function evalAccessorNode(scope, args, context) { var object = evalObject(scope, args, context); - var index2 = evalIndex(scope, args, object); - return access(object, index2); + var index3 = evalIndex(scope, args, object); + return access(object, index3); }; } } @@ -67827,8 +67932,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) = } forEach(callback) { for (var i4 = 0; i4 < this.items.length; i4++) { - var node = this.items[i4]; - callback(node, "items[" + i4 + "]", this); + var node2 = this.items[i4]; + callback(node2, "items[" + i4 + "]", this); } } map(callback) { @@ -67842,8 +67947,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) = return new ArrayNode2(this.items.slice(0)); } _toString(options) { - var items = this.items.map(function(node) { - return node.toString(options); + var items = this.items.map(function(node2) { + return node2.toString(options); }); return "[" + items.join(", ") + "]"; } @@ -67857,8 +67962,8 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) = return new ArrayNode2(json.items); } _toHTML(options) { - var items = this.items.map(function(node) { - return node.toHTML(options); + var items = this.items.map(function(node2) { + return node2.toHTML(options); }); return '[' + items.join(',') + ']'; } @@ -67867,11 +67972,11 @@ var createArrayNode = /* @__PURE__ */ factory(name209, dependencies208, (_ref) = var mixedItems = items.some(isArrayNode) && !items.every(isArrayNode); var itemsFormRow = nested || mixedItems; var itemSep = itemsFormRow ? "&" : "\\\\"; - var itemsTex = items.map(function(node) { - if (node.items) { - return itemsToTex(node.items, !nested); + var itemsTex = items.map(function(node2) { + if (node2.items) { + return itemsToTex(node2.items, !nested); } else { - return node.toTex(options); + return node2.toTex(options); } }).join(itemSep); return mixedItems || !itemsFormRow || itemsFormRow && !nested ? "\\begin{bmatrix}" + itemsTex + "\\end{bmatrix}" : itemsTex; @@ -67892,23 +67997,23 @@ function assignFactory(_ref) { subset: subset2, matrix: matrix2 } = _ref; - return function assign(object, index2, value) { + return function assign(object, index3, value) { try { if (Array.isArray(object)) { - var result = matrix2(object).subset(index2, value).valueOf(); - result.forEach((item, index3) => { - object[index3] = item; + var result = matrix2(object).subset(index3, value).valueOf(); + result.forEach((item, index4) => { + object[index4] = item; }); return object; } else if (object && typeof object.subset === "function") { - return object.subset(index2, value); + return object.subset(index3, value); } else if (typeof object === "string") { - return subset2(object, index2, value); + return subset2(object, index3, value); } else if (typeof object === "object") { - if (!index2.isObjectProperty()) { + if (!index3.isObjectProperty()) { throw TypeError("Cannot apply a numeric index as object property"); } - setSafeProperty(object, index2.getObjectProperty(), value); + setSafeProperty(object, index3.getObjectProperty(), value); return object; } else { throw new TypeError("Cannot apply index: unsupported type of object"); @@ -68112,17 +68217,17 @@ var properties2 = [{ function unwrapParen(_node, parenthesis) { if (!parenthesis || parenthesis !== "auto") return _node; - var node = _node; - while (isParenthesisNode(node)) - node = node.content; - return node; + var node2 = _node; + while (isParenthesisNode(node2)) + node2 = node2.content; + return node2; } function getPrecedence(_node, parenthesis, implicit, parent) { - var node = _node; + var node2 = _node; if (parenthesis !== "keep") { - node = _node.getContent(); + node2 = _node.getContent(); } - var identifier = node.getIdentifier(); + var identifier = node2.getIdentifier(); var precedence = null; for (var i4 = 0; i4 < properties2.length; i4++) { if (identifier in properties2[i4]) { @@ -68130,8 +68235,8 @@ function getPrecedence(_node, parenthesis, implicit, parent) { break; } } - if (identifier === "OperatorNode:multiply" && node.implicit && implicit !== "show") { - var leftArg = unwrapParen(node.args[0], parenthesis); + if (identifier === "OperatorNode:multiply" && node2.implicit && implicit !== "show") { + var leftArg = unwrapParen(node2.args[0], parenthesis); if (!(isConstantNode(leftArg) && parent && parent.getIdentifier() === "OperatorNode:divide" && rule2Node(unwrapParen(parent.args[0], parenthesis))) && !(leftArg.getIdentifier() === "OperatorNode:divide" && rule2Node(unwrapParen(leftArg.args[0], parenthesis)) && isConstantNode(unwrapParen(leftArg.args[1])))) { precedence += 1; } @@ -68139,16 +68244,16 @@ function getPrecedence(_node, parenthesis, implicit, parent) { return precedence; } function getAssociativity(_node, parenthesis) { - var node = _node; + var node2 = _node; if (parenthesis !== "keep") { - node = _node.getContent(); + node2 = _node.getContent(); } - var identifier = node.getIdentifier(); - var index2 = getPrecedence(node, parenthesis); - if (index2 === null) { + var identifier = node2.getIdentifier(); + var index3 = getPrecedence(node2, parenthesis); + if (index3 === null) { return null; } - var property = properties2[index2][identifier]; + var property = properties2[index3][identifier]; if (hasOwnProperty2(property, "associativity")) { if (property.associativity === "left") { return "left"; @@ -68165,11 +68270,11 @@ function isAssociativeWith(nodeA, nodeB, parenthesis) { var b2 = parenthesis !== "keep" ? nodeA.getContent() : nodeB; var identifierA = a4.getIdentifier(); var identifierB = b2.getIdentifier(); - var index2 = getPrecedence(a4, parenthesis); - if (index2 === null) { + var index3 = getPrecedence(a4, parenthesis); + if (index3 === null) { return null; } - var property = properties2[index2][identifierA]; + var property = properties2[index3][identifierA]; if (hasOwnProperty2(property, "associativeWith") && property.associativeWith instanceof Array) { for (var i4 = 0; i4 < property.associativeWith.length; i4++) { if (property.associativeWith[i4] === identifierB) { @@ -68210,20 +68315,20 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r subset: subset2, matrix: matrix2 }); - function needParenthesis(node, parenthesis, implicit) { + function needParenthesis(node2, parenthesis, implicit) { if (!parenthesis) { parenthesis = "keep"; } - var precedence = getPrecedence(node, parenthesis, implicit); - var exprPrecedence = getPrecedence(node.value, parenthesis, implicit); + var precedence = getPrecedence(node2, parenthesis, implicit); + var exprPrecedence = getPrecedence(node2.value, parenthesis, implicit); return parenthesis === "all" || exprPrecedence !== null && exprPrecedence <= precedence; } class AssignmentNode2 extends Node4 { - constructor(object, index2, value) { + constructor(object, index3, value) { super(); this.object = object; - this.index = value ? index2 : null; - this.value = value || index2; + this.index = value ? index3 : null; + this.value = value || index3; if (!isSymbolNode(object) && !isAccessorNode(object)) { throw new TypeError('SymbolNode or AccessorNode expected as "object"'); } @@ -68276,8 +68381,8 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r return function evalAssignmentNode(scope, args, context) { var childObject = evalObject(scope, args, context); var value = evalValue(scope, args, context); - var index2 = evalIndex(scope, args, childObject); - scope.set(name317, assign(childObject, index2, value)); + var index3 = evalIndex(scope, args, childObject); + scope.set(name317, assign(childObject, index3, value)); return value; }; } else { @@ -68287,9 +68392,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r return function evalAssignmentNode(scope, args, context) { var parent = evalParentObject(scope, args, context); var childObject = getSafeProperty(parent, parentProp); - var index2 = evalIndex(scope, args, childObject); + var index3 = evalIndex(scope, args, childObject); var value = evalValue(scope, args, context); - setSafeProperty(parent, parentProp, assign(childObject, index2, value)); + setSafeProperty(parent, parentProp, assign(childObject, index3, value)); return value; }; } else { @@ -68298,9 +68403,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r var parent = evalParentObject(scope, args, context); var parentIndex = evalParentIndex(scope, args, parent); var childObject = access(parent, parentIndex); - var index2 = evalIndex(scope, args, childObject); + var index3 = evalIndex(scope, args, childObject); var value = evalValue(scope, args, context); - assign(parent, parentIndex, assign(childObject, index2, value)); + assign(parent, parentIndex, assign(childObject, index3, value)); return value; }; } @@ -68315,21 +68420,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r } map(callback) { var object = this._ifNode(callback(this.object, "object", this)); - var index2 = this.index ? this._ifNode(callback(this.index, "index", this)) : null; + var index3 = this.index ? this._ifNode(callback(this.index, "index", this)) : null; var value = this._ifNode(callback(this.value, "value", this)); - return new AssignmentNode2(object, index2, value); + return new AssignmentNode2(object, index3, value); } clone() { return new AssignmentNode2(this.object, this.index, this.value); } _toString(options) { var object = this.object.toString(options); - var index2 = this.index ? this.index.toString(options) : ""; + var index3 = this.index ? this.index.toString(options) : ""; var value = this.value.toString(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = "(" + value + ")"; } - return object + index2 + " = " + value; + return object + index3 + " = " + value; } toJSON() { return { @@ -68344,21 +68449,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name210, dependencies209, (_r } _toHTML(options) { var object = this.object.toHTML(options); - var index2 = this.index ? this.index.toHTML(options) : ""; + var index3 = this.index ? this.index.toHTML(options) : ""; var value = this.value.toHTML(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = '(' + value + ')'; } - return object + index2 + '=' + value; + return object + index3 + '=' + value; } _toTex(options) { var object = this.object.toTex(options); - var index2 = this.index ? this.index.toTex(options) : ""; + var index3 = this.index ? this.index.toTex(options) : ""; var value = this.value.toTex(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = "\\left(".concat(value, "\\right)"); } - return object + index2 + "=" + value; + return object + index3 + "=" + value; } } _defineProperty(AssignmentNode2, "name", name210); @@ -68382,15 +68487,15 @@ var createBlockNode = /* @__PURE__ */ factory(name211, dependencies210, (_ref) = if (!Array.isArray(blocks)) throw new Error("Array expected"); this.blocks = blocks.map(function(block) { - var node = block && block.node; + var node2 = block && block.node; var visible = block && block.visible !== void 0 ? block.visible : true; - if (!isNode2(node)) + if (!isNode2(node2)) throw new TypeError('Property "node" must be a Node'); if (typeof visible !== "boolean") { throw new TypeError('Property "visible" must be a boolean'); } return { - node, + node: node2, visible }; }); @@ -68428,9 +68533,9 @@ var createBlockNode = /* @__PURE__ */ factory(name211, dependencies210, (_ref) = var blocks = []; for (var i4 = 0; i4 < this.blocks.length; i4++) { var block = this.blocks[i4]; - var node = this._ifNode(callback(block.node, "blocks[" + i4 + "].node", this)); + var node2 = this._ifNode(callback(block.node, "blocks[" + i4 + "].node", this)); blocks[i4] = { - node, + node: node2, visible: block.visible }; } @@ -69004,8 +69109,8 @@ var latexFunctions = { to: { 2: "\\left(${args[0]}".concat(latexOperators.to, "${args[1]}\\right)") }, - numeric: function numeric(node, options) { - return node.args[0].toTex(); + numeric: function numeric(node2, options) { + return node2.args[0].toTex(); }, number: { 0: "0", @@ -69043,8 +69148,8 @@ var defaultTemplate = "\\mathrm{${name}}\\left(${args}\\right)"; var latexUnits = { deg: "^\\circ" }; -function escapeLatex(string4) { - return (0, import_escape_latex.default)(string4, { +function escapeLatex(string6) { + return (0, import_escape_latex.default)(string6, { preserveFormatting: true }); } @@ -69137,9 +69242,9 @@ var createConstantNode = /* @__PURE__ */ factory(name213, dependencies212, (_ref if (!finite) { return this.value.valueOf() < 0 ? "-\\infty" : "\\infty"; } - var index2 = value.toLowerCase().indexOf("e"); - if (index2 !== -1) { - return value.substring(0, index2) + "\\cdot10^{" + value.substring(index2 + 1) + "}"; + var index3 = value.toLowerCase().indexOf("e"); + if (index3 !== -1) { + return value.substring(0, index3) + "\\cdot10^{" + value.substring(index3 + 1) + "}"; } return value; } @@ -69165,9 +69270,9 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(name214, dependencies typed: typed3, Node: Node4 } = _ref; - function needParenthesis(node, parenthesis, implicit) { - var precedence = getPrecedence(node, parenthesis, implicit); - var exprPrecedence = getPrecedence(node.expr, parenthesis, implicit); + function needParenthesis(node2, parenthesis, implicit) { + var precedence = getPrecedence(node2, parenthesis, implicit); + var exprPrecedence = getPrecedence(node2.expr, parenthesis, implicit); return parenthesis === "all" || exprPrecedence !== null && exprPrecedence <= precedence; } class FunctionAssignmentNode2 extends Node4 { @@ -69257,10 +69362,10 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(name214, dependencies return { mathjs: name214, name: this.name, - params: this.params.map(function(param, index2) { + params: this.params.map(function(param, index3) { return { name: param, - type: types2[index2] + type: types2[index3] }; }), expr: this.expr @@ -69325,7 +69430,7 @@ var createIndexNode = /* @__PURE__ */ factory(name215, dependencies214, (_ref) = } _compile(math2, argNames) { var evalDimensions = map(this.dimensions, function(dimension, i4) { - var needsEnd = dimension.filter((node) => node.isSymbolNode && node.name === "end").length > 0; + var needsEnd = dimension.filter((node2) => node2.isSymbolNode && node2.name === "end").length > 0; if (needsEnd) { var childArgNames = Object.create(argNames); childArgNames.end = true; @@ -69343,12 +69448,12 @@ var createIndexNode = /* @__PURE__ */ factory(name215, dependencies214, (_ref) = return dimension._compile(math2, argNames); } }); - var index2 = getSafeProperty(math2, "index"); + var index3 = getSafeProperty(math2, "index"); return function evalIndexNode(scope, args, context) { var dimensions = map(evalDimensions, function(evalDimension) { return evalDimension(scope, args, context); }); - return index2(...dimensions); + return index3(...dimensions); }; } forEach(callback) { @@ -69422,8 +69527,8 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref) super(); this.properties = properties3 || {}; if (properties3) { - if (!(typeof properties3 === "object") || !Object.keys(properties3).every(function(key2) { - return isNode2(properties3[key2]); + if (!(typeof properties3 === "object") || !Object.keys(properties3).every(function(key3) { + return isNode2(properties3[key3]); })) { throw new TypeError("Object containing Nodes expected"); } @@ -69437,11 +69542,11 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref) } _compile(math2, argNames) { var evalEntries = {}; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - var stringifiedKey = stringify2(key2); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + var stringifiedKey = stringify2(key3); var parsedKey = JSON.parse(stringifiedKey); - var prop2 = getSafeProperty(this.properties, key2); + var prop2 = getSafeProperty(this.properties, key3); evalEntries[parsedKey] = prop2._compile(math2, argNames); } } @@ -69456,35 +69561,35 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref) }; } forEach(callback) { - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - callback(this.properties[key2], "properties[" + stringify2(key2) + "]", this); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + callback(this.properties[key3], "properties[" + stringify2(key3) + "]", this); } } } map(callback) { var properties3 = {}; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - properties3[key2] = this._ifNode(callback(this.properties[key2], "properties[" + stringify2(key2) + "]", this)); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + properties3[key3] = this._ifNode(callback(this.properties[key3], "properties[" + stringify2(key3) + "]", this)); } } return new ObjectNode2(properties3); } clone() { var properties3 = {}; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - properties3[key2] = this.properties[key2]; + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + properties3[key3] = this.properties[key3]; } } return new ObjectNode2(properties3); } _toString(options) { var entries = []; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - entries.push(stringify2(key2) + ": " + this.properties[key2].toString(options)); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + entries.push(stringify2(key3) + ": " + this.properties[key3].toString(options)); } } return "{" + entries.join(", ") + "}"; @@ -69500,18 +69605,18 @@ var createObjectNode = /* @__PURE__ */ factory(name216, dependencies215, (_ref) } _toHTML(options) { var entries = []; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - entries.push('' + escape(key2) + ':' + this.properties[key2].toHTML(options)); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + entries.push('' + escape(key3) + ':' + this.properties[key3].toHTML(options)); } } return '{' + entries.join(',') + '}'; } _toTex(options) { var entries = []; - for (var key2 in this.properties) { - if (hasOwnProperty2(this.properties, key2)) { - entries.push("\\mathbf{" + key2 + ":} & " + this.properties[key2].toTex(options) + "\\\\"); + for (var key3 in this.properties) { + if (hasOwnProperty2(this.properties, key3)) { + entries.push("\\mathbf{" + key3 + ":} & " + this.properties[key3].toTex(options) + "\\\\"); } } var tex = "\\left\\{\\begin{array}{ll}" + entries.join("\n") + "\\end{array}\\right\\}"; @@ -69550,10 +69655,10 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } return false; } - function calculateNecessaryParentheses(root, parenthesis, implicit, args, latex) { - var precedence = getPrecedence(root, parenthesis, implicit); - var associativity = getAssociativity(root, parenthesis); - if (parenthesis === "all" || args.length > 2 && root.getIdentifier() !== "OperatorNode:add" && root.getIdentifier() !== "OperatorNode:multiply") { + function calculateNecessaryParentheses(root4, parenthesis, implicit, args, latex) { + var precedence = getPrecedence(root4, parenthesis, implicit); + var associativity = getAssociativity(root4, parenthesis); + if (parenthesis === "all" || args.length > 2 && root4.getIdentifier() !== "OperatorNode:add" && root4.getIdentifier() !== "OperatorNode:multiply") { return args.map(function(arg2) { switch (arg2.getContent().type) { case "ArrayNode": @@ -69573,16 +69678,16 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref break; case 1: { - var operandPrecedence = getPrecedence(args[0], parenthesis, implicit, root); + var operandPrecedence = getPrecedence(args[0], parenthesis, implicit, root4); if (latex && operandPrecedence !== null) { var operandIdentifier; var rootIdentifier; if (parenthesis === "keep") { operandIdentifier = args[0].getIdentifier(); - rootIdentifier = root.getIdentifier(); + rootIdentifier = root4.getIdentifier(); } else { operandIdentifier = args[0].getContent().getIdentifier(); - rootIdentifier = root.getContent().getIdentifier(); + rootIdentifier = root4.getContent().getIdentifier(); } if (properties2[precedence][rootIdentifier].latexLeftParens === false) { result = [false]; @@ -69607,8 +69712,8 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref case 2: { var lhsParens; - var lhsPrecedence = getPrecedence(args[0], parenthesis, implicit, root); - var assocWithLhs = isAssociativeWith(root, args[0], parenthesis); + var lhsPrecedence = getPrecedence(args[0], parenthesis, implicit, root4); + var assocWithLhs = isAssociativeWith(root4, args[0], parenthesis); if (lhsPrecedence === null) { lhsParens = false; } else if (lhsPrecedence === precedence && associativity === "right" && !assocWithLhs) { @@ -69619,8 +69724,8 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref lhsParens = false; } var rhsParens; - var rhsPrecedence = getPrecedence(args[1], parenthesis, implicit, root); - var assocWithRhs = isAssociativeWith(root, args[1], parenthesis); + var rhsPrecedence = getPrecedence(args[1], parenthesis, implicit, root4); + var assocWithRhs = isAssociativeWith(root4, args[1], parenthesis); if (rhsPrecedence === null) { rhsParens = false; } else if (rhsPrecedence === precedence && associativity === "left" && !assocWithRhs) { @@ -69635,13 +69740,13 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref var lhsIdentifier; var rhsIdentifier; if (parenthesis === "keep") { - _rootIdentifier = root.getIdentifier(); - lhsIdentifier = root.args[0].getIdentifier(); - rhsIdentifier = root.args[1].getIdentifier(); + _rootIdentifier = root4.getIdentifier(); + lhsIdentifier = root4.args[0].getIdentifier(); + rhsIdentifier = root4.args[1].getIdentifier(); } else { - _rootIdentifier = root.getContent().getIdentifier(); - lhsIdentifier = root.args[0].getContent().getIdentifier(); - rhsIdentifier = root.args[1].getContent().getIdentifier(); + _rootIdentifier = root4.getContent().getIdentifier(); + lhsIdentifier = root4.args[0].getContent().getIdentifier(); + rhsIdentifier = root4.args[1].getContent().getIdentifier(); } if (lhsPrecedence !== null) { if (properties2[precedence][_rootIdentifier].latexLeftParens === false) { @@ -69664,10 +69769,10 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } break; default: - if (root.getIdentifier() === "OperatorNode:add" || root.getIdentifier() === "OperatorNode:multiply") { + if (root4.getIdentifier() === "OperatorNode:add" || root4.getIdentifier() === "OperatorNode:multiply") { result = args.map(function(arg2) { - var argPrecedence = getPrecedence(arg2, parenthesis, implicit, root); - var assocWithArg = isAssociativeWith(root, arg2, parenthesis); + var argPrecedence = getPrecedence(arg2, parenthesis, implicit, root4); + var assocWithArg = isAssociativeWith(root4, arg2, parenthesis); var argAssociativity = getAssociativity(arg2, parenthesis); if (argPrecedence === null) { return false; @@ -69681,7 +69786,7 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } break; } - if (args.length >= 2 && root.getIdentifier() === "OperatorNode:multiply" && root.implicit && parenthesis !== "all" && implicit === "hide") { + if (args.length >= 2 && root4.getIdentifier() === "OperatorNode:multiply" && root4.implicit && parenthesis !== "all" && implicit === "hide") { for (var i4 = 1; i4 < result.length; ++i4) { if (startsWithConstant(args[i4], parenthesis) && !result[i4 - 1] && (parenthesis !== "keep" || !isParenthesisNode(args[i4 - 1]))) { result[i4] = true; @@ -69803,9 +69908,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } return lhs + " " + this.op + " " + rhs; } else if (args.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { - var stringifiedArgs = args.map(function(arg2, index2) { + var stringifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toString(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = "(" + arg2 + ")"; } return arg2; @@ -69861,9 +69966,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } return lhs + '' + escape(this.op) + "" + rhs; } else { - var stringifiedArgs = args.map(function(arg2, index2) { + var stringifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toHTML(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = '(' + arg2 + ')'; } return arg2; @@ -69933,9 +70038,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name217, dependencies216, (_ref } return lhsTex + op + rhsTex; } else if (args.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { - var texifiedArgs = args.map(function(arg2, index2) { + var texifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toTex(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = "\\left(".concat(arg2, "\\right)"); } return arg2; @@ -69969,12 +70074,12 @@ var createParenthesisNode = /* @__PURE__ */ factory(name218, dependencies217, (_ Node: Node4 } = _ref; class ParenthesisNode2 extends Node4 { - constructor(content3) { + constructor(content5) { super(); - if (!isNode2(content3)) { + if (!isNode2(content5)) { throw new TypeError('Node expected for parameter "content"'); } - this.content = content3; + this.content = content5; } get type() { return name218; @@ -69992,8 +70097,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(name218, dependencies217, (_ callback(this.content, "content", this); } map(callback) { - var content3 = callback(this.content, "content", this); - return new ParenthesisNode2(content3); + var content5 = callback(this.content, "content", this); + return new ParenthesisNode2(content5); } clone() { return new ParenthesisNode2(this.content); @@ -70040,16 +70145,16 @@ var createRangeNode = /* @__PURE__ */ factory(name219, dependencies218, (_ref) = var { Node: Node4 } = _ref; - function calculateNecessaryParentheses(node, parenthesis, implicit) { - var precedence = getPrecedence(node, parenthesis, implicit); + function calculateNecessaryParentheses(node2, parenthesis, implicit) { + var precedence = getPrecedence(node2, parenthesis, implicit); var parens = {}; - var startPrecedence = getPrecedence(node.start, parenthesis, implicit); + var startPrecedence = getPrecedence(node2.start, parenthesis, implicit); parens.start = startPrecedence !== null && startPrecedence <= precedence || parenthesis === "all"; - if (node.step) { - var stepPrecedence = getPrecedence(node.step, parenthesis, implicit); + if (node2.step) { + var stepPrecedence = getPrecedence(node2.step, parenthesis, implicit); parens.step = stepPrecedence !== null && stepPrecedence <= precedence || parenthesis === "all"; } - var endPrecedence = getPrecedence(node.end, parenthesis, implicit); + var endPrecedence = getPrecedence(node2.end, parenthesis, implicit); parens.end = endPrecedence !== null && endPrecedence <= precedence || parenthesis === "all"; return parens; } @@ -70075,8 +70180,8 @@ var createRangeNode = /* @__PURE__ */ factory(name219, dependencies218, (_ref) = return true; } needsEnd() { - var endSymbols = this.filter(function(node) { - return isSymbolNode(node) && node.name === "end"; + var endSymbols = this.filter(function(node2) { + return isSymbolNode(node2) && node2.name === "end"; }); return endSymbols.length > 0; } @@ -70232,7 +70337,7 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, dependencies219, (_r } _compile(math2, argNames) { var self2 = this; - var compiled = this.params.map((p) => p._compile(math2, argNames)); + var compiled = this.params.map((p2) => p2._compile(math2, argNames)); return function evalRelationalNode(scope, args, context) { var evalLhs; var evalRhs = compiled[0](scope, args, context); @@ -70259,9 +70364,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, dependencies219, (_r _toString(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { - var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); - return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "(" + p.toString(options) + ")" : p.toString(options); + var paramStrings = this.params.map(function(p2, index3) { + var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit); + return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "(" + p2.toString(options) + ")" : p2.toString(options); }); var ret = paramStrings[0]; for (var i4 = 0; i4 < this.conditionals.length; i4++) { @@ -70283,9 +70388,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, dependencies219, (_r _toHTML(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { - var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); - return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? '(' + p.toHTML(options) + ')' : p.toHTML(options); + var paramStrings = this.params.map(function(p2, index3) { + var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit); + return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? '(' + p2.toHTML(options) + ')' : p2.toHTML(options); }); var ret = paramStrings[0]; for (var i4 = 0; i4 < this.conditionals.length; i4++) { @@ -70296,9 +70401,9 @@ var createRelationalNode = /* @__PURE__ */ factory(name220, dependencies219, (_r _toTex(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { - var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); - return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "\\left(" + p.toTex(options) + "\right)" : p.toTex(options); + var paramStrings = this.params.map(function(p2, index3) { + var paramPrecedence = getPrecedence(p2, parenthesis, options && options.implicit); + return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "\\left(" + p2.toTex(options) + "\right)" : p2.toTex(options); }); var ret = paramStrings[0]; for (var i4 = 0; i4 < this.conditionals.length; i4++) { @@ -70428,7 +70533,7 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref var strin = (entity) => format4(entity, { truncate: 78 }); - function expandTemplate(template2, node, options) { + function expandTemplate(template2, node2, options) { var latex = ""; var regex = /\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi; var inputPos = 0; @@ -70441,7 +70546,7 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref inputPos++; } else { inputPos += match2[0].length; - var property = node[match2[1]]; + var property = node2[match2[1]]; if (!property) { throw new ReferenceError("Template: Property " + match2[1] + " does not exist."); } @@ -70454,11 +70559,11 @@ var createFunctionNode = /* @__PURE__ */ factory(name222, dependencies221, (_ref if (isNode2(property)) { latex += property.toTex(options); } else if (Array.isArray(property)) { - latex += property.map(function(arg2, index2) { + latex += property.map(function(arg2, index3) { if (isNode2(arg2)) { return arg2.toTex(options); } - throw new TypeError("Template: " + match2[1] + "[" + index2 + "] is not a Node."); + throw new TypeError("Template: " + match2[1] + "[" + index3 + "] is not a Node."); }).join(","); } else { throw new TypeError("Template: " + match2[1] + " has to be a Node, String or array of Nodes"); @@ -70738,8 +70843,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { RelationalNode: RelationalNode2, SymbolNode: SymbolNode2 } = _ref; - var parse7 = typed3(name223, { - string: function string4(expression) { + var parse8 = typed3(name223, { + string: function string6(expression) { return parseStart(expression, {}); }, "Array | Matrix": function ArrayMatrix(expressions) { @@ -70870,7 +70975,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { next(state); } } - if (parse7.isWhitespace(currentCharacter(state), state.nestingLevel)) { + if (parse8.isWhitespace(currentCharacter(state), state.nestingLevel)) { next(state); } else { break; @@ -70910,7 +71015,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { next(state); return; } - if (parse7.isDigitDot(c1)) { + if (parse8.isDigitDot(c1)) { state.tokenType = TOKENTYPE.NUMBER; var _c = currentString(state, 2); if (_c === "0b" || _c === "0o" || _c === "0x") { @@ -70918,21 +71023,21 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { next(state); state.token += currentCharacter(state); next(state); - while (parse7.isHexDigit(currentCharacter(state))) { + while (parse8.isHexDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } if (currentCharacter(state) === ".") { state.token += "."; next(state); - while (parse7.isHexDigit(currentCharacter(state))) { + while (parse8.isHexDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } } else if (currentCharacter(state) === "i") { state.token += "i"; next(state); - while (parse7.isDigit(currentCharacter(state))) { + while (parse8.isDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } @@ -70942,40 +71047,40 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { if (currentCharacter(state) === ".") { state.token += currentCharacter(state); next(state); - if (!parse7.isDigit(currentCharacter(state))) { + if (!parse8.isDigit(currentCharacter(state))) { state.tokenType = TOKENTYPE.DELIMITER; return; } } else { - while (parse7.isDigit(currentCharacter(state))) { + while (parse8.isDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } - if (parse7.isDecimalMark(currentCharacter(state), nextCharacter(state))) { + if (parse8.isDecimalMark(currentCharacter(state), nextCharacter(state))) { state.token += currentCharacter(state); next(state); } } - while (parse7.isDigit(currentCharacter(state))) { + while (parse8.isDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } if (currentCharacter(state) === "E" || currentCharacter(state) === "e") { - if (parse7.isDigit(nextCharacter(state)) || nextCharacter(state) === "-" || nextCharacter(state) === "+") { + if (parse8.isDigit(nextCharacter(state)) || nextCharacter(state) === "-" || nextCharacter(state) === "+") { state.token += currentCharacter(state); next(state); if (currentCharacter(state) === "+" || currentCharacter(state) === "-") { state.token += currentCharacter(state); next(state); } - if (!parse7.isDigit(currentCharacter(state))) { + if (!parse8.isDigit(currentCharacter(state))) { throw createSyntaxError(state, 'Digit expected, got "' + currentCharacter(state) + '"'); } - while (parse7.isDigit(currentCharacter(state))) { + while (parse8.isDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } - if (parse7.isDecimalMark(currentCharacter(state), nextCharacter(state))) { + if (parse8.isDecimalMark(currentCharacter(state), nextCharacter(state))) { throw createSyntaxError(state, 'Digit expected, got "' + currentCharacter(state) + '"'); } } else if (nextCharacter(state) === ".") { @@ -70985,8 +71090,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } return; } - if (parse7.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) { - while (parse7.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse7.isDigit(currentCharacter(state))) { + if (parse8.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) { + while (parse8.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse8.isDigit(currentCharacter(state))) { state.token += currentCharacter(state); next(state); } @@ -71015,28 +71120,28 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { function closeParams(state) { state.nestingLevel--; } - parse7.isAlpha = function isAlpha(c3, cPrev, cNext) { - return parse7.isValidLatinOrGreek(c3) || parse7.isValidMathSymbol(c3, cNext) || parse7.isValidMathSymbol(cPrev, c3); + parse8.isAlpha = function isAlpha(c3, cPrev, cNext) { + return parse8.isValidLatinOrGreek(c3) || parse8.isValidMathSymbol(c3, cNext) || parse8.isValidMathSymbol(cPrev, c3); }; - parse7.isValidLatinOrGreek = function isValidLatinOrGreek(c3) { + parse8.isValidLatinOrGreek = function isValidLatinOrGreek(c3) { return /^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(c3); }; - parse7.isValidMathSymbol = function isValidMathSymbol(high, low) { + parse8.isValidMathSymbol = function isValidMathSymbol(high, low) { return /^[\uD835]$/.test(high) && /^[\uDC00-\uDFFF]$/.test(low) && /^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(low); }; - parse7.isWhitespace = function isWhitespace(c3, nestingLevel) { + parse8.isWhitespace = function isWhitespace(c3, nestingLevel) { return c3 === " " || c3 === " " || c3 === "\n" && nestingLevel > 0; }; - parse7.isDecimalMark = function isDecimalMark(c3, cNext) { + parse8.isDecimalMark = function isDecimalMark(c3, cNext) { return c3 === "." && cNext !== "/" && cNext !== "*" && cNext !== "^"; }; - parse7.isDigitDot = function isDigitDot(c3) { + parse8.isDigitDot = function isDigitDot(c3) { return c3 >= "0" && c3 <= "9" || c3 === "."; }; - parse7.isDigit = function isDigit(c3) { + parse8.isDigit = function isDigit(c3) { return c3 >= "0" && c3 <= "9"; }; - parse7.isHexDigit = function isHexDigit2(c3) { + parse8.isHexDigit = function isHexDigit2(c3) { return c3 >= "0" && c3 <= "9" || c3 >= "a" && c3 <= "f" || c3 >= "A" && c3 <= "F"; }; function parseStart(expression, extraNodes) { @@ -71046,7 +71151,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { extraNodes }); getToken(state); - var node = parseBlock(state); + var node2 = parseBlock(state); if (state.token !== "") { if (state.tokenType === TOKENTYPE.DELIMITER) { throw createError(state, "Unexpected operator " + state.token); @@ -71054,35 +71159,35 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { throw createSyntaxError(state, 'Unexpected part "' + state.token + '"'); } } - return node; + return node2; } function parseBlock(state) { - var node; + var node2; var blocks = []; var visible; if (state.token !== "" && state.token !== "\n" && state.token !== ";") { - node = parseAssignment(state); + node2 = parseAssignment(state); if (state.comment) { - node.comment = state.comment; + node2.comment = state.comment; } } while (state.token === "\n" || state.token === ";") { - if (blocks.length === 0 && node) { + if (blocks.length === 0 && node2) { visible = state.token !== ";"; blocks.push({ - node, + node: node2, visible }); } getToken(state); if (state.token !== "\n" && state.token !== ";" && state.token !== "") { - node = parseAssignment(state); + node2 = parseAssignment(state); if (state.comment) { - node.comment = state.comment; + node2.comment = state.comment; } visible = state.token !== ";"; blocks.push({ - node, + node: node2, visible }); } @@ -71090,40 +71195,40 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { if (blocks.length > 0) { return new BlockNode2(blocks); } else { - if (!node) { - node = new ConstantNode3(void 0); + if (!node2) { + node2 = new ConstantNode3(void 0); if (state.comment) { - node.comment = state.comment; + node2.comment = state.comment; } } - return node; + return node2; } } function parseAssignment(state) { - var name317, args, value, valid; - var node = parseConditional(state); + var name317, args, value, valid2; + var node2 = parseConditional(state); if (state.token === "=") { - if (isSymbolNode(node)) { - name317 = node.name; + if (isSymbolNode(node2)) { + name317 = node2.name; getTokenSkipNewline(state); value = parseAssignment(state); return new AssignmentNode2(new SymbolNode2(name317), value); - } else if (isAccessorNode(node)) { + } else if (isAccessorNode(node2)) { getTokenSkipNewline(state); value = parseAssignment(state); - return new AssignmentNode2(node.object, node.index, value); - } else if (isFunctionNode(node) && isSymbolNode(node.fn)) { - valid = true; + return new AssignmentNode2(node2.object, node2.index, value); + } else if (isFunctionNode(node2) && isSymbolNode(node2.fn)) { + valid2 = true; args = []; - name317 = node.name; - node.args.forEach(function(arg2, index2) { + name317 = node2.name; + node2.args.forEach(function(arg2, index3) { if (isSymbolNode(arg2)) { - args[index2] = arg2.name; + args[index3] = arg2.name; } else { - valid = false; + valid2 = false; } }); - if (valid) { + if (valid2) { getTokenSkipNewline(state); value = parseAssignment(state); return new FunctionAssignmentNode2(name317, args, value); @@ -71131,73 +71236,73 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } throw createSyntaxError(state, "Invalid left hand side of assignment operator ="); } - return node; + return node2; } function parseConditional(state) { - var node = parseLogicalOr(state); + var node2 = parseLogicalOr(state); while (state.token === "?") { var prev = state.conditionalLevel; state.conditionalLevel = state.nestingLevel; getTokenSkipNewline(state); - var condition = node; + var condition = node2; var trueExpr = parseAssignment(state); if (state.token !== ":") throw createSyntaxError(state, "False part of conditional expression expected"); state.conditionalLevel = null; getTokenSkipNewline(state); var falseExpr = parseAssignment(state); - node = new ConditionalNode2(condition, trueExpr, falseExpr); + node2 = new ConditionalNode2(condition, trueExpr, falseExpr); state.conditionalLevel = prev; } - return node; + return node2; } function parseLogicalOr(state) { - var node = parseLogicalXor(state); + var node2 = parseLogicalXor(state); while (state.token === "or") { getTokenSkipNewline(state); - node = new OperatorNode2("or", "or", [node, parseLogicalXor(state)]); + node2 = new OperatorNode2("or", "or", [node2, parseLogicalXor(state)]); } - return node; + return node2; } function parseLogicalXor(state) { - var node = parseLogicalAnd(state); + var node2 = parseLogicalAnd(state); while (state.token === "xor") { getTokenSkipNewline(state); - node = new OperatorNode2("xor", "xor", [node, parseLogicalAnd(state)]); + node2 = new OperatorNode2("xor", "xor", [node2, parseLogicalAnd(state)]); } - return node; + return node2; } function parseLogicalAnd(state) { - var node = parseBitwiseOr(state); + var node2 = parseBitwiseOr(state); while (state.token === "and") { getTokenSkipNewline(state); - node = new OperatorNode2("and", "and", [node, parseBitwiseOr(state)]); + node2 = new OperatorNode2("and", "and", [node2, parseBitwiseOr(state)]); } - return node; + return node2; } function parseBitwiseOr(state) { - var node = parseBitwiseXor(state); + var node2 = parseBitwiseXor(state); while (state.token === "|") { getTokenSkipNewline(state); - node = new OperatorNode2("|", "bitOr", [node, parseBitwiseXor(state)]); + node2 = new OperatorNode2("|", "bitOr", [node2, parseBitwiseXor(state)]); } - return node; + return node2; } function parseBitwiseXor(state) { - var node = parseBitwiseAnd(state); + var node2 = parseBitwiseAnd(state); while (state.token === "^|") { getTokenSkipNewline(state); - node = new OperatorNode2("^|", "bitXor", [node, parseBitwiseAnd(state)]); + node2 = new OperatorNode2("^|", "bitXor", [node2, parseBitwiseAnd(state)]); } - return node; + return node2; } function parseBitwiseAnd(state) { - var node = parseRelational(state); + var node2 = parseRelational(state); while (state.token === "&") { getTokenSkipNewline(state); - node = new OperatorNode2("&", "bitAnd", [node, parseRelational(state)]); + node2 = new OperatorNode2("&", "bitAnd", [node2, parseRelational(state)]); } - return node; + return node2; } function parseRelational(state) { var params = [parseShift(state)]; @@ -71228,8 +71333,8 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } } function parseShift(state) { - var node, name317, fn, params; - node = parseConversion(state); + var node2, name317, fn, params; + node2 = parseConversion(state); var operators = { "<<": "leftShift", ">>": "rightArithShift", @@ -71239,14 +71344,14 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { name317 = state.token; fn = operators[name317]; getTokenSkipNewline(state); - params = [node, parseConversion(state)]; - node = new OperatorNode2(name317, fn, params); + params = [node2, parseConversion(state)]; + node2 = new OperatorNode2(name317, fn, params); } - return node; + return node2; } function parseConversion(state) { - var node, name317, fn, params; - node = parseRange(state); + var node2, name317, fn, params; + node2 = parseRange(state); var operators = { to: "to", in: "to" @@ -71256,24 +71361,24 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { fn = operators[name317]; getTokenSkipNewline(state); if (name317 === "in" && state.token === "") { - node = new OperatorNode2("*", "multiply", [node, new SymbolNode2("in")], true); + node2 = new OperatorNode2("*", "multiply", [node2, new SymbolNode2("in")], true); } else { - params = [node, parseRange(state)]; - node = new OperatorNode2(name317, fn, params); + params = [node2, parseRange(state)]; + node2 = new OperatorNode2(name317, fn, params); } } - return node; + return node2; } function parseRange(state) { - var node; + var node2; var params = []; if (state.token === ":") { - node = new ConstantNode3(1); + node2 = new ConstantNode3(1); } else { - node = parseAddSubtract(state); + node2 = parseAddSubtract(state); } if (state.token === ":" && state.conditionalLevel !== state.nestingLevel) { - params.push(node); + params.push(node2); while (state.token === ":" && params.length < 3) { getTokenSkipNewline(state); if (state.token === ")" || state.token === "]" || state.token === "," || state.token === "") { @@ -71283,16 +71388,16 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } } if (params.length === 3) { - node = new RangeNode2(params[0], params[2], params[1]); + node2 = new RangeNode2(params[0], params[2], params[1]); } else { - node = new RangeNode2(params[0], params[1]); + node2 = new RangeNode2(params[0], params[1]); } } - return node; + return node2; } function parseAddSubtract(state) { - var node, name317, fn, params; - node = parseMultiplyDivide(state); + var node2, name317, fn, params; + node2 = parseMultiplyDivide(state); var operators = { "+": "add", "-": "subtract" @@ -71303,18 +71408,18 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { getTokenSkipNewline(state); var rightNode = parseMultiplyDivide(state); if (rightNode.isPercentage) { - params = [node, new OperatorNode2("*", "multiply", [node, rightNode])]; + params = [node2, new OperatorNode2("*", "multiply", [node2, rightNode])]; } else { - params = [node, rightNode]; + params = [node2, rightNode]; } - node = new OperatorNode2(name317, fn, params); + node2 = new OperatorNode2(name317, fn, params); } - return node; + return node2; } function parseMultiplyDivide(state) { - var node, last, name317, fn; - node = parseImplicitMultiplication(state); - last = node; + var node2, last, name317, fn; + node2 = parseImplicitMultiplication(state); + last = node2; var operators = { "*": "multiply", ".*": "dotMultiply", @@ -71327,30 +71432,30 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { fn = operators[name317]; getTokenSkipNewline(state); last = parseImplicitMultiplication(state); - node = new OperatorNode2(name317, fn, [node, last]); + node2 = new OperatorNode2(name317, fn, [node2, last]); } else { break; } } - return node; + return node2; } function parseImplicitMultiplication(state) { - var node, last; - node = parseRule2(state); - last = node; + var node2, last; + node2 = parseRule2(state); + last = node2; while (true) { - if (state.tokenType === TOKENTYPE.SYMBOL || state.token === "in" && isConstantNode(node) || state.tokenType === TOKENTYPE.NUMBER && !isConstantNode(last) && (!isOperatorNode(last) || last.op === "!") || state.token === "(") { + if (state.tokenType === TOKENTYPE.SYMBOL || state.token === "in" && isConstantNode(node2) || state.tokenType === TOKENTYPE.NUMBER && !isConstantNode(last) && (!isOperatorNode(last) || last.op === "!") || state.token === "(") { last = parseRule2(state); - node = new OperatorNode2("*", "multiply", [node, last], true); + node2 = new OperatorNode2("*", "multiply", [node2, last], true); } else { break; } } - return node; + return node2; } function parseRule2(state) { - var node = parsePercentage(state); - var last = node; + var node2 = parsePercentage(state); + var last = node2; var tokenStates = []; while (true) { if (state.token === "/" && rule2Node(last)) { @@ -71363,7 +71468,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { _extends(state, tokenStates.pop()); tokenStates.pop(); last = parsePercentage(state); - node = new OperatorNode2("/", "divide", [node, last]); + node2 = new OperatorNode2("/", "divide", [node2, last]); } else { tokenStates.pop(); _extends(state, tokenStates.pop()); @@ -71377,11 +71482,11 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { break; } } - return node; + return node2; } function parsePercentage(state) { - var node, name317, fn, params; - node = parseUnary(state); + var node2, name317, fn, params; + node2 = parseUnary(state); var operators = { "%": "mod", mod: "mod" @@ -71391,13 +71496,13 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { fn = operators[name317]; getTokenSkipNewline(state); if (name317 === "%" && state.tokenType === TOKENTYPE.DELIMITER && state.token !== "(") { - node = new OperatorNode2("/", "divide", [node, new ConstantNode3(100)], false, true); + node2 = new OperatorNode2("/", "divide", [node2, new ConstantNode3(100)], false, true); } else { - params = [node, parseUnary(state)]; - node = new OperatorNode2(name317, fn, params); + params = [node2, parseUnary(state)]; + node2 = new OperatorNode2(name317, fn, params); } } - return node; + return node2; } function parseUnary(state) { var name317, params, fn; @@ -71417,20 +71522,20 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { return parsePow(state); } function parsePow(state) { - var node, name317, fn, params; - node = parseLeftHandOperators(state); + var node2, name317, fn, params; + node2 = parseLeftHandOperators(state); if (state.token === "^" || state.token === ".^") { name317 = state.token; fn = name317 === "^" ? "pow" : "dotPow"; getTokenSkipNewline(state); - params = [node, parseUnary(state)]; - node = new OperatorNode2(name317, fn, params); + params = [node2, parseUnary(state)]; + node2 = new OperatorNode2(name317, fn, params); } - return node; + return node2; } function parseLeftHandOperators(state) { - var node, name317, fn, params; - node = parseCustomNodes(state); + var node2, name317, fn, params; + node2 = parseCustomNodes(state); var operators = { "!": "factorial", "'": "ctranspose" @@ -71439,11 +71544,11 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { name317 = state.token; fn = operators[name317]; getToken(state); - params = [node]; - node = new OperatorNode2(name317, fn, params); - node = parseAccessors(state, node); + params = [node2]; + node2 = new OperatorNode2(name317, fn, params); + node2 = parseAccessors(state, node2); } - return node; + return node2; } function parseCustomNodes(state) { var params = []; @@ -71472,28 +71577,28 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { return parseSymbol(state); } function parseSymbol(state) { - var node, name317; + var node2, name317; if (state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS) { name317 = state.token; getToken(state); if (hasOwnProperty2(CONSTANTS, name317)) { - node = new ConstantNode3(CONSTANTS[name317]); + node2 = new ConstantNode3(CONSTANTS[name317]); } else if (NUMERIC_CONSTANTS.indexOf(name317) !== -1) { - node = new ConstantNode3(numeric3(name317, "number")); + node2 = new ConstantNode3(numeric3(name317, "number")); } else { - node = new SymbolNode2(name317); + node2 = new SymbolNode2(name317); } - node = parseAccessors(state, node); - return node; + node2 = parseAccessors(state, node2); + return node2; } return parseString(state); } - function parseAccessors(state, node, types2) { + function parseAccessors(state, node2, types2) { var params; while ((state.token === "(" || state.token === "[" || state.token === ".") && (!types2 || types2.indexOf(state.token) !== -1)) { params = []; if (state.token === "(") { - if (isSymbolNode(node) || isAccessorNode(node)) { + if (isSymbolNode(node2) || isAccessorNode(node2)) { openParams(state); getToken(state); if (state.token !== ")") { @@ -71508,9 +71613,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } closeParams(state); getToken(state); - node = new FunctionNode3(node, params); + node2 = new FunctionNode3(node2, params); } else { - return node; + return node2; } } else if (state.token === "[") { openParams(state); @@ -71527,7 +71632,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } closeParams(state); getToken(state); - node = new AccessorNode2(node, new IndexNode2(params)); + node2 = new AccessorNode2(node2, new IndexNode2(params)); } else { getToken(state); var isPropertyName = state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS; @@ -71537,18 +71642,18 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { params.push(new ConstantNode3(state.token)); getToken(state); var dotNotation = true; - node = new AccessorNode2(node, new IndexNode2(params, dotNotation)); + node2 = new AccessorNode2(node2, new IndexNode2(params, dotNotation)); } } - return node; + return node2; } function parseString(state) { - var node, str; + var node2, str; if (state.token === '"' || state.token === "'") { str = parseStringToken(state, state.token); - node = new ConstantNode3(str); - node = parseAccessors(state, node); - return node; + node2 = new ConstantNode3(str); + node2 = parseAccessors(state, node2); + return node2; } return parseMatrix(state); } @@ -71646,15 +71751,15 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { function parseObject2(state) { if (state.token === "{") { openParams(state); - var key2; + var key3; var properties3 = {}; do { getToken(state); if (state.token !== "}") { if (state.token === '"' || state.token === "'") { - key2 = parseStringToken(state, state.token); + key3 = parseStringToken(state, state.token); } else if (state.tokenType === TOKENTYPE.SYMBOL || state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS) { - key2 = state.token; + key3 = state.token; getToken(state); } else { throw createSyntaxError(state, "Symbol or string expected as object key"); @@ -71663,7 +71768,7 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { throw createSyntaxError(state, "Colon : expected after object key"); } getToken(state); - properties3[key2] = parseAssignment(state); + properties3[key3] = parseAssignment(state); } } while (state.token === ","); if (state.token !== "}") { @@ -71671,9 +71776,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { } closeParams(state); getToken(state); - var node = new ObjectNode2(properties3); - node = parseAccessors(state, node); - return node; + var node2 = new ObjectNode2(properties3); + node2 = parseAccessors(state, node2); + return node2; } return parseNumber(state); } @@ -71687,19 +71792,19 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { return parseParentheses(state); } function parseParentheses(state) { - var node; + var node2; if (state.token === "(") { openParams(state); getToken(state); - node = parseAssignment(state); + node2 = parseAssignment(state); if (state.token !== ")") { throw createSyntaxError(state, "Parenthesis ) expected"); } closeParams(state); getToken(state); - node = new ParenthesisNode2(node); - node = parseAccessors(state, node); - return node; + node2 = new ParenthesisNode2(node2); + node2 = parseAccessors(state, node2); + return node2; } return parseEnd(state); } @@ -71728,9 +71833,9 @@ var createParse = /* @__PURE__ */ factory(name223, dependencies222, (_ref) => { typed3.addConversion({ from: "string", to: "Node", - convert: parse7 + convert: parse8 }); - return parse7; + return parse8; }); // node_modules/mathjs/lib/esm/expression/function/compile.js @@ -71739,15 +71844,15 @@ var dependencies223 = ["typed", "parse"]; var createCompile = /* @__PURE__ */ factory(name224, dependencies223, (_ref) => { var { typed: typed3, - parse: parse7 + parse: parse8 } = _ref; return typed3(name224, { - string: function string4(expr) { - return parse7(expr).compile(); + string: function string6(expr) { + return parse8(expr).compile(); }, "Array | Matrix": function ArrayMatrix(expr) { return deepMap(expr, function(entry) { - return parse7(entry).compile(); + return parse8(entry).compile(); }); } }); @@ -71759,25 +71864,25 @@ var dependencies224 = ["typed", "parse"]; var createEvaluate = /* @__PURE__ */ factory(name225, dependencies224, (_ref) => { var { typed: typed3, - parse: parse7 + parse: parse8 } = _ref; return typed3(name225, { - string: function string4(expr) { + string: function string6(expr) { var scope = createEmptyMap(); - return parse7(expr).compile().evaluate(scope); + return parse8(expr).compile().evaluate(scope); }, "string, Map | Object": function stringMapObject(expr, scope) { - return parse7(expr).compile().evaluate(scope); + return parse8(expr).compile().evaluate(scope); }, "Array | Matrix": function ArrayMatrix(expr) { var scope = createEmptyMap(); return deepMap(expr, function(entry) { - return parse7(entry).compile().evaluate(scope); + return parse8(entry).compile().evaluate(scope); }); }, "Array | Matrix, Map | Object": function ArrayMatrixMapObject(expr, scope) { return deepMap(expr, function(entry) { - return parse7(entry).compile().evaluate(scope); + return parse8(entry).compile().evaluate(scope); }); } }); @@ -71885,15 +71990,15 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { var rows = m4._size[0]; var columns = m4._size[1]; var n3 = Math.min(rows, columns); - var data2 = clone(m4._data); + var data3 = clone(m4._data); var ldata = []; var lsize = [rows, n3]; var udata = []; var usize = [n3, columns]; var i4, j, k2; - var p = []; + var p2 = []; for (i4 = 0; i4 < rows; i4++) { - p[i4] = i4; + p2[i4] = i4; } for (j = 0; j < columns; j++) { if (j > 0) { @@ -71901,16 +72006,16 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { var min5 = Math.min(i4, j); var s4 = 0; for (k2 = 0; k2 < min5; k2++) { - s4 = addScalar2(s4, multiplyScalar2(data2[i4][k2], data2[k2][j])); + s4 = addScalar2(s4, multiplyScalar2(data3[i4][k2], data3[k2][j])); } - data2[i4][j] = subtractScalar2(data2[i4][j], s4); + data3[i4][j] = subtractScalar2(data3[i4][j], s4); } } var pi3 = j; var pabsv = 0; var vjj = 0; for (i4 = j; i4 < rows; i4++) { - var v2 = data2[i4][j]; + var v2 = data3[i4][j]; var absv = abs3(v2); if (larger2(absv, pabsv)) { pi3 = i4; @@ -71919,14 +72024,14 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { } } if (j !== pi3) { - p[j] = [p[pi3], p[pi3] = p[j]][0]; - DenseMatrix2._swapRows(j, pi3, data2); + p2[j] = [p2[pi3], p2[pi3] = p2[j]][0]; + DenseMatrix2._swapRows(j, pi3, data3); } if (j < rows) { for (i4 = j + 1; i4 < rows; i4++) { - var vij = data2[i4][j]; + var vij = data3[i4][j]; if (!equalScalar2(vij, 0)) { - data2[i4][j] = divideScalar2(data2[i4][j], vjj); + data3[i4][j] = divideScalar2(data3[i4][j], vjj); } } } @@ -71941,7 +72046,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { } if (i4 < j) { if (i4 < columns) { - udata[i4][j] = data2[i4][j]; + udata[i4][j] = data3[i4][j]; } if (j < rows) { ldata[i4][j] = 0; @@ -71950,7 +72055,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { } if (i4 === j) { if (i4 < columns) { - udata[i4][j] = data2[i4][j]; + udata[i4][j] = data3[i4][j]; } if (j < rows) { ldata[i4][j] = 1; @@ -71961,7 +72066,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { udata[i4][j] = 0; } if (j < rows) { - ldata[i4][j] = data2[i4][j]; + ldata[i4][j] = data3[i4][j]; } } } @@ -71974,14 +72079,14 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { size: usize }); var pv = []; - for (i4 = 0, n3 = p.length; i4 < n3; i4++) { - pv[p[i4]] = i4; + for (i4 = 0, n3 = p2.length; i4 < n3; i4++) { + pv[p2[i4]] = i4; } return { L: l2, U: u3, p: pv, - toString: function toString4() { + toString: function toString5() { return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\nP: " + this.p; } }; @@ -71991,7 +72096,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { var columns = m4._size[1]; var n3 = Math.min(rows, columns); var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var lvalues = []; var lindex = []; @@ -72027,7 +72132,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (k2 = k0; k2 < k1; k2++) { - i4 = index2[k2]; + i4 = index3[k2]; spa.set(pvCo[i4], values2[k2]); } if (j > 0) { @@ -72088,7 +72193,7 @@ var createLup = /* @__PURE__ */ factory(name228, dependencies227, (_ref) => { size: usize }), p: pvCo, - toString: function toString4() { + toString: function toString5() { return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\nP: " + this.p; } }; @@ -72185,7 +72290,7 @@ var createQr = /* @__PURE__ */ factory(name229, dependencies228, (_ref) => { return { Q: Q3, R: R2, - toString: function toString4() { + toString: function toString5() { return "Q: " + this.Q.toString() + "\nR: " + this.R.toString(); } }; @@ -72244,17 +72349,17 @@ function csPermute(a4, pinv2, q2, values2) { } // node_modules/mathjs/lib/esm/function/algebra/sparse/csTdfs.js -function csTdfs(j, k2, w2, head, next, post, stack) { +function csTdfs(j, k2, w2, head2, next, post, stack) { var top = 0; w2[stack] = j; while (top >= 0) { - var p = w2[stack + top]; - var i4 = w2[head + p]; + var p2 = w2[stack + top]; + var i4 = w2[head2 + p2]; if (i4 === -1) { top--; - post[k2++] = p; + post[k2++] = p2; } else { - w2[head + p] = w2[next + i4]; + w2[head2 + p2] = w2[next + i4]; ++top; w2[stack + top] = i4; } @@ -72271,24 +72376,24 @@ function csPost(parent, n3) { var j; var post = []; var w2 = []; - var head = 0; + var head2 = 0; var next = n3; var stack = 2 * n3; for (j = 0; j < n3; j++) { - w2[head + j] = -1; + w2[head2 + j] = -1; } for (j = n3 - 1; j >= 0; j--) { if (parent[j] === -1) { continue; } - w2[next + j] = w2[head + parent[j]]; - w2[head + parent[j]] = j; + w2[next + j] = w2[head2 + parent[j]]; + w2[head2 + parent[j]] = j; } for (j = 0; j < n3; j++) { if (parent[j] !== -1) { continue; } - k2 = csTdfs(j, k2, w2, head, next, post, stack); + k2 = csTdfs(j, k2, w2, head2, next, post, stack); } return post; } @@ -72316,8 +72421,8 @@ function csEtree(a4, ata) { for (var k2 = 0; k2 < n3; k2++) { parent[k2] = -1; w2[ancestor2 + k2] = -1; - for (var p0 = aptr[k2], p1 = aptr[k2 + 1], p = p0; p < p1; p++) { - var r2 = aindex[p]; + for (var p0 = aptr[k2], p1 = aptr[k2 + 1], p2 = p0; p2 < p1; p2++) { + var r2 = aindex[p2]; i4 = ata ? w2[prev + r2] : r2; for (; i4 !== -1 && i4 < k2; i4 = inext) { inext = w2[ancestor2 + i4]; @@ -72343,13 +72448,13 @@ function csFkeep(a4, callback, other) { var n3 = asize[1]; var nz = 0; for (var j = 0; j < n3; j++) { - var p = aptr[j]; + var p2 = aptr[j]; aptr[j] = nz; - for (; p < aptr[j + 1]; p++) { - if (callback(aindex[p], j, avalues ? avalues[p] : 1, other)) { - aindex[nz] = aindex[p]; + for (; p2 < aptr[j + 1]; p2++) { + if (callback(aindex[p2], j, avalues ? avalues[p2] : 1, other)) { + aindex[nz] = aindex[p2]; if (avalues) { - avalues[nz] = avalues[p]; + avalues[nz] = avalues[p2]; } nz++; } @@ -72377,8 +72482,8 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { multiply: multiply2, transpose: transpose2 } = _ref; - return function csAmd(order, a4) { - if (!a4 || order <= 0 || order > 3) { + return function csAmd(order2, a4) { + if (!a4 || order2 <= 0 || order2 > 3) { return null; } var asize = a4._size; @@ -72387,7 +72492,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { var lemax = 0; var dense = Math.max(16, 10 * Math.sqrt(n3)); dense = Math.min(n3 - 2, dense); - var cm = _createTargetMatrix(order, a4, m4, n3, dense); + var cm = _createTargetMatrix(order2, a4, m4, n3, dense); csFkeep(cm, _diag, null); var cindex = cm._index; var cptr = cm._ptr; @@ -72397,38 +72502,38 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { var len = 0; var nv = n3 + 1; var next = 2 * (n3 + 1); - var head = 3 * (n3 + 1); + var head2 = 3 * (n3 + 1); var elen = 4 * (n3 + 1); var degree = 5 * (n3 + 1); var w2 = 6 * (n3 + 1); var hhead = 7 * (n3 + 1); var last = P3; - var mark = _initializeQuotientGraph(n3, cptr, W, len, head, last, next, hhead, nv, w2, elen, degree); - var nel = _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head, last, next); + var mark2 = _initializeQuotientGraph(n3, cptr, W, len, head2, last, next, hhead, nv, w2, elen, degree); + var nel = _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head2, last, next); var mindeg = 0; var i4, j, k2, k1, k22, e5, pj, ln2, nvi, pk, eln, p1, p2, pn, h3, d4; while (nel < n3) { - for (k2 = -1; mindeg < n3 && (k2 = W[head + mindeg]) === -1; mindeg++) + for (k2 = -1; mindeg < n3 && (k2 = W[head2 + mindeg]) === -1; mindeg++) ; if (W[next + k2] !== -1) { last[W[next + k2]] = -1; } - W[head + mindeg] = W[next + k2]; + W[head2 + mindeg] = W[next + k2]; var elenk = W[elen + k2]; var nvk = W[nv + k2]; nel += nvk; var dk = 0; W[nv + k2] = -nvk; - var p = cptr[k2]; - var pk1 = elenk === 0 ? p : cnz; + var p3 = cptr[k2]; + var pk1 = elenk === 0 ? p3 : cnz; var pk2 = pk1; for (k1 = 1; k1 <= elenk + 1; k1++) { if (k1 > elenk) { e5 = k2; - pj = p; + pj = p3; ln2 = W[len + k2] - elenk; } else { - e5 = cindex[p++]; + e5 = cindex[p3++]; pj = cptr[e5]; ln2 = W[len + e5]; } @@ -72446,7 +72551,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { if (last[i4] !== -1) { W[next + last[i4]] = W[next + i4]; } else { - W[head + W[degree + i4]] = W[next + i4]; + W[head2 + W[degree + i4]] = W[next + i4]; } } if (e5 !== k2) { @@ -72461,17 +72566,17 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { cptr[k2] = pk1; W[len + k2] = pk2 - pk1; W[elen + k2] = -2; - mark = _wclear(mark, lemax, W, w2, n3); + mark2 = _wclear(mark2, lemax, W, w2, n3); for (pk = pk1; pk < pk2; pk++) { i4 = cindex[pk]; if ((eln = W[elen + i4]) <= 0) { continue; } nvi = -W[nv + i4]; - var wnvi = mark - nvi; - for (p = cptr[i4], p1 = cptr[i4] + eln - 1; p <= p1; p++) { - e5 = cindex[p]; - if (W[w2 + e5] >= mark) { + var wnvi = mark2 - nvi; + for (p3 = cptr[i4], p1 = cptr[i4] + eln - 1; p3 <= p1; p3++) { + e5 = cindex[p3]; + if (W[w2 + e5] >= mark2) { W[w2 + e5] -= nvi; } else if (W[w2 + e5] !== 0) { W[w2 + e5] = W[degree + e5] + wnvi; @@ -72483,10 +72588,10 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { p1 = cptr[i4]; p2 = p1 + W[elen + i4] - 1; pn = p1; - for (h3 = 0, d4 = 0, p = p1; p <= p2; p++) { - e5 = cindex[p]; + for (h3 = 0, d4 = 0, p3 = p1; p3 <= p2; p3++) { + e5 = cindex[p3]; if (W[w2 + e5] !== 0) { - var dext = W[w2 + e5] - mark; + var dext = W[w2 + e5] - mark2; if (dext > 0) { d4 += dext; cindex[pn++] = e5; @@ -72498,10 +72603,10 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { } } W[elen + i4] = pn - p1 + 1; - var p3 = pn; + var p32 = pn; var p4 = p1 + W[len + i4]; - for (p = p2 + 1; p < p4; p++) { - j = cindex[p]; + for (p3 = p2 + 1; p3 < p4; p3++) { + j = cindex[p3]; var nvj = W[nv + j]; if (nvj <= 0) { continue; @@ -72520,8 +72625,8 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { W[elen + i4] = -1; } else { W[degree + i4] = Math.min(W[degree + i4], d4); - cindex[pn] = cindex[p3]; - cindex[p3] = cindex[p1]; + cindex[pn] = cindex[p32]; + cindex[p32] = cindex[p1]; cindex[p1] = k2; W[len + i4] = pn - p1 + 1; h3 = (h3 < 0 ? -h3 : h3) % n3; @@ -72532,7 +72637,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { } W[degree + k2] = dk; lemax = Math.max(lemax, dk); - mark = _wclear(mark + lemax, lemax, W, w2, n3); + mark2 = _wclear(mark2 + lemax, lemax, W, w2, n3); for (pk = pk1; pk < pk2; pk++) { i4 = cindex[pk]; if (W[nv + i4] >= 0) { @@ -72541,21 +72646,21 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { h3 = last[i4]; i4 = W[hhead + h3]; W[hhead + h3] = -1; - for (; i4 !== -1 && W[next + i4] !== -1; i4 = W[next + i4], mark++) { + for (; i4 !== -1 && W[next + i4] !== -1; i4 = W[next + i4], mark2++) { ln2 = W[len + i4]; eln = W[elen + i4]; - for (p = cptr[i4] + 1; p <= cptr[i4] + ln2 - 1; p++) { - W[w2 + cindex[p]] = mark; + for (p3 = cptr[i4] + 1; p3 <= cptr[i4] + ln2 - 1; p3++) { + W[w2 + cindex[p3]] = mark2; } var jlast = i4; for (j = W[next + i4]; j !== -1; ) { - var ok = W[len + j] === ln2 && W[elen + j] === eln; - for (p = cptr[j] + 1; ok && p <= cptr[j] + ln2 - 1; p++) { - if (W[w2 + cindex[p]] !== mark) { - ok = 0; + var ok2 = W[len + j] === ln2 && W[elen + j] === eln; + for (p3 = cptr[j] + 1; ok2 && p3 <= cptr[j] + ln2 - 1; p3++) { + if (W[w2 + cindex[p3]] !== mark2) { + ok2 = 0; } } - if (ok) { + if (ok2) { cptr[j] = csFlip(i4); W[nv + i4] += W[nv + j]; W[nv + j] = 0; @@ -72569,7 +72674,7 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { } } } - for (p = pk1, pk = pk1; pk < pk2; pk++) { + for (p3 = pk1, pk = pk1; pk < pk2; pk++) { i4 = cindex[pk]; if ((nvi = -W[nv + i4]) <= 0) { continue; @@ -72577,72 +72682,72 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { W[nv + i4] = nvi; d4 = W[degree + i4] + dk - nvi; d4 = Math.min(d4, n3 - nel - nvi); - if (W[head + d4] !== -1) { - last[W[head + d4]] = i4; + if (W[head2 + d4] !== -1) { + last[W[head2 + d4]] = i4; } - W[next + i4] = W[head + d4]; + W[next + i4] = W[head2 + d4]; last[i4] = -1; - W[head + d4] = i4; + W[head2 + d4] = i4; mindeg = Math.min(mindeg, d4); W[degree + i4] = d4; - cindex[p++] = i4; + cindex[p3++] = i4; } W[nv + k2] = nvk; - if ((W[len + k2] = p - pk1) === 0) { + if ((W[len + k2] = p3 - pk1) === 0) { cptr[k2] = -1; W[w2 + k2] = 0; } if (elenk !== 0) { - cnz = p; + cnz = p3; } } for (i4 = 0; i4 < n3; i4++) { cptr[i4] = csFlip(cptr[i4]); } for (j = 0; j <= n3; j++) { - W[head + j] = -1; + W[head2 + j] = -1; } for (j = n3; j >= 0; j--) { if (W[nv + j] > 0) { continue; } - W[next + j] = W[head + cptr[j]]; - W[head + cptr[j]] = j; + W[next + j] = W[head2 + cptr[j]]; + W[head2 + cptr[j]] = j; } for (e5 = n3; e5 >= 0; e5--) { if (W[nv + e5] <= 0) { continue; } if (cptr[e5] !== -1) { - W[next + e5] = W[head + cptr[e5]]; - W[head + cptr[e5]] = e5; + W[next + e5] = W[head2 + cptr[e5]]; + W[head2 + cptr[e5]] = e5; } } for (k2 = 0, i4 = 0; i4 <= n3; i4++) { if (cptr[i4] === -1) { - k2 = csTdfs(i4, k2, W, head, next, P3, w2); + k2 = csTdfs(i4, k2, W, head2, next, P3, w2); } } P3.splice(P3.length - 1, 1); return P3; }; - function _createTargetMatrix(order, a4, m4, n3, dense) { + function _createTargetMatrix(order2, a4, m4, n3, dense) { var at2 = transpose2(a4); - if (order === 1 && n3 === m4) { + if (order2 === 1 && n3 === m4) { return add4(a4, at2); } - if (order === 2) { + if (order2 === 2) { var tindex = at2._index; var tptr = at2._ptr; var p2 = 0; for (var j = 0; j < m4; j++) { - var p = tptr[j]; + var p3 = tptr[j]; tptr[j] = p2; - if (tptr[j + 1] - p > dense) { + if (tptr[j + 1] - p3 > dense) { continue; } - for (var p1 = tptr[j + 1]; p < p1; p++) { - tindex[p2++] = tindex[p]; + for (var p1 = tptr[j + 1]; p3 < p1; p3++) { + tindex[p2++] = tindex[p3]; } } tptr[m4] = p2; @@ -72651,13 +72756,13 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { } return multiply2(at2, a4); } - function _initializeQuotientGraph(n3, cptr, W, len, head, last, next, hhead, nv, w2, elen, degree) { + function _initializeQuotientGraph(n3, cptr, W, len, head2, last, next, hhead, nv, w2, elen, degree) { for (var k2 = 0; k2 < n3; k2++) { W[len + k2] = cptr[k2 + 1] - cptr[k2]; } W[len + n3] = 0; for (var i4 = 0; i4 <= n3; i4++) { - W[head + i4] = -1; + W[head2 + i4] = -1; last[i4] = -1; W[next + i4] = -1; W[hhead + i4] = -1; @@ -72666,13 +72771,13 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { W[elen + i4] = 0; W[degree + i4] = W[len + i4]; } - var mark = _wclear(0, 0, W, w2, n3); + var mark2 = _wclear(0, 0, W, w2, n3); W[elen + n3] = -2; cptr[n3] = -1; W[w2 + n3] = 0; - return mark; + return mark2; } - function _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head, last, next) { + function _initializeDegreeLists(n3, cptr, W, degree, elen, w2, dense, nv, head2, last, next) { var nel = 0; for (var i4 = 0; i4 < n3; i4++) { var d4 = W[degree + i4]; @@ -72688,26 +72793,26 @@ var createCsAmd = /* @__PURE__ */ factory(name230, dependencies229, (_ref) => { cptr[i4] = csFlip(n3); W[nv + n3]++; } else { - var h3 = W[head + d4]; + var h3 = W[head2 + d4]; if (h3 !== -1) { last[h3] = i4; } - W[next + i4] = W[head + d4]; - W[head + d4] = i4; + W[next + i4] = W[head2 + d4]; + W[head2 + d4] = i4; } } return nel; } - function _wclear(mark, lemax, W, w2, n3) { - if (mark < 2 || mark + lemax < 0) { + function _wclear(mark2, lemax, W, w2, n3) { + if (mark2 < 2 || mark2 + lemax < 0) { for (var k2 = 0; k2 < n3; k2++) { if (W[w2 + k2] !== 0) { W[w2 + k2] = 1; } } - mark = 2; + mark2 = 2; } - return mark; + return mark2; } function _diag(i4, j) { return i4 !== j; @@ -72757,14 +72862,14 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) => var asize = a4._size; var m4 = asize[0]; var n3 = asize[1]; - var i4, j, k2, J, p, p0, p1; + var i4, j, k2, J, p2, p0, p1; var s4 = 4 * n3 + (ata ? n3 + m4 + 1 : 0); var w2 = []; var ancestor2 = 0; var maxfirst = n3; var prevleaf = 2 * n3; var first = 3 * n3; - var head = 4 * n3; + var head2 = 4 * n3; var next = 5 * n3 + 1; for (k2 = 0; k2 < s4; k2++) { w2[k2] = -1; @@ -72785,11 +72890,11 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) => w2[post[k2]] = k2; } for (i4 = 0; i4 < m4; i4++) { - for (k2 = n3, p0 = tptr[i4], p1 = tptr[i4 + 1], p = p0; p < p1; p++) { - k2 = Math.min(k2, w2[tindex[p]]); + for (k2 = n3, p0 = tptr[i4], p1 = tptr[i4 + 1], p2 = p0; p2 < p1; p2++) { + k2 = Math.min(k2, w2[tindex[p2]]); } - w2[next + i4] = w2[head + k2]; - w2[head + k2] = i4; + w2[next + i4] = w2[head2 + k2]; + w2[head2 + k2] = i4; } } for (i4 = 0; i4 < n3; i4++) { @@ -72800,9 +72905,9 @@ var createCsCounts = /* @__PURE__ */ factory(name231, dependencies230, (_ref) => if (parent[j] !== -1) { colcount[parent[j]]--; } - for (J = ata ? w2[head + k2] : j; J !== -1; J = ata ? w2[next + J] : -1) { - for (p = tptr[J]; p < tptr[J + 1]; p++) { - i4 = tindex[p]; + for (J = ata ? w2[head2 + k2] : j; J !== -1; J = ata ? w2[next + J] : -1) { + for (p2 = tptr[J]; p2 < tptr[J + 1]; p2++) { + i4 = tindex[p2]; var r2 = csLeaf(i4, j, w2, first, maxfirst, prevleaf, ancestor2); if (r2.jleaf >= 1) { colcount[j]++; @@ -72842,18 +72947,18 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => { var csCounts = createCsCounts({ transpose: transpose2 }); - return function csSqr(order, a4, qr2) { + return function csSqr(order2, a4, qr2) { var aptr = a4._ptr; var asize = a4._size; var n3 = asize[1]; var k2; var s4 = {}; - s4.q = csAmd(order, a4); - if (order && !s4.q) { + s4.q = csAmd(order2, a4); + if (order2 && !s4.q) { return null; } if (qr2) { - var c3 = order ? csPermute(a4, null, s4.q, 0) : a4; + var c3 = order2 ? csPermute(a4, null, s4.q, 0) : a4; s4.parent = csEtree(c3, 1); var post = csPost(s4.parent, n3); s4.cp = csCounts(c3, s4.parent, post, 1); @@ -72881,12 +72986,12 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => { var leftmost = s4.leftmost; var w2 = []; var next = 0; - var head = m4; + var head2 = m4; var tail = m4 + n3; var nque = m4 + 2 * n3; - var i4, k2, p, p0, p1; + var i4, k2, p2, p0, p1; for (k2 = 0; k2 < n3; k2++) { - w2[head + k2] = -1; + w2[head2 + k2] = -1; w2[tail + k2] = -1; w2[nque + k2] = 0; } @@ -72894,8 +72999,8 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => { leftmost[i4] = -1; } for (k2 = n3 - 1; k2 >= 0; k2--) { - for (p0 = aptr[k2], p1 = aptr[k2 + 1], p = p0; p < p1; p++) { - leftmost[aindex[p]] = k2; + for (p0 = aptr[k2], p1 = aptr[k2 + 1], p2 = p0; p2 < p1; p2++) { + leftmost[aindex[p2]] = k2; } } for (i4 = m4 - 1; i4 >= 0; i4--) { @@ -72907,13 +73012,13 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => { if (w2[nque + k2]++ === 0) { w2[tail + k2] = i4; } - w2[next + i4] = w2[head + k2]; - w2[head + k2] = i4; + w2[next + i4] = w2[head2 + k2]; + w2[head2 + k2] = i4; } s4.lnz = 0; s4.m2 = m4; for (k2 = 0; k2 < n3; k2++) { - i4 = w2[head + k2]; + i4 = w2[head2 + k2]; s4.lnz++; if (i4 < 0) { i4 = s4.m2++; @@ -72928,8 +73033,8 @@ var createCsSqr = /* @__PURE__ */ factory(name232, dependencies231, (_ref) => { if (w2[nque + pa] === 0) { w2[tail + pa] = w2[tail + k2]; } - w2[next + w2[tail + k2]] = w2[head + pa]; - w2[head + pa] = w2[next + i4]; + w2[next + w2[tail + k2]] = w2[head2 + pa]; + w2[head2 + pa] = w2[next + i4]; w2[nque + pa] += w2[nque + k2]; } } @@ -72959,33 +73064,33 @@ function csUnflip(i4) { // node_modules/mathjs/lib/esm/function/algebra/sparse/csDfs.js function csDfs(j, g, top, xi, pinv2) { - var index2 = g._index; + var index3 = g._index; var ptr = g._ptr; var size2 = g._size; var n3 = size2[1]; - var i4, p, p2; - var head = 0; + var i4, p2, p22; + var head2 = 0; xi[0] = j; - while (head >= 0) { - j = xi[head]; + while (head2 >= 0) { + j = xi[head2]; var jnew = pinv2 ? pinv2[j] : j; if (!csMarked(ptr, j)) { csMark(ptr, j); - xi[n3 + head] = jnew < 0 ? 0 : csUnflip(ptr[jnew]); + xi[n3 + head2] = jnew < 0 ? 0 : csUnflip(ptr[jnew]); } var done = 1; - for (p = xi[n3 + head], p2 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p < p2; p++) { - i4 = index2[p]; + for (p2 = xi[n3 + head2], p22 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p2 < p22; p2++) { + i4 = index3[p2]; if (csMarked(ptr, i4)) { continue; } - xi[n3 + head] = p; - xi[++head] = i4; + xi[n3 + head2] = p2; + xi[++head2] = i4; done = 0; break; } if (done) { - head--; + head2--; xi[--top] = j; } } @@ -72999,16 +73104,16 @@ function csReach(g, b2, k2, xi, pinv2) { var bindex = b2._index; var bptr = b2._ptr; var n3 = gsize[1]; - var p, p0, p1; + var p2, p0, p1; var top = n3; - for (p0 = bptr[k2], p1 = bptr[k2 + 1], p = p0; p < p1; p++) { - var i4 = bindex[p]; + for (p0 = bptr[k2], p1 = bptr[k2 + 1], p2 = p0; p2 < p1; p2++) { + var i4 = bindex[p2]; if (!csMarked(gptr, i4)) { top = csDfs(i4, g, top, xi, pinv2); } } - for (p = top; p < n3; p++) { - csMark(gptr, xi[p]); + for (p2 = top; p2 < n3; p2++) { + csMark(gptr, xi[p2]); } return top; } @@ -73031,13 +73136,13 @@ var createCsSpsolve = /* @__PURE__ */ factory(name233, dependencies232, (_ref) = var bvalues = b2._values; var bindex = b2._index; var bptr = b2._ptr; - var p, p0, p1, q2; + var p2, p0, p1, q2; var top = csReach(g, b2, k2, xi, pinv2); - for (p = top; p < n3; p++) { - x2[xi[p]] = 0; + for (p2 = top; p2 < n3; p2++) { + x2[xi[p2]] = 0; } - for (p0 = bptr[k2], p1 = bptr[k2 + 1], p = p0; p < p1; p++) { - x2[bindex[p]] = bvalues[p]; + for (p0 = bptr[k2], p1 = bptr[k2 + 1], p2 = p0; p2 < p1; p2++) { + x2[bindex[p2]] = bvalues[p2]; } for (var px = top; px < n3; px++) { var j = xi[px]; @@ -73048,11 +73153,11 @@ var createCsSpsolve = /* @__PURE__ */ factory(name233, dependencies232, (_ref) = p0 = gptr[J]; p1 = gptr[J + 1]; x2[j] = divideScalar2(x2[j], gvalues[lo ? p0 : p1 - 1]); - p = lo ? p0 + 1 : p0; + p2 = lo ? p0 + 1 : p0; q2 = lo ? p1 : p1 - 1; - for (; p < q2; p++) { - var i4 = gindex[p]; - x2[i4] = subtract3(x2[i4], multiply2(gvalues[p], x2[j])); + for (; p2 < q2; p2++) { + var i4 = gindex[p2]; + x2[i4] = subtract3(x2[i4], multiply2(gvalues[p2], x2[j])); } } return top; @@ -73110,7 +73215,7 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => { size: [n3, n3] }); var pinv2 = []; - var i4, p; + var i4, p2; var x2 = []; var xi = []; for (i4 = 0; i4 < n3; i4++) { @@ -73127,8 +73232,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => { var top = csSpsolve(L2, m4, col, xi, x2, pinv2, 1); var ipiv = -1; var a4 = -1; - for (p = top; p < n3; p++) { - i4 = xi[p]; + for (p2 = top; p2 < n3; p2++) { + i4 = xi[p2]; if (pinv2[i4] < 0) { var xabs = abs3(x2[i4]); if (larger2(xabs, a4)) { @@ -73152,8 +73257,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => { pinv2[ipiv] = k2; lindex[lnz] = ipiv; lvalues[lnz++] = 1; - for (p = top; p < n3; p++) { - i4 = xi[p]; + for (p2 = top; p2 < n3; p2++) { + i4 = xi[p2]; if (pinv2[i4] < 0) { lindex[lnz] = i4; lvalues[lnz++] = divideScalar2(x2[i4], pivot); @@ -73163,8 +73268,8 @@ var createCsLu = /* @__PURE__ */ factory(name234, dependencies233, (_ref) => { } lptr[n3] = lnz; uptr[n3] = unz; - for (p = 0; p < lnz; p++) { - lindex[p] = pinv2[lindex[p]]; + for (p2 = 0; p2 < lnz; p2++) { + lindex[p2] = pinv2[lindex[p2]]; } lvalues.splice(lnz, lvalues.length - lnz); lindex.splice(lnz, lindex.length - lnz); @@ -73209,21 +73314,21 @@ var createSlu = /* @__PURE__ */ factory(name235, dependencies234, (_ref) => { SparseMatrix: SparseMatrix2 }); return typed3(name235, { - "SparseMatrix, number, number": function SparseMatrixNumberNumber(a4, order, threshold) { - if (!isInteger(order) || order < 0 || order > 3) { + "SparseMatrix, number, number": function SparseMatrixNumberNumber(a4, order2, threshold) { + if (!isInteger(order2) || order2 < 0 || order2 > 3) { throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]"); } if (threshold < 0 || threshold > 1) { throw new Error("Partial pivoting threshold must be a number from 0 to 1"); } - var s4 = csSqr(order, a4, false); + var s4 = csSqr(order2, a4, false); var f2 = csLu(a4, s4, threshold); return { L: f2.L, U: f2.U, p: f2.pinv, q: s4.q, - toString: function toString4() { + toString: function toString5() { return "L: " + this.L.toString() + "\nU: " + this.U.toString() + "\np: " + this.p.toString() + (this.q ? "\nq: " + this.q.toString() : "") + "\n"; } }; @@ -73232,13 +73337,13 @@ var createSlu = /* @__PURE__ */ factory(name235, dependencies234, (_ref) => { }); // node_modules/mathjs/lib/esm/function/algebra/sparse/csIpvec.js -function csIpvec(p, b2) { +function csIpvec(p2, b2) { var k2; var n3 = b2.length; var x2 = []; - if (p) { + if (p2) { for (k2 = 0; k2 < n3; k2++) { - x2[p[k2]] = b2[k2]; + x2[p2[k2]] = b2[k2]; } } else { for (k2 = 0; k2 < n3; k2++) { @@ -73279,8 +73384,8 @@ var createLusolve = /* @__PURE__ */ factory(name236, dependencies235, (_ref) => var d4 = lup2(a4); return _lusolve(d4.L, d4.U, d4.p, null, b2); }, - "SparseMatrix, Array | Matrix, number, number": function SparseMatrixArrayMatrixNumberNumber(a4, b2, order, threshold) { - var d4 = slu2(a4, order, threshold); + "SparseMatrix, Array | Matrix, number, number": function SparseMatrixArrayMatrixNumberNumber(a4, b2, order2, threshold) { + var d4 = slu2(a4, order2, threshold); return _lusolve(d4.L, d4.U, d4.p, d4.q, b2); }, "Object, Array | Matrix": function ObjectArrayMatrix(d4, b2) { @@ -73296,12 +73401,12 @@ var createLusolve = /* @__PURE__ */ factory(name236, dependencies235, (_ref) => } throw new TypeError("Invalid Matrix LU decomposition"); } - function _lusolve(l2, u3, p, q2, b2) { + function _lusolve(l2, u3, p2, q2, b2) { l2 = _toMatrix(l2); u3 = _toMatrix(u3); - if (p) { + if (p2) { b2 = solveValidation(l2, b2, true); - b2._data = csIpvec(p, b2._data); + b2._data = csIpvec(p2, b2._data); } var y3 = lsolve2(l2, b2); var x2 = usolve2(u3, y3); @@ -73531,9 +73636,9 @@ var createChainClass = /* @__PURE__ */ factory(name239, dependencies238, (_ref) Chain2.prototype[name317] = chainify(fn); } } - function createLazyProxy(name317, resolver) { + function createLazyProxy(name317, resolver2) { lazy(Chain2.prototype, name317, function outerResolver() { - var fn = resolver(); + var fn = resolver2(); if (typeof fn === "function") { return chainify(fn); } @@ -73584,9 +73689,9 @@ var createChainClass = /* @__PURE__ */ factory(name239, dependencies238, (_ref) }; Chain2.createProxy(math2); if (on) { - on("import", function(name317, resolver, path2) { - if (!path2) { - createLazyProxy(name317, resolver); + on("import", function(name317, resolver2, path3) { + if (!path3) { + createLazyProxy(name317, resolver2); } }); } @@ -76484,12 +76589,12 @@ var createHelp = /* @__PURE__ */ factory(name240, dependencies239, (_ref) => { Help: Help2 } = _ref; return typed3(name240, { - any: function any(search2) { + any: function any(search3) { var prop2; - var searchName = search2; - if (typeof search2 !== "string") { + var searchName = search3; + if (typeof search3 !== "string") { for (prop2 in mathWithTransform2) { - if (hasOwnProperty2(mathWithTransform2, prop2) && search2 === mathWithTransform2[prop2]) { + if (hasOwnProperty2(mathWithTransform2, prop2) && search3 === mathWithTransform2[prop2]) { searchName = prop2; break; } @@ -76913,13 +77018,13 @@ function createComplexEigs(_ref) { var big = type === "BigNumber"; var cplx = type === "Complex"; var realzero = big ? bignumber2(0) : 0; - var one = big ? bignumber2(1) : cplx ? complex2(1) : 1; + var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1; var realone = big ? bignumber2(1) : 1; var radix = big ? bignumber2(10) : 2; var radixSq = multiplyScalar2(radix, radix); var Rdiag; if (findVectors) { - Rdiag = Array(N).fill(one); + Rdiag = Array(N).fill(one5); } var last = false; while (!last) { @@ -77024,7 +77129,7 @@ function createComplexEigs(_ref) { function iterateUntilTriangular(A, N, prec, type, findVectors) { var big = type === "BigNumber"; var cplx = type === "Complex"; - var one = big ? bignumber2(1) : cplx ? complex2(1) : 1; + var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1; if (big) { prec = bignumber2(prec); } @@ -77032,8 +77137,8 @@ function createComplexEigs(_ref) { var lambdas = []; var n3 = N; var Sdiag = []; - var Qtotal = findVectors ? diag2(Array(N).fill(one)) : void 0; - var Qpartial = findVectors ? diag2(Array(n3).fill(one)) : void 0; + var Qtotal = findVectors ? diag2(Array(N).fill(one5)) : void 0; + var Qpartial = findVectors ? diag2(Array(n3).fill(one5)) : void 0; var lastConvergenceBefore = 0; while (lastConvergenceBefore <= 100) { lastConvergenceBefore += 1; @@ -77060,7 +77165,7 @@ function createComplexEigs(_ref) { inflateMatrix(Qpartial, N); Qtotal = multiply2(Qtotal, Qpartial); if (n3 > 1) { - Qpartial = diag2(Array(n3 - 1).fill(one)); + Qpartial = diag2(Array(n3 - 1).fill(one5)); } } n3 -= 1; @@ -77077,7 +77182,7 @@ function createComplexEigs(_ref) { inflateMatrix(Qpartial, N); Qtotal = multiply2(Qtotal, Qpartial); if (n3 > 2) { - Qpartial = diag2(Array(n3 - 2).fill(one)); + Qpartial = diag2(Array(n3 - 2).fill(one5)); } } n3 -= 2; @@ -77111,7 +77216,7 @@ function createComplexEigs(_ref) { var big = type === "BigNumber"; var cplx = type === "Complex"; var zero = big ? bignumber2(0) : cplx ? complex2(0) : 0; - var one = big ? bignumber2(1) : cplx ? complex2(1) : 1; + var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1; var uniqueValues = []; var multiplicities = []; for (var lambda of values2) { @@ -77126,7 +77231,7 @@ function createComplexEigs(_ref) { var vectors = []; var len = uniqueValues.length; var b2 = Array(N).fill(zero); - var E2 = diag2(Array(N).fill(one)); + var E2 = diag2(Array(N).fill(one5)); var _loop = function _loop2() { var lambda2 = uniqueValues[_i4]; var S3 = subtract3(U, multiply2(lambda2, E2)); @@ -77162,9 +77267,9 @@ function createComplexEigs(_ref) { var big = type === "BigNumber"; var cplx = type === "Complex"; var zero = big ? bignumber2(0) : cplx ? complex2(0) : 0; - var one = big ? bignumber2(1) : cplx ? complex2(1) : 1; + var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1; if (smaller2(abs3(c3), prec)) { - return [[one, zero], [zero, one]]; + return [[one5, zero], [zero, one5]]; } if (larger2(abs3(subtract3(l1, l2)), prec)) { return [[subtract3(l1, d4), subtract3(l2, d4)], [c3, c3]]; @@ -77172,9 +77277,9 @@ function createComplexEigs(_ref) { var na = subtract3(a4, l1); var nd = subtract3(d4, l1); if (smaller2(abs3(b2), prec) && smaller2(abs3(nd), prec)) { - return [[na, one], [c3, zero]]; + return [[na, one5], [c3, zero]]; } else { - return [[b2, zero], [nd, one]]; + return [[b2, zero], [nd, one5]]; } } function inflateMatrix(arr, N) { @@ -77239,7 +77344,7 @@ function createComplexEigs(_ref) { if (++i4 >= 10) { return null; } - b2 = normalize(c3); + b2 = normalize3(c3); } return b2; } @@ -77254,7 +77359,7 @@ function createComplexEigs(_ref) { v2 = v2.map((n3) => complex2(n3)); } v2 = orthogonalComplement(v2, orthog); - return normalize(v2, type); + return normalize3(v2, type); } function orthogonalComplement(v2, orthog) { var vectorShape = size2(v2); @@ -77267,11 +77372,11 @@ function createComplexEigs(_ref) { function norm3(v2) { return abs3(sqrt3(dot2(v2, v2))); } - function normalize(v2, type) { + function normalize3(v2, type) { var big = type === "BigNumber"; var cplx = type === "Complex"; - var one = big ? bignumber2(1) : cplx ? complex2(1) : 1; - return multiply2(divideScalar2(one, norm3(v2)), v2); + var one5 = big ? bignumber2(1) : cplx ? complex2(1) : 1; + return multiply2(divideScalar2(one5, norm3(v2)), v2); } return complexEigs; } @@ -77560,7 +77665,7 @@ var createEigs = /* @__PURE__ */ factory(name245, dependencies244, (_ref) => { larger: larger2, column: column2, flatten: flatten4, - number: number4, + number: number5, complex: complex2, sqrt: sqrt3, diag: diag2, @@ -77768,7 +77873,7 @@ var createEigs = /* @__PURE__ */ factory(name245, dependencies244, (_ref) => { if (hasNumber) { for (var _i3 = 0; _i3 < N; _i3++) { for (var _j3 = 0; _j3 < N; _j3++) { - arr[_i3][_j3] = number4(arr[_i3][_j3]); + arr[_i3][_j3] = number5(arr[_i3][_j3]); } } return "number"; @@ -77874,7 +77979,7 @@ var createSqrtm = /* @__PURE__ */ factory(name247, dependencies246, (_ref) => { abs: abs3, add: add4, multiply: multiply2, - map: map4, + map: map6, sqrt: sqrt3, subtract: subtract3, inv: inv2, @@ -77906,7 +78011,7 @@ var createSqrtm = /* @__PURE__ */ factory(name247, dependencies246, (_ref) => { switch (size3.length) { case 1: if (size3[0] === 1) { - return map4(A, sqrt3); + return map6(A, sqrt3); } else { throw new RangeError("Matrix must be square (size: " + format4(size3) + ")"); } @@ -77939,7 +78044,7 @@ var createSylvester = /* @__PURE__ */ factory(name248, dependencies247, (_ref) = range: range2, concat: concat3, transpose: transpose2, - index: index2, + index: index3, subset: subset2, add: add4, subtract: subtract3, @@ -77981,31 +78086,31 @@ var createSylvester = /* @__PURE__ */ factory(name248, dependencies247, (_ref) = var G2 = sB.T; var V = sB.U; var D2 = multiply2(multiply2(transpose2(U), C), V); - var all2 = range2(0, m4); + var all6 = range2(0, m4); var y3 = []; var hc = (a4, b2) => concat3(a4, b2, 1); var vc = (a4, b2) => concat3(a4, b2, 0); for (var k2 = 0; k2 < n3; k2++) { - if (k2 < n3 - 1 && abs3(subset2(G2, index2(k2 + 1, k2))) > 1e-5) { - var RHS = vc(subset2(D2, index2(all2, k2)), subset2(D2, index2(all2, k2 + 1))); + if (k2 < n3 - 1 && abs3(subset2(G2, index3(k2 + 1, k2))) > 1e-5) { + var RHS = vc(subset2(D2, index3(all6, k2)), subset2(D2, index3(all6, k2 + 1))); for (var j = 0; j < k2; j++) { - RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index2(j, k2))), multiply2(y3[j], subset2(G2, index2(j, k2 + 1))))); + RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index3(j, k2))), multiply2(y3[j], subset2(G2, index3(j, k2 + 1))))); } - var gkk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2, k2)))); - var gmk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2 + 1, k2)))); - var gkm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2, k2 + 1)))); - var gmm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2 + 1, k2 + 1)))); + var gkk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2, k2)))); + var gmk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2 + 1, k2)))); + var gkm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2, k2 + 1)))); + var gmm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2 + 1, k2 + 1)))); var LHS = vc(hc(add4(F, gkk), gmk), hc(gkm, add4(F, gmm))); var yAux = lusolve2(LHS, RHS); - y3[k2] = yAux.subset(index2(range2(0, m4), 0)); - y3[k2 + 1] = yAux.subset(index2(range2(m4, 2 * m4), 0)); + y3[k2] = yAux.subset(index3(range2(0, m4), 0)); + y3[k2 + 1] = yAux.subset(index3(range2(m4, 2 * m4), 0)); k2++; } else { - var _RHS = subset2(D2, index2(all2, k2)); + var _RHS = subset2(D2, index3(all6, k2)); for (var _j = 0; _j < k2; _j++) { - _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index2(_j, k2)))); + _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index3(_j, k2)))); } - var _gkk = subset2(G2, index2(k2, k2)); + var _gkk = subset2(G2, index3(k2, k2)); var _LHS = subtract3(F, multiply2(_gkk, identity2(m4))); y3[k2] = lusolve2(_LHS, _RHS); } @@ -78310,10 +78415,10 @@ var createDistance = /* @__PURE__ */ factory(name252, dependencies251, (_ref) => return _isNumber(a4[0]) && _isNumber(a4[1]) && _isNumber(a4[2]) && _isNumber(a4[3]) && _isNumber(a4[4]) && _isNumber(a4[5]); } function _objectToArray(o2) { - var keys = Object.keys(o2); + var keys2 = Object.keys(o2); var a4 = []; - for (var i4 = 0; i4 < keys.length; i4++) { - a4.push(o2[keys[i4]]); + for (var i4 = 0; i4 < keys2.length; i4++) { + a4.push(o2[keys2[i4]]); } return a4; } @@ -78777,7 +78882,7 @@ var createMad = /* @__PURE__ */ factory(name258, dependencies257, (_ref) => { var { typed: typed3, abs: abs3, - map: map4, + map: map6, median: median3, subtract: subtract3 } = _ref; @@ -78794,7 +78899,7 @@ var createMad = /* @__PURE__ */ factory(name258, dependencies257, (_ref) => { } try { var med = median3(array); - return median3(map4(array, function(value) { + return median3(map6(array, function(value) { return abs3(subtract3(value, med)); })); } catch (err) { @@ -78907,21 +79012,21 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref) isInteger: isInteger3 }); return typed3(name260, { - "Array | Matrix, number | BigNumber": (data2, p) => _quantileSeqProbNumber(data2, p, false), - "Array | Matrix, number | BigNumber, number": (data2, prob, dim) => _quantileSeqDim(data2, prob, false, dim, _quantileSeqProbNumber), + "Array | Matrix, number | BigNumber": (data3, p2) => _quantileSeqProbNumber(data3, p2, false), + "Array | Matrix, number | BigNumber, number": (data3, prob, dim) => _quantileSeqDim(data3, prob, false, dim, _quantileSeqProbNumber), "Array | Matrix, number | BigNumber, boolean": _quantileSeqProbNumber, - "Array | Matrix, number | BigNumber, boolean, number": (data2, prob, sorted, dim) => _quantileSeqDim(data2, prob, sorted, dim, _quantileSeqProbNumber), - "Array | Matrix, Array | Matrix": (data2, p) => _quantileSeqProbCollection(data2, p, false), - "Array | Matrix, Array | Matrix, number": (data2, prob, dim) => _quantileSeqDim(data2, prob, false, dim, _quantileSeqProbCollection), + "Array | Matrix, number | BigNumber, boolean, number": (data3, prob, sorted, dim) => _quantileSeqDim(data3, prob, sorted, dim, _quantileSeqProbNumber), + "Array | Matrix, Array | Matrix": (data3, p2) => _quantileSeqProbCollection(data3, p2, false), + "Array | Matrix, Array | Matrix, number": (data3, prob, dim) => _quantileSeqDim(data3, prob, false, dim, _quantileSeqProbCollection), "Array | Matrix, Array | Matrix, boolean": _quantileSeqProbCollection, - "Array | Matrix, Array | Matrix, boolean, number": (data2, prob, sorted, dim) => _quantileSeqDim(data2, prob, sorted, dim, _quantileSeqProbCollection) + "Array | Matrix, Array | Matrix, boolean, number": (data3, prob, sorted, dim) => _quantileSeqDim(data3, prob, sorted, dim, _quantileSeqProbCollection) }); - function _quantileSeqDim(data2, prob, sorted, dim, fn) { - return apply2(data2, dim, (x2) => fn(x2, prob, sorted)); + function _quantileSeqDim(data3, prob, sorted, dim, fn) { + return apply2(data3, dim, (x2) => fn(x2, prob, sorted)); } - function _quantileSeqProbNumber(data2, probOrN, sorted) { + function _quantileSeqProbNumber(data3, probOrN, sorted) { var probArr; - var dataArr = data2.valueOf(); + var dataArr = data3.valueOf(); if (smaller2(probOrN, 0)) { throw new Error("N/prob must be non-negative"); } @@ -78944,8 +79049,8 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref) return isNumber(probOrN) ? probArr : bignumber2(probArr); } } - function _quantileSeqProbCollection(data2, probOrN, sorted) { - var dataArr = data2.valueOf(); + function _quantileSeqProbCollection(data3, probOrN, sorted) { + var dataArr = data3.valueOf(); var probOrNArr = probOrN.valueOf(); var probArr = []; for (var i4 = 0; i4 < probOrNArr.length; ++i4) { @@ -78959,11 +79064,11 @@ var createQuantileSeq = /* @__PURE__ */ factory(name260, dependencies259, (_ref) if (len === 0) { throw new Error("Cannot calculate quantile of an empty sequence"); } - var index2 = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1); - var integerPart = isNumber(prob) ? Math.floor(index2) : index2.floor().toNumber(); - var fracPart = isNumber(prob) ? index2 % 1 : index2.minus(integerPart); - if (isInteger3(index2)) { - return sorted ? flat2[index2] : partitionSelect2(flat2, isNumber(prob) ? index2 : index2.valueOf()); + var index3 = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1); + var integerPart = isNumber(prob) ? Math.floor(index3) : index3.floor().toNumber(); + var fracPart = isNumber(prob) ? index3 % 1 : index3.minus(integerPart); + if (isInteger3(index3)) { + return sorted ? flat2[index3] : partitionSelect2(flat2, isNumber(prob) ? index3 : index3.valueOf()); } var left; var right; @@ -78989,7 +79094,7 @@ var dependencies260 = ["typed", "map", "sqrt", "variance"]; var createStd = /* @__PURE__ */ factory(name261, dependencies260, (_ref) => { var { typed: typed3, - map: map4, + map: map6, sqrt: sqrt3, variance: variance2 } = _ref; @@ -79009,7 +79114,7 @@ var createStd = /* @__PURE__ */ factory(name261, dependencies260, (_ref) => { try { var v2 = variance2.apply(null, arguments); if (isCollection(v2)) { - return map4(v2, sqrt3); + return map6(v2, sqrt3); } else { return sqrt3(v2); } @@ -79071,7 +79176,7 @@ var createCorr = /* @__PURE__ */ factory(name262, dependencies261, (_ref) => { var n3 = A.length; var sumX = sum4(A); var sumY = sum4(B2); - var sumXY = A.reduce((acc, x2, index2) => add4(acc, multiply2(x2, B2[index2])), 0); + var sumXY = A.reduce((acc, x2, index3) => add4(acc, multiply2(x2, B2[index3])), 0); var sumXSquare = sum4(A.map((x2) => pow3(x2, 2))); var sumYSquare = sum4(B2.map((y3) => pow3(y3, 2))); var numerator = subtract3(multiply2(n3, sumXY), multiply2(sumX, sumY)); @@ -79093,20 +79198,20 @@ var createCombinations = /* @__PURE__ */ factory(name263, dependencies262, (_ref var BigNumber2 = n3.constructor; var result, i4; var nMinusk = n3.minus(k2); - var one = new BigNumber2(1); + var one5 = new BigNumber2(1); if (!isPositiveInteger(n3) || !isPositiveInteger(k2)) { throw new TypeError("Positive integer value expected in function combinations"); } if (k2.gt(n3)) { throw new TypeError("k must be less than n in function combinations"); } - result = one; + result = one5; if (k2.lt(nMinusk)) { - for (i4 = one; i4.lte(nMinusk); i4 = i4.plus(one)) { + for (i4 = one5; i4.lte(nMinusk); i4 = i4.plus(one5)) { result = result.times(k2.plus(i4)).dividedBy(i4); } } else { - for (i4 = one; i4.lte(k2); i4 = i4.plus(one)) { + for (i4 = one5; i4.lte(k2); i4 = i4.plus(one5)) { result = result.times(nMinusk.plus(i4)).dividedBy(i4); } } @@ -79146,21 +79251,21 @@ var createCombinationsWithRep = /* @__PURE__ */ factory(name264, dependencies263 "BigNumber, BigNumber": function BigNumberBigNumber(n3, k2) { var BigNumber2 = n3.constructor; var result, i4; - var one = new BigNumber2(1); - var nMinusOne = n3.minus(one); + var one5 = new BigNumber2(1); + var nMinusOne = n3.minus(one5); if (!isPositiveInteger2(n3) || !isPositiveInteger2(k2)) { throw new TypeError("Positive integer value expected in function combinationsWithRep"); } - if (n3.lt(one)) { + if (n3.lt(one5)) { throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep"); } - result = one; + result = one5; if (k2.lt(nMinusOne)) { - for (i4 = one; i4.lte(nMinusOne); i4 = i4.plus(one)) { + for (i4 = one5; i4.lte(nMinusOne); i4 = i4.plus(one5)) { result = result.times(k2.plus(i4)).dividedBy(i4); } } else { - for (i4 = one; i4.lte(k2); i4 = i4.plus(one)) { + for (i4 = one5; i4.lte(k2); i4 = i4.plus(one5)) { result = result.times(nMinusOne.plus(i4)).dividedBy(i4); } } @@ -79229,12 +79334,12 @@ var createGamma = /* @__PURE__ */ factory(name265, dependencies264, (_ref) => { if (n3 % 2 === 1) { return n3.times(bigFactorial(new _BigNumber(n3 - 1))); } - var p = n3; + var p2 = n3; var prod2 = new Big(n3); var sum4 = n3.toNumber(); - while (p > 2) { - p -= 2; - sum4 += p; + while (p2 > 2) { + p2 -= 2; + sum4 += p2; prod2 = prod2.times(sum4); } return new _BigNumber(prod2.toPrecision(_BigNumber.precision)); @@ -79322,7 +79427,7 @@ var createFactorial = /* @__PURE__ */ factory(name267, dependencies266, (_ref) = gamma: gamma2 } = _ref; return typed3(name267, { - number: function number4(n3) { + number: function number5(n3) { if (n3 < 0) { throw new Error("Value must be non-negative"); } @@ -79348,27 +79453,27 @@ var createKldivergence = /* @__PURE__ */ factory(name268, dependencies267, (_ref divide: divide3, sum: sum4, multiply: multiply2, - map: map4, + map: map6, dotDivide: dotDivide2, log: log4, isNumeric: isNumeric2 } = _ref; return typed3(name268, { - "Array, Array": function ArrayArray(q2, p) { - return _kldiv(matrix2(q2), matrix2(p)); + "Array, Array": function ArrayArray(q2, p2) { + return _kldiv(matrix2(q2), matrix2(p2)); }, - "Matrix, Array": function MatrixArray(q2, p) { - return _kldiv(q2, matrix2(p)); + "Matrix, Array": function MatrixArray(q2, p2) { + return _kldiv(q2, matrix2(p2)); }, - "Array, Matrix": function ArrayMatrix(q2, p) { - return _kldiv(matrix2(q2), p); + "Array, Matrix": function ArrayMatrix(q2, p2) { + return _kldiv(matrix2(q2), p2); }, - "Matrix, Matrix": function MatrixMatrix(q2, p) { - return _kldiv(q2, p); + "Matrix, Matrix": function MatrixMatrix(q2, p2) { + return _kldiv(q2, p2); } }); - function _kldiv(q2, p) { - var plength = p.size().length; + function _kldiv(q2, p2) { + var plength = p2.size().length; var qlength = q2.size().length; if (plength > 1) { throw new Error("first object must be one dimensional"); @@ -79383,13 +79488,13 @@ var createKldivergence = /* @__PURE__ */ factory(name268, dependencies267, (_ref if (sumq === 0) { throw new Error("Sum of elements in first object must be non zero"); } - var sump = sum4(p); + var sump = sum4(p2); if (sump === 0) { throw new Error("Sum of elements in second object must be non zero"); } var qnorm = divide3(q2, sum4(q2)); - var pnorm = divide3(p, sum4(p)); - var result = sum4(multiply2(qnorm, map4(dotDivide2(qnorm, pnorm), (x2) => log4(x2)))); + var pnorm = divide3(p2, sum4(p2)); + var result = sum4(multiply2(qnorm, map6(dotDivide2(qnorm, pnorm), (x2) => log4(x2)))); if (isNumeric2(result)) { return result; } else { @@ -79457,8 +79562,8 @@ var createPermutations = /* @__PURE__ */ factory(name270, dependencies269, (_ref if (k2.gt(n3)) { throw new TypeError("second argument k must be less than or equal to first argument n"); } - var one = n3.mul(0).add(1); - result = one; + var one5 = n3.mul(0).add(1); + result = one5; for (i4 = n3.minus(k2).plus(1); i4.lte(n3); i4 = i4.plus(1)) { result = result.times(i4); } @@ -79509,9 +79614,9 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref) "Array | Matrix, Object": function ArrayMatrixObject(possibles, options) { return _pickRandom(possibles, options); }, - "Array | Matrix, number": function ArrayMatrixNumber(possibles, number4) { + "Array | Matrix, number": function ArrayMatrixNumber(possibles, number5) { return _pickRandom(possibles, { - number: number4 + number: number5 }); }, "Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(possibles, weights) { @@ -79519,28 +79624,28 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref) weights }); }, - "Array | Matrix, Array | Matrix, number": function ArrayMatrixArrayMatrixNumber(possibles, weights, number4) { + "Array | Matrix, Array | Matrix, number": function ArrayMatrixArrayMatrixNumber(possibles, weights, number5) { return _pickRandom(possibles, { - number: number4, + number: number5, weights }); }, - "Array | Matrix, number, Array | Matrix": function ArrayMatrixNumberArrayMatrix(possibles, number4, weights) { + "Array | Matrix, number, Array | Matrix": function ArrayMatrixNumberArrayMatrix(possibles, number5, weights) { return _pickRandom(possibles, { - number: number4, + number: number5, weights }); } }); function _pickRandom(possibles, _ref2) { var { - number: number4, + number: number5, weights, elementWise = true } = _ref2; - var single = typeof number4 === "undefined"; + var single = typeof number5 === "undefined"; if (single) { - number4 = 1; + number5 = 1; } var createMatrix2 = isMatrix(possibles) ? possibles.create : isMatrix(weights) ? weights.create : null; possibles = possibles.valueOf(); @@ -79566,7 +79671,7 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref) var length = possibles.length; var result = []; var pick; - while (result.length < number4) { + while (result.length < number5) { if (typeof weights === "undefined") { pick = possibles[Math.floor(rng() * length)]; } else { @@ -79587,18 +79692,18 @@ var createPickRandom = /* @__PURE__ */ factory(name271, dependencies270, (_ref) // node_modules/mathjs/lib/esm/function/probability/util/randomMatrix.js function randomMatrix(size2, random3) { - var data2 = []; + var data3 = []; size2 = size2.slice(0); if (size2.length > 1) { for (var i4 = 0, length = size2.shift(); i4 < length; i4++) { - data2.push(randomMatrix(size2, random3)); + data3.push(randomMatrix(size2, random3)); } } else { for (var _i = 0, _length = size2.shift(); _i < _length; _i++) { - data2.push(random3()); + data3.push(random3()); } } - return data2; + return data3; } // node_modules/mathjs/lib/esm/function/probability/random.js @@ -79684,7 +79789,7 @@ var createStirlingS2 = /* @__PURE__ */ factory(name274, dependencies273, (_ref) combinations: combinations2, isNegative: isNegative2, isInteger: isInteger3, - number: number4, + number: number5, bignumber: bignumber2, larger: larger2 } = _ref; @@ -79699,9 +79804,9 @@ var createStirlingS2 = /* @__PURE__ */ factory(name274, dependencies273, (_ref) } var big = !(isNumber(n3) && isNumber(k2)); var cache2 = big ? bigCache : smallCache; - var make = big ? bignumber2 : number4; - var nn = number4(n3); - var nk = number4(k2); + var make = big ? bignumber2 : number5; + var nn = number5(n3); + var nk = number5(k2); if (cache2[nn] && cache2[nn].length > nk) { return cache2[nn][nk]; } @@ -79804,12 +79909,12 @@ var name278 = "leafCount"; var dependencies277 = ["parse", "typed"]; var createLeafCount = /* @__PURE__ */ factory(name278, dependencies277, (_ref) => { var { - parse: parse7, + parse: parse8, typed: typed3 } = _ref; - function countLeaves(node) { + function countLeaves(node2) { var count3 = 0; - node.forEach((n3) => { + node2.forEach((n3) => { count3 += countLeaves(n3); }); return count3 || 1; @@ -79970,13 +80075,13 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => { } return defaultContext[defaultName][property]; } - function isCommutative(node) { + function isCommutative(node2) { var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultContext; - return hasProperty(node, "commutative", context); + return hasProperty(node2, "commutative", context); } - function isAssociative(node) { + function isAssociative(node2) { var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultContext; - return hasProperty(node, "associative", context); + return hasProperty(node2, "associative", context); } function mergeContext(primary, secondary) { var merged = _objectSpread3({}, primary); @@ -79989,21 +80094,21 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => { } return merged; } - function flatten4(node, context) { - if (!node.args || node.args.length === 0) { - return node; + function flatten4(node2, context) { + if (!node2.args || node2.args.length === 0) { + return node2; } - node.args = allChildren(node, context); - for (var i4 = 0; i4 < node.args.length; i4++) { - flatten4(node.args[i4], context); + node2.args = allChildren(node2, context); + for (var i4 = 0; i4 < node2.args.length; i4++) { + flatten4(node2.args[i4], context); } } - function allChildren(node, context) { + function allChildren(node2, context) { var op; var children = []; - var findChildren = function findChildren2(node2) { - for (var i4 = 0; i4 < node2.args.length; i4++) { - var child = node2.args[i4]; + var findChildren = function findChildren2(node3) { + for (var i4 = 0; i4 < node3.args.length; i4++) { + var child = node3.args[i4]; if (isOperatorNode(child) && op === child.op) { findChildren2(child); } else { @@ -80011,53 +80116,53 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => { } } }; - if (isAssociative(node, context)) { - op = node.op; - findChildren(node); + if (isAssociative(node2, context)) { + op = node2.op; + findChildren(node2); return children; } else { - return node.args; + return node2.args; } } - function unflattenr(node, context) { - if (!node.args || node.args.length === 0) { + function unflattenr(node2, context) { + if (!node2.args || node2.args.length === 0) { return; } - var makeNode = createMakeNodeFunction(node); - var l2 = node.args.length; + var makeNode = createMakeNodeFunction(node2); + var l2 = node2.args.length; for (var i4 = 0; i4 < l2; i4++) { - unflattenr(node.args[i4], context); + unflattenr(node2.args[i4], context); } - if (l2 > 2 && isAssociative(node, context)) { - var curnode = node.args.pop(); - while (node.args.length > 0) { - curnode = makeNode([node.args.pop(), curnode]); + if (l2 > 2 && isAssociative(node2, context)) { + var curnode = node2.args.pop(); + while (node2.args.length > 0) { + curnode = makeNode([node2.args.pop(), curnode]); } - node.args = curnode.args; + node2.args = curnode.args; } } - function unflattenl(node, context) { - if (!node.args || node.args.length === 0) { + function unflattenl(node2, context) { + if (!node2.args || node2.args.length === 0) { return; } - var makeNode = createMakeNodeFunction(node); - var l2 = node.args.length; + var makeNode = createMakeNodeFunction(node2); + var l2 = node2.args.length; for (var i4 = 0; i4 < l2; i4++) { - unflattenl(node.args[i4], context); + unflattenl(node2.args[i4], context); } - if (l2 > 2 && isAssociative(node, context)) { - var curnode = node.args.shift(); - while (node.args.length > 0) { - curnode = makeNode([curnode, node.args.shift()]); + if (l2 > 2 && isAssociative(node2, context)) { + var curnode = node2.args.shift(); + while (node2.args.length > 0) { + curnode = makeNode([curnode, node2.args.shift()]); } - node.args = curnode.args; + node2.args = curnode.args; } } - function createMakeNodeFunction(node) { - if (isOperatorNode(node)) { + function createMakeNodeFunction(node2) { + if (isOperatorNode(node2)) { return function(args) { try { - return new OperatorNode2(node.op, node.fn, args, node.implicit); + return new OperatorNode2(node2.op, node2.fn, args, node2.implicit); } catch (err) { console.error(err); return []; @@ -80065,7 +80170,7 @@ var createUtil = /* @__PURE__ */ factory(name279, dependencies278, (_ref) => { }; } else { return function(args) { - return new FunctionNode3(new SymbolNode2(node.name), args); + return new FunctionNode3(new SymbolNode2(node2.name), args); }; } } @@ -80092,7 +80197,7 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => var { config: config4, typed: typed3, - parse: parse7, + parse: parse8, add: add4, subtract: subtract3, multiply: multiply2, @@ -80155,9 +80260,9 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => simplify2.defaultContext = defaultContext; simplify2.realContext = realContext; simplify2.positiveContext = positiveContext; - function removeParens(node) { - return node.transform(function(node2, path2, parent) { - return isParenthesisNode(node2) ? removeParens(node2.content) : node2; + function removeParens(node2) { + return node2.transform(function(node3, path3, parent) { + return isParenthesisNode(node3) ? removeParens(node3.content) : node3; }); } var SUPPORTED_CONSTANTS = { @@ -80560,15 +80665,15 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => newRule.l = ruleObject.l; newRule.r = ruleObject.r; } - newRule.l = removeParens(parse7(newRule.l)); - newRule.r = removeParens(parse7(newRule.r)); + newRule.l = removeParens(parse8(newRule.l)); + newRule.r = removeParens(parse8(newRule.r)); for (var prop2 of ["imposeContext", "repeat", "assuming"]) { if (prop2 in ruleObject) { newRule[prop2] = ruleObject[prop2]; } } if (ruleObject.evaluate) { - newRule.evaluate = parse7(ruleObject.evaluate); + newRule.evaluate = parse8(ruleObject.evaluate); } if (isAssociative(newRule.l, context)) { var nonCommutative = !isCommutative(newRule.l, context); @@ -80683,18 +80788,18 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } return resNodes; } - function applyRule(node, rule, context) { + function applyRule(node2, rule, context) { if (rule.assuming) { for (var symbol in rule.assuming) { for (var property in rule.assuming[symbol]) { if (hasProperty(symbol, property, context) !== rule.assuming[symbol][property]) { - return node; + return node2; } } } } var mergedContext = mergeContext(rule.imposeContext, context); - var res = node; + var res = node2; if (res instanceof OperatorNode2 || res instanceof FunctionNode3) { var newArgs = mapRule(res.args, rule, context); if (newArgs !== res.args) { @@ -80763,37 +80868,37 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => if (implicit && "implicit" in repl) { res.implicit = true; } - res = res.transform(function(node2) { - if (node2.isSymbolNode && hasOwnProperty2(matches.placeholders, node2.name)) { - return matches.placeholders[node2.name].clone(); + res = res.transform(function(node3) { + if (node3.isSymbolNode && hasOwnProperty2(matches.placeholders, node3.name)) { + return matches.placeholders[node3.name].clone(); } else { - return node2; + return node3; } }); } - if (rule.repeat && res !== node) { + if (rule.repeat && res !== node2) { res = applyRule(res, rule, context); } return res; } - function getSplits(node, context) { + function getSplits(node2, context) { var res = []; var right, rightArgs; - var makeNode = createMakeNodeFunction(node); - if (isCommutative(node, context)) { - for (var i4 = 0; i4 < node.args.length; i4++) { - rightArgs = node.args.slice(0); + var makeNode = createMakeNodeFunction(node2); + if (isCommutative(node2, context)) { + for (var i4 = 0; i4 < node2.args.length; i4++) { + rightArgs = node2.args.slice(0); rightArgs.splice(i4, 1); right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs); - res.push(makeNode([node.args[i4], right])); + res.push(makeNode([node2.args[i4], right])); } } else { - for (var _i = 1; _i < node.args.length; _i++) { - var left = node.args[0]; + for (var _i = 1; _i < node2.args.length; _i++) { + var left = node2.args[0]; if (_i > 1) { - left = makeNode(node.args.slice(0, _i)); + left = makeNode(node2.args.slice(0, _i)); } - rightArgs = node.args.slice(_i); + rightArgs = node2.args.slice(_i); right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs); res.push(makeNode([left, right])); } @@ -80811,11 +80916,11 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } else if (!match2.placeholders) { return match1; } - for (var key2 in match1.placeholders) { - if (hasOwnProperty2(match1.placeholders, key2)) { - res.placeholders[key2] = match1.placeholders[key2]; - if (hasOwnProperty2(match2.placeholders, key2)) { - if (!_exactMatch(match1.placeholders[key2], match2.placeholders[key2])) { + for (var key3 in match1.placeholders) { + if (hasOwnProperty2(match1.placeholders, key3)) { + res.placeholders[key3] = match1.placeholders[key3]; + if (hasOwnProperty2(match2.placeholders, key3)) { + if (!_exactMatch(match1.placeholders[key3], match2.placeholders[key3])) { return null; } } @@ -80828,15 +80933,15 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } return res; } - function combineChildMatches(list1, list2) { + function combineChildMatches(list1, list22) { var res = []; - if (list1.length === 0 || list2.length === 0) { + if (list1.length === 0 || list22.length === 0) { return res; } var merged; for (var i1 = 0; i1 < list1.length; i1++) { - for (var i22 = 0; i22 < list2.length; i22++) { - merged = mergeMatch(list1[i1], list2[i22]); + for (var i22 = 0; i22 < list22.length; i22++) { + merged = mergeMatch(list1[i1], list22[i22]); if (merged) { res.push(merged); } @@ -80860,49 +80965,49 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } return uniqueSets; } - function _ruleMatch(rule, node, context, isSplit) { + function _ruleMatch(rule, node2, context, isSplit) { var res = [{ placeholders: {} }]; - if (rule instanceof OperatorNode2 && node instanceof OperatorNode2 || rule instanceof FunctionNode3 && node instanceof FunctionNode3) { + if (rule instanceof OperatorNode2 && node2 instanceof OperatorNode2 || rule instanceof FunctionNode3 && node2 instanceof FunctionNode3) { if (rule instanceof OperatorNode2) { - if (rule.op !== node.op || rule.fn !== node.fn) { + if (rule.op !== node2.op || rule.fn !== node2.fn) { return []; } } else if (rule instanceof FunctionNode3) { - if (rule.name !== node.name) { + if (rule.name !== node2.name) { return []; } } - if (node.args.length === 1 && rule.args.length === 1 || !isAssociative(node, context) && node.args.length === rule.args.length || isSplit) { + if (node2.args.length === 1 && rule.args.length === 1 || !isAssociative(node2, context) && node2.args.length === rule.args.length || isSplit) { var childMatches = []; for (var i4 = 0; i4 < rule.args.length; i4++) { - var childMatch = _ruleMatch(rule.args[i4], node.args[i4], context); + var childMatch = _ruleMatch(rule.args[i4], node2.args[i4], context); if (childMatch.length === 0) { break; } childMatches.push(childMatch); } if (childMatches.length !== rule.args.length) { - if (!isCommutative(node, context) || rule.args.length === 1) { + if (!isCommutative(node2, context) || rule.args.length === 1) { return []; } if (rule.args.length > 2) { throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented"); } - var leftMatch = _ruleMatch(rule.args[0], node.args[1], context); + var leftMatch = _ruleMatch(rule.args[0], node2.args[1], context); if (leftMatch.length === 0) { return []; } - var rightMatch = _ruleMatch(rule.args[1], node.args[0], context); + var rightMatch = _ruleMatch(rule.args[1], node2.args[0], context); if (rightMatch.length === 0) { return []; } childMatches = [leftMatch, rightMatch]; } res = mergeChildMatches(childMatches); - } else if (node.args.length >= 2 && rule.args.length === 2) { - var splits = getSplits(node, context); + } else if (node2.args.length >= 2 && rule.args.length === 2) { + var splits = getSplits(node2, context); var splitMatches = []; for (var _i2 = 0; _i2 < splits.length; _i2++) { var matchSet = _ruleMatch(rule, splits[_i2], context, true); @@ -80919,61 +81024,61 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => throw new Error("Symbol in rule has 0 length...!?"); } if (SUPPORTED_CONSTANTS[rule.name]) { - if (rule.name !== node.name) { + if (rule.name !== node2.name) { return []; } } else { switch (rule.name[1] >= "a" && rule.name[1] <= "z" ? rule.name.substring(0, 2) : rule.name[0]) { case "n": case "_p": - res[0].placeholders[rule.name] = node; + res[0].placeholders[rule.name] = node2; break; case "c": case "cl": - if (isConstantNode(node)) { - res[0].placeholders[rule.name] = node; + if (isConstantNode(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "v": - if (!isConstantNode(node)) { - res[0].placeholders[rule.name] = node; + if (!isConstantNode(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "vl": - if (isSymbolNode(node)) { - res[0].placeholders[rule.name] = node; + if (isSymbolNode(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "cd": - if (isNumericNode(node)) { - res[0].placeholders[rule.name] = node; + if (isNumericNode(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "vd": - if (!isNumericNode(node)) { - res[0].placeholders[rule.name] = node; + if (!isNumericNode(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "ce": - if (isConstantExpression(node)) { - res[0].placeholders[rule.name] = node; + if (isConstantExpression(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } break; case "ve": - if (!isConstantExpression(node)) { - res[0].placeholders[rule.name] = node; + if (!isConstantExpression(node2)) { + res[0].placeholders[rule.name] = node2; } else { return []; } @@ -80983,7 +81088,7 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } } } else if (rule instanceof ConstantNode3) { - if (!equal2(rule.value, node.value)) { + if (!equal2(rule.value, node2.value)) { return []; } } else { @@ -80991,30 +81096,30 @@ var createSimplify = /* @__PURE__ */ factory(name280, dependencies279, (_ref) => } return res; } - function _exactMatch(p, q2) { - if (p instanceof ConstantNode3 && q2 instanceof ConstantNode3) { - if (!equal2(p.value, q2.value)) { + function _exactMatch(p2, q2) { + if (p2 instanceof ConstantNode3 && q2 instanceof ConstantNode3) { + if (!equal2(p2.value, q2.value)) { return false; } - } else if (p instanceof SymbolNode2 && q2 instanceof SymbolNode2) { - if (p.name !== q2.name) { + } else if (p2 instanceof SymbolNode2 && q2 instanceof SymbolNode2) { + if (p2.name !== q2.name) { return false; } - } else if (p instanceof OperatorNode2 && q2 instanceof OperatorNode2 || p instanceof FunctionNode3 && q2 instanceof FunctionNode3) { - if (p instanceof OperatorNode2) { - if (p.op !== q2.op || p.fn !== q2.fn) { + } else if (p2 instanceof OperatorNode2 && q2 instanceof OperatorNode2 || p2 instanceof FunctionNode3 && q2 instanceof FunctionNode3) { + if (p2 instanceof OperatorNode2) { + if (p2.op !== q2.op || p2.fn !== q2.fn) { return false; } - } else if (p instanceof FunctionNode3) { - if (p.name !== q2.name) { + } else if (p2 instanceof FunctionNode3) { + if (p2.name !== q2.name) { return false; } } - if (p.args.length !== q2.args.length) { + if (p2.args.length !== q2.args.length) { return false; } - for (var i4 = 0; i4 < p.args.length; i4++) { - if (!_exactMatch(p.args[i4], q2.args[i4])) { + for (var i4 = 0; i4 < p2.args.length; i4++) { + if (!_exactMatch(p2.args[i4], q2.args[i4])) { return false; } } @@ -81057,7 +81162,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( SymbolNode: SymbolNode2 }); var simplifyConstant2 = typed3("simplifyConstant", { - Node: (node) => _ensureNode(foldFraction(node, {})), + Node: (node2) => _ensureNode(foldFraction(node2, {})), "Node, Object": function NodeObject(expr, options) { return _ensureNode(foldFraction(expr, options)); } @@ -81077,14 +81182,14 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( function _eval(fnname, args, options) { try { return mathWithTransform2[fnname].apply(null, args); - } catch (ignore2) { + } catch (ignore3) { args = args.map(_removeFractions); return _toNumber(mathWithTransform2[fnname].apply(null, args), options); } } var _toNode = typed3({ Fraction: _fractionToNode, - number: function number4(n3) { + number: function number5(n3) { if (n3 < 0) { return unaryMinusNode(new ConstantNode3(-n3)); } @@ -81099,7 +81204,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( Complex: function Complex3(s4) { throw new Error("Cannot convert Complex number to Node"); }, - string: function string4(s4) { + string: function string6(s4) { return new ConstantNode3(s4); }, Matrix: function Matrix2(m4) { @@ -81178,12 +81283,12 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( } return new OperatorNode2("/", "divide", [n3, new ConstantNode3(f2.d)]); } - function _foldAccessor(obj, index2, options) { - if (!isIndexNode(index2)) { - return new AccessorNode2(_ensureNode(obj), _ensureNode(index2)); + function _foldAccessor(obj, index3, options) { + if (!isIndexNode(index3)) { + return new AccessorNode2(_ensureNode(obj), _ensureNode(index3)); } if (isArrayNode(obj) || isMatrix(obj)) { - var remainingDims = Array.from(index2.dimensions); + var remainingDims = Array.from(index3.dimensions); while (remainingDims.length > 0) { if (isConstantNode(remainingDims[0]) && typeof remainingDims[0].value !== "string") { var first = _toNumber(remainingDims.shift().value, options); @@ -81222,23 +81327,23 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( break; } } - if (remainingDims.length === index2.dimensions.length) { - return new AccessorNode2(_ensureNode(obj), index2); + if (remainingDims.length === index3.dimensions.length) { + return new AccessorNode2(_ensureNode(obj), index3); } if (remainingDims.length > 0) { - index2 = new IndexNode2(remainingDims); - return new AccessorNode2(_ensureNode(obj), index2); + index3 = new IndexNode2(remainingDims); + return new AccessorNode2(_ensureNode(obj), index3); } return obj; } - if (isObjectNode(obj) && index2.dimensions.length === 1 && isConstantNode(index2.dimensions[0])) { - var key2 = index2.dimensions[0].value; - if (key2 in obj.properties) { - return obj.properties[key2]; + if (isObjectNode(obj) && index3.dimensions.length === 1 && isConstantNode(index3.dimensions[0])) { + var key3 = index3.dimensions[0].value; + if (key3 in obj.properties) { + return obj.properties[key3]; } return new ConstantNode3(); } - return new AccessorNode2(_ensureNode(obj), index2); + return new AccessorNode2(_ensureNode(obj), index3); } function foldOp(fn, args, makeNode, options) { var first = args.shift(); @@ -81264,36 +81369,36 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( } return makeNode([reduction[0], _toNode(reduction[1])]); } - function foldFraction(node, options) { - switch (node.type) { + function foldFraction(node2, options) { + switch (node2.type) { case "SymbolNode": - return node; + return node2; case "ConstantNode": - switch (typeof node.value) { + switch (typeof node2.value) { case "number": - return _toNumber(node.value, options); + return _toNumber(node2.value, options); case "string": - return node.value; + return node2.value; default: - if (!isNaN(node.value)) - return _toNumber(node.value, options); + if (!isNaN(node2.value)) + return _toNumber(node2.value, options); } - return node; + return node2; case "FunctionNode": - if (mathWithTransform2[node.name] && mathWithTransform2[node.name].rawArgs) { - return node; + if (mathWithTransform2[node2.name] && mathWithTransform2[node2.name].rawArgs) { + return node2; } { var operatorFunctions = ["add", "multiply"]; - if (operatorFunctions.indexOf(node.name) === -1) { - var args = node.args.map((arg2) => foldFraction(arg2, options)); + if (operatorFunctions.indexOf(node2.name) === -1) { + var args = node2.args.map((arg2) => foldFraction(arg2, options)); if (!args.some(isNode2)) { try { - return _eval(node.name, args, options); + return _eval(node2.name, args, options); } catch (ignoreandcontinue) { } } - if (node.name === "size" && args.length === 1 && isArrayNode(args[0])) { + if (node2.name === "size" && args.length === 1 && isArrayNode(args[0])) { var sz = []; var section = args[0]; while (isArrayNode(section)) { @@ -81302,24 +81407,24 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( } return matrix2(sz); } - return new FunctionNode3(node.name, args.map(_ensureNode)); + return new FunctionNode3(node2.name, args.map(_ensureNode)); } else { } } case "OperatorNode": { - var fn = node.fn.toString(); + var fn = node2.fn.toString(); var _args; var res; - var makeNode = createMakeNodeFunction(node); - if (isOperatorNode(node) && node.isUnary()) { - _args = [foldFraction(node.args[0], options)]; + var makeNode = createMakeNodeFunction(node2); + if (isOperatorNode(node2) && node2.isUnary()) { + _args = [foldFraction(node2.args[0], options)]; if (!isNode2(_args[0])) { res = _eval(fn, _args, options); } else { res = makeNode(_args); } - } else if (isAssociative(node, options.context)) { - _args = allChildren(node, options.context); + } else if (isAssociative(node2, options.context)) { + _args = allChildren(node2, options.context); _args = _args.map((arg2) => foldFraction(arg2, options)); if (isCommutative(fn, options.context)) { var consts = []; @@ -81342,29 +81447,29 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( res = foldOp(fn, _args, makeNode, options); } } else { - _args = node.args.map((arg2) => foldFraction(arg2, options)); + _args = node2.args.map((arg2) => foldFraction(arg2, options)); res = foldOp(fn, _args, makeNode, options); } return res; } case "ParenthesisNode": - return foldFraction(node.content, options); + return foldFraction(node2.content, options); case "AccessorNode": - return _foldAccessor(foldFraction(node.object, options), foldFraction(node.index, options), options); + return _foldAccessor(foldFraction(node2.object, options), foldFraction(node2.index, options), options); case "ArrayNode": { - var foldItems = node.items.map((item) => foldFraction(item, options)); + var foldItems = node2.items.map((item) => foldFraction(item, options)); if (foldItems.some(isNode2)) { return new ArrayNode2(foldItems.map(_ensureNode)); } return matrix2(foldItems); } case "IndexNode": { - return new IndexNode2(node.dimensions.map((n3) => simplifyConstant2(n3, options))); + return new IndexNode2(node2.dimensions.map((n3) => simplifyConstant2(n3, options))); } case "ObjectNode": { var foldProps = {}; - for (var prop2 in node.properties) { - foldProps[prop2] = simplifyConstant2(node.properties[prop2], options); + for (var prop2 in node2.properties) { + foldProps[prop2] = simplifyConstant2(node2.properties[prop2], options); } return new ObjectNode2(foldProps); } @@ -81374,7 +81479,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name281, dependencies280, ( case "RangeNode": case "ConditionalNode": default: - throw new Error("Unimplemented node type in simplifyConstant: ".concat(node.type)); + throw new Error("Unimplemented node type in simplifyConstant: ".concat(node2.type)); } } return simplifyConstant2; @@ -81386,7 +81491,7 @@ var dependencies281 = ["typed", "parse", "equal", "isZero", "add", "subtract", " var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref) => { var { typed: typed3, - parse: parse7, + parse: parse8, equal: equal2, isZero: isZero2, add: add4, @@ -81408,8 +81513,8 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref var node1 = new ConstantNode3(1); var nodeT = new ConstantNode3(true); var nodeF = new ConstantNode3(false); - function isAlwaysBoolean(node) { - return isOperatorNode(node) && ["and", "not", "or"].includes(node.op); + function isAlwaysBoolean(node2) { + return isOperatorNode(node2) && ["and", "not", "or"].includes(node2.op); } var { hasProperty, @@ -81438,30 +81543,30 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref return simpChild; } } - var node = nodeToSimplify; - if (isFunctionNode(node)) { - var op = getOperator(node.name); + var node2 = nodeToSimplify; + if (isFunctionNode(node2)) { + var op = getOperator(node2.name); if (op) { - if (node.args.length > 2 && hasProperty(node, "associative", context)) { - while (node.args.length > 2) { - var last = node.args.pop(); - var seclast = node.args.pop(); - node.args.push(new OperatorNode2(op, node.name, [last, seclast])); + if (node2.args.length > 2 && hasProperty(node2, "associative", context)) { + while (node2.args.length > 2) { + var last = node2.args.pop(); + var seclast = node2.args.pop(); + node2.args.push(new OperatorNode2(op, node2.name, [last, seclast])); } } - node = new OperatorNode2(op, node.name, node.args); + node2 = new OperatorNode2(op, node2.name, node2.args); } else { - return new FunctionNode3(_simplifyCore(node.fn), node.args.map((n3) => _simplifyCore(n3, options))); + return new FunctionNode3(_simplifyCore(node2.fn), node2.args.map((n3) => _simplifyCore(n3, options))); } } - if (isOperatorNode(node) && node.isUnary()) { - var a0 = _simplifyCore(node.args[0], options); - if (node.op === "~") { + if (isOperatorNode(node2) && node2.isUnary()) { + var a0 = _simplifyCore(node2.args[0], options); + if (node2.op === "~") { if (isOperatorNode(a0) && a0.isUnary() && a0.op === "~") { return a0.args[0]; } } - if (node.op === "not") { + if (node2.op === "not") { if (isOperatorNode(a0) && a0.isUnary() && a0.op === "not") { if (isAlwaysBoolean(a0.args[0])) { return a0.args[0]; @@ -81469,10 +81574,10 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } } var finish = true; - if (node.op === "-") { + if (node2.op === "-") { if (isOperatorNode(a0)) { if (a0.isBinary() && a0.fn === "subtract") { - node = new OperatorNode2("-", "subtract", [a0.args[1], a0.args[0]]); + node2 = new OperatorNode2("-", "subtract", [a0.args[1], a0.args[0]]); finish = false; } if (a0.isUnary() && a0.op === "-") { @@ -81481,12 +81586,12 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } } if (finish) - return new OperatorNode2(node.op, node.fn, [a0]); + return new OperatorNode2(node2.op, node2.fn, [a0]); } - if (isOperatorNode(node) && node.isBinary()) { - var _a = _simplifyCore(node.args[0], options); - var a1 = _simplifyCore(node.args[1], options); - if (node.op === "+") { + if (isOperatorNode(node2) && node2.isBinary()) { + var _a = _simplifyCore(node2.args[0], options); + var a1 = _simplifyCore(node2.args[1], options); + if (node2.op === "+") { if (isConstantNode(_a) && isZero2(_a.value)) { return a1; } @@ -81495,10 +81600,10 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } if (isOperatorNode(a1) && a1.isUnary() && a1.op === "-") { a1 = a1.args[0]; - node = new OperatorNode2("-", "subtract", [_a, a1]); + node2 = new OperatorNode2("-", "subtract", [_a, a1]); } } - if (node.op === "-") { + if (node2.op === "-") { if (isOperatorNode(a1) && a1.isUnary() && a1.op === "-") { return _simplifyCore(new OperatorNode2("+", "add", [_a, a1.args[0]]), options); } @@ -81508,9 +81613,9 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref if (isConstantNode(a1) && isZero2(a1.value)) { return _a; } - return new OperatorNode2(node.op, node.fn, [_a, a1]); + return new OperatorNode2(node2.op, node2.fn, [_a, a1]); } - if (node.op === "*") { + if (node2.op === "*") { if (isConstantNode(_a)) { if (isZero2(_a.value)) { return node0; @@ -81524,22 +81629,22 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } else if (equal2(a1.value, 1)) { return _a; } - if (isCommutative(node, context)) { - return new OperatorNode2(node.op, node.fn, [a1, _a], node.implicit); + if (isCommutative(node2, context)) { + return new OperatorNode2(node2.op, node2.fn, [a1, _a], node2.implicit); } } - return new OperatorNode2(node.op, node.fn, [_a, a1], node.implicit); + return new OperatorNode2(node2.op, node2.fn, [_a, a1], node2.implicit); } - if (node.op === "/") { + if (node2.op === "/") { if (isConstantNode(_a) && isZero2(_a.value)) { return node0; } if (isConstantNode(a1) && equal2(a1.value, 1)) { return _a; } - return new OperatorNode2(node.op, node.fn, [_a, a1]); + return new OperatorNode2(node2.op, node2.fn, [_a, a1]); } - if (node.op === "^") { + if (node2.op === "^") { if (isConstantNode(a1)) { if (isZero2(a1.value)) { return node1; @@ -81548,7 +81653,7 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } } } - if (node.op === "and") { + if (node2.op === "and") { if (isConstantNode(_a)) { if (_a.value) { if (isAlwaysBoolean(a1)) @@ -81569,7 +81674,7 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } } } - if (node.op === "or") { + if (node2.op === "or") { if (isConstantNode(_a)) { if (_a.value) { return nodeT; @@ -81587,28 +81692,28 @@ var createSimplifyCore = /* @__PURE__ */ factory(name282, dependencies281, (_ref } } } - return new OperatorNode2(node.op, node.fn, [_a, a1]); + return new OperatorNode2(node2.op, node2.fn, [_a, a1]); } - if (isOperatorNode(node)) { - return new OperatorNode2(node.op, node.fn, node.args.map((a4) => _simplifyCore(a4, options))); + if (isOperatorNode(node2)) { + return new OperatorNode2(node2.op, node2.fn, node2.args.map((a4) => _simplifyCore(a4, options))); } - if (isArrayNode(node)) { - return new ArrayNode2(node.items.map((n3) => _simplifyCore(n3, options))); + if (isArrayNode(node2)) { + return new ArrayNode2(node2.items.map((n3) => _simplifyCore(n3, options))); } - if (isAccessorNode(node)) { - return new AccessorNode2(_simplifyCore(node.object, options), _simplifyCore(node.index, options)); + if (isAccessorNode(node2)) { + return new AccessorNode2(_simplifyCore(node2.object, options), _simplifyCore(node2.index, options)); } - if (isIndexNode(node)) { - return new IndexNode2(node.dimensions.map((n3) => _simplifyCore(n3, options))); + if (isIndexNode(node2)) { + return new IndexNode2(node2.dimensions.map((n3) => _simplifyCore(n3, options))); } - if (isObjectNode(node)) { + if (isObjectNode(node2)) { var newProps = {}; - for (var prop2 in node.properties) { - newProps[prop2] = _simplifyCore(node.properties[prop2], options); + for (var prop2 in node2.properties) { + newProps[prop2] = _simplifyCore(node2.properties[prop2], options); } return new ObjectNode2(newProps); } - return node; + return node2; } return typed3(name282, { Node: _simplifyCore, @@ -81622,48 +81727,48 @@ var dependencies282 = ["typed", "parse", "ConstantNode", "FunctionNode", "Operat var createResolve = /* @__PURE__ */ factory(name283, dependencies282, (_ref) => { var { typed: typed3, - parse: parse7, + parse: parse8, ConstantNode: ConstantNode3, FunctionNode: FunctionNode3, OperatorNode: OperatorNode2, ParenthesisNode: ParenthesisNode2 } = _ref; - function _resolve(node, scope) { + function _resolve(node2, scope) { var within = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Set(); if (!scope) { - return node; + return node2; } - if (isSymbolNode(node)) { - if (within.has(node.name)) { + if (isSymbolNode(node2)) { + if (within.has(node2.name)) { var variables = Array.from(within).join(", "); throw new ReferenceError("recursive loop of variable definitions among {".concat(variables, "}")); } - var value = scope.get(node.name); + var value = scope.get(node2.name); if (isNode2(value)) { var nextWithin = new Set(within); - nextWithin.add(node.name); + nextWithin.add(node2.name); return _resolve(value, scope, nextWithin); } else if (typeof value === "number") { - return parse7(String(value)); + return parse8(String(value)); } else if (value !== void 0) { return new ConstantNode3(value); } else { - return node; + return node2; } - } else if (isOperatorNode(node)) { - var args = node.args.map(function(arg2) { + } else if (isOperatorNode(node2)) { + var args = node2.args.map(function(arg2) { return _resolve(arg2, scope, within); }); - return new OperatorNode2(node.op, node.fn, args, node.implicit); - } else if (isParenthesisNode(node)) { - return new ParenthesisNode2(_resolve(node.content, scope, within)); - } else if (isFunctionNode(node)) { - var _args = node.args.map(function(arg2) { + return new OperatorNode2(node2.op, node2.fn, args, node2.implicit); + } else if (isParenthesisNode(node2)) { + return new ParenthesisNode2(_resolve(node2.content, scope, within)); + } else if (isFunctionNode(node2)) { + var _args = node2.args.map(function(arg2) { return _resolve(arg2, scope, within); }); - return new FunctionNode3(node.name, _args); + return new FunctionNode3(node2.name, _args); } - return node.map((child) => _resolve(child, scope, within)); + return node2.map((child) => _resolve(child, scope, within)); } return typed3("resolve", { Node: _resolve, @@ -81682,7 +81787,7 @@ var name284 = "symbolicEqual"; var dependencies283 = ["parse", "simplify", "typed", "OperatorNode"]; var createSymbolicEqual = /* @__PURE__ */ factory(name284, dependencies283, (_ref) => { var { - parse: parse7, + parse: parse8, simplify: simplify2, typed: typed3, OperatorNode: OperatorNode2 @@ -81706,7 +81811,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) var { typed: typed3, config: config4, - parse: parse7, + parse: parse8, simplify: simplify2, equal: equal2, isZero: isZero2, @@ -81729,7 +81834,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) typed3.addConversion({ from: "identifier", to: "SymbolNode", - convert: parse7 + convert: parse8 }); var derivative2 = typed3(name285, { "Node, SymbolNode": plainDerivative, @@ -81738,7 +81843,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) typed3.removeConversion({ from: "identifier", to: "SymbolNode", - convert: parse7 + convert: parse8 }); derivative2._simplify = true; derivative2.toTex = function(deriv) { @@ -81747,61 +81852,61 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) var _derivTex = typed3("_derivTex", { "Node, SymbolNode": function NodeSymbolNode(expr, x2) { if (isConstantNode(expr) && typeOf(expr.value) === "string") { - return _derivTex(parse7(expr.value).toString(), x2.toString(), 1); + return _derivTex(parse8(expr.value).toString(), x2.toString(), 1); } else { return _derivTex(expr.toTex(), x2.toString(), 1); } }, "Node, ConstantNode": function NodeConstantNode(expr, x2) { if (typeOf(x2.value) === "string") { - return _derivTex(expr, parse7(x2.value)); + return _derivTex(expr, parse8(x2.value)); } else { throw new Error("The second parameter to 'derivative' is a non-string constant"); } }, - "Node, SymbolNode, ConstantNode": function NodeSymbolNodeConstantNode(expr, x2, order) { - return _derivTex(expr.toString(), x2.name, order.value); + "Node, SymbolNode, ConstantNode": function NodeSymbolNodeConstantNode(expr, x2, order2) { + return _derivTex(expr.toString(), x2.name, order2.value); }, - "string, string, number": function stringStringNumber(expr, x2, order) { + "string, string, number": function stringStringNumber(expr, x2, order2) { var d4; - if (order === 1) { + if (order2 === 1) { d4 = "{d\\over d" + x2 + "}"; } else { - d4 = "{d^{" + order + "}\\over d" + x2 + "^{" + order + "}}"; + d4 = "{d^{" + order2 + "}\\over d" + x2 + "^{" + order2 + "}}"; } return d4 + "\\left[".concat(expr, "\\right]"); } }); var constTag = typed3("constTag", { - "Object, ConstantNode, string": function ObjectConstantNodeString(constNodes, node) { - constNodes[node] = true; + "Object, ConstantNode, string": function ObjectConstantNodeString(constNodes, node2) { + constNodes[node2] = true; return true; }, - "Object, SymbolNode, string": function ObjectSymbolNodeString(constNodes, node, varName) { - if (node.name !== varName) { - constNodes[node] = true; + "Object, SymbolNode, string": function ObjectSymbolNodeString(constNodes, node2, varName) { + if (node2.name !== varName) { + constNodes[node2] = true; return true; } return false; }, - "Object, ParenthesisNode, string": function ObjectParenthesisNodeString(constNodes, node, varName) { - return constTag(constNodes, node.content, varName); + "Object, ParenthesisNode, string": function ObjectParenthesisNodeString(constNodes, node2, varName) { + return constTag(constNodes, node2.content, varName); }, - "Object, FunctionAssignmentNode, string": function ObjectFunctionAssignmentNodeString(constNodes, node, varName) { - if (node.params.indexOf(varName) === -1) { - constNodes[node] = true; + "Object, FunctionAssignmentNode, string": function ObjectFunctionAssignmentNodeString(constNodes, node2, varName) { + if (node2.params.indexOf(varName) === -1) { + constNodes[node2] = true; return true; } - return constTag(constNodes, node.expr, varName); + return constTag(constNodes, node2.expr, varName); }, - "Object, FunctionNode | OperatorNode, string": function ObjectFunctionNodeOperatorNodeString(constNodes, node, varName) { - if (node.args.length > 0) { - var isConst = constTag(constNodes, node.args[0], varName); - for (var i4 = 1; i4 < node.args.length; ++i4) { - isConst = constTag(constNodes, node.args[i4], varName) && isConst; + "Object, FunctionNode | OperatorNode, string": function ObjectFunctionNodeOperatorNodeString(constNodes, node2, varName) { + if (node2.args.length > 0) { + var isConst = constTag(constNodes, node2.args[0], varName); + for (var i4 = 1; i4 < node2.args.length; ++i4) { + isConst = constTag(constNodes, node2.args[i4], varName) && isConst; } if (isConst) { - constNodes[node] = true; + constNodes[node2] = true; return true; } } @@ -81809,66 +81914,66 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) } }); var _derivative = typed3("_derivative", { - "ConstantNode, Object": function ConstantNodeObject(node) { + "ConstantNode, Object": function ConstantNodeObject(node2) { return createConstantNode2(0); }, - "SymbolNode, Object": function SymbolNodeObject(node, constNodes) { - if (constNodes[node] !== void 0) { + "SymbolNode, Object": function SymbolNodeObject(node2, constNodes) { + if (constNodes[node2] !== void 0) { return createConstantNode2(0); } return createConstantNode2(1); }, - "ParenthesisNode, Object": function ParenthesisNodeObject(node, constNodes) { - return new ParenthesisNode2(_derivative(node.content, constNodes)); + "ParenthesisNode, Object": function ParenthesisNodeObject(node2, constNodes) { + return new ParenthesisNode2(_derivative(node2.content, constNodes)); }, - "FunctionAssignmentNode, Object": function FunctionAssignmentNodeObject(node, constNodes) { - if (constNodes[node] !== void 0) { + "FunctionAssignmentNode, Object": function FunctionAssignmentNodeObject(node2, constNodes) { + if (constNodes[node2] !== void 0) { return createConstantNode2(0); } - return _derivative(node.expr, constNodes); + return _derivative(node2.expr, constNodes); }, - "FunctionNode, Object": function FunctionNodeObject(node, constNodes) { - if (constNodes[node] !== void 0) { + "FunctionNode, Object": function FunctionNodeObject(node2, constNodes) { + if (constNodes[node2] !== void 0) { return createConstantNode2(0); } - var arg0 = node.args[0]; + var arg0 = node2.args[0]; var arg1; var div2 = false; var negative = false; var funcDerivative; - switch (node.name) { + switch (node2.name) { case "cbrt": div2 = true; funcDerivative = new OperatorNode2("*", "multiply", [createConstantNode2(3), new OperatorNode2("^", "pow", [arg0, new OperatorNode2("/", "divide", [createConstantNode2(2), createConstantNode2(3)])])]); break; case "sqrt": case "nthRoot": - if (node.args.length === 1) { + if (node2.args.length === 1) { div2 = true; funcDerivative = new OperatorNode2("*", "multiply", [createConstantNode2(2), new FunctionNode3("sqrt", [arg0])]); - } else if (node.args.length === 2) { - arg1 = new OperatorNode2("/", "divide", [createConstantNode2(1), node.args[1]]); - constNodes[arg1] = constNodes[node.args[1]]; + } else if (node2.args.length === 2) { + arg1 = new OperatorNode2("/", "divide", [createConstantNode2(1), node2.args[1]]); + constNodes[arg1] = constNodes[node2.args[1]]; return _derivative(new OperatorNode2("^", "pow", [arg0, arg1]), constNodes); } break; case "log10": arg1 = createConstantNode2(10); case "log": - if (!arg1 && node.args.length === 1) { + if (!arg1 && node2.args.length === 1) { funcDerivative = arg0.clone(); div2 = true; - } else if (node.args.length === 1 && arg1 || node.args.length === 2 && constNodes[node.args[1]] !== void 0) { - funcDerivative = new OperatorNode2("*", "multiply", [arg0.clone(), new FunctionNode3("log", [arg1 || node.args[1]])]); + } else if (node2.args.length === 1 && arg1 || node2.args.length === 2 && constNodes[node2.args[1]] !== void 0) { + funcDerivative = new OperatorNode2("*", "multiply", [arg0.clone(), new FunctionNode3("log", [arg1 || node2.args[1]])]); div2 = true; - } else if (node.args.length === 2) { - return _derivative(new OperatorNode2("/", "divide", [new FunctionNode3("log", [arg0]), new FunctionNode3("log", [node.args[1]])]), constNodes); + } else if (node2.args.length === 2) { + return _derivative(new OperatorNode2("/", "divide", [new FunctionNode3("log", [arg0]), new FunctionNode3("log", [node2.args[1]])]), constNodes); } break; case "pow": - if (node.args.length === 2) { - constNodes[arg1] = constNodes[node.args[1]]; - return _derivative(new OperatorNode2("^", "pow", [arg0, node.args[1]]), constNodes); + if (node2.args.length === 2) { + constNodes[arg1] = constNodes[node2.args[1]]; + return _derivative(new OperatorNode2("^", "pow", [arg0, node2.args[1]]), constNodes); } break; case "exp": @@ -81884,11 +81989,11 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) funcDerivative = new OperatorNode2("^", "pow", [new FunctionNode3("sec", [arg0.clone()]), createConstantNode2(2)]); break; case "sec": - funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("tan", [arg0.clone()])]); + funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("tan", [arg0.clone()])]); break; case "csc": negative = true; - funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("cot", [arg0.clone()])]); + funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("cot", [arg0.clone()])]); break; case "cot": negative = true; @@ -81932,11 +82037,11 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) break; case "sech": negative = true; - funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("tanh", [arg0.clone()])]); + funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("tanh", [arg0.clone()])]); break; case "csch": negative = true; - funcDerivative = new OperatorNode2("*", "multiply", [node, new FunctionNode3("coth", [arg0.clone()])]); + funcDerivative = new OperatorNode2("*", "multiply", [node2, new FunctionNode3("coth", [arg0.clone()])]); break; case "coth": negative = true; @@ -81974,7 +82079,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) break; case "gamma": default: - throw new Error('Cannot process function "' + node.name + '" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported'); + throw new Error('Cannot process function "' + node2.name + '" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported'); } var op, func; if (div2) { @@ -81990,44 +82095,44 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) } return new OperatorNode2(op, func, [chainDerivative, funcDerivative]); }, - "OperatorNode, Object": function OperatorNodeObject(node, constNodes) { - if (constNodes[node] !== void 0) { + "OperatorNode, Object": function OperatorNodeObject(node2, constNodes) { + if (constNodes[node2] !== void 0) { return createConstantNode2(0); } - if (node.op === "+") { - return new OperatorNode2(node.op, node.fn, node.args.map(function(arg2) { + if (node2.op === "+") { + return new OperatorNode2(node2.op, node2.fn, node2.args.map(function(arg2) { return _derivative(arg2, constNodes); })); } - if (node.op === "-") { - if (node.isUnary()) { - return new OperatorNode2(node.op, node.fn, [_derivative(node.args[0], constNodes)]); + if (node2.op === "-") { + if (node2.isUnary()) { + return new OperatorNode2(node2.op, node2.fn, [_derivative(node2.args[0], constNodes)]); } - if (node.isBinary()) { - return new OperatorNode2(node.op, node.fn, [_derivative(node.args[0], constNodes), _derivative(node.args[1], constNodes)]); + if (node2.isBinary()) { + return new OperatorNode2(node2.op, node2.fn, [_derivative(node2.args[0], constNodes), _derivative(node2.args[1], constNodes)]); } } - if (node.op === "*") { - var constantTerms = node.args.filter(function(arg2) { + if (node2.op === "*") { + var constantTerms = node2.args.filter(function(arg2) { return constNodes[arg2] !== void 0; }); if (constantTerms.length > 0) { - var nonConstantTerms = node.args.filter(function(arg2) { + var nonConstantTerms = node2.args.filter(function(arg2) { return constNodes[arg2] === void 0; }); var nonConstantNode = nonConstantTerms.length === 1 ? nonConstantTerms[0] : new OperatorNode2("*", "multiply", nonConstantTerms); var newArgs = constantTerms.concat(_derivative(nonConstantNode, constNodes)); return new OperatorNode2("*", "multiply", newArgs); } - return new OperatorNode2("+", "add", node.args.map(function(argOuter) { - return new OperatorNode2("*", "multiply", node.args.map(function(argInner) { + return new OperatorNode2("+", "add", node2.args.map(function(argOuter) { + return new OperatorNode2("*", "multiply", node2.args.map(function(argInner) { return argInner === argOuter ? _derivative(argInner, constNodes) : argInner.clone(); })); })); } - if (node.op === "/" && node.isBinary()) { - var arg0 = node.args[0]; - var arg1 = node.args[1]; + if (node2.op === "/" && node2.isBinary()) { + var arg0 = node2.args[0]; + var arg1 = node2.args[1]; if (constNodes[arg1] !== void 0) { return new OperatorNode2("/", "divide", [_derivative(arg0, constNodes), arg1]); } @@ -82036,14 +82141,14 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) } return new OperatorNode2("/", "divide", [new OperatorNode2("-", "subtract", [new OperatorNode2("*", "multiply", [_derivative(arg0, constNodes), arg1.clone()]), new OperatorNode2("*", "multiply", [arg0.clone(), _derivative(arg1, constNodes)])]), new OperatorNode2("^", "pow", [arg1.clone(), createConstantNode2(2)])]); } - if (node.op === "^" && node.isBinary()) { - var _arg = node.args[0]; - var _arg2 = node.args[1]; + if (node2.op === "^" && node2.isBinary()) { + var _arg = node2.args[0]; + var _arg2 = node2.args[1]; if (constNodes[_arg] !== void 0) { if (isConstantNode(_arg) && (isZero2(_arg.value) || equal2(_arg.value, 1))) { return createConstantNode2(0); } - return new OperatorNode2("*", "multiply", [node, new OperatorNode2("*", "multiply", [new FunctionNode3("log", [_arg.clone()]), _derivative(_arg2.clone(), constNodes)])]); + return new OperatorNode2("*", "multiply", [node2, new OperatorNode2("*", "multiply", [new FunctionNode3("log", [_arg.clone()]), _derivative(_arg2.clone(), constNodes)])]); } if (constNodes[_arg2] !== void 0) { if (isConstantNode(_arg2)) { @@ -82059,7 +82164,7 @@ var createDerivative = /* @__PURE__ */ factory(name285, dependencies284, (_ref) } return new OperatorNode2("*", "multiply", [new OperatorNode2("^", "pow", [_arg.clone(), _arg2.clone()]), new OperatorNode2("+", "add", [new OperatorNode2("*", "multiply", [_derivative(_arg, constNodes), new OperatorNode2("/", "divide", [_arg2.clone(), _arg.clone()])]), new OperatorNode2("*", "multiply", [_derivative(_arg2, constNodes), new FunctionNode3("log", [_arg.clone()])])])]); } - throw new Error('Cannot process operator "' + node.op + '" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported'); + throw new Error('Cannot process operator "' + node2.op + '" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported'); } }); function createConstantNode2(value, valueType) { @@ -82082,7 +82187,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) multiply: multiply2, divide: divide3, pow: pow3, - parse: parse7, + parse: parse8, simplifyConstant: simplifyConstant2, simplifyCore: simplifyCore2, simplify: simplify2, @@ -82172,43 +82277,43 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) }); function polynomial(expr, scope, extended, rules) { var variables = []; - var node = simplify2(expr, rules, scope, { + var node2 = simplify2(expr, rules, scope, { exactFractions: false }); extended = !!extended; var oper = "+-*" + (extended ? "/" : ""); - recPoly(node); + recPoly(node2); var retFunc = {}; - retFunc.expression = node; + retFunc.expression = node2; retFunc.variables = variables; return retFunc; - function recPoly(node2) { - var tp = node2.type; + function recPoly(node3) { + var tp = node3.type; if (tp === "FunctionNode") { throw new Error("There is an unsolved function call"); } else if (tp === "OperatorNode") { - if (node2.op === "^") { - if (node2.args[1].type !== "ConstantNode" || !isInteger(parseFloat(node2.args[1].value))) { + if (node3.op === "^") { + if (node3.args[1].type !== "ConstantNode" || !isInteger(parseFloat(node3.args[1].value))) { throw new Error("There is a non-integer exponent"); } else { - recPoly(node2.args[0]); + recPoly(node3.args[0]); } } else { - if (oper.indexOf(node2.op) === -1) { - throw new Error("Operator " + node2.op + " invalid in polynomial expression"); + if (oper.indexOf(node3.op) === -1) { + throw new Error("Operator " + node3.op + " invalid in polynomial expression"); } - for (var i4 = 0; i4 < node2.args.length; i4++) { - recPoly(node2.args[i4]); + for (var i4 = 0; i4 < node3.args.length; i4++) { + recPoly(node3.args[i4]); } } } else if (tp === "SymbolNode") { - var _name = node2.name; + var _name = node3.name; var pos = variables.indexOf(_name); if (pos === -1) { variables.push(_name); } } else if (tp === "ParenthesisNode") { - recPoly(node2.content); + recPoly(node3.content); } else if (tp !== "ConstantNode") { throw new Error("type " + tp + " is not allowed in polynomial expression"); } @@ -82452,47 +82557,47 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) ]; return setRules; } - function expandPower(node, parent, indParent) { - var tp = node.type; + function expandPower(node2, parent, indParent) { + var tp = node2.type; var internal = arguments.length > 1; - if (tp === "OperatorNode" && node.isBinary()) { + if (tp === "OperatorNode" && node2.isBinary()) { var does = false; var val; - if (node.op === "^") { - if ((node.args[0].type === "ParenthesisNode" || node.args[0].type === "OperatorNode") && node.args[1].type === "ConstantNode") { - val = parseFloat(node.args[1].value); + if (node2.op === "^") { + if ((node2.args[0].type === "ParenthesisNode" || node2.args[0].type === "OperatorNode") && node2.args[1].type === "ConstantNode") { + val = parseFloat(node2.args[1].value); does = val >= 2 && isInteger(val); } } if (does) { if (val > 2) { - var nEsqTopo = node.args[0]; - var nDirTopo = new OperatorNode2("^", "pow", [node.args[0].cloneDeep(), new ConstantNode3(val - 1)]); - node = new OperatorNode2("*", "multiply", [nEsqTopo, nDirTopo]); + var nEsqTopo = node2.args[0]; + var nDirTopo = new OperatorNode2("^", "pow", [node2.args[0].cloneDeep(), new ConstantNode3(val - 1)]); + node2 = new OperatorNode2("*", "multiply", [nEsqTopo, nDirTopo]); } else { - node = new OperatorNode2("*", "multiply", [node.args[0], node.args[0].cloneDeep()]); + node2 = new OperatorNode2("*", "multiply", [node2.args[0], node2.args[0].cloneDeep()]); } if (internal) { if (indParent === "content") { - parent.content = node; + parent.content = node2; } else { - parent.args[indParent] = node; + parent.args[indParent] = node2; } } } } if (tp === "ParenthesisNode") { - expandPower(node.content, node, "content"); + expandPower(node2.content, node2, "content"); } else if (tp !== "ConstantNode" && tp !== "SymbolNode") { - for (var i4 = 0; i4 < node.args.length; i4++) { - expandPower(node.args[i4], node, i4); + for (var i4 = 0; i4 < node2.args.length; i4++) { + expandPower(node2.args[i4], node2, i4); } } if (!internal) { - return node; + return node2; } } - function polyToCanonical(node, coefficients) { + function polyToCanonical(node2, coefficients) { if (coefficients === void 0) { coefficients = []; } @@ -82503,7 +82608,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) o2.fire = ""; var maxExpo = 0; var varname = ""; - recurPol(node, null, o2); + recurPol(node2, null, o2); maxExpo = coefficients.length - 1; var first = true; var no; @@ -82540,43 +82645,43 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) } else { return no; } - function recurPol(node2, noPai, o3) { - var tp = node2.type; + function recurPol(node3, noPai, o3) { + var tp = node3.type; if (tp === "FunctionNode") { throw new Error("There is an unsolved function call"); } else if (tp === "OperatorNode") { - if ("+-*^".indexOf(node2.op) === -1) - throw new Error("Operator " + node2.op + " invalid"); + if ("+-*^".indexOf(node3.op) === -1) + throw new Error("Operator " + node3.op + " invalid"); if (noPai !== null) { - if ((node2.fn === "unaryMinus" || node2.fn === "pow") && noPai.fn !== "add" && noPai.fn !== "subtract" && noPai.fn !== "multiply") { - throw new Error("Invalid " + node2.op + " placing"); + if ((node3.fn === "unaryMinus" || node3.fn === "pow") && noPai.fn !== "add" && noPai.fn !== "subtract" && noPai.fn !== "multiply") { + throw new Error("Invalid " + node3.op + " placing"); } - if ((node2.fn === "subtract" || node2.fn === "add" || node2.fn === "multiply") && noPai.fn !== "add" && noPai.fn !== "subtract") { - throw new Error("Invalid " + node2.op + " placing"); + if ((node3.fn === "subtract" || node3.fn === "add" || node3.fn === "multiply") && noPai.fn !== "add" && noPai.fn !== "subtract") { + throw new Error("Invalid " + node3.op + " placing"); } - if ((node2.fn === "subtract" || node2.fn === "add" || node2.fn === "unaryMinus") && o3.noFil !== 0) { - throw new Error("Invalid " + node2.op + " placing"); + if ((node3.fn === "subtract" || node3.fn === "add" || node3.fn === "unaryMinus") && o3.noFil !== 0) { + throw new Error("Invalid " + node3.op + " placing"); } } - if (node2.op === "^" || node2.op === "*") { - o3.fire = node2.op; + if (node3.op === "^" || node3.op === "*") { + o3.fire = node3.op; } - for (var _i = 0; _i < node2.args.length; _i++) { - if (node2.fn === "unaryMinus") + for (var _i = 0; _i < node3.args.length; _i++) { + if (node3.fn === "unaryMinus") o3.oper = "-"; - if (node2.op === "+" || node2.fn === "subtract") { + if (node3.op === "+" || node3.fn === "subtract") { o3.fire = ""; o3.cte = 1; - o3.oper = _i === 0 ? "+" : node2.op; + o3.oper = _i === 0 ? "+" : node3.op; } o3.noFil = _i; - recurPol(node2.args[_i], node2, o3); + recurPol(node3.args[_i], node3, o3); } } else if (tp === "SymbolNode") { - if (node2.name !== varname && varname !== "") { + if (node3.name !== varname && varname !== "") { throw new Error("There is more than one variable"); } - varname = node2.name; + varname = node3.name; if (noPai === null) { coefficients[1] = 1; return; @@ -82594,7 +82699,7 @@ var createRationalize = /* @__PURE__ */ factory(name286, dependencies285, (_ref) maxExpo = Math.max(1, maxExpo); } } else if (tp === "ConstantNode") { - var valor = parseFloat(node2.value); + var valor = parseFloat(node3.value); if (noPai === null) { coefficients[0] = valor; return; @@ -82633,28 +82738,28 @@ var createZpk2tf = /* @__PURE__ */ factory(name287, dependencies286, (_ref) => { add: add4, multiply: multiply2, Complex: Complex3, - number: number4 + number: number5 } = _ref; return typed3(name287, { - "Array,Array,number": function ArrayArrayNumber(z2, p, k2) { - return _zpk2tf(z2, p, k2); + "Array,Array,number": function ArrayArrayNumber(z2, p2, k2) { + return _zpk2tf(z2, p2, k2); }, - "Array,Array": function ArrayArray(z2, p) { - return _zpk2tf(z2, p, 1); + "Array,Array": function ArrayArray(z2, p2) { + return _zpk2tf(z2, p2, 1); }, - "Matrix,Matrix,number": function MatrixMatrixNumber(z2, p, k2) { - return _zpk2tf(z2.valueOf(), p.valueOf(), k2); + "Matrix,Matrix,number": function MatrixMatrixNumber(z2, p2, k2) { + return _zpk2tf(z2.valueOf(), p2.valueOf(), k2); }, - "Matrix,Matrix": function MatrixMatrix(z2, p) { - return _zpk2tf(z2.valueOf(), p.valueOf(), 1); + "Matrix,Matrix": function MatrixMatrix(z2, p2) { + return _zpk2tf(z2.valueOf(), p2.valueOf(), 1); } }); - function _zpk2tf(z2, p, k2) { + function _zpk2tf(z2, p2, k2) { if (z2.some((el) => el.type === "BigNumber")) { - z2 = z2.map((el) => number4(el)); + z2 = z2.map((el) => number5(el)); } - if (p.some((el) => el.type === "BigNumber")) { - p = p.map((el) => number4(el)); + if (p2.some((el) => el.type === "BigNumber")) { + p2 = p2.map((el) => number5(el)); } var num = [Complex3(1, 0)]; var den = [Complex3(1, 0)]; @@ -82664,8 +82769,8 @@ var createZpk2tf = /* @__PURE__ */ factory(name287, dependencies286, (_ref) => { zero = Complex3(zero, 0); num = _multiply(num, [Complex3(1, 0), Complex3(-zero.re, -zero.im)]); } - for (var _i = 0; _i < p.length; _i++) { - var pole = p[_i]; + for (var _i = 0; _i < p2.length; _i++) { + var pole = p2[_i]; if (typeof pole === "number") pole = Complex3(pole, 0); den = _multiply(den, [Complex3(1, 0), Complex3(-pole.re, -pole.im)]); @@ -82790,7 +82895,7 @@ var createReviver = /* @__PURE__ */ factory(name289, dependencies288, (_ref) => var { classes: classes2 } = _ref; - return function reviver2(key2, value) { + return function reviver2(key3, value) { var constructor = classes2[value && value.mathjs]; if (constructor && typeof constructor.fromJSON === "function") { return constructor.fromJSON(value); @@ -82803,7 +82908,7 @@ var createReviver = /* @__PURE__ */ factory(name289, dependencies288, (_ref) => var name290 = "replacer"; var dependencies289 = []; var createReplacer = /* @__PURE__ */ factory(name290, dependencies289, () => { - return function replacer2(key2, value) { + return function replacer2(key3, value) { if (typeof value === "number" && (!isFinite(value) || isNaN(value))) { return { mathjs: "number", @@ -82928,8 +83033,8 @@ var createUppercaseE = /* @__PURE__ */ factory("E", ["e"], (_ref15) => { return e5; }); var createVersion = /* @__PURE__ */ factory("version", [], () => version2); -function recreateFactory(name317, dependencies314, create2) { - return factory(name317, dependencies314, create2, { +function recreateFactory(name317, dependencies314, create3) { + return factory(name317, dependencies314, create3, { recreateOnConfigChange: true }); } @@ -83077,8 +83182,8 @@ var createColumnTransform = /* @__PURE__ */ factory(name292, dependencies291, (_ // node_modules/mathjs/lib/esm/expression/transform/utils/compileInlineExpression.js function compileInlineExpression(expression, math2, scope) { - var symbol = expression.filter(function(node) { - return isSymbolNode(node) && !(node.name in math2) && !scope.has(node.name); + var symbol = expression.filter(function(node2) { + return isSymbolNode(node2) && !(node2.name in math2) && !scope.has(node2.name); })[0]; if (!symbol) { throw new Error('No undefined variable found in inline expression "' + expression + '"'); @@ -83130,8 +83235,8 @@ var createFilterTransform = /* @__PURE__ */ factory(name293, dependencies292, (_ isTransformFunction: true }); function _filter(x2, callback) { - return filter(x2, function(value, index2, array) { - return applyCallback(callback, value, [index2 + 1], array, "filter"); + return filter(x2, function(value, index3, array) { + return applyCallback(callback, value, [index3 + 1], array, "filter"); }); } @@ -83159,13 +83264,13 @@ var createForEachTransform = /* @__PURE__ */ factory(name294, dependencies293, ( forEachTransform.rawArgs = true; var _forEach2 = typed3("forEach", { "Array | Matrix, function": function ArrayMatrixFunction(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { forEach(value, function(child, i4) { - recurse2(child, index2.concat(i4 + 1)); + recurse2(child, index3.concat(i4 + 1)); }); } else { - return applyCallback(callback, value, index2, array, "forEach"); + return applyCallback(callback, value, index3, array, "forEach"); } }; recurse(array.valueOf(), []); @@ -83238,10 +83343,10 @@ var createMapTransform = /* @__PURE__ */ factory(name296, dependencies295, (_ref callback = compileInlineExpression(args[1], math2, scope); } } - return map4(x2, callback); + return map6(x2, callback); } mapTransform.rawArgs = true; - var map4 = typed3("map", { + var map6 = typed3("map", { "Array, function": function ArrayFunction(x2, callback) { return _map2(x2, callback, x2); }, @@ -83254,13 +83359,13 @@ var createMapTransform = /* @__PURE__ */ factory(name296, dependencies295, (_ref isTransformFunction: true }); function _map2(array, callback, orig) { - function recurse(value, index2) { + function recurse(value, index3) { if (Array.isArray(value)) { return map(value, function(child, i4) { - return recurse(child, index2.concat(i4 + 1)); + return recurse(child, index3.concat(i4 + 1)); }); } else { - return applyCallback(callback, value, index2, orig, "map"); + return applyCallback(callback, value, index3, orig, "map"); } } return recurse(array, []); @@ -83515,14 +83620,14 @@ var createDiffTransform = /* @__PURE__ */ factory(name304, dependencies303, (_re typed: typed3, matrix: matrix2, subtract: subtract3, - number: number4, + number: number5, bignumber: bignumber2 } = _ref; var diff2 = createDiff({ typed: typed3, matrix: matrix2, subtract: subtract3, - number: number4, + number: number5, bignumber: bignumber2 }); return typed3(name304, { @@ -83545,13 +83650,13 @@ var dependencies304 = ["typed", "map", "sqrt", "variance"]; var createStdTransform = /* @__PURE__ */ factory(name305, dependencies304, (_ref) => { var { typed: typed3, - map: map4, + map: map6, sqrt: sqrt3, variance: variance2 } = _ref; var std2 = createStd({ typed: typed3, - map: map4, + map: map6, sqrt: sqrt3, variance: variance2 }); @@ -83637,9 +83742,9 @@ var createQuantileSeqTransform = /* @__PURE__ */ factory(name307, dependencies30 "Array | Matrix, number | BigNumber, boolean": quantileSeq2, "Array | Matrix, number | BigNumber, boolean, number": (arr, prob, sorted, dim) => quantileSeq2(arr, prob, sorted, dimToZeroBase(dim)), "Array | Matrix, Array | Matrix": quantileSeq2, - "Array | Matrix, Array | Matrix, number": (data2, prob, dim) => quantileSeq2(data2, prob, dimToZeroBase(dim)), + "Array | Matrix, Array | Matrix, number": (data3, prob, dim) => quantileSeq2(data3, prob, dimToZeroBase(dim)), "Array | Matrix, Array | Matrix, boolean": quantileSeq2, - "Array | Matrix, Array | Matrix, boolean, number": (data2, prob, sorted, dim) => quantileSeq2(data2, prob, sorted, dimToZeroBase(dim)) + "Array | Matrix, Array | Matrix, boolean, number": (data3, prob, sorted, dim) => quantileSeq2(data3, prob, sorted, dimToZeroBase(dim)) }); function dimToZeroBase(dim) { return lastDimToZeroBase([[], dim])[1]; @@ -86511,7 +86616,7 @@ function importFactory(typed3, load, math2, importedFactories) { math2[name317] = value; delete importedFactories[name317]; _importTransform(name317, value); - math2.emit("import", name317, function resolver() { + math2.emit("import", name317, function resolver2() { return value; }); return; @@ -86520,7 +86625,7 @@ function importFactory(typed3, load, math2, importedFactories) { math2[name317] = value; delete importedFactories[name317]; _importTransform(name317, value); - math2.emit("import", name317, function resolver() { + math2.emit("import", name317, function resolver2() { return value; }); return; @@ -86572,7 +86677,7 @@ function importFactory(typed3, load, math2, importedFactories) { var namespace = isTransformFunctionFactory(factory2) ? math2.expression.transform : math2; var existingTransform = name317 in math2.expression.transform; var existing = hasOwnProperty2(namespace, name317) ? namespace[name317] : void 0; - var resolver = function resolver2() { + var resolver2 = function resolver3() { var dependencies314 = {}; factory2.dependencies.map(stripOptionalNotation).forEach((dependency) => { if (contains2(dependency, ".")) { @@ -86605,7 +86710,7 @@ function importFactory(typed3, load, math2, importedFactories) { } }; if (!factory2.meta || factory2.meta.lazy !== false) { - lazy(namespace, name317, resolver); + lazy(namespace, name317, resolver2); if (existing && existingTransform) { _deleteTransform(name317); } else { @@ -86614,7 +86719,7 @@ function importFactory(typed3, load, math2, importedFactories) { } } } else { - namespace[name317] = resolver(); + namespace[name317] = resolver2(); if (existing && existingTransform) { _deleteTransform(name317); } else { @@ -86624,7 +86729,7 @@ function importFactory(typed3, load, math2, importedFactories) { } } importedFactories[name317] = factory2; - math2.emit("import", name317, resolver); + math2.emit("import", name317, resolver2); } function isSupportedType(object) { return typeof object === "function" || typeof object === "number" || typeof object === "string" || typeof object === "boolean" || object === null || isUnit(object) || isComplex(object) || isBigNumber(object) || isFraction(object) || isMatrix(object) || Array.isArray(object); @@ -86633,15 +86738,15 @@ function importFactory(typed3, load, math2, importedFactories) { return typeof fn === "function" && typeof fn.signature === "string"; } function allowedInExpressions(name317) { - return !hasOwnProperty2(unsafe, name317); + return !hasOwnProperty2(unsafe2, name317); } function factoryAllowedInExpressions(factory2) { - return factory2.fn.indexOf(".") === -1 && !hasOwnProperty2(unsafe, factory2.fn) && (!factory2.meta || !factory2.meta.isClass); + return factory2.fn.indexOf(".") === -1 && !hasOwnProperty2(unsafe2, factory2.fn) && (!factory2.meta || !factory2.meta.isClass); } function isTransformFunctionFactory(factory2) { return factory2 !== void 0 && factory2.meta !== void 0 && factory2.meta.isTransformFunction === true || false; } - var unsafe = { + var unsafe2 = { expression: true, type: true, docs: true, @@ -86720,9 +86825,9 @@ function create(factories, config4) { console.warn("Factory object with properties `type`, `name`, and `factory` expected", factory2); throw new Error("Factory object with properties `type`, `name`, and `factory` expected"); } - var index2 = legacyFactories.indexOf(factory2); + var index3 = legacyFactories.indexOf(factory2); var instance; - if (index2 === -1) { + if (index3 === -1) { if (factory2.math === true) { instance = factory2.factory(math2.type, configInternal, load, math2.typed, math2); } else { @@ -86731,7 +86836,7 @@ function create(factories, config4) { legacyFactories.push(factory2); legacyInstances.push(instance); } else { - instance = legacyInstances[index2]; + instance = legacyInstances[index3]; } return instance; } @@ -87010,15 +87115,15 @@ var formulas = { str = format6(str); return str.match(new RegExp(regex)); }, - "replace": (str, search2, replace) => { + "replace": (str, search3, replace) => { str = format6(str); - return str.replace(new RegExp(search2), replace); + return str.replace(new RegExp(search3), replace); }, - "replaceAll": (str, search2, replace) => { + "replaceAll": (str, search3, replace) => { str = format6(str); - search2 = format6(search2); + search3 = format6(search3); replace = format6(replace); - return str.replace(new RegExp(search2, "g"), replace); + return str.replace(new RegExp(search3, "g"), replace); }, "lower": (str) => { str = format6(str); @@ -87137,8 +87242,8 @@ var formulas = { "timeStamp": (date) => { return date.getTime(); }, - "at": (arr, index2) => { - return arr[index2]; + "at": (arr, index3) => { + return arr[index3]; }, "first": (arr) => { return arr[0]; @@ -87181,15 +87286,15 @@ var formulas = { }; // src/core/utils/formula/parser.ts -var runFormulaWithContext = (runContext, paths, formula, properties3, values2, path2, emitError) => { +var runFormulaWithContext = (runContext, paths, formula, properties3, values2, path3, emitError) => { if (!formula) return ""; const scope = /* @__PURE__ */ new Map(); Object.keys(values2).forEach((f2) => scope.set(f2, values2[f2])); scope.set("$properties", properties3); scope.set("$paths", paths); - if (path2) - scope.set("$current", path2); + if (path3) + scope.set("$current", path3); let value; try { runContext.evaluate("current = current()", scope); @@ -87203,8 +87308,8 @@ var runFormulaWithContext = (runContext, paths, formula, properties3, values2, p }; // src/core/utils/tree.ts -var nodeIsAncestorOfTarget = (path2, target) => { - return target.startsWith(path2); +var nodeIsAncestorOfTarget = (path3, target) => { + return target.startsWith(path3); return false; }; var compareByFieldDeep = (field, dir) => (_a, _b) => { @@ -87241,17 +87346,17 @@ var compareByFieldNumerical = (field, dir) => (_a, _b) => { }; // src/core/superstate/utils/tags.ts -var deleteTagFromPath = (superstate, path2, tag2) => { - if (superstate.spacesIndex.has(path2)) { - return superstate.spaceManager.deleteTag(superstate.spacesIndex.get(path2).defPath, tag2); +var deleteTagFromPath = (superstate, path3, tag2) => { + if (superstate.spacesIndex.has(path3)) { + return superstate.spaceManager.deleteTag(superstate.spacesIndex.get(path3).defPath, tag2); } - return superstate.spaceManager.deleteTag(path2, tag2); + return superstate.spaceManager.deleteTag(path3, tag2); }; -var addTagToPath = (superstate, path2, tag2) => { - if (superstate.spacesIndex.has(path2)) { - return superstate.spaceManager.addTag(superstate.spacesIndex.get(path2).defPath, tag2); +var addTagToPath = (superstate, path3, tag2) => { + if (superstate.spacesIndex.has(path3)) { + return superstate.spaceManager.addTag(superstate.spacesIndex.get(path3).defPath, tag2); } - return superstate.spaceManager.addTag(path2, tag2); + return superstate.spaceManager.addTag(path3, tag2); }; var addTag = (superstate, tag2) => { return superstate.spaceManager.createSpace(ensureTag(tag2), superstate.settings.spacesFolder, null); @@ -87305,29 +87410,29 @@ var parseSpaceMetadata = (metadata, settings) => { templateName: ensureString(metadata[spaceTemplateNameKey(settings)]) }; }; -var spaceToTreeNode = (path2, collapsed, sortable, depth, parentId, parentPath, childrenCount) => { +var spaceToTreeNode = (path3, collapsed, sortable, depth, parentId, parentPath, childrenCount) => { return { - id: parentId ? parentId + "/" + path2.path : path2.path, + id: parentId ? parentId + "/" + path3.path : path3.path, parentId, depth, index: 0, space: parentPath, - path: path2.path, - item: path2, - rank: path2?.rank, + path: path3.path, + item: path3, + rank: path3?.rank, collapsed, sortable, childrenCount, type: "space" }; }; -var pathStateToTreeNode = (superstate, item, space2, path2, depth, i4, collapsed, sortable, childrenCount, parentId) => ({ +var pathStateToTreeNode = (superstate, item, space3, path3, depth, i4, collapsed, sortable, childrenCount, parentId) => ({ item, - space: space2, + space: space3, id: parentId + "/" + item.path, parentId, depth, - path: path2, + path: path3, index: i4, collapsed, sortable, @@ -87358,21 +87463,21 @@ var spaceSortFn = (sortStrategy) => (a4, b2) => { const fieldFunc = (obj) => obj?.metadata?.file?.[sortStrategy.field]; sortFns.push(compareByFieldDeep(fieldFunc, sortStrategy.asc)); } - return sortFns.reduce((p, c3) => { - return p == 0 ? c3(a4, b2) : p; + return sortFns.reduce((p2, c3) => { + return p2 == 0 ? c3(a4, b2) : p2; }, 0); }; -var updatePathRankInSpace = async (superstate, path2, rank, space2) => { - const spaceState = superstate.spacesIndex.get(space2); +var updatePathRankInSpace = async (superstate, path3, rank, space3) => { + const spaceState = superstate.spacesIndex.get(space3); if (!spaceState) return; const fixedRank = rank; - superstate.addToContextStateQueue(() => reorderPathsInContext(superstate.spaceManager, [path2], fixedRank, spaceState.space).then((f2) => { + superstate.addToContextStateQueue(() => reorderPathsInContext(superstate.spaceManager, [path3], fixedRank, spaceState.space).then((f2) => { const promises = [...superstate.spacesMap.getInverse(spaceState.path)].map((f3) => superstate.reloadPath(f3)); return Promise.all(promises); }).then((f2) => superstate.dispatchEvent("spaceStateUpdated", { path: spaceState.path }))); }; -var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index2, copy) => { +var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index3, copy) => { if (!item) return; const currentPathState = superstate.pathsIndex.get(item.path); @@ -87388,25 +87493,32 @@ var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index2, copy } else { await superstate.spaceManager.renamePath(item.path, movePath(item.path, newParent)); } - updatePathRankInSpace(superstate, newPath, index2, newParent); + updatePathRankInSpace(superstate, newPath, index3, newParent); }; -var setTemplateInSpace = (superstate, path2, template2) => { - saveSpaceMetadataValue(superstate, path2, "template", template2); +var setTemplateInSpace = (superstate, path3, template2) => { + saveSpaceMetadataValue(superstate, path3, "template", template2); }; -var setTemplateNameInSpace = (superstate, path2, templateName) => { - saveSpaceMetadataValue(superstate, path2, "templateName", templateName); +var setTemplateNameInSpace = (superstate, path3, templateName) => { + saveSpaceMetadataValue(superstate, path3, "templateName", templateName); }; -var createSpace = async (superstate, path2, newSpace) => { - const spaces2 = superstate.allSpaces(); - const spaceInfo = fileSystemSpaceInfoFromFolder(superstate.spaceManager, path2); +var createSpace = async (superstate, path3, newSpace) => { + const space3 = superstate.spacesIndex.get(path3); let newSpaceCache; - if (spaces2.find((f2) => f2.path == spaceInfo.path)) { + if (space3) { + if (!superstate.pathsIndex.has(path3)) { + return await superstate.reloadSpace(space3.space); + return; + } if (newSpace) { - newSpaceCache = await saveSpaceCache(superstate, spaceInfo, newSpace); + newSpaceCache = await saveSpaceCache(superstate, space3.space, newSpace); } else { return; } } else { + const spaceInfo = superstate.spaceManager.spaceInfoForPath(path3); + if (spaceInfo.readOnly) { + return await superstate.reloadSpace(spaceInfo); + } await superstate.spaceManager.createSpace(spaceInfo.name, superstate.spaceManager.parentPathForPath(spaceInfo.path), newSpace); if (newSpace) { await saveSpaceCache(superstate, spaceInfo, newSpace); @@ -87418,23 +87530,23 @@ var createSpace = async (superstate, path2, newSpace) => { superstate.onSpaceDefinitionChanged(newSpaceCache, null); return newSpaceCache; }; -var saveSpaceMetadataValue = async (superstate, space2, key2, value) => { - superstate.spaceManager.saveSpace(space2, (metadata) => ({ ...metadata, [key2]: value })); - const spaceCache = superstate.spacesIndex.get(space2); - await superstate.updateSpaceMetadata(space2, { ...spaceCache.metadata, [key2]: value }); +var saveSpaceMetadataValue = async (superstate, space3, key3, value) => { + superstate.spaceManager.saveSpace(space3, (metadata) => ({ ...metadata, [key3]: value })); + const spaceCache = superstate.spacesIndex.get(space3); + await superstate.updateSpaceMetadata(space3, { ...spaceCache.metadata, [key3]: value }); }; -var saveSpaceProperties = async (superstate, space2, properties3) => { - superstate.spaceManager.saveSpace(space2, (metadata) => metadata, properties3); +var saveSpaceProperties = async (superstate, space3, properties3) => { + superstate.spaceManager.saveSpace(space3, (metadata) => metadata, properties3); }; var saveSpaceCache = async (superstate, spaceInfo, metadata) => { await superstate.spaceManager.saveSpace(spaceInfo.path, (oldMetadata) => ({ ...oldMetadata, ...metadata })); return superstate.updateSpaceMetadata(spaceInfo.path, metadata); }; -var addPathToSpaceAtIndex = async (superstate, space2, path2, rank) => { - if (space2.type == "tag") { - return addTagToPath(superstate, path2, space2.name); +var addPathToSpaceAtIndex = async (superstate, space3, path3, rank) => { + if (space3.type == "tag") { + return addTagToPath(superstate, path3, space3.name); } else { - return pinPathToSpaceAtIndex(superstate, space2, path2, rank); + return pinPathToSpaceAtIndex(superstate, space3, path3, rank); } }; var defaultSpace = async (superstate, activeFile) => { @@ -87451,21 +87563,21 @@ var defaultSpace = async (superstate, activeFile) => { } return spaceState; }; -var pinPathToSpaceAtIndex = async (superstate, space2, path2, rank) => { - if (path2 == space2.path) { +var pinPathToSpaceAtIndex = async (superstate, space3, path3, rank) => { + if (path3 == space3.path) { return; } - const spaceExists = ensureArray(space2.metadata.links) ?? []; - const pathExists = spaceExists.find((f2) => f2 == path2); + const spaceExists = ensureArray(space3.metadata.links) ?? []; + const pathExists = spaceExists.find((f2) => f2 == path3); if (!pathExists) { - spaceExists.push(path2); + spaceExists.push(path3); } - await saveSpaceCache(superstate, space2.space, { ...space2.metadata, links: spaceExists }); - await superstate.reloadPath(path2, true).then((f2) => superstate.dispatchEvent("pathStateUpdated", { path: path2 })); - updatePathRankInSpace(superstate, path2, rank, space2.path); + await saveSpaceCache(superstate, space3.space, { ...space3.metadata, links: spaceExists }); + await superstate.reloadPath(path3, true).then((f2) => superstate.dispatchEvent("pathStateUpdated", { path: path3 })); + updatePathRankInSpace(superstate, path3, rank, space3.path); }; -var removeSpace = async (superstate, space2) => { - const spaceCache = superstate.spacesIndex.get(space2); +var removeSpace = async (superstate, space3) => { + const spaceCache = superstate.spacesIndex.get(space3); if (!spaceCache) return; if (spaceCache.type == "tag") { @@ -87474,11 +87586,11 @@ var removeSpace = async (superstate, space2) => { await deletePath(superstate, spaceCache.path); } }; -var updateSpaceSort = (superstate, path2, sort2) => { - const space2 = superstate.spacesIndex.get(path2); - if (space2) - saveSpaceCache(superstate, space2.space, { - ...space2.metadata, +var updateSpaceSort = (superstate, path3, sort2) => { + const space3 = superstate.spacesIndex.get(path3); + if (space3) + saveSpaceCache(superstate, space3.space, { + ...space3.metadata, sort: sort2 }); }; @@ -87494,63 +87606,63 @@ var toggleWaypoint = (superstate, spacePath, remove, rank) => { } superstate.saveSettings(); }; -var saveSpaceTemplate = async (superstate, path2, space2) => { - const spaceCache = superstate.spacesIndex.get(space2); +var saveSpaceTemplate = async (superstate, path3, space3) => { + const spaceCache = superstate.spacesIndex.get(space3); if (!spaceCache) return; - await superstate.spaceManager.saveTemplate(path2, spaceCache.path); + await superstate.spaceManager.saveTemplate(path3, spaceCache.path); superstate.ui.notify(i18n_default.notice.templateSaved + spaceCache.name); }; var removePathsFromSpace = async (superstate, spacePath, paths) => { - const space2 = superstate.spacesIndex.get(spacePath); - if (!space2) + const space3 = superstate.spacesIndex.get(spacePath); + if (!space3) return; - if (space2.type == "default") { - if (space2.path == "spaces://$waypoints") { + if (space3.type == "default") { + if (space3.path == "spaces://$waypoints") { toggleWaypoint(superstate, paths[0], true); return; } } - if (space2.type == "tag") { - paths.forEach((path2) => deleteTagFromPath(superstate, path2, space2.name)); - } else if (space2.type == "folder" || space2.type == "vault") { - await saveSpaceMetadataValue(superstate, space2.path, "links", space2.metadata.links.filter((f2) => !paths.some((g) => g == f2))); + if (space3.type == "tag") { + paths.forEach((path3) => deleteTagFromPath(superstate, path3, space3.name)); + } else if (space3.type == "folder" || space3.type == "vault") { + await saveSpaceMetadataValue(superstate, space3.path, "links", space3.metadata.links.filter((f2) => !paths.some((g) => g == f2))); } }; -var newTemplateInSpace = async (superstate, space2, name317, location) => { +var newTemplateInSpace = async (superstate, space3, name317, location) => { let newName; try { - if (space2.metadata.templateName?.length > 0) { - const result = runFormulaWithContext(superstate.formulaContext, superstate.pathsIndex, space2.metadata.templateName, {}, {}, superstate.pathsIndex.get(space2.path)); + if (space3.metadata.templateName?.length > 0) { + const result = runFormulaWithContext(superstate.formulaContext, superstate.pathsIndex, space3.metadata.templateName, {}, {}, superstate.pathsIndex.get(space3.path)); if (result?.length > 0) newName = result; } } catch (e5) { } - if (!await superstate.spaceManager.pathExists(`${space2.path}/.space/templates/${name317}`)) { - newPathInSpace(superstate, space2, "md", null, false, null, location); + if (!await superstate.spaceManager.pathExists(`${space3.path}/.space/templates/${name317}`)) { + newPathInSpace(superstate, space3, "md", null, false, null, location); return; } - const newPath = await superstate.spaceManager.copyPath(`${space2.path}/.space/templates/${name317}`, space2.path, newName); + const newPath = await superstate.spaceManager.copyPath(`${space3.path}/.space/templates/${name317}`, space3.path, newName); if (newPath) superstate.ui.openPath(newPath, location); }; -var newPathInSpace = async (superstate, space2, type, name317, dontOpen, content3, location) => { +var newPathInSpace = async (superstate, space3, type, name317, dontOpen, content5, location) => { let newPath; - if (space2.type == "tag") { + if (space3.type == "tag") { newPath = await superstate.spaceManager.createItemAtPath( "/", type, name317, - content3 + content5 ); - await superstate.spaceManager.addTag(newPath, space2.name); + await superstate.spaceManager.addTag(newPath, space3.name); } else { newPath = await superstate.spaceManager.createItemAtPath( - space2.path, + space3.path, type, name317, - content3 + content5 ); } if (!dontOpen) { @@ -87558,60 +87670,60 @@ var newPathInSpace = async (superstate, space2, type, name317, dontOpen, content } return newPath; }; -var saveLabel = (superstate, path2, label, value) => { - superstate.spaceManager.saveLabel(path2, label, value); +var saveLabel = (superstate, path3, label, value) => { + superstate.spaceManager.saveLabel(path3, label, value); }; -var saveProperties = (superstate, path2, properties3) => { - if (superstate.spacesIndex.has(path2)) { - saveSpaceProperties(superstate, path2, properties3); +var saveProperties = (superstate, path3, properties3) => { + if (superstate.spacesIndex.has(path3)) { + saveSpaceProperties(superstate, path3, properties3); } else { - superstate.spaceManager.saveProperties(path2, properties3); + superstate.spaceManager.saveProperties(path3, properties3); } }; -var renameProperty = (superstate, path2, oldName, newName) => { - if (superstate.spacesIndex.has(path2)) { - superstate.spaceManager.renameProperty(superstate.spacesIndex.get(path2).defPath, oldName, newName); +var renameProperty = (superstate, path3, oldName, newName) => { + if (superstate.spacesIndex.has(path3)) { + superstate.spaceManager.renameProperty(superstate.spacesIndex.get(path3).defPath, oldName, newName); return; } - superstate.spaceManager.renameProperty(path2, oldName, newName); + superstate.spaceManager.renameProperty(path3, oldName, newName); }; -var deleteProperty = (superstate, path2, name317) => { - if (superstate.spacesIndex.has(path2)) { - superstate.spaceManager.deleteProperty(superstate.spacesIndex.get(path2).defPath, name317); +var deleteProperty = (superstate, path3, name317) => { + if (superstate.spacesIndex.has(path3)) { + superstate.spaceManager.deleteProperty(superstate.spacesIndex.get(path3).defPath, name317); return; } - superstate.spaceManager.deleteProperty(path2, name317); + superstate.spaceManager.deleteProperty(path3, name317); }; // src/core/superstate/utils/label.ts -var savePathBanner = (superstate, path2, banner) => { - if (superstate.spacesIndex.has(path2)) { - saveProperties(superstate, superstate.spacesIndex.get(path2).defPath, { +var savePathBanner = (superstate, path3, banner) => { + if (superstate.spacesIndex.has(path3)) { + saveProperties(superstate, superstate.spacesIndex.get(path3).defPath, { [superstate.settings.fmKeyBanner]: banner }); return; } - saveProperties(superstate, path2, { + saveProperties(superstate, path3, { [superstate.settings.fmKeyBanner]: banner }); }; -var savePathColor = async (superstate, path2, color2) => { - if (superstate.spacesIndex.has(path2)) { - saveSpaceProperties(superstate, path2, { [superstate.settings.fmKeyColor]: color2 }); +var savePathColor = async (superstate, path3, color3) => { + if (superstate.spacesIndex.has(path3)) { + saveSpaceProperties(superstate, path3, { [superstate.settings.fmKeyColor]: color3 }); return; } - saveLabel(superstate, path2, "color", color2); + saveLabel(superstate, path3, "color", color3); }; -var savePathSticker = async (superstate, path2, sticker) => { - if (superstate.spacesIndex.has(path2)) { - saveSpaceProperties(superstate, path2, { [superstate.settings.fmKeySticker]: sticker }); +var savePathSticker = async (superstate, path3, sticker) => { + if (superstate.spacesIndex.has(path3)) { + saveSpaceProperties(superstate, path3, { [superstate.settings.fmKeySticker]: sticker }); return; } - saveLabel(superstate, path2, "sticker", sticker); + saveLabel(superstate, path3, "sticker", sticker); }; -var updatePrimaryAlias = (superstate, path2, aliases, value) => { +var updatePrimaryAlias = (superstate, path3, aliases, value) => { const newValue = serializeMultiDisplayString([value, ...ensureArray(aliases).filter((f2) => f2 == value)]); - saveProperties(superstate, path2, { [superstate.settings.fmKeyAlias]: parseMDBValue("option-multi", newValue) }); + saveProperties(superstate, path3, { [superstate.settings.fmKeyAlias]: parseMDBValue("option-multi", newValue) }); }; // src/core/utils/dnd/dropPath.ts @@ -87635,7 +87747,7 @@ var dropPathsInTree = async (superstate, paths, active, over, projected, flatten dropPathsInSpaceAtIndex(superstate, droppable, newSpace, projected.sortable && newRank, modifier); } }; -var dropPathInTree = async (superstate, path2, active, over, projected, flattenedTree, activeSpaces, modifier) => { +var dropPathInTree = async (superstate, path3, active, over, projected, flattenedTree, activeSpaces, modifier) => { if (projected) { const clonedItems = flattenedTree; const overIndex = clonedItems.findIndex(({ id: id3 }) => id3 === over); @@ -87644,7 +87756,7 @@ var dropPathInTree = async (superstate, path2, active, over, projected, flattene const newSpace = projected.depth == 0 && !projected.insert ? null : clonedItems.find(({ id: id3 }) => id3 === parentId)?.item.path; const newRank = parentId == null ? activeSpaces.findIndex((f2) => f2?.path == overItem.id) : parentId == overItem.id ? -1 : overItem.rank ?? -1; if (!active) { - dropPathInSpaceAtIndex(superstate, path2, null, newSpace, projected.sortable && newRank, modifier); + dropPathInSpaceAtIndex(superstate, path3, null, newSpace, projected.sortable && newRank, modifier); return; } const activeIndex = clonedItems.findIndex(({ id: id3 }) => id3 === active); @@ -87653,11 +87765,11 @@ var dropPathInTree = async (superstate, path2, active, over, projected, flattene dropPathInSpaceAtIndex(superstate, activeItem.item.path, oldSpace, newSpace, projected.sortable && newRank, modifier); } }; -var reorderOpenSpace = (superstate, path2, index2) => { +var reorderOpenSpace = (superstate, path3, index3) => { const newWaypoint = superstate.waypoints[superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; - const currentIndex = newWaypoint.paths.findIndex((f2) => f2 == path2); - const newIndex = currentIndex > index2 ? Math.max(0, index2 - 1) : index2; - newWaypoint.paths = arrayMove(newWaypoint.paths, newWaypoint.paths.findIndex((f2) => f2 == path2), newIndex); + const currentIndex = newWaypoint.paths.findIndex((f2) => f2 == path3); + const newIndex = currentIndex > index3 ? Math.max(0, index3 - 1) : index3; + newWaypoint.paths = arrayMove(newWaypoint.paths, newWaypoint.paths.findIndex((f2) => f2 == path3), newIndex); if (superstate.settings.currentWaypoint > superstate.waypoints.length) { superstate.spaceManager.saveWaypoints([ ...superstate.waypoints, @@ -87669,72 +87781,72 @@ var reorderOpenSpace = (superstate, path2, index2) => { ); superstate.spaceManager.saveWaypoints(newWaypoints); }; -var dropPathInSpaceAtIndex = async (superstate, path2, oldSpacePath, newSpacePath, index2, modifier) => { - const cache2 = superstate.pathsIndex.get(path2); +var dropPathInSpaceAtIndex = async (superstate, path3, oldSpacePath, newSpacePath, index3, modifier) => { + const cache2 = superstate.pathsIndex.get(path3); if (!cache2) return false; if (!newSpacePath) { - reorderOpenSpace(superstate, path2, index2); + reorderOpenSpace(superstate, path3, index3); return; } const newSpaceCache = superstate.spacesIndex.get(newSpacePath); if (oldSpacePath == newSpacePath) { - updatePathRankInSpace(superstate, path2, index2, newSpacePath); + updatePathRankInSpace(superstate, path3, index3, newSpacePath); return; } if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") { - if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) { - pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2); + if (modifier == "link" || nodeIsAncestorOfTarget(path3, newSpaceCache.path)) { + pinPathToSpaceAtIndex(superstate, newSpaceCache, path3, index3); } else { - movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy"); + movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path3), newSpaceCache.path, index3, modifier == "copy"); } } if (newSpaceCache.type == "tag") { - addTagToPath(superstate, path2, newSpaceCache.name); + addTagToPath(superstate, path3, newSpaceCache.name); } if (oldSpacePath && oldSpacePath != newSpacePath) { - removePathsFromSpace(superstate, oldSpacePath, [path2]); + removePathsFromSpace(superstate, oldSpacePath, [path3]); } }; -var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index2, modifier) => { +var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index3, modifier) => { const newSpaceCache = superstate.spacesIndex.get(newSpacePath); if (!newSpaceCache) return; if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") { - paths.forEach((path2) => { - if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) { - pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2); + paths.forEach((path3) => { + if (modifier == "link" || nodeIsAncestorOfTarget(path3, newSpaceCache.path)) { + pinPathToSpaceAtIndex(superstate, newSpaceCache, path3, index3); } else { - movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy"); + movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path3), newSpaceCache.path, index3, modifier == "copy"); } }); } if (newSpaceCache.type == "tag") { - paths.forEach((path2) => addTagToPath(superstate, path2, newSpaceCache.name)); + paths.forEach((path3) => addTagToPath(superstate, path3, newSpaceCache.name)); } }; // src/core/utils/emoji.ts var saveIconsForPaths = (superstate, paths, icon) => { - paths.forEach((path2) => { - savePathSticker(superstate, path2, icon); + paths.forEach((path3) => { + savePathSticker(superstate, path3, icon); }); }; var saveColorForPaths = (superstate, paths, icon) => { - paths.forEach((path2) => { - savePathColor(superstate, path2, icon); + paths.forEach((path3) => { + savePathColor(superstate, path3, icon); }); }; -var savePathIcon = (superstate, path2, icon) => { - savePathSticker(superstate, path2, icon); +var savePathIcon = (superstate, path3, icon) => { + savePathSticker(superstate, path3, icon); }; var removeIconsForPaths = (superstate, paths) => { - paths.forEach((path2) => { - savePathSticker(superstate, path2, ""); + paths.forEach((path3) => { + savePathSticker(superstate, path3, ""); }); }; -var removePathIcon = (superstate, path2) => { - savePathSticker(superstate, path2, ""); +var removePathIcon = (superstate, path3) => { + savePathSticker(superstate, path3, ""); }; // src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx @@ -87763,10 +87875,10 @@ var ConfirmationModal = (props) => { // src/core/utils/color/gradient.ts var typeName = (name317) => `${name317}-gradient(`; var stringifyGradient = (gradient) => { - let handlers = gradient.values; - handlers.sort((l2, r2) => l2.position - r2.position); - handlers = handlers.length == 1 ? [handlers[0], handlers[0]] : handlers; - const color2 = handlers.map((handler) => `${handler.color} ${handler.position}%`).join(", "); + let handlers2 = gradient.values; + handlers2.sort((l2, r2) => l2.position - r2.position); + handlers2 = handlers2.length == 1 ? [handlers2[0], handlers2[0]] : handlers2; + const color3 = handlers2.map((handler) => `${handler.color} ${handler.position}%`).join(", "); const tp = gradient.type; const defDir = ["top", "left", "bottom", "right", "center"]; let ang = gradient.direction; @@ -87776,7 +87888,7 @@ var stringifyGradient = (gradient) => { if (["radial", "repeating-radial"].indexOf(tp) >= 0 && defDir.indexOf(ang) >= 0) { ang = `circle at ${ang}`; } - return color2 ? `${tp}-gradient(${ang}, ${color2})` : ""; + return color3 ? `${tp}-gradient(${ang}, ${color3})` : ""; }; var parseGradient = (value) => { let type = null; @@ -87807,11 +87919,11 @@ var parseGradient = (value) => { direction, values: values2.map((value2) => { const hdlValues = value2.split(" "); - const position = parseFloat(hdlValues.pop()); - const color2 = hdlValues.join(""); + const position3 = parseFloat(hdlValues.pop()); + const color3 = hdlValues.join(""); return { - position, - color: color2 + position: position3, + color: color3 }; }) }; @@ -87896,14 +88008,14 @@ var ColorPicker = (props) => { setValue(gradientString); props.saveValue(gradientString); }; - const updateColor = (color2) => { - if (color2) { - setValue(color2); - setCurrentColor(color2); + const updateColor = (color3) => { + if (color3) { + setValue(color3); + setCurrentColor(color3); } let gradientObject; try { - gradientObject = parseGradient(color2); + gradientObject = parseGradient(color3); const values2 = gradientObject.values.map((g) => { const existingStop = gradient?.values.find( (f2) => f2.position == g.position && f2.color == g.color @@ -87921,7 +88033,7 @@ var ColorPicker = (props) => { setGradient(gradientObject); setCurrentColor(gradientObject.values[0].color); } else { - setCurrentColor(color2); + setCurrentColor(color3); } }; (0, import_react10.useEffect)(() => { @@ -88061,7 +88173,7 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => { name: i18n_default.menu.openFilePane, icon: "ui//go-to-file", onClick: (e6) => { - paths.forEach((path2) => superstate.ui.openPath(path2, true)); + paths.forEach((path3) => superstate.ui.openPath(path3, true)); } }); menuOptions.push(menuSeparator); @@ -88073,11 +88185,11 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => { showSpacesMenu( offset2, superstate, - (link) => { + (link3) => { dropPathsInSpaceAtIndex( superstate, selectedPaths.map((f2) => f2.path), - link, + link3, -1, "link" ); @@ -88126,9 +88238,9 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => { icon: "ui//paper-plane", onClick: (e6) => { const offset2 = e6.target.getBoundingClientRect(); - showSpacesMenu(offset2, superstate, (link) => { + showSpacesMenu(offset2, superstate, (link3) => { paths.forEach((f2) => { - movePathToSpace(superstate, f2, link); + movePathToSpace(superstate, f2, link3); }); }); } @@ -88169,8 +88281,8 @@ var triggerMultiPathMenu = (superstate, selectedPaths, e5) => { ); return false; }; -var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRename) => { - const cache2 = superstate.pathsIndex.get(path2); +var showPathContextMenu = (superstate, path3, space3, rect, anchor, triggerRename) => { + const cache2 = superstate.pathsIndex.get(path3); if (!cache2) return; const menuOptions = []; @@ -88178,7 +88290,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam name: i18n_default.menu.openFilePane, icon: "ui//go-to-file", onClick: (e5) => { - superstate.ui.openPath(path2, true); + superstate.ui.openPath(path3, true); } }); menuOptions.push(menuSeparator); @@ -88190,8 +88302,8 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam showSpacesMenu( offset2, superstate, - (link) => { - dropPathsInSpaceAtIndex(superstate, [path2], link, -1, "link"); + (link3) => { + dropPathsInSpaceAtIndex(superstate, [path3], link3, -1, "link"); }, true ); @@ -88202,24 +88314,24 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam name: i18n_default.menu.changeToFolderNote, icon: "ui//file-plus-2", onClick: (e5) => { - convertPathToSpace(superstate, path2, false); + convertPathToSpace(superstate, path3, false); } }); menuOptions.push({ name: "Save as Template", icon: "ui//clipboard-add", onClick: (e5) => { - saveSpaceTemplate(superstate, path2, space2); + saveSpaceTemplate(superstate, path3, space3); } }); - if (space2 && space2 != cache2.parent) { - const spaceCache = superstate.spacesIndex.get(space2); + if (space3 && space3 != cache2.parent) { + const spaceCache = superstate.spacesIndex.get(space3); if (spaceCache) { menuOptions.push({ name: i18n_default.menu.removeFromSpace, icon: "ui//pin-off", onClick: (e5) => { - removePathsFromSpace(superstate, spaceCache.path, [path2]); + removePathsFromSpace(superstate, spaceCache.path, [path3]); } }); } @@ -88235,7 +88347,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam superstate, offset2, "", - (value) => savePathColor(superstate, path2, value) + (value) => savePathColor(superstate, path3, value) ); } }); @@ -88246,7 +88358,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react11.default.createElement(StickerModal_default, { ui: superstate.ui, hide: _props.hide, - selectedSticker: (emoji) => savePathIcon(superstate, path2, emoji) + selectedSticker: (emoji) => savePathIcon(superstate, path3, emoji) })); } }); @@ -88254,7 +88366,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam name: i18n_default.buttons.removeIcon, icon: "ui//file-minus", onClick: (e5) => { - removePathIcon(superstate, path2); + removePathIcon(superstate, path3); } }); } @@ -88269,7 +88381,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam saveLabel: i18n_default.buttons.rename, value: cache2.name, hide: _props.hide, - saveValue: (v2) => renamePathByName(superstate, path2, v2) + saveValue: (v2) => renamePathByName(superstate, path3, v2) }) ); } @@ -88279,7 +88391,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam icon: "ui//documents", onClick: (e5) => { superstate.spaceManager.copyPath( - path2, + path3, `${cache2.parent}/${cache2.name} 1.${cache2.type}` ); } @@ -88289,9 +88401,9 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam icon: "ui//paper-plane", onClick: (e5) => { const offset2 = e5.target.getBoundingClientRect(); - showSpacesMenu(offset2, superstate, (link) => { - const item = superstate.pathsIndex.get(path2); - superstate.spaceManager.renamePath(path2, movePath(path2, link)); + showSpacesMenu(offset2, superstate, (link3) => { + const item = superstate.pathsIndex.get(path3); + superstate.spaceManager.renamePath(path3, movePath(path3, link3)); }); } }); @@ -88301,7 +88413,7 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam name: i18n_default.menu.revealInDefault, icon: "ui//arrow-up-right", onClick: (e5) => { - superstate.ui.openPath(path2, "system"); + superstate.ui.openPath(path3, "system"); } }); menuOptions.push(menuSeparator); @@ -88310,14 +88422,14 @@ var showPathContextMenu = (superstate, path2, space2, rect, anchor, triggerRenam name: i18n_default.menu.hide, icon: "ui//eye-off", onClick: (e5) => { - hidePath(superstate, path2); + hidePath(superstate, path3); } }); menuOptions.push({ name: i18n_default.menu.delete, icon: "ui//trash", onClick: (e5) => { - deletePath(superstate, path2); + deletePath(superstate, path3); } }); superstate.ui.openMenu(rect, defaultMenu(superstate.ui, menuOptions), anchor); @@ -88415,14 +88527,14 @@ var NodeType = class { } return this.id == name317; } - static match(map4) { + static match(map6) { let direct = /* @__PURE__ */ Object.create(null); - for (let prop2 in map4) + for (let prop2 in map6) for (let name317 of prop2.split(" ")) - direct[name317] = map4[prop2]; - return (node) => { - for (let groups = node.prop(NodeProp.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { - let found = direct[i4 < 0 ? node.name : groups[i4]]; + direct[name317] = map6[prop2]; + return (node2) => { + for (let groups = node2.prop(NodeProp.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { + let found = direct[i4 < 0 ? node2.name : groups[i4]]; if (found) return found; } @@ -88505,14 +88617,14 @@ var Tree = class { return new TreeNode2(this, 0, 0, null); } resolve(pos, side = 0) { - let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false); - CachedNode.set(this, node); - return node; + let node2 = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false); + CachedNode.set(this, node2); + return node2; } resolveInner(pos, side = 0) { - let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true); - CachedInnerNode.set(this, node); - return node; + let node2 = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true); + CachedInnerNode.set(this, node2); + return node2; } iterate(spec) { let { enter, leave, from = 0, to: to2 = this.length } = spec; @@ -88547,15 +88659,15 @@ var Tree = class { balance(config4 = {}) { return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length))); } - static build(data2) { - return buildTree(data2); + static build(data3) { + return buildTree(data3); } }; Tree.empty = new Tree(NodeType.none, [], [], 0); var FlatBufferCursor = class { - constructor(buffer, index2) { - this.buffer = buffer; - this.index = index2; + constructor(buffer2, index3) { + this.buffer = buffer2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -88580,8 +88692,8 @@ var FlatBufferCursor = class { } }; var TreeBuffer = class { - constructor(buffer, length, set) { - this.buffer = buffer; + constructor(buffer2, length, set) { + this.buffer = buffer2; this.length = length; this.set = set; } @@ -88590,31 +88702,31 @@ var TreeBuffer = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } findChild(startIndex, endIndex, dir, pos, side) { - let { buffer } = this, pick = -1; - for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) { - if (checkSide(side, pos, buffer[i4 + 1], buffer[i4 + 2])) { + let { buffer: buffer2 } = this, pick = -1; + for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) { + if (checkSide(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) { pick = i4; if (dir > 0) break; @@ -88650,47 +88762,47 @@ function checkSide(side, pos, from, to2) { return true; } } -function enterUnfinishedNodesBefore(node, pos) { - let scan = node.childBefore(pos); +function enterUnfinishedNodesBefore(node2, pos) { + let scan = node2.childBefore(pos); while (scan) { let last = scan.lastChild; if (!last || last.to != scan.to) break; if (last.type.isError && last.from == last.to) { - node = scan; + node2 = scan; scan = last.prevSibling; } else { scan = last; } } - return node; + return node2; } -function resolveNode(node, pos, side, overlays) { +function resolveNode(node2, pos, side, overlays) { var _a; - while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { - let parent = !overlays && node instanceof TreeNode2 && node.index < 0 ? null : node.parent; + while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) { + let parent = !overlays && node2 instanceof TreeNode2 && node2.index < 0 ? null : node2.parent; if (!parent) - return node; - node = parent; + return node2; + node2 = parent; } let mode2 = overlays ? 0 : IterMode.IgnoreOverlays; if (overlays) - for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { + for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) { if (scan instanceof TreeNode2 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from) - node = parent; + node2 = parent; } for (; ; ) { - let inner = node.enter(pos, side, mode2); + let inner = node2.enter(pos, side, mode2); if (!inner) - return node; - node = inner; + return node2; + node2 = inner; } } var TreeNode2 = class { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -88711,9 +88823,9 @@ var TreeNode2 = class { if (next instanceof TreeBuffer) { if (mode2 & IterMode.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode(new BufferContext(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode(new BufferContext(parent, next, i4, start), null, index3); } else if (mode2 & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) { let mounted; if (!(mode2 & IterMode.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp.mounted)) && !mounted.overlay) @@ -88806,8 +88918,8 @@ var TreeNode2 = class { return matchNodeContext(this, context); } }; -function getChildren(node, type, before, after) { - let cur = node.cursor(), result = []; +function getChildren(node2, type, before, after) { + let cur = node2.cursor(), result = []; if (!cur.firstChild()) return result; if (before != null) { @@ -88824,12 +88936,12 @@ function getChildren(node, type, before, after) { return after == null ? result : []; } } -function matchNodeContext(node, context, i4 = context.length - 1) { - for (let p = node.parent; i4 >= 0; p = p.parent) { - if (!p) +function matchNodeContext(node2, context, i4 = context.length - 1) { + for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) { + if (!p2) return false; - if (!p.type.isAnonymous) { - if (context[i4] && context[i4] != p.name) + if (!p2.type.isAnonymous) { + if (context[i4] && context[i4] != p2.name) return false; i4--; } @@ -88837,19 +88949,19 @@ function matchNodeContext(node, context, i4 = context.length - 1) { return true; } var BufferContext = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer2, index3, start) { this.parent = parent; - this.buffer = buffer; - this.index = index2; + this.buffer = buffer2; + this.index = index3; this.start = start; } }; var BufferNode = class { - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } get name() { return this.type.name; @@ -88861,9 +88973,9 @@ var BufferNode = class { return this.context.start + this.context.buffer.buffer[this.index + 2]; } child(dir, pos, side) { - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -88880,9 +88992,9 @@ var BufferNode = class { enter(pos, side, mode2 = 0) { if (mode2 & IterMode.ExcludeBuffers) return null; - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -88891,18 +89003,18 @@ var BufferNode = class { return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4); } get nextSibling() { - let { buffer } = this.context; - let after = buffer.buffer[this.index + 3]; - if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) + let { buffer: buffer2 } = this.context; + let after = buffer2.buffer[this.index + 3]; + if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length)) return new BufferNode(this.context, this._parent, after); return this.externalSibling(1); } get prevSibling() { - let { buffer } = this.context; + let { buffer: buffer2 } = this.context; let parentStart = this._parent ? this._parent.index + 4 : 0; if (this.index == parentStart) return this.externalSibling(-1); - return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4)); + return new BufferNode(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4)); } cursor(mode2 = 0) { return new TreeCursor(this, mode2); @@ -88912,11 +89024,11 @@ var BufferNode = class { } toTree() { let children = [], positions = []; - let { buffer } = this.context; - let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; + let { buffer: buffer2 } = this.context; + let startI = this.index + 4, endI = buffer2.buffer[this.index + 3]; if (endI > startI) { - let from = buffer.buffer[this.index + 1], to2 = buffer.buffer[this.index + 2]; - children.push(buffer.slice(startI, endI, from, to2)); + let from = buffer2.buffer[this.index + 1], to2 = buffer2.buffer[this.index + 2]; + children.push(buffer2.slice(startI, endI, from, to2)); positions.push(0); } return new Tree(this.type, children, positions, this.to - this.from); @@ -88948,52 +89060,52 @@ var BufferNode = class { } }; var TreeCursor = class { - constructor(node, mode2 = 0) { + constructor(node2, mode2 = 0) { this.mode = mode2; this.buffer = null; this.stack = []; this.index = 0; this.bufferNode = null; - if (node instanceof TreeNode2) { - this.yieldNode(node); + if (node2 instanceof TreeNode2) { + this.yieldNode(node2); } else { - this._tree = node.context.parent; - this.buffer = node.context; - for (let n3 = node._parent; n3; n3 = n3._parent) + this._tree = node2.context.parent; + this.buffer = node2.context; + for (let n3 = node2._parent; n3; n3 = n3._parent) this.stack.unshift(n3.index); - this.bufferNode = node; - this.yieldBuf(node.index); + this.bufferNode = node2; + this.yieldBuf(node2.index); } } get name() { return this.type.name; } - yieldNode(node) { - if (!node) + yieldNode(node2) { + if (!node2) return false; - this._tree = node; - this.type = node.type; - this.from = node.from; - this.to = node.to; + this._tree = node2; + this.type = node2.type; + this.from = node2.from; + this.to = node2.to; return true; } - yieldBuf(index2, type) { - this.index = index2; - let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + yieldBuf(index3, type) { + this.index = index3; + let { start, buffer: buffer2 } = this.buffer; + this.type = type || buffer2.set.types[buffer2.buffer[index3]]; + this.from = start + buffer2.buffer[index3 + 1]; + this.to = start + buffer2.buffer[index3 + 2]; return true; } - yield(node) { - if (!node) + yield(node2) { + if (!node2) return false; - if (node instanceof TreeNode2) { + if (node2 instanceof TreeNode2) { this.buffer = null; - return this.yieldNode(node); + return this.yieldNode(node2); } - this.buffer = node.context; - return this.yieldBuf(node.index, node.type); + this.buffer = node2.context; + return this.yieldBuf(node2.index, node2.type); } toString() { return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); @@ -89001,12 +89113,12 @@ var TreeCursor = class { enterChild(dir, pos, side) { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); - let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let { buffer: buffer2 } = this.buffer; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -89037,14 +89149,14 @@ var TreeCursor = class { sibling(dir) { if (!this.buffer) return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); - let { buffer } = this.buffer, d4 = this.stack.length - 1; + let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1; if (dir < 0) { let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4; if (this.index != parentStart) - return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4)); + return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4)); } else { - let after = buffer.buffer[this.index + 3]; - if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3])) + let after = buffer2.buffer[this.index + 3]; + if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3])) return this.yieldBuf(after); } return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; @@ -89056,23 +89168,23 @@ var TreeCursor = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; - if (buffer) { + let index3, parent, { buffer: buffer2 } = this; + if (buffer2) { if (dir > 0) { - if (this.index < buffer.buffer.buffer.length) + if (this.index < buffer2.buffer.buffer.length) return false; } else { for (let i4 = 0; i4 < this.index; i4++) - if (buffer.buffer.buffer[i4 + 3] < this.index) + if (buffer2.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer2); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) return false; @@ -89110,16 +89222,16 @@ var TreeCursor = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -89157,11 +89269,11 @@ var TreeCursor = class { matchContext(context) { if (!this.buffer) return matchNodeContext(this.node, context); - let { buffer } = this.buffer, { types: types2 } = buffer.set; + let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set; for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) { if (d4 < 0) return matchNodeContext(this.node, context, i4); - let type = types2[buffer.buffer[this.stack[d4]]]; + let type = types2[buffer2.buffer[this.stack[d4]]]; if (!type.isAnonymous) { if (context[i4] && context[i4] != type.name) return false; @@ -89174,10 +89286,10 @@ var TreeCursor = class { function hasChild(tree) { return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch)); } -function buildTree(data2) { +function buildTree(data3) { var _a; - let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data2; - let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer; + let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data3; + let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor(buffer2, buffer2.length) : buffer2; let types2 = nodeSet.types; let contextHash = 0, lookAhead = 0; function takeNode(parentStart, minPos, children2, positions2, inRepeat) { @@ -89186,8 +89298,8 @@ function buildTree(data2) { while (size2 < 0) { cursor2.next(); if (size2 == -1) { - let node2 = reused[id3]; - children2.push(node2); + let node3 = reused[id3]; + children2.push(node3); positions2.push(start - parentStart); return; } else if (size2 == -3) { @@ -89200,15 +89312,15 @@ function buildTree(data2) { throw new RangeError(`Unrecognized record size: ${size2}`); } } - let type = types2[id3], node, buffer2; + let type = types2[id3], node2, buffer3; let startPos = start - parentStart; - if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { - let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) { + let data4 = new Uint16Array(buffer3.size - buffer3.skip); + let endPos = cursor2.pos - buffer3.size, index3 = data4.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); - node = new TreeBuffer(data3, end - buffer2.start, nodeSet); - startPos = buffer2.start - parentStart; + index3 = copyToBuffer(buffer3.start, data4, index3); + node2 = new TreeBuffer(data4, end - buffer3.start, nodeSet); + startPos = buffer3.start - parentStart; } else { let endPos = cursor2.pos - size2; cursor2.next(); @@ -89233,12 +89345,12 @@ function buildTree(data2) { localPositions.reverse(); if (localInRepeat > -1 && lastGroup > 0) { let make = makeBalanced(type); - node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); + node2 = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); } else { - node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); + node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); } } - children2.push(node); + children2.push(node2); positions2.push(startPos); } function makeBalanced(type) { @@ -89253,14 +89365,14 @@ function buildTree(data2) { return makeTree(type, children2, positions2, length2, lookAhead2); }; } - function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) { + function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) { let localChildren = [], localPositions = []; while (children2.length > i4) { localChildren.push(children2.pop()); - localPositions.push(positions2.pop() + base2 - from); + localPositions.push(positions2.pop() + base3 - from); } children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2)); - positions2.push(from - base2); + positions2.push(from - base3); } function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) { if (contextHash) { @@ -89317,48 +89429,48 @@ function buildTree(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer3, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer3, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer3[--index3] = startIndex; + buffer3[--index3] = end - bufferStart; + buffer3[--index3] = start - bufferStart; + buffer3[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) - takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1); - let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; - return new Tree(types2[data2.topID], children.reverse(), positions.reverse(), length); + takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1); + let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; + return new Tree(types2[data3.topID], children.reverse(), positions.reverse(), length); } var nodeSizeCache = /* @__PURE__ */ new WeakMap(); -function nodeSize(balanceType, node) { - if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType) +function nodeSize(balanceType, node2) { + if (!balanceType.isAnonymous || node2 instanceof TreeBuffer || node2.type != balanceType) return 1; - let size2 = nodeSizeCache.get(node); + let size2 = nodeSizeCache.get(node2); if (size2 == null) { size2 = 1; - for (let child of node.children) { + for (let child of node2.children) { if (child.type != balanceType || !(child instanceof Tree)) { size2 = 1; break; } size2 += nodeSize(balanceType, child); } - nodeSizeCache.set(node, size2); + nodeSizeCache.set(node2, size2); } return size2; } @@ -89403,17 +89515,17 @@ var Parser4 = class { return this.createParse(input, fragments || [], ranges); } parse(input, fragments, ranges) { - let parse7 = this.startParse(input, fragments, ranges); + let parse8 = this.startParse(input, fragments, ranges); for (; ; ) { - let done = parse7.advance(); + let done = parse8.advance(); if (done) return done; } } }; var StringInput = class { - constructor(string4) { - this.string = string4; + constructor(string6) { + this.string = string6; } get length() { return this.string.length; @@ -89432,14 +89544,14 @@ var stoppedInner = new NodeProp({ perNode: true }); // node_modules/@lezer/javascript/node_modules/@lezer/lr/dist/index.js var Stack = class { - constructor(p, stack, state, reducePos, pos, score, buffer, bufferBase, curContext, lookAhead = 0, parent) { - this.p = p; + constructor(p2, stack, state, reducePos, pos, score, buffer2, bufferBase, curContext, lookAhead = 0, parent) { + this.p = p2; this.stack = stack; this.state = state; this.reducePos = reducePos; this.pos = pos; this.score = score; - this.buffer = buffer; + this.buffer = buffer2; this.bufferBase = bufferBase; this.curContext = curContext; this.lookAhead = lookAhead; @@ -89448,9 +89560,9 @@ var Stack = class { toString() { return `[${this.stack.filter((_15, i4) => i4 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; } - static start(p, state, pos = 0) { - let cx = p.parser.context; - return new Stack(p, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null); + static start(p2, state, pos = 0) { + let cx = p2.parser.context; + return new Stack(p2, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null); } get context() { return this.curContext ? this.curContext.context : null; @@ -89472,20 +89584,20 @@ var Stack = class { this.reduceContext(type, this.reducePos); return; } - let base2 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0); - let start = this.stack[base2 - 2]; - let bufferBase = this.stack[base2 - 1], count3 = this.bufferBase + this.buffer.length - bufferBase; + let base3 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0); + let start = this.stack[base3 - 2]; + let bufferBase = this.stack[base3 - 1], count3 = this.bufferBase + this.buffer.length - bufferBase; if (type < parser3.minRepeatTerm || action & 131072) { let pos = parser3.stateFlag(this.state, 1) ? this.pos : this.reducePos; this.storeNode(type, start, pos, count3 + 4, true); } if (action & 262144) { - this.state = this.stack[base2]; + this.state = this.stack[base3]; } else { - let baseStateID = this.stack[base2 - 3]; + let baseStateID = this.stack[base3 - 3]; this.state = parser3.getGoto(baseStateID, type, true); } - while (this.stack.length > base2) + while (this.stack.length > base3) this.stack.pop(); this.reduceContext(type, start); } @@ -89508,21 +89620,21 @@ var Stack = class { if (!isReduce || this.pos == end) { this.buffer.push(term, start, end, size2); } else { - let index2 = this.buffer.length; - if (index2 > 0 && this.buffer[index2 - 4] != 0) - while (index2 > 0 && this.buffer[index2 - 2] > end) { - this.buffer[index2] = this.buffer[index2 - 4]; - this.buffer[index2 + 1] = this.buffer[index2 - 3]; - this.buffer[index2 + 2] = this.buffer[index2 - 2]; - this.buffer[index2 + 3] = this.buffer[index2 - 1]; - index2 -= 4; + let index3 = this.buffer.length; + if (index3 > 0 && this.buffer[index3 - 4] != 0) + while (index3 > 0 && this.buffer[index3 - 2] > end) { + this.buffer[index3] = this.buffer[index3 - 4]; + this.buffer[index3 + 1] = this.buffer[index3 - 3]; + this.buffer[index3 + 2] = this.buffer[index3 - 2]; + this.buffer[index3 + 3] = this.buffer[index3 - 1]; + index3 -= 4; if (size2 > 4) size2 -= 4; } - this.buffer[index2] = term; - this.buffer[index2 + 1] = start; - this.buffer[index2 + 2] = end; - this.buffer[index2 + 3] = size2; + this.buffer[index3] = term; + this.buffer[index3 + 1] = start; + this.buffer[index3 + 2] = end; + this.buffer[index3 + 3] = size2; } } shift(action, next, nextEnd) { @@ -89554,15 +89666,15 @@ var Stack = class { this.shift(action, next, nextEnd); } useNode(value, next) { - let index2 = this.p.reused.length - 1; - if (index2 < 0 || this.p.reused[index2] != value) { + let index3 = this.p.reused.length - 1; + if (index3 < 0 || this.p.reused[index3] != value) { this.p.reused.push(value); - index2++; + index3++; } let start = this.pos; this.reducePos = this.pos = start + value.length; this.pushState(next, start); - this.buffer.push(index2, start, this.reducePos, -1); + this.buffer.push(index3, start, this.reducePos, -1); if (this.curContext) this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length))); } @@ -89571,10 +89683,10 @@ var Stack = class { let off = parent.buffer.length; while (off > 0 && parent.buffer[off - 2] > parent.reducePos) off -= 4; - let buffer = parent.buffer.slice(off), base2 = parent.bufferBase + off; - while (parent && base2 == parent.bufferBase) + let buffer2 = parent.buffer.slice(off), base3 = parent.bufferBase + off; + while (parent && base3 == parent.bufferBase) parent = parent.parent; - return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base2, this.curContext, this.lookAhead, parent); + return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer2, base3, this.curContext, this.lookAhead, parent); } recoverByDelete(next, nextEnd) { let isNode3 = next <= this.p.parser.maxNode; @@ -89753,10 +89865,10 @@ var SimulatedStack = class { } }; var StackBufferCursor = class { - constructor(stack, pos, index2) { + constructor(stack, pos, index3) { this.stack = stack; this.pos = pos; - this.index = index2; + this.index = index3; this.buffer = stack.buffer; if (this.index == 0) this.maybeNext(); @@ -89823,19 +89935,19 @@ var InputStream = class { this.readNext(); } resolveOffset(offset2, assoc) { - let range2 = this.range, index2 = this.rangeIndex; + let range2 = this.range, index3 = this.rangeIndex; let pos = this.pos + offset2; while (pos < range2.from) { - if (!index2) + if (!index3) return null; - let next = this.ranges[--index2]; + let next = this.ranges[--index3]; pos -= range2.from - next.to; range2 = next; } while (assoc < 0 ? pos > range2.to : pos >= range2.to) { - if (index2 == this.ranges.length - 1) + if (index3 == this.ranges.length - 1) return null; - let next = this.ranges[++index2]; + let next = this.ranges[++index3]; pos += next.from - range2.to; range2 = next; } @@ -89967,8 +90079,8 @@ var InputStream = class { } }; var TokenGroup = class { - constructor(data2, id3) { - this.data = data2; + constructor(data3, id3) { + this.data = data3; this.id = id3; } token(input, stack) { @@ -89984,31 +90096,31 @@ var ExternalTokenizer = class { this.extend = !!options.extend; } }; -function readToken(data2, input, stack, group) { +function readToken(data3, input, stack, group) { let state = 0, groupMask = 1 << group, { parser: parser3 } = stack.p, { dialect } = parser3; scan: for (; ; ) { - if ((groupMask & data2[state]) == 0) + if ((groupMask & data3[state]) == 0) break; - let accEnd = data2[state + 1]; + let accEnd = data3[state + 1]; for (let i4 = state + 3; i4 < accEnd; i4 += 2) - if ((data2[i4 + 1] & groupMask) > 0) { - let term = data2[i4]; + if ((data3[i4 + 1] & groupMask) > 0) { + let term = data3[i4]; if (dialect.allows(term) && (input.token.value == -1 || input.token.value == term || parser3.overrides(term, input.token.value))) { input.acceptToken(term); break; } } - for (let next = input.next, low = 0, high = data2[state + 2]; low < high; ) { + for (let next = input.next, low = 0, high = data3[state + 2]; low < high; ) { let mid = low + high >> 1; - let index2 = accEnd + mid + (mid << 1); - let from = data2[index2], to2 = data2[index2 + 1]; + let index3 = accEnd + mid + (mid << 1); + let from = data3[index3], to2 = data3[index3 + 1]; if (next < from) high = mid; else if (next >= to2) low = mid + 1; else { - state = data2[index2 + 2]; + state = data3[index3 + 2]; input.advance(); continue scan; } @@ -90114,15 +90226,15 @@ var FragmentCursor = class { this.nextFragment(); return null; } - let top = this.trees[last], index2 = this.index[last]; - if (index2 == top.children.length) { + let top = this.trees[last], index3 = this.index[last]; + if (index3 == top.children.length) { this.trees.pop(); this.start.pop(); this.index.pop(); continue; } - let next = top.children[index2]; - let start = this.start[last] + top.positions[index2]; + let next = top.children[index3]; + let start = this.start[last] + top.positions[index3]; if (start > pos) { this.nextStart = start; return null; @@ -90207,10 +90319,10 @@ var TokenCache = class { getMainToken(stack) { if (this.mainToken) return this.mainToken; - let main = new CachedToken(), { pos, p } = stack; + let main = new CachedToken(), { pos, p: p2 } = stack; main.start = pos; - main.end = Math.min(pos + 1, p.stream.end); - main.value = pos == p.stream.end ? p.parser.eofTerm : 0; + main.end = Math.min(pos + 1, p2.stream.end); + main.value = pos == p2.stream.end ? p2.parser.eofTerm : 0; return main; } updateCachedToken(token, tokenizer2, stack) { @@ -90233,33 +90345,33 @@ var TokenCache = class { token.end = Math.min(stack.p.stream.end, stack.pos + 1); } } - putAction(action, token, end, index2) { - for (let i4 = 0; i4 < index2; i4 += 3) + putAction(action, token, end, index3) { + for (let i4 = 0; i4 < index3; i4 += 3) if (this.actions[i4] == action) - return index2; - this.actions[index2++] = action; - this.actions[index2++] = token; - this.actions[index2++] = end; - return index2; - } - addActions(stack, token, end, index2) { - let { state } = stack, { parser: parser3 } = stack.p, { data: data2 } = parser3; + return index3; + this.actions[index3++] = action; + this.actions[index3++] = token; + this.actions[index3++] = end; + return index3; + } + addActions(stack, token, end, index3) { + let { state } = stack, { parser: parser3 } = stack.p, { data: data3 } = parser3; for (let set = 0; set < 2; set++) { for (let i4 = parser3.stateSlot(state, set ? 2 : 1); ; i4 += 3) { - if (data2[i4] == 65535) { - if (data2[i4 + 1] == 1) { - i4 = pair(data2, i4 + 2); + if (data3[i4] == 65535) { + if (data3[i4 + 1] == 1) { + i4 = pair(data3, i4 + 2); } else { - if (index2 == 0 && data2[i4 + 1] == 2) - index2 = this.putAction(pair(data2, i4 + 2), token, end, index2); + if (index3 == 0 && data3[i4 + 1] == 2) + index3 = this.putAction(pair(data3, i4 + 2), token, end, index3); break; } } - if (data2[i4] == token) - index2 = this.putAction(pair(data2, i4 + 1), token, end, index2); + if (data3[i4] == token) + index3 = this.putAction(pair(data3, i4 + 1), token, end, index3); } } - return index2; + return index3; } }; var Rec; @@ -90371,7 +90483,7 @@ var Parse = class { } advanceStack(stack, stacks, split) { let start = stack.pos, { parser: parser3 } = this; - let base2 = verbose ? this.stackID(stack) + " -> " : ""; + let base3 = verbose ? this.stackID(stack) + " -> " : ""; if (this.stoppedAt != null && start > this.stoppedAt) return stack.forceReduce() ? stack : null; if (this.fragments) { @@ -90381,7 +90493,7 @@ var Parse = class { if (match2 > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) { stack.useNode(cached, match2); if (verbose) - console.log(base2 + this.stackID(stack) + ` (via reuse of ${parser3.getName(cached.type.id)})`); + console.log(base3 + this.stackID(stack) + ` (via reuse of ${parser3.getName(cached.type.id)})`); return true; } if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0) @@ -90397,7 +90509,7 @@ var Parse = class { if (defaultReduce > 0) { stack.reduce(defaultReduce); if (verbose) - console.log(base2 + this.stackID(stack) + ` (via always-reduce ${parser3.getName(defaultReduce & 65535)})`); + console.log(base3 + this.stackID(stack) + ` (via always-reduce ${parser3.getName(defaultReduce & 65535)})`); return true; } if (stack.stack.length >= 15e3) { @@ -90411,7 +90523,7 @@ var Parse = class { let localStack = last ? stack : stack.split(); localStack.apply(action, term, end); if (verbose) - console.log(base2 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser3.getName(action & 65535)}`} for ${parser3.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`); + console.log(base3 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser3.getName(action & 65535)}`} for ${parser3.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`); if (last) return true; else if (localStack.pos > start) @@ -90436,19 +90548,19 @@ var Parse = class { let finished = null, restarted = false; for (let i4 = 0; i4 < stacks.length; i4++) { let stack = stacks[i4], token = tokens[i4 << 1], tokenEnd = tokens[(i4 << 1) + 1]; - let base2 = verbose ? this.stackID(stack) + " -> " : ""; + let base3 = verbose ? this.stackID(stack) + " -> " : ""; if (stack.deadEnd) { if (restarted) continue; restarted = true; stack.restart(); if (verbose) - console.log(base2 + this.stackID(stack) + " (restarted)"); + console.log(base3 + this.stackID(stack) + " (restarted)"); let done = this.advanceFully(stack, newStacks); if (done) continue; } - let force = stack.split(), forceBase = base2; + let force = stack.split(), forceBase = base3; for (let j = 0; force.forceReduce() && j < 10; j++) { if (verbose) console.log(forceBase + this.stackID(force) + " (via force-reduce)"); @@ -90460,7 +90572,7 @@ var Parse = class { } for (let insert2 of stack.recoverByInsert(token)) { if (verbose) - console.log(base2 + this.stackID(insert2) + " (via recover-insert)"); + console.log(base3 + this.stackID(insert2) + " (via recover-insert)"); this.advanceFully(insert2, newStacks); } if (this.stream.end > stack.pos) { @@ -90470,7 +90582,7 @@ var Parse = class { } stack.recoverByDelete(token, tokenEnd); if (verbose) - console.log(base2 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`); + console.log(base3 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`); pushStackDedup(stack, newStacks); } else if (!finished || finished.score < stack.score) { finished = stack; @@ -90600,41 +90712,41 @@ var LRParser = class extends Parser4 { this.top = this.topRules[Object.keys(this.topRules)[0]]; } createParse(input, fragments, ranges) { - let parse7 = new Parse(this, input, fragments, ranges); + let parse8 = new Parse(this, input, fragments, ranges); for (let w2 of this.wrappers) - parse7 = w2(parse7, input, fragments, ranges); - return parse7; + parse8 = w2(parse8, input, fragments, ranges); + return parse8; } getGoto(state, term, loose = false) { - let table = this.goto; - if (term >= table[0]) + let table2 = this.goto; + if (term >= table2[0]) return -1; - for (let pos = table[term + 1]; ; ) { - let groupTag = table[pos++], last = groupTag & 1; - let target = table[pos++]; + for (let pos = table2[term + 1]; ; ) { + let groupTag = table2[pos++], last = groupTag & 1; + let target = table2[pos++]; if (last && loose) return target; for (let end = pos + (groupTag >> 1); pos < end; pos++) - if (table[pos] == state) + if (table2[pos] == state) return target; if (last) return -1; } } hasAction(state, terminal) { - let data2 = this.data; + let data3 = this.data; for (let set = 0; set < 2; set++) { for (let i4 = this.stateSlot(state, set ? 2 : 1), next; ; i4 += 3) { - if ((next = data2[i4]) == 65535) { - if (data2[i4 + 1] == 1) - next = data2[i4 = pair(data2, i4 + 2)]; - else if (data2[i4 + 1] == 2) - return pair(data2, i4 + 2); + if ((next = data3[i4]) == 65535) { + if (data3[i4 + 1] == 1) + next = data3[i4 = pair(data3, i4 + 2)]; + else if (data3[i4 + 1] == 2) + return pair(data3, i4 + 2); else break; } if (next == terminal || next == 0) - return pair(data2, i4 + 1); + return pair(data3, i4 + 1); } } return 0; @@ -90743,11 +90855,11 @@ var LRParser = class extends Parser4 { return new LRParser(spec); } }; -function pair(data2, off) { - return data2[off] | data2[off + 1] << 16; +function pair(data3, off) { + return data3[off] | data3[off + 1] << 16; } -function findOffset(data2, start, term) { - for (let i4 = start, next; (next = data2[i4]) != 65535; i4++) +function findOffset(data3, start, term) { + for (let i4 = start, next; (next = data3[i4]) != 65535; i4++) if (next == term) return i4 - start; return -1; @@ -90765,9 +90877,9 @@ function findFinished(stacks) { // node_modules/@lezer/javascript/node_modules/@lezer/highlight/dist/index.js var nextTagID = 0; var Tag = class { - constructor(set, base2, modified) { + constructor(set, base3, modified) { this.set = set; - this.base = base2; + this.base = base3; this.modified = modified; this.id = nextTagID++; } @@ -90796,17 +90908,17 @@ var Modifier = class { this.instances = []; this.id = nextModifierID++; } - static get(base2, mods) { + static get(base3, mods) { if (!mods.length) - return base2; - let exists = mods[0].instances.find((t5) => t5.base == base2 && sameArray(mods, t5.modified)); + return base3; + let exists = mods[0].instances.find((t5) => t5.base == base3 && sameArray(mods, t5.modified)); if (exists) return exists; - let set = [], tag2 = new Tag(set, base2, mods); + let set = [], tag2 = new Tag(set, base3, mods); for (let m4 of mods) m4.instances.push(tag2); let configs = permute(mods); - for (let parent of base2.set) + for (let parent of base3.set) for (let config4 of configs) set.push(Modifier.get(parent, config4)); return tag2; @@ -90883,21 +90995,21 @@ var Rule = class { } }; function tagHighlighter(tags3, options) { - let map4 = /* @__PURE__ */ Object.create(null); + let map6 = /* @__PURE__ */ Object.create(null); for (let style of tags3) { if (!Array.isArray(style.tag)) - map4[style.tag.id] = style.class; + map6[style.tag.id] = style.class; else for (let tag2 of style.tag) - map4[tag2.id] = style.class; + map6[tag2.id] = style.class; } - let { scope, all: all2 = null } = options || {}; + let { scope, all: all6 = null } = options || {}; return { style: (tags4) => { - let cls = all2; + let cls = all6; for (let tag2 of tags4) { for (let sub2 of tag2.set) { - let tagClass = map4[sub2.id]; + let tagClass = map6[sub2.id]; if (tagClass) { cls = cls ? cls + " " + tagClass : tagClass; break; @@ -91322,14 +91434,14 @@ var NodeType2 = class { } return this.id == name317; } - static match(map4) { + static match(map6) { let direct = /* @__PURE__ */ Object.create(null); - for (let prop2 in map4) + for (let prop2 in map6) for (let name317 of prop2.split(" ")) - direct[name317] = map4[prop2]; - return (node) => { - for (let groups = node.prop(NodeProp2.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { - let found = direct[i4 < 0 ? node.name : groups[i4]]; + direct[name317] = map6[prop2]; + return (node2) => { + for (let groups = node2.prop(NodeProp2.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { + let found = direct[i4 < 0 ? node2.name : groups[i4]]; if (found) return found; } @@ -91388,14 +91500,14 @@ var Tree2 = class { return new TreeNode3(this, 0, 0, null); } resolve(pos, side = 0) { - let node = resolveNode2(CachedNode2.get(this) || this.topNode, pos, side, false); - CachedNode2.set(this, node); - return node; + let node2 = resolveNode2(CachedNode2.get(this) || this.topNode, pos, side, false); + CachedNode2.set(this, node2); + return node2; } resolveInner(pos, side = 0) { - let node = resolveNode2(CachedInnerNode2.get(this) || this.topNode, pos, side, true); - CachedInnerNode2.set(this, node); - return node; + let node2 = resolveNode2(CachedInnerNode2.get(this) || this.topNode, pos, side, true); + CachedInnerNode2.set(this, node2); + return node2; } iterate(spec) { let { enter, leave, from = 0, to: to2 = this.length } = spec; @@ -91430,15 +91542,15 @@ var Tree2 = class { balance(config4 = {}) { return this.children.length <= 8 ? this : balanceRange2(NodeType2.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree2(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree2(NodeType2.none, children, positions, length))); } - static build(data2) { - return buildTree2(data2); + static build(data3) { + return buildTree2(data3); } }; Tree2.empty = new Tree2(NodeType2.none, [], [], 0); var FlatBufferCursor2 = class { - constructor(buffer, index2) { - this.buffer = buffer; - this.index = index2; + constructor(buffer2, index3) { + this.buffer = buffer2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -91463,8 +91575,8 @@ var FlatBufferCursor2 = class { } }; var TreeBuffer2 = class { - constructor(buffer, length, set) { - this.buffer = buffer; + constructor(buffer2, length, set) { + this.buffer = buffer2; this.length = length; this.set = set; } @@ -91473,31 +91585,31 @@ var TreeBuffer2 = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } findChild(startIndex, endIndex, dir, pos, side) { - let { buffer } = this, pick = -1; - for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) { - if (checkSide2(side, pos, buffer[i4 + 1], buffer[i4 + 2])) { + let { buffer: buffer2 } = this, pick = -1; + for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) { + if (checkSide2(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) { pick = i4; if (dir > 0) break; @@ -91533,47 +91645,47 @@ function checkSide2(side, pos, from, to2) { return true; } } -function enterUnfinishedNodesBefore2(node, pos) { - let scan = node.childBefore(pos); +function enterUnfinishedNodesBefore2(node2, pos) { + let scan = node2.childBefore(pos); while (scan) { let last = scan.lastChild; if (!last || last.to != scan.to) break; if (last.type.isError && last.from == last.to) { - node = scan; + node2 = scan; scan = last.prevSibling; } else { scan = last; } } - return node; + return node2; } -function resolveNode2(node, pos, side, overlays) { +function resolveNode2(node2, pos, side, overlays) { var _a; - while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { - let parent = !overlays && node instanceof TreeNode3 && node.index < 0 ? null : node.parent; + while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) { + let parent = !overlays && node2 instanceof TreeNode3 && node2.index < 0 ? null : node2.parent; if (!parent) - return node; - node = parent; + return node2; + node2 = parent; } let mode2 = overlays ? 0 : IterMode2.IgnoreOverlays; if (overlays) - for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { + for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) { if (scan instanceof TreeNode3 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from) - node = parent; + node2 = parent; } for (; ; ) { - let inner = node.enter(pos, side, mode2); + let inner = node2.enter(pos, side, mode2); if (!inner) - return node; - node = inner; + return node2; + node2 = inner; } } var TreeNode3 = class { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -91594,9 +91706,9 @@ var TreeNode3 = class { if (next instanceof TreeBuffer2) { if (mode2 & IterMode2.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode2(new BufferContext2(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode2(new BufferContext2(parent, next, i4, start), null, index3); } else if (mode2 & IterMode2.IncludeAnonymous || (!next.type.isAnonymous || hasChild2(next))) { let mounted; if (!(mode2 & IterMode2.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp2.mounted)) && !mounted.overlay) @@ -91689,8 +91801,8 @@ var TreeNode3 = class { return matchNodeContext2(this, context); } }; -function getChildren2(node, type, before, after) { - let cur = node.cursor(), result = []; +function getChildren2(node2, type, before, after) { + let cur = node2.cursor(), result = []; if (!cur.firstChild()) return result; if (before != null) { @@ -91707,12 +91819,12 @@ function getChildren2(node, type, before, after) { return after == null ? result : []; } } -function matchNodeContext2(node, context, i4 = context.length - 1) { - for (let p = node.parent; i4 >= 0; p = p.parent) { - if (!p) +function matchNodeContext2(node2, context, i4 = context.length - 1) { + for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) { + if (!p2) return false; - if (!p.type.isAnonymous) { - if (context[i4] && context[i4] != p.name) + if (!p2.type.isAnonymous) { + if (context[i4] && context[i4] != p2.name) return false; i4--; } @@ -91720,19 +91832,19 @@ function matchNodeContext2(node, context, i4 = context.length - 1) { return true; } var BufferContext2 = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer2, index3, start) { this.parent = parent; - this.buffer = buffer; - this.index = index2; + this.buffer = buffer2; + this.index = index3; this.start = start; } }; var BufferNode2 = class { - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } get name() { return this.type.name; @@ -91744,9 +91856,9 @@ var BufferNode2 = class { return this.context.start + this.context.buffer.buffer[this.index + 2]; } child(dir, pos, side) { - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode2(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode2(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -91763,9 +91875,9 @@ var BufferNode2 = class { enter(pos, side, mode2 = 0) { if (mode2 & IterMode2.ExcludeBuffers) return null; - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode2(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode2(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -91774,18 +91886,18 @@ var BufferNode2 = class { return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4); } get nextSibling() { - let { buffer } = this.context; - let after = buffer.buffer[this.index + 3]; - if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) + let { buffer: buffer2 } = this.context; + let after = buffer2.buffer[this.index + 3]; + if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length)) return new BufferNode2(this.context, this._parent, after); return this.externalSibling(1); } get prevSibling() { - let { buffer } = this.context; + let { buffer: buffer2 } = this.context; let parentStart = this._parent ? this._parent.index + 4 : 0; if (this.index == parentStart) return this.externalSibling(-1); - return new BufferNode2(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4)); + return new BufferNode2(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4)); } cursor(mode2 = 0) { return new TreeCursor2(this, mode2); @@ -91795,11 +91907,11 @@ var BufferNode2 = class { } toTree() { let children = [], positions = []; - let { buffer } = this.context; - let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; + let { buffer: buffer2 } = this.context; + let startI = this.index + 4, endI = buffer2.buffer[this.index + 3]; if (endI > startI) { - let from = buffer.buffer[this.index + 1], to2 = buffer.buffer[this.index + 2]; - children.push(buffer.slice(startI, endI, from, to2)); + let from = buffer2.buffer[this.index + 1], to2 = buffer2.buffer[this.index + 2]; + children.push(buffer2.slice(startI, endI, from, to2)); positions.push(0); } return new Tree2(this.type, children, positions, this.to - this.from); @@ -91831,52 +91943,52 @@ var BufferNode2 = class { } }; var TreeCursor2 = class { - constructor(node, mode2 = 0) { + constructor(node2, mode2 = 0) { this.mode = mode2; this.buffer = null; this.stack = []; this.index = 0; this.bufferNode = null; - if (node instanceof TreeNode3) { - this.yieldNode(node); + if (node2 instanceof TreeNode3) { + this.yieldNode(node2); } else { - this._tree = node.context.parent; - this.buffer = node.context; - for (let n3 = node._parent; n3; n3 = n3._parent) + this._tree = node2.context.parent; + this.buffer = node2.context; + for (let n3 = node2._parent; n3; n3 = n3._parent) this.stack.unshift(n3.index); - this.bufferNode = node; - this.yieldBuf(node.index); + this.bufferNode = node2; + this.yieldBuf(node2.index); } } get name() { return this.type.name; } - yieldNode(node) { - if (!node) + yieldNode(node2) { + if (!node2) return false; - this._tree = node; - this.type = node.type; - this.from = node.from; - this.to = node.to; + this._tree = node2; + this.type = node2.type; + this.from = node2.from; + this.to = node2.to; return true; } - yieldBuf(index2, type) { - this.index = index2; - let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + yieldBuf(index3, type) { + this.index = index3; + let { start, buffer: buffer2 } = this.buffer; + this.type = type || buffer2.set.types[buffer2.buffer[index3]]; + this.from = start + buffer2.buffer[index3 + 1]; + this.to = start + buffer2.buffer[index3 + 2]; return true; } - yield(node) { - if (!node) + yield(node2) { + if (!node2) return false; - if (node instanceof TreeNode3) { + if (node2 instanceof TreeNode3) { this.buffer = null; - return this.yieldNode(node); + return this.yieldNode(node2); } - this.buffer = node.context; - return this.yieldBuf(node.index, node.type); + this.buffer = node2.context; + return this.yieldBuf(node2.index, node2.type); } toString() { return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); @@ -91884,12 +91996,12 @@ var TreeCursor2 = class { enterChild(dir, pos, side) { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); - let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let { buffer: buffer2 } = this.buffer; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -91920,14 +92032,14 @@ var TreeCursor2 = class { sibling(dir) { if (!this.buffer) return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); - let { buffer } = this.buffer, d4 = this.stack.length - 1; + let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1; if (dir < 0) { let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4; if (this.index != parentStart) - return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4)); + return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4)); } else { - let after = buffer.buffer[this.index + 3]; - if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3])) + let after = buffer2.buffer[this.index + 3]; + if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3])) return this.yieldBuf(after); } return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; @@ -91939,23 +92051,23 @@ var TreeCursor2 = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; - if (buffer) { + let index3, parent, { buffer: buffer2 } = this; + if (buffer2) { if (dir > 0) { - if (this.index < buffer.buffer.buffer.length) + if (this.index < buffer2.buffer.buffer.length) return false; } else { for (let i4 = 0; i4 < this.index; i4++) - if (buffer.buffer.buffer[i4 + 3] < this.index) + if (buffer2.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer2); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode2.IncludeAnonymous || child instanceof TreeBuffer2 || !child.type.isAnonymous || hasChild2(child)) return false; @@ -91993,16 +92105,16 @@ var TreeCursor2 = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -92040,11 +92152,11 @@ var TreeCursor2 = class { matchContext(context) { if (!this.buffer) return matchNodeContext2(this.node, context); - let { buffer } = this.buffer, { types: types2 } = buffer.set; + let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set; for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) { if (d4 < 0) return matchNodeContext2(this.node, context, i4); - let type = types2[buffer.buffer[this.stack[d4]]]; + let type = types2[buffer2.buffer[this.stack[d4]]]; if (!type.isAnonymous) { if (context[i4] && context[i4] != type.name) return false; @@ -92057,10 +92169,10 @@ var TreeCursor2 = class { function hasChild2(tree) { return tree.children.some((ch) => ch instanceof TreeBuffer2 || !ch.type.isAnonymous || hasChild2(ch)); } -function buildTree2(data2) { +function buildTree2(data3) { var _a; - let { buffer, nodeSet, maxBufferLength = DefaultBufferLength2, reused = [], minRepeatType = nodeSet.types.length } = data2; - let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor2(buffer, buffer.length) : buffer; + let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength2, reused = [], minRepeatType = nodeSet.types.length } = data3; + let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor2(buffer2, buffer2.length) : buffer2; let types2 = nodeSet.types; let contextHash = 0, lookAhead = 0; function takeNode(parentStart, minPos, children2, positions2, inRepeat) { @@ -92069,8 +92181,8 @@ function buildTree2(data2) { while (size2 < 0) { cursor2.next(); if (size2 == -1) { - let node2 = reused[id3]; - children2.push(node2); + let node3 = reused[id3]; + children2.push(node3); positions2.push(start - parentStart); return; } else if (size2 == -3) { @@ -92083,15 +92195,15 @@ function buildTree2(data2) { throw new RangeError(`Unrecognized record size: ${size2}`); } } - let type = types2[id3], node, buffer2; + let type = types2[id3], node2, buffer3; let startPos = start - parentStart; - if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { - let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) { + let data4 = new Uint16Array(buffer3.size - buffer3.skip); + let endPos = cursor2.pos - buffer3.size, index3 = data4.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); - node = new TreeBuffer2(data3, end - buffer2.start, nodeSet); - startPos = buffer2.start - parentStart; + index3 = copyToBuffer(buffer3.start, data4, index3); + node2 = new TreeBuffer2(data4, end - buffer3.start, nodeSet); + startPos = buffer3.start - parentStart; } else { let endPos = cursor2.pos - size2; cursor2.next(); @@ -92116,12 +92228,12 @@ function buildTree2(data2) { localPositions.reverse(); if (localInRepeat > -1 && lastGroup > 0) { let make = makeBalanced(type); - node = balanceRange2(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); + node2 = balanceRange2(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); } else { - node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); + node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); } } - children2.push(node); + children2.push(node2); positions2.push(startPos); } function makeBalanced(type) { @@ -92136,14 +92248,14 @@ function buildTree2(data2) { return makeTree(type, children2, positions2, length2, lookAhead2); }; } - function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) { + function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) { let localChildren = [], localPositions = []; while (children2.length > i4) { localChildren.push(children2.pop()); - localPositions.push(positions2.pop() + base2 - from); + localPositions.push(positions2.pop() + base3 - from); } children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2)); - positions2.push(from - base2); + positions2.push(from - base3); } function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) { if (contextHash) { @@ -92200,48 +92312,48 @@ function buildTree2(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer3, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer3, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer3[--index3] = startIndex; + buffer3[--index3] = end - bufferStart; + buffer3[--index3] = start - bufferStart; + buffer3[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) - takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1); - let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; - return new Tree2(types2[data2.topID], children.reverse(), positions.reverse(), length); + takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1); + let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; + return new Tree2(types2[data3.topID], children.reverse(), positions.reverse(), length); } var nodeSizeCache2 = /* @__PURE__ */ new WeakMap(); -function nodeSize2(balanceType, node) { - if (!balanceType.isAnonymous || node instanceof TreeBuffer2 || node.type != balanceType) +function nodeSize2(balanceType, node2) { + if (!balanceType.isAnonymous || node2 instanceof TreeBuffer2 || node2.type != balanceType) return 1; - let size2 = nodeSizeCache2.get(node); + let size2 = nodeSizeCache2.get(node2); if (size2 == null) { size2 = 1; - for (let child of node.children) { + for (let child of node2.children) { if (child.type != balanceType || !(child instanceof Tree2)) { size2 = 1; break; } size2 += nodeSize2(balanceType, child); } - nodeSizeCache2.set(node, size2); + nodeSizeCache2.set(node2, size2); } return size2; } @@ -92282,24 +92394,24 @@ var NodeWeakMap = class { constructor() { this.map = /* @__PURE__ */ new WeakMap(); } - setBuffer(buffer, index2, value) { - let inner = this.map.get(buffer); + setBuffer(buffer2, index3, value) { + let inner = this.map.get(buffer2); if (!inner) - this.map.set(buffer, inner = /* @__PURE__ */ new Map()); - inner.set(index2, value); + this.map.set(buffer2, inner = /* @__PURE__ */ new Map()); + inner.set(index3, value); } - getBuffer(buffer, index2) { - let inner = this.map.get(buffer); - return inner && inner.get(index2); + getBuffer(buffer2, index3) { + let inner = this.map.get(buffer2); + return inner && inner.get(index3); } - set(node, value) { - if (node instanceof BufferNode2) - this.setBuffer(node.context.buffer, node.index, value); - else if (node instanceof TreeNode3) - this.map.set(node.tree, value); + set(node2, value) { + if (node2 instanceof BufferNode2) + this.setBuffer(node2.context.buffer, node2.index, value); + else if (node2 instanceof TreeNode3) + this.map.set(node2.tree, value); } - get(node) { - return node instanceof BufferNode2 ? this.getBuffer(node.context.buffer, node.index) : node instanceof TreeNode3 ? this.map.get(node.tree) : void 0; + get(node2) { + return node2 instanceof BufferNode2 ? this.getBuffer(node2.context.buffer, node2.index) : node2 instanceof TreeNode3 ? this.map.get(node2.tree) : void 0; } cursorSet(cursor2, value) { if (cursor2.buffer) @@ -92362,8 +92474,8 @@ var ScopeNodes = /* @__PURE__ */ new Set([ "ForStatement" ]); function defID(type) { - return (node, def) => { - let id3 = node.node.getChild("VariableDefinition"); + return (node2, def) => { + let id3 = node2.node.getChild("VariableDefinition"); if (id3) def(id3, type); return true; @@ -92377,38 +92489,38 @@ var gatherCompletions = { EnumDeclaration: /* @__PURE__ */ defID("constant"), TypeAliasDeclaration: /* @__PURE__ */ defID("type"), NamespaceDeclaration: /* @__PURE__ */ defID("namespace"), - VariableDefinition(node, def) { - if (!node.matchContext(functionContext)) - def(node, "variable"); + VariableDefinition(node2, def) { + if (!node2.matchContext(functionContext)) + def(node2, "variable"); }, - TypeDefinition(node, def) { - def(node, "type"); + TypeDefinition(node2, def) { + def(node2, "type"); }, __proto__: null }; -function getScope(doc, node) { - let cached = cache.get(node); +function getScope(doc, node2) { + let cached = cache.get(node2); if (cached) return cached; let completions = [], top = true; - function def(node2, type) { - let name317 = doc.sliceString(node2.from, node2.to); + function def(node3, type) { + let name317 = doc.sliceString(node3.from, node3.to); completions.push({ label: name317, type }); } - node.cursor(IterMode2.IncludeAnonymous).iterate((node2) => { + node2.cursor(IterMode2.IncludeAnonymous).iterate((node3) => { if (top) { top = false; - } else if (node2.name) { - let gather = gatherCompletions[node2.name]; - if (gather && gather(node2, def) || ScopeNodes.has(node2.name)) + } else if (node3.name) { + let gather = gatherCompletions[node3.name]; + if (gather && gather(node3, def) || ScopeNodes.has(node3.name)) return false; - } else if (node2.to - node2.from > 8192) { - for (let c3 of getScope(doc, node2.node)) + } else if (node3.to - node3.from > 8192) { + for (let c3 of getScope(doc, node3.node)) completions.push(c3); return false; } }); - cache.set(node, completions); + cache.set(node2, completions); return completions; } var Identifier = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/; @@ -92494,25 +92606,25 @@ function elementName(doc, tree, max5 = doc.length) { return name317 ? doc.sliceString(name317.from, Math.min(name317.to, max5)) : ""; } var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent); -var autoCloseTags = /* @__PURE__ */ import_view2.EditorView.inputHandler.of((view, from, to2, text2) => { - if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to2 || text2 != ">" && text2 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1)) +var autoCloseTags = /* @__PURE__ */ import_view2.EditorView.inputHandler.of((view, from, to2, text7) => { + if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to2 || text7 != ">" && text7 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1)) return false; let { state } = view; let changes = state.changeByRange((range2) => { var _a, _b, _c; - let { head } = range2, around2 = (0, import_language2.syntaxTree)(state).resolveInner(head, -1), name317; + let { head: head2 } = range2, around2 = (0, import_language2.syntaxTree)(state).resolveInner(head2, -1), name317; if (around2.name == "JSXStartTag") around2 = around2.parent; - if (text2 == ">" && around2.name == "JSXFragmentTag") { - return { range: import_state3.EditorSelection.cursor(head + 1), changes: { from: head, insert: `><>` } }; - } else if (text2 == ">" && around2.name == "JSXIdentifier") { - if (((_b = (_a = around2.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && (name317 = elementName(state.doc, around2.parent, head))) - return { range: import_state3.EditorSelection.cursor(head + 1), changes: { from: head, insert: `>` } }; - } else if (text2 == "/" && around2.name == "JSXFragmentTag") { - let empty3 = around2.parent, base2 = empty3 === null || empty3 === void 0 ? void 0 : empty3.parent; - if (empty3.from == head - 1 && ((_c = base2.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "JSXEndTag" && (name317 = elementName(state.doc, base2 === null || base2 === void 0 ? void 0 : base2.firstChild, head))) { + if (text7 == ">" && around2.name == "JSXFragmentTag") { + return { range: import_state3.EditorSelection.cursor(head2 + 1), changes: { from: head2, insert: `><>` } }; + } else if (text7 == ">" && around2.name == "JSXIdentifier") { + if (((_b = (_a = around2.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && (name317 = elementName(state.doc, around2.parent, head2))) + return { range: import_state3.EditorSelection.cursor(head2 + 1), changes: { from: head2, insert: `>` } }; + } else if (text7 == "/" && around2.name == "JSXFragmentTag") { + let empty3 = around2.parent, base3 = empty3 === null || empty3 === void 0 ? void 0 : empty3.parent; + if (empty3.from == head2 - 1 && ((_c = base3.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "JSXEndTag" && (name317 = elementName(state.doc, base3 === null || base3 === void 0 ? void 0 : base3.firstChild, head2))) { let insert2 = `/${name317}>`; - return { range: import_state3.EditorSelection.cursor(head + insert2.length), changes: { from: head, insert: insert2 } }; + return { range: import_state3.EditorSelection.cursor(head2 + insert2.length), changes: { from: head2, insert: insert2 } }; } } return { range: range2 }; @@ -92614,14 +92726,14 @@ var NodeType3 = class { } return this.id == name317; } - static match(map4) { + static match(map6) { let direct = /* @__PURE__ */ Object.create(null); - for (let prop2 in map4) + for (let prop2 in map6) for (let name317 of prop2.split(" ")) - direct[name317] = map4[prop2]; - return (node) => { - for (let groups = node.prop(NodeProp3.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { - let found = direct[i4 < 0 ? node.name : groups[i4]]; + direct[name317] = map6[prop2]; + return (node2) => { + for (let groups = node2.prop(NodeProp3.group), i4 = -1; i4 < (groups ? groups.length : 0); i4++) { + let found = direct[i4 < 0 ? node2.name : groups[i4]]; if (found) return found; } @@ -92680,14 +92792,14 @@ var Tree3 = class { return new TreeNode4(this, 0, 0, null); } resolve(pos, side = 0) { - let node = resolveNode3(CachedNode3.get(this) || this.topNode, pos, side, false); - CachedNode3.set(this, node); - return node; + let node2 = resolveNode3(CachedNode3.get(this) || this.topNode, pos, side, false); + CachedNode3.set(this, node2); + return node2; } resolveInner(pos, side = 0) { - let node = resolveNode3(CachedInnerNode3.get(this) || this.topNode, pos, side, true); - CachedInnerNode3.set(this, node); - return node; + let node2 = resolveNode3(CachedInnerNode3.get(this) || this.topNode, pos, side, true); + CachedInnerNode3.set(this, node2); + return node2; } resolveStack(pos, side = 0) { return stackIterator(this, pos, side); @@ -92726,15 +92838,15 @@ var Tree3 = class { balance(config4 = {}) { return this.children.length <= 8 ? this : balanceRange3(NodeType3.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree3(this.type, children, positions, length, this.propValues), config4.makeTree || ((children, positions, length) => new Tree3(NodeType3.none, children, positions, length))); } - static build(data2) { - return buildTree3(data2); + static build(data3) { + return buildTree3(data3); } }; Tree3.empty = new Tree3(NodeType3.none, [], [], 0); var FlatBufferCursor3 = class { - constructor(buffer, index2) { - this.buffer = buffer; - this.index = index2; + constructor(buffer2, index3) { + this.buffer = buffer2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -92759,8 +92871,8 @@ var FlatBufferCursor3 = class { } }; var TreeBuffer3 = class { - constructor(buffer, length, set) { - this.buffer = buffer; + constructor(buffer2, length, set) { + this.buffer = buffer2; this.length = length; this.set = set; } @@ -92769,31 +92881,31 @@ var TreeBuffer3 = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } findChild(startIndex, endIndex, dir, pos, side) { - let { buffer } = this, pick = -1; - for (let i4 = startIndex; i4 != endIndex; i4 = buffer[i4 + 3]) { - if (checkSide3(side, pos, buffer[i4 + 1], buffer[i4 + 2])) { + let { buffer: buffer2 } = this, pick = -1; + for (let i4 = startIndex; i4 != endIndex; i4 = buffer2[i4 + 3]) { + if (checkSide3(side, pos, buffer2[i4 + 1], buffer2[i4 + 2])) { pick = i4; if (dir > 0) break; @@ -92830,25 +92942,25 @@ function checkSide3(side, pos, from, to2) { return true; } } -function resolveNode3(node, pos, side, overlays) { +function resolveNode3(node2, pos, side, overlays) { var _a; - while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { - let parent = !overlays && node instanceof TreeNode4 && node.index < 0 ? null : node.parent; + while (node2.from == node2.to || (side < 1 ? node2.from >= pos : node2.from > pos) || (side > -1 ? node2.to <= pos : node2.to < pos)) { + let parent = !overlays && node2 instanceof TreeNode4 && node2.index < 0 ? null : node2.parent; if (!parent) - return node; - node = parent; + return node2; + node2 = parent; } let mode2 = overlays ? 0 : IterMode3.IgnoreOverlays; if (overlays) - for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { + for (let scan = node2, parent = scan.parent; parent; scan = parent, parent = scan.parent) { if (scan instanceof TreeNode4 && scan.index < 0 && ((_a = parent.enter(pos, side, mode2)) === null || _a === void 0 ? void 0 : _a.from) != scan.from) - node = parent; + node2 = parent; } for (; ; ) { - let inner = node.enter(pos, side, mode2); + let inner = node2.enter(pos, side, mode2); if (!inner) - return node; - node = inner; + return node2; + node2 = inner; } } var BaseNode = class { @@ -92872,19 +92984,19 @@ var BaseNode = class { return matchNodeContext3(this, context); } enterUnfinishedNodesBefore(pos) { - let scan = this.childBefore(pos), node = this; + let scan = this.childBefore(pos), node2 = this; while (scan) { let last = scan.lastChild; if (!last || last.to != scan.to) break; if (last.type.isError && last.from == last.to) { - node = scan; + node2 = scan; scan = last.prevSibling; } else { scan = last; } } - return node; + return node2; } get node() { return this; @@ -92894,11 +93006,11 @@ var BaseNode = class { } }; var TreeNode4 = class extends BaseNode { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { super(); this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -92919,9 +93031,9 @@ var TreeNode4 = class extends BaseNode { if (next instanceof TreeBuffer3) { if (mode2 & IterMode3.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode3(new BufferContext3(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode3(new BufferContext3(parent, next, i4, start), null, index3); } else if (mode2 & IterMode3.IncludeAnonymous || (!next.type.isAnonymous || hasChild3(next))) { let mounted; if (!(mode2 & IterMode3.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay) @@ -92989,8 +93101,8 @@ var TreeNode4 = class extends BaseNode { return this._tree.toString(); } }; -function getChildren3(node, type, before, after) { - let cur = node.cursor(), result = []; +function getChildren3(node2, type, before, after) { + let cur = node2.cursor(), result = []; if (!cur.firstChild()) return result; if (before != null) @@ -93008,12 +93120,12 @@ function getChildren3(node, type, before, after) { return after == null ? result : []; } } -function matchNodeContext3(node, context, i4 = context.length - 1) { - for (let p = node.parent; i4 >= 0; p = p.parent) { - if (!p) +function matchNodeContext3(node2, context, i4 = context.length - 1) { + for (let p2 = node2.parent; i4 >= 0; p2 = p2.parent) { + if (!p2) return false; - if (!p.type.isAnonymous) { - if (context[i4] && context[i4] != p.name) + if (!p2.type.isAnonymous) { + if (context[i4] && context[i4] != p2.name) return false; i4--; } @@ -93021,10 +93133,10 @@ function matchNodeContext3(node, context, i4 = context.length - 1) { return true; } var BufferContext3 = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer2, index3, start) { this.parent = parent; - this.buffer = buffer; - this.index = index2; + this.buffer = buffer2; + this.index = index3; this.start = start; } }; @@ -93038,17 +93150,17 @@ var BufferNode3 = class extends BaseNode { get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; } - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { super(); this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } child(dir, pos, side) { - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode3(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode3(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -93065,9 +93177,9 @@ var BufferNode3 = class extends BaseNode { enter(pos, side, mode2 = 0) { if (mode2 & IterMode3.ExcludeBuffers) return null; - let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode3(this.context, this, index2); + let { buffer: buffer2 } = this.context; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode3(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -93076,29 +93188,29 @@ var BufferNode3 = class extends BaseNode { return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4); } get nextSibling() { - let { buffer } = this.context; - let after = buffer.buffer[this.index + 3]; - if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) + let { buffer: buffer2 } = this.context; + let after = buffer2.buffer[this.index + 3]; + if (after < (this._parent ? buffer2.buffer[this._parent.index + 3] : buffer2.buffer.length)) return new BufferNode3(this.context, this._parent, after); return this.externalSibling(1); } get prevSibling() { - let { buffer } = this.context; + let { buffer: buffer2 } = this.context; let parentStart = this._parent ? this._parent.index + 4 : 0; if (this.index == parentStart) return this.externalSibling(-1); - return new BufferNode3(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4)); + return new BufferNode3(this.context, this._parent, buffer2.findChild(parentStart, this.index, -1, 0, 4)); } get tree() { return null; } toTree() { let children = [], positions = []; - let { buffer } = this.context; - let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; + let { buffer: buffer2 } = this.context; + let startI = this.index + 4, endI = buffer2.buffer[this.index + 3]; if (endI > startI) { - let from = buffer.buffer[this.index + 1]; - children.push(buffer.slice(startI, endI, from)); + let from = buffer2.buffer[this.index + 1]; + children.push(buffer2.slice(startI, endI, from)); positions.push(0); } return new Tree3(this.type, children, positions, this.to - this.from); @@ -93112,9 +93224,9 @@ function iterStack(heads) { return null; let pick = 0, picked = heads[0]; for (let i4 = 1; i4 < heads.length; i4++) { - let node = heads[i4]; - if (node.from > picked.from || node.to < picked.to) { - picked = node; + let node2 = heads[i4]; + if (node2.from > picked.from || node2.to < picked.to) { + picked = node2; pick = i4; } } @@ -93127,9 +93239,9 @@ function iterStack(heads) { return new StackIterator(newHeads, picked); } var StackIterator = class { - constructor(heads, node) { + constructor(heads, node2) { this.heads = heads; - this.node = node; + this.node = node2; } get next() { return iterStack(this.heads); @@ -93145,8 +93257,8 @@ function stackIterator(tree, pos, side) { } else { let mount = MountedTree.get(scan.tree); if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) { - let root = new TreeNode4(mount.tree, mount.overlay[0].from + scan.from, -1, scan); - (layers || (layers = [inner])).push(resolveNode3(root, pos, side, false)); + let root4 = new TreeNode4(mount.tree, mount.overlay[0].from + scan.from, -1, scan); + (layers || (layers = [inner])).push(resolveNode3(root4, pos, side, false)); } } } @@ -93156,49 +93268,49 @@ var TreeCursor3 = class { get name() { return this.type.name; } - constructor(node, mode2 = 0) { + constructor(node2, mode2 = 0) { this.mode = mode2; this.buffer = null; this.stack = []; this.index = 0; this.bufferNode = null; - if (node instanceof TreeNode4) { - this.yieldNode(node); + if (node2 instanceof TreeNode4) { + this.yieldNode(node2); } else { - this._tree = node.context.parent; - this.buffer = node.context; - for (let n3 = node._parent; n3; n3 = n3._parent) + this._tree = node2.context.parent; + this.buffer = node2.context; + for (let n3 = node2._parent; n3; n3 = n3._parent) this.stack.unshift(n3.index); - this.bufferNode = node; - this.yieldBuf(node.index); + this.bufferNode = node2; + this.yieldBuf(node2.index); } } - yieldNode(node) { - if (!node) + yieldNode(node2) { + if (!node2) return false; - this._tree = node; - this.type = node.type; - this.from = node.from; - this.to = node.to; + this._tree = node2; + this.type = node2.type; + this.from = node2.from; + this.to = node2.to; return true; } - yieldBuf(index2, type) { - this.index = index2; - let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + yieldBuf(index3, type) { + this.index = index3; + let { start, buffer: buffer2 } = this.buffer; + this.type = type || buffer2.set.types[buffer2.buffer[index3]]; + this.from = start + buffer2.buffer[index3 + 1]; + this.to = start + buffer2.buffer[index3 + 2]; return true; } - yield(node) { - if (!node) + yield(node2) { + if (!node2) return false; - if (node instanceof TreeNode4) { + if (node2 instanceof TreeNode4) { this.buffer = null; - return this.yieldNode(node); + return this.yieldNode(node2); } - this.buffer = node.context; - return this.yieldBuf(node.index, node.type); + this.buffer = node2.context; + return this.yieldBuf(node2.index, node2.type); } toString() { return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); @@ -93206,12 +93318,12 @@ var TreeCursor3 = class { enterChild(dir, pos, side) { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); - let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let { buffer: buffer2 } = this.buffer; + let index3 = buffer2.findChild(this.index + 4, buffer2.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -93242,14 +93354,14 @@ var TreeCursor3 = class { sibling(dir) { if (!this.buffer) return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); - let { buffer } = this.buffer, d4 = this.stack.length - 1; + let { buffer: buffer2 } = this.buffer, d4 = this.stack.length - 1; if (dir < 0) { let parentStart = d4 < 0 ? 0 : this.stack[d4] + 4; if (this.index != parentStart) - return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4)); + return this.yieldBuf(buffer2.findChild(parentStart, this.index, -1, 0, 4)); } else { - let after = buffer.buffer[this.index + 3]; - if (after < (d4 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d4] + 3])) + let after = buffer2.buffer[this.index + 3]; + if (after < (d4 < 0 ? buffer2.buffer.length : buffer2.buffer[this.stack[d4] + 3])) return this.yieldBuf(after); } return d4 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; @@ -93261,23 +93373,23 @@ var TreeCursor3 = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; - if (buffer) { + let index3, parent, { buffer: buffer2 } = this; + if (buffer2) { if (dir > 0) { - if (this.index < buffer.buffer.buffer.length) + if (this.index < buffer2.buffer.buffer.length) return false; } else { for (let i4 = 0; i4 < this.index; i4++) - if (buffer.buffer.buffer[i4 + 3] < this.index) + if (buffer2.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer2); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode3.IncludeAnonymous || child instanceof TreeBuffer3 || !child.type.isAnonymous || hasChild3(child)) return false; @@ -93315,16 +93427,16 @@ var TreeCursor3 = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -93362,11 +93474,11 @@ var TreeCursor3 = class { matchContext(context) { if (!this.buffer) return matchNodeContext3(this.node, context); - let { buffer } = this.buffer, { types: types2 } = buffer.set; + let { buffer: buffer2 } = this.buffer, { types: types2 } = buffer2.set; for (let i4 = context.length - 1, d4 = this.stack.length - 1; i4 >= 0; d4--) { if (d4 < 0) return matchNodeContext3(this.node, context, i4); - let type = types2[buffer.buffer[this.stack[d4]]]; + let type = types2[buffer2.buffer[this.stack[d4]]]; if (!type.isAnonymous) { if (context[i4] && context[i4] != type.name) return false; @@ -93379,10 +93491,10 @@ var TreeCursor3 = class { function hasChild3(tree) { return tree.children.some((ch) => ch instanceof TreeBuffer3 || !ch.type.isAnonymous || hasChild3(ch)); } -function buildTree3(data2) { +function buildTree3(data3) { var _a; - let { buffer, nodeSet, maxBufferLength = DefaultBufferLength3, reused = [], minRepeatType = nodeSet.types.length } = data2; - let cursor2 = Array.isArray(buffer) ? new FlatBufferCursor3(buffer, buffer.length) : buffer; + let { buffer: buffer2, nodeSet, maxBufferLength = DefaultBufferLength3, reused = [], minRepeatType = nodeSet.types.length } = data3; + let cursor2 = Array.isArray(buffer2) ? new FlatBufferCursor3(buffer2, buffer2.length) : buffer2; let types2 = nodeSet.types; let contextHash = 0, lookAhead = 0; function takeNode(parentStart, minPos, children2, positions2, inRepeat, depth) { @@ -93391,8 +93503,8 @@ function buildTree3(data2) { while (size2 < 0) { cursor2.next(); if (size2 == -1) { - let node2 = reused[id3]; - children2.push(node2); + let node3 = reused[id3]; + children2.push(node3); positions2.push(start - parentStart); return; } else if (size2 == -3) { @@ -93405,15 +93517,15 @@ function buildTree3(data2) { throw new RangeError(`Unrecognized record size: ${size2}`); } } - let type = types2[id3], node, buffer2; + let type = types2[id3], node2, buffer3; let startPos = start - parentStart; - if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { - let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + if (end - start <= maxBufferLength && (buffer3 = findBufferSize(cursor2.pos - minPos, inRepeat))) { + let data4 = new Uint16Array(buffer3.size - buffer3.skip); + let endPos = cursor2.pos - buffer3.size, index3 = data4.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); - node = new TreeBuffer3(data3, end - buffer2.start, nodeSet); - startPos = buffer2.start - parentStart; + index3 = copyToBuffer(buffer3.start, data4, index3); + node2 = new TreeBuffer3(data4, end - buffer3.start, nodeSet); + startPos = buffer3.start - parentStart; } else { let endPos = cursor2.pos - size2; cursor2.next(); @@ -93440,12 +93552,12 @@ function buildTree3(data2) { localPositions.reverse(); if (localInRepeat > -1 && lastGroup > 0) { let make = makeBalanced(type); - node = balanceRange3(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); + node2 = balanceRange3(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); } else { - node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); + node2 = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); } } - children2.push(node); + children2.push(node2); positions2.push(startPos); } function takeFlatNode(parentStart, minPos, children2, positions2) { @@ -93466,15 +93578,15 @@ function buildTree3(data2) { } } if (nodeCount) { - let buffer2 = new Uint16Array(nodeCount * 4); + let buffer3 = new Uint16Array(nodeCount * 4); let start = nodes[nodes.length - 2]; for (let i4 = nodes.length - 3, j = 0; i4 >= 0; i4 -= 3) { - buffer2[j++] = nodes[i4]; - buffer2[j++] = nodes[i4 + 1] - start; - buffer2[j++] = nodes[i4 + 2] - start; - buffer2[j++] = j; + buffer3[j++] = nodes[i4]; + buffer3[j++] = nodes[i4 + 1] - start; + buffer3[j++] = nodes[i4 + 2] - start; + buffer3[j++] = j; } - children2.push(new TreeBuffer3(buffer2, nodes[2] - start, nodeSet)); + children2.push(new TreeBuffer3(buffer3, nodes[2] - start, nodeSet)); positions2.push(start - parentStart); } } @@ -93490,14 +93602,14 @@ function buildTree3(data2) { return makeTree(type, children2, positions2, length2, lookAhead2); }; } - function makeRepeatLeaf(children2, positions2, base2, i4, from, to2, type, lookAhead2) { + function makeRepeatLeaf(children2, positions2, base3, i4, from, to2, type, lookAhead2) { let localChildren = [], localPositions = []; while (children2.length > i4) { localChildren.push(children2.pop()); - localPositions.push(positions2.pop() + base2 - from); + localPositions.push(positions2.pop() + base3 - from); } children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to2 - from, lookAhead2 - to2)); - positions2.push(from - base2); + positions2.push(from - base3); } function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) { if (contextHash) { @@ -93554,48 +93666,48 @@ function buildTree3(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer3, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer3, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer3[--index3] = startIndex; + buffer3[--index3] = end - bufferStart; + buffer3[--index3] = start - bufferStart; + buffer3[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) - takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1, 0); - let length = (_a = data2.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; - return new Tree3(types2[data2.topID], children.reverse(), positions.reverse(), length); + takeNode(data3.start || 0, data3.bufferStart || 0, children, positions, -1, 0); + let length = (_a = data3.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0; + return new Tree3(types2[data3.topID], children.reverse(), positions.reverse(), length); } var nodeSizeCache3 = /* @__PURE__ */ new WeakMap(); -function nodeSize3(balanceType, node) { - if (!balanceType.isAnonymous || node instanceof TreeBuffer3 || node.type != balanceType) +function nodeSize3(balanceType, node2) { + if (!balanceType.isAnonymous || node2 instanceof TreeBuffer3 || node2.type != balanceType) return 1; - let size2 = nodeSizeCache3.get(node); + let size2 = nodeSizeCache3.get(node2); if (size2 == null) { size2 = 1; - for (let child of node.children) { + for (let child of node2.children) { if (child.type != balanceType || !(child instanceof Tree3)) { size2 = 1; break; } size2 += nodeSize3(balanceType, child); } - nodeSizeCache3.set(node, size2); + nodeSizeCache3.set(node2, size2); } return size2; } @@ -93637,9 +93749,9 @@ var stoppedInner3 = new NodeProp3({ perNode: true }); // node_modules/@lezer/highlight/dist/index.js var nextTagID2 = 0; var Tag2 = class { - constructor(set, base2, modified) { + constructor(set, base3, modified) { this.set = set; - this.base = base2; + this.base = base3; this.modified = modified; this.id = nextTagID2++; } @@ -93668,17 +93780,17 @@ var Modifier2 = class { this.instances = []; this.id = nextModifierID2++; } - static get(base2, mods) { + static get(base3, mods) { if (!mods.length) - return base2; - let exists = mods[0].instances.find((t5) => t5.base == base2 && sameArray2(mods, t5.modified)); + return base3; + let exists = mods[0].instances.find((t5) => t5.base == base3 && sameArray2(mods, t5.modified)); if (exists) return exists; - let set = [], tag2 = new Tag2(set, base2, mods); + let set = [], tag2 = new Tag2(set, base3, mods); for (let m4 of mods) m4.instances.push(tag2); let configs = powerSet(mods); - for (let parent of base2.set) + for (let parent of base3.set) if (!parent.modified.length) for (let config4 of configs) set.push(Modifier2.get(parent, config4)); @@ -93725,21 +93837,21 @@ var Rule2 = class { }; Rule2.empty = new Rule2([], 2, null); function tagHighlighter2(tags3, options) { - let map4 = /* @__PURE__ */ Object.create(null); + let map6 = /* @__PURE__ */ Object.create(null); for (let style of tags3) { if (!Array.isArray(style.tag)) - map4[style.tag.id] = style.class; + map6[style.tag.id] = style.class; else for (let tag2 of style.tag) - map4[tag2.id] = style.class; + map6[tag2.id] = style.class; } - let { scope, all: all2 = null } = options || {}; + let { scope, all: all6 = null } = options || {}; return { style: (tags4) => { - let cls = all2; + let cls = all6; for (let tag2 of tags4) { for (let sub2 of tag2.set) { - let tagClass = map4[sub2.id]; + let tagClass = map6[sub2.id]; if (tagClass) { cls = cls ? cls + " " + tagClass : tagClass; break; @@ -93957,8 +94069,8 @@ var createTheme = (_ref) => { dark: theme === "dark" }); var highlightStyle = import_language3.HighlightStyle.define(styles2); - var extension = [themeExtension, (0, import_language3.syntaxHighlighting)(highlightStyle)]; - return extension; + var extension2 = [themeExtension, (0, import_language3.syntaxHighlighting)(highlightStyle)]; + return extension2; }; // node_modules/@uiw/codemirror-theme-abcdef/esm/index.js @@ -94074,12 +94186,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { return {}; var target = {}; var sourceKeys = Object.keys(source); - var key2, i4; + var key3, i4; for (i4 = 0; i4 < sourceKeys.length; i4++) { - key2 = sourceKeys[i4]; - if (excluded.indexOf(key2) >= 0) + key3 = sourceKeys[i4]; + if (excluded.indexOf(key3) >= 0) continue; - target[key2] = source[key2]; + target[key3] = source[key3]; } return target; } @@ -94470,7 +94582,7 @@ function useCodeMirror(props) { readOnly = false, indentWithTab: defaultIndentWithTab = true, basicSetup: defaultBasicSetup = true, - root, + root: root4, initialState: initialState2 } = props; var [container, setContainer] = (0, import_react12.useState)(); @@ -94490,7 +94602,7 @@ function useCodeMirror(props) { } }); var updateListener = import_view8.EditorView.updateListener.of((vu) => { - if (vu.docChanged && typeof onChange === "function" && !vu.transactions.some((tr) => tr.annotation(External))) { + if (vu.docChanged && typeof onChange === "function" && !vu.transactions.some((tr2) => tr2.annotation(External))) { var doc = vu.state.doc; var _value = doc.toString(); onChange(_value, vu); @@ -94523,7 +94635,7 @@ function useCodeMirror(props) { var viewCurrent = new import_view8.EditorView({ state: stateCurrent, parent: container, - root + root: root4 }); setView(viewCurrent); onCreateEditor && onCreateEditor(viewCurrent, stateCurrent); @@ -94609,7 +94721,7 @@ var ReactCodeMirror = /* @__PURE__ */ (0, import_react13.forwardRef)((props, ref indentWithTab: indentWithTab2, editable, readOnly, - root, + root: root4, initialState: initialState2 } = props, other = _objectWithoutPropertiesLoose(props, _excluded); var editor = (0, import_react13.useRef)(null); @@ -94619,7 +94731,7 @@ var ReactCodeMirror = /* @__PURE__ */ (0, import_react13.forwardRef)((props, ref container } = useCodeMirror({ container: editor.current, - root, + root: root4, value, autoFocus, theme, @@ -94751,9 +94863,9 @@ var executeNode = async (executable, results, contexts, api) => { const actions = executeCodeBlocks(executable.node, "actions", executable.execActions, stylesResults); return actions; }; -var executeCode = (code, environment) => { - const isMultiLine = typeof code === "string" || code instanceof String ? code.includes("\n") : false; - const func = isMultiLine ? new Function(`with(this) { ${code} }`) : new Function(`with(this) { return ${code}; }`); +var executeCode = (code3, environment) => { + const isMultiLine = typeof code3 === "string" || code3 instanceof String ? code3.includes("\n") : false; + const func = isMultiLine ? new Function(`with(this) { ${code3} }`) : new Function(`with(this) { return ${code3}; }`); return func.call(environment); }; var executePropsCodeBlocks = async (executable, results, contexts, api) => { @@ -94766,51 +94878,51 @@ var executePropsCodeBlocks = async (executable, results, contexts, api) => { styles: results.state[id3]?.styles ?? {} }; environment.$contexts = contexts, environment.$api = api; - for (const { name: key2, isConst } of executable.execPropsOptions.props) { + for (const { name: key3, isConst } of executable.execPropsOptions.props) { try { let result; - if (key2 in (results.newState?.[id3]?.["props"] || {}) && isConst) { - result = results.newState[id3]["props"][key2]; + if (key3 in (results.newState?.[id3]?.["props"] || {}) && isConst) { + result = results.newState[id3]["props"][key3]; } else { - result = codeBlockStore[key2]?.call(environment); + result = codeBlockStore[key3]?.call(environment); } if (result !== null) { - environment[id3]["props"][key2] = result; - results.state[id3]["props"][key2] = result; + environment[id3]["props"][key3] = result; + results.state[id3]["props"][key3] = result; if (results.newState) { results.newState[id3] = results.newState[id3] ?? { props: {}, styles: {}, actions: {} }; - results.newState[id3]["props"][key2] = result; + results.newState[id3]["props"][key3] = result; } } else { - delete environment[id3]["props"][key2]; - delete results.state[id3]["props"][key2]; + delete environment[id3]["props"][key3]; + delete results.state[id3]["props"][key3]; if (results.newState?.[id3]) { - delete results.newState[id3]["props"][key2]; + delete results.newState[id3]["props"][key3]; } } } catch (error) { - console.log(key2, error); + console.log(key3, error); } } return results; }; -function executeCodeBlocks(node, type, codeBlockStore, results) { - const { id: id3 } = node; - for (const key2 of Object.keys(codeBlockStore)) { +function executeCodeBlocks(node2, type, codeBlockStore, results) { + const { id: id3 } = node2; + for (const key3 of Object.keys(codeBlockStore)) { let result; try { - if (key2 in (results.newState?.[id3]?.[type] || {})) { - result = results.newState[id3][type][key2]; + if (key3 in (results.newState?.[id3]?.[type] || {})) { + result = results.newState[id3][type][key3]; } else { - result = codeBlockStore[key2]?.call(results.state); + result = codeBlockStore[key3]?.call(results.state); } if (result !== null) { - results.state[node.id][type][key2] = result; + results.state[node2.id][type][key3] = result; } else { - delete results.state[node.id][type][key2]; + delete results.state[node2.id][type][key3]; } } catch (error) { - console.log(error, key2); + console.log(error, key3); } } return results; @@ -94999,8 +95111,8 @@ var filterFnTypes = { // src/core/utils/commands/filter.ts var filterForAny = (props, filters) => { - return filters.reduce((p, c3) => { - if (p == true) + return filters.reduce((p2, c3) => { + if (p2 == true) return true; return props ? filterForProps(props, c3) : false; }, false); @@ -95014,15 +95126,15 @@ var filterForProps = (props, def) => { return result; }; var filterPathsForAll = (props, filters) => { - return filters.reduce((p, c3) => { - if (p == false) + return filters.reduce((p2, c3) => { + if (p2 == false) return false; return props ? filterForProps(props, c3) : false; }, true); }; var resultForFilters = (filters, props) => { - const pathInFilter = filters.reduce((p, c3) => { - if (!p || c3.filters.length == 0) + const pathInFilter = filters.reduce((p2, c3) => { + if (!p2 || c3.filters.length == 0) return false; const result = c3.type == "any" ? filterForAny(props, c3.filters) : filterPathsForAll(props, c3.filters); return result; @@ -95050,7 +95162,7 @@ var runActionTree = async (superstate, actionTree, instance) => { props: { ...actionTree?.props ?? {}, ...Object.keys(actionTree.linked ?? {}).reduce( - (p, c3) => ({ ...p, [c3]: instance.instanceProps[actionTree.linked[c3]] }), + (p2, c3) => ({ ...p2, [c3]: instance.instanceProps[actionTree.linked[c3]] }), {} ), ...actionTree.result ? { [actionTree.result]: instance.result } : {} @@ -95110,7 +95222,7 @@ var runActionTree = async (superstate, actionTree, instance) => { // src/core/react/components/SpaceEditor/Actions/ActionTester.tsx var ActionTester = (props) => { - const path2 = props.superstate.pathsIndex.get(props.path); + const path3 = props.superstate.pathsIndex.get(props.path); const [fieldValues, setFieldValues] = (0, import_react14.useState)({}); const [result, setResult] = (0, import_react14.useState)(); const [error, setError] = (0, import_react14.useState)(); @@ -95128,7 +95240,7 @@ var ActionTester = (props) => { $api: props.superstate.api, $contexts: { $space: { - path: path2 + path: path3 }, $context: {} }, @@ -95151,9 +95263,9 @@ var ActionTester = (props) => { props.superstate.formulaContext, props.superstate.pathsIndex, props.code, - props.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}), + props.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}), values2, - path2, + path3, true ); } catch (e5) { @@ -95524,14 +95636,14 @@ var showPropertyMenu = (props) => { }; // src/core/react/components/UI/Menus/menu/concerns/matchers.js -function escapeForRegExp(string4) { - return string4.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); +function escapeForRegExp(string6) { + return string6.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); } -function matchAny(string4) { - return new RegExp(escapeForRegExp(string4), "gi"); +function matchAny(string6) { + return new RegExp(escapeForRegExp(string6), "gi"); } -function matchExact(string4) { - return new RegExp(`^${escapeForRegExp(string4)}$`, "i"); +function matchExact(string6) { + return new RegExp(`^${escapeForRegExp(string6)}$`, "i"); } // src/core/react/context/ContextEditorContext.tsx @@ -95663,7 +95775,7 @@ var PathProvider = (props) => { const removeFromSpace = (spacePath) => { removePathsFromSpace(props.superstate, spacePath, [pathState.path]); }; - const readMode = props.readMode; + const readMode = pathState?.type == "remote" || props.readMode; (0, import_react17.useEffect)(() => { const reloadPath = () => { if (!props.pathState) @@ -95792,41 +95904,41 @@ var FramesMDBProvider = (props) => { return frameData?.[frameSchema?.id]; }, [frameData, frameSchema]); const { spaceInfo, readMode } = (0, import_react19.useContext)(SpaceContext); - const deleteSchema = async (table) => { - if (table.primary) + const deleteSchema = async (table2) => { + if (table2.primary) return; - await props.superstate.spaceManager.deleteFrame(spaceInfo.path, table.id); + await props.superstate.spaceManager.deleteFrame(spaceInfo.path, table2.id); const newSchemaTable = { ...schemaTable, - rows: schemaTable.rows.filter((f2) => f2.id != table.id) + rows: schemaTable.rows.filter((f2) => f2.id != table2.id) }; setSchemaTable(newSchemaTable); }; - const saveSchema = async (table) => { - const newSchema = schemaTable.rows.find((f2) => f2.id == table.id) ? true : false; + const saveSchema = async (table2) => { + const newSchema = schemaTable.rows.find((f2) => f2.id == table2.id) ? true : false; const newSchemaTable = newSchema ? { ...schemaTable, rows: schemaTable.rows.map( - (f2) => f2.id == table.id ? frameSchemaToTableSchema(table) : f2 + (f2) => f2.id == table2.id ? frameSchemaToTableSchema(table2) : f2 ) } : { ...schemaTable, - rows: [...schemaTable.rows, frameSchemaToTableSchema(table)] + rows: [...schemaTable.rows, frameSchemaToTableSchema(table2)] }; if (!spaceInfo.readOnly) { await props.superstate.spaceManager.saveFrameSchema( spaceInfo.path, - table.id, - () => frameSchemaToTableSchema(table) + table2.id, + () => frameSchemaToTableSchema(table2) ); } - if (table.id == frameSchema?.id) { - setFrameSchema(table); + if (table2.id == frameSchema?.id) { + setFrameSchema(table2); setFrameData((f2) => ({ ...f2, - [table.id]: { - ...f2[table.id], - schema: frameSchemaToTableSchema(table) + [table2.id]: { + ...f2[table2.id], + schema: frameSchemaToTableSchema(table2) } })); } @@ -95842,7 +95954,7 @@ var FramesMDBProvider = (props) => { }, [schemaTable]); (0, import_react19.useEffect)(() => { if (schemaTable) { - setFrameSchema((p) => { + setFrameSchema((p2) => { if (props.schema) { const preselectSchema = mdbSchemaToFrameSchema( schemaTable.rows.find( @@ -95866,9 +95978,9 @@ var FramesMDBProvider = (props) => { return newSchema; } } else { - if (p) { + if (p2) { return mdbSchemaToFrameSchema( - schemaTable.rows?.find((g) => g.id == p.id) + schemaTable.rows?.find((g) => g.id == p2.id) ); } else { if (props.contextSchema) { @@ -95893,7 +96005,7 @@ var FramesMDBProvider = (props) => { } } } - return p; + return p2; }); } }, [schemaTable, props.contextSchema, props.schema]); @@ -95939,16 +96051,16 @@ var FramesMDBProvider = (props) => { (0, import_react19.useEffect)(() => { loadTables(); }, [spaceInfo, props.schema]); - const saveFrame = async (newTable, track = true) => { + const saveFrame = async (newTable, track2 = true) => { if (spaceInfo.readOnly) return; - if (track) { + if (track2) { setHistory((prevHistory) => [...prevHistory, newTable]); setFuture([]); } await props.superstate.spaceManager.saveFrame(spaceInfo.path, newTable).then((f2) => { - setFrameData((p) => ({ - ...p, + setFrameData((p2) => ({ + ...p2, [newTable.schema.id]: newTable })); }); @@ -96097,7 +96209,7 @@ var ContextEditorProvider = (props) => { ); return _views.length > 0 ? _views : frameSchema ? [frameSchema] : []; }, [frameSchemas, frameSchema, dbSchema]); - const defaultSchema = defaultContextTable; + const defaultSchema2 = defaultContextTable; const contexts = spaceCache?.contexts ?? []; const loadTables = async () => { const schemas = await props.superstate.spaceManager.tablesForSpace( @@ -96105,7 +96217,7 @@ var ContextEditorProvider = (props) => { ); if (schemas) setSchemaTable(() => ({ - ...defaultSchema, + ...defaultSchema2, rows: schemas })); }; @@ -96200,8 +96312,8 @@ var ContextEditorProvider = (props) => { () => tableData ? [ ...tableData.cols.map((f2) => ({ ...f2, table: "" })) ?? [], ...dbSchema?.primary == "true" ? contexts.reduce( - (p, c3) => [ - ...p, + (p2, c3) => [ + ...p2, ...contextTable[c3]?.cols.filter((f2) => f2.primary != "true").map((f2) => ({ ...f2, table: c3 })) ?? [] ], [] @@ -96209,9 +96321,9 @@ var ContextEditorProvider = (props) => { ] : [], [tableData, contextTable, contexts, dbSchema] ); - const data2 = (0, import_react20.useMemo)( - () => tableData?.rows.map((r2, index2) => ({ - _index: index2.toString(), + const data3 = (0, import_react20.useMemo)( + () => tableData?.rows.map((r2, index3) => ({ + _index: index3.toString(), ...r2, ...r2[PathPropertyName] ? { [PathPropertyName]: props.superstate.spaceManager.resolvePath( @@ -96219,7 +96331,7 @@ var ContextEditorProvider = (props) => { spaceCache?.path ) } : {}, - ...contexts.reduce((p, c3) => { + ...contexts.reduce((p2, c3) => { const contextRowIndexByPath = contextTable[c3]?.rows.findIndex( (f2) => f2[PathPropertyName] == r2[PathPropertyName] ) ?? -1; @@ -96229,7 +96341,7 @@ var ContextEditorProvider = (props) => { ).reduce((pa, ca) => ({ ...pa, [ca + c3]: contextRowsByPath[ca] }), { ["_index" + c3]: contextRowIndexByPath.toString() }); - return { ...p, ...contextRowsWithKeysAppended }; + return { ...p2, ...contextRowsWithKeysAppended }; }, {}) })) ?? [], [tableData, contextTable, cols, dbSchema, spaceCache] @@ -96257,64 +96369,64 @@ var ContextEditorProvider = (props) => { ); }, [cols, predicate]); const filteredData = (0, import_react20.useMemo)( - () => data2.filter((f2) => { - return (predicate?.filters ?? []).reduce((p, c3) => { - return p ? filterReturnForCol( + () => data3.filter((f2) => { + return (predicate?.filters ?? []).reduce((p2, c3) => { + return p2 ? filterReturnForCol( cols.find((col) => col.name + col.table == c3.field), c3, f2, spaceCache.properties - ) : p; + ) : p2; }, true); }).filter( (f2) => searchString?.length > 0 ? matchAny(searchString).test( Object.keys(f2).filter((g) => g.charAt(0) != "_").map((g) => f2[g]).join("|") ) : true ).sort((a4, b2) => { - return (predicate?.sort ?? []).reduce((p, c3) => { - return p == 0 ? sortReturnForCol( + return (predicate?.sort ?? []).reduce((p2, c3) => { + return p2 == 0 ? sortReturnForCol( cols.find((col) => col.name + col.table == c3.field), c3, a4, b2 - ) : p; + ) : p2; }, 0); }), - [predicate, data2, cols, searchString] + [predicate, data3, cols, searchString] ); - const updateValue2 = (column2, value, table, index2, path2) => { - const col = (table == "" ? tableData : contextTable[table])?.cols.find( + const updateValue2 = (column2, value, table2, index3, path3) => { + const col = (table2 == "" ? tableData : contextTable[table2])?.cols.find( (f2) => f2.name == column2 ); if (col) saveProperties( props.superstate, - path2 ?? tableData.rows[index2]?.[PathPropertyName], + path3 ?? tableData.rows[index3]?.[PathPropertyName], { [column2]: parseMDBValue(col.type, value) } ); - if (table == "") { + if (table2 == "") { saveDB({ ...tableData, rows: tableData.rows.map( - (r2, i4) => i4 == index2 ? { + (r2, i4) => i4 == index3 ? { ...r2, [column2]: value } : r2 ) }); - } else if (contextTable[table]) { - const path3 = tableData.rows[index2][PathPropertyName]; + } else if (contextTable[table2]) { + const path4 = tableData.rows[index3][PathPropertyName]; saveContextDB( { - ...contextTable[table], - rows: contextTable[table].rows.map( - (r2, i4) => r2[PathPropertyName] == path3 ? { + ...contextTable[table2], + rows: contextTable[table2].rows.map( + (r2, i4) => r2[PathPropertyName] == path4 ? { ...r2, [column2]: value } : r2 ) }, - table + table2 ); } }; @@ -96331,14 +96443,14 @@ var ContextEditorProvider = (props) => { ] : predicate.colsHidden.filter((s4) => s4 != col.name + col.table) }); }; - const updateFieldValue = (column2, fieldValue, value, table, index2, path2) => { + const updateFieldValue = (column2, fieldValue, value, table2, index3, path3) => { const col = tableData.cols.find((f2) => f2.name == column2); saveProperties( props.superstate, - path2 ?? tableData.rows[index2]?.[PathPropertyName], + path3 ?? tableData.rows[index3]?.[PathPropertyName], { [column2]: parseMDBValue(col.type, value) } ); - if (table == "") { + if (table2 == "") { const newTable = { ...tableData, cols: tableData.cols.map( @@ -96348,32 +96460,32 @@ var ContextEditorProvider = (props) => { } : m4 ), rows: tableData.rows.map( - (r2, i4) => i4 == index2 ? { + (r2, i4) => i4 == index3 ? { ...r2, [column2]: value } : r2 ) }; saveDB(newTable); - } else if (contextTable[table]) { - const path3 = tableData.rows[index2][PathPropertyName]; + } else if (contextTable[table2]) { + const path4 = tableData.rows[index3][PathPropertyName]; saveContextDB( { - ...contextTable[table], - cols: contextTable[table].cols.map( + ...contextTable[table2], + cols: contextTable[table2].cols.map( (m4) => m4.name == column2 ? { ...m4, value: fieldValue } : m4 ), - rows: contextTable[table].rows.map( - (r2, i4) => path3 == r2[PathPropertyName] ? { + rows: contextTable[table2].rows.map( + (r2, i4) => path4 == r2[PathPropertyName] ? { ...r2, [column2]: value } : r2 ) }, - table + table2 ); } }; @@ -96390,11 +96502,11 @@ var ContextEditorProvider = (props) => { ...rows.rows, { [PathPropertyName]: c3, - ...properties3 ? fmKeys.reduce((p, c4) => { + ...properties3 ? fmKeys.reduce((p2, c4) => { const value = parseProperty(c4, properties3[c4]); if (value?.length > 0) - return { ...p, [c4]: value }; - return p; + return { ...p2, [c4]: value }; + return p2; }, {}) : {} } ] @@ -96437,9 +96549,9 @@ var ContextEditorProvider = (props) => { if (!(dbSchema?.primary == "true")) return; if (lastSelected) { - const path2 = tableData.rows[parseInt(lastSelected)]?.[PathPropertyName]; - if (path2) - props.superstate.ui.setActivePath(path2); + const path3 = tableData.rows[parseInt(lastSelected)]?.[PathPropertyName]; + if (path3) + props.superstate.ui.setActivePath(path3); } else { props.superstate.ui.setActivePath(contextPath); } @@ -96472,10 +96584,10 @@ var ContextEditorProvider = (props) => { }; (0, import_react20.useEffect)(() => { if (predicate) - setPredicate((p) => ({ - ...p, + setPredicate((p2) => ({ + ...p2, colsOrder: uniq([ - ...p.colsOrder, + ...p2.colsOrder, ...cols.filter((f2) => f2.hidden != "true").map((c3) => c3.name + c3.table) ]) })); @@ -96496,11 +96608,11 @@ var ContextEditorProvider = (props) => { }; const delColumn = (column2) => { let mdbtable; - const table = column2.table; - if (table == "") { + const table2 = column2.table; + if (table2 == "") { mdbtable = tableData; - } else if (contextTable[table]) { - mdbtable = contextTable[table]; + } else if (contextTable[table2]) { + mdbtable = contextTable[table2]; } const newFields = mdbtable.cols.filter( (f2, i4) => f2.name != column2.name @@ -96513,10 +96625,10 @@ var ContextEditorProvider = (props) => { return rest; }) }; - if (table == "") { + if (table2 == "") { saveDB(newTable); - } else if (contextTable[table]) { - saveContextDB(newTable, table); + } else if (contextTable[table2]) { + saveContextDB(newTable, table2); } }; const newColumn = (col) => { @@ -96528,11 +96640,11 @@ var ContextEditorProvider = (props) => { ...newColumn2, name: sanitizeColumnName(newColumn2.name) }; - const table = column2.table; - if (table == "" || table == contextPath) { + const table2 = column2.table; + if (table2 == "" || table2 == contextPath) { mdbtable = tableData; - } else if (contextTable[table]) { - mdbtable = contextTable[table]; + } else if (contextTable[table2]) { + mdbtable = contextTable[table2]; } if (column2.name == "") { props.superstate.ui.notify(i18n_default.notice.noPropertyName); @@ -96582,14 +96694,14 @@ var ContextEditorProvider = (props) => { [oldColumn.name + oldColumn.table]: void 0 } }); - if (table == "") { + if (table2 == "") { if (dbSchema.id == defaultContextSchemaID) { syncAllProperties(newTable); } else { saveDB(newTable); } - } else if (contextTable[table]) { - saveContextDB(newTable, table); + } else if (contextTable[table2]) { + saveContextDB(newTable, table2); } return true; }; @@ -96628,8 +96740,8 @@ var ContextEditorProvider = (props) => { var import_react21 = __toESM(require_react()); function useCombinedRefs2(...refs) { return (0, import_react21.useMemo)( - () => (node) => { - refs.forEach((ref2) => ref2(node)); + () => (node2) => { + refs.forEach((ref2) => ref2(node2)); }, refs ); @@ -96793,8 +96905,8 @@ var allCacheTypesForPaths = (superstate, paths) => { return []; ; const properties3 = {}; - for (const path2 of paths) { - const f2 = superstate.pathsIndex.get(path2)?.metadata; + for (const path3 of paths) { + const f2 = superstate.pathsIndex.get(path3)?.metadata; if (f2) { Object.keys(f2).forEach((k2) => { const type = detectPropertyType(f2[k2], k2); @@ -96803,8 +96915,8 @@ var allCacheTypesForPaths = (superstate, paths) => { }); } } - return Object.keys(properties3).reduce((p, c3) => { - return [...p, { name: c3, type: properties3[c3][0] }]; + return Object.keys(properties3).reduce((p2, c3) => { + return [...p2, { name: c3, type: properties3[c3][0] }]; }, []); }; @@ -97190,9 +97302,9 @@ var SpacePropertyEditor = (props) => { const [openNodes, setOpenNodes] = (0, import_react25.useState)([]); const [overId, setOverId] = (0, import_react25.useState)(""); const contextProperties = (0, import_react25.useMemo)(() => { - return props.contexts.reduce((p, c3) => { + return props.contexts.reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { path: props.superstate.pathsIndex.get(tagSpacePathFromTag(c3)), space: props.superstate.spacesIndex.get(tagSpacePathFromTag(c3)), @@ -97347,9 +97459,9 @@ var SpacePropertyEditor = (props) => { }, /* @__PURE__ */ import_react25.default.createElement(SortableContext, { items, strategy: verticalListSortingStrategy - }, items.map((value, index2) => { + }, items.map((value, index3) => { return /* @__PURE__ */ import_react25.default.createElement(SortableItem, { - key: index2, + key: index3, id: value.id, field: value, superstate: props.superstate, @@ -97455,35 +97567,35 @@ var import_react46 = __toESM(require_react()); var import_react45 = __toESM(require_react()); // src/core/utils/contexts/embed.ts -var framePathForSpace = (space2, schema) => { - if (space2.type == "folder") { - return `${space2.path}/#*${schema}`; +var framePathForSpace = (space3, schema) => { + if (space3.type == "folder") { + return `${space3.path}/#*${schema}`; } - if (space2.type == "vault") { + if (space3.type == "vault") { return `/#*${schema}`; } - return `${space2.path}/#*${schema}`; + return `${space3.path}/#*${schema}`; }; -var actionPathForSpace = (space2, schema) => { - if (space2.type == "folder") { - return `${space2.path}/#;${schema}`; +var actionPathForSpace = (space3, schema) => { + if (space3.type == "folder") { + return `${space3.path}/#;${schema}`; } - if (space2.type == "vault") { + if (space3.type == "vault") { return `/#;${schema}`; } - return `${space2.path}/#;${schema}`; + return `${space3.path}/#;${schema}`; }; -var contextPathForSpace = (space2, schema) => { - if (space2.type == "folder") { - return `${space2.path}/#^${schema}`; +var contextPathForSpace = (space3, schema) => { + if (space3.type == "folder") { + return `${space3.path}/#^${schema}`; } - if (space2.type == "vault") { + if (space3.type == "vault") { return `/#^${schema}`; } - return `${space2.path}/#^${schema}`; + return `${space3.path}/#^${schema}`; }; -var contextViewEmbedStringFromContext = (space2, schema) => `![![${framePathForSpace(space2, schema)}]]`; -var contextEmbedStringFromContext = (space2, schema) => `![![${contextPathForSpace(space2, schema)}]]`; +var contextViewEmbedStringFromContext = (space3, schema) => `![![${framePathForSpace(space3, schema)}]]`; +var contextEmbedStringFromContext = (space3, schema) => `![![${contextPathForSpace(space3, schema)}]]`; // src/core/react/components/SpaceEditor/ActionsList.tsx var import_react26 = __toESM(require_react()); @@ -97634,8 +97746,8 @@ var import_react27 = __toESM(require_react()); var PathStickerView = (props) => { const { pathState } = props; const sticker = pathState?.label?.sticker; - const color2 = pathState?.label?.color; - const extension = pathState?.type; + const color3 = pathState?.label?.color; + const extension2 = pathState?.type; const triggerStickerContextMenu = (e5) => { if (!pathState) return; @@ -97690,8 +97802,8 @@ var PathStickerView = (props) => { }) : /* @__PURE__ */ import_react27.default.createElement("button", { "aria-label": i18n_default.buttons.changeIcon, onContextMenu: triggerStickerContextMenu, - style: color2?.length > 0 ? { - "--label-color": `${color2}`, + style: color3?.length > 0 ? { + "--label-color": `${color3}`, "--icon-color": `#ffffff` } : { "--icon-color": `var(--mk-ui-text-secondary)` @@ -97734,18 +97846,18 @@ var PathStickerContainer = (props) => { // src/core/react/components/UI/Crumbs/PathCrumb.tsx var PathCrumb = (props) => { - const path2 = (0, import_react28.useMemo)( + const path3 = (0, import_react28.useMemo)( () => props.source && props.path ? props.superstate.spaceManager.resolvePath(props.path, props.source) : props.path, [props.source, props.path] ); const [cache2, setCache] = (0, import_react28.useState)( - props.superstate.pathsIndex.get(path2) + props.superstate.pathsIndex.get(path3) ); const reloadCache = () => { - setCache(props.superstate.pathsIndex.get(path2)); + setCache(props.superstate.pathsIndex.get(path3)); }; const reloadIcon = (payload) => { - if (payload.path == path2) { + if (payload.path == path3) { reloadCache(); } }; @@ -97761,11 +97873,11 @@ var PathCrumb = (props) => { reloadIcon ); }; - }, [path2]); + }, [path3]); return /* @__PURE__ */ import_react28.default.createElement("div", { className: "mk-path", - "aria-label": path2, - onClick: () => props.superstate.ui.openPath(cache2?.path ?? path2, false), + "aria-label": path3, + onClick: () => props.superstate.ui.openPath(cache2?.path ?? path3, false), onContextMenu: (e5) => cache2 && showPathContextMenu(props.superstate, cache2.path, null, { x: e5.clientX, y: e5.clientY, @@ -97775,7 +97887,7 @@ var PathCrumb = (props) => { }, cache2 && /* @__PURE__ */ import_react28.default.createElement(PathStickerView, { superstate: props.superstate, pathState: cache2 - }), /* @__PURE__ */ import_react28.default.createElement("span", null, (!props.hideName && cache2?.displayName) ?? path2), props.children); + }), /* @__PURE__ */ import_react28.default.createElement("span", null, (!props.hideName && cache2?.displayName) ?? path3), props.children); }; // src/core/react/components/UI/Menus/properties/datePickerMenu.tsx @@ -97787,9 +97899,9 @@ var __assign = function() { __assign = Object.assign || function __assign4(t5) { for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) { s4 = arguments[i4]; - for (var p in s4) - if (Object.prototype.hasOwnProperty.call(s4, p)) - t5[p] = s4[p]; + for (var p2 in s4) + if (Object.prototype.hasOwnProperty.call(s4, p2)) + t5[p2] = s4[p2]; } return t5; }; @@ -97797,13 +97909,13 @@ var __assign = function() { }; function __rest(s4, e5) { var t5 = {}; - for (var p in s4) - if (Object.prototype.hasOwnProperty.call(s4, p) && e5.indexOf(p) < 0) - t5[p] = s4[p]; + for (var p2 in s4) + if (Object.prototype.hasOwnProperty.call(s4, p2) && e5.indexOf(p2) < 0) + t5[p2] = s4[p2]; if (s4 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i4 = 0, p = Object.getOwnPropertySymbols(s4); i4 < p.length; i4++) { - if (e5.indexOf(p[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p[i4])) - t5[p[i4]] = s4[p[i4]]; + for (var i4 = 0, p2 = Object.getOwnPropertySymbols(s4); i4 < p2.length; i4++) { + if (e5.indexOf(p2[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p2[i4])) + t5[p2[i4]] = s4[p2[i4]]; } return t5; } @@ -97825,14 +97937,14 @@ function requireReactJsxRuntime_production_min() { if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min; hasRequiredReactJsxRuntime_production_min = 1; - var f2 = import_react29.default, k2 = Symbol.for("react.element"), l2 = Symbol.for("react.fragment"), m4 = Object.prototype.hasOwnProperty, n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true }; + var f2 = import_react29.default, k2 = Symbol.for("react.element"), l2 = Symbol.for("react.fragment"), m4 = Object.prototype.hasOwnProperty, n3 = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p2 = { key: true, ref: true, __self: true, __source: true }; function q2(c3, a4, g) { var b2, d4 = {}, e5 = null, h3 = null; void 0 !== g && (e5 = "" + g); void 0 !== a4.key && (e5 = "" + a4.key); void 0 !== a4.ref && (h3 = a4.ref); for (b2 in a4) - m4.call(a4, b2) && !p.hasOwnProperty(b2) && (d4[b2] = a4[b2]); + m4.call(a4, b2) && !p2.hasOwnProperty(b2) && (d4[b2] = a4[b2]); if (c3 && c3.defaultProps) for (b2 in a4 = c3.defaultProps, a4) void 0 === d4[b2] && (d4[b2] = a4[b2]); @@ -98297,10 +98409,10 @@ function Caption(props) { return jsxRuntimeExports.jsx("div", { className: classNames13.caption, style: styles2.caption, children: caption }); } function Footer(props) { - var _a = useDayPicker(), footer = _a.footer, styles2 = _a.styles, tfoot = _a.classNames.tfoot; - if (!footer) + var _a = useDayPicker(), footer2 = _a.footer, styles2 = _a.styles, tfoot2 = _a.classNames.tfoot; + if (!footer2) return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); - return jsxRuntimeExports.jsx("tfoot", { className: tfoot, style: styles2.tfoot, children: jsxRuntimeExports.jsx("tr", { children: jsxRuntimeExports.jsx("td", { colSpan: 8, children: footer }) }) }); + return jsxRuntimeExports.jsx("tfoot", { className: tfoot2, style: styles2.tfoot, children: jsxRuntimeExports.jsx("tr", { children: jsxRuntimeExports.jsx("td", { colSpan: 8, children: footer2 }) }) }); } function getWeekdays(locale2, weekStartsOn, ISOWeek) { var start = ISOWeek ? startOfISOWeek(new Date()) : startOfWeek(new Date(), { locale: locale2, weekStartsOn }); @@ -98357,10 +98469,10 @@ function SelectMultipleProviderInternal(_a) { } var selectedDays = selected ? __spreadArray([], selected, true) : []; if (activeModifiers.selected) { - var index2 = selectedDays.findIndex(function(selectedDay) { + var index3 = selectedDays.findIndex(function(selectedDay) { return isSameDay(day, selectedDay); }); - selectedDays.splice(index2, 1); + selectedDays.splice(index3, 1); } else { selectedDays.push(day); } @@ -98687,10 +98799,10 @@ function isMatch(day, matchers) { }); } function getActiveModifiers(day, modifiers, displayMonth) { - var matchedModifiers = Object.keys(modifiers).reduce(function(result, key2) { - var modifier = modifiers[key2]; + var matchedModifiers = Object.keys(modifiers).reduce(function(result, key3) { + var modifier = modifiers[key3]; if (isMatch(day, modifier)) { - result.push(key2); + result.push(key3); } return result; }, []); @@ -99115,15 +99227,15 @@ function Day(props) { function WeekNumber(props) { var weekNumber = props.number, dates = props.dates; var _a = useDayPicker(), onWeekNumberClick = _a.onWeekNumberClick, styles2 = _a.styles, classNames13 = _a.classNames, locale2 = _a.locale, labelWeekNumber2 = _a.labels.labelWeekNumber, formatWeekNumber2 = _a.formatters.formatWeekNumber; - var content3 = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); + var content5 = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); if (!onWeekNumberClick) { - return jsxRuntimeExports.jsx("span", { className: classNames13.weeknumber, style: styles2.weeknumber, children: content3 }); + return jsxRuntimeExports.jsx("span", { className: classNames13.weeknumber, style: styles2.weeknumber, children: content5 }); } var label = labelWeekNumber2(Number(weekNumber), { locale: locale2 }); var handleClick = function(e5) { onWeekNumberClick(weekNumber, dates, e5); }; - return jsxRuntimeExports.jsx(Button, { name: "week-number", "aria-label": label, className: classNames13.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content3 }); + return jsxRuntimeExports.jsx(Button, { name: "week-number", "aria-label": label, className: classNames13.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content5 }); } function Row(props) { var _a, _b; @@ -99285,11 +99397,11 @@ function Root(_a) { classNames13.push(dayPicker.classNames.with_weeknumber); } var style = __assign(__assign({}, dayPicker.styles.root), dayPicker.style); - var dataAttributes = Object.keys(initialProps).filter(function(key2) { - return key2.startsWith("data-"); - }).reduce(function(attrs, key2) { + var dataAttributes = Object.keys(initialProps).filter(function(key3) { + return key3.startsWith("data-"); + }).reduce(function(attrs, key3) { var _a2; - return __assign(__assign({}, attrs), (_a2 = {}, _a2[key2] = initialProps[key2], _a2)); + return __assign(__assign({}, attrs), (_a2 = {}, _a2[key3] = initialProps[key3], _a2)); }, {}); var MonthsComponent = (_c = (_b = initialProps.components) === null || _b === void 0 ? void 0 : _b.Months) !== null && _c !== void 0 ? _c : Months; return jsxRuntimeExports.jsx("div", __assign({ className: classNames13.join(" "), style, dir: dayPicker.dir, id: dayPicker.id, nonce: initialProps.nonce, title: initialProps.title, lang: initialProps.lang }, dataAttributes, { children: jsxRuntimeExports.jsx(MonthsComponent, { children: navigation.displayMonths.map(function(month, i4) { @@ -99472,8 +99584,8 @@ var import_react39 = __toESM(require_react()); // src/core/react/components/UI/Menus/navigator/showSpaceAddMenu.tsx var import_react31 = __toESM(require_react()); -var defaultAddAction = (superstate, space2, location) => { - if (space2?.path == "spaces://$tags") { +var defaultAddAction = (superstate, space3, location) => { + if (space3?.path == "spaces://$tags") { superstate.ui.openModal("New Tag", (props) => { return /* @__PURE__ */ import_react31.default.createElement(InputModal, { value: "", @@ -99482,12 +99594,12 @@ var defaultAddAction = (superstate, space2, location) => { saveValue: (value) => addTag(superstate, value) }); }); - } else if (space2) { - if (space2?.metadata.template?.length > 0) { - newTemplateInSpace(superstate, space2, space2.metadata.template, location); + } else if (space3) { + if (space3?.metadata.template?.length > 0) { + newTemplateInSpace(superstate, space3, space3.metadata.template, location); return; } else { - newPathInSpace(superstate, space2, "md", null, false, null, location); + newPathInSpace(superstate, space3, "md", null, false, null, location); } } else { defaultSpace( @@ -99499,9 +99611,9 @@ var defaultAddAction = (superstate, space2, location) => { }); } }; -var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { +var showSpaceAddMenu = (superstate, offset2, space3, dontOpen) => { const menuOptions = []; - if (space2.type == "default") { + if (space3.type == "default") { menuOptions.push({ name: "New Tag", icon: "ui//tags", @@ -99523,7 +99635,7 @@ var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { onClick: (e5) => { newPathInSpace( superstate, - space2, + space3, "md", superstate.settings.newNotePlaceholder, dontOpen @@ -99534,7 +99646,7 @@ var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { name: i18n_default.buttons.createCanvas, icon: "ui//layout-dashboard", onClick: (e5) => { - newPathInSpace(superstate, space2, "canvas", null, dontOpen); + newPathInSpace(superstate, space3, "canvas", null, dontOpen); } }); menuOptions.push({ @@ -99548,7 +99660,7 @@ var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { value: "", hide: props.hide, saveValue: (v2) => { - let pathState = superstate.pathsIndex.get(space2?.path); + let pathState = superstate.pathsIndex.get(space3?.path); if (!pathState) { pathState = superstate.pathsIndex.get("/"); } @@ -99569,14 +99681,14 @@ var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { ); } }); - if (space2.templates.length > 0) { + if (space3.templates.length > 0) { menuOptions.push(menuSeparator); - for (const template2 of space2.templates) { + for (const template2 of space3.templates) { menuOptions.push({ name: template2, icon: "ui//clipboard-pen", onClick: (e5) => { - newTemplateInSpace(superstate, space2, template2); + newTemplateInSpace(superstate, space3, template2); } }); } @@ -99589,7 +99701,7 @@ var showSpaceAddMenu = (superstate, offset2, space2, dontOpen) => { }; // src/core/react/components/UI/Menus/properties/propertyMenu.tsx -var showSetValueMenu = (rect, superstate, property, onChangeValue, path2) => { +var showSetValueMenu = (rect, superstate, property, onChangeValue, path3) => { if (!property) return; if (property.type == "text") { @@ -99607,7 +99719,7 @@ var showSetValueMenu = (rect, superstate, property, onChangeValue, path2) => { 0 /* None */ ); } else if (property.type == "option") { - const options = parseFieldValue(property.value, property.type, superstate, path2)?.options ?? []; + const options = parseFieldValue(property.value, property.type, superstate, path3)?.options ?? []; superstate.ui.openMenu(rect, { ...defaultMenu(superstate.ui, options), saveOptions: (options2, value) => { @@ -99913,18 +100025,18 @@ var FilterBar = (props) => { } = (0, import_react38.useContext)(ContextEditorContext); const { frameSchema, saveSchema, setFrameSchema } = (0, import_react38.useContext)(FramesMDBContext); const properties3 = spaceCache?.propertyTypes ?? []; - const propertiesForFrame = (path2) => { - if (!path2) + const propertiesForFrame = (path3) => { + if (!path3) return []; - const uri = props.superstate.spaceManager.uriByString(path2); + const uri = props.superstate.spaceManager.uriByString(path3); if (uri.authority == "$kit") { - const node = props.superstate.kitFrames.get(uri.ref).node; - return Object.keys(node.types).map((f2) => ({ - type: node.types[f2], + const node2 = props.superstate.kitFrames.get(uri.ref).node; + return Object.keys(node2.types).map((f2) => ({ + type: node2.types[f2], name: f2, - attrs: JSON.stringify(node.propsAttrs?.[f2]), - schemaId: node.schemaId, - value: JSON.stringify(node.propsValue?.[f2]) + attrs: JSON.stringify(node2.propsAttrs?.[f2]), + schemaId: node2.schemaId, + value: JSON.stringify(node2.propsValue?.[f2]) })).filter((f2) => !f2.name.startsWith("_")); } else { return props.superstate.framesIndex.get(uri.path)?.frames[uri.ref].cols.filter((f2) => !f2.name.startsWith("_")); @@ -100017,9 +100129,9 @@ var FilterBar = (props) => { colsHidden: [] }); }; - const removeFilter = (filter4, index2) => { + const removeFilter = (filter4, index3) => { const pred = predicate ?? defaultPredicateForSchema(dbSchema); - const newFilters = [...pred.filters.filter((f2, i4) => i4 != index2)]; + const newFilters = [...pred.filters.filter((f2, i4) => i4 != index3)]; savePredicate({ filters: newFilters }); @@ -100174,13 +100286,13 @@ var FilterBar = (props) => { }; const selectSource = (e5) => { const offset2 = e5.target.getBoundingClientRect(); - showSpacesMenu(offset2, props.superstate, (link) => { + showSpacesMenu(offset2, props.superstate, (link3) => { const newSchema = { ...frameSchema, name: frameSchema.name, def: { db: dbSchema.id, - context: link + context: link3 }, type: "view" }; @@ -100423,7 +100535,7 @@ var FilterBar = (props) => { openSpaceEditorModal(props.superstate, sourceCache, 1); } }; - const changeFilterMenu = (e5, filter4, index2) => { + const changeFilterMenu = (e5, filter4, index3) => { const offset2 = e5.target.getBoundingClientRect(); const saveFilter = (_15, newType) => { const type = newType[0]; @@ -100434,7 +100546,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -100581,13 +100693,13 @@ var FilterBar = (props) => { "right" ); }; - const selectFilterValue = (e5, filter4, index2) => { + const selectFilterValue = (e5, filter4, index3) => { switch (filter4.fType ?? filterFnTypes[filter4.fn].valueType) { case "property": { savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? filter4 : s4 + (s4, i4) => i4 == index3 ? filter4 : s4 ) }); } @@ -100597,7 +100709,7 @@ var FilterBar = (props) => { { savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? filter4 : s4 + (s4, i4) => i4 == index3 ? filter4 : s4 ) }); } @@ -100610,7 +100722,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -100629,10 +100741,10 @@ var FilterBar = (props) => { { const col = cols.find((f2) => f2.name + f2.table == filter4.field); if (col?.type.startsWith("context")) { - const space2 = parseFieldValue(col.value, col.type)?.space; - if (!space2) + const space3 = parseFieldValue(col.value, col.type)?.space; + if (!space3) return; - const contextData = props.superstate.contextsIndex.get(space2)?.paths ?? []; + const contextData = props.superstate.contextsIndex.get(space3)?.paths ?? []; const offset3 = e5.target.getBoundingClientRect(); props.superstate.ui.openMenu(offset3, { ui: props.superstate.ui, @@ -100650,7 +100762,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }, @@ -100660,14 +100772,14 @@ var FilterBar = (props) => { }); return; } - const saveValue = (link) => { + const saveValue = (link3) => { const newFilter = { ...filter4, - value: link + value: link3 }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -100675,8 +100787,8 @@ var FilterBar = (props) => { showLinkMenu( offset2, props.superstate, - (link) => { - saveValue(link); + (link3) => { + saveValue(link3); }, { multi: true } ); @@ -100693,7 +100805,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -100712,10 +100824,10 @@ var FilterBar = (props) => { showAll: true }); } else if (col.type.startsWith("context")) { - const space2 = parseFieldValue(col.value, col.type)?.space; - if (!space2) + const space3 = parseFieldValue(col.value, col.type)?.space; + if (!space3) return; - const contextData = props.superstate.contextsIndex.get(space2)?.paths ?? []; + const contextData = props.superstate.contextsIndex.get(space3)?.paths ?? []; const offset2 = e5.target.getBoundingClientRect(); props.superstate.ui.openMenu(offset2, { ui: props.superstate.ui, @@ -100736,8 +100848,8 @@ var FilterBar = (props) => { showLinkMenu( offset2, props.superstate, - (link) => { - saveOptions([link], [link]); + (link3) => { + saveOptions([link3], [link3]); }, { multi: true } ); @@ -101041,8 +101153,8 @@ var SpaceQuery = (props) => { } }; const addDefGroup = () => { - setFilters((p) => [ - ...p, + setFilters((p2) => [ + ...p2, { type: "any", trueFalse: true, @@ -101434,7 +101546,7 @@ var SpaceItems = (props) => { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//live") }, - onClick: () => setSmartSearch((p) => !p) + onClick: () => setSmartSearch((p2) => !p2) }), /* @__PURE__ */ import_react40.default.createElement("button", { className: "mk-button-new", "aria-label": i18n_default.buttons.addItem, @@ -101443,9 +101555,9 @@ var SpaceItems = (props) => { showLinkMenu( offset2, props.superstate, - (link) => saveMetadata({ + (link3) => saveMetadata({ ...metadata, - links: [...metadata.links ?? [], link] + links: [...metadata.links ?? [], link3] }) ); e5.stopPropagation(); @@ -101524,8 +101636,8 @@ var TemplatesList = (props) => { }, [pathState]); const newAction = (e5) => { const offset2 = e5.target.getBoundingClientRect(); - showLinkMenu(offset2, props.superstate, (space2) => { - saveSpaceTemplate(props.superstate, pathState.path, space2); + showLinkMenu(offset2, props.superstate, (space3) => { + saveSpaceTemplate(props.superstate, pathState.path, space3); }); e5.stopPropagation(); }; @@ -101770,17 +101882,17 @@ var TableList = (props) => { icon: "ui//move", onClick: (e6) => { const offset2 = e6.target.getBoundingClientRect(); - showSpacesMenu(offset2, props.superstate, (space2) => { - const table = props.superstate.contextsIndex.get(spaceState.path).tables?.[_schema.id]; - table.schema.id = uniqueNameFromString( - sanitizeTableName(table.schema.id), - Object.keys(props.superstate.contextsIndex.get(space2).tables) + showSpacesMenu(offset2, props.superstate, (space3) => { + const table2 = props.superstate.contextsIndex.get(spaceState.path).tables?.[_schema.id]; + table2.schema.id = uniqueNameFromString( + sanitizeTableName(table2.schema.id), + Object.keys(props.superstate.contextsIndex.get(space3).tables) ); - table.cols = table.cols.map((f2) => ({ + table2.cols = table2.cols.map((f2) => ({ ...f2, - schemaId: table.schema.id + schemaId: table2.schema.id })); - props.superstate.spaceManager.createTable(space2, table.schema).then((f2) => props.superstate.spaceManager.saveTable(space2, table)); + props.superstate.spaceManager.createTable(space3, table2.schema).then((f2) => props.superstate.spaceManager.saveTable(space3, table2)); }); } }); @@ -101795,23 +101907,23 @@ var TableList = (props) => { hide: _props.hide, saveLabel: "Save", saveValue: (value) => { - const table = props.superstate.contextsIndex.get( + const table2 = props.superstate.contextsIndex.get( spaceState.path ).tables?.[_schema.id]; - table.schema.id = uniqueNameFromString( + table2.schema.id = uniqueNameFromString( sanitizeTableName(value), Object.keys( props.superstate.contextsIndex.get(spaceState.path).tables ) ); - table.cols = table.cols.map((f2) => ({ + table2.cols = table2.cols.map((f2) => ({ ...f2, - schemaId: table.schema.id + schemaId: table2.schema.id })); - props.superstate.spaceManager.createTable(spaceState.path, table.schema).then( + props.superstate.spaceManager.createTable(spaceState.path, table2.schema).then( (f2) => props.superstate.spaceManager.saveTable( spaceState.path, - table + table2 ) ); } @@ -101893,7 +102005,7 @@ var TableList = (props) => { // src/core/react/components/SpaceEditor/SpaceEditor.tsx var SpaceEditor = (props) => { - const [tab, setTab] = (0, import_react45.useState)( + const [tab2, setTab] = (0, import_react45.useState)( props.space?.type == "tag" ? Math.max(1, props.tab) : props.tab ); return /* @__PURE__ */ import_react45.default.createElement("div", { @@ -101903,35 +102015,35 @@ var SpaceEditor = (props) => { }, props.space?.type != "tag" && /* @__PURE__ */ import_react45.default.createElement("div", { "aria-label": i18n_default.subViews.spaceItems, onClick: () => setTab(0), - className: `mk-tab ${tab == 0 ? "mk-active" : ""}`, + className: `mk-tab ${tab2 == 0 ? "mk-active" : ""}`, dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//file-stack") } }), /* @__PURE__ */ import_react45.default.createElement("div", { "aria-label": i18n_default.subViews.spaceContext, onClick: () => setTab(1), - className: `mk-tab ${tab == 1 ? "mk-active" : ""}`, + className: `mk-tab ${tab2 == 1 ? "mk-active" : ""}`, dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//list") } }), /* @__PURE__ */ import_react45.default.createElement("div", { "aria-label": i18n_default.subViews.spaceLists, onClick: () => setTab(2), - className: `mk-tab ${tab == 2 ? "mk-active" : ""}`, + className: `mk-tab ${tab2 == 2 ? "mk-active" : ""}`, dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//layout-list") } }), /* @__PURE__ */ import_react45.default.createElement("div", { "aria-label": i18n_default.subViews.spaceActions, onClick: () => setTab(3), - className: `mk-tab ${tab == 3 ? "mk-active" : ""}`, + className: `mk-tab ${tab2 == 3 ? "mk-active" : ""}`, dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//mouse-pointer-click") } }), /* @__PURE__ */ import_react45.default.createElement("div", { "aria-label": i18n_default.subViews.spaceTemplates, onClick: () => setTab(4), - className: `mk-tab ${tab == 4 ? "mk-active" : ""}`, + className: `mk-tab ${tab2 == 4 ? "mk-active" : ""}`, dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//clipboard-pen") } @@ -101941,22 +102053,22 @@ var SpaceEditor = (props) => { readMode: false }, /* @__PURE__ */ import_react45.default.createElement(SpaceProvider, { superstate: props.superstate - }, tab == 0 ? /* @__PURE__ */ import_react45.default.createElement(SpaceItems, { + }, tab2 == 0 ? /* @__PURE__ */ import_react45.default.createElement(SpaceItems, { superstate: props.superstate, space: props.space - }) : tab == 1 ? /* @__PURE__ */ import_react45.default.createElement(FramesMDBProvider, { + }) : tab2 == 1 ? /* @__PURE__ */ import_react45.default.createElement(FramesMDBProvider, { superstate: props.superstate }, /* @__PURE__ */ import_react45.default.createElement(ContextEditorProvider, { superstate: props.superstate }, /* @__PURE__ */ import_react45.default.createElement(SpacePropertyEditorContext, { superstate: props.superstate - }))) : tab == 2 ? /* @__PURE__ */ import_react45.default.createElement(TableList, { + }))) : tab2 == 2 ? /* @__PURE__ */ import_react45.default.createElement(TableList, { superstate: props.superstate, hide: props.close - }) : tab == 3 ? /* @__PURE__ */ import_react45.default.createElement(ActionsList, { + }) : tab2 == 3 ? /* @__PURE__ */ import_react45.default.createElement(ActionsList, { superstate: props.superstate, close: props.close - }) : tab == 4 ? /* @__PURE__ */ import_react45.default.createElement(TemplatesList, { + }) : tab2 == 4 ? /* @__PURE__ */ import_react45.default.createElement(TemplatesList, { superstate: props.superstate, close: props.close }) : /* @__PURE__ */ import_react45.default.createElement(import_react45.default.Fragment, null)))); @@ -101964,13 +102076,13 @@ var SpaceEditor = (props) => { var SpaceEditor_default = SpaceEditor; // src/core/react/components/UI/Modals/ContextEditor.tsx -var openSpaceEditorModal = (superstate, space2, tab) => { +var openSpaceEditorModal = (superstate, space3, tab2) => { superstate.ui.openModal( - space2.name, + space3.name, (props) => /* @__PURE__ */ import_react46.default.createElement(SpaceEditor_default, { superstate, - space: space2, - tab, + space: space3, + tab: tab2, close: () => { props.hide(); } @@ -102017,39 +102129,39 @@ var SpacePropertyEditorContext = (props) => { }; // src/core/react/components/UI/Menus/navigator/spaceContextMenu.tsx -var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onClose) => { - const space2 = superstate.spacesIndex.get(path2.path); - if (!space2) +var showSpaceContextMenu = (superstate, path3, e5, activePath, parentSpace, onClose) => { + const space3 = superstate.spacesIndex.get(path3.path); + if (!space3) return; const menuOptions = []; menuOptions.push({ name: "New", type: 6 /* Submenu */, onSubmenu: (offset2) => { - return showSpaceAddMenu(superstate, offset2, space2); + return showSpaceAddMenu(superstate, offset2, space3); }, icon: "ui//plus" }); - if (space2.type == "folder") { + if (space3.type == "folder") { menuOptions.push({ name: i18n_default.buttons.addIntoSpace, icon: "ui//pin", onClick: (e6) => { const offset2 = e6.target.getBoundingClientRect(); - showLinkMenu(offset2, superstate, (link) => { - pinPathToSpaceAtIndex(superstate, space2, link); + showLinkMenu(offset2, superstate, (link3) => { + pinPathToSpaceAtIndex(superstate, space3, link3); }); e6.stopPropagation(); } }); } menuOptions.push(menuSeparator); - if (space2.type != "default") { + if (space3.type != "default") { menuOptions.push({ name: i18n_default.labels.renameSection, icon: "ui//edit", onClick: (e6) => { - openSpaceEditorModal(superstate, space2, 0); + openSpaceEditorModal(superstate, space3, 0); } }); } @@ -102063,7 +102175,7 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl }); } menuOptions.push(menuSeparator); - if (space2.type == "folder") { + if (space3.type == "folder") { menuOptions.push({ name: i18n_default.buttons.addToSpace, icon: "ui//pin", @@ -102072,10 +102184,10 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl showSpacesMenu( offset2, superstate, - (link) => { - const spaceCache = superstate.spacesIndex.get(link); + (link3) => { + const spaceCache = superstate.spacesIndex.get(link3); if (spaceCache) - addPathToSpaceAtIndex(superstate, spaceCache, space2.path, -1); + addPathToSpaceAtIndex(superstate, spaceCache, space3.path, -1); }, true ); @@ -102089,17 +102201,17 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl name: "Save as Template", icon: "ui//clipboard-add", onClick: (e6) => { - saveSpaceTemplate(superstate, space2.path, parentSpace); + saveSpaceTemplate(superstate, space3.path, parentSpace); } }); - if (parentSpace != path2.parent) { + if (parentSpace != path3.parent) { const spaceCache = superstate.spacesIndex.get(parentSpace); if (spaceCache) { menuOptions.push({ name: i18n_default.menu.removeFromSpace, icon: "ui//pin-off", onClick: (e6) => { - removePathsFromSpace(superstate, spaceCache.path, [space2.path]); + removePathsFromSpace(superstate, spaceCache.path, [space3.path]); } }); } @@ -102116,7 +102228,7 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl superstate, offset2, "", - (value) => savePathColor(superstate, space2.path, value) + (value) => savePathColor(superstate, space3.path, value) ); } }); @@ -102127,7 +102239,7 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react47.default.createElement(StickerModal_default, { ui: superstate.ui, hide: _props.hide, - selectedSticker: (emoji) => savePathSticker(superstate, space2.path, emoji) + selectedSticker: (emoji) => savePathSticker(superstate, space3.path, emoji) })); } }); @@ -102135,11 +102247,11 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl name: i18n_default.buttons.removeIcon, icon: "ui//file-minus", onClick: (e6) => { - removePathIcon(superstate, space2.path); + removePathIcon(superstate, space3.path); } }); } - if (space2.metadata?.sort) { + if (space3.metadata?.sort) { menuOptions.push(menuSeparator); menuOptions.push({ name: i18n_default.menu.sortBy, @@ -102150,13 +102262,13 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl sortOptions.push({ name: i18n_default.menu.groupSpaces, icon: "ui//arrow-up-down", - value: space2.metadata.sort.group == true, + value: space3.metadata.sort.group == true, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, { - field: space2.metadata.sort.field, - asc: space2.metadata.sort.asc, - group: !space2.metadata.sort.group + updateSpaceSort(superstate, space3.path, { + field: space3.metadata.sort.field, + asc: space3.metadata.sort.asc, + group: !space3.metadata.sort.group }); } }); @@ -102164,131 +102276,131 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl const rankSortOption = { field: "rank", asc: true, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.customSort, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == rankSortOption.field && space2.metadata.sort.asc == rankSortOption.asc, + value: space3.metadata.sort.field == rankSortOption.field && space3.metadata.sort.asc == rankSortOption.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, rankSortOption); + updateSpaceSort(superstate, space3.path, rankSortOption); } }); sortOptions.push(menuSeparator); const nameSortOption = { field: "name", asc: true, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.fileNameSortAlphaAsc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == nameSortOption.field && space2.metadata.sort.asc == nameSortOption.asc, + value: space3.metadata.sort.field == nameSortOption.field && space3.metadata.sort.asc == nameSortOption.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, nameSortOption); + updateSpaceSort(superstate, space3.path, nameSortOption); } }); const nameSortOptionDesc = { field: "name", asc: false, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.fileNameSortAlphaDesc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == nameSortOptionDesc.field && space2.metadata.sort.asc == nameSortOptionDesc.asc, + value: space3.metadata.sort.field == nameSortOptionDesc.field && space3.metadata.sort.asc == nameSortOptionDesc.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, nameSortOptionDesc); + updateSpaceSort(superstate, space3.path, nameSortOptionDesc); } }); sortOptions.push(menuSeparator); const numberSortOption = { field: "number", asc: true, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.fileNameSortNumericalAsc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == numberSortOption.field && space2.metadata.sort.asc == numberSortOption.asc, + value: space3.metadata.sort.field == numberSortOption.field && space3.metadata.sort.asc == numberSortOption.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, numberSortOption); + updateSpaceSort(superstate, space3.path, numberSortOption); } }); const numberSortOptionDesc = { field: "number", asc: false, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.fileNameSortNumericalDesc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == numberSortOptionDesc.field && space2.metadata.sort.asc == numberSortOptionDesc.asc, + value: space3.metadata.sort.field == numberSortOptionDesc.field && space3.metadata.sort.asc == numberSortOptionDesc.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, numberSortOptionDesc); + updateSpaceSort(superstate, space3.path, numberSortOptionDesc); } }); sortOptions.push(menuSeparator); const createdTimeSortOption = { field: "ctime", asc: false, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.createdTimeSortAsc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == createdTimeSortOption.field && space2.metadata.sort.asc == createdTimeSortOption.asc, + value: space3.metadata.sort.field == createdTimeSortOption.field && space3.metadata.sort.asc == createdTimeSortOption.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, createdTimeSortOption); + updateSpaceSort(superstate, space3.path, createdTimeSortOption); } }); const createdTimeSortOptionDesc = { field: "ctime", asc: true, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.createdTimeSortDesc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == createdTimeSortOptionDesc.field && space2.metadata.sort.asc == createdTimeSortOptionDesc.asc, + value: space3.metadata.sort.field == createdTimeSortOptionDesc.field && space3.metadata.sort.asc == createdTimeSortOptionDesc.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, createdTimeSortOptionDesc); + updateSpaceSort(superstate, space3.path, createdTimeSortOptionDesc); } }); sortOptions.push(menuSeparator); const sizeSortOption = { field: "size", asc: false, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.sizeSortAsc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == sizeSortOption.field && space2.metadata.sort.asc == sizeSortOption.asc, + value: space3.metadata.sort.field == sizeSortOption.field && space3.metadata.sort.asc == sizeSortOption.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, sizeSortOption); + updateSpaceSort(superstate, space3.path, sizeSortOption); } }); const sizeSortOptionDesc = { field: "size", asc: true, - group: space2.metadata.sort.group + group: space3.metadata.sort.group }; sortOptions.push({ name: i18n_default.menu.sizeSortDesc, icon: "ui//arrow-up-down", - value: space2.metadata.sort.field == sizeSortOptionDesc.field && space2.metadata.sort.asc == sizeSortOptionDesc.asc, + value: space3.metadata.sort.field == sizeSortOptionDesc.field && space3.metadata.sort.asc == sizeSortOptionDesc.asc, type: 3 /* Radio */, onClick: (e6) => { - updateSpaceSort(superstate, space2.path, sizeSortOptionDesc); + updateSpaceSort(superstate, space3.path, sizeSortOptionDesc); } }); return superstate.ui.openMenu( @@ -102298,7 +102410,7 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl } }); } - if (space2.type != "default") { + if (space3.type != "default") { menuOptions.push(menuSeparator); menuOptions.push({ name: i18n_default.menu.rename, @@ -102308,9 +102420,9 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl i18n_default.labels.rename, (_props) => /* @__PURE__ */ import_react47.default.createElement(InputModal, { saveLabel: i18n_default.buttons.rename, - value: space2.type == "tag" ? stringFromTag(space2.name) : space2.name, + value: space3.type == "tag" ? stringFromTag(space3.name) : space3.name, hide: _props.hide, - saveValue: (v2) => renamePathByName(superstate, space2.path, v2) + saveValue: (v2) => renamePathByName(superstate, space3.path, v2) }) ); } @@ -102320,19 +102432,19 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl name: i18n_default.menu.duplicate, icon: "ui//documents", onClick: (e6) => { - superstate.spaceManager.copyPath(path2.path, `${path2.parent}`); + superstate.spaceManager.copyPath(path3.path, `${path3.parent}`); } }); - if (space2.type == "folder") { + if (space3.type == "folder") { menuOptions.push({ name: i18n_default.menu.moveFile, icon: "ui//paper-plane", onClick: (e6) => { const offset2 = e6.target.getBoundingClientRect(); - showSpacesMenu(offset2, superstate, (link) => { + showSpacesMenu(offset2, superstate, (link3) => { superstate.spaceManager.renameSpace( - space2.path, - movePath(space2.path, link) + space3.path, + movePath(space3.path, link3) ); }); } @@ -102345,23 +102457,23 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl icon: "ui//arrow-up-right", onClick: (e6) => { superstate.ui.openPath( - space2.type == "folder" ? space2.path : `${superstate.settings.spacesFolder}/${space2.name}`, + space3.type == "folder" ? space3.path : `${superstate.settings.spacesFolder}/${space3.name}`, "system" ); } }); } menuOptions.push(menuSeparator); - if (space2.type == "folder") { + if (space3.type == "folder") { menuOptions.push({ name: i18n_default.menu.hide, icon: "ui//eye-off", onClick: (e6) => { - hidePath(superstate, space2.path); + hidePath(superstate, space3.path); } }); } - if (space2.type == "folder" || space2.type == "tag") + if (space3.type == "folder" || space3.type == "tag") menuOptions.push({ name: i18n_default.menu.delete, icon: "ui//trash", @@ -102370,7 +102482,7 @@ var showSpaceContextMenu = (superstate, path2, e5, activePath, parentSpace, onCl i18n_default.labels.deleteSpace, (_props) => /* @__PURE__ */ import_react47.default.createElement(ConfirmationModal, { hide: _props.hide, - confirmAction: () => removeSpace(superstate, space2.path), + confirmAction: () => removeSpace(superstate, space3.path), confirmLabel: i18n_default.buttons.delete, message: i18n_default.descriptions.deleteSpace }) @@ -102481,20 +102593,20 @@ var ContextListEditSelector = (props) => { return schema; }; const addListItemToKit = () => { - const path2 = props.superstate.spaceManager.uriByString(predicate.listItem); - if (path2.authority == "$kit") { + const path3 = props.superstate.spaceManager.uriByString(predicate.listItem); + if (path3.authority == "$kit") { props.superstate.ui.notify("Already in Kit"); return; } - const mdbFrame = props.superstate.framesIndex.get(path2.path)?.frames[path2.ref]; + const mdbFrame = props.superstate.framesIndex.get(path3.path)?.frames[path3.ref]; props.superstate.spaceManager.saveFrameKit( mdbFrame, props.superstate.settings.selectedKit ); }; const editItem = (type) => { - const listItem2 = initiateString(predicate[type], "spaces://$kit/#*" + type); - const uri = props.superstate.spaceManager.uriByString(listItem2); + const listItem4 = initiateString(predicate[type], "spaces://$kit/#*" + type); + const uri = props.superstate.spaceManager.uriByString(listItem4); if (uri.authority == "$kit") { const kit = props.superstate.kit.find((g) => g.def.id == uri.ref); newSchema( @@ -102505,7 +102617,7 @@ var ContextListEditSelector = (props) => { selectFrame(`${spaceInfo.path}/#*${f2.id}`, type); }); } else { - selectFrame(listItem2, type); + selectFrame(listItem4, type); } props.setEditSection(type); }; @@ -102720,12 +102832,12 @@ var React47 = __toESM(require_react(), 1); function functionalUpdate(updater, input) { return typeof updater === "function" ? updater(input) : updater; } -function makeStateUpdater(key2, instance) { +function makeStateUpdater(key3, instance) { return (updater) => { instance.setState((old) => { return { ...old, - [key2]: functionalUpdate(updater, old[key2]) + [key3]: functionalUpdate(updater, old[key3]) }; }); }; @@ -102758,7 +102870,7 @@ function memo2(getDeps, fn, opts) { if (opts.key && opts.debug) depTime = Date.now(); const newDeps = getDeps(depArgs); - const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index3) => deps[index3] !== dep); if (!depsChanged) { return result; } @@ -102789,7 +102901,7 @@ function memo2(getDeps, fn, opts) { return result; }; } -function getMemoOptions(tableOptions, debugLevel, key2, onChange) { +function getMemoOptions(tableOptions, debugLevel, key3, onChange) { return { debug: () => { var _tableOptions$debugAl; @@ -102799,10 +102911,10 @@ function getMemoOptions(tableOptions, debugLevel, key2, onChange) { onChange }; } -function createCell(table, row2, column2, columnId) { +function createCell(table2, row2, column2, columnId) { const getRenderValue = () => { var _cell$getValue; - return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table2.options.renderFallbackValue; }; const cell = { id: `${row2.id}_${column2.id}`, @@ -102810,23 +102922,23 @@ function createCell(table, row2, column2, columnId) { column: column2, getValue: () => row2.getValue(columnId), renderValue: getRenderValue, - getContext: memo2(() => [table, column2, row2, cell], (table2, column3, row3, cell2) => ({ - table: table2, + getContext: memo2(() => [table2, column2, row2, cell], (table3, column3, row3, cell2) => ({ + table: table3, column: column3, row: row3, cell: cell2, getValue: cell2.getValue, renderValue: cell2.renderValue - }), getMemoOptions(table.options, "debugCells", "cell.getContext")) + }), getMemoOptions(table2.options, "debugCells", "cell.getContext")) }; - table._features.forEach((feature) => { - feature.createCell == null || feature.createCell(cell, column2, row2, table); + table2._features.forEach((feature) => { + feature.createCell == null || feature.createCell(cell, column2, row2, table2); }, {}); return cell; } -function createColumn2(table, columnDef, depth, parent) { +function createColumn2(table2, columnDef, depth, parent) { var _ref, _resolvedColumnDef$id; - const defaultColumn = table._getDefaultColumnDef(); + const defaultColumn = table2._getDefaultColumnDef(); const resolvedColumnDef = { ...defaultColumn, ...columnDef @@ -102840,11 +102952,11 @@ function createColumn2(table, columnDef, depth, parent) { if (accessorKey.includes(".")) { accessorFn = (originalRow) => { let result = originalRow; - for (const key2 of accessorKey.split(".")) { + for (const key3 of accessorKey.split(".")) { var _result; - result = (_result = result) == null ? void 0 : _result[key2]; + result = (_result = result) == null ? void 0 : _result[key3]; if (false) { - console.warn(`"${key2}" in deeply nested key "${accessorKey}" returned undefined.`); + console.warn(`"${key3}" in deeply nested key "${accessorKey}" returned undefined.`); } } return result; @@ -102869,23 +102981,23 @@ function createColumn2(table, columnDef, depth, parent) { getFlatColumns: memo2(() => [true], () => { var _column$columns; return [column2, ...(_column$columns = column2.columns) == null ? void 0 : _column$columns.flatMap((d4) => d4.getFlatColumns())]; - }, getMemoOptions(table.options, "debugColumns", "column.getFlatColumns")), - getLeafColumns: memo2(() => [table._getOrderColumnsFn()], (orderColumns2) => { + }, getMemoOptions(table2.options, "debugColumns", "column.getFlatColumns")), + getLeafColumns: memo2(() => [table2._getOrderColumnsFn()], (orderColumns2) => { var _column$columns2; if ((_column$columns2 = column2.columns) != null && _column$columns2.length) { let leafColumns = column2.columns.flatMap((column3) => column3.getLeafColumns()); return orderColumns2(leafColumns); } return [column2]; - }, getMemoOptions(table.options, "debugColumns", "column.getLeafColumns")) + }, getMemoOptions(table2.options, "debugColumns", "column.getLeafColumns")) }; - for (const feature of table._features) { - feature.createColumn == null || feature.createColumn(column2, table); + for (const feature of table2._features) { + feature.createColumn == null || feature.createColumn(column2, table2); } return column2; } var debug = "debugHeaders"; -function createHeader(table, column2, options) { +function createHeader(table2, column2, options) { var _options$id; const id3 = (_options$id = options.id) != null ? _options$id : column2.id; let header = { @@ -102911,99 +103023,99 @@ function createHeader(table, column2, options) { return leafHeaders; }, getContext: () => ({ - table, + table: table2, header, column: column2 }) }; - table._features.forEach((feature) => { - feature.createHeader == null || feature.createHeader(header, table); + table2._features.forEach((feature) => { + feature.createHeader == null || feature.createHeader(header, table2); }); return header; } var Headers = { - createTable: (table) => { - table.getHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + createTable: (table2) => { + table2.getHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { var _left$map$filter, _right$map$filter; const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; const centerColumns = leafColumns.filter((column2) => !(left != null && left.includes(column2.id)) && !(right != null && right.includes(column2.id))); - const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table2); return headerGroups; - }, getMemoOptions(table.options, debug, "getHeaderGroups")); - table.getCenterHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + }, getMemoOptions(table2.options, debug, "getHeaderGroups")); + table2.getCenterHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { leafColumns = leafColumns.filter((column2) => !(left != null && left.includes(column2.id)) && !(right != null && right.includes(column2.id))); - return buildHeaderGroups(allColumns, leafColumns, table, "center"); - }, getMemoOptions(table.options, debug, "getCenterHeaderGroups")); - table.getLeftHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + return buildHeaderGroups(allColumns, leafColumns, table2, "center"); + }, getMemoOptions(table2.options, debug, "getCenterHeaderGroups")); + table2.getLeftHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.left], (allColumns, leafColumns, left) => { var _left$map$filter2; const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; - return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left"); - }, getMemoOptions(table.options, debug, "getLeftHeaderGroups")); - table.getRightHeaderGroups = memo2(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + return buildHeaderGroups(allColumns, orderedLeafColumns, table2, "left"); + }, getMemoOptions(table2.options, debug, "getLeftHeaderGroups")); + table2.getRightHeaderGroups = memo2(() => [table2.getAllColumns(), table2.getVisibleLeafColumns(), table2.getState().columnPinning.right], (allColumns, leafColumns, right) => { var _right$map$filter2; const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d4) => d4.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; - return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right"); - }, getMemoOptions(table.options, debug, "getRightHeaderGroups")); - table.getFooterGroups = memo2(() => [table.getHeaderGroups()], (headerGroups) => { + return buildHeaderGroups(allColumns, orderedLeafColumns, table2, "right"); + }, getMemoOptions(table2.options, debug, "getRightHeaderGroups")); + table2.getFooterGroups = memo2(() => [table2.getHeaderGroups()], (headerGroups) => { return [...headerGroups].reverse(); - }, getMemoOptions(table.options, debug, "getFooterGroups")); - table.getLeftFooterGroups = memo2(() => [table.getLeftHeaderGroups()], (headerGroups) => { + }, getMemoOptions(table2.options, debug, "getFooterGroups")); + table2.getLeftFooterGroups = memo2(() => [table2.getLeftHeaderGroups()], (headerGroups) => { return [...headerGroups].reverse(); - }, getMemoOptions(table.options, debug, "getLeftFooterGroups")); - table.getCenterFooterGroups = memo2(() => [table.getCenterHeaderGroups()], (headerGroups) => { + }, getMemoOptions(table2.options, debug, "getLeftFooterGroups")); + table2.getCenterFooterGroups = memo2(() => [table2.getCenterHeaderGroups()], (headerGroups) => { return [...headerGroups].reverse(); - }, getMemoOptions(table.options, debug, "getCenterFooterGroups")); - table.getRightFooterGroups = memo2(() => [table.getRightHeaderGroups()], (headerGroups) => { + }, getMemoOptions(table2.options, debug, "getCenterFooterGroups")); + table2.getRightFooterGroups = memo2(() => [table2.getRightHeaderGroups()], (headerGroups) => { return [...headerGroups].reverse(); - }, getMemoOptions(table.options, debug, "getRightFooterGroups")); - table.getFlatHeaders = memo2(() => [table.getHeaderGroups()], (headerGroups) => { + }, getMemoOptions(table2.options, debug, "getRightFooterGroups")); + table2.getFlatHeaders = memo2(() => [table2.getHeaderGroups()], (headerGroups) => { return headerGroups.map((headerGroup) => { return headerGroup.headers; }).flat(); - }, getMemoOptions(table.options, debug, "getFlatHeaders")); - table.getLeftFlatHeaders = memo2(() => [table.getLeftHeaderGroups()], (left) => { + }, getMemoOptions(table2.options, debug, "getFlatHeaders")); + table2.getLeftFlatHeaders = memo2(() => [table2.getLeftHeaderGroups()], (left) => { return left.map((headerGroup) => { return headerGroup.headers; }).flat(); - }, getMemoOptions(table.options, debug, "getLeftFlatHeaders")); - table.getCenterFlatHeaders = memo2(() => [table.getCenterHeaderGroups()], (left) => { + }, getMemoOptions(table2.options, debug, "getLeftFlatHeaders")); + table2.getCenterFlatHeaders = memo2(() => [table2.getCenterHeaderGroups()], (left) => { return left.map((headerGroup) => { return headerGroup.headers; }).flat(); - }, getMemoOptions(table.options, debug, "getCenterFlatHeaders")); - table.getRightFlatHeaders = memo2(() => [table.getRightHeaderGroups()], (left) => { + }, getMemoOptions(table2.options, debug, "getCenterFlatHeaders")); + table2.getRightFlatHeaders = memo2(() => [table2.getRightHeaderGroups()], (left) => { return left.map((headerGroup) => { return headerGroup.headers; }).flat(); - }, getMemoOptions(table.options, debug, "getRightFlatHeaders")); - table.getCenterLeafHeaders = memo2(() => [table.getCenterFlatHeaders()], (flatHeaders) => { + }, getMemoOptions(table2.options, debug, "getRightFlatHeaders")); + table2.getCenterLeafHeaders = memo2(() => [table2.getCenterFlatHeaders()], (flatHeaders) => { return flatHeaders.filter((header) => { var _header$subHeaders; return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); }); - }, getMemoOptions(table.options, debug, "getCenterLeafHeaders")); - table.getLeftLeafHeaders = memo2(() => [table.getLeftFlatHeaders()], (flatHeaders) => { + }, getMemoOptions(table2.options, debug, "getCenterLeafHeaders")); + table2.getLeftLeafHeaders = memo2(() => [table2.getLeftFlatHeaders()], (flatHeaders) => { return flatHeaders.filter((header) => { var _header$subHeaders2; return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); }); - }, getMemoOptions(table.options, debug, "getLeftLeafHeaders")); - table.getRightLeafHeaders = memo2(() => [table.getRightFlatHeaders()], (flatHeaders) => { + }, getMemoOptions(table2.options, debug, "getLeftLeafHeaders")); + table2.getRightLeafHeaders = memo2(() => [table2.getRightFlatHeaders()], (flatHeaders) => { return flatHeaders.filter((header) => { var _header$subHeaders3; return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); }); - }, getMemoOptions(table.options, debug, "getRightLeafHeaders")); - table.getLeafHeaders = memo2(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + }, getMemoOptions(table2.options, debug, "getRightLeafHeaders")); + table2.getLeafHeaders = memo2(() => [table2.getLeftHeaderGroups(), table2.getCenterHeaderGroups(), table2.getRightHeaderGroups()], (left, center, right) => { var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; return [...(_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : [], ...(_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : [], ...(_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : []].map((header) => { return header.getLeafHeaders(); }).flat(); - }, getMemoOptions(table.options, debug, "getLeafHeaders")); + }, getMemoOptions(table2.options, debug, "getLeafHeaders")); } }; -function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { +function buildHeaderGroups(allColumns, columnsToGroup, table2, headerFamily) { var _headerGroups$0$heade, _headerGroups$; let maxDepth = 0; const findMaxDepth = function(columns, depth) { @@ -103041,7 +103153,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column2) { latestPendingParentHeader.subHeaders.push(headerToGroup); } else { - const header = createHeader(table, column2, { + const header = createHeader(table2, column2, { id: [headerFamily, depth, column2.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"), isPlaceholder, placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d4) => d4.column === column2).length}` : void 0, @@ -103059,9 +103171,9 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { createHeaderGroup(pendingParentHeaders, depth - 1); } }; - const bottomHeaders = columnsToGroup.map((column2, index2) => createHeader(table, column2, { + const bottomHeaders = columnsToGroup.map((column2, index3) => createHeader(table2, column2, { depth: maxDepth, - index: index2 + index: index3 })); createHeaderGroup(bottomHeaders, maxDepth - 1); headerGroups.reverse(); @@ -103097,7 +103209,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); return headerGroups; } -var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => { +var createRow2 = (table2, id3, original, rowIndex, depth, subRows, parentId) => { let row2 = { id: id3, index: rowIndex, @@ -103110,7 +103222,7 @@ var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => { if (row2._valuesCache.hasOwnProperty(columnId)) { return row2._valuesCache[columnId]; } - const column2 = table.getColumn(columnId); + const column2 = table2.getColumn(columnId); if (!(column2 != null && column2.accessorFn)) { return void 0; } @@ -103121,7 +103233,7 @@ var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => { if (row2._uniqueValuesCache.hasOwnProperty(columnId)) { return row2._uniqueValuesCache[columnId]; } - const column2 = table.getColumn(columnId); + const column2 = table2.getColumn(columnId); if (!(column2 != null && column2.accessorFn)) { return void 0; } @@ -103134,11 +103246,11 @@ var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => { }, renderValue: (columnId) => { var _row$getValue; - return (_row$getValue = row2.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + return (_row$getValue = row2.getValue(columnId)) != null ? _row$getValue : table2.options.renderFallbackValue; }, subRows: subRows != null ? subRows : [], getLeafRows: () => flattenBy(row2.subRows, (d4) => d4.subRows), - getParentRow: () => row2.parentId ? table.getRow(row2.parentId, true) : void 0, + getParentRow: () => row2.parentId ? table2.getRow(row2.parentId, true) : void 0, getParentRows: () => { let parentRows = []; let currentRow = row2; @@ -103151,41 +103263,41 @@ var createRow2 = (table, id3, original, rowIndex, depth, subRows, parentId) => { } return parentRows.reverse(); }, - getAllCells: memo2(() => [table.getAllLeafColumns()], (leafColumns) => { + getAllCells: memo2(() => [table2.getAllLeafColumns()], (leafColumns) => { return leafColumns.map((column2) => { - return createCell(table, row2, column2, column2.id); + return createCell(table2, row2, column2, column2.id); }); - }, getMemoOptions(table.options, "debugRows", "getAllCells")), + }, getMemoOptions(table2.options, "debugRows", "getAllCells")), _getAllCellsByColumnId: memo2(() => [row2.getAllCells()], (allCells) => { return allCells.reduce((acc, cell) => { acc[cell.column.id] = cell; return acc; }, {}); - }, getMemoOptions(table.options, "debugRows", "getAllCellsByColumnId")) + }, getMemoOptions(table2.options, "debugRows", "getAllCellsByColumnId")) }; - for (let i4 = 0; i4 < table._features.length; i4++) { - const feature = table._features[i4]; - feature == null || feature.createRow == null || feature.createRow(row2, table); + for (let i4 = 0; i4 < table2._features.length; i4++) { + const feature = table2._features[i4]; + feature == null || feature.createRow == null || feature.createRow(row2, table2); } return row2; }; var ColumnFaceting = { - createColumn: (column2, table) => { - column2._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column2.id); + createColumn: (column2, table2) => { + column2._getFacetedRowModel = table2.options.getFacetedRowModel && table2.options.getFacetedRowModel(table2, column2.id); column2.getFacetedRowModel = () => { if (!column2._getFacetedRowModel) { - return table.getPreFilteredRowModel(); + return table2.getPreFilteredRowModel(); } return column2._getFacetedRowModel(); }; - column2._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column2.id); + column2._getFacetedUniqueValues = table2.options.getFacetedUniqueValues && table2.options.getFacetedUniqueValues(table2, column2.id); column2.getFacetedUniqueValues = () => { if (!column2._getFacetedUniqueValues) { return /* @__PURE__ */ new Map(); } return column2._getFacetedUniqueValues(); }; - column2._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column2.id); + column2._getFacetedMinMaxValues = table2.options.getFacetedMinMaxValues && table2.options.getFacetedMinMaxValues(table2, column2.id); column2.getFacetedMinMaxValues = () => { if (!column2._getFacetedMinMaxValues) { return void 0; @@ -103196,8 +103308,8 @@ var ColumnFaceting = { }; var includesString = (row2, columnId, filterValue) => { var _row$getValue; - const search2 = filterValue.toLowerCase(); - return Boolean((_row$getValue = row2.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search2)); + const search3 = filterValue.toLowerCase(); + return Boolean((_row$getValue = row2.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search3)); }; includesString.autoRemove = (val) => testFalsey(val); var includesStringSensitive = (row2, columnId, filterValue) => { @@ -103282,16 +103394,16 @@ var ColumnFiltering = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onColumnFiltersChange: makeStateUpdater("columnFilters", table), + onColumnFiltersChange: makeStateUpdater("columnFilters", table2), filterFromLeafRows: false, maxLeafRowFilterDepth: 100 }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.getAutoFilterFn = () => { - const firstRow = table.getCoreRowModel().flatRows[0]; + const firstRow = table2.getCoreRowModel().flatRows[0]; const value = firstRow == null ? void 0 : firstRow.getValue(column2.id); if (typeof value === "string") { return filterFns.includesString; @@ -103312,23 +103424,23 @@ var ColumnFiltering = { }; column2.getFilterFn = () => { var _table$options$filter, _table$options$filter2; - return isFunction2(column2.columnDef.filterFn) ? column2.columnDef.filterFn : column2.columnDef.filterFn === "auto" ? column2.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column2.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column2.columnDef.filterFn]; + return isFunction2(column2.columnDef.filterFn) ? column2.columnDef.filterFn : column2.columnDef.filterFn === "auto" ? column2.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table2.options.filterFns) == null ? void 0 : _table$options$filter2[column2.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column2.columnDef.filterFn]; }; column2.getCanFilter = () => { var _column$columnDef$ena, _table$options$enable, _table$options$enable2; - return ((_column$columnDef$ena = column2.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column2.accessorFn; + return ((_column$columnDef$ena = column2.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table2.options.enableFilters) != null ? _table$options$enable2 : true) && !!column2.accessorFn; }; column2.getIsFiltered = () => column2.getFilterIndex() > -1; column2.getFilterValue = () => { var _table$getState$colum; - return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find((d4) => d4.id === column2.id)) == null ? void 0 : _table$getState$colum.value; + return (_table$getState$colum = table2.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find((d4) => d4.id === column2.id)) == null ? void 0 : _table$getState$colum.value; }; column2.getFilterIndex = () => { var _table$getState$colum2, _table$getState$colum3; - return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$colum2 : -1; + return (_table$getState$colum2 = (_table$getState$colum3 = table2.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$colum2 : -1; }; column2.setFilterValue = (value) => { - table.setColumnFilters((old) => { + table2.setColumnFilters((old) => { const filterFn = column2.getFilterFn(); const previousFilter = old == null ? void 0 : old.find((d4) => d4.id === column2.id); const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : void 0); @@ -103360,9 +103472,9 @@ var ColumnFiltering = { row2.columnFilters = {}; row2.columnFiltersMeta = {}; }, - createTable: (table) => { - table.setColumnFilters = (updater) => { - const leafColumns = table.getAllLeafColumns(); + createTable: (table2) => { + table2.setColumnFilters = (updater) => { + const leafColumns = table2.getAllLeafColumns(); const updateFn = (old) => { var _functionalUpdate; return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter((filter4) => { @@ -103376,21 +103488,21 @@ var ColumnFiltering = { return true; }); }; - table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + table2.options.onColumnFiltersChange == null || table2.options.onColumnFiltersChange(updateFn); }; - table.resetColumnFilters = (defaultState) => { + table2.resetColumnFilters = (defaultState) => { var _table$initialState$c, _table$initialState; - table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + table2.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); }; - table.getPreFilteredRowModel = () => table.getCoreRowModel(); - table.getFilteredRowModel = () => { - if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { - table._getFilteredRowModel = table.options.getFilteredRowModel(table); + table2.getPreFilteredRowModel = () => table2.getCoreRowModel(); + table2.getFilteredRowModel = () => { + if (!table2._getFilteredRowModel && table2.options.getFilteredRowModel) { + table2._getFilteredRowModel = table2.options.getFilteredRowModel(table2); } - if (table.options.manualFiltering || !table._getFilteredRowModel) { - return table.getPreFilteredRowModel(); + if (table2.options.manualFiltering || !table2._getFilteredRowModel) { + return table2.getPreFilteredRowModel(); } - return table._getFilteredRowModel(); + return table2._getFilteredRowModel(); }; } }; @@ -103506,15 +103618,15 @@ var ColumnGrouping = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onGroupingChange: makeStateUpdater("grouping", table), + onGroupingChange: makeStateUpdater("grouping", table2), groupedColumnMode: "reorder" }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.toggleGrouping = () => { - table.setGrouping((old) => { + table2.setGrouping((old) => { if (old != null && old.includes(column2.id)) { return old.filter((d4) => d4 !== column2.id); } @@ -103523,15 +103635,15 @@ var ColumnGrouping = { }; column2.getCanGroup = () => { var _ref, _ref2, _ref3, _column$columnDef$ena; - return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column2.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column2.accessorFn; + return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column2.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table2.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column2.accessorFn; }; column2.getIsGrouped = () => { var _table$getState$group; - return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column2.id); + return (_table$getState$group = table2.getState().grouping) == null ? void 0 : _table$getState$group.includes(column2.id); }; column2.getGroupedIndex = () => { var _table$getState$group2; - return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column2.id); + return (_table$getState$group2 = table2.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column2.id); }; column2.getToggleGroupingHandler = () => { const canGroup = column2.getCanGroup(); @@ -103542,7 +103654,7 @@ var ColumnGrouping = { }; }; column2.getAutoAggregationFn = () => { - const firstRow = table.getCoreRowModel().flatRows[0]; + const firstRow = table2.getCoreRowModel().flatRows[0]; const value = firstRow == null ? void 0 : firstRow.getValue(column2.id); if (typeof value === "number") { return aggregationFns.sum; @@ -103556,33 +103668,33 @@ var ColumnGrouping = { if (!column2) { throw new Error(); } - return isFunction2(column2.columnDef.aggregationFn) ? column2.columnDef.aggregationFn : column2.columnDef.aggregationFn === "auto" ? column2.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column2.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column2.columnDef.aggregationFn]; + return isFunction2(column2.columnDef.aggregationFn) ? column2.columnDef.aggregationFn : column2.columnDef.aggregationFn === "auto" ? column2.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table2.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column2.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column2.columnDef.aggregationFn]; }; }, - createTable: (table) => { - table.setGrouping = (updater) => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); - table.resetGrouping = (defaultState) => { + createTable: (table2) => { + table2.setGrouping = (updater) => table2.options.onGroupingChange == null ? void 0 : table2.options.onGroupingChange(updater); + table2.resetGrouping = (defaultState) => { var _table$initialState$g, _table$initialState; - table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + table2.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); }; - table.getPreGroupedRowModel = () => table.getFilteredRowModel(); - table.getGroupedRowModel = () => { - if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { - table._getGroupedRowModel = table.options.getGroupedRowModel(table); + table2.getPreGroupedRowModel = () => table2.getFilteredRowModel(); + table2.getGroupedRowModel = () => { + if (!table2._getGroupedRowModel && table2.options.getGroupedRowModel) { + table2._getGroupedRowModel = table2.options.getGroupedRowModel(table2); } - if (table.options.manualGrouping || !table._getGroupedRowModel) { - return table.getPreGroupedRowModel(); + if (table2.options.manualGrouping || !table2._getGroupedRowModel) { + return table2.getPreGroupedRowModel(); } - return table._getGroupedRowModel(); + return table2._getGroupedRowModel(); }; }, - createRow: (row2, table) => { + createRow: (row2, table2) => { row2.getIsGrouped = () => !!row2.groupingColumnId; row2.getGroupingValue = (columnId) => { if (row2._groupingValuesCache.hasOwnProperty(columnId)) { return row2._groupingValuesCache[columnId]; } - const column2 = table.getColumn(columnId); + const column2 = table2.getColumn(columnId); if (!(column2 != null && column2.columnDef.getGroupingValue)) { return row2.getValue(columnId); } @@ -103591,7 +103703,7 @@ var ColumnGrouping = { }; row2._groupingValuesCache = {}; }, - createCell: (cell, column2, row2, table) => { + createCell: (cell, column2, row2, table2) => { cell.getIsGrouped = () => column2.getIsGrouped() && column2.id === row2.groupingColumnId; cell.getIsPlaceholder = () => !cell.getIsGrouped() && column2.getIsGrouped(); cell.getIsAggregated = () => { @@ -103618,31 +103730,31 @@ var ColumnOrdering = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onColumnOrderChange: makeStateUpdater("columnOrder", table) + onColumnOrderChange: makeStateUpdater("columnOrder", table2) }; }, - createColumn: (column2, table) => { - column2.getIndex = memo2((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d4) => d4.id === column2.id), getMemoOptions(table.options, "debugColumns", "getIndex")); - column2.getIsFirstColumn = (position) => { + createColumn: (column2, table2) => { + column2.getIndex = memo2((position3) => [_getVisibleLeafColumns(table2, position3)], (columns) => columns.findIndex((d4) => d4.id === column2.id), getMemoOptions(table2.options, "debugColumns", "getIndex")); + column2.getIsFirstColumn = (position3) => { var _columns$; - const columns = _getVisibleLeafColumns(table, position); + const columns = _getVisibleLeafColumns(table2, position3); return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column2.id; }; - column2.getIsLastColumn = (position) => { + column2.getIsLastColumn = (position3) => { var _columns; - const columns = _getVisibleLeafColumns(table, position); + const columns = _getVisibleLeafColumns(table2, position3); return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column2.id; }; }, - createTable: (table) => { - table.setColumnOrder = (updater) => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); - table.resetColumnOrder = (defaultState) => { + createTable: (table2) => { + table2.setColumnOrder = (updater) => table2.options.onColumnOrderChange == null ? void 0 : table2.options.onColumnOrderChange(updater); + table2.resetColumnOrder = (defaultState) => { var _table$initialState$c; - table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + table2.setColumnOrder(defaultState ? [] : (_table$initialState$c = table2.initialState.columnOrder) != null ? _table$initialState$c : []); }; - table._getOrderColumnsFn = memo2(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => { + table2._getOrderColumnsFn = memo2(() => [table2.getState().columnOrder, table2.getState().grouping, table2.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => { let orderedColumns = []; if (!(columnOrder != null && columnOrder.length)) { orderedColumns = columns; @@ -103659,7 +103771,7 @@ var ColumnOrdering = { orderedColumns = [...orderedColumns, ...columnsCopy]; } return orderColumns(orderedColumns, grouping, groupedColumnMode); - }, getMemoOptions(table.options, "debugTable", "_getOrderColumnsFn")); + }, getMemoOptions(table2.options, "debugTable", "_getOrderColumnsFn")); } }; var getDefaultColumnPinningState = () => ({ @@ -103673,24 +103785,24 @@ var ColumnPinning = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onColumnPinningChange: makeStateUpdater("columnPinning", table) + onColumnPinningChange: makeStateUpdater("columnPinning", table2) }; }, - createColumn: (column2, table) => { - column2.pin = (position) => { + createColumn: (column2, table2) => { + column2.pin = (position3) => { const columnIds = column2.getLeafColumns().map((d4) => d4.id).filter(Boolean); - table.setColumnPinning((old) => { + table2.setColumnPinning((old) => { var _old$left3, _old$right3; - if (position === "right") { + if (position3 === "right") { var _old$left, _old$right; return { left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))), right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))), ...columnIds] }; } - if (position === "left") { + if (position3 === "left") { var _old$left2, _old$right2; return { left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d4) => !(columnIds != null && columnIds.includes(d4))), ...columnIds], @@ -103707,7 +103819,7 @@ var ColumnPinning = { const leafColumns = column2.getLeafColumns(); return leafColumns.some((d4) => { var _d$columnDef$enablePi, _ref, _table$options$enable; - return ((_d$columnDef$enablePi = d4.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + return ((_d$columnDef$enablePi = d4.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table2.options.enableColumnPinning) != null ? _table$options$enable : table2.options.enablePinning) != null ? _ref : true); }); }; column2.getIsPinned = () => { @@ -103715,62 +103827,62 @@ var ColumnPinning = { const { left, right - } = table.getState().columnPinning; + } = table2.getState().columnPinning; const isLeft = leafColumnIds.some((d4) => left == null ? void 0 : left.includes(d4)); const isRight = leafColumnIds.some((d4) => right == null ? void 0 : right.includes(d4)); return isLeft ? "left" : isRight ? "right" : false; }; column2.getPinnedIndex = () => { var _table$getState$colum, _table$getState$colum2; - const position = column2.getIsPinned(); - return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column2.id)) != null ? _table$getState$colum : -1 : 0; + const position3 = column2.getIsPinned(); + return position3 ? (_table$getState$colum = (_table$getState$colum2 = table2.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position3]) == null ? void 0 : _table$getState$colum2.indexOf(column2.id)) != null ? _table$getState$colum : -1 : 0; }; }, - createRow: (row2, table) => { - row2.getCenterVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + createRow: (row2, table2) => { + row2.getCenterVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allCells, left, right) => { const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; return allCells.filter((d4) => !leftAndRight.includes(d4.column.id)); - }, getMemoOptions(table.options, "debugRows", "getCenterVisibleCells")); - row2.getLeftVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { - const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({ + }, getMemoOptions(table2.options, "debugRows", "getCenterVisibleCells")); + row2.getLeftVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.left], (allCells, left) => { + const cells2 = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({ ...d4, position: "left" })); - return cells; - }, getMemoOptions(table.options, "debugRows", "getLeftVisibleCells")); - row2.getRightVisibleCells = memo2(() => [row2._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { - const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({ + return cells2; + }, getMemoOptions(table2.options, "debugRows", "getLeftVisibleCells")); + row2.getRightVisibleCells = memo2(() => [row2._getAllVisibleCells(), table2.getState().columnPinning.right], (allCells, right) => { + const cells2 = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d4) => ({ ...d4, position: "right" })); - return cells; - }, getMemoOptions(table.options, "debugRows", "getRightVisibleCells")); + return cells2; + }, getMemoOptions(table2.options, "debugRows", "getRightVisibleCells")); }, - createTable: (table) => { - table.setColumnPinning = (updater) => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); - table.resetColumnPinning = (defaultState) => { + createTable: (table2) => { + table2.setColumnPinning = (updater) => table2.options.onColumnPinningChange == null ? void 0 : table2.options.onColumnPinningChange(updater); + table2.resetColumnPinning = (defaultState) => { var _table$initialState$c, _table$initialState; - return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + return table2.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); }; - table.getIsSomeColumnsPinned = (position) => { + table2.getIsSomeColumnsPinned = (position3) => { var _pinningState$positio; - const pinningState = table.getState().columnPinning; - if (!position) { + const pinningState = table2.getState().columnPinning; + if (!position3) { var _pinningState$left, _pinningState$right; return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); } - return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + return Boolean((_pinningState$positio = pinningState[position3]) == null ? void 0 : _pinningState$positio.length); }; - table.getLeftLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + table2.getLeftLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.left], (allColumns, left) => { return (left != null ? left : []).map((columnId) => allColumns.find((column2) => column2.id === columnId)).filter(Boolean); - }, getMemoOptions(table.options, "debugColumns", "getLeftLeafColumns")); - table.getRightLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + }, getMemoOptions(table2.options, "debugColumns", "getLeftLeafColumns")); + table2.getRightLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.right], (allColumns, right) => { return (right != null ? right : []).map((columnId) => allColumns.find((column2) => column2.id === columnId)).filter(Boolean); - }, getMemoOptions(table.options, "debugColumns", "getRightLeafColumns")); - table.getCenterLeafColumns = memo2(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + }, getMemoOptions(table2.options, "debugColumns", "getRightLeafColumns")); + table2.getCenterLeafColumns = memo2(() => [table2.getAllLeafColumns(), table2.getState().columnPinning.left, table2.getState().columnPinning.right], (allColumns, left, right) => { const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; return allColumns.filter((d4) => !leftAndRight.includes(d4.id)); - }, getMemoOptions(table.options, "debugColumns", "getCenterLeafColumns")); + }, getMemoOptions(table2.options, "debugColumns", "getCenterLeafColumns")); } }; var defaultColumnSizing = { @@ -103797,24 +103909,24 @@ var ColumnSizing = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { columnResizeMode: "onEnd", columnResizeDirection: "ltr", - onColumnSizingChange: makeStateUpdater("columnSizing", table), - onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table) + onColumnSizingChange: makeStateUpdater("columnSizing", table2), + onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table2) }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.getSize = () => { var _column$columnDef$min, _ref, _column$columnDef$max; - const columnSize = table.getState().columnSizing[column2.id]; + const columnSize = table2.getState().columnSizing[column2.id]; return Math.min(Math.max((_column$columnDef$min = column2.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column2.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column2.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); }; - column2.getStart = memo2((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column2.getIndex(position)).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getStart")); - column2.getAfter = memo2((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column2.getIndex(position) + 1).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getAfter")); + column2.getStart = memo2((position3) => [position3, _getVisibleLeafColumns(table2, position3), table2.getState().columnSizing], (position3, columns) => columns.slice(0, column2.getIndex(position3)).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table2.options, "debugColumns", "getStart")); + column2.getAfter = memo2((position3) => [position3, _getVisibleLeafColumns(table2, position3), table2.getState().columnSizing], (position3, columns) => columns.slice(column2.getIndex(position3) + 1).reduce((sum4, column3) => sum4 + column3.getSize(), 0), getMemoOptions(table2.options, "debugColumns", "getAfter")); column2.resetSize = () => { - table.setColumnSizing((_ref2) => { + table2.setColumnSizing((_ref2) => { let { [column2.id]: _15, ...rest @@ -103824,13 +103936,13 @@ var ColumnSizing = { }; column2.getCanResize = () => { var _column$columnDef$ena, _table$options$enable; - return ((_column$columnDef$ena = column2.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + return ((_column$columnDef$ena = column2.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableColumnResizing) != null ? _table$options$enable : true); }; column2.getIsResizing = () => { - return table.getState().columnSizingInfo.isResizingColumn === column2.id; + return table2.getState().columnSizingInfo.isResizingColumn === column2.id; }; }, - createHeader: (header, table) => { + createHeader: (header, table2) => { header.getSize = () => { let sum4 = 0; const recurse = (header2) => { @@ -103852,7 +103964,7 @@ var ColumnSizing = { return 0; }; header.getResizeHandler = (_contextDocument) => { - const column2 = table.getColumn(header.column.id); + const column2 = table2.getColumn(header.column.id); const canResize = column2 == null ? void 0 : column2.getCanResize(); return (e5) => { if (!column2 || !canResize) { @@ -103872,9 +103984,9 @@ var ColumnSizing = { if (typeof clientXPos !== "number") { return; } - table.setColumnSizingInfo((old) => { + table2.setColumnSizingInfo((old) => { var _old$startOffset, _old$startSize; - const deltaDirection = table.options.columnResizeDirection === "rtl" ? -1 : 1; + const deltaDirection = table2.options.columnResizeDirection === "rtl" ? -1 : 1; const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); old.columnSizingStart.forEach((_ref3) => { @@ -103887,8 +103999,8 @@ var ColumnSizing = { deltaPercentage }; }); - if (table.options.columnResizeMode === "onChange" || eventType === "end") { - table.setColumnSizing((old) => ({ + if (table2.options.columnResizeMode === "onChange" || eventType === "end") { + table2.setColumnSizing((old) => ({ ...old, ...newColumnSizing })); @@ -103897,7 +104009,7 @@ var ColumnSizing = { const onMove = (clientXPos) => updateOffset("move", clientXPos); const onEnd = (clientXPos) => { updateOffset("end", clientXPos); - table.setColumnSizingInfo((old) => ({ + table2.setColumnSizingInfo((old) => ({ ...old, isResizingColumn: false, startOffset: null, @@ -103946,7 +104058,7 @@ var ColumnSizing = { contextDocument == null || contextDocument.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported); contextDocument == null || contextDocument.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported); } - table.setColumnSizingInfo((old) => ({ + table2.setColumnSizingInfo((old) => ({ ...old, startOffset: clientX, startSize, @@ -103958,38 +104070,38 @@ var ColumnSizing = { }; }; }, - createTable: (table) => { - table.setColumnSizing = (updater) => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); - table.setColumnSizingInfo = (updater) => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); - table.resetColumnSizing = (defaultState) => { + createTable: (table2) => { + table2.setColumnSizing = (updater) => table2.options.onColumnSizingChange == null ? void 0 : table2.options.onColumnSizingChange(updater); + table2.setColumnSizingInfo = (updater) => table2.options.onColumnSizingInfoChange == null ? void 0 : table2.options.onColumnSizingInfoChange(updater); + table2.resetColumnSizing = (defaultState) => { var _table$initialState$c; - table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + table2.setColumnSizing(defaultState ? {} : (_table$initialState$c = table2.initialState.columnSizing) != null ? _table$initialState$c : {}); }; - table.resetHeaderSizeInfo = (defaultState) => { + table2.resetHeaderSizeInfo = (defaultState) => { var _table$initialState$c2; - table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + table2.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table2.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); }; - table.getTotalSize = () => { + table2.getTotalSize = () => { var _table$getHeaderGroup, _table$getHeaderGroup2; - return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum4, header) => { + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table2.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum4, header) => { return sum4 + header.getSize(); }, 0)) != null ? _table$getHeaderGroup : 0; }; - table.getLeftTotalSize = () => { + table2.getLeftTotalSize = () => { var _table$getLeftHeaderG, _table$getLeftHeaderG2; - return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum4, header) => { + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table2.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum4, header) => { return sum4 + header.getSize(); }, 0)) != null ? _table$getLeftHeaderG : 0; }; - table.getCenterTotalSize = () => { + table2.getCenterTotalSize = () => { var _table$getCenterHeade, _table$getCenterHeade2; - return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum4, header) => { + return (_table$getCenterHeade = (_table$getCenterHeade2 = table2.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum4, header) => { return sum4 + header.getSize(); }, 0)) != null ? _table$getCenterHeade : 0; }; - table.getRightTotalSize = () => { + table2.getRightTotalSize = () => { var _table$getRightHeader, _table$getRightHeader2; - return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum4, header) => { + return (_table$getRightHeader = (_table$getRightHeader2 = table2.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum4, header) => { return sum4 + header.getSize(); }, 0)) != null ? _table$getRightHeader : 0; }; @@ -104027,15 +104139,15 @@ var ColumnVisibility = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onColumnVisibilityChange: makeStateUpdater("columnVisibility", table) + onColumnVisibilityChange: makeStateUpdater("columnVisibility", table2) }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.toggleVisibility = (value) => { if (column2.getCanHide()) { - table.setColumnVisibility((old) => ({ + table2.setColumnVisibility((old) => ({ ...old, [column2.id]: value != null ? value : !column2.getIsVisible() })); @@ -104044,11 +104156,11 @@ var ColumnVisibility = { column2.getIsVisible = () => { var _ref, _table$getState$colum; const childColumns = column2.columns; - return (_ref = childColumns.length ? childColumns.some((c3) => c3.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column2.id]) != null ? _ref : true; + return (_ref = childColumns.length ? childColumns.some((c3) => c3.getIsVisible()) : (_table$getState$colum = table2.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column2.id]) != null ? _ref : true; }; column2.getCanHide = () => { var _column$columnDef$ena, _table$options$enable; - return ((_column$columnDef$ena = column2.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + return ((_column$columnDef$ena = column2.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableHiding) != null ? _table$options$enable : true); }; column2.getToggleVisibilityHandler = () => { return (e5) => { @@ -104056,48 +104168,48 @@ var ColumnVisibility = { }; }; }, - createRow: (row2, table) => { - row2._getAllVisibleCells = memo2(() => [row2.getAllCells(), table.getState().columnVisibility], (cells) => { - return cells.filter((cell) => cell.column.getIsVisible()); - }, getMemoOptions(table.options, "debugRows", "_getAllVisibleCells")); - row2.getVisibleCells = memo2(() => [row2.getLeftVisibleCells(), row2.getCenterVisibleCells(), row2.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells")); + createRow: (row2, table2) => { + row2._getAllVisibleCells = memo2(() => [row2.getAllCells(), table2.getState().columnVisibility], (cells2) => { + return cells2.filter((cell) => cell.column.getIsVisible()); + }, getMemoOptions(table2.options, "debugRows", "_getAllVisibleCells")); + row2.getVisibleCells = memo2(() => [row2.getLeftVisibleCells(), row2.getCenterVisibleCells(), row2.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table2.options, "debugRows", "getVisibleCells")); }, - createTable: (table) => { - const makeVisibleColumnsMethod = (key2, getColumns) => { + createTable: (table2) => { + const makeVisibleColumnsMethod = (key3, getColumns) => { return memo2(() => [getColumns(), getColumns().filter((d4) => d4.getIsVisible()).map((d4) => d4.id).join("_")], (columns) => { return columns.filter((d4) => d4.getIsVisible == null ? void 0 : d4.getIsVisible()); - }, getMemoOptions(table.options, "debugColumns", key2)); - }; - table.getVisibleFlatColumns = makeVisibleColumnsMethod("getVisibleFlatColumns", () => table.getAllFlatColumns()); - table.getVisibleLeafColumns = makeVisibleColumnsMethod("getVisibleLeafColumns", () => table.getAllLeafColumns()); - table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table.getLeftLeafColumns()); - table.getRightVisibleLeafColumns = makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table.getRightLeafColumns()); - table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table.getCenterLeafColumns()); - table.setColumnVisibility = (updater) => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); - table.resetColumnVisibility = (defaultState) => { + }, getMemoOptions(table2.options, "debugColumns", key3)); + }; + table2.getVisibleFlatColumns = makeVisibleColumnsMethod("getVisibleFlatColumns", () => table2.getAllFlatColumns()); + table2.getVisibleLeafColumns = makeVisibleColumnsMethod("getVisibleLeafColumns", () => table2.getAllLeafColumns()); + table2.getLeftVisibleLeafColumns = makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table2.getLeftLeafColumns()); + table2.getRightVisibleLeafColumns = makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table2.getRightLeafColumns()); + table2.getCenterVisibleLeafColumns = makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table2.getCenterLeafColumns()); + table2.setColumnVisibility = (updater) => table2.options.onColumnVisibilityChange == null ? void 0 : table2.options.onColumnVisibilityChange(updater); + table2.resetColumnVisibility = (defaultState) => { var _table$initialState$c; - table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + table2.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table2.initialState.columnVisibility) != null ? _table$initialState$c : {}); }; - table.toggleAllColumnsVisible = (value) => { + table2.toggleAllColumnsVisible = (value) => { var _value; - value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); - table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column2) => ({ + value = (_value = value) != null ? _value : !table2.getIsAllColumnsVisible(); + table2.setColumnVisibility(table2.getAllLeafColumns().reduce((obj, column2) => ({ ...obj, [column2.id]: !value ? !(column2.getCanHide != null && column2.getCanHide()) : value }), {})); }; - table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some((column2) => !(column2.getIsVisible != null && column2.getIsVisible())); - table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some((column2) => column2.getIsVisible == null ? void 0 : column2.getIsVisible()); - table.getToggleAllColumnsVisibilityHandler = () => { + table2.getIsAllColumnsVisible = () => !table2.getAllLeafColumns().some((column2) => !(column2.getIsVisible != null && column2.getIsVisible())); + table2.getIsSomeColumnsVisible = () => table2.getAllLeafColumns().some((column2) => column2.getIsVisible == null ? void 0 : column2.getIsVisible()); + table2.getToggleAllColumnsVisibilityHandler = () => { return (e5) => { var _target; - table.toggleAllColumnsVisible((_target = e5.target) == null ? void 0 : _target.checked); + table2.toggleAllColumnsVisible((_target = e5.target) == null ? void 0 : _target.checked); }; }; } }; -function _getVisibleLeafColumns(table, position) { - return !position ? table.getVisibleLeafColumns() : position === "center" ? table.getCenterVisibleLeafColumns() : position === "left" ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); +function _getVisibleLeafColumns(table2, position3) { + return !position3 ? table2.getVisibleLeafColumns() : position3 === "center" ? table2.getCenterVisibleLeafColumns() : position3 === "left" ? table2.getLeftVisibleLeafColumns() : table2.getRightVisibleLeafColumns(); } var GlobalFiltering = { getInitialState: (state) => { @@ -104106,60 +104218,60 @@ var GlobalFiltering = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onGlobalFilterChange: makeStateUpdater("globalFilter", table), + onGlobalFilterChange: makeStateUpdater("globalFilter", table2), globalFilterFn: "auto", getColumnCanGlobalFilter: (column2) => { var _table$getCoreRowMode; - const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column2.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + const value = (_table$getCoreRowMode = table2.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column2.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); return typeof value === "string" || typeof value === "number"; } }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.getCanGlobalFilter = () => { var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; - return ((_column$columnDef$ena = column2.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column2)) != null ? _table$options$getCol : true) && !!column2.accessorFn; + return ((_column$columnDef$ena = column2.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table2.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table2.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table2.options.getColumnCanGlobalFilter == null ? void 0 : table2.options.getColumnCanGlobalFilter(column2)) != null ? _table$options$getCol : true) && !!column2.accessorFn; }; }, - createTable: (table) => { - table.getGlobalAutoFilterFn = () => { + createTable: (table2) => { + table2.getGlobalAutoFilterFn = () => { return filterFns.includesString; }; - table.getGlobalFilterFn = () => { + table2.getGlobalFilterFn = () => { var _table$options$filter, _table$options$filter2; const { globalFilterFn - } = table.options; - return isFunction2(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; + } = table2.options; + return isFunction2(globalFilterFn) ? globalFilterFn : globalFilterFn === "auto" ? table2.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table2.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; }; - table.setGlobalFilter = (updater) => { - table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + table2.setGlobalFilter = (updater) => { + table2.options.onGlobalFilterChange == null || table2.options.onGlobalFilterChange(updater); }; - table.resetGlobalFilter = (defaultState) => { - table.setGlobalFilter(defaultState ? void 0 : table.initialState.globalFilter); + table2.resetGlobalFilter = (defaultState) => { + table2.setGlobalFilter(defaultState ? void 0 : table2.initialState.globalFilter); }; - table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, "__global__"); - table.getGlobalFacetedRowModel = () => { - if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { - return table.getPreFilteredRowModel(); + table2._getGlobalFacetedRowModel = table2.options.getFacetedRowModel && table2.options.getFacetedRowModel(table2, "__global__"); + table2.getGlobalFacetedRowModel = () => { + if (table2.options.manualFiltering || !table2._getGlobalFacetedRowModel) { + return table2.getPreFilteredRowModel(); } - return table._getGlobalFacetedRowModel(); + return table2._getGlobalFacetedRowModel(); }; - table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, "__global__"); - table.getGlobalFacetedUniqueValues = () => { - if (!table._getGlobalFacetedUniqueValues) { + table2._getGlobalFacetedUniqueValues = table2.options.getFacetedUniqueValues && table2.options.getFacetedUniqueValues(table2, "__global__"); + table2.getGlobalFacetedUniqueValues = () => { + if (!table2._getGlobalFacetedUniqueValues) { return /* @__PURE__ */ new Map(); } - return table._getGlobalFacetedUniqueValues(); + return table2._getGlobalFacetedUniqueValues(); }; - table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, "__global__"); - table.getGlobalFacetedMinMaxValues = () => { - if (!table._getGlobalFacetedMinMaxValues) { + table2._getGlobalFacetedMinMaxValues = table2.options.getFacetedMinMaxValues && table2.options.getFacetedMinMaxValues(table2, "__global__"); + table2.getGlobalFacetedMinMaxValues = () => { + if (!table2._getGlobalFacetedMinMaxValues) { return; } - return table._getGlobalFacetedMinMaxValues(); + return table2._getGlobalFacetedMinMaxValues(); }; } }; @@ -104170,99 +104282,99 @@ var RowExpanding = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onExpandedChange: makeStateUpdater("expanded", table), + onExpandedChange: makeStateUpdater("expanded", table2), paginateExpandedRows: true }; }, - createTable: (table) => { + createTable: (table2) => { let registered = false; let queued = false; - table._autoResetExpanded = () => { + table2._autoResetExpanded = () => { var _ref, _table$options$autoRe; if (!registered) { - table._queue(() => { + table2._queue(() => { registered = true; }); return; } - if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if ((_ref = (_table$options$autoRe = table2.options.autoResetAll) != null ? _table$options$autoRe : table2.options.autoResetExpanded) != null ? _ref : !table2.options.manualExpanding) { if (queued) return; queued = true; - table._queue(() => { - table.resetExpanded(); + table2._queue(() => { + table2.resetExpanded(); queued = false; }); } }; - table.setExpanded = (updater) => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); - table.toggleAllRowsExpanded = (expanded) => { - if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { - table.setExpanded(true); + table2.setExpanded = (updater) => table2.options.onExpandedChange == null ? void 0 : table2.options.onExpandedChange(updater); + table2.toggleAllRowsExpanded = (expanded) => { + if (expanded != null ? expanded : !table2.getIsAllRowsExpanded()) { + table2.setExpanded(true); } else { - table.setExpanded({}); + table2.setExpanded({}); } }; - table.resetExpanded = (defaultState) => { + table2.resetExpanded = (defaultState) => { var _table$initialState$e, _table$initialState; - table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + table2.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); }; - table.getCanSomeRowsExpand = () => { - return table.getPrePaginationRowModel().flatRows.some((row2) => row2.getCanExpand()); + table2.getCanSomeRowsExpand = () => { + return table2.getPrePaginationRowModel().flatRows.some((row2) => row2.getCanExpand()); }; - table.getToggleAllRowsExpandedHandler = () => { + table2.getToggleAllRowsExpandedHandler = () => { return (e5) => { e5.persist == null || e5.persist(); - table.toggleAllRowsExpanded(); + table2.toggleAllRowsExpanded(); }; }; - table.getIsSomeRowsExpanded = () => { - const expanded = table.getState().expanded; + table2.getIsSomeRowsExpanded = () => { + const expanded = table2.getState().expanded; return expanded === true || Object.values(expanded).some(Boolean); }; - table.getIsAllRowsExpanded = () => { - const expanded = table.getState().expanded; + table2.getIsAllRowsExpanded = () => { + const expanded = table2.getState().expanded; if (typeof expanded === "boolean") { return expanded === true; } if (!Object.keys(expanded).length) { return false; } - if (table.getRowModel().flatRows.some((row2) => !row2.getIsExpanded())) { + if (table2.getRowModel().flatRows.some((row2) => !row2.getIsExpanded())) { return false; } return true; }; - table.getExpandedDepth = () => { + table2.getExpandedDepth = () => { let maxDepth = 0; - const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + const rowIds = table2.getState().expanded === true ? Object.keys(table2.getRowModel().rowsById) : Object.keys(table2.getState().expanded); rowIds.forEach((id3) => { const splitId = id3.split("."); maxDepth = Math.max(maxDepth, splitId.length); }); return maxDepth; }; - table.getPreExpandedRowModel = () => table.getSortedRowModel(); - table.getExpandedRowModel = () => { - if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { - table._getExpandedRowModel = table.options.getExpandedRowModel(table); + table2.getPreExpandedRowModel = () => table2.getSortedRowModel(); + table2.getExpandedRowModel = () => { + if (!table2._getExpandedRowModel && table2.options.getExpandedRowModel) { + table2._getExpandedRowModel = table2.options.getExpandedRowModel(table2); } - if (table.options.manualExpanding || !table._getExpandedRowModel) { - return table.getPreExpandedRowModel(); + if (table2.options.manualExpanding || !table2._getExpandedRowModel) { + return table2.getPreExpandedRowModel(); } - return table._getExpandedRowModel(); + return table2._getExpandedRowModel(); }; }, - createRow: (row2, table) => { + createRow: (row2, table2) => { row2.toggleExpanded = (expanded) => { - table.setExpanded((old) => { + table2.setExpanded((old) => { var _expanded; const exists = old === true ? true : !!(old != null && old[row2.id]); let oldExpanded = {}; if (old === true) { - Object.keys(table.getRowModel().rowsById).forEach((rowId) => { + Object.keys(table2.getRowModel().rowsById).forEach((rowId) => { oldExpanded[rowId] = true; }); } else { @@ -104287,18 +104399,18 @@ var RowExpanding = { }; row2.getIsExpanded = () => { var _table$options$getIsR; - const expanded = table.getState().expanded; - return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row2)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row2.id])); + const expanded = table2.getState().expanded; + return !!((_table$options$getIsR = table2.options.getIsRowExpanded == null ? void 0 : table2.options.getIsRowExpanded(row2)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row2.id])); }; row2.getCanExpand = () => { var _table$options$getRow, _table$options$enable, _row$subRows; - return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row2)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row2.subRows) != null && _row$subRows.length); + return (_table$options$getRow = table2.options.getRowCanExpand == null ? void 0 : table2.options.getRowCanExpand(row2)) != null ? _table$options$getRow : ((_table$options$enable = table2.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row2.subRows) != null && _row$subRows.length); }; row2.getIsAllParentsExpanded = () => { let isFullyExpanded = true; let currentRow = row2; while (isFullyExpanded && currentRow.parentId) { - currentRow = table.getRow(currentRow.parentId, true); + currentRow = table2.getRow(currentRow.parentId, true); isFullyExpanded = currentRow.getIsExpanded(); } return isFullyExpanded; @@ -104329,47 +104441,47 @@ var RowPagination = { } }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onPaginationChange: makeStateUpdater("pagination", table) + onPaginationChange: makeStateUpdater("pagination", table2) }; }, - createTable: (table) => { + createTable: (table2) => { let registered = false; let queued = false; - table._autoResetPageIndex = () => { + table2._autoResetPageIndex = () => { var _ref, _table$options$autoRe; if (!registered) { - table._queue(() => { + table2._queue(() => { registered = true; }); return; } - if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if ((_ref = (_table$options$autoRe = table2.options.autoResetAll) != null ? _table$options$autoRe : table2.options.autoResetPageIndex) != null ? _ref : !table2.options.manualPagination) { if (queued) return; queued = true; - table._queue(() => { - table.resetPageIndex(); + table2._queue(() => { + table2.resetPageIndex(); queued = false; }); } }; - table.setPagination = (updater) => { + table2.setPagination = (updater) => { const safeUpdater = (old) => { let newState = functionalUpdate(updater, old); return newState; }; - return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + return table2.options.onPaginationChange == null ? void 0 : table2.options.onPaginationChange(safeUpdater); }; - table.resetPagination = (defaultState) => { + table2.resetPagination = (defaultState) => { var _table$initialState$p; - table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + table2.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table2.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); }; - table.setPageIndex = (updater) => { - table.setPagination((old) => { + table2.setPageIndex = (updater) => { + table2.setPagination((old) => { let pageIndex = functionalUpdate(updater, old.pageIndex); - const maxPageIndex = typeof table.options.pageCount === "undefined" || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + const maxPageIndex = typeof table2.options.pageCount === "undefined" || table2.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table2.options.pageCount - 1; pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); return { ...old, @@ -104377,16 +104489,16 @@ var RowPagination = { }; }); }; - table.resetPageIndex = (defaultState) => { + table2.resetPageIndex = (defaultState) => { var _table$initialState$p2, _table$initialState; - table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + table2.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table2.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); }; - table.resetPageSize = (defaultState) => { + table2.resetPageSize = (defaultState) => { var _table$initialState$p3, _table$initialState2; - table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + table2.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table2.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); }; - table.setPageSize = (updater) => { - table.setPagination((old) => { + table2.setPageSize = (updater) => { + table2.setPagination((old) => { const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)); const topRowIndex = old.pageSize * old.pageIndex; const pageIndex = Math.floor(topRowIndex / pageSize); @@ -104397,9 +104509,9 @@ var RowPagination = { }; }); }; - table.setPageCount = (updater) => table.setPagination((old) => { + table2.setPageCount = (updater) => table2.setPagination((old) => { var _table$options$pageCo; - let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table2.options.pageCount) != null ? _table$options$pageCo : -1); if (typeof newPageCount === "number") { newPageCount = Math.max(-1, newPageCount); } @@ -104408,19 +104520,19 @@ var RowPagination = { pageCount: newPageCount }; }); - table.getPageOptions = memo2(() => [table.getPageCount()], (pageCount) => { + table2.getPageOptions = memo2(() => [table2.getPageCount()], (pageCount) => { let pageOptions = []; if (pageCount && pageCount > 0) { pageOptions = [...new Array(pageCount)].fill(null).map((_15, i4) => i4); } return pageOptions; - }, getMemoOptions(table.options, "debugTable", "getPageOptions")); - table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; - table.getCanNextPage = () => { + }, getMemoOptions(table2.options, "debugTable", "getPageOptions")); + table2.getCanPreviousPage = () => table2.getState().pagination.pageIndex > 0; + table2.getCanNextPage = () => { const { pageIndex - } = table.getState().pagination; - const pageCount = table.getPageCount(); + } = table2.getState().pagination; + const pageCount = table2.getPageCount(); if (pageCount === -1) { return true; } @@ -104429,37 +104541,37 @@ var RowPagination = { } return pageIndex < pageCount - 1; }; - table.previousPage = () => { - return table.setPageIndex((old) => old - 1); + table2.previousPage = () => { + return table2.setPageIndex((old) => old - 1); }; - table.nextPage = () => { - return table.setPageIndex((old) => { + table2.nextPage = () => { + return table2.setPageIndex((old) => { return old + 1; }); }; - table.firstPage = () => { - return table.setPageIndex(0); + table2.firstPage = () => { + return table2.setPageIndex(0); }; - table.lastPage = () => { - return table.setPageIndex(table.getPageCount() - 1); + table2.lastPage = () => { + return table2.setPageIndex(table2.getPageCount() - 1); }; - table.getPrePaginationRowModel = () => table.getExpandedRowModel(); - table.getPaginationRowModel = () => { - if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { - table._getPaginationRowModel = table.options.getPaginationRowModel(table); + table2.getPrePaginationRowModel = () => table2.getExpandedRowModel(); + table2.getPaginationRowModel = () => { + if (!table2._getPaginationRowModel && table2.options.getPaginationRowModel) { + table2._getPaginationRowModel = table2.options.getPaginationRowModel(table2); } - if (table.options.manualPagination || !table._getPaginationRowModel) { - return table.getPrePaginationRowModel(); + if (table2.options.manualPagination || !table2._getPaginationRowModel) { + return table2.getPrePaginationRowModel(); } - return table._getPaginationRowModel(); + return table2._getPaginationRowModel(); }; - table.getPageCount = () => { + table2.getPageCount = () => { var _table$options$pageCo2; - return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + return (_table$options$pageCo2 = table2.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table2.getRowCount() / table2.getState().pagination.pageSize); }; - table.getRowCount = () => { + table2.getRowCount = () => { var _table$options$rowCou; - return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + return (_table$options$rowCou = table2.options.rowCount) != null ? _table$options$rowCou : table2.getPrePaginationRowModel().rows.length; }; } }; @@ -104474,13 +104586,13 @@ var RowPinning = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onRowPinningChange: makeStateUpdater("rowPinning", table) + onRowPinningChange: makeStateUpdater("rowPinning", table2) }; }, - createRow: (row2, table) => { - row2.pin = (position, includeLeafRows, includeParentRows) => { + createRow: (row2, table2) => { + row2.pin = (position3, includeLeafRows, includeParentRows) => { const leafRowIds = includeLeafRows ? row2.getLeafRows().map((_ref) => { let { id: id3 @@ -104494,16 +104606,16 @@ var RowPinning = { return id3; }) : []; const rowIds = /* @__PURE__ */ new Set([...parentRowIds, row2.id, ...leafRowIds]); - table.setRowPinning((old) => { + table2.setRowPinning((old) => { var _old$top3, _old$bottom3; - if (position === "bottom") { + if (position3 === "bottom") { var _old$top, _old$bottom; return { top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter((d4) => !(rowIds != null && rowIds.has(d4))), bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter((d4) => !(rowIds != null && rowIds.has(d4))), ...Array.from(rowIds)] }; } - if (position === "top") { + if (position3 === "top") { var _old$top2, _old$bottom2; return { top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter((d4) => !(rowIds != null && rowIds.has(d4))), ...Array.from(rowIds)], @@ -104521,7 +104633,7 @@ var RowPinning = { const { enableRowPinning, enablePinning - } = table.options; + } = table2.options; if (typeof enableRowPinning === "function") { return enableRowPinning(row2); } @@ -104532,17 +104644,17 @@ var RowPinning = { const { top, bottom - } = table.getState().rowPinning; + } = table2.getState().rowPinning; const isTop = rowIds.some((d4) => top == null ? void 0 : top.includes(d4)); const isBottom = rowIds.some((d4) => bottom == null ? void 0 : bottom.includes(d4)); return isTop ? "top" : isBottom ? "bottom" : false; }; row2.getPinnedIndex = () => { var _table$_getPinnedRows, _visiblePinnedRowIds$; - const position = row2.getIsPinned(); - if (!position) + const position3 = row2.getIsPinned(); + if (!position3) return -1; - const visiblePinnedRowIds = (_table$_getPinnedRows = table._getPinnedRows(position)) == null ? void 0 : _table$_getPinnedRows.map((_ref4) => { + const visiblePinnedRowIds = (_table$_getPinnedRows = table2._getPinnedRows(position3)) == null ? void 0 : _table$_getPinnedRows.map((_ref4) => { let { id: id3 } = _ref4; @@ -104551,38 +104663,38 @@ var RowPinning = { return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row2.id)) != null ? _visiblePinnedRowIds$ : -1; }; }, - createTable: (table) => { - table.setRowPinning = (updater) => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); - table.resetRowPinning = (defaultState) => { + createTable: (table2) => { + table2.setRowPinning = (updater) => table2.options.onRowPinningChange == null ? void 0 : table2.options.onRowPinningChange(updater); + table2.resetRowPinning = (defaultState) => { var _table$initialState$r, _table$initialState; - return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + return table2.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); }; - table.getIsSomeRowsPinned = (position) => { + table2.getIsSomeRowsPinned = (position3) => { var _pinningState$positio; - const pinningState = table.getState().rowPinning; - if (!position) { + const pinningState = table2.getState().rowPinning; + if (!position3) { var _pinningState$top, _pinningState$bottom; return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); } - return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + return Boolean((_pinningState$positio = pinningState[position3]) == null ? void 0 : _pinningState$positio.length); }; - table._getPinnedRows = memo2((position) => [table.getRowModel().rows, table.getState().rowPinning[position], position], (visibleRows, pinnedRowIds, position) => { + table2._getPinnedRows = memo2((position3) => [table2.getRowModel().rows, table2.getState().rowPinning[position3], position3], (visibleRows, pinnedRowIds, position3) => { var _table$options$keepPi; - const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => { - const row2 = table.getRow(rowId, true); + const rows = ((_table$options$keepPi = table2.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => { + const row2 = table2.getRow(rowId, true); return row2.getIsAllParentsExpanded() ? row2 : null; }) : (pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => visibleRows.find((row2) => row2.id === rowId)); return rows.filter(Boolean).map((d4) => ({ ...d4, - position + position: position3 })); - }, getMemoOptions(table.options, "debugRows", "_getPinnedRows")); - table.getTopRows = () => table._getPinnedRows("top"); - table.getBottomRows = () => table._getPinnedRows("bottom"); - table.getCenterRows = memo2(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + }, getMemoOptions(table2.options, "debugRows", "_getPinnedRows")); + table2.getTopRows = () => table2._getPinnedRows("top"); + table2.getBottomRows = () => table2._getPinnedRows("bottom"); + table2.getCenterRows = memo2(() => [table2.getRowModel().rows, table2.getState().rowPinning.top, table2.getState().rowPinning.bottom], (allRows, top, bottom) => { const topAndBottom = /* @__PURE__ */ new Set([...top != null ? top : [], ...bottom != null ? bottom : []]); return allRows.filter((d4) => !topAndBottom.has(d4.id)); - }, getMemoOptions(table.options, "debugRows", "getCenterRows")); + }, getMemoOptions(table2.options, "debugRows", "getCenterRows")); } }; var RowSelection = { @@ -104592,27 +104704,27 @@ var RowSelection = { ...state }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onRowSelectionChange: makeStateUpdater("rowSelection", table), + onRowSelectionChange: makeStateUpdater("rowSelection", table2), enableRowSelection: true, enableMultiRowSelection: true, enableSubRowSelection: true }; }, - createTable: (table) => { - table.setRowSelection = (updater) => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); - table.resetRowSelection = (defaultState) => { + createTable: (table2) => { + table2.setRowSelection = (updater) => table2.options.onRowSelectionChange == null ? void 0 : table2.options.onRowSelectionChange(updater); + table2.resetRowSelection = (defaultState) => { var _table$initialState$r; - return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + return table2.setRowSelection(defaultState ? {} : (_table$initialState$r = table2.initialState.rowSelection) != null ? _table$initialState$r : {}); }; - table.toggleAllRowsSelected = (value) => { - table.setRowSelection((old) => { - value = typeof value !== "undefined" ? value : !table.getIsAllRowsSelected(); + table2.toggleAllRowsSelected = (value) => { + table2.setRowSelection((old) => { + value = typeof value !== "undefined" ? value : !table2.getIsAllRowsSelected(); const rowSelection = { ...old }; - const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + const preGroupedFlatRows = table2.getPreGroupedRowModel().flatRows; if (value) { preGroupedFlatRows.forEach((row2) => { if (!row2.getCanSelect()) { @@ -104628,18 +104740,18 @@ var RowSelection = { return rowSelection; }); }; - table.toggleAllPageRowsSelected = (value) => table.setRowSelection((old) => { - const resolvedValue = typeof value !== "undefined" ? value : !table.getIsAllPageRowsSelected(); + table2.toggleAllPageRowsSelected = (value) => table2.setRowSelection((old) => { + const resolvedValue = typeof value !== "undefined" ? value : !table2.getIsAllPageRowsSelected(); const rowSelection = { ...old }; - table.getRowModel().rows.forEach((row2) => { - mutateRowIsSelected(rowSelection, row2.id, resolvedValue, true, table); + table2.getRowModel().rows.forEach((row2) => { + mutateRowIsSelected(rowSelection, row2.id, resolvedValue, true, table2); }); return rowSelection; }); - table.getPreSelectedRowModel = () => table.getCoreRowModel(); - table.getSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + table2.getPreSelectedRowModel = () => table2.getCoreRowModel(); + table2.getSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getCoreRowModel()], (rowSelection, rowModel) => { if (!Object.keys(rowSelection).length) { return { rows: [], @@ -104647,9 +104759,9 @@ var RowSelection = { rowsById: {} }; } - return selectRowsFn(table, rowModel); - }, getMemoOptions(table.options, "debugTable", "getSelectedRowModel")); - table.getFilteredSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + return selectRowsFn(table2, rowModel); + }, getMemoOptions(table2.options, "debugTable", "getSelectedRowModel")); + table2.getFilteredSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getFilteredRowModel()], (rowSelection, rowModel) => { if (!Object.keys(rowSelection).length) { return { rows: [], @@ -104657,9 +104769,9 @@ var RowSelection = { rowsById: {} }; } - return selectRowsFn(table, rowModel); - }, getMemoOptions(table.options, "debugTable", "getFilteredSelectedRowModel")); - table.getGroupedSelectedRowModel = memo2(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + return selectRowsFn(table2, rowModel); + }, getMemoOptions(table2.options, "debugTable", "getFilteredSelectedRowModel")); + table2.getGroupedSelectedRowModel = memo2(() => [table2.getState().rowSelection, table2.getSortedRowModel()], (rowSelection, rowModel) => { if (!Object.keys(rowSelection).length) { return { rows: [], @@ -104667,13 +104779,13 @@ var RowSelection = { rowsById: {} }; } - return selectRowsFn(table, rowModel); - }, getMemoOptions(table.options, "debugTable", "getGroupedSelectedRowModel")); - table.getIsAllRowsSelected = () => { - const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + return selectRowsFn(table2, rowModel); + }, getMemoOptions(table2.options, "debugTable", "getGroupedSelectedRowModel")); + table2.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table2.getFilteredRowModel().flatRows; const { rowSelection - } = table.getState(); + } = table2.getState(); let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); if (isAllRowsSelected) { if (preGroupedFlatRows.some((row2) => row2.getCanSelect() && !rowSelection[row2.id])) { @@ -104682,41 +104794,41 @@ var RowSelection = { } return isAllRowsSelected; }; - table.getIsAllPageRowsSelected = () => { - const paginationFlatRows = table.getPaginationRowModel().flatRows.filter((row2) => row2.getCanSelect()); + table2.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table2.getPaginationRowModel().flatRows.filter((row2) => row2.getCanSelect()); const { rowSelection - } = table.getState(); + } = table2.getState(); let isAllPageRowsSelected = !!paginationFlatRows.length; if (isAllPageRowsSelected && paginationFlatRows.some((row2) => !rowSelection[row2.id])) { isAllPageRowsSelected = false; } return isAllPageRowsSelected; }; - table.getIsSomeRowsSelected = () => { + table2.getIsSomeRowsSelected = () => { var _table$getState$rowSe; - const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; - return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + const totalSelected = Object.keys((_table$getState$rowSe = table2.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table2.getFilteredRowModel().flatRows.length; }; - table.getIsSomePageRowsSelected = () => { - const paginationFlatRows = table.getPaginationRowModel().flatRows; - return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter((row2) => row2.getCanSelect()).some((d4) => d4.getIsSelected() || d4.getIsSomeSelected()); + table2.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table2.getPaginationRowModel().flatRows; + return table2.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter((row2) => row2.getCanSelect()).some((d4) => d4.getIsSelected() || d4.getIsSomeSelected()); }; - table.getToggleAllRowsSelectedHandler = () => { + table2.getToggleAllRowsSelectedHandler = () => { return (e5) => { - table.toggleAllRowsSelected(e5.target.checked); + table2.toggleAllRowsSelected(e5.target.checked); }; }; - table.getToggleAllPageRowsSelectedHandler = () => { + table2.getToggleAllPageRowsSelectedHandler = () => { return (e5) => { - table.toggleAllPageRowsSelected(e5.target.checked); + table2.toggleAllPageRowsSelected(e5.target.checked); }; }; }, - createRow: (row2, table) => { + createRow: (row2, table2) => { row2.toggleSelected = (value, opts) => { const isSelected = row2.getIsSelected(); - table.setRowSelection((old) => { + table2.setRowSelection((old) => { var _opts$selectChildren; value = typeof value !== "undefined" ? value : !isSelected; if (row2.getCanSelect() && isSelected === value) { @@ -104725,48 +104837,48 @@ var RowSelection = { const selectedRowIds = { ...old }; - mutateRowIsSelected(selectedRowIds, row2.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + mutateRowIsSelected(selectedRowIds, row2.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table2); return selectedRowIds; }); }; row2.getIsSelected = () => { const { rowSelection - } = table.getState(); + } = table2.getState(); return isRowSelected(row2, rowSelection); }; row2.getIsSomeSelected = () => { const { rowSelection - } = table.getState(); + } = table2.getState(); return isSubRowSelected(row2, rowSelection) === "some"; }; row2.getIsAllSubRowsSelected = () => { const { rowSelection - } = table.getState(); + } = table2.getState(); return isSubRowSelected(row2, rowSelection) === "all"; }; row2.getCanSelect = () => { var _table$options$enable; - if (typeof table.options.enableRowSelection === "function") { - return table.options.enableRowSelection(row2); + if (typeof table2.options.enableRowSelection === "function") { + return table2.options.enableRowSelection(row2); } - return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + return (_table$options$enable = table2.options.enableRowSelection) != null ? _table$options$enable : true; }; row2.getCanSelectSubRows = () => { var _table$options$enable2; - if (typeof table.options.enableSubRowSelection === "function") { - return table.options.enableSubRowSelection(row2); + if (typeof table2.options.enableSubRowSelection === "function") { + return table2.options.enableSubRowSelection(row2); } - return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + return (_table$options$enable2 = table2.options.enableSubRowSelection) != null ? _table$options$enable2 : true; }; row2.getCanMultiSelect = () => { var _table$options$enable3; - if (typeof table.options.enableMultiRowSelection === "function") { - return table.options.enableMultiRowSelection(row2); + if (typeof table2.options.enableMultiRowSelection === "function") { + return table2.options.enableMultiRowSelection(row2); } - return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + return (_table$options$enable3 = table2.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; }; row2.getToggleSelectedHandler = () => { const canSelect = row2.getCanSelect(); @@ -104779,12 +104891,12 @@ var RowSelection = { }; } }; -var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table) => { +var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table2) => { var _row$subRows; - const row2 = table.getRow(id3, true); + const row2 = table2.getRow(id3, true); if (value) { if (!row2.getCanMultiSelect()) { - Object.keys(selectedRowIds).forEach((key2) => delete selectedRowIds[key2]); + Object.keys(selectedRowIds).forEach((key3) => delete selectedRowIds[key3]); } if (row2.getCanSelect()) { selectedRowIds[id3] = true; @@ -104793,11 +104905,11 @@ var mutateRowIsSelected = (selectedRowIds, id3, value, includeChildren, table) = delete selectedRowIds[id3]; } if (includeChildren && (_row$subRows = row2.subRows) != null && _row$subRows.length && row2.getCanSelectSubRows()) { - row2.subRows.forEach((row3) => mutateRowIsSelected(selectedRowIds, row3.id, value, includeChildren, table)); + row2.subRows.forEach((row3) => mutateRowIsSelected(selectedRowIds, row3.id, value, includeChildren, table2)); } }; -function selectRowsFn(table, rowModel) { - const rowSelection = table.getState().rowSelection; +function selectRowsFn(table2, rowModel) { + const rowSelection = table2.getState().rowSelection; const newSelectedFlatRows = []; const newSelectedRowsById = {}; const recurseRows = function(rows, depth) { @@ -104829,7 +104941,7 @@ function isRowSelected(row2, selection2) { var _selection$row$id; return (_selection$row$id = selection2[row2.id]) != null ? _selection$row$id : false; } -function isSubRowSelected(row2, selection2, table) { +function isSubRowSelected(row2, selection2, table2) { var _row$subRows3; if (!((_row$subRows3 = row2.subRows) != null && _row$subRows3.length)) return false; @@ -104947,17 +105059,17 @@ var RowSorting = { sortUndefined: 1 }; }, - getDefaultOptions: (table) => { + getDefaultOptions: (table2) => { return { - onSortingChange: makeStateUpdater("sorting", table), + onSortingChange: makeStateUpdater("sorting", table2), isMultiSortEvent: (e5) => { return e5.shiftKey; } }; }, - createColumn: (column2, table) => { + createColumn: (column2, table2) => { column2.getAutoSortingFn = () => { - const firstRows = table.getFilteredRowModel().flatRows.slice(10); + const firstRows = table2.getFilteredRowModel().flatRows.slice(10); let isString5 = false; for (const row2 of firstRows) { const value = row2 == null ? void 0 : row2.getValue(column2.id); @@ -104977,7 +105089,7 @@ var RowSorting = { return sortingFns.basic; }; column2.getAutoSortDir = () => { - const firstRow = table.getFilteredRowModel().flatRows[0]; + const firstRow = table2.getFilteredRowModel().flatRows[0]; const value = firstRow == null ? void 0 : firstRow.getValue(column2.id); if (typeof value === "string") { return "asc"; @@ -104989,12 +105101,12 @@ var RowSorting = { if (!column2) { throw new Error(); } - return isFunction2(column2.columnDef.sortingFn) ? column2.columnDef.sortingFn : column2.columnDef.sortingFn === "auto" ? column2.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column2.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column2.columnDef.sortingFn]; + return isFunction2(column2.columnDef.sortingFn) ? column2.columnDef.sortingFn : column2.columnDef.sortingFn === "auto" ? column2.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table2.options.sortingFns) == null ? void 0 : _table$options$sortin2[column2.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column2.columnDef.sortingFn]; }; column2.toggleSorting = (desc, multi) => { const nextSortingOrder = column2.getNextSortingOrder(); const hasManualValue = typeof desc !== "undefined" && desc !== null; - table.setSorting((old) => { + table2.setSorting((old) => { const existingSorting = old == null ? void 0 : old.find((d4) => d4.id === column2.id); const existingIndex = old == null ? void 0 : old.findIndex((d4) => d4.id === column2.id); let newSorting = []; @@ -105028,7 +105140,7 @@ var RowSorting = { id: column2.id, desc: nextDesc }]; - newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table2.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); } else if (sortAction === "toggle") { newSorting = old.map((d4) => { if (d4.id === column2.id) { @@ -105052,7 +105164,7 @@ var RowSorting = { }; column2.getFirstSortDir = () => { var _ref, _column$columnDef$sor; - const sortDescFirst = (_ref = (_column$columnDef$sor = column2.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column2.getAutoSortDir() === "desc"; + const sortDescFirst = (_ref = (_column$columnDef$sor = column2.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table2.options.sortDescFirst) != null ? _ref : column2.getAutoSortDir() === "desc"; return sortDescFirst ? "desc" : "asc"; }; column2.getNextSortingOrder = (multi) => { @@ -105062,30 +105174,30 @@ var RowSorting = { if (!isSorted) { return firstSortDirection; } - if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true)) { + if (isSorted !== firstSortDirection && ((_table$options$enable = table2.options.enableSortingRemoval) != null ? _table$options$enable : true) && (multi ? (_table$options$enable2 = table2.options.enableMultiRemove) != null ? _table$options$enable2 : true : true)) { return false; } return isSorted === "desc" ? "asc" : "desc"; }; column2.getCanSort = () => { var _column$columnDef$ena, _table$options$enable3; - return ((_column$columnDef$ena = column2.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column2.accessorFn; + return ((_column$columnDef$ena = column2.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table2.options.enableSorting) != null ? _table$options$enable3 : true) && !!column2.accessorFn; }; column2.getCanMultiSort = () => { var _ref2, _column$columnDef$ena2; - return (_ref2 = (_column$columnDef$ena2 = column2.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column2.accessorFn; + return (_ref2 = (_column$columnDef$ena2 = column2.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table2.options.enableMultiSort) != null ? _ref2 : !!column2.accessorFn; }; column2.getIsSorted = () => { var _table$getState$sorti; - const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d4) => d4.id === column2.id); + const columnSort = (_table$getState$sorti = table2.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d4) => d4.id === column2.id); return !columnSort ? false : columnSort.desc ? "desc" : "asc"; }; column2.getSortIndex = () => { var _table$getState$sorti2, _table$getState$sorti3; - return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$sorti2 : -1; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table2.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d4) => d4.id === column2.id)) != null ? _table$getState$sorti2 : -1; }; column2.clearSorting = () => { - table.setSorting((old) => old != null && old.length ? old.filter((d4) => d4.id !== column2.id) : []); + table2.setSorting((old) => old != null && old.length ? old.filter((d4) => d4.id !== column2.id) : []); }; column2.getToggleSortingHandler = () => { const canSort = column2.getCanSort(); @@ -105093,25 +105205,25 @@ var RowSorting = { if (!canSort) return; e5.persist == null || e5.persist(); - column2.toggleSorting == null || column2.toggleSorting(void 0, column2.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e5) : false); + column2.toggleSorting == null || column2.toggleSorting(void 0, column2.getCanMultiSort() ? table2.options.isMultiSortEvent == null ? void 0 : table2.options.isMultiSortEvent(e5) : false); }; }; }, - createTable: (table) => { - table.setSorting = (updater) => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); - table.resetSorting = (defaultState) => { + createTable: (table2) => { + table2.setSorting = (updater) => table2.options.onSortingChange == null ? void 0 : table2.options.onSortingChange(updater); + table2.resetSorting = (defaultState) => { var _table$initialState$s, _table$initialState; - table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + table2.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table2.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); }; - table.getPreSortedRowModel = () => table.getGroupedRowModel(); - table.getSortedRowModel = () => { - if (!table._getSortedRowModel && table.options.getSortedRowModel) { - table._getSortedRowModel = table.options.getSortedRowModel(table); + table2.getPreSortedRowModel = () => table2.getGroupedRowModel(); + table2.getSortedRowModel = () => { + if (!table2._getSortedRowModel && table2.options.getSortedRowModel) { + table2._getSortedRowModel = table2.options.getSortedRowModel(table2); } - if (table.options.manualSorting || !table._getSortedRowModel) { - return table.getPreSortedRowModel(); + if (table2.options.manualSorting || !table2._getSortedRowModel) { + return table2.getPreSortedRowModel(); } - return table._getSortedRowModel(); + return table2._getSortedRowModel(); }; } }; @@ -105137,15 +105249,15 @@ function createTable(options) { console.info("Creating Table Instance..."); } const _features = [...builtInFeatures, ...(_options$_features = options._features) != null ? _options$_features : []]; - let table = { + let table2 = { _features }; - const defaultOptions4 = table._features.reduce((obj, feature) => { - return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + const defaultOptions4 = table2._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table2)); }, {}); const mergeOptions = (options2) => { - if (table.options.mergeOptions) { - return table.options.mergeOptions(defaultOptions4, options2); + if (table2.options.mergeOptions) { + return table2.options.mergeOptions(defaultOptions4, options2); } return { ...defaultOptions4, @@ -105157,7 +105269,7 @@ function createTable(options) { ...coreInitialState, ...(_options$initialState = options.initialState) != null ? _options$initialState : {} }; - table._features.forEach((feature) => { + table2._features.forEach((feature) => { var _feature$getInitialSt; initialState2 = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState2)) != null ? _feature$getInitialSt : initialState2; }); @@ -105185,35 +105297,35 @@ function createTable(options) { } }, reset: () => { - table.setState(table.initialState); + table2.setState(table2.initialState); }, setOptions: (updater) => { - const newOptions = functionalUpdate(updater, table.options); - table.options = mergeOptions(newOptions); + const newOptions = functionalUpdate(updater, table2.options); + table2.options = mergeOptions(newOptions); }, getState: () => { - return table.options.state; + return table2.options.state; }, setState: (updater) => { - table.options.onStateChange == null || table.options.onStateChange(updater); + table2.options.onStateChange == null || table2.options.onStateChange(updater); }, - _getRowId: (row2, index2, parent) => { + _getRowId: (row2, index3, parent) => { var _table$options$getRow; - return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row2, index2, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index2].join(".") : index2}`; + return (_table$options$getRow = table2.options.getRowId == null ? void 0 : table2.options.getRowId(row2, index3, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index3].join(".") : index3}`; }, getCoreRowModel: () => { - if (!table._getCoreRowModel) { - table._getCoreRowModel = table.options.getCoreRowModel(table); + if (!table2._getCoreRowModel) { + table2._getCoreRowModel = table2.options.getCoreRowModel(table2); } - return table._getCoreRowModel(); + return table2._getCoreRowModel(); }, getRowModel: () => { - return table.getPaginationRowModel(); + return table2.getPaginationRowModel(); }, getRow: (id3, searchAll) => { - let row2 = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id3]; + let row2 = (searchAll ? table2.getPrePaginationRowModel() : table2.getRowModel()).rowsById[id3]; if (!row2) { - row2 = table.getCoreRowModel().rowsById[id3]; + row2 = table2.getCoreRowModel().rowsById[id3]; if (!row2) { if (false) { throw new Error(`getRow could not find row with ID: ${id3}`); @@ -105223,7 +105335,7 @@ function createTable(options) { } return row2; }, - _getDefaultColumnDef: memo2(() => [table.options.defaultColumn], (defaultColumn) => { + _getDefaultColumnDef: memo2(() => [table2.options.defaultColumn], (defaultColumn) => { var _defaultColumn; defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; return { @@ -105241,20 +105353,20 @@ function createTable(options) { var _props$renderValue$to, _props$renderValue; return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; }, - ...table._features.reduce((obj, feature) => { + ...table2._features.reduce((obj, feature) => { return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); }, {}), ...defaultColumn }; }, getMemoOptions(options, "debugColumns", "_getDefaultColumnDef")), - _getColumnDefs: () => table.options.columns, - getAllColumns: memo2(() => [table._getColumnDefs()], (columnDefs) => { + _getColumnDefs: () => table2.options.columns, + getAllColumns: memo2(() => [table2._getColumnDefs()], (columnDefs) => { const recurseColumns = function(columnDefs2, parent, depth) { if (depth === void 0) { depth = 0; } return columnDefs2.map((columnDef) => { - const column2 = createColumn2(table, columnDef, depth, parent); + const column2 = createColumn2(table2, columnDef, depth, parent); const groupingColumnDef = columnDef; column2.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column2, depth + 1) : []; return column2; @@ -105262,38 +105374,38 @@ function createTable(options) { }; return recurseColumns(columnDefs); }, getMemoOptions(options, "debugColumns", "getAllColumns")), - getAllFlatColumns: memo2(() => [table.getAllColumns()], (allColumns) => { + getAllFlatColumns: memo2(() => [table2.getAllColumns()], (allColumns) => { return allColumns.flatMap((column2) => { return column2.getFlatColumns(); }); }, getMemoOptions(options, "debugColumns", "getAllFlatColumns")), - _getAllFlatColumnsById: memo2(() => [table.getAllFlatColumns()], (flatColumns) => { + _getAllFlatColumnsById: memo2(() => [table2.getAllFlatColumns()], (flatColumns) => { return flatColumns.reduce((acc, column2) => { acc[column2.id] = column2; return acc; }, {}); }, getMemoOptions(options, "debugColumns", "getAllFlatColumnsById")), - getAllLeafColumns: memo2(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => { + getAllLeafColumns: memo2(() => [table2.getAllColumns(), table2._getOrderColumnsFn()], (allColumns, orderColumns2) => { let leafColumns = allColumns.flatMap((column2) => column2.getLeafColumns()); return orderColumns2(leafColumns); }, getMemoOptions(options, "debugColumns", "getAllLeafColumns")), getColumn: (columnId) => { - const column2 = table._getAllFlatColumnsById()[columnId]; + const column2 = table2._getAllFlatColumnsById()[columnId]; if (false) { console.error(`[Table] Column with id '${columnId}' does not exist.`); } return column2; } }; - Object.assign(table, coreInstance); - for (let index2 = 0; index2 < table._features.length; index2++) { - const feature = table._features[index2]; - feature == null || feature.createTable == null || feature.createTable(table); + Object.assign(table2, coreInstance); + for (let index3 = 0; index3 < table2._features.length; index3++) { + const feature = table2._features[index3]; + feature == null || feature.createTable == null || feature.createTable(table2); } - return table; + return table2; } function getCoreRowModel() { - return (table) => memo2(() => [table.options.data], (data2) => { + return (table2) => memo2(() => [table2.options.data], (data3) => { const rowModel = { rows: [], flatRows: [], @@ -105305,13 +105417,13 @@ function getCoreRowModel() { } const rows = []; for (let i4 = 0; i4 < originalRows.length; i4++) { - const row2 = createRow2(table, table._getRowId(originalRows[i4], i4, parentRow), originalRows[i4], i4, depth, void 0, parentRow == null ? void 0 : parentRow.id); + const row2 = createRow2(table2, table2._getRowId(originalRows[i4], i4, parentRow), originalRows[i4], i4, depth, void 0, parentRow == null ? void 0 : parentRow.id); rowModel.flatRows.push(row2); rowModel.rowsById[row2.id] = row2; rows.push(row2); - if (table.options.getSubRows) { + if (table2.options.getSubRows) { var _row$originalSubRows; - row2.originalSubRows = table.options.getSubRows(originalRows[i4], i4); + row2.originalSubRows = table2.options.getSubRows(originalRows[i4], i4); if ((_row$originalSubRows = row2.originalSubRows) != null && _row$originalSubRows.length) { row2.subRows = accessRows(row2.originalSubRows, depth + 1, row2); } @@ -105319,12 +105431,12 @@ function getCoreRowModel() { } return rows; }; - rowModel.rows = accessRows(data2); + rowModel.rows = accessRows(data3); return rowModel; - }, getMemoOptions(table.options, "debugTable", "getRowModel", () => table._autoResetPageIndex())); + }, getMemoOptions(table2.options, "debugTable", "getRowModel", () => table2._autoResetPageIndex())); } function getExpandedRowModel() { - return (table) => memo2(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + return (table2) => memo2(() => [table2.getState().expanded, table2.getPreExpandedRowModel(), table2.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { return rowModel; } @@ -105332,7 +105444,7 @@ function getExpandedRowModel() { return rowModel; } return expandRows(rowModel); - }, getMemoOptions(table.options, "debugTable", "getExpandedRowModel")); + }, getMemoOptions(table2.options, "debugTable", "getExpandedRowModel")); } function expandRows(rowModel) { const expandedRows = []; @@ -105351,11 +105463,11 @@ function expandRows(rowModel) { }; } function getGroupedRowModel() { - return (table) => memo2(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + return (table2) => memo2(() => [table2.getState().grouping, table2.getPreGroupedRowModel()], (grouping, rowModel) => { if (!rowModel.rows.length || !grouping.length) { return rowModel; } - const existingGrouping = grouping.filter((columnId) => table.getColumn(columnId)); + const existingGrouping = grouping.filter((columnId) => table2.getColumn(columnId)); const groupedFlatRows = []; const groupedRowsById = {}; const groupUpRecursively = function(rows, depth, parentId) { @@ -105375,13 +105487,13 @@ function getGroupedRowModel() { } const columnId = existingGrouping[depth]; const rowGroupsMap = groupBy(rows, columnId); - const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index2) => { + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index3) => { let [groupingValue, groupedRows2] = _ref; let id3 = `${columnId}:${groupingValue}`; id3 = parentId ? `${parentId}>${id3}` : id3; const subRows = groupUpRecursively(groupedRows2, depth + 1, id3); const leafRows = depth ? flattenBy(groupedRows2, (row3) => row3.subRows) : groupedRows2; - const row2 = createRow2(table, id3, leafRows[0].original, index2, depth, void 0, parentId); + const row2 = createRow2(table2, id3, leafRows[0].original, index3, depth, void 0, parentId); Object.assign(row2, { groupingColumnId: columnId, groupingValue, @@ -105401,7 +105513,7 @@ function getGroupedRowModel() { if (row2._groupingValuesCache.hasOwnProperty(columnId2)) { return row2._groupingValuesCache[columnId2]; } - const column2 = table.getColumn(columnId2); + const column2 = table2.getColumn(columnId2); const aggregateFn = column2 == null ? void 0 : column2.getAggregationFn(); if (aggregateFn) { row2._groupingValuesCache[columnId2] = aggregateFn(columnId2, leafRows, groupedRows2); @@ -105427,28 +105539,28 @@ function getGroupedRowModel() { flatRows: groupedFlatRows, rowsById: groupedRowsById }; - }, getMemoOptions(table.options, "debugTable", "getGroupedRowModel", () => { - table._queue(() => { - table._autoResetExpanded(); - table._autoResetPageIndex(); + }, getMemoOptions(table2.options, "debugTable", "getGroupedRowModel", () => { + table2._queue(() => { + table2._autoResetExpanded(); + table2._autoResetPageIndex(); }); })); } function groupBy(rows, columnId) { const groupMap = /* @__PURE__ */ new Map(); - return rows.reduce((map4, row2) => { + return rows.reduce((map6, row2) => { const resKey = `${row2.getGroupingValue(columnId)}`; - const previous = map4.get(resKey); - if (!previous) { - map4.set(resKey, [row2]); + const previous2 = map6.get(resKey); + if (!previous2) { + map6.set(resKey, [row2]); } else { - previous.push(row2); + previous2.push(row2); } - return map4; + return map6; }, groupMap); } function getPaginationRowModel(opts) { - return (table) => memo2(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => { + return (table2) => memo2(() => [table2.getState().pagination, table2.getPrePaginationRowModel(), table2.options.paginateExpandedRows ? void 0 : table2.getState().expanded], (pagination, rowModel) => { if (!rowModel.rows.length) { return rowModel; } @@ -105465,7 +105577,7 @@ function getPaginationRowModel(opts) { const pageEnd = pageStart + pageSize; rows = rows.slice(pageStart, pageEnd); let paginatedRowModel; - if (!table.options.paginateExpandedRows) { + if (!table2.options.paginateExpandedRows) { paginatedRowModel = expandRows({ rows, flatRows, @@ -105487,7 +105599,7 @@ function getPaginationRowModel(opts) { }; paginatedRowModel.rows.forEach(handleRow); return paginatedRowModel; - }, getMemoOptions(table.options, "debugTable", "getPaginationRowModel")); + }, getMemoOptions(table2.options, "debugTable", "getPaginationRowModel")); } // node_modules/@tanstack/react-table/build/lib/index.mjs @@ -105611,8 +105723,8 @@ var BooleanCell = (props) => { var import_react52 = __toESM(require_react()); var ColorCell = (props) => { const showMenu2 = (e5) => { - const handleChangeComplete = (color2) => { - props.saveValue(color2); + const handleChangeComplete = (color3) => { + props.saveValue(color3); }; const offset2 = e5.target.getBoundingClientRect(); showColorPickerMenu( @@ -105715,9 +105827,9 @@ var OptionCell = (props) => { props.saveValue(""); } }; - const removeOption = (option) => { - const newOptions = options.filter((f2) => f2.value != option); - const newValues = value.filter((f2) => f2 != option); + const removeOption = (option2) => { + const newOptions = options.filter((f2) => f2.value != option2); + const newValues = value.filter((f2) => f2 != option2); setOptions(newOptions); setValue(newValues); if (props.multi) { @@ -105766,20 +105878,20 @@ var OptionCell = (props) => { savePropValue(newOptions, newValues); } }; - const saveOption = (option, newValue) => { - const newOptions = options.map((t5) => t5.value == option ? newValue : t5); + const saveOption = (option2, newValue) => { + const newOptions = options.map((t5) => t5.value == option2 ? newValue : t5); const newValues = value; setOptions(newOptions); setValue(newValues); savePropValue(newOptions, newValues); }; const showOptionMenu = (e5, optionValue) => { - const option = options.find((f2) => f2.value == optionValue); + const option2 = options.find((f2) => f2.value == optionValue); const menuOptions = []; menuOptions.push( menuInput( - option.value, - (value2) => saveOption(option.value, { ...option, value: value2 }) + option2.value, + (value2) => saveOption(option2.value, { ...option2, value: value2 }) ) ); menuOptions.push(menuSeparator); @@ -105787,7 +105899,7 @@ var OptionCell = (props) => { name: "None", color: "var(--mk-color-none)", onClick: () => { - saveOption(option.value, { ...option, color: "" }); + saveOption(option2.value, { ...option2, color: "" }); } }); colors.forEach((f2) => { @@ -105796,7 +105908,7 @@ var OptionCell = (props) => { value: f2[1], color: `${f2[1]}`, onClick: () => { - saveOption(option.value, { ...option, color: f2[1] }); + saveOption(option2.value, { ...option2, color: f2[1] }); } }); }); @@ -105829,12 +105941,12 @@ var OptionCell = (props) => { selectLabel: props.compactMode ? props.property.name : i18n_default.labels.select, editMode: props.editMode, labelElement: (_props) => { - const color2 = options.find((f2) => f2.value == _props.value)?.color ?? "var(--mk-color-none)"; + const color3 = options.find((f2) => f2.value == _props.value)?.color ?? "var(--mk-color-none)"; return /* @__PURE__ */ import_react53.default.createElement("div", { className: "mk-cell-option-item", style: { - background: `${color2}`, - color: color2 == "var(--mk-color-none)" ? "inherit" : "var(--mk-color-white)" + background: `${color3}`, + color: color3 == "var(--mk-color-none)" ? "inherit" : "var(--mk-color-white)" } }, _props.value, _props.children); } @@ -106209,12 +106321,12 @@ var ImageModal = (props) => { className: "mk-input mk-input-large mk-border-bottom" }), /* @__PURE__ */ import_react57.default.createElement("div", { className: "mk-layout-masonry mk-padding-12 mk-layout-scroll" - }, images.map((image) => /* @__PURE__ */ import_react57.default.createElement("img", { - key: image.path, - src: props.superstate.ui.getUIPath(image.thumnail), - className: selectedImage === image.path ? "mk-selected" : "", + }, images.map((image3) => /* @__PURE__ */ import_react57.default.createElement("img", { + key: image3.path, + src: props.superstate.ui.getUIPath(image3.thumnail), + className: selectedImage === image3.path ? "mk-selected" : "", onClick: () => { - props.selectedPath(image.path); + props.selectedPath(image3.path); props.hide(); } })))); @@ -106238,34 +106350,34 @@ var ImageCell = (props) => { import_react58.default.useEffect(() => { setValue(parseMultiString(initialValue)); }, [initialValue]); - const deleteValue = (index2) => { + const deleteValue = (index3) => { if (multi) { const newValue = [...value]; - newValue.splice(index2, 1); + newValue.splice(index3, 1); setValue(newValue); props.saveValue(serializeMultiString(newValue)); } else { props.saveValue(""); } }; - const saveValue = (index2, image) => { + const saveValue = (index3, image3) => { if (props.multi) { - if (index2 == -1) { - props.saveValue(serializeMultiString([...value, image])); + if (index3 == -1) { + props.saveValue(serializeMultiString([...value, image3])); } else { props.saveValue( - serializeMultiString(value.map((f2, i4) => i4 == index2 ? image : f2)) + serializeMultiString(value.map((f2, i4) => i4 == index3 ? image3 : f2)) ); } } else { - props.saveValue(image); + props.saveValue(image3); } }; - const showModal2 = (index2) => { + const showModal2 = (index3) => { props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react58.default.createElement(ImageModal_default, { superstate: props.superstate, hide: _props.hide, - selectedPath: (image) => saveValue(index2, image) + selectedPath: (image3) => saveValue(index3, image3) })); props.setEditMode(null); }; @@ -106493,18 +106605,18 @@ var ObjectEditor = (props) => { }; }) ]; - const saveKey = (key2, newKey) => { - if (key2 != newKey) + const saveKey = (key3, newKey) => { + if (key3 != newKey) saveValue({ ...value, - [newKey]: value[key2], - [key2]: void 0 + [newKey]: value[key3], + [key3]: void 0 }); }; - const saveVal = (key2, val) => { + const saveVal = (key3, val) => { saveValue({ ...value, - [key2]: val + [key3]: val }); }; const showPropertyMenu2 = (e5, field) => { @@ -106536,15 +106648,15 @@ var ObjectEditor = (props) => { icon: "ui//trash", onClick: (e6) => { props.saveType( - Object.keys(props.type ?? {}).reduce((p, c3) => { + Object.keys(props.type ?? {}).reduce((p2, c3) => { if (c3 != field) - return { ...p, [c3]: props.type[c3] }; - return p; + return { ...p2, [c3]: props.type[c3] }; + return p2; }, {}), - Object.keys(value).reduce((p, c3) => { + Object.keys(value).reduce((p2, c3) => { if (c3 != field) - return { ...p, [c3]: value[c3] }; - return p; + return { ...p2, [c3]: value[c3] }; + return p2; }, {}) ); } @@ -106608,10 +106720,10 @@ var ObjectCell = (props) => { const saveType = (newType, _value) => { if (props.multi) { const newValues = value.map((f2) => ({ - ...Object.keys(newType).reduce((p, c3) => { + ...Object.keys(newType).reduce((p2, c3) => { if (f2[c3]) - return { ...p, [c3]: f2[c3] }; - return p; + return { ...p2, [c3]: f2[c3] }; + return p2; }, {}) })); props.savePropValue( @@ -106628,73 +106740,73 @@ var ObjectCell = (props) => { const saveValue = (newValue) => { props.saveValue(JSON.stringify(newValue)); }; - const insertMultiValue = (index2) => { - const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); + const insertMultiValue = (index3) => { + const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {}); props.saveValue( - JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)]) + JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)]) ); }; - const saveMultiValue = (newValue, index2) => { - if (index2 >= value.length) { + const saveMultiValue = (newValue, index3) => { + if (index3 >= value.length) { props.saveValue(JSON.stringify([...value, newValue])); return; } props.saveValue( JSON.stringify( value.map( - (f2, i4) => i4 == index2 ? newValue : f2 + (f2, i4) => i4 == index3 ? newValue : f2 ) ) ); }; - const deleteMultiValue = (index2) => { + const deleteMultiValue = (index3) => { props.saveValue( JSON.stringify( - value.filter((f2, i4) => i4 != index2) + value.filter((f2, i4) => i4 != index3) ) ); }; - const newKey = (key2) => { - if (key2) + const newKey = (key3) => { + if (key3) saveValue({ ...value, - [key2]: "" + [key3]: "" }); }; - const showPropertyMultiMenu = (e5, index2) => { + const showPropertyMultiMenu = (e5, index3) => { const offset2 = e5.target.getBoundingClientRect(); const menuOptions = []; menuOptions.push({ name: i18n_default.menu.insertAbove, onClick: (e6) => { - insertMultiValue(index2); + insertMultiValue(index3); } }); menuOptions.push({ name: i18n_default.menu.insertBelow, onClick: (e6) => { - insertMultiValue(index2 + 1); + insertMultiValue(index3 + 1); } }); menuOptions.push(menuSeparator); - if (index2 > 0) + if (index3 > 0) menuOptions.push({ name: i18n_default.menu.moveUp, onClick: (e6) => { props.saveValue( JSON.stringify( - arrayMove(value, index2, index2 - 1) + arrayMove(value, index3, index3 - 1) ) ); } }); - if (index2 < value.length - 1) + if (index3 < value.length - 1) menuOptions.push({ name: i18n_default.menu.moveDown, onClick: (e6) => { props.saveValue( JSON.stringify( - arrayMove(value, index2, index2 + 1) + arrayMove(value, index3, index3 + 1) ) ); } @@ -106704,7 +106816,7 @@ var ObjectCell = (props) => { name: i18n_default.buttons.delete, icon: "ui//trash", onClick: (e6) => { - deleteMultiValue(index2); + deleteMultiValue(index3); } }); props.superstate.ui.openMenu( @@ -106873,12 +106985,12 @@ var ObjectEditorModal = (props) => { false ); }; - const insertMultiValue = (index2) => { + const insertMultiValue = (index3) => { const val = parseObject(value, props.property.type == "object-multi"); const type = parseFieldValue(fieldValue, props.property.type)?.type; - const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); + const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {}); saveValue( - JSON.stringify([...val.slice(0, index2), item, ...val.slice(index2)]) + JSON.stringify([...val.slice(0, index3), item, ...val.slice(index3)]) ); }; return /* @__PURE__ */ import_react62.default.createElement("div", { @@ -106908,8 +107020,8 @@ var ObjectEditorModal = (props) => { saveValue: (v2) => { saveValue(v2); }, - savePropValue: (v2, p) => { - savePropValue(v2, p); + savePropValue: (v2, p2) => { + savePropValue(v2, p2); }, editMode: 5 /* EditModeAlways */ }), /* @__PURE__ */ import_react62.default.createElement("div", { @@ -106974,11 +107086,11 @@ var PathCell = (props) => { }; const newPath = async (file) => { const pathName = file.path.replace(/\//g, "").replace(/\./g, ""); - const path2 = `${props.folder}/${pathName}.md`; + const path3 = `${props.folder}/${pathName}.md`; if (pathName.length == 0) { return; } - if (await pathExists(path2)) { + if (await pathExists(path3)) { props.superstate.ui.notify(i18n_default.notice.fileExists); } else { await props.superstate.spaceManager.createItemAtPath( @@ -107186,9 +107298,9 @@ var import_react67 = __toESM(require_react()); var import_react66 = __toESM(require_react()); var ParameterSetter = (props) => { const [value, setValue] = (0, import_react66.useState)(props.value); - const saveValue = (key2, val) => { - setValue({ ...value, [key2]: val }); - props.saveValue(key2, val); + const saveValue = (key3, val) => { + setValue({ ...value, [key3]: val }); + props.saveValue(key3, val); }; const stackedProperty = (field) => { return field.type.startsWith("object") || field.type == "super"; @@ -107238,14 +107350,14 @@ var SuperCell = (props) => { let parsedValue; try { parsedValue = JSON.parse(value2); - parsedValue = Object.keys(parsedValue).reduce((p, c3) => { + parsedValue = Object.keys(parsedValue).reduce((p2, c3) => { if (typeof parsedValue[c3] === "object") { - return { ...p, [c3]: JSON.stringify(parsedValue[c3]) }; + return { ...p2, [c3]: JSON.stringify(parsedValue[c3]) }; } if (typeof parsedValue[c3] === "string") { - return { ...p, [c3]: wrapQuotes(parsedValue[c3]) }; + return { ...p2, [c3]: wrapQuotes(parsedValue[c3]) }; } - return { ...p, [c3]: parsedValue[c3] }; + return { ...p2, [c3]: parsedValue[c3] }; }, {}); } catch (e5) { console.log(e5); @@ -107260,12 +107372,12 @@ var SuperCell = (props) => { setValue(parseValue(unwrapParanthesis(props.initialValue))); }, [props.initialValue]); const specialStringify = (obj) => { - return `{${Object.keys(obj ?? {}).map((key2) => `"${key2}": ${obj[key2]}`).join(",")}}`; + return `{${Object.keys(obj ?? {}).map((key3) => `"${key3}": ${obj[key3]}`).join(",")}}`; }; - const saveValue = (key2, val) => { - setValue({ ...value, [key2]: val }); + const saveValue = (key3, val) => { + setValue({ ...value, [key3]: val }); const newValue = wrapParanthesis( - specialStringify({ ...value, [key2]: val }) + specialStringify({ ...value, [key3]: val }) ); props.saveValue(newValue); }; @@ -107558,7 +107670,7 @@ var TableView = (props) => { selectedRows, selectRows, sortedColumns: cols, - filteredData: data2, + filteredData: data3, predicate, savePredicate, updateFieldValue, @@ -107597,53 +107709,53 @@ var TableView = (props) => { ), [predicate] ); - const newRow = (name317, index2, data3) => { + const newRow = (name317, index3, data4) => { if (dbSchema?.id == defaultContextSchemaID) { newPathInSpace(props.superstate, spaceCache, "md", name317, true); } else { saveDB( createNewRow( tableData, - primaryCol ? { [primaryCol.name]: name317 ?? "", ...data3 ?? {} } : data3 ?? {}, - index2 + primaryCol ? { [primaryCol.name]: name317 ?? "", ...data4 ?? {} } : data4 ?? {}, + index3 ) ); } }; - const toggleFlow = (path2) => { + const toggleFlow = (path3) => { setOpenFlows( - (f2) => f2.find((p) => p == path2) ? f2.filter((p) => p != path2) : uniq([...f2, path2]) + (f2) => f2.find((p2) => p2 == path3) ? f2.filter((p2) => p2 != path3) : uniq([...f2, path3]) ); }; - const selectItem = (modifier, index2) => { + const selectItem = (modifier, index3) => { if (modifier.metaKey) { props.superstate.ui.openPath( - tableData.rows[parseInt(index2)][PathPropertyName], + tableData.rows[parseInt(index3)][PathPropertyName], false ); return; } if (modifier.ctrlKey) { - selectedRows.some((f2) => f2 == index2) ? selectRows( + selectedRows.some((f2) => f2 == index3) ? selectRows( null, - selectedRows.filter((f2) => f2 != index2) - ) : selectRows(index2, uniq([...selectedRows, index2])); + selectedRows.filter((f2) => f2 != index3) + ) : selectRows(index3, uniq([...selectedRows, index3])); } else if (modifier.shiftKey) { selectRows( - index2, + index3, uniq([ ...selectedRows, ...selectRange( lastSelectedIndex, - index2, - data2.map((f2) => f2._index) + index3, + data3.map((f2) => f2._index) ) ]) ); } else { - selectRows(index2, [index2]); + selectRows(index3, [index3]); } - setLastSelectedIndex(index2); + setLastSelectedIndex(index3); }; const onKeyDown = (e5) => { const setCellValue = (value) => { @@ -107669,7 +107781,7 @@ var TableView = (props) => { const nextRow = () => { const newIndex = selectNextIndex( lastSelectedIndex, - data2.map((f2) => f2._index) + data3.map((f2) => f2._index) ); selectRows(newIndex, [newIndex]); setLastSelectedIndex(newIndex); @@ -107677,7 +107789,7 @@ var TableView = (props) => { const lastRow = () => { const newIndex = selectPrevIndex( lastSelectedIndex, - data2.map((f2) => f2._index) + data3.map((f2) => f2._index) ); selectRows(newIndex, [newIndex]); setLastSelectedIndex(newIndex); @@ -107749,19 +107861,19 @@ var TableView = (props) => { }, cell: ({ getValue, - row: { index: index2 }, + row: { index: index3 }, column: { colId }, cell, - table: table2 + table: table3 }) => { const initialValue = getValue(); - const rowIndex = parseInt(data2[index2]["_index"]); - const tableIndex = parseInt(data2[index2]["_index"]); + const rowIndex = parseInt(data3[index3]["_index"]); + const tableIndex = parseInt(data3[index3]["_index"]); const saveValue = (value) => { setCurrentEdit(null); setSelectedColumn(null); if (initialValue != value) - table2.options.meta?.updateData( + table3.options.meta?.updateData( f2.name, value, f2.table, @@ -107769,7 +107881,7 @@ var TableView = (props) => { ); }; const saveFieldValue = (fieldValue, value) => { - table2.options.meta?.updateFieldValue( + table3.options.meta?.updateFieldValue( f2.name, fieldValue, value, @@ -107787,9 +107899,9 @@ var TableView = (props) => { setEditMode: setCurrentEdit, column: f2, editMode, - row: data2[index2], + row: data3[index3], contextTable, - source: data2[index2][PathPropertyName] + source: data3[index3][PathPropertyName] }; const fieldType = fieldTypeForType(f2.type, f2.name); if (!fieldType) { @@ -107811,24 +107923,24 @@ var TableView = (props) => { } ] ], - [cols, data2, currentEdit, predicate, dbSchema, contextTable] + [cols, data3, currentEdit, predicate, dbSchema, contextTable] ); const groupBy2 = (0, import_react71.useMemo)( () => predicate?.groupBy?.length > 0 && cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) ? predicate.groupBy : [], [predicate, cols] ); - const table = useReactTable({ - data: data2, + const table2 = useReactTable({ + data: data3, columns, columnResizeMode: "onChange", state: { columnVisibility: predicate?.colsHidden.reduce( - (p, c3) => ({ ...p, [c3]: false }), + (p2, c3) => ({ ...p2, [c3]: false }), {} ), columnOrder: predicate?.colsOrder, columnSizing: { - ...columns.reduce((p, c3) => ({ ...p, [c3.accessorKey]: 150 }), {}), + ...columns.reduce((p2, c3) => ({ ...p2, [c3.accessorKey]: 150 }), {}), ...colsSize }, grouping: groupBy2, @@ -107886,7 +107998,7 @@ var TableView = (props) => { ] }); }; - const selectCell = (e5, index2, column2) => { + const selectCell = (e5, index3, column2) => { if (isTouchScreen(props.superstate.ui) || column2 == "+") return; selectItem( @@ -107896,12 +108008,12 @@ var TableView = (props) => { altKey: e5.altKey, shiftKey: e5.shiftKey }, - data2[index2]["_index"] + data3[index3]["_index"] ); setSelectedColumn(column2); if (e5.detail === 1) { } else if (e5.detail === 2) { - setCurrentEdit([column2, data2[index2]["_index"]]); + setCurrentEdit([column2, data3[index3]["_index"]]); } }; function handleDragEnd({ active, over }) { @@ -107938,7 +108050,7 @@ var TableView = (props) => { onKeyDown }, /* @__PURE__ */ import_react71.default.createElement("table", { ...{} - }, /* @__PURE__ */ import_react71.default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ import_react71.default.createElement("tr", { + }, /* @__PURE__ */ import_react71.default.createElement("thead", null, table2.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ import_react71.default.createElement("tr", { key: headerGroup.id }, /* @__PURE__ */ import_react71.default.createElement("th", null), headerGroup.headers.map((header) => /* @__PURE__ */ import_react71.default.createElement("th", { className: "mk-th", @@ -107969,13 +108081,13 @@ var TableView = (props) => { onTouchStart: header.getResizeHandler(), className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}` } - })))))), /* @__PURE__ */ import_react71.default.createElement("tbody", null, table.getRowModel().rows.map((row2) => /* @__PURE__ */ import_react71.default.createElement("tr", { + })))))), /* @__PURE__ */ import_react71.default.createElement("tbody", null, table2.getRowModel().rows.map((row2) => /* @__PURE__ */ import_react71.default.createElement("tr", { className: selectedRows?.some( - (f2) => f2 == data2[row2.index]["_index"] + (f2) => f2 == data3[row2.index]["_index"] ) ? "mk-active" : void 0, onContextMenu: (e5) => { const rowIndex = parseInt( - data2[row2.index]["_index"] + data3[row2.index]["_index"] ); showRowContextMenu( e5, @@ -108023,10 +108135,10 @@ var TableView = (props) => { cell.column.columnDef.cell, cell.getContext() )) - )))), /* @__PURE__ */ import_react71.default.createElement("tfoot", null, table.getCanNextPage() && /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", { + )))), /* @__PURE__ */ import_react71.default.createElement("tfoot", null, table2.getCanNextPage() && /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", { className: "mk-row-new", colSpan: cols.length + (readMode ? 1 : 2), - onClick: () => table.setPageSize(pagination.pageSize + 25) + onClick: () => table2.setPageSize(pagination.pageSize + 25) }, "Load More")), !readMode ? /* @__PURE__ */ import_react71.default.createElement("tr", null, /* @__PURE__ */ import_react71.default.createElement("th", { className: "mk-row-new", colSpan: cols.length + (readMode ? 1 : 2), @@ -108115,15 +108227,15 @@ var DataPropertyView = (props) => { false ); }; - const insertMultiValue = (index2) => { + const insertMultiValue = (index3) => { const type = parseFieldValue(props.column.value, props.column.type)?.type; const value = parseObject( props.initialValue ?? "", props.column.type == "object-multi" ); - const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); + const item = Object.keys(type).reduce((p2, c3) => ({ ...p2, [c3]: "" }), {}); props.updateValue( - JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)]) + JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)]) ); }; return /* @__PURE__ */ import_react72.default.createElement(import_react72.default.Fragment, null, /* @__PURE__ */ import_react72.default.createElement("div", { @@ -108234,7 +108346,7 @@ var EditPropertiesSubmenu = (props) => { }; // src/core/react/components/UI/Menus/contexts/rowContextMenu.tsx -var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => { +var showRowContextMenu = (e5, superstate, contextPath, schema, index3) => { e5.preventDefault(); const context = superstate.contextsIndex.get(contextPath); const dbSchema = context?.tables[schema]?.schema; @@ -108242,7 +108354,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => { if (!context) return; if (dbSchema.primary == "true") { - const row2 = rows.find((f2, i4) => i4 == index2); + const row2 = rows.find((f2, i4) => i4 == index3); if (row2) { if (superstate.spacesIndex.has(row2[PathPropertyName])) { const pathState = superstate.pathsIndex.get(row2[PathPropertyName]); @@ -108265,7 +108377,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => { pathState: superstate.pathsIndex.get(contextPath), path: contextPath, schema, - index: index2 + index: index3 }; menuOptions.push({ name: i18n_default.menu.editProperties, @@ -108284,7 +108396,7 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => { name: i18n_default.menu.deleteRow, icon: "ui//trash", onClick: (e6) => { - deleteRowInTable(superstate.spaceManager, context.space, schema, index2); + deleteRowInTable(superstate.spaceManager, context.space, schema, index3); } }); superstate.ui.openMenu( @@ -108297,11 +108409,11 @@ var showRowContextMenu = (e5, superstate, contextPath, schema, index2) => { var API = class { constructor(superstate) { this.frame = { - update: (property, value, path2, saveState) => { + update: (property, value, path3, saveState) => { if (property.startsWith("$contexts")) { const { context, prop: prop2 } = parseContextNode(property); if (context && prop2) - this.context.update(context, path2, prop2, value); + this.context.update(context, path3, prop2, value); } else { const linkedNode = parseLinkedNode(property); if (linkedNode.node && linkedNode.prop) { @@ -108320,9 +108432,9 @@ var API = class { color: (property, value) => { if (property?.type?.includes("option")) { const fields = parseFieldValue(property.value, property.type); - const option = fields.options?.find((f2) => f2.value == value); - if (option?.color.length > 0) - return option.color; + const option2 = fields.options?.find((f2) => f2.value == value); + if (option2?.color.length > 0) + return option2.color; } return "var(--mk-ui-background-contrast)"; }, @@ -108334,35 +108446,35 @@ var API = class { } }; this.path = { - label: (path2) => { - return this.superstate.pathsIndex.get(path2)?.label; + label: (path3) => { + return this.superstate.pathsIndex.get(path3)?.label; }, - open: (path2, target) => { - this.superstate.ui.openPath(path2, target); + open: (path3, target) => { + this.superstate.ui.openPath(path3, target); }, - create: (name317, space2, type, content3) => { - if (content3 instanceof Promise) { - return content3.then((c3) => { - newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space2), type, name317, true, c3); + create: (name317, space3, type, content5) => { + if (content5 instanceof Promise) { + return content5.then((c3) => { + newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space3), type, name317, true, c3); }); } - return newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space2), type, name317, true, content3); + return newPathInSpace(this.superstate, this.superstate.spacesIndex.get(space3), type, name317, true, content5); }, - setProperty: (path2, property, value) => { + setProperty: (path3, property, value) => { if (value instanceof Promise) { value.then((v2) => { - saveProperties(this.superstate, path2, { + saveProperties(this.superstate, path3, { [property]: v2 }); }); return; } - saveProperties(this.superstate, path2, { + saveProperties(this.superstate, path3, { [property]: value }); }, - contextMenu: (e5, path2) => { - showPathContextMenu(this.superstate, path2, null, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 }); + contextMenu: (e5, path3) => { + showPathContextMenu(this.superstate, path3, null, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 }); } }; this.commands = { @@ -108377,79 +108489,79 @@ var API = class { alert("Button actions have been upgraded, please rebind your buttons to use the new API."); }; this.table = { - select: (path2, table) => { - return this.superstate.spaceManager.readTable(path2, table)?.then((f2) => f2?.rows); + select: (path3, table2) => { + return this.superstate.spaceManager.readTable(path3, table2)?.then((f2) => f2?.rows); }, - update: (path2, table, index2, row2) => { - const space2 = this.superstate.spacesIndex.get(path2); - if (space2) - return updateTableRow(this.superstate.spaceManager, space2.space, table, index2, row2); + update: (path3, table2, index3, row2) => { + const space3 = this.superstate.spacesIndex.get(path3); + if (space3) + return updateTableRow(this.superstate.spaceManager, space3.space, table2, index3, row2); }, - insert: (path2, schema, row2) => { + insert: (path3, schema, row2) => { if (schema == defaultContextSchemaID) { - this.context.insert(path2, schema, row2[PathPropertyName], row2); + this.context.insert(path3, schema, row2[PathPropertyName], row2); return; } - const space2 = this.superstate.spacesIndex.get(path2); - if (space2) - return addRowInTable(this.superstate.spaceManager, row2, space2.space, schema); + const space3 = this.superstate.spacesIndex.get(path3); + if (space3) + return addRowInTable(this.superstate.spaceManager, row2, space3.space, schema); return Promise.resolve(); }, - create: (path2, table, properties3) => { + create: (path3, table2, properties3) => { const newSchema = { - id: sanitizeTableName(table), - name: table, + id: sanitizeTableName(table2), + name: table2, type: "db" }; this.superstate.spaceManager.createTable( - path2, + path3, newSchema ); }, - open: (space2, table, index2, target) => { - const context = this.superstate.contextsIndex.get(space2); - if (table == defaultContextSchemaID) { - const path2 = context?.tables[table]?.rows[index2]?.[PathPropertyName]; - this.superstate.ui.openPath(path2, target); + open: (space3, table2, index3, target) => { + const context = this.superstate.contextsIndex.get(space3); + if (table2 == defaultContextSchemaID) { + const path3 = context?.tables[table2]?.rows[index3]?.[PathPropertyName]; + this.superstate.ui.openPath(path3, target); } else { } }, - contextMenu: (e5, space2, table, index2) => { - const context = this.superstate.contextsIndex.get(space2); - if (table == defaultContextSchemaID) { - const path2 = context?.tables[table]?.rows[index2]?.[PathPropertyName]; - showPathContextMenu(this.superstate, path2, space2, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 }); + contextMenu: (e5, space3, table2, index3) => { + const context = this.superstate.contextsIndex.get(space3); + if (table2 == defaultContextSchemaID) { + const path3 = context?.tables[table2]?.rows[index3]?.[PathPropertyName]; + showPathContextMenu(this.superstate, path3, space3, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 }); } else { - showRowContextMenu(e5, this.superstate, space2, table, index2); + showRowContextMenu(e5, this.superstate, space3, table2, index3); } } }; this.context = { - select: (path2, table) => { - return this.superstate.contextsIndex.get(path2)?.tables[table]?.rows; + select: (path3, table2) => { + return this.superstate.contextsIndex.get(path3)?.tables[table2]?.rows; }, - update: (path2, file, field, value) => { - const space2 = this.superstate.spacesIndex.get(path2); - if (space2) - updateValueInContext(this.superstate.spaceManager, file, field, value, space2.space); + update: (path3, file, field, value) => { + const space3 = this.superstate.spacesIndex.get(path3); + if (space3) + updateValueInContext(this.superstate.spaceManager, file, field, value, space3.space); }, - insert: (path2, schema, name317, row2) => { + insert: (path3, schema, name317, row2) => { if (schema == defaultContextSchemaID) { - newPathInSpace(this.superstate, this.superstate.spacesIndex.get(path2), "md", name317, true).then((f2) => { + newPathInSpace(this.superstate, this.superstate.spacesIndex.get(path3), "md", name317, true).then((f2) => { if (row2) saveProperties(this.superstate, f2, { ...row2 }); }); } else { - const table = this.superstate.contextsIndex.get(path2)?.tables?.[schema]; - if (table) { - const prop2 = table.cols.find((f2) => f2.primary == "true"); + const table2 = this.superstate.contextsIndex.get(path3)?.tables?.[schema]; + if (table2) { + const prop2 = table2.cols.find((f2) => f2.primary == "true"); const newRow = prop2 ? { ...row2, [prop2.name]: name317 } : row2; - this.table.insert(path2, schema, newRow); + this.table.insert(path3, schema, newRow); } } } @@ -108513,8 +108625,8 @@ var _IndexMap = class { this.map = /* @__PURE__ */ new Map(); this.invMap = /* @__PURE__ */ new Map(); } - get(key2) { - const result = this.map.get(key2); + get(key3) { + const result = this.map.get(key3); if (result) { return new Set(result); } else { @@ -108524,65 +108636,65 @@ var _IndexMap = class { getInverse(value) { return this.invMap.get(value) || _IndexMap.EMPTY_SET; } - set(key2, values2) { + set(key3, values2) { if (!values2.size) { - this.delete(key2); + this.delete(key3); return this; } - const oldValues = this.map.get(key2); + const oldValues = this.map.get(key3); if (oldValues) { for (const value of oldValues) { - if (!values2.has(key2)) - this.invMap.get(value)?.delete(key2); + if (!values2.has(key3)) + this.invMap.get(value)?.delete(key3); } } - this.map.set(key2, values2); + this.map.set(key3, values2); for (const value of values2) { if (!this.invMap.has(value)) - this.invMap.set(value, /* @__PURE__ */ new Set([key2])); + this.invMap.set(value, /* @__PURE__ */ new Set([key3])); else - this.invMap.get(value)?.add(key2); + this.invMap.get(value)?.add(key3); } return this; } - setInverse(key2, values2) { + setInverse(key3, values2) { if (!values2.size) { - this.deleteInverse(key2); + this.deleteInverse(key3); return this; } - const oldValues = this.invMap.get(key2); + const oldValues = this.invMap.get(key3); if (oldValues) { for (const value of oldValues) { - if (!values2.has(key2)) - this.map.get(value)?.delete(key2); + if (!values2.has(key3)) + this.map.get(value)?.delete(key3); } } - this.invMap.set(key2, values2); + this.invMap.set(key3, values2); for (const value of values2) { if (!this.map.has(value)) - this.map.set(value, /* @__PURE__ */ new Set([key2])); + this.map.set(value, /* @__PURE__ */ new Set([key3])); else - this.map.get(value)?.add(key2); + this.map.get(value)?.add(key3); } return this; } - delete(key2) { - const oldValues = this.map.get(key2); + delete(key3) { + const oldValues = this.map.get(key3); if (!oldValues) return false; - this.map.delete(key2); + this.map.delete(key3); for (const value of oldValues) { - this.invMap.get(value)?.delete(key2); + this.invMap.get(value)?.delete(key3); } return true; } - deleteInverse(key2) { - const oldValues = this.invMap.get(key2); + deleteInverse(key3) { + const oldValues = this.invMap.get(key3); if (!oldValues) return false; - this.invMap.delete(key2); + this.invMap.delete(key3); for (const value of oldValues) { - this.map.get(value)?.delete(key2); + this.map.get(value)?.delete(key3); } return true; } @@ -108612,8 +108724,8 @@ IndexMap.EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set()); // src/core/utils/spaces/query.ts var filterPathsForAny = (paths, filters, props) => { - const newArray = filters.reduce((p, c3) => { - const [result, remaining] = p; + const newArray = filters.reduce((p2, c3) => { + const [result, remaining] = p2; const filteredPaths = c3.type == "context" ? filterContext(remaining, c3, props) : c3.type == "path" ? filterPathCache(remaining, c3, props) : c3.type == "frontmatter" ? filterFM(remaining, c3, props) : filterPathProperties(remaining, c3, props); const diffArray = remaining.filter((x2) => !filteredPaths.includes(x2)); return [[...result, ...filteredPaths], diffArray]; @@ -108621,8 +108733,8 @@ var filterPathsForAny = (paths, filters, props) => { return newArray[0]; }; var filterPathsForAll2 = (paths, filters, props) => { - return filters.reduce((p, c3) => { - return c3.type == "context" ? filterContext(p, c3, props) : c3.type == "path" ? filterPathCache(p, c3, props) : c3.type == "frontmatter" ? filterFM(p, c3, props) : filterPathProperties(p, c3, props); + return filters.reduce((p2, c3) => { + return c3.type == "context" ? filterContext(p2, c3, props) : c3.type == "path" ? filterPathCache(p2, c3, props) : c3.type == "frontmatter" ? filterFM(p2, c3, props) : filterPathProperties(p2, c3, props); }, paths); }; var filterContext = (paths, def, props) => { @@ -108700,11 +108812,11 @@ var filterPathProperties = (paths, def, props) => { return result; }); }; -var pathByDef = (filters, path2, props) => { - const pathInFilter = filters.reduce((p, c3) => { - if (!p || c3.filters.length == 0) +var pathByDef = (filters, path3, props) => { + const pathInFilter = filters.reduce((p2, c3) => { + if (!p2 || c3.filters.length == 0) return false; - const result = c3.type == "any" ? filterPathsForAny([path2], c3.filters, props).length > 0 : filterPathsForAll2([path2], c3.filters, props).length > 0; + const result = c3.type == "any" ? filterPathsForAny([path3], c3.filters, props).length > 0 : filterPathsForAll2([path3], c3.filters, props).length > 0; return result; }, true); return pathInFilter; @@ -109998,7 +110110,7 @@ var imageListItem = { }, actions: { onClick: `$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });`, - onDoubleClick: `$api.table.open($contexts.$context['_keyValue'], false)`, + onDoubleClick: `$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)`, onContextMenu: `$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])` } }, @@ -110100,7 +110212,7 @@ var cardsListItem = { }, actions: { onClick: `$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });`, - onDoubleClick: `$api.table.open($contexts.$context['_keyValue'], false)`, + onDoubleClick: `$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)`, onContextMenu: `$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])` } }, @@ -110346,7 +110458,7 @@ var listItem = { }, actions: { onClick: `$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });`, - onDoubleClick: `$api.table.open($contexts.$context['_index'], false)`, + onDoubleClick: `$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)`, onContextMenu: `$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])` } }, @@ -110456,7 +110568,7 @@ var detailItem = { }, actions: { onClick: `$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });`, - onDoubleClick: `$api.table.open($contexts.$context['_keyValue'], false)`, + onDoubleClick: `$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)`, onContextMenu: `$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])` } }, @@ -111098,7 +111210,7 @@ var SpacesCommandsAdapter = class { if (command.schema.type == "script") result = executeCode(command.code, instance.instanceProps); if (command.schema.type == "formula") - result = runFormulaWithContext(this.superstate.formulaContext, this.superstate.pathsIndex, command.code, command.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}), instance.instanceProps); + result = runFormulaWithContext(this.superstate.formulaContext, this.superstate.pathsIndex, command.code, command.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}), instance.instanceProps); } catch (e5) { error = e5; } @@ -111123,55 +111235,55 @@ var propertyDependencies = (fields) => { localDependencies.push(...deps); } catch (e5) { } - const key2 = f2.name; - if (!graph.has(key2)) { - graph.set(key2, /* @__PURE__ */ new Set()); + const key3 = f2.name; + if (!graph.has(key3)) { + graph.set(key3, /* @__PURE__ */ new Set()); } for (const dep of localDependencies) { const depStr = dep; - if (depStr === key2) + if (depStr === key3) continue; - graph.get(key2).add(depStr); + graph.get(key3).add(depStr); } }); const visited = /* @__PURE__ */ new Set(); const result = []; const temp = /* @__PURE__ */ new Set(); - const visit = (key2) => { - if (temp.has(key2)) + const visit2 = (key3) => { + if (temp.has(key3)) throw new Error("Circular dependency detected"); - if (!visited.has(key2)) { - temp.add(key2); - const edges = graph.get(key2) || /* @__PURE__ */ new Set(); + if (!visited.has(key3)) { + temp.add(key3); + const edges = graph.get(key3) || /* @__PURE__ */ new Set(); for (const dep of edges) { - visit(dep); + visit2(dep); } - visited.add(key2); - temp.delete(key2); - result.push(key2); + visited.add(key3); + temp.delete(key3); + result.push(key3); } }; - for (const key2 of fields) { - if (!visited.has(key2.name)) { - visit(key2.name); + for (const key3 of fields) { + if (!visited.has(key3.name)) { + visit2(key3.name); } } return result; }; -var linkContextRow = (runContext, paths, row2, fields, path2, dependencies314) => { +var linkContextRow = (runContext, paths, row2, fields, path3, dependencies314) => { if (!row2) return {}; const result = dependencies314 ?? propertyDependencies(fields); const frontmatter = paths.get(row2[PathPropertyName])?.metadata?.property ?? {}; - const filteredFrontmatter = Object.keys(frontmatter).filter((f2) => fields.some((g) => g.name == f2)).reduce((p, c3) => ({ ...p, [c3]: parseProperty(c3, frontmatter[c3]) }), {}); + const filteredFrontmatter = Object.keys(frontmatter).filter((f2) => fields.some((g) => g.name == f2)).reduce((p2, c3) => ({ ...p2, [c3]: parseProperty(c3, frontmatter[c3]) }), {}); const fieldsSorted = result.map((f2) => fields.find((g) => g.name == f2)).filter((f2) => f2 && (f2.type == "fileprop" || f2.name == "tags")); - const properties3 = fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}); + const properties3 = fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}); return { ...row2, ...filteredFrontmatter, - ...fieldsSorted.reduce((p, c3) => { + ...fieldsSorted.reduce((p2, c3) => { const { value } = parseFieldValue(c3.value, c3.type); - return { ...p, [c3.name]: runFormulaWithContext(runContext, paths, value, properties3, { ...row2, ...p }, path2) }; + return { ...p2, [c3.name]: runFormulaWithContext(runContext, paths, value, properties3, { ...row2, ...p2 }, path3) }; }, {}) }; }; @@ -111418,7 +111530,7 @@ q: \`+this.q.toString():"")+\` \`),n.seealso&&n.seealso.length&&(a+="See also: "+n.seealso.join(", ")+\` \`),a},t.prototype.toJSON=function(){var n=ar(this.doc);return n.mathjs="Help",n},t.fromJSON=function(n){var a={};return Object.keys(n).filter(i=>i!=="mathjs").forEach(i=>{a[i]=n[i]}),new t(a)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var vG="Chain",gG=["?on","math","typed"],dg=F(vG,gG,e=>{var{on:r,math:t,typed:n}=e;function a(o){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");bu(o)?this.value=o.value:this.value=o}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return lr(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(o){return new a(o.value)};function i(o,s){typeof s=="function"&&(a.prototype[o]=l(s))}function u(o,s){Du(a.prototype,o,function(){var d=s();if(typeof d=="function")return l(d)})}function l(o){return function(){if(arguments.length===0)return new a(o(this.value));for(var s=[this.value],m=0;mo[x])};for(var d in o)m(d)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return a.createProxy(t),r&&r("import",function(o,s,m){m||u(o,s)}),a},{isClass:!0});var DD={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var ET={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var TT={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var FT={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var _T={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var OT={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var BT={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var PT={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var IT={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var RT={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var kT={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as \`(1 + sqrt(5)) / 2\` and is approximately 1.618034...",examples:["phi"],seealso:[]};var SD={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var qT={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var LT={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var zT={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var UT={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var WT={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var YT={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var HT={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var $T={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var GT={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var VT={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var ZT={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var QT={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var XT={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var JT={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var KT={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var jT={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var eF={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var rF={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var tF={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var nF={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var aF={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var iF={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var oF={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var sF={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var uF={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var fF={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var cF={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var lF={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix \`A\` is decomposed in two matrices (\`Q\`, \`R\`) where \`Q\` is an orthogonal matrix and \`R\` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var mF={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var pF={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var dF={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var hF={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var vF={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var gF={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var xF={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var yF={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var bF={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var wF={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var DF={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var SF={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When \`x\` is a number or complex number, an optional second argument \`allRoots\` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var NF={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var AF={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var MF={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var CF={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var EF={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var TF={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var FF={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var _F={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var OF={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var BF={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var PF={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var IF={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var RF={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var kF={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \\u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var qF={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var LF={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var zF={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var UF={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a \`value+1\`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var WF={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating \`log(x, 2)\`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var YF={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var HF={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var $F={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var GF={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var VF={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var ZF={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var QF={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var XF={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var JF={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var KF={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix \`X\` of another matrix \`A\` is such that \`X * X = A\`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var jF={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var e_={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var r_={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var t_={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var n_={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var a_={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var i_={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var o_={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var s_={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var u_={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var f_={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var c_={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var l_={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var m_={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var p_={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var d_={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. \`bellNumbers\` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var h_={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var v_={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var g_={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. \`stirlingS2\` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var x_={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var y_={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var b_={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var w_={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var D_={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var S_={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var N_={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var A_={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var M_={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var C_={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var E_={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var T_={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var F_={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var __={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var O_={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var B_={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var P_={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var I_={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var R_={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var k_={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var q_={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var L_={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var z_={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var U_={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var W_={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var Y_={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var H_={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var $_={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var G_={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var V_={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var Z_={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var Q_={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var X_={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var J_={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var K_={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var j_={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var eO={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var rO={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var tO={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var nO={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var aO={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var iO={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var oO={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var sO={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var uO={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var fO={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation \`l:u\`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var cO={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var lO={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var mO={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var pO={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var dO={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var hO={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var vO={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var gO={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var xO={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var yO={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var bO={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var wO={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from \`n\` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var DO={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var SO={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var NO={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var AO={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var MO={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var CO={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var EO={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var TO={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var FO={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var _O={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var OO={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var BO={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var PO={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var IO={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var RO={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var kO={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var qO={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var LO={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var zO={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var UO={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var WO={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var YO={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var HO={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var $O={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var GO={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var VO={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var ZO={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var QO={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var XO={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var JO={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var KO={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var jO={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var e3={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var r3={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var t3={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var n3={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var a3={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:\`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. -In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var i3={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var o3={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var s3={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var u3={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var f3={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var c3={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var l3={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var m3={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var p3={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var d3={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var h3={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var v3={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var g3={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var x3={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var y3={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var b3={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var w3={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var D3={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var S3={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var N3={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var A3={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var M3={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var C3={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var E3={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var T3={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var F3={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var _3={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var O3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var B3={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var P3={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var I3={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var R3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var k3={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var q3={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var L3={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var z3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var U3={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var W3={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Y3={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var H3={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var $3={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var G3={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var V3={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var Z3={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var Q3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var X3={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var J3={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var K3={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var j3={bignumber:YT,boolean:HT,complex:$T,createUnit:GT,fraction:VT,index:ZT,matrix:QT,number:XT,sparse:JT,splitUnit:KT,string:jT,unit:eF,e:DD,E:DD,false:ET,i:TT,Infinity:FT,LN2:OT,LN10:_T,LOG2E:PT,LOG10E:BT,NaN:IT,null:RT,pi:SD,PI:SD,phi:kT,SQRT1_2:qT,SQRT2:LT,tau:zT,true:UT,version:WT,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:aF,lsolve:oF,lsolveAll:sF,lup:uF,lusolve:fF,leafCount:iF,polynomialRoot:cF,resolve:pF,simplify:dF,simplifyConstant:hF,simplifyCore:vF,symbolicEqual:xF,rationalize:mF,slu:gF,usolve:yF,usolveAll:bF,qr:lF,abs:wF,add:DF,cbrt:SF,ceil:NF,cube:AF,divide:MF,dotDivide:CF,dotMultiply:EF,dotPow:TF,exp:FF,expm:_F,expm1:OF,fix:BF,floor:PF,gcd:IF,hypot:RF,lcm:qF,log:LF,log2:WF,log1p:UF,log10:zF,mod:YF,multiply:HF,norm:$F,nthRoot:GF,nthRoots:VF,pow:ZF,round:QF,sign:XF,sqrt:JF,sqrtm:KF,square:t_,subtract:n_,unaryMinus:a_,unaryPlus:i_,xgcd:o_,invmod:kF,bitAnd:s_,bitNot:u_,bitOr:f_,bitXor:c_,leftShift:l_,rightArithShift:m_,rightLogShift:p_,bellNumbers:d_,catalan:h_,composition:v_,stirlingS2:g_,config:rF,import:tF,typed:nF,arg:x_,conj:y_,re:w_,im:b_,evaluate:D_,help:S_,distance:N_,intersect:A_,and:M_,not:C_,or:E_,xor:T_,concat:__,count:O_,cross:B_,column:F_,ctranspose:P_,det:I_,diag:R_,diff:k_,dot:q_,getMatrixDataType:Y_,identity:H_,filter:z_,flatten:U_,forEach:W_,inv:$_,pinv:G_,eigs:L_,kron:V_,matrixFromFunction:X_,matrixFromRows:J_,matrixFromColumns:Q_,map:Z_,ones:K_,partitionSelect:j_,range:eO,resize:tO,reshape:rO,rotate:nO,rotationMatrix:aO,row:iO,size:oO,sort:sO,squeeze:uO,subset:fO,trace:cO,transpose:lO,zeros:mO,fft:pO,ifft:dO,sylvester:jF,schur:e_,lyap:r_,solveODE:K3,combinations:hO,combinationsWithRep:vO,factorial:gO,gamma:xO,kldivergence:bO,lgamma:yO,multinomial:wO,permutations:DO,pickRandom:SO,random:NO,randomInt:AO,compare:MO,compareNatural:CO,compareText:EO,deepEqual:TO,equal:FO,equalText:_O,larger:OO,largerEq:BO,smaller:PO,smallerEq:IO,unequal:RO,setCartesian:kO,setDifference:qO,setDistinct:LO,setIntersect:zO,setIsSubset:UO,setMultiplicity:WO,setPowerset:YO,setSize:HO,setSymDifference:$O,setUnion:GO,zpk2tf:VO,freqz:ZO,erf:QO,zeta:XO,cumsum:o3,mad:JO,max:KO,mean:jO,median:e3,min:r3,mode:t3,prod:n3,quantileSeq:a3,std:i3,sum:s3,variance:u3,corr:f3,acos:c3,acosh:l3,acot:m3,acoth:p3,acsc:d3,acsch:h3,asec:v3,asech:g3,asin:x3,asinh:y3,atan:b3,atanh:D3,atan2:w3,cos:S3,cosh:N3,cot:A3,coth:M3,csc:C3,csch:E3,sec:T3,sech:F3,sin:_3,sinh:O3,tan:B3,tanh:P3,to:I3,clone:k3,format:q3,bin:R3,oct:Q3,hex:z3,isNaN:W3,isInteger:U3,isNegative:Y3,isNumeric:H3,hasNumericValue:L3,isPositive:$3,isPrime:G3,isZero:V3,print:X3,typeOf:J3,numeric:Z3};var eB="help",xG=["typed","mathWithTransform","Help"],hg=F(eB,xG,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(eB,{any:function(i){var u,l=i;if(typeof i!="string"){for(u in t)if(Xe(t,u)&&i===t[u]){l=u;break}}var c=wt(j3,l);if(!c){var o=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+o+'"')}return new n(c)}})});var rB="chain",yG=["typed","Chain"],vg=F(rB,yG,e=>{var{typed:r,Chain:t}=e;return r(rB,{"":function(){return new t},any:function(a){return new t(a)}})});var tB="det",bG=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],gg=F(tB,bG,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:u,unaryMinus:l}=e;return r(tB,{any:function(s){return ar(s)},"Array | Matrix":function(s){var m;switch(Qe(s)?m=s.size():Array.isArray(s)?(s=t(s),m=s.size()):m=[],m.length){case 0:return ar(s);case 1:if(m[0]===1)return ar(s.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")");case 2:{var d=m[0],h=m[1];if(d===h)return c(s.clone().valueOf(),d,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(m)+")")}}});function c(o,s,m){if(s===1)return ar(o[0][0]);if(s===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var d=!1,h=new Array(s).fill(0).map((O,_)=>_),x=0;x{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:u,det:l,identity:c,abs:o}=e;return r(nB,{"Array | Matrix":function(d){var h=Qe(d)?d.size():ur(d);switch(h.length){case 1:if(h[0]===1)return Qe(d)?t([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+lr(h)+")");case 2:{var x=h[0],v=h[1];if(x===v)return Qe(d)?t(s(d.valueOf(),x,v),d.storage()):s(d,x,v);throw new RangeError("Matrix must be square (size: "+lr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(h)+")")}},any:function(d){return n(1,d)}});function s(m,d,h){var x,v,y,w,C;if(d===1){if(w=m[0][0],w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,w)]]}else if(d===2){var b=l(m);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],b),n(u(m[0][1]),b)],[n(u(m[1][0]),b),n(m[0][0],b)]]}else{var M=m.concat();for(x=0;xO&&(O=o(M[x][S]),_=x),x++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");x=_,x!==S&&(C=M[S],M[S]=M[x],M[x]=C,C=A[S],A[S]=A[x],A[x]=C);var E=M[S],T=A[S];for(x=0;x{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:u,dot:l,ctranspose:c,divideScalar:o,multiply:s,add:m,Complex:d}=e;return r(aB,{"Array | Matrix":function(b){var M=Qe(b)?b.size():ur(b);switch(M.length){case 1:return w(b)?c(b):M[0]===1?n(b):u(c(b),l(b,b));case 2:{if(w(b))return c(b);var A=M[0],S=M[1];if(A===S)try{return n(b)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(b)?t(h(b.valueOf(),A,S),b.storage()):h(b,A,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(M)+")")}},any:function(b){return i(b,0)?ar(b):o(1,b)}});function h(C,b,M){var{C:A,F:S}=v(C,b,M),O=s(n(s(c(A),A)),c(A)),_=s(c(S),n(s(S,c(S))));return s(_,O)}function x(C,b,M){for(var A=ar(C),S=0,O=0;O_.filter((T,R)=>R!y(l(A[E],A[E])));return{C:S,F:O}}function y(C){return i(m(C,d(1,1)),m(0,d(1,1)))}function w(C){return a(m(C,d(1,1)),m(s(C,0),d(1,1)))}});function iB(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:u,sqrt:l,abs:c,bignumber:o,diag:s,size:m,reshape:d,inv:h,qr:x,usolve:v,usolveAll:y,equal:w,complex:C,larger:b,smaller:M,matrixFromColumns:A,dot:S}=e;function O(ae,$,le,Ee){var me=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,le,Ee,me);E(ae,$,le,Ee,me,ge);var{values:Se,C:xe}=T(ae,$,le,Ee,me);if(me){var be=R(ae,$,xe,ge,Se,le,Ee);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",xe=ge?o(0):0,be=ge?o(1):Se?C(1):1,De=ge?o(1):1,Ae=ge?o(10):2,We=i(Ae,Ae),Je;me&&(Je=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var ye=xe,j=xe,ne=0;ne<$;ne++)re!==ne&&(ye=r(ye,c(ae[ne][re])),j=r(j,c(ae[re][ne])));if(!w(ye,0)&&!w(j,0)){for(var ue=De,Me=ye,Ce=u(j,Ae),Le=i(j,Ae);M(Me,Ce);)Me=i(Me,We),ue=i(ue,Ae);for(;b(Me,Le);)Me=u(Me,We),ue=u(ue,Ae);var Ie=M(u(r(Me,j),ue),i(r(ye,j),.95));if(Ie){J=!1;for(var fr=u(1,ue),or=0;or<$;or++)re!==or&&(ae[re][or]=i(ae[re][or],fr),ae[or][re]=i(ae[or][re],ue));me&&(Je[re]=i(Je[re],fr))}}}}return me?s(Je):null}function E(ae,$,le,Ee,me,ge){var Se=Ee==="BigNumber",xe=Ee==="Complex",be=Se?o(0):xe?C(0):0;Se&&(le=o(le));for(var De=0;De<$-2;De++){for(var Ae=0,We=be,Je=De+1;Je<$;Je++){var J=ae[Je][De];M(c(We),c(J))&&(We=J,Ae=Je)}if(!M(c(We),le)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var ye=0;ye<$;ye++){var j=ae[ye][Ae];ae[ye][Ae]=ae[ye][De+1],ae[ye][De+1]=j}if(me){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=u(ae[ue][De],We);if(Me!==0){for(var Ce=0;Ce<$;Ce++)ae[ue][Ce]=t(ae[ue][Ce],i(Me,ae[De+1][Ce]));for(var Le=0;Le<$;Le++)ae[Le][De+1]=r(ae[Le][De+1],i(Me,ae[Le][ue]));if(me)for(var Ie=0;Ie<$;Ie++)ge[ue][Ie]=t(ge[ue][Ie],i(Me,ge[De+1][Ie]))}}}}return ge}function T(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",xe=ge?o(1):Se?C(1):1;ge&&(le=o(le));for(var be=ar(ae),De=[],Ae=$,We=[],Je=me?s(Array($).fill(xe)):void 0,J=me?s(Array(Ae).fill(xe)):void 0,re=0;re<=100;){re+=1;for(var ye=be[Ae-1][Ae-1],j=0;j1&&(J=s(Array(Ae-1).fill(xe)))),Ae-=1,be.pop();for(var Ce=0;Ce2&&(J=s(Array(Ae-2).fill(xe)))),Ae-=2,be.pop(),be.pop();for(var Ie=0;Ie+t(c(Ke),c(Pr))),re>100){var fr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw fr.values=De,fr.vectors=[],fr}var or=me?a(Je,H(We,$)):void 0;return{values:De,C:or}}function R(ae,$,le,Ee,me,ge,Se){var xe=h(le),be=a(xe,ae,le),De=Se==="BigNumber",Ae=Se==="Complex",We=De?o(0):Ae?C(0):0,Je=De?o(1):Ae?C(1):1,J=[],re=[];for(var ye of me){var j=L(J,ye,w);j===-1?(J.push(ye),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(We),Ce=s(Array($).fill(Je)),Le=function(){var or=J[Ie],Ke=t(be,a(or,Ce)),Pr=y(Ke,Me);for(Pr.shift();Pr.lengtha(ce,we)),ne.push(...Pr.map(we=>({value:or,vector:n(we)})))},Ie=0;Ie=5)return null;for(xe=0;;){var be=v(ae,Se);if(M(oe(z(Se,[be])),Ee))break;if(++xe>=10)return null;Se=pe(be)}return Se}function K(ae,$,le){var Ee=le==="BigNumber",me=le==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ee&&(ge=ge.map(Se=>o(Se))),me&&(ge=ge.map(Se=>C(Se))),ge=z(ge,$),pe(ge,le)}function z(ae,$){var le=m(ae);for(var Ee of $)Ee=d(Ee,le),ae=t(ae,a(u(S(Ee,ae),S(Ee,Ee)),Ee));return ae}function oe(ae){return c(l(S(ae,ae)))}function pe(ae,$){var le=$==="BigNumber",Ee=$==="Complex",me=le?o(1):Ee?C(1):1;return a(u(me,oe(ae)),ae)}return O}function oB(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:u,sin:l,multiplyScalar:c,inv:o,bignumber:s,multiply:m,add:d}=e;function h(E,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,q=arguments.length>3?arguments[3]:void 0,W=arguments.length>4?arguments[4]:void 0;if(q==="number")return x(E,R,W);if(q==="BigNumber")return v(E,R,W);throw TypeError("Unsupported data type: "+q)}function x(E,T,R){var q=E.length,W=Math.abs(T/q),G,H;if(R){H=new Array(q);for(var L=0;L=Math.abs(W);){var K=k[0][0],z=k[0][1];G=y(E[K][K],E[z][z],E[K][z]),E=A(E,G,K,z),R&&(H=C(H,G,K,z)),k=S(E)}for(var oe=Array(q).fill(0),pe=0;pe=a(W);){var K=k[0][0],z=k[0][1];G=w(E[K][K],E[z][z],E[K][z]),E=M(E,G,K,z),R&&(H=b(H,G,K,z)),k=O(E)}for(var oe=Array(q).fill(0),pe=0;pe({value:W[$],vector:ae}));return{values:W,eigenvectors:pe}}return h}var SG="eigs",NG=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],bg=F(SG,NG,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,divideScalar:d,inv:h,bignumber:x,multiply:v,add:y,larger:w,column:C,flatten:b,number:M,complex:A,sqrt:S,diag:O,size:_,reshape:E,qr:T,usolve:R,usolveAll:q,im:W,re:G,smaller:H,matrixFromColumns:L,dot:k}=e,K=oB({config:r,addScalar:a,subtract:i,column:C,flatten:b,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,inv:h,bignumber:x,complex:A,multiply:v,add:y}),z=iB({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:b,divideScalar:d,sqrt:S,abs:l,bignumber:x,diag:O,size:_,reshape:E,qr:T,inv:h,usolve:R,usolveAll:q,equal:u,complex:A,larger:w,smaller:H,matrixFromColumns:L,dot:k});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(me,ge){return oe(n(me),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var xe={matricize:!0};return ht(xe,Se),oe(ge,xe)}});function oe(me){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xe="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=pe(me,be,xe);return Se.matricize&&(De.values=n(De.values),xe&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:We,vector:Je}=Ae;return{value:We,vector:n(Je)}}))),xe&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function pe(me,ge,Se){var xe=me.toArray(),be=me.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(lr(be),")"));var De=be[0];if($(xe,De,ge)&&(le(xe,De),ae(xe,De,ge))){var Ae=Ee(me,xe,De);return K(xe,De,ge,Ae,Se)}var We=Ee(me,xe,De);return z(xe,De,ge,We,Se)}function ae(me,ge,Se){for(var xe=0;xe{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:u}=e;return r(sB,{Matrix:function(m){var d=m.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+lr(d)+")");for(var h=d[0],x=1e-15,v=l(m),y=c(v,x),w=y.q,C=y.j,b=u(m,Math.pow(2,-C)),M=a(h),A=a(h),S=1,O=b,_=-1,E=1;E<=w;E++)E>1&&(O=u(O,b),_=-_),S=S*(w-E+1)/((2*w-E+1)*E),M=n(M,u(S,O)),A=n(A,u(S*_,O));for(var T=u(i(A),M),R=0;R{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:u,subtract:l,inv:c,size:o,max:s,identity:m}=e,d=1e3,h=1e-6;function x(v){var y,w=0,C=v,b=m(o(v));do{var M=C;if(C=a(.5,n(M,c(b))),b=a(.5,n(b,c(M))),y=s(t(l(C,M))),y>h&&++w>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(y>h);return C}return r(uB,{"Array | Matrix":function(y){var w=Qe(y)?y.size():ur(y);switch(w.length){case 1:if(w[0]===1)return i(y,u);throw new RangeError("Matrix must be square (size: "+lr(w)+")");case 2:{var C=w[0],b=w[1];if(C===b)return x(y);throw new RangeError("Matrix must be square (size: "+lr(w)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+lr(w)+")")}}})});var fB="sylvester",CG=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Sg=F(fB,CG,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:u,concat:l,transpose:c,index:o,subset:s,add:m,subtract:d,identity:h,lusolve:x,abs:v}=e;return r(fB,{"Matrix, Matrix, Matrix":y,"Array, Matrix, Matrix":function(C,b,M){return y(a(C),b,M)},"Array, Array, Matrix":function(C,b,M){return y(a(C),a(b),M)},"Array, Matrix, Array":function(C,b,M){return y(a(C),b,a(M))},"Matrix, Array, Matrix":function(C,b,M){return y(C,a(b),M)},"Matrix, Array, Array":function(C,b,M){return y(C,a(b),a(M))},"Matrix, Matrix, Array":function(C,b,M){return y(C,b,a(M))},"Array, Array, Array":function(C,b,M){return y(a(C),a(b),a(M)).toArray()}});function y(w,C,b){for(var M=C.size()[0],A=w.size()[0],S=t(w),O=S.T,_=S.U,E=t(i(-1,C)),T=E.T,R=E.U,q=i(i(c(_),b),R),W=u(0,A),G=[],H=(Ae,We)=>l(Ae,We,1),L=(Ae,We)=>l(Ae,We,0),k=0;k1e-5){for(var K=L(s(q,o(W,k)),s(q,o(W,k+1))),z=0;z{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:u,subtract:l}=e;return r(cB,{Array:function(s){var m=c(t(s));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(s){return c(s)}});function c(o){var s=o.size()[0],m=o,d=n(s),h=0,x;do{x=m;var v=i(m),y=v.Q,w=v.R;if(m=a(w,y),d=a(d,y),h++>100)break}while(u(l(m,x))>1e-4);return{U:d,T:m}}});var lB="lyap",TG=["typed","matrix","sylvester","multiply","transpose"],Ag=F(lB,TG,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(lB,{"Matrix, Matrix":function(l,c){return n(l,i(l),a(-1,c))},"Array, Matrix":function(l,c){return n(t(l),i(t(l)),a(-1,c))},"Matrix, Array":function(l,c){return n(l,i(t(l)),t(a(-1,c)))},"Array, Array":function(l,c){return n(t(l),i(t(l)),t(a(-1,c))).toArray()}})});var FG="divide",_G=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Mg=F(FG,_G,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:u}=e,l=jr({typed:r,equalScalar:a}),c=qt({typed:r});return r("divide",Dm({"Array | Matrix, Array | Matrix":function(s,m){return n(s,u(m))},"DenseMatrix, any":function(s,m){return c(s,m,i,!1)},"SparseMatrix, any":function(s,m){return l(s,m,i,!1)},"Array, any":function(s,m){return c(t(s),m,i,!1).valueOf()},"any, Array | Matrix":function(s,m){return n(s,u(m))}},i.signatures))});var mB="distance",OG=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Cg=F(mB,OG,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:u,sqrt:l,abs:c}=e;return r(mB,{"Array, Array, Array":function(A,S,O){if(A.length===2&&S.length===2&&O.length===2){if(!s(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!s(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(S,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],S[1]),E=n(S[0],O[0]),T=n(a(O[0],S[1]),a(S[0],O[1]));return y(A[0],A[1],_,E,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(A,S,O){if(Object.keys(A).length===2&&Object.keys(S).length===2&&Object.keys(O).length===2){if(!s(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!s(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(x(S),x(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in A&&"pointY"in A&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,S.lineOnePtY),E=n(S.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,S.lineOnePtY),a(S.lineOnePtX,O.lineTwoPtY));return y(A.pointX,A.pointY,_,E,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(A,S){if(A.length===2&&S.length===3){if(!s(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return y(A[0],A[1],S[0],S[1],S[2])}else if(A.length===3&&S.length===6){if(!m(A))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return w(A[0],A[1],A[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(A.length===S.length&&A.length>0){if(!d(A))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return C(A,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(A,S){if(Object.keys(A).length===2&&Object.keys(S).length===3){if(!s(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return y(A.pointX,A.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(S).length===6){if(!m(A))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return w(A.pointX,A.pointY,A.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===2&&Object.keys(S).length===2){if(!s(A))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointTwoX"in S&&"pointTwoY"in S)return C([A.pointOneX,A.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(S).length===3){if(!m(A))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointOneZ"in A&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return C([A.pointOneX,A.pointOneY,A.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(A){if(!v(A))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(A)}});function o(M){return typeof M=="number"||rr(M)}function s(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])}function m(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])&&o(M[2])}function d(M){return Array.isArray(M)||(M=x(M)),M.every(o)}function h(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])&&o(M[2])&&o(M[3])&&o(M[4])&&o(M[5])}function x(M){for(var A=Object.keys(M),S=[],O=0;OA.length!==2||!o(A[0])||!o(A[1])))return!1}else if(M[0].length===3&&o(M[0][0])&&o(M[0][1])&&o(M[0][2])){if(M.some(A=>A.length!==3||!o(A[0])||!o(A[1])||!o(A[2])))return!1}else return!1;return!0}function y(M,A,S,O,_){var E=c(t(t(a(S,M),a(O,A)),_)),T=l(t(a(S,S),a(O,O)));return i(E,T)}function w(M,A,S,O,_,E,T,R,q){var W=[n(a(n(_,A),q),a(n(E,S),R)),n(a(n(E,S),T),a(n(O,M),q)),n(a(n(O,M),R),a(n(_,A),T))];W=l(t(t(a(W[0],W[0]),a(W[1],W[1])),a(W[2],W[2])));var G=l(t(t(a(T,T),a(R,R)),a(q,q)));return i(W,G)}function C(M,A){for(var S=M.length,O=0,_=0,E=0;E{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:u,multiply:l,multiplyScalar:c,divideScalar:o,subtract:s,smaller:m,equalScalar:d,flatten:h,isZero:x,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":w,"Matrix, Matrix, Matrix":function(R,q,W){var G=y(R.valueOf(),q.valueOf(),W.valueOf());return G===null?null:u(G)},"Matrix, Matrix, Matrix, Matrix":function(R,q,W,G){var H=w(R.valueOf(),q.valueOf(),W.valueOf(),G.valueOf());return H===null?null:u(H)}});function y(T,R,q){if(T=C(T),R=C(R),q=C(q),!M(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!M(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(q))throw new TypeError("Array with 4 numbers expected as third argument");return E(T[0],T[1],T[2],R[0],R[1],R[2],q[0],q[1],q[2],q[3])}function w(T,R,q,W){if(T=C(T),R=C(R),q=C(q),W=C(W),T.length===2){if(!b(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(q))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(W))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(T,R,q,W)}else if(T.length===3){if(!M(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!M(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(q))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!M(W))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],R[0],R[1],R[2],q[0],q[1],q[2],W[0],W[1],W[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function C(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(R=>Array.isArray(R)&&R.length===1)?h(T):T}function b(T){return T.length===2&&v(T[0])&&v(T[1])}function M(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function A(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function S(T,R,q,W){var G=T,H=q,L=s(G,R),k=s(H,W),K=s(c(L[0],k[1]),c(k[0],L[1]));if(x(K)||m(n(K),t.epsilon))return null;var z=c(k[0],G[1]),oe=c(k[1],G[0]),pe=c(k[0],H[1]),ae=c(k[1],H[0]),$=o(i(s(s(z,oe),pe),ae),K);return a(l(L,$),G)}function O(T,R,q,W,G,H,L,k,K,z,oe,pe){var ae=c(s(T,R),s(q,W)),$=c(s(G,H),s(L,k)),le=c(s(K,z),s(oe,pe));return i(i(ae,$),le)}function _(T,R,q,W,G,H,L,k,K,z,oe,pe){var ae=O(T,L,z,L,R,k,oe,k,q,K,pe,K),$=O(z,L,W,T,oe,k,G,R,pe,K,H,q),le=O(T,L,W,T,R,k,G,R,q,K,H,q),Ee=O(z,L,z,L,oe,k,oe,k,pe,K,pe,K),me=O(W,T,W,T,G,R,G,R,H,q,H,q),ge=s(c(ae,$),c(le,Ee)),Se=s(c(me,Ee),c($,$));if(x(Se))return null;var xe=o(ge,Se),be=o(i(ae,c(xe,$)),Ee),De=i(T,c(xe,s(W,T))),Ae=i(R,c(xe,s(G,R))),We=i(q,c(xe,s(H,q))),Je=i(L,c(be,s(z,L))),J=i(k,c(be,s(oe,k))),re=i(K,c(be,s(pe,K)));return d(De,Je)&&d(Ae,J)&&d(We,re)?[De,Ae,We]:null}function E(T,R,q,W,G,H,L,k,K,z){var oe=c(T,L),pe=c(W,L),ae=c(R,k),$=c(G,k),le=c(q,K),Ee=c(H,K),me=s(s(s(z,oe),ae),le),ge=s(s(s(i(i(pe,$),Ee),oe),ae),le),Se=o(me,ge),xe=i(T,c(Se,s(W,T))),be=i(R,c(Se,s(G,R))),De=i(q,c(Se,s(H,q)));return[xe,be,De]}});var pB="sum",IG=["typed","config","add","numeric"],nf=F(pB,IG,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(pB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":u,"...":function(c){if(Ba(c))throw new TypeError("Scalar values expected in function sum");return i(c)}});function i(l){var c;return An(l,function(o){try{c=c===void 0?o:n(c,o)}catch(s){throw Et(s,"sum",o)}}),c===void 0&&(c=a(0,t.number)),typeof c=="string"&&(c=a(c,t.number)),c}function u(l,c){try{var o=ko(l,c,n);return o}catch(s){throw Et(s,"sum")}}});var Tg="cumsum",RG=["typed","add","unaryPlus"],af=F(Tg,RG,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(Tg,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":u,"Matrix, number | BigNumber":function(o,s){return o.create(u(o.valueOf(),s))},"...":function(o){if(Ba(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(c){try{return i(c)}catch(o){throw Et(o,Tg)}}function i(c){if(c.length===0)return[];for(var o=[n(c[0])],s=1;s=s.length)throw new tn(o,s.length);try{return l(c,o)}catch(m){throw Et(m,Tg)}}function l(c,o){var s,m,d;if(o<=0){var h=c[0][0];if(Array.isArray(h)){for(d=Km(c),m=[],s=0;s{var{typed:r,add:t,divide:n}=e;return r(dB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(l){if(Ba(l))throw new TypeError("Scalar values expected in function mean");return i(l)}});function a(u,l){try{var c=ko(u,l,t),o=Array.isArray(u)?ur(u):u.size();return n(c,o[l])}catch(s){throw Et(s,"mean")}}function i(u){var l,c=0;if(An(u,function(o){try{l=l===void 0?o:t(l,o),c++}catch(s){throw Et(s,"mean",o)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,c)}});var hB="median",qG=["typed","add","divide","compare","partitionSelect"],Fg=F(hB,qG,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function u(o){try{o=gr(o.valueOf());var s=o.length;if(s===0)throw new Error("Cannot calculate median of an empty array");if(s%2===0){for(var m=s/2-1,d=i(o,m+1),h=o[m],x=0;x0&&(h=o[x]);return c(h,d)}else{var v=i(o,(s-1)/2);return l(v)}}catch(y){throw Et(y,"median")}}var l=r({"number | BigNumber | Complex | Unit":function(s){return s}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(s,m){return n(t(s,m),2)}});return r(hB,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(s,m){throw new Error("median(A, dim) is not yet supported")},"...":function(s){if(Ba(s))throw new TypeError("Scalar values expected in function median");return u(s)}})});var vB="mad",LG=["typed","abs","map","median","subtract"],_g=F(vB,LG,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(vB,{"Array | Matrix":u,"...":function(c){return u(c)}});function u(l){if(l=gr(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=a(l);return a(n(l,function(o){return t(i(o,c))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):Et(o,"mad")}}});var ND="unbiased",gB="variance",zG=["typed","add","subtract","multiply","divide","apply","isNaN"],sf=F(gB,zG,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e;return r(gB,{"Array | Matrix":function(m){return c(m,ND)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(m,d){return o(m,d,ND)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return c(m,ND)}});function c(s,m){var d,h=0;if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(An(s,function(y){try{d=d===void 0?y:t(d,y),h++}catch(w){throw Et(w,"variance",y)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var x=i(d,h);if(d=void 0,An(s,function(y){var w=n(y,x);d=d===void 0?a(w,w):t(d,a(w,w))}),l(d))return d;switch(m){case"uncorrected":return i(d,h);case"biased":return i(d,h+1);case"unbiased":{var v=rr(d)?d.mul(0):0;return h===1?v:i(d,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(s,m,d){try{if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(s,m,h=>c(h,d))}catch(h){throw Et(h,"variance")}}});var xB="quantileSeq",UG=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],uf=F(xB,UG,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=qo({typed:r,isInteger:o});return r(xB,{"Array | Matrix, number | BigNumber":(C,b)=>v(C,b,!1),"Array | Matrix, number | BigNumber, number":(C,b,M)=>x(C,b,!1,M,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(C,b,M,A)=>x(C,b,M,A,v),"Array | Matrix, Array | Matrix":(C,b)=>y(C,b,!1),"Array | Matrix, Array | Matrix, number":(C,b,M)=>x(C,b,!1,M,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(C,b,M,A)=>x(C,b,M,A,y)});function x(C,b,M,A,S){return h(C,A,O=>S(O,b,M))}function v(C,b,M){var A,S=C.valueOf();if(s(b,0))throw new Error("N/prob must be non-negative");if(m(b,1))return sr(b)?w(S,b,M):t(w(S,b,M));if(d(b,1)){if(!o(b))throw new Error("N must be a positive integer");if(d(b,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(b,1);A=[];for(var _=0;s(_,b);_++){var E=i(_+1,O);A.push(w(S,E,M))}return sr(b)?A:t(A)}}function y(C,b,M){for(var A=C.valueOf(),S=b.valueOf(),O=[],_=0;_0&&(T=A[q])}return n(u(T,a(1,E)),u(R,E))}});var yB="std",WG=["typed","map","sqrt","variance"],ff=F(yB,WG,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(yB,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(l){return i(l)}});function i(u,l){if(u.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=a.apply(null,arguments);return Nt(c)?t(c,n):n(c)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var bB="corr",YG=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Og=F(bB,YG,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:u,multiply:l,pow:c,divide:o}=e;return r(bB,{"Array, Array":function(h,x){return s(h,x)},"Matrix, Matrix":function(h,x){var v=s(h.toArray(),x.toArray());return Array.isArray(v)?t(v):v}});function s(d,h){var x=[];if(Array.isArray(d[0])&&Array.isArray(h[0])){if(d.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(S,l(O,h[_])),0),C=a(d.map(S=>c(S,2))),b=a(h.map(S=>c(S,2))),M=u(l(x,w),l(v,y)),A=n(l(u(l(x,C),c(v,2)),u(l(x,b),c(y,2))));return o(M,A)}});var wB="combinations",HG=["typed"],Bg=F(wB,HG,e=>{var{typed:r}=e;return r(wB,{"number, number":kw,"BigNumber, BigNumber":function(n,a){var i=n.constructor,u,l,c=n.minus(a),o=new i(1);if(!DB(n)||!DB(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(u=o,a.lt(c))for(l=o;l.lte(c);l=l.plus(o))u=u.times(a.plus(l)).dividedBy(l);else for(l=o;l.lte(a);l=l.plus(o))u=u.times(c.plus(l)).dividedBy(l);return u}})});function DB(e){return e.isInteger()&&e.gte(0)}var SB="combinationsWithRep",$G=["typed"],Pg=F(SB,$G,e=>{var{typed:r}=e;return r(SB,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:u}=e;function l(o){if(o.im===0)return _c(o.re);if(o.re<.5){var s=new u(1-o.re,-o.im),m=new u(Math.PI*o.re,Math.PI*o.im);return new u(Math.PI).div(m.sin()).div(l(s))}o=new u(o.re-1,o.im);for(var d=new u(Ts[0],0),h=1;h2;)d-=2,x+=d,h=h.times(x);return new i(h.toPrecision(i.precision))}});var MB="lgamma",VG=["Complex","typed"],Rg=F(MB,VG,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(MB,{number:Oc,Complex:u,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function u(o){var s=6.283185307179586,m=1.1447298858494002,d=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(Oc(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return l(o);if(o.re<=d){var h=nM(s,o.im)*Math.floor(.5*o.re+.25),x=o.mul(Math.PI).sin().log(),v=u(new r(1-o.re,-o.im));return new r(m,h).sub(x).sub(v)}else return o.im>=0?c(o):c(o.conjugate()).conjugate()}function l(o){for(var s=o.sub(.5).mul(o.log()).sub(o).add(Hw),m=new r(1,0).div(o),d=m.div(o),h=i[0],x=i[1],v=2*d.re,y=d.re*d.re+d.im*d.im,w=2;w<8;w++){var C=x;x=-y*h+i[w],h=v*h+C}var b=m.mul(d.mul(h).add(x));return s.add(b)}function c(o){var s=0,m=0,d=o;for(o=o.add(1);o.re<=n;){d=d.mul(o);var h=d.im<0?1:0;h!==0&&m===0&&s++,m=h,o=o.add(1)}return l(o).sub(d.log()).sub(new r(0,s*2*Math.PI*1))}});var CB="factorial",ZG=["typed","gamma"],kg=F(CB,ZG,e=>{var{typed:r,gamma:t}=e;return r(CB,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var EB="kldivergence",QG=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],qg=F(EB,QG,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:u,dotDivide:l,log:c,isNumeric:o}=e;return r(EB,{"Array, Array":function(d,h){return s(t(d),t(h))},"Matrix, Array":function(d,h){return s(d,t(h))},"Array, Matrix":function(d,h){return s(t(d),h)},"Matrix, Matrix":function(d,h){return s(d,h)}});function s(m,d){var h=d.size().length,x=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(x>1)throw new Error("second object must be one dimensional");if(h!==x)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var y=a(d);if(y===0)throw new Error("Sum of elements in second object must be non zero");var w=n(m,a(m)),C=n(d,a(d)),b=a(i(w,u(l(w,C),M=>c(M))));return o(b)?b:Number.NaN}});var TB="multinomial",XG=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Lg=F(TB,XG,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:u,isPositive:l}=e;return r(TB,{"Array | Matrix":function(o){var s=0,m=1;return An(o,function(d){if(!u(d)||!l(d))throw new TypeError("Positive integer value expected in function multinomial");s=t(s,d),m=a(m,i(d))}),n(i(s),m)}})});var FB="permutations",JG=["typed","factorial"],zg=F(FB,JG,e=>{var{typed:r,factorial:t}=e;return r(FB,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return da(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var u,l;if(!_B(a)||!_B(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var c=a.mul(0).add(1);for(u=c,l=a.minus(i).plus(1);l.lte(a);l=l.plus(1))u=u.times(l);return u}})});function _B(e){return e.isInteger()&&e.gte(0)}var _D=ca(ZB(),1),aV=(0,_D.default)(Date.now());function to(e){var r;function t(a){r=a===null?aV:(0,_D.default)(String(a))}t(e);function n(){return r()}return n}var QB="pickRandom",iV=["typed","config","?on"],Wg=F(QB,iV,e=>{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(u,l){u.randomSeed!==l.randomSeed&&(a=to(u.randomSeed))}),r(QB,{"Array | Matrix":function(l){return i(l,{})},"Array | Matrix, Object":function(l,c){return i(l,c)},"Array | Matrix, number":function(l,c){return i(l,{number:c})},"Array | Matrix, Array | Matrix":function(l,c){return i(l,{weights:c})},"Array | Matrix, Array | Matrix, number":function(l,c,o){return i(l,{number:o,weights:c})},"Array | Matrix, number, Array | Matrix":function(l,c,o){return i(l,{number:c,weights:o})}});function i(u,l){var{number:c,weights:o,elementWise:s=!0}=l,m=typeof c>"u";m&&(c=1);var d=Qe(u)?u.create:Qe(o)?o.create:null;u=u.valueOf(),o&&(o=o.valueOf()),s===!0&&(u=gr(u),o=gr(o));var h=0;if(typeof o<"u"){if(o.length!==u.length)throw new Error("Weights must have the same length as possibles");for(var x=0,v=o.length;x"u")C=u[Math.floor(a()*y)];else for(var b=a()*h,M=0,A=u.length;M1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=to(l.randomSeed))}),r(XB,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=kc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return l+a()*(c-l)}});var JB="randomInt",sV=["typed","config","?on"],Hg=F(JB,sV,e=>{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=to(l.randomSeed))}),r(JB,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=kc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return Math.floor(l+a()*(c-l))}});var KB="stirlingS2",uV=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],$g=F(KB,uV,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:u,factorial:l,combinations:c,isNegative:o,isInteger:s,number:m,bignumber:d,larger:h}=e,x=[],v=[];return r(KB,{"number | BigNumber, number | BigNumber":function(w,C){if(!s(w)||o(w)||!s(C)||o(C))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(C,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(sr(w)&&sr(C)),M=b?v:x,A=b?d:m,S=m(w),O=m(C);if(M[S]&&M[S].length>O)return M[S][O];for(var _=0;_<=S;++_)if(M[_]||(M[_]=[A(_===0?1:0)]),_!==0)for(var E=M[_],T=M[_-1],R=E.length;R<=_&&R<=O;++R)R===_?E[R]=1:E[R]=t(a(A(R),T[R]),T[R-1]);return M[S][O]}})});var jB="bellNumbers",fV=["typed","addScalar","isNegative","isInteger","stirlingS2"],Gg=F(jB,fV,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(jB,{"number | BigNumber":function(l){if(!a(l)||n(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,o=0;o<=l;o++)c=t(c,i(l,o));return c}})});var eP="catalan",cV=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Vg=F(eP,cV,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:u,isInteger:l}=e;return r(eP,{"number | BigNumber":function(o){if(!l(o)||u(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var rP="composition",lV=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Zg=F(rP,lV,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:u,larger:l}=e;return r(rP,{"number | BigNumber, number | BigNumber":function(o,s){if(!u(o)||!a(o)||!u(s)||!a(s))throw new TypeError("Positive integer value expected in function composition");if(l(s,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(s,-1))}})});var tP="leafCount",mV=["parse","typed"],Qg=F(tP,mV,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(u=>{i+=n(u)}),i||1}return t(tP,{Node:function(i){return n(i)}})});function OD(e){return yr(e)||ct(e)&&e.isUnary()&&yr(e.args[0])}function qc(e){return!!(yr(e)||(gn(e)||ct(e))&&e.args.every(qc)||en(e)&&qc(e.content))}function nP(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function BD(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,u="defaultF",l={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},c={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function s(b,M){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,S=u;if(typeof b=="string"?S=b:ct(b)?S=b.fn.toString():gn(b)?S=b.name:en(b)&&(S="paren"),Xe(A,S)){var O=A[S];if(Xe(O,M))return O[M];if(Xe(l,S))return l[S][M]}if(Xe(A,u)){var _=A[u];return Xe(_,M)?_[M]:l[u][M]}if(Xe(l,S)){var E=l[S];if(Xe(E,M))return E[M]}return l[u][M]}function m(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"commutative",M)}function d(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"associative",M)}function h(b,M){var A=BD({},b);for(var S in M)Xe(b,S)?A[S]=BD(BD({},M[S]),b[S]):A[S]=M[S];return A}function x(b,M){if(!b.args||b.args.length===0)return b;b.args=v(b,M);for(var A=0;A2&&d(b,M)){for(var _=b.args.pop();b.args.length>0;)_=A([b.args.pop(),_]);b.args=_.args}}}function w(b,M){if(!(!b.args||b.args.length===0)){for(var A=C(b),S=b.args.length,O=0;O2&&d(b,M)){for(var _=b.args.shift();b.args.length>0;)_=A([_,b.args.shift()]);b.args=_.args}}}function C(b){return ct(b)?function(M){try{return new t(b.op,b.fn,M,b.implicit)}catch(A){return console.error(A),[]}}:function(M){return new r(new n(b.name),M)}}return{createMakeNodeFunction:C,hasProperty:s,isCommutative:m,isAssociative:d,mergeContext:h,flatten:x,allChildren:v,unflattenr:y,unflattenl:w,defaultContext:l,realContext:c,positiveContext:o}});var hV="simplify",vV=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Xg=F(hV,vV,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:u,divide:l,pow:c,isZero:o,equal:s,resolve:m,simplifyConstant:d,simplifyCore:h,fraction:x,bignumber:v,mathWithTransform:y,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:M,FunctionNode:A,IndexNode:S,ObjectNode:O,OperatorNode:_,ParenthesisNode:E,SymbolNode:T}=e,{hasProperty:R,isCommutative:q,isAssociative:W,mergeContext:G,flatten:H,unflattenr:L,unflattenl:k,createMakeNodeFunction:K,defaultContext:z,realContext:oe,positiveContext:pe}=cf({FunctionNode:A,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:Ki});var ae=t("simplify",{Node:xe,"Node, Map":(j,ne)=>xe(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>xe(j,!1,ne,ue),"Node, Array":xe,"Node, Array, Map":xe,"Node, Array, Map, Object":xe});t.removeConversion({from:"Object",to:"Map",convert:Ki}),ae.defaultContext=z,ae.realContext=oe,ae.positiveContext=pe;function $(j){return j.transform(function(ne,ue,Me){return en(ne)?$(ne.content):ne})}var le={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ee(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in j&&(ue[Ce]=j[Ce]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),W(ue.l,ne)){var Le=!q(ue.l,ne),Ie;Le&&(Ie=Se());var fr=K(ue.l),or=Se();ue.expanded={},ue.expanded.l=fr([ue.l,or]),H(ue.expanded.l,ne),L(ue.expanded.l,ne),ue.expanded.r=fr([ue.r,or]),Le&&(ue.expandedNC1={},ue.expandedNC1.l=fr([Ie,ue.l]),ue.expandedNC1.r=fr([Ie,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=fr([Ie,ue.expanded.l]),ue.expandedNC2.r=fr([Ie,ue.expanded.r]))}return ue}function me(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:Oo(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Me.consoleDebug;ne=me(ne||ae.rules,Me.context);var Le=m(j,ue);Le=$(Le);for(var Ie={},fr=Le.toString({parenthesis:"all"});!Ie[fr];){Ie[fr]=!0,ge=0;var or=fr;Ce&&console.log("Working on: ",fr);for(var Ke=0;Ke ").concat(ne[Ke].r.toString()))),Ce){var ee=Le.toString({parenthesis:"all"});ee!==or&&(console.log("Applying",Pr,"produced",ee),or=ee)}k(Le,Me.context)}fr=Le.toString({parenthesis:"all"})}return Le}function be(j,ne,ue){var Me=j;if(j)for(var Ce=0;Ce1&&(or=Le(j.args.slice(0,fr))),Ce=j.args.slice(fr),Me=Ce.length===1?Ce[0]:Le(Ce),ue.push(Le([or,Me]))}return ue}function We(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!ye(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ce in ne.placeholders)Xe(ne.placeholders,Ce)&&(ue.placeholders[Ce]=ne.placeholders[Ce]);return ue}function Je(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var or=re(j.args[0],ne.args[1],ue);if(or.length===0)return[];var Ke=re(j.args[1],ne.args[0],ue);if(Ke.length===0)return[];Le=[or,Ke]}Ce=J(Le)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],ce=0;ce2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(le[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ce[0].placeholders[j.name]=ne;break;case"c":case"cl":if(yr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"v":if(!yr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vl":if(at(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"cd":if(OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ce":if(qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof M){if(!s(j.value,ne.value))return[]}else return[];return Ce}function ye(j,ne){if(j instanceof M&&ne instanceof M){if(!s(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof A&&ne instanceof A){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof A&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:u,AccessorNode:l,ArrayNode:c,ConstantNode:o,FunctionNode:s,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:x}=e,{isCommutative:v,isAssociative:y,allChildren:w,createMakeNodeFunction:C}=cf({FunctionNode:s,OperatorNode:h,SymbolNode:x}),b=r("simplifyConstant",{Node:H=>O(G(H,{})),"Node, Object":function(L,k){return O(G(L,k))}});function M(H){return ma(H)?H.valueOf():H instanceof Array?H.map(M):Qe(H)?a(M(H.valueOf())):H}function A(H,L,k){try{return n[H].apply(null,L)}catch{return L=L.map(M),E(n[H].apply(null,L),k)}}var S=r({Fraction:R,number:function(L){return L<0?T(new o(-L)):new o(L)},BigNumber:function(L){return L<0?T(new o(-L)):new o(L)},Complex:function(L){throw new Error("Cannot convert Complex number to Node")},string:function(L){return new o(L)},Matrix:function(L){return new c(L.valueOf().map(k=>S(k)))}});function O(H){return Nr(H)?H:S(H)}function _(H,L){var k=L&&L.exactFractions!==!1;if(k&&isFinite(H)&&i){var K=i(H),z=L&&typeof L.fractionsLimit=="number"?L.fractionsLimit:1/0;if(K.valueOf()===H&&K.n0;)if(yr(K[0])&&typeof K[0].value!="string"){var z=E(K.shift().value,k);jt(H)?H=H.items[z-1]:(H=H.valueOf()[z-1],H instanceof Array&&(H=a(H)))}else if(K.length>1&&yr(K[1])&&typeof K[1].value!="string"){var oe=E(K[1].value,k),pe=[],ae=jt(H)?H.items:H.valueOf();for(var $ of ae)if(jt($))pe.push($.items[oe-1]);else if(Qe(H))pe.push($[oe-1]);else break;if(pe.length===ae.length)jt(H)?H=new c(pe):H=a(pe),K.splice(1,1);else break}else break;return K.length===L.dimensions.length?new l(O(H),L):K.length>0?(L=new m(K),new l(O(H),L)):H}if(Ci(H)&&L.dimensions.length===1&&yr(L.dimensions[0])){var le=L.dimensions[0].value;return le in H.properties?H.properties[le]:new o}return new l(O(H),L)}function W(H,L,k,K){var z=L.shift(),oe=L.reduce((pe,ae)=>{if(!Nr(ae)){var $=pe.pop();if(Nr($))return[$,ae];try{return pe.push(A(H,[$,ae],K)),pe}catch{pe.push($)}}pe.push(O(pe.pop()));var le=pe.length===1?pe[0]:k(pe);return[k([le,O(ae)])]},[z]);return oe.length===1?oe[0]:k([oe[0],S(oe[1])])}function G(H,L){switch(H.type){case"SymbolNode":return H;case"ConstantNode":switch(typeof H.value){case"number":return E(H.value,L);case"string":return H.value;default:if(!isNaN(H.value))return E(H.value,L)}return H;case"FunctionNode":if(n[H.name]&&n[H.name].rawArgs)return H;{var k=["add","multiply"];if(k.indexOf(H.name)===-1){var K=H.args.map(De=>G(De,L));if(!K.some(Nr))try{return A(H.name,K,L)}catch{}if(H.name==="size"&&K.length===1&&jt(K[0])){for(var z=[],oe=K[0];jt(oe);)z.push(oe.items.length),oe=oe.items[0];return a(z)}return new s(H.name,K.map(O))}}case"OperatorNode":{var pe=H.fn.toString(),ae,$,le=C(H);if(ct(H)&&H.isUnary())ae=[G(H.args[0],L)],Nr(ae[0])?$=le(ae):$=A(pe,ae,L);else if(y(H,L.context))if(ae=w(H,L.context),ae=ae.map(De=>G(De,L)),v(pe,L.context)){for(var Ee=[],me=[],ge=0;ge1?($=W(pe,Ee,le,L),me.unshift($),$=W(pe,me,le,L)):$=W(pe,ae,le,L)}else $=W(pe,ae,le,L);else ae=H.args.map(De=>G(De,L)),$=W(pe,ae,le,L);return $}case"ParenthesisNode":return G(H.content,L);case"AccessorNode":return q(G(H.object,L),G(H.index,L),L);case"ArrayNode":{var Se=H.items.map(De=>G(De,L));return Se.some(Nr)?new c(Se.map(O)):a(Se)}case"IndexNode":return new m(H.dimensions.map(De=>b(De,L)));case"ObjectNode":{var xe={};for(var be in H.properties)xe[be]=b(H.properties[be],L);return new d(xe)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(H.type))}}return b});var aP="simplifyCore",yV=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Kg=F(aP,yV,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,AccessorNode:s,ArrayNode:m,ConstantNode:d,FunctionNode:h,IndexNode:x,ObjectNode:v,OperatorNode:y,ParenthesisNode:w,SymbolNode:C}=e,b=new d(0),M=new d(1),A=new d(!0),S=new d(!1);function O(R){return ct(R)&&["and","not","or"].includes(R.op)}var{hasProperty:_,isCommutative:E}=cf({FunctionNode:h,OperatorNode:y,SymbolNode:C});function T(R){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=q?q.context:void 0;if(_(R,"trivial",W)){if(gn(R)&&R.args.length===1)return T(R.args[0],q);var G=!1,H=0;if(R.forEach(me=>{++H,H===1&&(G=T(me,q))}),H===1)return G}var L=R;if(gn(L)){var k=rT(L.name);if(k){if(L.args.length>2&&_(L,"associative",W))for(;L.args.length>2;){var K=L.args.pop(),z=L.args.pop();L.args.push(new y(k,L.name,[K,z]))}L=new y(k,L.name,L.args)}else return new h(T(L.fn),L.args.map(me=>T(me,q)))}if(ct(L)&&L.isUnary()){var oe=T(L.args[0],q);if(L.op==="~"&&ct(oe)&&oe.isUnary()&&oe.op==="~"||L.op==="not"&&ct(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var pe=!0;if(L.op==="-"&&ct(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(L=new y("-","subtract",[oe.args[1],oe.args[0]]),pe=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(pe)return new y(L.op,L.fn,[oe])}if(ct(L)&&L.isBinary()){var ae=T(L.args[0],q),$=T(L.args[1],q);if(L.op==="+"){if(yr(ae)&&a(ae.value))return $;if(yr($)&&a($.value))return ae;ct($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],L=new y("-","subtract",[ae,$]))}if(L.op==="-")return ct($)&&$.isUnary()&&$.op==="-"?T(new y("+","add",[ae,$.args[0]]),q):yr(ae)&&a(ae.value)?T(new y("-","unaryMinus",[$])):yr($)&&a($.value)?ae:new y(L.op,L.fn,[ae,$]);if(L.op==="*"){if(yr(ae)){if(a(ae.value))return b;if(n(ae.value,1))return $}if(yr($)){if(a($.value))return b;if(n($.value,1))return ae;if(E(L,W))return new y(L.op,L.fn,[$,ae],L.implicit)}return new y(L.op,L.fn,[ae,$],L.implicit)}if(L.op==="/")return yr(ae)&&a(ae.value)?b:yr($)&&n($.value,1)?ae:new y(L.op,L.fn,[ae,$]);if(L.op==="^"&&yr($)){if(a($.value))return M;if(n($.value,1))return ae}if(L.op==="and"){if(yr(ae))if(ae.value){if(O($))return $;if(yr($))return $.value?A:S}else return S;if(yr($))if($.value){if(O(ae))return ae}else return S}if(L.op==="or"){if(yr(ae)){if(ae.value)return A;if(O($))return $}if(yr($)){if($.value)return A;if(O(ae))return ae}}return new y(L.op,L.fn,[ae,$])}if(ct(L))return new y(L.op,L.fn,L.args.map(me=>T(me,q)));if(jt(L))return new m(L.items.map(me=>T(me,q)));if(qn(L))return new s(T(L.object,q),T(L.index,q));if(Qn(L))return new x(L.dimensions.map(me=>T(me,q)));if(Ci(L)){var le={};for(var Ee in L.properties)le[Ee]=T(L.properties[Ee],q);return new v(le)}return L}return r(aP,{Node:T,"Node,Object":T})});var bV="resolve",wV=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],jg=F(bV,wV,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:u}=e;function l(c,o){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return c;if(at(c)){if(s.has(c.name)){var m=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var d=o.get(c.name);if(Nr(d)){var h=new Set(s);return h.add(c.name),l(d,o,h)}else return typeof d=="number"?t(String(d)):d!==void 0?new n(d):c}else if(ct(c)){var x=c.args.map(function(y){return l(y,o,s)});return new i(c.op,c.fn,x,c.implicit)}else{if(en(c))return new u(l(c.content,o,s));if(gn(c)){var v=c.args.map(function(y){return l(y,o,s)});return new a(c.name,v)}}return c.map(y=>l(y,o,s))}return r("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(c,o)=>l(c,Ki(o)),"Array | Matrix":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array | Matrix, null | undefined":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array, Object":r.referTo("Array,Map",c=>(o,s)=>c(o,Ki(s))),"Matrix, Object":r.referTo("Matrix,Map",c=>(o,s)=>c(o,Ki(s))),"Array | Matrix, Map":r.referToSelf(c=>(o,s)=>o.map(m=>c(m,s)))})});var iP="symbolicEqual",DV=["parse","simplify","typed","OperatorNode"],e0=F(iP,DV,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(u,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[u,l]),s=t(o,{},c);return yr(s)&&!s.value}return n(iP,{"Node, Node":i,"Node, Node, Object":i})});var oP="derivative",SV=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],r0=F(oP,SV,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:u,numeric:l,ConstantNode:c,FunctionNode:o,OperatorNode:s,ParenthesisNode:m,SymbolNode:d}=e;function h(b,M){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};y(S,b,M.name);var O=w(b,S);return A.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var x=r(oP,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),x._simplify=!0,x.toTex=function(b){return v.apply(null,b.args)};var v=r("_derivTex",{"Node, SymbolNode":function(M,A){return yr(M)&&Fr(M.value)==="string"?v(n(M.value).toString(),A.toString(),1):v(M.toTex(),A.toString(),1)},"Node, ConstantNode":function(M,A){if(Fr(A.value)==="string")return v(M,n(A.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(M,A,S){return v(M.toString(),A.name,S.value)},"string, string, number":function(M,A,S){var O;return S===1?O="{d\\\\over d"+A+"}":O="{d^{"+S+"}\\\\over d"+A+"^{"+S+"}}",O+"\\\\left[".concat(M,"\\\\right]")}}),y=r("constTag",{"Object, ConstantNode, string":function(M,A){return M[A]=!0,!0},"Object, SymbolNode, string":function(M,A,S){return A.name!==S?(M[A]=!0,!0):!1},"Object, ParenthesisNode, string":function(M,A,S){return y(M,A.content,S)},"Object, FunctionAssignmentNode, string":function(M,A,S){return A.params.indexOf(S)===-1?(M[A]=!0,!0):y(M,A.expr,S)},"Object, FunctionNode | OperatorNode, string":function(M,A,S){if(A.args.length>0){for(var O=y(M,A.args[0],S),_=1;_0){var O=M.args.filter(function(H){return A[H]===void 0}),_=O.length===1?O[0]:new s("*","multiply",O),E=S.concat(w(_,A));return new s("*","multiply",E)}return new s("+","add",M.args.map(function(H){return new s("*","multiply",M.args.map(function(L){return L===H?w(L,A):L.clone()}))}))}if(M.op==="/"&&M.isBinary()){var T=M.args[0],R=M.args[1];return A[R]!==void 0?new s("/","divide",[w(T,A),R]):A[T]!==void 0?new s("*","multiply",[new s("-","unaryMinus",[T]),new s("/","divide",[w(R,A),new s("^","pow",[R.clone(),C(2)])])]):new s("/","divide",[new s("-","subtract",[new s("*","multiply",[w(T,A),R.clone()]),new s("*","multiply",[T.clone(),w(R,A)])]),new s("^","pow",[R.clone(),C(2)])])}if(M.op==="^"&&M.isBinary()){var q=M.args[0],W=M.args[1];if(A[q]!==void 0)return yr(q)&&(u(q.value)||i(q.value,1))?C(0):new s("*","multiply",[M,new s("*","multiply",[new o("log",[q.clone()]),w(W.clone(),A)])]);if(A[W]!==void 0){if(yr(W)){if(u(W.value))return C(0);if(i(W.value,1))return w(q,A)}var G=new s("^","pow",[q.clone(),new s("-","subtract",[W,C(1)])]);return new s("*","multiply",[W.clone(),new s("*","multiply",[w(q,A),G])])}return new s("*","multiply",[new s("^","pow",[q.clone(),W.clone()]),new s("+","add",[new s("*","multiply",[w(q,A),new s("/","divide",[W.clone(),q.clone()])]),new s("*","multiply",[w(W,A),new o("log",[q.clone()])])])])}throw new Error('Cannot process operator "'+M.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function C(b,M){return new c(l(b,M||t.number))}return x});var sP="rationalize",NV=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],t0=F(sP,NV,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,parse:s,simplifyConstant:m,simplifyCore:d,simplify:h,fraction:x,bignumber:v,mathWithTransform:y,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:M,FunctionNode:A,IndexNode:S,ObjectNode:O,OperatorNode:_,SymbolNode:E,ParenthesisNode:T}=e;function R(L){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,z=W(),oe=q(L,k,!0,z.firstRules),pe=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(L=oe.expression,pe>=1){L=G(L);var le,Ee,me=!0,ge=!1;L=h(L,z.firstRules,{},ae);for(var Se;Ee=me?z.distrDivRules:z.sucDivRules,L=h(L,Ee,{},$),me=!me,Se=L.toString(),Se!==le;)ge=!0,le=Se;ge&&(L=h(L,z.firstRulesAgain,{},ae)),L=h(L,z.finalRules,{},ae)}var xe=[],be={};return L.type==="OperatorNode"&&L.isBinary()&&L.op==="/"?(pe===1&&(L.args[0]=H(L.args[0],xe),L.args[1]=H(L.args[1])),K&&(be.numerator=L.args[0],be.denominator=L.args[1])):(pe===1&&(L=H(L,xe)),K&&(be.numerator=L,be.denominator=null)),K?(be.coefficients=xe,be.variables=oe.variables,be.expression=L,be):L}return t(sP,{Node:R,"Node, boolean":(L,k)=>R(L,{},k),"Node, Object":R,"Node, Object, boolean":R});function q(L,k,K,z){var oe=[],pe=h(L,z,k,{exactFractions:!1});K=!!K;var ae="+-*"+(K?"/":"");le(pe);var $={};return $.expression=pe,$.variables=oe,$;function le(Ee){var me=Ee.type;if(me==="FunctionNode")throw new Error("There is an unsolved function call");if(me==="OperatorNode")if(Ee.op==="^"){if(Ee.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ee.args[1].value)))throw new Error("There is a non-integer exponent");le(Ee.args[0])}else{if(ae.indexOf(Ee.op)===-1)throw new Error("Operator "+Ee.op+" invalid in polynomial expression");for(var ge=0;ge1;if(z==="OperatorNode"&&L.isBinary()){var pe=!1,ae;if(L.op==="^"&&(L.args[0].type==="ParenthesisNode"||L.args[0].type==="OperatorNode")&&L.args[1].type==="ConstantNode"&&(ae=parseFloat(L.args[1].value),pe=ae>=2&&Ze(ae)),pe){if(ae>2){var $=L.args[0],le=new _("^","pow",[L.args[0].cloneDeep(),new M(ae-1)]);L=new _("*","multiply",[$,le])}else L=new _("*","multiply",[L.args[0],L.args[0].cloneDeep()]);oe&&(K==="content"?k.content=L:k.args[K]=L)}}if(z==="ParenthesisNode")G(L.content,L,"content");else if(z!=="ConstantNode"&&z!=="SymbolNode")for(var Ee=0;Ee=0;$--)if(k[$]!==0){var le=new M(pe?k[$]:Math.abs(k[$])),Ee=k[$]<0?"-":"+";if($>0){var me=new E(oe);if($>1){var ge=new M($);me=new _("^","pow",[me,ge])}k[$]===-1&&pe?le=new _("-","unaryMinus",[me]):Math.abs(k[$])===1?le=me:le=new _("*","multiply",[le,me])}pe?ae=le:Ee==="+"?ae=new _("+","add",[ae,le]):ae=new _("-","subtract",[ae,le]),pe=!1}if(pe)return new M(0);return ae;function Se(xe,be,De){var Ae=xe.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(xe.op)===-1)throw new Error("Operator "+xe.op+" invalid");if(be!==null){if((xe.fn==="unaryMinus"||xe.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+xe.op+" placing");if((xe.fn==="subtract"||xe.fn==="add"||xe.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+xe.op+" placing");if((xe.fn==="subtract"||xe.fn==="add"||xe.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+xe.op+" placing")}(xe.op==="^"||xe.op==="*")&&(De.fire=xe.op);for(var We=0;Wez&&(k[Je]=0),k[Je]+=De.cte*(De.oper==="+"?1:-1),z=Math.max(Je,z);return}De.cte=Je,De.fire===""&&(k[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var uP="zpk2tf",AV=["typed","add","multiply","Complex","number"],n0=F(uP,AV,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(uP,{"Array,Array,number":function(o,s,m){return u(o,s,m)},"Array,Array":function(o,s){return u(o,s,1)},"Matrix,Matrix,number":function(o,s,m){return u(o.valueOf(),s.valueOf(),m)},"Matrix,Matrix":function(o,s){return u(o.valueOf(),s.valueOf(),1)}});function u(c,o,s){c.some(C=>C.type==="BigNumber")&&(c=c.map(C=>i(C))),o.some(C=>C.type==="BigNumber")&&(o=o.map(C=>i(C)));for(var m=[a(1,0)],d=[a(1,0)],h=0;h=0&&m-d{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:u}=e;return r(fP,{"Array, Array":function(s,m){var d=c(512);return l(s,m,d)},"Array, Array, Array":function(s,m,d){return l(s,m,d)},"Array, Array, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d);return l(s,m,h)},"Matrix, Matrix":function(s,m){var d=c(512),{w:h,h:x}=l(s.valueOf(),m.valueOf(),d);return{w:u(h),h:u(x)}},"Matrix, Matrix, Matrix":function(s,m,d){var{h}=l(s.valueOf(),m.valueOf(),d.valueOf());return{h:u(h),w:u(d)}},"Matrix, Matrix, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d),{h:x}=l(s.valueOf(),m.valueOf(),h);return{h:u(x),w:u(h)}}});function l(o,s,m){for(var d=[],h=[],x=0;x{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var TV="replacer",FV=[],o0=F(TV,FV,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var cP="12.4.1";var s0=F("true",[],()=>!0),u0=F("false",[],()=>!1),f0=F("null",[],()=>null),c0=va("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),l0=va("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),m0=va("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Ic(t):HM}),p0=va("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?mE(t):$M}),d0=va("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?cE(t):GM}),h0=va("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?lE(t):VM}),v0=va("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),g0=va("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),x0=va("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),y0=va("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),b0=va("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),w0=va("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),D0=va("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),lP=F("PI",["pi"],e=>{var{pi:r}=e;return r}),mP=F("E",["e"],e=>{var{e:r}=e;return r}),S0=F("version",[],()=>cP);function va(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var N0=Er("speedOfLight","299792458","m s^-1"),A0=Er("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),M0=Er("planckConstant","6.62607015e-34","J s"),C0=Er("reducedPlanckConstant","1.0545718176461565e-34","J s"),E0=Er("magneticConstant","1.25663706212e-6","N A^-2"),T0=Er("electricConstant","8.8541878128e-12","F m^-1"),F0=Er("vacuumImpedance","376.730313667","ohm"),_0=Er("coulomb","8.987551792261171e9","N m^2 C^-2"),O0=Er("elementaryCharge","1.602176634e-19","C"),B0=Er("bohrMagneton","9.2740100783e-24","J T^-1"),P0=Er("conductanceQuantum","7.748091729863649e-5","S"),I0=Er("inverseConductanceQuantum","12906.403729652257","ohm"),R0=Er("magneticFluxQuantum","2.0678338484619295e-15","Wb"),k0=Er("nuclearMagneton","5.0507837461e-27","J T^-1"),q0=Er("klitzing","25812.807459304513","ohm");var L0=Er("bohrRadius","5.29177210903e-11","m"),z0=Er("classicalElectronRadius","2.8179403262e-15","m"),U0=Er("electronMass","9.1093837015e-31","kg"),W0=Er("fermiCoupling","1.1663787e-5","GeV^-2"),Y0=bx("fineStructure",.0072973525693),H0=Er("hartreeEnergy","4.3597447222071e-18","J"),$0=Er("protonMass","1.67262192369e-27","kg"),G0=Er("deuteronMass","3.3435830926e-27","kg"),V0=Er("neutronMass","1.6749271613e-27","kg"),Z0=Er("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Q0=Er("rydberg","10973731.568160","m^-1"),X0=Er("thomsonCrossSection","6.6524587321e-29","m^2"),J0=bx("weakMixingAngle",.2229),K0=bx("efimovFactor",22.7),j0=Er("atomicMass","1.66053906660e-27","kg"),ex=Er("avogadro","6.02214076e23","mol^-1"),rx=Er("boltzmann","1.380649e-23","J K^-1"),tx=Er("faraday","96485.33212331001","C mol^-1"),nx=Er("firstRadiation","3.7417718521927573e-16","W m^2"),ax=Er("loschmidt","2.686780111798444e25","m^-3"),ix=Er("gasConstant","8.31446261815324","J K^-1 mol^-1"),ox=Er("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),sx=Er("molarVolume","0.022413969545014137","m^3 mol^-1"),ux=bx("sackurTetrode",-1.16487052358),fx=Er("secondRadiation","0.014387768775039337","m K"),cx=Er("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),lx=Er("wienDisplacement","2.897771955e-3","m K"),mx=Er("molarMass","0.99999999965e-3","kg mol^-1"),px=Er("molarMassC12","11.9999999958e-3","kg mol^-1"),dx=Er("gravity","9.80665","m s^-2"),hx=Er("planckLength","1.616255e-35","m"),vx=Er("planckMass","2.176435e-8","kg"),gx=Er("planckTime","5.391245e-44","s"),xx=Er("planckCharge","1.87554603778e-18","C"),yx=Er("planckTemperature","1.416785e+32","K");function Er(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:u,BigNumber:l}=a,c=i.number==="BigNumber"?new l(r):parseFloat(r),o=new u(c,t);return o.fixPrefix=!0,o})}function bx(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var _V="apply",OV=["typed","isInteger"],wx=F(_V,OV,e=>{var{typed:r,isInteger:t}=e,n=qo({typed:r,isInteger:t});return r("apply",{"...any":function(i){var u=i[1];sr(u)?i[1]=u-1:rr(u)&&(i[1]=u.minus(1));try{return n.apply(null,i)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var BV="column",PV=["typed","Index","matrix","range"],Dx=F(BV,PV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Wu({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});function lf(e,r,t){var n=e.filter(function(c){return at(c)&&!(c.name in r)&&!t.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,u=new Eu(t,i,new Set([a])),l=e.compile();return function(o){return i.set(a,o),l.evaluate(u)}}var IV="filter",RV=["typed"],Sx=F(IV,RV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("filter",{"Array, function":pP,"Matrix, function":function(i,u){return i.create(pP(i.toArray(),u))},"Array, RegExp":Mu,"Matrix, RegExp":function(i,u){return i.create(Mu(i.toArray(),u))}});return t},{isTransformFunction:!0});function pP(e,r){return Om(e,function(t,n,a){return Ia(r,t,[n+1],a,"filter")})}var kV="forEach",qV=["typed"],Nx=F(kV,qV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,u){var l=function c(o,s){if(Array.isArray(o))Fo(o,function(m,d){c(m,s.concat(d+1))});else return Ia(u,o,s,i,"forEach")};l(i.valueOf(),[])}});return t},{isTransformFunction:!0});var LV="index",zV=["Index","getMatrixDataType"],Ax=F(LV,zV,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,u=arguments.length;i0?0:2;else if(l&&l.isSet===!0)l=l.map(function(o){return o-1});else if(Mr(l)||Qe(l))t(l)!=="boolean"&&(l=l.map(function(o){return o-1}));else if(sr(l))l--;else if(rr(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=l}var c=new r;return r.apply(c,a),c}},{isTransformFunction:!0});var UV="map",WV=["typed"],Mx=F(UV,WV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,u){return dP(i,u,i)},"Matrix, function":function(i,u){return i.create(dP(i.valueOf(),u,i))}});return t},{isTransformFunction:!0});function dP(e,r,t){function n(a,i){return Array.isArray(a)?Xn(a,function(u,l){return n(u,i.concat(l+1))}):Ia(r,a,i,t,"map")}return n(e,[])}function Cn(e){if(e.length===2&&Nt(e[0])){e=e.slice();var r=e[1];sr(r)?e[1]=r-1:rr(r)&&(e[1]=r.minus(1))}return e}var YV="max",HV=["typed","config","numeric","larger"],Cx=F(YV,HV,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=ef({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var $V="mean",GV=["typed","add","divide"],Ex=F($V,GV,e=>{var{typed:r,add:t,divide:n}=e,a=of({typed:r,add:t,divide:n});return r("mean",{"...any":function(u){u=Cn(u);try{return a.apply(null,u)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var VV="min",ZV=["typed","config","numeric","smaller"],Tx=F(VV,ZV,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=rf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var QV="range",XV=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Fx=F(QV,XV,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s}=e,m=$u({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s});return r("range",{"...any":function(h){var x=h.length-1,v=h[x];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var JV="row",KV=["typed","Index","matrix","range"],_x=F(JV,KV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Gu({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});var jV="subset",eZ=["typed","matrix","zeros","add"],Ox=F(jV,eZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Vu({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(l){try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var rZ="concat",tZ=["typed","matrix","isInteger"],Bx=F(rZ,tZ,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Uu({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(u){var l=u.length-1,c=u[l];sr(c)?u[l]=c-1:rr(c)&&(u[l]=c.minus(1));try{return a.apply(null,u)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var hP="diff",nZ=["typed","matrix","subtract","number","bignumber"],Px=F(hP,nZ,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,u=Yu({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(hP,{"...any":function(c){c=Cn(c);try{return u.apply(null,c)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var aZ="std",iZ=["typed","map","sqrt","variance"],Ix=F(aZ,iZ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=ff({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var vP="sum",oZ=["typed","config","add","numeric"],Rx=F(vP,oZ,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=nf({typed:r,config:t,add:n,numeric:a});return r(vP,{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var sZ="quantileSeq",uZ=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],kx=F(sZ,uZ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=uf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,y,w)=>h(v,y,x(w)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,y,w,C)=>h(v,y,w,x(C)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,y,w)=>h(v,y,x(w)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,y,w,C)=>h(v,y,w,x(C))});function x(v){return Cn([[],v])[1]}},{isTransformFunction:!0});var gP="cumsum",fZ=["typed","add","unaryPlus"],qx=F(gP,fZ,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=af({typed:r,add:t,unaryPlus:n});return r(gP,{"...any":function(u){if(u.length===2&&Nt(u[0])){var l=u[1];sr(l)?u[1]=l-1:rr(l)&&(u[1]=l.minus(1))}try{return a.apply(null,u)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var xP="variance",cZ=["typed","add","subtract","multiply","divide","apply","isNaN"],Lx=F(xP,cZ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e,c=sf({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l});return r(xP,{"...any":function(s){s=Cn(s);try{return c.apply(null,s)}catch(m){throw mt(m)}}})},{isTransformFunction:!0});var yP="print",lZ=["typed","matrix","zeros","add"],zx=F(yP,lZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Qu({typed:r,matrix:t,zeros:n,add:a});return r(yP,{"string, Object | Array":function(c,o){return i(u(c),o)},"string, Object | Array, number | Object":function(c,o,s){return i(u(c),o,s)}});function u(l){return l.replace(qd,c=>{var o=c.slice(1).split("."),s=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+s.join(".")})}},{isTransformFunction:!0});var mZ="and",pZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Ux=F(mZ,pZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=ju({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)&&!l(d,!0))return!1;var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var dZ="or",hZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Wx=F(dZ,hZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=zu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)&&u(m,!1))return!0;var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var vZ="bitAnd",gZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Yx=F(vZ,gZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=qu({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var xZ="bitOr",yZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Hx=F(xZ,yZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=Lu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Ge=Hm({config:Oe}),pt=$m({}),ID=d0({BigNumber:Ge,config:Oe}),bP=u0({}),wP=Y0({BigNumber:Ge,config:Oe}),Uo=Gm({}),RD=D0({Complex:pt}),DP=c0({BigNumber:Ge,config:Oe}),SP=g0({BigNumber:Ge,config:Oe}),NP=y0({BigNumber:Ge,config:Oe}),Lc=Zm({}),AP=l0({BigNumber:Ge,config:Oe}),MP=f0({}),CP=h0({BigNumber:Ge,config:Oe}),EP=Vm({}),kD=Rm({}),TP=b0({BigNumber:Ge,config:Oe}),FP=ux({BigNumber:Ge,config:Oe}),qD=p0({BigNumber:Ge,config:Oe}),_P=s0({}),OP=S0({}),_r=Xm({Matrix:Lc}),BP=K0({BigNumber:Ge,config:Oe}),PP=v0({BigNumber:Ge,config:Oe}),$x=m0({BigNumber:Ge,config:Oe}),IP=o0({}),RP=w0({BigNumber:Ge,config:Oe}),te=Im({BigNumber:Ge,Complex:pt,DenseMatrix:_r,Fraction:Uo}),Gx=Np({BigNumber:Ge,config:Oe,typed:te}),kP=J0({BigNumber:Ge,config:Oe}),En=Ap({typed:te}),qP=Oh({Complex:pt,config:Oe,typed:te}),LP=Ph({BigNumber:Ge,typed:te}),zP=Rh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),Qt=Cp({typed:te}),UP=jp({typed:te}),WP=Lh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),YP=Uh({typed:te}),LD=Wh({typed:te}),HP=Hh({Complex:pt,config:Oe,typed:te}),ea=hp({BigNumber:Ge,typed:te}),$P=Jp({typed:te}),GP=dp({typed:te}),VP=Jm({typed:te}),zc=Bg({typed:te}),Uc=vp({Complex:pt,typed:te}),Wo=ed({typed:te}),Vx=$h({typed:te}),ZP=Vh({BigNumber:Ge,typed:te}),QP=Qh({BigNumber:Ge,typed:te}),XP=_p({typed:te}),Ir=cp({config:Oe,typed:te}),JP=Fd({typed:te}),zD=Op({typed:te}),KP=Bp({Complex:pt,typed:te}),jP=ud({typed:te}),eI=cd({typed:te}),mf=Pd({typed:te}),Zx=ld({typed:te}),rI=kd({format:mf,typed:te}),Qx=rd({typed:te}),Ln=ep({typed:te}),no=tp({typed:te}),Yo=ip({typed:te}),qa=op({typed:te}),tI=x0({BigNumber:Ge,config:Oe}),nI=Rg({Complex:pt,typed:te}),aI=kp({Complex:pt,config:Oe,typed:te}),UD=qp({Complex:pt,config:Oe,typed:te}),Ho=dd({typed:te}),Ot=Lp({typed:te}),Wc=nd({typed:te}),Oi=mp({typed:te}),iI=Rd({format:mf,typed:te}),oI=Wg({config:Oe,typed:te}),sI=Qu({typed:te}),uI=Yg({config:Oe,typed:te}),Xx=td({typed:te}),fI=Jh({BigNumber:Ge,typed:te}),WD=Wp({BigNumber:Ge,Fraction:Uo,complex:Uc,typed:te}),Yc=jh({typed:te}),Bi=lp({Matrix:Lc,equalScalar:Ir,typed:te}),cI=Dp({typed:te}),lI=Hp({typed:te}),mI=pp({typed:te}),ga=Ep({typed:te}),pI=rv({typed:te}),YD=up({typed:te}),dI=Bh({Complex:pt,config:Oe,typed:te}),hI=kh({BigNumber:Ge,typed:te}),Jx=qo({isInteger:Ln,typed:te}),vI=qh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),gI=Id({format:mf,typed:te}),xI=Pg({typed:te}),yI=Gh({typed:te}),bI=Xh({BigNumber:Ge,typed:te}),pf=sp({typed:te}),wI=zd({typed:te}),DI=Hg({config:Oe,typed:te}),SI=Kh({BigNumber:Ge,typed:te}),NI=ev({typed:te}),AI=Fh({SparseMatrix:Bi,typed:te}),La=Yp({Complex:pt,config:Oe,typed:te}),MI=tv({typed:te}),fi=Sp({typed:te}),CI=Ih({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),EI=Zh({BigNumber:Ge,typed:te}),Bs=gp({Fraction:Uo,typed:te}),$o=np({typed:te}),$e=xp({DenseMatrix:_r,Matrix:Lc,SparseMatrix:Bi,typed:te}),TI=yp({isZero:qa,matrix:$e,typed:te}),FI=Od({isNaN:pf,isNumeric:$o,typed:te}),za=Ud({bignumber:ea,fraction:Bs,number:Oi}),HD=Bd({config:Oe,multiplyScalar:Ot,numeric:za,typed:te}),$D=xd({isInteger:Ln,matrix:$e,typed:te}),cn=Dd({matrix:$e,config:Oe,typed:te}),_I=Sd({matrix:$e,typed:te}),df=Nd({matrix:$e,typed:te}),GD=Gp({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ln=Md({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),OI=zh({Complex:pt,config:Oe,typed:te}),VD=Tp({BigNumber:Ge,Complex:pt,Fraction:Uo,config:Oe,isNegative:no,matrix:$e,typed:te,unaryMinus:fi}),Gr=Uu({isInteger:Ln,matrix:$e,typed:te}),BI=id({prod:HD,size:cn,typed:te}),Kx=Ad({conj:Wo,transpose:df,typed:te}),ZD=sd({DenseMatrix:_r,SparseMatrix:Bi,matrix:$e,typed:te}),Mt=Wd({numeric:za,typed:te}),hf=Qd({DenseMatrix:_r,concat:Gr,divideScalar:Mt,equalScalar:Ir,matrix:$e,typed:te}),xa=uh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),vf=fd({matrix:$e,typed:te}),PI=ap({isNumeric:$o,typed:te}),ao=md({BigNumber:Ge,DenseMatrix:_r,SparseMatrix:Bi,config:Oe,matrix:$e,typed:te}),II=pd({matrix:$e,multiplyScalar:Ot,typed:te}),Hc=gh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),RI=eh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),QD=Xd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),jx=wp({flatten:vf,matrix:$e,size:cn,typed:te}),kI=Up({BigNumber:Ge,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),qI=hd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ey=sg({addScalar:Qt,complex:Uc,conj:Wo,divideScalar:Mt,equal:xa,identity:ao,isZero:qa,matrix:$e,multiplyScalar:Ot,sign:WD,sqrt:La,subtractScalar:ga,typed:te,unaryMinus:fi,zeros:ln}),LI=yd({config:Oe,matrix:$e}),zI=rh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Ps=Hd({BigNumber:Ge,DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Tn=lh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),Bt=$p({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,subtractScalar:ga,typed:te,unaryMinus:fi}),UI=Ld({concat:Gr,matrix:$e,typed:te}),WI=bh({DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),ry=Jd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),YI=ad({DenseMatrix:_r,concat:Gr,matrix:$e,typed:te}),Lr=pv({DenseMatrix:_r,SparseMatrix:Bi,addScalar:Qt,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),HI=Yh({BigNumber:Ge,DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),$I=qu({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),GI=Lu({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),VI=Kp({DenseMatrix:_r,concat:Gr,matrix:$e,typed:te}),ZI=Vg({addScalar:Qt,combinations:zc,divideScalar:Mt,isInteger:Ln,isNegative:no,multiplyScalar:Ot,typed:te}),Go=ah({BigNumber:Ge,DenseMatrix:_r,Fraction:Uo,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),XD=oh({concat:Gr,matrix:$e,typed:te}),QI=af({add:Lr,typed:te,unaryPlus:Gx}),ty=xh({equal:xa,typed:te}),XI=Yu({matrix:$e,number:Oi,subtract:Bt,typed:te}),JI=Cg({abs:En,addScalar:Qt,deepEqual:ty,divideScalar:Mt,multiplyScalar:Ot,sqrt:La,subtractScalar:ga,typed:te}),$c=vv({addScalar:Qt,conj:Wo,multiplyScalar:Ot,size:cn,typed:te}),KI=fh({compareText:XD,isZero:qa,typed:te}),JD=Pu({DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),jI=Ip({BigNumber:Ge,DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),e4=dv({abs:En,addScalar:Qt,divideScalar:Mt,isPositive:Yo,multiplyScalar:Ot,smaller:Tn,sqrt:La,typed:te}),KD=Sh({DenseMatrix:_r,smaller:Tn}),yn=Nh({ImmutableDenseMatrix:KD,getMatrixDataType:Zx}),Fn=hh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),ny=$d({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),r4=Kd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),t4=bp({flatten:vf,matrix:$e,size:cn,typed:te}),n4=rf({config:Oe,numeric:za,smaller:Tn,typed:te}),jD=Iu({DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),it=zp({addScalar:Qt,dot:$c,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),a4=Vd({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),i4=zu({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),Gc=wh({compare:Go,isNaN:pf,isNumeric:$o,typed:te}),o4=th({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),eS=cg({SparseMatrix:Bi,abs:En,add:Lr,divideScalar:Mt,larger:Fn,largerEq:Hc,multiply:it,subtract:Bt,transpose:df,typed:te}),ra=Vu({add:Lr,matrix:$e,typed:te,zeros:ln}),ay=nf({add:Lr,config:Oe,numeric:za,typed:te}),s4=gv({add:Lr,matrix:$e,typed:te}),rS=jd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),u4=n0({Complex:pt,add:Lr,multiply:it,number:Oi,typed:te}),iy=Fp({DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),ci=ih({compare:Go,typed:te}),f4=Zg({addScalar:Qt,combinations:zc,isInteger:Ln,isNegative:no,isPositive:Yo,larger:Fn,typed:te}),c4=od({matrix:$e,multiply:it,subtract:Bt,typed:te}),tS=gg({divideScalar:Mt,isZero:qa,matrix:$e,multiply:it,subtractScalar:ga,typed:te,unaryMinus:fi}),l4=Qp({concat:Gr,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),nS=Ah({larger:Fn,smaller:Tn}),aS=Pp({Complex:pt,DenseMatrix:_r,ceil:iy,equalScalar:Ir,floor:JD,matrix:$e,typed:te,zeros:ln}),iS=xv({Index:yn,typed:te}),m4=Eg({abs:En,add:Lr,addScalar:Qt,config:Oe,divideScalar:Mt,equalScalar:Ir,flatten:vf,isNumeric:$o,isZero:qa,matrix:$e,multiply:it,multiplyScalar:Ot,smaller:Tn,subtract:Bt,typed:te}),p4=Vp({BigNumber:Ge,add:Lr,config:Oe,equal:xa,isInteger:Ln,mod:jD,smaller:Tn,typed:te,xgcd:GD}),d4=Rp({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),h4=Gd({Complex:pt,config:Oe,divideScalar:Mt,log:ny,typed:te}),oy=ef({config:Oe,larger:Fn,numeric:za,typed:te}),v4=nv({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),g4=iv({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),x4=sv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),y4=fv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),Is=ph({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),b4=Dh({compare:Go,compareNatural:ci,matrix:$e,typed:te}),w4=ju({concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),Rs=$u({bignumber:ea,matrix:$e,add:Lr,config:Oe,isPositive:Yo,larger:Fn,largerEq:Hc,smaller:Tn,smallerEq:Is,typed:te}),D4=Gu({Index:yn,matrix:$e,range:Rs,typed:te}),oS=av({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),S4=uv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),sS=lv({Index:yn,concat:Gr,setDifference:oS,size:cn,subset:ra,typed:te}),uS=Mh({FibonacciHeap:nS,addScalar:Qt,equalScalar:Ir}),fS=Wu({Index:yn,matrix:$e,range:Rs,typed:te}),Vo=xg({abs:En,addScalar:Qt,det:tS,divideScalar:Mt,identity:ao,matrix:$e,multiply:it,typed:te,unaryMinus:fi}),cS=og({DenseMatrix:_r,Spa:uS,SparseMatrix:Bi,abs:En,addScalar:Qt,divideScalar:Mt,equalScalar:Ir,larger:Fn,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te,unaryMinus:fi}),N4=yg({Complex:pt,add:Lr,ctranspose:Kx,deepEqual:ty,divideScalar:Mt,dot:$c,dotDivide:hf,equal:xa,inv:Vo,matrix:$e,multiply:it,typed:te}),ya=Yd({Complex:pt,config:Oe,fraction:Bs,identity:ao,inv:Vo,matrix:$e,multiply:it,number:Oi,typed:te}),lS=ov({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),A4=mv({Index:yn,concat:Gr,setIntersect:lS,setSymDifference:sS,size:cn,subset:ra,typed:te}),M4=Dg({abs:En,add:Lr,identity:ao,inv:Vo,map:Ho,max:oy,multiply:it,size:cn,sqrt:La,subtract:Bt,typed:te}),wr=Eh({BigNumber:Ge,Complex:pt,Fraction:Uo,abs:En,addScalar:Qt,config:Oe,divideScalar:Mt,equal:xa,fix:aS,format:mf,isNumeric:$o,multiplyScalar:Ot,number:Oi,pow:ya,round:Ps,subtractScalar:ga}),C4=F0({BigNumber:Ge,Unit:wr,config:Oe}),E4=lx({BigNumber:Ge,Unit:wr,config:Oe}),T4=j0({BigNumber:Ge,Unit:wr,config:Oe}),F4=B0({BigNumber:Ge,Unit:wr,config:Oe}),_4=rx({BigNumber:Ge,Unit:wr,config:Oe}),O4=P0({BigNumber:Ge,Unit:wr,config:Oe}),B4=_0({BigNumber:Ge,Unit:wr,config:Oe}),P4=G0({BigNumber:Ge,Unit:wr,config:Oe}),I4=Zd({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,pow:ya,typed:te}),R4=T0({BigNumber:Ge,Unit:wr,config:Oe}),k4=O0({BigNumber:Ge,Unit:wr,config:Oe}),q4=wg({abs:En,add:Lr,identity:ao,inv:Vo,multiply:it,typed:te}),L4=tx({BigNumber:Ge,Unit:wr,config:Oe}),mS=Cd({addScalar:Qt,ceil:iy,conj:Wo,divideScalar:Mt,dotDivide:hf,exp:zD,i:RD,log2:UD,matrix:$e,multiplyScalar:Ot,pow:ya,tau:qD,typed:te}),sy=Ig({BigNumber:Ge,Complex:pt,config:Oe,multiplyScalar:Ot,pow:ya,typed:te}),z4=A0({BigNumber:Ge,Unit:wr,config:Oe}),U4=H0({BigNumber:Ge,Unit:wr,config:Oe}),W4=Ed({conj:Wo,dotDivide:hf,fft:mS,typed:te}),Y4=q0({BigNumber:Ge,Unit:wr,config:Oe}),H4=ax({BigNumber:Ge,Unit:wr,config:Oe}),$4=E0({BigNumber:Ge,Unit:wr,config:Oe}),G4=mx({BigNumber:Ge,Unit:wr,config:Oe}),V4=ox({BigNumber:Ge,Unit:wr,config:Oe}),Z4=V0({BigNumber:Ge,Unit:wr,config:Oe}),Q4=k0({BigNumber:Ge,Unit:wr,config:Oe}),X4=xx({BigNumber:Ge,Unit:wr,config:Oe}),J4=hx({BigNumber:Ge,Unit:wr,config:Oe}),K4=yx({BigNumber:Ge,Unit:wr,config:Oe}),j4=$0({BigNumber:Ge,Unit:wr,config:Oe}),eR=Z0({BigNumber:Ge,Unit:wr,config:Oe}),rR=C0({BigNumber:Ge,Unit:wr,config:Oe}),tR=Q0({BigNumber:Ge,Unit:wr,config:Oe}),nR=fx({BigNumber:Ge,Unit:wr,config:Oe}),aR=N0({BigNumber:Ge,Unit:wr,config:Oe}),iR=cx({BigNumber:Ge,Unit:wr,config:Oe}),oR=X0({BigNumber:Ge,Unit:wr,config:Oe}),sR=ex({BigNumber:Ge,Unit:wr,config:Oe}),uR=L0({BigNumber:Ge,Unit:wr,config:Oe}),fR=_h({Unit:wr,typed:te}),an=Mg({divideScalar:Mt,equalScalar:Ir,inv:Vo,matrix:$e,multiply:it,typed:te}),cR=U0({BigNumber:Ge,Unit:wr,config:Oe}),gf=kg({gamma:sy,typed:te}),lR=nx({BigNumber:Ge,Unit:wr,config:Oe}),mR=dx({BigNumber:Ge,Unit:wr,config:Oe}),pR=I0({BigNumber:Ge,Unit:wr,config:Oe}),pS=lg({DenseMatrix:_r,lsolve:QD,lup:cS,matrix:$e,slu:eS,typed:te,usolve:ry}),dR=R0({BigNumber:Ge,Unit:wr,config:Oe}),hR=px({BigNumber:Ge,Unit:wr,config:Oe}),vR=Lg({add:Lr,divide:an,factorial:gf,isInteger:Ln,isPositive:Yo,multiply:it,typed:te}),gR=zg({factorial:gf,typed:te}),xR=vx({BigNumber:Ge,Unit:wr,config:Oe}),yR=mg({add:Lr,cbrt:VD,divide:an,equalScalar:Ir,im:Qx,isZero:qa,multiply:it,re:Xx,sqrt:La,subtract:Bt,typeOf:YD,typed:te,unaryMinus:fi}),bR=cv({compareNatural:ci,typed:te}),wR=Td({abs:En,add:Lr,bignumber:ea,divide:an,isNegative:no,isPositive:Yo,larger:Fn,map:Ho,matrix:$e,max:oy,multiply:it,smaller:Tn,subtract:Bt,typed:te,unaryMinus:fi}),dS=$g({bignumber:ea,addScalar:Qt,combinations:zc,divideScalar:Mt,factorial:gf,isInteger:Ln,isNegative:no,larger:Fn,multiplyScalar:Ot,number:Oi,pow:ya,subtractScalar:ga,typed:te}),DR=Th({Unit:wr,typed:te}),SR=Gg({addScalar:Qt,isInteger:Ln,isNegative:no,stirlingS2:dS,typed:te}),hS=bg({abs:En,add:Lr,addScalar:Qt,atan:LD,bignumber:ea,column:fS,complex:Uc,config:Oe,cos:Vx,diag:ZD,divideScalar:Mt,dot:$c,equal:xa,flatten:vf,im:Qx,inv:Vo,larger:Fn,matrix:$e,matrixFromColumns:jx,multiply:it,multiplyScalar:Ot,number:Oi,qr:ey,re:Xx,reshape:$D,sin:Yc,size:cn,smaller:Tn,sqrt:La,subtract:Bt,typed:te,usolve:ry,usolveAll:rS}),NR=W0({BigNumber:Ge,Unit:wr,config:Oe}),AR=ix({BigNumber:Ge,Unit:wr,config:Oe}),MR=qg({divide:an,dotDivide:hf,isNumeric:$o,log:ny,map:Ho,matrix:$e,multiply:it,sum:ay,typed:te}),vS=of({add:Lr,divide:an,typed:te}),CR=sx({BigNumber:Ge,Unit:wr,config:Oe}),ER=M0({BigNumber:Ge,Unit:wr,config:Oe}),TR=uf({bignumber:ea,add:Lr,compare:Go,divide:an,isInteger:Ln,larger:Fn,multiply:it,partitionSelect:Gc,smaller:Tn,smallerEq:Is,subtract:Bt,typed:te}),uy=sf({add:Lr,apply:Jx,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),FR=z0({BigNumber:Ge,Unit:wr,config:Oe}),gS=Fg({add:Lr,compare:Go,divide:an,partitionSelect:Gc,typed:te}),_R=Og({add:Lr,divide:an,matrix:$e,mean:vS,multiply:it,pow:ya,sqrt:La,subtract:Bt,sum:ay,typed:te}),OR=a0({Complex:pt,add:Lr,divide:an,matrix:$e,multiply:it,typed:te}),BR=_g({abs:En,map:Ho,median:gS,subtract:Bt,typed:te}),PR=ff({map:Ho,sqrt:La,typed:te,variance:uy}),IR=_d({BigNumber:Ge,Complex:pt,add:Lr,config:Oe,divide:an,equal:xa,factorial:gf,gamma:sy,isNegative:no,multiply:it,pi:$x,pow:ya,sin:Yc,smallerEq:Is,subtract:Bt,typed:te}),fy=hv({abs:En,add:Lr,conj:Wo,ctranspose:Kx,eigs:hS,equalScalar:Ir,larger:Fn,matrix:$e,multiply:it,pow:ya,smaller:Tn,sqrt:La,typed:te}),xS=wd({BigNumber:Ge,DenseMatrix:_r,SparseMatrix:Bi,addScalar:Qt,config:Oe,cos:Vx,matrix:$e,multiplyScalar:Ot,norm:fy,sin:Yc,typed:te,unaryMinus:fi}),RR=gx({BigNumber:Ge,Unit:wr,config:Oe}),yS=Ng({identity:ao,matrix:$e,multiply:it,norm:fy,qr:ey,subtract:Bt,typed:te}),kR=bd({multiply:it,rotationMatrix:xS,typed:te}),bS=Sg({abs:En,add:Lr,concat:Gr,identity:ao,index:iS,lusolve:pS,matrix:$e,matrixFromColumns:jx,multiply:it,range:Rs,schur:yS,subset:ra,subtract:Bt,transpose:df,typed:te}),qR=Ag({matrix:$e,multiply:it,sylvester:bS,transpose:df,typed:te});var xf={},yf={},LR={},_n=bv({mathWithTransform:yf}),bf=Yv({Node:_n}),io=$v({Node:_n}),ks=Vv({Node:_n}),zR=Jv({Node:_n}),wf=Av({Node:_n}),UR=_v({Node:_n,ResultSet:kD}),WR=Bv({Node:_n}),Zo=kv({Node:_n}),YR=Qv({Node:_n}),bZ=i0({classes:LR}),wS=dg({math:xf,typed:te}),HR=Lv({Node:_n,typed:te}),wZ=vg({Chain:wS,typed:te}),Df=Uv({Node:_n,size:cn}),Sf=Sv({Node:_n,subset:ra}),$R=Tv({matrix:$e,Node:_n,subset:ra}),Qo=Kv({Unit:wr,Node:_n,math:xf}),Xo=eg({Node:_n,SymbolNode:Qo,math:xf}),Ua=rg({AccessorNode:Sf,ArrayNode:wf,AssignmentNode:$R,BlockNode:UR,ConditionalNode:WR,ConstantNode:Zo,FunctionAssignmentNode:HR,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,RangeNode:YR,RelationalNode:zR,SymbolNode:Qo,config:Oe,numeric:za,typed:te}),GR=jg({ConstantNode:Zo,FunctionNode:Xo,OperatorNode:io,ParenthesisNode:ks,parse:Ua,typed:te}),DS=Jg({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,SymbolNode:Qo,config:Oe,mathWithTransform:yf,matrix:$e,typed:te}),DZ=tg({parse:Ua,typed:te}),SS=Kg({AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,divide:an,equal:xa,isZero:qa,multiply:it,parse:Ua,pow:ya,subtract:Bt,typed:te}),NS=ng({parse:Ua,typed:te}),VR=pg({evaluate:NS}),ZR=ag({evaluate:NS}),cy=Xg({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,config:Oe,divide:an,equal:xa,isZero:qa,mathWithTransform:yf,matrix:$e,multiply:it,parse:Ua,pow:ya,resolve:GR,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),SZ=e0({OperatorNode:io,parse:Ua,simplify:cy,typed:te}),NZ=Qg({parse:Ua,typed:te}),AZ=ig({Parser:ZR,typed:te}),MZ=t0({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,config:Oe,divide:an,equal:xa,isZero:qa,mathWithTransform:yf,matrix:$e,multiply:it,parse:Ua,pow:ya,simplify:cy,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),CZ=r0({ConstantNode:Zo,FunctionNode:Xo,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,config:Oe,equal:xa,isZero:qa,numeric:za,parse:Ua,simplify:cy,typed:te}),EZ=hg({Help:VR,mathWithTransform:yf,typed:te});ht(xf,{e:ID,false:bP,fineStructure:wP,i:RD,Infinity:DP,LN10:SP,LOG10E:NP,NaN:AP,null:MP,phi:CP,SQRT1_2:TP,sackurTetrode:FP,tau:qD,true:_P,E:ID,version:OP,efimovFactor:BP,LN2:PP,pi:$x,replacer:IP,reviver:bZ,SQRT2:RP,typed:te,unaryPlus:Gx,PI:$x,weakMixingAngle:kP,abs:En,acos:qP,acot:LP,acsc:zP,addScalar:Qt,arg:UP,asech:WP,asinh:YP,atan:LD,atanh:HP,bignumber:ea,bitNot:$P,boolean:GP,clone:VP,combinations:zc,complex:Uc,conj:Wo,cos:Vx,cot:ZP,csc:QP,cube:XP,equalScalar:Ir,erf:JP,exp:zD,expm1:KP,filter:jP,forEach:eI,format:mf,getMatrixDataType:Zx,hex:rI,im:Qx,isInteger:Ln,isNegative:no,isPositive:Yo,isZero:qa,LOG2E:tI,lgamma:nI,log10:aI,log2:UD,map:Ho,multiplyScalar:Ot,not:Wc,number:Oi,oct:iI,pickRandom:oI,print:sI,random:uI,re:Xx,sec:fI,sign:WD,sin:Yc,splitUnit:cI,square:lI,string:mI,subtractScalar:ga,tan:pI,typeOf:YD,acosh:dI,acsch:hI,apply:Jx,asec:vI,bin:gI,chain:wZ,combinationsWithRep:xI,cosh:yI,csch:bI,isNaN:pf,isPrime:wI,randomInt:DI,sech:SI,sinh:NI,sparse:AI,sqrt:La,tanh:MI,unaryMinus:fi,acoth:CI,coth:EI,fraction:Bs,isNumeric:$o,matrix:$e,matrixFromFunction:TI,mode:FI,numeric:za,prod:HD,reshape:$D,size:cn,squeeze:_I,transpose:df,xgcd:GD,zeros:ln,asin:OI,cbrt:VD,concat:Gr,count:BI,ctranspose:Kx,diag:ZD,divideScalar:Mt,dotDivide:hf,equal:xa,flatten:vf,hasNumericValue:PI,identity:ao,kron:II,largerEq:Hc,leftShift:RI,lsolve:QD,matrixFromColumns:jx,nthRoot:kI,ones:qI,qr:ey,resize:LI,rightArithShift:zI,round:Ps,smaller:Tn,subtract:Bt,to:UI,unequal:WI,usolve:ry,xor:YI,add:Lr,atan2:HI,bitAnd:$I,bitOr:GI,bitXor:VI,catalan:ZI,compare:Go,compareText:XD,cumsum:QI,deepEqual:ty,diff:XI,distance:JI,dot:$c,equalText:KI,floor:JD,gcd:jI,hypot:e4,larger:Fn,log:ny,lsolveAll:r4,matrixFromRows:t4,min:n4,mod:jD,multiply:it,nthRoots:a4,or:i4,partitionSelect:Gc,rightLogShift:o4,slu:eS,subset:ra,sum:ay,trace:s4,usolveAll:rS,zpk2tf:u4,ceil:iy,compareNatural:ci,composition:f4,cross:c4,det:tS,dotMultiply:l4,fix:aS,index:iS,intersect:m4,invmod:p4,lcm:d4,log1p:h4,max:oy,setCartesian:v4,setDistinct:g4,setIsSubset:x4,setPowerset:y4,smallerEq:Is,sort:b4,and:w4,range:Rs,row:D4,setDifference:oS,setMultiplicity:S4,setSymDifference:sS,column:fS,inv:Vo,lup:cS,pinv:N4,pow:ya,setIntersect:lS,setUnion:A4,sqrtm:M4,vacuumImpedance:C4,wienDisplacement:E4,atomicMass:T4,bohrMagneton:F4,boltzmann:_4,conductanceQuantum:O4,coulomb:B4,deuteronMass:P4,dotPow:I4,electricConstant:R4,elementaryCharge:k4,expm:q4,faraday:L4,fft:mS,gamma:sy,gravitationConstant:z4,hartreeEnergy:U4,ifft:W4,klitzing:Y4,loschmidt:H4,magneticConstant:$4,molarMass:G4,molarPlanckConstant:V4,neutronMass:Z4,nuclearMagneton:Q4,planckCharge:X4,planckLength:J4,planckTemperature:K4,protonMass:j4,quantumOfCirculation:eR,reducedPlanckConstant:rR,rydberg:tR,secondRadiation:nR,speedOfLight:aR,stefanBoltzmann:iR,thomsonCrossSection:oR,avogadro:sR,bohrRadius:uR,createUnit:fR,divide:an,electronMass:cR,factorial:gf,firstRadiation:lR,gravity:mR,inverseConductanceQuantum:pR,lusolve:pS,magneticFluxQuantum:dR,molarMassC12:hR,multinomial:vR,parse:Ua,permutations:gR,planckMass:xR,polynomialRoot:yR,resolve:GR,setSize:bR,simplifyConstant:DS,solveODE:wR,stirlingS2:dS,unit:DR,bellNumbers:SR,compile:DZ,eigs:hS,fermiCoupling:NR,gasConstant:AR,kldivergence:MR,mean:vS,molarVolume:CR,planckConstant:ER,quantileSeq:TR,simplifyCore:SS,variance:uy,classicalElectronRadius:FR,evaluate:NS,median:gS,simplify:cy,symbolicEqual:SZ,corr:_R,freqz:OR,leafCount:NZ,mad:BR,parser:AZ,rationalize:MZ,std:PR,zeta:IR,derivative:CZ,norm:fy,rotationMatrix:xS,help:EZ,planckTime:RR,schur:yS,rotate:kR,sylvester:bS,lyap:qR,config:Oe});ht(yf,xf,{filter:Sx({typed:te}),forEach:Nx({typed:te}),map:Mx({typed:te}),apply:wx({isInteger:Ln,typed:te}),or:Wx({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),and:Ux({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),concat:Bx({isInteger:Ln,matrix:$e,typed:te}),max:Cx({config:Oe,larger:Fn,numeric:za,typed:te}),print:zx({add:Lr,matrix:$e,typed:te,zeros:ln}),bitAnd:Yx({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),diff:Px({bignumber:ea,matrix:$e,number:Oi,subtract:Bt,typed:te}),min:Tx({config:Oe,numeric:za,smaller:Tn,typed:te}),subset:Ox({add:Lr,matrix:$e,typed:te,zeros:ln}),bitOr:Hx({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),cumsum:qx({add:Lr,typed:te,unaryPlus:Gx}),index:Ax({Index:yn,getMatrixDataType:Zx}),sum:Rx({add:Lr,config:Oe,numeric:za,typed:te}),range:Fx({bignumber:ea,matrix:$e,add:Lr,config:Oe,isPositive:Yo,larger:Fn,largerEq:Hc,smaller:Tn,smallerEq:Is,typed:te}),row:_x({Index:yn,matrix:$e,range:Rs,typed:te}),column:Dx({Index:yn,matrix:$e,range:Rs,typed:te}),mean:Ex({add:Lr,divide:an,typed:te}),quantileSeq:kx({add:Lr,bignumber:ea,compare:Go,divide:an,isInteger:Ln,larger:Fn,multiply:it,partitionSelect:Gc,smaller:Tn,smallerEq:Is,subtract:Bt,typed:te}),variance:Lx({add:Lr,apply:Jx,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),std:Ix({map:Ho,sqrt:La,typed:te,variance:uy})});ht(LR,{BigNumber:Ge,Complex:pt,Fraction:Uo,Matrix:Lc,Node:_n,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,Range:EP,RelationalNode:zR,ResultSet:kD,ArrayNode:wf,BlockNode:UR,ConditionalNode:WR,ConstantNode:Zo,DenseMatrix:_r,RangeNode:YR,Chain:wS,FunctionAssignmentNode:HR,SparseMatrix:Bi,IndexNode:Df,ImmutableDenseMatrix:KD,Index:yn,AccessorNode:Sf,AssignmentNode:$R,FibonacciHeap:nS,Spa:uS,Unit:wr,SymbolNode:Qo,FunctionNode:Xo,Help:VR,Parser:ZR});wS.createProxy(xf);var AS=PD;var jR=ca(Am(),1);var XR=ca(QR(),1);function JR(e){var r=new XR.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function KR(e,r,t,n){function a(y,w){var C=arguments.length;if(C!==1&&C!==2)throw new ha("import",C,1,2);w||(w={});function b(O,_,E){if(Array.isArray(_))_.forEach(q=>b(O,q));else if(typeof _=="object")for(var T in _)Xe(_,T)&&b(O,_[T],T);else if(As(_)||E!==void 0){var R=As(_)?x(_)?_.fn+".transform":_.fn:E;if(Xe(O,R)&&O[R]!==_&&!w.silent)throw new Error('Cannot import "'+R+'" twice');O[R]=_}else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}var M={};b(M,y);for(var A in M)if(Xe(M,A)){var S=M[A];if(As(S))o(S,w);else if(s(S))i(A,S,w);else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(y,w,C){if(C.wrap&&typeof w=="function"&&(w=c(w)),m(w)&&(w=e(y,{[w.signature]:w})),e.isTypedFunction(t[y])&&e.isTypedFunction(w)){C.override?w=e(y,w.signatures):w=e(t[y],w),t[y]=w,delete n[y],u(y,w),t.emit("import",y,function(){return w});return}if(t[y]===void 0||C.override){t[y]=w,delete n[y],u(y,w),t.emit("import",y,function(){return w});return}if(!C.silent)throw new Error('Cannot import "'+y+'": already exists')}function u(y,w){w&&typeof w.transform=="function"?(t.expression.transform[y]=w.transform,d(y)&&(t.expression.mathWithTransform[y]=w.transform)):(delete t.expression.transform[y],d(y)&&(t.expression.mathWithTransform[y]=w))}function l(y){delete t.expression.transform[y],d(y)?t.expression.mathWithTransform[y]=t[y]:delete t.expression.mathWithTransform[y]}function c(y){var w=function(){for(var b=[],M=0,A=arguments.length;M2&&arguments[2]!==void 0?arguments[2]:y.fn;if(Jb(C,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(C));var b=x(y)?t.expression.transform:t,M=C in t.expression.transform,A=Xe(b,C)?b[C]:void 0,S=function(){var _={};y.dependencies.map(ew).forEach(T=>{if(Jb(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var E=y(_);if(E&&typeof E.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(A===void 0||w.override)return E;if(e.isTypedFunction(A)&&e.isTypedFunction(E))return e(A,E);if(w.silent)return A;throw new Error('Cannot import "'+C+'": already exists')};!y.meta||y.meta.lazy!==!1?(Du(b,C,S),A&&M?l(C):(x(y)||h(y))&&Du(t.expression.mathWithTransform,C,()=>b[C])):(b[C]=S(),A&&M?l(C):(x(y)||h(y))&&Du(t.expression.mathWithTransform,C,()=>b[C])),n[C]=y,t.emit("import",C,S)}function s(y){return typeof y=="function"||typeof y=="number"||typeof y=="string"||typeof y=="boolean"||y===null||Ht(y)||Kt(y)||rr(y)||ma(y)||Qe(y)||Array.isArray(y)}function m(y){return typeof y=="function"&&typeof y.signature=="string"}function d(y){return!Xe(v,y)}function h(y){return y.fn.indexOf(".")===-1&&!Xe(v,y.fn)&&(!y.meta||!y.meta.isClass)}function x(y){return y!==void 0&&y.meta!==void 0&&y.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function ly(e,r){var t=ht({},Ds,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=JR({isNumber:sr,isComplex:Kt,isBigNumber:rr,isFraction:ma,isUnit:Ht,isString:St,isArray:Mr,isMatrix:Qe,isCollection:Nt,isDenseMatrix:Xi,isSparseMatrix:pa,isRange:To,isIndex:Ai,isBoolean:cm,isResultSet:lm,isHelp:yu,isFunction:mm,isDate:pm,isRegExp:dm,isObject:Mi,isNull:hm,isUndefined:vm,isAccessorNode:qn,isArrayNode:jt,isAssignmentNode:gm,isBlockNode:xm,isConditionalNode:ym,isConstantNode:yr,isFunctionAssignmentNode:_a,isFunctionNode:gn,isIndexNode:Qn,isNode:Nr,isObjectNode:Ci,isOperatorNode:ct,isParenthesisNode:en,isRangeNode:bm,isRelationalNode:wm,isSymbolNode:at,isChain:bu});n.config=HA(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function u(s){if(As(s))return s(n);var m=s[Object.keys(s)[0]];if(As(m))return m(n);if(!UA(s))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",s),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var d=a.indexOf(s),h;return d===-1?(s.math===!0?h=s.factory(n.type,t,u,n.typed,n):h=s.factory(n.type,t,u,n.typed),a.push(s),i.push(h)):h=i[d],h}var l={};function c(){for(var s=arguments.length,m=new Array(s),d=0;d{Ub(l).forEach(s=>{s&&s.meta&&s.meta.recreateOnConfigChange&&o(s,{override:!0})})}),n.create=ly.bind(null,e),n.factory=F,n.import(Ub(LA(e))),n.ArgumentsError=ha,n.DimensionError=pr,n.IndexError=tn,n}var vy=ca(fm());var r5=ca(e5()),TS=class{constructor(){this.lang="en";this.all={en:{hintText:{dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"New Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Spaces",migrateData:"Migrate Spaces From 0.7",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Spaces",releaseNotes:"Release Notes",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{newView:"New View",closeSpace:"Close Space",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open Space",revealInDefault:"Reveal in Finder",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Spaces",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",waypoints:"Waypoints",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group By",sortBy:"Sort By",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",removeFromWaypoints:"Unpin from Waypoints",editCode:"Edit Code",editProperties:"Edit Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",addFilter:"Add Filter",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete Table",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"New Action",newTable:"New Table",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Quickly Search a File, Folder, Tag... Press Tab to Edit",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueProperty:"Property",propertyLookup:"Edit Formula",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",context:"Context",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: "},settings:{layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Stickers",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},generateThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Spaces as Default Tab",desc:"Open the Spaces tab when Obsidian launches"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Open Flow Blocks on Internal Link Click",desc:"Turn on to toggle Flow Blocks directly by clicking on internal links, otherwise a tooltip will be shown"},syncContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},inlineBacklinks:{name:"Show Inline Backlinks (Inline Context required)",desc:"Show editable backlinks at the bottom of your notes"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContextExplorer:{name:"Inline Context",desc:"Display the context and a banner at the top of your notes"},inlineContextExpanded:{name:"Auto Expand Inline Context",desc:"Expand the inline context sections when opening a note"},inlineContextHorizontal:{name:"Inline Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Frontmatter Properties",desc:"Hide the frontmatter properties in inline context"},openFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},folderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},expandFolder:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},hoverPreview:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},activeFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Spaces"},contexts:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},spaces:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesAlias:{name:"Alias",desc:"Use the alias metadata to show in Spaces"},spacesFileExplorerDual:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using Spaces"},spacesDeleteOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},hideRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceView:{name:"Space View",desc:"Open the space view when you click on a space"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},tagSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Performance Mode",desc:"Turn on performance mode for Spaces, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in spaces (in pixels), default is 28"},coverHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blink:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",classic:"Classic",minimal:"Minimal"}}}};this.lang="en";let r=r5.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Tr=new TS().texts;var RZ=ca(fm());var _Z=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var t5=({field:e,value:r})=>r=="ctime"?{value:\`parseDate(prop('\${e}')['metadata']['file']['\${r}'])\`,type:"date"}:{value:\`prop('\${e}')['metadata']['file']['\${r}']\`,type:"string"},my=(e,r,t,n)=>{let a=wc(e);if(a)return r=="fileprop"&&a.field?t5(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=_Z(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...n5(r).configKeys??[],"alias","default"].reduce((i,u)=>({...i,[u]:a[u]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,u]=e.split(".");a=t5({field:i,value:u})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:Sn(e).map(u=>({name:u,value:u}))}:a={});return a??{}};var n5=(e,r)=>r==Fa?Af.find(t=>t.type=="file"):r=="tags"?Af.find(t=>t.type=="tags-multi"):r=="aliases"?Af.find(t=>t.type=="option-multi"):r=="sticker"?Af.find(t=>e=="icon"):Af.find(t=>e==t.type)||Af.find(t=>e==t.multiType),Af=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"text",label:Tr.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Tr.properties.text.description},{type:"number",label:Tr.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Tr.properties.number.description},{type:"boolean",label:Tr.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Tr.properties.boolean.description},{type:"date",label:Tr.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Tr.properties.date.description},{type:"option",label:Tr.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Tr.properties.option.description},{type:"tags-multi",label:Tr.properties.tags.label,icon:"ui//tags",description:Tr.properties.tags.description},{type:"file",label:Tr.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Tr.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Tr.properties.fileProperty.description},{type:"link",label:Tr.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Tr.properties.link.description},{type:"context",label:Tr.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space"],description:Tr.properties.context.description},{type:"object",label:Tr.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Tr.properties.object.description},{type:"icon",label:Tr.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Tr.properties.icon.description},{type:"image",label:Tr.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Tr.properties.image.description},{type:"color",label:Tr.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Tr.properties.color.description},{type:"space",label:Tr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Tr.properties.space.description},{type:"table",label:Tr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Tr.properties.space.description},{type:"super",label:Tr.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Tr.properties.super.label,icon:"ui//input",restricted:!0}];var qs="files",hy={id:qs,name:"Files",type:"db",primary:"true"},OZ="filesView",BZ={id:OZ,name:"All",type:"view",def:JSON.stringify({db:qs,icon:"ui//file-stack"})},PZ="main",IZ=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),N4e={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[IZ(PZ),BZ]},py={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[hy]},a5={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},dy={...a5,rows:[{name:Fa,schemaId:qs,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:Tr.properties.fileProperty.createdTime,schemaId:qs,type:"fileprop",value:Fa+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var A4e=[{name:Tr.properties.defaultField,schemaId:"",type:"text",primary:"true"}],FS={...a5,rows:[{name:Fa,schemaId:qs,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var M4e={schema:hy,cols:dy.rows,rows:[]},C4e={schema:hy,cols:dy.rows,rows:[]},E4e={schema:hy,cols:FS.rows,rows:[]},i5=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var T4e={m_schema:py,m_fields:dy,...i5(dy.rows,py.rows)},F4e={m_schema:py,m_fields:FS,...i5(FS.rows,py.rows)};var _S="spaces://$tags";var fRe={name:Tr.menu.waypoints,displayName:Tr.menu.waypoints,path:"spaces://$waypoints",label:{name:Tr.menu.waypoints,thumbnail:"",sticker:"ui//tags",color:""},type:"default"},cRe={name:Tr.menu.tags,displayName:Tr.menu.tags,path:"spaces://$tags",label:{thumbnail:"",name:Tr.menu.tags,sticker:"ui//tags",color:""},type:"default"},lRe={name:Tr.menu.vault,displayName:Tr.menu.vault,path:"/",label:{thumbnail:"",name:Tr.menu.vault,sticker:"ui//vault",color:""},type:"default"};var o5=(e,r,t,n,a,i,u)=>{if(!t)return"";let l=new Map;Object.keys(a).forEach(o=>l.set(o,a[o])),l.set("$properties",n),l.set("$paths",r),i&&l.set("$current",i);let c;try{e.evaluate("current = current()",l),c=e.evaluate(t,l),c=ws("",c)}catch(o){if(u)throw o}return c};var OS=e=>{let r=new Map;e.filter(u=>u.type=="fileprop"||u.name.startsWith("tags")).forEach(u=>{let{value:l}=my(u.value,u.type),c=[];try{let s=Ua(l).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);c.push(...s)}catch{}let o=u.name;r.has(o)||r.set(o,new Set);for(let s of c){let m=s;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=u=>{if(a.has(u))throw new Error("Circular dependency detected");if(!t.has(u)){a.add(u);let l=r.get(u)||new Set;for(let c of l)i(c);t.add(u),a.delete(u),n.push(u)}};for(let u of e)t.has(u.name)||i(u.name);return n},s5=(e,r,t,n,a,i)=>{if(!t)return{};let u=i??OS(n),l=r.get(t[Fa])?.metadata?.property??{},c=Object.keys(l).filter(m=>n.some(d=>d.name==m)).reduce((m,d)=>({...m,[d]:ws(d,l[d])}),{}),o=u.map(m=>n.find(d=>d.name==m)).filter(m=>m&&(m.type=="fileprop"||m.name=="tags")),s=n.reduce((m,d)=>({...m,[d.name]:d}),{});return{...t,...c,...o.reduce((m,d)=>{let{value:h}=my(d.value,d.type);return{...m,[d.name]:o5(e,r,h,s,{...t,...m},a)}},{})}};var u5=(e,r)=>{let t=e?Sn(e):[],n=r?Sn(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},Mf=(e,r)=>e==r,BS=(e,r)=>(e??"").length==0,PS=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),IS=(e,r)=>parseFloat(e)>parseFloat(r),RS=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},c5=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?Sn(e):[],n=r?Sn(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},l5=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},m5=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var Cf={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!BS(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>BS(e,""),valueType:"none"},include:{fn:(e,r)=>PS(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!PS(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>Mf(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!Mf(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>Mf(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>Mf(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!Mf(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>IS(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>RS(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!IS(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!RS(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>c5(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>f5(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>l5(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>m5(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>u5(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>kS(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!kS(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var qZ=(e,r,t)=>r.reduce((a,i)=>{let[u,l]=a,c=i.type=="context"?p5(l,i,t):i.type=="path"?h5(l,i,t):i.type=="frontmatter"?d5(l,i,t):v5(l,i,t),o=l.filter(s=>!c.includes(s));return[[...u,...c],o]},[[],e])[0],LZ=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?p5(n,a,t):a.type=="path"?h5(n,a,t):a.type=="frontmatter"?d5(n,a,t):v5(n,a,t),e),p5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,u]=r.field.split("."),l=a.metadata?.property;if(!a.spaces?.includes(i)||!l||!l[u])return!1;let c=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;c=n.fn(ws(u,l[u]),o)}return c})},d5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(ws(r.field,i[r.field]),l)}return u})},h5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=bs(a.outlinks??[]):r.field=="inlinks"?i=bs(a.inlinks??[]):r.field=="tags"&&(i=bs(a.tags??[]));let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(i,l)}return u})},v5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let u=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],u)}return i})},g5=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?qZ([r],i.filters,t).length>0:LZ([r],i.filters,t).length>0,!0);var x5=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var y5=(e,r,t)=>{if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,frames:{},schemas:[]}};let n=Object.values(r).map(l=>l.schema),a=n.filter(l=>l.type=="frame").reduce((l,c)=>({...l,[c.id]:r[c.id]}),{}),i={path:e.path,frames:a,schemas:n},u=!0;return t&&vy.default.isEqual(i,t)&&(u=!1),{changed:u,cache:i}},b5=(e,r,t,n,a,i,u)=>{let l={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{cols:[],path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],tables:{},space:e,spaceMap:l,dbExists:!1}};let c=Object.values(r).map(A=>A.schema),o=c.find(A=>A.primary=="true"),s=OS(r[o.id].cols),m={...r[o.id],rows:r[o.id].rows.map(A=>s5(u,i,A,r[o.id].cols,i.get(e.path),s))},d={...r,[o.id]:m},h=m.cols?.filter(A=>A.type.startsWith("context"))??[],x=m.cols?.filter(A=>A.type.startsWith("link"))??[],v=ti(h.map(A=>A.value));h.forEach(A=>{l[A.name]={},m.rows.forEach(S=>{Sn(S[A.name]).forEach(O=>l[A.name][O]=[...l[A.name][O]??[],S[Fa]])})});let y=d[qs]?.rows?.map(A=>A[Fa])??[],w=NA(t??[],y),C=ti(m.rows.reduce((A,S)=>ti([...A,...[...h,...x].flatMap(O=>Sn(S[O.name]).map(_=>Dc(_)))]),[])),b={cols:m.cols,path:e.path,contexts:v,outlinks:C,paths:w,tables:d,schemas:c,space:e,spaceMap:l,dbExists:a},M=!0;return n&&vy.default.isEqual(b,n)&&(M=!0),{changed:M,cache:b}},w5=(e,r,t,n)=>{let a={};for(let[i,u]of e){let l=t.get(i)?.defPath??i,c=e.get(l)??u,o=u?.parent??"",s=u?.type??"",m=u?.subtype??"",d=c?.label,h=n?.get(i),{changed:x,cache:v}=qS(i,r,t,c,d,s,m,o,h);a[i]={changed:x,cache:v}}return a},qS=(e,r,t,n,a,i,u,l,c)=>{let o=(W,G,H)=>W?.length>0||W?.length>0?W:G=="space"?H=="Spaces/Home"?"ui//home":H=="/"?"ui//vault":H.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",s={label:n?.label,path:e,name:yc(e),displayName:yc(e)},m=[],d=n?.tags?.map(W=>W)??[],h=x5(r,e),x=(W,G,H=new Set)=>{let L=[];for(let k of G){let K=W.get(k)?.contexts??[];for(let z of K)H.has(z)||(L.push(z),H.add(z),L.push(...x(W,[bc(z)],H)))}return L};if(t.has(l))for(let W of t.get(l).contexts??[])m.push(W);m.push(...d);let v=a?.name,y=n?.properties?um(n.properties[r.fmKeyAlias]):[],w=o(a?.sticker,i,e),C=a?.color??"",b=n?.inlinks??[],M=n?.links??[],A=r.spacesUseAlias?y[0]??v:v,S={...s,name:v,tags:ti(m),type:i,subtype:u,displayName:A,parent:l,label:{name:v,sticker:w,color:C,thumbnail:a?.thumbnail??"",preview:a?.preview??""},metadata:{...n},inlinks:b,outlinks:M},O=[];u=="tag"&&O.push(_S);for(let W of m)O.push(bc(W));let _=new Set,E=(W,G)=>{if(!_.has(W)){if(_.add(W),G.dependencies?.length>0)for(let H of G.dependencies)t.has(H)&&E(H,t.get(H));if(G.defPath==e&&(h=!0),u!="tag"&&u!="default"&&G.space&&G.space.path==l){O.push(W);return}if(G.metadata?.filters?.length>0&&g5(G.metadata.filters,{...S,spaces:O},G.properties)){O.push(W);return}if(G.metadata?.links?.length>0&&(G.metadata?.links??[]).find(L=>L==S.path)){O.push(W);return}}};for(let[W,G]of t)E(W,G);let T=x(t,O);O.push(...T.map(W=>bc(W))),S.tags.push(...T);let R=h?{...S,spaces:[],hidden:h}:{...S,spaces:ti(O),hidden:h},q=!0;return c&&vy.default.isEqual(R,c)&&(q=!1),{changed:q,cache:R}};function D5(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,label:i,type:u,subtype:l,parent:c,oldMetadata:o}=e;return qS(r,t,n,a,i,u,l,c,o)}function LS(e,r){let{space:t,mdb:n,paths:a,oldCache:i,dbExists:u,pathsIndex:l}=e;return b5(t,n,a,i,u,l,r)}function S5(e,r){let{map:t,pathsIndex:n}=e,a=new Map;for(let[i,u]of t)a.set(i,LS({...u,pathsIndex:n},r));return a}function N5(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return w5(r,t,n,a)}function A5(e){let{space:r,mdb:t,oldCache:n}=e;return y5(r,t,n)}var zZ=self,UZ={...AS,createAdd:F("add",[],()=>function(r,t){return r+t})},zS=ly(UZ);zS.import(Lb,{override:!0});zZ.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=D5(r):t.type=="context"?n=LS(r,zS):t.type=="contexts"?n=S5(r,zS):t.type=="frames"?n=A5(r):t.type=="paths"&&(n=N5(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; +In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var i3={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var o3={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var s3={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var u3={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var f3={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var c3={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var l3={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var m3={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var p3={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var d3={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var h3={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var v3={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var g3={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var x3={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var y3={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var b3={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var w3={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var D3={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var S3={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var N3={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var A3={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var M3={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var C3={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var E3={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var T3={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var F3={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var _3={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var O3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var B3={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var P3={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var I3={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var R3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var k3={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var q3={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var L3={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var z3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var U3={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var W3={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Y3={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var H3={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var $3={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var G3={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var V3={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var Z3={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var Q3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var X3={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var J3={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var K3={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var j3={bignumber:YT,boolean:HT,complex:$T,createUnit:GT,fraction:VT,index:ZT,matrix:QT,number:XT,sparse:JT,splitUnit:KT,string:jT,unit:eF,e:DD,E:DD,false:ET,i:TT,Infinity:FT,LN2:OT,LN10:_T,LOG2E:PT,LOG10E:BT,NaN:IT,null:RT,pi:SD,PI:SD,phi:kT,SQRT1_2:qT,SQRT2:LT,tau:zT,true:UT,version:WT,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:aF,lsolve:oF,lsolveAll:sF,lup:uF,lusolve:fF,leafCount:iF,polynomialRoot:cF,resolve:pF,simplify:dF,simplifyConstant:hF,simplifyCore:vF,symbolicEqual:xF,rationalize:mF,slu:gF,usolve:yF,usolveAll:bF,qr:lF,abs:wF,add:DF,cbrt:SF,ceil:NF,cube:AF,divide:MF,dotDivide:CF,dotMultiply:EF,dotPow:TF,exp:FF,expm:_F,expm1:OF,fix:BF,floor:PF,gcd:IF,hypot:RF,lcm:qF,log:LF,log2:WF,log1p:UF,log10:zF,mod:YF,multiply:HF,norm:$F,nthRoot:GF,nthRoots:VF,pow:ZF,round:QF,sign:XF,sqrt:JF,sqrtm:KF,square:t_,subtract:n_,unaryMinus:a_,unaryPlus:i_,xgcd:o_,invmod:kF,bitAnd:s_,bitNot:u_,bitOr:f_,bitXor:c_,leftShift:l_,rightArithShift:m_,rightLogShift:p_,bellNumbers:d_,catalan:h_,composition:v_,stirlingS2:g_,config:rF,import:tF,typed:nF,arg:x_,conj:y_,re:w_,im:b_,evaluate:D_,help:S_,distance:N_,intersect:A_,and:M_,not:C_,or:E_,xor:T_,concat:__,count:O_,cross:B_,column:F_,ctranspose:P_,det:I_,diag:R_,diff:k_,dot:q_,getMatrixDataType:Y_,identity:H_,filter:z_,flatten:U_,forEach:W_,inv:$_,pinv:G_,eigs:L_,kron:V_,matrixFromFunction:X_,matrixFromRows:J_,matrixFromColumns:Q_,map:Z_,ones:K_,partitionSelect:j_,range:eO,resize:tO,reshape:rO,rotate:nO,rotationMatrix:aO,row:iO,size:oO,sort:sO,squeeze:uO,subset:fO,trace:cO,transpose:lO,zeros:mO,fft:pO,ifft:dO,sylvester:jF,schur:e_,lyap:r_,solveODE:K3,combinations:hO,combinationsWithRep:vO,factorial:gO,gamma:xO,kldivergence:bO,lgamma:yO,multinomial:wO,permutations:DO,pickRandom:SO,random:NO,randomInt:AO,compare:MO,compareNatural:CO,compareText:EO,deepEqual:TO,equal:FO,equalText:_O,larger:OO,largerEq:BO,smaller:PO,smallerEq:IO,unequal:RO,setCartesian:kO,setDifference:qO,setDistinct:LO,setIntersect:zO,setIsSubset:UO,setMultiplicity:WO,setPowerset:YO,setSize:HO,setSymDifference:$O,setUnion:GO,zpk2tf:VO,freqz:ZO,erf:QO,zeta:XO,cumsum:o3,mad:JO,max:KO,mean:jO,median:e3,min:r3,mode:t3,prod:n3,quantileSeq:a3,std:i3,sum:s3,variance:u3,corr:f3,acos:c3,acosh:l3,acot:m3,acoth:p3,acsc:d3,acsch:h3,asec:v3,asech:g3,asin:x3,asinh:y3,atan:b3,atanh:D3,atan2:w3,cos:S3,cosh:N3,cot:A3,coth:M3,csc:C3,csch:E3,sec:T3,sech:F3,sin:_3,sinh:O3,tan:B3,tanh:P3,to:I3,clone:k3,format:q3,bin:R3,oct:Q3,hex:z3,isNaN:W3,isInteger:U3,isNegative:Y3,isNumeric:H3,hasNumericValue:L3,isPositive:$3,isPrime:G3,isZero:V3,print:X3,typeOf:J3,numeric:Z3};var eB="help",xG=["typed","mathWithTransform","Help"],hg=F(eB,xG,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(eB,{any:function(i){var u,l=i;if(typeof i!="string"){for(u in t)if(Xe(t,u)&&i===t[u]){l=u;break}}var c=wt(j3,l);if(!c){var o=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+o+'"')}return new n(c)}})});var rB="chain",yG=["typed","Chain"],vg=F(rB,yG,e=>{var{typed:r,Chain:t}=e;return r(rB,{"":function(){return new t},any:function(a){return new t(a)}})});var tB="det",bG=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],gg=F(tB,bG,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:u,unaryMinus:l}=e;return r(tB,{any:function(s){return ar(s)},"Array | Matrix":function(s){var m;switch(Qe(s)?m=s.size():Array.isArray(s)?(s=t(s),m=s.size()):m=[],m.length){case 0:return ar(s);case 1:if(m[0]===1)return ar(s.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")");case 2:{var d=m[0],h=m[1];if(d===h)return c(s.clone().valueOf(),d,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(m)+")")}}});function c(o,s,m){if(s===1)return ar(o[0][0]);if(s===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var d=!1,h=new Array(s).fill(0).map((O,_)=>_),x=0;x{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:u,det:l,identity:c,abs:o}=e;return r(nB,{"Array | Matrix":function(d){var h=Qe(d)?d.size():ur(d);switch(h.length){case 1:if(h[0]===1)return Qe(d)?t([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+lr(h)+")");case 2:{var x=h[0],v=h[1];if(x===v)return Qe(d)?t(s(d.valueOf(),x,v),d.storage()):s(d,x,v);throw new RangeError("Matrix must be square (size: "+lr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(h)+")")}},any:function(d){return n(1,d)}});function s(m,d,h){var x,v,y,w,C;if(d===1){if(w=m[0][0],w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,w)]]}else if(d===2){var b=l(m);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],b),n(u(m[0][1]),b)],[n(u(m[1][0]),b),n(m[0][0],b)]]}else{var M=m.concat();for(x=0;xO&&(O=o(M[x][S]),_=x),x++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");x=_,x!==S&&(C=M[S],M[S]=M[x],M[x]=C,C=A[S],A[S]=A[x],A[x]=C);var E=M[S],T=A[S];for(x=0;x{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:u,dot:l,ctranspose:c,divideScalar:o,multiply:s,add:m,Complex:d}=e;return r(aB,{"Array | Matrix":function(b){var M=Qe(b)?b.size():ur(b);switch(M.length){case 1:return w(b)?c(b):M[0]===1?n(b):u(c(b),l(b,b));case 2:{if(w(b))return c(b);var A=M[0],S=M[1];if(A===S)try{return n(b)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(b)?t(h(b.valueOf(),A,S),b.storage()):h(b,A,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(M)+")")}},any:function(b){return i(b,0)?ar(b):o(1,b)}});function h(C,b,M){var{C:A,F:S}=v(C,b,M),O=s(n(s(c(A),A)),c(A)),_=s(c(S),n(s(S,c(S))));return s(_,O)}function x(C,b,M){for(var A=ar(C),S=0,O=0;O_.filter((T,R)=>R!y(l(A[E],A[E])));return{C:S,F:O}}function y(C){return i(m(C,d(1,1)),m(0,d(1,1)))}function w(C){return a(m(C,d(1,1)),m(s(C,0),d(1,1)))}});function iB(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:u,sqrt:l,abs:c,bignumber:o,diag:s,size:m,reshape:d,inv:h,qr:x,usolve:v,usolveAll:y,equal:w,complex:C,larger:b,smaller:M,matrixFromColumns:A,dot:S}=e;function O(ae,$,le,Ee){var me=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,le,Ee,me);E(ae,$,le,Ee,me,ge);var{values:Se,C:xe}=T(ae,$,le,Ee,me);if(me){var be=R(ae,$,xe,ge,Se,le,Ee);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",xe=ge?o(0):0,be=ge?o(1):Se?C(1):1,De=ge?o(1):1,Ae=ge?o(10):2,We=i(Ae,Ae),Je;me&&(Je=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var ye=xe,j=xe,ne=0;ne<$;ne++)re!==ne&&(ye=r(ye,c(ae[ne][re])),j=r(j,c(ae[re][ne])));if(!w(ye,0)&&!w(j,0)){for(var ue=De,Me=ye,Ce=u(j,Ae),Le=i(j,Ae);M(Me,Ce);)Me=i(Me,We),ue=i(ue,Ae);for(;b(Me,Le);)Me=u(Me,We),ue=u(ue,Ae);var Ie=M(u(r(Me,j),ue),i(r(ye,j),.95));if(Ie){J=!1;for(var fr=u(1,ue),or=0;or<$;or++)re!==or&&(ae[re][or]=i(ae[re][or],fr),ae[or][re]=i(ae[or][re],ue));me&&(Je[re]=i(Je[re],fr))}}}}return me?s(Je):null}function E(ae,$,le,Ee,me,ge){var Se=Ee==="BigNumber",xe=Ee==="Complex",be=Se?o(0):xe?C(0):0;Se&&(le=o(le));for(var De=0;De<$-2;De++){for(var Ae=0,We=be,Je=De+1;Je<$;Je++){var J=ae[Je][De];M(c(We),c(J))&&(We=J,Ae=Je)}if(!M(c(We),le)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var ye=0;ye<$;ye++){var j=ae[ye][Ae];ae[ye][Ae]=ae[ye][De+1],ae[ye][De+1]=j}if(me){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=u(ae[ue][De],We);if(Me!==0){for(var Ce=0;Ce<$;Ce++)ae[ue][Ce]=t(ae[ue][Ce],i(Me,ae[De+1][Ce]));for(var Le=0;Le<$;Le++)ae[Le][De+1]=r(ae[Le][De+1],i(Me,ae[Le][ue]));if(me)for(var Ie=0;Ie<$;Ie++)ge[ue][Ie]=t(ge[ue][Ie],i(Me,ge[De+1][Ie]))}}}}return ge}function T(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",xe=ge?o(1):Se?C(1):1;ge&&(le=o(le));for(var be=ar(ae),De=[],Ae=$,We=[],Je=me?s(Array($).fill(xe)):void 0,J=me?s(Array(Ae).fill(xe)):void 0,re=0;re<=100;){re+=1;for(var ye=be[Ae-1][Ae-1],j=0;j1&&(J=s(Array(Ae-1).fill(xe)))),Ae-=1,be.pop();for(var Ce=0;Ce2&&(J=s(Array(Ae-2).fill(xe)))),Ae-=2,be.pop(),be.pop();for(var Ie=0;Ie+t(c(Ke),c(Pr))),re>100){var fr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw fr.values=De,fr.vectors=[],fr}var or=me?a(Je,H(We,$)):void 0;return{values:De,C:or}}function R(ae,$,le,Ee,me,ge,Se){var xe=h(le),be=a(xe,ae,le),De=Se==="BigNumber",Ae=Se==="Complex",We=De?o(0):Ae?C(0):0,Je=De?o(1):Ae?C(1):1,J=[],re=[];for(var ye of me){var j=L(J,ye,w);j===-1?(J.push(ye),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(We),Ce=s(Array($).fill(Je)),Le=function(){var or=J[Ie],Ke=t(be,a(or,Ce)),Pr=y(Ke,Me);for(Pr.shift();Pr.lengtha(ce,we)),ne.push(...Pr.map(we=>({value:or,vector:n(we)})))},Ie=0;Ie=5)return null;for(xe=0;;){var be=v(ae,Se);if(M(oe(z(Se,[be])),Ee))break;if(++xe>=10)return null;Se=pe(be)}return Se}function K(ae,$,le){var Ee=le==="BigNumber",me=le==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ee&&(ge=ge.map(Se=>o(Se))),me&&(ge=ge.map(Se=>C(Se))),ge=z(ge,$),pe(ge,le)}function z(ae,$){var le=m(ae);for(var Ee of $)Ee=d(Ee,le),ae=t(ae,a(u(S(Ee,ae),S(Ee,Ee)),Ee));return ae}function oe(ae){return c(l(S(ae,ae)))}function pe(ae,$){var le=$==="BigNumber",Ee=$==="Complex",me=le?o(1):Ee?C(1):1;return a(u(me,oe(ae)),ae)}return O}function oB(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:u,sin:l,multiplyScalar:c,inv:o,bignumber:s,multiply:m,add:d}=e;function h(E,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,q=arguments.length>3?arguments[3]:void 0,W=arguments.length>4?arguments[4]:void 0;if(q==="number")return x(E,R,W);if(q==="BigNumber")return v(E,R,W);throw TypeError("Unsupported data type: "+q)}function x(E,T,R){var q=E.length,W=Math.abs(T/q),G,H;if(R){H=new Array(q);for(var L=0;L=Math.abs(W);){var K=k[0][0],z=k[0][1];G=y(E[K][K],E[z][z],E[K][z]),E=A(E,G,K,z),R&&(H=C(H,G,K,z)),k=S(E)}for(var oe=Array(q).fill(0),pe=0;pe=a(W);){var K=k[0][0],z=k[0][1];G=w(E[K][K],E[z][z],E[K][z]),E=M(E,G,K,z),R&&(H=b(H,G,K,z)),k=O(E)}for(var oe=Array(q).fill(0),pe=0;pe({value:W[$],vector:ae}));return{values:W,eigenvectors:pe}}return h}var SG="eigs",NG=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],bg=F(SG,NG,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,divideScalar:d,inv:h,bignumber:x,multiply:v,add:y,larger:w,column:C,flatten:b,number:M,complex:A,sqrt:S,diag:O,size:_,reshape:E,qr:T,usolve:R,usolveAll:q,im:W,re:G,smaller:H,matrixFromColumns:L,dot:k}=e,K=oB({config:r,addScalar:a,subtract:i,column:C,flatten:b,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,inv:h,bignumber:x,complex:A,multiply:v,add:y}),z=iB({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:b,divideScalar:d,sqrt:S,abs:l,bignumber:x,diag:O,size:_,reshape:E,qr:T,inv:h,usolve:R,usolveAll:q,equal:u,complex:A,larger:w,smaller:H,matrixFromColumns:L,dot:k});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(me,ge){return oe(n(me),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var xe={matricize:!0};return ht(xe,Se),oe(ge,xe)}});function oe(me){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xe="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=pe(me,be,xe);return Se.matricize&&(De.values=n(De.values),xe&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:We,vector:Je}=Ae;return{value:We,vector:n(Je)}}))),xe&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function pe(me,ge,Se){var xe=me.toArray(),be=me.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(lr(be),")"));var De=be[0];if($(xe,De,ge)&&(le(xe,De),ae(xe,De,ge))){var Ae=Ee(me,xe,De);return K(xe,De,ge,Ae,Se)}var We=Ee(me,xe,De);return z(xe,De,ge,We,Se)}function ae(me,ge,Se){for(var xe=0;xe{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:u}=e;return r(sB,{Matrix:function(m){var d=m.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+lr(d)+")");for(var h=d[0],x=1e-15,v=l(m),y=c(v,x),w=y.q,C=y.j,b=u(m,Math.pow(2,-C)),M=a(h),A=a(h),S=1,O=b,_=-1,E=1;E<=w;E++)E>1&&(O=u(O,b),_=-_),S=S*(w-E+1)/((2*w-E+1)*E),M=n(M,u(S,O)),A=n(A,u(S*_,O));for(var T=u(i(A),M),R=0;R{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:u,subtract:l,inv:c,size:o,max:s,identity:m}=e,d=1e3,h=1e-6;function x(v){var y,w=0,C=v,b=m(o(v));do{var M=C;if(C=a(.5,n(M,c(b))),b=a(.5,n(b,c(M))),y=s(t(l(C,M))),y>h&&++w>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(y>h);return C}return r(uB,{"Array | Matrix":function(y){var w=Qe(y)?y.size():ur(y);switch(w.length){case 1:if(w[0]===1)return i(y,u);throw new RangeError("Matrix must be square (size: "+lr(w)+")");case 2:{var C=w[0],b=w[1];if(C===b)return x(y);throw new RangeError("Matrix must be square (size: "+lr(w)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+lr(w)+")")}}})});var fB="sylvester",CG=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Sg=F(fB,CG,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:u,concat:l,transpose:c,index:o,subset:s,add:m,subtract:d,identity:h,lusolve:x,abs:v}=e;return r(fB,{"Matrix, Matrix, Matrix":y,"Array, Matrix, Matrix":function(C,b,M){return y(a(C),b,M)},"Array, Array, Matrix":function(C,b,M){return y(a(C),a(b),M)},"Array, Matrix, Array":function(C,b,M){return y(a(C),b,a(M))},"Matrix, Array, Matrix":function(C,b,M){return y(C,a(b),M)},"Matrix, Array, Array":function(C,b,M){return y(C,a(b),a(M))},"Matrix, Matrix, Array":function(C,b,M){return y(C,b,a(M))},"Array, Array, Array":function(C,b,M){return y(a(C),a(b),a(M)).toArray()}});function y(w,C,b){for(var M=C.size()[0],A=w.size()[0],S=t(w),O=S.T,_=S.U,E=t(i(-1,C)),T=E.T,R=E.U,q=i(i(c(_),b),R),W=u(0,A),G=[],H=(Ae,We)=>l(Ae,We,1),L=(Ae,We)=>l(Ae,We,0),k=0;k1e-5){for(var K=L(s(q,o(W,k)),s(q,o(W,k+1))),z=0;z{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:u,subtract:l}=e;return r(cB,{Array:function(s){var m=c(t(s));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(s){return c(s)}});function c(o){var s=o.size()[0],m=o,d=n(s),h=0,x;do{x=m;var v=i(m),y=v.Q,w=v.R;if(m=a(w,y),d=a(d,y),h++>100)break}while(u(l(m,x))>1e-4);return{U:d,T:m}}});var lB="lyap",TG=["typed","matrix","sylvester","multiply","transpose"],Ag=F(lB,TG,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(lB,{"Matrix, Matrix":function(l,c){return n(l,i(l),a(-1,c))},"Array, Matrix":function(l,c){return n(t(l),i(t(l)),a(-1,c))},"Matrix, Array":function(l,c){return n(l,i(t(l)),t(a(-1,c)))},"Array, Array":function(l,c){return n(t(l),i(t(l)),t(a(-1,c))).toArray()}})});var FG="divide",_G=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Mg=F(FG,_G,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:u}=e,l=jr({typed:r,equalScalar:a}),c=qt({typed:r});return r("divide",Dm({"Array | Matrix, Array | Matrix":function(s,m){return n(s,u(m))},"DenseMatrix, any":function(s,m){return c(s,m,i,!1)},"SparseMatrix, any":function(s,m){return l(s,m,i,!1)},"Array, any":function(s,m){return c(t(s),m,i,!1).valueOf()},"any, Array | Matrix":function(s,m){return n(s,u(m))}},i.signatures))});var mB="distance",OG=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Cg=F(mB,OG,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:u,sqrt:l,abs:c}=e;return r(mB,{"Array, Array, Array":function(A,S,O){if(A.length===2&&S.length===2&&O.length===2){if(!s(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!s(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(S,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],S[1]),E=n(S[0],O[0]),T=n(a(O[0],S[1]),a(S[0],O[1]));return y(A[0],A[1],_,E,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(A,S,O){if(Object.keys(A).length===2&&Object.keys(S).length===2&&Object.keys(O).length===2){if(!s(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!s(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(x(S),x(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in A&&"pointY"in A&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,S.lineOnePtY),E=n(S.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,S.lineOnePtY),a(S.lineOnePtX,O.lineTwoPtY));return y(A.pointX,A.pointY,_,E,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(A,S){if(A.length===2&&S.length===3){if(!s(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return y(A[0],A[1],S[0],S[1],S[2])}else if(A.length===3&&S.length===6){if(!m(A))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return w(A[0],A[1],A[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(A.length===S.length&&A.length>0){if(!d(A))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return C(A,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(A,S){if(Object.keys(A).length===2&&Object.keys(S).length===3){if(!s(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return y(A.pointX,A.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(S).length===6){if(!m(A))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return w(A.pointX,A.pointY,A.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===2&&Object.keys(S).length===2){if(!s(A))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointTwoX"in S&&"pointTwoY"in S)return C([A.pointOneX,A.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(S).length===3){if(!m(A))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointOneZ"in A&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return C([A.pointOneX,A.pointOneY,A.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(A){if(!v(A))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(A)}});function o(M){return typeof M=="number"||rr(M)}function s(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])}function m(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])&&o(M[2])}function d(M){return Array.isArray(M)||(M=x(M)),M.every(o)}function h(M){return M.constructor!==Array&&(M=x(M)),o(M[0])&&o(M[1])&&o(M[2])&&o(M[3])&&o(M[4])&&o(M[5])}function x(M){for(var A=Object.keys(M),S=[],O=0;OA.length!==2||!o(A[0])||!o(A[1])))return!1}else if(M[0].length===3&&o(M[0][0])&&o(M[0][1])&&o(M[0][2])){if(M.some(A=>A.length!==3||!o(A[0])||!o(A[1])||!o(A[2])))return!1}else return!1;return!0}function y(M,A,S,O,_){var E=c(t(t(a(S,M),a(O,A)),_)),T=l(t(a(S,S),a(O,O)));return i(E,T)}function w(M,A,S,O,_,E,T,R,q){var W=[n(a(n(_,A),q),a(n(E,S),R)),n(a(n(E,S),T),a(n(O,M),q)),n(a(n(O,M),R),a(n(_,A),T))];W=l(t(t(a(W[0],W[0]),a(W[1],W[1])),a(W[2],W[2])));var G=l(t(t(a(T,T),a(R,R)),a(q,q)));return i(W,G)}function C(M,A){for(var S=M.length,O=0,_=0,E=0;E{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:u,multiply:l,multiplyScalar:c,divideScalar:o,subtract:s,smaller:m,equalScalar:d,flatten:h,isZero:x,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":w,"Matrix, Matrix, Matrix":function(R,q,W){var G=y(R.valueOf(),q.valueOf(),W.valueOf());return G===null?null:u(G)},"Matrix, Matrix, Matrix, Matrix":function(R,q,W,G){var H=w(R.valueOf(),q.valueOf(),W.valueOf(),G.valueOf());return H===null?null:u(H)}});function y(T,R,q){if(T=C(T),R=C(R),q=C(q),!M(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!M(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(q))throw new TypeError("Array with 4 numbers expected as third argument");return E(T[0],T[1],T[2],R[0],R[1],R[2],q[0],q[1],q[2],q[3])}function w(T,R,q,W){if(T=C(T),R=C(R),q=C(q),W=C(W),T.length===2){if(!b(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(q))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(W))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(T,R,q,W)}else if(T.length===3){if(!M(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!M(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(q))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!M(W))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],R[0],R[1],R[2],q[0],q[1],q[2],W[0],W[1],W[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function C(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(R=>Array.isArray(R)&&R.length===1)?h(T):T}function b(T){return T.length===2&&v(T[0])&&v(T[1])}function M(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function A(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function S(T,R,q,W){var G=T,H=q,L=s(G,R),k=s(H,W),K=s(c(L[0],k[1]),c(k[0],L[1]));if(x(K)||m(n(K),t.epsilon))return null;var z=c(k[0],G[1]),oe=c(k[1],G[0]),pe=c(k[0],H[1]),ae=c(k[1],H[0]),$=o(i(s(s(z,oe),pe),ae),K);return a(l(L,$),G)}function O(T,R,q,W,G,H,L,k,K,z,oe,pe){var ae=c(s(T,R),s(q,W)),$=c(s(G,H),s(L,k)),le=c(s(K,z),s(oe,pe));return i(i(ae,$),le)}function _(T,R,q,W,G,H,L,k,K,z,oe,pe){var ae=O(T,L,z,L,R,k,oe,k,q,K,pe,K),$=O(z,L,W,T,oe,k,G,R,pe,K,H,q),le=O(T,L,W,T,R,k,G,R,q,K,H,q),Ee=O(z,L,z,L,oe,k,oe,k,pe,K,pe,K),me=O(W,T,W,T,G,R,G,R,H,q,H,q),ge=s(c(ae,$),c(le,Ee)),Se=s(c(me,Ee),c($,$));if(x(Se))return null;var xe=o(ge,Se),be=o(i(ae,c(xe,$)),Ee),De=i(T,c(xe,s(W,T))),Ae=i(R,c(xe,s(G,R))),We=i(q,c(xe,s(H,q))),Je=i(L,c(be,s(z,L))),J=i(k,c(be,s(oe,k))),re=i(K,c(be,s(pe,K)));return d(De,Je)&&d(Ae,J)&&d(We,re)?[De,Ae,We]:null}function E(T,R,q,W,G,H,L,k,K,z){var oe=c(T,L),pe=c(W,L),ae=c(R,k),$=c(G,k),le=c(q,K),Ee=c(H,K),me=s(s(s(z,oe),ae),le),ge=s(s(s(i(i(pe,$),Ee),oe),ae),le),Se=o(me,ge),xe=i(T,c(Se,s(W,T))),be=i(R,c(Se,s(G,R))),De=i(q,c(Se,s(H,q)));return[xe,be,De]}});var pB="sum",IG=["typed","config","add","numeric"],nf=F(pB,IG,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(pB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":u,"...":function(c){if(Ba(c))throw new TypeError("Scalar values expected in function sum");return i(c)}});function i(l){var c;return An(l,function(o){try{c=c===void 0?o:n(c,o)}catch(s){throw Et(s,"sum",o)}}),c===void 0&&(c=a(0,t.number)),typeof c=="string"&&(c=a(c,t.number)),c}function u(l,c){try{var o=ko(l,c,n);return o}catch(s){throw Et(s,"sum")}}});var Tg="cumsum",RG=["typed","add","unaryPlus"],af=F(Tg,RG,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(Tg,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":u,"Matrix, number | BigNumber":function(o,s){return o.create(u(o.valueOf(),s))},"...":function(o){if(Ba(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(c){try{return i(c)}catch(o){throw Et(o,Tg)}}function i(c){if(c.length===0)return[];for(var o=[n(c[0])],s=1;s=s.length)throw new tn(o,s.length);try{return l(c,o)}catch(m){throw Et(m,Tg)}}function l(c,o){var s,m,d;if(o<=0){var h=c[0][0];if(Array.isArray(h)){for(d=Km(c),m=[],s=0;s{var{typed:r,add:t,divide:n}=e;return r(dB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(l){if(Ba(l))throw new TypeError("Scalar values expected in function mean");return i(l)}});function a(u,l){try{var c=ko(u,l,t),o=Array.isArray(u)?ur(u):u.size();return n(c,o[l])}catch(s){throw Et(s,"mean")}}function i(u){var l,c=0;if(An(u,function(o){try{l=l===void 0?o:t(l,o),c++}catch(s){throw Et(s,"mean",o)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,c)}});var hB="median",qG=["typed","add","divide","compare","partitionSelect"],Fg=F(hB,qG,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function u(o){try{o=gr(o.valueOf());var s=o.length;if(s===0)throw new Error("Cannot calculate median of an empty array");if(s%2===0){for(var m=s/2-1,d=i(o,m+1),h=o[m],x=0;x0&&(h=o[x]);return c(h,d)}else{var v=i(o,(s-1)/2);return l(v)}}catch(y){throw Et(y,"median")}}var l=r({"number | BigNumber | Complex | Unit":function(s){return s}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(s,m){return n(t(s,m),2)}});return r(hB,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(s,m){throw new Error("median(A, dim) is not yet supported")},"...":function(s){if(Ba(s))throw new TypeError("Scalar values expected in function median");return u(s)}})});var vB="mad",LG=["typed","abs","map","median","subtract"],_g=F(vB,LG,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(vB,{"Array | Matrix":u,"...":function(c){return u(c)}});function u(l){if(l=gr(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=a(l);return a(n(l,function(o){return t(i(o,c))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):Et(o,"mad")}}});var ND="unbiased",gB="variance",zG=["typed","add","subtract","multiply","divide","apply","isNaN"],sf=F(gB,zG,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e;return r(gB,{"Array | Matrix":function(m){return c(m,ND)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(m,d){return o(m,d,ND)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return c(m,ND)}});function c(s,m){var d,h=0;if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(An(s,function(y){try{d=d===void 0?y:t(d,y),h++}catch(w){throw Et(w,"variance",y)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var x=i(d,h);if(d=void 0,An(s,function(y){var w=n(y,x);d=d===void 0?a(w,w):t(d,a(w,w))}),l(d))return d;switch(m){case"uncorrected":return i(d,h);case"biased":return i(d,h+1);case"unbiased":{var v=rr(d)?d.mul(0):0;return h===1?v:i(d,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(s,m,d){try{if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(s,m,h=>c(h,d))}catch(h){throw Et(h,"variance")}}});var xB="quantileSeq",UG=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],uf=F(xB,UG,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=qo({typed:r,isInteger:o});return r(xB,{"Array | Matrix, number | BigNumber":(C,b)=>v(C,b,!1),"Array | Matrix, number | BigNumber, number":(C,b,M)=>x(C,b,!1,M,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(C,b,M,A)=>x(C,b,M,A,v),"Array | Matrix, Array | Matrix":(C,b)=>y(C,b,!1),"Array | Matrix, Array | Matrix, number":(C,b,M)=>x(C,b,!1,M,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(C,b,M,A)=>x(C,b,M,A,y)});function x(C,b,M,A,S){return h(C,A,O=>S(O,b,M))}function v(C,b,M){var A,S=C.valueOf();if(s(b,0))throw new Error("N/prob must be non-negative");if(m(b,1))return sr(b)?w(S,b,M):t(w(S,b,M));if(d(b,1)){if(!o(b))throw new Error("N must be a positive integer");if(d(b,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(b,1);A=[];for(var _=0;s(_,b);_++){var E=i(_+1,O);A.push(w(S,E,M))}return sr(b)?A:t(A)}}function y(C,b,M){for(var A=C.valueOf(),S=b.valueOf(),O=[],_=0;_0&&(T=A[q])}return n(u(T,a(1,E)),u(R,E))}});var yB="std",WG=["typed","map","sqrt","variance"],ff=F(yB,WG,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(yB,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(l){return i(l)}});function i(u,l){if(u.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=a.apply(null,arguments);return Nt(c)?t(c,n):n(c)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var bB="corr",YG=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Og=F(bB,YG,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:u,multiply:l,pow:c,divide:o}=e;return r(bB,{"Array, Array":function(h,x){return s(h,x)},"Matrix, Matrix":function(h,x){var v=s(h.toArray(),x.toArray());return Array.isArray(v)?t(v):v}});function s(d,h){var x=[];if(Array.isArray(d[0])&&Array.isArray(h[0])){if(d.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(S,l(O,h[_])),0),C=a(d.map(S=>c(S,2))),b=a(h.map(S=>c(S,2))),M=u(l(x,w),l(v,y)),A=n(l(u(l(x,C),c(v,2)),u(l(x,b),c(y,2))));return o(M,A)}});var wB="combinations",HG=["typed"],Bg=F(wB,HG,e=>{var{typed:r}=e;return r(wB,{"number, number":kw,"BigNumber, BigNumber":function(n,a){var i=n.constructor,u,l,c=n.minus(a),o=new i(1);if(!DB(n)||!DB(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(u=o,a.lt(c))for(l=o;l.lte(c);l=l.plus(o))u=u.times(a.plus(l)).dividedBy(l);else for(l=o;l.lte(a);l=l.plus(o))u=u.times(c.plus(l)).dividedBy(l);return u}})});function DB(e){return e.isInteger()&&e.gte(0)}var SB="combinationsWithRep",$G=["typed"],Pg=F(SB,$G,e=>{var{typed:r}=e;return r(SB,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:u}=e;function l(o){if(o.im===0)return _c(o.re);if(o.re<.5){var s=new u(1-o.re,-o.im),m=new u(Math.PI*o.re,Math.PI*o.im);return new u(Math.PI).div(m.sin()).div(l(s))}o=new u(o.re-1,o.im);for(var d=new u(Ts[0],0),h=1;h2;)d-=2,x+=d,h=h.times(x);return new i(h.toPrecision(i.precision))}});var MB="lgamma",VG=["Complex","typed"],Rg=F(MB,VG,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(MB,{number:Oc,Complex:u,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function u(o){var s=6.283185307179586,m=1.1447298858494002,d=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(Oc(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return l(o);if(o.re<=d){var h=nM(s,o.im)*Math.floor(.5*o.re+.25),x=o.mul(Math.PI).sin().log(),v=u(new r(1-o.re,-o.im));return new r(m,h).sub(x).sub(v)}else return o.im>=0?c(o):c(o.conjugate()).conjugate()}function l(o){for(var s=o.sub(.5).mul(o.log()).sub(o).add(Hw),m=new r(1,0).div(o),d=m.div(o),h=i[0],x=i[1],v=2*d.re,y=d.re*d.re+d.im*d.im,w=2;w<8;w++){var C=x;x=-y*h+i[w],h=v*h+C}var b=m.mul(d.mul(h).add(x));return s.add(b)}function c(o){var s=0,m=0,d=o;for(o=o.add(1);o.re<=n;){d=d.mul(o);var h=d.im<0?1:0;h!==0&&m===0&&s++,m=h,o=o.add(1)}return l(o).sub(d.log()).sub(new r(0,s*2*Math.PI*1))}});var CB="factorial",ZG=["typed","gamma"],kg=F(CB,ZG,e=>{var{typed:r,gamma:t}=e;return r(CB,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var EB="kldivergence",QG=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],qg=F(EB,QG,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:u,dotDivide:l,log:c,isNumeric:o}=e;return r(EB,{"Array, Array":function(d,h){return s(t(d),t(h))},"Matrix, Array":function(d,h){return s(d,t(h))},"Array, Matrix":function(d,h){return s(t(d),h)},"Matrix, Matrix":function(d,h){return s(d,h)}});function s(m,d){var h=d.size().length,x=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(x>1)throw new Error("second object must be one dimensional");if(h!==x)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var y=a(d);if(y===0)throw new Error("Sum of elements in second object must be non zero");var w=n(m,a(m)),C=n(d,a(d)),b=a(i(w,u(l(w,C),M=>c(M))));return o(b)?b:Number.NaN}});var TB="multinomial",XG=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Lg=F(TB,XG,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:u,isPositive:l}=e;return r(TB,{"Array | Matrix":function(o){var s=0,m=1;return An(o,function(d){if(!u(d)||!l(d))throw new TypeError("Positive integer value expected in function multinomial");s=t(s,d),m=a(m,i(d))}),n(i(s),m)}})});var FB="permutations",JG=["typed","factorial"],zg=F(FB,JG,e=>{var{typed:r,factorial:t}=e;return r(FB,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return da(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var u,l;if(!_B(a)||!_B(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var c=a.mul(0).add(1);for(u=c,l=a.minus(i).plus(1);l.lte(a);l=l.plus(1))u=u.times(l);return u}})});function _B(e){return e.isInteger()&&e.gte(0)}var _D=ca(ZB(),1),aV=(0,_D.default)(Date.now());function to(e){var r;function t(a){r=a===null?aV:(0,_D.default)(String(a))}t(e);function n(){return r()}return n}var QB="pickRandom",iV=["typed","config","?on"],Wg=F(QB,iV,e=>{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(u,l){u.randomSeed!==l.randomSeed&&(a=to(u.randomSeed))}),r(QB,{"Array | Matrix":function(l){return i(l,{})},"Array | Matrix, Object":function(l,c){return i(l,c)},"Array | Matrix, number":function(l,c){return i(l,{number:c})},"Array | Matrix, Array | Matrix":function(l,c){return i(l,{weights:c})},"Array | Matrix, Array | Matrix, number":function(l,c,o){return i(l,{number:o,weights:c})},"Array | Matrix, number, Array | Matrix":function(l,c,o){return i(l,{number:c,weights:o})}});function i(u,l){var{number:c,weights:o,elementWise:s=!0}=l,m=typeof c>"u";m&&(c=1);var d=Qe(u)?u.create:Qe(o)?o.create:null;u=u.valueOf(),o&&(o=o.valueOf()),s===!0&&(u=gr(u),o=gr(o));var h=0;if(typeof o<"u"){if(o.length!==u.length)throw new Error("Weights must have the same length as possibles");for(var x=0,v=o.length;x"u")C=u[Math.floor(a()*y)];else for(var b=a()*h,M=0,A=u.length;M1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=to(l.randomSeed))}),r(XB,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=kc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return l+a()*(c-l)}});var JB="randomInt",sV=["typed","config","?on"],Hg=F(JB,sV,e=>{var{typed:r,config:t,on:n}=e,a=to(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=to(l.randomSeed))}),r(JB,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=kc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return Math.floor(l+a()*(c-l))}});var KB="stirlingS2",uV=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],$g=F(KB,uV,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:u,factorial:l,combinations:c,isNegative:o,isInteger:s,number:m,bignumber:d,larger:h}=e,x=[],v=[];return r(KB,{"number | BigNumber, number | BigNumber":function(w,C){if(!s(w)||o(w)||!s(C)||o(C))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(C,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(sr(w)&&sr(C)),M=b?v:x,A=b?d:m,S=m(w),O=m(C);if(M[S]&&M[S].length>O)return M[S][O];for(var _=0;_<=S;++_)if(M[_]||(M[_]=[A(_===0?1:0)]),_!==0)for(var E=M[_],T=M[_-1],R=E.length;R<=_&&R<=O;++R)R===_?E[R]=1:E[R]=t(a(A(R),T[R]),T[R-1]);return M[S][O]}})});var jB="bellNumbers",fV=["typed","addScalar","isNegative","isInteger","stirlingS2"],Gg=F(jB,fV,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(jB,{"number | BigNumber":function(l){if(!a(l)||n(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,o=0;o<=l;o++)c=t(c,i(l,o));return c}})});var eP="catalan",cV=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Vg=F(eP,cV,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:u,isInteger:l}=e;return r(eP,{"number | BigNumber":function(o){if(!l(o)||u(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var rP="composition",lV=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Zg=F(rP,lV,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:u,larger:l}=e;return r(rP,{"number | BigNumber, number | BigNumber":function(o,s){if(!u(o)||!a(o)||!u(s)||!a(s))throw new TypeError("Positive integer value expected in function composition");if(l(s,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(s,-1))}})});var tP="leafCount",mV=["parse","typed"],Qg=F(tP,mV,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(u=>{i+=n(u)}),i||1}return t(tP,{Node:function(i){return n(i)}})});function OD(e){return yr(e)||ct(e)&&e.isUnary()&&yr(e.args[0])}function qc(e){return!!(yr(e)||(gn(e)||ct(e))&&e.args.every(qc)||en(e)&&qc(e.content))}function nP(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function BD(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,u="defaultF",l={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},c={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function s(b,M){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,S=u;if(typeof b=="string"?S=b:ct(b)?S=b.fn.toString():gn(b)?S=b.name:en(b)&&(S="paren"),Xe(A,S)){var O=A[S];if(Xe(O,M))return O[M];if(Xe(l,S))return l[S][M]}if(Xe(A,u)){var _=A[u];return Xe(_,M)?_[M]:l[u][M]}if(Xe(l,S)){var E=l[S];if(Xe(E,M))return E[M]}return l[u][M]}function m(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"commutative",M)}function d(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"associative",M)}function h(b,M){var A=BD({},b);for(var S in M)Xe(b,S)?A[S]=BD(BD({},M[S]),b[S]):A[S]=M[S];return A}function x(b,M){if(!b.args||b.args.length===0)return b;b.args=v(b,M);for(var A=0;A2&&d(b,M)){for(var _=b.args.pop();b.args.length>0;)_=A([b.args.pop(),_]);b.args=_.args}}}function w(b,M){if(!(!b.args||b.args.length===0)){for(var A=C(b),S=b.args.length,O=0;O2&&d(b,M)){for(var _=b.args.shift();b.args.length>0;)_=A([_,b.args.shift()]);b.args=_.args}}}function C(b){return ct(b)?function(M){try{return new t(b.op,b.fn,M,b.implicit)}catch(A){return console.error(A),[]}}:function(M){return new r(new n(b.name),M)}}return{createMakeNodeFunction:C,hasProperty:s,isCommutative:m,isAssociative:d,mergeContext:h,flatten:x,allChildren:v,unflattenr:y,unflattenl:w,defaultContext:l,realContext:c,positiveContext:o}});var hV="simplify",vV=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Xg=F(hV,vV,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:u,divide:l,pow:c,isZero:o,equal:s,resolve:m,simplifyConstant:d,simplifyCore:h,fraction:x,bignumber:v,mathWithTransform:y,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:M,FunctionNode:A,IndexNode:S,ObjectNode:O,OperatorNode:_,ParenthesisNode:E,SymbolNode:T}=e,{hasProperty:R,isCommutative:q,isAssociative:W,mergeContext:G,flatten:H,unflattenr:L,unflattenl:k,createMakeNodeFunction:K,defaultContext:z,realContext:oe,positiveContext:pe}=cf({FunctionNode:A,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:Ki});var ae=t("simplify",{Node:xe,"Node, Map":(j,ne)=>xe(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>xe(j,!1,ne,ue),"Node, Array":xe,"Node, Array, Map":xe,"Node, Array, Map, Object":xe});t.removeConversion({from:"Object",to:"Map",convert:Ki}),ae.defaultContext=z,ae.realContext=oe,ae.positiveContext=pe;function $(j){return j.transform(function(ne,ue,Me){return en(ne)?$(ne.content):ne})}var le={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ee(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in j&&(ue[Ce]=j[Ce]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),W(ue.l,ne)){var Le=!q(ue.l,ne),Ie;Le&&(Ie=Se());var fr=K(ue.l),or=Se();ue.expanded={},ue.expanded.l=fr([ue.l,or]),H(ue.expanded.l,ne),L(ue.expanded.l,ne),ue.expanded.r=fr([ue.r,or]),Le&&(ue.expandedNC1={},ue.expandedNC1.l=fr([Ie,ue.l]),ue.expandedNC1.r=fr([Ie,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=fr([Ie,ue.expanded.l]),ue.expandedNC2.r=fr([Ie,ue.expanded.r]))}return ue}function me(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:Oo(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Me.consoleDebug;ne=me(ne||ae.rules,Me.context);var Le=m(j,ue);Le=$(Le);for(var Ie={},fr=Le.toString({parenthesis:"all"});!Ie[fr];){Ie[fr]=!0,ge=0;var or=fr;Ce&&console.log("Working on: ",fr);for(var Ke=0;Ke ").concat(ne[Ke].r.toString()))),Ce){var ee=Le.toString({parenthesis:"all"});ee!==or&&(console.log("Applying",Pr,"produced",ee),or=ee)}k(Le,Me.context)}fr=Le.toString({parenthesis:"all"})}return Le}function be(j,ne,ue){var Me=j;if(j)for(var Ce=0;Ce1&&(or=Le(j.args.slice(0,fr))),Ce=j.args.slice(fr),Me=Ce.length===1?Ce[0]:Le(Ce),ue.push(Le([or,Me]))}return ue}function We(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!ye(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ce in ne.placeholders)Xe(ne.placeholders,Ce)&&(ue.placeholders[Ce]=ne.placeholders[Ce]);return ue}function Je(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var or=re(j.args[0],ne.args[1],ue);if(or.length===0)return[];var Ke=re(j.args[1],ne.args[0],ue);if(Ke.length===0)return[];Le=[or,Ke]}Ce=J(Le)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],ce=0;ce2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(le[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ce[0].placeholders[j.name]=ne;break;case"c":case"cl":if(yr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"v":if(!yr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vl":if(at(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"cd":if(OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ce":if(qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof M){if(!s(j.value,ne.value))return[]}else return[];return Ce}function ye(j,ne){if(j instanceof M&&ne instanceof M){if(!s(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof A&&ne instanceof A){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof A&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:u,AccessorNode:l,ArrayNode:c,ConstantNode:o,FunctionNode:s,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:x}=e,{isCommutative:v,isAssociative:y,allChildren:w,createMakeNodeFunction:C}=cf({FunctionNode:s,OperatorNode:h,SymbolNode:x}),b=r("simplifyConstant",{Node:H=>O(G(H,{})),"Node, Object":function(L,k){return O(G(L,k))}});function M(H){return ma(H)?H.valueOf():H instanceof Array?H.map(M):Qe(H)?a(M(H.valueOf())):H}function A(H,L,k){try{return n[H].apply(null,L)}catch{return L=L.map(M),E(n[H].apply(null,L),k)}}var S=r({Fraction:R,number:function(L){return L<0?T(new o(-L)):new o(L)},BigNumber:function(L){return L<0?T(new o(-L)):new o(L)},Complex:function(L){throw new Error("Cannot convert Complex number to Node")},string:function(L){return new o(L)},Matrix:function(L){return new c(L.valueOf().map(k=>S(k)))}});function O(H){return Nr(H)?H:S(H)}function _(H,L){var k=L&&L.exactFractions!==!1;if(k&&isFinite(H)&&i){var K=i(H),z=L&&typeof L.fractionsLimit=="number"?L.fractionsLimit:1/0;if(K.valueOf()===H&&K.n0;)if(yr(K[0])&&typeof K[0].value!="string"){var z=E(K.shift().value,k);jt(H)?H=H.items[z-1]:(H=H.valueOf()[z-1],H instanceof Array&&(H=a(H)))}else if(K.length>1&&yr(K[1])&&typeof K[1].value!="string"){var oe=E(K[1].value,k),pe=[],ae=jt(H)?H.items:H.valueOf();for(var $ of ae)if(jt($))pe.push($.items[oe-1]);else if(Qe(H))pe.push($[oe-1]);else break;if(pe.length===ae.length)jt(H)?H=new c(pe):H=a(pe),K.splice(1,1);else break}else break;return K.length===L.dimensions.length?new l(O(H),L):K.length>0?(L=new m(K),new l(O(H),L)):H}if(Ci(H)&&L.dimensions.length===1&&yr(L.dimensions[0])){var le=L.dimensions[0].value;return le in H.properties?H.properties[le]:new o}return new l(O(H),L)}function W(H,L,k,K){var z=L.shift(),oe=L.reduce((pe,ae)=>{if(!Nr(ae)){var $=pe.pop();if(Nr($))return[$,ae];try{return pe.push(A(H,[$,ae],K)),pe}catch{pe.push($)}}pe.push(O(pe.pop()));var le=pe.length===1?pe[0]:k(pe);return[k([le,O(ae)])]},[z]);return oe.length===1?oe[0]:k([oe[0],S(oe[1])])}function G(H,L){switch(H.type){case"SymbolNode":return H;case"ConstantNode":switch(typeof H.value){case"number":return E(H.value,L);case"string":return H.value;default:if(!isNaN(H.value))return E(H.value,L)}return H;case"FunctionNode":if(n[H.name]&&n[H.name].rawArgs)return H;{var k=["add","multiply"];if(k.indexOf(H.name)===-1){var K=H.args.map(De=>G(De,L));if(!K.some(Nr))try{return A(H.name,K,L)}catch{}if(H.name==="size"&&K.length===1&&jt(K[0])){for(var z=[],oe=K[0];jt(oe);)z.push(oe.items.length),oe=oe.items[0];return a(z)}return new s(H.name,K.map(O))}}case"OperatorNode":{var pe=H.fn.toString(),ae,$,le=C(H);if(ct(H)&&H.isUnary())ae=[G(H.args[0],L)],Nr(ae[0])?$=le(ae):$=A(pe,ae,L);else if(y(H,L.context))if(ae=w(H,L.context),ae=ae.map(De=>G(De,L)),v(pe,L.context)){for(var Ee=[],me=[],ge=0;ge1?($=W(pe,Ee,le,L),me.unshift($),$=W(pe,me,le,L)):$=W(pe,ae,le,L)}else $=W(pe,ae,le,L);else ae=H.args.map(De=>G(De,L)),$=W(pe,ae,le,L);return $}case"ParenthesisNode":return G(H.content,L);case"AccessorNode":return q(G(H.object,L),G(H.index,L),L);case"ArrayNode":{var Se=H.items.map(De=>G(De,L));return Se.some(Nr)?new c(Se.map(O)):a(Se)}case"IndexNode":return new m(H.dimensions.map(De=>b(De,L)));case"ObjectNode":{var xe={};for(var be in H.properties)xe[be]=b(H.properties[be],L);return new d(xe)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(H.type))}}return b});var aP="simplifyCore",yV=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Kg=F(aP,yV,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,AccessorNode:s,ArrayNode:m,ConstantNode:d,FunctionNode:h,IndexNode:x,ObjectNode:v,OperatorNode:y,ParenthesisNode:w,SymbolNode:C}=e,b=new d(0),M=new d(1),A=new d(!0),S=new d(!1);function O(R){return ct(R)&&["and","not","or"].includes(R.op)}var{hasProperty:_,isCommutative:E}=cf({FunctionNode:h,OperatorNode:y,SymbolNode:C});function T(R){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=q?q.context:void 0;if(_(R,"trivial",W)){if(gn(R)&&R.args.length===1)return T(R.args[0],q);var G=!1,H=0;if(R.forEach(me=>{++H,H===1&&(G=T(me,q))}),H===1)return G}var L=R;if(gn(L)){var k=rT(L.name);if(k){if(L.args.length>2&&_(L,"associative",W))for(;L.args.length>2;){var K=L.args.pop(),z=L.args.pop();L.args.push(new y(k,L.name,[K,z]))}L=new y(k,L.name,L.args)}else return new h(T(L.fn),L.args.map(me=>T(me,q)))}if(ct(L)&&L.isUnary()){var oe=T(L.args[0],q);if(L.op==="~"&&ct(oe)&&oe.isUnary()&&oe.op==="~"||L.op==="not"&&ct(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var pe=!0;if(L.op==="-"&&ct(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(L=new y("-","subtract",[oe.args[1],oe.args[0]]),pe=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(pe)return new y(L.op,L.fn,[oe])}if(ct(L)&&L.isBinary()){var ae=T(L.args[0],q),$=T(L.args[1],q);if(L.op==="+"){if(yr(ae)&&a(ae.value))return $;if(yr($)&&a($.value))return ae;ct($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],L=new y("-","subtract",[ae,$]))}if(L.op==="-")return ct($)&&$.isUnary()&&$.op==="-"?T(new y("+","add",[ae,$.args[0]]),q):yr(ae)&&a(ae.value)?T(new y("-","unaryMinus",[$])):yr($)&&a($.value)?ae:new y(L.op,L.fn,[ae,$]);if(L.op==="*"){if(yr(ae)){if(a(ae.value))return b;if(n(ae.value,1))return $}if(yr($)){if(a($.value))return b;if(n($.value,1))return ae;if(E(L,W))return new y(L.op,L.fn,[$,ae],L.implicit)}return new y(L.op,L.fn,[ae,$],L.implicit)}if(L.op==="/")return yr(ae)&&a(ae.value)?b:yr($)&&n($.value,1)?ae:new y(L.op,L.fn,[ae,$]);if(L.op==="^"&&yr($)){if(a($.value))return M;if(n($.value,1))return ae}if(L.op==="and"){if(yr(ae))if(ae.value){if(O($))return $;if(yr($))return $.value?A:S}else return S;if(yr($))if($.value){if(O(ae))return ae}else return S}if(L.op==="or"){if(yr(ae)){if(ae.value)return A;if(O($))return $}if(yr($)){if($.value)return A;if(O(ae))return ae}}return new y(L.op,L.fn,[ae,$])}if(ct(L))return new y(L.op,L.fn,L.args.map(me=>T(me,q)));if(jt(L))return new m(L.items.map(me=>T(me,q)));if(qn(L))return new s(T(L.object,q),T(L.index,q));if(Qn(L))return new x(L.dimensions.map(me=>T(me,q)));if(Ci(L)){var le={};for(var Ee in L.properties)le[Ee]=T(L.properties[Ee],q);return new v(le)}return L}return r(aP,{Node:T,"Node,Object":T})});var bV="resolve",wV=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],jg=F(bV,wV,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:u}=e;function l(c,o){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return c;if(at(c)){if(s.has(c.name)){var m=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var d=o.get(c.name);if(Nr(d)){var h=new Set(s);return h.add(c.name),l(d,o,h)}else return typeof d=="number"?t(String(d)):d!==void 0?new n(d):c}else if(ct(c)){var x=c.args.map(function(y){return l(y,o,s)});return new i(c.op,c.fn,x,c.implicit)}else{if(en(c))return new u(l(c.content,o,s));if(gn(c)){var v=c.args.map(function(y){return l(y,o,s)});return new a(c.name,v)}}return c.map(y=>l(y,o,s))}return r("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(c,o)=>l(c,Ki(o)),"Array | Matrix":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array | Matrix, null | undefined":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array, Object":r.referTo("Array,Map",c=>(o,s)=>c(o,Ki(s))),"Matrix, Object":r.referTo("Matrix,Map",c=>(o,s)=>c(o,Ki(s))),"Array | Matrix, Map":r.referToSelf(c=>(o,s)=>o.map(m=>c(m,s)))})});var iP="symbolicEqual",DV=["parse","simplify","typed","OperatorNode"],e0=F(iP,DV,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(u,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[u,l]),s=t(o,{},c);return yr(s)&&!s.value}return n(iP,{"Node, Node":i,"Node, Node, Object":i})});var oP="derivative",SV=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],r0=F(oP,SV,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:u,numeric:l,ConstantNode:c,FunctionNode:o,OperatorNode:s,ParenthesisNode:m,SymbolNode:d}=e;function h(b,M){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};y(S,b,M.name);var O=w(b,S);return A.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var x=r(oP,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),x._simplify=!0,x.toTex=function(b){return v.apply(null,b.args)};var v=r("_derivTex",{"Node, SymbolNode":function(M,A){return yr(M)&&Fr(M.value)==="string"?v(n(M.value).toString(),A.toString(),1):v(M.toTex(),A.toString(),1)},"Node, ConstantNode":function(M,A){if(Fr(A.value)==="string")return v(M,n(A.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(M,A,S){return v(M.toString(),A.name,S.value)},"string, string, number":function(M,A,S){var O;return S===1?O="{d\\\\over d"+A+"}":O="{d^{"+S+"}\\\\over d"+A+"^{"+S+"}}",O+"\\\\left[".concat(M,"\\\\right]")}}),y=r("constTag",{"Object, ConstantNode, string":function(M,A){return M[A]=!0,!0},"Object, SymbolNode, string":function(M,A,S){return A.name!==S?(M[A]=!0,!0):!1},"Object, ParenthesisNode, string":function(M,A,S){return y(M,A.content,S)},"Object, FunctionAssignmentNode, string":function(M,A,S){return A.params.indexOf(S)===-1?(M[A]=!0,!0):y(M,A.expr,S)},"Object, FunctionNode | OperatorNode, string":function(M,A,S){if(A.args.length>0){for(var O=y(M,A.args[0],S),_=1;_0){var O=M.args.filter(function(H){return A[H]===void 0}),_=O.length===1?O[0]:new s("*","multiply",O),E=S.concat(w(_,A));return new s("*","multiply",E)}return new s("+","add",M.args.map(function(H){return new s("*","multiply",M.args.map(function(L){return L===H?w(L,A):L.clone()}))}))}if(M.op==="/"&&M.isBinary()){var T=M.args[0],R=M.args[1];return A[R]!==void 0?new s("/","divide",[w(T,A),R]):A[T]!==void 0?new s("*","multiply",[new s("-","unaryMinus",[T]),new s("/","divide",[w(R,A),new s("^","pow",[R.clone(),C(2)])])]):new s("/","divide",[new s("-","subtract",[new s("*","multiply",[w(T,A),R.clone()]),new s("*","multiply",[T.clone(),w(R,A)])]),new s("^","pow",[R.clone(),C(2)])])}if(M.op==="^"&&M.isBinary()){var q=M.args[0],W=M.args[1];if(A[q]!==void 0)return yr(q)&&(u(q.value)||i(q.value,1))?C(0):new s("*","multiply",[M,new s("*","multiply",[new o("log",[q.clone()]),w(W.clone(),A)])]);if(A[W]!==void 0){if(yr(W)){if(u(W.value))return C(0);if(i(W.value,1))return w(q,A)}var G=new s("^","pow",[q.clone(),new s("-","subtract",[W,C(1)])]);return new s("*","multiply",[W.clone(),new s("*","multiply",[w(q,A),G])])}return new s("*","multiply",[new s("^","pow",[q.clone(),W.clone()]),new s("+","add",[new s("*","multiply",[w(q,A),new s("/","divide",[W.clone(),q.clone()])]),new s("*","multiply",[w(W,A),new o("log",[q.clone()])])])])}throw new Error('Cannot process operator "'+M.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function C(b,M){return new c(l(b,M||t.number))}return x});var sP="rationalize",NV=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],t0=F(sP,NV,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,parse:s,simplifyConstant:m,simplifyCore:d,simplify:h,fraction:x,bignumber:v,mathWithTransform:y,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:M,FunctionNode:A,IndexNode:S,ObjectNode:O,OperatorNode:_,SymbolNode:E,ParenthesisNode:T}=e;function R(L){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,z=W(),oe=q(L,k,!0,z.firstRules),pe=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(L=oe.expression,pe>=1){L=G(L);var le,Ee,me=!0,ge=!1;L=h(L,z.firstRules,{},ae);for(var Se;Ee=me?z.distrDivRules:z.sucDivRules,L=h(L,Ee,{},$),me=!me,Se=L.toString(),Se!==le;)ge=!0,le=Se;ge&&(L=h(L,z.firstRulesAgain,{},ae)),L=h(L,z.finalRules,{},ae)}var xe=[],be={};return L.type==="OperatorNode"&&L.isBinary()&&L.op==="/"?(pe===1&&(L.args[0]=H(L.args[0],xe),L.args[1]=H(L.args[1])),K&&(be.numerator=L.args[0],be.denominator=L.args[1])):(pe===1&&(L=H(L,xe)),K&&(be.numerator=L,be.denominator=null)),K?(be.coefficients=xe,be.variables=oe.variables,be.expression=L,be):L}return t(sP,{Node:R,"Node, boolean":(L,k)=>R(L,{},k),"Node, Object":R,"Node, Object, boolean":R});function q(L,k,K,z){var oe=[],pe=h(L,z,k,{exactFractions:!1});K=!!K;var ae="+-*"+(K?"/":"");le(pe);var $={};return $.expression=pe,$.variables=oe,$;function le(Ee){var me=Ee.type;if(me==="FunctionNode")throw new Error("There is an unsolved function call");if(me==="OperatorNode")if(Ee.op==="^"){if(Ee.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ee.args[1].value)))throw new Error("There is a non-integer exponent");le(Ee.args[0])}else{if(ae.indexOf(Ee.op)===-1)throw new Error("Operator "+Ee.op+" invalid in polynomial expression");for(var ge=0;ge1;if(z==="OperatorNode"&&L.isBinary()){var pe=!1,ae;if(L.op==="^"&&(L.args[0].type==="ParenthesisNode"||L.args[0].type==="OperatorNode")&&L.args[1].type==="ConstantNode"&&(ae=parseFloat(L.args[1].value),pe=ae>=2&&Ze(ae)),pe){if(ae>2){var $=L.args[0],le=new _("^","pow",[L.args[0].cloneDeep(),new M(ae-1)]);L=new _("*","multiply",[$,le])}else L=new _("*","multiply",[L.args[0],L.args[0].cloneDeep()]);oe&&(K==="content"?k.content=L:k.args[K]=L)}}if(z==="ParenthesisNode")G(L.content,L,"content");else if(z!=="ConstantNode"&&z!=="SymbolNode")for(var Ee=0;Ee=0;$--)if(k[$]!==0){var le=new M(pe?k[$]:Math.abs(k[$])),Ee=k[$]<0?"-":"+";if($>0){var me=new E(oe);if($>1){var ge=new M($);me=new _("^","pow",[me,ge])}k[$]===-1&&pe?le=new _("-","unaryMinus",[me]):Math.abs(k[$])===1?le=me:le=new _("*","multiply",[le,me])}pe?ae=le:Ee==="+"?ae=new _("+","add",[ae,le]):ae=new _("-","subtract",[ae,le]),pe=!1}if(pe)return new M(0);return ae;function Se(xe,be,De){var Ae=xe.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(xe.op)===-1)throw new Error("Operator "+xe.op+" invalid");if(be!==null){if((xe.fn==="unaryMinus"||xe.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+xe.op+" placing");if((xe.fn==="subtract"||xe.fn==="add"||xe.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+xe.op+" placing");if((xe.fn==="subtract"||xe.fn==="add"||xe.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+xe.op+" placing")}(xe.op==="^"||xe.op==="*")&&(De.fire=xe.op);for(var We=0;Wez&&(k[Je]=0),k[Je]+=De.cte*(De.oper==="+"?1:-1),z=Math.max(Je,z);return}De.cte=Je,De.fire===""&&(k[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var uP="zpk2tf",AV=["typed","add","multiply","Complex","number"],n0=F(uP,AV,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(uP,{"Array,Array,number":function(o,s,m){return u(o,s,m)},"Array,Array":function(o,s){return u(o,s,1)},"Matrix,Matrix,number":function(o,s,m){return u(o.valueOf(),s.valueOf(),m)},"Matrix,Matrix":function(o,s){return u(o.valueOf(),s.valueOf(),1)}});function u(c,o,s){c.some(C=>C.type==="BigNumber")&&(c=c.map(C=>i(C))),o.some(C=>C.type==="BigNumber")&&(o=o.map(C=>i(C)));for(var m=[a(1,0)],d=[a(1,0)],h=0;h=0&&m-d{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:u}=e;return r(fP,{"Array, Array":function(s,m){var d=c(512);return l(s,m,d)},"Array, Array, Array":function(s,m,d){return l(s,m,d)},"Array, Array, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d);return l(s,m,h)},"Matrix, Matrix":function(s,m){var d=c(512),{w:h,h:x}=l(s.valueOf(),m.valueOf(),d);return{w:u(h),h:u(x)}},"Matrix, Matrix, Matrix":function(s,m,d){var{h}=l(s.valueOf(),m.valueOf(),d.valueOf());return{h:u(h),w:u(d)}},"Matrix, Matrix, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d),{h:x}=l(s.valueOf(),m.valueOf(),h);return{h:u(x),w:u(h)}}});function l(o,s,m){for(var d=[],h=[],x=0;x{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var TV="replacer",FV=[],o0=F(TV,FV,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var cP="12.4.1";var s0=F("true",[],()=>!0),u0=F("false",[],()=>!1),f0=F("null",[],()=>null),c0=va("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),l0=va("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),m0=va("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Ic(t):HM}),p0=va("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?mE(t):$M}),d0=va("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?cE(t):GM}),h0=va("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?lE(t):VM}),v0=va("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),g0=va("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),x0=va("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),y0=va("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),b0=va("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),w0=va("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),D0=va("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),lP=F("PI",["pi"],e=>{var{pi:r}=e;return r}),mP=F("E",["e"],e=>{var{e:r}=e;return r}),S0=F("version",[],()=>cP);function va(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var N0=Er("speedOfLight","299792458","m s^-1"),A0=Er("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),M0=Er("planckConstant","6.62607015e-34","J s"),C0=Er("reducedPlanckConstant","1.0545718176461565e-34","J s"),E0=Er("magneticConstant","1.25663706212e-6","N A^-2"),T0=Er("electricConstant","8.8541878128e-12","F m^-1"),F0=Er("vacuumImpedance","376.730313667","ohm"),_0=Er("coulomb","8.987551792261171e9","N m^2 C^-2"),O0=Er("elementaryCharge","1.602176634e-19","C"),B0=Er("bohrMagneton","9.2740100783e-24","J T^-1"),P0=Er("conductanceQuantum","7.748091729863649e-5","S"),I0=Er("inverseConductanceQuantum","12906.403729652257","ohm"),R0=Er("magneticFluxQuantum","2.0678338484619295e-15","Wb"),k0=Er("nuclearMagneton","5.0507837461e-27","J T^-1"),q0=Er("klitzing","25812.807459304513","ohm");var L0=Er("bohrRadius","5.29177210903e-11","m"),z0=Er("classicalElectronRadius","2.8179403262e-15","m"),U0=Er("electronMass","9.1093837015e-31","kg"),W0=Er("fermiCoupling","1.1663787e-5","GeV^-2"),Y0=bx("fineStructure",.0072973525693),H0=Er("hartreeEnergy","4.3597447222071e-18","J"),$0=Er("protonMass","1.67262192369e-27","kg"),G0=Er("deuteronMass","3.3435830926e-27","kg"),V0=Er("neutronMass","1.6749271613e-27","kg"),Z0=Er("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Q0=Er("rydberg","10973731.568160","m^-1"),X0=Er("thomsonCrossSection","6.6524587321e-29","m^2"),J0=bx("weakMixingAngle",.2229),K0=bx("efimovFactor",22.7),j0=Er("atomicMass","1.66053906660e-27","kg"),ex=Er("avogadro","6.02214076e23","mol^-1"),rx=Er("boltzmann","1.380649e-23","J K^-1"),tx=Er("faraday","96485.33212331001","C mol^-1"),nx=Er("firstRadiation","3.7417718521927573e-16","W m^2"),ax=Er("loschmidt","2.686780111798444e25","m^-3"),ix=Er("gasConstant","8.31446261815324","J K^-1 mol^-1"),ox=Er("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),sx=Er("molarVolume","0.022413969545014137","m^3 mol^-1"),ux=bx("sackurTetrode",-1.16487052358),fx=Er("secondRadiation","0.014387768775039337","m K"),cx=Er("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),lx=Er("wienDisplacement","2.897771955e-3","m K"),mx=Er("molarMass","0.99999999965e-3","kg mol^-1"),px=Er("molarMassC12","11.9999999958e-3","kg mol^-1"),dx=Er("gravity","9.80665","m s^-2"),hx=Er("planckLength","1.616255e-35","m"),vx=Er("planckMass","2.176435e-8","kg"),gx=Er("planckTime","5.391245e-44","s"),xx=Er("planckCharge","1.87554603778e-18","C"),yx=Er("planckTemperature","1.416785e+32","K");function Er(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:u,BigNumber:l}=a,c=i.number==="BigNumber"?new l(r):parseFloat(r),o=new u(c,t);return o.fixPrefix=!0,o})}function bx(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var _V="apply",OV=["typed","isInteger"],wx=F(_V,OV,e=>{var{typed:r,isInteger:t}=e,n=qo({typed:r,isInteger:t});return r("apply",{"...any":function(i){var u=i[1];sr(u)?i[1]=u-1:rr(u)&&(i[1]=u.minus(1));try{return n.apply(null,i)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var BV="column",PV=["typed","Index","matrix","range"],Dx=F(BV,PV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Wu({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});function lf(e,r,t){var n=e.filter(function(c){return at(c)&&!(c.name in r)&&!t.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,u=new Eu(t,i,new Set([a])),l=e.compile();return function(o){return i.set(a,o),l.evaluate(u)}}var IV="filter",RV=["typed"],Sx=F(IV,RV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("filter",{"Array, function":pP,"Matrix, function":function(i,u){return i.create(pP(i.toArray(),u))},"Array, RegExp":Mu,"Matrix, RegExp":function(i,u){return i.create(Mu(i.toArray(),u))}});return t},{isTransformFunction:!0});function pP(e,r){return Om(e,function(t,n,a){return Ia(r,t,[n+1],a,"filter")})}var kV="forEach",qV=["typed"],Nx=F(kV,qV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,u){var l=function c(o,s){if(Array.isArray(o))Fo(o,function(m,d){c(m,s.concat(d+1))});else return Ia(u,o,s,i,"forEach")};l(i.valueOf(),[])}});return t},{isTransformFunction:!0});var LV="index",zV=["Index","getMatrixDataType"],Ax=F(LV,zV,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,u=arguments.length;i0?0:2;else if(l&&l.isSet===!0)l=l.map(function(o){return o-1});else if(Mr(l)||Qe(l))t(l)!=="boolean"&&(l=l.map(function(o){return o-1}));else if(sr(l))l--;else if(rr(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=l}var c=new r;return r.apply(c,a),c}},{isTransformFunction:!0});var UV="map",WV=["typed"],Mx=F(UV,WV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||_a(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,u){return dP(i,u,i)},"Matrix, function":function(i,u){return i.create(dP(i.valueOf(),u,i))}});return t},{isTransformFunction:!0});function dP(e,r,t){function n(a,i){return Array.isArray(a)?Xn(a,function(u,l){return n(u,i.concat(l+1))}):Ia(r,a,i,t,"map")}return n(e,[])}function Cn(e){if(e.length===2&&Nt(e[0])){e=e.slice();var r=e[1];sr(r)?e[1]=r-1:rr(r)&&(e[1]=r.minus(1))}return e}var YV="max",HV=["typed","config","numeric","larger"],Cx=F(YV,HV,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=ef({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var $V="mean",GV=["typed","add","divide"],Ex=F($V,GV,e=>{var{typed:r,add:t,divide:n}=e,a=of({typed:r,add:t,divide:n});return r("mean",{"...any":function(u){u=Cn(u);try{return a.apply(null,u)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var VV="min",ZV=["typed","config","numeric","smaller"],Tx=F(VV,ZV,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=rf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var QV="range",XV=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Fx=F(QV,XV,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s}=e,m=$u({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s});return r("range",{"...any":function(h){var x=h.length-1,v=h[x];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var JV="row",KV=["typed","Index","matrix","range"],_x=F(JV,KV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Gu({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});var jV="subset",eZ=["typed","matrix","zeros","add"],Ox=F(jV,eZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Vu({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(l){try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var rZ="concat",tZ=["typed","matrix","isInteger"],Bx=F(rZ,tZ,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Uu({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(u){var l=u.length-1,c=u[l];sr(c)?u[l]=c-1:rr(c)&&(u[l]=c.minus(1));try{return a.apply(null,u)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var hP="diff",nZ=["typed","matrix","subtract","number","bignumber"],Px=F(hP,nZ,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,u=Yu({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(hP,{"...any":function(c){c=Cn(c);try{return u.apply(null,c)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var aZ="std",iZ=["typed","map","sqrt","variance"],Ix=F(aZ,iZ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=ff({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var vP="sum",oZ=["typed","config","add","numeric"],Rx=F(vP,oZ,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=nf({typed:r,config:t,add:n,numeric:a});return r(vP,{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var sZ="quantileSeq",uZ=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],kx=F(sZ,uZ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=uf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,y,w)=>h(v,y,x(w)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,y,w,C)=>h(v,y,w,x(C)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,y,w)=>h(v,y,x(w)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,y,w,C)=>h(v,y,w,x(C))});function x(v){return Cn([[],v])[1]}},{isTransformFunction:!0});var gP="cumsum",fZ=["typed","add","unaryPlus"],qx=F(gP,fZ,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=af({typed:r,add:t,unaryPlus:n});return r(gP,{"...any":function(u){if(u.length===2&&Nt(u[0])){var l=u[1];sr(l)?u[1]=l-1:rr(l)&&(u[1]=l.minus(1))}try{return a.apply(null,u)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var xP="variance",cZ=["typed","add","subtract","multiply","divide","apply","isNaN"],Lx=F(xP,cZ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e,c=sf({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l});return r(xP,{"...any":function(s){s=Cn(s);try{return c.apply(null,s)}catch(m){throw mt(m)}}})},{isTransformFunction:!0});var yP="print",lZ=["typed","matrix","zeros","add"],zx=F(yP,lZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Qu({typed:r,matrix:t,zeros:n,add:a});return r(yP,{"string, Object | Array":function(c,o){return i(u(c),o)},"string, Object | Array, number | Object":function(c,o,s){return i(u(c),o,s)}});function u(l){return l.replace(qd,c=>{var o=c.slice(1).split("."),s=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+s.join(".")})}},{isTransformFunction:!0});var mZ="and",pZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Ux=F(mZ,pZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=ju({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)&&!l(d,!0))return!1;var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var dZ="or",hZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Wx=F(dZ,hZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=zu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)&&u(m,!1))return!0;var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var vZ="bitAnd",gZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Yx=F(vZ,gZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=qu({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var xZ="bitOr",yZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Hx=F(xZ,yZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=Lu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Ge=Hm({config:Oe}),pt=$m({}),ID=d0({BigNumber:Ge,config:Oe}),bP=u0({}),wP=Y0({BigNumber:Ge,config:Oe}),Uo=Gm({}),RD=D0({Complex:pt}),DP=c0({BigNumber:Ge,config:Oe}),SP=g0({BigNumber:Ge,config:Oe}),NP=y0({BigNumber:Ge,config:Oe}),Lc=Zm({}),AP=l0({BigNumber:Ge,config:Oe}),MP=f0({}),CP=h0({BigNumber:Ge,config:Oe}),EP=Vm({}),kD=Rm({}),TP=b0({BigNumber:Ge,config:Oe}),FP=ux({BigNumber:Ge,config:Oe}),qD=p0({BigNumber:Ge,config:Oe}),_P=s0({}),OP=S0({}),_r=Xm({Matrix:Lc}),BP=K0({BigNumber:Ge,config:Oe}),PP=v0({BigNumber:Ge,config:Oe}),$x=m0({BigNumber:Ge,config:Oe}),IP=o0({}),RP=w0({BigNumber:Ge,config:Oe}),te=Im({BigNumber:Ge,Complex:pt,DenseMatrix:_r,Fraction:Uo}),Gx=Np({BigNumber:Ge,config:Oe,typed:te}),kP=J0({BigNumber:Ge,config:Oe}),En=Ap({typed:te}),qP=Oh({Complex:pt,config:Oe,typed:te}),LP=Ph({BigNumber:Ge,typed:te}),zP=Rh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),Qt=Cp({typed:te}),UP=jp({typed:te}),WP=Lh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),YP=Uh({typed:te}),LD=Wh({typed:te}),HP=Hh({Complex:pt,config:Oe,typed:te}),ea=hp({BigNumber:Ge,typed:te}),$P=Jp({typed:te}),GP=dp({typed:te}),VP=Jm({typed:te}),zc=Bg({typed:te}),Uc=vp({Complex:pt,typed:te}),Wo=ed({typed:te}),Vx=$h({typed:te}),ZP=Vh({BigNumber:Ge,typed:te}),QP=Qh({BigNumber:Ge,typed:te}),XP=_p({typed:te}),Ir=cp({config:Oe,typed:te}),JP=Fd({typed:te}),zD=Op({typed:te}),KP=Bp({Complex:pt,typed:te}),jP=ud({typed:te}),eI=cd({typed:te}),mf=Pd({typed:te}),Zx=ld({typed:te}),rI=kd({format:mf,typed:te}),Qx=rd({typed:te}),Ln=ep({typed:te}),no=tp({typed:te}),Yo=ip({typed:te}),qa=op({typed:te}),tI=x0({BigNumber:Ge,config:Oe}),nI=Rg({Complex:pt,typed:te}),aI=kp({Complex:pt,config:Oe,typed:te}),UD=qp({Complex:pt,config:Oe,typed:te}),Ho=dd({typed:te}),Ot=Lp({typed:te}),Wc=nd({typed:te}),Oi=mp({typed:te}),iI=Rd({format:mf,typed:te}),oI=Wg({config:Oe,typed:te}),sI=Qu({typed:te}),uI=Yg({config:Oe,typed:te}),Xx=td({typed:te}),fI=Jh({BigNumber:Ge,typed:te}),WD=Wp({BigNumber:Ge,Fraction:Uo,complex:Uc,typed:te}),Yc=jh({typed:te}),Bi=lp({Matrix:Lc,equalScalar:Ir,typed:te}),cI=Dp({typed:te}),lI=Hp({typed:te}),mI=pp({typed:te}),ga=Ep({typed:te}),pI=rv({typed:te}),YD=up({typed:te}),dI=Bh({Complex:pt,config:Oe,typed:te}),hI=kh({BigNumber:Ge,typed:te}),Jx=qo({isInteger:Ln,typed:te}),vI=qh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),gI=Id({format:mf,typed:te}),xI=Pg({typed:te}),yI=Gh({typed:te}),bI=Xh({BigNumber:Ge,typed:te}),pf=sp({typed:te}),wI=zd({typed:te}),DI=Hg({config:Oe,typed:te}),SI=Kh({BigNumber:Ge,typed:te}),NI=ev({typed:te}),AI=Fh({SparseMatrix:Bi,typed:te}),La=Yp({Complex:pt,config:Oe,typed:te}),MI=tv({typed:te}),fi=Sp({typed:te}),CI=Ih({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),EI=Zh({BigNumber:Ge,typed:te}),Bs=gp({Fraction:Uo,typed:te}),$o=np({typed:te}),$e=xp({DenseMatrix:_r,Matrix:Lc,SparseMatrix:Bi,typed:te}),TI=yp({isZero:qa,matrix:$e,typed:te}),FI=Od({isNaN:pf,isNumeric:$o,typed:te}),za=Ud({bignumber:ea,fraction:Bs,number:Oi}),HD=Bd({config:Oe,multiplyScalar:Ot,numeric:za,typed:te}),$D=xd({isInteger:Ln,matrix:$e,typed:te}),cn=Dd({matrix:$e,config:Oe,typed:te}),_I=Sd({matrix:$e,typed:te}),df=Nd({matrix:$e,typed:te}),GD=Gp({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ln=Md({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),OI=zh({Complex:pt,config:Oe,typed:te}),VD=Tp({BigNumber:Ge,Complex:pt,Fraction:Uo,config:Oe,isNegative:no,matrix:$e,typed:te,unaryMinus:fi}),Gr=Uu({isInteger:Ln,matrix:$e,typed:te}),BI=id({prod:HD,size:cn,typed:te}),Kx=Ad({conj:Wo,transpose:df,typed:te}),ZD=sd({DenseMatrix:_r,SparseMatrix:Bi,matrix:$e,typed:te}),Mt=Wd({numeric:za,typed:te}),hf=Qd({DenseMatrix:_r,concat:Gr,divideScalar:Mt,equalScalar:Ir,matrix:$e,typed:te}),xa=uh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),vf=fd({matrix:$e,typed:te}),PI=ap({isNumeric:$o,typed:te}),ao=md({BigNumber:Ge,DenseMatrix:_r,SparseMatrix:Bi,config:Oe,matrix:$e,typed:te}),II=pd({matrix:$e,multiplyScalar:Ot,typed:te}),Hc=gh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),RI=eh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),QD=Xd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),jx=wp({flatten:vf,matrix:$e,size:cn,typed:te}),kI=Up({BigNumber:Ge,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),qI=hd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ey=sg({addScalar:Qt,complex:Uc,conj:Wo,divideScalar:Mt,equal:xa,identity:ao,isZero:qa,matrix:$e,multiplyScalar:Ot,sign:WD,sqrt:La,subtractScalar:ga,typed:te,unaryMinus:fi,zeros:ln}),LI=yd({config:Oe,matrix:$e}),zI=rh({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Ps=Hd({BigNumber:Ge,DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Tn=lh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),Bt=$p({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,subtractScalar:ga,typed:te,unaryMinus:fi}),UI=Ld({concat:Gr,matrix:$e,typed:te}),WI=bh({DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),ry=Jd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),YI=ad({DenseMatrix:_r,concat:Gr,matrix:$e,typed:te}),Lr=pv({DenseMatrix:_r,SparseMatrix:Bi,addScalar:Qt,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),HI=Yh({BigNumber:Ge,DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),$I=qu({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),GI=Lu({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),VI=Kp({DenseMatrix:_r,concat:Gr,matrix:$e,typed:te}),ZI=Vg({addScalar:Qt,combinations:zc,divideScalar:Mt,isInteger:Ln,isNegative:no,multiplyScalar:Ot,typed:te}),Go=ah({BigNumber:Ge,DenseMatrix:_r,Fraction:Uo,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),XD=oh({concat:Gr,matrix:$e,typed:te}),QI=af({add:Lr,typed:te,unaryPlus:Gx}),ty=xh({equal:xa,typed:te}),XI=Yu({matrix:$e,number:Oi,subtract:Bt,typed:te}),JI=Cg({abs:En,addScalar:Qt,deepEqual:ty,divideScalar:Mt,multiplyScalar:Ot,sqrt:La,subtractScalar:ga,typed:te}),$c=vv({addScalar:Qt,conj:Wo,multiplyScalar:Ot,size:cn,typed:te}),KI=fh({compareText:XD,isZero:qa,typed:te}),JD=Pu({DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),jI=Ip({BigNumber:Ge,DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),e4=dv({abs:En,addScalar:Qt,divideScalar:Mt,isPositive:Yo,multiplyScalar:Ot,smaller:Tn,sqrt:La,typed:te}),KD=Sh({DenseMatrix:_r,smaller:Tn}),yn=Nh({ImmutableDenseMatrix:KD,getMatrixDataType:Zx}),Fn=hh({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),ny=$d({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),r4=Kd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),t4=bp({flatten:vf,matrix:$e,size:cn,typed:te}),n4=rf({config:Oe,numeric:za,smaller:Tn,typed:te}),jD=Iu({DenseMatrix:_r,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),it=zp({addScalar:Qt,dot:$c,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),a4=Vd({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),i4=zu({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),Gc=wh({compare:Go,isNaN:pf,isNumeric:$o,typed:te}),o4=th({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),eS=cg({SparseMatrix:Bi,abs:En,add:Lr,divideScalar:Mt,larger:Fn,largerEq:Hc,multiply:it,subtract:Bt,transpose:df,typed:te}),ra=Vu({add:Lr,matrix:$e,typed:te,zeros:ln}),ay=nf({add:Lr,config:Oe,numeric:za,typed:te}),s4=gv({add:Lr,matrix:$e,typed:te}),rS=jd({DenseMatrix:_r,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te}),u4=n0({Complex:pt,add:Lr,multiply:it,number:Oi,typed:te}),iy=Fp({DenseMatrix:_r,config:Oe,equalScalar:Ir,matrix:$e,round:Ps,typed:te,zeros:ln}),ci=ih({compare:Go,typed:te}),f4=Zg({addScalar:Qt,combinations:zc,isInteger:Ln,isNegative:no,isPositive:Yo,larger:Fn,typed:te}),c4=od({matrix:$e,multiply:it,subtract:Bt,typed:te}),tS=gg({divideScalar:Mt,isZero:qa,matrix:$e,multiply:it,subtractScalar:ga,typed:te,unaryMinus:fi}),l4=Qp({concat:Gr,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),nS=Ah({larger:Fn,smaller:Tn}),aS=Pp({Complex:pt,DenseMatrix:_r,ceil:iy,equalScalar:Ir,floor:JD,matrix:$e,typed:te,zeros:ln}),iS=xv({Index:yn,typed:te}),m4=Eg({abs:En,add:Lr,addScalar:Qt,config:Oe,divideScalar:Mt,equalScalar:Ir,flatten:vf,isNumeric:$o,isZero:qa,matrix:$e,multiply:it,multiplyScalar:Ot,smaller:Tn,subtract:Bt,typed:te}),p4=Vp({BigNumber:Ge,add:Lr,config:Oe,equal:xa,isInteger:Ln,mod:jD,smaller:Tn,typed:te,xgcd:GD}),d4=Rp({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),h4=Gd({Complex:pt,config:Oe,divideScalar:Mt,log:ny,typed:te}),oy=ef({config:Oe,larger:Fn,numeric:za,typed:te}),v4=nv({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),g4=iv({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),x4=sv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),y4=fv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),Is=ph({DenseMatrix:_r,concat:Gr,config:Oe,matrix:$e,typed:te}),b4=Dh({compare:Go,compareNatural:ci,matrix:$e,typed:te}),w4=ju({concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),Rs=$u({bignumber:ea,matrix:$e,add:Lr,config:Oe,isPositive:Yo,larger:Fn,largerEq:Hc,smaller:Tn,smallerEq:Is,typed:te}),D4=Gu({Index:yn,matrix:$e,range:Rs,typed:te}),oS=av({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),S4=uv({Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),sS=lv({Index:yn,concat:Gr,setDifference:oS,size:cn,subset:ra,typed:te}),uS=Mh({FibonacciHeap:nS,addScalar:Qt,equalScalar:Ir}),fS=Wu({Index:yn,matrix:$e,range:Rs,typed:te}),Vo=xg({abs:En,addScalar:Qt,det:tS,divideScalar:Mt,identity:ao,matrix:$e,multiply:it,typed:te,unaryMinus:fi}),cS=og({DenseMatrix:_r,Spa:uS,SparseMatrix:Bi,abs:En,addScalar:Qt,divideScalar:Mt,equalScalar:Ir,larger:Fn,matrix:$e,multiplyScalar:Ot,subtractScalar:ga,typed:te,unaryMinus:fi}),N4=yg({Complex:pt,add:Lr,ctranspose:Kx,deepEqual:ty,divideScalar:Mt,dot:$c,dotDivide:hf,equal:xa,inv:Vo,matrix:$e,multiply:it,typed:te}),ya=Yd({Complex:pt,config:Oe,fraction:Bs,identity:ao,inv:Vo,matrix:$e,multiply:it,number:Oi,typed:te}),lS=ov({DenseMatrix:_r,Index:yn,compareNatural:ci,size:cn,subset:ra,typed:te}),A4=mv({Index:yn,concat:Gr,setIntersect:lS,setSymDifference:sS,size:cn,subset:ra,typed:te}),M4=Dg({abs:En,add:Lr,identity:ao,inv:Vo,map:Ho,max:oy,multiply:it,size:cn,sqrt:La,subtract:Bt,typed:te}),wr=Eh({BigNumber:Ge,Complex:pt,Fraction:Uo,abs:En,addScalar:Qt,config:Oe,divideScalar:Mt,equal:xa,fix:aS,format:mf,isNumeric:$o,multiplyScalar:Ot,number:Oi,pow:ya,round:Ps,subtractScalar:ga}),C4=F0({BigNumber:Ge,Unit:wr,config:Oe}),E4=lx({BigNumber:Ge,Unit:wr,config:Oe}),T4=j0({BigNumber:Ge,Unit:wr,config:Oe}),F4=B0({BigNumber:Ge,Unit:wr,config:Oe}),_4=rx({BigNumber:Ge,Unit:wr,config:Oe}),O4=P0({BigNumber:Ge,Unit:wr,config:Oe}),B4=_0({BigNumber:Ge,Unit:wr,config:Oe}),P4=G0({BigNumber:Ge,Unit:wr,config:Oe}),I4=Zd({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,pow:ya,typed:te}),R4=T0({BigNumber:Ge,Unit:wr,config:Oe}),k4=O0({BigNumber:Ge,Unit:wr,config:Oe}),q4=wg({abs:En,add:Lr,identity:ao,inv:Vo,multiply:it,typed:te}),L4=tx({BigNumber:Ge,Unit:wr,config:Oe}),mS=Cd({addScalar:Qt,ceil:iy,conj:Wo,divideScalar:Mt,dotDivide:hf,exp:zD,i:RD,log2:UD,matrix:$e,multiplyScalar:Ot,pow:ya,tau:qD,typed:te}),sy=Ig({BigNumber:Ge,Complex:pt,config:Oe,multiplyScalar:Ot,pow:ya,typed:te}),z4=A0({BigNumber:Ge,Unit:wr,config:Oe}),U4=H0({BigNumber:Ge,Unit:wr,config:Oe}),W4=Ed({conj:Wo,dotDivide:hf,fft:mS,typed:te}),Y4=q0({BigNumber:Ge,Unit:wr,config:Oe}),H4=ax({BigNumber:Ge,Unit:wr,config:Oe}),$4=E0({BigNumber:Ge,Unit:wr,config:Oe}),G4=mx({BigNumber:Ge,Unit:wr,config:Oe}),V4=ox({BigNumber:Ge,Unit:wr,config:Oe}),Z4=V0({BigNumber:Ge,Unit:wr,config:Oe}),Q4=k0({BigNumber:Ge,Unit:wr,config:Oe}),X4=xx({BigNumber:Ge,Unit:wr,config:Oe}),J4=hx({BigNumber:Ge,Unit:wr,config:Oe}),K4=yx({BigNumber:Ge,Unit:wr,config:Oe}),j4=$0({BigNumber:Ge,Unit:wr,config:Oe}),eR=Z0({BigNumber:Ge,Unit:wr,config:Oe}),rR=C0({BigNumber:Ge,Unit:wr,config:Oe}),tR=Q0({BigNumber:Ge,Unit:wr,config:Oe}),nR=fx({BigNumber:Ge,Unit:wr,config:Oe}),aR=N0({BigNumber:Ge,Unit:wr,config:Oe}),iR=cx({BigNumber:Ge,Unit:wr,config:Oe}),oR=X0({BigNumber:Ge,Unit:wr,config:Oe}),sR=ex({BigNumber:Ge,Unit:wr,config:Oe}),uR=L0({BigNumber:Ge,Unit:wr,config:Oe}),fR=_h({Unit:wr,typed:te}),an=Mg({divideScalar:Mt,equalScalar:Ir,inv:Vo,matrix:$e,multiply:it,typed:te}),cR=U0({BigNumber:Ge,Unit:wr,config:Oe}),gf=kg({gamma:sy,typed:te}),lR=nx({BigNumber:Ge,Unit:wr,config:Oe}),mR=dx({BigNumber:Ge,Unit:wr,config:Oe}),pR=I0({BigNumber:Ge,Unit:wr,config:Oe}),pS=lg({DenseMatrix:_r,lsolve:QD,lup:cS,matrix:$e,slu:eS,typed:te,usolve:ry}),dR=R0({BigNumber:Ge,Unit:wr,config:Oe}),hR=px({BigNumber:Ge,Unit:wr,config:Oe}),vR=Lg({add:Lr,divide:an,factorial:gf,isInteger:Ln,isPositive:Yo,multiply:it,typed:te}),gR=zg({factorial:gf,typed:te}),xR=vx({BigNumber:Ge,Unit:wr,config:Oe}),yR=mg({add:Lr,cbrt:VD,divide:an,equalScalar:Ir,im:Qx,isZero:qa,multiply:it,re:Xx,sqrt:La,subtract:Bt,typeOf:YD,typed:te,unaryMinus:fi}),bR=cv({compareNatural:ci,typed:te}),wR=Td({abs:En,add:Lr,bignumber:ea,divide:an,isNegative:no,isPositive:Yo,larger:Fn,map:Ho,matrix:$e,max:oy,multiply:it,smaller:Tn,subtract:Bt,typed:te,unaryMinus:fi}),dS=$g({bignumber:ea,addScalar:Qt,combinations:zc,divideScalar:Mt,factorial:gf,isInteger:Ln,isNegative:no,larger:Fn,multiplyScalar:Ot,number:Oi,pow:ya,subtractScalar:ga,typed:te}),DR=Th({Unit:wr,typed:te}),SR=Gg({addScalar:Qt,isInteger:Ln,isNegative:no,stirlingS2:dS,typed:te}),hS=bg({abs:En,add:Lr,addScalar:Qt,atan:LD,bignumber:ea,column:fS,complex:Uc,config:Oe,cos:Vx,diag:ZD,divideScalar:Mt,dot:$c,equal:xa,flatten:vf,im:Qx,inv:Vo,larger:Fn,matrix:$e,matrixFromColumns:jx,multiply:it,multiplyScalar:Ot,number:Oi,qr:ey,re:Xx,reshape:$D,sin:Yc,size:cn,smaller:Tn,sqrt:La,subtract:Bt,typed:te,usolve:ry,usolveAll:rS}),NR=W0({BigNumber:Ge,Unit:wr,config:Oe}),AR=ix({BigNumber:Ge,Unit:wr,config:Oe}),MR=qg({divide:an,dotDivide:hf,isNumeric:$o,log:ny,map:Ho,matrix:$e,multiply:it,sum:ay,typed:te}),vS=of({add:Lr,divide:an,typed:te}),CR=sx({BigNumber:Ge,Unit:wr,config:Oe}),ER=M0({BigNumber:Ge,Unit:wr,config:Oe}),TR=uf({bignumber:ea,add:Lr,compare:Go,divide:an,isInteger:Ln,larger:Fn,multiply:it,partitionSelect:Gc,smaller:Tn,smallerEq:Is,subtract:Bt,typed:te}),uy=sf({add:Lr,apply:Jx,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),FR=z0({BigNumber:Ge,Unit:wr,config:Oe}),gS=Fg({add:Lr,compare:Go,divide:an,partitionSelect:Gc,typed:te}),_R=Og({add:Lr,divide:an,matrix:$e,mean:vS,multiply:it,pow:ya,sqrt:La,subtract:Bt,sum:ay,typed:te}),OR=a0({Complex:pt,add:Lr,divide:an,matrix:$e,multiply:it,typed:te}),BR=_g({abs:En,map:Ho,median:gS,subtract:Bt,typed:te}),PR=ff({map:Ho,sqrt:La,typed:te,variance:uy}),IR=_d({BigNumber:Ge,Complex:pt,add:Lr,config:Oe,divide:an,equal:xa,factorial:gf,gamma:sy,isNegative:no,multiply:it,pi:$x,pow:ya,sin:Yc,smallerEq:Is,subtract:Bt,typed:te}),fy=hv({abs:En,add:Lr,conj:Wo,ctranspose:Kx,eigs:hS,equalScalar:Ir,larger:Fn,matrix:$e,multiply:it,pow:ya,smaller:Tn,sqrt:La,typed:te}),xS=wd({BigNumber:Ge,DenseMatrix:_r,SparseMatrix:Bi,addScalar:Qt,config:Oe,cos:Vx,matrix:$e,multiplyScalar:Ot,norm:fy,sin:Yc,typed:te,unaryMinus:fi}),RR=gx({BigNumber:Ge,Unit:wr,config:Oe}),yS=Ng({identity:ao,matrix:$e,multiply:it,norm:fy,qr:ey,subtract:Bt,typed:te}),kR=bd({multiply:it,rotationMatrix:xS,typed:te}),bS=Sg({abs:En,add:Lr,concat:Gr,identity:ao,index:iS,lusolve:pS,matrix:$e,matrixFromColumns:jx,multiply:it,range:Rs,schur:yS,subset:ra,subtract:Bt,transpose:df,typed:te}),qR=Ag({matrix:$e,multiply:it,sylvester:bS,transpose:df,typed:te});var xf={},yf={},LR={},_n=bv({mathWithTransform:yf}),bf=Yv({Node:_n}),io=$v({Node:_n}),ks=Vv({Node:_n}),zR=Jv({Node:_n}),wf=Av({Node:_n}),UR=_v({Node:_n,ResultSet:kD}),WR=Bv({Node:_n}),Zo=kv({Node:_n}),YR=Qv({Node:_n}),bZ=i0({classes:LR}),wS=dg({math:xf,typed:te}),HR=Lv({Node:_n,typed:te}),wZ=vg({Chain:wS,typed:te}),Df=Uv({Node:_n,size:cn}),Sf=Sv({Node:_n,subset:ra}),$R=Tv({matrix:$e,Node:_n,subset:ra}),Qo=Kv({Unit:wr,Node:_n,math:xf}),Xo=eg({Node:_n,SymbolNode:Qo,math:xf}),Ua=rg({AccessorNode:Sf,ArrayNode:wf,AssignmentNode:$R,BlockNode:UR,ConditionalNode:WR,ConstantNode:Zo,FunctionAssignmentNode:HR,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,RangeNode:YR,RelationalNode:zR,SymbolNode:Qo,config:Oe,numeric:za,typed:te}),GR=jg({ConstantNode:Zo,FunctionNode:Xo,OperatorNode:io,ParenthesisNode:ks,parse:Ua,typed:te}),DS=Jg({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,SymbolNode:Qo,config:Oe,mathWithTransform:yf,matrix:$e,typed:te}),DZ=tg({parse:Ua,typed:te}),SS=Kg({AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,divide:an,equal:xa,isZero:qa,multiply:it,parse:Ua,pow:ya,subtract:Bt,typed:te}),NS=ng({parse:Ua,typed:te}),VR=pg({evaluate:NS}),ZR=ag({evaluate:NS}),cy=Xg({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,config:Oe,divide:an,equal:xa,isZero:qa,mathWithTransform:yf,matrix:$e,multiply:it,parse:Ua,pow:ya,resolve:GR,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),SZ=e0({OperatorNode:io,parse:Ua,simplify:cy,typed:te}),NZ=Qg({parse:Ua,typed:te}),AZ=ig({Parser:ZR,typed:te}),MZ=t0({bignumber:ea,fraction:Bs,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Zo,FunctionNode:Xo,IndexNode:Df,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,add:Lr,config:Oe,divide:an,equal:xa,isZero:qa,mathWithTransform:yf,matrix:$e,multiply:it,parse:Ua,pow:ya,simplify:cy,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),CZ=r0({ConstantNode:Zo,FunctionNode:Xo,OperatorNode:io,ParenthesisNode:ks,SymbolNode:Qo,config:Oe,equal:xa,isZero:qa,numeric:za,parse:Ua,simplify:cy,typed:te}),EZ=hg({Help:VR,mathWithTransform:yf,typed:te});ht(xf,{e:ID,false:bP,fineStructure:wP,i:RD,Infinity:DP,LN10:SP,LOG10E:NP,NaN:AP,null:MP,phi:CP,SQRT1_2:TP,sackurTetrode:FP,tau:qD,true:_P,E:ID,version:OP,efimovFactor:BP,LN2:PP,pi:$x,replacer:IP,reviver:bZ,SQRT2:RP,typed:te,unaryPlus:Gx,PI:$x,weakMixingAngle:kP,abs:En,acos:qP,acot:LP,acsc:zP,addScalar:Qt,arg:UP,asech:WP,asinh:YP,atan:LD,atanh:HP,bignumber:ea,bitNot:$P,boolean:GP,clone:VP,combinations:zc,complex:Uc,conj:Wo,cos:Vx,cot:ZP,csc:QP,cube:XP,equalScalar:Ir,erf:JP,exp:zD,expm1:KP,filter:jP,forEach:eI,format:mf,getMatrixDataType:Zx,hex:rI,im:Qx,isInteger:Ln,isNegative:no,isPositive:Yo,isZero:qa,LOG2E:tI,lgamma:nI,log10:aI,log2:UD,map:Ho,multiplyScalar:Ot,not:Wc,number:Oi,oct:iI,pickRandom:oI,print:sI,random:uI,re:Xx,sec:fI,sign:WD,sin:Yc,splitUnit:cI,square:lI,string:mI,subtractScalar:ga,tan:pI,typeOf:YD,acosh:dI,acsch:hI,apply:Jx,asec:vI,bin:gI,chain:wZ,combinationsWithRep:xI,cosh:yI,csch:bI,isNaN:pf,isPrime:wI,randomInt:DI,sech:SI,sinh:NI,sparse:AI,sqrt:La,tanh:MI,unaryMinus:fi,acoth:CI,coth:EI,fraction:Bs,isNumeric:$o,matrix:$e,matrixFromFunction:TI,mode:FI,numeric:za,prod:HD,reshape:$D,size:cn,squeeze:_I,transpose:df,xgcd:GD,zeros:ln,asin:OI,cbrt:VD,concat:Gr,count:BI,ctranspose:Kx,diag:ZD,divideScalar:Mt,dotDivide:hf,equal:xa,flatten:vf,hasNumericValue:PI,identity:ao,kron:II,largerEq:Hc,leftShift:RI,lsolve:QD,matrixFromColumns:jx,nthRoot:kI,ones:qI,qr:ey,resize:LI,rightArithShift:zI,round:Ps,smaller:Tn,subtract:Bt,to:UI,unequal:WI,usolve:ry,xor:YI,add:Lr,atan2:HI,bitAnd:$I,bitOr:GI,bitXor:VI,catalan:ZI,compare:Go,compareText:XD,cumsum:QI,deepEqual:ty,diff:XI,distance:JI,dot:$c,equalText:KI,floor:JD,gcd:jI,hypot:e4,larger:Fn,log:ny,lsolveAll:r4,matrixFromRows:t4,min:n4,mod:jD,multiply:it,nthRoots:a4,or:i4,partitionSelect:Gc,rightLogShift:o4,slu:eS,subset:ra,sum:ay,trace:s4,usolveAll:rS,zpk2tf:u4,ceil:iy,compareNatural:ci,composition:f4,cross:c4,det:tS,dotMultiply:l4,fix:aS,index:iS,intersect:m4,invmod:p4,lcm:d4,log1p:h4,max:oy,setCartesian:v4,setDistinct:g4,setIsSubset:x4,setPowerset:y4,smallerEq:Is,sort:b4,and:w4,range:Rs,row:D4,setDifference:oS,setMultiplicity:S4,setSymDifference:sS,column:fS,inv:Vo,lup:cS,pinv:N4,pow:ya,setIntersect:lS,setUnion:A4,sqrtm:M4,vacuumImpedance:C4,wienDisplacement:E4,atomicMass:T4,bohrMagneton:F4,boltzmann:_4,conductanceQuantum:O4,coulomb:B4,deuteronMass:P4,dotPow:I4,electricConstant:R4,elementaryCharge:k4,expm:q4,faraday:L4,fft:mS,gamma:sy,gravitationConstant:z4,hartreeEnergy:U4,ifft:W4,klitzing:Y4,loschmidt:H4,magneticConstant:$4,molarMass:G4,molarPlanckConstant:V4,neutronMass:Z4,nuclearMagneton:Q4,planckCharge:X4,planckLength:J4,planckTemperature:K4,protonMass:j4,quantumOfCirculation:eR,reducedPlanckConstant:rR,rydberg:tR,secondRadiation:nR,speedOfLight:aR,stefanBoltzmann:iR,thomsonCrossSection:oR,avogadro:sR,bohrRadius:uR,createUnit:fR,divide:an,electronMass:cR,factorial:gf,firstRadiation:lR,gravity:mR,inverseConductanceQuantum:pR,lusolve:pS,magneticFluxQuantum:dR,molarMassC12:hR,multinomial:vR,parse:Ua,permutations:gR,planckMass:xR,polynomialRoot:yR,resolve:GR,setSize:bR,simplifyConstant:DS,solveODE:wR,stirlingS2:dS,unit:DR,bellNumbers:SR,compile:DZ,eigs:hS,fermiCoupling:NR,gasConstant:AR,kldivergence:MR,mean:vS,molarVolume:CR,planckConstant:ER,quantileSeq:TR,simplifyCore:SS,variance:uy,classicalElectronRadius:FR,evaluate:NS,median:gS,simplify:cy,symbolicEqual:SZ,corr:_R,freqz:OR,leafCount:NZ,mad:BR,parser:AZ,rationalize:MZ,std:PR,zeta:IR,derivative:CZ,norm:fy,rotationMatrix:xS,help:EZ,planckTime:RR,schur:yS,rotate:kR,sylvester:bS,lyap:qR,config:Oe});ht(yf,xf,{filter:Sx({typed:te}),forEach:Nx({typed:te}),map:Mx({typed:te}),apply:wx({isInteger:Ln,typed:te}),or:Wx({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),and:Ux({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),concat:Bx({isInteger:Ln,matrix:$e,typed:te}),max:Cx({config:Oe,larger:Fn,numeric:za,typed:te}),print:zx({add:Lr,matrix:$e,typed:te,zeros:ln}),bitAnd:Yx({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Wc,typed:te,zeros:ln}),diff:Px({bignumber:ea,matrix:$e,number:Oi,subtract:Bt,typed:te}),min:Tx({config:Oe,numeric:za,smaller:Tn,typed:te}),subset:Ox({add:Lr,matrix:$e,typed:te,zeros:ln}),bitOr:Hx({DenseMatrix:_r,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),cumsum:qx({add:Lr,typed:te,unaryPlus:Gx}),index:Ax({Index:yn,getMatrixDataType:Zx}),sum:Rx({add:Lr,config:Oe,numeric:za,typed:te}),range:Fx({bignumber:ea,matrix:$e,add:Lr,config:Oe,isPositive:Yo,larger:Fn,largerEq:Hc,smaller:Tn,smallerEq:Is,typed:te}),row:_x({Index:yn,matrix:$e,range:Rs,typed:te}),column:Dx({Index:yn,matrix:$e,range:Rs,typed:te}),mean:Ex({add:Lr,divide:an,typed:te}),quantileSeq:kx({add:Lr,bignumber:ea,compare:Go,divide:an,isInteger:Ln,larger:Fn,multiply:it,partitionSelect:Gc,smaller:Tn,smallerEq:Is,subtract:Bt,typed:te}),variance:Lx({add:Lr,apply:Jx,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),std:Ix({map:Ho,sqrt:La,typed:te,variance:uy})});ht(LR,{BigNumber:Ge,Complex:pt,Fraction:Uo,Matrix:Lc,Node:_n,ObjectNode:bf,OperatorNode:io,ParenthesisNode:ks,Range:EP,RelationalNode:zR,ResultSet:kD,ArrayNode:wf,BlockNode:UR,ConditionalNode:WR,ConstantNode:Zo,DenseMatrix:_r,RangeNode:YR,Chain:wS,FunctionAssignmentNode:HR,SparseMatrix:Bi,IndexNode:Df,ImmutableDenseMatrix:KD,Index:yn,AccessorNode:Sf,AssignmentNode:$R,FibonacciHeap:nS,Spa:uS,Unit:wr,SymbolNode:Qo,FunctionNode:Xo,Help:VR,Parser:ZR});wS.createProxy(xf);var AS=PD;var jR=ca(Am(),1);var XR=ca(QR(),1);function JR(e){var r=new XR.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function KR(e,r,t,n){function a(y,w){var C=arguments.length;if(C!==1&&C!==2)throw new ha("import",C,1,2);w||(w={});function b(O,_,E){if(Array.isArray(_))_.forEach(q=>b(O,q));else if(typeof _=="object")for(var T in _)Xe(_,T)&&b(O,_[T],T);else if(As(_)||E!==void 0){var R=As(_)?x(_)?_.fn+".transform":_.fn:E;if(Xe(O,R)&&O[R]!==_&&!w.silent)throw new Error('Cannot import "'+R+'" twice');O[R]=_}else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}var M={};b(M,y);for(var A in M)if(Xe(M,A)){var S=M[A];if(As(S))o(S,w);else if(s(S))i(A,S,w);else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(y,w,C){if(C.wrap&&typeof w=="function"&&(w=c(w)),m(w)&&(w=e(y,{[w.signature]:w})),e.isTypedFunction(t[y])&&e.isTypedFunction(w)){C.override?w=e(y,w.signatures):w=e(t[y],w),t[y]=w,delete n[y],u(y,w),t.emit("import",y,function(){return w});return}if(t[y]===void 0||C.override){t[y]=w,delete n[y],u(y,w),t.emit("import",y,function(){return w});return}if(!C.silent)throw new Error('Cannot import "'+y+'": already exists')}function u(y,w){w&&typeof w.transform=="function"?(t.expression.transform[y]=w.transform,d(y)&&(t.expression.mathWithTransform[y]=w.transform)):(delete t.expression.transform[y],d(y)&&(t.expression.mathWithTransform[y]=w))}function l(y){delete t.expression.transform[y],d(y)?t.expression.mathWithTransform[y]=t[y]:delete t.expression.mathWithTransform[y]}function c(y){var w=function(){for(var b=[],M=0,A=arguments.length;M2&&arguments[2]!==void 0?arguments[2]:y.fn;if(Jb(C,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(C));var b=x(y)?t.expression.transform:t,M=C in t.expression.transform,A=Xe(b,C)?b[C]:void 0,S=function(){var _={};y.dependencies.map(ew).forEach(T=>{if(Jb(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var E=y(_);if(E&&typeof E.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(A===void 0||w.override)return E;if(e.isTypedFunction(A)&&e.isTypedFunction(E))return e(A,E);if(w.silent)return A;throw new Error('Cannot import "'+C+'": already exists')};!y.meta||y.meta.lazy!==!1?(Du(b,C,S),A&&M?l(C):(x(y)||h(y))&&Du(t.expression.mathWithTransform,C,()=>b[C])):(b[C]=S(),A&&M?l(C):(x(y)||h(y))&&Du(t.expression.mathWithTransform,C,()=>b[C])),n[C]=y,t.emit("import",C,S)}function s(y){return typeof y=="function"||typeof y=="number"||typeof y=="string"||typeof y=="boolean"||y===null||Ht(y)||Kt(y)||rr(y)||ma(y)||Qe(y)||Array.isArray(y)}function m(y){return typeof y=="function"&&typeof y.signature=="string"}function d(y){return!Xe(v,y)}function h(y){return y.fn.indexOf(".")===-1&&!Xe(v,y.fn)&&(!y.meta||!y.meta.isClass)}function x(y){return y!==void 0&&y.meta!==void 0&&y.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function ly(e,r){var t=ht({},Ds,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=JR({isNumber:sr,isComplex:Kt,isBigNumber:rr,isFraction:ma,isUnit:Ht,isString:St,isArray:Mr,isMatrix:Qe,isCollection:Nt,isDenseMatrix:Xi,isSparseMatrix:pa,isRange:To,isIndex:Ai,isBoolean:cm,isResultSet:lm,isHelp:yu,isFunction:mm,isDate:pm,isRegExp:dm,isObject:Mi,isNull:hm,isUndefined:vm,isAccessorNode:qn,isArrayNode:jt,isAssignmentNode:gm,isBlockNode:xm,isConditionalNode:ym,isConstantNode:yr,isFunctionAssignmentNode:_a,isFunctionNode:gn,isIndexNode:Qn,isNode:Nr,isObjectNode:Ci,isOperatorNode:ct,isParenthesisNode:en,isRangeNode:bm,isRelationalNode:wm,isSymbolNode:at,isChain:bu});n.config=HA(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function u(s){if(As(s))return s(n);var m=s[Object.keys(s)[0]];if(As(m))return m(n);if(!UA(s))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",s),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var d=a.indexOf(s),h;return d===-1?(s.math===!0?h=s.factory(n.type,t,u,n.typed,n):h=s.factory(n.type,t,u,n.typed),a.push(s),i.push(h)):h=i[d],h}var l={};function c(){for(var s=arguments.length,m=new Array(s),d=0;d{Ub(l).forEach(s=>{s&&s.meta&&s.meta.recreateOnConfigChange&&o(s,{override:!0})})}),n.create=ly.bind(null,e),n.factory=F,n.import(Ub(LA(e))),n.ArgumentsError=ha,n.DimensionError=pr,n.IndexError=tn,n}var vy=ca(fm());var r5=ca(e5()),TS=class{constructor(){this.lang="en";this.all={en:{hintText:{dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"New Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Spaces",migrateData:"Migrate Spaces From 0.7",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Spaces",releaseNotes:"Release Notes",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{newView:"New View",closeSpace:"Close Space",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open Space",revealInDefault:"Reveal in Finder",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Spaces",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",waypoints:"Waypoints",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group By",sortBy:"Sort By",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",removeFromWaypoints:"Unpin from Waypoints",editCode:"Edit Code",editProperties:"Edit Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",addFilter:"Add Filter",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete Table",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"New Action",newTable:"New Table",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Quickly Search a File, Folder, Tag... Press Tab to Edit",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueProperty:"Property",propertyLookup:"Edit Formula",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",context:"Context",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: "},settings:{layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Stickers",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},generateThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Spaces as Default Tab",desc:"Open the Spaces tab when Obsidian launches"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Open Flow Blocks on Internal Link Click",desc:"Turn on to toggle Flow Blocks directly by clicking on internal links, otherwise a tooltip will be shown"},syncContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},inlineBacklinks:{name:"Show Inline Backlinks (Inline Context required)",desc:"Show editable backlinks at the bottom of your notes"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContextExplorer:{name:"Inline Context",desc:"Display the context and a banner at the top of your notes"},inlineContextExpanded:{name:"Auto Expand Inline Context",desc:"Expand the inline context sections when opening a note"},inlineContextHorizontal:{name:"Inline Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Frontmatter Properties",desc:"Hide the frontmatter properties in inline context"},openFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},folderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},expandFolder:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},hoverPreview:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},activeFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Spaces"},contexts:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},spaces:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesAlias:{name:"Alias",desc:"Use the alias metadata to show in Spaces"},spacesFileExplorerDual:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using Spaces"},spacesDeleteOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},hideRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceView:{name:"Space View",desc:"Open the space view when you click on a space"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},tagSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Performance Mode",desc:"Turn on performance mode for Spaces, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in spaces (in pixels), default is 28"},coverHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blink:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",classic:"Classic",minimal:"Minimal"}}}};this.lang="en";let r=r5.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Tr=new TS().texts;var RZ=ca(fm());var _Z=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var t5=({field:e,value:r})=>r=="ctime"?{value:\`parseDate(prop('\${e}')['metadata']['file']['\${r}'])\`,type:"date"}:{value:\`prop('\${e}')['metadata']['file']['\${r}']\`,type:"string"},my=(e,r,t,n)=>{let a=wc(e);if(a)return r=="fileprop"&&a.field?t5(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=_Z(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...n5(r).configKeys??[],"alias","default"].reduce((i,u)=>({...i,[u]:a[u]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,u]=e.split(".");a=t5({field:i,value:u})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:Sn(e).map(u=>({name:u,value:u}))}:a={});return a??{}};var n5=(e,r)=>r==Fa?Af.find(t=>t.type=="file"):r=="tags"?Af.find(t=>t.type=="tags-multi"):r=="aliases"?Af.find(t=>t.type=="option-multi"):r=="sticker"?Af.find(t=>e=="icon"):Af.find(t=>e==t.type)||Af.find(t=>e==t.multiType),Af=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"text",label:Tr.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Tr.properties.text.description},{type:"number",label:Tr.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Tr.properties.number.description},{type:"boolean",label:Tr.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Tr.properties.boolean.description},{type:"date",label:Tr.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Tr.properties.date.description},{type:"option",label:Tr.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Tr.properties.option.description},{type:"tags-multi",label:Tr.properties.tags.label,icon:"ui//tags",description:Tr.properties.tags.description},{type:"file",label:Tr.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Tr.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Tr.properties.fileProperty.description},{type:"link",label:Tr.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Tr.properties.link.description},{type:"context",label:Tr.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space"],description:Tr.properties.context.description},{type:"object",label:Tr.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Tr.properties.object.description},{type:"icon",label:Tr.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Tr.properties.icon.description},{type:"image",label:Tr.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Tr.properties.image.description},{type:"color",label:Tr.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Tr.properties.color.description},{type:"space",label:Tr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Tr.properties.space.description},{type:"table",label:Tr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Tr.properties.space.description},{type:"super",label:Tr.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Tr.properties.super.label,icon:"ui//input",restricted:!0}];var qs="files",hy={id:qs,name:"Files",type:"db",primary:"true"},OZ="filesView",BZ={id:OZ,name:"All",type:"view",def:JSON.stringify({db:qs,icon:"ui//file-stack"})},PZ="main",IZ=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),N4e={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[IZ(PZ),BZ]},py={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[hy]},a5={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},dy={...a5,rows:[{name:Fa,schemaId:qs,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:Tr.properties.fileProperty.createdTime,schemaId:qs,type:"fileprop",value:Fa+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var A4e=[{name:Tr.properties.defaultField,schemaId:"",type:"text",primary:"true"}],FS={...a5,rows:[{name:Fa,schemaId:qs,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var M4e={schema:hy,cols:dy.rows,rows:[]},C4e={schema:hy,cols:dy.rows,rows:[]},E4e={schema:hy,cols:FS.rows,rows:[]},i5=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var T4e={m_schema:py,m_fields:dy,...i5(dy.rows,py.rows)},F4e={m_schema:py,m_fields:FS,...i5(FS.rows,py.rows)};var _S="spaces://$tags";var fRe={name:Tr.menu.waypoints,displayName:Tr.menu.waypoints,path:"spaces://$waypoints",label:{name:Tr.menu.waypoints,thumbnail:"",sticker:"ui//tags",color:""},type:"default"},cRe={name:Tr.menu.tags,displayName:Tr.menu.tags,path:"spaces://$tags",label:{thumbnail:"",name:Tr.menu.tags,sticker:"ui//tags",color:""},type:"default"},lRe={name:Tr.menu.vault,displayName:Tr.menu.vault,path:"/",label:{thumbnail:"",name:Tr.menu.vault,sticker:"ui//vault",color:""},type:"default"};var o5=(e,r,t,n,a,i,u)=>{if(!t)return"";let l=new Map;Object.keys(a).forEach(o=>l.set(o,a[o])),l.set("$properties",n),l.set("$paths",r),i&&l.set("$current",i);let c;try{e.evaluate("current = current()",l),c=e.evaluate(t,l),c=ws("",c)}catch(o){if(u)throw o}return c};var OS=e=>{let r=new Map;e.filter(u=>u.type=="fileprop"||u.name.startsWith("tags")).forEach(u=>{let{value:l}=my(u.value,u.type),c=[];try{let s=Ua(l).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);c.push(...s)}catch{}let o=u.name;r.has(o)||r.set(o,new Set);for(let s of c){let m=s;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=u=>{if(a.has(u))throw new Error("Circular dependency detected");if(!t.has(u)){a.add(u);let l=r.get(u)||new Set;for(let c of l)i(c);t.add(u),a.delete(u),n.push(u)}};for(let u of e)t.has(u.name)||i(u.name);return n},s5=(e,r,t,n,a,i)=>{if(!t)return{};let u=i??OS(n),l=r.get(t[Fa])?.metadata?.property??{},c=Object.keys(l).filter(m=>n.some(d=>d.name==m)).reduce((m,d)=>({...m,[d]:ws(d,l[d])}),{}),o=u.map(m=>n.find(d=>d.name==m)).filter(m=>m&&(m.type=="fileprop"||m.name=="tags")),s=n.reduce((m,d)=>({...m,[d.name]:d}),{});return{...t,...c,...o.reduce((m,d)=>{let{value:h}=my(d.value,d.type);return{...m,[d.name]:o5(e,r,h,s,{...t,...m},a)}},{})}};var u5=(e,r)=>{let t=e?Sn(e):[],n=r?Sn(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},Mf=(e,r)=>e==r,BS=(e,r)=>(e??"").length==0,PS=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),IS=(e,r)=>parseFloat(e)>parseFloat(r),RS=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},c5=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?Sn(e):[],n=r?Sn(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},l5=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},m5=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var Cf={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!BS(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>BS(e,""),valueType:"none"},include:{fn:(e,r)=>PS(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!PS(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>Mf(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!Mf(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>Mf(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>Mf(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!Mf(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>IS(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>RS(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!IS(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!RS(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>c5(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>f5(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>l5(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>m5(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>u5(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>kS(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!kS(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var qZ=(e,r,t)=>r.reduce((a,i)=>{let[u,l]=a,c=i.type=="context"?p5(l,i,t):i.type=="path"?h5(l,i,t):i.type=="frontmatter"?d5(l,i,t):v5(l,i,t),o=l.filter(s=>!c.includes(s));return[[...u,...c],o]},[[],e])[0],LZ=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?p5(n,a,t):a.type=="path"?h5(n,a,t):a.type=="frontmatter"?d5(n,a,t):v5(n,a,t),e),p5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,u]=r.field.split("."),l=a.metadata?.property;if(!a.spaces?.includes(i)||!l||!l[u])return!1;let c=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;c=n.fn(ws(u,l[u]),o)}return c})},d5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(ws(r.field,i[r.field]),l)}return u})},h5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=bs(a.outlinks??[]):r.field=="inlinks"?i=bs(a.inlinks??[]):r.field=="tags"&&(i=bs(a.tags??[]));let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(i,l)}return u})},v5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let u=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],u)}return i})},g5=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?qZ([r],i.filters,t).length>0:LZ([r],i.filters,t).length>0,!0);var x5=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var y5=(e,r,t)=>{if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,frames:{},schemas:[]}};let n=Object.values(r).map(l=>l.schema),a=n.filter(l=>l.type=="frame").reduce((l,c)=>({...l,[c.id]:r[c.id]}),{}),i={path:e.path,frames:a,schemas:n},u=!0;return t&&vy.default.isEqual(i,t)&&(u=!1),{changed:u,cache:i}},b5=(e,r,t,n,a,i,u)=>{let l={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{cols:[],path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],tables:{},space:e,spaceMap:l,dbExists:!1}};let c=Object.values(r).map(A=>A.schema),o=c.find(A=>A.primary=="true"),s=OS(r[o.id].cols),m={...r[o.id],rows:r[o.id].rows.map(A=>s5(u,i,A,r[o.id].cols,i.get(e.path),s))},d={...r,[o.id]:m},h=m.cols?.filter(A=>A.type.startsWith("context"))??[],x=m.cols?.filter(A=>A.type.startsWith("link"))??[],v=ti(h.map(A=>A.value));h.forEach(A=>{l[A.name]={},m.rows.forEach(S=>{Sn(S[A.name]).forEach(O=>l[A.name][O]=[...l[A.name][O]??[],S[Fa]])})});let y=d[qs]?.rows?.map(A=>A[Fa])??[],w=NA(t??[],y),C=ti(m.rows.reduce((A,S)=>ti([...A,...[...h,...x].flatMap(O=>Sn(S[O.name]).map(_=>Dc(_)))]),[])),b={cols:m.cols,path:e.path,contexts:v,outlinks:C,paths:w,tables:d,schemas:c,space:e,spaceMap:l,dbExists:a},M=!0;return n&&vy.default.isEqual(b,n)&&(M=!0),{changed:M,cache:b}},w5=(e,r,t,n)=>{let a={};for(let[i,u]of e){let l=t.get(i)?.defPath??i,c=e.get(l)??u,o=u?.parent??"",s=u?.type??"",m=u?.subtype??"",d=c?.label,h=n?.get(i),{changed:x,cache:v}=qS(i,r,t,c,d,s,m,o,h);a[i]={changed:x,cache:v}}return a},qS=(e,r,t,n,a,i,u,l,c)=>{let o=(W,G,H)=>W?.length>0||W?.length>0?W:G=="space"?H=="Spaces/Home"?"ui//home":H=="/"?"ui//vault":H.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",s={label:n?.label,path:e,name:yc(e),displayName:yc(e)},m=[],d=n?.tags?.map(W=>W)??[],h=x5(r,e),x=(W,G,H=new Set)=>{let L=[];for(let k of G){let K=W.get(k)?.contexts??[];for(let z of K)H.has(z)||(L.push(z),H.add(z),L.push(...x(W,[bc(z)],H)))}return L};if(t.has(l))for(let W of t.get(l).contexts??[])m.push(W);m.push(...d);let v=a?.name,y=n?.properties?um(n.properties[r.fmKeyAlias]):[],w=o(a?.sticker,i,e),C=a?.color??"",b=n?.inlinks??[],M=n?.links??[],A=r.spacesUseAlias?y[0]??v:v,S={...s,name:v,tags:ti(m),type:i,subtype:u,displayName:A,parent:l,label:{name:v,sticker:w,color:C,thumbnail:a?.thumbnail??"",preview:a?.preview??""},metadata:{...n},inlinks:b,outlinks:M},O=[];u=="tag"&&O.push(_S);for(let W of m)O.push(bc(W));let _=new Set,E=(W,G)=>{if(!_.has(W)){if(_.add(W),G.dependencies?.length>0)for(let H of G.dependencies)t.has(H)&&E(H,t.get(H));if(G.defPath==e&&G.path!=G.defPath&&(h=!0),u!="tag"&&u!="default"&&G.space&&G.space.path==l){O.push(W);return}if(G.metadata?.filters?.length>0&&g5(G.metadata.filters,{...S,spaces:O},G.properties)){O.push(W);return}if(G.metadata?.links?.length>0&&(G.metadata?.links??[]).find(L=>L==S.path)){O.push(W);return}}};for(let[W,G]of t)E(W,G);let T=x(t,O);O.push(...T.map(W=>bc(W))),S.tags.push(...T);let R=h?{...S,spaces:[],hidden:h}:{...S,spaces:ti(O),hidden:h},q=!0;return c&&vy.default.isEqual(R,c)&&(q=!1),{changed:q,cache:R}};function D5(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,label:i,type:u,subtype:l,parent:c,oldMetadata:o}=e;return qS(r,t,n,a,i,u,l,c,o)}function LS(e,r){let{space:t,mdb:n,paths:a,oldCache:i,dbExists:u,pathsIndex:l}=e;return b5(t,n,a,i,u,l,r)}function S5(e,r){let{map:t,pathsIndex:n}=e,a=new Map;for(let[i,u]of t)a.set(i,LS({...u,pathsIndex:n},r));return a}function N5(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return w5(r,t,n,a)}function A5(e){let{space:r,mdb:t,oldCache:n}=e;return y5(r,t,n)}var zZ=self,UZ={...AS,createAdd:F("add",[],()=>function(r,t){return r+t})},zS=ly(UZ);zS.import(Lb,{override:!0});zZ.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=D5(r):t.type=="context"?n=LS(r,zS):t.type=="contexts"?n=S5(r,zS):t.type=="frames"?n=A5(r):t.type=="paths"&&(n=N5(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; /*! * decimal.js v10.4.3 * An arbitrary-precision Decimal type for JavaScript. @@ -111465,9 +111577,9 @@ var Indexer = class { this.reloadQueue = []; this.reloadSet = /* @__PURE__ */ new Set(); this.callbacks = /* @__PURE__ */ new Map(); - for (let index2 = 0; index2 < numWorkers; index2++) { - const worker = new Worker2({ name: "Make.md Superstate Indexer " + (index2 + 1) }); - worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index2); + for (let index3 = 0; index3 < numWorkers; index3++) { + const worker = new Worker2({ name: "Make.md Superstate Indexer " + (index3 + 1) }); + worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index3); this.workers.push(worker); this.busy.push(false); } @@ -111491,21 +111603,21 @@ var Indexer = class { } return promise; } - finish(jerb, data2, index2) { + finish(jerb, data3, index3) { const jobKey = stringifyJob(jerb); const calls = [].concat(this.callbacks.get(jobKey) ?? []); this.reloadSet.delete(jobKey); this.callbacks.delete(jobKey); - this.busy[index2] = false; + this.busy[index3] = false; const job = this.reloadQueue.shift(); if (job !== void 0) - this.send(job, index2); - if ("$error" in data2) { + this.send(job, index3); + if ("$error" in data3) { for (const [_15, reject] of calls) - reject(data2["$error"]); + reject(data3["$error"]); } else { for (const [callback, _15] of calls) - callback(data2); + callback(data3); } } async send(job, workerId) { @@ -111529,7 +111641,7 @@ var Indexer = class { const pathMetadata = await this.cache.spaceManager.readPathCache(cachePath) ?? await this.cache.spaceManager.readPathCache(job.path); const label = pathMetadata?.label; const parent = await this.cache.spaceManager.parentPathForPath(job.path); - const type = spaceState ? "space" : "file"; + const type = spaceState ? "space" : pathMetadata.type; const subtype = spaceState ? spaceState.type : pathMetadata?.subtype; const payload = { path: job.path, @@ -111550,12 +111662,12 @@ var Indexer = class { return; } if (job.type == "context") { - const space2 = this.cache.spacesIndex.get(job.path)?.space; - if (!space2 || !space2.path) { + const space3 = this.cache.spacesIndex.get(job.path)?.space; + if (!space3 || !space3.path) { this.message(workerId, { job, payload: { - space: space2, + space: space3, mdb: null, paths: [...this.cache.spacesMap.getInverse(job.path)], oldCache: this.cache.contextsIndex.get(job.path), @@ -111565,12 +111677,12 @@ var Indexer = class { this.busy[workerId] = true; return; } - const dbExists = await this.cache.spaceManager.spaceInitiated(space2.path); - this.cache.spaceManager.readAllTables(space2.path).then((mdb) => { + const dbExists = await this.cache.spaceManager.contextInitiated(space3.path); + this.cache.spaceManager.readAllTables(space3.path).then((mdb) => { this.message(workerId, { job, payload: { - space: space2, + space: space3, mdb, paths: [...this.cache.spacesMap.getInverse(job.path)], oldCache: this.cache.contextsIndex.get(job.path), @@ -111585,16 +111697,16 @@ var Indexer = class { if (job.type == "contexts") { const spaces2 = this.cache.allSpaces().filter((f2) => f2.type != "default").map((f2) => f2.space); const payloads = /* @__PURE__ */ new Map(); - for (const space2 of spaces2) { - const dbExists = await this.cache.spaceManager.spaceInitiated(space2.path); - await this.cache.spaceManager.readAllTables(space2.path).then((mdb) => { + for (const space3 of spaces2) { + const dbExists = await this.cache.spaceManager.contextInitiated(space3.path); + await this.cache.spaceManager.readAllTables(space3.path).then((mdb) => { payloads.set( - space2.path, + space3.path, { - space: space2, + space: space3, mdb, - paths: [...this.cache.spacesMap.getInverse(space2.path)], - oldCache: this.cache.contextsIndex.get(space2.path), + paths: [...this.cache.spacesMap.getInverse(space3.path)], + oldCache: this.cache.contextsIndex.get(space3.path), dbExists } ); @@ -111610,12 +111722,12 @@ var Indexer = class { this.busy[workerId] = true; } if (job.type == "frames") { - const space2 = this.cache.spacesIndex.get(job.path)?.space; - if (!space2) { + const space3 = this.cache.spacesIndex.get(job.path)?.space; + if (!space3) { this.message(workerId, { job, payload: { - space: space2, + space: space3, mdb: null, oldCache: this.cache.framesIndex.get(job.path) } @@ -111623,11 +111735,11 @@ var Indexer = class { this.busy[workerId] = true; return; } - this.cache.spaceManager.readAllFrames(space2.path).then((mdb) => { + this.cache.spaceManager.readAllFrames(space3.path).then((mdb) => { this.message(workerId, { job, payload: { - space: space2, + space: space3, mdb, oldCache: this.cache.framesIndex.get(job.path) } @@ -111643,8 +111755,8 @@ var Indexer = class { ); } nextAvailableWorker() { - const index2 = this.busy.indexOf(false); - return index2 == -1 ? void 0 : index2; + const index3 = this.busy.indexOf(false); + return index3 == -1 ? void 0 : index3; } }; @@ -111663,9 +111775,9 @@ var Searcher = class { this.reloadQueue = []; this.reloadSet = /* @__PURE__ */ new Set(); this.callbacks = /* @__PURE__ */ new Map(); - for (let index2 = 0; index2 < numWorkers; index2++) { - const worker = new Worker3({ name: "Make.md Superstate Indexer " + (index2 + 1) }); - worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index2); + for (let index3 = 0; index3 < numWorkers; index3++) { + const worker = new Worker3({ name: "Make.md Superstate Indexer " + (index3 + 1) }); + worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index3); this.workers.push(worker); this.busy.push(false); } @@ -111689,21 +111801,21 @@ var Searcher = class { } return promise; } - finish(jerb, data2, index2) { + finish(jerb, data3, index3) { const jobKey = stringifyJob(jerb); const calls = [].concat(this.callbacks.get(jobKey) ?? []); this.reloadSet.delete(jobKey); this.callbacks.delete(jobKey); - this.busy[index2] = false; + this.busy[index3] = false; const job = this.reloadQueue.shift(); if (job !== void 0) - this.send(job, index2); - if ("$error" in data2) { + this.send(job, index3); + if ("$error" in data3) { for (const [_15, reject] of calls) - reject(data2["$error"]); + reject(data3["$error"]); } else { for (const [callback, _15] of calls) - callback(data2); + callback(data3); } } async send(job, workerId) { @@ -111725,8 +111837,8 @@ var Searcher = class { ); } nextAvailableWorker() { - const index2 = this.busy.indexOf(false); - return index2 == -1 ? void 0 : index2; + const index3 = this.busy.indexOf(false); + return index3 == -1 ? void 0 : index3; } }; @@ -111769,13 +111881,13 @@ var Superstate10 = class { columnView ]; this.eventsDispatcher = new EventDispatcher(); - const all2 = { + const all6 = { ...all, createAdd: factory("add", [], () => function add4(a4, b2) { return a4 + b2; }) }; - const runContext = create(all2); + const runContext = create(all6); runContext.import(formulas, { override: true }); this.formulaContext = runContext; this.initialized = false; @@ -111910,7 +112022,7 @@ var Superstate10 = class { } async initializeContexts() { await this.indexer.reload({ type: "contexts", path: "" }).then(async (r2) => { - const promises = [...r2.entries()].map(([path2, { cache: cache2, changed }]) => this.contextReloaded(path2, cache2, changed)); + const promises = [...r2.entries()].map(([path3, { cache: cache2, changed }]) => this.contextReloaded(path3, cache2, changed)); await Promise.all(promises); }); } @@ -111922,8 +112034,8 @@ var Superstate10 = class { this.addToContextStateQueue(() => removePathsInContext(this.spaceManager, removeFiles.map((f2) => f2[PathPropertyName]), this.spacesIndex.get(context.path).space).then((f2) => this.reloadSpaceByPath(context.path))); } }); - this.spacesIndex.forEach((space2) => { - const removeFiles = [...this.spacesMap.getInverse(space2.path)]; + this.spacesIndex.forEach((space3) => { + const removeFiles = [...this.spacesMap.getInverse(space3.path)]; }); } async loadFromCache() { @@ -111941,21 +112053,21 @@ var Superstate10 = class { const allContexts = await this.persister.loadAll("context"); const allFrames = await this.persister.loadAll("frame"); allSpaces.forEach((s4) => { - const space2 = safelyParseJSON(s4.cache); - if (space2 && space2.type) { - this.spacesIndex.set(s4.path, space2); + const space3 = safelyParseJSON(s4.cache); + if (space3 && space3.type) { + this.spacesIndex.set(s4.path, space3); } }); allContexts.forEach((s4) => { - const space2 = safelyParseJSON(s4.cache); - if (space2) { - this.contextsIndex.set(s4.path, space2); + const space3 = safelyParseJSON(s4.cache); + if (space3) { + this.contextsIndex.set(s4.path, space3); } }); allFrames.forEach((s4) => { - const space2 = safelyParseJSON(s4.cache); - if (space2) { - this.framesIndex.set(s4.path, space2); + const space3 = safelyParseJSON(s4.cache); + if (space3) { + this.framesIndex.set(s4.path, space3); } }); allPaths.forEach((f2) => { @@ -111975,17 +112087,17 @@ var Superstate10 = class { const promises = [tagsSpacePath, ...allTags].map((l2) => this.reloadPath(l2, true)); await Promise.all(promises); } - async onSpaceDefinitionChanged(space2, oldDef) { - const currentPaths = this.spacesMap.getInverse(space2.path); + async onSpaceDefinitionChanged(space3, oldDef) { + const currentPaths = this.spacesMap.getInverse(space3.path); const newPaths = []; - if (space2.metadata?.links && !import_lodash12.default.isEqual(space2.metadata.links, oldDef?.links)) { - newPaths.push(...space2.metadata.links); + if (space3.metadata?.links && !import_lodash12.default.isEqual(space3.metadata.links, oldDef?.links)) { + newPaths.push(...space3.metadata.links); } - if (space2.metadata?.filters) { - const hasProps = space2.metadata.filters.some((f2) => f2.filters.some((g) => g.fType == "property")); - if (!import_lodash12.default.isEqual(space2.metadata?.filters, oldDef?.filters) || hasProps) { + if (space3.metadata?.filters) { + const hasProps = space3.metadata.filters.some((f2) => f2.filters.some((g) => g.fType == "property")); + if (!import_lodash12.default.isEqual(space3.metadata?.filters, oldDef?.filters) || hasProps) { for (const [k2, f2] of this.pathsIndex) { - if (!f2.hidden && pathByDef(space2.metadata?.filters, f2, space2.properties)) { + if (!f2.hidden && pathByDef(space3.metadata?.filters, f2, space3.properties)) { newPaths.push(k2); } } @@ -112014,8 +112126,8 @@ var Superstate10 = class { const allFiles = this.spaceManager.allPaths(); const start = Date.now(); await this.indexer.reload({ type: "paths", path: "" }).then(async (r2) => { - for await (const [path2, { cache: cache2, changed }] of Object.entries(r2)) { - await this.pathReloaded(path2, cache2, changed, false); + for await (const [path3, { cache: cache2, changed }] of Object.entries(r2)) { + await this.pathReloaded(path3, cache2, changed, false); } }); this.ui.notify(`Make.md - ${allFiles.length} Paths Cached in ${(Date.now() - start) / 1e3} seconds`, "console"); @@ -112042,8 +112154,8 @@ var Superstate10 = class { this.dispatchEvent("spaceStateUpdated", { path: "spaces://$tags" }); } async onTagDeleted(tag2) { - this.tagsMap.getInverse(tag2).forEach((path2) => { - this.deleteTagInPath(tag2, path2); + this.tagsMap.getInverse(tag2).forEach((path3) => { + this.deleteTagInPath(tag2, path3); }); const spacePath = folderForTagSpace(tag2, this.settings); await this.spaceManager.deletePath(spacePath); @@ -112062,10 +112174,10 @@ var Superstate10 = class { this.addToContextStateQueue(() => removeTagInContexts(this.spaceManager, tag2, allContextsWithTag)); this.dispatchEvent("spaceStateUpdated", { path: "spaces://$tags" }); } - async deleteTagInPath(tag2, path2) { + async deleteTagInPath(tag2, path3) { let oldMetadata; - if (this.pathsIndex.has(path2)) { - oldMetadata = this.pathsIndex.get(path2); + if (this.pathsIndex.has(path3)) { + oldMetadata = this.pathsIndex.get(path3); } if (oldMetadata) { const newMetadata = { @@ -112073,38 +112185,38 @@ var Superstate10 = class { tags: oldMetadata.tags.filter((f2) => f2 != tag2), spaces: oldMetadata.spaces.filter((f2) => f2 != tagSpacePathFromTag(tag2)) }; - this.pathsIndex.set(path2, newMetadata); - this.tagsMap.set(path2, new Set(newMetadata.tags)); - this.spacesMap.set(path2, new Set(newMetadata.spaces)); + this.pathsIndex.set(path3, newMetadata); + this.tagsMap.set(path3, new Set(newMetadata.tags)); + this.spacesMap.set(path3, new Set(newMetadata.spaces)); } else { - await this.reloadPath(path2); + await this.reloadPath(path3); } - this.onPathReloaded(path2); - this.dispatchEvent("pathStateUpdated", { path: path2 }); + this.onPathReloaded(path3); + this.dispatchEvent("pathStateUpdated", { path: path3 }); } - onMetadataChange(path2) { - if (!this.pathsIndex.has(path2)) { + onMetadataChange(path3) { + if (!this.pathsIndex.has(path3)) { return; } - this.reloadPath(path2).then( + this.reloadPath(path3).then( (f2) => { - const pathState = this.pathsIndex.get(path2); - const spaceState = this.spacesIndex.get(path2); + const pathState = this.pathsIndex.get(path3); + const spaceState = this.spacesIndex.get(path3); if (spaceState) { this.reloadSpace(spaceState.space).then((f3) => this.onSpaceDefinitionChanged(f3, spaceState.metadata)); } const allContextsWithFile = pathState.spaces.map((f3) => this.spacesIndex.get(f3)?.space).filter((f3) => f3); - this.addToContextStateQueue(() => updateContextWithProperties(this, path2, allContextsWithFile).then(() => { + this.addToContextStateQueue(() => updateContextWithProperties(this, path3, allContextsWithFile).then(() => { allContextsWithFile.forEach((f3) => { this.dispatchEvent("contextStateUpdated", { path: f3.path }); }); })); - this.dispatchEvent("pathStateUpdated", { path: path2 }); + this.dispatchEvent("pathStateUpdated", { path: path3 }); } ); } - reloadSpaceByPath(path2, metadata) { - return this.reloadSpace(this.spaceManager.spaceInfoForPath(path2), metadata); + reloadSpaceByPath(path3, metadata) { + return this.reloadSpace(this.spaceManager.spaceInfoForPath(path3), metadata); } async onPathRename(oldPath, newPath) { const newFilePath = newPath; @@ -112118,11 +112230,11 @@ var Superstate10 = class { this.pathsIndex.delete(oldPath); const allContextsWithPath = oldSpaces.map((f2) => this.spacesIndex.get(f2)).filter((f2) => f2); await renamePathInContexts(this.spaceManager, oldPath, newFilePath, allContextsWithPath.map((f2) => f2.space)); - for (const space2 of allContextsWithPath) { - if (space2.metadata?.links?.includes(oldPath)) { - this.addToContextStateQueue(() => saveSpaceMetadataValue(this, space2.path, "links", space2.metadata.links.map((f2) => f2 == oldPath ? newPath : f2))); + for (const space3 of allContextsWithPath) { + if (space3.metadata?.links?.includes(oldPath)) { + this.addToContextStateQueue(() => saveSpaceMetadataValue(this, space3.path, "links", space3.metadata.links.map((f2) => f2 == oldPath ? newPath : f2))); } - await this.reloadContext(space2.space); + await this.reloadContext(space3.space); } const allContextsWithLink = []; for (const [contextPath, contextCache] of this.contextsIndex) { @@ -112147,37 +112259,37 @@ var Superstate10 = class { view.openPath(newPath); }); } - async onPathCreated(path2) { - await this.reloadPath(path2, true); - const parent = getParentPathFromString(path2); - if (this.spacesIndex.has(parent) && this.spacesIndex.get(parent).defPath == path2) { + async onPathCreated(path3) { + await this.reloadPath(path3, true); + const parent = getParentPathFromString(path3); + if (this.spacesIndex.has(parent) && this.spacesIndex.get(parent).defPath == path3) { await this.reloadSpace(this.spacesIndex.get(parent).space); } - this.dispatchEvent("pathCreated", { path: path2 }); + this.dispatchEvent("pathCreated", { path: path3 }); } - onPathDeleted(path2) { - this.spacesMap.delete(path2); - this.linksMap.delete(path2); - this.linksMap.deleteInverse(path2); - this.persister.remove(path2, "path"); - const fileCache = this.pathsIndex.get(path2); + onPathDeleted(path3) { + this.spacesMap.delete(path3); + this.linksMap.delete(path3); + this.linksMap.deleteInverse(path3); + this.persister.remove(path3, "path"); + const fileCache = this.pathsIndex.get(path3); if (!fileCache) { return; } const allContextsWithFile = (fileCache.spaces ?? []).map((f2) => this.spacesIndex.get(f2)?.space).filter((f2) => f2); - this.addToContextStateQueue(() => removePathInContexts(this.spaceManager, path2, allContextsWithFile).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3)))); + this.addToContextStateQueue(() => removePathInContexts(this.spaceManager, path3, allContextsWithFile).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3)))); const allContextsWithLink = []; for (const [contextPath, contextCache] of this.contextsIndex) { - if (contextCache.outlinks.includes(path2) && this.spacesIndex.has(contextCache.path)) { + if (contextCache.outlinks.includes(path3) && this.spacesIndex.has(contextCache.path)) { allContextsWithLink.push(this.spacesIndex.get(contextCache.path).space); } } - this.addToContextStateQueue(() => removeLinkInContexts(this.spaceManager, path2, allContextsWithLink).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3)))); + this.addToContextStateQueue(() => removeLinkInContexts(this.spaceManager, path3, allContextsWithLink).then((f2) => allContextsWithFile.forEach((c3) => this.reloadContext(c3)))); (fileCache.spaces ?? []).forEach((f2) => { this.dispatchEvent("spaceStateUpdated", { path: f2 }); }); - this.pathsIndex.delete(path2); - this.dispatchEvent("pathDeleted", { path: path2 }); + this.pathsIndex.delete(path3); + this.dispatchEvent("pathDeleted", { path: path3 }); } async onSpaceRenamed(oldPath, newSpaceInfo) { if (this.spacesIndex.has(oldPath)) { @@ -112201,60 +112313,60 @@ var Superstate10 = class { await this.reloadFrames(newSpaceInfo).then((f2) => this.dispatchEvent("frameStateUpdated", { path: newSpaceInfo.path })); } } - onSpaceDeleted(space2) { - if (this.spacesIndex.has(space2)) { - this.spacesIndex.delete(space2); - this.contextsIndex.delete(space2); - this.framesIndex.delete(space2); + onSpaceDeleted(space3) { + if (this.spacesIndex.has(space3)) { + this.spacesIndex.delete(space3); + this.contextsIndex.delete(space3); + this.framesIndex.delete(space3); } - this.spacesMap.delete(space2); - this.spacesMap.deleteInverse(space2); - this.persister.remove(space2, "space"); - this.dispatchEvent("spaceDeleted", { path: space2 }); + this.spacesMap.delete(space3); + this.spacesMap.deleteInverse(space3); + this.persister.remove(space3, "space"); + this.dispatchEvent("spaceDeleted", { path: space3 }); } - async reloadActions(space2) { - if (!space2) + async reloadActions(space3) { + if (!space3) return false; - this.spaceManager.commandsForSpace(space2.path).then((r2) => { - this.actionsIndex.set(space2.path, r2); - this.dispatchEvent("actionStateUpdated", { path: space2.path }); + this.spaceManager.commandsForSpace(space3.path).then((r2) => { + this.actionsIndex.set(space3.path, r2); + this.dispatchEvent("actionStateUpdated", { path: space3.path }); }); } - async reloadFrames(space2) { - if (!space2) + async reloadFrames(space3) { + if (!space3) return false; - return this.indexer.reload({ type: "frames", path: space2.path }).then((r2) => { + return this.indexer.reload({ type: "frames", path: space3.path }).then((r2) => { const { changed, cache: cache2 } = r2; if (!changed) { return false; } - this.framesIndex.set(space2.path, cache2); - this.persister.store(space2.path, JSON.stringify(cache2), "frame"); + this.framesIndex.set(space3.path, cache2); + this.persister.store(space3.path, JSON.stringify(cache2), "frame"); return true; }); } - async reloadContextByPath(path2) { - return this.reloadContext(this.spaceManager.spaceInfoForPath(path2)); + async reloadContextByPath(path3) { + return this.reloadContext(this.spaceManager.spaceInfoForPath(path3)); } - async reloadContext(space2) { - if (!space2) + async reloadContext(space3) { + if (!space3) return false; - return this.indexer.reload({ type: "context", path: space2.path }).then((r2) => { - return this.contextReloaded(space2.path, r2.cache, r2.changed); + return this.indexer.reload({ type: "context", path: space3.path }).then((r2) => { + return this.contextReloaded(space3.path, r2.cache, r2.changed); }); } - async contextReloaded(path2, cache2, changed) { + async contextReloaded(path3, cache2, changed) { if (!changed) { return false; } - this.contextsIndex.set(path2, cache2); + this.contextsIndex.set(path3, cache2); if (cache2.dbExists) { if (this.settings.syncFormulaToFrontmatter) { const allRows = cache2.tables?.[defaultContextSchemaID]?.rows ?? []; const allColumns = cache2.tables?.[defaultContextSchemaID]?.cols ?? []; const updatedValues = allRows.filter((f2) => { - const path3 = f2[PathPropertyName]; - const pathCache = this.pathsIndex.get(path3); + const path4 = f2[PathPropertyName]; + const pathCache = this.pathsIndex.get(path4); if (!pathCache) { return false; } @@ -112283,14 +112395,14 @@ var Superstate10 = class { const missingPaths = cache2.paths.filter((f2) => !contextPaths.includes(f2)); const removedPaths = contextPaths.filter((f2) => !cache2.paths.includes(f2)); if (missingPaths.length > 0) { - this.addToContextStateQueue(() => insertContextItems(this.spaceManager, missingPaths, path2)); + this.addToContextStateQueue(() => insertContextItems(this.spaceManager, missingPaths, path3)); } if (removedPaths.length > 0) { this.addToContextStateQueue(() => removePathsInContext(this.spaceManager, removedPaths, cache2.space)); } } - this.persister.store(path2, JSON.stringify(cache2), "context"); - this.dispatchEvent("contextStateUpdated", { path: path2 }); + this.persister.store(path3, JSON.stringify(cache2), "context"); + this.dispatchEvent("contextStateUpdated", { path: path3 }); return true; } allSpaces(ordered) { @@ -112306,19 +112418,19 @@ var Superstate10 = class { return [...this.framesIndex.values()].filter((f2) => f2).flatMap((f2) => f2.schemas.filter((f3) => f3.type == "frame").map((s4) => ({ schema: s4, path: f2.path }))); } async updateSpaceMetadata(spacePath, metadata) { - const space2 = this.spacesIndex.get(spacePath); - const oldDef = space2?.metadata; - if (!space2) { + const space3 = this.spacesIndex.get(spacePath); + const oldDef = space3?.metadata; + if (!space3) { return this.reloadSpaceByPath(spacePath); } let spaceDefChanged = false; const spaceSort = metadata?.sort ?? { field: "rank", asc: true, group: true }; const sortable = spaceSort.field == "rank"; - if (!import_lodash12.default.isEqual(space2.metadata.links, metadata.links) || !import_lodash12.default.isEqual(space2.metadata.filters, metadata.filters)) { + if (!import_lodash12.default.isEqual(space3.metadata.links, metadata.links) || !import_lodash12.default.isEqual(space3.metadata.filters, metadata.filters)) { spaceDefChanged = true; } const newSpaceCache = { - ...space2, + ...space3, metadata, contexts: metadata?.contexts ?? [], sortable @@ -112327,35 +112439,35 @@ var Superstate10 = class { if (spaceDefChanged) { await this.onSpaceDefinitionChanged(newSpaceCache, oldDef); } - this.dispatchEvent("spaceStateUpdated", { path: space2.path }); + this.dispatchEvent("spaceStateUpdated", { path: space3.path }); return newSpaceCache; } - async reloadSpace(space2, spaceMetadata, initialized = true) { - if (!space2) + async reloadSpace(space3, spaceMetadata, initialized = true) { + if (!space3) return; - const metadata = spaceMetadata ?? await this.spaceManager.spaceDefForSpace(space2.path); - let pathState = this.pathsIndex.get(space2.path); - const type = this.spaceManager.spaceTypeByString(this.spaceManager.uriByString(space2.path)); + const metadata = spaceMetadata ?? await this.spaceManager.spaceDefForSpace(space3.path); + let pathState = this.pathsIndex.get(space3.path); + const type = this.spaceManager.spaceTypeByString(this.spaceManager.uriByString(space3.path)); if (type == "default" || type == "tag") { metadata.filters = []; metadata.links = []; } const propertyTypes = []; let properties3 = {}; - const frame = this.framesIndex.get(space2.path); + const frame = this.framesIndex.get(space3.path); if (frame) { const frameProps = frame.frames[mainFrameID]?.cols ?? []; propertyTypes.push(...frameProps); } else { - const frameProps = await this.spaceManager.readFrame(space2.path, mainFrameID).then((f2) => f2?.cols ?? []); + const frameProps = await this.spaceManager.readFrame(space3.path, mainFrameID).then((f2) => f2?.cols ?? []); propertyTypes.push(...frameProps); } if (propertyTypes.length > 0) { if (!pathState) { - const pathCache = this.spaceManager.readPathCache(space2.defPath); + const pathCache = await this.spaceManager.readPathCache(space3.defPath); pathState = { - path: space2.path, - name: space2.name, + path: space3.path, + name: space3.name, tags: [], spaces: [], outlinks: [], @@ -112363,17 +112475,17 @@ var Superstate10 = class { metadata: pathCache?.metadata, type: "space", subtype: type, - displayName: space2.name, + displayName: space3.name, label: pathCache?.label }; } - properties3 = await this.spaceManager.readProperties(space2.defPath).then((f2) => linkContextRow(this.formulaContext, this.pathsIndex, f2, propertyTypes, pathState)); + properties3 = await this.spaceManager.readProperties(space3.defPath).then((f2) => linkContextRow(this.formulaContext, this.pathsIndex, f2, propertyTypes, pathState)); } - [...this.spacesMap.get(space2.path)].map((f2) => this.contextsIndex.get(f2)).forEach((f2) => { + [...this.spacesMap.get(space3.path)].map((f2) => this.contextsIndex.get(f2)).forEach((f2) => { if (f2) { const contextProps = f2.tables?.[defaultContextSchemaID]?.cols ?? []; propertyTypes.push(...contextProps); - properties3 = { ...properties3, ...f2.tables?.[defaultContextSchemaID]?.rows.find((g) => g[PathPropertyName] == space2.path) ?? {} }; + properties3 = { ...properties3, ...f2.tables?.[defaultContextSchemaID]?.rows.find((g) => g[PathPropertyName] == space3.path) ?? {} }; } }); const spaceSort = metadata?.sort ?? { field: "rank", asc: true, group: true }; @@ -112381,15 +112493,15 @@ var Superstate10 = class { const contexts = metadata?.contexts ?? []; const dependencies314 = uniq((metadata.filters ?? []).flatMap((f2) => f2.filters).flatMap((f2) => f2.type == "context" ? [f2.field.split(".")[0]] : f2.type == "path" && f2.field == "space" ? parseMultiString(f2.value) : [])); if (type == "tag" && this.settings.autoAddContextsToSubtags) { - const parentTags = getAllParentTags(space2.name); + const parentTags = getAllParentTags(space3.name); contexts.push(...parentTags); } - const templates = await this.spaceManager.readTemplates(space2.path); + const templates = await this.spaceManager.readTemplates(space3.path); const cache2 = { - name: space2.name, - space: space2, - path: space2.path, - defPath: space2.defPath, + name: space3.name, + space: space3, + path: space3.path, + defPath: space3.defPath, type, templates, contexts: contexts.map((f2) => ensureTag(f2)), @@ -112399,31 +112511,31 @@ var Superstate10 = class { properties: properties3, propertyTypes }; - this.spacesIndex.set(space2.path, cache2); - this.persister.store(space2.path, JSON.stringify(cache2), "space"); + this.spacesIndex.set(space3.path, cache2); + this.persister.store(space3.path, JSON.stringify(cache2), "space"); cache2.metadata?.links?.forEach((f2) => { if (pathIsSpace(this, f2)) { - this.spacesMap.set(f2, /* @__PURE__ */ new Set([...this.spacesMap.get(f2), space2.path])); + this.spacesMap.set(f2, /* @__PURE__ */ new Set([...this.spacesMap.get(f2), space3.path])); } }); if (initialized) { - this.dispatchEvent("spaceStateUpdated", { path: space2.path }); + this.dispatchEvent("spaceStateUpdated", { path: space3.path }); return cache2; } } - async pathReloaded(path2, cache2, changed, force) { - this.pathsIndex.set(path2, cache2); - await this.onPathReloaded(path2); + async pathReloaded(path3, cache2, changed, force) { + this.pathsIndex.set(path3, cache2); + await this.onPathReloaded(path3); if (cache2.subtype == "image" || cache2.metadata?.file?.extension == "svg") { - this.imagesCache.set(cache2.metadata.file.filename, path2); + this.imagesCache.set(cache2.metadata.file.filename, path3); } if (!changed && !force) { return false; } - this.tagsMap.set(path2, new Set(cache2.tags)); - this.linksMap.set(path2, new Set(cache2.outlinks)); - if (!import_lodash12.default.isEqual(cache2.spaces, Array.from(this.spacesMap.get(path2)))) { - this.spacesMap.set(path2, new Set(cache2.spaces)); + this.tagsMap.set(path3, new Set(cache2.tags)); + this.linksMap.set(path3, new Set(cache2.outlinks)); + if (!import_lodash12.default.isEqual(cache2.spaces, Array.from(this.spacesMap.get(path3)))) { + this.spacesMap.set(path3, new Set(cache2.spaces)); const promises = cache2.tags.map((f2) => this.spacesIndex.has(tagSpacePathFromTag(f2)) ? null : fileSystemSpaceInfoFromTag(this.spaceManager, f2)).filter((f2) => f2).map( async (f2) => { await this.reloadSpace(f2); @@ -112439,7 +112551,7 @@ var Superstate10 = class { } if (force) { const allContextsWithFile = cache2.spaces.map((f2) => this.spacesIndex.get(f2)?.space).filter((f2) => f2); - this.addToContextStateQueue(() => updateContextWithProperties(this, path2, allContextsWithFile).then((g) => { + this.addToContextStateQueue(() => updateContextWithProperties(this, path3, allContextsWithFile).then((g) => { allContextsWithFile.forEach((f2) => { this.reloadContext(f2); this.dispatchEvent("spaceStateUpdated", { path: f2.path }); @@ -112447,29 +112559,29 @@ var Superstate10 = class { })); } if (cache2.metadata?.file?.extension == "svg" && this.settings.indexSVG) { - this.spaceManager.readPath(path2).then((f2) => { - this.iconsCache.set(path2, f2); - this.persister.store(path2, f2, "icon"); + this.spaceManager.readPath(path3).then((f2) => { + this.iconsCache.set(path3, f2); + this.persister.store(path3, f2, "icon"); }); } } - async reloadPath(path2, force) { - if (!path2) + async reloadPath(path3, force) { + if (!path3) return false; - return this.indexer.reload({ type: "path", path: path2 }).then(async (r2) => { - await this.pathReloaded(path2, r2.cache, r2.changed, force); + return this.indexer.reload({ type: "path", path: path3 }).then(async (r2) => { + await this.pathReloaded(path3, r2.cache, r2.changed, force); return true; }); } - async onPathReloaded(path2) { + async onPathReloaded(path3) { let pathState; - if (this.pathsIndex.has(path2)) { - pathState = this.pathsIndex.get(path2); + if (this.pathsIndex.has(path3)) { + pathState = this.pathsIndex.get(path3); } if (!pathState) { return false; } - await this.persister.store(path2, serializePathState(pathState), "path"); + await this.persister.store(path3, serializePathState(pathState), "path"); } }; @@ -112483,8 +112595,8 @@ var FilesystemMiddleware = class { static create() { return new FilesystemMiddleware(); } - resolvePath(path2, source) { - return this.primary.resolvePath(path2, source); + resolvePath(path3, source) { + return this.primary.resolvePath(path3, source); } keysForCacheType(cacheType) { return this.primary.keysForCacheType(cacheType); @@ -112516,9 +112628,9 @@ var FilesystemMiddleware = class { } getFileCacheTypeByRefString(file, refString) { const adapters = this.filetypeAdaptersForFile(file); - return adapters.reduce((p, c3) => { - if (p) - return p; + return adapters.reduce((p2, c3) => { + if (p2) + return p2; return c3.getCacheTypeByRefString(file, refString); }, null); } @@ -112528,21 +112640,21 @@ var FilesystemMiddleware = class { allFiles() { return this.primary.allFiles(); } - resourcePathForPath(path2) { - return this.adapterForPath(path2).resourcePathForPath(path2); + resourcePathForPath(path3) { + return this.adapterForPath(path3).resourcePathForPath(path3); } - parentPathForPath(path2) { - return this.adapterForPath(path2).parentPathForPath(path2); + parentPathForPath(path3) { + return this.adapterForPath(path3).parentPathForPath(path3); } - async createFileCache(path2) { - const file = await this.getFile(path2); + async createFileCache(path3) { + const file = await this.getFile(path3); for (const adapter of this.filetypeAdaptersForFile(file)) { if (adapter.parseCache) await adapter.parseCache(file, false); } } - getFileCache(path2) { - return this.adapterForPath(path2).getFileCache(path2); + getFileCache(path3) { + return this.adapterForPath(path3).getFileCache(path3); } getFileContent(file, contentType, contentId) { const adapters = this.filetypeAdaptersForFile(file).filter((f2) => f2.contentTypes(file).includes(contentType)); @@ -112550,8 +112662,8 @@ var FilesystemMiddleware = class { return adapters[0].readContent(file, contentType, contentId); } } - updateFileCache(path2, cache2, refresh) { - this.adapterForPath(path2).updateFileCache(path2, cache2, refresh); + updateFileCache(path3, cache2, refresh) { + this.adapterForPath(path3).updateFileCache(path3, cache2, refresh); } readFileFragments(file, fragmentType, query) { const adapters = this.filetypeAdaptersForFileFragments(file, fragmentType); @@ -112559,23 +112671,23 @@ var FilesystemMiddleware = class { return adapters[0].readContent(file, fragmentType, query); } } - async newFile(parent, name317, type, content3) { + async newFile(parent, name317, type, content5) { const adapter = this.filetypes.find((f2) => f2.supportedFileTypes.includes(type)); if (adapter) - return adapter.newFile(parent, name317, type, content3); + return adapter.newFile(parent, name317, type, content5); } - newFileFragment(file, fragmentType, name317, content3, options) { + newFileFragment(file, fragmentType, name317, content5, options) { const adapters = this.filetypeAdaptersForFileFragments(file, fragmentType); if (adapters.length >= 1) { - return adapters[0].newContent(file, fragmentType, name317, content3, options); + return adapters[0].newContent(file, fragmentType, name317, content5, options); } } - saveFileLabel(file, key2, value) { + saveFileLabel(file, key3, value) { const adapters = this.filetypeAdaptersForFileFragments(file, "label"); if (adapters.length >= 1) { - return adapters[0].saveContent(file, "label", key2, () => value); + return adapters[0].saveContent(file, "label", key3, () => value); } else { - return this.primary.updateFileLabel(file.path, key2, value); + return this.primary.updateFileLabel(file.path, key3, value); } } saveFileFragment(file, fragmentType, fragmentId, saveContent) { @@ -112603,53 +112715,53 @@ var FilesystemMiddleware = class { onDelete(file) { this.eventDispatch.dispatchEvent("onDelete", { file }); } - adapterForPath(path2) { + adapterForPath(path3) { return this.primary; } async getRoot() { return this.adapterForPath().getRoot(); } - async copyFile(path2, folder, newName) { - return this.adapterForPath(path2).copyFile(path2, folder, newName); + async copyFile(path3, folder, newName) { + return this.adapterForPath(path3).copyFile(path3, folder, newName); } - async writeTextToFile(path2, content3) { - return this.adapterForPath(path2).writeTextToFile(path2, content3); + async writeTextToFile(path3, content5) { + return this.adapterForPath(path3).writeTextToFile(path3, content5); } - async readTextFromFile(path2) { - return this.adapterForPath(path2).readTextFromFile(path2); + async readTextFromFile(path3) { + return this.adapterForPath(path3).readTextFromFile(path3); } - async writeBinaryToFile(path2, buffer) { - return this.adapterForPath(path2).writeBinaryToFile(path2, buffer); + async writeBinaryToFile(path3, buffer2) { + return this.adapterForPath(path3).writeBinaryToFile(path3, buffer2); } - async readBinaryToFile(path2) { - return this.adapterForPath(path2).readBinaryToFile(path2); + async readBinaryToFile(path3) { + return this.adapterForPath(path3).readBinaryToFile(path3); } - async renameFile(path2, newPath) { - return this.adapterForPath(path2).renameFile(path2, newPath); + async renameFile(path3, newPath) { + return this.adapterForPath(path3).renameFile(path3, newPath); } - async createFolder(path2) { - return this.adapterForPath(path2).createFolder(path2); + async createFolder(path3) { + return this.adapterForPath(path3).createFolder(path3); } - async childrenForFolder(path2, type) { - return this.adapterForPath(path2).childrenForFolder(path2, type); + async childrenForFolder(path3, type) { + return this.adapterForPath(path3).childrenForFolder(path3, type); } - async fileExists(path2) { - return this.adapterForPath(path2).fileExists(path2); + async fileExists(path3) { + return this.adapterForPath(path3).fileExists(path3); } - async getFile(path2, source) { - return this.adapterForPath(path2).getFile(path2, source); + async getFile(path3, source) { + return this.adapterForPath(path3).getFile(path3, source); } - async deleteFile(path2) { - return this.adapterForPath(path2).deleteFile(path2); + async deleteFile(path3) { + return this.adapterForPath(path3).deleteFile(path3); } - async addTagToFile(path2, tag2) { - return this.adapterForPath(path2).addTagToFile(path2, tag2); + async addTagToFile(path3, tag2) { + return this.adapterForPath(path3).addTagToFile(path3, tag2); } - async renameTagForFile(path2, oldTag, newTag) { - return this.adapterForPath(path2).renameTagForFile(path2, oldTag, newTag); + async renameTagForFile(path3, oldTag, newTag) { + return this.adapterForPath(path3).renameTagForFile(path3, oldTag, newTag); } - async removeTagFromFile(path2, tag2) { - return this.adapterForPath(path2).removeTagFromFile(path2, tag2); + async removeTagFromFile(path3, tag2) { + return this.adapterForPath(path3).removeTagFromFile(path3, tag2); } filesForTag(tag2) { return this.primary.filesForTag(tag2); @@ -112700,14 +112812,14 @@ var FilesystemSpaceAdapter = class { initiateAdapter(manager) { this.spaceManager = manager; } - async readTemplates(path2) { - return (await this.childrenForPath(`${path2}/.space/templates`)).filter((f2) => !f2.startsWith(".")).map((f2) => f2.split("/").pop()); + async readTemplates(path3) { + return (await this.childrenForPath(`${path3}/.space/templates`)).filter((f2) => !f2.startsWith(".")).map((f2) => f2.split("/").pop()); } - async saveTemplate(path2, space2) { - return this.copyPath(path2, `${space2}/.space/templates`); + async saveTemplate(path3, space3) { + return this.copyPath(path3, `${space3}/.space/templates`); } - deleteTemplate(path2, space2) { - return this.deletePath(`${space2}/.space/templates/${path2}`); + deleteTemplate(path3, space3) { + return this.deletePath(`${space3}/.space/templates/${path3}`); } async readWaypoints() { if (!await this.fileSystem.fileExists(defaultSpaceFolder)) { @@ -112753,10 +112865,10 @@ var FilesystemSpaceAdapter = class { async readAllTemplates() { const strings = (await this.childrenForPath(defaultTemplatesFolder)).map((f2) => f2.split("/").pop()); const templates = {}; - for (const string4 of strings) { - const template2 = await this.readTemplate(string4); + for (const string6 of strings) { + const template2 = await this.readTemplate(string6); if (template2) { - templates[string4] = template2; + templates[string6] = template2; } } return templates; @@ -112794,67 +112906,67 @@ var FilesystemSpaceAdapter = class { async onMetadataChange(payload) { if (!payload.path) return; - for (const space2 of this.allSpaces()) { - if (space2.defPath == payload.path) { - this.spaceManager.onPathPropertyChanged(space2.path); + for (const space3 of this.allSpaces()) { + if (space3.defPath == payload.path) { + this.spaceManager.onPathPropertyChanged(space3.path); return; } } this.spaceManager.onPathPropertyChanged(payload.path); } - uriByPath(path2) { - return this.spaceManager.uriByString(path2); + uriByPath(path3) { + return this.spaceManager.uriByString(path3); } allPaths(type) { return [...this.fileSystem.allFiles().filter((f2) => type ? type.some((g) => g == "folder" ? f2.isFolder : f2.extension == g) : true).map((g) => g.path)]; } - async pathExists(path2) { - return this.fileSystem.fileExists(path2); + async pathExists(path3) { + return this.fileSystem.fileExists(path3); } - async createItemAtPath(parent, type, name317, content3) { + async createItemAtPath(parent, type, name317, content5) { const parentURI = await this.getPathInfo(parent); if (!parentURI?.isFolder) { const file = await this.fileSystem.getFile(parent); if (!file) return null; - return this.fileSystem.newFileFragment(file, type, name317, content3)?.then((f2) => file.path); + return this.fileSystem.newFileFragment(file, type, name317, content5)?.then((f2) => file.path); } - return this.fileSystem.newFile(parent, name317, type, content3).then((f2) => f2?.path); + return this.fileSystem.newFile(parent, name317, type, content5).then((f2) => f2?.path); } - async renamePath(oldPath, path2) { + async renamePath(oldPath, path3) { const uri = this.uriByPath(oldPath); - const newUri = this.uriByPath(path2); + const newUri = this.uriByPath(path3); const file = await this.fileSystem.getFile(uri.path); if (uri.refStr) { const refType = await this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr); return await this.fileSystem.saveFileFragment(file, refType, uri.refStr, () => newUri.refStr); } - return await this.fileSystem.renameFile(oldPath, path2); + return await this.fileSystem.renameFile(oldPath, path3); } - async deletePath(path2) { - const uri = this.uriByPath(path2); + async deletePath(path3) { + const uri = this.uriByPath(path3); if (uri.refStr) { const file = await this.fileSystem.getFile(uri.path); const refType = await this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr); return this.fileSystem.deleteFileFragment(file, refType, uri.refStr); } - return this.fileSystem.deleteFile(path2); + return this.fileSystem.deleteFile(path3); } - async getPathInfo(path2) { - const uri = this.uriByPath(path2); + async getPathInfo(path3) { + const uri = this.uriByPath(path3); const file = await this.fileSystem.getFile(uri.path); if (uri.refStr) { const type = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr); } return file; } - keysForCacheType(path2) { - return this.fileSystem.keysForCacheType(path2); + keysForCacheType(path3) { + return this.fileSystem.keysForCacheType(path3); } - readPathCache(path2) { - const uri = this.uriByPath(path2); + async readPathCache(path3) { + const uri = this.uriByPath(path3); if (uri.scheme == "spaces") { - if (path2.startsWith(tagsSpacePath)) { + if (path3.startsWith(tagsSpacePath)) { return { file: null, metadata: null, @@ -112896,44 +113008,44 @@ var FilesystemSpaceAdapter = class { }; } } - return this.fileSystem.getFileCache(path2); + return this.fileSystem.getFileCache(path3); } - async readPath(path2) { - const uri = this.uriByPath(path2); + async readPath(path3) { + const uri = this.uriByPath(path3); const file = await this.fileSystem.getFile(uri.path); if (uri.refStr) { const fragmentType = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr); this.fileSystem.getFileContent(file, fragmentType, uri.refStr); } - return this.fileSystem.readTextFromFile(path2); + return this.fileSystem.readTextFromFile(path3); } - async copyPath(path2, newPath, newName) { - const uri = this.uriByPath(path2); + async copyPath(path3, newPath, newName) { + const uri = this.uriByPath(path3); const file = await this.fileSystem.getFile(uri.path); return this.fileSystem.copyFile(file.path, newPath, newName); } - async writeToPath(path2, content3, binary) { - const uri = this.uriByPath(path2); + async writeToPath(path3, content5, binary) { + const uri = this.uriByPath(path3); const file = await this.fileSystem.getFile(uri.path); if (uri.refStr) { const fragmentType = this.fileSystem.getFileCacheTypeByRefString(file, uri.refStr); - this.fileSystem.saveFileFragment(file, fragmentType, uri.refStr, () => content3); + this.fileSystem.saveFileFragment(file, fragmentType, uri.refStr, () => content5); } if (binary) { - return this.fileSystem.writeBinaryToFile(path2, content3); + return this.fileSystem.writeBinaryToFile(path3, content5); } - return this.fileSystem.writeTextToFile(path2, content3); + return this.fileSystem.writeTextToFile(path3, content5); } - async childrenForPath(path2, type) { - if (await this.fileSystem.fileExists(path2)) - return this.fileSystem.childrenForFolder(path2, type); + async childrenForPath(path3, type) { + if (await this.fileSystem.fileExists(path3)) + return this.fileSystem.childrenForFolder(path3, type); return []; } - parentPathForPath(path2) { - return this.fileSystem.parentPathForPath(path2); + parentPathForPath(path3) { + return this.fileSystem.parentPathForPath(path3); } - async readFrame(path2, schema) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async readFrame(path3, schema) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { const defaultTemplate2 = this.defaultFrame(); if (Object.keys(defaultTemplate2).some((f2) => f2 == schema)) { @@ -112943,15 +113055,15 @@ var FilesystemSpaceAdapter = class { } return this.fileSystem.readFileFragments(mdbFile, "mdbTable", schema); } - async readAllFrames(path2) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async readAllFrames(path3) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { return this.defaultFrame(); } return this.fileSystem.readFileFragments(mdbFile, "mdbTables"); } - async readTable(path2, schema) { - const spaceInfo = this.spaceInfoForPath(path2); + async readTable(path3, schema) { + const spaceInfo = this.spaceInfoForPath(path3); const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath); if (!mdbFile && schema == defaultContextDBSchema.id) { const defaultTable = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo); @@ -112959,15 +113071,18 @@ var FilesystemSpaceAdapter = class { } return this.fileSystem.readFileFragments(mdbFile, "mdbTable", schema); } - async spaceInitiated(path2) { - const spaceInfo = this.spaceInfoForPath(path2); + async spaceInitiated(path3) { + return true; + } + async contextInitiated(path3) { + const spaceInfo = this.spaceInfoForPath(path3); const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath); if (mdbFile) return true; return false; } - async tablesForSpace(path2) { - const spaceInfo = this.spaceInfoForPath(path2); + async tablesForSpace(path3) { + const spaceInfo = this.spaceInfoForPath(path3); const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath); if (!mdbFile) { return defaultContextTable.rows; @@ -112975,7 +113090,7 @@ var FilesystemSpaceAdapter = class { return this.fileSystem.readFileFragments(mdbFile, "schemas", null); } defaultDBTablesForContext(spaceInfo) { - const table = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo); + const table2 = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo); const defaultFields = defaultFieldsForContext(spaceInfo); const defaultTable = defaultTablesForContext(spaceInfo); return { @@ -112983,12 +113098,12 @@ var FilesystemSpaceAdapter = class { m_fields: { uniques: defaultFields.uniques, cols: defaultFields.cols, - rows: [...defaultFields.rows ?? [], ...table.cols] + rows: [...defaultFields.rows ?? [], ...table2.cols] }, - [table.schema.id]: { - uniques: table.cols.filter((c3) => c3.unique == "true").map((c3) => c3.name), - cols: table.cols.map((c3) => c3.name), - rows: table.rows + [table2.schema.id]: { + uniques: table2.cols.filter((c3) => c3.unique == "true").map((c3) => c3.name), + cols: table2.cols.map((c3) => c3.name), + rows: table2.rows } }; } @@ -112998,57 +113113,57 @@ var FilesystemSpaceAdapter = class { } return DefaultMDBTables; } - async createDefaultTable(path2) { - const spaceInfo = this.spaceInfoForPath(path2); - const dbPath = this.spaceInfoForPath(path2).dbPath; - const extension = dbPath.split(".").pop(); + async createDefaultTable(path3) { + const spaceInfo = this.spaceInfoForPath(path3); + const dbPath = this.spaceInfoForPath(path3).dbPath; + const extension2 = dbPath.split(".").pop(); const folder = dbPath.split("/").slice(0, -1).join("/"); const filename = dbPath.split("/").pop().split(".")[0]; - return this.fileSystem.newFile(folder, filename, extension, this.defaultDBTablesForContext(spaceInfo)); + return this.fileSystem.newFile(folder, filename, extension2, this.defaultDBTablesForContext(spaceInfo)); } - async createDefaultFrames(path2) { + async createDefaultFrames(path3) { const defaultSpaceTemplate = this.defaultFrame(); const dbField = { ...mdbFrameToDBTables(defaultSpaceTemplate), m_schema: defaultFramesTable }; - const dbPath = this.spaceInfoForPath(path2).framePath; - const extension = dbPath.split(".").pop(); + const dbPath = this.spaceInfoForPath(path3).framePath; + const extension2 = dbPath.split(".").pop(); const folder = dbPath.split("/").slice(0, -1).join("/"); const filename = dbPath.split("/").pop().split(".")[0]; - return this.fileSystem.newFile(folder, filename, extension, dbField); + return this.fileSystem.newFile(folder, filename, extension2, dbField); } - async createTable(path2, schema) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async createTable(path3, schema) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); if (!mdbFile) { - mdbFile = await this.createDefaultTable(path2); + mdbFile = await this.createDefaultTable(path3); } return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema); } - async saveTableSchema(path2, schemaId, saveSchema) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async saveTableSchema(path3, schemaId, saveSchema) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); if (!mdbFile) { - mdbFile = await this.createDefaultTable(path2); + mdbFile = await this.createDefaultTable(path3); } return this.fileSystem.saveFileFragment(mdbFile, "schema", schemaId, saveSchema); } - async saveTable(path2, table, force) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async saveTable(path3, table2, force) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); if (!mdbFile) { if (force) { - mdbFile = await this.createDefaultTable(path2); + mdbFile = await this.createDefaultTable(path3); } else { return false; } } - return this.fileSystem.saveFileFragment(mdbFile, "mdbTable", table.schema.id, () => table); + return this.fileSystem.saveFileFragment(mdbFile, "mdbTable", table2.schema.id, () => table2); } - async deleteTable(path2, name317) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async deleteTable(path3, name317) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); return this.fileSystem.deleteFileFragment(mdbFile, "schema", name317); } - async readAllTables(path2) { - const spaceInfo = this.spaceInfoForPath(path2); + async readAllTables(path3) { + const spaceInfo = this.spaceInfoForPath(path3); const mdbFile = await this.fileSystem.getFile(spaceInfo.dbPath); if (!mdbFile) { const defaultTable = defaultTableDataForContext(this.spaceManager.superstate, spaceInfo); @@ -113058,40 +113173,40 @@ var FilesystemSpaceAdapter = class { } return this.fileSystem.readFileFragments(mdbFile, "mdbTables", null); } - async framesForSpace(path2) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async framesForSpace(path3) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { const frames = this.defaultFrame(); return Object.values(frames).map((f2) => f2.schema); } return this.fileSystem.readFileFragments(mdbFile, "schemas", null); } - async createFrame(path2, schema) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async createFrame(path3, schema) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { - mdbFile = await this.createDefaultFrames(path2); + mdbFile = await this.createDefaultFrames(path3); } return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema); } - async deleteFrame(path2, name317) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async deleteFrame(path3, name317) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); return this.fileSystem.deleteFileFragment(mdbFile, "schema", name317); } - async saveFrameSchema(path2, schemaId, saveSchema) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async saveFrameSchema(path3, schemaId, saveSchema) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { - mdbFile = await this.createDefaultFrames(path2); + mdbFile = await this.createDefaultFrames(path3); } return this.fileSystem.saveFileFragment(mdbFile, "schema", schemaId, saveSchema); } - async saveFrame(path2, frame) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).framePath); + async saveFrame(path3, frame) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).framePath); if (!mdbFile) { - mdbFile = await this.createDefaultFrames(path2); + mdbFile = await this.createDefaultFrames(path3); } return this.fileSystem.saveFileFragment(mdbFile, "mdbFrame", frame.schema.id, () => frame); } - async createDefaultCommands(path2) { + async createDefaultCommands(path3) { const dbField = { m_fields: { uniques: fieldSchema.uniques, @@ -113104,21 +113219,21 @@ var FilesystemSpaceAdapter = class { rows: [] } }; - const dbPath = this.spaceInfoForPath(path2).commandsPath; - const extension = dbPath.split(".").pop(); + const dbPath = this.spaceInfoForPath(path3).commandsPath; + const extension2 = dbPath.split(".").pop(); const folder = dbPath.split("/").slice(0, -1).join("/"); const filename = dbPath.split("/").pop().split(".")[0]; - return this.fileSystem.newFile(folder, filename, extension, dbField); + return this.fileSystem.newFile(folder, filename, extension2, dbField); } - async commandsForSpace(path2) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath); + async commandsForSpace(path3) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath); if (!mdbFile) { return []; } return this.fileSystem.readFileFragments(mdbFile, "mdbCommands", null); } - async runCommand(path2, name317, args) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath); + async runCommand(path3, name317, args) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath); if (!mdbFile) { return { result: null, error: "No commands file found" }; } @@ -113132,16 +113247,16 @@ var FilesystemSpaceAdapter = class { if (command.schema.type == "script") result = executeCode(command.code, args); if (command.schema.type == "formula") - result = runFormulaWithContext(this.spaceManager.superstate.formulaContext, this.spaceManager.superstate.pathsIndex, command.code, command.fields.reduce((p, c3) => ({ ...p, [c3.name]: c3 }), {}), args, this.spaceManager.superstate.pathsIndex.get(path2)); + result = runFormulaWithContext(this.spaceManager.superstate.formulaContext, this.spaceManager.superstate.pathsIndex, command.code, command.fields.reduce((p2, c3) => ({ ...p2, [c3.name]: c3 }), {}), args, this.spaceManager.superstate.pathsIndex.get(path3)); } catch (e5) { error = e5; } return { result, error }; } - async createCommand(path2, schema) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath); + async createCommand(path3, schema) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath); if (!mdbFile) { - mdbFile = await this.createDefaultCommands(path2); + mdbFile = await this.createDefaultCommands(path3); } return this.fileSystem.newFileFragment(mdbFile, "schema", schema.id, schema); } @@ -113192,65 +113307,65 @@ var FilesystemSpaceAdapter = class { } }; const dbPath = mdbFile.path; - const extension = dbPath.split(".").pop(); + const extension2 = dbPath.split(".").pop(); const folder = dbPath.split("/").slice(0, -1).join("/"); const filename = dbPath.split("/").pop().split(".")[0]; - await this.fileSystem.newFile(folder, filename, extension, dbField); + await this.fileSystem.newFile(folder, filename, extension2, dbField); } } - async deleteCommand(path2, name317) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath); + async deleteCommand(path3, name317) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath); return this.fileSystem.deleteFileFragment(mdbFile, "mdbCommand", name317); } - async saveCommand(path2, schemaId, saveCommand) { - let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).commandsPath); + async saveCommand(path3, schemaId, saveCommand) { + let mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).commandsPath); if (!mdbFile) { - mdbFile = await this.createDefaultCommands(path2); + mdbFile = await this.createDefaultCommands(path3); } return this.fileSystem.saveFileFragment(mdbFile, "mdbCommand", schemaId, saveCommand); } - async contextForSpace(path2) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async contextForSpace(path3) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); if (!mdbFile) { - return defaultTableDataForContext(this.spaceManager.superstate, this.spaceInfoForPath(path2)); + return defaultTableDataForContext(this.spaceManager.superstate, this.spaceInfoForPath(path3)); } return this.fileSystem.readFileFragments(mdbFile, "mdbTable", defaultContextSchemaID); } - async addSpaceProperty(path2, property) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2)?.dbPath); + async addSpaceProperty(path3, property) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3)?.dbPath); if (!mdbFile) { - await this.createDefaultTable(path2); + await this.createDefaultTable(path3); } return this.fileSystem.newFileFragment(mdbFile, "field", property.name, property); } - async deleteSpaceProperty(path2, property) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async deleteSpaceProperty(path3, property) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); return this.fileSystem.deleteFileFragment(mdbFile, "field", property); } - async saveSpaceProperty(path2, property, oldProperty) { - const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path2).dbPath); + async saveSpaceProperty(path3, property, oldProperty) { + const mdbFile = await this.fileSystem.getFile(this.spaceInfoForPath(path3).dbPath); if (!mdbFile) { - await this.createDefaultTable(path2); + await this.createDefaultTable(path3); } return this.fileSystem.saveFileFragment(mdbFile, "field", oldProperty, (prev) => ({ ...prev, ...property })); } - async addProperty(path2, property) { - const file = await this.fileSystem.getFile(path2); + async addProperty(path3, property) { + const file = await this.fileSystem.getFile(path3); this.fileSystem.newFileFragment(file, "property", property.name, property); } - async saveProperties(path2, properties3) { - const file = await this.fileSystem.getFile(path2); + async saveProperties(path3, properties3) { + const file = await this.fileSystem.getFile(path3); this.fileSystem.saveFileFragment(file, "property", null, (prev) => ({ ...prev, ...properties3 })); } - async readLabel(path2) { - return this.fileSystem.getFileCache(path2).label; + async readLabel(path3) { + return this.fileSystem.getFileCache(path3).label; } - async saveLabel(path2, label, value) { - const file = await this.fileSystem.getFile(path2); + async saveLabel(path3, label, value) { + const file = await this.fileSystem.getFile(path3); this.fileSystem.saveFileLabel(file, label, value); } - async renameProperty(path2, property, newProperty) { - const file = await this.fileSystem.getFile(path2); + async renameProperty(path3, property, newProperty) { + const file = await this.fileSystem.getFile(path3); this.fileSystem.saveFileFragment(file, "property", null, (prev) => { const { [property]: value, ...properties3 } = prev; if (!value) @@ -113258,12 +113373,12 @@ var FilesystemSpaceAdapter = class { return { ...properties3, [newProperty]: value }; }); } - async readProperties(path2) { - const file = await this.fileSystem.getFile(path2); + async readProperties(path3) { + const file = await this.fileSystem.getFile(path3); return this.fileSystem.readFileFragments(file, "property", null); } - async deleteProperty(path2, property) { - const file = await this.fileSystem.getFile(path2); + async deleteProperty(path3, property) { + const file = await this.fileSystem.getFile(path3); this.fileSystem.deleteFileFragment(file, "property", property); } allSpaces() { @@ -113280,31 +113395,31 @@ var FilesystemSpaceAdapter = class { readTags() { return this.fileSystem.allTags(); } - spaceInfoForPath(path2) { - return fileSystemSpaceInfoByPath(this.spaceManager, path2); + spaceInfoForPath(path3) { + return fileSystemSpaceInfoByPath(this.spaceManager, path3); } allCaches() { return this.fileSystem.allCaches(); } - async spaceDefForSpace(path2) { - const space2 = this.spaceInfoForPath(path2); - if (!space2) + async spaceDefForSpace(path3) { + const space3 = this.spaceInfoForPath(path3); + if (!space3) return null; - const defFile = await this.fileSystem.getFile(space2.defPath); + const defFile = await this.fileSystem.getFile(space3.defPath); const metaCache = defFile ? this.fileSystem.getFileCache(defFile.path)?.frontmatter : null; const spaceDef = metaCache ?? {}; return parseSpaceMetadata(spaceDef, this.spaceManager.superstate.settings); } - async createSpace(name317, parentPath, definition) { + async createSpace(name317, parentPath, definition3) { const spaceInfo = this.spaceInfoForPath(parentPath); const newPath = spaceInfo.folderPath == "/" ? name317 : spaceInfo.folderPath + "/" + name317; await this.fileSystem.createFolder(newPath); - if (Object.keys(definition ?? {}).length > 0) - return this.saveSpace(newPath, () => definition); + if (Object.keys(definition3 ?? {}).length > 0) + return this.saveSpace(newPath, () => definition3); } - async saveSpace(path2, definitionFn, properties3) { - const metadata = definitionFn(await this.spaceDefForSpace(path2)) ?? {}; - const spaceInfo = this.spaceInfoForPath(path2); + async saveSpace(path3, definitionFn, properties3) { + const metadata = definitionFn(await this.spaceDefForSpace(path3)) ?? {}; + const spaceInfo = this.spaceInfoForPath(path3); let file = await this.fileSystem.getFile(spaceInfo.defPath); if (!file) { file = await this.fileSystem.newFile(spaceInfo.folderPath, spaceInfo.name, "md"); @@ -113326,28 +113441,28 @@ var FilesystemSpaceAdapter = class { const newSpaceInfo = this.spaceInfoForPath(newPath); this.fileSystem.renameFile(spaceInfo.folderPath, newSpaceInfo.folderPath).then((f2) => this.fileSystem.renameFile(movePath(spaceInfo.defPath, newSpaceInfo.path), newSpaceInfo.defPath)); } - deleteSpace(path2) { - const spaceCache = this.spaceInfoForPath(path2); + deleteSpace(path3) { + const spaceCache = this.spaceInfoForPath(path3); const spaceInfo = fileSystemSpaceInfoFromTag(this.spaceManager, spaceCache.name); this.fileSystem.deleteFile(spaceInfo.folderPath); } - childrenForSpace(path2) { - return this.fileSystem.allFiles().filter((f2) => f2.parent == path2).map((f2) => f2.path); + childrenForSpace(path3) { + return this.fileSystem.allFiles().filter((f2) => f2.parent == path3).map((f2) => f2.path); } - addTag(path2, tag2) { - this.fileSystem.addTagToFile(path2, tag2); + addTag(path3, tag2) { + this.fileSystem.addTagToFile(path3, tag2); } - renameTag(path2, tag2, newTag) { - this.fileSystem.renameTagForFile(path2, tag2, newTag); + renameTag(path3, tag2, newTag) { + this.fileSystem.renameTagForFile(path3, tag2, newTag); } - deleteTag(path2, tag2) { - this.fileSystem.removeTagFromFile(path2, tag2); + deleteTag(path3, tag2) { + this.fileSystem.removeTagFromFile(path3, tag2); } pathsForTag(tag2) { return this.fileSystem.filesForTag(tag2); } - resolvePath(path2, source) { - return this.fileSystem.resolvePath(path2, source); + resolvePath(path3, source) { + return this.fileSystem.resolvePath(path3, source); } }; @@ -113394,24 +113509,24 @@ function getTag(value) { return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value); } var INCORRECT_INDEX_TYPE = "Incorrect 'index' type"; -var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key2) => `Invalid value for key ${key2}`; +var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key3) => `Invalid value for key ${key3}`; var PATTERN_LENGTH_TOO_LARGE = (max5) => `Pattern length exceeds max of ${max5}.`; var MISSING_KEY_PROPERTY = (name317) => `Missing ${name317} property in key`; -var INVALID_KEY_WEIGHT_VALUE = (key2) => `Property 'weight' in key '${key2}' must be a positive integer`; +var INVALID_KEY_WEIGHT_VALUE = (key3) => `Property 'weight' in key '${key3}' must be a positive integer`; var hasOwn2 = Object.prototype.hasOwnProperty; var KeyStore = class { - constructor(keys) { + constructor(keys2) { this._keys = []; this._keyMap = {}; let totalWeight = 0; - keys.forEach((key2) => { - let obj = createKey(key2); + keys2.forEach((key3) => { + let obj = createKey(key3); this._keys.push(obj); this._keyMap[obj.id] = obj; totalWeight += obj.weight; }); - this._keys.forEach((key2) => { - key2.weight /= totalWeight; + this._keys.forEach((key3) => { + key3.weight /= totalWeight; }); } get(keyId) { @@ -113424,69 +113539,69 @@ var KeyStore = class { return JSON.stringify(this._keys); } }; -function createKey(key2) { - let path2 = null; +function createKey(key3) { + let path3 = null; let id3 = null; let src = null; let weight = 1; let getFn = null; - if (isString4(key2) || isArray4(key2)) { - src = key2; - path2 = createKeyPath(key2); - id3 = createKeyId(key2); + if (isString4(key3) || isArray4(key3)) { + src = key3; + path3 = createKeyPath(key3); + id3 = createKeyId(key3); } else { - if (!hasOwn2.call(key2, "name")) { + if (!hasOwn2.call(key3, "name")) { throw new Error(MISSING_KEY_PROPERTY("name")); } - const name317 = key2.name; + const name317 = key3.name; src = name317; - if (hasOwn2.call(key2, "weight")) { - weight = key2.weight; + if (hasOwn2.call(key3, "weight")) { + weight = key3.weight; if (weight <= 0) { throw new Error(INVALID_KEY_WEIGHT_VALUE(name317)); } } - path2 = createKeyPath(name317); + path3 = createKeyPath(name317); id3 = createKeyId(name317); - getFn = key2.getFn; + getFn = key3.getFn; } - return { path: path2, id: id3, weight, src, getFn }; + return { path: path3, id: id3, weight, src, getFn }; } -function createKeyPath(key2) { - return isArray4(key2) ? key2 : key2.split("."); +function createKeyPath(key3) { + return isArray4(key3) ? key3 : key3.split("."); } -function createKeyId(key2) { - return isArray4(key2) ? key2.join(".") : key2; +function createKeyId(key3) { + return isArray4(key3) ? key3.join(".") : key3; } -function get(obj, path2) { - let list = []; +function get(obj, path3) { + let list4 = []; let arr = false; - const deepGet = (obj2, path3, index2) => { + const deepGet = (obj2, path4, index3) => { if (!isDefined(obj2)) { return; } - if (!path3[index2]) { - list.push(obj2); + if (!path4[index3]) { + list4.push(obj2); } else { - let key2 = path3[index2]; - const value = obj2[key2]; + let key3 = path4[index3]; + const value = obj2[key3]; if (!isDefined(value)) { return; } - if (index2 === path3.length - 1 && (isString4(value) || isNumber3(value) || isBoolean2(value))) { - list.push(toString3(value)); + if (index3 === path4.length - 1 && (isString4(value) || isNumber3(value) || isBoolean2(value))) { + list4.push(toString3(value)); } else if (isArray4(value)) { arr = true; for (let i4 = 0, len = value.length; i4 < len; i4 += 1) { - deepGet(value[i4], path3, index2 + 1); + deepGet(value[i4], path4, index3 + 1); } - } else if (path3.length) { - deepGet(value, path3, index2 + 1); + } else if (path4.length) { + deepGet(value, path4, index3 + 1); } } }; - deepGet(obj, isString4(path2) ? path2.split(".") : path2, 0); - return arr ? list : list[0]; + deepGet(obj, isString4(path3) ? path3.split(".") : path3, 0); + return arr ? list4 : list4[0]; } var MatchOptions = { includeMatches: false, @@ -113554,11 +113669,11 @@ var FuseIndex = class { setIndexRecords(records = []) { this.records = records; } - setKeys(keys = []) { - this.keys = keys; + setKeys(keys2 = []) { + this.keys = keys2; this._keysMap = {}; - keys.forEach((key2, idx) => { - this._keysMap[key2.id] = idx; + keys2.forEach((key3, idx) => { + this._keysMap[key3.id] = idx; }); } create() { @@ -113610,8 +113725,8 @@ var FuseIndex = class { } _addObject(doc, docIndex) { let record = { i: docIndex, $: {} }; - this.keys.forEach((key2, keyIndex) => { - let value = key2.getFn ? key2.getFn(doc) : this.getFn(doc, key2.path); + this.keys.forEach((key3, keyIndex) => { + let value = key3.getFn ? key3.getFn(doc) : this.getFn(doc, key3.path); if (!isDefined(value)) { return; } @@ -113658,17 +113773,17 @@ var FuseIndex = class { }; } }; -function createIndex2(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { +function createIndex2(keys2, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { const myIndex = new FuseIndex({ getFn, fieldNormWeight }); - myIndex.setKeys(keys.map(createKey)); + myIndex.setKeys(keys2.map(createKey)); myIndex.setSources(docs); myIndex.create(); return myIndex; } -function parseIndex(data2, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { - const { keys, records } = data2; +function parseIndex(data3, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { + const { keys: keys2, records } = data3; const myIndex = new FuseIndex({ getFn, fieldNormWeight }); - myIndex.setKeys(keys); + myIndex.setKeys(keys2); myIndex.setIndexRecords(records); return myIndex; } @@ -113712,7 +113827,7 @@ function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMat return indices; } var MAX_BITS = 32; -function search(text2, pattern, patternAlphabet, { +function search(text7, pattern, patternAlphabet, { location = Config.location, distance: distance2 = Config.distance, threshold = Config.threshold, @@ -113725,26 +113840,26 @@ function search(text2, pattern, patternAlphabet, { throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS)); } const patternLen = pattern.length; - const textLen = text2.length; + const textLen = text7.length; const expectedLocation = Math.max(0, Math.min(location, textLen)); let currentThreshold = threshold; let bestLocation = expectedLocation; const computeMatches = minMatchCharLength > 1 || includeMatches; const matchMask = computeMatches ? Array(textLen) : []; - let index2; - while ((index2 = text2.indexOf(pattern, bestLocation)) > -1) { + let index3; + while ((index3 = text7.indexOf(pattern, bestLocation)) > -1) { let score = computeScore$1(pattern, { - currentLocation: index2, + currentLocation: index3, expectedLocation, distance: distance2, ignoreLocation }); currentThreshold = Math.min(score, currentThreshold); - bestLocation = index2 + patternLen; + bestLocation = index3 + patternLen; if (computeMatches) { let i4 = 0; while (i4 < patternLen) { - matchMask[index2 + i4] = 1; + matchMask[index3 + i4] = 1; i4 += 1; } } @@ -113779,7 +113894,7 @@ function search(text2, pattern, patternAlphabet, { bitArr[finish + 1] = (1 << i4) - 1; for (let j = finish; j >= start; j -= 1) { let currentLocation = j - 1; - let charMatch = patternAlphabet[text2.charAt(currentLocation)]; + let charMatch = patternAlphabet[text7.charAt(currentLocation)]; if (computeMatches) { matchMask[currentLocation] = +!!charMatch; } @@ -113889,18 +114004,18 @@ var BitapSearch = class { addChunk(this.pattern, 0); } } - searchIn(text2) { + searchIn(text7) { const { isCaseSensitive, includeMatches } = this.options; if (!isCaseSensitive) { - text2 = text2.toLowerCase(); + text7 = text7.toLowerCase(); } - if (this.pattern === text2) { + if (this.pattern === text7) { let result2 = { isMatch: true, score: 0 }; if (includeMatches) { - result2.indices = [[0, text2.length - 1]]; + result2.indices = [[0, text7.length - 1]]; } return result2; } @@ -113916,7 +114031,7 @@ var BitapSearch = class { let totalScore = 0; let hasMatches = false; this.chunks.forEach(({ pattern, alphabet, startIndex }) => { - const { isMatch: isMatch2, score, indices } = search(text2, pattern, alphabet, { + const { isMatch: isMatch2, score, indices } = search(text7, pattern, alphabet, { location: location + startIndex, distance: distance2, threshold, @@ -113973,8 +114088,8 @@ var ExactMatch = class extends BaseMatch { static get singleRegex() { return /^=(.*)$/; } - search(text2) { - const isMatch2 = text2 === this.pattern; + search(text7) { + const isMatch2 = text7 === this.pattern; return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, @@ -113995,13 +114110,13 @@ var InverseExactMatch = class extends BaseMatch { static get singleRegex() { return /^!(.*)$/; } - search(text2) { - const index2 = text2.indexOf(this.pattern); - const isMatch2 = index2 === -1; + search(text7) { + const index3 = text7.indexOf(this.pattern); + const isMatch2 = index3 === -1; return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, - indices: [0, text2.length - 1] + indices: [0, text7.length - 1] }; } }; @@ -114018,8 +114133,8 @@ var PrefixExactMatch = class extends BaseMatch { static get singleRegex() { return /^\^(.*)$/; } - search(text2) { - const isMatch2 = text2.startsWith(this.pattern); + search(text7) { + const isMatch2 = text7.startsWith(this.pattern); return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, @@ -114040,12 +114155,12 @@ var InversePrefixExactMatch = class extends BaseMatch { static get singleRegex() { return /^!\^(.*)$/; } - search(text2) { - const isMatch2 = !text2.startsWith(this.pattern); + search(text7) { + const isMatch2 = !text7.startsWith(this.pattern); return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, - indices: [0, text2.length - 1] + indices: [0, text7.length - 1] }; } }; @@ -114062,12 +114177,12 @@ var SuffixExactMatch = class extends BaseMatch { static get singleRegex() { return /^(.*)\$$/; } - search(text2) { - const isMatch2 = text2.endsWith(this.pattern); + search(text7) { + const isMatch2 = text7.endsWith(this.pattern); return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, - indices: [text2.length - this.pattern.length, text2.length - 1] + indices: [text7.length - this.pattern.length, text7.length - 1] }; } }; @@ -114084,12 +114199,12 @@ var InverseSuffixExactMatch = class extends BaseMatch { static get singleRegex() { return /^!(.*)\$$/; } - search(text2) { - const isMatch2 = !text2.endsWith(this.pattern); + search(text7) { + const isMatch2 = !text7.endsWith(this.pattern); return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, - indices: [0, text2.length - 1] + indices: [0, text7.length - 1] }; } }; @@ -114125,8 +114240,8 @@ var FuzzyMatch = class extends BaseMatch { static get singleRegex() { return /^(.*)$/; } - search(text2) { - return this._bitapSearch.searchIn(text2); + search(text7) { + return this._bitapSearch.searchIn(text7); } }; var IncludeMatch = class extends BaseMatch { @@ -114142,14 +114257,14 @@ var IncludeMatch = class extends BaseMatch { static get singleRegex() { return /^'(.*)$/; } - search(text2) { + search(text7) { let location = 0; - let index2; + let index3; const indices = []; const patternLen = this.pattern.length; - while ((index2 = text2.indexOf(this.pattern, location)) > -1) { - location = index2 + patternLen; - indices.push([index2, location - 1]); + while ((index3 = text7.indexOf(this.pattern, location)) > -1) { + location = index3 + patternLen; + indices.push([index3, location - 1]); } const isMatch2 = !!indices.length; return { @@ -114233,7 +114348,7 @@ var ExtendedSearch = class { static condition(_15, options) { return options.useExtendedSearch; } - searchIn(text2) { + searchIn(text7) { const query = this.query; if (!query) { return { @@ -114242,7 +114357,7 @@ var ExtendedSearch = class { }; } const { includeMatches, isCaseSensitive } = this.options; - text2 = isCaseSensitive ? text2 : text2.toLowerCase(); + text7 = isCaseSensitive ? text7 : text7.toLowerCase(); let numMatches = 0; let allIndices = []; let totalScore = 0; @@ -114252,7 +114367,7 @@ var ExtendedSearch = class { numMatches = 0; for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) { const searcher = searchers2[j]; - const { isMatch: isMatch2, indices, score } = searcher.search(text2); + const { isMatch: isMatch2, indices, score } = searcher.search(text7); if (isMatch2) { numMatches += 1; totalScore += score; @@ -114313,25 +114428,25 @@ var isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOper var isPath = (query) => !!query[KeyType.PATH]; var isLeaf = (query) => !isArray4(query) && isObject2(query) && !isExpression(query); var convertToExplicit = (query) => ({ - [LogicalOperator.AND]: Object.keys(query).map((key2) => ({ - [key2]: query[key2] + [LogicalOperator.AND]: Object.keys(query).map((key3) => ({ + [key3]: query[key3] })) }); function parse6(query, options, { auto = true } = {}) { const next = (query2) => { - let keys = Object.keys(query2); + let keys2 = Object.keys(query2); const isQueryPath = isPath(query2); - if (!isQueryPath && keys.length > 1 && !isExpression(query2)) { + if (!isQueryPath && keys2.length > 1 && !isExpression(query2)) { return next(convertToExplicit(query2)); } if (isLeaf(query2)) { - const key2 = isQueryPath ? query2[KeyType.PATH] : keys[0]; - const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key2]; + const key3 = isQueryPath ? query2[KeyType.PATH] : keys2[0]; + const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key3]; if (!isString4(pattern)) { - throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key2)); + throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key3)); } const obj = { - keyId: createKeyId(key2), + keyId: createKeyId(key3), pattern }; if (auto) { @@ -114339,19 +114454,19 @@ function parse6(query, options, { auto = true } = {}) { } return obj; } - let node = { + let node2 = { children: [], - operator: keys[0] + operator: keys2[0] }; - keys.forEach((key2) => { - const value = query2[key2]; + keys2.forEach((key3) => { + const value = query2[key3]; if (isArray4(value)) { value.forEach((item) => { - node.children.push(next(item)); + node2.children.push(next(item)); }); } }); - return node; + return node2; }; if (!isExpression(query)) { query = convertToExplicit(query); @@ -114361,8 +114476,8 @@ function parse6(query, options, { auto = true } = {}) { function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) { results.forEach((result) => { let totalScore = 1; - result.matches.forEach(({ key: key2, norm: norm3, score }) => { - const weight = key2 ? key2.weight : null; + result.matches.forEach(({ key: key3, norm: norm3, score }) => { + const weight = key3 ? key3.weight : null; totalScore *= Math.pow( score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm3) @@ -114371,9 +114486,9 @@ function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) { result.score = totalScore; }); } -function transformMatches(result, data2) { +function transformMatches(result, data3) { const matches = result.matches; - data2.matches = []; + data3.matches = []; if (!isDefined(matches)) { return; } @@ -114392,11 +114507,11 @@ function transformMatches(result, data2) { if (match2.idx > -1) { obj.refIndex = match2.idx; } - data2.matches.push(obj); + data3.matches.push(obj); }); } -function transformScore(result, data2) { - data2.score = result.score; +function transformScore(result, data3) { + data3.score = result.score; } function format7(results, docs, { includeMatches = Config.includeMatches, @@ -114409,33 +114524,33 @@ function format7(results, docs, { transformers.push(transformScore); return results.map((result) => { const { idx } = result; - const data2 = { + const data3 = { item: docs[idx], refIndex: idx }; if (transformers.length) { transformers.forEach((transformer) => { - transformer(result, data2); + transformer(result, data3); }); } - return data2; + return data3; }); } var Fuse = class { - constructor(docs, options = {}, index2) { + constructor(docs, options = {}, index3) { this.options = { ...Config, ...options }; if (this.options.useExtendedSearch && false) { throw new Error(EXTENDED_SEARCH_UNAVAILABLE); } this._keyStore = new KeyStore(this.options.keys); - this.setCollection(docs, index2); + this.setCollection(docs, index3); } - setCollection(docs, index2) { + setCollection(docs, index3) { this._docs = docs; - if (index2 && !(index2 instanceof FuseIndex)) { + if (index3 && !(index3 instanceof FuseIndex)) { throw new Error(INCORRECT_INDEX_TYPE); } - this._myIndex = index2 || createIndex2(this.options.keys, this._docs, { + this._myIndex = index3 || createIndex2(this.options.keys, this._docs, { getFn: this.options.getFn, fieldNormWeight: this.options.fieldNormWeight }); @@ -114492,16 +114607,16 @@ var Fuse = class { const searcher = createSearcher(query, this.options); const { records } = this._myIndex; const results = []; - records.forEach(({ v: text2, i: idx, n: norm3 }) => { - if (!isDefined(text2)) { + records.forEach(({ v: text7, i: idx, n: norm3 }) => { + if (!isDefined(text7)) { return; } - const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2); + const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7); if (isMatch2) { results.push({ - item: text2, + item: text7, idx, - matches: [{ score, value: text2, norm: norm3, indices }] + matches: [{ score, value: text7, norm: norm3, indices }] }); } }); @@ -114509,9 +114624,9 @@ var Fuse = class { } _searchLogical(query) { const expression = parse6(query, this.options); - const evaluate2 = (node, item, idx) => { - if (!node.children) { - const { keyId, searcher } = node; + const evaluate2 = (node2, item, idx) => { + if (!node2.children) { + const { keyId, searcher } = node2; const matches = this._findMatches({ key: this._keyStore.get(keyId), value: this._myIndex.getValueForItemAtKeyId(item, keyId), @@ -114529,12 +114644,12 @@ var Fuse = class { return []; } const res = []; - for (let i4 = 0, len = node.children.length; i4 < len; i4 += 1) { - const child = node.children[i4]; + for (let i4 = 0, len = node2.children.length; i4 < len; i4 += 1) { + const child = node2.children[i4]; const result = evaluate2(child, item, idx); if (result.length) { res.push(...result); - } else if (node.operator === LogicalOperator.AND) { + } else if (node2.operator === LogicalOperator.AND) { return []; } } @@ -114561,17 +114676,17 @@ var Fuse = class { } _searchObjectList(query) { const searcher = createSearcher(query, this.options); - const { keys, records } = this._myIndex; + const { keys: keys2, records } = this._myIndex; const results = []; records.forEach(({ $: item, i: idx }) => { if (!isDefined(item)) { return; } let matches = []; - keys.forEach((key2, keyIndex) => { + keys2.forEach((key3, keyIndex) => { matches.push( ...this._findMatches({ - key: key2, + key: key3, value: item[keyIndex], searcher }) @@ -114587,22 +114702,22 @@ var Fuse = class { }); return results; } - _findMatches({ key: key2, value, searcher }) { + _findMatches({ key: key3, value, searcher }) { if (!isDefined(value)) { return []; } let matches = []; if (isArray4(value)) { - value.forEach(({ v: text2, i: idx, n: norm3 }) => { - if (!isDefined(text2)) { + value.forEach(({ v: text7, i: idx, n: norm3 }) => { + if (!isDefined(text7)) { return; } - const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2); + const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7); if (isMatch2) { matches.push({ score, - key: key2, - value: text2, + key: key3, + value: text7, idx, norm: norm3, indices @@ -114610,10 +114725,10 @@ var Fuse = class { } }); } else { - const { v: text2, n: norm3 } = value; - const { isMatch: isMatch2, score, indices } = searcher.searchIn(text2); + const { v: text7, n: norm3 } = value; + const { isMatch: isMatch2, score, indices } = searcher.searchIn(text7); if (isMatch2) { - matches.push({ score, key: key2, value: text2, norm: norm3, indices }); + matches.push({ score, key: key3, value: text7, norm: norm3, indices }); } } return matches; @@ -114653,7 +114768,7 @@ var STYLE_PROPS = [ ]; var SelectMenuSearch = (0, import_react75.forwardRef)( (props, input) => { - const { classNames: classNames13, inputAttributes, inputEventHandlers, index: index2 } = props; + const { classNames: classNames13, inputAttributes, inputEventHandlers, index: index3 } = props; const sizer = (0, import_react75.useRef)(null); const [inputWidth, setInputWidth] = (0, import_react75.useState)(null); const [query, setQuery] = (0, import_react75.useState)(""); @@ -114805,13 +114920,13 @@ var SelectMenuInput = (props) => { }); }; var SelectMenuSuggestions = (props) => { - const options = props.options.map((item, index2) => { - const key2 = `${props.id}-${index2}`; - const className = item.type == -1 /* Separator */ ? "mk-menu-separator" : item.type == 2 /* Input */ ? "mk-menu-input" : item.type == 5 /* Custom */ ? "mk-menu-custom" : `mk-menu-option ${props.index === index2 && props.classNames.suggestionActive} ${item.disabled && props.classNames.suggestionDisabled}`; + const options = props.options.map((item, index3) => { + const key3 = `${props.id}-${index3}`; + const className = item.type == -1 /* Separator */ ? "mk-menu-separator" : item.type == 2 /* Input */ ? "mk-menu-input" : item.type == 5 /* Custom */ ? "mk-menu-custom" : `mk-menu-option ${props.index === index3 && props.classNames.suggestionActive} ${item.disabled && props.classNames.suggestionDisabled}`; return /* @__PURE__ */ import_react77.default.createElement("div", { ref: (ref2) => { if (props.refs?.current) - props.refs.current[index2] = ref2; + props.refs.current[index3] = ref2; }, onMouseDown: (e5) => { if (!props.isDisclosureMenu) @@ -114820,7 +114935,7 @@ var SelectMenuSuggestions = (props) => { }, onClick: (e5) => { if (item.onSubmenu && props.openSubmenu) { - const el = props.refs?.current[index2].getBoundingClientRect(); + const el = props.refs?.current[index3].getBoundingClientRect(); props.openSubmenu(item.onSubmenu(el)); } else if (item.onClick) { item.onClick(e5); @@ -114841,8 +114956,8 @@ var SelectMenuSuggestions = (props) => { } } }, - id: key2, - key: key2, + id: key3, + key: key3, className }, item.type == -1 /* Separator */ ? /* @__PURE__ */ import_react77.default.createElement(import_react77.default.Fragment, null) : item.type == -2 /* Section */ ? /* @__PURE__ */ import_react77.default.createElement("div", { className: "mk-menu-options-section" @@ -114855,7 +114970,7 @@ var SelectMenuSuggestions = (props) => { ui: props.ui, item, query: props.query, - active: index2 == props.index, + active: index3 == props.index, onMoreOption: props.moreOption, onDeleteOption: props.deleteOption })); @@ -114890,7 +115005,7 @@ function focusNextElement(scope, currentTarget) { const interactiveEls = scope.querySelectorAll("a,button,input"); const currentEl = Array.prototype.findIndex.call( interactiveEls, - (element) => element === currentTarget + (element3) => element3 === currentTarget ); const nextEl = interactiveEls[currentEl - 1] || interactiveEls[currentEl + 1]; if (nextEl) { @@ -114941,12 +115056,12 @@ var defaultProps = { inputAttributes: {} }; var findMatchIndex = (options, query) => { - return options.findIndex((option) => matchExact(query).test(option.name)); + return options.findIndex((option2) => matchExact(query).test(option2.name)); }; -var pressDelimiter = (props, query, index2, options, addTag2, modifiers) => { +var pressDelimiter = (props, query, index3, options, addTag2, modifiers) => { if (query.length >= props.minQueryLength) { const match2 = findMatchIndex(options, query); - const _index = index2 === -1 ? match2 : index2; + const _index = index3 === -1 ? match2 : index3; const tag2 = _index > -1 ? options[_index] : null; if (tag2) { addTag2(tag2, modifiers); @@ -115005,7 +115120,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( const [section, setSection] = (0, import_react78.useState)(""); const [query, setQuery] = (0, import_react78.useState)(""); const [focused, setFocused] = (0, import_react78.useState)(false); - const [index2, setIndex] = (0, import_react78.useState)(0); + const [index3, setIndex] = (0, import_react78.useState)(0); const onComposition = (0, import_react78.useRef)(false); (0, import_react78.useEffect)(() => { if (ref2) { @@ -115043,17 +115158,17 @@ var SelectMenuComponent = import_react78.default.forwardRef( props.onInput(_query); } if (_query.length === query.length + 1 && props.delimiters.indexOf(query.slice(-1)) > -1) { - pressDelimiter(props, query, index2, options, addTag2, {}); + pressDelimiter(props, query, index3, options, addTag2, {}); } else if (_query !== query) { setQuery(_query); } }; const onKeyDown = (e5) => { if (props.delimiters.indexOf(e5.key) > -1) { - if (query || index2 > -1) { + if (query || index3 > -1) { e5.preventDefault(); } - pressDelimiter(props, query, index2, options, addTag2, { + pressDelimiter(props, query, index3, options, addTag2, { ctrlKey: e5.ctrlKey, metaKey: e5.metaKey, altKey: e5.altKey, @@ -115089,11 +115204,11 @@ var SelectMenuComponent = import_react78.default.forwardRef( props.onFocus(); } }; - const onDeleteTag = (index3, event) => { + const onDeleteTag = (index4, event) => { if (container.current) { focusNextElement(container.current, event.currentTarget); } - deleteTag(index3); + deleteTag(index4); }; const addTag2 = (tag2, modifiers) => { if (tag2.disabled) { @@ -115118,7 +115233,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( const pressUpKey = (e5) => { e5.preventDefault(); const size2 = options.length - 1; - const newIndex = index2 <= 0 ? size2 : index2 - 1; + const newIndex = index3 <= 0 ? size2 : index3 - 1; if (options[newIndex].disabled) { setIndex(newIndex <= 0 ? size2 : newIndex - 1); } else { @@ -115128,7 +115243,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( const pressDownKey = (e5) => { e5.preventDefault(); const size2 = options.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; if (options[newIndex].disabled) { setIndex(newIndex >= size2 ? 0 : newIndex + 1); } else { @@ -115144,11 +115259,11 @@ var SelectMenuComponent = import_react78.default.forwardRef( if (props.showSections) { e5.preventDefault(); e5.stopPropagation(); - setSection((p) => { - const sectionIndex = sections.findIndex((g) => g.value == p); + setSection((p2) => { + const sectionIndex = sections.findIndex((g) => g.value == p2); if (e5.shiftKey) { if (sectionIndex == 0) { - return p; + return p2; } if (props.onSelectSection) { props.onSelectSection(sections[sectionIndex - 1].value); @@ -115156,7 +115271,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( return sections[sectionIndex - 1].value; } if (sectionIndex == sections.length - 1) { - return p; + return p2; } if (props.onSelectSection) { props.onSelectSection(sections[sectionIndex + 1].value); @@ -115183,7 +115298,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( return () => { props.ui.inputManager.off("keydown", onKeyDown); }; - }, [options, index2]); + }, [options, index3]); const expanded = focused && query.length >= props.minQueryLength; const classNames13 = Object.assign({}, CLASS_NAMES, props.classNames); if (props.wrapperClass) { @@ -115221,7 +115336,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( ui: props.ui, ref: inputRef, query, - index: index2, + index: index3, id: props.id, classNames: classNames13, inputAttributes: props.inputAttributes, @@ -115247,7 +115362,7 @@ var SelectMenuComponent = import_react78.default.forwardRef( options, query, setIndex, - index: index2, + index: index3, id: props.id, classNames: classNames13, expanded, @@ -115406,12 +115521,12 @@ var NoteView = (0, import_react80.forwardRef)((props, ref2) => { const [loaded, setLoaded] = (0, import_react80.useState)(false); const loadPath = async (force) => { const div2 = flowRef.current; - const path2 = props.superstate.spaceManager.uriByString( + const path3 = props.superstate.spaceManager.uriByString( props.path, props.source ); const properties3 = props.properties; - const pathState = props.superstate.pathsIndex.get(path2.path); + const pathState = props.superstate.pathsIndex.get(path3.path); const filePath = pathState?.type == "space" ? props.superstate.spacesIndex.get(props.path)?.defPath : pathState?.path; if (!filePath) { if (!force) { @@ -115420,7 +115535,7 @@ var NoteView = (0, import_react80.forwardRef)((props, ref2) => { return; } else { const parent = props.superstate.spaceManager.parentPathForPath( - path2.path + path3.path ); if (!parent) return; @@ -115504,15 +115619,15 @@ var PathContextList = (props) => { (f3) => f3[PathPropertyName] == pathState.path ); f2.cols.filter((f3) => f3.primary != "true").forEach((g) => { - const index2 = properties3.findIndex((h3) => h3.property.name == g.name); - if (index2 == -1) { + const index3 = properties3.findIndex((h3) => h3.property.name == g.name); + if (index3 == -1) { properties3.push({ property: g, contexts: [f2.path], value: row2?.[g.name] ?? "" }); } else { - properties3[index2].contexts.push(f2.path); + properties3[index3].contexts.push(f2.path); } }); }, []); @@ -115654,7 +115769,7 @@ var PropertiesView = (props) => { const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set(); const columns = [...pathContexts].map( (f2) => props.superstate.contextsIndex.get(f2)?.tables?.[defaultContextSchemaID]?.cols ?? [] - ).reduce((p, c3) => [...p, ...c3], []); + ).reduce((p2, c3) => [...p2, ...c3], []); const newCols = []; const newValues = {}; const properties3 = pathState?.metadata?.property ?? {}; @@ -115728,15 +115843,15 @@ var PropertiesView = (props) => { } deleteProperty(props.superstate, pathState.path, property.name); }; - const saveMetadata = async (property, space2) => { + const saveMetadata = async (property, space3) => { const field = { ...property, schemaId: defaultContextSchemaID }; - const spaceInfo = props.superstate.spacesIndex.get(space2)?.space; + const spaceInfo = props.superstate.spacesIndex.get(space3)?.space; if (!spaceInfo) return; - await props.superstate.spaceManager.addSpaceProperty(space2, field); + await props.superstate.spaceManager.addSpaceProperty(space3, field); await updateContextValue( props.superstate.spaceManager, spaceInfo, @@ -115772,31 +115887,31 @@ var PropertiesView = (props) => { "bottom" ); }; - const renameFMKey = (key2, name317) => { + const renameFMKey = (key3, name317) => { if (saveProperty) { - const property = tableData?.cols?.find((g) => g.name == key2); + const property = tableData?.cols?.find((g) => g.name == key3); if (property) saveProperty({ ...property, name: name317 }, property); } - renameProperty(props.superstate, pathState.path, key2, name317); + renameProperty(props.superstate, pathState.path, key3, name317); }; - const selectedType = (value, key2) => { + const selectedType = (value, key3) => { if (saveProperty) { - const property = tableData?.cols?.find((g) => g.name == key2); + const property = tableData?.cols?.find((g) => g.name == key3); if (property) saveProperty({ ...property, type: value[0] }, property); } saveProperties(props.superstate, pathState.path, { - [key2]: defaultValueForType(value[0]) + [key3]: defaultValueForType(value[0]) }); }; - const selectType = (r2, key2) => { + const selectType = (r2, key3) => { props.superstate.ui.openMenu(r2, { ui: props.superstate.ui, multi: false, editable: false, searchable: false, - saveOptions: (_15, v2) => selectedType(v2, key2), + saveOptions: (_15, v2) => selectedType(v2, key3), value: [], showAll: true, options: fieldTypes.filter((f2) => f2.metadata).map((f2, i4) => ({ @@ -115937,15 +116052,15 @@ var ContextPropertiesView = (props) => { }; // src/core/react/components/Explorer/Explorer.tsx -var isLeafNode = (node) => { - if (node.type == "metadata" && (node.subType == "properties" || node.subType == "flow")) +var isLeafNode = (node2) => { + if (node2.type == "metadata" && (node2.subType == "properties" || node2.subType == "flow")) return true; return false; }; -var childrenForNode = (superstate, node, index2, depth) => { - let i4 = index2; +var childrenForNode = (superstate, node2, index3, depth) => { + let i4 = index3; const items = []; - if (node.type == "path") { + if (node2.type == "path") { const metadataTypes = []; metadataTypes.push({ type: "properties", @@ -115980,50 +116095,50 @@ var childrenForNode = (superstate, node, index2, depth) => { ); items.push( ...metadataTypes.map((f2, k2) => ({ - id: node.id + "/" + f2.type, - parentId: node.id, + id: node2.id + "/" + f2.type, + parentId: node2.id, type: "metadata", subType: f2.type, index: i4 + k2, - path: node.path, + path: node2.path, label: f2.label, sticker: f2.sticker, value: f2.type, depth, - parentPath: node.parentPath + parentPath: node2.parentPath })) ); - } else if (node.type == "metadata") { - if (node.subType == "tables") { + } else if (node2.type == "metadata") { + if (node2.subType == "tables") { items.push( ...[ - ...(superstate.contextsIndex.get(node.path)?.schemas ?? []).filter( + ...(superstate.contextsIndex.get(node2.path)?.schemas ?? []).filter( (f2) => f2.name != defaultContextSchemaID ) ].map((f2, k2) => ({ - id: node.id + "/" + f2.id, - parentId: node.id, + id: node2.id + "/" + f2.id, + parentId: node2.id, type: "schema", - path: node.path, + path: node2.path, index: i4 + k2, sticker: "", label: f2.name, value: f2.id, depth, - parentPath: node.path + parentPath: node2.path })) ); } let paths = []; - if (node.subType == "inlinks") { - paths = [...superstate.linksMap.getInverse(node.path)]; - } else if (node.subType == "outlinks") { - paths = [...superstate.linksMap.get(node.path)]; + if (node2.subType == "inlinks") { + paths = [...superstate.linksMap.getInverse(node2.path)]; + } else if (node2.subType == "outlinks") { + paths = [...superstate.linksMap.get(node2.path)]; } items.push( ...paths.map((f2) => superstate.pathsIndex.get(f2)).filter((f2) => f2).map((f2, k2) => ({ - id: node.id + "/" + node.value, - parentId: node.id, + id: node2.id + "/" + node2.value, + parentId: node2.id, type: "path", path: f2.path, index: i4 + k2, @@ -116031,38 +116146,38 @@ var childrenForNode = (superstate, node, index2, depth) => { label: f2.name, value: f2.path, depth, - parentPath: node.path + parentPath: node2.path })) ); } i4 += items.length; return items; }; -var flattenTree = (superstate, node, openNodes, depth, index2) => { +var flattenTree = (superstate, node2, openNodes, depth, index3) => { const items = []; - let i4 = index2; - const leafNode = isLeafNode(node); + let i4 = index3; + const leafNode = isLeafNode(node2); if (!leafNode) { - const children = childrenForNode(superstate, node, i4, depth); + const children = childrenForNode(superstate, node2, i4, depth); const newItems = []; - if (openNodes.some((f2) => f2 == node.id)) { + if (openNodes.some((f2) => f2 == node2.id)) { children.forEach((f2) => { i4 = i4 + 1; newItems.push(...flattenTree(superstate, f2, openNodes, depth + 1, i4)); }); } - if (node.type != "metadata" || children.length != 0) - items.push({ ...node, children: children.length, isLeafNode: leafNode }); + if (node2.type != "metadata" || children.length != 0) + items.push({ ...node2, children: children.length, isLeafNode: leafNode }); items.push(...newItems); } else { - items.push({ ...node, isLeafNode: leafNode }); + items.push({ ...node2, isLeafNode: leafNode }); } return items; }; var Explorer = (props) => { const [selectedPath, setSelectedPath] = (0, import_react84.useState)(null); - const changeSelectedPath = (path2) => { - setSelectedPath(path2); + const changeSelectedPath = (path3) => { + setSelectedPath(path3); }; (0, import_react84.useEffect)(() => { props.superstate.ui.eventsDispatch.addListener( @@ -116120,7 +116235,7 @@ var PathContextView = (props) => { superstate: props.superstate, collapsed: !openNodes.some((g) => g == f2.id), onToggle: (collapsed) => setOpenNodes( - (p) => p.some((g) => g == f2.id) ? p.filter((o2) => o2 != f2.id) : [...p, f2.id] + (p2) => p2.some((g) => g == f2.id) ? p2.filter((o2) => o2 != f2.id) : [...p2, f2.id] ) }) : /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null), f2.type == "metadata" ? f2.subType == "flow" ? /* @__PURE__ */ import_react84.default.createElement(ExplorerFlowRow, { path: f2.path, @@ -116154,22 +116269,22 @@ var PathContextView = (props) => { }, f2.label)))))) : /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null)); }; var ExplorerFlowRow = (props) => { - const path2 = (0, import_react84.useMemo)(() => { + const path3 = (0, import_react84.useMemo)(() => { const spaceCache = props.superstate.spacesIndex.get(props.path); if (spaceCache) return spaceCache.space.defPath; return props.path; }, [props.path]); const [block, setBlock] = (0, import_react84.useState)([null, null]); - const refreshBlock = (path3) => { - const fCache = props.superstate.pathsIndex.get(path3); - const link = [ + const refreshBlock = (path4) => { + const fCache = props.superstate.pathsIndex.get(path4); + const link3 = [ ...fCache?.metadata.links ?? [], ...fCache?.metadata.embeds ?? [] ].find((f2) => props.source && props.source.includes(f2.displayText)); - if (link) { + if (link3) { const block2 = fCache.metadata.sections.find( - (f2) => f2.position.start.offset <= link.position.start.offset && f2.position.end.offset >= link.position.end.offset + (f2) => f2.position.start.offset <= link3.position.start.offset && f2.position.end.offset >= link3.position.end.offset ); if (!block2) setBlock([null, null]); @@ -116189,17 +116304,17 @@ var ExplorerFlowRow = (props) => { } }; (0, import_react84.useEffect)(() => { - refreshBlock(path2); + refreshBlock(path3); }, []); (0, import_react84.useEffect)(() => { - refreshBlock(path2); - }, [path2]); + refreshBlock(path3); + }, [path3]); return /* @__PURE__ */ import_react84.default.createElement(import_react84.default.Fragment, null, /* @__PURE__ */ import_react84.default.createElement("div", { className: "mk-path-context-backlink" }, /* @__PURE__ */ import_react84.default.createElement(NoteView, { load: true, superstate: props.superstate, - path: path2, + path: path3, properties: { from: block[0]?.line, to: block[1] ? block[1].line + 1 : null @@ -116208,9 +116323,9 @@ var ExplorerFlowRow = (props) => { }))); }; var ExplorerContextRow = (props) => { - const { node, superstate } = props; + const { node: node2, superstate } = props; const [spaceCache, setSpaceCache] = (0, import_react84.useState)( - superstate.spacesIndex.get(node.path) + superstate.spacesIndex.get(node2.path) ); return /* @__PURE__ */ import_react84.default.createElement(ContextPropertiesView, { superstate: props.superstate, @@ -116219,7 +116334,7 @@ var ExplorerContextRow = (props) => { }; // src/core/react/components/MDBView/MDBViewer.tsx -var import_react155 = __toESM(require_react()); +var import_react175 = __toESM(require_react()); // src/core/react/context/FrameSelectionContext.tsx var import_react88 = __toESM(require_react()); @@ -116269,11 +116384,11 @@ var FrameEditorProvider = (props) => { (f2) => f2.id == frameSchema.id ? { ...frameToNode(f2), types: tableData.cols.reduce( - (p, c3) => ({ ...p, [c3.name]: c3.type }), + (p2, c3) => ({ ...p2, [c3.name]: c3.type }), {} ), propsValue: tableData.cols.reduce( - (p, c3) => ({ ...p, [c3.name]: c3.value }), + (p2, c3) => ({ ...p2, [c3.name]: c3.value }), {} ) } : frameToNode(f2) @@ -116284,20 +116399,20 @@ var FrameEditorProvider = (props) => { } return [...frames, _root]; }, [tableData, frameSchema]); - const [root, setRoot] = (0, import_react85.useState)(null); + const [root4, setRoot] = (0, import_react85.useState)(null); const frameProperties = (0, import_react85.useMemo)(() => { const hiddenFields = [ ...FMMetadataKeys(props.superstate.settings), ...FMSpaceKeys(props.superstate.settings) ]; - return root?.id ? [ + return root4?.id ? [ ...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? [], ...(props.cols ?? []).map((f2) => ({ ...f2, - schemaId: root.id + schemaId: root4.id })) ].filter((f2) => hiddenFields.some((g) => g == f2.name) == false) : []; - }, [root, props.cols]); + }, [root4, props.cols]); const initiateRoot = () => { if (frameSchema?.type == "frame") { const _newRoot = buildRoot( @@ -116316,7 +116431,7 @@ var FrameEditorProvider = (props) => { screenType: props.superstate.ui.getScreenType() } ); - if (executableChanged(_newRoot, root)) { + if (executableChanged(_newRoot, root4)) { setRoot(_newRoot); } } @@ -116343,18 +116458,18 @@ var FrameEditorProvider = (props) => { initiateRoot(); }, [frameSchema, nodes, tableData, props.editMode]); const updateNode = (_node, state) => { - const node = nodes.find((f2) => f2.id == _node.id); - if (!node) + const node2 = nodes.find((f2) => f2.id == _node.id); + if (!node2) return; if (selectedSlide) { const existingDeltaNode = nodes.find( - (f2) => f2.parentId == selectedSlide && f2.ref == node.id + (f2) => f2.parentId == selectedSlide && f2.ref == node2.id ); if (!existingDeltaNode) { addNode( { ...deltaNode.node, - ref: node.id, + ref: node2.id, ...state }, nodes.find((f2) => f2.id == selectedSlide), @@ -116382,26 +116497,26 @@ var FrameEditorProvider = (props) => { } else { saveNodes([ { - ...node, + ...node2, props: state.props ? { - ...node.props, + ...node2.props, ...state.props - } : node.props, + } : node2.props, styles: state.styles ? { - ...node.styles, + ...node2.styles, ...state.styles - } : node.styles, + } : node2.styles, actions: state.actions ? { - ...node.actions, + ...node2.actions, ...state.actions - } : node.actions + } : node2.actions } ]); } }; - const moveUp = (node) => { - const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); + const moveUp = (node2) => { + const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); + const itemIndex = items.findIndex((item2) => item2.id === node2.id); if (itemIndex <= 0) { saveNodes(items); return; @@ -116411,9 +116526,9 @@ var FrameEditorProvider = (props) => { [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; saveNodes(items); }; - const moveDown = (node) => { - const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); + const moveDown = (node2) => { + const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); + const itemIndex = items.findIndex((item2) => item2.id === node2.id); if (itemIndex < 0 || itemIndex >= items.length - 1) { saveNodes(items); return; @@ -116423,20 +116538,20 @@ var FrameEditorProvider = (props) => { [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; saveNodes(items.sort((a4, b2) => a4.rank - b2.rank)); }; - const ungroupNode = (node) => { - const children = nodes.filter((f2) => f2.parentId == node.id); - const newRank = node.rank; - const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank); + const ungroupNode = (node2) => { + const children = nodes.filter((f2) => f2.parentId == node2.id); + const newRank = node2.rank; + const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank); const newItems = insertMulti( items, newRank, - children.map((f2) => ({ ...f2, parentId: node.parentId })) - ).filter((f2) => f2.id != node.id).map((f2, i4) => ({ ...f2, rank: i4 })); - return saveNodes(newItems, [node]); + children.map((f2) => ({ ...f2, parentId: node2.parentId })) + ).filter((f2) => f2.id != node2.id).map((f2, i4) => ({ ...f2, rank: i4 })); + return saveNodes(newItems, [node2]); }; - const moveToRank = (node, newRank) => { - const items = nodes.filter((f2) => f2.parentId == node.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); + const moveToRank = (node2, newRank) => { + const items = nodes.filter((f2) => f2.parentId == node2.parentId).sort((a4, b2) => a4.rank - b2.rank).map((f2, i4) => ({ ...f2, rank: i4 })); + const itemIndex = items.findIndex((item2) => item2.id === node2.id); if (itemIndex < 0 || newRank < 0 || newRank >= items.length) { saveNodes(items); return; @@ -116455,9 +116570,9 @@ var FrameEditorProvider = (props) => { ...newUniqueNode(groupNode, parentId, nodes, frameSchema.id) }; const newNodes = treeNodes.map((f2) => { - const node = import_lodash13.default.cloneDeep(f2); - node.parentId = group.id; - return node; + const node2 = import_lodash13.default.cloneDeep(f2); + node2.parentId = group.id; + return node2; }); saveNodes([ { ...group, styles: { ...group.styles, ...style } }, @@ -116465,21 +116580,21 @@ var FrameEditorProvider = (props) => { ]); }; const addNode = async (treeNode, target, insertInto) => { - let node = relinkProps("$root", frameSchema.id, treeNode, frameSchema.id); + let node2 = relinkProps("$root", frameSchema.id, treeNode, frameSchema.id); const id3 = uniqueNameFromString( - node.id, + node2.id, nodes.map((f2) => f2.id) ); - node = relinkProps(treeNode.id, id3, treeNode, frameSchema.id); - let parent = target ? target : root.node; + node2 = relinkProps(treeNode.id, id3, treeNode, frameSchema.id); + let parent = target ? target : root4.node; let rank = target ? target.rank + 1 : parent.rank; if (!insertInto || !groupableTypes.some((f2) => parent.type == f2)) { - parent = findParent(root, parent.id).node; + parent = findParent(root4, parent.id).node; } else { rank = nodes.filter((f2) => f2.parentId == parent.id).length; } const newTreeNode = { - ...node, + ...node2, id: id3, schemaId: frameSchema.id, parentId: parent.id @@ -116497,7 +116612,7 @@ var FrameEditorProvider = (props) => { if (!tableData) { return; } - const newRows = tableData?.rows?.some((f2) => f2.id == root.id) ? tableData.rows : [...tableData?.rows ?? [], nodeToFrame(root.node)]; + const newRows = tableData?.rows?.some((f2) => f2.id == root4.id) ? tableData.rows : [...tableData?.rows ?? [], nodeToFrame(root4.node)]; const insertRows2 = treeNodes.filter((f2) => !newRows.some((g) => g.id == f2.id)).map((f2) => nodeToFrame(f2)); const modRows = treeNodes.filter((f2) => newRows.some((g) => g.id == f2.id)).map((f2) => nodeToFrame(f2)); const newTable = { @@ -116565,13 +116680,13 @@ var FrameEditorProvider = (props) => { { editMode: props.editMode }, true )[0]; - const parent = findParent(root, treeNode.id); + const parent = findParent(root4, treeNode.id); const modNodes = []; const deleteNodes = flattenToFrameNodes(tree, tree.node.schemaId); if (parent) { if (parent.children.length == 1 && parent.node.type == "column") deleteNodes.push(parent.node); - const grandParent = findParent(root, parent.id); + const grandParent = findParent(root4, parent.id); if (grandParent?.node.type == "container") { if (grandParent.children.length == 1) { deleteNodes.push(grandParent.node); @@ -116600,7 +116715,7 @@ var FrameEditorProvider = (props) => { const properties3 = tableData?.cols ?? []; return /* @__PURE__ */ import_react85.default.createElement(FramesEditorRootContext.Provider, { value: { - root, + root: root4, nodes, properties: properties3, addNode, @@ -116629,7 +116744,7 @@ var FrameRootContext = import_react86.default.createContext({ path: null }); var FrameRootProvider = (props) => { - const [root, setRoot] = (0, import_react86.useState)(null); + const [root4, setRoot] = (0, import_react86.useState)(null); const refreshFrame = (payload) => { if (payload.path != props.path.path && props.path.authority != "$kit") { return; @@ -116664,7 +116779,7 @@ var FrameRootProvider = (props) => { }, [props.path]); return /* @__PURE__ */ import_react86.default.createElement(FrameRootContext.Provider, { value: { - root, + root: root4, path: props.path.fullPath } }, props.children); @@ -116674,7 +116789,7 @@ var FrameRootProvider = (props) => { var FrameInstanceContext = (0, import_react87.createContext)({ id: "", hoverNode: { id: null, node: "", direction: null }, - setHoverNode: (node) => null, + setHoverNode: (node2) => null, selectableNodeBounds: { current: {} }, runRoot: () => null, instance: null, @@ -116694,17 +116809,17 @@ var FrameInstanceProvider = (props) => { }); const [rootProps, setRootProps] = (0, import_react87.useState)(props.props); (0, import_react87.useEffect)(() => { - setRootProps((p) => { - if (import_lodash14.default.isEqual(p, props.props)) - return p; + setRootProps((p2) => { + if (import_lodash14.default.isEqual(p2, props.props)) + return p2; return props.props; }); }, [props.props]); const { selectedSlide: _selectedSlide } = (0, import_react87.useContext)(FramesEditorRootContext); const selectedSlide = props.editable ? _selectedSlide : null; const { root: editableRoot } = (0, import_react87.useContext)(FramesEditorRootContext); - const { root: nonEditableRoot, path: path2 } = (0, import_react87.useContext)(FrameRootContext); - const root = (0, import_react87.useMemo)( + const { root: nonEditableRoot, path: path3 } = (0, import_react87.useContext)(FrameRootContext); + const root4 = (0, import_react87.useMemo)( () => props.editable ? editableRoot : nonEditableRoot, [props.editable, editableRoot, nonEditableRoot] ); @@ -116737,7 +116852,7 @@ var FrameInstanceProvider = (props) => { exec: _exec } ).then((s4) => { - setInstance((p) => { + setInstance((p2) => { return s4; }); }); @@ -116755,8 +116870,8 @@ var FrameInstanceProvider = (props) => { }, [instance]); const selectableNodeBounds = (0, import_react87.useRef)({}); const fastSaveState = (newState) => { - setInstance((p) => { - return { ...p, state: newState }; + setInstance((p2) => { + return { ...p2, state: newState }; }); }; (0, import_react87.useEffect)( @@ -116766,8 +116881,8 @@ var FrameInstanceProvider = (props) => { [] ); const runRoot = () => { - if (root) { - const newRoot = import_lodash14.default.cloneDeep(root); + if (root4) { + const newRoot = import_lodash14.default.cloneDeep(root4); const runID = (0, import_lodash14.uniqueId)(); activeRunID.current = runID; executeTreeNode( @@ -116782,13 +116897,13 @@ var FrameInstanceProvider = (props) => { api: props.superstate.api, contexts: props.contexts, saveState, - root, + root: root4, exec: newRoot, runID, selectedSlide } ).then((s4) => { - setInstance((p) => { + setInstance((p2) => { return s4; }); activeRunID.current = s4.id; @@ -116796,12 +116911,12 @@ var FrameInstanceProvider = (props) => { } }; (0, import_react87.useEffect)(() => { - if (instance.root && !executableChanged(root, instance.root) && (0, import_lodash14.isEqual)(props.contexts, instance.contexts)) { + if (instance.root && !executableChanged(root4, instance.root) && (0, import_lodash14.isEqual)(props.contexts, instance.contexts)) { saveState({ [instance.root.id]: { props: rootProps } }, instance); } else { runRoot(); } - }, [rootProps, root, props.contexts]); + }, [rootProps, root4, props.contexts]); return /* @__PURE__ */ import_react87.default.createElement(FrameInstanceContext.Provider, { value: { id: props.id, @@ -116927,11 +117042,11 @@ var FrameSelectionProvider = (props) => { // src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx var import_lodash19 = __toESM(require_lodash()); -var import_react154 = __toESM(require_react()); +var import_react174 = __toESM(require_react()); // src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx var import_lodash18 = __toESM(require_lodash()); -var import_react151 = __toESM(require_react()); +var import_react171 = __toESM(require_react()); // src/core/utils/frames/editor/dropFrame.ts var shouldDeleteColumn = (nodeParent) => { @@ -116952,26 +117067,26 @@ var shouldCollapseColumnContainer = (nodeParent) => { } return false; }; -var dropFrame = (_activeNode, overNode, root, nodes, direction) => { +var dropFrame = (_activeNode, overNode, root4, nodes, direction) => { let activeNode = _activeNode; - if (activeNode.schemaId != root.id) { - activeNode = relinkProps("$root", root.id, activeNode, root.id); + if (activeNode.schemaId != root4.id) { + activeNode = relinkProps("$root", root4.id, activeNode, root4.id); const id3 = uniqueNameFromString( activeNode.id, nodes.map((f2) => f2.id) ); - activeNode = relinkProps(activeNode.id, id3, activeNode, root.id); + activeNode = relinkProps(activeNode.id, id3, activeNode, root4.id); activeNode.id = id3; - activeNode.schemaId = root.id; + activeNode.schemaId = root4.id; } let saveNodes = []; const deleteNodes = []; if (activeNode.id == overNode.id) { return [[], []]; } - const schemaId = root.node.schemaId; - const overParentNode = findParent(root, overNode.id); - const activeParentNode = findParent(root, activeNode.id); + const schemaId = root4.node.schemaId; + const overParentNode = findParent(root4, overNode.id); + const activeParentNode = findParent(root4, activeNode.id); if (!overParentNode) { return [[], []]; } @@ -116979,13 +117094,13 @@ var dropFrame = (_activeNode, overNode, root, nodes, direction) => { if (direction == "inside") { const newItem = { ...activeNode, parentId: overNode.node.id }; saveNodes.push(newItem); - } else if (isDroppableColumn || root.editorProps.editMode == 1 /* Page */ && overNode.node.parentId == root.id && (direction == "left" || direction == "right")) { - const baseLevelNode = overNode.node.parentId == root.id; + } else if (isDroppableColumn || root4.editorProps.editMode == 1 /* Page */ && overNode.node.parentId == root4.id && (direction == "left" || direction == "right")) { + const baseLevelNode = overNode.node.parentId == root4.id; const containerType = overNode.node.type == "container"; const columnType = overNode.node.type == "column"; let columnContainerIsBaseLevel = false; if (columnType) { - if (overParentNode.node.parentId == root.id) + if (overParentNode.node.parentId == root4.id) columnContainerIsBaseLevel = true; } const createColumnContainer = baseLevelNode && !containerType; @@ -117040,26 +117155,26 @@ var dropFrame = (_activeNode, overNode, root, nodes, direction) => { saveNodes.push(...newItems); } if (activeParentNode && shouldDeleteColumn(activeParentNode)) { - const columnParentNode = findParent(root, activeParentNode.id); + const columnParentNode = findParent(root4, activeParentNode.id); deleteNodes.push(activeParentNode.node); if (shouldDeleteColumnContainer(columnParentNode)) { deleteNodes.push(columnParentNode.node); } else if (shouldCollapseColumnContainer(columnParentNode)) { const removeColumn = columnParentNode.children.filter((f2) => f2.id != activeParentNode.id); deleteNodes.push(...removeColumn.map((f2) => f2.node), columnParentNode.node); - const moveToParentNodes = removeColumn.flatMap((f2) => f2.children.map((f3) => ({ ...f3.node, parentId: root.id, rank: columnParentNode.node.rank }))); + const moveToParentNodes = removeColumn.flatMap((f2) => f2.children.map((f3) => ({ ...f3.node, parentId: root4.id, rank: columnParentNode.node.rank }))); moveToParentNodes.push(...saveNodes.filter((f2) => removeColumn.some((g) => g.id == f2.parentId))); - saveNodes = [...saveNodes.map((f2) => moveToParentNodes.some((g) => g.id == f2.id) ? { ...f2, parentId: root.id } : f2), ...moveToParentNodes.filter((g) => !saveNodes.some((f2) => g.id == f2.id))]; + saveNodes = [...saveNodes.map((f2) => moveToParentNodes.some((g) => g.id == f2.id) ? { ...f2, parentId: root4.id } : f2), ...moveToParentNodes.filter((g) => !saveNodes.some((f2) => g.id == f2.id))]; } } return [saveNodes, deleteNodes]; }; // src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx -var import_react150 = __toESM(require_react()); +var import_react170 = __toESM(require_react()); // src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx -var import_classnames10 = __toESM(require_classnames()); +var import_classnames11 = __toESM(require_classnames()); // src/core/utils/frames/renderer.ts var parseStylesToClass = (styles2) => { @@ -117086,7 +117201,7 @@ var parseStylesToClass = (styles2) => { }; // src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx -var import_react149 = __toESM(require_react()); +var import_react169 = __toESM(require_react()); var import_react_dom11 = __toESM(require_react_dom()); // src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameMultiNodeEditor.tsx @@ -117214,24 +117329,24 @@ var predicateForViewType = (type) => { }; } }; -var createInlineTable = async (superstate, path2, type) => { +var createInlineTable = async (superstate, path3, type) => { let tableName = type == "board" ? "Board" : "Table"; - const schemas = await superstate.spaceManager.tablesForSpace(path2); + const schemas = await superstate.spaceManager.tablesForSpace(path3); if (schemas) { tableName = uniqueNameFromString( tableName, schemas.map((f2) => f2.id) ); } - const viewID = await superstate.spaceManager.createTable(path2, { + const viewID = await superstate.spaceManager.createTable(path3, { id: tableName, name: tableName, type: "db" }).then( - (f2) => superstate.spaceManager.addSpaceProperty(path2, { ...defaultTableFields[0], schemaId: tableName }) + (f2) => superstate.spaceManager.addSpaceProperty(path3, { ...defaultTableFields[0], schemaId: tableName }) ).then( async (f2) => { - const schemaTable = await superstate.spaceManager.framesForSpace(path2); + const schemaTable = await superstate.spaceManager.framesForSpace(path3); const schema = { id: uniqueNameFromString( tableName, @@ -117248,7 +117363,7 @@ var createInlineTable = async (superstate, path2, type) => { icon: type == "board" ? "ui//square-kanban" : "ui//table" }) }; - await superstate.spaceManager.createFrame(path2, schema); + await superstate.spaceManager.createFrame(path3, schema); return schema.id; } ); @@ -117256,7 +117371,7 @@ var createInlineTable = async (superstate, path2, type) => { }; // src/core/react/components/UI/Menus/frames/newFrameMenu.tsx -var showNewFrameMenu = (rect, superstate, space2, addNode, options = { searchable: true }) => { +var showNewFrameMenu = (rect, superstate, space3, addNode, options = { searchable: true }) => { const kits = superstate.settings.quickFrames.flatMap((s4) => { const frameSchemas = superstate.framesIndex.get(s4)?.schemas ?? []; return frameSchemas.map((f2) => mdbSchemaToFrameSchema(f2)).map((f2) => ({ @@ -117325,7 +117440,7 @@ var showNewFrameMenu = (rect, superstate, space2, addNode, options = { searchabl const insertNode = async (item) => { if (item.type == "preset") { if (item.value == "note") { - const _space = superstate.spacesIndex.get(space2.path); + const _space = superstate.spacesIndex.get(space3.path); if (_space) { const newPath = await newPathInSpace( superstate, @@ -117340,10 +117455,10 @@ var showNewFrameMenu = (rect, superstate, space2, addNode, options = { searchabl }); } } else if (item.value == "table") { - const table = await createInlineTable(superstate, space2.path); + const table2 = await createInlineTable(superstate, space3.path); addNode({ ...contextNode.node, - props: { value: wrapQuotes(`${space2.path}/#*${table}`) } + props: { value: wrapQuotes(`${space3.path}/#*${table2}`) } }); } else if (item.value == "link") { } @@ -117375,8 +117490,8 @@ var showNewFrameMenu = (rect, superstate, space2, addNode, options = { searchabl var import_react90 = __toESM(require_react()); var ColorSetter = (props) => { const showColorMenu = (e5, prop2) => { - const handleChangeComplete = (color2) => { - props.setValue(color2); + const handleChangeComplete = (color3) => { + props.setValue(color3); }; const offset2 = e5.target.getBoundingClientRect(); showColorPickerMenu( @@ -118064,7 +118179,7 @@ var PropertiesSubmenu = (props) => { }; const propertyForField = (field) => { const f2 = frameProperties?.find( - (p) => p.name == parseLinkedNode(frameProps?.[field])?.prop + (p2) => p2.name == parseLinkedNode(frameProps?.[field])?.prop ); return f2; }; @@ -118220,8 +118335,8 @@ var BorderSubmenu = (props) => { ); }; const showColorMenu = (e5, prop2) => { - const handleChangeComplete = (color2) => { - saveStyleValue(prop2, `'${color2}'`); + const handleChangeComplete = (color3) => { + saveStyleValue(prop2, `'${color3}'`); }; const offset2 = e5.target.getBoundingClientRect(); showColorPickerMenu( @@ -118262,8 +118377,8 @@ var import_react102 = __toESM(require_react()); var ShadowSubmenu = (props) => { const { selectedNode, saveStyleValue } = props; const showColorMenu = (e5, prop2) => { - const handleChangeComplete = (color2) => { - const { r: r2, g, b: b2 } = hexToRgb(color2); + const handleChangeComplete = (color3) => { + const { r: r2, g, b: b2 } = hexToRgb(color3); saveStyleValue(prop2, `'${r2},${g},${b2}'`); }; const offset2 = e5.target.getBoundingClientRect(); @@ -118332,8 +118447,8 @@ var ShadowSubmenu = (props) => { var StyleSubmenu = (props) => { const { selectedNode, saveStyleValue } = props; const showColorMenu = (e5, prop2) => { - const handleChangeComplete = (color2) => { - saveStyleValue(prop2, `'${color2}'`); + const handleChangeComplete = (color3) => { + saveStyleValue(prop2, `'${color3}'`); }; const offset2 = e5.target.getBoundingClientRect(); showColorPickerMenu( @@ -118416,8 +118531,8 @@ var TextSubmenu = (props) => { saveStyleValue("textAlign", `'${value}'`); }; const showColorMenu = (e5, prop2) => { - const handleChangeComplete = (color2) => { - saveStyleValue(prop2, `'${color2}'`); + const handleChangeComplete = (color3) => { + saveStyleValue(prop2, `'${color3}'`); }; const offset2 = e5.target.getBoundingClientRect(); showColorPickerMenu( @@ -118524,8 +118639,8 @@ var FrameNodeEditor = (props) => { const { selectionMode } = (0, import_react105.useContext)(FrameSelectionContext); const { instance } = (0, import_react105.useContext)(FrameInstanceContext); const saveNodeValue = (0, import_react105.useCallback)( - (values2, node) => { - updateNode(node, { + (values2, node2) => { + updateNode(node2, { props: { ...values2 } @@ -118556,7 +118671,7 @@ var FrameNodeEditor = (props) => { }, [props.node]); const savePropValue = (0, import_react105.useCallback)( (prop2, value) => { - setFrameProps((p) => ({ ...p, [prop2]: value })); + setFrameProps((p2) => ({ ...p2, [prop2]: value })); saveNodeValue({ [prop2]: value }, props.node); }, [setFrameProps, saveNodeValue, props.node] @@ -118842,9098 +118957,19945 @@ var ContentNodeView = (props) => { return /* @__PURE__ */ import_react106.default.createElement(import_react106.default.Fragment, null, props.children); }; -// src/core/react/components/PathView/PathView.tsx -var import_react119 = __toESM(require_react()); - -// src/core/react/components/SpaceView/Contexts/SpaceView.tsx -var import_react116 = __toESM(require_react()); - -// node_modules/react-error-boundary/dist/react-error-boundary.cjs.mjs -var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1); - -// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx -var import_lodash17 = __toESM(require_lodash()); - -// src/core/react/context/SidebarContext.tsx -var import_lodash16 = __toESM(require_lodash()); +// src/adapters/obsidian/ui/editors/EmbedContextView.tsx +var import_obsidian = require("obsidian"); var import_react107 = __toESM(require_react()); -var NavigatorContext = (0, import_react107.createContext)({ - dragPaths: [], - setDragPaths: import_lodash16.default.noop, - selectedPaths: [], - setSelectedPaths: import_lodash16.default.noop, - activePath: null, - setActivePath: import_lodash16.default.noop, - activeViewSpaces: [], - waypoints: [], - setWaypoints: import_lodash16.default.noop, - saveActiveSpace: import_lodash16.default.noop, - closeActiveSpace: import_lodash16.default.noop, - modifier: null, - setModifier: import_lodash16.default.noop -}); -var SidebarProvider = (props) => { - const [modifier, setModifier] = (0, import_react107.useState)(null); - const [dragPaths, setDragPaths] = (0, import_react107.useState)([]); - const [selectedPaths, setSelectedPaths] = (0, import_react107.useState)([]); - const [activePath, setActivePath] = (0, import_react107.useState)(null); - const [waypoints, setWaypoints] = (0, import_react107.useState)( - props.superstate.waypoints - ); - const [activeViewSpaces, setActiveViewSpaces] = (0, import_react107.useState)( - (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2) - ); - const setActiveViewSpaceByPath = (path2) => { - const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; - newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2), path2]; - if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) { - props.superstate.spaceManager.saveWaypoints([ - ...props.superstate.waypoints, - newWaypoint - ]); - } - const newWaypoints = props.superstate.waypoints.map( - (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2 - ); - props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); - }; - const closeActiveViewSpace = (path2) => { - const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; - newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2)]; - if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) { - props.superstate.spaceManager.saveWaypoints([ - ...props.superstate.waypoints, - newWaypoint - ]); - } - const newWaypoints = props.superstate.waypoints.map( - (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2 - ); - props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); - }; - const saveWaypoints = (paths) => { - props.superstate.spaceManager.saveWaypoints(paths.filter((f2) => f2)); - }; - const refreshSpaces = (payload) => { - if (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths?.includes(payload.path)) { - setActiveViewSpaces( - (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2) - ); - } - }; - const reloadPaths = () => { - setWaypoints(props.superstate.waypoints); - setActiveViewSpaces( - (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2) - ); - }; - (0, import_react107.useEffect)(() => { - props.superstate.eventsDispatcher.addListener( - "spaceStateUpdated", - refreshSpaces - ); - props.superstate.eventsDispatcher.addListener( - "settingsChanged", - reloadPaths - ); - props.superstate.eventsDispatcher.addListener( - "superstateUpdated", - reloadPaths - ); - return () => { - props.superstate.eventsDispatcher.removeListener( - "spaceStateUpdated", - refreshSpaces - ); - props.superstate.eventsDispatcher.removeListener( - "settingsChanged", - reloadPaths - ); - props.superstate.eventsDispatcher.removeListener( - "superstateUpdated", - reloadPaths - ); - }; - }, []); - return /* @__PURE__ */ import_react107.default.createElement(NavigatorContext.Provider, { - value: { - dragPaths, - setDragPaths, - selectedPaths, - setSelectedPaths, - activePath, - setActivePath, - activeViewSpaces, - waypoints, - setWaypoints: saveWaypoints, - saveActiveSpace: setActiveViewSpaceByPath, - closeActiveSpace: closeActiveViewSpace, - modifier, - setModifier - } - }, props.children); -}; - -// src/core/types/types.ts -var eventTypes = { - frameSelected: "mkmd-active-frame", - frameLayerSelected: "mkmd-frame-layer", - refreshView: "mkmd-refresh-view", - revealPath: "mkmd-reveal-file", - collapseFolders: "mkmd-collapse-folders", - toggleBacklinks: "mkmd-toggle-backlinks", - metadataChange: "mkmd-tags-change", - vaultChange: "mkmd-vault-change", - mdbChange: "mkmd-mdb-change", - spacesChange: "mkmd-spaces-change", - frameChange: "mkmd-frame-change", - updateSections: "mkmd-update-sections", - settingsChanged: "mkmd-settings-changed" -}; - -// src/core/utils/dnd/dragPath.ts -function getMaxDepth(previousItem, dirDown) { - if (previousItem) { - if (previousItem.item?.type == "space" && !previousItem.collapsed && dirDown) - return previousItem.depth + 1; - return previousItem.depth; - } - return 0; -} -function getMinDepth(previousItem) { - if (previousItem) { - return Math.max(0, previousItem.depth - 1); +var EMBED_CONTEXT_VIEW_TYPE = "mk-space-embed"; +var EmbedContextView = class extends import_obsidian.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = true; + this.plugin = plugin; } - return 0; -} -function getDragDepth(offset2, indentationWidth) { - return Math.round(offset2 / indentationWidth); -} -var getMultiProjection = (flattenedTree, paths, overIndex, modifier) => { - const overItem = flattenedTree[overIndex]; - if (!overItem) - return; - const dropTarget = overItem.type == "file" ? flattenedTree.find((f2) => f2.id == overItem.parentId) : overItem; - if (dropTarget && dropTarget.type != "file") { - const _projected = { - depth: overItem.depth, - overId: overItem.id, - parentId: dropTarget.id, - sortable: false, - insert: dropTarget.collapsed, - droppable: true, - copy: modifier == "link" || modifier == "copy", - reorder: false - }; - return _projected; + getViewType() { + return EMBED_CONTEXT_VIEW_TYPE; } - return null; -}; -function getProjection(activeItem, items, paths, overItemIndex, dragDepth, yOffset, dirDown, modifier, activeSpaceID) { - if (paths.length == 0) - return null; - if (paths.length > 1) - return getMultiProjection(items, paths, overItemIndex, modifier); - const overItem = items[overItemIndex]; - const previousItem = items[overItemIndex]; - const nextItem = items[overItemIndex + 1]; - if (!previousItem) - return; - const previousItemDroppable = previousItem.type != "file"; - const insert2 = activeItem.depth > 0 && overItem.collapsed && previousItemDroppable && (!overItem.sortable || dirDown && yOffset <= 13 || !dirDown && yOffset >= 13); - const sortable = overItem.sortable || previousItemDroppable && !insert2 && nextItem.sortable; - const projectedDepth = dragDepth; - const maxDepth = activeItem.depth == 0 ? 0 : getMaxDepth( - previousItem, - dirDown - ); - const minDepth = getMinDepth(previousItem); - let depth = projectedDepth; - if (projectedDepth >= maxDepth) { - depth = maxDepth; - } else if (projectedDepth < minDepth) { - depth = minDepth; + getDisplayText() { + return this.path; } - const parentId = getParentId(); - const parent = items.find((f2) => f2.id == parentId); - return { - depth, - overId: previousItem.id, - parentId, - sortable, - insert: insert2, - droppable: parent?.type != "file", - copy: modifier == "link" || modifier == "copy", - reorder: insert2 ? activeItem?.parentId == overItem?.id : activeItem?.parentId == parent?.id || activeItem?.parentId == activeSpaceID - }; - function getParentId() { - if (depth === 0) { - return null; - } - if (!previousItem) { - return null; - } - if (depth === previousItem.depth || depth > previousItem.depth && previousItem.item.type != "space") { - return previousItem.parentId; - } - if (depth > previousItem.depth) { - return previousItem.id; - } - const newParent = items.slice(0, overItemIndex).reverse().find((item) => item.depth === depth)?.parentId; - return newParent ?? null; + async onClose() { + this.destroy(); } -} - -// src/core/utils/keyboard.ts -var normalizedAltName = () => window.navigator.platform.startsWith("Mac") ? "\u2325" : "Alt"; - -// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx -var import_react111 = __toESM(require_react()); - -// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx -var import_classnames3 = __toESM(require_classnames()); -var import_react109 = __toESM(require_react()); - -// node_modules/react-dropzone/dist/es/index.js -var import_react108 = __toESM(require_react()); -var import_prop_types = __toESM(require_prop_types()); - -// node_modules/tslib/tslib.es6.mjs -function __awaiter(thisArg, _arguments, P3, generator) { - function adopt(value) { - return value instanceof P3 ? value : new P3(function(resolve2) { - resolve2(value); - }); + onunload() { + this.destroy(); } - return new (P3 || (P3 = Promise))(function(resolve2, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e5) { - reject(e5); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e5) { - reject(e5); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _15 = { label: 0, sent: function() { - if (t5[0] & 1) - throw t5[1]; - return t5[1]; - }, trys: [], ops: [] }, f2, y3, t5, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n3) { - return function(v2) { - return step([n3, v2]); - }; + destroy() { + if (this.root) + this.root.unmount(); } - function step(op) { - if (f2) - throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_15 = 0)), _15) - try { - if (f2 = 1, y3 && (t5 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t5 = y3["return"]) && t5.call(y3), 0) : y3.next) && !(t5 = t5.call(y3, op[1])).done) - return t5; - if (y3 = 0, t5) - op = [op[0] & 2, t5.value]; - switch (op[0]) { - case 0: - case 1: - t5 = op; - break; - case 4: - _15.label++; - return { value: op[1], done: false }; - case 5: - _15.label++; - y3 = op[1]; - op = [0]; - continue; - case 7: - op = _15.ops.pop(); - _15.trys.pop(); - continue; - default: - if (!(t5 = _15.trys, t5 = t5.length > 0 && t5[t5.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _15 = 0; - continue; - } - if (op[0] === 3 && (!t5 || op[1] > t5[0] && op[1] < t5[3])) { - _15.label = op[1]; - break; - } - if (op[0] === 6 && _15.label < t5[1]) { - _15.label = t5[1]; - t5 = op; - break; - } - if (t5 && _15.label < t5[2]) { - _15.label = t5[2]; - _15.ops.push(op); - break; - } - if (t5[2]) - _15.ops.pop(); - _15.trys.pop(); - continue; - } - op = body.call(thisArg, _15); - } catch (e5) { - op = [6, e5]; - y3 = 0; - } finally { - f2 = t5 = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; + async onOpen() { + this.destroy(); } -} -function __read(o2, n3) { - var m4 = typeof Symbol === "function" && o2[Symbol.iterator]; - if (!m4) - return o2; - var i4 = m4.call(o2), r2, ar = [], e5; - try { - while ((n3 === void 0 || n3-- > 0) && !(r2 = i4.next()).done) - ar.push(r2.value); - } catch (error) { - e5 = { error }; - } finally { - try { - if (r2 && !r2.done && (m4 = i4["return"])) - m4.call(i4); - } finally { - if (e5) - throw e5.error; + async setState(state, result) { + this.path = state.path; + this.source = state.source; + this.constructInlineContext(); + await super.setState(state, result); + const title = pathDisplayName(this.path, this.plugin.superstate); + this.leaf.tabHeaderInnerTitleEl.innerText = title; + this.leaf.view.titleEl = title; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = title; } + return; } - return ar; -} -function __spreadArray2(to2, from, pack) { - if (pack || arguments.length === 2) - for (var i4 = 0, l2 = from.length, ar; i4 < l2; i4++) { - if (ar || !(i4 in from)) { - if (!ar) - ar = Array.prototype.slice.call(from, 0, i4); - ar[i4] = from[i4]; - } - } - return to2.concat(ar || Array.prototype.slice.call(from)); -} - -// node_modules/file-selector/dist/es5/file.js -var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([ - ["aac", "audio/aac"], - ["abw", "application/x-abiword"], - ["arc", "application/x-freearc"], - ["avif", "image/avif"], - ["avi", "video/x-msvideo"], - ["azw", "application/vnd.amazon.ebook"], - ["bin", "application/octet-stream"], - ["bmp", "image/bmp"], - ["bz", "application/x-bzip"], - ["bz2", "application/x-bzip2"], - ["cda", "application/x-cdf"], - ["csh", "application/x-csh"], - ["css", "text/css"], - ["csv", "text/csv"], - ["doc", "application/msword"], - ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"], - ["eot", "application/vnd.ms-fontobject"], - ["epub", "application/epub+zip"], - ["gz", "application/gzip"], - ["gif", "image/gif"], - ["heic", "image/heic"], - ["heif", "image/heif"], - ["htm", "text/html"], - ["html", "text/html"], - ["ico", "image/vnd.microsoft.icon"], - ["ics", "text/calendar"], - ["jar", "application/java-archive"], - ["jpeg", "image/jpeg"], - ["jpg", "image/jpeg"], - ["js", "text/javascript"], - ["json", "application/json"], - ["jsonld", "application/ld+json"], - ["mid", "audio/midi"], - ["midi", "audio/midi"], - ["mjs", "text/javascript"], - ["mp3", "audio/mpeg"], - ["mp4", "video/mp4"], - ["mpeg", "video/mpeg"], - ["mpkg", "application/vnd.apple.installer+xml"], - ["odp", "application/vnd.oasis.opendocument.presentation"], - ["ods", "application/vnd.oasis.opendocument.spreadsheet"], - ["odt", "application/vnd.oasis.opendocument.text"], - ["oga", "audio/ogg"], - ["ogv", "video/ogg"], - ["ogx", "application/ogg"], - ["opus", "audio/opus"], - ["otf", "font/otf"], - ["png", "image/png"], - ["pdf", "application/pdf"], - ["php", "application/x-httpd-php"], - ["ppt", "application/vnd.ms-powerpoint"], - ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"], - ["rar", "application/vnd.rar"], - ["rtf", "application/rtf"], - ["sh", "application/x-sh"], - ["svg", "image/svg+xml"], - ["swf", "application/x-shockwave-flash"], - ["tar", "application/x-tar"], - ["tif", "image/tiff"], - ["tiff", "image/tiff"], - ["ts", "video/mp2t"], - ["ttf", "font/ttf"], - ["txt", "text/plain"], - ["vsd", "application/vnd.visio"], - ["wav", "audio/wav"], - ["weba", "audio/webm"], - ["webm", "video/webm"], - ["webp", "image/webp"], - ["woff", "font/woff"], - ["woff2", "font/woff2"], - ["xhtml", "application/xhtml+xml"], - ["xls", "application/vnd.ms-excel"], - ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], - ["xml", "application/xml"], - ["xul", "application/vnd.mozilla.xul+xml"], - ["zip", "application/zip"], - ["7z", "application/x-7z-compressed"], - ["mkv", "video/x-matroska"], - ["mov", "video/quicktime"], - ["msg", "application/vnd.ms-outlook"] -]); -function toFileWithPath(file, path2) { - var f2 = withMimeType(file); - if (typeof f2.path !== "string") { - var webkitRelativePath = file.webkitRelativePath; - Object.defineProperty(f2, "path", { - value: typeof path2 === "string" ? path2 : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name, - writable: false, - configurable: false, - enumerable: true - }); + getState() { + const state = super.getState(); + state.path = this.path; + state.source = this.source; + return state; } - return f2; -} -function withMimeType(file) { - var name317 = file.name; - var hasExtension = name317 && name317.lastIndexOf(".") !== -1; - if (hasExtension && !file.type) { - var ext = name317.split(".").pop().toLowerCase(); - var type = COMMON_MIME_TYPES.get(ext); - if (type) { - Object.defineProperty(file, "type", { - value: type, - writable: false, - configurable: false, - enumerable: true - }); + constructInlineContext() { + this.destroy(); + this.root = this.plugin.ui.createRoot(this.contentEl); + if (this.root) { + this.root.render( + /* @__PURE__ */ import_react107.default.createElement(SpaceFragmentViewComponent, { + id: this.path, + superstate: this.plugin.superstate, + path: this.path, + source: this.source + }) + ); + } else { + this.plugin.ui.manager.eventsDispatch.addOnceListener( + "windowReady", + () => { + this.constructInlineContext(); + } + ); } } - return file; -} +}; -// node_modules/file-selector/dist/es5/file-selector.js -var FILES_TO_IGNORE = [ - ".DS_Store", - "Thumbs.db" -]; -function fromEvent(evt) { - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a) { - if (isObject3(evt) && isDataTransfer(evt.dataTransfer)) { - return [2, getDataTransferFiles(evt.dataTransfer, evt.type)]; - } else if (isChangeEvt(evt)) { - return [2, getInputFiles(evt)]; - } else if (Array.isArray(evt) && evt.every(function(item) { - return "getFile" in item && typeof item.getFile === "function"; - })) { - return [2, getFsHandleFiles(evt)]; - } - return [2, []]; - }); - }); -} -function isDataTransfer(value) { - return isObject3(value); -} -function isChangeEvt(value) { - return isObject3(value) && isObject3(value.target); -} -function isObject3(v2) { - return typeof v2 === "object" && v2 !== null; -} -function getInputFiles(evt) { - return fromList(evt.target.files).map(function(file) { - return toFileWithPath(file); - }); -} -function getFsHandleFiles(handles) { - return __awaiter(this, void 0, void 0, function() { - var files; - return __generator(this, function(_a) { - switch (_a.label) { - case 0: - return [4, Promise.all(handles.map(function(h3) { - return h3.getFile(); - }))]; - case 1: - files = _a.sent(); - return [2, files.map(function(file) { - return toFileWithPath(file); - })]; - } - }); - }); -} -function getDataTransferFiles(dt, type) { - return __awaiter(this, void 0, void 0, function() { - var items, files; - return __generator(this, function(_a) { - switch (_a.label) { - case 0: - if (!dt.items) - return [3, 2]; - items = fromList(dt.items).filter(function(item) { - return item.kind === "file"; - }); - if (type !== "drop") { - return [2, items]; - } - return [4, Promise.all(items.map(toFilePromises))]; - case 1: - files = _a.sent(); - return [2, noIgnoredFiles(flatten3(files))]; - case 2: - return [2, noIgnoredFiles(fromList(dt.files).map(function(file) { - return toFileWithPath(file); - }))]; - } - }); - }); -} -function noIgnoredFiles(files) { - return files.filter(function(file) { - return FILES_TO_IGNORE.indexOf(file.name) === -1; - }); -} -function fromList(items) { - if (items === null) { - return []; - } - var files = []; - for (var i4 = 0; i4 < items.length; i4++) { - var file = items[i4]; - files.push(file); - } - return files; -} -function toFilePromises(item) { - if (typeof item.webkitGetAsEntry !== "function") { - return fromDataTransferItem(item); - } - var entry = item.webkitGetAsEntry(); - if (entry && entry.isDirectory) { - return fromDirEntry(entry); +// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx +var import_obsidian2 = require("obsidian"); +var import_react108 = __toESM(require_react()); +var LINK_VIEW_TYPE = "mk-uri-view"; +var FileLinkView = class extends import_obsidian2.ItemView { + constructor(leaf, app2, viewType, superstate) { + super(leaf); + this.superstate = superstate; + this.navigation = true; + this.app = app2; + this.viewType = viewType; } - return fromDataTransferItem(item); -} -function flatten3(items) { - return items.reduce(function(acc, files) { - return __spreadArray2(__spreadArray2([], __read(acc), false), __read(Array.isArray(files) ? flatten3(files) : [files]), false); - }, []); -} -function fromDataTransferItem(item) { - var file = item.getAsFile(); - if (!file) { - return Promise.reject("".concat(item, " is not a File")); + getViewType() { + return LINK_VIEW_TYPE; } - var fwp = toFileWithPath(file); - return Promise.resolve(fwp); -} -function fromEntry(entry) { - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a) { - return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)]; - }); - }); -} -function fromDirEntry(entry) { - var reader = entry.createReader(); - return new Promise(function(resolve2, reject) { - var entries = []; - function readEntries() { - var _this = this; - reader.readEntries(function(batch) { - return __awaiter(_this, void 0, void 0, function() { - var files, err_1, items; - return __generator(this, function(_a) { - switch (_a.label) { - case 0: - if (!!batch.length) - return [3, 5]; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4, Promise.all(entries)]; - case 2: - files = _a.sent(); - resolve2(files); - return [3, 4]; - case 3: - err_1 = _a.sent(); - reject(err_1); - return [3, 4]; - case 4: - return [3, 6]; - case 5: - items = Promise.all(batch.map(fromEntry)); - entries.push(items); - readEntries(); - _a.label = 6; - case 6: - return [2]; - } - }); - }); - }, function(err) { - reject(err); - }); - } - readEntries(); - }); -} -function fromFileEntry(entry) { - return __awaiter(this, void 0, void 0, function() { - return __generator(this, function(_a) { - return [2, new Promise(function(resolve2, reject) { - entry.file(function(file) { - var fwp = toFileWithPath(file, entry.fullPath); - resolve2(fwp); - }, function(err) { - reject(err); - }); - })]; - }); - }); -} - -// node_modules/react-dropzone/dist/es/utils/index.js -var import_attr_accept = __toESM(require_es()); -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); -} -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) - return Array.from(iter); -} -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) - return _arrayLikeToArray(arr); -} -function ownKeys4(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); + getDisplayText() { + return this.path; } - return keys; -} -function _objectSpread4(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = null != arguments[i4] ? arguments[i4] : {}; - i4 % 2 ? ownKeys4(Object(source), true).forEach(function(key2) { - _defineProperty2(target, key2, source[key2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); + async onClose() { + this.destroy(); } - return target; -} -function _defineProperty2(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; + destroy() { + if (this.root) + this.root.unmount(); } - return obj; -} -function _slicedToArray(arr, i4) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest(); -} -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -function _unsupportedIterableToArray(o2, minLen) { - if (!o2) - return; - if (typeof o2 === "string") - return _arrayLikeToArray(o2, minLen); - var n3 = Object.prototype.toString.call(o2).slice(8, -1); - if (n3 === "Object" && o2.constructor) - n3 = o2.constructor.name; - if (n3 === "Map" || n3 === "Set") - return Array.from(o2); - if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3)) - return _arrayLikeToArray(o2, minLen); -} -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) - len = arr.length; - for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { - arr2[i4] = arr[i4]; + async onOpen() { + this.destroy(); } - return arr2; -} -function _iterableToArrayLimit(arr, i4) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - if (_i == null) - return; - var _arr = []; - var _n = true; - var _d = false; - var _s, _e; - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i4 && _arr.length === i4) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; + async setState(state, result) { + this.path = state.path; + this.constructView(this.path); + const displayName = this.path; + await super.setState(state, result); + this.leaf.tabHeaderInnerTitleEl.innerText = displayName; + this.leaf.view.titleEl = displayName; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = displayName; } + result.history = true; + return; } - return _arr; -} -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) - return arr; -} -var FILE_INVALID_TYPE = "file-invalid-type"; -var FILE_TOO_LARGE = "file-too-large"; -var FILE_TOO_SMALL = "file-too-small"; -var TOO_MANY_FILES = "too-many-files"; -var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) { - accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept; - var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept; - return { - code: FILE_INVALID_TYPE, - message: "File type must be ".concat(messageSuffix) - }; -}; -var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) { - return { - code: FILE_TOO_LARGE, - message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes") - }; -}; -var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) { - return { - code: FILE_TOO_SMALL, - message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes") - }; -}; -var TOO_MANY_FILES_REJECTION = { - code: TOO_MANY_FILES, - message: "Too many files" -}; -function fileAccepted(file, accept) { - var isAcceptable = file.type === "application/x-moz-file" || (0, import_attr_accept.default)(file, accept); - return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)]; -} -function fileMatchSize(file, minSize, maxSize) { - if (isDefined2(file.size)) { - if (isDefined2(minSize) && isDefined2(maxSize)) { - if (file.size > maxSize) - return [false, getTooLargeRejectionErr(maxSize)]; - if (file.size < minSize) - return [false, getTooSmallRejectionErr(minSize)]; - } else if (isDefined2(minSize) && file.size < minSize) - return [false, getTooSmallRejectionErr(minSize)]; - else if (isDefined2(maxSize) && file.size > maxSize) - return [false, getTooLargeRejectionErr(maxSize)]; - } - return [true, null]; -} -function isDefined2(value) { - return value !== void 0 && value !== null; -} -function allFilesAccepted(_ref) { - var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator; - if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) { - return false; - } - return files.every(function(file) { - var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray(_fileAccepted, 1), accepted = _fileAccepted2[0]; - var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0]; - var customErrors = validator ? validator(file) : null; - return accepted && sizeMatch && !customErrors; - }); -} -function isPropagationStopped(event) { - if (typeof event.isPropagationStopped === "function") { - return event.isPropagationStopped(); - } else if (typeof event.cancelBubble !== "undefined") { - return event.cancelBubble; - } - return false; -} -function isEvtWithFiles(event) { - if (!event.dataTransfer) { - return !!event.target && !!event.target.files; + getState() { + const state = super.getState(); + state.path = this.path; + return state; } - return Array.prototype.some.call(event.dataTransfer.types, function(type) { - return type === "Files" || type === "application/x-moz-file"; - }); -} -function onDocumentDragOver(event) { - event.preventDefault(); -} -function isIe(userAgent) { - return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1; -} -function isEdge(userAgent) { - return userAgent.indexOf("Edge/") !== -1; -} -function isIeOrEdge() { - var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent; - return isIe(userAgent) || isEdge(userAgent); -} -function composeEventHandlers() { - for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { - fns[_key] = arguments[_key]; + constructView(path3) { + this.destroy(); + this.root = this.superstate.ui.createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ import_react108.default.createElement("div", { + className: "markdown-reading-view" + }, /* @__PURE__ */ import_react108.default.createElement(FileLinkViewComponent, { + superstate: this.superstate, + path: path3 + })) + ); } - return function(event) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - return fns.some(function(fn) { - if (!isPropagationStopped(event) && fn) { - fn.apply(void 0, [event].concat(args)); - } - return isPropagationStopped(event); - }); - }; -} -function canUseFileSystemAccessAPI() { - return "showOpenFilePicker" in window; -} -function pickerOptionsFromAccept(accept) { - if (isDefined2(accept)) { - var acceptForPicker = Object.entries(accept).filter(function(_ref2) { - var _ref3 = _slicedToArray(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1]; - var ok = true; - if (!isMIMEType(mimeType)) { - console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')); - ok = false; - } - if (!Array.isArray(ext) || !ext.every(isExt)) { - console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.')); - ok = false; - } - return ok; - }).reduce(function(agg, _ref4) { - var _ref5 = _slicedToArray(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1]; - return _objectSpread4(_objectSpread4({}, agg), {}, _defineProperty2({}, mimeType, ext)); - }, {}); - return [{ - description: "Files", - accept: acceptForPicker - }]; +}; + +// src/adapters/obsidian/utils/file.ts +var import_obsidian5 = require("obsidian"); + +// src/core/react/components/System/SystemSettings.tsx +var import_react120 = __toESM(require_react()); + +// src/core/assets/icons.ts +var uiIconSet = { + "rows": ``, + "close": ` + + `, + "flow-hover": ` + + `, + "folder": ` + + `, + "open-link": ` + + `, + "file": ` + + `, + "expand": ` + + `, + "json": ``, + "new-folder": ``, + "new-note": ``, + "collapse": ` + + `, + "options": ` + + `, + "plus": ` + + + `, + "collapse-solid": ` + + `, + "search": ` + + + `, + "view-options": ` + + + `, + "clear": ` + + + `, + "new-file": ` + + + `, + "blink": ` + + + + + `, + "spaces": ` + + `, + "home": ` + + `, + "tags": ``, + "handle": ` + + + + + + + + `, + "props": ` + + + + + `, + "new-space": ` + + + `, + "file-solid": ` + + + + `, + "folder-solid": ` + + + `, + "sync": ` + + + `, + "stack": ` + + + `, + "cut": ` + + + `, + "backlink": ` + + + `, + "canvas": ` + + + + + + `, + "video": ` + + + `, + "edit": ` + + + `, + "list": ` + + + + `, + "build": ` + + + `, + "check": ` + + + `, + "layout": ` + + + `, + "colors": ` + + + `, + "mk-make-todo": ` + + + + `, + "mk-make-list": ` + + + + + + + + `, + "mk-make-ordered": ` + + + + + + + + `, + "mk-make-h1": ` + + + + `, + "mk-make-h2": ` + + + + `, + "mk-make-h3": ` + + + + `, + "mk-make-quote": ` + + + + + + `, + "mk-make-hr": ` + + + `, + "mk-make-link": ` + + + `, + "mk-make-image": ` + + + + + + `, + "mk-make-codeblock": ` + + + + + `, + "mk-make-callout": ` + + + + `, + "mk-make-note": ` + + + + + + `, + "mk-make-flow": ` + + + `, + "mk-make-tag": ` + + + `, + "callout": ``, + "mk-make-table": ` + + + + + `, + "mk-make-date": ` + + + `, + "mk-make-indent": ` + + + + + + + `, + "mk-make-unindent": ` + + + + + + `, + "mk-mark-strong": ` + + + `, + "mk-mark-em": ` + + `, + "mk-mark-strikethrough": ` + + + + `, + "mk-mark-code": ` + + + + + `, + "mk-mark-link": ` + + `, + "mk-mark-blocklink": ` + + + + + `, + "mk-mark-highlight": ` + + + + + + `, + "mk-make-attach": ` + + + + + `, + "mk-make-keyboard": ` + + + + `, + "mk-make-slash": ` + + + + `, + "mk-make-style": ` + + `, + "mk-mark-color": ` + + + `, + "any": ` + + + `, + "all": ` + + + + `, + "context": ` + + + + + + `, + "full-width": ``, + "file-stack": ``, + "layout-panel-left": ``, + "align-center": ` + + +`, + "align-left": ` + + +`, + "align-right": ` + + +`, + "arrow-down": ` + + +`, + "arrow-left": ` + + +`, + "arrow-right": ` + + +`, + "arrow-up-down": ` + + +`, + "arrow-up-right": ` + + +`, + "baseline": ` + + +`, + "binary": ` + + +`, + "bold": ` + + +`, + "book-open": ` + + +`, + "box-select": ` + + +`, + "brush": ` + + +`, + "calendar": ` + + +`, + "case-insensitive": ` + + +`, + "check-square": ` + + + +`, + "chevron-left": ` + + +`, + "chevron-right": ` + + +`, + "chevrons-down-up": ` + + +`, + "chevrons-up-down": ` + + +`, + "clock": ` + + + +`, + "code": ` + + +`, + "columns": ` + + +`, + "combine": ` + + + +`, + "copy-check": ` + + + + +`, + "copy-x": ` + + + +`, + "copy": ` + + + +`, + "documents": ` + + + + +`, + "edit-3": ` + + +`, + "eye-off": ` + + + +`, + "eye": ` + + + +`, + "file-minus": ` + + + +`, + "file-plus-2": ` + + + +`, + "file-question": ` + + + +`, + "file-search": ` + + + +`, + "file-text": ` + + + +`, + "filter": ` + + +`, + "fold-horizontal": ` + + +`, + "fold-vertical": ` + + +`, + "folder-plus": ` + + +`, + "gallery-horizontal-end": ` + + +`, + "gem": ` + + + +`, + "go-to-file": ` + + + +`, + "heading-1": ` + + +`, + "heading-2": ` + + +`, + "heading-3": ` + + +`, + "heading-4": ` + + +`, + "heading-5": ` + + +`, + "heading-6": ` + + + +`, + "help-circle": ` + + + +`, + "image": ` + + + +`, + "infinity": ` + + +`, + "input": ` + + +`, + "italic": ` + + +`, + "justify": ` + + +`, + "layout-dashboard": ` + + +`, + "grid": ``, + "layout-grid": ` + + +`, + "layout-list": ` + + +`, + "lightbulb": ` + + +`, + "link": ` + + + +`, + "links-coming-in": ` + + + +`, + "links-going-out": ` + + + +`, + "list-tree": ` + + + +`, + "minus": ``, + "mouse-pointer-click": ` + + +`, + "paintbrush": ` + + + +`, + "palette": ` + + + +`, + "panel-top-close": ` + + + +`, + "paper-plane": ` + + +`, + "pie-chart": ` + + + +`, + "pin-off": ` + + +`, + "pin": ` + + +`, + "plug": ` + + +`, + "scaling": ` + + + +`, + "settings": ` + + + +`, + "smile": ` + + + +`, + "sort-asc": ` + + +`, + "sort-desc": ` + + +`, + "star": ` + + +`, + "sticker": ` + + + +`, + "text": ``, + "table-2": ` + + +`, + "table": ` + + +`, + "trash": ` + + +`, + "type": ` + + +`, + "underline": ` + + +`, + "unfold-horizontal": ` + + +`, + "unfold-vertical": ` + + +`, + "unplug": ` + + +`, + "wrap-text": ` + + + +`, + "x-square": ` + + +`, + "zap": ` + + +`, + "vault": ``, + "mk-logo": ``, + "package-plus": ``, + "square-kanban": ``, + "formula": ``, + "clipboard-pen": ``, + "clipboard-add": ``, + "live": ``, + "insert": ``, + "tabs": `` +}; + +// src/core/react/components/System/IconsSet.tsx +var import_react109 = __toESM(require_react()); +var IconSet = (props) => { + const [iconSets, setIconSets] = import_react109.default.useState([]); + const [icons, setIcons] = import_react109.default.useState([]); + (0, import_react109.useEffect)(() => { + Object.keys(uiIconSet).filter((f2, i4) => i4 < 10).forEach((icon) => { + setIcons((f2) => [...f2, "ui//" + icon]); + }); + }, []); + return /* @__PURE__ */ import_react109.default.createElement("div", null, /* @__PURE__ */ import_react109.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react109.default.createElement("div", { + key: i4, + className: "mk-icon-small", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(c3) + } + })))); +}; + +// src/core/react/components/System/ImageSet.tsx +var import_react110 = __toESM(require_react()); +var ImageSet = (props) => { + const [images, setImages] = import_react110.default.useState([]); + const [currentSet, setCurrentSet] = import_react110.default.useState(null); + const addImage = (image3) => { + setImages([...images, image3]); + }; + return /* @__PURE__ */ import_react110.default.createElement("div", null); +}; + +// src/core/react/components/System/MaterialsSet.tsx +var import_react111 = __toESM(require_react()); +var MaterialsSet = (props) => { + const [materials, setMaterials] = import_react111.default.useState([]); + return /* @__PURE__ */ import_react111.default.createElement("div", null, /* @__PURE__ */ import_react111.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react111.default.createElement("div", { + key: i4, + "aria-label": c3[0], + onMouseDown: () => { + }, + className: "mk-color", + style: { background: c3[1] } + })), /* @__PURE__ */ import_react111.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react111.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react111.default.createElement("div", { + key: i4, + "aria-label": c3[0], + onMouseDown: () => { + }, + className: "mk-color", + style: { background: c3[1] } + })))); +}; + +// src/core/react/components/System/SystemActions.tsx +var import_react118 = __toESM(require_react()); + +// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx +var import_react117 = __toESM(require_react()); + +// src/core/react/components/UI/Dropdown.tsx +var import_react112 = __toESM(require_react()); +var Dropdown2 = (props) => { + const openMenu = (e5) => { + const offset2 = e5.target.getBoundingClientRect(); + props.superstate.ui.openMenu(offset2, { + ui: props.superstate.ui, + editable: true, + value: [props.value], + options: props.options, + saveOptions: (options, value) => { + props.selectValue(value[0]); + } + }); + }; + return /* @__PURE__ */ import_react112.default.createElement("div", { + className: "mk-cell-option-item", + onClick: (e5) => props.triggerMenu ? props.triggerMenu(e5) : openMenu(e5) + }, /* @__PURE__ */ import_react112.default.createElement("div", null, props.options ? props.options.find((f2) => f2.value == props.value)?.name : props.value), /* @__PURE__ */ import_react112.default.createElement("div", { + className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//collapse-solid") + } + })); +}; + +// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx +var import_react115 = __toESM(require_react()); + +// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx +var import_react114 = __toESM(require_react()); + +// src/core/react/components/SpaceEditor/Actions/BuiltinPropertyEditor.tsx +var import_react113 = __toESM(require_react()); +var BuiltinPropertyEditor = (props) => { + const allOptions = (0, import_react113.useMemo)(() => { + const options = props.fields.map((f2) => ({ + id: f2.name, + field: f2.name, + vType: f2.type, + label: f2.name, + defaultFilter: "is", + type: "property", + description: "" + })); + return options; + }, []); + const editFormula = (e5) => { + const _props = { + superstate: props.superstate, + saveFormula: (value) => props.saveTree({ + ...props.actionTree, + props: { + ...props.actionTree.props, + $function: value + } + }), + formula: props.actionTree.props["$function"], + value: props.values, + fields: props.fields, + path: props.path + }; + props.superstate.ui.openCustomMenu( + e5.target.getBoundingClientRect(), + /* @__PURE__ */ import_react113.default.createElement(FormulaEditor, { + ..._props + }), + { ..._props }, + "bottom" + ); + }; + return props.command.schema.id == "formula" ? /* @__PURE__ */ import_react113.default.createElement("button", { + onClick: (e5) => editFormula(e5) + }, "Edit Formula") : props.command.schema.id == "filter" ? /* @__PURE__ */ import_react113.default.createElement(SpaceQuery, { + superstate: props.superstate, + filters: props.actionTree.props["$function"] ?? [], + setFilters: (filters) => { + props.saveTree({ + ...props.actionTree, + props: { + ...props.actionTree.props, + $function: filters + } + }); + }, + fields: allOptions, + sections: [], + removeable: true + }) : /* @__PURE__ */ import_react113.default.createElement(import_react113.default.Fragment, null); +}; + +// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx +var ActionNode = (props) => { + const [action, setAction] = import_react114.default.useState(props.actionTree?.action); + const command = (0, import_react114.useMemo)( + () => props.superstate.cli.commandForAction(action), + [action] + ); + (0, import_react114.useEffect)(() => { + setAction(props.actionTree?.action); + }, [props.actionTree]); + const selectAction = (e5, add4) => { + const options = [...allActions(props.superstate, props.path)]; + const sections = [...new Set(options.map((f2) => f2.section))].map((f2) => ({ + name: f2, + value: f2 + })); + const offset2 = e5.target.getBoundingClientRect(); + props.superstate.ui.openMenu(offset2, { + ui: props.superstate.ui, + editable: true, + value: [action], + options, + sections, + showSections: true, + saveOptions: (options2, value) => { + if (add4) { + props.saveTree({ + ...props.actionTree, + children: [ + ...props.actionTree.children, + { action: value[0], props: {}, propsValue: {}, children: [] } + ] + }); + return; + } + props.saveTree({ ...props.actionTree, action: value[0] }); + } + }); + }; + const selectLinkedProp = (e5, prop2) => { + const options = props.fields.map((f2) => ({ name: f2.name, value: f2.name })); + const offset2 = e5.target.getBoundingClientRect(); + props.superstate.ui.openMenu(offset2, { + ui: props.superstate.ui, + editable: true, + value: [], + options, + saveOptions: (options2, value) => { + props.saveTree({ + ...props.actionTree, + linked: { ...props.actionTree.linked, [prop2]: value[0] } + }); + } + }); + }; + return /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-editor-actions-node" + }, /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-editor-actions-body" + }, /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-editor-actions-name" + }, /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-path-icon", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker( + command ? stickerForSchema(command.schema) : "ui//plus" + ) + } + }), /* @__PURE__ */ import_react114.default.createElement("div", { + onClick: (e5) => !command && selectAction(e5), + className: "mk-editor-actions-selector" + }, command?.schema.name ?? "Select"), /* @__PURE__ */ import_react114.default.createElement("span", null), props.deleteTree && /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-icon-small", + onClick: (e5) => props.deleteTree(), + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//close") + } + })), command && /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-editor-actions-fields" + }, command.schema.type == "builtin" ? /* @__PURE__ */ import_react114.default.createElement(BuiltinPropertyEditor, { + superstate: props.superstate, + command, + actionTree: props.actionTree, + saveTree: props.saveTree, + fields: [...props.fields, props.prevField].filter((f2) => f2), + values: props.values, + path: props.path + }) : command?.fields.map((f2, i4) => { + return /* @__PURE__ */ import_react114.default.createElement(DataPropertyView, { + key: i4, + superstate: props.superstate, + column: f2, + columns: props.fields, + initialValue: props.actionTree.props[f2.name], + updateValue: (value) => { + const newTree = { ...props.actionTree }; + newTree.props[f2.name] = value; + props.saveTree(newTree); + }, + updateFieldValue: (fieldValue, value) => { + const newTree = { ...props.actionTree }; + newTree.props[f2.name] = value; + newTree.propsValue[f2.name] = fieldValue; + props.saveTree(newTree); + }, + editMode: 5 /* EditModeAlways */, + linkProp: (e5) => selectLinkedProp(e5, f2.name) + }); + }))), /* @__PURE__ */ import_react114.default.createElement("div", { + className: props.hasSiblings ? "mk-editor-actions-children" : "" + }, props.actionTree.children.map((child, i4) => /* @__PURE__ */ import_react114.default.createElement(ActionNode, { + key: i4, + hasSiblings: props.actionTree.children.length > 1, + prevField: command?.fields[i4], + superstate: props.superstate, + path: props.path, + fields: props.fields, + actionTree: child, + saveTree: (tree) => { + const newTree = { ...props.actionTree }; + newTree.children[i4] = tree; + props.saveTree(newTree); + }, + values: props.values, + deleteTree: () => { + const newTree = { ...props.actionTree }; + newTree.children.splice(i4, 1); + props.saveTree(newTree); + } + })), props.actionTree.children.length == 0 && /* @__PURE__ */ import_react114.default.createElement("button", { + onClick: (e5) => selectAction(e5, true), + className: "mk-inline-button" + }, /* @__PURE__ */ import_react114.default.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") + } + }), "Add Step"))); +}; + +// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx +var ActionEditor = (props) => { + const [actionTree, setActionTree] = import_react115.default.useState( + parseActionString(props.formula) ?? { + action: "", + props: {}, + propsValue: {}, + children: [] + } + ); + return /* @__PURE__ */ import_react115.default.createElement("div", { + className: "mk-editor-actions-nodes" + }, /* @__PURE__ */ import_react115.default.createElement(ActionNode, { + hasSiblings: false, + superstate: props.superstate, + prevField: null, + actionTree, + path: props.path, + fields: props.fields, + values: props.value, + saveTree: (tree) => { + props.saveFormula(JSON.stringify(tree)); + setActionTree(tree); + } + })); +}; + +// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx +var import_react116 = __toESM(require_react()); + +// node_modules/@uiw/codemirror-theme-github/esm/index.js +var defaultSettingsGithubLight = { + background: "#fff", + foreground: "#24292e", + selection: "#BBDFFF", + selectionMatch: "#BBDFFF", + gutterBackground: "#fff", + gutterForeground: "#6e7781" +}; +var githubLightInit = (options) => { + var { + theme = "light", + settings = {}, + styles: styles2 = [] + } = options || {}; + return createTheme({ + theme, + settings: _extends({}, defaultSettingsGithubLight, settings), + styles: [{ + tag: [tags2.standard(tags2.tagName), tags2.tagName], + color: "#116329" + }, { + tag: [tags2.comment, tags2.bracket], + color: "#6a737d" + }, { + tag: [tags2.className, tags2.propertyName], + color: "#6f42c1" + }, { + tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator], + color: "#005cc5" + }, { + tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName], + color: "#d73a49" + }, { + tag: [tags2.string, tags2.meta, tags2.regexp], + color: "#032f62" + }, { + tag: [tags2.name, tags2.quote], + color: "#22863a" + }, { + tag: [tags2.heading, tags2.strong], + color: "#24292e", + fontWeight: "bold" + }, { + tag: [tags2.emphasis], + color: "#24292e", + fontStyle: "italic" + }, { + tag: [tags2.deleted], + color: "#b31d28", + backgroundColor: "ffeef0" + }, { + tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)], + color: "#e36209" + }, { + tag: [tags2.url, tags2.escape, tags2.regexp, tags2.link], + color: "#032f62" + }, { + tag: tags2.link, + textDecoration: "underline" + }, { + tag: tags2.strikethrough, + textDecoration: "line-through" + }, { + tag: tags2.invalid, + color: "#cb2431" + }, ...styles2] + }); +}; +var githubLight = githubLightInit(); +var defaultSettingsGithubDark = { + background: "#0d1117", + foreground: "#c9d1d9", + caret: "#c9d1d9", + selection: "#003d73", + selectionMatch: "#003d73", + lineHighlight: "#36334280" +}; +var githubDarkInit = (options) => { + var { + theme = "dark", + settings = {}, + styles: styles2 = [] + } = options || {}; + return createTheme({ + theme, + settings: _extends({}, defaultSettingsGithubDark, settings), + styles: [{ + tag: [tags2.standard(tags2.tagName), tags2.tagName], + color: "#7ee787" + }, { + tag: [tags2.comment, tags2.bracket], + color: "#8b949e" + }, { + tag: [tags2.className, tags2.propertyName], + color: "#d2a8ff" + }, { + tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator], + color: "#79c0ff" + }, { + tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName], + color: "#ff7b72" + }, { + tag: [tags2.string, tags2.meta, tags2.regexp], + color: "#a5d6ff" + }, { + tag: [tags2.name, tags2.quote], + color: "#7ee787" + }, { + tag: [tags2.heading, tags2.strong], + color: "#d2a8ff", + fontWeight: "bold" + }, { + tag: [tags2.emphasis], + color: "#d2a8ff", + fontStyle: "italic" + }, { + tag: [tags2.deleted], + color: "#ffdcd7", + backgroundColor: "ffeef0" + }, { + tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)], + color: "#ffab70" + }, { + tag: tags2.link, + textDecoration: "underline" + }, { + tag: tags2.strikethrough, + textDecoration: "line-through" + }, { + tag: tags2.invalid, + color: "#f97583" + }, ...styles2] + }); +}; +var githubDark = githubDarkInit(); + +// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx +var ScriptEditor = (props) => { + const { command } = props; + const value = (0, import_react116.useMemo)(() => { + if (!command) + return ""; + return `const ${command.schema.id} = (${command.fields.map((f2) => `${f2.name}: ${f2.type}`).join(", ")}, $api: API, $contexts) => { +${command.code} +}`; + }, [command]); + const saveCommand = (value2) => { + props.saveCommand({ + ...command, + code: value2.split("\n").slice(1, -1).join("\n"), + codeType: "script" + }); + }; + return /* @__PURE__ */ import_react116.default.createElement("div", null, /* @__PURE__ */ import_react116.default.createElement(esm_default, { + className: "mk-editor-code", + value, + height: "100%", + theme: githubDark, + extensions: [javascript({ jsx: true })], + onChange: saveCommand + }), /* @__PURE__ */ import_react116.default.createElement(ActionTester, { + type: "script", + code: command.code, + fields: command.fields, + value: {}, + superstate: props.superstate, + path: props.path + })); +}; + +// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx +var SpaceCommand = (props) => { + const [command, setCommand] = (0, import_react117.useState)(null); + const uri = (0, import_react117.useMemo)(() => { + return props.superstate.spaceManager.uriByString(props.action); + }, [props.action]); + const saveCommand = (command2) => { + setCommand(command2); + if (uri.authority == "$actions") { + props.superstate.spaceManager.saveSystemCommand( + uri.path.split("/").pop(), + command2 + ); + return; + } + props.superstate.spaceManager.saveCommand( + uri.path, + command2.schema.id, + () => command2 + ); + }; + (0, import_react117.useEffect)(() => { + setCommand(props.superstate.cli.commandForAction(props.action)); + }, [props.action]); + (0, import_react117.useEffect)(() => { + const listener = (f2) => { + if (f2.path == uri.basePath) + setCommand(props.superstate.cli.commandForAction(props.action)); + }; + props.superstate.eventsDispatcher.addListener( + "actionStateUpdated", + listener + ); + return () => { + props.superstate.eventsDispatcher.removeListener( + "actionStateUpdated", + listener + ); + }; + }); + const saveField = (source, field) => { + saveCommand({ + ...command, + fields: [...command.fields, field] + }); + }; + const deleteProperty2 = (field) => { + saveCommand({ + ...command, + fields: command.fields.filter((f2) => f2.name != field.name) + }); + }; + const updateField = (newField, oldField) => { + saveCommand({ + ...command, + fields: command.fields.map((f2) => { + if (f2.name == oldField.name) { + return newField; + } + return f2; + }) + }); + }; + const newProperty = (e5) => { + const offset2 = e5.target.getBoundingClientRect(); + showNewPropertyMenu( + props.superstate, + offset2, + [], + [], + saveField, + command.schema.id, + null, + true, + true + ); + }; + const menuItems = [ + { name: "Actions", value: "actions" }, + { name: "Script", value: "script" }, + { name: "Formula", value: "formula" } + ]; + const defaultValueForField = (field) => { + const parsedValue = parseFieldValue(field.value, field.type); + if (parsedValue) { + return parsedValue?.default; + } + }; + const saveDefaultValueForField = (field, value) => { + const parsedValue = parseFieldValue(field.value, field.type) ?? {}; + parsedValue.default = value; + updateField( + { + ...field, + value: JSON.stringify(parsedValue) + }, + field + ); + }; + const defaultValues = (0, import_react117.useMemo)(() => { + return command?.fields.reduce((p2, c3) => { + return { ...p2, [c3.name]: defaultValueForField(c3) }; + }, {}) ?? {}; + }, [command?.fields]); + return /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-editor-actions" + }, command && /* @__PURE__ */ import_react117.default.createElement(import_react117.default.Fragment, null, /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-props-contexts" + }, /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-path-context-row" + }, /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-path-context-field" + }, "Type"), /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-path-context-value" + }, /* @__PURE__ */ import_react117.default.createElement(Dropdown2, { + superstate: props.superstate, + options: menuItems, + value: command.schema.type, + selectValue: (value) => saveCommand({ + ...command, + schema: { + ...command.schema, + type: value + } + }) + }))), /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-path-context-row" + }, /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-path-context-field" + }, "Properties")), /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-cell-object" + }, command.fields.map((f2) => { + return /* @__PURE__ */ import_react117.default.createElement(DataPropertyView, { + key: f2.name, + superstate: props.superstate, + initialValue: defaultValueForField(f2), + column: f2, + editMode: 5 /* EditModeAlways */, + updateValue: (value) => { + saveDefaultValueForField(f2, value); + }, + updateFieldValue: (fieldValue, value) => { + saveCommand({ + ...command, + fields: command.fields.map((g) => { + if (f2.name == g.name) { + return { + ...g, + value: fieldValue + }; + } + return g; + }) + }); + }, + propertyMenu: (e5) => { + const offset2 = e5.target.getBoundingClientRect(); + showPropertyMenu({ + superstate: props.superstate, + rect: offset2, + editable: true, + options: [], + field: f2, + fields: command.fields, + contextPath: null, + saveField: (newField) => updateField(newField, f2), + deleteColumn: deleteProperty2 + }); + } + }); + })), /* @__PURE__ */ import_react117.default.createElement("button", { + className: "mk-inline-button", + onClick: (e5) => newProperty(e5) + }, /* @__PURE__ */ import_react117.default.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") + } + }), i18n_default.labels.newProperty)), command.schema.type == "script" ? /* @__PURE__ */ import_react117.default.createElement(ScriptEditor, { + superstate: props.superstate, + command, + saveCommand, + values: defaultValues, + path: uri.path + }) : command.schema.type == "actions" ? /* @__PURE__ */ import_react117.default.createElement(ActionEditor, { + superstate: props.superstate, + formula: command.code, + path: uri.path, + saveOutputType: (outputType) => { + saveCommand({ + ...command, + codeType: outputType + }); + }, + saveFormula: (formula) => { + saveCommand({ + ...command, + code: formula + }); + }, + fields: command.fields, + value: defaultValues + }) : command.schema.type == "formula" ? /* @__PURE__ */ import_react117.default.createElement(FormulaEditor, { + superstate: props.superstate, + formula: command.code, + saveFormula: (formula) => { + saveCommand({ + ...command, + code: formula + }); + }, + fields: command.fields, + value: defaultValues, + path: uri.path + }) : /* @__PURE__ */ import_react117.default.createElement("div", null))); +}; + +// src/core/react/components/System/SystemActions.tsx +var SystemActionsEditor = (props) => { + const [selectedCommand, setSelectedCommand] = (0, import_react118.useState)(); + const saveCommand = (command) => { + props.superstate.spaceManager.saveSystemCommand( + selectedCommand.library, + command + ); + }; + const addLibrary = () => { + props.superstate.spaceManager.saveSystemCommand( + selectedCommand.library, + null + ); + }; + return /* @__PURE__ */ import_react118.default.createElement("div", { + style: { display: "flex" } + }, selectedCommand && /* @__PURE__ */ import_react118.default.createElement("div", null, /* @__PURE__ */ import_react118.default.createElement(SpaceCommand, { + superstate: props.superstate, + action: "spaces://$actions/" + selectedCommand.library + "/#;" + selectedCommand.command.schema.id + }))); +}; + +// src/core/react/components/System/Templates.tsx +var import_react119 = __toESM(require_react()); +var Templates = (props) => { + return /* @__PURE__ */ import_react119.default.createElement("div", null, /* @__PURE__ */ import_react119.default.createElement("h1", null, "Templates")); +}; + +// src/core/react/components/System/SystemSettings.tsx +var SystemSettings = (props) => { + const [tab2, setTab] = (0, import_react120.useState)(0); + const [loadout, setLoadOut] = (0, import_react120.useState)(); + const loadouts = props.superstate.loadouts; + return /* @__PURE__ */ import_react120.default.createElement("div", null, /* @__PURE__ */ import_react120.default.createElement("div", { + style: { display: "flex", flexDirection: "column" } + }, "System Name", /* @__PURE__ */ import_react120.default.createElement("input", { + value: props.superstate.settings.systemName, + onChange: (e5) => { + props.superstate.settings.systemName = e5.target.value; + } + }), /* @__PURE__ */ import_react120.default.createElement("div", null, /* @__PURE__ */ import_react120.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react120.default.createElement("div", { + key: i4, + onClick: () => { + setLoadOut(l2); + } + }, l2.name)), /* @__PURE__ */ import_react120.default.createElement("button", { + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") + }, + onClick: () => props.superstate.ui.openModal( + "New Loadout", + (_props) => /* @__PURE__ */ import_react120.default.createElement(InputModal, { + value: "", + saveLabel: "Save", + hide: _props.hide, + saveValue: (label) => { + setLoadOut({ + name: label + }); + } + }) + ) + })), /* @__PURE__ */ import_react120.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react120.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react120.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react120.default.createElement(MaterialsSet, { + superstate: props.superstate + }), "Icons", /* @__PURE__ */ import_react120.default.createElement(IconSet, { + superstate: props.superstate + }), "Images", /* @__PURE__ */ import_react120.default.createElement(ImageSet, { + superstate: props.superstate + }), /* @__PURE__ */ import_react120.default.createElement(Templates, { + superstate: props.superstate + }), /* @__PURE__ */ import_react120.default.createElement(SystemActionsEditor, { + superstate: props.superstate + }))); +}; + +// src/adapters/obsidian/SpaceViewContainer.tsx +var import_obsidian3 = require("obsidian"); +var import_react129 = __toESM(require_react()); + +// src/core/react/components/MarkdownEditor/BannerView.tsx +var import_react121 = __toESM(require_react()); +var BannerView = (props) => { + const [hasSticker, setHasSticker] = (0, import_react121.useState)(false); + const { pathState } = (0, import_react121.useContext)(PathContext); + const [banner, setBanner] = (0, import_react121.useState)( + props.superstate.spaceManager.uriByString( + pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner] + ) + ); + (0, import_react121.useEffect)(() => { + const banner2 = props.superstate.spaceManager.uriByString( + pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner] + ); + const hasSticker2 = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0; + setHasSticker(hasSticker2); + if (banner2) { + setBanner(banner2); + } else { + setBanner(null); + } + }, [pathState]); + const offset2 = pathState?.metadata.property?.banner_y ? `${(parseFloat(pathState?.metadata.property?.banner_y) * 100).toString()}%` : "center"; + const triggerBannerContextMenu = (e5) => { + e5.preventDefault(); + const menuOptions = [ + { + name: i18n_default.buttons.changeBanner, + value: "change", + icon: "ui//image", + onClick: (ev) => { + props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react121.default.createElement(ImageModal_default, { + superstate: props.superstate, + hide: _props.hide, + selectedPath: (image3) => savePathBanner(props.superstate, pathState.path, image3) + })); + } + }, + { + name: i18n_default.buttons.removeBanner, + value: "remove", + icon: "ui//file-minus", + onClick: (ev) => { + if (props.superstate.spacesIndex.has(pathState.path)) { + props.superstate.spaceManager.deleteProperty( + props.superstate.spacesIndex.get(pathState.path).defPath, + props.superstate.settings.fmKeyBanner + ); + } + props.superstate.spaceManager.deleteProperty( + pathState.path, + props.superstate.settings.fmKeyBanner + ); + } + } + ]; + props.superstate.ui.openMenu( + { + x: e5.clientX, + y: e5.clientY, + width: 0, + height: 0 + }, + defaultMenu(props.superstate.ui, menuOptions) + ); + return false; + }; + return banner ? /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, /* @__PURE__ */ import_react121.default.createElement("div", { + className: `mk-space-banner`, + onContextMenu: triggerBannerContextMenu, + style: { + "--mk-banner-height": props.superstate.settings.bannerHeight + "px", + backgroundImage: `url("${banner.scheme == "vault" ? props.superstate.ui.getUIPath(banner.basePath) : banner.fullPath}")`, + backgroundPositionY: offset2 + } + }), /* @__PURE__ */ import_react121.default.createElement("div", { + className: `mk-spacer`, + style: { + "--mk-header-height": ((isTouchScreen(props.superstate.ui) ? 1 : 0) * 26 + (props.superstate.settings.bannerHeight - 62) + (!props.superstate.settings.spacesStickers || props.superstate.settings.inlineContextNameLayout == "horizontal" ? 50 : hasSticker ? 0 : 30)).toString() + "px" + }, + onContextMenu: (e5) => e5.preventDefault() + })) : /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null); +}; + +// src/core/react/components/SpaceView/SpaceHeader.tsx +var import_react125 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx +var import_react123 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Contexts/SpaceEditor/SpaceProperties.tsx +var import_react122 = __toESM(require_react()); +var SpaceHeaderView = (props) => { + const { pathState } = (0, import_react122.useContext)(PathContext); + const { spaceState } = (0, import_react122.useContext)(SpaceContext); + const [tab2, setTab] = (0, import_react122.useState)(0); + const tabs = [ + { label: "Items", icon: "ui//file-stack", tab: 0 }, + { label: "Lists", icon: "ui//layout-list", tab: 2 }, + { label: "Actions", icon: "ui//mouse-pointer-click", tab: 3 } + ]; + return /* @__PURE__ */ import_react122.default.createElement(import_react122.default.Fragment, null, /* @__PURE__ */ import_react122.default.createElement("div", { + className: "mk-header-space" + }, /* @__PURE__ */ import_react122.default.createElement("div", { + className: "mk-tabs-space" + }, tabs.map((f2, i4) => /* @__PURE__ */ import_react122.default.createElement("div", { + key: i4, + onClick: () => { + openSpaceEditorModal(props.superstate, spaceState, f2.tab); + }, + className: `mk-path-info` + }, /* @__PURE__ */ import_react122.default.createElement("div", { + "aria-label": f2.label, + className: "mk-icon-small", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(f2.icon) + } + }), f2.label))), /* @__PURE__ */ import_react122.default.createElement("div", { + className: "mk-props-contexts" + }, /* @__PURE__ */ import_react122.default.createElement(PathContextList, { + superstate: props.superstate, + color: "var(--tag-background)", + path: pathState.path + }), /* @__PURE__ */ import_react122.default.createElement(PropertiesView, { + superstate: props.superstate, + spaces: props.spaces.map((f2) => f2.path), + force: true, + excludeKeys: [ + ...FMMetadataKeys(props.superstate.settings), + ...FMSpaceKeys(props.superstate.settings) + ], + editable: true + })))); +}; + +// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx +var NoteSpacesBar = (props) => { + const { addToSpace, removeFromSpace, pathState } = (0, import_react123.useContext)(PathContext); + const showContextMenu = (e5, path3) => { + const space3 = props.superstate.spacesIndex.get(path3); + if (!space3) + return; + e5.preventDefault(); + const menuOptions = []; + menuOptions.push({ + name: i18n_default.menu.openSpace, + icon: "ui//layout-grid", + onClick: (e6) => { + props.superstate.ui.openPath(space3.path, e6.metaKey); + } + }); + menuOptions.push({ + name: i18n_default.labels.newProperty, + icon: "ui//plus", + onClick: (e6) => { + newProperty(e6, space3.path); + } + }); + if (removeFromSpace) + menuOptions.push({ + name: i18n_default.menu.removeFromSpace, + icon: "ui//trash", + onClick: (e6) => { + removeFromSpace(space3.path); + } + }); + const offset2 = e5.target.getBoundingClientRect(); + props.superstate.ui.openMenu( + offset2, + defaultMenu(props.superstate.ui, menuOptions) + ); + }; + const spacesFromPath = (path3) => { + return [...props.superstate.spacesMap.get(path3)].map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2 && f2.type != "default" && f2.path != "/").map((f2) => props.superstate.pathsIndex.get(f2.path)).sort( + (f2, k2) => path3.startsWith(f2.path) ? -1 : path3.startsWith(k2.path) ? 1 : 0 + ).filter((f2) => f2); + }; + const spacePathStates = (0, import_react123.useMemo)( + () => spacesFromPath(pathState.path), + [pathState] + ); + const spaces2 = (0, import_react123.useMemo)( + () => [...props.superstate.spacesMap.get(pathState?.path) ?? []].map((f2) => props.superstate.spacesIndex.get(f2)?.space).filter((f2) => f2), + [pathState] + ); + const saveField = (source, field) => { + if (source == "fm") { + props.superstate.spaceManager.addProperty(pathState.path, field); + return; + } + props.superstate.spaceManager.addSpaceProperty(source, field); + }; + const newProperty = (e5, space3) => { + const offset2 = e5.target.getBoundingClientRect(); + showNewPropertyMenu( + props.superstate, + offset2, + [], + [], + (source, field) => saveField(space3, field), + defaultContextSchemaID, + space3 + ); + }; + const showAddMenu = (e5) => { + const offset2 = e5.target.getBoundingClientRect(); + showSpacesMenu( + offset2, + props.superstate, + (link3, isNew) => { + if (isNew) { + if (link3.charAt(0) == "#") { + addTagToPath(props.superstate, pathState.path, link3); + } else { + createSpace(props.superstate, link3, { links: [pathState.path] }); + } + } else { + addToSpace(link3); + } + }, + false, + true + ); + }; + return /* @__PURE__ */ import_react123.default.createElement(import_react123.default.Fragment, null, /* @__PURE__ */ import_react123.default.createElement("div", { + className: "mk-props-contexts" + }, /* @__PURE__ */ import_react123.default.createElement("div", { + className: "mk-path-context-row" + }, /* @__PURE__ */ import_react123.default.createElement("div", { + className: "mk-props-contexts-space-list" + }, spacePathStates.map((f2, i4) => /* @__PURE__ */ import_react123.default.createElement("div", { + key: i4, + className: "mk-props-contexts-space-name", + onContextMenu: (e5) => showContextMenu(e5, f2.path), + onClick: (e5) => props.superstate.ui.openPath(f2.path, e5.metaKey), + style: f2.label?.color?.length > 0 ? { + "--tag-background": f2.label?.color, + "--tag-color": "var(--color-white)" + } : {} + }, /* @__PURE__ */ import_react123.default.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(f2.label?.sticker) + } + }), f2.name)), /* @__PURE__ */ import_react123.default.createElement("div", { + className: "mk-props-contexts-space-name", + onClick: (e5) => showAddMenu(e5), + style: { + opacity: 0.5 + } + }, /* @__PURE__ */ import_react123.default.createElement("span", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") + } + }), i18n_default.buttons.addToSpace))), pathState.type == "space" ? /* @__PURE__ */ import_react123.default.createElement(SpaceHeaderView, { + superstate: props.superstate, + spacePathStates, + spaces: spaces2 + }) : /* @__PURE__ */ import_react123.default.createElement(import_react123.default.Fragment, null, /* @__PURE__ */ import_react123.default.createElement(PathContextList, { + superstate: props.superstate, + color: "var(--tag-background)", + path: pathState.path + }), /* @__PURE__ */ import_react123.default.createElement(PropertiesView, { + superstate: props.superstate, + spaces: spaces2.map((f2) => f2.path), + force: true, + excludeKeys: [ + ...FMMetadataKeys(props.superstate.settings), + ...FMSpaceKeys(props.superstate.settings) + ], + editable: true + })))); +}; + +// src/core/react/components/SpaceView/TitleComponent.tsx +var import_react124 = __toESM(require_react()); +var TitleComponent = (props) => { + const { pathState } = (0, import_react124.useContext)(PathContext); + const { spaceState } = (0, import_react124.useContext)(SpaceContext); + const fileNameRef = (0, import_react124.useRef)(null); + const name317 = (0, import_react124.useMemo)( + () => pathState ? props.superstate.settings.spacesUseAlias ? pathState?.displayName : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null, + [pathState] + ); + const contentEditable = !props.readOnly && spaceState?.type != "default"; + const onBlur = (e5) => { + const newValue = e5.target.innerText; + if (newValue != name317) { + if (pathState.path == "/") { + props.superstate.settings.systemName = newValue; + props.superstate.saveSettings(); + props.superstate.reloadSpaceByPath("/"); + return; + } + if (props.superstate.settings.spacesUseAlias) { + updatePrimaryAlias( + props.superstate, + pathState.path, + pathState.metadata.aliases, + newValue + ); + } else { + renamePathByName(props.superstate, pathState.path, newValue); + } + } + }; + const onKeyPress = (e5) => { + e5.stopPropagation(); + }; + const onKeyUp = (e5) => { + e5.stopPropagation(); + }; + const onKeyDown = (e5) => { + e5.stopPropagation(); + if (e5.key == "a" && e5.metaKey) { + e5.preventDefault(); + const selection2 = window.getSelection(); + const range2 = document.createRange(); + range2.selectNodeContents(e5.target); + selection2.removeAllRanges(); + selection2.addRange(range2); + } + if (e5.key == "Enter") { + e5.target.blur(); + e5.preventDefault(); + } + if (e5.key == "Escape") { + e5.target.blur(); + e5.preventDefault(); + } + }; + const hasSticker = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0; + const hasBanner = pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]; + return pathState && /* @__PURE__ */ import_react124.default.createElement(import_react124.default.Fragment, null, props.superstate.settings.spacesStickers && /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-header-icon", + style: hasBanner ? { + "--label-color": "var(--mk-ui-background)" + } : {} + }, hasSticker ? /* @__PURE__ */ import_react124.default.createElement(PathStickerContainer, { + superstate: props.superstate, + path: pathState.path + }) : /* @__PURE__ */ import_react124.default.createElement("button", { + className: "mk-inline-button", + onClick: (e5) => props.superstate.ui.openPalette( + (_props) => /* @__PURE__ */ import_react124.default.createElement(StickerModal_default, { + ui: props.superstate.ui, + hide: _props.hide, + selectedSticker: (emoji) => savePathIcon(props.superstate, pathState.path, emoji) + }) + ) + }, /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//smile") + } + }), i18n_default.buttons.addIcon), /* @__PURE__ */ import_react124.default.createElement("span", null), !hasBanner && /* @__PURE__ */ import_react124.default.createElement("button", { + className: "mk-inline-button", + onClick: (e5) => props.superstate.ui.openPalette( + (_props) => /* @__PURE__ */ import_react124.default.createElement(ImageModal_default, { + superstate: props.superstate, + hide: _props.hide, + selectedPath: (image3) => savePathBanner( + props.superstate, + pathState.path, + image3 + ) + }) + ) + }, /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//mk-make-image") + } + }), i18n_default.buttons.addCover)), /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-title-container" + }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-title-prefix" + }, "#") : "", /* @__PURE__ */ import_react124.default.createElement("div", { + className: "mk-inline-title inline-title", + ref: fileNameRef, + contentEditable, + onBlur, + onDrop: (e5) => e5.preventDefault(), + onKeyDown, + onKeyPress, + onKeyUp, + dangerouslySetInnerHTML: { + __html: name317 + } + }))); +}; + +// src/core/react/components/SpaceView/SpaceHeader.tsx +var SpaceHeader = (props) => { + const { readMode } = (0, import_react125.useContext)(PathContext); + const { spaceState } = (0, import_react125.useContext)(SpaceContext); + const [collapsed, setCollapsed] = (0, import_react125.useState)( + !props.superstate.settings.inlineContextExpanded + ); + (0, import_react125.useEffect)(() => { + props.superstate.settings.inlineContextExpanded = !collapsed; + props.superstate.saveSettings(); + }, [collapsed]); + return /* @__PURE__ */ import_react125.default.createElement(import_react125.default.Fragment, null, /* @__PURE__ */ import_react125.default.createElement(BannerView, { + superstate: props.superstate + }), /* @__PURE__ */ import_react125.default.createElement("div", { + className: "mk-space-header" + }, /* @__PURE__ */ import_react125.default.createElement("div", { + className: "mk-path-context-label" + }, /* @__PURE__ */ import_react125.default.createElement(TitleComponent, { + superstate: props.superstate, + readOnly: readMode + }), /* @__PURE__ */ import_react125.default.createElement("div", { + style: { position: "relative" } + }, /* @__PURE__ */ import_react125.default.createElement("div", { + className: "mk-fold" + }, /* @__PURE__ */ import_react125.default.createElement(CollapseToggle, { + superstate: props.superstate, + collapsed, + onToggle: (c3) => setCollapsed(c3) + })))), !collapsed && spaceState?.type == "folder" && /* @__PURE__ */ import_react125.default.createElement(NoteSpacesBar, { + superstate: props.superstate + }))); +}; + +// node_modules/@air/react-drag-to-select/dist/index.modern.js +var import_react126 = __toESM(require_react(), 1); +var import_react_dom6 = __toESM(require_react_dom(), 1); +var import_react_style_object_to_css = __toESM(require_react_style_object_to_css(), 1); +function a3() { + return a3 = Object.assign ? Object.assign.bind() : function(e5) { + for (var t5 = 1; t5 < arguments.length; t5++) { + var n3 = arguments[t5]; + for (var r2 in n3) + Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]); + } + return e5; + }, a3.apply(this, arguments); +} +var s3 = ["style"]; +var d3 = (0, import_react126.forwardRef)((t5, u3) => { + let { style: d4 = {} } = t5, m4 = function(e5, t6) { + if (null == e5) + return {}; + var n3, r2, o2 = {}, l2 = Object.keys(e5); + for (r2 = 0; r2 < l2.length; r2++) + t6.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]); + return o2; + }(t5, s3); + const v2 = (0, import_react126.useRef)(null), f2 = (0, import_react126.useRef)(null), [, p2] = (0, import_react126.useState)(0); + return (0, import_react126.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => { + var e5; + return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect(); + }, getParentBoundingClientRect: () => { + var e5, t6; + return null == v2 || null == (e5 = v2.current) || null == (t6 = e5.parentElement) ? void 0 : t6.getBoundingClientRect(); + }, drawSelectionBox: (e5) => { + requestAnimationFrame(() => { + if (f2.current) { + const t6 = a3({ border: "1px solid #4C85D8", background: "rgba(155, 193, 239, 0.4)", position: "absolute", pointerEvents: "none" }, d4, { top: e5.top, left: e5.left, width: e5.width, height: e5.height }); + f2.current.style.cssText = (0, import_react_style_object_to_css.default)(t6); + } + }); + }, clearSelectionBox: () => { + requestAnimationFrame(() => { + f2.current && (f2.current.style.cssText = (0, import_react_style_object_to_css.default)({ top: 0, left: 0, width: 0, height: 0 })); + }); + } })), (0, import_react126.useEffect)(() => { + p2((e5) => e5 + 1); + }, []), import_react126.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom6.default.createPortal(import_react126.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null); +}); +var m3 = (e5, t5) => e5.left <= t5.left + t5.width && e5.left + e5.width >= t5.left && e5.top <= t5.top + t5.height && e5.top + e5.height >= t5.top; +function v(t5) { + const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t5 || {}, f2 = (0, import_react126.useRef)(null), { cancelCurrentSelection: p2 } = function({ containerRef: e5, onSelectionChange: t6, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) { + const d4 = (0, import_react126.useRef)(null), m5 = (0, import_react126.useRef)(null), v3 = (0, import_react126.useRef)(false), f3 = (0, import_react126.useRef)(t6), p3 = (0, import_react126.useRef)(r3), h3 = (0, import_react126.useRef)(o3), g = (0, import_react126.useRef)(), y3 = (0, import_react126.useRef)(c4); + f3.current = (0, import_react126.useCallback)((e6) => { + g.current = t6 ? requestAnimationFrame(() => { + t6(e6); + }) : void 0; + }, [t6]), p3.current = r3, h3.current = o3, y3.current = c4; + const b2 = (0, import_react126.useCallback)(() => { + var t7; + d4.current = null, m5.current = null, v3.current = false, null == (t7 = e5.current) || t7.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current); + }, [e5]), S3 = (0, import_react126.useCallback)((t7, n3) => { + var r4, o4, l2; + return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t7.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t7.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) }; + }, [e5]), E2 = (0, import_react126.useCallback)((t7, n3) => { + if (d4.current && m5.current) { + if (!n3) + return; + const l2 = (({ startPoint: e6, endPoint: t8 }) => ({ left: Math.min(e6.x, t8.x), top: Math.min(e6.y, t8.y), width: Math.abs(e6.x - t8.x), height: Math.abs(e6.y - t8.y) }))({ startPoint: d4.current, endPoint: m5.current }), u3 = a3({}, l2, { top: l2.top + ((null == n3 ? void 0 : n3.top) || 0), left: l2.left + ((null == n3 ? void 0 : n3.left) || 0) }); + var r4; + (o4 = l2).width * o4.height > 10 ? (v3.current || (null != p3 && p3.current && p3.current(t7), v3.current = true), null == (r4 = e5.current) || r4.drawSelectionBox(l2), null == f3.current || f3.current(u3)) : v3.current && (null == f3.current || f3.current(u3)); + } else + b2(); + var o4; + }, [b2, e5]), w2 = (0, import_react126.useCallback)((t7) => { + var n3; + if (!d4.current) + return; + const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect(); + m5.current = S3(t7, r4), E2(t7, r4); + }, [E2, S3, e5]), x2 = (0, import_react126.useCallback)((e6) => { + var t7; + 0 === e6.button && (m5.current && (null == h3.current || h3.current(e6)), b2(), document.body.style.removeProperty("user-select"), document.body.style.removeProperty("-webkit-user-select"), (i5 || document.body).removeEventListener("mousemove", w2), null == (t7 = window) || t7.removeEventListener("mouseup", x2)); + }, [i5, b2, w2]), C = (0, import_react126.useCallback)((e6) => { + if (0 === e6.button && y3.current) { + var t7; + if ("function" == typeof s5 && !s5(e6.target)) + return; + document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", d4.current = S3(e6), (i5 || document.body).addEventListener("mousemove", w2), null == (t7 = window) || t7.addEventListener("mouseup", x2); + } + }, [i5, S3, w2, x2]); + return (0, import_react126.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C), () => { + (i5 || document.body).removeEventListener("mousedown", C), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2); + }), [i5, C, w2, x2]), { cancelCurrentSelection: b2 }; + }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 }); + return { cancelCurrentSelection: p2, DragSelection: (0, import_react126.useCallback)(() => import_react126.default.createElement(d3, a3({ ref: f2 }, s4)), []) }; +} + +// src/core/react/components/SpaceView/SpaceOuter.tsx +var import_react127 = __toESM(require_react()); +var SpaceOuter = (0, import_react127.forwardRef)( + (props, ref2) => { + const [selectionBox, setSelectionBox] = (0, import_react127.useState)(); + const selectableItems = (0, import_react127.useRef)([]); + const { frameProperties } = (0, import_react127.useContext)(FramesEditorRootContext); + const { selectableNodeBounds, id: id3 } = (0, import_react127.useContext)(FrameInstanceContext); + const { selectMulti } = (0, import_react127.useContext)(FrameSelectionContext); + const { tableData } = (0, import_react127.useContext)(FramesMDBContext); + const [dragging, setDragging] = (0, import_react127.useState)(false); + const localRef = (0, import_react127.useRef)(null); + const [contexts, setContexts] = (0, import_react127.useState)({}); + const [frameProps, setFrameProps] = (0, import_react127.useState)({}); + const { pathState } = (0, import_react127.useContext)(PathContext); + const { spaceInfo } = (0, import_react127.useContext)(SpaceContext); + (0, import_react127.useEffect)(() => { + if (!spaceInfo) { + return; + } + const linkedNote = spaceInfo.defPath; + const refreshProps = () => { + if (tableData) { + const properties3 = { + ...pathState?.metadata?.property ?? {} + }; + const fixedProps = Object.keys(properties3).reduce( + (p2, c3) => ({ + ...p2, + [c3]: parseProperty(c3, properties3[c3]) + }), + {} + ); + const row2 = linkContextRow( + props.superstate.formulaContext, + props.superstate.pathsIndex, + fixedProps, + tableData?.cols ?? [], + pathState + ); + setFrameProps(row2); + } else { + const properties3 = { + ...pathState?.metadata?.property ?? {} + }; + setFrameProps(properties3); + } + if (!pathState) { + setContexts({}); + return; + } + const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set(); + const contexts2 = [...pathContexts].reduce( + (p2, c3) => { + const context = props.superstate.contextsIndex.get(c3)?.tables?.[defaultContextSchemaID].rows.find( + (f2) => f2[PathPropertyName] == pathState.path + ); + return context ? { ...p2, [c3]: context } : p2; + }, + { + $space: { + note: linkedNote, + space: pathState.path, + path: pathState.path + }, + $context: { + _keyValue: pathState.path, + _schema: "main" + }, + $properties: frameProperties + } + ); + setContexts(contexts2); + }; + refreshProps(); + }, [spaceInfo, pathState, tableData]); + const propSetters = Object.keys(frameProps).reduce( + (p2, c3) => ({ + ...p2, + [c3]: (value) => { + setFrameProps((p3) => ({ ...p3, [c3]: value })); + saveProperties(props.superstate, pathState.path, { + [c3]: value + }); + } + }), + {} + ); + const onKeyDown = (e5) => { + if (e5.key === "Escape") { + props.superstate.ui.resetSelection(null); + } + }; + (0, import_react127.useEffect)(() => { + window.addEventListener("keydown", onKeyDown); + return () => { + window.removeEventListener("keydown", onKeyDown); + }; + }, []); + const { DragSelection } = v({ + eventsElement: localRef.current, + onSelectionChange: (box) => { + const scroller = localRef.current.parentElement; + const scrollAwareBox = { + ...box, + top: box.top + scroller.scrollTop, + left: box.left + scroller.scrollLeft + }; + setSelectionBox(scrollAwareBox); + const nodesToSelect = []; + Object.keys(selectableNodeBounds.current).forEach((item) => { + if (m3(scrollAwareBox, selectableNodeBounds.current[item])) { + nodesToSelect.push(item); + } + }); + selectMulti(nodesToSelect, false); + }, + onSelectionStart: () => { + setDragging(true); + }, + onSelectionEnd: (e5) => { + setTimeout(function() { + setDragging(false); + }, 100); + }, + selectionProps: { + style: { + backgroundColor: "hsla(var(--color-accent-hsl), 0.1)", + border: "2px solid var(--color-accent)", + borderRadius: 2, + opacity: 0.5 + } + }, + isEnabled: true, + shouldStartSelecting: (target) => { + if (target instanceof HTMLElement && (target.className.includes("mk-f-main") || target.className.includes("mk-space-outer"))) + return true; + return false; + } + }); + return /* @__PURE__ */ import_react127.default.createElement("div", { + className: "mk-space-body cm-line", + ref: (el) => { + localRef.current = el; + if (typeof ref2 == "function") + ref2(el); + else if (ref2 !== null) + ref2.current = el; + } + }, /* @__PURE__ */ import_react127.default.createElement(DragSelection, null), /* @__PURE__ */ import_react127.default.createElement(FrameInstanceProvider, { + id: id3 ?? "root", + superstate: props.superstate, + props: frameProps, + contexts, + propSetters, + editable: true + }, props.children)); + } +); +SpaceOuter.displayName = "SpaceOuter"; +var SpaceOuter_default = SpaceOuter; + +// src/core/react/components/SpaceView/SpaceInner.tsx +var import_react128 = __toESM(require_react()); +var SpaceInner = (props) => { + const ref2 = (0, import_react128.useRef)(null); + const { spaceState } = (0, import_react128.useContext)(SpaceContext); + return /* @__PURE__ */ import_react128.default.createElement(import_react128.default.Fragment, null, /* @__PURE__ */ import_react128.default.createElement(SpaceHeader, { + superstate: props.superstate + }), spaceState && /* @__PURE__ */ import_react128.default.createElement(SpaceOuter_default, { + superstate: props.superstate, + ref: ref2 + }, /* @__PURE__ */ import_react128.default.createElement(FrameEditorInstance, { + containerRef: ref2, + superstate: props.superstate + }))); +}; + +// src/adapters/obsidian/SpaceViewContainer.tsx +var SPACE_VIEW_TYPE = "mk-space"; +var SpaceViewContainer = class extends import_obsidian3.ItemView { + constructor(leaf, superstate, ObsidianUI2, viewType) { + super(leaf); + this.navigation = true; + this.superstate = superstate; + this.viewType = viewType; + this.ui = ObsidianUI2; + } + getViewType() { + return SPACE_VIEW_TYPE; + } + getDisplayText() { + return pathDisplayName(this.path, this.superstate); + } + async onClose() { + this.destroy(); + } + destroy() { + this.superstate.eventsDispatcher.removeListener( + "spaceChanged", + this.changePath + ); + this.superstate.eventsDispatcher.removeListener( + "spaceDeleted", + this.closePath + ); + this.root?.unmount(); + } + async onOpen() { + this.destroy(); + } + changePath(payload) { + if (this.path == payload.path) { + this.leaf.setViewState({ + type: SPACE_VIEW_TYPE, + state: { path: payload.newPath } + }); + } + } + closePath(payload) { + if (this?.path == payload.path) { + this.leaf.setViewState({ + type: null + }); + } + } + async setState(state, result) { + this.path = state.path; + if (!this.path) + return; + this.constructNote(this.path); + const displayName = pathDisplayName(this.path, this.superstate); + const spaceCache = this.superstate.spacesIndex.get(this.path); + await super.setState(state, result); + this.leaf.tabHeaderInnerTitleEl.innerText = displayName; + this.leaf.view.titleEl = displayName; + const headerEl = this.leaf.view.headerEl; + if (headerEl && spaceCache) { + headerEl.querySelector(".view-header-title").innerText = displayName; + if (spaceCache.type == "folder") { + const titleParent = headerEl.querySelector(".view-header-title-parent"); + titleParent.innerHTML = ""; + const parentPaths = getParentFolderPaths(spaceCache.path); + if (titleParent) { + parentPaths.forEach((f2) => { + const breadcrumb = titleParent.createEl("span"); + breadcrumb.addClass("view-header-breadcrumb"); + breadcrumb.innerText = folderPathToString(f2); + breadcrumb.addEventListener( + "click", + () => this.superstate.ui.openPath(f2, false) + ); + const breadcrumbSeparator = titleParent.createEl("span"); + breadcrumbSeparator.addClass("view-header-breadcrumb-separator"); + breadcrumbSeparator.innerText = "/"; + }); + } + } + } + result.history = true; + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + return state; + } + constructNote(path3) { + this.destroy(); + this.superstate.eventsDispatcher.addListener( + "spaceChanged", + this.changePath, + 0, + this + ); + this.superstate.eventsDispatcher.addListener( + "spaceDeleted", + this.closePath, + 0, + this + ); + this.root = this.ui.createRoot(this.contentEl); + if (this.root) { + this.root.render( + /* @__PURE__ */ import_react129.default.createElement("div", { + className: "mk-space-view" + }, path3 == "spaces://$settings" ? /* @__PURE__ */ import_react129.default.createElement(SystemSettings, { + superstate: this.superstate + }) : /* @__PURE__ */ import_react129.default.createElement(SpaceView, { + path: path3, + superstate: this.superstate, + key: path3, + readOnly: false + }, /* @__PURE__ */ import_react129.default.createElement("div", { + className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width" + }, /* @__PURE__ */ import_react129.default.createElement(SpaceInner, { + superstate: this.superstate + })))) + ); + } else { + this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => { + this.constructNote(path3); + }); + } + } +}; + +// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentWrapper.tsx +var import_react130 = __toESM(require_react()); +var import_react131 = __toESM(require_react()); +var SpaceFragmentTitleComponent = (props) => { + const { pathState } = (0, import_react131.useContext)(PathContext); + const fileNameRef = (0, import_react131.useRef)(null); + const contentEditable = true; + const onBlur = (e5) => { + const newValue = e5.target.innerHTML; + if (newValue != props.name) { + props.saveName(newValue); + } + }; + const onKeyPress = (e5) => { + e5.stopPropagation(); + }; + const onKeyUp = (e5) => { + e5.stopPropagation(); + }; + const onKeyDown = (e5) => { + e5.stopPropagation(); + if (e5.key == "a" && e5.metaKey) { + e5.preventDefault(); + const selection2 = window.getSelection(); + const range2 = document.createRange(); + range2.selectNodeContents(e5.target); + selection2.removeAllRanges(); + selection2.addRange(range2); + } + if (e5.key == "Enter") { + e5.target.blur(); + e5.preventDefault(); + } + if (e5.key == "Escape") { + e5.target.blur(); + e5.preventDefault(); + } + }; + const triggerStickerMenu = (e5) => { + props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react130.default.createElement(StickerModal_default, { + ui: props.superstate.ui, + hide: _props.hide, + selectedSticker: (emoji) => props.saveSticker(emoji) + })); + }; + return /* @__PURE__ */ import_react130.default.createElement("div", null, /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-header-icon" + }), /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-title-container" + }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-title-prefix" + }, "#") : "", /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-inline-title inline-title", + ref: fileNameRef, + contentEditable, + onBlur, + onDrop: (e5) => e5.preventDefault(), + onKeyDown, + onKeyPress, + onKeyUp, + dangerouslySetInnerHTML: { + __html: props.name + } + }))); +}; +var SpaceFragmentWrapper = (props) => { + const [schema, setSchema] = import_react130.default.useState(null); + (0, import_react130.useEffect)(() => { + const uri = props.superstate.spaceManager.uriByString(props.path); + if (uri.refType == "context") { + const schema2 = props.superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref); + if (schema2) { + setSchema({ + id: schema2.id, + name: schema2.name, + type: "context", + path: uri.basePath + }); + } + } + if (uri.refType == "frame") { + const schema2 = props.superstate.framesIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref); + if (schema2) { + const frameSchema = mdbSchemaToFrameSchema(schema2); + setSchema({ + id: schema2.id, + name: frameSchema.name, + sticker: frameSchema.def?.icon, + type: "frame", + path: uri.basePath + }); + } + } + if (uri.refType == "action") { + const schema2 = props.superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema; + if (schema2) { + setSchema({ + id: schema2.id, + name: schema2.name, + sticker: schema2.def?.icon, + type: "action", + path: uri.basePath + }); + } + } + }, [props.path]); + const saveName = (name317) => { + if (schema.type == "context") { + props.superstate.spaceManager.saveTableSchema( + schema.path, + schema.id, + (schema2) => ({ ...schema2, name: name317 }) + ); + } + if (schema.type == "frame") { + props.superstate.spaceManager.saveFrameSchema( + schema.path, + schema.id, + (schema2) => ({ ...schema2, name: name317 }) + ); + } + if (schema.type == "action") { + props.superstate.spaceManager.saveCommand( + schema.path, + schema.id, + (command) => ({ ...command, schema: { ...command.schema, name: name317 } }) + ); + } + }; + const saveSticker = (name317) => { + if (schema.type == "frame") { + props.superstate.spaceManager.saveFrameSchema( + schema.path, + schema.id, + (schema2) => { + const frameSchema = mdbSchemaToFrameSchema(schema2); + const newFrameSchema = { + ...frameSchema, + def: { ...frameSchema.def, icon: name317 } + }; + return frameSchemaToTableSchema(newFrameSchema); + } + ); + } + if (schema.type == "action") { + props.superstate.spaceManager.saveCommand( + schema.path, + schema.id, + (command) => { + return { + ...command, + schema: { + ...command.schema, + def: { ...command.schema?.def ?? {}, icon: name317 } + } + }; + } + ); + } + }; + return /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-editor-space-fragment markdown-source-view mod-cm6 is-readable-line-width" + }, /* @__PURE__ */ import_react130.default.createElement("div", { + className: "mk-editor-header" + }, schema && /* @__PURE__ */ import_react130.default.createElement(SpaceFragmentTitleComponent, { + superstate: props.superstate, + readOnly: true, + name: schema.name, + sticker: schema.sticker, + saveName, + saveSticker + })), props.children); +}; + +// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx +var import_obsidian4 = require("obsidian"); +var import_react132 = __toESM(require_react()); +var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment"; +var SpaceFragmentView = class extends import_obsidian4.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + } + getViewType() { + return SPACE_FRAGMENT_VIEW_TYPE; + } + getDisplayText() { + return this.path; + } + async onClose() { + this.destroy(); + } + onunload() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.path = state.path; + this.source = state.source; + this.constructInlineContext(); + await super.setState(state, result); + const title = pathDisplayName(this.path, this.plugin.superstate); + this.leaf.tabHeaderInnerTitleEl.innerText = title; + this.leaf.view.titleEl = title; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = title; + } + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + state.source = this.source; + return state; + } + constructInlineContext() { + this.destroy(); + this.root = this.plugin.ui.createRoot(this.contentEl); + if (this.root) { + this.root.render( + /* @__PURE__ */ import_react132.default.createElement(SpaceFragmentWrapper, { + superstate: this.plugin.superstate, + path: this.path + }, /* @__PURE__ */ import_react132.default.createElement(SpaceFragmentViewComponent, { + id: this.path, + superstate: this.plugin.superstate, + path: this.path, + source: this.source + })) + ); + } else { + this.plugin.ui.manager.eventsDispatch.addOnceListener( + "windowReady", + () => { + this.constructInlineContext(); + } + ); + } + } +}; + +// src/adapters/obsidian/utils/file.ts +var tFileToAFile = (file) => { + if (!file) + return null; + if (file instanceof import_obsidian5.TFile && file.stat) { + return { + isFolder: false, + name: file.basename, + filename: file.name, + path: file.path, + parent: file.parent?.path, + extension: file.extension, + ...file.stat + }; + } + return { + isFolder: true, + name: file.name, + filename: file.name, + path: file.path, + parent: file.parent?.path + }; +}; +var defaultConfigFile = async (plugin) => { + return await plugin.app.vault.adapter.read( + (0, import_obsidian5.normalizePath)(plugin.app.vault.configDir + "/app.json") + ); +}; +var fileExtensionForFile = (path3) => path3?.indexOf(".") > 0 ? path3.split(".").pop() : "md"; +var fileNameForFile = (path3) => path3?.indexOf("/") > 0 ? path3.split("/").pop().split(".").shift() : path3.split(".").shift(); +var uniqueFileName = (oldName, name317, extension2, folder) => { + let newName = sanitizeFileName(name317); + let uniqueName = false; + let append = 1; + while (!uniqueName) { + if (!folder.children.some((f2) => f2.name == `${newName}.${extension2}` && f2.name != oldName)) { + uniqueName = true; + } else { + newName = `${newName} ${append}`; + append += 1; + } + } + return `${newName}.${extension2}`; +}; +function getAllAbstractFilesInVault(app2) { + const files = []; + const rootFolder = app2.vault.getRoot(); + function recursiveFx(folder) { + for (const child of folder.children) { + if (child instanceof import_obsidian5.TFolder) { + const childFolder = child; + if (childFolder.children) + recursiveFx(childFolder); + } + files.push(child); + } + } + recursiveFx(rootFolder); + files.push(rootFolder); + return files; +} +var openPath = async (leaf, path3, plugin, flow3) => { + const uri = plugin.superstate.spaceManager.uriByString(path3); + if (!uri) + return; + if (uri.scheme == "https" || uri.scheme == "http") { + if (plugin.superstate.spacesIndex.has(path3)) { + const viewType = SPACE_VIEW_TYPE; + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: path3 } + }); + return; + } + window.open(uri.fullPath, "_blank"); + return; + } + if (uri.scheme == "obsidian") { + await leaf.setViewState({ + type: uri.authority + }); + return; + } + if (uri.ref) { + const cache2 = plugin.superstate.pathsIndex.get(uri.path); + if (cache2?.type == "space" || uri.scheme == "spaces") { + if (flow3) { + await leaf.setViewState({ + type: EMBED_CONTEXT_VIEW_TYPE, + state: { path: uri.fullPath } + }); + } else { + await leaf.setViewState({ + type: SPACE_FRAGMENT_VIEW_TYPE, + state: { path: uri.fullPath } + }); + } + return; + } + } + if (uri.scheme == "spaces") { + openTagContext(leaf, uri.authority, plugin.app); + return; + } + plugin.files.getFile(path3).then((f2) => { + if (f2) { + openAFile(leaf, f2, plugin); + } else { + if (path3.contains("/")) { + const folder = removeTrailingSlashFromFolder(getParentPathFromString(path3)); + const spaceFolder = plugin.superstate.spacesIndex.get(folder); + if (spaceFolder) { + newPathInSpace( + plugin.superstate, + spaceFolder, + fileExtensionForFile(path3), + fileNameForFile(path3) + ); + } + } else { + defaultSpace(plugin.superstate, plugin.superstate.pathsIndex.get(plugin.superstate.ui.activePath)).then((f3) => { + if (f3) + newPathInSpace( + plugin.superstate, + f3, + fileExtensionForFile(path3), + fileNameForFile(path3) + ); + }); + } + } + }); +}; +var getLeaf = (app2, location) => { + let leaf; + if (location == "system" || location == "hover") { + return null; + } else if (location == "right") { + leaf = app2.workspace.getRightLeaf(false); + } else if (location == "left") { + leaf = app2.workspace.getLeftLeaf(false); + } else { + leaf = app2.workspace.getLeaf(location); + } + return leaf; +}; +var openURL = async (url, app2, location) => { + if (location == "system") { + window.open(url, "_blank"); + return; + } + const leaf = getLeaf(app2, location); + if (url.endsWith(".md")) { + const viewType = LINK_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: url } + }); + await app2.workspace.requestSaveLayout(); + } else if (url.endsWith(".mdb")) { + const viewType = SPACE_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: url } + }); + await app2.workspace.requestSaveLayout(); + } else { + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: EMBED_CONTEXT_VIEW_TYPE, + state: { path: url } + }); + } + if (import_obsidian5.Platform.isMobile) { + app2.workspace.leftSplit.collapse(); + } +}; +var openAFile = async (leaf, file, plugin) => { + if (file.isFolder) { + openTFolder(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin); + } else if (file) { + openTFile(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin.app); + } else { + return; + } +}; +var openTFile = async (leaf, file, app2) => { + if (!file) + return; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.openFile(file); +}; +var openTFolder = async (leaf, file, plugin) => { + if (!plugin.superstate.settings.spaceViewEnabled) { + const space3 = plugin.superstate.spacesIndex.get(file.path)?.space.defPath; + if (!space3) + return; + const spaceFile = getAbstractFileAtPath(plugin.app, space3); + if (!spaceFile) + return; + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + leaf.openFile(spaceFile); + return; + } + const viewType = SPACE_VIEW_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: file.path } + }); + await app.workspace.requestSaveLayout(); + if (import_obsidian5.Platform.isMobile) { + app.workspace.leftSplit.collapse(); + } +}; +var openTagContext = async (leaf, tag2, app2) => { + const viewType = SPACE_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ type: viewType, state: { path: "spaces://" + tag2 } }); + await app2.workspace.requestSaveLayout(); + if (import_obsidian5.Platform.isMobile) { + app2.workspace.leftSplit.collapse(); + } +}; +var getAbstractFileAtPath = (app2, path3) => { + return app2.vault.getAbstractFileByPath(path3); +}; + +// src/adapters/text/removemd.js +function removemd(md, options) { + options = options || {}; + options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false; + options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true; + options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true; + options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true; + options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false; + options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false; + options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : []; + var output = md || ""; + output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*/gm, ""); + try { + if (options.stripListLeaders) { + if (options.listUnicodeChar) + output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1"); + else + output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1"); + } + if (options.gfm) { + output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, ""); + } + if (options.abbr) { + output = output.replace(/\*\[.*\]:.*\n/, ""); + } + output = output.replace(/<[^>]*>/g, ""); + var htmlReplaceRegex = new RegExp("<[^>]*>", "g"); + if (options.htmlTagsToSkip.length > 0) { + var joinedHtmlTagsToSkip = "(?!" + options.htmlTagsToSkip.join("|") + ")"; + htmlReplaceRegex = new RegExp( + "<" + joinedHtmlTagsToSkip + "[^>]*>", + "ig" + ); + } + output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1"); + } catch (e5) { + console.error(e5); + return md; + } + return output; +} + +// src/adapters/text/textCacher.ts +var regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms; +var textCacheExperimental = { + wordCount: (str) => { + const spaceDelimitedChars = /'’A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source; + const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source; + const nonSpaceDelimitedWordsOther = /[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source; + const pattern = new RegExp( + [ + `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`, + nonSpaceDelimitedWords, + nonSpaceDelimitedWordsOther + ].join("|"), + "g" + ); + return (str.replace(regexYaml, "").match(pattern) || []).length; + }, + preview: (str) => { + return removemd(str.replace(regexYaml, "")); + } +}; +var TextCacher = class { + constructor(plugin) { + this.plugin = plugin; + this.supportedFileTypes = ["md"]; + this.id = "text.make.md"; + this.plugin = plugin; + this.cache = /* @__PURE__ */ new Map(); + } + initiate(middleware) { + this.middleware = middleware; + this.middleware.eventDispatch.addListener("onModify", this.refreshCache.bind(this)); + } + refreshCache(payload) { + if (this.supportedFileTypes.find((type) => type == payload.file.extension)) + this.parseCache(payload.file, true); + } + async parseCache(file, refresh) { + if (!file) + return; + const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)); + const updatedCache = {}; + Object.keys(textCacheExperimental).forEach((key3) => { + const runner = textCacheExperimental[key3]; + updatedCache[key3] = runner(contents); + }); + this.cache.set(file.path, updatedCache); + this.middleware.updateFileCache(file.path, updatedCache, refresh); + } +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx +var import_obsidian6 = require("obsidian"); +var import_classnames3 = __toESM(require_classnames()); + +// node_modules/bail/index.js +function bail(error) { + if (error) { + throw error; + } +} + +// node_modules/unified/lib/index.js +var import_is_buffer2 = __toESM(require_is_buffer(), 1); +var import_extend = __toESM(require_extend(), 1); + +// node_modules/is-plain-obj/index.js +function isPlainObject2(value) { + if (typeof value !== "object" || value === null) { + return false; + } + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); +} + +// node_modules/trough/lib/index.js +function trough() { + const fns = []; + const pipeline = { run, use }; + return pipeline; + function run(...values2) { + let middlewareIndex = -1; + const callback = values2.pop(); + if (typeof callback !== "function") { + throw new TypeError("Expected function as last argument, not " + callback); + } + next(null, ...values2); + function next(error, ...output) { + const fn = fns[++middlewareIndex]; + let index3 = -1; + if (error) { + callback(error); + return; + } + while (++index3 < values2.length) { + if (output[index3] === null || output[index3] === void 0) { + output[index3] = values2[index3]; + } + } + values2 = output; + if (fn) { + wrap(fn, next)(...output); + } else { + callback(null, ...output); + } + } + } + function use(middelware) { + if (typeof middelware !== "function") { + throw new TypeError( + "Expected `middelware` to be a function, not " + middelware + ); + } + fns.push(middelware); + return pipeline; + } +} +function wrap(middleware, callback) { + let called; + return wrapped; + function wrapped(...parameters) { + const fnExpectsCallback = middleware.length > parameters.length; + let result; + if (fnExpectsCallback) { + parameters.push(done); + } + try { + result = middleware.apply(this, parameters); + } catch (error) { + const exception = error; + if (fnExpectsCallback && called) { + throw exception; + } + return done(exception); + } + if (!fnExpectsCallback) { + if (result && result.then && typeof result.then === "function") { + result.then(then, done); + } else if (result instanceof Error) { + done(result); + } else { + then(result); + } + } + } + function done(error, ...output) { + if (!called) { + called = true; + callback(error, ...output); + } + } + function then(value) { + done(null, value); + } +} + +// node_modules/vfile/lib/index.js +var import_is_buffer = __toESM(require_is_buffer(), 1); + +// node_modules/unist-util-stringify-position/lib/index.js +function stringifyPosition(value) { + if (!value || typeof value !== "object") { + return ""; + } + if ("position" in value || "type" in value) { + return position(value.position); + } + if ("start" in value || "end" in value) { + return position(value); + } + if ("line" in value || "column" in value) { + return point(value); + } + return ""; +} +function point(point4) { + return index2(point4 && point4.line) + ":" + index2(point4 && point4.column); +} +function position(pos) { + return point(pos && pos.start) + "-" + point(pos && pos.end); +} +function index2(value) { + return value && typeof value === "number" ? value : 1; +} + +// node_modules/vfile-message/lib/index.js +var VFileMessage = class extends Error { + constructor(reason, place, origin) { + const parts = [null, null]; + let position3 = { + start: { line: null, column: null }, + end: { line: null, column: null } + }; + super(); + if (typeof place === "string") { + origin = place; + place = void 0; + } + if (typeof origin === "string") { + const index3 = origin.indexOf(":"); + if (index3 === -1) { + parts[1] = origin; + } else { + parts[0] = origin.slice(0, index3); + parts[1] = origin.slice(index3 + 1); + } + } + if (place) { + if ("type" in place || "position" in place) { + if (place.position) { + position3 = place.position; + } + } else if ("start" in place || "end" in place) { + position3 = place; + } else if ("line" in place || "column" in place) { + position3.start = place; + } + } + this.name = stringifyPosition(place) || "1:1"; + this.message = typeof reason === "object" ? reason.message : reason; + this.stack = ""; + if (typeof reason === "object" && reason.stack) { + this.stack = reason.stack; + } + this.reason = this.message; + this.fatal; + this.line = position3.start.line; + this.column = position3.start.column; + this.position = position3; + this.source = parts[0]; + this.ruleId = parts[1]; + this.file; + this.actual; + this.expected; + this.url; + this.note; + } +}; +VFileMessage.prototype.file = ""; +VFileMessage.prototype.name = ""; +VFileMessage.prototype.reason = ""; +VFileMessage.prototype.message = ""; +VFileMessage.prototype.stack = ""; +VFileMessage.prototype.fatal = null; +VFileMessage.prototype.column = null; +VFileMessage.prototype.line = null; +VFileMessage.prototype.source = null; +VFileMessage.prototype.ruleId = null; +VFileMessage.prototype.position = null; + +// node_modules/vfile/lib/minpath.browser.js +var path2 = { basename, dirname, extname, join: join2, sep: "/" }; +function basename(path3, ext) { + if (ext !== void 0 && typeof ext !== "string") { + throw new TypeError('"ext" argument must be a string'); + } + assertPath(path3); + let start = 0; + let end = -1; + let index3 = path3.length; + let seenNonSlash; + if (ext === void 0 || ext.length === 0 || ext.length > path3.length) { + while (index3--) { + if (path3.charCodeAt(index3) === 47) { + if (seenNonSlash) { + start = index3 + 1; + break; + } + } else if (end < 0) { + seenNonSlash = true; + end = index3 + 1; + } + } + return end < 0 ? "" : path3.slice(start, end); + } + if (ext === path3) { + return ""; + } + let firstNonSlashEnd = -1; + let extIndex = ext.length - 1; + while (index3--) { + if (path3.charCodeAt(index3) === 47) { + if (seenNonSlash) { + start = index3 + 1; + break; + } + } else { + if (firstNonSlashEnd < 0) { + seenNonSlash = true; + firstNonSlashEnd = index3 + 1; + } + if (extIndex > -1) { + if (path3.charCodeAt(index3) === ext.charCodeAt(extIndex--)) { + if (extIndex < 0) { + end = index3; + } + } else { + extIndex = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) { + end = firstNonSlashEnd; + } else if (end < 0) { + end = path3.length; + } + return path3.slice(start, end); +} +function dirname(path3) { + assertPath(path3); + if (path3.length === 0) { + return "."; + } + let end = -1; + let index3 = path3.length; + let unmatchedSlash; + while (--index3) { + if (path3.charCodeAt(index3) === 47) { + if (unmatchedSlash) { + end = index3; + break; + } + } else if (!unmatchedSlash) { + unmatchedSlash = true; + } + } + return end < 0 ? path3.charCodeAt(0) === 47 ? "/" : "." : end === 1 && path3.charCodeAt(0) === 47 ? "//" : path3.slice(0, end); +} +function extname(path3) { + assertPath(path3); + let index3 = path3.length; + let end = -1; + let startPart = 0; + let startDot = -1; + let preDotState = 0; + let unmatchedSlash; + while (index3--) { + const code3 = path3.charCodeAt(index3); + if (code3 === 47) { + if (unmatchedSlash) { + startPart = index3 + 1; + break; + } + continue; + } + if (end < 0) { + unmatchedSlash = true; + end = index3 + 1; + } + if (code3 === 46) { + if (startDot < 0) { + startDot = index3; + } else if (preDotState !== 1) { + preDotState = 1; + } + } else if (startDot > -1) { + preDotState = -1; + } + } + if (startDot < 0 || end < 0 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ""; + } + return path3.slice(startDot, end); +} +function join2(...segments) { + let index3 = -1; + let joined; + while (++index3 < segments.length) { + assertPath(segments[index3]); + if (segments[index3]) { + joined = joined === void 0 ? segments[index3] : joined + "/" + segments[index3]; + } + } + return joined === void 0 ? "." : normalize(joined); +} +function normalize(path3) { + assertPath(path3); + const absolute = path3.charCodeAt(0) === 47; + let value = normalizeString(path3, !absolute); + if (value.length === 0 && !absolute) { + value = "."; + } + if (value.length > 0 && path3.charCodeAt(path3.length - 1) === 47) { + value += "/"; + } + return absolute ? "/" + value : value; +} +function normalizeString(path3, allowAboveRoot) { + let result = ""; + let lastSegmentLength = 0; + let lastSlash = -1; + let dots = 0; + let index3 = -1; + let code3; + let lastSlashIndex; + while (++index3 <= path3.length) { + if (index3 < path3.length) { + code3 = path3.charCodeAt(index3); + } else if (code3 === 47) { + break; + } else { + code3 = 47; + } + if (code3 === 47) { + if (lastSlash === index3 - 1 || dots === 1) { + } else if (lastSlash !== index3 - 1 && dots === 2) { + if (result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 || result.charCodeAt(result.length - 2) !== 46) { + if (result.length > 2) { + lastSlashIndex = result.lastIndexOf("/"); + if (lastSlashIndex !== result.length - 1) { + if (lastSlashIndex < 0) { + result = ""; + lastSegmentLength = 0; + } else { + result = result.slice(0, lastSlashIndex); + lastSegmentLength = result.length - 1 - result.lastIndexOf("/"); + } + lastSlash = index3; + dots = 0; + continue; + } + } else if (result.length > 0) { + result = ""; + lastSegmentLength = 0; + lastSlash = index3; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + result = result.length > 0 ? result + "/.." : ".."; + lastSegmentLength = 2; + } + } else { + if (result.length > 0) { + result += "/" + path3.slice(lastSlash + 1, index3); + } else { + result = path3.slice(lastSlash + 1, index3); + } + lastSegmentLength = index3 - lastSlash - 1; + } + lastSlash = index3; + dots = 0; + } else if (code3 === 46 && dots > -1) { + dots++; + } else { + dots = -1; + } + } + return result; +} +function assertPath(path3) { + if (typeof path3 !== "string") { + throw new TypeError( + "Path must be a string. Received " + JSON.stringify(path3) + ); + } +} + +// node_modules/vfile/lib/minproc.browser.js +var proc = { cwd }; +function cwd() { + return "/"; +} + +// node_modules/vfile/lib/minurl.shared.js +function isUrl(fileUrlOrPath) { + return fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && fileUrlOrPath.href && fileUrlOrPath.origin; +} + +// node_modules/vfile/lib/minurl.browser.js +function urlToPath(path3) { + if (typeof path3 === "string") { + path3 = new URL(path3); + } else if (!isUrl(path3)) { + const error = new TypeError( + 'The "path" argument must be of type string or an instance of URL. Received `' + path3 + "`" + ); + error.code = "ERR_INVALID_ARG_TYPE"; + throw error; + } + if (path3.protocol !== "file:") { + const error = new TypeError("The URL must be of scheme file"); + error.code = "ERR_INVALID_URL_SCHEME"; + throw error; + } + return getPathFromURLPosix(path3); +} +function getPathFromURLPosix(url) { + if (url.hostname !== "") { + const error = new TypeError( + 'File URL host must be "localhost" or empty on darwin' + ); + error.code = "ERR_INVALID_FILE_URL_HOST"; + throw error; + } + const pathname = url.pathname; + let index3 = -1; + while (++index3 < pathname.length) { + if (pathname.charCodeAt(index3) === 37 && pathname.charCodeAt(index3 + 1) === 50) { + const third = pathname.charCodeAt(index3 + 2); + if (third === 70 || third === 102) { + const error = new TypeError( + "File URL path must not include encoded / characters" + ); + error.code = "ERR_INVALID_FILE_URL_PATH"; + throw error; + } + } + } + return decodeURIComponent(pathname); +} + +// node_modules/vfile/lib/index.js +var order = ["history", "path", "basename", "stem", "extname", "dirname"]; +var VFile = class { + constructor(value) { + let options; + if (!value) { + options = {}; + } else if (typeof value === "string" || buffer(value)) { + options = { value }; + } else if (isUrl(value)) { + options = { path: value }; + } else { + options = value; + } + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = proc.cwd(); + this.value; + this.stored; + this.result; + this.map; + let index3 = -1; + while (++index3 < order.length) { + const prop3 = order[index3]; + if (prop3 in options && options[prop3] !== void 0 && options[prop3] !== null) { + this[prop3] = prop3 === "history" ? [...options[prop3]] : options[prop3]; + } + } + let prop2; + for (prop2 in options) { + if (!order.includes(prop2)) { + this[prop2] = options[prop2]; + } + } + } + get path() { + return this.history[this.history.length - 1]; + } + set path(path3) { + if (isUrl(path3)) { + path3 = urlToPath(path3); + } + assertNonEmpty(path3, "path"); + if (this.path !== path3) { + this.history.push(path3); + } + } + get dirname() { + return typeof this.path === "string" ? path2.dirname(this.path) : void 0; + } + set dirname(dirname2) { + assertPath2(this.basename, "dirname"); + this.path = path2.join(dirname2 || "", this.basename); + } + get basename() { + return typeof this.path === "string" ? path2.basename(this.path) : void 0; + } + set basename(basename2) { + assertNonEmpty(basename2, "basename"); + assertPart(basename2, "basename"); + this.path = path2.join(this.dirname || "", basename2); + } + get extname() { + return typeof this.path === "string" ? path2.extname(this.path) : void 0; + } + set extname(extname2) { + assertPart(extname2, "extname"); + assertPath2(this.dirname, "extname"); + if (extname2) { + if (extname2.charCodeAt(0) !== 46) { + throw new Error("`extname` must start with `.`"); + } + if (extname2.includes(".", 1)) { + throw new Error("`extname` cannot contain multiple dots"); + } + } + this.path = path2.join(this.dirname, this.stem + (extname2 || "")); + } + get stem() { + return typeof this.path === "string" ? path2.basename(this.path, this.extname) : void 0; + } + set stem(stem) { + assertNonEmpty(stem, "stem"); + assertPart(stem, "stem"); + this.path = path2.join(this.dirname || "", stem + (this.extname || "")); + } + toString(encoding) { + return (this.value || "").toString(encoding || void 0); + } + message(reason, place, origin) { + const message = new VFileMessage(reason, place, origin); + if (this.path) { + message.name = this.path + ":" + message.name; + message.file = this.path; + } + message.fatal = false; + this.messages.push(message); + return message; + } + info(reason, place, origin) { + const message = this.message(reason, place, origin); + message.fatal = null; + return message; + } + fail(reason, place, origin) { + const message = this.message(reason, place, origin); + message.fatal = true; + throw message; + } +}; +function assertPart(part, name317) { + if (part && part.includes(path2.sep)) { + throw new Error( + "`" + name317 + "` cannot be a path: did not expect `" + path2.sep + "`" + ); + } +} +function assertNonEmpty(part, name317) { + if (!part) { + throw new Error("`" + name317 + "` cannot be empty"); + } +} +function assertPath2(path3, name317) { + if (!path3) { + throw new Error("Setting `" + name317 + "` requires `path` to be set too"); + } +} +function buffer(value) { + return (0, import_is_buffer.default)(value); +} + +// node_modules/unified/lib/index.js +var unified = base2().freeze(); +var own = {}.hasOwnProperty; +function base2() { + const transformers = trough(); + const attachers = []; + let namespace = {}; + let frozen; + let freezeIndex = -1; + processor.data = data3; + processor.Parser = void 0; + processor.Compiler = void 0; + processor.freeze = freeze; + processor.attachers = attachers; + processor.use = use; + processor.parse = parse8; + processor.stringify = stringify5; + processor.run = run; + processor.runSync = runSync; + processor.process = process2; + processor.processSync = processSync; + return processor; + function processor() { + const destination = base2(); + let index3 = -1; + while (++index3 < attachers.length) { + destination.use(...attachers[index3]); + } + destination.data((0, import_extend.default)(true, {}, namespace)); + return destination; + } + function data3(key3, value) { + if (typeof key3 === "string") { + if (arguments.length === 2) { + assertUnfrozen("data", frozen); + namespace[key3] = value; + return processor; + } + return own.call(namespace, key3) && namespace[key3] || null; + } + if (key3) { + assertUnfrozen("data", frozen); + namespace = key3; + return processor; + } + return namespace; + } + function freeze() { + if (frozen) { + return processor; + } + while (++freezeIndex < attachers.length) { + const [attacher, ...options] = attachers[freezeIndex]; + if (options[0] === false) { + continue; + } + if (options[0] === true) { + options[0] = void 0; + } + const transformer = attacher.call(processor, ...options); + if (typeof transformer === "function") { + transformers.use(transformer); + } + } + frozen = true; + freezeIndex = Number.POSITIVE_INFINITY; + return processor; + } + function use(value, ...options) { + let settings; + assertUnfrozen("use", frozen); + if (value === null || value === void 0) { + } else if (typeof value === "function") { + addPlugin(value, ...options); + } else if (typeof value === "object") { + if (Array.isArray(value)) { + addList(value); + } else { + addPreset(value); + } + } else { + throw new TypeError("Expected usable value, not `" + value + "`"); + } + if (settings) { + namespace.settings = Object.assign(namespace.settings || {}, settings); + } + return processor; + function add4(value2) { + if (typeof value2 === "function") { + addPlugin(value2); + } else if (typeof value2 === "object") { + if (Array.isArray(value2)) { + const [plugin, ...options2] = value2; + addPlugin(plugin, ...options2); + } else { + addPreset(value2); + } + } else { + throw new TypeError("Expected usable value, not `" + value2 + "`"); + } + } + function addPreset(result) { + addList(result.plugins); + if (result.settings) { + settings = Object.assign(settings || {}, result.settings); + } + } + function addList(plugins) { + let index3 = -1; + if (plugins === null || plugins === void 0) { + } else if (Array.isArray(plugins)) { + while (++index3 < plugins.length) { + const thing = plugins[index3]; + add4(thing); + } + } else { + throw new TypeError("Expected a list of plugins, not `" + plugins + "`"); + } + } + function addPlugin(plugin, value2) { + let index3 = -1; + let entry; + while (++index3 < attachers.length) { + if (attachers[index3][0] === plugin) { + entry = attachers[index3]; + break; + } + } + if (entry) { + if (isPlainObject2(entry[1]) && isPlainObject2(value2)) { + value2 = (0, import_extend.default)(true, entry[1], value2); + } + entry[1] = value2; + } else { + attachers.push([...arguments]); + } + } + } + function parse8(doc) { + processor.freeze(); + const file = vfile(doc); + const Parser5 = processor.Parser; + assertParser("parse", Parser5); + if (newable(Parser5, "parse")) { + return new Parser5(String(file), file).parse(); + } + return Parser5(String(file), file); + } + function stringify5(node2, doc) { + processor.freeze(); + const file = vfile(doc); + const Compiler = processor.Compiler; + assertCompiler("stringify", Compiler); + assertNode(node2); + if (newable(Compiler, "compile")) { + return new Compiler(node2, file).compile(); + } + return Compiler(node2, file); + } + function run(node2, doc, callback) { + assertNode(node2); + processor.freeze(); + if (!callback && typeof doc === "function") { + callback = doc; + doc = void 0; + } + if (!callback) { + return new Promise(executor); + } + executor(null, callback); + function executor(resolve2, reject) { + transformers.run(node2, vfile(doc), done); + function done(error, tree, file) { + tree = tree || node2; + if (error) { + reject(error); + } else if (resolve2) { + resolve2(tree); + } else { + callback(null, tree, file); + } + } + } + } + function runSync(node2, file) { + let result; + let complete; + processor.run(node2, file, done); + assertDone("runSync", "run", complete); + return result; + function done(error, tree) { + bail(error); + result = tree; + complete = true; + } + } + function process2(doc, callback) { + processor.freeze(); + assertParser("process", processor.Parser); + assertCompiler("process", processor.Compiler); + if (!callback) { + return new Promise(executor); + } + executor(null, callback); + function executor(resolve2, reject) { + const file = vfile(doc); + processor.run(processor.parse(file), file, (error, tree, file2) => { + if (error || !tree || !file2) { + done(error); + } else { + const result = processor.stringify(tree, file2); + if (result === void 0 || result === null) { + } else if (looksLikeAVFileValue(result)) { + file2.value = result; + } else { + file2.result = result; + } + done(error, file2); + } + }); + function done(error, file2) { + if (error || !file2) { + reject(error); + } else if (resolve2) { + resolve2(file2); + } else { + callback(null, file2); + } + } + } + } + function processSync(doc) { + let complete; + processor.freeze(); + assertParser("processSync", processor.Parser); + assertCompiler("processSync", processor.Compiler); + const file = vfile(doc); + processor.process(file, done); + assertDone("processSync", "process", complete); + return file; + function done(error) { + complete = true; + bail(error); + } + } +} +function newable(value, name317) { + return typeof value === "function" && value.prototype && (keys(value.prototype) || name317 in value.prototype); +} +function keys(value) { + let key3; + for (key3 in value) { + if (own.call(value, key3)) { + return true; + } + } + return false; +} +function assertParser(name317, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name317 + "` without `Parser`"); + } +} +function assertCompiler(name317, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name317 + "` without `Compiler`"); + } +} +function assertUnfrozen(name317, frozen) { + if (frozen) { + throw new Error( + "Cannot call `" + name317 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`." + ); + } +} +function assertNode(node2) { + if (!isPlainObject2(node2) || typeof node2.type !== "string") { + throw new TypeError("Expected node, got `" + node2 + "`"); + } +} +function assertDone(name317, asyncName, complete) { + if (!complete) { + throw new Error( + "`" + name317 + "` finished async. Use `" + asyncName + "` instead" + ); + } +} +function vfile(value) { + return looksLikeAVFile(value) ? value : new VFile(value); +} +function looksLikeAVFile(value) { + return Boolean( + value && typeof value === "object" && "message" in value && "messages" in value + ); +} +function looksLikeAVFileValue(value) { + return typeof value === "string" || (0, import_is_buffer2.default)(value); +} + +// node_modules/mdast-util-to-string/lib/index.js +var emptyOptions = {}; +function toString4(value, options) { + const settings = options || emptyOptions; + const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true; + const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true; + return one(value, includeImageAlt, includeHtml); +} +function one(value, includeImageAlt, includeHtml) { + if (node(value)) { + if ("value" in value) { + return value.type === "html" && !includeHtml ? "" : value.value; + } + if (includeImageAlt && "alt" in value && value.alt) { + return value.alt; + } + if ("children" in value) { + return all2(value.children, includeImageAlt, includeHtml); + } + } + if (Array.isArray(value)) { + return all2(value, includeImageAlt, includeHtml); + } + return ""; +} +function all2(values2, includeImageAlt, includeHtml) { + const result = []; + let index3 = -1; + while (++index3 < values2.length) { + result[index3] = one(values2[index3], includeImageAlt, includeHtml); + } + return result.join(""); +} +function node(value) { + return Boolean(value && typeof value === "object"); +} + +// node_modules/micromark-util-chunked/index.js +function splice(list4, start, remove, items) { + const end = list4.length; + let chunkStart = 0; + let parameters; + if (start < 0) { + start = -start > end ? 0 : end + start; + } else { + start = start > end ? end : start; + } + remove = remove > 0 ? remove : 0; + if (items.length < 1e4) { + parameters = Array.from(items); + parameters.unshift(start, remove); + list4.splice(...parameters); + } else { + if (remove) + list4.splice(start, remove); + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 1e4); + parameters.unshift(start, 0); + list4.splice(...parameters); + chunkStart += 1e4; + start += 1e4; + } + } +} +function push(list4, items) { + if (list4.length > 0) { + splice(list4, list4.length, 0, items); + return list4; + } + return items; +} + +// node_modules/micromark-util-combine-extensions/index.js +var hasOwnProperty3 = {}.hasOwnProperty; +function combineExtensions(extensions) { + const all6 = {}; + let index3 = -1; + while (++index3 < extensions.length) { + syntaxExtension(all6, extensions[index3]); + } + return all6; +} +function syntaxExtension(all6, extension2) { + let hook; + for (hook in extension2) { + const maybe = hasOwnProperty3.call(all6, hook) ? all6[hook] : void 0; + const left = maybe || (all6[hook] = {}); + const right = extension2[hook]; + let code3; + if (right) { + for (code3 in right) { + if (!hasOwnProperty3.call(left, code3)) + left[code3] = []; + const value = right[code3]; + constructs( + left[code3], + Array.isArray(value) ? value : value ? [value] : [] + ); + } + } + } +} +function constructs(existing, list4) { + let index3 = -1; + const before = []; + while (++index3 < list4.length) { + ; + (list4[index3].add === "after" ? existing : before).push(list4[index3]); + } + splice(existing, 0, 0, before); +} + +// node_modules/micromark-util-character/lib/unicode-punctuation-regex.js +var unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; + +// node_modules/micromark-util-character/index.js +var asciiAlpha = regexCheck(/[A-Za-z]/); +var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); +var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); +function asciiControl(code3) { + return code3 !== null && (code3 < 32 || code3 === 127); +} +var asciiDigit = regexCheck(/\d/); +var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); +var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); +function markdownLineEnding(code3) { + return code3 !== null && code3 < -2; +} +function markdownLineEndingOrSpace(code3) { + return code3 !== null && (code3 < 0 || code3 === 32); +} +function markdownSpace(code3) { + return code3 === -2 || code3 === -1 || code3 === 32; +} +var unicodePunctuation = regexCheck(unicodePunctuationRegex); +var unicodeWhitespace = regexCheck(/\s/); +function regexCheck(regex) { + return check; + function check(code3) { + return code3 !== null && regex.test(String.fromCharCode(code3)); + } +} + +// node_modules/micromark-factory-space/index.js +function factorySpace(effects, ok2, type, max5) { + const limit = max5 ? max5 - 1 : Number.POSITIVE_INFINITY; + let size2 = 0; + return start; + function start(code3) { + if (markdownSpace(code3)) { + effects.enter(type); + return prefix(code3); + } + return ok2(code3); + } + function prefix(code3) { + if (markdownSpace(code3) && size2++ < limit) { + effects.consume(code3); + return prefix; + } + effects.exit(type); + return ok2(code3); + } +} + +// node_modules/micromark/lib/initialize/content.js +var content3 = { + tokenize: initializeContent +}; +function initializeContent(effects) { + const contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ); + let previous2; + return contentStart; + function afterContentStartConstruct(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, contentStart, "linePrefix"); + } + function paragraphInitial(code3) { + effects.enter("paragraph"); + return lineStart(code3); + } + function lineStart(code3) { + const token = effects.enter("chunkText", { + contentType: "text", + previous: previous2 + }); + if (previous2) { + previous2.next = token; + } + previous2 = token; + return data3(code3); + } + function data3(code3) { + if (code3 === null) { + effects.exit("chunkText"); + effects.exit("paragraph"); + effects.consume(code3); + return; + } + if (markdownLineEnding(code3)) { + effects.consume(code3); + effects.exit("chunkText"); + return lineStart; + } + effects.consume(code3); + return data3; + } +} + +// node_modules/micromark/lib/initialize/document.js +var document2 = { + tokenize: initializeDocument +}; +var containerConstruct = { + tokenize: tokenizeContainer +}; +function initializeDocument(effects) { + const self2 = this; + const stack = []; + let continued = 0; + let childFlow; + let childToken; + let lineStartOffset; + return start; + function start(code3) { + if (continued < stack.length) { + const item = stack[continued]; + self2.containerState = item[1]; + return effects.attempt( + item[0].continuation, + documentContinue, + checkNewContainers + )(code3); + } + return checkNewContainers(code3); + } + function documentContinue(code3) { + continued++; + if (self2.containerState._closeFlow) { + self2.containerState._closeFlow = void 0; + if (childFlow) { + closeFlow(); + } + const indexBeforeExits = self2.events.length; + let indexBeforeFlow = indexBeforeExits; + let point4; + while (indexBeforeFlow--) { + if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { + point4 = self2.events[indexBeforeFlow][1].end; + break; + } + } + exitContainers(continued); + let index3 = indexBeforeExits; + while (index3 < self2.events.length) { + self2.events[index3][1].end = Object.assign({}, point4); + index3++; + } + splice( + self2.events, + indexBeforeFlow + 1, + 0, + self2.events.slice(indexBeforeExits) + ); + self2.events.length = index3; + return checkNewContainers(code3); + } + return start(code3); + } + function checkNewContainers(code3) { + if (continued === stack.length) { + if (!childFlow) { + return documentContinued(code3); + } + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + return flowStart(code3); + } + self2.interrupt = Boolean( + childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack + ); + } + self2.containerState = {}; + return effects.check( + containerConstruct, + thereIsANewContainer, + thereIsNoNewContainer + )(code3); + } + function thereIsANewContainer(code3) { + if (childFlow) + closeFlow(); + exitContainers(continued); + return documentContinued(code3); + } + function thereIsNoNewContainer(code3) { + self2.parser.lazy[self2.now().line] = continued !== stack.length; + lineStartOffset = self2.now().offset; + return flowStart(code3); + } + function documentContinued(code3) { + self2.containerState = {}; + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code3); + } + function containerContinue(code3) { + continued++; + stack.push([self2.currentConstruct, self2.containerState]); + return documentContinued(code3); + } + function flowStart(code3) { + if (code3 === null) { + if (childFlow) + closeFlow(); + exitContainers(0); + effects.consume(code3); + return; + } + childFlow = childFlow || self2.parser.flow(self2.now()); + effects.enter("chunkFlow", { + contentType: "flow", + previous: childToken, + _tokenizer: childFlow + }); + return flowContinue(code3); + } + function flowContinue(code3) { + if (code3 === null) { + writeToChild(effects.exit("chunkFlow"), true); + exitContainers(0); + effects.consume(code3); + return; + } + if (markdownLineEnding(code3)) { + effects.consume(code3); + writeToChild(effects.exit("chunkFlow")); + continued = 0; + self2.interrupt = void 0; + return start; + } + effects.consume(code3); + return flowContinue; + } + function writeToChild(token, eof) { + const stream = self2.sliceStream(token); + if (eof) + stream.push(null); + token.previous = childToken; + if (childToken) + childToken.next = token; + childToken = token; + childFlow.defineSkip(token.start); + childFlow.write(stream); + if (self2.parser.lazy[token.start.line]) { + let index3 = childFlow.events.length; + while (index3--) { + if (childFlow.events[index3][1].start.offset < lineStartOffset && (!childFlow.events[index3][1].end || childFlow.events[index3][1].end.offset > lineStartOffset)) { + return; + } + } + const indexBeforeExits = self2.events.length; + let indexBeforeFlow = indexBeforeExits; + let seen; + let point4; + while (indexBeforeFlow--) { + if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { + if (seen) { + point4 = self2.events[indexBeforeFlow][1].end; + break; + } + seen = true; + } + } + exitContainers(continued); + index3 = indexBeforeExits; + while (index3 < self2.events.length) { + self2.events[index3][1].end = Object.assign({}, point4); + index3++; + } + splice( + self2.events, + indexBeforeFlow + 1, + 0, + self2.events.slice(indexBeforeExits) + ); + self2.events.length = index3; + } + } + function exitContainers(size2) { + let index3 = stack.length; + while (index3-- > size2) { + const entry = stack[index3]; + self2.containerState = entry[1]; + entry[0].exit.call(self2, effects); + } + stack.length = size2; + } + function closeFlow() { + childFlow.write([null]); + childToken = void 0; + childFlow = void 0; + self2.containerState._closeFlow = void 0; + } +} +function tokenizeContainer(effects, ok2, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok2, nok), + "linePrefix", + this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + ); +} + +// node_modules/micromark-util-classify-character/index.js +function classifyCharacter(code3) { + if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) { + return 1; + } + if (unicodePunctuation(code3)) { + return 2; + } +} + +// node_modules/micromark-util-resolve-all/index.js +function resolveAll(constructs2, events2, context) { + const called = []; + let index3 = -1; + while (++index3 < constructs2.length) { + const resolve2 = constructs2[index3].resolveAll; + if (resolve2 && !called.includes(resolve2)) { + events2 = resolve2(events2, context); + called.push(resolve2); + } + } + return events2; +} + +// node_modules/micromark-core-commonmark/lib/attention.js +var attention = { + name: "attention", + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +}; +function resolveAllAttention(events2, context) { + let index3 = -1; + let open; + let group; + let text7; + let openingSequence; + let closingSequence; + let use; + let nextEvents; + let offset2; + while (++index3 < events2.length) { + if (events2[index3][0] === "enter" && events2[index3][1].type === "attentionSequence" && events2[index3][1]._close) { + open = index3; + while (open--) { + if (events2[open][0] === "exit" && events2[open][1].type === "attentionSequence" && events2[open][1]._open && context.sliceSerialize(events2[open][1]).charCodeAt(0) === context.sliceSerialize(events2[index3][1]).charCodeAt(0)) { + if ((events2[open][1]._close || events2[index3][1]._open) && (events2[index3][1].end.offset - events2[index3][1].start.offset) % 3 && !((events2[open][1].end.offset - events2[open][1].start.offset + events2[index3][1].end.offset - events2[index3][1].start.offset) % 3)) { + continue; + } + use = events2[open][1].end.offset - events2[open][1].start.offset > 1 && events2[index3][1].end.offset - events2[index3][1].start.offset > 1 ? 2 : 1; + const start = Object.assign({}, events2[open][1].end); + const end = Object.assign({}, events2[index3][1].start); + movePoint(start, -use); + movePoint(end, use); + openingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start, + end: Object.assign({}, events2[open][1].end) + }; + closingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start: Object.assign({}, events2[index3][1].start), + end + }; + text7 = { + type: use > 1 ? "strongText" : "emphasisText", + start: Object.assign({}, events2[open][1].end), + end: Object.assign({}, events2[index3][1].start) + }; + group = { + type: use > 1 ? "strong" : "emphasis", + start: Object.assign({}, openingSequence.start), + end: Object.assign({}, closingSequence.end) + }; + events2[open][1].end = Object.assign({}, openingSequence.start); + events2[index3][1].start = Object.assign({}, closingSequence.end); + nextEvents = []; + if (events2[open][1].end.offset - events2[open][1].start.offset) { + nextEvents = push(nextEvents, [ + ["enter", events2[open][1], context], + ["exit", events2[open][1], context] + ]); + } + nextEvents = push(nextEvents, [ + ["enter", group, context], + ["enter", openingSequence, context], + ["exit", openingSequence, context], + ["enter", text7, context] + ]); + nextEvents = push( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events2.slice(open + 1, index3), + context + ) + ); + nextEvents = push(nextEvents, [ + ["exit", text7, context], + ["enter", closingSequence, context], + ["exit", closingSequence, context], + ["exit", group, context] + ]); + if (events2[index3][1].end.offset - events2[index3][1].start.offset) { + offset2 = 2; + nextEvents = push(nextEvents, [ + ["enter", events2[index3][1], context], + ["exit", events2[index3][1], context] + ]); + } else { + offset2 = 0; + } + splice(events2, open - 1, index3 - open + 3, nextEvents); + index3 = open + nextEvents.length - offset2 - 2; + break; + } + } + } + } + index3 = -1; + while (++index3 < events2.length) { + if (events2[index3][1].type === "attentionSequence") { + events2[index3][1].type = "data"; + } + } + return events2; +} +function tokenizeAttention(effects, ok2) { + const attentionMarkers2 = this.parser.constructs.attentionMarkers.null; + const previous2 = this.previous; + const before = classifyCharacter(previous2); + let marker; + return start; + function start(code3) { + marker = code3; + effects.enter("attentionSequence"); + return inside(code3); + } + function inside(code3) { + if (code3 === marker) { + effects.consume(code3); + return inside; + } + const token = effects.exit("attentionSequence"); + const after = classifyCharacter(code3); + const open = !after || after === 2 && before || attentionMarkers2.includes(code3); + const close = !before || before === 2 && after || attentionMarkers2.includes(previous2); + token._open = Boolean(marker === 42 ? open : open && (before || !close)); + token._close = Boolean(marker === 42 ? close : close && (after || !open)); + return ok2(code3); + } +} +function movePoint(point4, offset2) { + point4.column += offset2; + point4.offset += offset2; + point4._bufferIndex += offset2; +} + +// node_modules/micromark-core-commonmark/lib/autolink.js +var autolink = { + name: "autolink", + tokenize: tokenizeAutolink +}; +function tokenizeAutolink(effects, ok2, nok) { + let size2 = 0; + return start; + function start(code3) { + effects.enter("autolink"); + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.enter("autolinkProtocol"); + return open; + } + function open(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + return schemeOrEmailAtext; + } + return emailAtext(code3); + } + function schemeOrEmailAtext(code3) { + if (code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) { + size2 = 1; + return schemeInsideOrEmailAtext(code3); + } + return emailAtext(code3); + } + function schemeInsideOrEmailAtext(code3) { + if (code3 === 58) { + effects.consume(code3); + size2 = 0; + return urlInside; + } + if ((code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) && size2++ < 32) { + effects.consume(code3); + return schemeInsideOrEmailAtext; + } + size2 = 0; + return emailAtext(code3); + } + function urlInside(code3) { + if (code3 === 62) { + effects.exit("autolinkProtocol"); + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok2; + } + if (code3 === null || code3 === 32 || code3 === 60 || asciiControl(code3)) { + return nok(code3); + } + effects.consume(code3); + return urlInside; + } + function emailAtext(code3) { + if (code3 === 64) { + effects.consume(code3); + return emailAtSignOrDot; + } + if (asciiAtext(code3)) { + effects.consume(code3); + return emailAtext; + } + return nok(code3); + } + function emailAtSignOrDot(code3) { + return asciiAlphanumeric(code3) ? emailLabel(code3) : nok(code3); + } + function emailLabel(code3) { + if (code3 === 46) { + effects.consume(code3); + size2 = 0; + return emailAtSignOrDot; + } + if (code3 === 62) { + effects.exit("autolinkProtocol").type = "autolinkEmail"; + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok2; + } + return emailValue(code3); + } + function emailValue(code3) { + if ((code3 === 45 || asciiAlphanumeric(code3)) && size2++ < 63) { + const next = code3 === 45 ? emailValue : emailLabel; + effects.consume(code3); + return next; + } + return nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/blank-line.js +var blankLine = { + tokenize: tokenizeBlankLine, + partial: true +}; +function tokenizeBlankLine(effects, ok2, nok) { + return start; + function start(code3) { + return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3); + } + function after(code3) { + return code3 === null || markdownLineEnding(code3) ? ok2(code3) : nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/block-quote.js +var blockQuote = { + name: "blockQuote", + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit +}; +function tokenizeBlockQuoteStart(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + if (code3 === 62) { + const state = self2.containerState; + if (!state.open) { + effects.enter("blockQuote", { + _container: true + }); + state.open = true; + } + effects.enter("blockQuotePrefix"); + effects.enter("blockQuoteMarker"); + effects.consume(code3); + effects.exit("blockQuoteMarker"); + return after; + } + return nok(code3); + } + function after(code3) { + if (markdownSpace(code3)) { + effects.enter("blockQuotePrefixWhitespace"); + effects.consume(code3); + effects.exit("blockQuotePrefixWhitespace"); + effects.exit("blockQuotePrefix"); + return ok2; + } + effects.exit("blockQuotePrefix"); + return ok2(code3); + } +} +function tokenizeBlockQuoteContinuation(effects, ok2, nok) { + const self2 = this; + return contStart; + function contStart(code3) { + if (markdownSpace(code3)) { + return factorySpace( + effects, + contBefore, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code3); + } + return contBefore(code3); + } + function contBefore(code3) { + return effects.attempt(blockQuote, ok2, nok)(code3); + } +} +function exit(effects) { + effects.exit("blockQuote"); +} + +// node_modules/micromark-core-commonmark/lib/character-escape.js +var characterEscape = { + name: "characterEscape", + tokenize: tokenizeCharacterEscape +}; +function tokenizeCharacterEscape(effects, ok2, nok) { + return start; + function start(code3) { + effects.enter("characterEscape"); + effects.enter("escapeMarker"); + effects.consume(code3); + effects.exit("escapeMarker"); + return inside; + } + function inside(code3) { + if (asciiPunctuation(code3)) { + effects.enter("characterEscapeValue"); + effects.consume(code3); + effects.exit("characterEscapeValue"); + effects.exit("characterEscape"); + return ok2; + } + return nok(code3); + } +} + +// node_modules/decode-named-character-reference/index.dom.js +var element = document.createElement("i"); +function decodeNamedCharacterReference(value) { + const characterReference2 = "&" + value + ";"; + element.innerHTML = characterReference2; + const char = element.textContent; + if (char.charCodeAt(char.length - 1) === 59 && value !== "semi") { + return false; + } + return char === characterReference2 ? false : char; +} + +// node_modules/micromark-core-commonmark/lib/character-reference.js +var characterReference = { + name: "characterReference", + tokenize: tokenizeCharacterReference +}; +function tokenizeCharacterReference(effects, ok2, nok) { + const self2 = this; + let size2 = 0; + let max5; + let test; + return start; + function start(code3) { + effects.enter("characterReference"); + effects.enter("characterReferenceMarker"); + effects.consume(code3); + effects.exit("characterReferenceMarker"); + return open; + } + function open(code3) { + if (code3 === 35) { + effects.enter("characterReferenceMarkerNumeric"); + effects.consume(code3); + effects.exit("characterReferenceMarkerNumeric"); + return numeric3; + } + effects.enter("characterReferenceValue"); + max5 = 31; + test = asciiAlphanumeric; + return value(code3); + } + function numeric3(code3) { + if (code3 === 88 || code3 === 120) { + effects.enter("characterReferenceMarkerHexadecimal"); + effects.consume(code3); + effects.exit("characterReferenceMarkerHexadecimal"); + effects.enter("characterReferenceValue"); + max5 = 6; + test = asciiHexDigit; + return value; + } + effects.enter("characterReferenceValue"); + max5 = 7; + test = asciiDigit; + return value(code3); + } + function value(code3) { + if (code3 === 59 && size2) { + const token = effects.exit("characterReferenceValue"); + if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) { + return nok(code3); + } + effects.enter("characterReferenceMarker"); + effects.consume(code3); + effects.exit("characterReferenceMarker"); + effects.exit("characterReference"); + return ok2; + } + if (test(code3) && size2++ < max5) { + effects.consume(code3); + return value; + } + return nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/code-fenced.js +var nonLazyContinuation = { + tokenize: tokenizeNonLazyContinuation, + partial: true +}; +var codeFenced = { + name: "codeFenced", + tokenize: tokenizeCodeFenced, + concrete: true +}; +function tokenizeCodeFenced(effects, ok2, nok) { + const self2 = this; + const closeStart = { + tokenize: tokenizeCloseStart, + partial: true + }; + let initialPrefix = 0; + let sizeOpen = 0; + let marker; + return start; + function start(code3) { + return beforeSequenceOpen(code3); + } + function beforeSequenceOpen(code3) { + const tail = self2.events[self2.events.length - 1]; + initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + marker = code3; + effects.enter("codeFenced"); + effects.enter("codeFencedFence"); + effects.enter("codeFencedFenceSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === marker) { + sizeOpen++; + effects.consume(code3); + return sequenceOpen; + } + if (sizeOpen < 3) { + return nok(code3); + } + effects.exit("codeFencedFenceSequence"); + return markdownSpace(code3) ? factorySpace(effects, infoBefore, "whitespace")(code3) : infoBefore(code3); + } + function infoBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFencedFence"); + return self2.interrupt ? ok2(code3) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3); + } + effects.enter("codeFencedFenceInfo"); + effects.enter("chunkString", { + contentType: "string" + }); + return info(code3); + } + function info(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return infoBefore(code3); + } + if (markdownSpace(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return factorySpace(effects, metaBefore, "whitespace")(code3); + } + if (code3 === 96 && code3 === marker) { + return nok(code3); + } + effects.consume(code3); + return info; + } + function metaBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return infoBefore(code3); + } + effects.enter("codeFencedFenceMeta"); + effects.enter("chunkString", { + contentType: "string" + }); + return meta3(code3); + } + function meta3(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceMeta"); + return infoBefore(code3); + } + if (code3 === 96 && code3 === marker) { + return nok(code3); + } + effects.consume(code3); + return meta3; + } + function atNonLazyBreak(code3) { + return effects.attempt(closeStart, after, contentBefore)(code3); + } + function contentBefore(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return contentStart; + } + function contentStart(code3) { + return initialPrefix > 0 && markdownSpace(code3) ? factorySpace( + effects, + beforeContentChunk, + "linePrefix", + initialPrefix + 1 + )(code3) : beforeContentChunk(code3); + } + function beforeContentChunk(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3); + } + effects.enter("codeFlowValue"); + return contentChunk(code3); + } + function contentChunk(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFlowValue"); + return beforeContentChunk(code3); + } + effects.consume(code3); + return contentChunk; + } + function after(code3) { + effects.exit("codeFenced"); + return ok2(code3); + } + function tokenizeCloseStart(effects2, ok3, nok2) { + let size2 = 0; + return startBefore; + function startBefore(code3) { + effects2.enter("lineEnding"); + effects2.consume(code3); + effects2.exit("lineEnding"); + return start2; + } + function start2(code3) { + effects2.enter("codeFencedFence"); + return markdownSpace(code3) ? factorySpace( + effects2, + beforeSequenceClose, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code3) : beforeSequenceClose(code3); + } + function beforeSequenceClose(code3) { + if (code3 === marker) { + effects2.enter("codeFencedFenceSequence"); + return sequenceClose(code3); + } + return nok2(code3); + } + function sequenceClose(code3) { + if (code3 === marker) { + size2++; + effects2.consume(code3); + return sequenceClose; + } + if (size2 >= sizeOpen) { + effects2.exit("codeFencedFenceSequence"); + return markdownSpace(code3) ? factorySpace(effects2, sequenceCloseAfter, "whitespace")(code3) : sequenceCloseAfter(code3); + } + return nok2(code3); + } + function sequenceCloseAfter(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects2.exit("codeFencedFence"); + return ok3(code3); + } + return nok2(code3); + } + } +} +function tokenizeNonLazyContinuation(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + if (code3 === null) { + return nok(code3); + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return lineStart; + } + function lineStart(code3) { + return self2.parser.lazy[self2.now().line] ? nok(code3) : ok2(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/code-indented.js +var codeIndented = { + name: "codeIndented", + tokenize: tokenizeCodeIndented +}; +var furtherStart = { + tokenize: tokenizeFurtherStart, + partial: true +}; +function tokenizeCodeIndented(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("codeIndented"); + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3); + } + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code3) : nok(code3); + } + function atBreak(code3) { + if (code3 === null) { + return after(code3); + } + if (markdownLineEnding(code3)) { + return effects.attempt(furtherStart, atBreak, after)(code3); + } + effects.enter("codeFlowValue"); + return inside(code3); + } + function inside(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFlowValue"); + return atBreak(code3); + } + effects.consume(code3); + return inside; + } + function after(code3) { + effects.exit("codeIndented"); + return ok2(code3); + } +} +function tokenizeFurtherStart(effects, ok2, nok) { + const self2 = this; + return furtherStart2; + function furtherStart2(code3) { + if (self2.parser.lazy[self2.now().line]) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return furtherStart2; + } + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3); + } + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok2(code3) : markdownLineEnding(code3) ? furtherStart2(code3) : nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/code-text.js +var codeText = { + name: "codeText", + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous +}; +function resolveCodeText(events2) { + let tailExitIndex = events2.length - 4; + let headEnterIndex = 3; + let index3; + let enter; + if ((events2[headEnterIndex][1].type === "lineEnding" || events2[headEnterIndex][1].type === "space") && (events2[tailExitIndex][1].type === "lineEnding" || events2[tailExitIndex][1].type === "space")) { + index3 = headEnterIndex; + while (++index3 < tailExitIndex) { + if (events2[index3][1].type === "codeTextData") { + events2[headEnterIndex][1].type = "codeTextPadding"; + events2[tailExitIndex][1].type = "codeTextPadding"; + headEnterIndex += 2; + tailExitIndex -= 2; + break; + } + } + } + index3 = headEnterIndex - 1; + tailExitIndex++; + while (++index3 <= tailExitIndex) { + if (enter === void 0) { + if (index3 !== tailExitIndex && events2[index3][1].type !== "lineEnding") { + enter = index3; + } + } else if (index3 === tailExitIndex || events2[index3][1].type === "lineEnding") { + events2[enter][1].type = "codeTextData"; + if (index3 !== enter + 2) { + events2[enter][1].end = events2[index3 - 1][1].end; + events2.splice(enter + 2, index3 - enter - 2); + tailExitIndex -= index3 - enter - 2; + index3 = enter + 2; + } + enter = void 0; + } + } + return events2; +} +function previous(code3) { + return code3 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; +} +function tokenizeCodeText(effects, ok2, nok) { + const self2 = this; + let sizeOpen = 0; + let size2; + let token; + return start; + function start(code3) { + effects.enter("codeText"); + effects.enter("codeTextSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === 96) { + effects.consume(code3); + sizeOpen++; + return sequenceOpen; + } + effects.exit("codeTextSequence"); + return between2(code3); + } + function between2(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 32) { + effects.enter("space"); + effects.consume(code3); + effects.exit("space"); + return between2; + } + if (code3 === 96) { + token = effects.enter("codeTextSequence"); + size2 = 0; + return sequenceClose(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return between2; + } + effects.enter("codeTextData"); + return data3(code3); + } + function data3(code3) { + if (code3 === null || code3 === 32 || code3 === 96 || markdownLineEnding(code3)) { + effects.exit("codeTextData"); + return between2(code3); + } + effects.consume(code3); + return data3; + } + function sequenceClose(code3) { + if (code3 === 96) { + effects.consume(code3); + size2++; + return sequenceClose; + } + if (size2 === sizeOpen) { + effects.exit("codeTextSequence"); + effects.exit("codeText"); + return ok2(code3); + } + token.type = "codeTextData"; + return data3(code3); + } +} + +// node_modules/micromark-util-subtokenize/index.js +function subtokenize(events2) { + const jumps = {}; + let index3 = -1; + let event; + let lineIndex; + let otherIndex; + let otherEvent; + let parameters; + let subevents; + let more; + while (++index3 < events2.length) { + while (index3 in jumps) { + index3 = jumps[index3]; + } + event = events2[index3]; + if (index3 && event[1].type === "chunkFlow" && events2[index3 - 1][1].type === "listItemPrefix") { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { + otherIndex += 2; + } + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === "content") { + break; + } + if (subevents[otherIndex][1].type === "chunkText") { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } + if (event[0] === "enter") { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events2, index3)); + index3 = jumps[index3]; + more = true; + } + } else if (event[1]._container) { + otherIndex = index3; + lineIndex = void 0; + while (otherIndex--) { + otherEvent = events2[otherIndex]; + if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { + if (otherEvent[0] === "enter") { + if (lineIndex) { + events2[lineIndex][1].type = "lineEndingBlank"; + } + otherEvent[1].type = "lineEnding"; + lineIndex = otherIndex; + } + } else { + break; + } + } + if (lineIndex) { + event[1].end = Object.assign({}, events2[lineIndex][1].start); + parameters = events2.slice(lineIndex, index3); + parameters.unshift(event); + splice(events2, lineIndex, index3 - lineIndex + 1, parameters); + } + } + } + return !more; +} +function subcontent(events2, eventIndex) { + const token = events2[eventIndex][1]; + const context = events2[eventIndex][2]; + let startPosition = eventIndex - 1; + const startPositions = []; + const tokenizer2 = token._tokenizer || context.parser[token.contentType](token.start); + const childEvents = tokenizer2.events; + const jumps = []; + const gaps = {}; + let stream; + let previous2; + let index3 = -1; + let current3 = token; + let adjust = 0; + let start = 0; + const breaks = [start]; + while (current3) { + while (events2[++startPosition][1] !== current3) { + } + startPositions.push(startPosition); + if (!current3._tokenizer) { + stream = context.sliceStream(current3); + if (!current3.next) { + stream.push(null); + } + if (previous2) { + tokenizer2.defineSkip(current3.start); + } + if (current3._isInFirstContentOfListItem) { + tokenizer2._gfmTasklistFirstContentOfListItem = true; + } + tokenizer2.write(stream); + if (current3._isInFirstContentOfListItem) { + tokenizer2._gfmTasklistFirstContentOfListItem = void 0; + } + } + previous2 = current3; + current3 = current3.next; + } + current3 = token; + while (++index3 < childEvents.length) { + if (childEvents[index3][0] === "exit" && childEvents[index3 - 1][0] === "enter" && childEvents[index3][1].type === childEvents[index3 - 1][1].type && childEvents[index3][1].start.line !== childEvents[index3][1].end.line) { + start = index3 + 1; + breaks.push(start); + current3._tokenizer = void 0; + current3.previous = void 0; + current3 = current3.next; + } + } + tokenizer2.events = []; + if (current3) { + current3._tokenizer = void 0; + current3.previous = void 0; + } else { + breaks.pop(); + } + index3 = breaks.length; + while (index3--) { + const slice = childEvents.slice(breaks[index3], breaks[index3 + 1]); + const start2 = startPositions.pop(); + jumps.unshift([start2, start2 + slice.length - 1]); + splice(events2, start2, 2, slice); + } + index3 = -1; + while (++index3 < jumps.length) { + gaps[adjust + jumps[index3][0]] = adjust + jumps[index3][1]; + adjust += jumps[index3][1] - jumps[index3][0] - 1; + } + return gaps; +} + +// node_modules/micromark-core-commonmark/lib/content.js +var content4 = { + tokenize: tokenizeContent, + resolve: resolveContent +}; +var continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true +}; +function resolveContent(events2) { + subtokenize(events2); + return events2; +} +function tokenizeContent(effects, ok2) { + let previous2; + return chunkStart; + function chunkStart(code3) { + effects.enter("content"); + previous2 = effects.enter("chunkContent", { + contentType: "content" + }); + return chunkInside(code3); + } + function chunkInside(code3) { + if (code3 === null) { + return contentEnd(code3); + } + if (markdownLineEnding(code3)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code3); + } + effects.consume(code3); + return chunkInside; + } + function contentEnd(code3) { + effects.exit("chunkContent"); + effects.exit("content"); + return ok2(code3); + } + function contentContinue(code3) { + effects.consume(code3); + effects.exit("chunkContent"); + previous2.next = effects.enter("chunkContent", { + contentType: "content", + previous: previous2 + }); + previous2 = previous2.next; + return chunkInside; + } +} +function tokenizeContinuation(effects, ok2, nok) { + const self2 = this; + return startLookahead; + function startLookahead(code3) { + effects.exit("chunkContent"); + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, prefixed, "linePrefix"); + } + function prefixed(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return nok(code3); + } + const tail = self2.events[self2.events.length - 1]; + if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { + return ok2(code3); + } + return effects.interrupt(self2.parser.constructs.flow, nok, ok2)(code3); + } +} + +// node_modules/micromark-factory-destination/index.js +function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max5) { + const limit = max5 || Number.POSITIVE_INFINITY; + let balance = 0; + return start; + function start(code3) { + if (code3 === 60) { + effects.enter(type); + effects.enter(literalType); + effects.enter(literalMarkerType); + effects.consume(code3); + effects.exit(literalMarkerType); + return enclosedBefore; + } + if (code3 === null || code3 === 32 || code3 === 41 || asciiControl(code3)) { + return nok(code3); + } + effects.enter(type); + effects.enter(rawType); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return raw2(code3); + } + function enclosedBefore(code3) { + if (code3 === 62) { + effects.enter(literalMarkerType); + effects.consume(code3); + effects.exit(literalMarkerType); + effects.exit(literalType); + effects.exit(type); + return ok2; + } + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return enclosed(code3); + } + function enclosed(code3) { + if (code3 === 62) { + effects.exit("chunkString"); + effects.exit(stringType); + return enclosedBefore(code3); + } + if (code3 === null || code3 === 60 || markdownLineEnding(code3)) { + return nok(code3); + } + effects.consume(code3); + return code3 === 92 ? enclosedEscape : enclosed; + } + function enclosedEscape(code3) { + if (code3 === 60 || code3 === 62 || code3 === 92) { + effects.consume(code3); + return enclosed; + } + return enclosed(code3); + } + function raw2(code3) { + if (!balance && (code3 === null || code3 === 41 || markdownLineEndingOrSpace(code3))) { + effects.exit("chunkString"); + effects.exit(stringType); + effects.exit(rawType); + effects.exit(type); + return ok2(code3); + } + if (balance < limit && code3 === 40) { + effects.consume(code3); + balance++; + return raw2; + } + if (code3 === 41) { + effects.consume(code3); + balance--; + return raw2; + } + if (code3 === null || code3 === 32 || code3 === 40 || asciiControl(code3)) { + return nok(code3); + } + effects.consume(code3); + return code3 === 92 ? rawEscape : raw2; + } + function rawEscape(code3) { + if (code3 === 40 || code3 === 41 || code3 === 92) { + effects.consume(code3); + return raw2; + } + return raw2(code3); + } +} + +// node_modules/micromark-factory-label/index.js +function factoryLabel(effects, ok2, nok, type, markerType, stringType) { + const self2 = this; + let size2 = 0; + let seen; + return start; + function start(code3) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.enter(stringType); + return atBreak; + } + function atBreak(code3) { + if (size2 > 999 || code3 === null || code3 === 91 || code3 === 93 && !seen || code3 === 94 && !size2 && "_hiddenFootnoteSupport" in self2.parser.constructs) { + return nok(code3); + } + if (code3 === 93) { + effects.exit(stringType); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.exit(type); + return ok2; + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return atBreak; + } + effects.enter("chunkString", { + contentType: "string" + }); + return labelInside(code3); + } + function labelInside(code3) { + if (code3 === null || code3 === 91 || code3 === 93 || markdownLineEnding(code3) || size2++ > 999) { + effects.exit("chunkString"); + return atBreak(code3); + } + effects.consume(code3); + if (!seen) + seen = !markdownSpace(code3); + return code3 === 92 ? labelEscape : labelInside; + } + function labelEscape(code3) { + if (code3 === 91 || code3 === 92 || code3 === 93) { + effects.consume(code3); + size2++; + return labelInside; + } + return labelInside(code3); + } +} + +// node_modules/micromark-factory-title/index.js +function factoryTitle(effects, ok2, nok, type, markerType, stringType) { + let marker; + return start; + function start(code3) { + if (code3 === 34 || code3 === 39 || code3 === 40) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + marker = code3 === 40 ? 41 : code3; + return begin; + } + return nok(code3); + } + function begin(code3) { + if (code3 === marker) { + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.exit(type); + return ok2; + } + effects.enter(stringType); + return atBreak(code3); + } + function atBreak(code3) { + if (code3 === marker) { + effects.exit(stringType); + return begin(marker); + } + if (code3 === null) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, atBreak, "linePrefix"); + } + effects.enter("chunkString", { + contentType: "string" + }); + return inside(code3); + } + function inside(code3) { + if (code3 === marker || code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + return atBreak(code3); + } + effects.consume(code3); + return code3 === 92 ? escape2 : inside; + } + function escape2(code3) { + if (code3 === marker || code3 === 92) { + effects.consume(code3); + return inside; + } + return inside(code3); + } +} + +// node_modules/micromark-factory-whitespace/index.js +function factoryWhitespace(effects, ok2) { + let seen; + return start; + function start(code3) { + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + seen = true; + return start; + } + if (markdownSpace(code3)) { + return factorySpace( + effects, + start, + seen ? "linePrefix" : "lineSuffix" + )(code3); + } + return ok2(code3); + } +} + +// node_modules/micromark-util-normalize-identifier/index.js +function normalizeIdentifier(value) { + return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); +} + +// node_modules/micromark-core-commonmark/lib/definition.js +var definition = { + name: "definition", + tokenize: tokenizeDefinition +}; +var titleBefore = { + tokenize: tokenizeTitleBefore, + partial: true +}; +function tokenizeDefinition(effects, ok2, nok) { + const self2 = this; + let identifier; + return start; + function start(code3) { + effects.enter("definition"); + return before(code3); + } + function before(code3) { + return factoryLabel.call( + self2, + effects, + labelAfter, + nok, + "definitionLabel", + "definitionLabelMarker", + "definitionLabelString" + )(code3); + } + function labelAfter(code3) { + identifier = normalizeIdentifier( + self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) + ); + if (code3 === 58) { + effects.enter("definitionMarker"); + effects.consume(code3); + effects.exit("definitionMarker"); + return markerAfter; + } + return nok(code3); + } + function markerAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, destinationBefore)(code3) : destinationBefore(code3); + } + function destinationBefore(code3) { + return factoryDestination( + effects, + destinationAfter, + nok, + "definitionDestination", + "definitionDestinationLiteral", + "definitionDestinationLiteralMarker", + "definitionDestinationRaw", + "definitionDestinationString" + )(code3); + } + function destinationAfter(code3) { + return effects.attempt(titleBefore, after, after)(code3); + } + function after(code3) { + return markdownSpace(code3) ? factorySpace(effects, afterWhitespace, "whitespace")(code3) : afterWhitespace(code3); + } + function afterWhitespace(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("definition"); + self2.parser.defined.push(identifier); + return ok2(code3); + } + return nok(code3); + } +} +function tokenizeTitleBefore(effects, ok2, nok) { + return titleBefore2; + function titleBefore2(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, beforeMarker)(code3) : nok(code3); + } + function beforeMarker(code3) { + return factoryTitle( + effects, + titleAfter, + nok, + "definitionTitle", + "definitionTitleMarker", + "definitionTitleString" + )(code3); + } + function titleAfter(code3) { + return markdownSpace(code3) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code3) : titleAfterOptionalWhitespace(code3); + } + function titleAfterOptionalWhitespace(code3) { + return code3 === null || markdownLineEnding(code3) ? ok2(code3) : nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/hard-break-escape.js +var hardBreakEscape = { + name: "hardBreakEscape", + tokenize: tokenizeHardBreakEscape +}; +function tokenizeHardBreakEscape(effects, ok2, nok) { + return start; + function start(code3) { + effects.enter("hardBreakEscape"); + effects.consume(code3); + return after; + } + function after(code3) { + if (markdownLineEnding(code3)) { + effects.exit("hardBreakEscape"); + return ok2(code3); + } + return nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/heading-atx.js +var headingAtx = { + name: "headingAtx", + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +}; +function resolveHeadingAtx(events2, context) { + let contentEnd = events2.length - 2; + let contentStart = 3; + let content5; + let text7; + if (events2[contentStart][1].type === "whitespace") { + contentStart += 2; + } + if (contentEnd - 2 > contentStart && events2[contentEnd][1].type === "whitespace") { + contentEnd -= 2; + } + if (events2[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events2[contentEnd - 2][1].type === "whitespace")) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + } + if (contentEnd > contentStart) { + content5 = { + type: "atxHeadingText", + start: events2[contentStart][1].start, + end: events2[contentEnd][1].end + }; + text7 = { + type: "chunkText", + start: events2[contentStart][1].start, + end: events2[contentEnd][1].end, + contentType: "text" + }; + splice(events2, contentStart, contentEnd - contentStart + 1, [ + ["enter", content5, context], + ["enter", text7, context], + ["exit", text7, context], + ["exit", content5, context] + ]); + } + return events2; +} +function tokenizeHeadingAtx(effects, ok2, nok) { + let size2 = 0; + return start; + function start(code3) { + effects.enter("atxHeading"); + return before(code3); + } + function before(code3) { + effects.enter("atxHeadingSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === 35 && size2++ < 6) { + effects.consume(code3); + return sequenceOpen; + } + if (code3 === null || markdownLineEndingOrSpace(code3)) { + effects.exit("atxHeadingSequence"); + return atBreak(code3); + } + return nok(code3); + } + function atBreak(code3) { + if (code3 === 35) { + effects.enter("atxHeadingSequence"); + return sequenceFurther(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("atxHeading"); + return ok2(code3); + } + if (markdownSpace(code3)) { + return factorySpace(effects, atBreak, "whitespace")(code3); + } + effects.enter("atxHeadingText"); + return data3(code3); + } + function sequenceFurther(code3) { + if (code3 === 35) { + effects.consume(code3); + return sequenceFurther; + } + effects.exit("atxHeadingSequence"); + return atBreak(code3); + } + function data3(code3) { + if (code3 === null || code3 === 35 || markdownLineEndingOrSpace(code3)) { + effects.exit("atxHeadingText"); + return atBreak(code3); + } + effects.consume(code3); + return data3; + } +} + +// node_modules/micromark-util-html-tag-name/index.js +var htmlBlockNames = [ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "search", + "section", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul" +]; +var htmlRawNames = ["pre", "script", "style", "textarea"]; + +// node_modules/micromark-core-commonmark/lib/html-flow.js +var htmlFlow = { + name: "htmlFlow", + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +}; +var blankLineBefore = { + tokenize: tokenizeBlankLineBefore, + partial: true +}; +var nonLazyContinuationStart = { + tokenize: tokenizeNonLazyContinuationStart, + partial: true +}; +function resolveToHtmlFlow(events2) { + let index3 = events2.length; + while (index3--) { + if (events2[index3][0] === "enter" && events2[index3][1].type === "htmlFlow") { + break; + } + } + if (index3 > 1 && events2[index3 - 2][1].type === "linePrefix") { + events2[index3][1].start = events2[index3 - 2][1].start; + events2[index3 + 1][1].start = events2[index3 - 2][1].start; + events2.splice(index3 - 2, 2); + } + return events2; +} +function tokenizeHtmlFlow(effects, ok2, nok) { + const self2 = this; + let marker; + let closingTag; + let buffer2; + let index3; + let markerB; + return start; + function start(code3) { + return before(code3); + } + function before(code3) { + effects.enter("htmlFlow"); + effects.enter("htmlFlowData"); + effects.consume(code3); + return open; + } + function open(code3) { + if (code3 === 33) { + effects.consume(code3); + return declarationOpen; + } + if (code3 === 47) { + effects.consume(code3); + closingTag = true; + return tagCloseStart; + } + if (code3 === 63) { + effects.consume(code3); + marker = 3; + return self2.interrupt ? ok2 : continuationDeclarationInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + buffer2 = String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function declarationOpen(code3) { + if (code3 === 45) { + effects.consume(code3); + marker = 2; + return commentOpenInside; + } + if (code3 === 91) { + effects.consume(code3); + marker = 5; + index3 = 0; + return cdataOpenInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + marker = 4; + return self2.interrupt ? ok2 : continuationDeclarationInside; + } + return nok(code3); + } + function commentOpenInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return self2.interrupt ? ok2 : continuationDeclarationInside; + } + return nok(code3); + } + function cdataOpenInside(code3) { + const value = "CDATA["; + if (code3 === value.charCodeAt(index3++)) { + effects.consume(code3); + if (index3 === value.length) { + return self2.interrupt ? ok2 : continuation; + } + return cdataOpenInside; + } + return nok(code3); + } + function tagCloseStart(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + buffer2 = String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function tagName(code3) { + if (code3 === null || code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + const slash2 = code3 === 47; + const name317 = buffer2.toLowerCase(); + if (!slash2 && !closingTag && htmlRawNames.includes(name317)) { + marker = 1; + return self2.interrupt ? ok2(code3) : continuation(code3); + } + if (htmlBlockNames.includes(buffer2.toLowerCase())) { + marker = 6; + if (slash2) { + effects.consume(code3); + return basicSelfClosing; + } + return self2.interrupt ? ok2(code3) : continuation(code3); + } + marker = 7; + return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code3) : closingTag ? completeClosingTagAfter(code3) : completeAttributeNameBefore(code3); + } + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + buffer2 += String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function basicSelfClosing(code3) { + if (code3 === 62) { + effects.consume(code3); + return self2.interrupt ? ok2 : continuation; + } + return nok(code3); + } + function completeClosingTagAfter(code3) { + if (markdownSpace(code3)) { + effects.consume(code3); + return completeClosingTagAfter; + } + return completeEnd(code3); + } + function completeAttributeNameBefore(code3) { + if (code3 === 47) { + effects.consume(code3); + return completeEnd; + } + if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) { + effects.consume(code3); + return completeAttributeName; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeNameBefore; + } + return completeEnd(code3); + } + function completeAttributeName(code3) { + if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return completeAttributeName; + } + return completeAttributeNameAfter(code3); + } + function completeAttributeNameAfter(code3) { + if (code3 === 61) { + effects.consume(code3); + return completeAttributeValueBefore; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeNameAfter; + } + return completeAttributeNameBefore(code3); + } + function completeAttributeValueBefore(code3) { + if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) { + return nok(code3); + } + if (code3 === 34 || code3 === 39) { + effects.consume(code3); + markerB = code3; + return completeAttributeValueQuoted; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeValueBefore; + } + return completeAttributeValueUnquoted(code3); + } + function completeAttributeValueQuoted(code3) { + if (code3 === markerB) { + effects.consume(code3); + markerB = null; + return completeAttributeValueQuotedAfter; + } + if (code3 === null || markdownLineEnding(code3)) { + return nok(code3); + } + effects.consume(code3); + return completeAttributeValueQuoted; + } + function completeAttributeValueUnquoted(code3) { + if (code3 === null || code3 === 34 || code3 === 39 || code3 === 47 || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96 || markdownLineEndingOrSpace(code3)) { + return completeAttributeNameAfter(code3); + } + effects.consume(code3); + return completeAttributeValueUnquoted; + } + function completeAttributeValueQuotedAfter(code3) { + if (code3 === 47 || code3 === 62 || markdownSpace(code3)) { + return completeAttributeNameBefore(code3); + } + return nok(code3); + } + function completeEnd(code3) { + if (code3 === 62) { + effects.consume(code3); + return completeAfter; + } + return nok(code3); + } + function completeAfter(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return continuation(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAfter; + } + return nok(code3); + } + function continuation(code3) { + if (code3 === 45 && marker === 2) { + effects.consume(code3); + return continuationCommentInside; + } + if (code3 === 60 && marker === 1) { + effects.consume(code3); + return continuationRawTagOpen; + } + if (code3 === 62 && marker === 4) { + effects.consume(code3); + return continuationClose; + } + if (code3 === 63 && marker === 3) { + effects.consume(code3); + return continuationDeclarationInside; + } + if (code3 === 93 && marker === 5) { + effects.consume(code3); + return continuationCdataInside; + } + if (markdownLineEnding(code3) && (marker === 6 || marker === 7)) { + effects.exit("htmlFlowData"); + return effects.check( + blankLineBefore, + continuationAfter, + continuationStart + )(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("htmlFlowData"); + return continuationStart(code3); + } + effects.consume(code3); + return continuation; + } + function continuationStart(code3) { + return effects.check( + nonLazyContinuationStart, + continuationStartNonLazy, + continuationAfter + )(code3); + } + function continuationStartNonLazy(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return continuationBefore; + } + function continuationBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return continuationStart(code3); + } + effects.enter("htmlFlowData"); + return continuation(code3); + } + function continuationCommentInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationRawTagOpen(code3) { + if (code3 === 47) { + effects.consume(code3); + buffer2 = ""; + return continuationRawEndTag; + } + return continuation(code3); + } + function continuationRawEndTag(code3) { + if (code3 === 62) { + const name317 = buffer2.toLowerCase(); + if (htmlRawNames.includes(name317)) { + effects.consume(code3); + return continuationClose; + } + return continuation(code3); + } + if (asciiAlpha(code3) && buffer2.length < 8) { + effects.consume(code3); + buffer2 += String.fromCharCode(code3); + return continuationRawEndTag; + } + return continuation(code3); + } + function continuationCdataInside(code3) { + if (code3 === 93) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationDeclarationInside(code3) { + if (code3 === 62) { + effects.consume(code3); + return continuationClose; + } + if (code3 === 45 && marker === 2) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationClose(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("htmlFlowData"); + return continuationAfter(code3); + } + effects.consume(code3); + return continuationClose; + } + function continuationAfter(code3) { + effects.exit("htmlFlow"); + return ok2(code3); + } +} +function tokenizeNonLazyContinuationStart(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return after; + } + return nok(code3); + } + function after(code3) { + return self2.parser.lazy[self2.now().line] ? nok(code3) : ok2(code3); + } +} +function tokenizeBlankLineBefore(effects, ok2, nok) { + return start; + function start(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return effects.attempt(blankLine, ok2, nok); + } +} + +// node_modules/micromark-core-commonmark/lib/html-text.js +var htmlText = { + name: "htmlText", + tokenize: tokenizeHtmlText +}; +function tokenizeHtmlText(effects, ok2, nok) { + const self2 = this; + let marker; + let index3; + let returnState; + return start; + function start(code3) { + effects.enter("htmlText"); + effects.enter("htmlTextData"); + effects.consume(code3); + return open; + } + function open(code3) { + if (code3 === 33) { + effects.consume(code3); + return declarationOpen; + } + if (code3 === 47) { + effects.consume(code3); + return tagCloseStart; + } + if (code3 === 63) { + effects.consume(code3); + return instruction; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + return tagOpen; + } + return nok(code3); + } + function declarationOpen(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentOpenInside; + } + if (code3 === 91) { + effects.consume(code3); + index3 = 0; + return cdataOpenInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + return declaration; + } + return nok(code3); + } + function commentOpenInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentEnd; + } + return nok(code3); + } + function comment4(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 45) { + effects.consume(code3); + return commentClose; + } + if (markdownLineEnding(code3)) { + returnState = comment4; + return lineEndingBefore(code3); + } + effects.consume(code3); + return comment4; + } + function commentClose(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentEnd; + } + return comment4(code3); + } + function commentEnd(code3) { + return code3 === 62 ? end(code3) : code3 === 45 ? commentClose(code3) : comment4(code3); + } + function cdataOpenInside(code3) { + const value = "CDATA["; + if (code3 === value.charCodeAt(index3++)) { + effects.consume(code3); + return index3 === value.length ? cdata : cdataOpenInside; + } + return nok(code3); + } + function cdata(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 93) { + effects.consume(code3); + return cdataClose; + } + if (markdownLineEnding(code3)) { + returnState = cdata; + return lineEndingBefore(code3); + } + effects.consume(code3); + return cdata; + } + function cdataClose(code3) { + if (code3 === 93) { + effects.consume(code3); + return cdataEnd; + } + return cdata(code3); + } + function cdataEnd(code3) { + if (code3 === 62) { + return end(code3); + } + if (code3 === 93) { + effects.consume(code3); + return cdataEnd; + } + return cdata(code3); + } + function declaration(code3) { + if (code3 === null || code3 === 62) { + return end(code3); + } + if (markdownLineEnding(code3)) { + returnState = declaration; + return lineEndingBefore(code3); + } + effects.consume(code3); + return declaration; + } + function instruction(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 63) { + effects.consume(code3); + return instructionClose; + } + if (markdownLineEnding(code3)) { + returnState = instruction; + return lineEndingBefore(code3); + } + effects.consume(code3); + return instruction; + } + function instructionClose(code3) { + return code3 === 62 ? end(code3) : instruction(code3); + } + function tagCloseStart(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + return tagClose; + } + return nok(code3); + } + function tagClose(code3) { + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagClose; + } + return tagCloseBetween(code3); + } + function tagCloseBetween(code3) { + if (markdownLineEnding(code3)) { + returnState = tagCloseBetween; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagCloseBetween; + } + return end(code3); + } + function tagOpen(code3) { + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagOpen; + } + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + return nok(code3); + } + function tagOpenBetween(code3) { + if (code3 === 47) { + effects.consume(code3); + return end; + } + if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) { + effects.consume(code3); + return tagOpenAttributeName; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenBetween; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenBetween; + } + return end(code3); + } + function tagOpenAttributeName(code3) { + if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagOpenAttributeName; + } + return tagOpenAttributeNameAfter(code3); + } + function tagOpenAttributeNameAfter(code3) { + if (code3 === 61) { + effects.consume(code3); + return tagOpenAttributeValueBefore; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeNameAfter; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenAttributeNameAfter; + } + return tagOpenBetween(code3); + } + function tagOpenAttributeValueBefore(code3) { + if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) { + return nok(code3); + } + if (code3 === 34 || code3 === 39) { + effects.consume(code3); + marker = code3; + return tagOpenAttributeValueQuoted; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeValueBefore; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenAttributeValueBefore; + } + effects.consume(code3); + return tagOpenAttributeValueUnquoted; } - return accept; -} -function acceptPropAsAcceptAttr(accept) { - if (isDefined2(accept)) { - return Object.entries(accept).reduce(function(a4, _ref6) { - var _ref7 = _slicedToArray(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1]; - return [].concat(_toConsumableArray(a4), [mimeType], _toConsumableArray(ext)); - }, []).filter(function(v2) { - return isMIMEType(v2) || isExt(v2); - }).join(","); + function tagOpenAttributeValueQuoted(code3) { + if (code3 === marker) { + effects.consume(code3); + marker = void 0; + return tagOpenAttributeValueQuotedAfter; + } + if (code3 === null) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeValueQuoted; + return lineEndingBefore(code3); + } + effects.consume(code3); + return tagOpenAttributeValueQuoted; + } + function tagOpenAttributeValueUnquoted(code3) { + if (code3 === null || code3 === 34 || code3 === 39 || code3 === 60 || code3 === 61 || code3 === 96) { + return nok(code3); + } + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + effects.consume(code3); + return tagOpenAttributeValueUnquoted; + } + function tagOpenAttributeValueQuotedAfter(code3) { + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + return nok(code3); + } + function end(code3) { + if (code3 === 62) { + effects.consume(code3); + effects.exit("htmlTextData"); + effects.exit("htmlText"); + return ok2; + } + return nok(code3); + } + function lineEndingBefore(code3) { + effects.exit("htmlTextData"); + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return lineEndingAfter; + } + function lineEndingAfter(code3) { + return markdownSpace(code3) ? factorySpace( + effects, + lineEndingAfterPrefix, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code3) : lineEndingAfterPrefix(code3); + } + function lineEndingAfterPrefix(code3) { + effects.enter("htmlTextData"); + return returnState(code3); } - return void 0; } -function isAbort(v2) { - return v2 instanceof DOMException && (v2.name === "AbortError" || v2.code === v2.ABORT_ERR); + +// node_modules/micromark-core-commonmark/lib/label-end.js +var labelEnd = { + name: "labelEnd", + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +}; +var resourceConstruct = { + tokenize: tokenizeResource +}; +var referenceFullConstruct = { + tokenize: tokenizeReferenceFull +}; +var referenceCollapsedConstruct = { + tokenize: tokenizeReferenceCollapsed +}; +function resolveAllLabelEnd(events2) { + let index3 = -1; + while (++index3 < events2.length) { + const token = events2[index3][1]; + if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { + events2.splice(index3 + 1, token.type === "labelImage" ? 4 : 2); + token.type = "data"; + index3++; + } + } + return events2; } -function isSecurityError(v2) { - return v2 instanceof DOMException && (v2.name === "SecurityError" || v2.code === v2.SECURITY_ERR); +function resolveToLabelEnd(events2, context) { + let index3 = events2.length; + let offset2 = 0; + let token; + let open; + let close; + let media; + while (index3--) { + token = events2[index3][1]; + if (open) { + if (token.type === "link" || token.type === "labelLink" && token._inactive) { + break; + } + if (events2[index3][0] === "enter" && token.type === "labelLink") { + token._inactive = true; + } + } else if (close) { + if (events2[index3][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { + open = index3; + if (token.type !== "labelLink") { + offset2 = 2; + break; + } + } + } else if (token.type === "labelEnd") { + close = index3; + } + } + const group = { + type: events2[open][1].type === "labelLink" ? "link" : "image", + start: Object.assign({}, events2[open][1].start), + end: Object.assign({}, events2[events2.length - 1][1].end) + }; + const label = { + type: "label", + start: Object.assign({}, events2[open][1].start), + end: Object.assign({}, events2[close][1].end) + }; + const text7 = { + type: "labelText", + start: Object.assign({}, events2[open + offset2 + 2][1].end), + end: Object.assign({}, events2[close - 2][1].start) + }; + media = [ + ["enter", group, context], + ["enter", label, context] + ]; + media = push(media, events2.slice(open + 1, open + offset2 + 3)); + media = push(media, [["enter", text7, context]]); + media = push( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events2.slice(open + offset2 + 4, close - 3), + context + ) + ); + media = push(media, [ + ["exit", text7, context], + events2[close - 2], + events2[close - 1], + ["exit", label, context] + ]); + media = push(media, events2.slice(close + 1)); + media = push(media, [["exit", group, context]]); + splice(events2, open, events2.length, media); + return events2; +} +function tokenizeLabelEnd(effects, ok2, nok) { + const self2 = this; + let index3 = self2.events.length; + let labelStart; + let defined; + while (index3--) { + if ((self2.events[index3][1].type === "labelImage" || self2.events[index3][1].type === "labelLink") && !self2.events[index3][1]._balanced) { + labelStart = self2.events[index3][1]; + break; + } + } + return start; + function start(code3) { + if (!labelStart) { + return nok(code3); + } + if (labelStart._inactive) { + return labelEndNok(code3); + } + defined = self2.parser.defined.includes( + normalizeIdentifier( + self2.sliceSerialize({ + start: labelStart.end, + end: self2.now() + }) + ) + ); + effects.enter("labelEnd"); + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelEnd"); + return after; + } + function after(code3) { + if (code3 === 40) { + return effects.attempt( + resourceConstruct, + labelEndOk, + defined ? labelEndOk : labelEndNok + )(code3); + } + if (code3 === 91) { + return effects.attempt( + referenceFullConstruct, + labelEndOk, + defined ? referenceNotFull : labelEndNok + )(code3); + } + return defined ? labelEndOk(code3) : labelEndNok(code3); + } + function referenceNotFull(code3) { + return effects.attempt( + referenceCollapsedConstruct, + labelEndOk, + labelEndNok + )(code3); + } + function labelEndOk(code3) { + return ok2(code3); + } + function labelEndNok(code3) { + labelStart._balanced = true; + return nok(code3); + } +} +function tokenizeResource(effects, ok2, nok) { + return resourceStart; + function resourceStart(code3) { + effects.enter("resource"); + effects.enter("resourceMarker"); + effects.consume(code3); + effects.exit("resourceMarker"); + return resourceBefore; + } + function resourceBefore(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceOpen)(code3) : resourceOpen(code3); + } + function resourceOpen(code3) { + if (code3 === 41) { + return resourceEnd(code3); + } + return factoryDestination( + effects, + resourceDestinationAfter, + resourceDestinationMissing, + "resourceDestination", + "resourceDestinationLiteral", + "resourceDestinationLiteralMarker", + "resourceDestinationRaw", + "resourceDestinationString", + 32 + )(code3); + } + function resourceDestinationAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceBetween)(code3) : resourceEnd(code3); + } + function resourceDestinationMissing(code3) { + return nok(code3); + } + function resourceBetween(code3) { + if (code3 === 34 || code3 === 39 || code3 === 40) { + return factoryTitle( + effects, + resourceTitleAfter, + nok, + "resourceTitle", + "resourceTitleMarker", + "resourceTitleString" + )(code3); + } + return resourceEnd(code3); + } + function resourceTitleAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceEnd)(code3) : resourceEnd(code3); + } + function resourceEnd(code3) { + if (code3 === 41) { + effects.enter("resourceMarker"); + effects.consume(code3); + effects.exit("resourceMarker"); + effects.exit("resource"); + return ok2; + } + return nok(code3); + } +} +function tokenizeReferenceFull(effects, ok2, nok) { + const self2 = this; + return referenceFull; + function referenceFull(code3) { + return factoryLabel.call( + self2, + effects, + referenceFullAfter, + referenceFullMissing, + "reference", + "referenceMarker", + "referenceString" + )(code3); + } + function referenceFullAfter(code3) { + return self2.parser.defined.includes( + normalizeIdentifier( + self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) + ) + ) ? ok2(code3) : nok(code3); + } + function referenceFullMissing(code3) { + return nok(code3); + } +} +function tokenizeReferenceCollapsed(effects, ok2, nok) { + return referenceCollapsedStart; + function referenceCollapsedStart(code3) { + effects.enter("reference"); + effects.enter("referenceMarker"); + effects.consume(code3); + effects.exit("referenceMarker"); + return referenceCollapsedOpen; + } + function referenceCollapsedOpen(code3) { + if (code3 === 93) { + effects.enter("referenceMarker"); + effects.consume(code3); + effects.exit("referenceMarker"); + effects.exit("reference"); + return ok2; + } + return nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/label-start-image.js +var labelStartImage = { + name: "labelStartImage", + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +}; +function tokenizeLabelStartImage(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("labelImage"); + effects.enter("labelImageMarker"); + effects.consume(code3); + effects.exit("labelImageMarker"); + return open; + } + function open(code3) { + if (code3 === 91) { + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelImage"); + return after; + } + return nok(code3); + } + function after(code3) { + return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok2(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/label-start-link.js +var labelStartLink = { + name: "labelStartLink", + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +}; +function tokenizeLabelStartLink(effects, ok2, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("labelLink"); + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelLink"); + return after; + } + function after(code3) { + return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok2(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/line-ending.js +var lineEnding = { + name: "lineEnding", + tokenize: tokenizeLineEnding +}; +function tokenizeLineEnding(effects, ok2) { + return start; + function start(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, ok2, "linePrefix"); + } +} + +// node_modules/micromark-core-commonmark/lib/thematic-break.js +var thematicBreak = { + name: "thematicBreak", + tokenize: tokenizeThematicBreak +}; +function tokenizeThematicBreak(effects, ok2, nok) { + let size2 = 0; + let marker; + return start; + function start(code3) { + effects.enter("thematicBreak"); + return before(code3); + } + function before(code3) { + marker = code3; + return atBreak(code3); + } + function atBreak(code3) { + if (code3 === marker) { + effects.enter("thematicBreakSequence"); + return sequence(code3); + } + if (size2 >= 3 && (code3 === null || markdownLineEnding(code3))) { + effects.exit("thematicBreak"); + return ok2(code3); + } + return nok(code3); + } + function sequence(code3) { + if (code3 === marker) { + effects.consume(code3); + size2++; + return sequence; + } + effects.exit("thematicBreakSequence"); + return markdownSpace(code3) ? factorySpace(effects, atBreak, "whitespace")(code3) : atBreak(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/list.js +var list = { + name: "list", + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd +}; +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +}; +var indentConstruct = { + tokenize: tokenizeIndent, + partial: true +}; +function tokenizeListStart(effects, ok2, nok) { + const self2 = this; + const tail = self2.events[self2.events.length - 1]; + let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + let size2 = 0; + return start; + function start(code3) { + const kind = self2.containerState.type || (code3 === 42 || code3 === 43 || code3 === 45 ? "listUnordered" : "listOrdered"); + if (kind === "listUnordered" ? !self2.containerState.marker || code3 === self2.containerState.marker : asciiDigit(code3)) { + if (!self2.containerState.type) { + self2.containerState.type = kind; + effects.enter(kind, { + _container: true + }); + } + if (kind === "listUnordered") { + effects.enter("listItemPrefix"); + return code3 === 42 || code3 === 45 ? effects.check(thematicBreak, nok, atMarker)(code3) : atMarker(code3); + } + if (!self2.interrupt || code3 === 49) { + effects.enter("listItemPrefix"); + effects.enter("listItemValue"); + return inside(code3); + } + } + return nok(code3); + } + function inside(code3) { + if (asciiDigit(code3) && ++size2 < 10) { + effects.consume(code3); + return inside; + } + if ((!self2.interrupt || size2 < 2) && (self2.containerState.marker ? code3 === self2.containerState.marker : code3 === 41 || code3 === 46)) { + effects.exit("listItemValue"); + return atMarker(code3); + } + return nok(code3); + } + function atMarker(code3) { + effects.enter("listItemMarker"); + effects.consume(code3); + effects.exit("listItemMarker"); + self2.containerState.marker = self2.containerState.marker || code3; + return effects.check( + blankLine, + self2.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ); + } + function onBlank(code3) { + self2.containerState.initialBlankLine = true; + initialSize++; + return endOfPrefix(code3); + } + function otherPrefix(code3) { + if (markdownSpace(code3)) { + effects.enter("listItemPrefixWhitespace"); + effects.consume(code3); + effects.exit("listItemPrefixWhitespace"); + return endOfPrefix; + } + return nok(code3); + } + function endOfPrefix(code3) { + self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit("listItemPrefix"), true).length; + return ok2(code3); + } +} +function tokenizeListContinuation(effects, ok2, nok) { + const self2 = this; + self2.containerState._closeFlow = void 0; + return effects.check(blankLine, onBlank, notBlank); + function onBlank(code3) { + self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine; + return factorySpace( + effects, + ok2, + "listItemIndent", + self2.containerState.size + 1 + )(code3); + } + function notBlank(code3) { + if (self2.containerState.furtherBlankLines || !markdownSpace(code3)) { + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return notInCurrentItem(code3); + } + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return effects.attempt(indentConstruct, ok2, notInCurrentItem)(code3); + } + function notInCurrentItem(code3) { + self2.containerState._closeFlow = true; + self2.interrupt = void 0; + return factorySpace( + effects, + effects.attempt(list, ok2, nok), + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code3); + } +} +function tokenizeIndent(effects, ok2, nok) { + const self2 = this; + return factorySpace( + effects, + afterPrefix, + "listItemIndent", + self2.containerState.size + 1 + ); + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code3) : nok(code3); + } } -function isMIMEType(v2) { - return v2 === "audio/*" || v2 === "video/*" || v2 === "image/*" || v2 === "text/*" || /\w+\/[-+.\w]+/g.test(v2); +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type); } -function isExt(v2) { - return /^.*\.[\w]+$/.test(v2); +function tokenizeListItemPrefixWhitespace(effects, ok2, nok) { + const self2 = this; + return factorySpace( + effects, + afterPrefix, + "listItemPrefixWhitespace", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1 + ); + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return !markdownSpace(code3) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok2(code3) : nok(code3); + } +} + +// node_modules/micromark-core-commonmark/lib/setext-underline.js +var setextUnderline = { + name: "setextUnderline", + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +}; +function resolveToSetextUnderline(events2, context) { + let index3 = events2.length; + let content5; + let text7; + let definition3; + while (index3--) { + if (events2[index3][0] === "enter") { + if (events2[index3][1].type === "content") { + content5 = index3; + break; + } + if (events2[index3][1].type === "paragraph") { + text7 = index3; + } + } else { + if (events2[index3][1].type === "content") { + events2.splice(index3, 1); + } + if (!definition3 && events2[index3][1].type === "definition") { + definition3 = index3; + } + } + } + const heading5 = { + type: "setextHeading", + start: Object.assign({}, events2[text7][1].start), + end: Object.assign({}, events2[events2.length - 1][1].end) + }; + events2[text7][1].type = "setextHeadingText"; + if (definition3) { + events2.splice(text7, 0, ["enter", heading5, context]); + events2.splice(definition3 + 1, 0, ["exit", events2[content5][1], context]); + events2[content5][1].end = Object.assign({}, events2[definition3][1].end); + } else { + events2[content5][1] = heading5; + } + events2.push(["exit", heading5, context]); + return events2; +} +function tokenizeSetextUnderline(effects, ok2, nok) { + const self2 = this; + let marker; + return start; + function start(code3) { + let index3 = self2.events.length; + let paragraph3; + while (index3--) { + if (self2.events[index3][1].type !== "lineEnding" && self2.events[index3][1].type !== "linePrefix" && self2.events[index3][1].type !== "content") { + paragraph3 = self2.events[index3][1].type === "paragraph"; + break; + } + } + if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph3)) { + effects.enter("setextHeadingLine"); + marker = code3; + return before(code3); + } + return nok(code3); + } + function before(code3) { + effects.enter("setextHeadingLineSequence"); + return inside(code3); + } + function inside(code3) { + if (code3 === marker) { + effects.consume(code3); + return inside; + } + effects.exit("setextHeadingLineSequence"); + return markdownSpace(code3) ? factorySpace(effects, after, "lineSuffix")(code3) : after(code3); + } + function after(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("setextHeadingLine"); + return ok2(code3); + } + return nok(code3); + } } -// node_modules/react-dropzone/dist/es/index.js -var _excluded2 = ["children"]; -var _excluded22 = ["open"]; -var _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"]; -var _excluded4 = ["refKey", "onChange", "onClick"]; -function _toConsumableArray2(arr) { - return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2(); -} -function _nonIterableSpread2() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -function _iterableToArray2(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) - return Array.from(iter); -} -function _arrayWithoutHoles2(arr) { - if (Array.isArray(arr)) - return _arrayLikeToArray2(arr); +// node_modules/micromark/lib/initialize/flow.js +var flow = { + tokenize: initializeFlow +}; +function initializeFlow(effects) { + const self2 = this; + const initial = effects.attempt( + blankLine, + atBlankEnding, + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content4, afterConstruct) + ), + "linePrefix" + ) + ) + ); + return initial; + function atBlankEnding(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEndingBlank"); + effects.consume(code3); + effects.exit("lineEndingBlank"); + self2.currentConstruct = void 0; + return initial; + } + function afterConstruct(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + self2.currentConstruct = void 0; + return initial; + } } -function _slicedToArray2(arr, i4) { - return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _unsupportedIterableToArray2(arr, i4) || _nonIterableRest2(); + +// node_modules/micromark/lib/initialize/text.js +var resolver = { + resolveAll: createResolver() +}; +var string4 = initializeFactory("string"); +var text2 = initializeFactory("text"); +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === "text" ? resolveAllLineSuffixes : void 0 + ) + }; + function initializeText(effects) { + const self2 = this; + const constructs2 = this.parser.constructs[field]; + const text7 = effects.attempt(constructs2, start, notText); + return start; + function start(code3) { + return atBreak(code3) ? text7(code3) : notText(code3); + } + function notText(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("data"); + effects.consume(code3); + return data3; + } + function data3(code3) { + if (atBreak(code3)) { + effects.exit("data"); + return text7(code3); + } + effects.consume(code3); + return data3; + } + function atBreak(code3) { + if (code3 === null) { + return true; + } + const list4 = constructs2[code3]; + let index3 = -1; + if (list4) { + while (++index3 < list4.length) { + const item = list4[index3]; + if (!item.previous || item.previous.call(self2, self2.previous)) { + return true; + } + } + } + return false; + } + } } -function _nonIterableRest2() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +function createResolver(extraResolver) { + return resolveAllText; + function resolveAllText(events2, context) { + let index3 = -1; + let enter; + while (++index3 <= events2.length) { + if (enter === void 0) { + if (events2[index3] && events2[index3][1].type === "data") { + enter = index3; + index3++; + } + } else if (!events2[index3] || events2[index3][1].type !== "data") { + if (index3 !== enter + 2) { + events2[enter][1].end = events2[index3 - 1][1].end; + events2.splice(enter + 2, index3 - enter - 2); + index3 = enter + 2; + } + enter = void 0; + } + } + return extraResolver ? extraResolver(events2, context) : events2; + } +} +function resolveAllLineSuffixes(events2, context) { + let eventIndex = 0; + while (++eventIndex <= events2.length) { + if ((eventIndex === events2.length || events2[eventIndex][1].type === "lineEnding") && events2[eventIndex - 1][1].type === "data") { + const data3 = events2[eventIndex - 1][1]; + const chunks = context.sliceStream(data3); + let index3 = chunks.length; + let bufferIndex = -1; + let size2 = 0; + let tabs; + while (index3--) { + const chunk = chunks[index3]; + if (typeof chunk === "string") { + bufferIndex = chunk.length; + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size2++; + bufferIndex--; + } + if (bufferIndex) + break; + bufferIndex = -1; + } else if (chunk === -2) { + tabs = true; + size2++; + } else if (chunk === -1) { + } else { + index3++; + break; + } + } + if (size2) { + const token = { + type: eventIndex === events2.length || tabs || size2 < 2 ? "lineSuffix" : "hardBreakTrailing", + start: { + line: data3.end.line, + column: data3.end.column - size2, + offset: data3.end.offset - size2, + _index: data3.start._index + index3, + _bufferIndex: index3 ? bufferIndex : data3.start._bufferIndex + bufferIndex + }, + end: Object.assign({}, data3.end) + }; + data3.end = Object.assign({}, token.start); + if (data3.start.offset === data3.end.offset) { + Object.assign(data3, token); + } else { + events2.splice( + eventIndex, + 0, + ["enter", token, context], + ["exit", token, context] + ); + eventIndex += 2; + } + } + eventIndex++; + } + } + return events2; } -function _unsupportedIterableToArray2(o2, minLen) { - if (!o2) - return; - if (typeof o2 === "string") - return _arrayLikeToArray2(o2, minLen); - var n3 = Object.prototype.toString.call(o2).slice(8, -1); - if (n3 === "Object" && o2.constructor) - n3 = o2.constructor.name; - if (n3 === "Map" || n3 === "Set") - return Array.from(o2); - if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3)) - return _arrayLikeToArray2(o2, minLen); + +// node_modules/micromark/lib/create-tokenizer.js +function createTokenizer(parser3, initialize, from) { + let point4 = Object.assign( + from ? Object.assign({}, from) : { + line: 1, + column: 1, + offset: 0 + }, + { + _index: 0, + _bufferIndex: -1 + } + ); + const columnStart = {}; + const resolveAllConstructs = []; + let chunks = []; + let stack = []; + let consumed = true; + const effects = { + consume, + enter, + exit: exit2, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }) + }; + const context = { + previous: null, + code: null, + containerState: {}, + events: [], + parser: parser3, + sliceStream, + sliceSerialize, + now, + defineSkip, + write + }; + let state = initialize.tokenize.call(context, effects); + let expectedCode; + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize); + } + return context; + function write(slice) { + chunks = push(chunks, slice); + main(); + if (chunks[chunks.length - 1] !== null) { + return []; + } + addResult(initialize, 0); + context.events = resolveAll(resolveAllConstructs, context.events, context); + return context.events; + } + function sliceSerialize(token, expandTabs) { + return serializeChunks(sliceStream(token), expandTabs); + } + function sliceStream(token) { + return sliceChunks(chunks, token); + } + function now() { + const { line, column: column2, offset: offset2, _index, _bufferIndex } = point4; + return { + line, + column: column2, + offset: offset2, + _index, + _bufferIndex + }; + } + function defineSkip(value) { + columnStart[value.line] = value.column; + accountForPotentialSkip(); + } + function main() { + let chunkIndex; + while (point4._index < chunks.length) { + const chunk = chunks[point4._index]; + if (typeof chunk === "string") { + chunkIndex = point4._index; + if (point4._bufferIndex < 0) { + point4._bufferIndex = 0; + } + while (point4._index === chunkIndex && point4._bufferIndex < chunk.length) { + go(chunk.charCodeAt(point4._bufferIndex)); + } + } else { + go(chunk); + } + } + } + function go(code3) { + consumed = void 0; + expectedCode = code3; + state = state(code3); + } + function consume(code3) { + if (markdownLineEnding(code3)) { + point4.line++; + point4.column = 1; + point4.offset += code3 === -3 ? 2 : 1; + accountForPotentialSkip(); + } else if (code3 !== -1) { + point4.column++; + point4.offset++; + } + if (point4._bufferIndex < 0) { + point4._index++; + } else { + point4._bufferIndex++; + if (point4._bufferIndex === chunks[point4._index].length) { + point4._bufferIndex = -1; + point4._index++; + } + } + context.previous = code3; + consumed = true; + } + function enter(type, fields) { + const token = fields || {}; + token.type = type; + token.start = now(); + context.events.push(["enter", token, context]); + stack.push(token); + return token; + } + function exit2(type) { + const token = stack.pop(); + token.end = now(); + context.events.push(["exit", token, context]); + return token; + } + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from); + } + function onsuccessfulcheck(_15, info) { + info.restore(); + } + function constructFactory(onreturn, fields) { + return hook; + function hook(constructs2, returnState, bogusState) { + let listOfConstructs; + let constructIndex; + let currentConstruct; + let info; + return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? handleListOfConstructs([constructs2]) : handleMapOfConstructs(constructs2); + function handleMapOfConstructs(map6) { + return start; + function start(code3) { + const def = code3 !== null && map6[code3]; + const all6 = code3 !== null && map6.null; + const list4 = [ + ...Array.isArray(def) ? def : def ? [def] : [], + ...Array.isArray(all6) ? all6 : all6 ? [all6] : [] + ]; + return handleListOfConstructs(list4)(code3); + } + } + function handleListOfConstructs(list4) { + listOfConstructs = list4; + constructIndex = 0; + if (list4.length === 0) { + return bogusState; + } + return handleConstruct(list4[constructIndex]); + } + function handleConstruct(construct) { + return start; + function start(code3) { + info = store(); + currentConstruct = construct; + if (!construct.partial) { + context.currentConstruct = construct; + } + if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) { + return nok(code3); + } + return construct.tokenize.call( + fields ? Object.assign(Object.create(context), fields) : context, + effects, + ok2, + nok + )(code3); + } + } + function ok2(code3) { + consumed = true; + onreturn(currentConstruct, info); + return returnState; + } + function nok(code3) { + consumed = true; + info.restore(); + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]); + } + return bogusState; + } + } + } + function addResult(construct, from2) { + if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { + resolveAllConstructs.push(construct); + } + if (construct.resolve) { + splice( + context.events, + from2, + context.events.length - from2, + construct.resolve(context.events.slice(from2), context) + ); + } + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context); + } + } + function store() { + const startPoint = now(); + const startPrevious = context.previous; + const startCurrentConstruct = context.currentConstruct; + const startEventsIndex = context.events.length; + const startStack = Array.from(stack); + return { + restore, + from: startEventsIndex + }; + function restore() { + point4 = startPoint; + context.previous = startPrevious; + context.currentConstruct = startCurrentConstruct; + context.events.length = startEventsIndex; + stack = startStack; + accountForPotentialSkip(); + } + } + function accountForPotentialSkip() { + if (point4.line in columnStart && point4.column < 2) { + point4.column = columnStart[point4.line]; + point4.offset += columnStart[point4.line] - 1; + } + } } -function _arrayLikeToArray2(arr, len) { - if (len == null || len > arr.length) - len = arr.length; - for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { - arr2[i4] = arr[i4]; +function sliceChunks(chunks, token) { + const startIndex = token.start._index; + const startBufferIndex = token.start._bufferIndex; + const endIndex = token.end._index; + const endBufferIndex = token.end._bufferIndex; + let view; + if (startIndex === endIndex) { + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + } else { + view = chunks.slice(startIndex, endIndex); + if (startBufferIndex > -1) { + const head2 = view[0]; + if (typeof head2 === "string") { + view[0] = head2.slice(startBufferIndex); + } else { + view.shift(); + } + } + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)); + } } - return arr2; + return view; } -function _iterableToArrayLimit2(arr, i4) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - if (_i == null) - return; - var _arr = []; - var _n = true; - var _d = false; - var _s, _e; - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i4 && _arr.length === i4) +function serializeChunks(chunks, expandTabs) { + let index3 = -1; + const result = []; + let atTab; + while (++index3 < chunks.length) { + const chunk = chunks[index3]; + let value; + if (typeof chunk === "string") { + value = chunk; + } else + switch (chunk) { + case -5: { + value = "\r"; + break; + } + case -4: { + value = "\n"; + break; + } + case -3: { + value = "\r\n"; + break; + } + case -2: { + value = expandTabs ? " " : " "; + break; + } + case -1: { + if (!expandTabs && atTab) + continue; + value = " "; + break; + } + default: { + value = String.fromCharCode(chunk); + } + } + atTab = chunk === -2; + result.push(value); + } + return result.join(""); +} + +// node_modules/micromark/lib/constructs.js +var constructs_exports = {}; +__export(constructs_exports, { + attentionMarkers: () => attentionMarkers, + contentInitial: () => contentInitial, + disable: () => disable, + document: () => document3, + flow: () => flow2, + flowInitial: () => flowInitial, + insideSpan: () => insideSpan, + string: () => string5, + text: () => text3 +}); +var document3 = { + [42]: list, + [43]: list, + [45]: list, + [48]: list, + [49]: list, + [50]: list, + [51]: list, + [52]: list, + [53]: list, + [54]: list, + [55]: list, + [56]: list, + [57]: list, + [62]: blockQuote +}; +var contentInitial = { + [91]: definition +}; +var flowInitial = { + [-2]: codeIndented, + [-1]: codeIndented, + [32]: codeIndented +}; +var flow2 = { + [35]: headingAtx, + [42]: thematicBreak, + [45]: [setextUnderline, thematicBreak], + [60]: htmlFlow, + [61]: setextUnderline, + [95]: thematicBreak, + [96]: codeFenced, + [126]: codeFenced +}; +var string5 = { + [38]: characterReference, + [92]: characterEscape +}; +var text3 = { + [-5]: lineEnding, + [-4]: lineEnding, + [-3]: lineEnding, + [33]: labelStartImage, + [38]: characterReference, + [42]: attention, + [60]: [autolink, htmlText], + [91]: labelStartLink, + [92]: [hardBreakEscape, characterEscape], + [93]: labelEnd, + [95]: attention, + [96]: codeText +}; +var insideSpan = { + null: [attention, resolver] +}; +var attentionMarkers = { + null: [42, 95] +}; +var disable = { + null: [] +}; + +// node_modules/micromark/lib/parse.js +function parse7(options) { + const settings = options || {}; + const constructs2 = combineExtensions([constructs_exports, ...settings.extensions || []]); + const parser3 = { + defined: [], + lazy: {}, + constructs: constructs2, + content: create3(content3), + document: create3(document2), + flow: create3(flow), + string: create3(string4), + text: create3(text2) + }; + return parser3; + function create3(initial) { + return creator; + function creator(from) { + return createTokenizer(parser3, initial, from); + } + } +} + +// node_modules/micromark/lib/preprocess.js +var search2 = /[\0\t\n\r]/g; +function preprocess() { + let column2 = 1; + let buffer2 = ""; + let start = true; + let atCarriageReturn; + return preprocessor; + function preprocessor(value, encoding, end) { + const chunks = []; + let match2; + let next; + let startPosition; + let endPosition; + let code3; + value = buffer2 + value.toString(encoding); + startPosition = 0; + buffer2 = ""; + if (start) { + if (value.charCodeAt(0) === 65279) { + startPosition++; + } + start = void 0; + } + while (startPosition < value.length) { + search2.lastIndex = startPosition; + match2 = search2.exec(value); + endPosition = match2 && match2.index !== void 0 ? match2.index : value.length; + code3 = value.charCodeAt(endPosition); + if (!match2) { + buffer2 = value.slice(startPosition); break; + } + if (code3 === 10 && startPosition === endPosition && atCarriageReturn) { + chunks.push(-3); + atCarriageReturn = void 0; + } else { + if (atCarriageReturn) { + chunks.push(-5); + atCarriageReturn = void 0; + } + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)); + column2 += endPosition - startPosition; + } + switch (code3) { + case 0: { + chunks.push(65533); + column2++; + break; + } + case 9: { + next = Math.ceil(column2 / 4) * 4; + chunks.push(-2); + while (column2++ < next) + chunks.push(-1); + break; + } + case 10: { + chunks.push(-4); + column2 = 1; + break; + } + default: { + atCarriageReturn = true; + column2 = 1; + } + } + } + startPosition = endPosition + 1; } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; + if (end) { + if (atCarriageReturn) + chunks.push(-5); + if (buffer2) + chunks.push(buffer2); + chunks.push(null); } + return chunks; } - return _arr; -} -function _arrayWithHoles2(arr) { - if (Array.isArray(arr)) - return arr; } -function ownKeys5(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); + +// node_modules/micromark/lib/postprocess.js +function postprocess(events2) { + while (!subtokenize(events2)) { } - return keys; + return events2; } -function _objectSpread5(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = null != arguments[i4] ? arguments[i4] : {}; - i4 % 2 ? ownKeys5(Object(source), true).forEach(function(key2) { - _defineProperty3(target, key2, source[key2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); + +// node_modules/micromark-util-decode-numeric-character-reference/index.js +function decodeNumericCharacterReference(value, base3) { + const code3 = Number.parseInt(value, base3); + if (code3 < 9 || code3 === 11 || code3 > 13 && code3 < 32 || code3 > 126 && code3 < 160 || code3 > 55295 && code3 < 57344 || code3 > 64975 && code3 < 65008 || (code3 & 65535) === 65535 || (code3 & 65535) === 65534 || code3 > 1114111) { + return "\uFFFD"; } - return target; + return String.fromCharCode(code3); } -function _defineProperty3(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; + +// node_modules/micromark-util-decode-string/index.js +var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; +function decodeString(value) { + return value.replace(characterEscapeOrReference, decode); } -function _objectWithoutProperties(source, excluded) { - if (source == null) - return {}; - var target = _objectWithoutPropertiesLoose2(source, excluded); - var key2, i4; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i4 = 0; i4 < sourceSymbolKeys.length; i4++) { - key2 = sourceSymbolKeys[i4]; - if (excluded.indexOf(key2) >= 0) - continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key2)) - continue; - target[key2] = source[key2]; - } +function decode($0, $1, $2) { + if ($1) { + return $1; } - return target; -} -function _objectWithoutPropertiesLoose2(source, excluded) { - if (source == null) - return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key2, i4; - for (i4 = 0; i4 < sourceKeys.length; i4++) { - key2 = sourceKeys[i4]; - if (excluded.indexOf(key2) >= 0) - continue; - target[key2] = source[key2]; + const head2 = $2.charCodeAt(0); + if (head2 === 35) { + const head3 = $2.charCodeAt(1); + const hex2 = head3 === 120 || head3 === 88; + return decodeNumericCharacterReference($2.slice(hex2 ? 2 : 1), hex2 ? 16 : 10); } - return target; + return decodeNamedCharacterReference($2) || $0; } -var Dropzone = /* @__PURE__ */ (0, import_react108.forwardRef)(function(_ref, ref2) { - var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded2); - var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded22); - (0, import_react108.useImperativeHandle)(ref2, function() { - return { - open - }; - }, [open]); - return /* @__PURE__ */ import_react108.default.createElement(import_react108.Fragment, null, children(_objectSpread5(_objectSpread5({}, props), {}, { - open - }))); -}); -Dropzone.displayName = "Dropzone"; -var defaultProps2 = { - disabled: false, - getFilesFromEvent: fromEvent, - maxSize: Infinity, - minSize: 0, - multiple: true, - maxFiles: 0, - preventDropOnDocument: true, - noClick: false, - noKeyboard: false, - noDrag: false, - noDragEventsBubbling: false, - validator: null, - useFsAccessApi: true, - autoFocus: false -}; -Dropzone.defaultProps = defaultProps2; -Dropzone.propTypes = { - children: import_prop_types.default.func, - accept: import_prop_types.default.objectOf(import_prop_types.default.arrayOf(import_prop_types.default.string)), - multiple: import_prop_types.default.bool, - preventDropOnDocument: import_prop_types.default.bool, - noClick: import_prop_types.default.bool, - noKeyboard: import_prop_types.default.bool, - noDrag: import_prop_types.default.bool, - noDragEventsBubbling: import_prop_types.default.bool, - minSize: import_prop_types.default.number, - maxSize: import_prop_types.default.number, - maxFiles: import_prop_types.default.number, - disabled: import_prop_types.default.bool, - getFilesFromEvent: import_prop_types.default.func, - onFileDialogCancel: import_prop_types.default.func, - onFileDialogOpen: import_prop_types.default.func, - useFsAccessApi: import_prop_types.default.bool, - autoFocus: import_prop_types.default.bool, - onDragEnter: import_prop_types.default.func, - onDragLeave: import_prop_types.default.func, - onDragOver: import_prop_types.default.func, - onDrop: import_prop_types.default.func, - onDropAccepted: import_prop_types.default.func, - onDropRejected: import_prop_types.default.func, - onError: import_prop_types.default.func, - validator: import_prop_types.default.func -}; -var initialState = { - isFocused: false, - isFileDialogActive: false, - isDragActive: false, - isDragAccept: false, - isDragReject: false, - acceptedFiles: [], - fileRejections: [] + +// node_modules/mdast-util-from-markdown/lib/index.js +var own2 = {}.hasOwnProperty; +var fromMarkdown = function(value, encoding, options) { + if (typeof encoding !== "string") { + options = encoding; + encoding = void 0; + } + return compiler(options)( + postprocess( + parse7(options).document().write(preprocess()(value, encoding, true)) + ) + ); }; -function useDropzone() { - var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var _defaultProps$props = _objectSpread5(_objectSpread5({}, defaultProps2), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator; - var acceptAttr = (0, import_react108.useMemo)(function() { - return acceptPropAsAcceptAttr(accept); - }, [accept]); - var pickerTypes = (0, import_react108.useMemo)(function() { - return pickerOptionsFromAccept(accept); - }, [accept]); - var onFileDialogOpenCb = (0, import_react108.useMemo)(function() { - return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop2; - }, [onFileDialogOpen]); - var onFileDialogCancelCb = (0, import_react108.useMemo)(function() { - return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop2; - }, [onFileDialogCancel]); - var rootRef = (0, import_react108.useRef)(null); - var inputRef = (0, import_react108.useRef)(null); - var _useReducer = (0, import_react108.useReducer)(reducer2, initialState), _useReducer2 = _slicedToArray2(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1]; - var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive; - var fsAccessApiWorksRef = (0, import_react108.useRef)(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); - var onWindowFocus = function onWindowFocus2() { - if (!fsAccessApiWorksRef.current && isFileDialogActive) { - setTimeout(function() { - if (inputRef.current) { - var files = inputRef.current.files; - if (!files.length) { - dispatch({ - type: "closeDialog" - }); - onFileDialogCancelCb(); - } +function compiler(options) { + const config4 = { + transforms: [], + canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"], + enter: { + autolink: opener(link3), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading5), + blockQuote: opener(blockQuote2), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer2, + codeFencedFenceMeta: buffer2, + codeIndented: opener(codeFlow, buffer2), + codeText: opener(codeText2, buffer2), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition3), + definitionDestinationString: buffer2, + definitionLabelString: buffer2, + definitionTitleString: buffer2, + emphasis: opener(emphasis3), + hardBreakEscape: opener(hardBreak3), + hardBreakTrailing: opener(hardBreak3), + htmlFlow: opener(html7, buffer2), + htmlFlowData: onenterdata, + htmlText: opener(html7, buffer2), + htmlTextData: onenterdata, + image: opener(image3), + label: buffer2, + link: opener(link3), + listItem: opener(listItem4), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list4, onenterlistordered), + listUnordered: opener(list4), + paragraph: opener(paragraph3), + reference: onenterreference, + referenceString: buffer2, + resourceDestinationString: buffer2, + resourceTitleString: buffer2, + setextHeading: opener(heading5), + strong: opener(strong3), + thematicBreak: opener(thematicBreak4) + }, + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }; + configure(config4, (options || {}).mdastExtensions || []); + const data3 = {}; + return compile2; + function compile2(events2) { + let tree = { + type: "root", + children: [] + }; + const context = { + stack: [tree], + tokenStack: [], + config: config4, + enter, + exit: exit2, + buffer: buffer2, + resume, + setData, + getData + }; + const listStack = []; + let index3 = -1; + while (++index3 < events2.length) { + if (events2[index3][1].type === "listOrdered" || events2[index3][1].type === "listUnordered") { + if (events2[index3][0] === "enter") { + listStack.push(index3); + } else { + const tail = listStack.pop(); + index3 = prepareList(events2, tail, index3); } - }, 300); + } } - }; - (0, import_react108.useEffect)(function() { - window.addEventListener("focus", onWindowFocus, false); - return function() { - window.removeEventListener("focus", onWindowFocus, false); + index3 = -1; + while (++index3 < events2.length) { + const handler = config4[events2[index3][0]]; + if (own2.call(handler, events2[index3][1].type)) { + handler[events2[index3][1].type].call( + Object.assign( + { + sliceSerialize: events2[index3][2].sliceSerialize + }, + context + ), + events2[index3][1] + ); + } + } + if (context.tokenStack.length > 0) { + const tail = context.tokenStack[context.tokenStack.length - 1]; + const handler = tail[1] || defaultOnError; + handler.call(context, void 0, tail[0]); + } + tree.position = { + start: point2( + events2.length > 0 ? events2[0][1].start : { + line: 1, + column: 1, + offset: 0 + } + ), + end: point2( + events2.length > 0 ? events2[events2.length - 2][1].end : { + line: 1, + column: 1, + offset: 0 + } + ) }; - }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]); - var dragTargetsRef = (0, import_react108.useRef)([]); - var onDocumentDrop = function onDocumentDrop2(event) { - if (rootRef.current && rootRef.current.contains(event.target)) { - return; + index3 = -1; + while (++index3 < config4.transforms.length) { + tree = config4.transforms[index3](tree) || tree; } - event.preventDefault(); - dragTargetsRef.current = []; - }; - (0, import_react108.useEffect)(function() { - if (preventDropOnDocument) { - document.addEventListener("dragover", onDocumentDragOver, false); - document.addEventListener("drop", onDocumentDrop, false); + return tree; + } + function prepareList(events2, start, length) { + let index3 = start - 1; + let containerBalance = -1; + let listSpread = false; + let listItem5; + let lineIndex; + let firstBlankLineIndex; + let atMarker; + while (++index3 <= length) { + const event = events2[index3]; + if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") { + if (event[0] === "enter") { + containerBalance++; + } else { + containerBalance--; + } + atMarker = void 0; + } else if (event[1].type === "lineEndingBlank") { + if (event[0] === "enter") { + if (listItem5 && !atMarker && !containerBalance && !firstBlankLineIndex) { + firstBlankLineIndex = index3; + } + atMarker = void 0; + } + } else if (event[1].type === "linePrefix" || event[1].type === "listItemValue" || event[1].type === "listItemMarker" || event[1].type === "listItemPrefix" || event[1].type === "listItemPrefixWhitespace") { + } else { + atMarker = void 0; + } + if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) { + if (listItem5) { + let tailIndex = index3; + lineIndex = void 0; + while (tailIndex--) { + const tailEvent = events2[tailIndex]; + if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") { + if (tailEvent[0] === "exit") + continue; + if (lineIndex) { + events2[lineIndex][1].type = "lineEndingBlank"; + listSpread = true; + } + tailEvent[1].type = "lineEnding"; + lineIndex = tailIndex; + } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") { + } else { + break; + } + } + if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) { + listItem5._spread = true; + } + listItem5.end = Object.assign( + {}, + lineIndex ? events2[lineIndex][1].start : event[1].end + ); + events2.splice(lineIndex || index3, 0, ["exit", listItem5, event[2]]); + index3++; + length++; + } + if (event[1].type === "listItemPrefix") { + listItem5 = { + type: "listItem", + _spread: false, + start: Object.assign({}, event[1].start), + end: void 0 + }; + events2.splice(index3, 0, ["enter", listItem5, event[2]]); + index3++; + length++; + firstBlankLineIndex = void 0; + atMarker = true; + } + } } - return function() { - if (preventDropOnDocument) { - document.removeEventListener("dragover", onDocumentDragOver); - document.removeEventListener("drop", onDocumentDrop); + events2[start][1]._spread = listSpread; + return length; + } + function setData(key3, value) { + data3[key3] = value; + } + function getData(key3) { + return data3[key3]; + } + function opener(create3, and2) { + return open; + function open(token) { + enter.call(this, create3(token), token); + if (and2) + and2.call(this, token); + } + } + function buffer2() { + this.stack.push({ + type: "fragment", + children: [] + }); + } + function enter(node2, token, errorHandler) { + const parent = this.stack[this.stack.length - 1]; + parent.children.push(node2); + this.stack.push(node2); + this.tokenStack.push([token, errorHandler]); + node2.position = { + start: point2(token.start) + }; + return node2; + } + function closer(and2) { + return close; + function close(token) { + if (and2) + and2.call(this, token); + exit2.call(this, token); + } + } + function exit2(token, onExitError) { + const node2 = this.stack.pop(); + const open = this.tokenStack.pop(); + if (!open) { + throw new Error( + "Cannot close `" + token.type + "` (" + stringifyPosition({ + start: token.start, + end: token.end + }) + "): it\u2019s not open" + ); + } else if (open[0].type !== token.type) { + if (onExitError) { + onExitError.call(this, token, open[0]); + } else { + const handler = open[1] || defaultOnError; + handler.call(this, token, open[0]); } - }; - }, [rootRef, preventDropOnDocument]); - (0, import_react108.useEffect)(function() { - if (!disabled && autoFocus && rootRef.current) { - rootRef.current.focus(); } - return function() { + node2.position.end = point2(token.end); + return node2; + } + function resume() { + return toString4(this.stack.pop()); + } + function onenterlistordered() { + setData("expectingFirstListItemValue", true); + } + function onenterlistitemvalue(token) { + if (getData("expectingFirstListItemValue")) { + const ancestor2 = this.stack[this.stack.length - 2]; + ancestor2.start = Number.parseInt(this.sliceSerialize(token), 10); + setData("expectingFirstListItemValue"); + } + } + function onexitcodefencedfenceinfo() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.lang = data4; + } + function onexitcodefencedfencemeta() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.meta = data4; + } + function onexitcodefencedfence() { + if (getData("flowCodeInside")) + return; + this.buffer(); + setData("flowCodeInside", true); + } + function onexitcodefenced() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data4.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""); + setData("flowCodeInside"); + } + function onexitcodeindented() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data4.replace(/(\r?\n|\r)$/g, ""); + } + function onexitdefinitionlabelstring(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + } + function onexitdefinitiontitlestring() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.title = data4; + } + function onexitdefinitiondestinationstring() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.url = data4; + } + function onexitatxheadingsequence(token) { + const node2 = this.stack[this.stack.length - 1]; + if (!node2.depth) { + const depth = this.sliceSerialize(token).length; + node2.depth = depth; + } + } + function onexitsetextheadingtext() { + setData("setextHeadingSlurpLineEnding", true); + } + function onexitsetextheadinglinesequence(token) { + const node2 = this.stack[this.stack.length - 1]; + node2.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; + } + function onexitsetextheading() { + setData("setextHeadingSlurpLineEnding"); + } + function onenterdata(token) { + const node2 = this.stack[this.stack.length - 1]; + let tail = node2.children[node2.children.length - 1]; + if (!tail || tail.type !== "text") { + tail = text7(); + tail.position = { + start: point2(token.start) + }; + node2.children.push(tail); + } + this.stack.push(tail); + } + function onexitdata(token) { + const tail = this.stack.pop(); + tail.value += this.sliceSerialize(token); + tail.position.end = point2(token.end); + } + function onexitlineending(token) { + const context = this.stack[this.stack.length - 1]; + if (getData("atHardBreak")) { + const tail = context.children[context.children.length - 1]; + tail.position.end = point2(token.end); + setData("atHardBreak"); + return; + } + if (!getData("setextHeadingSlurpLineEnding") && config4.canContainEols.includes(context.type)) { + onenterdata.call(this, token); + onexitdata.call(this, token); + } + } + function onexithardbreak() { + setData("atHardBreak", true); + } + function onexithtmlflow() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data4; + } + function onexithtmltext() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data4; + } + function onexitcodetext() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data4; + } + function onexitlink() { + const node2 = this.stack[this.stack.length - 1]; + if (getData("inReference")) { + const referenceType = getData("referenceType") || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; + } else { + delete node2.identifier; + delete node2.label; + } + setData("referenceType"); + } + function onexitimage() { + const node2 = this.stack[this.stack.length - 1]; + if (getData("inReference")) { + const referenceType = getData("referenceType") || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; + } else { + delete node2.identifier; + delete node2.label; + } + setData("referenceType"); + } + function onexitlabeltext(token) { + const string6 = this.sliceSerialize(token); + const ancestor2 = this.stack[this.stack.length - 2]; + ancestor2.label = decodeString(string6); + ancestor2.identifier = normalizeIdentifier(string6).toLowerCase(); + } + function onexitlabel() { + const fragment = this.stack[this.stack.length - 1]; + const value = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + setData("inReference", true); + if (node2.type === "link") { + const children = fragment.children; + node2.children = children; + } else { + node2.alt = value; + } + } + function onexitresourcedestinationstring() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.url = data4; + } + function onexitresourcetitlestring() { + const data4 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.title = data4; + } + function onexitresource() { + setData("inReference"); + } + function onenterreference() { + setData("referenceType", "collapsed"); + } + function onexitreferencestring(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + setData("referenceType", "full"); + } + function onexitcharacterreferencemarker(token) { + setData("characterReferenceType", token.type); + } + function onexitcharacterreferencevalue(token) { + const data4 = this.sliceSerialize(token); + const type = getData("characterReferenceType"); + let value; + if (type) { + value = decodeNumericCharacterReference( + data4, + type === "characterReferenceMarkerNumeric" ? 10 : 16 + ); + setData("characterReferenceType"); + } else { + const result = decodeNamedCharacterReference(data4); + value = result; + } + const tail = this.stack.pop(); + tail.value += value; + tail.position.end = point2(token.end); + } + function onexitautolinkprotocol(token) { + onexitdata.call(this, token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = this.sliceSerialize(token); + } + function onexitautolinkemail(token) { + onexitdata.call(this, token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = "mailto:" + this.sliceSerialize(token); + } + function blockQuote2() { + return { + type: "blockquote", + children: [] }; - }, [rootRef, autoFocus, disabled]); - var onErrCb = (0, import_react108.useCallback)(function(e5) { - if (onError) { - onError(e5); + } + function codeFlow() { + return { + type: "code", + lang: null, + meta: null, + value: "" + }; + } + function codeText2() { + return { + type: "inlineCode", + value: "" + }; + } + function definition3() { + return { + type: "definition", + identifier: "", + label: null, + title: null, + url: "" + }; + } + function emphasis3() { + return { + type: "emphasis", + children: [] + }; + } + function heading5() { + return { + type: "heading", + depth: void 0, + children: [] + }; + } + function hardBreak3() { + return { + type: "break" + }; + } + function html7() { + return { + type: "html", + value: "" + }; + } + function image3() { + return { + type: "image", + title: null, + url: "", + alt: null + }; + } + function link3() { + return { + type: "link", + title: null, + url: "", + children: [] + }; + } + function list4(token) { + return { + type: "list", + ordered: token.type === "listOrdered", + start: null, + spread: token._spread, + children: [] + }; + } + function listItem4(token) { + return { + type: "listItem", + spread: token._spread, + checked: null, + children: [] + }; + } + function paragraph3() { + return { + type: "paragraph", + children: [] + }; + } + function strong3() { + return { + type: "strong", + children: [] + }; + } + function text7() { + return { + type: "text", + value: "" + }; + } + function thematicBreak4() { + return { + type: "thematicBreak" + }; + } +} +function point2(d4) { + return { + line: d4.line, + column: d4.column, + offset: d4.offset + }; +} +function configure(combined, extensions) { + let index3 = -1; + while (++index3 < extensions.length) { + const value = extensions[index3]; + if (Array.isArray(value)) { + configure(combined, value); } else { - console.error(e5); + extension(combined, value); } - }, [onError]); - var onDragEnterCb = (0, import_react108.useCallback)(function(event) { - event.preventDefault(); - event.persist(); - stopPropagation2(event); - dragTargetsRef.current = [].concat(_toConsumableArray2(dragTargetsRef.current), [event.target]); - if (isEvtWithFiles(event)) { - Promise.resolve(getFilesFromEvent(event)).then(function(files) { - if (isPropagationStopped(event) && !noDragEventsBubbling) { - return; + } +} +function extension(combined, extension2) { + let key3; + for (key3 in extension2) { + if (own2.call(extension2, key3)) { + if (key3 === "canContainEols") { + const right = extension2[key3]; + if (right) { + combined[key3].push(...right); } - var fileCount = files.length; - var isDragAccept = fileCount > 0 && allFilesAccepted({ - files, - accept: acceptAttr, - minSize, - maxSize, - multiple, - maxFiles, - validator - }); - var isDragReject = fileCount > 0 && !isDragAccept; - dispatch({ - isDragAccept, - isDragReject, - isDragActive: true, - type: "setDraggedFiles" - }); - if (onDragEnter) { - onDragEnter(event); + } else if (key3 === "transforms") { + const right = extension2[key3]; + if (right) { + combined[key3].push(...right); } - }).catch(function(e5) { - return onErrCb(e5); - }); + } else if (key3 === "enter" || key3 === "exit") { + const right = extension2[key3]; + if (right) { + Object.assign(combined[key3], right); + } + } } - }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]); - var onDragOverCb = (0, import_react108.useCallback)(function(event) { - event.preventDefault(); - event.persist(); - stopPropagation2(event); - var hasFiles = isEvtWithFiles(event); - if (hasFiles && event.dataTransfer) { - try { - event.dataTransfer.dropEffect = "copy"; - } catch (_unused) { + } +} +function defaultOnError(left, right) { + if (left) { + throw new Error( + "Cannot close `" + left.type + "` (" + stringifyPosition({ + start: left.start, + end: left.end + }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is open" + ); + } else { + throw new Error( + "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is still open" + ); + } +} + +// node_modules/remark-parse/lib/index.js +function remarkParse(options) { + const parser3 = (doc) => { + const settings = this.data("settings"); + return fromMarkdown( + doc, + Object.assign({}, settings, options, { + extensions: this.data("micromarkExtensions") || [], + mdastExtensions: this.data("fromMarkdownExtensions") || [] + }) + ); + }; + Object.assign(this, { Parser: parser3 }); +} + +// node_modules/zwitch/index.js +var own3 = {}.hasOwnProperty; +function zwitch(key3, options) { + const settings = options || {}; + function one5(value, ...parameters) { + let fn = one5.invalid; + const handlers2 = one5.handlers; + if (value && own3.call(value, key3)) { + const id3 = String(value[key3]); + fn = own3.call(handlers2, id3) ? handlers2[id3] : one5.unknown; + } + if (fn) { + return fn.call(this, value, ...parameters); + } + } + one5.handlers = settings.handlers || {}; + one5.invalid = settings.invalid; + one5.unknown = settings.unknown; + return one5; +} + +// node_modules/mdast-util-to-markdown/lib/configure.js +function configure2(base3, extension2) { + let index3 = -1; + let key3; + if (extension2.extensions) { + while (++index3 < extension2.extensions.length) { + configure2(base3, extension2.extensions[index3]); + } + } + for (key3 in extension2) { + if (key3 === "extensions") { + } else if (key3 === "unsafe" || key3 === "join") { + base3[key3] = [...base3[key3] || [], ...extension2[key3] || []]; + } else if (key3 === "handlers") { + base3[key3] = Object.assign(base3[key3], extension2[key3] || {}); + } else { + base3.options[key3] = extension2[key3]; + } + } + return base3; +} + +// node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +function blockquote(node2, _15, state, info) { + const exit2 = state.enter("blockquote"); + const tracker = state.createTracker(info); + tracker.move("> "); + tracker.shift(2); + const value = state.indentLines( + state.containerFlow(node2, tracker.current()), + map4 + ); + exit2(); + return value; +} +function map4(line, _15, blank) { + return ">" + (blank ? "" : " ") + line; +} + +// node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +function patternInScope(stack, pattern) { + return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false); +} +function listInScope(stack, list4, none) { + if (typeof list4 === "string") { + list4 = [list4]; + } + if (!list4 || list4.length === 0) { + return none; + } + let index3 = -1; + while (++index3 < list4.length) { + if (stack.includes(list4[index3])) { + return true; + } + } + return false; +} + +// node_modules/mdast-util-to-markdown/lib/handle/break.js +function hardBreak(_15, _1, state, info) { + let index3 = -1; + while (++index3 < state.unsafe.length) { + if (state.unsafe[index3].character === "\n" && patternInScope(state.stack, state.unsafe[index3])) { + return /[ \t]/.test(info.before) ? "" : " "; + } + } + return "\\\n"; +} + +// node_modules/longest-streak/index.js +function longestStreak(value, substring) { + const source = String(value); + let index3 = source.indexOf(substring); + let expected = index3; + let count3 = 0; + let max5 = 0; + if (typeof substring !== "string") { + throw new TypeError("Expected substring"); + } + while (index3 !== -1) { + if (index3 === expected) { + if (++count3 > max5) { + max5 = count3; } + } else { + count3 = 1; } - if (hasFiles && onDragOver) { - onDragOver(event); + expected = index3 + substring.length; + index3 = source.indexOf(substring, expected); + } + return max5; +} + +// node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +function formatCodeAsIndented(node2, state) { + return Boolean( + !state.options.fences && node2.value && !node2.lang && /[^ \r\n]/.test(node2.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value) + ); +} + +// node_modules/mdast-util-to-markdown/lib/util/check-fence.js +function checkFence(state) { + const marker = state.options.fence || "`"; + if (marker !== "`" && marker !== "~") { + throw new Error( + "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/handle/code.js +function code(node2, _15, state, info) { + const marker = checkFence(state); + const raw2 = node2.value || ""; + const suffix = marker === "`" ? "GraveAccent" : "Tilde"; + if (formatCodeAsIndented(node2, state)) { + const exit3 = state.enter("codeIndented"); + const value2 = state.indentLines(raw2, map5); + exit3(); + return value2; + } + const tracker = state.createTracker(info); + const sequence = marker.repeat(Math.max(longestStreak(raw2, marker) + 1, 3)); + const exit2 = state.enter("codeFenced"); + let value = tracker.move(sequence); + if (node2.lang) { + const subexit = state.enter(`codeFencedLang${suffix}`); + value += tracker.move( + state.safe(node2.lang, { + before: value, + after: " ", + encode: ["`"], + ...tracker.current() + }) + ); + subexit(); + } + if (node2.lang && node2.meta) { + const subexit = state.enter(`codeFencedMeta${suffix}`); + value += tracker.move(" "); + value += tracker.move( + state.safe(node2.meta, { + before: value, + after: "\n", + encode: ["`"], + ...tracker.current() + }) + ); + subexit(); + } + value += tracker.move("\n"); + if (raw2) { + value += tracker.move(raw2 + "\n"); + } + value += tracker.move(sequence); + exit2(); + return value; +} +function map5(line, _15, blank) { + return (blank ? "" : " ") + line; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-quote.js +function checkQuote(state) { + const marker = state.options.quote || '"'; + if (marker !== '"' && marker !== "'") { + throw new Error( + "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/handle/definition.js +function definition2(node2, _15, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const exit2 = state.enter("definition"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("["); + value += tracker.move( + state.safe(state.associationId(node2), { + before: value, + after: "]", + ...tracker.current() + }) + ); + value += tracker.move("]: "); + subexit(); + if (!node2.url || /[\0- \u007F]/.test(node2.url)) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, { before: value, after: ">", ...tracker.current() }) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, { + before: value, + after: node2.title ? " " : "\n", + ...tracker.current() + }) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); + subexit(); + } + exit2(); + return value; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +function checkEmphasis(state) { + const marker = state.options.emphasis || "*"; + if (marker !== "*" && marker !== "_") { + throw new Error( + "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +emphasis.peek = emphasisPeek; +function emphasis(node2, _15, state, info) { + const marker = checkEmphasis(state); + const exit2 = state.enter("emphasis"); + const tracker = state.createTracker(info); + let value = tracker.move(marker); + value += tracker.move( + state.containerPhrasing(node2, { + before: value, + after: marker, + ...tracker.current() + }) + ); + value += tracker.move(marker); + exit2(); + return value; +} +function emphasisPeek(_15, _1, state) { + return state.options.emphasis || "*"; +} + +// node_modules/unist-util-is/lib/index.js +var convert = function(test) { + if (test === void 0 || test === null) { + return ok; + } + if (typeof test === "string") { + return typeFactory(test); + } + if (typeof test === "object") { + return Array.isArray(test) ? anyFactory(test) : propsFactory(test); + } + if (typeof test === "function") { + return castFactory(test); + } + throw new Error("Expected function, string, or object as test"); +}; +function anyFactory(tests) { + const checks2 = []; + let index3 = -1; + while (++index3 < tests.length) { + checks2[index3] = convert(tests[index3]); + } + return castFactory(any); + function any(...parameters) { + let index4 = -1; + while (++index4 < checks2.length) { + if (checks2[index4].call(this, ...parameters)) + return true; } return false; - }, [onDragOver, noDragEventsBubbling]); - var onDragLeaveCb = (0, import_react108.useCallback)(function(event) { - event.preventDefault(); - event.persist(); - stopPropagation2(event); - var targets = dragTargetsRef.current.filter(function(target) { - return rootRef.current && rootRef.current.contains(target); - }); - var targetIdx = targets.indexOf(event.target); - if (targetIdx !== -1) { - targets.splice(targetIdx, 1); + } +} +function propsFactory(check) { + return castFactory(all6); + function all6(node2) { + let key3; + for (key3 in check) { + if (node2[key3] !== check[key3]) + return false; } - dragTargetsRef.current = targets; - if (targets.length > 0) { - return; + return true; + } +} +function typeFactory(check) { + return castFactory(type); + function type(node2) { + return node2 && node2.type === check; + } +} +function castFactory(check) { + return assertion; + function assertion(node2, ...parameters) { + return Boolean( + node2 && typeof node2 === "object" && "type" in node2 && Boolean(check.call(this, node2, ...parameters)) + ); + } +} +function ok() { + return true; +} + +// node_modules/unist-util-visit-parents/lib/color.browser.js +function color2(d4) { + return d4; +} + +// node_modules/unist-util-visit-parents/lib/index.js +var CONTINUE = true; +var EXIT = false; +var SKIP = "skip"; +var visitParents = function(tree, test, visitor, reverse) { + if (typeof test === "function" && typeof visitor !== "function") { + reverse = visitor; + visitor = test; + test = null; + } + const is2 = convert(test); + const step = reverse ? -1 : 1; + factory2(tree, void 0, [])(); + function factory2(node2, index3, parents) { + const value = node2 && typeof node2 === "object" ? node2 : {}; + if (typeof value.type === "string") { + const name317 = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0; + Object.defineProperty(visit2, "name", { + value: "node (" + color2(node2.type + (name317 ? "<" + name317 + ">" : "")) + ")" + }); } - dispatch({ - type: "setDraggedFiles", - isDragActive: false, - isDragAccept: false, - isDragReject: false + return visit2; + function visit2() { + let result = []; + let subresult; + let offset2; + let grandparents; + if (!test || is2(node2, index3, parents[parents.length - 1] || null)) { + result = toResult(visitor(node2, parents)); + if (result[0] === EXIT) { + return result; + } + } + if (node2.children && result[0] !== SKIP) { + offset2 = (reverse ? node2.children.length : -1) + step; + grandparents = parents.concat(node2); + while (offset2 > -1 && offset2 < node2.children.length) { + subresult = factory2(node2.children[offset2], offset2, grandparents)(); + if (subresult[0] === EXIT) { + return subresult; + } + offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step; + } + } + return result; + } + } +}; +function toResult(value) { + if (Array.isArray(value)) { + return value; + } + if (typeof value === "number") { + return [CONTINUE, value]; + } + return [value]; +} + +// node_modules/unist-util-visit/lib/index.js +var visit = function(tree, test, visitor, reverse) { + if (typeof test === "function" && typeof visitor !== "function") { + reverse = visitor; + visitor = test; + test = null; + } + visitParents(tree, test, overload, reverse); + function overload(node2, parents) { + const parent = parents[parents.length - 1]; + return visitor( + node2, + parent ? parent.children.indexOf(node2) : null, + parent + ); + } +}; + +// node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +function formatHeadingAsSetext(node2, state) { + let literalWithBreak = false; + visit(node2, (node3) => { + if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") { + literalWithBreak = true; + return EXIT; + } + }); + return Boolean( + (!node2.depth || node2.depth < 3) && toString4(node2) && (state.options.setext || literalWithBreak) + ); +} + +// node_modules/mdast-util-to-markdown/lib/handle/heading.js +function heading3(node2, _15, state, info) { + const rank = Math.max(Math.min(6, node2.depth || 1), 1); + const tracker = state.createTracker(info); + if (formatHeadingAsSetext(node2, state)) { + const exit3 = state.enter("headingSetext"); + const subexit2 = state.enter("phrasing"); + const value2 = state.containerPhrasing(node2, { + ...tracker.current(), + before: "\n", + after: "\n" }); - if (isEvtWithFiles(event) && onDragLeave) { - onDragLeave(event); + subexit2(); + exit3(); + return value2 + "\n" + (rank === 1 ? "=" : "-").repeat( + value2.length - (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1) + ); + } + const sequence = "#".repeat(rank); + const exit2 = state.enter("headingAtx"); + const subexit = state.enter("phrasing"); + tracker.move(sequence + " "); + let value = state.containerPhrasing(node2, { + before: "# ", + after: "\n", + ...tracker.current() + }); + if (/^[\t ]/.test(value)) { + value = "&#x" + value.charCodeAt(0).toString(16).toUpperCase() + ";" + value.slice(1); + } + value = value ? sequence + " " + value : sequence; + if (state.options.closeAtx) { + value += " " + sequence; + } + subexit(); + exit2(); + return value; +} + +// node_modules/mdast-util-to-markdown/lib/handle/html.js +html.peek = htmlPeek; +function html(node2) { + return node2.value || ""; +} +function htmlPeek() { + return "<"; +} + +// node_modules/mdast-util-to-markdown/lib/handle/image.js +image.peek = imagePeek; +function image(node2, _15, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const exit2 = state.enter("image"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("!["); + value += tracker.move( + state.safe(node2.alt, { before: value, after: "]", ...tracker.current() }) + ); + value += tracker.move("]("); + subexit(); + if (!node2.url && node2.title || /[\0- \u007F]/.test(node2.url)) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, { before: value, after: ">", ...tracker.current() }) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, { + before: value, + after: node2.title ? " " : ")", + ...tracker.current() + }) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); + subexit(); + } + value += tracker.move(")"); + exit2(); + return value; +} +function imagePeek() { + return "!"; +} + +// node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +imageReference.peek = imageReferencePeek; +function imageReference(node2, _15, state, info) { + const type = node2.referenceType; + const exit2 = state.enter("imageReference"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("!["); + const alt = state.safe(node2.alt, { + before: value, + after: "]", + ...tracker.current() + }); + value += tracker.move(alt + "]["); + subexit(); + const stack = state.stack; + state.stack = []; + subexit = state.enter("reference"); + const reference = state.safe(state.associationId(node2), { + before: value, + after: "]", + ...tracker.current() + }); + subexit(); + state.stack = stack; + exit2(); + if (type === "full" || !alt || alt !== reference) { + value += tracker.move(reference + "]"); + } else if (type === "shortcut") { + value = value.slice(0, -1); + } else { + value += tracker.move("]"); + } + return value; +} +function imageReferencePeek() { + return "!"; +} + +// node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js +function patternCompile(pattern) { + if (!pattern._compiled) { + const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : ""); + pattern._compiled = new RegExp( + (before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), + "g" + ); + } + return pattern._compiled; +} + +// node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +inlineCode.peek = inlineCodePeek; +function inlineCode(node2, _15, state) { + let value = node2.value || ""; + let sequence = "`"; + let index3 = -1; + while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) { + sequence += "`"; + } + if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) { + value = " " + value + " "; + } + while (++index3 < state.unsafe.length) { + const pattern = state.unsafe[index3]; + const expression = patternCompile(pattern); + let match2; + if (!pattern.atBreak) + continue; + while (match2 = expression.exec(value)) { + let position3 = match2.index; + if (value.charCodeAt(position3) === 10 && value.charCodeAt(position3 - 1) === 13) { + position3--; + } + value = value.slice(0, position3) + " " + value.slice(match2.index + 1); } - }, [rootRef, onDragLeave, noDragEventsBubbling]); - var setFiles = (0, import_react108.useCallback)(function(files, event) { - var acceptedFiles = []; - var fileRejections = []; - files.forEach(function(file) { - var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray2(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1]; - var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray2(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1]; - var customErrors = validator ? validator(file) : null; - if (accepted && sizeMatch && !customErrors) { - acceptedFiles.push(file); - } else { - var errors = [acceptError, sizeError]; - if (customErrors) { - errors = errors.concat(customErrors); + } + return sequence + value + sequence; +} +function inlineCodePeek() { + return "`"; +} + +// node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +function formatLinkAsAutolink(node2, state) { + const raw2 = toString4(node2); + return Boolean( + !state.options.resourceLink && node2.url && !node2.title && node2.children && node2.children.length === 1 && node2.children[0].type === "text" && (raw2 === node2.url || "mailto:" + raw2 === node2.url) && /^[a-z][a-z+.-]+:/i.test(node2.url) && !/[\0- <>\u007F]/.test(node2.url) + ); +} + +// node_modules/mdast-util-to-markdown/lib/handle/link.js +link.peek = linkPeek; +function link(node2, _15, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const tracker = state.createTracker(info); + let exit2; + let subexit; + if (formatLinkAsAutolink(node2, state)) { + const stack = state.stack; + state.stack = []; + exit2 = state.enter("autolink"); + let value2 = tracker.move("<"); + value2 += tracker.move( + state.containerPhrasing(node2, { + before: value2, + after: ">", + ...tracker.current() + }) + ); + value2 += tracker.move(">"); + exit2(); + state.stack = stack; + return value2; + } + exit2 = state.enter("link"); + subexit = state.enter("label"); + let value = tracker.move("["); + value += tracker.move( + state.containerPhrasing(node2, { + before: value, + after: "](", + ...tracker.current() + }) + ); + value += tracker.move("]("); + subexit(); + if (!node2.url && node2.title || /[\0- \u007F]/.test(node2.url)) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, { before: value, after: ">", ...tracker.current() }) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, { + before: value, + after: node2.title ? " " : ")", + ...tracker.current() + }) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); + subexit(); + } + value += tracker.move(")"); + exit2(); + return value; +} +function linkPeek(node2, _15, state) { + return formatLinkAsAutolink(node2, state) ? "<" : "["; +} + +// node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +linkReference.peek = linkReferencePeek; +function linkReference(node2, _15, state, info) { + const type = node2.referenceType; + const exit2 = state.enter("linkReference"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("["); + const text7 = state.containerPhrasing(node2, { + before: value, + after: "]", + ...tracker.current() + }); + value += tracker.move(text7 + "]["); + subexit(); + const stack = state.stack; + state.stack = []; + subexit = state.enter("reference"); + const reference = state.safe(state.associationId(node2), { + before: value, + after: "]", + ...tracker.current() + }); + subexit(); + state.stack = stack; + exit2(); + if (type === "full" || !text7 || text7 !== reference) { + value += tracker.move(reference + "]"); + } else if (type === "shortcut") { + value = value.slice(0, -1); + } else { + value += tracker.move("]"); + } + return value; +} +function linkReferencePeek() { + return "["; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +function checkBullet(state) { + const marker = state.options.bullet || "*"; + if (marker !== "*" && marker !== "+" && marker !== "-") { + throw new Error( + "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +function checkBulletOther(state) { + const bullet = checkBullet(state); + const bulletOther = state.options.bulletOther; + if (!bulletOther) { + return bullet === "*" ? "-" : "*"; + } + if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") { + throw new Error( + "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`" + ); + } + if (bulletOther === bullet) { + throw new Error( + "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different" + ); + } + return bulletOther; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +function checkBulletOrdered(state) { + const marker = state.options.bulletOrdered || "."; + if (marker !== "." && marker !== ")") { + throw new Error( + "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered-other.js +function checkBulletOrderedOther(state) { + const bulletOrdered = checkBulletOrdered(state); + const bulletOrderedOther = state.options.bulletOrderedOther; + if (!bulletOrderedOther) { + return bulletOrdered === "." ? ")" : "."; + } + if (bulletOrderedOther !== "." && bulletOrderedOther !== ")") { + throw new Error( + "Cannot serialize items with `" + bulletOrderedOther + "` for `options.bulletOrderedOther`, expected `*`, `+`, or `-`" + ); + } + if (bulletOrderedOther === bulletOrdered) { + throw new Error( + "Expected `bulletOrdered` (`" + bulletOrdered + "`) and `bulletOrderedOther` (`" + bulletOrderedOther + "`) to be different" + ); + } + return bulletOrderedOther; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-rule.js +function checkRule(state) { + const marker = state.options.rule || "*"; + if (marker !== "*" && marker !== "-" && marker !== "_") { + throw new Error( + "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/handle/list.js +function list2(node2, parent, state, info) { + const exit2 = state.enter("list"); + const bulletCurrent = state.bulletCurrent; + let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state); + const bulletOther = node2.ordered ? checkBulletOrderedOther(state) : checkBulletOther(state); + const bulletLastUsed = state.bulletLastUsed; + let useDifferentMarker = false; + if (parent && (node2.ordered ? state.options.bulletOrderedOther : state.options.bulletOther) && bulletLastUsed && bullet === bulletLastUsed) { + useDifferentMarker = true; + } + if (!node2.ordered) { + const firstListItem = node2.children ? node2.children[0] : void 0; + if ((bullet === "*" || bullet === "-") && firstListItem && (!firstListItem.children || !firstListItem.children[0]) && state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0) { + useDifferentMarker = true; + } + if (checkRule(state) === bullet && firstListItem) { + let index3 = -1; + while (++index3 < node2.children.length) { + const item = node2.children[index3]; + if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") { + useDifferentMarker = true; + break; } - fileRejections.push({ - file, - errors: errors.filter(function(e5) { - return e5; - }) - }); } - }); - if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) { - acceptedFiles.forEach(function(file) { - fileRejections.push({ - file, - errors: [TOO_MANY_FILES_REJECTION] - }); - }); - acceptedFiles.splice(0); } - dispatch({ - acceptedFiles, - fileRejections, - type: "setFiles" - }); - if (onDrop) { - onDrop(acceptedFiles, fileRejections, event); + } + if (useDifferentMarker) { + bullet = bulletOther; + } + state.bulletCurrent = bullet; + const value = state.containerFlow(node2, info); + state.bulletLastUsed = bullet; + state.bulletCurrent = bulletCurrent; + exit2(); + return value; +} + +// node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +function checkListItemIndent(state) { + const style = state.options.listItemIndent || "tab"; + if (style === 1 || style === "1") { + return "one"; + } + if (style !== "tab" && style !== "one" && style !== "mixed") { + throw new Error( + "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`" + ); + } + return style; +} + +// node_modules/mdast-util-to-markdown/lib/handle/list-item.js +function listItem2(node2, parent, state, info) { + const listItemIndent = checkListItemIndent(state); + let bullet = state.bulletCurrent || checkBullet(state); + if (parent && parent.type === "list" && parent.ordered) { + bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet; + } + let size2 = bullet.length + 1; + if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) { + size2 = Math.ceil(size2 / 4) * 4; + } + const tracker = state.createTracker(info); + tracker.move(bullet + " ".repeat(size2 - bullet.length)); + tracker.shift(size2); + const exit2 = state.enter("listItem"); + const value = state.indentLines( + state.containerFlow(node2, tracker.current()), + map6 + ); + exit2(); + return value; + function map6(line, index3, blank) { + if (index3) { + return (blank ? "" : " ".repeat(size2)) + line; } - if (fileRejections.length > 0 && onDropRejected) { - onDropRejected(fileRejections, event); + return (blank ? bullet : bullet + " ".repeat(size2 - bullet.length)) + line; + } +} + +// node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +function paragraph(node2, _15, state, info) { + const exit2 = state.enter("paragraph"); + const subexit = state.enter("phrasing"); + const value = state.containerPhrasing(node2, info); + subexit(); + exit2(); + return value; +} + +// node_modules/mdast-util-phrasing/lib/index.js +var phrasing = convert([ + "break", + "delete", + "emphasis", + "footnote", + "footnoteReference", + "image", + "imageReference", + "inlineCode", + "link", + "linkReference", + "strong", + "text" +]); + +// node_modules/mdast-util-to-markdown/lib/handle/root.js +function root(node2, _15, state, info) { + const hasPhrasing = node2.children.some((d4) => phrasing(d4)); + const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow; + return fn.call(state, node2, info); +} + +// node_modules/mdast-util-to-markdown/lib/util/check-strong.js +function checkStrong(state) { + const marker = state.options.strong || "*"; + if (marker !== "*" && marker !== "_") { + throw new Error( + "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`" + ); + } + return marker; +} + +// node_modules/mdast-util-to-markdown/lib/handle/strong.js +strong.peek = strongPeek; +function strong(node2, _15, state, info) { + const marker = checkStrong(state); + const exit2 = state.enter("strong"); + const tracker = state.createTracker(info); + let value = tracker.move(marker + marker); + value += tracker.move( + state.containerPhrasing(node2, { + before: value, + after: marker, + ...tracker.current() + }) + ); + value += tracker.move(marker + marker); + exit2(); + return value; +} +function strongPeek(_15, _1, state) { + return state.options.strong || "*"; +} + +// node_modules/mdast-util-to-markdown/lib/handle/text.js +function text4(node2, _15, state, info) { + return state.safe(node2.value, info); +} + +// node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +function checkRuleRepetition(state) { + const repetition = state.options.ruleRepetition || 3; + if (repetition < 3) { + throw new Error( + "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more" + ); + } + return repetition; +} + +// node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +function thematicBreak2(_15, _1, state) { + const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state)); + return state.options.ruleSpaces ? value.slice(0, -1) : value; +} + +// node_modules/mdast-util-to-markdown/lib/handle/index.js +var handle = { + blockquote, + break: hardBreak, + code, + definition: definition2, + emphasis, + hardBreak, + heading: heading3, + html, + image, + imageReference, + inlineCode, + link, + linkReference, + list: list2, + listItem: listItem2, + paragraph, + root, + strong, + text: text4, + thematicBreak: thematicBreak2 +}; + +// node_modules/mdast-util-to-markdown/lib/join.js +var join3 = [joinDefaults]; +function joinDefaults(left, right, parent, state) { + if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) { + return false; + } + if (left.type === "list" && left.type === right.type && Boolean(left.ordered) === Boolean(right.ordered) && !(left.ordered ? state.options.bulletOrderedOther : state.options.bulletOther)) { + return false; + } + if ("spread" in parent && typeof parent.spread === "boolean") { + if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) { + return; } - if (acceptedFiles.length > 0 && onDropAccepted) { - onDropAccepted(acceptedFiles, event); + return parent.spread ? 1 : 0; + } +} + +// node_modules/mdast-util-to-markdown/lib/unsafe.js +var fullPhrasingSpans = [ + "autolink", + "destinationLiteral", + "destinationRaw", + "reference", + "titleQuote", + "titleApostrophe" +]; +var unsafe = [ + { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" }, + { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, + { + character: " ", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"] + }, + { + character: "\r", + inConstruct: [ + "codeFencedLangGraveAccent", + "codeFencedLangTilde", + "codeFencedMetaGraveAccent", + "codeFencedMetaTilde", + "destinationLiteral", + "headingAtx" + ] + }, + { + character: "\n", + inConstruct: [ + "codeFencedLangGraveAccent", + "codeFencedLangTilde", + "codeFencedMetaGraveAccent", + "codeFencedMetaTilde", + "destinationLiteral", + "headingAtx" + ] + }, + { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" }, + { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, + { + character: " ", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"] + }, + { + character: "!", + after: "\\[", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + { character: '"', inConstruct: "titleQuote" }, + { atBreak: true, character: "#" }, + { character: "#", inConstruct: "headingAtx", after: "(?:[\r\n]|$)" }, + { character: "&", after: "[#A-Za-z]", inConstruct: "phrasing" }, + { character: "'", inConstruct: "titleApostrophe" }, + { character: "(", inConstruct: "destinationRaw" }, + { + before: "\\]", + character: "(", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + { atBreak: true, before: "\\d+", character: ")" }, + { character: ")", inConstruct: "destinationRaw" }, + { atBreak: true, character: "*", after: "(?:[ \r\n*])" }, + { character: "*", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + { atBreak: true, character: "+", after: "(?:[ \r\n])" }, + { atBreak: true, character: "-", after: "(?:[ \r\n-])" }, + { atBreak: true, before: "\\d+", character: ".", after: "(?:[ \r\n]|$)" }, + { atBreak: true, character: "<", after: "[!/?A-Za-z]" }, + { + character: "<", + after: "[!/?A-Za-z]", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + { character: "<", inConstruct: "destinationLiteral" }, + { atBreak: true, character: "=" }, + { atBreak: true, character: ">" }, + { character: ">", inConstruct: "destinationLiteral" }, + { atBreak: true, character: "[" }, + { character: "[", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + { character: "[", inConstruct: ["label", "reference"] }, + { character: "\\", after: "[\\r\\n]", inConstruct: "phrasing" }, + { character: "]", inConstruct: ["label", "reference"] }, + { atBreak: true, character: "_" }, + { character: "_", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + { atBreak: true, character: "`" }, + { + character: "`", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"] + }, + { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + { atBreak: true, character: "~" } +]; + +// node_modules/mdast-util-to-markdown/lib/util/association.js +function association(node2) { + if (node2.label || !node2.identifier) { + return node2.label || ""; + } + return decodeString(node2.identifier); +} + +// node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +function containerPhrasing(parent, state, info) { + const indexStack = state.indexStack; + const children = parent.children || []; + const results = []; + let index3 = -1; + let before = info.before; + indexStack.push(-1); + let tracker = state.createTracker(info); + while (++index3 < children.length) { + const child = children[index3]; + let after; + indexStack[indexStack.length - 1] = index3; + if (index3 + 1 < children.length) { + let handle3 = state.handle.handlers[children[index3 + 1].type]; + if (handle3 && handle3.peek) + handle3 = handle3.peek; + after = handle3 ? handle3(children[index3 + 1], parent, state, { + before: "", + after: "", + ...tracker.current() + }).charAt(0) : ""; + } else { + after = info.after; } - }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]); - var onDropCb = (0, import_react108.useCallback)(function(event) { - event.preventDefault(); - event.persist(); - stopPropagation2(event); - dragTargetsRef.current = []; - if (isEvtWithFiles(event)) { - Promise.resolve(getFilesFromEvent(event)).then(function(files) { - if (isPropagationStopped(event) && !noDragEventsBubbling) { - return; - } - setFiles(files, event); - }).catch(function(e5) { - return onErrCb(e5); - }); + if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") { + results[results.length - 1] = results[results.length - 1].replace( + /(\r?\n|\r)$/, + " " + ); + before = " "; + tracker = state.createTracker(info); + tracker.move(results.join("")); + } + results.push( + tracker.move( + state.handle(child, parent, state, { + ...tracker.current(), + before, + after + }) + ) + ); + before = results[results.length - 1].slice(-1); + } + indexStack.pop(); + return results.join(""); +} + +// node_modules/mdast-util-to-markdown/lib/util/container-flow.js +function containerFlow(parent, state, info) { + const indexStack = state.indexStack; + const children = parent.children || []; + const tracker = state.createTracker(info); + const results = []; + let index3 = -1; + indexStack.push(-1); + while (++index3 < children.length) { + const child = children[index3]; + indexStack[indexStack.length - 1] = index3; + results.push( + tracker.move( + state.handle(child, parent, state, { + before: "\n", + after: "\n", + ...tracker.current() + }) + ) + ); + if (child.type !== "list") { + state.bulletLastUsed = void 0; + } + if (index3 < children.length - 1) { + results.push( + tracker.move(between(child, children[index3 + 1], parent, state)) + ); + } + } + indexStack.pop(); + return results.join(""); +} +function between(left, right, parent, state) { + let index3 = state.join.length; + while (index3--) { + const result = state.join[index3](left, right, parent, state); + if (result === true || result === 1) { + break; + } + if (typeof result === "number") { + return "\n".repeat(1 + result); + } + if (result === false) { + return "\n\n\n\n"; + } + } + return "\n\n"; +} + +// node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +var eol = /\r?\n|\r/g; +function indentLines(value, map6) { + const result = []; + let start = 0; + let line = 0; + let match2; + while (match2 = eol.exec(value)) { + one5(value.slice(start, match2.index)); + result.push(match2[0]); + start = match2.index + match2[0].length; + line++; + } + one5(value.slice(start)); + return result.join(""); + function one5(value2) { + result.push(map6(value2, line, !value2)); + } +} + +// node_modules/mdast-util-to-markdown/lib/util/safe.js +function safe(state, input, config4) { + const value = (config4.before || "") + (input || "") + (config4.after || ""); + const positions = []; + const result = []; + const infos = {}; + let index3 = -1; + while (++index3 < state.unsafe.length) { + const pattern = state.unsafe[index3]; + if (!patternInScope(state.stack, pattern)) { + continue; } - dispatch({ - type: "reset" - }); - }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); - var openFileDialog = (0, import_react108.useCallback)(function() { - if (fsAccessApiWorksRef.current) { - dispatch({ - type: "openDialog" - }); - onFileDialogOpenCb(); - var opts = { - multiple, - types: pickerTypes - }; - window.showOpenFilePicker(opts).then(function(handles) { - return getFilesFromEvent(handles); - }).then(function(files) { - setFiles(files, null); - dispatch({ - type: "closeDialog" - }); - }).catch(function(e5) { - if (isAbort(e5)) { - onFileDialogCancelCb(e5); - dispatch({ - type: "closeDialog" - }); - } else if (isSecurityError(e5)) { - fsAccessApiWorksRef.current = false; - if (inputRef.current) { - inputRef.current.value = null; - inputRef.current.click(); - } else { - onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided.")); - } - } else { - onErrCb(e5); + const expression = patternCompile(pattern); + let match2; + while (match2 = expression.exec(value)) { + const before = "before" in pattern || Boolean(pattern.atBreak); + const after = "after" in pattern; + const position3 = match2.index + (before ? match2[1].length : 0); + if (positions.includes(position3)) { + if (infos[position3].before && !before) { + infos[position3].before = false; } - }); - return; - } - if (inputRef.current) { - dispatch({ - type: "openDialog" - }); - onFileDialogOpenCb(); - inputRef.current.value = null; - inputRef.current.click(); + if (infos[position3].after && !after) { + infos[position3].after = false; + } + } else { + positions.push(position3); + infos[position3] = { before, after }; + } } - }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); - var onKeyDownCb = (0, import_react108.useCallback)(function(event) { - if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) { - return; + } + positions.sort(numerical); + let start = config4.before ? config4.before.length : 0; + const end = value.length - (config4.after ? config4.after.length : 0); + index3 = -1; + while (++index3 < positions.length) { + const position3 = positions[index3]; + if (position3 < start || position3 >= end) { + continue; } - if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) { - event.preventDefault(); - openFileDialog(); + if (position3 + 1 < end && positions[index3 + 1] === position3 + 1 && infos[position3].after && !infos[position3 + 1].before && !infos[position3 + 1].after || positions[index3 - 1] === position3 - 1 && infos[position3].before && !infos[position3 - 1].before && !infos[position3 - 1].after) { + continue; } - }, [rootRef, openFileDialog]); - var onFocusCb = (0, import_react108.useCallback)(function() { - dispatch({ - type: "focus" - }); - }, []); - var onBlurCb = (0, import_react108.useCallback)(function() { - dispatch({ - type: "blur" - }); - }, []); - var onClickCb = (0, import_react108.useCallback)(function() { - if (noClick) { - return; + if (start !== position3) { + result.push(escapeBackslashes(value.slice(start, position3), "\\")); } - if (isIeOrEdge()) { - setTimeout(openFileDialog, 0); + start = position3; + if (/[!-/:-@[-`{-~]/.test(value.charAt(position3)) && (!config4.encode || !config4.encode.includes(value.charAt(position3)))) { + result.push("\\"); } else { - openFileDialog(); + result.push( + "&#x" + value.charCodeAt(position3).toString(16).toUpperCase() + ";" + ); + start++; } - }, [noClick, openFileDialog]); - var composeHandler = function composeHandler2(fn) { - return disabled ? null : fn; - }; - var composeKeyboardHandler = function composeKeyboardHandler2(fn) { - return noKeyboard ? null : composeHandler(fn); - }; - var composeDragHandler = function composeDragHandler2(fn) { - return noDrag ? null : composeHandler(fn); - }; - var stopPropagation2 = function stopPropagation3(event) { - if (noDragEventsBubbling) { - event.stopPropagation(); + } + result.push(escapeBackslashes(value.slice(start, end), config4.after)); + return result.join(""); +} +function numerical(a4, b2) { + return a4 - b2; +} +function escapeBackslashes(value, after) { + const expression = /\\(?=[!-/:-@[-`{-~])/g; + const positions = []; + const results = []; + const whole = value + after; + let index3 = -1; + let start = 0; + let match2; + while (match2 = expression.exec(whole)) { + positions.push(match2.index); + } + while (++index3 < positions.length) { + if (start !== positions[index3]) { + results.push(value.slice(start, positions[index3])); + } + results.push("\\"); + start = positions[index3]; + } + results.push(value.slice(start)); + return results.join(""); +} + +// node_modules/mdast-util-to-markdown/lib/util/track.js +function track(config4) { + const options = config4 || {}; + const now = options.now || {}; + let lineShift = options.lineShift || 0; + let line = now.line || 1; + let column2 = now.column || 1; + return { move, current: current3, shift }; + function current3() { + return { now: { line, column: column2 }, lineShift }; + } + function shift(value) { + lineShift += value; + } + function move(input) { + const value = input || ""; + const chunks = value.split(/\r?\n|\r/g); + const tail = chunks[chunks.length - 1]; + line += chunks.length - 1; + column2 = chunks.length === 1 ? column2 + tail.length : 1 + tail.length + lineShift; + return value; + } +} + +// node_modules/mdast-util-to-markdown/lib/index.js +function toMarkdown(tree, options = {}) { + const state = { + enter, + indentLines, + associationId: association, + containerPhrasing: containerPhrasingBound, + containerFlow: containerFlowBound, + createTracker: track, + safe: safeBound, + stack: [], + unsafe: [], + join: [], + handlers: {}, + options: {}, + indexStack: [], + handle: void 0 + }; + configure2(state, { unsafe, join: join3, handlers: handle }); + configure2(state, options); + if (state.options.tightDefinitions) { + configure2(state, { join: [joinDefinition] }); + } + state.handle = zwitch("type", { + invalid: invalid2, + unknown, + handlers: state.handlers + }); + let result = state.handle(tree, void 0, state, { + before: "\n", + after: "\n", + now: { line: 1, column: 1 }, + lineShift: 0 + }); + if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) { + result += "\n"; + } + return result; + function enter(name317) { + state.stack.push(name317); + return exit2; + function exit2() { + state.stack.pop(); } - }; - var getRootProps = (0, import_react108.useMemo)(function() { - return function() { - var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3); - return _objectSpread5(_objectSpread5(_defineProperty3({ - onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)), - onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)), - onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)), - onClick: composeHandler(composeEventHandlers(onClick, onClickCb)), - onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)), - onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)), - onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)), - onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)), - role: typeof role === "string" && role !== "" ? role : "presentation" - }, refKey, rootRef), !disabled && !noKeyboard ? { - tabIndex: 0 - } : {}), rest); - }; - }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]); - var onInputElementClick = (0, import_react108.useCallback)(function(event) { - event.stopPropagation(); - }, []); - var getInputProps = (0, import_react108.useMemo)(function() { - return function() { - var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4); - var inputProps = _defineProperty3({ - accept: acceptAttr, - multiple, - type: "file", - style: { - display: "none" - }, - onChange: composeHandler(composeEventHandlers(onChange, onDropCb)), - onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)), - tabIndex: -1 - }, refKey, inputRef); - return _objectSpread5(_objectSpread5({}, inputProps), rest); - }; - }, [inputRef, accept, multiple, onDropCb, disabled]); - return _objectSpread5(_objectSpread5({}, state), {}, { - isFocused: isFocused && !disabled, - getRootProps, - getInputProps, - rootRef, - inputRef, - open: composeHandler(openFileDialog) - }); + } } -function reducer2(state, action) { - switch (action.type) { - case "focus": - return _objectSpread5(_objectSpread5({}, state), {}, { - isFocused: true - }); - case "blur": - return _objectSpread5(_objectSpread5({}, state), {}, { - isFocused: false - }); - case "openDialog": - return _objectSpread5(_objectSpread5({}, initialState), {}, { - isFileDialogActive: true - }); - case "closeDialog": - return _objectSpread5(_objectSpread5({}, state), {}, { - isFileDialogActive: false - }); - case "setDraggedFiles": - return _objectSpread5(_objectSpread5({}, state), {}, { - isDragActive: action.isDragActive, - isDragAccept: action.isDragAccept, - isDragReject: action.isDragReject - }); - case "setFiles": - return _objectSpread5(_objectSpread5({}, state), {}, { - acceptedFiles: action.acceptedFiles, - fileRejections: action.fileRejections - }); - case "reset": - return _objectSpread5({}, initialState); - default: - return state; +function invalid2(value) { + throw new Error("Cannot handle value `" + value + "`, expected node"); +} +function unknown(node2) { + throw new Error("Cannot handle unknown node `" + node2.type + "`"); +} +function joinDefinition(left, right) { + if (left.type === "definition" && left.type === right.type) { + return 0; } } -function noop2() { +function containerPhrasingBound(parent, info) { + return containerPhrasing(parent, this, info); +} +function containerFlowBound(parent, info) { + return containerFlow(parent, this, info); +} +function safeBound(value, config4) { + return safe(this, value, config4); } -// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx -var eventToModifier = (e5, isDefaultSpace) => e5.altKey ? "copy" : e5.shiftKey || isDefaultSpace ? "link" : "move"; -var TreeItem = (props) => { - const { - id: id3, - childCount, - clone: clone5, - data: data2, - depth, - dragActive, - ghost, - active, - indentationWidth, - indicator, - collapsed, - selected, - highlighted, - onCollapse, - onSelectRange, - style, - superstate, - disabled, - dragStarted, - dragOver, - dragEnded - } = props; - const { - activePath, - setActivePath, - selectedPaths, - setSelectedPaths, - setDragPaths, - closeActiveSpace - } = (0, import_react109.useContext)(NavigatorContext); - const [hoverTarget, setHoverTarget] = (0, import_react109.useState)(null); - const innerRef = (0, import_react109.useRef)(null); - const [dropHighlighted, setDropHighlighted] = (0, import_react109.useState)(false); - const [pathState, setPathState] = (0, import_react109.useState)( - superstate.pathsIndex.get(data2.item.path) +// node_modules/remark-stringify/lib/index.js +function remarkStringify(options) { + const compiler2 = (tree) => { + const settings = this.data("settings"); + return toMarkdown( + tree, + Object.assign({}, settings, options, { + extensions: this.data("toMarkdownExtensions") || [] + }) + ); + }; + Object.assign(this, { Compiler: compiler2 }); +} + +// node_modules/remark/index.js +var remark = unified().use(remarkParse).use(remarkStringify).freeze(); + +// node_modules/property-information/lib/util/schema.js +var Schema = class { + constructor(property, normal, space3) { + this.property = property; + this.normal = normal; + if (space3) { + this.space = space3; + } + } +}; +Schema.prototype.property = {}; +Schema.prototype.normal = {}; +Schema.prototype.space = null; + +// node_modules/property-information/lib/util/merge.js +function merge(definitions2, space3) { + const property = {}; + const normal = {}; + let index3 = -1; + while (++index3 < definitions2.length) { + Object.assign(property, definitions2[index3].property); + Object.assign(normal, definitions2[index3].normal); + } + return new Schema(property, normal, space3); +} + +// node_modules/property-information/lib/normalize.js +function normalize2(value) { + return value.toLowerCase(); +} + +// node_modules/property-information/lib/util/info.js +var Info = class { + constructor(property, attribute) { + this.property = property; + this.attribute = attribute; + } +}; +Info.prototype.space = null; +Info.prototype.boolean = false; +Info.prototype.booleanish = false; +Info.prototype.overloadedBoolean = false; +Info.prototype.number = false; +Info.prototype.commaSeparated = false; +Info.prototype.spaceSeparated = false; +Info.prototype.commaOrSpaceSeparated = false; +Info.prototype.mustUseProperty = false; +Info.prototype.defined = false; + +// node_modules/property-information/lib/util/types.js +var types_exports = {}; +__export(types_exports, { + boolean: () => boolean2, + booleanish: () => booleanish, + commaOrSpaceSeparated: () => commaOrSpaceSeparated, + commaSeparated: () => commaSeparated, + number: () => number4, + overloadedBoolean: () => overloadedBoolean, + spaceSeparated: () => spaceSeparated +}); +var powers = 0; +var boolean2 = increment(); +var booleanish = increment(); +var overloadedBoolean = increment(); +var number4 = increment(); +var spaceSeparated = increment(); +var commaSeparated = increment(); +var commaOrSpaceSeparated = increment(); +function increment() { + return 2 ** ++powers; +} + +// node_modules/property-information/lib/util/defined-info.js +var checks = Object.keys(types_exports); +var DefinedInfo = class extends Info { + constructor(property, attribute, mask, space3) { + let index3 = -1; + super(property, attribute); + mark(this, "space", space3); + if (typeof mask === "number") { + while (++index3 < checks.length) { + const check = checks[index3]; + mark(this, checks[index3], (mask & types_exports[check]) === types_exports[check]); + } + } + } +}; +DefinedInfo.prototype.defined = true; +function mark(values2, key3, value) { + if (value) { + values2[key3] = value; + } +} + +// node_modules/property-information/lib/util/create.js +var own4 = {}.hasOwnProperty; +function create2(definition3) { + const property = {}; + const normal = {}; + let prop2; + for (prop2 in definition3.properties) { + if (own4.call(definition3.properties, prop2)) { + const value = definition3.properties[prop2]; + const info = new DefinedInfo( + prop2, + definition3.transform(definition3.attributes || {}, prop2), + value, + definition3.space + ); + if (definition3.mustUseProperty && definition3.mustUseProperty.includes(prop2)) { + info.mustUseProperty = true; + } + property[prop2] = info; + normal[normalize2(prop2)] = prop2; + normal[normalize2(info.attribute)] = prop2; + } + } + return new Schema(property, normal, definition3.space); +} + +// node_modules/property-information/lib/xlink.js +var xlink = create2({ + space: "xlink", + transform(_15, prop2) { + return "xlink:" + prop2.slice(5).toLowerCase(); + }, + properties: { + xLinkActuate: null, + xLinkArcRole: null, + xLinkHref: null, + xLinkRole: null, + xLinkShow: null, + xLinkTitle: null, + xLinkType: null + } +}); + +// node_modules/property-information/lib/xml.js +var xml = create2({ + space: "xml", + transform(_15, prop2) { + return "xml:" + prop2.slice(3).toLowerCase(); + }, + properties: { xmlLang: null, xmlBase: null, xmlSpace: null } +}); + +// node_modules/property-information/lib/util/case-sensitive-transform.js +function caseSensitiveTransform(attributes, attribute) { + return attribute in attributes ? attributes[attribute] : attribute; +} + +// node_modules/property-information/lib/util/case-insensitive-transform.js +function caseInsensitiveTransform(attributes, property) { + return caseSensitiveTransform(attributes, property.toLowerCase()); +} + +// node_modules/property-information/lib/xmlns.js +var xmlns = create2({ + space: "xmlns", + attributes: { xmlnsxlink: "xmlns:xlink" }, + transform: caseInsensitiveTransform, + properties: { xmlns: null, xmlnsXLink: null } +}); + +// node_modules/property-information/lib/aria.js +var aria = create2({ + transform(_15, prop2) { + return prop2 === "role" ? prop2 : "aria-" + prop2.slice(4).toLowerCase(); + }, + properties: { + ariaActiveDescendant: null, + ariaAtomic: booleanish, + ariaAutoComplete: null, + ariaBusy: booleanish, + ariaChecked: booleanish, + ariaColCount: number4, + ariaColIndex: number4, + ariaColSpan: number4, + ariaControls: spaceSeparated, + ariaCurrent: null, + ariaDescribedBy: spaceSeparated, + ariaDetails: null, + ariaDisabled: booleanish, + ariaDropEffect: spaceSeparated, + ariaErrorMessage: null, + ariaExpanded: booleanish, + ariaFlowTo: spaceSeparated, + ariaGrabbed: booleanish, + ariaHasPopup: null, + ariaHidden: booleanish, + ariaInvalid: null, + ariaKeyShortcuts: null, + ariaLabel: null, + ariaLabelledBy: spaceSeparated, + ariaLevel: number4, + ariaLive: null, + ariaModal: booleanish, + ariaMultiLine: booleanish, + ariaMultiSelectable: booleanish, + ariaOrientation: null, + ariaOwns: spaceSeparated, + ariaPlaceholder: null, + ariaPosInSet: number4, + ariaPressed: booleanish, + ariaReadOnly: booleanish, + ariaRelevant: null, + ariaRequired: booleanish, + ariaRoleDescription: spaceSeparated, + ariaRowCount: number4, + ariaRowIndex: number4, + ariaRowSpan: number4, + ariaSelected: booleanish, + ariaSetSize: number4, + ariaSort: null, + ariaValueMax: number4, + ariaValueMin: number4, + ariaValueNow: number4, + ariaValueText: null, + role: null + } +}); + +// node_modules/property-information/lib/html.js +var html2 = create2({ + space: "html", + attributes: { + acceptcharset: "accept-charset", + classname: "class", + htmlfor: "for", + httpequiv: "http-equiv" + }, + transform: caseInsensitiveTransform, + mustUseProperty: ["checked", "multiple", "muted", "selected"], + properties: { + abbr: null, + accept: commaSeparated, + acceptCharset: spaceSeparated, + accessKey: spaceSeparated, + action: null, + allow: null, + allowFullScreen: boolean2, + allowPaymentRequest: boolean2, + allowUserMedia: boolean2, + alt: null, + as: null, + async: boolean2, + autoCapitalize: null, + autoComplete: spaceSeparated, + autoFocus: boolean2, + autoPlay: boolean2, + blocking: spaceSeparated, + capture: null, + charSet: null, + checked: boolean2, + cite: null, + className: spaceSeparated, + cols: number4, + colSpan: null, + content: null, + contentEditable: booleanish, + controls: boolean2, + controlsList: spaceSeparated, + coords: number4 | commaSeparated, + crossOrigin: null, + data: null, + dateTime: null, + decoding: null, + default: boolean2, + defer: boolean2, + dir: null, + dirName: null, + disabled: boolean2, + download: overloadedBoolean, + draggable: booleanish, + encType: null, + enterKeyHint: null, + fetchPriority: null, + form: null, + formAction: null, + formEncType: null, + formMethod: null, + formNoValidate: boolean2, + formTarget: null, + headers: spaceSeparated, + height: number4, + hidden: boolean2, + high: number4, + href: null, + hrefLang: null, + htmlFor: spaceSeparated, + httpEquiv: spaceSeparated, + id: null, + imageSizes: null, + imageSrcSet: null, + inert: boolean2, + inputMode: null, + integrity: null, + is: null, + isMap: boolean2, + itemId: null, + itemProp: spaceSeparated, + itemRef: spaceSeparated, + itemScope: boolean2, + itemType: spaceSeparated, + kind: null, + label: null, + lang: null, + language: null, + list: null, + loading: null, + loop: boolean2, + low: number4, + manifest: null, + max: null, + maxLength: number4, + media: null, + method: null, + min: null, + minLength: number4, + multiple: boolean2, + muted: boolean2, + name: null, + nonce: null, + noModule: boolean2, + noValidate: boolean2, + onAbort: null, + onAfterPrint: null, + onAuxClick: null, + onBeforeMatch: null, + onBeforePrint: null, + onBeforeToggle: null, + onBeforeUnload: null, + onBlur: null, + onCancel: null, + onCanPlay: null, + onCanPlayThrough: null, + onChange: null, + onClick: null, + onClose: null, + onContextLost: null, + onContextMenu: null, + onContextRestored: null, + onCopy: null, + onCueChange: null, + onCut: null, + onDblClick: null, + onDrag: null, + onDragEnd: null, + onDragEnter: null, + onDragExit: null, + onDragLeave: null, + onDragOver: null, + onDragStart: null, + onDrop: null, + onDurationChange: null, + onEmptied: null, + onEnded: null, + onError: null, + onFocus: null, + onFormData: null, + onHashChange: null, + onInput: null, + onInvalid: null, + onKeyDown: null, + onKeyPress: null, + onKeyUp: null, + onLanguageChange: null, + onLoad: null, + onLoadedData: null, + onLoadedMetadata: null, + onLoadEnd: null, + onLoadStart: null, + onMessage: null, + onMessageError: null, + onMouseDown: null, + onMouseEnter: null, + onMouseLeave: null, + onMouseMove: null, + onMouseOut: null, + onMouseOver: null, + onMouseUp: null, + onOffline: null, + onOnline: null, + onPageHide: null, + onPageShow: null, + onPaste: null, + onPause: null, + onPlay: null, + onPlaying: null, + onPopState: null, + onProgress: null, + onRateChange: null, + onRejectionHandled: null, + onReset: null, + onResize: null, + onScroll: null, + onScrollEnd: null, + onSecurityPolicyViolation: null, + onSeeked: null, + onSeeking: null, + onSelect: null, + onSlotChange: null, + onStalled: null, + onStorage: null, + onSubmit: null, + onSuspend: null, + onTimeUpdate: null, + onToggle: null, + onUnhandledRejection: null, + onUnload: null, + onVolumeChange: null, + onWaiting: null, + onWheel: null, + open: boolean2, + optimum: number4, + pattern: null, + ping: spaceSeparated, + placeholder: null, + playsInline: boolean2, + popover: null, + popoverTarget: null, + popoverTargetAction: null, + poster: null, + preload: null, + readOnly: boolean2, + referrerPolicy: null, + rel: spaceSeparated, + required: boolean2, + reversed: boolean2, + rows: number4, + rowSpan: number4, + sandbox: spaceSeparated, + scope: null, + scoped: boolean2, + seamless: boolean2, + selected: boolean2, + shadowRootDelegatesFocus: boolean2, + shadowRootMode: null, + shape: null, + size: number4, + sizes: null, + slot: null, + span: number4, + spellCheck: booleanish, + src: null, + srcDoc: null, + srcLang: null, + srcSet: null, + start: number4, + step: null, + style: null, + tabIndex: number4, + target: null, + title: null, + translate: null, + type: null, + typeMustMatch: boolean2, + useMap: null, + value: booleanish, + width: number4, + wrap: null, + align: null, + aLink: null, + archive: spaceSeparated, + axis: null, + background: null, + bgColor: null, + border: number4, + borderColor: null, + bottomMargin: number4, + cellPadding: null, + cellSpacing: null, + char: null, + charOff: null, + classId: null, + clear: null, + code: null, + codeBase: null, + codeType: null, + color: null, + compact: boolean2, + declare: boolean2, + event: null, + face: null, + frame: null, + frameBorder: null, + hSpace: number4, + leftMargin: number4, + link: null, + longDesc: null, + lowSrc: null, + marginHeight: number4, + marginWidth: number4, + noResize: boolean2, + noHref: boolean2, + noShade: boolean2, + noWrap: boolean2, + object: null, + profile: null, + prompt: null, + rev: null, + rightMargin: number4, + rules: null, + scheme: null, + scrolling: booleanish, + standby: null, + summary: null, + text: null, + topMargin: number4, + valueType: null, + version: null, + vAlign: null, + vLink: null, + vSpace: number4, + allowTransparency: null, + autoCorrect: null, + autoSave: null, + disablePictureInPicture: boolean2, + disableRemotePlayback: boolean2, + prefix: null, + property: null, + results: number4, + security: null, + unselectable: null + } +}); + +// node_modules/property-information/lib/svg.js +var svg = create2({ + space: "svg", + attributes: { + accentHeight: "accent-height", + alignmentBaseline: "alignment-baseline", + arabicForm: "arabic-form", + baselineShift: "baseline-shift", + capHeight: "cap-height", + className: "class", + clipPath: "clip-path", + clipRule: "clip-rule", + colorInterpolation: "color-interpolation", + colorInterpolationFilters: "color-interpolation-filters", + colorProfile: "color-profile", + colorRendering: "color-rendering", + crossOrigin: "crossorigin", + dataType: "datatype", + dominantBaseline: "dominant-baseline", + enableBackground: "enable-background", + fillOpacity: "fill-opacity", + fillRule: "fill-rule", + floodColor: "flood-color", + floodOpacity: "flood-opacity", + fontFamily: "font-family", + fontSize: "font-size", + fontSizeAdjust: "font-size-adjust", + fontStretch: "font-stretch", + fontStyle: "font-style", + fontVariant: "font-variant", + fontWeight: "font-weight", + glyphName: "glyph-name", + glyphOrientationHorizontal: "glyph-orientation-horizontal", + glyphOrientationVertical: "glyph-orientation-vertical", + hrefLang: "hreflang", + horizAdvX: "horiz-adv-x", + horizOriginX: "horiz-origin-x", + horizOriginY: "horiz-origin-y", + imageRendering: "image-rendering", + letterSpacing: "letter-spacing", + lightingColor: "lighting-color", + markerEnd: "marker-end", + markerMid: "marker-mid", + markerStart: "marker-start", + navDown: "nav-down", + navDownLeft: "nav-down-left", + navDownRight: "nav-down-right", + navLeft: "nav-left", + navNext: "nav-next", + navPrev: "nav-prev", + navRight: "nav-right", + navUp: "nav-up", + navUpLeft: "nav-up-left", + navUpRight: "nav-up-right", + onAbort: "onabort", + onActivate: "onactivate", + onAfterPrint: "onafterprint", + onBeforePrint: "onbeforeprint", + onBegin: "onbegin", + onCancel: "oncancel", + onCanPlay: "oncanplay", + onCanPlayThrough: "oncanplaythrough", + onChange: "onchange", + onClick: "onclick", + onClose: "onclose", + onCopy: "oncopy", + onCueChange: "oncuechange", + onCut: "oncut", + onDblClick: "ondblclick", + onDrag: "ondrag", + onDragEnd: "ondragend", + onDragEnter: "ondragenter", + onDragExit: "ondragexit", + onDragLeave: "ondragleave", + onDragOver: "ondragover", + onDragStart: "ondragstart", + onDrop: "ondrop", + onDurationChange: "ondurationchange", + onEmptied: "onemptied", + onEnd: "onend", + onEnded: "onended", + onError: "onerror", + onFocus: "onfocus", + onFocusIn: "onfocusin", + onFocusOut: "onfocusout", + onHashChange: "onhashchange", + onInput: "oninput", + onInvalid: "oninvalid", + onKeyDown: "onkeydown", + onKeyPress: "onkeypress", + onKeyUp: "onkeyup", + onLoad: "onload", + onLoadedData: "onloadeddata", + onLoadedMetadata: "onloadedmetadata", + onLoadStart: "onloadstart", + onMessage: "onmessage", + onMouseDown: "onmousedown", + onMouseEnter: "onmouseenter", + onMouseLeave: "onmouseleave", + onMouseMove: "onmousemove", + onMouseOut: "onmouseout", + onMouseOver: "onmouseover", + onMouseUp: "onmouseup", + onMouseWheel: "onmousewheel", + onOffline: "onoffline", + onOnline: "ononline", + onPageHide: "onpagehide", + onPageShow: "onpageshow", + onPaste: "onpaste", + onPause: "onpause", + onPlay: "onplay", + onPlaying: "onplaying", + onPopState: "onpopstate", + onProgress: "onprogress", + onRateChange: "onratechange", + onRepeat: "onrepeat", + onReset: "onreset", + onResize: "onresize", + onScroll: "onscroll", + onSeeked: "onseeked", + onSeeking: "onseeking", + onSelect: "onselect", + onShow: "onshow", + onStalled: "onstalled", + onStorage: "onstorage", + onSubmit: "onsubmit", + onSuspend: "onsuspend", + onTimeUpdate: "ontimeupdate", + onToggle: "ontoggle", + onUnload: "onunload", + onVolumeChange: "onvolumechange", + onWaiting: "onwaiting", + onZoom: "onzoom", + overlinePosition: "overline-position", + overlineThickness: "overline-thickness", + paintOrder: "paint-order", + panose1: "panose-1", + pointerEvents: "pointer-events", + referrerPolicy: "referrerpolicy", + renderingIntent: "rendering-intent", + shapeRendering: "shape-rendering", + stopColor: "stop-color", + stopOpacity: "stop-opacity", + strikethroughPosition: "strikethrough-position", + strikethroughThickness: "strikethrough-thickness", + strokeDashArray: "stroke-dasharray", + strokeDashOffset: "stroke-dashoffset", + strokeLineCap: "stroke-linecap", + strokeLineJoin: "stroke-linejoin", + strokeMiterLimit: "stroke-miterlimit", + strokeOpacity: "stroke-opacity", + strokeWidth: "stroke-width", + tabIndex: "tabindex", + textAnchor: "text-anchor", + textDecoration: "text-decoration", + textRendering: "text-rendering", + transformOrigin: "transform-origin", + typeOf: "typeof", + underlinePosition: "underline-position", + underlineThickness: "underline-thickness", + unicodeBidi: "unicode-bidi", + unicodeRange: "unicode-range", + unitsPerEm: "units-per-em", + vAlphabetic: "v-alphabetic", + vHanging: "v-hanging", + vIdeographic: "v-ideographic", + vMathematical: "v-mathematical", + vectorEffect: "vector-effect", + vertAdvY: "vert-adv-y", + vertOriginX: "vert-origin-x", + vertOriginY: "vert-origin-y", + wordSpacing: "word-spacing", + writingMode: "writing-mode", + xHeight: "x-height", + playbackOrder: "playbackorder", + timelineBegin: "timelinebegin" + }, + transform: caseSensitiveTransform, + properties: { + about: commaOrSpaceSeparated, + accentHeight: number4, + accumulate: null, + additive: null, + alignmentBaseline: null, + alphabetic: number4, + amplitude: number4, + arabicForm: null, + ascent: number4, + attributeName: null, + attributeType: null, + azimuth: number4, + bandwidth: null, + baselineShift: null, + baseFrequency: null, + baseProfile: null, + bbox: null, + begin: null, + bias: number4, + by: null, + calcMode: null, + capHeight: number4, + className: spaceSeparated, + clip: null, + clipPath: null, + clipPathUnits: null, + clipRule: null, + color: null, + colorInterpolation: null, + colorInterpolationFilters: null, + colorProfile: null, + colorRendering: null, + content: null, + contentScriptType: null, + contentStyleType: null, + crossOrigin: null, + cursor: null, + cx: null, + cy: null, + d: null, + dataType: null, + defaultAction: null, + descent: number4, + diffuseConstant: number4, + direction: null, + display: null, + dur: null, + divisor: number4, + dominantBaseline: null, + download: boolean2, + dx: null, + dy: null, + edgeMode: null, + editable: null, + elevation: number4, + enableBackground: null, + end: null, + event: null, + exponent: number4, + externalResourcesRequired: null, + fill: null, + fillOpacity: number4, + fillRule: null, + filter: null, + filterRes: null, + filterUnits: null, + floodColor: null, + floodOpacity: null, + focusable: null, + focusHighlight: null, + fontFamily: null, + fontSize: null, + fontSizeAdjust: null, + fontStretch: null, + fontStyle: null, + fontVariant: null, + fontWeight: null, + format: null, + fr: null, + from: null, + fx: null, + fy: null, + g1: commaSeparated, + g2: commaSeparated, + glyphName: commaSeparated, + glyphOrientationHorizontal: null, + glyphOrientationVertical: null, + glyphRef: null, + gradientTransform: null, + gradientUnits: null, + handler: null, + hanging: number4, + hatchContentUnits: null, + hatchUnits: null, + height: null, + href: null, + hrefLang: null, + horizAdvX: number4, + horizOriginX: number4, + horizOriginY: number4, + id: null, + ideographic: number4, + imageRendering: null, + initialVisibility: null, + in: null, + in2: null, + intercept: number4, + k: number4, + k1: number4, + k2: number4, + k3: number4, + k4: number4, + kernelMatrix: commaOrSpaceSeparated, + kernelUnitLength: null, + keyPoints: null, + keySplines: null, + keyTimes: null, + kerning: null, + lang: null, + lengthAdjust: null, + letterSpacing: null, + lightingColor: null, + limitingConeAngle: number4, + local: null, + markerEnd: null, + markerMid: null, + markerStart: null, + markerHeight: null, + markerUnits: null, + markerWidth: null, + mask: null, + maskContentUnits: null, + maskUnits: null, + mathematical: null, + max: null, + media: null, + mediaCharacterEncoding: null, + mediaContentEncodings: null, + mediaSize: number4, + mediaTime: null, + method: null, + min: null, + mode: null, + name: null, + navDown: null, + navDownLeft: null, + navDownRight: null, + navLeft: null, + navNext: null, + navPrev: null, + navRight: null, + navUp: null, + navUpLeft: null, + navUpRight: null, + numOctaves: null, + observer: null, + offset: null, + onAbort: null, + onActivate: null, + onAfterPrint: null, + onBeforePrint: null, + onBegin: null, + onCancel: null, + onCanPlay: null, + onCanPlayThrough: null, + onChange: null, + onClick: null, + onClose: null, + onCopy: null, + onCueChange: null, + onCut: null, + onDblClick: null, + onDrag: null, + onDragEnd: null, + onDragEnter: null, + onDragExit: null, + onDragLeave: null, + onDragOver: null, + onDragStart: null, + onDrop: null, + onDurationChange: null, + onEmptied: null, + onEnd: null, + onEnded: null, + onError: null, + onFocus: null, + onFocusIn: null, + onFocusOut: null, + onHashChange: null, + onInput: null, + onInvalid: null, + onKeyDown: null, + onKeyPress: null, + onKeyUp: null, + onLoad: null, + onLoadedData: null, + onLoadedMetadata: null, + onLoadStart: null, + onMessage: null, + onMouseDown: null, + onMouseEnter: null, + onMouseLeave: null, + onMouseMove: null, + onMouseOut: null, + onMouseOver: null, + onMouseUp: null, + onMouseWheel: null, + onOffline: null, + onOnline: null, + onPageHide: null, + onPageShow: null, + onPaste: null, + onPause: null, + onPlay: null, + onPlaying: null, + onPopState: null, + onProgress: null, + onRateChange: null, + onRepeat: null, + onReset: null, + onResize: null, + onScroll: null, + onSeeked: null, + onSeeking: null, + onSelect: null, + onShow: null, + onStalled: null, + onStorage: null, + onSubmit: null, + onSuspend: null, + onTimeUpdate: null, + onToggle: null, + onUnload: null, + onVolumeChange: null, + onWaiting: null, + onZoom: null, + opacity: null, + operator: null, + order: null, + orient: null, + orientation: null, + origin: null, + overflow: null, + overlay: null, + overlinePosition: number4, + overlineThickness: number4, + paintOrder: null, + panose1: null, + path: null, + pathLength: number4, + patternContentUnits: null, + patternTransform: null, + patternUnits: null, + phase: null, + ping: spaceSeparated, + pitch: null, + playbackOrder: null, + pointerEvents: null, + points: null, + pointsAtX: number4, + pointsAtY: number4, + pointsAtZ: number4, + preserveAlpha: null, + preserveAspectRatio: null, + primitiveUnits: null, + propagate: null, + property: commaOrSpaceSeparated, + r: null, + radius: null, + referrerPolicy: null, + refX: null, + refY: null, + rel: commaOrSpaceSeparated, + rev: commaOrSpaceSeparated, + renderingIntent: null, + repeatCount: null, + repeatDur: null, + requiredExtensions: commaOrSpaceSeparated, + requiredFeatures: commaOrSpaceSeparated, + requiredFonts: commaOrSpaceSeparated, + requiredFormats: commaOrSpaceSeparated, + resource: null, + restart: null, + result: null, + rotate: null, + rx: null, + ry: null, + scale: null, + seed: null, + shapeRendering: null, + side: null, + slope: null, + snapshotTime: null, + specularConstant: number4, + specularExponent: number4, + spreadMethod: null, + spacing: null, + startOffset: null, + stdDeviation: null, + stemh: null, + stemv: null, + stitchTiles: null, + stopColor: null, + stopOpacity: null, + strikethroughPosition: number4, + strikethroughThickness: number4, + string: null, + stroke: null, + strokeDashArray: commaOrSpaceSeparated, + strokeDashOffset: null, + strokeLineCap: null, + strokeLineJoin: null, + strokeMiterLimit: number4, + strokeOpacity: number4, + strokeWidth: null, + style: null, + surfaceScale: number4, + syncBehavior: null, + syncBehaviorDefault: null, + syncMaster: null, + syncTolerance: null, + syncToleranceDefault: null, + systemLanguage: commaOrSpaceSeparated, + tabIndex: number4, + tableValues: null, + target: null, + targetX: number4, + targetY: number4, + textAnchor: null, + textDecoration: null, + textRendering: null, + textLength: null, + timelineBegin: null, + title: null, + transformBehavior: null, + type: null, + typeOf: commaOrSpaceSeparated, + to: null, + transform: null, + transformOrigin: null, + u1: null, + u2: null, + underlinePosition: number4, + underlineThickness: number4, + unicode: null, + unicodeBidi: null, + unicodeRange: null, + unitsPerEm: number4, + values: null, + vAlphabetic: number4, + vMathematical: number4, + vectorEffect: null, + vHanging: number4, + vIdeographic: number4, + version: null, + vertAdvY: number4, + vertOriginX: number4, + vertOriginY: number4, + viewBox: null, + viewTarget: null, + visibility: null, + width: null, + widths: null, + wordSpacing: null, + writingMode: null, + x: null, + x1: null, + x2: null, + xChannelSelector: null, + xHeight: number4, + y: null, + y1: null, + y2: null, + yChannelSelector: null, + z: null, + zoomAndPan: null + } +}); + +// node_modules/property-information/lib/find.js +var valid = /^data[-\w.:]+$/i; +var dash = /-[a-z]/g; +var cap = /[A-Z]/g; +function find2(schema, value) { + const normal = normalize2(value); + let prop2 = value; + let Type = Info; + if (normal in schema.normal) { + return schema.property[schema.normal[normal]]; + } + if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) { + if (value.charAt(4) === "-") { + const rest = value.slice(5).replace(dash, camelcase); + prop2 = "data" + rest.charAt(0).toUpperCase() + rest.slice(1); + } else { + const rest = value.slice(4); + if (!dash.test(rest)) { + let dashes = rest.replace(cap, kebab); + if (dashes.charAt(0) !== "-") { + dashes = "-" + dashes; + } + value = "data" + dashes; + } + } + Type = DefinedInfo; + } + return new Type(prop2, value); +} +function kebab($0) { + return "-" + $0.toLowerCase(); +} +function camelcase($0) { + return $0.charAt(1).toUpperCase(); +} + +// node_modules/property-information/index.js +var html3 = merge([xml, xlink, xmlns, aria, html2], "html"); +var svg2 = merge([xml, xlink, xmlns, aria, svg], "svg"); + +// node_modules/html-void-elements/index.js +var htmlVoidElements = [ + "area", + "base", + "basefont", + "bgsound", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "image", + "img", + "input", + "isindex", + "keygen", + "link", + "menuitem", + "meta", + "nextid", + "param", + "source", + "track", + "wbr" +]; + +// node_modules/stringify-entities/lib/core.js +function core(value, options) { + value = value.replace( + options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g, + basic2 ); - (0, import_react109.useEffect)( - () => setPathState(superstate.pathsIndex.get(data2.item.path)), - [data2.item.path] + if (options.subset || options.escapeOnly) { + return value; + } + return value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate).replace( + /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, + basic2 ); - const openPathAtTarget = (path2, e5) => { - if (e5.shiftKey) { - onSelectRange(path2.id); - return; - } else if (e5.altKey) { - setSelectedPaths((s4) => [...s4.filter((f2) => f2.id != path2.id), path2]); - return; + function surrogate(pair2, index3, all6) { + return options.format( + (pair2.charCodeAt(0) - 55296) * 1024 + pair2.charCodeAt(1) - 56320 + 65536, + all6.charCodeAt(index3 + 2), + options + ); + } + function basic2(character, index3, all6) { + return options.format( + character.charCodeAt(0), + all6.charCodeAt(index3 + 1), + options + ); + } +} +function charactersToExpression(subset2) { + const groups = []; + let index3 = -1; + while (++index3 < subset2.length) { + groups.push(subset2[index3].replace(/[|\\{}()[\]^$+*?.]/g, "\\$&")); + } + return new RegExp("(?:" + groups.join("|") + ")", "g"); +} + +// node_modules/stringify-entities/lib/util/to-hexadecimal.js +function toHexadecimal(code3, next, omit) { + const value = "&#x" + code3.toString(16).toUpperCase(); + return omit && next && !/[\dA-Fa-f]/.test(String.fromCharCode(next)) ? value : value + ";"; +} + +// node_modules/stringify-entities/lib/util/to-decimal.js +function toDecimal(code3, next, omit) { + const value = "&#" + String(code3); + return omit && next && !/\d/.test(String.fromCharCode(next)) ? value : value + ";"; +} + +// node_modules/character-entities-legacy/index.js +var characterEntitiesLegacy = [ + "AElig", + "AMP", + "Aacute", + "Acirc", + "Agrave", + "Aring", + "Atilde", + "Auml", + "COPY", + "Ccedil", + "ETH", + "Eacute", + "Ecirc", + "Egrave", + "Euml", + "GT", + "Iacute", + "Icirc", + "Igrave", + "Iuml", + "LT", + "Ntilde", + "Oacute", + "Ocirc", + "Ograve", + "Oslash", + "Otilde", + "Ouml", + "QUOT", + "REG", + "THORN", + "Uacute", + "Ucirc", + "Ugrave", + "Uuml", + "Yacute", + "aacute", + "acirc", + "acute", + "aelig", + "agrave", + "amp", + "aring", + "atilde", + "auml", + "brvbar", + "ccedil", + "cedil", + "cent", + "copy", + "curren", + "deg", + "divide", + "eacute", + "ecirc", + "egrave", + "eth", + "euml", + "frac12", + "frac14", + "frac34", + "gt", + "iacute", + "icirc", + "iexcl", + "igrave", + "iquest", + "iuml", + "laquo", + "lt", + "macr", + "micro", + "middot", + "nbsp", + "not", + "ntilde", + "oacute", + "ocirc", + "ograve", + "ordf", + "ordm", + "oslash", + "otilde", + "ouml", + "para", + "plusmn", + "pound", + "quot", + "raquo", + "reg", + "sect", + "shy", + "sup1", + "sup2", + "sup3", + "szlig", + "thorn", + "times", + "uacute", + "ucirc", + "ugrave", + "uml", + "uuml", + "yacute", + "yen", + "yuml" +]; + +// node_modules/character-entities-html4/index.js +var characterEntitiesHtml4 = { + nbsp: "\xA0", + iexcl: "\xA1", + cent: "\xA2", + pound: "\xA3", + curren: "\xA4", + yen: "\xA5", + brvbar: "\xA6", + sect: "\xA7", + uml: "\xA8", + copy: "\xA9", + ordf: "\xAA", + laquo: "\xAB", + not: "\xAC", + shy: "\xAD", + reg: "\xAE", + macr: "\xAF", + deg: "\xB0", + plusmn: "\xB1", + sup2: "\xB2", + sup3: "\xB3", + acute: "\xB4", + micro: "\xB5", + para: "\xB6", + middot: "\xB7", + cedil: "\xB8", + sup1: "\xB9", + ordm: "\xBA", + raquo: "\xBB", + frac14: "\xBC", + frac12: "\xBD", + frac34: "\xBE", + iquest: "\xBF", + Agrave: "\xC0", + Aacute: "\xC1", + Acirc: "\xC2", + Atilde: "\xC3", + Auml: "\xC4", + Aring: "\xC5", + AElig: "\xC6", + Ccedil: "\xC7", + Egrave: "\xC8", + Eacute: "\xC9", + Ecirc: "\xCA", + Euml: "\xCB", + Igrave: "\xCC", + Iacute: "\xCD", + Icirc: "\xCE", + Iuml: "\xCF", + ETH: "\xD0", + Ntilde: "\xD1", + Ograve: "\xD2", + Oacute: "\xD3", + Ocirc: "\xD4", + Otilde: "\xD5", + Ouml: "\xD6", + times: "\xD7", + Oslash: "\xD8", + Ugrave: "\xD9", + Uacute: "\xDA", + Ucirc: "\xDB", + Uuml: "\xDC", + Yacute: "\xDD", + THORN: "\xDE", + szlig: "\xDF", + agrave: "\xE0", + aacute: "\xE1", + acirc: "\xE2", + atilde: "\xE3", + auml: "\xE4", + aring: "\xE5", + aelig: "\xE6", + ccedil: "\xE7", + egrave: "\xE8", + eacute: "\xE9", + ecirc: "\xEA", + euml: "\xEB", + igrave: "\xEC", + iacute: "\xED", + icirc: "\xEE", + iuml: "\xEF", + eth: "\xF0", + ntilde: "\xF1", + ograve: "\xF2", + oacute: "\xF3", + ocirc: "\xF4", + otilde: "\xF5", + ouml: "\xF6", + divide: "\xF7", + oslash: "\xF8", + ugrave: "\xF9", + uacute: "\xFA", + ucirc: "\xFB", + uuml: "\xFC", + yacute: "\xFD", + thorn: "\xFE", + yuml: "\xFF", + fnof: "\u0192", + Alpha: "\u0391", + Beta: "\u0392", + Gamma: "\u0393", + Delta: "\u0394", + Epsilon: "\u0395", + Zeta: "\u0396", + Eta: "\u0397", + Theta: "\u0398", + Iota: "\u0399", + Kappa: "\u039A", + Lambda: "\u039B", + Mu: "\u039C", + Nu: "\u039D", + Xi: "\u039E", + Omicron: "\u039F", + Pi: "\u03A0", + Rho: "\u03A1", + Sigma: "\u03A3", + Tau: "\u03A4", + Upsilon: "\u03A5", + Phi: "\u03A6", + Chi: "\u03A7", + Psi: "\u03A8", + Omega: "\u03A9", + alpha: "\u03B1", + beta: "\u03B2", + gamma: "\u03B3", + delta: "\u03B4", + epsilon: "\u03B5", + zeta: "\u03B6", + eta: "\u03B7", + theta: "\u03B8", + iota: "\u03B9", + kappa: "\u03BA", + lambda: "\u03BB", + mu: "\u03BC", + nu: "\u03BD", + xi: "\u03BE", + omicron: "\u03BF", + pi: "\u03C0", + rho: "\u03C1", + sigmaf: "\u03C2", + sigma: "\u03C3", + tau: "\u03C4", + upsilon: "\u03C5", + phi: "\u03C6", + chi: "\u03C7", + psi: "\u03C8", + omega: "\u03C9", + thetasym: "\u03D1", + upsih: "\u03D2", + piv: "\u03D6", + bull: "\u2022", + hellip: "\u2026", + prime: "\u2032", + Prime: "\u2033", + oline: "\u203E", + frasl: "\u2044", + weierp: "\u2118", + image: "\u2111", + real: "\u211C", + trade: "\u2122", + alefsym: "\u2135", + larr: "\u2190", + uarr: "\u2191", + rarr: "\u2192", + darr: "\u2193", + harr: "\u2194", + crarr: "\u21B5", + lArr: "\u21D0", + uArr: "\u21D1", + rArr: "\u21D2", + dArr: "\u21D3", + hArr: "\u21D4", + forall: "\u2200", + part: "\u2202", + exist: "\u2203", + empty: "\u2205", + nabla: "\u2207", + isin: "\u2208", + notin: "\u2209", + ni: "\u220B", + prod: "\u220F", + sum: "\u2211", + minus: "\u2212", + lowast: "\u2217", + radic: "\u221A", + prop: "\u221D", + infin: "\u221E", + ang: "\u2220", + and: "\u2227", + or: "\u2228", + cap: "\u2229", + cup: "\u222A", + int: "\u222B", + there4: "\u2234", + sim: "\u223C", + cong: "\u2245", + asymp: "\u2248", + ne: "\u2260", + equiv: "\u2261", + le: "\u2264", + ge: "\u2265", + sub: "\u2282", + sup: "\u2283", + nsub: "\u2284", + sube: "\u2286", + supe: "\u2287", + oplus: "\u2295", + otimes: "\u2297", + perp: "\u22A5", + sdot: "\u22C5", + lceil: "\u2308", + rceil: "\u2309", + lfloor: "\u230A", + rfloor: "\u230B", + lang: "\u2329", + rang: "\u232A", + loz: "\u25CA", + spades: "\u2660", + clubs: "\u2663", + hearts: "\u2665", + diams: "\u2666", + quot: '"', + amp: "&", + lt: "<", + gt: ">", + OElig: "\u0152", + oelig: "\u0153", + Scaron: "\u0160", + scaron: "\u0161", + Yuml: "\u0178", + circ: "\u02C6", + tilde: "\u02DC", + ensp: "\u2002", + emsp: "\u2003", + thinsp: "\u2009", + zwnj: "\u200C", + zwj: "\u200D", + lrm: "\u200E", + rlm: "\u200F", + ndash: "\u2013", + mdash: "\u2014", + lsquo: "\u2018", + rsquo: "\u2019", + sbquo: "\u201A", + ldquo: "\u201C", + rdquo: "\u201D", + bdquo: "\u201E", + dagger: "\u2020", + Dagger: "\u2021", + permil: "\u2030", + lsaquo: "\u2039", + rsaquo: "\u203A", + euro: "\u20AC" +}; + +// node_modules/stringify-entities/lib/constant/dangerous.js +var dangerous = [ + "cent", + "copy", + "divide", + "gt", + "lt", + "not", + "para", + "times" +]; + +// node_modules/stringify-entities/lib/util/to-named.js +var own5 = {}.hasOwnProperty; +var characters = {}; +var key2; +for (key2 in characterEntitiesHtml4) { + if (own5.call(characterEntitiesHtml4, key2)) { + characters[characterEntitiesHtml4[key2]] = key2; + } +} +function toNamed(code3, next, omit, attribute) { + const character = String.fromCharCode(code3); + if (own5.call(characters, character)) { + const name317 = characters[character]; + const value = "&" + name317; + if (omit && characterEntitiesLegacy.includes(name317) && !dangerous.includes(name317) && (!attribute || next && next !== 61 && /[^\da-z]/i.test(String.fromCharCode(next)))) { + return value; } - if (isFolder) { - if (superstate.settings.expandFolderOnClick) { - if (collapsed) { - onCollapse(data2, true); - } else if (active || selected) { - onCollapse(data2, false); - } - } + return value + ";"; + } + return ""; +} + +// node_modules/stringify-entities/lib/util/format-smart.js +function formatSmart(code3, next, options) { + let numeric3 = toHexadecimal(code3, next, options.omitOptionalSemicolons); + let named; + if (options.useNamedReferences || options.useShortestReferences) { + named = toNamed( + code3, + next, + options.omitOptionalSemicolons, + options.attribute + ); + } + if ((options.useShortestReferences || !named) && options.useShortestReferences) { + const decimal = toDecimal(code3, next, options.omitOptionalSemicolons); + if (decimal.length < numeric3.length) { + numeric3 = decimal; } - superstate.ui.openPath( - path2.item.path, - e5.ctrlKey || e5.metaKey || e5.button == 1 ? e5.altKey ? "split" : "tab" : false + } + return named && (!options.useShortestReferences || named.length < numeric3.length) ? named : numeric3; +} + +// node_modules/stringify-entities/lib/index.js +function stringifyEntities(value, options) { + return core(value, Object.assign({ format: formatSmart }, options)); +} + +// node_modules/hast-util-to-html/lib/handle/comment.js +function comment3(node2, _1, _22, state) { + return state.settings.bogusComments ? ""] }) + ) + ">" : "|--!>|"; + function encode($0) { + return stringifyEntities( + $0, + Object.assign({}, state.settings.characterReferences, { + subset: ["<", ">"] + }) ); - setActivePath(path2.item.path); - setSelectedPaths([path2]); - }; - const onDragStarted = (e5) => { - if (selectedPaths.length > 1) { - setDragPaths(selectedPaths.map((f2) => f2.path)); - superstate.ui.dragStarted( - e5, - selectedPaths.map((f2) => f2.path) - ); - return; + } +} + +// node_modules/hast-util-to-html/lib/handle/doctype.js +function doctype(_1, _22, _32, state) { + return ""; +} + +// node_modules/ccount/index.js +function ccount(value, character) { + const source = String(value); + if (typeof character !== "string") { + throw new TypeError("Expected character"); + } + let count3 = 0; + let index3 = source.indexOf(character); + while (index3 !== -1) { + count3++; + index3 = source.indexOf(character, index3 + character.length); + } + return count3; +} + +// node_modules/comma-separated-tokens/index.js +function stringify3(values2, options) { + const settings = options || {}; + const input = values2[values2.length - 1] === "" ? [...values2, ""] : values2; + return input.join( + (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ") + ).trim(); +} + +// node_modules/space-separated-tokens/index.js +function stringify4(values2) { + return values2.join(" ").trim(); +} + +// node_modules/hast-util-whitespace/index.js +function whitespace(thing) { + const value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing; + return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === ""; +} + +// node_modules/hast-util-to-html/lib/omission/util/siblings.js +var siblingAfter = siblings(1); +var siblingBefore = siblings(-1); +function siblings(increment2) { + return sibling; + function sibling(parent, index3, includeWhitespace) { + const siblings2 = parent ? parent.children : []; + let offset2 = (index3 || 0) + increment2; + let next = siblings2 && siblings2[offset2]; + if (!includeWhitespace) { + while (next && whitespace(next)) { + offset2 += increment2; + next = siblings2[offset2]; + } } - dragStarted(data2.id); - setDragPaths([data2.path]); - superstate.ui.dragStarted(e5, [data2.path]); - }; - const onDragOver = (e5) => { - e5.preventDefault(); - if (!innerRef.current) - return; - const rect = innerRef.current.getBoundingClientRect(); - const x2 = e5.clientX - rect.left; - const y3 = e5.clientY - rect.top; - dragOver(e5, data2.id, { x: x2, y: y3 }); - }; - const onKeyDown = (e5) => { - if (e5.key === "Control" || e5.key === "Meta") { - if (e5.repeat) - return; - const el = hoverTarget; - if (el) - superstate.ui.openPath(pathState.path, "hover", el); + return next; + } +} + +// node_modules/hast-util-to-html/lib/omission/omission.js +var own6 = {}.hasOwnProperty; +function omission(handlers2) { + return omit; + function omit(node2, index3, parent) { + return own6.call(handlers2, node2.tagName) && handlers2[node2.tagName](node2, index3, parent); + } +} + +// node_modules/hast-util-to-html/lib/omission/closing.js +var closing = omission({ + html: html4, + head: headOrColgroupOrCaption, + body, + p, + li, + dt, + dd, + rt: rubyElement, + rp: rubyElement, + optgroup, + option, + menuitem, + colgroup: headOrColgroupOrCaption, + caption: headOrColgroupOrCaption, + thead, + tbody, + tfoot, + tr, + td: cells, + th: cells +}); +function headOrColgroupOrCaption(_15, index3, parent) { + const next = siblingAfter(parent, index3, true); + return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0))); +} +function html4(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type !== "comment"; +} +function body(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type !== "comment"; +} +function p(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || !(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video")); +} +function li(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && next.tagName === "li"; +} +function dt(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd"); +} +function dd(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd"); +} +function rubyElement(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt"); +} +function optgroup(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && next.tagName === "optgroup"; +} +function option(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup"); +} +function menuitem(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "menuitem" || next.tagName === "hr" || next.tagName === "menu"); +} +function thead(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot"); +} +function tbody(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot"); +} +function tfoot(_15, index3, parent) { + return !siblingAfter(parent, index3); +} +function tr(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && next.tagName === "tr"; +} +function cells(_15, index3, parent) { + const next = siblingAfter(parent, index3); + return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th"); +} + +// node_modules/hast-util-to-html/lib/omission/opening.js +var opening = omission({ + html: html5, + head, + body: body2, + colgroup, + tbody: tbody2 +}); +function html5(node2) { + const head2 = siblingAfter(node2, -1); + return !head2 || head2.type !== "comment"; +} +function head(node2) { + const children = node2.children; + const seen = []; + let index3 = -1; + while (++index3 < children.length) { + const child = children[index3]; + if (child.type === "element" && (child.tagName === "title" || child.tagName === "base")) { + if (seen.includes(child.tagName)) + return false; + seen.push(child.tagName); } - }; - const onDrop = (0, import_react109.useCallback)((files) => { - if (isFolder) { - files.map(async (file) => { - file.arrayBuffer().then((arrayBuffer) => { - superstate.spaceManager.writeToPath( - pathState.path + "/" + file.name, - arrayBuffer, - true - ); - }); - }); + } + return children.length > 0; +} +function body2(node2) { + const head2 = siblingAfter(node2, -1, true); + return !head2 || head2.type !== "comment" && !(head2.type === "text" && whitespace(head2.value.charAt(0))) && !(head2.type === "element" && (head2.tagName === "meta" || head2.tagName === "link" || head2.tagName === "script" || head2.tagName === "style" || head2.tagName === "template")); +} +function colgroup(node2, index3, parent) { + const previous2 = siblingBefore(parent, index3); + const head2 = siblingAfter(node2, -1, true); + if (parent && previous2 && previous2.type === "element" && previous2.tagName === "colgroup" && closing(previous2, parent.children.indexOf(previous2), parent)) { + return false; + } + return head2 && head2.type === "element" && head2.tagName === "col"; +} +function tbody2(node2, index3, parent) { + const previous2 = siblingBefore(parent, index3); + const head2 = siblingAfter(node2, -1); + if (parent && previous2 && previous2.type === "element" && (previous2.tagName === "thead" || previous2.tagName === "tbody") && closing(previous2, parent.children.indexOf(previous2), parent)) { + return false; + } + return head2 && head2.type === "element" && head2.tagName === "tr"; +} + +// node_modules/hast-util-to-html/lib/handle/element.js +var constants = { + name: [ + [" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")], + [`\0 +\f\r "&'/<=>`.split(""), "\0 \n\f\r \"&'/<=>`".split("")] + ], + unquoted: [ + [" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")], + ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")] + ], + single: [ + ["&'".split(""), "\"&'`".split("")], + ["\0&'".split(""), "\0\"&'`".split("")] + ], + double: [ + ['"&'.split(""), "\"&'`".split("")], + ['\0"&'.split(""), "\0\"&'`".split("")] + ] +}; +function element2(node2, index3, parent, state) { + const schema = state.schema; + const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags; + let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node2.tagName.toLowerCase()); + const parts = []; + let last; + if (schema.space === "html" && node2.tagName === "svg") { + state.schema = svg2; + } + const attrs = serializeAttributes(state, node2.properties); + const content5 = state.all( + schema.space === "html" && node2.tagName === "template" ? node2.content : node2 + ); + state.schema = schema; + if (content5) + selfClosing = false; + if (attrs || !omit || !opening(node2, index3, parent)) { + parts.push("<", node2.tagName, attrs ? " " + attrs : ""); + if (selfClosing && (schema.space === "svg" || state.settings.closeSelfClosing)) { + last = attrs.charAt(attrs.length - 1); + if (!state.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") { + parts.push(" "); + } + parts.push("/"); } - }, []); - const onDragEnter = (0, import_react109.useCallback)(() => { - if (isFolder) - setDropHighlighted(true); - }, []); - const { getRootProps, getInputProps, isDragActive } = useDropzone({ - onDrop, - onDragEnter, - onDragLeave: () => setDropHighlighted(false), - onDropAccepted: () => setDropHighlighted(false), - onDropRejected: () => setDropHighlighted(false), - noClick: true - }); - const onDragEnded = (e5) => { - dragEnded(e5, data2.id); - }; - const mouseOut = (e5) => { - setHoverTarget(null); - }; - const newAction = (e5) => { - const space2 = superstate.spacesIndex.get(pathState.path); - if (e5.shiftKey) { - const offset2 = e5.target.getBoundingClientRect(); - showLinkMenu( - offset2, - superstate, - (link) => { - pinPathToSpaceAtIndex(superstate, space2, link); - }, - { placeholder: i18n_default.labels.pinNotePlaceholder } - ); - e5.stopPropagation(); - return; + parts.push(">"); + } + parts.push(content5); + if (!selfClosing && (!omit || !closing(node2, index3, parent))) { + parts.push(""); + } + return parts.join(""); +} +function serializeAttributes(state, props) { + const values2 = []; + let index3 = -1; + let key3; + if (props) { + for (key3 in props) { + if (props[key3] !== void 0 && props[key3] !== null) { + const value = serializeAttribute(state, key3, props[key3]); + if (value) + values2.push(value); + } } - defaultAddAction(superstate, space2); - }; - const handleRightClick = (e5) => { - selectedPaths.length > 1 && selectedPaths.some((f2) => f2.id == data2.id) ? triggerMultiPathMenu(superstate, selectedPaths, e5) : contextMenu(e5); - }; - const color2 = pathState?.label?.color; - const contextMenu = (e5) => { - if (superstate.spacesIndex.has(pathState.path)) { - showSpaceContextMenu( - superstate, - pathState, - e5, - activePath, - data2.space, - data2.type == "group" ? () => closeActiveSpace(data2.path) : null - ); - return; + } + while (++index3 < values2.length) { + const last = state.settings.tightAttributes ? values2[index3].charAt(values2[index3].length - 1) : null; + if (index3 !== values2.length - 1 && last !== '"' && last !== "'") { + values2[index3] += " "; } - showPathContextMenu( - superstate, - data2.path, - data2.space, - e5.target.getBoundingClientRect(), - "right" + } + return values2.join(""); +} +function serializeAttribute(state, key3, value) { + const info = find2(state.schema, key3); + const x2 = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1; + const y3 = state.settings.allowDangerousCharacters ? 0 : 1; + let quote = state.quote; + let result; + if (info.overloadedBoolean && (value === info.attribute || value === "")) { + value = true; + } else if (info.boolean || info.overloadedBoolean && typeof value !== "string") { + value = Boolean(value); + } + if (value === void 0 || value === null || value === false || typeof value === "number" && Number.isNaN(value)) { + return ""; + } + const name317 = stringifyEntities( + info.attribute, + Object.assign({}, state.settings.characterReferences, { + subset: constants.name[x2][y3] + }) + ); + if (value === true) + return name317; + value = Array.isArray(value) ? (info.commaSeparated ? stringify3 : stringify4)(value, { + padLeft: !state.settings.tightCommaSeparatedLists + }) : String(value); + if (state.settings.collapseEmptyAttributes && !value) + return name317; + if (state.settings.preferUnquoted) { + result = stringifyEntities( + value, + Object.assign({}, state.settings.characterReferences, { + subset: constants.unquoted[x2][y3], + attribute: true + }) ); - }; - const pathStateUpdated = (payload) => { - if (payload.path == pathState?.path) { - const _pathState = superstate.pathsIndex.get(pathState.path); - if (_pathState) - setPathState(_pathState); + } + if (result !== value) { + if (state.settings.quoteSmart && ccount(value, quote) > ccount(value, state.alternative)) { + quote = state.alternative; } - }; - (0, import_react109.useEffect)(() => { - superstate.eventsDispatcher.addListener( - "pathStateUpdated", - pathStateUpdated + result = quote + stringifyEntities( + value, + Object.assign({}, state.settings.characterReferences, { + subset: (quote === "'" ? constants.single : constants.double)[x2][y3], + attribute: true + }) + ) + quote; + } + return name317 + (result ? "=" + result : result); +} + +// node_modules/hast-util-to-html/lib/handle/text.js +function text5(node2, _15, parent, state) { + return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node2.value : stringifyEntities( + node2.value, + Object.assign({}, state.settings.characterReferences, { + subset: ["<", "&"] + }) + ); +} + +// node_modules/hast-util-to-html/lib/handle/raw.js +function raw(node2, index3, parent, state) { + return state.settings.allowDangerousHtml ? node2.value : text5(node2, index3, parent, state); +} + +// node_modules/hast-util-to-html/lib/handle/root.js +function root2(node2, _1, _22, state) { + return state.all(node2); +} + +// node_modules/hast-util-to-html/lib/handle/index.js +var handle2 = zwitch("type", { + invalid: invalid3, + unknown: unknown2, + handlers: { comment: comment3, doctype, element: element2, raw, root: root2, text: text5 } +}); +function invalid3(node2) { + throw new Error("Expected node, not `" + node2 + "`"); +} +function unknown2(node2) { + throw new Error("Cannot compile unknown node `" + node2.type + "`"); +} + +// node_modules/hast-util-to-html/lib/index.js +function toHtml(tree, options) { + const options_ = options || {}; + const quote = options_.quote || '"'; + const alternative = quote === '"' ? "'" : '"'; + if (quote !== '"' && quote !== "'") { + throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`"); + } + const state = { + one: one2, + all: all3, + settings: { + omitOptionalTags: options_.omitOptionalTags || false, + allowParseErrors: options_.allowParseErrors || false, + allowDangerousCharacters: options_.allowDangerousCharacters || false, + quoteSmart: options_.quoteSmart || false, + preferUnquoted: options_.preferUnquoted || false, + tightAttributes: options_.tightAttributes || false, + upperDoctype: options_.upperDoctype || false, + tightDoctype: options_.tightDoctype || false, + bogusComments: options_.bogusComments || false, + tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false, + tightSelfClosing: options_.tightSelfClosing || false, + collapseEmptyAttributes: options_.collapseEmptyAttributes || false, + allowDangerousHtml: options_.allowDangerousHtml || false, + voids: options_.voids || htmlVoidElements, + characterReferences: options_.characterReferences || options_.entities || {}, + closeSelfClosing: options_.closeSelfClosing || false, + closeEmptyElements: options_.closeEmptyElements || false + }, + schema: options_.space === "svg" ? svg2 : html3, + quote, + alternative + }; + return state.one( + Array.isArray(tree) ? { type: "root", children: tree } : tree, + void 0, + void 0 + ); +} +function one2(node2, index3, parent) { + return handle2(node2, index3, parent, this); +} +function all3(parent) { + const results = []; + const children = parent && parent.children || []; + let index3 = -1; + while (++index3 < children.length) { + results[index3] = this.one(children[index3], index3, parent); + } + return results.join(""); +} + +// node_modules/hast-util-sanitize/lib/schema.js +var defaultSchema = { + strip: ["script"], + clobberPrefix: "user-content-", + clobber: ["name", "id"], + ancestors: { + tbody: ["table"], + tfoot: ["table"], + thead: ["table"], + td: ["table"], + th: ["table"], + tr: ["table"] + }, + protocols: { + href: ["http", "https", "mailto", "xmpp", "irc", "ircs"], + cite: ["http", "https"], + src: ["http", "https"], + longDesc: ["http", "https"] + }, + tagNames: [ + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "br", + "b", + "i", + "strong", + "em", + "a", + "pre", + "code", + "img", + "tt", + "div", + "ins", + "del", + "sup", + "sub", + "p", + "ol", + "ul", + "table", + "thead", + "tbody", + "tfoot", + "blockquote", + "dl", + "dt", + "dd", + "kbd", + "q", + "samp", + "var", + "hr", + "ruby", + "rt", + "rp", + "li", + "tr", + "td", + "th", + "s", + "strike", + "summary", + "details", + "caption", + "figure", + "figcaption", + "abbr", + "bdo", + "cite", + "dfn", + "mark", + "small", + "span", + "time", + "wbr", + "input" + ], + attributes: { + a: ["href"], + img: ["src", "longDesc"], + input: [ + ["type", "checkbox"], + ["disabled", true] + ], + li: [["className", "task-list-item"]], + div: ["itemScope", "itemType"], + blockquote: ["cite"], + del: ["cite"], + ins: ["cite"], + q: ["cite"], + "*": [ + "abbr", + "accept", + "acceptCharset", + "accessKey", + "action", + "align", + "alt", + "ariaDescribedBy", + "ariaHidden", + "ariaLabel", + "ariaLabelledBy", + "axis", + "border", + "cellPadding", + "cellSpacing", + "char", + "charOff", + "charSet", + "checked", + "clear", + "cols", + "colSpan", + "color", + "compact", + "coords", + "dateTime", + "dir", + "disabled", + "encType", + "htmlFor", + "frame", + "headers", + "height", + "hrefLang", + "hSpace", + "isMap", + "id", + "label", + "lang", + "maxLength", + "media", + "method", + "multiple", + "name", + "noHref", + "noShade", + "noWrap", + "open", + "prompt", + "readOnly", + "rel", + "rev", + "rows", + "rowSpan", + "rules", + "scope", + "selected", + "shape", + "size", + "span", + "start", + "summary", + "tabIndex", + "target", + "title", + "type", + "useMap", + "vAlign", + "value", + "vSpace", + "width", + "itemProp" + ] + }, + required: { + input: { + type: "checkbox", + disabled: true + } + } +}; + +// node_modules/hast-util-sanitize/lib/index.js +var own7 = {}.hasOwnProperty; +var nodeSchema = { + root: { children: all4 }, + doctype: handleDoctype, + comment: handleComment, + element: { + tagName: handleTagName, + properties: handleProperties, + children: all4 + }, + text: { value: handleValue }, + "*": { data: allow, position: allow } +}; +function sanitize(node2, schema) { + let ctx = { type: "root", children: [] }; + if (node2 && typeof node2 === "object" && node2.type) { + const replace = one3( + Object.assign({}, defaultSchema, schema || {}), + node2, + [] ); - return () => { - superstate.eventsDispatcher.removeListener( - "pathStateUpdated", - pathStateUpdated - ); - }; - }, []); - const hoverItem = (e5) => { - if (superstate.settings.filePreviewOnHover) { - setHoverTarget(e5.target); - if (e5.ctrlKey || e5.metaKey) { - superstate.ui.openPath(pathState.path, "hover", e5.target); + if (replace) { + if (Array.isArray(replace)) { + if (replace.length === 1) { + ctx = replace[0]; + } else { + ctx.children = replace; + } + } else { + ctx = replace; } } - }; - (0, import_react109.useEffect)(() => { - if (hoverTarget && superstate.settings.filePreviewOnHover) { - window.addEventListener("keydown", onKeyDown); - return () => { - window.removeEventListener("keydown", onKeyDown); - }; + } + return ctx; +} +function one3(schema, node2, stack) { + const type = node2 && node2.type; + const replacement = { type: node2.type }; + let replace; + if (own7.call(nodeSchema, type)) { + let definition3 = nodeSchema[type]; + if (typeof definition3 === "function") { + definition3 = definition3(schema, node2); } - }, [hoverTarget]); - const dropProps = { - onDragOver - }; - const innerProps = { - draggable: true, - onDragStart: onDragStarted, - onDrop: onDragEnded - }; - const isSpace = pathState?.type == "space"; - const isFolder = pathState?.metadata?.isFolder || isSpace; - const extension = pathState?.metadata?.file?.extension; - const isLink = pathState?.parent != data2.space; - const spacing = data2.type == "group" ? 0 : indentationWidth * (depth - 1) + (data2.type == "space" ? 0 : isTouchScreen(props.superstate.ui) ? 30 : 20); - return /* @__PURE__ */ import_react109.default.createElement(import_react109.default.Fragment, null, /* @__PURE__ */ import_react109.default.createElement("div", { - className: (0, import_classnames3.default)( - "mk-tree-wrapper", - data2.type == "group" ? "mk-tree-section" : "", - clone5 && "mk-clone", - ghost && "mk-ghost", - highlighted ? "is-highlighted" : "" - ), - style: color2?.length > 0 ? { - "--label-color": `${color2}`, - "--icon-color": `#ffffff`, - position: "relative" - } : { - "--icon-color": `var(--mk-ui-text-secondary)`, - position: "relative" - }, - ref: innerRef, - onMouseLeave: mouseOut, - onMouseEnter: hoverItem, - onKeyDown, - onClick: (e5) => openPathAtTarget(data2, e5), - onContextMenu: (e5) => handleRightClick(e5), - ...dropProps, - ...innerProps - }, /* @__PURE__ */ import_react109.default.createElement("div", { - className: (0, import_classnames3.default)(isFolder ? "nav-folder" : "nav-file"), - style: { - ...style, - ...dragActive ? { pointerEvents: "none" } : {} - }, - ...!isTouchScreen(props.superstate.ui) ? getRootProps({ className: "dropzone" }) : {} - }, /* @__PURE__ */ import_react109.default.createElement("input", { - ...getInputProps() - }), /* @__PURE__ */ import_react109.default.createElement("div", { - className: (0, import_classnames3.default)( - "mk-tree-item", - "tree-item-self", - isFolder ? "nav-folder-title" : "nav-file-title", - active ? "is-active" : "", - selected ? "is-selected" : "", - indicator || dropHighlighted ? "mk-indicator-row" : "" - ), - style: { - "--spacing": `${spacing}px`, - "--childrenCount": `${data2.type == "space" && !collapsed ? childCount * spaceRowHeight(superstate, false) - 13 : 0}px` - }, - "data-path": pathState?.path - }, data2.type == "space" && /* @__PURE__ */ import_react109.default.createElement(CollapseToggle, { - superstate: props.superstate, - collapsed, - onToggle: (c3, e5) => { - onCollapse(data2, false); - e5.stopPropagation(); + if (definition3) { + const allowed = Object.assign({}, definition3, nodeSchema["*"]); + let key3; + replace = true; + for (key3 in allowed) { + if (own7.call(allowed, key3)) { + const result = allowed[key3](schema, node2[key3], node2, stack); + if (result === false) { + replace = void 0; + replacement[key3] = node2[key3]; + } else if (result !== void 0 && result !== null) { + replacement[key3] = result; + } + } + } } - }), superstate.settings.spacesStickers && pathState && /* @__PURE__ */ import_react109.default.createElement(PathStickerView, { - superstate, - pathState, - editable: true - }), /* @__PURE__ */ import_react109.default.createElement("div", { - className: `mk-tree-text ${isFolder ? "nav-folder-title-content" : "nav-file-title-content"}` - }, pathState?.displayName ?? pathState?.name ?? data2.path), data2.type == "group" && data2.childrenCount > 0 && /* @__PURE__ */ import_react109.default.createElement(CollapseToggle, { - superstate: props.superstate, - collapsed, - onToggle: (c3, e5) => { - onCollapse(data2, false); - e5.stopPropagation(); + } + if (replace) { + return replacement; + } + return replacement.type === "element" && schema.strip && !schema.strip.includes(replacement.tagName) ? replacement.children : void 0; +} +function all4(schema, children, node2, stack) { + const results = []; + if (Array.isArray(children)) { + let index3 = -1; + if (node2.type === "element") { + stack.push(node2.tagName); } - }), /* @__PURE__ */ import_react109.default.createElement("div", { - className: "mk-tree-span" - }), !isSpace && extension != "md" && /* @__PURE__ */ import_react109.default.createElement("span", { - className: "nav-file-tag" - }, extension), !clone5 ? /* @__PURE__ */ import_react109.default.createElement("div", { - className: "mk-folder-buttons" - }, /* @__PURE__ */ import_react109.default.createElement("button", { - "aria-label": i18n_default.buttons.moreOptions, - onClick: (e5) => { - contextMenu(e5); - e5.stopPropagation(); - }, - dangerouslySetInnerHTML: { - __html: superstate.ui.getSticker("ui//options") + while (++index3 < children.length) { + const value = one3(schema, children[index3], stack); + if (value) { + if (Array.isArray(value)) { + results.push(...value); + } else { + results.push(value); + } + } } - }), isSpace && /* @__PURE__ */ import_react109.default.createElement("button", { - "aria-label": i18n_default.buttons.newNote, - onClick: (e5) => { - newAction(e5); - e5.stopPropagation(); - }, - dangerouslySetInnerHTML: { - __html: superstate.ui.getSticker("ui//plus") + if (node2.type === "element") { + stack.pop(); } - })) : /* @__PURE__ */ import_react109.default.createElement(import_react109.default.Fragment, null))))); -}; -TreeItem.displayName = "TreeItem"; + } + return results; +} +function handleDoctype(schema) { + return schema.allowDoctypes ? { name: handleDoctypeName } : void 0; +} +function handleComment(schema) { + return schema.allowComments ? { value: handleCommentValue } : void 0; +} +function handleProperties(schema, properties3, node2, stack) { + const name317 = handleTagName(schema, node2.tagName, node2, stack); + const attrs = schema.attributes || {}; + const reqs = schema.required || {}; + const props = properties3 || {}; + const allowed = Object.assign( + {}, + toPropertyValueMap(attrs["*"]), + toPropertyValueMap(name317 && own7.call(attrs, name317) ? attrs[name317] : []) + ); + const result = {}; + let key3; + for (key3 in props) { + if (own7.call(props, key3)) { + let value = props[key3]; + let definition3; + if (own7.call(allowed, key3)) { + definition3 = allowed[key3]; + } else if (data2(key3) && own7.call(allowed, "data*")) { + definition3 = allowed["data*"]; + } else { + continue; + } + value = Array.isArray(value) ? handlePropertyValues(schema, value, key3, definition3) : handlePropertyValue(schema, value, key3, definition3); + if (value !== void 0 && value !== null) { + result[key3] = value; + } + } + } + if (name317 && own7.call(reqs, name317)) { + for (key3 in reqs[name317]) { + if (!own7.call(result, key3)) { + result[key3] = reqs[name317][key3]; + } + } + } + return result; +} +function handleDoctypeName() { + return "html"; +} +function handleTagName(schema, tagName, _15, stack) { + const name317 = typeof tagName === "string" ? tagName : ""; + let index3 = -1; + if (!name317 || name317 === "*" || schema.tagNames && !schema.tagNames.includes(name317)) { + return false; + } + if (schema.ancestors && own7.call(schema.ancestors, name317)) { + while (++index3 < schema.ancestors[name317].length) { + if (stack.includes(schema.ancestors[name317][index3])) { + return name317; + } + } + return false; + } + return name317; +} +function handleCommentValue(_15, value) { + const result = typeof value === "string" ? value : ""; + const index3 = result.indexOf("-->"); + return index3 < 0 ? result : result.slice(0, index3); +} +function handleValue(_15, value) { + return typeof value === "string" ? value : ""; +} +function allow(_15, value) { + return value; +} +function handlePropertyValues(schema, values2, prop2, definition3) { + let index3 = -1; + const result = []; + while (++index3 < values2.length) { + const value = handlePropertyValue(schema, values2[index3], prop2, definition3); + if (value !== void 0 && value !== null) { + result.push(value); + } + } + return result; +} +function handlePropertyValue(schema, value, prop2, definition3) { + if ((typeof value === "boolean" || typeof value === "number" || typeof value === "string") && safeProtocol(schema, value, prop2) && (definition3.length === 0 || definition3.some( + (allowed) => allowed && typeof allowed === "object" && "flags" in allowed ? allowed.test(String(value)) : allowed === value + ))) { + return schema.clobberPrefix && schema.clobber && schema.clobber.includes(prop2) ? schema.clobberPrefix + value : value; + } +} +function safeProtocol(schema, value, prop2) { + const url = String(value); + const colon = url.indexOf(":"); + const questionMark = url.indexOf("?"); + const numberSign = url.indexOf("#"); + const slash2 = url.indexOf("/"); + const protocols = schema.protocols && own7.call(schema.protocols, prop2) ? schema.protocols[prop2].concat() : []; + let index3 = -1; + if (protocols.length === 0 || colon < 0 || slash2 > -1 && colon > slash2 || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign) { + return true; + } + while (++index3 < protocols.length) { + if (colon === protocols[index3].length && url.slice(0, protocols[index3].length) === protocols[index3]) { + return true; + } + } + return false; +} +function toPropertyValueMap(values2) { + const result = {}; + let index3 = -1; + while (++index3 < values2.length) { + const value = values2[index3]; + if (Array.isArray(value)) { + result[value[0]] = value.slice(1); + } else { + result[value] = []; + } + } + return result; +} +function data2(prop2) { + return prop2.length > 4 && prop2.slice(0, 4).toLowerCase() === "data"; +} -// node_modules/@tanstack/react-virtual/dist/esm/index.js -var React107 = __toESM(require_react(), 1); -var import_react_dom6 = __toESM(require_react_dom(), 1); +// node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +function blockquote2(state, node2) { + const result = { + type: "element", + tagName: "blockquote", + properties: {}, + children: state.wrap(state.all(node2), true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} -// node_modules/@tanstack/virtual-core/dist/esm/utils.js -function memo3(getDeps, fn, opts) { - let deps = opts.initialDeps ?? []; - let result; - return () => { - var _a, _b, _c, _d; - let depTime; - if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) - depTime = Date.now(); - const newDeps = getDeps(); - const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep); - if (!depsChanged) { - return result; +// node_modules/mdast-util-to-hast/lib/handlers/break.js +function hardBreak2(state, node2) { + const result = { type: "element", tagName: "br", properties: {}, children: [] }; + state.patch(node2, result); + return [state.applyData(node2, result), { type: "text", value: "\n" }]; +} + +// node_modules/mdast-util-to-hast/lib/handlers/code.js +function code2(state, node2) { + const value = node2.value ? node2.value + "\n" : ""; + const lang = node2.lang ? node2.lang.match(/^[^ \t]+(?=[ \t]|$)/) : null; + const properties3 = {}; + if (lang) { + properties3.className = ["language-" + lang]; + } + let result = { + type: "element", + tagName: "code", + properties: properties3, + children: [{ type: "text", value }] + }; + if (node2.meta) { + result.data = { meta: node2.meta }; + } + state.patch(node2, result); + result = state.applyData(node2, result); + result = { type: "element", tagName: "pre", properties: {}, children: [result] }; + state.patch(node2, result); + return result; +} + +// node_modules/mdast-util-to-hast/lib/handlers/delete.js +function strikethrough(state, node2) { + const result = { + type: "element", + tagName: "del", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +function emphasis2(state, node2) { + const result = { + type: "element", + tagName: "em", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/micromark-util-sanitize-uri/index.js +function normalizeUri(value) { + const result = []; + let index3 = -1; + let start = 0; + let skip = 0; + while (++index3 < value.length) { + const code3 = value.charCodeAt(index3); + let replace = ""; + if (code3 === 37 && asciiAlphanumeric(value.charCodeAt(index3 + 1)) && asciiAlphanumeric(value.charCodeAt(index3 + 2))) { + skip = 2; + } else if (code3 < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code3))) { + replace = String.fromCharCode(code3); + } + } else if (code3 > 55295 && code3 < 57344) { + const next = value.charCodeAt(index3 + 1); + if (code3 < 56320 && next > 56319 && next < 57344) { + replace = String.fromCharCode(code3, next); + skip = 1; + } else { + replace = "\uFFFD"; + } + } else { + replace = String.fromCharCode(code3); } - deps = newDeps; - let resultTime; - if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) - resultTime = Date.now(); - result = fn(...newDeps); - if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) { - const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; - const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; - const resultFpsPercentage = resultEndTime / 16; - const pad = (str, num) => { - str = String(str); - while (str.length < num) { - str = " " + str; - } - return str; - }; - console.info( - `%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, - ` - font-size: .6rem; - font-weight: bold; - color: hsl(${Math.max( - 0, - Math.min(120 - 120 * resultFpsPercentage, 120) - )}deg 100% 31%);`, - opts == null ? void 0 : opts.key - ); + if (replace) { + result.push(value.slice(start, index3), encodeURIComponent(replace)); + start = index3 + skip + 1; + replace = ""; } - (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result); - return result; + if (skip) { + index3 += skip; + skip = 0; + } + } + return result.join("") + value.slice(start); +} + +// node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +function footnoteReference(state, node2) { + const id3 = String(node2.identifier).toUpperCase(); + const safeId = normalizeUri(id3.toLowerCase()); + const index3 = state.footnoteOrder.indexOf(id3); + let counter; + if (index3 === -1) { + state.footnoteOrder.push(id3); + state.footnoteCounts[id3] = 1; + counter = state.footnoteOrder.length; + } else { + state.footnoteCounts[id3]++; + counter = index3 + 1; + } + const reuseCounter = state.footnoteCounts[id3]; + const link3 = { + type: "element", + tagName: "a", + properties: { + href: "#" + state.clobberPrefix + "fn-" + safeId, + id: state.clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""), + dataFootnoteRef: true, + ariaDescribedBy: ["footnote-label"] + }, + children: [{ type: "text", value: String(counter) }] + }; + state.patch(node2, link3); + const sup = { + type: "element", + tagName: "sup", + properties: {}, + children: [link3] + }; + state.patch(node2, sup); + return state.applyData(node2, sup); +} + +// node_modules/mdast-util-to-hast/lib/handlers/footnote.js +function footnote(state, node2) { + const footnoteById = state.footnoteById; + let no = 1; + while (no in footnoteById) + no++; + const identifier = String(no); + footnoteById[identifier] = { + type: "footnoteDefinition", + identifier, + children: [{ type: "paragraph", children: node2.children }], + position: node2.position + }; + return footnoteReference(state, { + type: "footnoteReference", + identifier, + position: node2.position + }); +} + +// node_modules/mdast-util-to-hast/lib/handlers/heading.js +function heading4(state, node2) { + const result = { + type: "element", + tagName: "h" + node2.depth, + properties: {}, + children: state.all(node2) }; + state.patch(node2, result); + return state.applyData(node2, result); } -function notUndefined(value, msg) { - if (value === void 0) { - throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`); + +// node_modules/mdast-util-to-hast/lib/handlers/html.js +function html6(state, node2) { + if (state.dangerous) { + const result = { type: "raw", value: node2.value }; + state.patch(node2, result); + return state.applyData(node2, result); + } + return null; +} + +// node_modules/mdast-util-to-hast/lib/revert.js +function revert(state, node2) { + const subtype = node2.referenceType; + let suffix = "]"; + if (subtype === "collapsed") { + suffix += "[]"; + } else if (subtype === "full") { + suffix += "[" + (node2.label || node2.identifier) + "]"; + } + if (node2.type === "imageReference") { + return { type: "text", value: "![" + node2.alt + suffix }; + } + const contents = state.all(node2); + const head2 = contents[0]; + if (head2 && head2.type === "text") { + head2.value = "[" + head2.value; } else { - return value; + contents.unshift({ type: "text", value: "[" }); + } + const tail = contents[contents.length - 1]; + if (tail && tail.type === "text") { + tail.value += suffix; + } else { + contents.push({ type: "text", value: suffix }); } + return contents; } -var approxEqual = (a4, b2) => Math.abs(a4 - b2) < 1; -// node_modules/@tanstack/virtual-core/dist/esm/index.js -var defaultKeyExtractor = (index2) => index2; -var defaultRangeExtractor = (range2) => { - const start = Math.max(range2.startIndex - range2.overscan, 0); - const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1); - const arr = []; - for (let i4 = start; i4 <= end; i4++) { - arr.push(i4); +// node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +function imageReference2(state, node2) { + const def = state.definition(node2.identifier); + if (!def) { + return revert(state, node2); } - return arr; -}; -var observeElementRect = (instance, cb) => { - const element = instance.scrollElement; - if (!element) { - return; + const properties3 = { src: normalizeUri(def.url || ""), alt: node2.alt }; + if (def.title !== null && def.title !== void 0) { + properties3.title = def.title; } - const handler = (rect) => { - const { width, height } = rect; - cb({ width: Math.round(width), height: Math.round(height) }); - }; - handler(element.getBoundingClientRect()); - if (typeof ResizeObserver === "undefined") { - return () => { - }; + const result = { type: "element", tagName: "img", properties: properties3, children: [] }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/image.js +function image2(state, node2) { + const properties3 = { src: normalizeUri(node2.url) }; + if (node2.alt !== null && node2.alt !== void 0) { + properties3.alt = node2.alt; } - const observer = new ResizeObserver((entries) => { - const entry = entries[0]; - if (entry == null ? void 0 : entry.borderBoxSize) { - const box = entry.borderBoxSize[0]; - if (box) { - handler({ width: box.inlineSize, height: box.blockSize }); - return; - } - } - handler(element.getBoundingClientRect()); - }); - observer.observe(element, { box: "border-box" }); - return () => { - observer.unobserve(element); + if (node2.title !== null && node2.title !== void 0) { + properties3.title = node2.title; + } + const result = { type: "element", tagName: "img", properties: properties3, children: [] }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +function inlineCode2(state, node2) { + const text7 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") }; + state.patch(node2, text7); + const result = { + type: "element", + tagName: "code", + properties: {}, + children: [text7] }; -}; -var observeElementOffset = (instance, cb) => { - const element = instance.scrollElement; - if (!element) { - return; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +function linkReference2(state, node2) { + const def = state.definition(node2.identifier); + if (!def) { + return revert(state, node2); } - const handler = () => { - cb(element[instance.options.horizontal ? "scrollLeft" : "scrollTop"]); + const properties3 = { href: normalizeUri(def.url || "") }; + if (def.title !== null && def.title !== void 0) { + properties3.title = def.title; + } + const result = { + type: "element", + tagName: "a", + properties: properties3, + children: state.all(node2) }; - handler(); - element.addEventListener("scroll", handler, { - passive: true - }); - return () => { - element.removeEventListener("scroll", handler); + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/link.js +function link2(state, node2) { + const properties3 = { href: normalizeUri(node2.url) }; + if (node2.title !== null && node2.title !== void 0) { + properties3.title = node2.title; + } + const result = { + type: "element", + tagName: "a", + properties: properties3, + children: state.all(node2) }; -}; -var measureElement = (element, entry, instance) => { - if (entry == null ? void 0 : entry.borderBoxSize) { - const box = entry.borderBoxSize[0]; - if (box) { - const size2 = Math.round( - box[instance.options.horizontal ? "inlineSize" : "blockSize"] - ); - return size2; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/list-item.js +function listItem3(state, node2, parent) { + const results = state.all(node2); + const loose = parent ? listLoose(parent) : listItemLoose(node2); + const properties3 = {}; + const children = []; + if (typeof node2.checked === "boolean") { + const head2 = results[0]; + let paragraph3; + if (head2 && head2.type === "element" && head2.tagName === "p") { + paragraph3 = head2; + } else { + paragraph3 = { type: "element", tagName: "p", properties: {}, children: [] }; + results.unshift(paragraph3); + } + if (paragraph3.children.length > 0) { + paragraph3.children.unshift({ type: "text", value: " " }); } + paragraph3.children.unshift({ + type: "element", + tagName: "input", + properties: { type: "checkbox", checked: node2.checked, disabled: true }, + children: [] + }); + properties3.className = ["task-list-item"]; } - return Math.round( - element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"] - ); -}; -var elementScroll = (offset2, { - adjustments = 0, - behavior -}, instance) => { - var _a, _b; - const toOffset = offset2 + adjustments; - (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, { - [instance.options.horizontal ? "left" : "top"]: toOffset, - behavior - }); -}; -var Virtualizer = class { - constructor(opts) { - this.unsubs = []; - this.scrollElement = null; - this.isScrolling = false; - this.isScrollingTimeoutId = null; - this.scrollToIndexTimeoutId = null; - this.measurementsCache = []; - this.itemSizeCache = /* @__PURE__ */ new Map(); - this.pendingMeasuredCacheIndexes = []; - this.scrollDirection = null; - this.scrollAdjustments = 0; - this.measureElementCache = /* @__PURE__ */ new Map(); - this.observer = /* @__PURE__ */ (() => { - let _ro = null; - const get2 = () => { - if (_ro) { - return _ro; - } else if (typeof ResizeObserver !== "undefined") { - return _ro = new ResizeObserver((entries) => { - entries.forEach((entry) => { - this._measureElement(entry.target, entry); - }); - }); - } else { - return null; - } - }; - return { - disconnect: () => { - var _a; - return (_a = get2()) == null ? void 0 : _a.disconnect(); - }, - observe: (target) => { - var _a; - return (_a = get2()) == null ? void 0 : _a.observe(target, { box: "border-box" }); - }, - unobserve: (target) => { - var _a; - return (_a = get2()) == null ? void 0 : _a.unobserve(target); - } - }; - })(); - this.range = null; - this.setOptions = (opts2) => { - Object.entries(opts2).forEach(([key2, value]) => { - if (typeof value === "undefined") - delete opts2[key2]; - }); - this.options = { - debug: false, - initialOffset: 0, - overscan: 1, - paddingStart: 0, - paddingEnd: 0, - scrollPaddingStart: 0, - scrollPaddingEnd: 0, - horizontal: false, - getItemKey: defaultKeyExtractor, - rangeExtractor: defaultRangeExtractor, - onChange: () => { - }, - measureElement, - initialRect: { width: 0, height: 0 }, - scrollMargin: 0, - gap: 0, - scrollingDelay: 150, - indexAttribute: "data-index", - initialMeasurementsCache: [], - lanes: 1, - ...opts2 - }; - }; - this.notify = (sync) => { - var _a, _b; - (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync); - }; - this.maybeNotify = memo3( - () => { - this.calculateRange(); - return [ - this.isScrolling, - this.range ? this.range.startIndex : null, - this.range ? this.range.endIndex : null - ]; - }, - (isScrolling) => { - this.notify(isScrolling); - }, - { - key: false, - debug: () => this.options.debug, - initialDeps: [ - this.isScrolling, - this.range ? this.range.startIndex : null, - this.range ? this.range.endIndex : null - ] - } - ); - this.cleanup = () => { - this.unsubs.filter(Boolean).forEach((d4) => d4()); - this.unsubs = []; - this.scrollElement = null; - }; - this._didMount = () => { - this.measureElementCache.forEach(this.observer.observe); - return () => { - this.observer.disconnect(); - this.cleanup(); - }; - }; - this._willUpdate = () => { - const scrollElement = this.options.getScrollElement(); - if (this.scrollElement !== scrollElement) { - this.cleanup(); - this.scrollElement = scrollElement; - this._scrollToOffset(this.scrollOffset, { - adjustments: void 0, - behavior: void 0 - }); - this.unsubs.push( - this.options.observeElementRect(this, (rect) => { - this.scrollRect = rect; - this.maybeNotify(); - }) - ); - this.unsubs.push( - this.options.observeElementOffset(this, (offset2) => { - this.scrollAdjustments = 0; - if (this.scrollOffset === offset2) { - return; - } - if (this.isScrollingTimeoutId !== null) { - clearTimeout(this.isScrollingTimeoutId); - this.isScrollingTimeoutId = null; - } - this.isScrolling = true; - this.scrollDirection = this.scrollOffset < offset2 ? "forward" : "backward"; - this.scrollOffset = offset2; - this.maybeNotify(); - this.isScrollingTimeoutId = setTimeout(() => { - this.isScrollingTimeoutId = null; - this.isScrolling = false; - this.scrollDirection = null; - this.maybeNotify(); - }, this.options.scrollingDelay); - }) - ); - } + let index3 = -1; + while (++index3 < results.length) { + const child = results[index3]; + if (loose || index3 !== 0 || child.type !== "element" || child.tagName !== "p") { + children.push({ type: "text", value: "\n" }); + } + if (child.type === "element" && child.tagName === "p" && !loose) { + children.push(...child.children); + } else { + children.push(child); + } + } + const tail = results[results.length - 1]; + if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) { + children.push({ type: "text", value: "\n" }); + } + const result = { type: "element", tagName: "li", properties: properties3, children }; + state.patch(node2, result); + return state.applyData(node2, result); +} +function listLoose(node2) { + let loose = false; + if (node2.type === "list") { + loose = node2.spread || false; + const children = node2.children; + let index3 = -1; + while (!loose && ++index3 < children.length) { + loose = listItemLoose(children[index3]); + } + } + return loose; +} +function listItemLoose(node2) { + const spread = node2.spread; + return spread === void 0 || spread === null ? node2.children.length > 1 : spread; +} + +// node_modules/mdast-util-to-hast/lib/handlers/list.js +function list3(state, node2) { + const properties3 = {}; + const results = state.all(node2); + let index3 = -1; + if (typeof node2.start === "number" && node2.start !== 1) { + properties3.start = node2.start; + } + while (++index3 < results.length) { + const child = results[index3]; + if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) { + properties3.className = ["contains-task-list"]; + break; + } + } + const result = { + type: "element", + tagName: node2.ordered ? "ol" : "ul", + properties: properties3, + children: state.wrap(results, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +function paragraph2(state, node2) { + const result = { + type: "element", + tagName: "p", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/root.js +function root3(state, node2) { + const result = { type: "root", children: state.wrap(state.all(node2)) }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/strong.js +function strong2(state, node2) { + const result = { + type: "element", + tagName: "strong", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/unist-util-position/lib/index.js +var pointStart = point3("start"); +var pointEnd = point3("end"); +function position2(node2) { + return { start: pointStart(node2), end: pointEnd(node2) }; +} +function point3(type) { + return point4; + function point4(node2) { + const point5 = node2 && node2.position && node2.position[type] || {}; + return { + line: point5.line || null, + column: point5.column || null, + offset: point5.offset > -1 ? point5.offset : null }; - this.getSize = () => { - return this.scrollRect[this.options.horizontal ? "width" : "height"]; + } +} + +// node_modules/mdast-util-to-hast/lib/handlers/table.js +function table(state, node2) { + const rows = state.all(node2); + const firstRow = rows.shift(); + const tableContent = []; + if (firstRow) { + const head2 = { + type: "element", + tagName: "thead", + properties: {}, + children: state.wrap([firstRow], true) }; - this.memoOptions = memo3( - () => [ - this.options.count, - this.options.paddingStart, - this.options.scrollMargin, - this.options.getItemKey - ], - (count3, paddingStart, scrollMargin, getItemKey) => { - this.pendingMeasuredCacheIndexes = []; - return { - count: count3, - paddingStart, - scrollMargin, - getItemKey - }; - }, - { - key: false - } - ); - this.getFurthestMeasurement = (measurements, index2) => { - const furthestMeasurementsFound = /* @__PURE__ */ new Map(); - const furthestMeasurements = /* @__PURE__ */ new Map(); - for (let m4 = index2 - 1; m4 >= 0; m4--) { - const measurement = measurements[m4]; - if (furthestMeasurementsFound.has(measurement.lane)) { - continue; - } - const previousFurthestMeasurement = furthestMeasurements.get( - measurement.lane - ); - if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) { - furthestMeasurements.set(measurement.lane, measurement); - } else if (measurement.end < previousFurthestMeasurement.end) { - furthestMeasurementsFound.set(measurement.lane, true); - } - if (furthestMeasurementsFound.size === this.options.lanes) { - break; - } - } - return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a4, b2) => { - if (a4.end === b2.end) { - return a4.index - b2.index; - } - return a4.end - b2.end; - })[0] : void 0; + state.patch(node2.children[0], head2); + tableContent.push(head2); + } + if (rows.length > 0) { + const body3 = { + type: "element", + tagName: "tbody", + properties: {}, + children: state.wrap(rows, true) }; - this.getMeasurements = memo3( - () => [this.memoOptions(), this.itemSizeCache], - ({ count: count3, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => { - const min5 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0; - this.pendingMeasuredCacheIndexes = []; - const measurements = this.measurementsCache.slice(0, min5); - for (let i4 = min5; i4 < count3; i4++) { - const key2 = getItemKey(i4); - const furthestMeasurement = this.options.lanes === 1 ? measurements[i4 - 1] : this.getFurthestMeasurement(measurements, i4); - const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin; - const measuredSize = itemSizeCache.get(key2); - const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i4); - const end = start + size2; - const lane = furthestMeasurement ? furthestMeasurement.lane : i4 % this.options.lanes; - measurements[i4] = { - index: i4, - start, - size: size2, - end, - key: key2, - lane + const start = pointStart(node2.children[1]); + const end = pointEnd(node2.children[node2.children.length - 1]); + if (start.line && end.line) + body3.position = { start, end }; + tableContent.push(body3); + } + const result = { + type: "element", + tagName: "table", + properties: {}, + children: state.wrap(tableContent, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/table-row.js +function tableRow(state, node2, parent) { + const siblings2 = parent ? parent.children : void 0; + const rowIndex = siblings2 ? siblings2.indexOf(node2) : 1; + const tagName = rowIndex === 0 ? "th" : "td"; + const align = parent && parent.type === "table" ? parent.align : void 0; + const length = align ? align.length : node2.children.length; + let cellIndex = -1; + const cells2 = []; + while (++cellIndex < length) { + const cell = node2.children[cellIndex]; + const properties3 = {}; + const alignValue = align ? align[cellIndex] : void 0; + if (alignValue) { + properties3.align = alignValue; + } + let result2 = { type: "element", tagName, properties: properties3, children: [] }; + if (cell) { + result2.children = state.all(cell); + state.patch(cell, result2); + result2 = state.applyData(node2, result2); + } + cells2.push(result2); + } + const result = { + type: "element", + tagName: "tr", + properties: {}, + children: state.wrap(cells2, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +function tableCell(state, node2) { + const result = { + type: "element", + tagName: "td", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/trim-lines/index.js +var tab = 9; +var space2 = 32; +function trimLines(value) { + const source = String(value); + const search3 = /\r?\n|\r/g; + let match2 = search3.exec(source); + let last = 0; + const lines = []; + while (match2) { + lines.push( + trimLine(source.slice(last, match2.index), last > 0, true), + match2[0] + ); + last = match2.index + match2[0].length; + match2 = search3.exec(source); + } + lines.push(trimLine(source.slice(last), last > 0, false)); + return lines.join(""); +} +function trimLine(value, start, end) { + let startIndex = 0; + let endIndex = value.length; + if (start) { + let code3 = value.codePointAt(startIndex); + while (code3 === tab || code3 === space2) { + startIndex++; + code3 = value.codePointAt(startIndex); + } + } + if (end) { + let code3 = value.codePointAt(endIndex - 1); + while (code3 === tab || code3 === space2) { + endIndex--; + code3 = value.codePointAt(endIndex - 1); + } + } + return endIndex > startIndex ? value.slice(startIndex, endIndex) : ""; +} + +// node_modules/mdast-util-to-hast/lib/handlers/text.js +function text6(state, node2) { + const result = { type: "text", value: trimLines(String(node2.value)) }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +function thematicBreak3(state, node2) { + const result = { + type: "element", + tagName: "hr", + properties: {}, + children: [] + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/index.js +var handlers = { + blockquote: blockquote2, + break: hardBreak2, + code: code2, + delete: strikethrough, + emphasis: emphasis2, + footnoteReference, + footnote, + heading: heading4, + html: html6, + imageReference: imageReference2, + image: image2, + inlineCode: inlineCode2, + linkReference: linkReference2, + link: link2, + listItem: listItem3, + list: list3, + paragraph: paragraph2, + root: root3, + strong: strong2, + table, + tableCell, + tableRow, + text: text6, + thematicBreak: thematicBreak3, + toml: ignore2, + yaml: ignore2, + definition: ignore2, + footnoteDefinition: ignore2 +}; +function ignore2() { + return null; +} + +// node_modules/unist-util-generated/lib/index.js +function generated(node2) { + return !node2 || !node2.position || !node2.position.start || !node2.position.start.line || !node2.position.start.column || !node2.position.end || !node2.position.end.line || !node2.position.end.column; +} + +// node_modules/mdast-util-definitions/lib/index.js +var own8 = {}.hasOwnProperty; +function definitions(tree) { + const cache2 = /* @__PURE__ */ Object.create(null); + if (!tree || !tree.type) { + throw new Error("mdast-util-definitions expected node"); + } + visit(tree, "definition", (definition4) => { + const id3 = clean(definition4.identifier); + if (id3 && !own8.call(cache2, id3)) { + cache2[id3] = definition4; + } + }); + return definition3; + function definition3(identifier) { + const id3 = clean(identifier); + return id3 && own8.call(cache2, id3) ? cache2[id3] : null; + } +} +function clean(value) { + return String(value || "").toUpperCase(); +} + +// node_modules/mdast-util-to-hast/lib/state.js +var own9 = {}.hasOwnProperty; +function createState(tree, options) { + const settings = options || {}; + const dangerous2 = settings.allowDangerousHtml || false; + const footnoteById = {}; + state.dangerous = dangerous2; + state.clobberPrefix = settings.clobberPrefix === void 0 || settings.clobberPrefix === null ? "user-content-" : settings.clobberPrefix; + state.footnoteLabel = settings.footnoteLabel || "Footnotes"; + state.footnoteLabelTagName = settings.footnoteLabelTagName || "h2"; + state.footnoteLabelProperties = settings.footnoteLabelProperties || { + className: ["sr-only"] + }; + state.footnoteBackLabel = settings.footnoteBackLabel || "Back to content"; + state.unknownHandler = settings.unknownHandler; + state.passThrough = settings.passThrough; + state.handlers = { ...handlers, ...settings.handlers }; + state.definition = definitions(tree); + state.footnoteById = footnoteById; + state.footnoteOrder = []; + state.footnoteCounts = {}; + state.patch = patch; + state.applyData = applyData; + state.one = oneBound; + state.all = allBound; + state.wrap = wrap2; + state.augment = augment; + visit(tree, "footnoteDefinition", (definition3) => { + const id3 = String(definition3.identifier).toUpperCase(); + if (!own9.call(footnoteById, id3)) { + footnoteById[id3] = definition3; + } + }); + return state; + function augment(left, right) { + if (left && "data" in left && left.data) { + const data3 = left.data; + if (data3.hName) { + if (right.type !== "element") { + right = { + type: "element", + tagName: "", + properties: {}, + children: [] }; } - this.measurementsCache = measurements; - return measurements; - }, - { - key: false, - debug: () => this.options.debug - } - ); - this.calculateRange = memo3( - () => [this.getMeasurements(), this.getSize(), this.scrollOffset], - (measurements, outerSize, scrollOffset) => { - return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({ - measurements, - outerSize, - scrollOffset - }) : null; - }, - { - key: false, - debug: () => this.options.debug + right.tagName = data3.hName; } - ); - this.getIndexes = memo3( - () => [ - this.options.rangeExtractor, - this.calculateRange(), - this.options.overscan, - this.options.count - ], - (rangeExtractor, range2, overscan, count3) => { - return range2 === null ? [] : rangeExtractor({ - ...range2, - overscan, - count: count3 - }); - }, - { - key: false, - debug: () => this.options.debug + if (right.type === "element" && data3.hProperties) { + right.properties = { ...right.properties, ...data3.hProperties }; } - ); - this.indexFromElement = (node) => { - const attributeName = this.options.indexAttribute; - const indexStr = node.getAttribute(attributeName); - if (!indexStr) { - console.warn( - `Missing attribute name '${attributeName}={index}' on measured element.` - ); - return -1; + if ("children" in right && right.children && data3.hChildren) { + right.children = data3.hChildren; } - return parseInt(indexStr, 10); - }; - this._measureElement = (node, entry) => { - const item = this.measurementsCache[this.indexFromElement(node)]; - if (!item || !node.isConnected) { - this.measureElementCache.forEach((cached, key2) => { - if (cached === node) { - this.observer.unobserve(node); - this.measureElementCache.delete(key2); - } - }); - return; + } + if (left) { + const ctx = "type" in left ? left : { position: left }; + if (!generated(ctx)) { + right.position = { start: pointStart(ctx), end: pointEnd(ctx) }; } - const prevNode = this.measureElementCache.get(item.key); - if (prevNode !== node) { - if (prevNode) { - this.observer.unobserve(prevNode); - } - this.observer.observe(node); - this.measureElementCache.set(item.key, node); + } + return right; + } + function state(node2, tagName, props, children) { + if (Array.isArray(props)) { + children = props; + props = {}; + } + return augment(node2, { + type: "element", + tagName, + properties: props || {}, + children: children || [] + }); + } + function oneBound(node2, parent) { + return one4(state, node2, parent); + } + function allBound(parent) { + return all5(state, parent); + } +} +function patch(from, to2) { + if (from.position) + to2.position = position2(from); +} +function applyData(from, to2) { + let result = to2; + if (from && from.data) { + const hName = from.data.hName; + const hChildren = from.data.hChildren; + const hProperties = from.data.hProperties; + if (typeof hName === "string") { + if (result.type === "element") { + result.tagName = hName; + } else { + result = { + type: "element", + tagName: hName, + properties: {}, + children: [] + }; } - const measuredItemSize = this.options.measureElement(node, entry, this); - this.resizeItem(item, measuredItemSize); - }; - this.resizeItem = (item, size2) => { - const itemSize = this.itemSizeCache.get(item.key) ?? item.size; - const delta = size2 - itemSize; - if (delta !== 0) { - if (item.start < this.scrollOffset + this.scrollAdjustments) { - if (false) { - console.info("correction", delta); + } + if (result.type === "element" && hProperties) { + result.properties = { ...result.properties, ...hProperties }; + } + if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) { + result.children = hChildren; + } + } + return result; +} +function one4(state, node2, parent) { + const type = node2 && node2.type; + if (!type) { + throw new Error("Expected node, got `" + node2 + "`"); + } + if (own9.call(state.handlers, type)) { + return state.handlers[type](state, node2, parent); + } + if (state.passThrough && state.passThrough.includes(type)) { + return "children" in node2 ? { ...node2, children: all5(state, node2) } : node2; + } + if (state.unknownHandler) { + return state.unknownHandler(state, node2, parent); + } + return defaultUnknownHandler(state, node2); +} +function all5(state, parent) { + const values2 = []; + if ("children" in parent) { + const nodes = parent.children; + let index3 = -1; + while (++index3 < nodes.length) { + const result = one4(state, nodes[index3], parent); + if (result) { + if (index3 && nodes[index3 - 1].type === "break") { + if (!Array.isArray(result) && result.type === "text") { + result.value = result.value.replace(/^\s+/, ""); + } + if (!Array.isArray(result) && result.type === "element") { + const head2 = result.children[0]; + if (head2 && head2.type === "text") { + head2.value = head2.value.replace(/^\s+/, ""); + } } - this._scrollToOffset(this.scrollOffset, { - adjustments: this.scrollAdjustments += delta, - behavior: void 0 - }); } - this.pendingMeasuredCacheIndexes.push(item.index); - this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2)); - this.notify(false); + if (Array.isArray(result)) { + values2.push(...result); + } else { + values2.push(result); + } } - }; - this.measureElement = (node) => { - if (!node) { - return; + } + } + return values2; +} +function defaultUnknownHandler(state, node2) { + const data3 = node2.data || {}; + const result = "value" in node2 && !(own9.call(data3, "hProperties") || own9.call(data3, "hChildren")) ? { type: "text", value: node2.value } : { + type: "element", + tagName: "div", + properties: {}, + children: all5(state, node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} +function wrap2(nodes, loose) { + const result = []; + let index3 = -1; + if (loose) { + result.push({ type: "text", value: "\n" }); + } + while (++index3 < nodes.length) { + if (index3) + result.push({ type: "text", value: "\n" }); + result.push(nodes[index3]); + } + if (loose && nodes.length > 0) { + result.push({ type: "text", value: "\n" }); + } + return result; +} + +// node_modules/mdast-util-to-hast/lib/footer.js +function footer(state) { + const listItems = []; + let index3 = -1; + while (++index3 < state.footnoteOrder.length) { + const def = state.footnoteById[state.footnoteOrder[index3]]; + if (!def) { + continue; + } + const content5 = state.all(def); + const id3 = String(def.identifier).toUpperCase(); + const safeId = normalizeUri(id3.toLowerCase()); + let referenceIndex = 0; + const backReferences = []; + while (++referenceIndex <= state.footnoteCounts[id3]) { + const backReference = { + type: "element", + tagName: "a", + properties: { + href: "#" + state.clobberPrefix + "fnref-" + safeId + (referenceIndex > 1 ? "-" + referenceIndex : ""), + dataFootnoteBackref: true, + className: ["data-footnote-backref"], + ariaLabel: state.footnoteBackLabel + }, + children: [{ type: "text", value: "\u21A9" }] + }; + if (referenceIndex > 1) { + backReference.children.push({ + type: "element", + tagName: "sup", + children: [{ type: "text", value: String(referenceIndex) }] + }); + } + if (backReferences.length > 0) { + backReferences.push({ type: "text", value: " " }); + } + backReferences.push(backReference); + } + const tail = content5[content5.length - 1]; + if (tail && tail.type === "element" && tail.tagName === "p") { + const tailTail = tail.children[tail.children.length - 1]; + if (tailTail && tailTail.type === "text") { + tailTail.value += " "; + } else { + tail.children.push({ type: "text", value: " " }); } - this._measureElement(node, void 0); + tail.children.push(...backReferences); + } else { + content5.push(...backReferences); + } + const listItem4 = { + type: "element", + tagName: "li", + properties: { id: state.clobberPrefix + "fn-" + safeId }, + children: state.wrap(content5, true) }; - this.getVirtualItems = memo3( - () => [this.getIndexes(), this.getMeasurements()], - (indexes, measurements) => { - const virtualItems = []; - for (let k2 = 0, len = indexes.length; k2 < len; k2++) { - const i4 = indexes[k2]; - const measurement = measurements[i4]; - virtualItems.push(measurement); - } - return virtualItems; + state.patch(def, listItem4); + listItems.push(listItem4); + } + if (listItems.length === 0) { + return; + } + return { + type: "element", + tagName: "section", + properties: { dataFootnotes: true, className: ["footnotes"] }, + children: [ + { + type: "element", + tagName: state.footnoteLabelTagName, + properties: { + ...JSON.parse(JSON.stringify(state.footnoteLabelProperties)), + id: "footnote-label" + }, + children: [{ type: "text", value: state.footnoteLabel }] }, + { type: "text", value: "\n" }, { - key: false, - debug: () => this.options.debug - } + type: "element", + tagName: "ol", + properties: {}, + children: state.wrap(listItems, true) + }, + { type: "text", value: "\n" } + ] + }; +} + +// node_modules/mdast-util-to-hast/lib/index.js +function toHast(tree, options) { + const state = createState(tree, options); + const node2 = state.one(tree, null); + const foot = footer(state); + if (foot) { + node2.children.push({ type: "text", value: "\n" }, foot); + } + return Array.isArray(node2) ? { type: "root", children: node2 } : node2; +} + +// node_modules/remark-html/index.js +function remarkHtml(settings = {}) { + const options = { ...settings }; + let clean2; + if (typeof options.sanitize === "boolean") { + clean2 = options.sanitize; + options.sanitize = void 0; + } + if (typeof clean2 !== "boolean") { + clean2 = true; + } + Object.assign(this, { Compiler: compiler2 }); + function compiler2(node2, file) { + const hast = toHast(node2, { + allowDangerousHtml: !clean2, + handlers: options.handlers + }); + const cleanHast = clean2 ? sanitize(hast, options.sanitize) : hast; + const result = toHtml( + cleanHast, + Object.assign({}, options, { allowDangerousHtml: !clean2 }) ); - this.getVirtualItemForOffset = (offset2) => { - const measurements = this.getMeasurements(); - return notUndefined( - measurements[findNearestBinarySearch( - 0, - measurements.length - 1, - (index2) => notUndefined(measurements[index2]).start, - offset2 - )] - ); - }; - this.getOffsetForAlignment = (toOffset, align) => { - const size2 = this.getSize(); - if (align === "auto") { - if (toOffset <= this.scrollOffset) { - align = "start"; - } else if (toOffset >= this.scrollOffset + size2) { - align = "end"; - } else { - align = "start"; + if (file.extname) { + file.extname = ".html"; + } + return node2 && node2.type && node2.type === "root" && result && /[^\r\n]/.test(result.charAt(result.length - 1)) ? result + "\n" : result; + } +} + +// src/core/utils/markdown/mdToHTML.ts +async function markdownToHtml(markdown) { + const result = await remark().use(remarkHtml).process(markdown); + return result.toString(); +} + +// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx +var import_react134 = __toESM(require_react()); + +// src/adapters/obsidian/filetypes/frontmatter/frontMatterKeys.ts +var frontMatterKeys = (fm) => { + return Object.keys(fm ?? {}).filter((f2) => f2 != "position"); +}; + +// src/adapters/obsidian/ui/editors/markdownView/RemoteMarkdownHeaderView.tsx +var import_react133 = __toESM(require_react()); +var RemoteMarkdownHeaderView = (props) => { + const { name: name317, fm } = props; + const [collapsed, setCollapsed] = (0, import_react133.useState)(false); + const tags3 = fm.tags ?? []; + const [values2, setValues] = (0, import_react133.useState)({}); + const [columns, setColumns] = (0, import_react133.useState)([]); + (0, import_react133.useEffect)(() => { + const newCols = []; + const newValues = {}; + const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); + const cols = fmKeys.map((f2) => ({ + table: "", + name: f2, + schemaId: "", + type: yamlTypeToMDBType(detectPropertyType(fm[f2], f2)) + })); + if (fm) { + newCols.push(...cols); + Object.keys(fm).forEach((c3) => { + newValues[c3] = parseProperty(c3, fm[c3]); + }); + } + setValues(newValues); + setColumns(newCols); + }, []); + const pathState = (0, import_react133.useMemo)( + () => ({ + name: name317, + path: name317, + displayName: name317, + type: "note", + label: { + sticker: fm.sticker, + color: fm.color, + name: name317 + }, + metadata: { + property: { + banner: fm.banner } } - if (align === "start") { - toOffset = toOffset; - } else if (align === "end") { - toOffset = toOffset - size2; - } else if (align === "center") { - toOffset = toOffset - size2 / 2; - } - const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight"; - const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0; - const maxOffset = scrollSize - this.getSize(); - return Math.max(Math.min(maxOffset, toOffset), 0); - }; - this.getOffsetForIndex = (index2, align = "auto") => { - index2 = Math.max(0, Math.min(index2, this.options.count - 1)); - const measurement = notUndefined(this.getMeasurements()[index2]); - if (align === "auto") { - if (measurement.end >= this.scrollOffset + this.getSize() - this.options.scrollPaddingEnd) { - align = "end"; - } else if (measurement.start <= this.scrollOffset + this.options.scrollPaddingStart) { - align = "start"; + }), + [fm, name317] + ); + return /* @__PURE__ */ import_react133.default.createElement(PathProvider, { + superstate: props.superstate, + path: props.name, + pathState, + readMode: true + }, pathState.metadata.property.banner && /* @__PURE__ */ import_react133.default.createElement(BannerView, { + superstate: props.superstate + }), /* @__PURE__ */ import_react133.default.createElement("div", { + className: "mk-path-context-component" + }, /* @__PURE__ */ import_react133.default.createElement("div", { + className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` + }, /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react133.default.createElement("div", { + className: "mk-header-icon" + }, /* @__PURE__ */ import_react133.default.createElement("div", { + className: `mk-path-icon` + }, /* @__PURE__ */ import_react133.default.createElement("div", { + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(fm.sticker) + } + }))) : /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null), /* @__PURE__ */ import_react133.default.createElement("div", { + className: "mk-inline-title inline-title" + }, pathNameToString(name317))))), !collapsed ? /* @__PURE__ */ import_react133.default.createElement("div", { + className: "mk-path-context-component" + }, /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null, /* @__PURE__ */ import_react133.default.createElement("div", { + className: "mk-path-context-section" + }, columns.map((f2, i4) => /* @__PURE__ */ import_react133.default.createElement(DataPropertyView, { + key: i4, + superstate: props.superstate, + initialValue: values2[f2.name], + row: {}, + column: { ...f2, table: "" }, + editMode: 2 /* EditModeView */, + updateValue: () => { + }, + updateFieldValue: (fieldValue, value) => { + }, + contextTable: {} + }))))) : /* @__PURE__ */ import_react133.default.createElement(import_react133.default.Fragment, null)); +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx +var FileLinkViewComponent = (props) => { + const ref2 = (0, import_react134.useRef)(null); + const [markdown, setMarkdown] = (0, import_react134.useState)(""); + const [fm, setFM] = (0, import_react134.useState)({}); + (0, import_react134.useEffect)(() => { + markdownToHtml(markdown).then((html7) => { + ref2.current.innerHTML = html7; + }); + }, [markdown]); + (0, import_react134.useEffect)(() => { + if (props.superstate.pathsIndex.get(props.path)) { + props.superstate.spaceManager.readPath(props.path).then((f2) => { + const match2 = f2.match(regexYaml); + if (match2) { + setMarkdown(f2.replace(match2[0], "")); + const yamlContent = match2[1]; + setFM((0, import_obsidian6.parseYaml)(yamlContent)); } else { - return [this.scrollOffset, align]; + setMarkdown(f2); } + }); + return; + } + fetch(props.path).then((res) => res.text()).then((f2) => { + const match2 = f2.match(regexYaml); + if (match2) { + setMarkdown(f2.replace(match2[0], "")); + const yamlContent = match2[1]; + setFM((0, import_obsidian6.parseYaml)(yamlContent)); + } else { + setMarkdown(f2); } - const toOffset = align === "end" ? measurement.end + this.options.scrollPaddingEnd : measurement.start - this.options.scrollPaddingStart; - return [this.getOffsetForAlignment(toOffset, align), align]; + }); + }, [props.path]); + return /* @__PURE__ */ import_react134.default.createElement("div", { + className: (0, import_classnames3.default)( + "markdown-preview-view markdown-rendered node-insert-event allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter", + props.superstate.settings.readableLineWidth ? "is-readable-line-width" : "" + ) + }, !props.flow && /* @__PURE__ */ import_react134.default.createElement("div", { + className: "mk-remote-header" + }, /* @__PURE__ */ import_react134.default.createElement(RemoteMarkdownHeaderView, { + superstate: props.superstate, + name: fm.name ?? props.path, + fm + })), /* @__PURE__ */ import_react134.default.createElement("div", { + className: "markdown-preview-sizer markdown-preview-section", + ref: ref2 + })); +}; + +// src/core/react/components/PathView/PathView.tsx +var import_react145 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Contexts/SpaceView.tsx +var import_react144 = __toESM(require_react()); + +// node_modules/react-error-boundary/dist/react-error-boundary.cjs.mjs +var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1); + +// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx +var import_lodash17 = __toESM(require_lodash()); + +// src/core/react/context/SidebarContext.tsx +var import_lodash16 = __toESM(require_lodash()); +var import_react135 = __toESM(require_react()); +var NavigatorContext = (0, import_react135.createContext)({ + dragPaths: [], + setDragPaths: import_lodash16.default.noop, + selectedPaths: [], + setSelectedPaths: import_lodash16.default.noop, + activePath: null, + setActivePath: import_lodash16.default.noop, + activeViewSpaces: [], + waypoints: [], + setWaypoints: import_lodash16.default.noop, + saveActiveSpace: import_lodash16.default.noop, + closeActiveSpace: import_lodash16.default.noop, + modifier: null, + setModifier: import_lodash16.default.noop +}); +var SidebarProvider = (props) => { + const [modifier, setModifier] = (0, import_react135.useState)(null); + const [dragPaths, setDragPaths] = (0, import_react135.useState)([]); + const [selectedPaths, setSelectedPaths] = (0, import_react135.useState)([]); + const [activePath, setActivePath] = (0, import_react135.useState)(null); + const [waypoints, setWaypoints] = (0, import_react135.useState)( + props.superstate.waypoints + ); + const [activeViewSpaces, setActiveViewSpaces] = (0, import_react135.useState)( + (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2) + ); + const setActiveViewSpaceByPath = (path3) => { + const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; + newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path3), path3]; + if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) { + props.superstate.spaceManager.saveWaypoints([ + ...props.superstate.waypoints, + newWaypoint + ]); + } + const newWaypoints = props.superstate.waypoints.map( + (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2 + ); + props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); + }; + const closeActiveViewSpace = (path3) => { + const newWaypoint = props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; + newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path3)]; + if (props.superstate.settings.currentWaypoint > props.superstate.waypoints.length) { + props.superstate.spaceManager.saveWaypoints([ + ...props.superstate.waypoints, + newWaypoint + ]); + } + const newWaypoints = props.superstate.waypoints.map( + (f2, i4) => i4 == props.superstate.settings.currentWaypoint ? newWaypoint : f2 + ); + props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); + }; + const saveWaypoints = (paths) => { + props.superstate.spaceManager.saveWaypoints(paths.filter((f2) => f2)); + }; + const refreshSpaces = (payload) => { + if (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths?.includes(payload.path)) { + setActiveViewSpaces( + (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)) + ); + } + }; + const reloadPaths = () => { + setWaypoints(props.superstate.waypoints); + setActiveViewSpaces( + (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2) + ); + }; + (0, import_react135.useEffect)(() => { + props.superstate.eventsDispatcher.addListener( + "spaceStateUpdated", + refreshSpaces + ); + props.superstate.eventsDispatcher.addListener( + "settingsChanged", + reloadPaths + ); + props.superstate.eventsDispatcher.addListener( + "superstateUpdated", + reloadPaths + ); + return () => { + props.superstate.eventsDispatcher.removeListener( + "spaceStateUpdated", + refreshSpaces + ); + props.superstate.eventsDispatcher.removeListener( + "settingsChanged", + reloadPaths + ); + props.superstate.eventsDispatcher.removeListener( + "superstateUpdated", + reloadPaths + ); }; - this.isDynamicMode = () => this.measureElementCache.size > 0; - this.cancelScrollToIndex = () => { - if (this.scrollToIndexTimeoutId !== null) { - clearTimeout(this.scrollToIndexTimeoutId); - this.scrollToIndexTimeoutId = null; - } + }, []); + return /* @__PURE__ */ import_react135.default.createElement(NavigatorContext.Provider, { + value: { + dragPaths, + setDragPaths, + selectedPaths, + setSelectedPaths, + activePath, + setActivePath, + activeViewSpaces, + waypoints, + setWaypoints: saveWaypoints, + saveActiveSpace: setActiveViewSpaceByPath, + closeActiveSpace: closeActiveViewSpace, + modifier, + setModifier + } + }, props.children); +}; + +// src/core/types/types.ts +var eventTypes = { + frameSelected: "mkmd-active-frame", + frameLayerSelected: "mkmd-frame-layer", + refreshView: "mkmd-refresh-view", + revealPath: "mkmd-reveal-file", + collapseFolders: "mkmd-collapse-folders", + toggleBacklinks: "mkmd-toggle-backlinks", + metadataChange: "mkmd-tags-change", + vaultChange: "mkmd-vault-change", + mdbChange: "mkmd-mdb-change", + spacesChange: "mkmd-spaces-change", + frameChange: "mkmd-frame-change", + updateSections: "mkmd-update-sections", + settingsChanged: "mkmd-settings-changed" +}; + +// src/core/utils/dnd/dragPath.ts +function getMaxDepth(previousItem, dirDown) { + if (previousItem) { + if (previousItem.item?.type == "space" && !previousItem.collapsed && dirDown) + return previousItem.depth + 1; + return previousItem.depth; + } + return 0; +} +function getMinDepth(previousItem) { + if (previousItem) { + return Math.max(0, previousItem.depth - 1); + } + return 0; +} +function getDragDepth(offset2, indentationWidth) { + return Math.round(offset2 / indentationWidth); +} +var getMultiProjection = (flattenedTree, paths, overIndex, modifier) => { + const overItem = flattenedTree[overIndex]; + if (!overItem) + return; + const dropTarget = overItem.type == "file" ? flattenedTree.find((f2) => f2.id == overItem.parentId) : overItem; + if (dropTarget && dropTarget.type != "file") { + const _projected = { + depth: overItem.depth, + overId: overItem.id, + parentId: dropTarget.id, + sortable: false, + insert: dropTarget.collapsed, + droppable: true, + copy: modifier == "link" || modifier == "copy", + reorder: false }; - this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => { - this.cancelScrollToIndex(); - if (behavior === "smooth" && this.isDynamicMode()) { - console.warn( - "The `smooth` scroll behavior is not fully supported with dynamic size." - ); + return _projected; + } + return null; +}; +function getProjection(activeItem, items, paths, overItemIndex, dragDepth, yOffset, dirDown, modifier, activeSpaceID) { + if (paths.length == 0) + return null; + if (paths.length > 1) + return getMultiProjection(items, paths, overItemIndex, modifier); + const overItem = items[overItemIndex]; + const previousItem = items[overItemIndex]; + const nextItem = items[overItemIndex + 1]; + if (!previousItem) + return; + const previousItemDroppable = previousItem.type != "file"; + const insert2 = activeItem.depth > 0 && overItem.collapsed && previousItemDroppable && (!overItem.sortable || dirDown && yOffset <= 13 || !dirDown && yOffset >= 13); + const sortable = overItem.sortable || previousItemDroppable && !insert2 && nextItem.sortable; + const projectedDepth = dragDepth; + const maxDepth = activeItem.depth == 0 ? 0 : getMaxDepth( + previousItem, + dirDown + ); + const minDepth = getMinDepth(previousItem); + let depth = projectedDepth; + if (projectedDepth >= maxDepth) { + depth = maxDepth; + } else if (projectedDepth < minDepth) { + depth = minDepth; + } + const parentId = getParentId(); + const parent = items.find((f2) => f2.id == parentId); + return { + depth, + overId: previousItem.id, + parentId, + sortable, + insert: insert2, + droppable: parent?.type != "file", + copy: modifier == "link" || modifier == "copy", + reorder: insert2 ? activeItem?.parentId == overItem?.id : activeItem?.parentId == parent?.id || activeItem?.parentId == activeSpaceID + }; + function getParentId() { + if (depth === 0) { + return null; + } + if (!previousItem) { + return null; + } + if (depth === previousItem.depth || depth > previousItem.depth && previousItem.item.type != "space") { + return previousItem.parentId; + } + if (depth > previousItem.depth) { + return previousItem.id; + } + const newParent = items.slice(0, overItemIndex).reverse().find((item) => item.depth === depth)?.parentId; + return newParent ?? null; + } +} + +// src/core/utils/keyboard.ts +var normalizedAltName = () => window.navigator.platform.startsWith("Mac") ? "\u2325" : "Alt"; + +// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx +var import_react139 = __toESM(require_react()); + +// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx +var import_classnames4 = __toESM(require_classnames()); +var import_react137 = __toESM(require_react()); + +// node_modules/react-dropzone/dist/es/index.js +var import_react136 = __toESM(require_react()); +var import_prop_types = __toESM(require_prop_types()); + +// node_modules/tslib/tslib.es6.mjs +function __awaiter(thisArg, _arguments, P3, generator) { + function adopt(value) { + return value instanceof P3 ? value : new P3(function(resolve2) { + resolve2(value); + }); + } + return new (P3 || (P3 = Promise))(function(resolve2, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e5) { + reject(e5); } - this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), { - adjustments: void 0, - behavior - }); - }; - this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => { - index2 = Math.max(0, Math.min(index2, this.options.count - 1)); - this.cancelScrollToIndex(); - if (behavior === "smooth" && this.isDynamicMode()) { - console.warn( - "The `smooth` scroll behavior is not fully supported with dynamic size." - ); + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e5) { + reject(e5); } - const [toOffset, align] = this.getOffsetForIndex(index2, initialAlign); - this._scrollToOffset(toOffset, { adjustments: void 0, behavior }); - if (behavior !== "smooth" && this.isDynamicMode()) { - this.scrollToIndexTimeoutId = setTimeout(() => { - this.scrollToIndexTimeoutId = null; - const elementInDOM = this.measureElementCache.has( - this.options.getItemKey(index2) - ); - if (elementInDOM) { - const [toOffset2] = this.getOffsetForIndex(index2, align); - if (!approxEqual(toOffset2, this.scrollOffset)) { - this.scrollToIndex(index2, { align, behavior }); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body3) { + var _15 = { label: 0, sent: function() { + if (t5[0] & 1) + throw t5[1]; + return t5[1]; + }, trys: [], ops: [] }, f2, y3, t5, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n3) { + return function(v2) { + return step([n3, v2]); + }; + } + function step(op) { + if (f2) + throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_15 = 0)), _15) + try { + if (f2 = 1, y3 && (t5 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t5 = y3["return"]) && t5.call(y3), 0) : y3.next) && !(t5 = t5.call(y3, op[1])).done) + return t5; + if (y3 = 0, t5) + op = [op[0] & 2, t5.value]; + switch (op[0]) { + case 0: + case 1: + t5 = op; + break; + case 4: + _15.label++; + return { value: op[1], done: false }; + case 5: + _15.label++; + y3 = op[1]; + op = [0]; + continue; + case 7: + op = _15.ops.pop(); + _15.trys.pop(); + continue; + default: + if (!(t5 = _15.trys, t5 = t5.length > 0 && t5[t5.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _15 = 0; + continue; } - } else { - this.scrollToIndex(index2, { align, behavior }); - } - }); + if (op[0] === 3 && (!t5 || op[1] > t5[0] && op[1] < t5[3])) { + _15.label = op[1]; + break; + } + if (op[0] === 6 && _15.label < t5[1]) { + _15.label = t5[1]; + t5 = op; + break; + } + if (t5 && _15.label < t5[2]) { + _15.label = t5[2]; + _15.ops.push(op); + break; + } + if (t5[2]) + _15.ops.pop(); + _15.trys.pop(); + continue; + } + op = body3.call(thisArg, _15); + } catch (e5) { + op = [6, e5]; + y3 = 0; + } finally { + f2 = t5 = 0; } - }; - this.scrollBy = (delta, { behavior } = {}) => { - this.cancelScrollToIndex(); - if (behavior === "smooth" && this.isDynamicMode()) { - console.warn( - "The `smooth` scroll behavior is not fully supported with dynamic size." - ); + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } +} +function __read(o2, n3) { + var m4 = typeof Symbol === "function" && o2[Symbol.iterator]; + if (!m4) + return o2; + var i4 = m4.call(o2), r2, ar = [], e5; + try { + while ((n3 === void 0 || n3-- > 0) && !(r2 = i4.next()).done) + ar.push(r2.value); + } catch (error) { + e5 = { error }; + } finally { + try { + if (r2 && !r2.done && (m4 = i4["return"])) + m4.call(i4); + } finally { + if (e5) + throw e5.error; + } + } + return ar; +} +function __spreadArray2(to2, from, pack) { + if (pack || arguments.length === 2) + for (var i4 = 0, l2 = from.length, ar; i4 < l2; i4++) { + if (ar || !(i4 in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i4); + ar[i4] = from[i4]; } - this._scrollToOffset(this.scrollOffset + delta, { - adjustments: void 0, - behavior + } + return to2.concat(ar || Array.prototype.slice.call(from)); +} + +// node_modules/file-selector/dist/es5/file.js +var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([ + ["aac", "audio/aac"], + ["abw", "application/x-abiword"], + ["arc", "application/x-freearc"], + ["avif", "image/avif"], + ["avi", "video/x-msvideo"], + ["azw", "application/vnd.amazon.ebook"], + ["bin", "application/octet-stream"], + ["bmp", "image/bmp"], + ["bz", "application/x-bzip"], + ["bz2", "application/x-bzip2"], + ["cda", "application/x-cdf"], + ["csh", "application/x-csh"], + ["css", "text/css"], + ["csv", "text/csv"], + ["doc", "application/msword"], + ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"], + ["eot", "application/vnd.ms-fontobject"], + ["epub", "application/epub+zip"], + ["gz", "application/gzip"], + ["gif", "image/gif"], + ["heic", "image/heic"], + ["heif", "image/heif"], + ["htm", "text/html"], + ["html", "text/html"], + ["ico", "image/vnd.microsoft.icon"], + ["ics", "text/calendar"], + ["jar", "application/java-archive"], + ["jpeg", "image/jpeg"], + ["jpg", "image/jpeg"], + ["js", "text/javascript"], + ["json", "application/json"], + ["jsonld", "application/ld+json"], + ["mid", "audio/midi"], + ["midi", "audio/midi"], + ["mjs", "text/javascript"], + ["mp3", "audio/mpeg"], + ["mp4", "video/mp4"], + ["mpeg", "video/mpeg"], + ["mpkg", "application/vnd.apple.installer+xml"], + ["odp", "application/vnd.oasis.opendocument.presentation"], + ["ods", "application/vnd.oasis.opendocument.spreadsheet"], + ["odt", "application/vnd.oasis.opendocument.text"], + ["oga", "audio/ogg"], + ["ogv", "video/ogg"], + ["ogx", "application/ogg"], + ["opus", "audio/opus"], + ["otf", "font/otf"], + ["png", "image/png"], + ["pdf", "application/pdf"], + ["php", "application/x-httpd-php"], + ["ppt", "application/vnd.ms-powerpoint"], + ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"], + ["rar", "application/vnd.rar"], + ["rtf", "application/rtf"], + ["sh", "application/x-sh"], + ["svg", "image/svg+xml"], + ["swf", "application/x-shockwave-flash"], + ["tar", "application/x-tar"], + ["tif", "image/tiff"], + ["tiff", "image/tiff"], + ["ts", "video/mp2t"], + ["ttf", "font/ttf"], + ["txt", "text/plain"], + ["vsd", "application/vnd.visio"], + ["wav", "audio/wav"], + ["weba", "audio/webm"], + ["webm", "video/webm"], + ["webp", "image/webp"], + ["woff", "font/woff"], + ["woff2", "font/woff2"], + ["xhtml", "application/xhtml+xml"], + ["xls", "application/vnd.ms-excel"], + ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], + ["xml", "application/xml"], + ["xul", "application/vnd.mozilla.xul+xml"], + ["zip", "application/zip"], + ["7z", "application/x-7z-compressed"], + ["mkv", "video/x-matroska"], + ["mov", "video/quicktime"], + ["msg", "application/vnd.ms-outlook"] +]); +function toFileWithPath(file, path3) { + var f2 = withMimeType(file); + if (typeof f2.path !== "string") { + var webkitRelativePath = file.webkitRelativePath; + Object.defineProperty(f2, "path", { + value: typeof path3 === "string" ? path3 : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name, + writable: false, + configurable: false, + enumerable: true + }); + } + return f2; +} +function withMimeType(file) { + var name317 = file.name; + var hasExtension = name317 && name317.lastIndexOf(".") !== -1; + if (hasExtension && !file.type) { + var ext = name317.split(".").pop().toLowerCase(); + var type = COMMON_MIME_TYPES.get(ext); + if (type) { + Object.defineProperty(file, "type", { + value: type, + writable: false, + configurable: false, + enumerable: true }); - }; - this.getTotalSize = () => { - var _a; - const measurements = this.getMeasurements(); - let end; - if (measurements.length === 0) { - end = this.options.paddingStart; - } else { - end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max( - ...measurements.slice(-this.options.lanes).map((m4) => m4.end) - ); + } + } + return file; +} + +// node_modules/file-selector/dist/es5/file-selector.js +var FILES_TO_IGNORE = [ + ".DS_Store", + "Thumbs.db" +]; +function fromEvent(evt) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + if (isObject3(evt) && isDataTransfer(evt.dataTransfer)) { + return [2, getDataTransferFiles(evt.dataTransfer, evt.type)]; + } else if (isChangeEvt(evt)) { + return [2, getInputFiles(evt)]; + } else if (Array.isArray(evt) && evt.every(function(item) { + return "getFile" in item && typeof item.getFile === "function"; + })) { + return [2, getFsHandleFiles(evt)]; } - return end - this.options.scrollMargin + this.options.paddingEnd; - }; - this._scrollToOffset = (offset2, { - adjustments, - behavior - }) => { - this.options.scrollToFn(offset2, { behavior, adjustments }, this); - }; - this.measure = () => { - this.itemSizeCache = /* @__PURE__ */ new Map(); - this.notify(false); - }; - this.setOptions(opts); - this.scrollRect = this.options.initialRect; - this.scrollOffset = this.options.initialOffset; - this.measurementsCache = this.options.initialMeasurementsCache; - this.measurementsCache.forEach((item) => { - this.itemSizeCache.set(item.key, item.size); + return [2, []]; + }); + }); +} +function isDataTransfer(value) { + return isObject3(value); +} +function isChangeEvt(value) { + return isObject3(value) && isObject3(value.target); +} +function isObject3(v2) { + return typeof v2 === "object" && v2 !== null; +} +function getInputFiles(evt) { + return fromList(evt.target.files).map(function(file) { + return toFileWithPath(file); + }); +} +function getFsHandleFiles(handles) { + return __awaiter(this, void 0, void 0, function() { + var files; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, Promise.all(handles.map(function(h3) { + return h3.getFile(); + }))]; + case 1: + files = _a.sent(); + return [2, files.map(function(file) { + return toFileWithPath(file); + })]; + } + }); + }); +} +function getDataTransferFiles(dt2, type) { + return __awaiter(this, void 0, void 0, function() { + var items, files; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!dt2.items) + return [3, 2]; + items = fromList(dt2.items).filter(function(item) { + return item.kind === "file"; + }); + if (type !== "drop") { + return [2, items]; + } + return [4, Promise.all(items.map(toFilePromises))]; + case 1: + files = _a.sent(); + return [2, noIgnoredFiles(flatten3(files))]; + case 2: + return [2, noIgnoredFiles(fromList(dt2.files).map(function(file) { + return toFileWithPath(file); + }))]; + } + }); + }); +} +function noIgnoredFiles(files) { + return files.filter(function(file) { + return FILES_TO_IGNORE.indexOf(file.name) === -1; + }); +} +function fromList(items) { + if (items === null) { + return []; + } + var files = []; + for (var i4 = 0; i4 < items.length; i4++) { + var file = items[i4]; + files.push(file); + } + return files; +} +function toFilePromises(item) { + if (typeof item.webkitGetAsEntry !== "function") { + return fromDataTransferItem(item); + } + var entry = item.webkitGetAsEntry(); + if (entry && entry.isDirectory) { + return fromDirEntry(entry); + } + return fromDataTransferItem(item); +} +function flatten3(items) { + return items.reduce(function(acc, files) { + return __spreadArray2(__spreadArray2([], __read(acc), false), __read(Array.isArray(files) ? flatten3(files) : [files]), false); + }, []); +} +function fromDataTransferItem(item) { + var file = item.getAsFile(); + if (!file) { + return Promise.reject("".concat(item, " is not a File")); + } + var fwp = toFileWithPath(file); + return Promise.resolve(fwp); +} +function fromEntry(entry) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)]; + }); + }); +} +function fromDirEntry(entry) { + var reader = entry.createReader(); + return new Promise(function(resolve2, reject) { + var entries = []; + function readEntries() { + var _this = this; + reader.readEntries(function(batch) { + return __awaiter(_this, void 0, void 0, function() { + var files, err_1, items; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!!batch.length) + return [3, 5]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, Promise.all(entries)]; + case 2: + files = _a.sent(); + resolve2(files); + return [3, 4]; + case 3: + err_1 = _a.sent(); + reject(err_1); + return [3, 4]; + case 4: + return [3, 6]; + case 5: + items = Promise.all(batch.map(fromEntry)); + entries.push(items); + readEntries(); + _a.label = 6; + case 6: + return [2]; + } + }); + }); + }, function(err) { + reject(err); + }); + } + readEntries(); + }); +} +function fromFileEntry(entry) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, new Promise(function(resolve2, reject) { + entry.file(function(file) { + var fwp = toFileWithPath(file, entry.fullPath); + resolve2(fwp); + }, function(err) { + reject(err); + }); + })]; }); - this.maybeNotify(); + }); +} + +// node_modules/react-dropzone/dist/es/utils/index.js +var import_attr_accept = __toESM(require_es()); +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) + return Array.from(iter); +} +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) + return _arrayLikeToArray(arr); +} +function ownKeys4(object, enumerableOnly) { + var keys2 = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys2.push.apply(keys2, symbols); } -}; -var findNearestBinarySearch = (low, high, getCurrentValue, value) => { - while (low <= high) { - const middle = (low + high) / 2 | 0; - const currentValue = getCurrentValue(middle); - if (currentValue < value) { - low = middle + 1; - } else if (currentValue > value) { - high = middle - 1; - } else { - return middle; - } + return keys2; +} +function _objectSpread4(target) { + for (var i4 = 1; i4 < arguments.length; i4++) { + var source = null != arguments[i4] ? arguments[i4] : {}; + i4 % 2 ? ownKeys4(Object(source), true).forEach(function(key3) { + _defineProperty2(target, key3, source[key3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key3) { + Object.defineProperty(target, key3, Object.getOwnPropertyDescriptor(source, key3)); + }); } - if (low > 0) { - return low - 1; + return target; +} +function _defineProperty2(obj, key3, value) { + if (key3 in obj) { + Object.defineProperty(obj, key3, { value, enumerable: true, configurable: true, writable: true }); } else { - return 0; + obj[key3] = value; } -}; -function calculateRange({ - measurements, - outerSize, - scrollOffset -}) { - const count3 = measurements.length - 1; - const getOffset = (index2) => measurements[index2].start; - const startIndex = findNearestBinarySearch(0, count3, getOffset, scrollOffset); - let endIndex = startIndex; - while (endIndex < count3 && measurements[endIndex].end < scrollOffset + outerSize) { - endIndex++; + return obj; +} +function _slicedToArray(arr, i4) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(o2, minLen) { + if (!o2) + return; + if (typeof o2 === "string") + return _arrayLikeToArray(o2, minLen); + var n3 = Object.prototype.toString.call(o2).slice(8, -1); + if (n3 === "Object" && o2.constructor) + n3 = o2.constructor.name; + if (n3 === "Map" || n3 === "Set") + return Array.from(o2); + if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3)) + return _arrayLikeToArray(o2, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) + len = arr.length; + for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { + arr2[i4] = arr[i4]; } - return { startIndex, endIndex }; + return arr2; } - -// node_modules/@tanstack/react-virtual/dist/esm/index.js -var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? React107.useLayoutEffect : React107.useEffect; -function useVirtualizerBase(options) { - const rerender = React107.useReducer(() => ({}), {})[1]; - const resolvedOptions = { - ...options, - onChange: (instance2, sync) => { - var _a; - if (sync) { - (0, import_react_dom6.flushSync)(rerender); - } else { - rerender(); - } - (_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync); +function _iterableToArrayLimit(arr, i4) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + if (_i == null) + return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i4 && _arr.length === i4) + break; } - }; - const [instance] = React107.useState( - () => new Virtualizer(resolvedOptions) - ); - instance.setOptions(resolvedOptions); - React107.useEffect(() => { - return instance._didMount(); - }, []); - useIsomorphicLayoutEffect3(() => { - return instance._willUpdate(); - }); - return instance; + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) + _i["return"](); + } finally { + if (_d) + throw _e; + } + } + return _arr; } -function useVirtualizer(options) { - return useVirtualizerBase({ - observeElementRect, - observeElementOffset, - scrollToFn: elementScroll, - ...options - }); +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) + return arr; } - -// src/core/react/components/Navigator/SpaceTree/SpaceTreeVirtualized.tsx -var import_react110 = __toESM(require_react()); -var VirtualizedList = import_react110.default.memo(function VirtualizedList2(props) { - const { - flattenedTree, - rowHeights, - projected, - vRef, - selectedPaths, - activePath, - selectRange: selectRange2, - handleCollapse, - superstate, - overIndex, - activeIndex, - indentationWidth - } = props; - const parentRef = import_react110.default.useRef(null); - const rowVirtualizer = useVirtualizer({ - count: flattenedTree.length, - paddingEnd: 24, - getScrollElement: () => parentRef.current, - estimateSize: import_react110.default.useCallback((index2) => rowHeights[index2], [rowHeights]), - overscan: 0 - }); - vRef.current = rowVirtualizer; - const { saveActiveSpace } = (0, import_react110.useContext)(NavigatorContext); - const dropIndicator = (index2) => { - return overIndex == index2 && projected && projected.insert; +var FILE_INVALID_TYPE = "file-invalid-type"; +var FILE_TOO_LARGE = "file-too-large"; +var FILE_TOO_SMALL = "file-too-small"; +var TOO_MANY_FILES = "too-many-files"; +var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) { + accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept; + var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept; + return { + code: FILE_INVALID_TYPE, + message: "File type must be ".concat(messageSuffix) }; - const highlighted = (index2) => { - if (!projected || !flattenedTree[index2] || !projected?.droppable) - return false; - return !projected.sortable && !projected.insert && flattenedTree[index2].parentId && flattenedTree[index2].parentId.startsWith(projected.parentId) || flattenedTree[index2].id == projected.parentId; +}; +var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) { + return { + code: FILE_TOO_LARGE, + message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes") }; - const heightBetweenIndex = (start, end) => { - if (start > end) - return rowHeights.slice(end, start).reduce((p, c3) => p + c3, 0); - return -rowHeights.slice(start, end).reduce((p, c3) => p + c3, 0); +}; +var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) { + return { + code: FILE_TOO_SMALL, + message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes") }; - const calcYOffset = (index2) => { - if (!projected) - return 0; - if (projected.insert) { - if (projected.copy && !projected.reorder) - return 0; - if (index2 > activeIndex) { - return -rowHeights[index2]; - } else if (index2 == activeIndex) { - return heightBetweenIndex(overIndex, activeIndex); - } else { - return 0; +}; +var TOO_MANY_FILES_REJECTION = { + code: TOO_MANY_FILES, + message: "Too many files" +}; +function fileAccepted(file, accept) { + var isAcceptable = file.type === "application/x-moz-file" || (0, import_attr_accept.default)(file, accept); + return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)]; +} +function fileMatchSize(file, minSize, maxSize) { + if (isDefined2(file.size)) { + if (isDefined2(minSize) && isDefined2(maxSize)) { + if (file.size > maxSize) + return [false, getTooLargeRejectionErr(maxSize)]; + if (file.size < minSize) + return [false, getTooSmallRejectionErr(minSize)]; + } else if (isDefined2(minSize) && file.size < minSize) + return [false, getTooSmallRejectionErr(minSize)]; + else if (isDefined2(maxSize) && file.size > maxSize) + return [false, getTooLargeRejectionErr(maxSize)]; + } + return [true, null]; +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function allFilesAccepted(_ref) { + var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator; + if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) { + return false; + } + return files.every(function(file) { + var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray(_fileAccepted, 1), accepted = _fileAccepted2[0]; + var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0]; + var customErrors = validator ? validator(file) : null; + return accepted && sizeMatch && !customErrors; + }); +} +function isPropagationStopped(event) { + if (typeof event.isPropagationStopped === "function") { + return event.isPropagationStopped(); + } else if (typeof event.cancelBubble !== "undefined") { + return event.cancelBubble; + } + return false; +} +function isEvtWithFiles(event) { + if (!event.dataTransfer) { + return !!event.target && !!event.target.files; + } + return Array.prototype.some.call(event.dataTransfer.types, function(type) { + return type === "Files" || type === "application/x-moz-file"; + }); +} +function onDocumentDragOver(event) { + event.preventDefault(); +} +function isIe(userAgent) { + return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1; +} +function isEdge(userAgent) { + return userAgent.indexOf("Edge/") !== -1; +} +function isIeOrEdge() { + var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent; + return isIe(userAgent) || isEdge(userAgent); +} +function composeEventHandlers() { + for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { + fns[_key] = arguments[_key]; + } + return function(event) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + return fns.some(function(fn) { + if (!isPropagationStopped(event) && fn) { + fn.apply(void 0, [event].concat(args)); } - } else if (projected.sortable) { - const targetIndex = overIndex < activeIndex ? overIndex : overIndex; - if (projected.copy && !projected.reorder) { - if (index2 == activeIndex) { - return heightBetweenIndex(targetIndex, activeIndex); - } else if (index2 >= targetIndex) { - return rowHeights[index2]; - } else { - return 0; - } + return isPropagationStopped(event); + }); + }; +} +function canUseFileSystemAccessAPI() { + return "showOpenFilePicker" in window; +} +function pickerOptionsFromAccept(accept) { + if (isDefined2(accept)) { + var acceptForPicker = Object.entries(accept).filter(function(_ref2) { + var _ref3 = _slicedToArray(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1]; + var ok2 = true; + if (!isMIMEType(mimeType)) { + console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')); + ok2 = false; } - if (index2 == activeIndex) { - return heightBetweenIndex(targetIndex, activeIndex); - } else if (index2 > activeIndex && index2 <= targetIndex) { - return -rowHeights[index2]; - } else if (index2 < activeIndex && index2 >= targetIndex) { - return rowHeights[index2]; - } else { - return 0; + if (!Array.isArray(ext) || !ext.every(isExt)) { + console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.')); + ok2 = false; } + return ok2; + }).reduce(function(agg, _ref4) { + var _ref5 = _slicedToArray(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1]; + return _objectSpread4(_objectSpread4({}, agg), {}, _defineProperty2({}, mimeType, ext)); + }, {}); + return [{ + description: "Files", + accept: acceptForPicker + }]; + } + return accept; +} +function acceptPropAsAcceptAttr(accept) { + if (isDefined2(accept)) { + return Object.entries(accept).reduce(function(a4, _ref6) { + var _ref7 = _slicedToArray(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1]; + return [].concat(_toConsumableArray(a4), [mimeType], _toConsumableArray(ext)); + }, []).filter(function(v2) { + return isMIMEType(v2) || isExt(v2); + }).join(","); + } + return void 0; +} +function isAbort(v2) { + return v2 instanceof DOMException && (v2.name === "AbortError" || v2.code === v2.ABORT_ERR); +} +function isSecurityError(v2) { + return v2 instanceof DOMException && (v2.name === "SecurityError" || v2.code === v2.SECURITY_ERR); +} +function isMIMEType(v2) { + return v2 === "audio/*" || v2 === "video/*" || v2 === "image/*" || v2 === "text/*" || /\w+\/[-+.\w]+/g.test(v2); +} +function isExt(v2) { + return /^.*\.[\w]+$/.test(v2); +} + +// node_modules/react-dropzone/dist/es/index.js +var _excluded2 = ["children"]; +var _excluded22 = ["open"]; +var _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"]; +var _excluded4 = ["refKey", "onChange", "onClick"]; +function _toConsumableArray2(arr) { + return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2(); +} +function _nonIterableSpread2() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _iterableToArray2(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) + return Array.from(iter); +} +function _arrayWithoutHoles2(arr) { + if (Array.isArray(arr)) + return _arrayLikeToArray2(arr); +} +function _slicedToArray2(arr, i4) { + return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _unsupportedIterableToArray2(arr, i4) || _nonIterableRest2(); +} +function _nonIterableRest2() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray2(o2, minLen) { + if (!o2) + return; + if (typeof o2 === "string") + return _arrayLikeToArray2(o2, minLen); + var n3 = Object.prototype.toString.call(o2).slice(8, -1); + if (n3 === "Object" && o2.constructor) + n3 = o2.constructor.name; + if (n3 === "Map" || n3 === "Set") + return Array.from(o2); + if (n3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3)) + return _arrayLikeToArray2(o2, minLen); +} +function _arrayLikeToArray2(arr, len) { + if (len == null || len > arr.length) + len = arr.length; + for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { + arr2[i4] = arr[i4]; + } + return arr2; +} +function _iterableToArrayLimit2(arr, i4) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + if (_i == null) + return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i4 && _arr.length === i4) + break; } - }; - return /* @__PURE__ */ import_react110.default.createElement("div", { - ref: parentRef, - style: { - width: `100%`, - height: `100%`, - overflow: "auto", - "--spaceRowHeight": spaceRowHeight(superstate, false) + "px" - } - }, /* @__PURE__ */ import_react110.default.createElement("div", { - style: { - height: `${rowVirtualizer.getTotalSize()}px`, - width: "100%", - position: "relative" - } - }, rowVirtualizer.getVirtualItems().map((virtualRow) => /* @__PURE__ */ import_react110.default.createElement("div", { - key: virtualRow.index, - style: { - position: "absolute", - top: 0, - left: 0, - width: "100%", - height: `${rowHeights[virtualRow.index]}px`, - transform: `translateY(${virtualRow.start}px)` - } - }, flattenedTree[virtualRow.index].type == "new" ? /* @__PURE__ */ import_react110.default.createElement("div", { - className: "mk-tree-wrapper mk-tree-section", - onClick: (e5) => { - const offset2 = e5.target.getBoundingClientRect(); - showSpacesMenu( - offset2, - props.superstate, - (link, isNew) => { - if (isNew) { - createSpace(props.superstate, link, {}).then((f2) => { - saveActiveSpace(link); - props.superstate.ui.openPath(link, false); - }); - return; - } - saveActiveSpace(link); - }, - true, - true - ); - } - }, /* @__PURE__ */ import_react110.default.createElement("div", { - className: "mk-tree-item tree-item-self nav-folder-title mk-tree-new" - }, /* @__PURE__ */ import_react110.default.createElement("div", { - className: `mk-path-icon mk-path-icon-placeholder`, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) + _i["return"](); + } finally { + if (_d) + throw _e; } - }), /* @__PURE__ */ import_react110.default.createElement("div", { - className: "mk-tree-text nav-folder-title-content" - }, i18n_default.menu.openSpace))) : /* @__PURE__ */ import_react110.default.createElement(TreeItem, { - key: flattenedTree[virtualRow.index].id, - id: flattenedTree[virtualRow.index].id, - data: flattenedTree[virtualRow.index], - disabled: false, - depth: flattenedTree[virtualRow.index].depth, - childCount: flattenedTree[virtualRow.index].childrenCount, - indentationWidth, - dragStarted: props.dragStarted, - dragOver: props.dragOver, - dragEnded: props.dragEnded, - dragActive: activeIndex != -1, - indicator: dropIndicator(virtualRow.index), - superstate, - ghost: overIndex != -1 && activeIndex == virtualRow.index, - style: { - opacity: projected && projected.insert && !projected.copy && virtualRow.index == activeIndex ? 0 : 1, - transform: CSS.Translate.toString({ - x: projected && projected.sortable && virtualRow.index == activeIndex && projected ? (projected.depth - flattenedTree[virtualRow.index].depth) * indentationWidth : 0, - y: calcYOffset(virtualRow.index), - scaleX: 0, - scaleY: 0 - }) - }, - onSelectRange: selectRange2, - active: activePath == flattenedTree[virtualRow.index].item?.path, - highlighted: highlighted(virtualRow.index), - selected: selectedPaths.some( - (g) => g.id == flattenedTree[virtualRow.index].id - ), - collapsed: flattenedTree[virtualRow.index].collapsed, - onCollapse: handleCollapse - }))))); -}); - -// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx -var treeForSpace = (superstate, space2, path2, depth, parentId, activeId, sortable, root, parentPath, sort2, expandedSpaces) => { - const tree = []; - const id3 = parentId ? parentId + "/" + space2.path : space2.path; - const spaceCollapsed = !expandedSpaces.includes(id3) || activeId == id3; - const spaceSort = space2.metadata?.sort?.field && space2.metadata?.sort?.field != "rank" ? space2.metadata?.sort : sort2 ?? { - field: "rank", - asc: true, - group: true - }; - const children = superstate.getSpaceItems(space2.path) ?? []; - if (!spaceCollapsed || root) { - children.sort(spaceSortFn(spaceSort)).forEach((item) => { - const _parentId = parentId ? parentId + "/" + space2.path : space2.path; - if (item.type != "space") { - tree.push( - pathStateToTreeNode( - superstate, - item, - space2.path, - item.path, - depth + 1, - 0, - true, - space2.sortable, - 0, - _parentId - ) - ); - } else { - if (superstate.spacesIndex.has(item.path)) { - tree.push( - ...treeForSpace( - superstate, - superstate.spacesIndex.get(item.path), - item, - depth + 1, - _parentId, - activeId, - space2.sortable, - false, - space2.path, - sort2, - expandedSpaces - ) - ); - } - } - }); } - if (!root) - tree.splice( - 0, - 0, - spaceToTreeNode( - path2, - spaceCollapsed, - sortable, - depth, - parentId, - parentPath, - tree.length - ) - ); - return tree; -}; -var treeForRoot = (superstate, space2, active, expandedSpaces) => { - const tree = []; - const pathIndex = superstate.pathsIndex.get(space2.path); - if (pathIndex) - tree.push({ - id: space2.path, - parentId: null, - depth: 0, - index: 0, - space: space2.path, - path: space2.path, - item: pathIndex, - rank: null, - collapsed: expandedSpaces.includes(space2.path) ? false : true, - sortable: space2.sortable, - childrenCount: [...superstate.spacesMap.getInverse(space2.path) ?? []].length, - type: "group" + return _arr; +} +function _arrayWithHoles2(arr) { + if (Array.isArray(arr)) + return arr; +} +function ownKeys5(object, enumerableOnly) { + var keys2 = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys2.push.apply(keys2, symbols); + } + return keys2; +} +function _objectSpread5(target) { + for (var i4 = 1; i4 < arguments.length; i4++) { + var source = null != arguments[i4] ? arguments[i4] : {}; + i4 % 2 ? ownKeys5(Object(source), true).forEach(function(key3) { + _defineProperty3(target, key3, source[key3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key3) { + Object.defineProperty(target, key3, Object.getOwnPropertyDescriptor(source, key3)); }); - const spaceSort = space2.metadata?.sort ?? { - field: "rank", - asc: true, - group: true - }; - if (!expandedSpaces.includes(space2.path) || active && !active.parentId) { - return tree; } - const children = superstate.getSpaceItems(space2.path) ?? []; - children.sort(spaceSortFn(spaceSort)).forEach((item) => { - const _parentId = space2.path; - if (item.type != "space") { - const id3 = _parentId + "/" + item.path; - const itemCollapsed = !expandedSpaces.includes(id3); - tree.push( - pathStateToTreeNode( - superstate, - item, - space2.path, - item.path, - 1, - 0, - itemCollapsed, - space2.sortable, - 0, - _parentId - ) - ); - } else { - if (superstate.spacesIndex.has(item.path)) - tree.push( - ...treeForSpace( - superstate, - superstate.spacesIndex.get(item.path), - item, - 1, - _parentId, - active?.id, - space2.sortable, - false, - space2.path, - spaceSort, - expandedSpaces - ) - ); + return target; +} +function _defineProperty3(obj, key3, value) { + if (key3 in obj) { + Object.defineProperty(obj, key3, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key3] = value; + } + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) + return {}; + var target = _objectWithoutPropertiesLoose2(source, excluded); + var key3, i4; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for (i4 = 0; i4 < sourceSymbolKeys.length; i4++) { + key3 = sourceSymbolKeys[i4]; + if (excluded.indexOf(key3) >= 0) + continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key3)) + continue; + target[key3] = source[key3]; } - }); - return tree; + } + return target; +} +function _objectWithoutPropertiesLoose2(source, excluded) { + if (source == null) + return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key3, i4; + for (i4 = 0; i4 < sourceKeys.length; i4++) { + key3 = sourceKeys[i4]; + if (excluded.indexOf(key3) >= 0) + continue; + target[key3] = source[key3]; + } + return target; +} +var Dropzone = /* @__PURE__ */ (0, import_react136.forwardRef)(function(_ref, ref2) { + var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded2); + var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded22); + (0, import_react136.useImperativeHandle)(ref2, function() { + return { + open + }; + }, [open]); + return /* @__PURE__ */ import_react136.default.createElement(import_react136.Fragment, null, children(_objectSpread5(_objectSpread5({}, props), {}, { + open + }))); +}); +Dropzone.displayName = "Dropzone"; +var defaultProps2 = { + disabled: false, + getFilesFromEvent: fromEvent, + maxSize: Infinity, + minSize: 0, + multiple: true, + maxFiles: 0, + preventDropOnDocument: true, + noClick: false, + noKeyboard: false, + noDrag: false, + noDragEventsBubbling: false, + validator: null, + useFsAccessApi: true, + autoFocus: false }; -var retrieveData = (superstate, activeViewSpaces, active, expandedSpaces) => { - const tree = []; - activeViewSpaces.filter((f2) => f2).forEach((activeViewSpace) => { - tree.push( - ...treeForRoot(superstate, activeViewSpace, active, expandedSpaces) - ); - }); - tree.push({ - id: "placeholder", - parentId: null, - depth: 0, - index: 0, - space: null, - type: "new", - path: null, - childrenCount: 0, - collapsed: false, - rank: 0 - }); - return tree; +Dropzone.defaultProps = defaultProps2; +Dropzone.propTypes = { + children: import_prop_types.default.func, + accept: import_prop_types.default.objectOf(import_prop_types.default.arrayOf(import_prop_types.default.string)), + multiple: import_prop_types.default.bool, + preventDropOnDocument: import_prop_types.default.bool, + noClick: import_prop_types.default.bool, + noKeyboard: import_prop_types.default.bool, + noDrag: import_prop_types.default.bool, + noDragEventsBubbling: import_prop_types.default.bool, + minSize: import_prop_types.default.number, + maxSize: import_prop_types.default.number, + maxFiles: import_prop_types.default.number, + disabled: import_prop_types.default.bool, + getFilesFromEvent: import_prop_types.default.func, + onFileDialogCancel: import_prop_types.default.func, + onFileDialogOpen: import_prop_types.default.func, + useFsAccessApi: import_prop_types.default.bool, + autoFocus: import_prop_types.default.bool, + onDragEnter: import_prop_types.default.func, + onDragLeave: import_prop_types.default.func, + onDragOver: import_prop_types.default.func, + onDrop: import_prop_types.default.func, + onDropAccepted: import_prop_types.default.func, + onDropRejected: import_prop_types.default.func, + onError: import_prop_types.default.func, + validator: import_prop_types.default.func }; -var SpaceTreeComponent = (props) => { - const { superstate } = props; - const indentationWidth = isTouchScreen(props.superstate.ui) ? 20 : 16; - const [expandedSpaces, setExpandedSpaces] = (0, import_react111.useState)( - superstate.settings.expandedSpaces - ); - const { - activePath, - activeViewSpaces, - setActivePath, - selectedPaths, - setSelectedPaths, - dragPaths, - setDragPaths, - modifier, - setModifier - } = (0, import_react111.useContext)(NavigatorContext); - const [active, setActive] = (0, import_react111.useState)(null); - const [overId, setOverId] = (0, import_react111.useState)(null); - const [flattenedTree, setFlattenedTree] = (0, import_react111.useState)([]); - const nextTreeScrollPath = (0, import_react111.useRef)(null); - const [offset2, setOffset] = (0, import_react111.useState)({ x: 0, y: 0 }); - const listRef = (0, import_react111.useRef)(null); - const refreshableSpaces = (0, import_react111.useMemo)( - () => [ - ...activeViewSpaces.filter((f2) => f2).map((f2) => f2.path), - ...flattenedTree.filter((f2) => f2.type == "space").map((f2) => f2.path) - ].filter((f2) => f2), - [activeViewSpaces, flattenedTree] - ); - (0, import_react111.useEffect)(() => { - if (selectedPaths.length <= 1) { - if (!selectedPaths[0] || selectedPaths[0].item.path != activePath) - setSelectedPaths([]); - if (superstate.settings.revealActiveFile) - revealPath(activePath); +var initialState = { + isFocused: false, + isFileDialogActive: false, + isDragActive: false, + isDragAccept: false, + isDragReject: false, + acceptedFiles: [], + fileRejections: [] +}; +function useDropzone() { + var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + var _defaultProps$props = _objectSpread5(_objectSpread5({}, defaultProps2), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator; + var acceptAttr = (0, import_react136.useMemo)(function() { + return acceptPropAsAcceptAttr(accept); + }, [accept]); + var pickerTypes = (0, import_react136.useMemo)(function() { + return pickerOptionsFromAccept(accept); + }, [accept]); + var onFileDialogOpenCb = (0, import_react136.useMemo)(function() { + return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop2; + }, [onFileDialogOpen]); + var onFileDialogCancelCb = (0, import_react136.useMemo)(function() { + return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop2; + }, [onFileDialogCancel]); + var rootRef = (0, import_react136.useRef)(null); + var inputRef = (0, import_react136.useRef)(null); + var _useReducer = (0, import_react136.useReducer)(reducer2, initialState), _useReducer2 = _slicedToArray2(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1]; + var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive; + var fsAccessApiWorksRef = (0, import_react136.useRef)(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); + var onWindowFocus = function onWindowFocus2() { + if (!fsAccessApiWorksRef.current && isFileDialogActive) { + setTimeout(function() { + if (inputRef.current) { + var files = inputRef.current.files; + if (!files.length) { + dispatch({ + type: "closeDialog" + }); + onFileDialogCancelCb(); + } + } + }, 300); } - props.superstate.ui.eventsDispatch.addListener( - "activePathChanged", - changeActivePath - ); - return () => { - props.superstate.ui.eventsDispatch.removeListener( - "activePathChanged", - changeActivePath - ); - }; - }, [activePath]); - (0, import_react111.useEffect)(() => { - window.addEventListener("dragend", resetState); - return () => { - window.removeEventListener("dragend", resetState); - }; - }); - (0, import_react111.useEffect)(() => { - const settingsChanged = () => { - setExpandedSpaces(superstate.settings.expandedSpaces); - }; - superstate.eventsDispatcher.addListener("settingsChanged", settingsChanged); - return () => { - superstate.eventsDispatcher.removeListener( - "settingsChanged", - settingsChanged - ); - }; - }, [activeViewSpaces, active, setExpandedSpaces, setFlattenedTree]); - const revealPath = (0, import_react111.useCallback)( - (path2) => { - if (!path2 || !activeViewSpaces?.some((f2) => f2.path == "/")) - return; - const folders = path2.split("/"); - const openPaths = folders.reduce( - (p, c3, index2) => [...p, index2 == 0 ? c3 : `/${p[index2]}/${c3}`], - ["/"] - ).slice(0, -1); - const newOpenFolders = [ - ...expandedSpaces.filter((f2) => !openPaths.find((g) => g == f2)) ?? [], - ...openPaths - ]; - superstate.settings.expandedSpaces = newOpenFolders; - nextTreeScrollPath.current = "/" + path2; - superstate.saveSettings(); - }, - [expandedSpaces, activeViewSpaces] - ); - (0, import_react111.useEffect)(() => { - const handleRevealPathEvent = (evt) => { - if (evt.detail) - revealPath(evt.detail.path); - }; - window.addEventListener(eventTypes.revealPath, handleRevealPathEvent); - return () => { - window.removeEventListener(eventTypes.revealPath, handleRevealPathEvent); - }; - }, [revealPath]); - (0, import_react111.useEffect)(() => { - const reloadData = () => { - setFlattenedTree( - retrieveData(superstate, activeViewSpaces, active, expandedSpaces) - ); + }; + (0, import_react136.useEffect)(function() { + window.addEventListener("focus", onWindowFocus, false); + return function() { + window.removeEventListener("focus", onWindowFocus, false); }; - const spaceUpdated = (payload) => { - if (refreshableSpaces.some((f2) => f2 == payload.path)) { - reloadData(); + }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]); + var dragTargetsRef = (0, import_react136.useRef)([]); + var onDocumentDrop = function onDocumentDrop2(event) { + if (rootRef.current && rootRef.current.contains(event.target)) { + return; + } + event.preventDefault(); + dragTargetsRef.current = []; + }; + (0, import_react136.useEffect)(function() { + if (preventDropOnDocument) { + document.addEventListener("dragover", onDocumentDragOver, false); + document.addEventListener("drop", onDocumentDrop, false); + } + return function() { + if (preventDropOnDocument) { + document.removeEventListener("dragover", onDocumentDragOver); + document.removeEventListener("drop", onDocumentDrop); } }; - props.superstate.eventsDispatcher.addListener( - "spaceStateUpdated", - spaceUpdated - ); - return () => { - props.superstate.eventsDispatcher.removeListener( - "spaceStateUpdated", - spaceUpdated - ); + }, [rootRef, preventDropOnDocument]); + (0, import_react136.useEffect)(function() { + if (!disabled && autoFocus && rootRef.current) { + rootRef.current.focus(); + } + return function() { }; - }, [ - expandedSpaces, - activeViewSpaces, - active, - expandedSpaces, - refreshableSpaces, - setFlattenedTree - ]); - (0, import_react111.useEffect)(() => { - setFlattenedTree( - retrieveData(superstate, activeViewSpaces, active, expandedSpaces) - ); - }, [expandedSpaces, activeViewSpaces, active]); - const changeActivePath = (path2) => { - setActivePath(path2); - }; - const overIndex = (0, import_react111.useMemo)( - () => flattenedTree.findIndex((f2) => f2.id == overId), - [overId, flattenedTree] - ); - const activeIndex = (0, import_react111.useMemo)( - () => active?.id ? flattenedTree.findIndex((f2) => f2.id == active.id) : -1, - [active, flattenedTree] - ); - const sortedIds = (0, import_react111.useMemo)( - () => flattenedTree.map(({ id: id3 }) => id3), - [flattenedTree] - ); - const selectRange2 = (0, import_react111.useCallback)( - (fromId) => { - const startIndex = sortedIds.findIndex((f2) => f2 == fromId); - const selectedPathsStartIndex = sortedIds.findIndex( - (f2) => f2 == selectedPaths[0]?.id - ); - const selectedPathsEndIndex = sortedIds.findIndex( - (f2) => f2 == selectedPaths[selectedPaths.length - 1]?.id - ); - if (startIndex < selectedPathsStartIndex) { - setSelectedPaths( - flattenedTree.slice(startIndex, selectedPathsEndIndex + 1).filter((f2) => f2.item) - ); - } else { - setSelectedPaths( - flattenedTree.slice(selectedPathsStartIndex, startIndex + 1).filter((f2) => f2.item) - ); + }, [rootRef, autoFocus, disabled]); + var onErrCb = (0, import_react136.useCallback)(function(e5) { + if (onError) { + onError(e5); + } else { + console.error(e5); + } + }, [onError]); + var onDragEnterCb = (0, import_react136.useCallback)(function(event) { + event.preventDefault(); + event.persist(); + stopPropagation2(event); + dragTargetsRef.current = [].concat(_toConsumableArray2(dragTargetsRef.current), [event.target]); + if (isEvtWithFiles(event)) { + Promise.resolve(getFilesFromEvent(event)).then(function(files) { + if (isPropagationStopped(event) && !noDragEventsBubbling) { + return; + } + var fileCount = files.length; + var isDragAccept = fileCount > 0 && allFilesAccepted({ + files, + accept: acceptAttr, + minSize, + maxSize, + multiple, + maxFiles, + validator + }); + var isDragReject = fileCount > 0 && !isDragAccept; + dispatch({ + isDragAccept, + isDragReject, + isDragActive: true, + type: "setDraggedFiles" + }); + if (onDragEnter) { + onDragEnter(event); + } + }).catch(function(e5) { + return onErrCb(e5); + }); + } + }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]); + var onDragOverCb = (0, import_react136.useCallback)(function(event) { + event.preventDefault(); + event.persist(); + stopPropagation2(event); + var hasFiles = isEvtWithFiles(event); + if (hasFiles && event.dataTransfer) { + try { + event.dataTransfer.dropEffect = "copy"; + } catch (_unused) { } - }, - [sortedIds, selectedPaths, setSelectedPaths, flattenedTree] - ); - const [projected, setProjected] = (0, import_react111.useState)(null); - (0, import_react111.useEffect)(() => { - const dragDepth = getDragDepth(offset2.x, indentationWidth); - const _projected = overId ? getProjection( - active, - flattenedTree, - dragPaths, - overIndex, - dragDepth, - offset2.y, - activeIndex < overIndex, - modifier, - active?.space - ) : null; - setProjected((p) => !(0, import_lodash17.isEqual)(p, _projected) ? _projected : p); - }, [ - active, - flattenedTree, - overId, - overIndex, - dragPaths, - offset2, - activeIndex, - modifier, - indentationWidth, - activeViewSpaces - ]); - const dragStarted = (activeId) => { - const activeItem = flattenedTree.find(({ id: id3 }) => id3 === activeId); - setActive(activeItem); - setOverId(activeId); - if (activeItem) { - if (selectedPaths.length > 1) { - setDragPaths(selectedPaths.map((f2) => f2.path)); + } + if (hasFiles && onDragOver) { + onDragOver(event); + } + return false; + }, [onDragOver, noDragEventsBubbling]); + var onDragLeaveCb = (0, import_react136.useCallback)(function(event) { + event.preventDefault(); + event.persist(); + stopPropagation2(event); + var targets = dragTargetsRef.current.filter(function(target) { + return rootRef.current && rootRef.current.contains(target); + }); + var targetIdx = targets.indexOf(event.target); + if (targetIdx !== -1) { + targets.splice(targetIdx, 1); + } + dragTargetsRef.current = targets; + if (targets.length > 0) { + return; + } + dispatch({ + type: "setDraggedFiles", + isDragActive: false, + isDragAccept: false, + isDragReject: false + }); + if (isEvtWithFiles(event) && onDragLeave) { + onDragLeave(event); + } + }, [rootRef, onDragLeave, noDragEventsBubbling]); + var setFiles = (0, import_react136.useCallback)(function(files, event) { + var acceptedFiles = []; + var fileRejections = []; + files.forEach(function(file) { + var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray2(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1]; + var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray2(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1]; + var customErrors = validator ? validator(file) : null; + if (accepted && sizeMatch && !customErrors) { + acceptedFiles.push(file); } else { - setDragPaths([activeItem.path]); + var errors = [acceptError, sizeError]; + if (customErrors) { + errors = errors.concat(customErrors); + } + fileRejections.push({ + file, + errors: errors.filter(function(e5) { + return e5; + }) + }); } + }); + if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) { + acceptedFiles.forEach(function(file) { + fileRejections.push({ + file, + errors: [TOO_MANY_FILES_REJECTION] + }); + }); + acceptedFiles.splice(0); } - document.body.style.setProperty("cursor", "grabbing"); - }; - const parentName = (0, import_react111.useMemo)( - () => projected ? flattenedTree.find((f2) => f2.id == projected.parentId)?.item?.name : null, - [flattenedTree, projected] - ); - const overName = (0, import_react111.useMemo)( - () => projected && flattenedTree.find((f2) => f2.id == projected.overId)?.item?.name, - [flattenedTree, projected] - ); - const dragOver = (e5, _overId, position) => { - const modifier2 = eventToModifier(e5); - setModifier(modifier2); - e5.dataTransfer.dropEffect = modifier2; - if (projected) { - superstate.ui.setDragLabel( - `${projected.reorder && !projected.insert ? i18n_default.labels.reorderIn : modifier2 == "move" || !modifier2 ? i18n_default.labels.moveTo : modifier2 == "link" ? i18n_default.labels.addTo : i18n_default.labels.copyTo} ${projected.insert ? overName : parentName ?? "Spaces"}` - ); + dispatch({ + acceptedFiles, + fileRejections, + type: "setFiles" + }); + if (onDrop) { + onDrop(acceptedFiles, fileRejections, event); } - if (dragPaths.length > 1) { - if (_overId && _overId != overId) - setOverId(_overId); - return; + if (fileRejections.length > 0 && onDropRejected) { + onDropRejected(fileRejections, event); } - if (_overId && _overId != overId) - setOverId(_overId); - const x2 = offset2.x; - const y3 = offset2.y; - const newX = 2 * Math.round(Math.max(1, position.x - indentationWidth - 20)); - const newY = 2 * Math.round(position.y / 2); - if (x2 != newX || y3 != newY) { - setOffset({ - x: newX, - y: newY - }); + if (acceptedFiles.length > 0 && onDropAccepted) { + onDropAccepted(acceptedFiles, event); } - }; - (0, import_react111.useEffect)(() => { - if (dragPaths.length == 0) { - setOverId(null); - setActive(null); - setOffset({ x: 0, y: 0 }); - setModifier(null); - setProjected(null); - dragCounter.current = 0; - document.body.style.setProperty("cursor", ""); + }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]); + var onDropCb = (0, import_react136.useCallback)(function(event) { + event.preventDefault(); + event.persist(); + stopPropagation2(event); + dragTargetsRef.current = []; + if (isEvtWithFiles(event)) { + Promise.resolve(getFilesFromEvent(event)).then(function(files) { + if (isPropagationStopped(event) && !noDragEventsBubbling) { + return; + } + setFiles(files, event); + }).catch(function(e5) { + return onErrCb(e5); + }); } - }, [dragPaths]); - const dragEnded = (e5, overId2) => { - const modifiers = eventToModifier(e5); - dropPathsInTree( - superstate, - dragPaths, - active?.id, - overId2, - projected, - flattenedTree, - activeViewSpaces, - modifiers - ); - resetState(); - }; - const handleCollapse = (0, import_react111.useCallback)( - (folder, open) => { - const folderOpen = expandedSpaces?.includes(folder.id); - const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter( - (openFolder) => folder.id !== openFolder - ); - superstate.settings.expandedSpaces = newOpenFolders; - superstate.saveSettings(); - }, - [superstate, expandedSpaces] - ); - function resetState() { - setDragPaths([]); - setOverId(null); - setActive(null); - setOffset({ x: 0, y: 0 }); - setModifier(null); - setProjected(null); - dragCounter.current = 0; - document.body.style.setProperty("cursor", ""); - } - const dragCounter = (0, import_react111.useRef)(0); - const dragEnter = () => { - dragCounter.current++; - }; - const dragLeave = () => { - dragCounter.current--; - if (dragCounter.current == 0) { - setOverId(null); - setOffset({ x: 0, y: 0 }); - setProjected(null); - dragCounter.current = 0; + dispatch({ + type: "reset" + }); + }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); + var openFileDialog = (0, import_react136.useCallback)(function() { + if (fsAccessApiWorksRef.current) { + dispatch({ + type: "openDialog" + }); + onFileDialogOpenCb(); + var opts = { + multiple, + types: pickerTypes + }; + window.showOpenFilePicker(opts).then(function(handles) { + return getFilesFromEvent(handles); + }).then(function(files) { + setFiles(files, null); + dispatch({ + type: "closeDialog" + }); + }).catch(function(e5) { + if (isAbort(e5)) { + onFileDialogCancelCb(e5); + dispatch({ + type: "closeDialog" + }); + } else if (isSecurityError(e5)) { + fsAccessApiWorksRef.current = false; + if (inputRef.current) { + inputRef.current.value = null; + inputRef.current.click(); + } else { + onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided.")); + } + } else { + onErrCb(e5); + } + }); + return; } - }; - const rowHeights = (0, import_react111.useMemo)( - () => flattenedTree.map((f2) => spaceRowHeight(superstate, f2.type == "group")), - [flattenedTree] - ); - return /* @__PURE__ */ import_react111.default.createElement("div", { - className: `mk-path-tree`, - onDragEnter: () => dragEnter(), - onDragLeave: () => dragLeave(), - onDragOver: (e5) => e5.preventDefault(), - onDrop: (e5) => { - if (overId) { - dragEnded(e5, overId); - } else { - resetState(); - } + if (inputRef.current) { + dispatch({ + type: "openDialog" + }); + onFileDialogOpenCb(); + inputRef.current.value = null; + inputRef.current.click(); } - }, /* @__PURE__ */ import_react111.default.createElement(VirtualizedList, { - vRef: listRef, - rowHeights, - flattenedTree, - projected, - handleCollapse, - activePath, - superstate, - selectedPaths, - selectRange: selectRange2, - indentationWidth, - dragStarted, - dragOver, - dragEnded, - overIndex, - activeIndex - }), modifier && !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react111.default.createElement("div", { - className: "mk-hint-dnd", - style: { - position: "absolute", - bottom: "10px", - left: "10px", - background: "var(--mk-ui-active)", - boxShadow: "var(--background-modifier-box-shadow)", - padding: "4px 8px", - borderRadius: "4px", - color: "var(--text-on-accent)", - fontSize: "12px" + }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); + var onKeyDownCb = (0, import_react136.useCallback)(function(event) { + if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) { + return; } - }, /* @__PURE__ */ import_react111.default.createElement("div", null, i18n_default.hintText.dragDropModifierKeys.replace("${1}", "shift").replace("${2}", normalizedAltName())))); -}; - -// src/core/react/components/Navigator/MainList.tsx -var import_react115 = __toESM(require_react()); - -// src/core/react/components/Navigator/MainMenu.tsx -var import_classnames4 = __toESM(require_classnames()); -var import_react112 = __toESM(require_react()); -var MainMenu = (props) => { - const { superstate } = props; - const { setActivePath, setDragPaths } = (0, import_react112.useContext)(NavigatorContext); - const ref2 = (0, import_react112.useRef)(); - return /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-main-menu-container" - }, /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-main-menu-inner" - }, /* @__PURE__ */ import_react112.default.createElement("div", { - className: (0, import_classnames4.default)("mk-main-menu") - }, /* @__PURE__ */ import_react112.default.createElement("div", { - className: `mk-main-menu-button mk-main-menu-button-primary`, - ref: ref2, - onClick: (e5) => { - props.superstate.ui.mainMenu(ref2.current, superstate); + if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) { + event.preventDefault(); + openFileDialog(); } - }, props.superstate.settings.systemName, /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//chevrons-up-down") + }, [rootRef, openFileDialog]); + var onFocusCb = (0, import_react136.useCallback)(function() { + dispatch({ + type: "focus" + }); + }, []); + var onBlurCb = (0, import_react136.useCallback)(function() { + dispatch({ + type: "blur" + }); + }, []); + var onClickCb = (0, import_react136.useCallback)(function() { + if (noClick) { + return; } - })), /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-main-menu-button", - onClick: (e5) => props.superstate.ui.quickOpen(superstate) - }, /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//search") + if (isIeOrEdge()) { + setTimeout(openFileDialog, 0); + } else { + openFileDialog(); } - }))), /* @__PURE__ */ import_react112.default.createElement("button", { - "aria-label": i18n_default.buttons.newNote, - className: "mk-main-menu-button", - onClick: (e5) => defaultAddAction(superstate, null, e5.metaKey ? "tab" : false) - }, /* @__PURE__ */ import_react112.default.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//new-note") + }, [noClick, openFileDialog]); + var composeHandler = function composeHandler2(fn) { + return disabled ? null : fn; + }; + var composeKeyboardHandler = function composeKeyboardHandler2(fn) { + return noKeyboard ? null : composeHandler(fn); + }; + var composeDragHandler = function composeDragHandler2(fn) { + return noDrag ? null : composeHandler(fn); + }; + var stopPropagation2 = function stopPropagation3(event) { + if (noDragEventsBubbling) { + event.stopPropagation(); } - })))); -}; - -// src/core/react/components/Navigator/Waypoints/Waypoints.tsx -var import_react114 = __toESM(require_react()); -var import_react_dom7 = __toESM(require_react_dom()); - -// src/core/react/components/Navigator/Waypoints/Waypoint.tsx -var import_classnames5 = __toESM(require_classnames()); -var import_react113 = __toESM(require_react()); -var SortablePinnedSpaceItem = ({ - id: id3, - index: index2, - ...props -}) => { - return /* @__PURE__ */ import_react113.default.createElement(PinnedSpace, { - index: index2, - ...props + }; + var getRootProps = (0, import_react136.useMemo)(function() { + return function() { + var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3); + return _objectSpread5(_objectSpread5(_defineProperty3({ + onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)), + onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)), + onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)), + onClick: composeHandler(composeEventHandlers(onClick, onClickCb)), + onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)), + onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)), + onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)), + onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)), + role: typeof role === "string" && role !== "" ? role : "presentation" + }, refKey, rootRef), !disabled && !noKeyboard ? { + tabIndex: 0 + } : {}), rest); + }; + }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]); + var onInputElementClick = (0, import_react136.useCallback)(function(event) { + event.stopPropagation(); + }, []); + var getInputProps = (0, import_react136.useMemo)(function() { + return function() { + var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4); + var inputProps = _defineProperty3({ + accept: acceptAttr, + multiple, + type: "file", + style: { + display: "none" + }, + onChange: composeHandler(composeEventHandlers(onChange, onDropCb)), + onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)), + tabIndex: -1 + }, refKey, inputRef); + return _objectSpread5(_objectSpread5({}, inputProps), rest); + }; + }, [inputRef, accept, multiple, onDropCb, disabled]); + return _objectSpread5(_objectSpread5({}, state), {}, { + isFocused: isFocused && !disabled, + getRootProps, + getInputProps, + rootRef, + inputRef, + open: composeHandler(openFileDialog) }); -}; -var PinnedSpace = (0, import_react113.forwardRef)( - ({ - pin, +} +function reducer2(state, action) { + switch (action.type) { + case "focus": + return _objectSpread5(_objectSpread5({}, state), {}, { + isFocused: true + }); + case "blur": + return _objectSpread5(_objectSpread5({}, state), {}, { + isFocused: false + }); + case "openDialog": + return _objectSpread5(_objectSpread5({}, initialState), {}, { + isFileDialogActive: true + }); + case "closeDialog": + return _objectSpread5(_objectSpread5({}, state), {}, { + isFileDialogActive: false + }); + case "setDraggedFiles": + return _objectSpread5(_objectSpread5({}, state), {}, { + isDragActive: action.isDragActive, + isDragAccept: action.isDragAccept, + isDragReject: action.isDragReject + }); + case "setFiles": + return _objectSpread5(_objectSpread5({}, state), {}, { + acceptedFiles: action.acceptedFiles, + fileRejections: action.fileRejections + }); + case "reset": + return _objectSpread5({}, initialState); + default: + return state; + } +} +function noop2() { +} + +// src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx +var eventToModifier = (e5, isDefaultSpace) => e5.altKey ? "copy" : e5.shiftKey || isDefaultSpace ? "link" : "move"; +var TreeItem = (props) => { + const { + id: id3, + childCount, + clone: clone5, + data: data3, + depth, + dragActive, + ghost, + active, + indentationWidth, indicator, + collapsed, + selected, highlighted, - superstate, + onCollapse, + onSelectRange, style, - clone: clone5, - ghost, - dragStart, + superstate, + disabled, + dragStarted, dragOver, - dragEnded, - index: index2 - }, ref2) => { - const innerRef = (0, import_react113.useRef)(null); - const { - activePath, - waypoints, - setWaypoints, - setModifier - } = (0, import_react113.useContext)(NavigatorContext); - const onDragStarted = (e5) => { - if (dragStart && pin) { - dragStart(index2); - } - }; - const onDragEnded = (e5) => { - if (dragEnded) { - dragEnded(); - } - }; - const innerProps = { - draggable: true, - onDragStart: onDragStarted, - onDragEnd: onDragEnded, - onDrop: onDragEnded - }; - return pin ? /* @__PURE__ */ import_react113.default.createElement("div", { - onContextMenu: (e5) => { - const menuOptions = [ - { - name: "Change Sticker", - icon: "ui//edit", - value: "change-sticker", - onClick: () => { - superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react113.default.createElement(StickerModal_default, { - ui: superstate.ui, - hide: _props.hide, - selectedSticker: (emoji) => { - setWaypoints( - waypoints.map( - (f2, i4) => i4 == index2 ? { ...f2, sticker: emoji } : f2 - ) - ); - } - })); - } - }, - { - name: "Close", - icon: "ui//close", - value: "close", - onClick: () => { - setWaypoints(waypoints.filter((f2, i4) => i4 != index2)); - superstate.saveSettings(); - } - } - ]; - superstate.ui.openMenu( - e5.target.getBoundingClientRect(), - defaultMenu(superstate.ui, menuOptions) - ); - }, - ref: innerRef, - className: "mk-waypoint", - onClick: (e5) => { - superstate.settings.currentWaypoint = index2; - superstate.saveSettings(); - }, - onDragOver: (e5) => { - e5.preventDefault(); - setModifier(eventToModifier(e5)); - if (!innerRef.current) - return; - const rect = innerRef.current.getBoundingClientRect(); - const x2 = e5.clientX - rect.left; - if (dragOver && pin) - dragOver(index2, x2); - }, - ...innerProps - }, /* @__PURE__ */ import_react113.default.createElement("div", { - ref: ref2, - className: (0, import_classnames5.default)( - "mk-waypoints-item", - "clickable-icon", - "nav-action-button", - (superstate.settings.currentWaypoint == index2 || highlighted) && "mk-active", - indicator && "mk-indicator", - clone5 && "mk-clone", - ghost && "mk-ghost" - ), - style: { - ...style - }, - dangerouslySetInnerHTML: { - __html: superstate.ui.getSticker(pin.sticker) - } - })) : /* @__PURE__ */ import_react113.default.createElement("div", { - ref: innerRef, - className: "mk-waypoint" - }, /* @__PURE__ */ import_react113.default.createElement("div", { - ref: ref2, - onClick: (e5) => { - setWaypoints([ - ...waypoints, - { sticker: "ui//spaces", name: "Waypoint", paths: [] } - ]); - superstate.saveSettings(); - }, - className: (0, import_classnames5.default)( - "mk-waypoints-item", - "clickable-icon", - "nav-action-button", - highlighted && "mk-active", - indicator && "mk-indicator", - clone5 && "mk-clone", - ghost && "mk-ghost" - ) - })); - } -); -PinnedSpace.displayName = "PinnedSpace"; - -// src/core/react/components/Navigator/Waypoints/Waypoints.tsx -var SpaceSwitcher = (props) => { + dragEnded + } = props; const { - waypoints, - modifier, - setModifier, - setWaypoints - } = (0, import_react114.useContext)(NavigatorContext); - const { superstate } = props; - const { dragPaths, setDragPaths } = (0, import_react114.useContext)(NavigatorContext); - const [activeId, setActiveId] = (0, import_react114.useState)(null); - const [overId, setOverId] = (0, import_react114.useState)(null); - const dragCounter = (0, import_react114.useRef)(0); - const [offset2, setOffset] = (0, import_react114.useState)(0); - const [projected, setProjected] = (0, import_react114.useState)(null); - const [dropPlaceholder, setDragPlaceholder] = (0, import_react114.useState)(null); - (0, import_react114.useEffect)(() => { - if (overId === null || dragPaths.length == 0) { - setProjected(null); + activePath, + setActivePath, + selectedPaths, + setSelectedPaths, + setDragPaths, + closeActiveSpace + } = (0, import_react137.useContext)(NavigatorContext); + const [hoverTarget, setHoverTarget] = (0, import_react137.useState)(null); + const innerRef = (0, import_react137.useRef)(null); + const [dropHighlighted, setDropHighlighted] = (0, import_react137.useState)(false); + const [pathState, setPathState] = (0, import_react137.useState)( + superstate.pathsIndex.get(data3.item.path) + ); + (0, import_react137.useEffect)( + () => setPathState(superstate.pathsIndex.get(data3.item.path)), + [data3.item.path] + ); + const openPathAtTarget = (path3, e5) => { + if (e5.shiftKey) { + onSelectRange(path3.id); return; - } - const waypoint = waypoints.find((f2, i4) => i4 == overId); - if (!waypoint) + } else if (e5.altKey) { + setSelectedPaths((s4) => [...s4.filter((f2) => f2.id != path3.id), path3]); return; - const _projected = { - depth: 0, - overId, - parentId: null, - sortable: false, - insert: true, - droppable: true, - copy: false, - reorder: false - }; - setProjected(_projected); - return; - }, [overId, dragPaths, offset2, modifier, waypoints, activeId]); - const resetState = () => { - setModifier(null); - setOverId(null); - setDragPaths([]); - setActiveId(null); - setProjected(null); - setOffset(0); - dragCounter.current = 0; - }; - const handleDragCancel = () => { - resetState(); - }; - const dragEnter = () => { - dragCounter.current++; - }; - const dragLeave = () => { - dragCounter.current--; - if (dragCounter.current == 0) { - setOverId(null); - setProjected(null); - setOffset(0); - dragCounter.current = 0; } + if (isFolder) { + if (superstate.settings.expandFolderOnClick) { + if (collapsed) { + onCollapse(data3, true); + } else if (active || selected) { + onCollapse(data3, false); + } + } + } + superstate.ui.openPath( + path3.item.path, + e5.ctrlKey || e5.metaKey || e5.button == 1 ? e5.altKey ? "split" : "tab" : false + ); + setActivePath(path3.item.path); + setSelectedPaths([path3]); }; - const adjustTranslate = ({ transform }) => { - return { - ...transform, - x: transform.x, - y: transform.y - 10 - }; + const onDragStarted = (e5) => { + if (selectedPaths.length > 1) { + setDragPaths(selectedPaths.map((f2) => f2.path)); + superstate.ui.dragStarted( + e5, + selectedPaths.map((f2) => f2.path) + ); + return; + } + dragStarted(data3.id); + setDragPaths([data3.path]); + superstate.ui.dragStarted(e5, [data3.path]); }; - const dragStarted = (id3) => { - setActiveId(id3); + const onDragOver = (e5) => { + e5.preventDefault(); + if (!innerRef.current) + return; + const rect = innerRef.current.getBoundingClientRect(); + const x2 = e5.clientX - rect.left; + const y3 = e5.clientY - rect.top; + dragOver(e5, data3.id, { x: x2, y: y3 }); }; - const dragOver = (id3, x2) => { - setOffset(x2); - if (activeId == null) { - setOverId(id3); - } else { - if (id3 == activeId) + const onKeyDown = (e5) => { + if (e5.key === "Control" || e5.key === "Meta") { + if (e5.repeat) return; - setWaypoints(arrayMove(waypoints, activeId, id3)); - setActiveId(id3); + const el = hoverTarget; + if (el) + superstate.ui.openPath(pathState.path, "hover", el); } }; - const dragEnded = () => { - if (projected && projected.insert) { - const space2 = props.superstate.spacesIndex.get(overId); - if (space2) - dropPathsInSpaceAtIndex( - props.superstate, - dragPaths, - space2.path, - 0, - "link" - ); - } else if (dragPaths.length == 1) { - const toIndex = overId; - if (activeId !== null) { - const fromIndex = activeId; - setWaypoints(arrayMove(waypoints, fromIndex, toIndex)); - } else { - setWaypoints( - waypoints.map( - (f2, i4) => i4 == toIndex ? { ...f2, paths: [...f2.paths, dragPaths[0]] } : f2 - ) - ); - } + const onDrop = (0, import_react137.useCallback)((files) => { + if (isFolder) { + files.map(async (file) => { + file.arrayBuffer().then((arrayBuffer) => { + superstate.spaceManager.writeToPath( + pathState.path + "/" + file.name, + arrayBuffer, + true + ); + }); + }); } - resetState(); + }, []); + const onDragEnter = (0, import_react137.useCallback)(() => { + if (isFolder) + setDropHighlighted(true); + }, []); + const { getRootProps, getInputProps, isDragActive } = useDropzone({ + onDrop, + onDragEnter, + onDragLeave: () => setDropHighlighted(false), + onDropAccepted: () => setDropHighlighted(false), + onDropRejected: () => setDropHighlighted(false), + noClick: true + }); + const onDragEnded = (e5) => { + dragEnded(e5, data3.id); }; - function handleDragStart(event) { - const { - active: { id: activeId2 } - } = event; - if (event.active.data.current.type != "path") + const mouseOut = (e5) => { + setHoverTarget(null); + }; + const newAction = (e5) => { + const space3 = superstate.spacesIndex.get(pathState.path); + if (e5.shiftKey) { + const offset2 = e5.target.getBoundingClientRect(); + showLinkMenu( + offset2, + superstate, + (link3) => { + pinPathToSpaceAtIndex(superstate, space3, link3); + }, + { placeholder: i18n_default.labels.pinNotePlaceholder } + ); + e5.stopPropagation(); return; - dragStarted(activeId2); - } - function handleDragMove({ delta }) { - } - function handleDragOver({ over }) { - const overId2 = over?.id; - if (overId2 !== null) { - if (activeId == null) { - setOverId(overId2); - } else { - setWaypoints( - arrayMove(waypoints, overId2, parseInt(activeId)) - ); - } - } - } - function handleDragEnd({ active, over }) { - dragEnded(); - } - (0, import_react114.useEffect)(() => { - window.addEventListener("dragend", resetState); - return () => { - window.removeEventListener("dragend", resetState); - }; - }); - const width = isTouchScreen(props.superstate.ui) ? 48 : 32; - const calcXOffset = (index2) => { - if (!projected || projected.insert) - return 0; - const fromIndex = activeId; - const targetIndex = overId; - if (activeId === null) { - if (index2 >= targetIndex) - return width; - return 0; - } - if (index2 == fromIndex) { - return width * (targetIndex - fromIndex); - } else if (index2 > fromIndex && index2 <= targetIndex) { - return -width; - } else if (index2 < fromIndex && index2 >= targetIndex) { - return width; - } else { - return 0; } + defaultAddAction(superstate, space3); }; - return /* @__PURE__ */ import_react114.default.createElement(import_react114.default.Fragment, null, /* @__PURE__ */ import_react114.default.createElement("div", { - className: "mk-waypoints nav-header", - onDragEnter: () => dragEnter(), - onDragLeave: () => dragLeave(), - onDragOver: (e5) => e5.preventDefault() - }, /* @__PURE__ */ import_react114.default.createElement("div", { - className: "mk-waypoints-inner nav-buttons-container" - }, waypoints.map((pin, i4) => /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, { - id: i4, - superstate: props.superstate, - highlighted: overId == i4 && projected && projected.insert && projected.droppable, - style: { - transform: CSS.Translate.toString({ - x: calcXOffset(i4), - y: 0, - scaleX: 0, - scaleY: 0 - }) - }, - index: i4, - pin, - key: i4, - dragStart: dragStarted, - dragOver, - dragEnded, - dragActive: activeId !== null, - ghost: activeId === i4 - })), /* @__PURE__ */ import_react114.default.createElement("div", { - className: "mk-waypoint-new", - onClick: (e5) => { - const newWaypoints = [ - ...waypoints, - { sticker: "ui//spaces", name: "Waypoint", paths: [] } - ]; - props.superstate.settings.currentWaypoint = newWaypoints.length - 1; - setWaypoints(newWaypoints); - }, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + const handleRightClick = (e5) => { + selectedPaths.length > 1 && selectedPaths.some((f2) => f2.id == data3.id) ? triggerMultiPathMenu(superstate, selectedPaths, e5) : contextMenu(e5); + }; + const color3 = pathState?.label?.color; + const contextMenu = (e5) => { + if (superstate.spacesIndex.has(pathState.path)) { + showSpaceContextMenu( + superstate, + pathState, + e5, + activePath, + data3.space, + data3.type == "group" ? () => closeActiveSpace(data3.path) : null + ); + return; } - }), overId != null && activeId === null && /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, { - id: waypoints.length, - superstate: props.superstate, - highlighted: false, - index: waypoints.length, - pin: null - })), (0, import_react_dom7.createPortal)( - /* @__PURE__ */ import_react114.default.createElement(DragOverlay, { - dropAnimation: null, - modifiers: [adjustTranslate], - zIndex: 1600 - }, activeId !== null ? /* @__PURE__ */ import_react114.default.createElement(SortablePinnedSpaceItem, { - id: -1, - superstate: props.superstate, - highlighted: false, - clone: true, - index: activeId, - indicator: false, - pin: waypoints[activeId] - }) : null), - document.body - ))); -}; - -// src/core/react/components/Navigator/MainList.tsx -var MainList = (props) => { - const [indexing, setIndexing] = import_react115.default.useState(false); - (0, import_react115.useEffect)(() => { - const reindex = async () => { - setIndexing(true); - }; - const finishedIndex = async () => { - setIndexing(false); - }; - props.superstate.eventsDispatcher.addListener("superstateReindex", reindex); - props.superstate.eventsDispatcher.addListener( - "superstateUpdated", - finishedIndex + showPathContextMenu( + superstate, + data3.path, + data3.space, + e5.target.getBoundingClientRect(), + "right" ); - return () => { - props.superstate.eventsDispatcher.removeListener( - "superstateReindex", - reindex - ); - props.superstate.eventsDispatcher.removeListener( - "superstateUpdated", - finishedIndex - ); - }; - }, []); - return /* @__PURE__ */ import_react115.default.createElement(import_react115.default.Fragment, null, /* @__PURE__ */ import_react115.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, { - FallbackComponent: ErrorFallback - }, /* @__PURE__ */ import_react115.default.createElement("div", { - className: "mk-progress-bar" - }, indexing && /* @__PURE__ */ import_react115.default.createElement("div", { - className: "mk-progress-bar-value" - })), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react115.default.createElement(MainMenu, { - superstate: props.superstate - }), /* @__PURE__ */ import_react115.default.createElement(SpaceSwitcher, { - superstate: props.superstate - }), /* @__PURE__ */ import_react115.default.createElement(SpaceTreeComponent, { - superstate: props.superstate - }))); -}; -function ErrorFallback({ error }) { - const { resetBoundary } = (0, import_react_error_boundary_cjs.useErrorBoundary)(); - const copyError = () => { - navigator.clipboard.writeText(error.message); }; - return /* @__PURE__ */ import_react115.default.createElement("div", { - role: "alert" - }, /* @__PURE__ */ import_react115.default.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ import_react115.default.createElement("p", { - style: { color: "red" } - }, error.message), /* @__PURE__ */ import_react115.default.createElement("button", { - onClick: copyError - }, "Copy Error"), /* @__PURE__ */ import_react115.default.createElement("button", { - onClick: resetBoundary - }, "Reload")); -} - -// src/core/react/components/SpaceView/Contexts/SpaceView.tsx -var SpaceView = (props) => { - return /* @__PURE__ */ import_react116.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, { - FallbackComponent: ErrorFallback - }, /* @__PURE__ */ import_react116.default.createElement(PathProvider, { - superstate: props.superstate, - path: props.path, - readMode: false - }, /* @__PURE__ */ import_react116.default.createElement(SpaceProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react116.default.createElement(FramesMDBProvider, { - superstate: props.superstate, - schema: "main" - }, /* @__PURE__ */ import_react116.default.createElement(FrameSelectionProvider, { - id: "main", - superstate: props.superstate, - editMode: props.readOnly ? 0 /* Read */ : 1 /* Page */ - }, /* @__PURE__ */ import_react116.default.createElement(SpaceRoot, { - superstate: props.superstate - }, props.children)))))); -}; -var SpaceRoot = (props) => { - const { pathState } = (0, import_react116.useContext)(PathContext); - const { tableData } = (0, import_react116.useContext)(FramesMDBContext); - const cols = [ - ...[...props.superstate.spacesMap.get(pathState.path) ?? []].flatMap( - (f2) => props.superstate.contextsIndex.get(f2)?.cols.map((g) => ({ ...g, table: f2 })) - ), - ...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? [] - ]; - return /* @__PURE__ */ import_react116.default.createElement(FrameEditorProvider, { - superstate: props.superstate, - editMode: 1 /* Page */, - cols - }, props.children); -}; - -// node_modules/@air/react-drag-to-select/dist/index.modern.js -var import_react117 = __toESM(require_react(), 1); -var import_react_dom8 = __toESM(require_react_dom(), 1); -var import_react_style_object_to_css = __toESM(require_react_style_object_to_css(), 1); -function a3() { - return a3 = Object.assign ? Object.assign.bind() : function(e5) { - for (var t5 = 1; t5 < arguments.length; t5++) { - var n3 = arguments[t5]; - for (var r2 in n3) - Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]); + const pathStateUpdated = (payload) => { + if (payload.path == pathState?.path) { + const _pathState = superstate.pathsIndex.get(pathState.path); + if (_pathState) + setPathState(_pathState); } - return e5; - }, a3.apply(this, arguments); -} -var s3 = ["style"]; -var d3 = (0, import_react117.forwardRef)((t5, u3) => { - let { style: d4 = {} } = t5, m4 = function(e5, t6) { - if (null == e5) - return {}; - var n3, r2, o2 = {}, l2 = Object.keys(e5); - for (r2 = 0; r2 < l2.length; r2++) - t6.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]); - return o2; - }(t5, s3); - const v2 = (0, import_react117.useRef)(null), f2 = (0, import_react117.useRef)(null), [, p] = (0, import_react117.useState)(0); - return (0, import_react117.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => { - var e5; - return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect(); - }, getParentBoundingClientRect: () => { - var e5, t6; - return null == v2 || null == (e5 = v2.current) || null == (t6 = e5.parentElement) ? void 0 : t6.getBoundingClientRect(); - }, drawSelectionBox: (e5) => { - requestAnimationFrame(() => { - if (f2.current) { - const t6 = a3({ border: "1px solid #4C85D8", background: "rgba(155, 193, 239, 0.4)", position: "absolute", pointerEvents: "none" }, d4, { top: e5.top, left: e5.left, width: e5.width, height: e5.height }); - f2.current.style.cssText = (0, import_react_style_object_to_css.default)(t6); - } - }); - }, clearSelectionBox: () => { - requestAnimationFrame(() => { - f2.current && (f2.current.style.cssText = (0, import_react_style_object_to_css.default)({ top: 0, left: 0, width: 0, height: 0 })); - }); - } })), (0, import_react117.useEffect)(() => { - p((e5) => e5 + 1); - }, []), import_react117.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom8.default.createPortal(import_react117.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null); -}); -var m3 = (e5, t5) => e5.left <= t5.left + t5.width && e5.left + e5.width >= t5.left && e5.top <= t5.top + t5.height && e5.top + e5.height >= t5.top; -function v(t5) { - const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t5 || {}, f2 = (0, import_react117.useRef)(null), { cancelCurrentSelection: p } = function({ containerRef: e5, onSelectionChange: t6, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) { - const d4 = (0, import_react117.useRef)(null), m5 = (0, import_react117.useRef)(null), v3 = (0, import_react117.useRef)(false), f3 = (0, import_react117.useRef)(t6), p2 = (0, import_react117.useRef)(r3), h3 = (0, import_react117.useRef)(o3), g = (0, import_react117.useRef)(), y3 = (0, import_react117.useRef)(c4); - f3.current = (0, import_react117.useCallback)((e6) => { - g.current = t6 ? requestAnimationFrame(() => { - t6(e6); - }) : void 0; - }, [t6]), p2.current = r3, h3.current = o3, y3.current = c4; - const b2 = (0, import_react117.useCallback)(() => { - var t7; - d4.current = null, m5.current = null, v3.current = false, null == (t7 = e5.current) || t7.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current); - }, [e5]), S3 = (0, import_react117.useCallback)((t7, n3) => { - var r4, o4, l2; - return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t7.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t7.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) }; - }, [e5]), E2 = (0, import_react117.useCallback)((t7, n3) => { - if (d4.current && m5.current) { - if (!n3) - return; - const l2 = (({ startPoint: e6, endPoint: t8 }) => ({ left: Math.min(e6.x, t8.x), top: Math.min(e6.y, t8.y), width: Math.abs(e6.x - t8.x), height: Math.abs(e6.y - t8.y) }))({ startPoint: d4.current, endPoint: m5.current }), u3 = a3({}, l2, { top: l2.top + ((null == n3 ? void 0 : n3.top) || 0), left: l2.left + ((null == n3 ? void 0 : n3.left) || 0) }); - var r4; - (o4 = l2).width * o4.height > 10 ? (v3.current || (null != p2 && p2.current && p2.current(t7), v3.current = true), null == (r4 = e5.current) || r4.drawSelectionBox(l2), null == f3.current || f3.current(u3)) : v3.current && (null == f3.current || f3.current(u3)); - } else - b2(); - var o4; - }, [b2, e5]), w2 = (0, import_react117.useCallback)((t7) => { - var n3; - if (!d4.current) - return; - const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect(); - m5.current = S3(t7, r4), E2(t7, r4); - }, [E2, S3, e5]), x2 = (0, import_react117.useCallback)((e6) => { - var t7; - 0 === e6.button && (m5.current && (null == h3.current || h3.current(e6)), b2(), document.body.style.removeProperty("user-select"), document.body.style.removeProperty("-webkit-user-select"), (i5 || document.body).removeEventListener("mousemove", w2), null == (t7 = window) || t7.removeEventListener("mouseup", x2)); - }, [i5, b2, w2]), C = (0, import_react117.useCallback)((e6) => { - if (0 === e6.button && y3.current) { - var t7; - if ("function" == typeof s5 && !s5(e6.target)) - return; - document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", d4.current = S3(e6), (i5 || document.body).addEventListener("mousemove", w2), null == (t7 = window) || t7.addEventListener("mouseup", x2); - } - }, [i5, S3, w2, x2]); - return (0, import_react117.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C), () => { - (i5 || document.body).removeEventListener("mousedown", C), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2); - }), [i5, C, w2, x2]), { cancelCurrentSelection: b2 }; - }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 }); - return { cancelCurrentSelection: p, DragSelection: (0, import_react117.useCallback)(() => import_react117.default.createElement(d3, a3({ ref: f2 }, s4)), []) }; -} - -// src/core/react/components/SpaceView/SpaceOuter.tsx -var import_react118 = __toESM(require_react()); -var SpaceOuter = (0, import_react118.forwardRef)( - (props, ref2) => { - const [selectionBox, setSelectionBox] = (0, import_react118.useState)(); - const selectableItems = (0, import_react118.useRef)([]); - const { frameProperties } = (0, import_react118.useContext)(FramesEditorRootContext); - const { selectableNodeBounds, id: id3 } = (0, import_react118.useContext)(FrameInstanceContext); - const { selectMulti } = (0, import_react118.useContext)(FrameSelectionContext); - const { tableData } = (0, import_react118.useContext)(FramesMDBContext); - const [dragging, setDragging] = (0, import_react118.useState)(false); - const localRef = (0, import_react118.useRef)(null); - const [contexts, setContexts] = (0, import_react118.useState)({}); - const [frameProps, setFrameProps] = (0, import_react118.useState)({}); - const { pathState } = (0, import_react118.useContext)(PathContext); - const { spaceInfo } = (0, import_react118.useContext)(SpaceContext); - (0, import_react118.useEffect)(() => { - if (!spaceInfo) { - return; - } - const linkedNote = spaceInfo.defPath; - const refreshProps = () => { - if (tableData) { - const properties3 = { - ...pathState?.metadata?.property ?? {} - }; - const fixedProps = Object.keys(properties3).reduce( - (p, c3) => ({ - ...p, - [c3]: parseProperty(c3, properties3[c3]) - }), - {} - ); - const row2 = linkContextRow( - props.superstate.formulaContext, - props.superstate.pathsIndex, - fixedProps, - tableData?.cols ?? [], - pathState - ); - setFrameProps(row2); - } else { - const properties3 = { - ...pathState?.metadata?.property ?? {} - }; - setFrameProps(properties3); - } - if (!pathState) { - setContexts({}); - return; - } - const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set(); - const contexts2 = [...pathContexts].reduce( - (p, c3) => { - const context = props.superstate.contextsIndex.get(c3)?.tables?.[defaultContextSchemaID].rows.find( - (f2) => f2[PathPropertyName] == pathState.path - ); - return context ? { ...p, [c3]: context } : p; - }, - { - $space: { - note: linkedNote, - space: pathState.path, - path: pathState.path - }, - $context: { - _keyValue: pathState.path, - _schema: "main" - }, - $properties: frameProperties - } - ); - setContexts(contexts2); - }; - refreshProps(); - }, [spaceInfo, pathState, tableData]); - const propSetters = Object.keys(frameProps).reduce( - (p, c3) => ({ - ...p, - [c3]: (value) => { - setFrameProps((p2) => ({ ...p2, [c3]: value })); - saveProperties(props.superstate, pathState.path, { - [c3]: value - }); - } - }), - {} - ); - const onKeyDown = (e5) => { - if (e5.key === "Escape") { - props.superstate.ui.resetSelection(null); - } + }; + (0, import_react137.useEffect)(() => { + superstate.eventsDispatcher.addListener( + "pathStateUpdated", + pathStateUpdated + ); + return () => { + superstate.eventsDispatcher.removeListener( + "pathStateUpdated", + pathStateUpdated + ); }; - (0, import_react118.useEffect)(() => { + }, []); + const hoverItem = (e5) => { + if (superstate.settings.filePreviewOnHover) { + setHoverTarget(e5.target); + if (e5.ctrlKey || e5.metaKey) { + superstate.ui.openPath(pathState.path, "hover", e5.target); + } + } + }; + (0, import_react137.useEffect)(() => { + if (hoverTarget && superstate.settings.filePreviewOnHover) { window.addEventListener("keydown", onKeyDown); return () => { window.removeEventListener("keydown", onKeyDown); }; - }, []); - const { DragSelection } = v({ - eventsElement: localRef.current, - onSelectionChange: (box) => { - const scroller = localRef.current.parentElement; - const scrollAwareBox = { - ...box, - top: box.top + scroller.scrollTop, - left: box.left + scroller.scrollLeft - }; - setSelectionBox(scrollAwareBox); - const nodesToSelect = []; - Object.keys(selectableNodeBounds.current).forEach((item) => { - if (m3(scrollAwareBox, selectableNodeBounds.current[item])) { - nodesToSelect.push(item); - } - }); - selectMulti(nodesToSelect, false); - }, - onSelectionStart: () => { - setDragging(true); - }, - onSelectionEnd: (e5) => { - setTimeout(function() { - setDragging(false); - }, 100); - }, - selectionProps: { - style: { - backgroundColor: "hsla(var(--color-accent-hsl), 0.1)", - border: "2px solid var(--color-accent)", - borderRadius: 2, - opacity: 0.5 - } - }, - isEnabled: true, - shouldStartSelecting: (target) => { - if (target instanceof HTMLElement && (target.className.includes("mk-f-main") || target.className.includes("mk-space-outer"))) - return true; - return false; - } - }); - return /* @__PURE__ */ import_react118.default.createElement("div", { - className: "mk-space-body cm-line", - ref: (el) => { - localRef.current = el; - if (typeof ref2 == "function") - ref2(el); - else if (ref2 !== null) - ref2.current = el; - } - }, /* @__PURE__ */ import_react118.default.createElement(DragSelection, null), /* @__PURE__ */ import_react118.default.createElement(FrameInstanceProvider, { - id: id3 ?? "root", - superstate: props.superstate, - props: frameProps, - contexts, - propSetters, - editable: true - }, props.children)); - } -); -SpaceOuter.displayName = "SpaceOuter"; -var SpaceOuter_default = SpaceOuter; - -// src/core/react/components/PathView/PathView.tsx -var PathView = (props) => { - const [pathState, setPathState] = (0, import_react119.useState)( - props.superstate.pathsIndex.get(props.path) - ); - const ref2 = (0, import_react119.useRef)(null); - (0, import_react119.useEffect)(() => { - const uri = props.superstate.spaceManager.uriByString(props.path); - if (uri?.scheme == "https" || uri?.scheme == "http") { - setPathState({ - path: props.path, - displayName: uri.path, - label: { - sticker: uri.scheme, - name: uri.path, - color: "" - }, - hidden: false, - subtype: "md", - type: "remote" - }); - return; } - const pathState2 = props.superstate.pathsIndex.get(props.path); - setPathState(pathState2); - }, [props.path]); - return /* @__PURE__ */ import_react119.default.createElement("div", { - className: "mk-path-view", - style: { ...props.styles ?? {} } - }, pathState?.type == "remote" ? /* @__PURE__ */ import_react119.default.createElement("iframe", { - src: props.path - }) : pathState?.type == "space" ? /* @__PURE__ */ import_react119.default.createElement(SpaceView, { - superstate: props.superstate, - path: props.path, - readOnly: props.readOnly - }, /* @__PURE__ */ import_react119.default.createElement(SpaceOuter_default, { + }, [hoverTarget]); + const dropProps = { + onDragOver + }; + const innerProps = { + draggable: true, + onDragStart: onDragStarted, + onDrop: onDragEnded + }; + const isSpace = pathState?.type == "space"; + const isFolder = pathState?.metadata?.isFolder || isSpace; + const extension2 = pathState?.metadata?.file?.extension; + const isLink = pathState?.parent != data3.space; + const spacing = data3.type == "group" ? 0 : indentationWidth * (depth - 1) + (data3.type == "space" ? 0 : isTouchScreen(props.superstate.ui) ? 30 : 20); + return /* @__PURE__ */ import_react137.default.createElement(import_react137.default.Fragment, null, /* @__PURE__ */ import_react137.default.createElement("div", { + className: (0, import_classnames4.default)( + "mk-tree-wrapper", + data3.type == "group" ? "mk-tree-section" : "", + clone5 && "mk-clone", + ghost && "mk-ghost", + highlighted ? "is-highlighted" : "" + ), + style: color3?.length > 0 ? { + "--label-color": `${color3}`, + "--icon-color": `#ffffff`, + position: "relative" + } : { + "--icon-color": `var(--mk-ui-text-secondary)`, + position: "relative" + }, + ref: innerRef, + onMouseLeave: mouseOut, + onMouseEnter: hoverItem, + onKeyDown, + onClick: (e5) => openPathAtTarget(data3, e5), + onContextMenu: (e5) => handleRightClick(e5), + ...dropProps, + ...innerProps + }, /* @__PURE__ */ import_react137.default.createElement("div", { + className: (0, import_classnames4.default)(isFolder ? "nav-folder" : "nav-file"), + style: { + ...style, + ...dragActive ? { pointerEvents: "none" } : {} + }, + ...!isTouchScreen(props.superstate.ui) ? getRootProps({ className: "dropzone" }) : {} + }, /* @__PURE__ */ import_react137.default.createElement("input", { + ...getInputProps() + }), /* @__PURE__ */ import_react137.default.createElement("div", { + className: (0, import_classnames4.default)( + "mk-tree-item", + "tree-item-self", + isFolder ? "nav-folder-title" : "nav-file-title", + active ? "is-active" : "", + selected ? "is-selected" : "", + indicator || dropHighlighted ? "mk-indicator-row" : "" + ), + style: { + "--spacing": `${spacing}px`, + "--childrenCount": `${data3.type == "space" && !collapsed ? childCount * spaceRowHeight(superstate, false) - 13 : 0}px` + }, + "data-path": pathState?.path + }, data3.type == "space" && /* @__PURE__ */ import_react137.default.createElement(CollapseToggle, { superstate: props.superstate, - ref: ref2 - }, /* @__PURE__ */ import_react119.default.createElement(FrameEditorInstance, { - containerRef: props.containerRef, - superstate: props.superstate - }))) : props.superstate.ui.availableViews().some((f2) => f2 == props.path?.split(".").pop()) ? /* @__PURE__ */ import_react119.default.createElement(NoteView, { + collapsed, + onToggle: (c3, e5) => { + onCollapse(data3, false); + e5.stopPropagation(); + } + }), superstate.settings.spacesStickers && pathState && /* @__PURE__ */ import_react137.default.createElement(PathStickerView, { + superstate, + pathState, + editable: true + }), /* @__PURE__ */ import_react137.default.createElement("div", { + className: `mk-tree-text ${isFolder ? "nav-folder-title-content" : "nav-file-title-content"}` + }, pathState?.displayName ?? pathState?.name ?? data3.path), data3.type == "group" && data3.childrenCount > 0 && /* @__PURE__ */ import_react137.default.createElement(CollapseToggle, { superstate: props.superstate, - path: props.path, - load: true, - classname: "mk-flow-node" - }) : /* @__PURE__ */ import_react119.default.createElement(import_react119.default.Fragment, null)); + collapsed, + onToggle: (c3, e5) => { + onCollapse(data3, false); + e5.stopPropagation(); + } + }), /* @__PURE__ */ import_react137.default.createElement("div", { + className: "mk-tree-span" + }), !isSpace && extension2 != "md" && /* @__PURE__ */ import_react137.default.createElement("span", { + className: "nav-file-tag" + }, extension2), !clone5 ? /* @__PURE__ */ import_react137.default.createElement("div", { + className: "mk-folder-buttons" + }, /* @__PURE__ */ import_react137.default.createElement("button", { + "aria-label": i18n_default.buttons.moreOptions, + onClick: (e5) => { + contextMenu(e5); + e5.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: superstate.ui.getSticker("ui//options") + } + }), isSpace && /* @__PURE__ */ import_react137.default.createElement("button", { + "aria-label": i18n_default.buttons.newNote, + onClick: (e5) => { + newAction(e5); + e5.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: superstate.ui.getSticker("ui//plus") + } + })) : /* @__PURE__ */ import_react137.default.createElement(import_react137.default.Fragment, null))))); }; +TreeItem.displayName = "TreeItem"; -// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx -var import_react121 = __toESM(require_react()); +// node_modules/@tanstack/react-virtual/dist/esm/index.js +var React133 = __toESM(require_react(), 1); +var import_react_dom7 = __toESM(require_react_dom(), 1); -// src/core/react/components/SpaceView/Frames/SpaceCommand/Suggester.tsx -var import_react120 = __toESM(require_react()); -var import_react_dom9 = __toESM(require_react_dom()); -var Suggester = (0, import_react120.forwardRef)( - (props, outerRef) => { - const ref2 = (0, import_react120.useRef)(null); - const [index2, setIndex] = (0, import_react120.useState)(0); - const [isReady, setIsReady] = (0, import_react120.useState)(false); - const menuRef = (0, import_react120.useRef)(null); - const [pos, setPos] = (0, import_react120.useState)({ x: 0, y: 0 }); - const [active, setActive] = (0, import_react120.useState)(false); - const [section, setSection] = (0, import_react120.useState)(""); - (0, import_react120.useEffect)(() => { - const resizeObserver = new ResizeObserver((entries) => { - if (menuRef.current) { - const rect = menuRef.current.getBoundingClientRect(); - setIsReady(true); - setPos( - calculateBoundsBasedOnPosition( - ref2.current.getBoundingClientRect(), - rect, - { width: window.innerWidth, height: innerHeight }, - "bottom" - ) - ); +// node_modules/@tanstack/virtual-core/dist/esm/utils.js +function memo3(getDeps, fn, opts) { + let deps = opts.initialDeps ?? []; + let result; + return () => { + var _a, _b, _c, _d; + let depTime; + if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) + depTime = Date.now(); + const newDeps = getDeps(); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index3) => deps[index3] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) + resultTime = Date.now(); + result = fn(...newDeps); + if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = " " + str; } - }); - if (menuRef.current && ref2.current) { - resizeObserver.observe(menuRef.current); - resizeObserver.observe(ref2.current); + return str; + }; + console.info( + `%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, + ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max( + 0, + Math.min(120 - 120 * resultFpsPercentage, 120) + )}deg 100% 31%);`, + opts == null ? void 0 : opts.key + ); + } + (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result); + return result; + }; +} +function notUndefined(value, msg) { + if (value === void 0) { + throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`); + } else { + return value; + } +} +var approxEqual = (a4, b2) => Math.abs(a4 - b2) < 1; + +// node_modules/@tanstack/virtual-core/dist/esm/index.js +var defaultKeyExtractor = (index3) => index3; +var defaultRangeExtractor = (range2) => { + const start = Math.max(range2.startIndex - range2.overscan, 0); + const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1); + const arr = []; + for (let i4 = start; i4 <= end; i4++) { + arr.push(i4); + } + return arr; +}; +var observeElementRect = (instance, cb) => { + const element3 = instance.scrollElement; + if (!element3) { + return; + } + const handler = (rect) => { + const { width, height } = rect; + cb({ width: Math.round(width), height: Math.round(height) }); + }; + handler(element3.getBoundingClientRect()); + if (typeof ResizeObserver === "undefined") { + return () => { + }; + } + const observer = new ResizeObserver((entries) => { + const entry = entries[0]; + if (entry == null ? void 0 : entry.borderBoxSize) { + const box = entry.borderBoxSize[0]; + if (box) { + handler({ width: box.inlineSize, height: box.blockSize }); + return; } - return () => { - resizeObserver.disconnect(); + } + handler(element3.getBoundingClientRect()); + }); + observer.observe(element3, { box: "border-box" }); + return () => { + observer.unobserve(element3); + }; +}; +var observeElementOffset = (instance, cb) => { + const element3 = instance.scrollElement; + if (!element3) { + return; + } + const handler = () => { + cb(element3[instance.options.horizontal ? "scrollLeft" : "scrollTop"]); + }; + handler(); + element3.addEventListener("scroll", handler, { + passive: true + }); + return () => { + element3.removeEventListener("scroll", handler); + }; +}; +var measureElement = (element3, entry, instance) => { + if (entry == null ? void 0 : entry.borderBoxSize) { + const box = entry.borderBoxSize[0]; + if (box) { + const size2 = Math.round( + box[instance.options.horizontal ? "inlineSize" : "blockSize"] + ); + return size2; + } + } + return Math.round( + element3.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"] + ); +}; +var elementScroll = (offset2, { + adjustments = 0, + behavior +}, instance) => { + var _a, _b; + const toOffset = offset2 + adjustments; + (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, { + [instance.options.horizontal ? "left" : "top"]: toOffset, + behavior + }); +}; +var Virtualizer = class { + constructor(opts) { + this.unsubs = []; + this.scrollElement = null; + this.isScrolling = false; + this.isScrollingTimeoutId = null; + this.scrollToIndexTimeoutId = null; + this.measurementsCache = []; + this.itemSizeCache = /* @__PURE__ */ new Map(); + this.pendingMeasuredCacheIndexes = []; + this.scrollDirection = null; + this.scrollAdjustments = 0; + this.measureElementCache = /* @__PURE__ */ new Map(); + this.observer = /* @__PURE__ */ (() => { + let _ro = null; + const get2 = () => { + if (_ro) { + return _ro; + } else if (typeof ResizeObserver !== "undefined") { + return _ro = new ResizeObserver((entries) => { + entries.forEach((entry) => { + this._measureElement(entry.target, entry); + }); + }); + } else { + return null; + } }; - }, [menuRef.current]); - const keyDown = (e5) => { - if (e5.key == "Delete" || e5.key == "Backspace") { - if (ref2.current.innerText == "" && props.onDelete) { - props.onDelete(); + return { + disconnect: () => { + var _a; + return (_a = get2()) == null ? void 0 : _a.disconnect(); + }, + observe: (target) => { + var _a; + return (_a = get2()) == null ? void 0 : _a.observe(target, { box: "border-box" }); + }, + unobserve: (target) => { + var _a; + return (_a = get2()) == null ? void 0 : _a.unobserve(target); } + }; + })(); + this.range = null; + this.setOptions = (opts2) => { + Object.entries(opts2).forEach(([key3, value]) => { + if (typeof value === "undefined") + delete opts2[key3]; + }); + this.options = { + debug: false, + initialOffset: 0, + overscan: 1, + paddingStart: 0, + paddingEnd: 0, + scrollPaddingStart: 0, + scrollPaddingEnd: 0, + horizontal: false, + getItemKey: defaultKeyExtractor, + rangeExtractor: defaultRangeExtractor, + onChange: () => { + }, + measureElement, + initialRect: { width: 0, height: 0 }, + scrollMargin: 0, + gap: 0, + scrollingDelay: 150, + indexAttribute: "data-index", + initialMeasurementsCache: [], + lanes: 1, + ...opts2 + }; + }; + this.notify = (sync) => { + var _a, _b; + (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync); + }; + this.maybeNotify = memo3( + () => { + this.calculateRange(); + return [ + this.isScrolling, + this.range ? this.range.startIndex : null, + this.range ? this.range.endIndex : null + ]; + }, + (isScrolling) => { + this.notify(isScrolling); + }, + { + key: false, + debug: () => this.options.debug, + initialDeps: [ + this.isScrolling, + this.range ? this.range.startIndex : null, + this.range ? this.range.endIndex : null + ] } - if (e5.key == "Tab") { - if (props.sections && props.onSelectSection) { - e5.preventDefault(); - e5.stopPropagation(); - setSection((p) => { - const sectionIndex = props.sections.findIndex((g) => g.value == p); - if (e5.shiftKey) { - if (sectionIndex == 0) { - return p; - } - props.onSelectSection(props.sections[sectionIndex - 1].value); - return props.sections[sectionIndex - 1].value; + ); + this.cleanup = () => { + this.unsubs.filter(Boolean).forEach((d4) => d4()); + this.unsubs = []; + this.scrollElement = null; + }; + this._didMount = () => { + this.measureElementCache.forEach(this.observer.observe); + return () => { + this.observer.disconnect(); + this.cleanup(); + }; + }; + this._willUpdate = () => { + const scrollElement = this.options.getScrollElement(); + if (this.scrollElement !== scrollElement) { + this.cleanup(); + this.scrollElement = scrollElement; + this._scrollToOffset(this.scrollOffset, { + adjustments: void 0, + behavior: void 0 + }); + this.unsubs.push( + this.options.observeElementRect(this, (rect) => { + this.scrollRect = rect; + this.maybeNotify(); + }) + ); + this.unsubs.push( + this.options.observeElementOffset(this, (offset2) => { + this.scrollAdjustments = 0; + if (this.scrollOffset === offset2) { + return; } - if (sectionIndex == props.sections.length - 1) { - return p; + if (this.isScrollingTimeoutId !== null) { + clearTimeout(this.isScrollingTimeoutId); + this.isScrollingTimeoutId = null; } - props.onSelectSection(props.sections[sectionIndex + 1].value); - return props.sections[sectionIndex + 1].value; - }); - } + this.isScrolling = true; + this.scrollDirection = this.scrollOffset < offset2 ? "forward" : "backward"; + this.scrollOffset = offset2; + this.maybeNotify(); + this.isScrollingTimeoutId = setTimeout(() => { + this.isScrollingTimeoutId = null; + this.isScrolling = false; + this.scrollDirection = null; + this.maybeNotify(); + }, this.options.scrollingDelay); + }) + ); } - if (e5.key == "ArrowUp") { - const size2 = props.suggestions.length - 1; - const newIndex = index2 < 0 ? size2 : index2 - 1; - if (props.suggestions[newIndex]?.disabled) { - setIndex(newIndex < 0 ? size2 : newIndex - 1); - } else { - setIndex(newIndex); - } - e5.preventDefault(); + }; + this.getSize = () => { + return this.scrollRect[this.options.horizontal ? "width" : "height"]; + }; + this.memoOptions = memo3( + () => [ + this.options.count, + this.options.paddingStart, + this.options.scrollMargin, + this.options.getItemKey + ], + (count3, paddingStart, scrollMargin, getItemKey) => { + this.pendingMeasuredCacheIndexes = []; + return { + count: count3, + paddingStart, + scrollMargin, + getItemKey + }; + }, + { + key: false } - if (e5.key == "ArrowDown") { - const size2 = props.suggestions.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; - if (props.suggestions[newIndex]?.disabled) { - setIndex(newIndex >= size2 ? 0 : newIndex + 1); - } else { - setIndex(newIndex); + ); + this.getFurthestMeasurement = (measurements, index3) => { + const furthestMeasurementsFound = /* @__PURE__ */ new Map(); + const furthestMeasurements = /* @__PURE__ */ new Map(); + for (let m4 = index3 - 1; m4 >= 0; m4--) { + const measurement = measurements[m4]; + if (furthestMeasurementsFound.has(measurement.lane)) { + continue; + } + const previousFurthestMeasurement = furthestMeasurements.get( + measurement.lane + ); + if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) { + furthestMeasurements.set(measurement.lane, measurement); + } else if (measurement.end < previousFurthestMeasurement.end) { + furthestMeasurementsFound.set(measurement.lane, true); + } + if (furthestMeasurementsFound.size === this.options.lanes) { + break; } - e5.preventDefault(); - } - if (e5.key == "Enter") { - props.onSelect(props.suggestions[index2]); - e5.preventDefault(); } + return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a4, b2) => { + if (a4.end === b2.end) { + return a4.index - b2.index; + } + return a4.end - b2.end; + })[0] : void 0; }; - const CLASS_NAMES2 = { - root: "mk-menu-container", - rootFocused: "mk-focused", - selected: "mk-selected", - selectedTagWrapper: "mk-menu-selected-tag-wrapper", - selectedTag: "mk-menu-selected-tag", - selectedTagName: "mk-menu-selected-tag-name", - search: "mk-menu-search", - searchWrapper: "mk-menu-search-container", - searchInput: "mk-menu-search-input", - suggestions: "mk-menu-suggestions", - suggestionActive: "mk-active", - suggestionDisabled: "mk-disabled" - }; - return /* @__PURE__ */ import_react120.default.createElement(import_react120.default.Fragment, null, /* @__PURE__ */ import_react120.default.createElement("div", { - ref: (node) => { - ref2.current = node; - if (outerRef) { - if (typeof outerRef === "function") { - outerRef(node); - } else { - outerRef.current = node; - } + this.getMeasurements = memo3( + () => [this.memoOptions(), this.itemSizeCache], + ({ count: count3, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => { + const min5 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0; + this.pendingMeasuredCacheIndexes = []; + const measurements = this.measurementsCache.slice(0, min5); + for (let i4 = min5; i4 < count3; i4++) { + const key3 = getItemKey(i4); + const furthestMeasurement = this.options.lanes === 1 ? measurements[i4 - 1] : this.getFurthestMeasurement(measurements, i4); + const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin; + const measuredSize = itemSizeCache.get(key3); + const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i4); + const end = start + size2; + const lane = furthestMeasurement ? furthestMeasurement.lane : i4 % this.options.lanes; + measurements[i4] = { + index: i4, + start, + size: size2, + end, + key: key3, + lane + }; } + this.measurementsCache = measurements; + return measurements; }, - onFocus: () => { - if (props.onFocus) { - props.onFocus(); - } - setActive(true); + { + key: false, + debug: () => this.options.debug + } + ); + this.calculateRange = memo3( + () => [this.getMeasurements(), this.getSize(), this.scrollOffset], + (measurements, outerSize, scrollOffset) => { + return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({ + measurements, + outerSize, + scrollOffset + }) : null; }, - onBlur: () => { - if (props.onBlur) - props.onBlur(); - setActive(false); + { + key: false, + debug: () => this.options.debug + } + ); + this.getIndexes = memo3( + () => [ + this.options.rangeExtractor, + this.calculateRange(), + this.options.overscan, + this.options.count + ], + (rangeExtractor, range2, overscan, count3) => { + return range2 === null ? [] : rangeExtractor({ + ...range2, + overscan, + count: count3 + }); }, - "data-placeholder": props.placeholder, - onInput: (e5) => props.onChange(e5.currentTarget.innerText), - onKeyDown: (e5) => keyDown(e5), - className: "mk-suggester", - contentEditable: true - }), active && (0, import_react_dom9.createPortal)( - /* @__PURE__ */ import_react120.default.createElement("div", { - ref: menuRef, - className: `mk-menu mk-menu-suggester ${isReady ? "mk-ready" : ""}`, - style: { - position: "absolute", - top: pos.y, - left: pos.x, - zIndex: 1e3, - width: "300px", - "--mk-menu-max-height": "300px", - visibility: active ? "visible" : "hidden" - } - }, props.sections ? /* @__PURE__ */ import_react120.default.createElement("div", { - className: "mk-menu-sections" - }, props.sections.map((f2, i4) => /* @__PURE__ */ import_react120.default.createElement("div", { - key: i4, - onClick: () => setSection(f2.value), - className: `${section == f2.value ? "is-active" : ""} mk-menu-section` - }, f2.name == "" ? i18n_default.labels.all : f2.name))) : /* @__PURE__ */ import_react120.default.createElement(import_react120.default.Fragment, null), /* @__PURE__ */ import_react120.default.createElement(SelectMenuSuggestions_default, { - expanded: false, - addKeyword: "Add", - options: props.suggestions, - query: "", - refs: null, - hide: () => null, - selectOption: props.onSelect, - id: "", - classNames: CLASS_NAMES2, - index: index2, - setIndex, - allowNew: false, - ui: props.superstate.ui, - isDisclosureMenu: false - })), - document.body - )); - } -); -Suggester.displayName = "Suggester"; - -// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx -function parseContent(input) { - const regex1 = /!\[!\[(.*?)\]\]/; - const regex2 = /!!\[\[(.*?)\]\]/; - const match1 = input.match(regex1); - const match2 = input.match(regex2); - return match1 ? match1[1] : match2 ? match2[1] : input; -} -var FlowNodeView = (props) => { - const { spaceState } = (0, import_react121.useContext)(SpaceContext); - const pathState = (0, import_react121.useMemo)(() => { - const fullPath = props.state?.props?.value; - const path2 = fullPath ? props.superstate.spaceManager.resolvePath( - parseContent(fullPath), - props.source - ) : null; - const uri = props.superstate.spaceManager.uriByString(fullPath); - if (uri?.scheme == "https" || uri?.scheme == "http") { - return { - path: fullPath, - displayName: uri.path, - label: { - sticker: uri.scheme, - name: uri.path, - color: "" - }, - hidden: false, - subtype: "md", - type: "remote" - }; - } - return props.superstate.pathsIndex.get(path2); - }, [props.state, props.source]); - const { updateNode, nodes } = (0, import_react121.useContext)(FramesEditorRootContext); - const { selectionMode } = (0, import_react121.useContext)(FrameSelectionContext); - const [expanded, setExpanded] = (0, import_react121.useState)( - props.state?.styles?.["--mk-expanded"] - ); - const updateValue2 = (newValue) => { - if (newValue != props.state.props?.value) { - if (props.treeNode.editorProps?.linkedNode) { - const node = nodes.find( - (f2) => f2.id == props.treeNode.editorProps.linkedNode.node + { + key: false, + debug: () => this.options.debug + } + ); + this.indexFromElement = (node2) => { + const attributeName = this.options.indexAttribute; + const indexStr = node2.getAttribute(attributeName); + if (!indexStr) { + console.warn( + `Missing attribute name '${attributeName}={index}' on measured element.` ); - updateNode(node, { - props: { - ...node.props, - [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) + return -1; + } + return parseInt(indexStr, 10); + }; + this._measureElement = (node2, entry) => { + const item = this.measurementsCache[this.indexFromElement(node2)]; + if (!item || !node2.isConnected) { + this.measureElementCache.forEach((cached, key3) => { + if (cached === node2) { + this.observer.unobserve(node2); + this.measureElementCache.delete(key3); } }); - } else { - updateNode(props.treeNode.node, { - props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } - }); + return; } - } - }; - const hideToggle = props.state?.styles?.["--mk-link"]; - const { id: id3 } = (0, import_react121.useContext)(FrameInstanceContext); - const [pathString, setPathString] = (0, import_react121.useState)(""); - const options = (0, import_react121.useMemo)(() => { - const fuseOptions = { - keys: ["name", "value"] + const prevNode = this.measureElementCache.get(item.key); + if (prevNode !== node2) { + if (prevNode) { + this.observer.unobserve(prevNode); + } + this.observer.observe(node2); + this.measureElementCache.set(item.key, node2); + } + const measuredItemSize = this.options.measureElement(node2, entry, this); + this.resizeItem(item, measuredItemSize); }; - const suggestions = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden && f2.subtype == "md" || f2.subtype == "space").map((f2) => ({ - name: f2.displayName, - value: f2.path, - description: f2.path, - icon: f2.label?.sticker - })); - const fuse = new Fuse(suggestions, fuseOptions); - return pathString?.length == 0 ? suggestions : fuse.search(pathString).map((result) => result.item); - }, [pathString]); - const toggleCollapse = () => { - setExpanded((p) => !p); - if (selectionMode > 0 /* Read */) - updateNode(props.treeNode.node, { - styles: { - ...props.treeNode.node.styles, - "--mk-expanded": (!props.state?.styles?.["--mk-expanded"]).toString() + this.resizeItem = (item, size2) => { + const itemSize = this.itemSizeCache.get(item.key) ?? item.size; + const delta = size2 - itemSize; + if (delta !== 0) { + if (item.start < this.scrollOffset + this.scrollAdjustments) { + if (false) { + console.info("correction", delta); + } + this._scrollToOffset(this.scrollOffset, { + adjustments: this.scrollAdjustments += delta, + behavior: void 0 + }); } - }); - }; - const [isTransition, startTransition] = (0, import_react121.useTransition)(); - return /* @__PURE__ */ import_react121.default.createElement("div", { - className: "mk-node-flow" - }, !props.state?.styles?.["--mk-min-mode"] && /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, pathState ? /* @__PURE__ */ import_react121.default.createElement("div", { - className: "mk-node-link" - }, /* @__PURE__ */ import_react121.default.createElement(PathCrumb, { - superstate: props.superstate, - path: pathState.path - }), !hideToggle && /* @__PURE__ */ import_react121.default.createElement(CollapseToggle, { - superstate: props.superstate, - collapsed: !expanded, - onToggle: toggleCollapse - })) : selectionMode > 0 /* Read */ && /* @__PURE__ */ import_react121.default.createElement("div", { - className: "mk-node-text-placeholder" - }, /* @__PURE__ */ import_react121.default.createElement(Suggester, { - placeholder: i18n_default.hintText.selectNote, - onChange: (e5) => { - setPathString(e5); - }, - suggestions: options, - superstate: props.superstate, - onSelect: (option) => { - updateValue2(option.value); - } - }))), props.state && expanded && (props.state?.props?.value?.length > 0 ? /* @__PURE__ */ import_react121.default.createElement(PathView, { - id: id3, - superstate: props.superstate, - path: pathState?.path ?? props.state?.props?.value, - containerRef: props.containerRef, - styles: {}, - readOnly: true - }) : /* @__PURE__ */ import_react121.default.createElement("div", { - onClick: () => newPathInSpace( - props.superstate, - spaceState, - "md", - null, - true - ).then((f2) => updateValue2(f2)) - }, "New Note"))); -}; - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameHoverMenu.tsx -var import_react122 = __toESM(require_react()); -var FrameHoverMenu = (props) => { - const { spaceInfo } = (0, import_react122.useContext)(SpaceContext); - const { addNode, moveUp, moveDown, setLastCreatedId } = (0, import_react122.useContext)( - FramesEditorRootContext - ); - const { select, selection: selection2 } = (0, import_react122.useContext)(FrameSelectionContext); - const selected = selection2.includes(props.node.id); - return /* @__PURE__ */ import_react122.default.createElement(import_react122.default.Fragment, null, /* @__PURE__ */ import_react122.default.createElement("div", { - className: `${"mk-editor-frame-hover-horizontal"}`, - style: { - pointerEvents: "auto", - opacity: props.visible ? "1" : "0" - } - }, props.dragRef && /* @__PURE__ */ import_react122.default.createElement("div", { - className: "mk-icon-small mk-editor-frame-hover-button", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//handle") - }, - style: { cursor: "grab" }, - ref: props.dragRef, - onClick: (e5) => { - e5.stopPropagation(); - if (selection2.length == 1 && selected) { - select(null); + this.pendingMeasuredCacheIndexes.push(item.index); + this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2)); + this.notify(false); + } + }; + this.measureElement = (node2) => { + if (!node2) { return; } - if (e5.shiftKey) { - select(props.node.id, true); - } else { - select(props.node.id); + this._measureElement(node2, void 0); + }; + this.getVirtualItems = memo3( + () => [this.getIndexes(), this.getMeasurements()], + (indexes, measurements) => { + const virtualItems = []; + for (let k2 = 0, len = indexes.length; k2 < len; k2++) { + const i4 = indexes[k2]; + const measurement = measurements[i4]; + virtualItems.push(measurement); + } + return virtualItems; + }, + { + key: false, + debug: () => this.options.debug } - }, - ...props.listeners ?? {}, - ...props.attributes ?? {} - }), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react122.default.createElement("div", { - onClick: (e5) => { - addNode(newNode.node, props.node).then( - (f2) => setLastCreatedId(f2.id) + ); + this.getVirtualItemForOffset = (offset2) => { + const measurements = this.getMeasurements(); + return notUndefined( + measurements[findNearestBinarySearch( + 0, + measurements.length - 1, + (index3) => notUndefined(measurements[index3]).start, + offset2 + )] ); - e5.stopPropagation(); - }, - className: "mk-icon-small mk-editor-frame-hover-button", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") - } - }))); -}; - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameNodeEditorContainer.tsx -var import_react123 = __toESM(require_react()); -var FrameNodeEditorContainer = (props) => { - const menuRef = (0, import_react123.useRef)(null); - const [pos, setPos] = (0, import_react123.useState)(0); - const calculateXBasedOnBounds = (targetRect, rect, containerRect) => { - const x2 = targetRect.x - props.containerRect.x; - const overflowX = x2 + rect.width - containerRect.width; - let newX = x2; - if (overflowX > 0) { - if (targetRect.x - props.containerRect.x - rect.width > 0) - newX = containerRect.width - rect.width; - else { - newX = 0; + }; + this.getOffsetForAlignment = (toOffset, align) => { + const size2 = this.getSize(); + if (align === "auto") { + if (toOffset <= this.scrollOffset) { + align = "start"; + } else if (toOffset >= this.scrollOffset + size2) { + align = "end"; + } else { + align = "start"; + } } - } - return newX; - }; - const [ready, setReady] = (0, import_react123.useState)(false); - (0, import_react123.useEffect)(() => { - const resizeObserver = new ResizeObserver((entries) => { - const rect = entries[0].target.getBoundingClientRect(); - setReady(true); - setPos( - calculateXBasedOnBounds(props.nodeRect, rect, props.containerRect) - ); - }); - if (menuRef.current) - resizeObserver.observe(menuRef.current); - return () => { - resizeObserver.disconnect(); + if (align === "start") { + toOffset = toOffset; + } else if (align === "end") { + toOffset = toOffset - size2; + } else if (align === "center") { + toOffset = toOffset - size2 / 2; + } + const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight"; + const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0; + const maxOffset = scrollSize - this.getSize(); + return Math.max(Math.min(maxOffset, toOffset), 0); }; - }, [menuRef]); - return /* @__PURE__ */ import_react123.default.createElement("div", { - className: "mk-editor-frame-node-container", - ref: menuRef, - style: { - visibility: ready ? "visible" : "hidden", - pointerEvents: "auto", - left: pos, - bottom: `calc(100% - ${props.nodeRect.y - props.containerRect.y - 10}px)`, - maxWidth: props.containerRect.width - }, - onClick: (e5) => { - e5.preventDefault(); - e5.stopPropagation(); - } - }, props.children); -}; - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx -var import_classnames6 = __toESM(require_classnames()); -var import_react125 = __toESM(require_react()); - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDraggableHandle.tsx -var import_react124 = __toESM(require_react()); -var FrameDraggableHandle = (props) => { - const [modifier, setModifier] = (0, import_react124.useState)(null); - const startValue = (0, import_react124.useRef)(props.value); - const currentValue = (0, import_react124.useRef)(props.value); - const [, setStartPos] = (0, import_react124.useState)([0, 0]); - const step = props.step ?? 1; - const handleMove = (0, import_react124.useCallback)( - (e5) => { - setStartPos((pos) => { - const { clientX: x2, clientY: y22 } = e5; - const [x1, y1] = pos; - const a4 = props.reverseX ? x1 - x2 : x2 - x1; - const b2 = props.reverseY ? y22 - y1 : y1 - y22; - const mod3 = props.mod ?? 1; - const stepModifer = step * mod3; - let delta = Math.sqrt((a4 + b2) / 2 * (a4 + b2) / 2) * stepModifer; - if (a4 + b2 < 0) - delta = -delta; - if (props.disableX) - delta = b2 * stepModifer; - if (props.disableY) - delta = a4 * stepModifer; - let newValue = startValue.current + delta; - newValue = props.min != null ? Math.max(newValue, props.min) : newValue; - newValue = props.max != null ? Math.min(newValue, props.max) : newValue; - currentValue.current = newValue; - props.onDragMove(newValue, { - ctrlKey: e5.ctrlKey, - metaKey: e5.metaKey, - altKey: e5.altKey, - shiftKey: e5.shiftKey - }); - return pos; - }); - e5.stopPropagation(); - }, - [modifier, props.max, props.min, step, props.onDragMove, props.mod] - ); - const handleMoveEnd = (0, import_react124.useCallback)( - (e5) => { - const captureClick = (e6) => { - e6.stopPropagation(); - window.removeEventListener("click", captureClick, true); - }; - window.addEventListener( - "click", - captureClick, - true - ); - document.removeEventListener("mousemove", handleMove); - document.removeEventListener("mouseup", handleMoveEnd); - props.onDragEnd(currentValue.current, { - ctrlKey: e5.ctrlKey, - metaKey: e5.metaKey, - altKey: e5.altKey, - shiftKey: e5.shiftKey + this.getOffsetForIndex = (index3, align = "auto") => { + index3 = Math.max(0, Math.min(index3, this.options.count - 1)); + const measurement = notUndefined(this.getMeasurements()[index3]); + if (align === "auto") { + if (measurement.end >= this.scrollOffset + this.getSize() - this.options.scrollPaddingEnd) { + align = "end"; + } else if (measurement.start <= this.scrollOffset + this.options.scrollPaddingStart) { + align = "start"; + } else { + return [this.scrollOffset, align]; + } + } + const toOffset = align === "end" ? measurement.end + this.options.scrollPaddingEnd : measurement.start - this.options.scrollPaddingStart; + return [this.getOffsetForAlignment(toOffset, align), align]; + }; + this.isDynamicMode = () => this.measureElementCache.size > 0; + this.cancelScrollToIndex = () => { + if (this.scrollToIndexTimeoutId !== null) { + clearTimeout(this.scrollToIndexTimeoutId); + this.scrollToIndexTimeoutId = null; + } + }; + this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => { + this.cancelScrollToIndex(); + if (behavior === "smooth" && this.isDynamicMode()) { + console.warn( + "The `smooth` scroll behavior is not fully supported with dynamic size." + ); + } + this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), { + adjustments: void 0, + behavior }); - e5.preventDefault(); - e5.stopPropagation(); - }, - [handleMove, props.onDragEnd] - ); - const handleDown = (0, import_react124.useCallback)( - (e5) => { - startValue.current = props.value; - setStartPos([e5.clientX, e5.clientY]); - document.addEventListener("mousemove", handleMove); - document.addEventListener("mouseup", handleMoveEnd); - e5.stopPropagation(); - }, - [handleMove, handleMoveEnd, props.value] - ); - const handleKeyDown = (e5) => { - if (e5.metaKey) { - setModifier("metaKey"); - } else if (e5.ctrlKey) { - setModifier("ctrlKey"); - } else if (e5.altKey) { - setModifier("altKey"); - } else if (e5.shiftKey) { - setModifier("shiftKey"); - } - }; - const handleKeyUp = () => { - setModifier(null); - }; - (0, import_react124.useEffect)(() => { - document.addEventListener("keydown", handleKeyDown); - document.addEventListener("keyup", handleKeyUp); - return () => { - document.removeEventListener("mousemove", handleMove); - document.removeEventListener("mouseup", handleMoveEnd); - document.removeEventListener("keydown", handleKeyDown); - document.removeEventListener("keyup", handleKeyUp); }; - }, []); - return /* @__PURE__ */ import_react124.default.createElement("div", { - className: "mk-frame-draggable-handle", - onMouseDown: handleDown, - "data-placeholder": currentValue.current.toString(), - style: { - cursor: props.cursor, - width: "100%", - height: "100%", - pointerEvents: "auto" - } - }, /* @__PURE__ */ import_react124.default.createElement("span", null)); + this.scrollToIndex = (index3, { align: initialAlign = "auto", behavior } = {}) => { + index3 = Math.max(0, Math.min(index3, this.options.count - 1)); + this.cancelScrollToIndex(); + if (behavior === "smooth" && this.isDynamicMode()) { + console.warn( + "The `smooth` scroll behavior is not fully supported with dynamic size." + ); + } + const [toOffset, align] = this.getOffsetForIndex(index3, initialAlign); + this._scrollToOffset(toOffset, { adjustments: void 0, behavior }); + if (behavior !== "smooth" && this.isDynamicMode()) { + this.scrollToIndexTimeoutId = setTimeout(() => { + this.scrollToIndexTimeoutId = null; + const elementInDOM = this.measureElementCache.has( + this.options.getItemKey(index3) + ); + if (elementInDOM) { + const [toOffset2] = this.getOffsetForIndex(index3, align); + if (!approxEqual(toOffset2, this.scrollOffset)) { + this.scrollToIndex(index3, { align, behavior }); + } + } else { + this.scrollToIndex(index3, { align, behavior }); + } + }); + } + }; + this.scrollBy = (delta, { behavior } = {}) => { + this.cancelScrollToIndex(); + if (behavior === "smooth" && this.isDynamicMode()) { + console.warn( + "The `smooth` scroll behavior is not fully supported with dynamic size." + ); + } + this._scrollToOffset(this.scrollOffset + delta, { + adjustments: void 0, + behavior + }); + }; + this.getTotalSize = () => { + var _a; + const measurements = this.getMeasurements(); + let end; + if (measurements.length === 0) { + end = this.options.paddingStart; + } else { + end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max( + ...measurements.slice(-this.options.lanes).map((m4) => m4.end) + ); + } + return end - this.options.scrollMargin + this.options.paddingEnd; + }; + this._scrollToOffset = (offset2, { + adjustments, + behavior + }) => { + this.options.scrollToFn(offset2, { behavior, adjustments }, this); + }; + this.measure = () => { + this.itemSizeCache = /* @__PURE__ */ new Map(); + this.notify(false); + }; + this.setOptions(opts); + this.scrollRect = this.options.initialRect; + this.scrollOffset = this.options.initialOffset; + this.measurementsCache = this.options.initialMeasurementsCache; + this.measurementsCache.forEach((item) => { + this.itemSizeCache.set(item.key, item.size); + }); + this.maybeNotify(); + } }; - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx -var FrameCorners = (props) => { - const match2 = props.styles.borderRadius ? props.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; - const numericValue = match2 ? parseInt(match2[1]) : 0; - const unit2 = match2 && match2[2] ? match2[2] : "px"; - const [offset2, setOffset] = import_react125.default.useState(Math.max(8, numericValue)); - (0, import_react125.useEffect)(() => { - setOffset(numericValue); - }, [numericValue]); - const handleProps = { - min: 0, - max: Math.min(props.clientSize.height / 2, props.clientSize.width / 2), - value: offset2, - onDragMove: (value) => { - setOffset(value); - }, - onDragEnd: (value) => { - props.saveStyles({ borderRadius: `"${value}${unit2}"` }); - } - }; - const minOffset = Math.max(8, offset2); - return /* @__PURE__ */ import_react125.default.createElement("div", { - style: { - position: "absolute", - top: 0, - left: 0, - width: props.clientSize.width, - height: props.clientSize.height, - display: "flex", - zIndex: 200, - borderRadius: offset2, - border: "1px solid var(--mk-ui-border-accent)" - } - }, /* @__PURE__ */ import_react125.default.createElement("div", { - className: (0, import_classnames6.default)("mk-frame-corners") - }, /* @__PURE__ */ import_react125.default.createElement("div", { - className: "mk-frame-corner", - style: { - position: "absolute", - transform: `translate(${minOffset}px, ${minOffset}px)`, - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, { - ...handleProps, - cursor: "nwse-resize", - reverseY: true - })), /* @__PURE__ */ import_react125.default.createElement("div", { - className: "mk-frame-corner", - style: { - position: "absolute", - transform: `translate(${props.clientSize.width - minOffset}px, ${minOffset}px)`, - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, { - ...handleProps, - cursor: "nesw-resize", - reverseX: true, - reverseY: true - })), /* @__PURE__ */ import_react125.default.createElement("div", { - className: "mk-frame-corner", - style: { - position: "absolute", - transform: `translate(${minOffset}px, ${props.clientSize.height - minOffset}px)`, - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, { - ...handleProps, - cursor: "nesw-resize" - })), /* @__PURE__ */ import_react125.default.createElement("div", { - className: "mk-frame-corner", - style: { - position: "absolute", - transform: `translate(${props.clientSize.width - minOffset}px, ${props.clientSize.height - minOffset}px)`, - zIndex: "var(--mk-layer-editor-overlay)" +var findNearestBinarySearch = (low, high, getCurrentValue, value) => { + while (low <= high) { + const middle = (low + high) / 2 | 0; + const currentValue = getCurrentValue(middle); + if (currentValue < value) { + low = middle + 1; + } else if (currentValue > value) { + high = middle - 1; + } else { + return middle; } - }, /* @__PURE__ */ import_react125.default.createElement(FrameDraggableHandle, { - ...handleProps, - reverseX: true, - cursor: "nwse-resize" - })))); + } + if (low > 0) { + return low - 1; + } else { + return 0; + } }; +function calculateRange({ + measurements, + outerSize, + scrollOffset +}) { + const count3 = measurements.length - 1; + const getOffset = (index3) => measurements[index3].start; + const startIndex = findNearestBinarySearch(0, count3, getOffset, scrollOffset); + let endIndex = startIndex; + while (endIndex < count3 && measurements[endIndex].end < scrollOffset + outerSize) { + endIndex++; + } + return { startIndex, endIndex }; +} -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDropZone.tsx -var import_classnames7 = __toESM(require_classnames()); -var import_react126 = __toESM(require_react()); -var FrameDropZone = (props) => { - const { instance, id: id3 } = (0, import_react126.useContext)(FrameInstanceContext); - const { spaceInfo } = (0, import_react126.useContext)(SpaceContext); - const { setNodeRef } = useDroppable({ - id: props.id + props.direction, - data: { - id: props.id + props.direction, - direction: props.direction, - type: "node", - parent: props.parentId, - root: id3, - frame: props.schemaID, - space: spaceInfo.path, - node: props.node +// node_modules/@tanstack/react-virtual/dist/esm/index.js +var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? React133.useLayoutEffect : React133.useEffect; +function useVirtualizerBase(options) { + const rerender = React133.useReducer(() => ({}), {})[1]; + const resolvedOptions = { + ...options, + onChange: (instance2, sync) => { + var _a; + if (sync) { + (0, import_react_dom7.flushSync)(rerender); + } else { + rerender(); + } + (_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync); } + }; + const [instance] = React133.useState( + () => new Virtualizer(resolvedOptions) + ); + instance.setOptions(resolvedOptions); + React133.useEffect(() => { + return instance._didMount(); + }, []); + useIsomorphicLayoutEffect3(() => { + return instance._willUpdate(); }); - const offset2 = 20; - const left = props.direction == "left" ? -offset2 : props.direction == "right" ? props.width : 0; - const top = props.direction == "bottom" ? props.insertMode != 0 ? props.height : props.height / 2 : props.direction == "top" && props.insertMode != 0 ? -offset2 : 0; - const width = props.direction == "left" || props.direction == "right" ? offset2 : props.width; - const height = props.direction == "top" || props.direction == "bottom" ? props.insertMode != 0 ? offset2 : props.height / 2 : props.height; - const indicator = props.insertMode != 0 ? props.direction == "top" ? "bottom" : props.direction == "bottom" ? "top" : props.direction : props.direction; - return /* @__PURE__ */ import_react126.default.createElement("div", { - ref: setNodeRef, - className: (0, import_classnames7.default)( - props.active ? `mk-indicator-${indicator}` : "", - "mk-frame-drop-zone" - ), - style: { - left, - top, - width, - height - } + return instance; +} +function useVirtualizer(options) { + return useVirtualizerBase({ + observeElementRect, + observeElementOffset, + scrollToFn: elementScroll, + ...options }); -}; -var FrameEditorDropZone = (props) => { - const { frameSchema } = (0, import_react126.useContext)(FramesMDBContext); - const { hoverNode } = (0, import_react126.useContext)(FrameInstanceContext); - const directions2 = [ - ...props.mode == 1 /* DropModeRowColumn */ ? ["top", "bottom", "left", "right"] : props.mode == 2 /* DropModeRowOnly */ ? ["top", "bottom"] : props.mode == 3 /* DropModeColumnOnly */ ? ["left", "right"] : [], - ...props.insertMode == 1 ? ["inside"] : [] - ]; - return /* @__PURE__ */ import_react126.default.createElement("div", { - className: `mk-frame-drop-zone-container`, - style: { - width: props.width, - height: props.height - } - }, directions2.map((d4) => /* @__PURE__ */ import_react126.default.createElement(FrameDropZone, { - ...props, - key: d4, - active: hoverNode?.node == props.node && hoverNode?.direction == d4, - direction: d4, - mode: props.mode, - schemaID: frameSchema.id - }))); -}; +} -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameGapHandle.tsx -var import_react127 = __toESM(require_react()); -var reduceFlexItems = (items, container, xAxis, axisGap) => { - const rows = {}; - let row2 = 0; - let currentRowWidth = 0; - const axisValue = xAxis ? "width" : "height"; - const nonAxisValue = !xAxis ? "width" : "height"; - items.forEach((f2, i4, array) => { - if (i4 == 0) { - rows[row2] = { - start: i4, - end: i4, - maxValue: f2[nonAxisValue], - items: [{ ...f2, row: row2 }] - }; - currentRowWidth = f2[axisValue]; - } else if (array[i4][axisValue] + axisGap > container[axisValue]) { - row2++; - rows[row2] = { - start: i4, - end: i4, - maxValue: f2[nonAxisValue], - items: [{ ...f2, row: row2 }] - }; - } else if (array[i4][axisValue] + axisGap + currentRowWidth > container[axisValue]) { - row2++; - rows[row2] = { - start: i4, - end: i4, - maxValue: f2[nonAxisValue], - items: [{ ...f2, row: row2 }] - }; - currentRowWidth = f2[axisValue]; - } else { - if (rows[row2]) { - rows[row2] = { - start: rows[row2].start, - end: i4, - maxValue: Math.max(rows[row2].maxValue, f2[nonAxisValue]), - items: [...rows[row2].items, { ...f2, row: row2 }] - }; - currentRowWidth += f2[axisValue] + axisGap; - } else { - console.log("Warning: Flexbox found orphan row"); - } - } +// src/core/react/components/Navigator/SpaceTree/SpaceTreeVirtualized.tsx +var import_react138 = __toESM(require_react()); +var VirtualizedList = import_react138.default.memo(function VirtualizedList2(props) { + const { + flattenedTree, + rowHeights, + projected, + vRef, + selectedPaths, + activePath, + selectRange: selectRange2, + handleCollapse, + superstate, + overIndex, + activeIndex, + indentationWidth + } = props; + const parentRef = import_react138.default.useRef(null); + const rowVirtualizer = useVirtualizer({ + count: flattenedTree.length, + paddingEnd: 24, + getScrollElement: () => parentRef.current, + estimateSize: import_react138.default.useCallback((index3) => rowHeights[index3], [rowHeights]), + overscan: 0 }); - return rows; -}; -var FrameGapHandle = (props) => { - const calculateOffset = (value) => { - const match2 = value ? value.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; - const numericValue = match2 ? parseInt(match2[1]) : 0; - return numericValue; + vRef.current = rowVirtualizer; + const { saveActiveSpace } = (0, import_react138.useContext)(NavigatorContext); + const dropIndicator = (index3) => { + return overIndex == index3 && projected && projected.insert; }; - const [offset2, setOffset] = import_react127.default.useState({ - row: calculateOffset(props.styles["rowGap"]), - column: calculateOffset(props.styles["columnGap"]) - }); - (0, import_react127.useEffect)(() => { - setOffset({ - row: calculateOffset(props.styles["rowGap"]), - column: calculateOffset(props.styles["columnGap"]) - }); - }, [props.styles]); - const handleProps = { - value: offset2[props.direction], - onDragMove: (value) => { - setOffset({ - ...offset2, - [props.direction == "column" ? "row" : "column"]: value - }); - }, - onDragEnd: (value) => { - props.saveStyles( - props.direction == "column" ? { - rowGap: `"${value}px"` - } : { - columnGap: `"${value}px"` - } - ); - } + const highlighted = (index3) => { + if (!projected || !flattenedTree[index3] || !projected?.droppable) + return false; + return !projected.sortable && !projected.insert && flattenedTree[index3].parentId && flattenedTree[index3].parentId.startsWith(projected.parentId) || flattenedTree[index3].id == projected.parentId; }; - const offAxisHandleProps = { - value: offset2[props.direction == "column" ? "row" : "column"], - onDragMove: (value) => { - setOffset({ - ...offset2, - [props.direction]: value - }); - }, - onDragEnd: (value) => { - props.saveStyles( - props.direction == "column" ? { - columnGap: `"${value}px"` - } : { - rowGap: `"${value}px"` + const heightBetweenIndex = (start, end) => { + if (start > end) + return rowHeights.slice(end, start).reduce((p2, c3) => p2 + c3, 0); + return -rowHeights.slice(start, end).reduce((p2, c3) => p2 + c3, 0); + }; + const calcYOffset = (index3) => { + if (!projected) + return 0; + if (projected.insert) { + if (projected.copy && !projected.reorder) + return 0; + if (index3 > activeIndex) { + return -rowHeights[index3]; + } else if (index3 == activeIndex) { + return heightBetweenIndex(overIndex, activeIndex); + } else { + return 0; + } + } else if (projected.sortable) { + const targetIndex = overIndex < activeIndex ? overIndex : overIndex; + if (projected.copy && !projected.reorder) { + if (index3 == activeIndex) { + return heightBetweenIndex(targetIndex, activeIndex); + } else if (index3 >= targetIndex) { + return rowHeights[index3]; + } else { + return 0; } - ); + } + if (index3 == activeIndex) { + return heightBetweenIndex(targetIndex, activeIndex); + } else if (index3 > activeIndex && index3 <= targetIndex) { + return -rowHeights[index3]; + } else if (index3 < activeIndex && index3 >= targetIndex) { + return rowHeights[index3]; + } else { + return 0; + } } }; - const rows = (0, import_react127.useMemo)( - () => reduceFlexItems( - props.childSizes, - { - width: props.clientSize.width - props.clientSize.paddingLeft - props.clientSize.paddingRight, - height: props.clientSize.height - props.clientSize.paddingTop - props.clientSize.paddingBottom - }, - props.direction == "row", - offset2[props.direction == "column" ? "row" : "column"] - ), - [props.childSizes, props.clientSize, props.direction, offset2] - ); - const items = (0, import_react127.useMemo)(() => { - const items2 = []; - Object.keys(rows).forEach((f2) => { - items2.push(...rows[f2].items); - }); - return items2; - }, [rows]); - return /* @__PURE__ */ import_react127.default.createElement("div", { - className: `mk-frame-gaps ${parseStylesToClass(props.styles)}`, + return /* @__PURE__ */ import_react138.default.createElement("div", { + ref: parentRef, style: { - position: "absolute", - top: 0, - left: 0, - width: props.clientSize.width, - height: props.clientSize.height, - padding: props.clientSize.paddingTop, - paddingLeft: props.clientSize.paddingLeft, - paddingBottom: props.clientSize.paddingBottom, - paddingRight: props.clientSize.paddingRight, - flexWrap: props.styles.flexWrap + width: `100%`, + height: `100%`, + overflow: "auto", + "--spaceRowHeight": spaceRowHeight(superstate, false) + "px" } - }, props.direction === "row" ? items.map((f2, i4, array) => /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null, /* @__PURE__ */ import_react127.default.createElement("div", { - style: { width: f2.width, height: f2.height } - }), i4 == array.length - 1 ? /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react127.default.createElement("div", { - key: i4, - className: "mk-frame-gap-handle-h", + }, /* @__PURE__ */ import_react138.default.createElement("div", { style: { + height: `${rowVirtualizer.getTotalSize()}px`, width: "100%", - height: Math.max(8, Math.abs(offset2["row"])), - zIndex: "var(--mk-layer-editor-overlay)" + position: "relative" } - }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, { - ...offAxisHandleProps, - cursor: "col-resize", - disableX: true, - reverseY: true - })) : /* @__PURE__ */ import_react127.default.createElement("div", { - key: i4, - className: "mk-frame-gap-handle-v", + }, rowVirtualizer.getVirtualItems().map((virtualRow) => /* @__PURE__ */ import_react138.default.createElement("div", { + key: virtualRow.index, style: { - width: Math.max(8, Math.abs(offset2["column"])), - height: rows[f2.row].maxValue, - zIndex: "var(--mk-layer-editor-overlay)" + position: "absolute", + top: 0, + left: 0, + width: "100%", + height: `${rowHeights[virtualRow.index]}px`, + transform: `translateY(${virtualRow.start}px)` } - }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, { - ...handleProps, - cursor: "col-resize", - disableY: true - })))) : items.map((f2, i4, array) => /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null, /* @__PURE__ */ import_react127.default.createElement("div", { - style: { width: f2.width, height: f2.height } - }), i4 == array.length - 1 ? /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react127.default.createElement("div", { - key: i4, - className: "mk-frame-gap-handle-v", - style: { - height: "100%", - width: Math.max(8, Math.abs(offset2["column"])), - zIndex: "var(--mk-layer-editor-overlay)" + }, flattenedTree[virtualRow.index].type == "new" ? /* @__PURE__ */ import_react138.default.createElement("div", { + className: "mk-tree-wrapper mk-tree-section", + onClick: (e5) => { + const offset2 = e5.target.getBoundingClientRect(); + showSpacesMenu( + offset2, + props.superstate, + (link3, isNew) => { + if (isNew) { + createSpace(props.superstate, link3, {}).then((f2) => { + saveActiveSpace(link3); + props.superstate.ui.openPath(link3, false); + }); + return; + } + saveActiveSpace(link3); + }, + true, + true + ); } - }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, { - ...offAxisHandleProps, - cursor: "col-resize", - disableX: true, - reverseY: true - })) : /* @__PURE__ */ import_react127.default.createElement("div", { - key: i4, - className: "mk-frame-gap-handle-h", - style: { - height: Math.max(8, Math.abs(offset2["row"])), - width: rows[f2.row].maxValue, - zIndex: "var(--mk-layer-editor-overlay)" + }, /* @__PURE__ */ import_react138.default.createElement("div", { + className: "mk-tree-item tree-item-self nav-folder-title mk-tree-new" + }, /* @__PURE__ */ import_react138.default.createElement("div", { + className: `mk-path-icon mk-path-icon-placeholder`, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") } - }, /* @__PURE__ */ import_react127.default.createElement(FrameDraggableHandle, { - ...handleProps, - cursor: "row-resize", - disableX: true, - reverseY: true + }), /* @__PURE__ */ import_react138.default.createElement("div", { + className: "mk-tree-text nav-folder-title-content" + }, i18n_default.menu.openSpace))) : /* @__PURE__ */ import_react138.default.createElement(TreeItem, { + key: flattenedTree[virtualRow.index].id, + id: flattenedTree[virtualRow.index].id, + data: flattenedTree[virtualRow.index], + disabled: false, + depth: flattenedTree[virtualRow.index].depth, + childCount: flattenedTree[virtualRow.index].childrenCount, + indentationWidth, + dragStarted: props.dragStarted, + dragOver: props.dragOver, + dragEnded: props.dragEnded, + dragActive: activeIndex != -1, + indicator: dropIndicator(virtualRow.index), + superstate, + ghost: overIndex != -1 && activeIndex == virtualRow.index, + style: { + opacity: projected && projected.insert && !projected.copy && virtualRow.index == activeIndex ? 0 : 1, + transform: CSS.Translate.toString({ + x: projected && projected.sortable && virtualRow.index == activeIndex && projected ? (projected.depth - flattenedTree[virtualRow.index].depth) * indentationWidth : 0, + y: calcYOffset(virtualRow.index), + scaleX: 0, + scaleY: 0 + }) + }, + onSelectRange: selectRange2, + active: activePath == flattenedTree[virtualRow.index].item?.path, + highlighted: highlighted(virtualRow.index), + selected: selectedPaths.some( + (g) => g.id == flattenedTree[virtualRow.index].id + ), + collapsed: flattenedTree[virtualRow.index].collapsed, + onCollapse: handleCollapse }))))); -}; +}); -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FramePaddingHandle.tsx -var import_classnames8 = __toESM(require_classnames()); -var import_react128 = __toESM(require_react()); -var FramePadding = (props) => { - const paddingTypes = [ - "padding", - "paddingTop", - "paddingBottom", - "paddingLeft", - "paddingRight" - ]; - const [offset2, setOffset] = import_react128.default.useState({ - padding: 0, - paddingTop: null, - paddingBottom: null, - paddingLeft: null, - paddingRight: null - }); - const unit2 = "px"; - (0, import_react128.useEffect)(() => { - const getNumericValue = (type) => { - if (!props.styles[type]) - return null; - const match2 = props.styles[type] ? props.styles[type].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; - const numericValue = Math.max(match2 ? parseInt(match2[1]) : 0, 8); - return numericValue; - }; - setOffset((p) => { - return paddingTypes.reduce((a4, c3) => { - return { - ...a4, - [c3]: getNumericValue(c3) - }; - }, p); - }); - }, [props.styles]); - const [shiftModifier, setShiftModifier] = import_react128.default.useState(false); - const handleProps = { - min: 0, - mod: 2 +// src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx +var treeForSpace = (superstate, space3, path3, depth, parentId, activeId, sortable, root4, parentPath, sort2, expandedSpaces) => { + const tree = []; + const id3 = parentId ? parentId + "/" + space3.path : space3.path; + const spaceCollapsed = !expandedSpaces.includes(id3) || activeId == id3; + const spaceSort = space3.metadata?.sort?.field && space3.metadata?.sort?.field != "rank" ? space3.metadata?.sort : sort2 ?? { + field: "rank", + asc: true, + group: true }; - const inset = (type) => Math.max(5, offset2[type] ?? offset2.padding); - const setNewOffset = (type, value, modifiers) => { - setOffset( - (p) => modifiers.shiftKey ? { - padding: value, - paddingBottom: null, - paddingTop: null, - paddingLeft: null, - paddingRight: null - } : { ...p, [type]: value } + const children = superstate.getSpaceItems(space3.path) ?? []; + if (!spaceCollapsed || root4) { + children.sort(spaceSortFn(spaceSort)).forEach((item) => { + const _parentId = parentId ? parentId + "/" + space3.path : space3.path; + if (item.type != "space") { + tree.push( + pathStateToTreeNode( + superstate, + item, + space3.path, + item.path, + depth + 1, + 0, + true, + space3.sortable, + 0, + _parentId + ) + ); + } else { + if (superstate.spacesIndex.has(item.path)) { + tree.push( + ...treeForSpace( + superstate, + superstate.spacesIndex.get(item.path), + item, + depth + 1, + _parentId, + activeId, + space3.sortable, + false, + space3.path, + sort2, + expandedSpaces + ) + ); + } + } + }); + } + if (!root4) + tree.splice( + 0, + 0, + spaceToTreeNode( + path3, + spaceCollapsed, + sortable, + depth, + parentId, + parentPath, + tree.length + ) ); + return tree; +}; +var treeForRoot = (superstate, space3, active, expandedSpaces) => { + const tree = []; + const pathIndex = superstate.pathsIndex.get(space3.path); + if (pathIndex) + tree.push({ + id: space3.path, + parentId: null, + depth: 0, + index: 0, + space: space3.path, + path: space3.path, + item: pathIndex, + rank: null, + collapsed: expandedSpaces.includes(space3.path) ? false : true, + sortable: space3.sortable, + childrenCount: [...superstate.spacesMap.getInverse(space3.path) ?? []].length, + type: "group" + }); + const spaceSort = space3.metadata?.sort ?? { + field: "rank", + asc: true, + group: true }; - const saveValue = (type, value, modifiers) => { - props.saveStyles( - modifiers.shiftKey ? { - padding: `'${value}${unit2}'`, - paddingBottom: "", - paddingTop: "", - paddingLeft: "", - paddingRight: "" - } : { [type]: `'${value}${unit2}'` } + if (!expandedSpaces.includes(space3.path) || active && !active.parentId) { + return tree; + } + const children = superstate.getSpaceItems(space3.path) ?? []; + children.sort(spaceSortFn(spaceSort)).forEach((item) => { + const _parentId = space3.path; + if (item.type != "space") { + const id3 = _parentId + "/" + item.path; + const itemCollapsed = !expandedSpaces.includes(id3); + tree.push( + pathStateToTreeNode( + superstate, + item, + space3.path, + item.path, + 1, + 0, + itemCollapsed, + space3.sortable, + 0, + _parentId + ) + ); + } else { + if (superstate.spacesIndex.has(item.path)) + tree.push( + ...treeForSpace( + superstate, + superstate.spacesIndex.get(item.path), + item, + 1, + _parentId, + active?.id, + space3.sortable, + false, + space3.path, + spaceSort, + expandedSpaces + ) + ); + } + }); + return tree; +}; +var retrieveData = (superstate, activeViewSpaces, active, expandedSpaces) => { + const tree = []; + activeViewSpaces.filter((f2) => f2).forEach((activeViewSpace) => { + tree.push( + ...treeForRoot(superstate, activeViewSpace, active, expandedSpaces) ); - }; - (0, import_react128.useEffect)(() => { - const handleKeyDown = (e5) => { - if (e5.key === "Shift") { - setShiftModifier(true); - } + }); + tree.push({ + id: "placeholder", + parentId: null, + depth: 0, + index: 0, + space: null, + type: "new", + path: null, + childrenCount: 0, + collapsed: false, + rank: 0 + }); + return tree; +}; +var SpaceTreeComponent = (props) => { + const { superstate } = props; + const indentationWidth = isTouchScreen(props.superstate.ui) ? 20 : 16; + const [expandedSpaces, setExpandedSpaces] = (0, import_react139.useState)( + superstate.settings.expandedSpaces + ); + const { + activePath, + activeViewSpaces, + setActivePath, + selectedPaths, + setSelectedPaths, + dragPaths, + setDragPaths, + modifier, + setModifier + } = (0, import_react139.useContext)(NavigatorContext); + const [active, setActive] = (0, import_react139.useState)(null); + const [overId, setOverId] = (0, import_react139.useState)(null); + const [flattenedTree, setFlattenedTree] = (0, import_react139.useState)([]); + const nextTreeScrollPath = (0, import_react139.useRef)(null); + const [offset2, setOffset] = (0, import_react139.useState)({ x: 0, y: 0 }); + const listRef = (0, import_react139.useRef)(null); + const refreshableSpaces = (0, import_react139.useMemo)( + () => [ + ...activeViewSpaces.filter((f2) => f2).map((f2) => f2.path), + ...flattenedTree.filter((f2) => f2.type == "space").map((f2) => f2.path) + ].filter((f2) => f2), + [activeViewSpaces, flattenedTree] + ); + (0, import_react139.useEffect)(() => { + if (selectedPaths.length <= 1) { + if (!selectedPaths[0] || selectedPaths[0].item.path != activePath) + setSelectedPaths([]); + if (superstate.settings.revealActiveFile) + revealPath(activePath); + } + props.superstate.ui.eventsDispatch.addListener( + "activePathChanged", + changeActivePath + ); + return () => { + props.superstate.ui.eventsDispatch.removeListener( + "activePathChanged", + changeActivePath + ); }; - const handleKeyUp = (e5) => { - if (e5.key === "Shift") { - setShiftModifier(false); - } + }, [activePath]); + (0, import_react139.useEffect)(() => { + window.addEventListener("dragend", resetState); + return () => { + window.removeEventListener("dragend", resetState); }; - window.addEventListener("keydown", handleKeyDown); - window.addEventListener("keyup", handleKeyUp); + }); + (0, import_react139.useEffect)(() => { + const settingsChanged = () => { + setExpandedSpaces(superstate.settings.expandedSpaces); + }; + superstate.eventsDispatcher.addListener("settingsChanged", settingsChanged); return () => { - window.removeEventListener("keydown", handleKeyDown); - window.removeEventListener("keyup", handleKeyUp); + superstate.eventsDispatcher.removeListener( + "settingsChanged", + settingsChanged + ); }; - }, []); - return /* @__PURE__ */ import_react128.default.createElement("div", { - style: { - position: "absolute", - top: 0, - left: 0, - width: props.clientSize.width, - height: props.clientSize.height, - display: "flex", - zIndex: 200, - border: "1px solid var(--mk-ui-color-border-accent)" - } - }, /* @__PURE__ */ import_react128.default.createElement("div", { - className: (0, import_classnames8.default)( - "mk-frame-paddings", - shiftModifier && "mk-modifier-shift" - ) - }, /* @__PURE__ */ import_react128.default.createElement("div", { - className: "mk-frame-padding-handle-h", - style: { - position: "absolute", - transform: `translate(${0}px, ${0}px)`, - height: inset("paddingTop"), - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, { - ...handleProps, - value: offset2["paddingTop"] ?? offset2.padding, - cursor: "s-resize", - max: props.clientSize.height, - onDragMove: (value, modifiers) => { - setNewOffset("paddingTop", value, modifiers); - }, - onDragEnd: (value, modifiers) => { - saveValue("paddingTop", value, modifiers); - }, - reverseY: true, - disableX: true - })), /* @__PURE__ */ import_react128.default.createElement("div", { - className: "mk-frame-padding-handle-v", - style: { - position: "absolute", - transform: `translate(${props.clientSize.width - inset("paddingRight")}px, ${0}px)`, - width: inset("paddingRight"), - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, { - ...handleProps, - value: offset2["paddingRight"] ?? offset2.padding, - cursor: "w-resize", - onDragMove: (value, modifiers) => { - setNewOffset("paddingRight", value, modifiers); - }, - max: props.clientSize.width, - onDragEnd: (value, modifiers) => { - saveValue("paddingRight", value, modifiers); - }, - reverseX: true, - reverseY: true, - disableY: true - })), /* @__PURE__ */ import_react128.default.createElement("div", { - className: "mk-frame-padding-handle-v", - style: { - position: "absolute", - transform: `translate(${0}px, ${0}px)`, - width: inset("paddingLeft"), - zIndex: "var(--mk-layer-editor-overlay)" - } - }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, { - ...handleProps, - value: offset2["paddingLeft"] ?? offset2.padding, - cursor: "e-resize", - max: props.clientSize.width, - onDragMove: (value, modifiers) => { - setNewOffset("paddingLeft", value, modifiers); + }, [activeViewSpaces, active, setExpandedSpaces, setFlattenedTree]); + const revealPath = (0, import_react139.useCallback)( + (path3) => { + if (!path3 || !activeViewSpaces?.some((f2) => f2.path == "/")) + return; + const folders = path3.split("/"); + const openPaths = folders.reduce( + (p2, c3, index3) => [ + ...p2, + index3 == 0 ? "//" + c3 : p2[index3] + "/" + folders.slice(0, index3 + 1).join("/") + ], + ["/"] + ).slice(0, -1); + const newOpenFolders = [ + ...expandedSpaces.filter((f2) => !openPaths.find((g) => g == f2)) ?? [], + ...openPaths + ]; + superstate.settings.expandedSpaces = newOpenFolders; + nextTreeScrollPath.current = "/" + path3; + superstate.saveSettings(); }, - onDragEnd: (value, modifiers) => { - saveValue("paddingLeft", value, modifiers); + [expandedSpaces, activeViewSpaces] + ); + (0, import_react139.useEffect)(() => { + const handleRevealPathEvent = (evt) => { + if (evt.detail) + revealPath(evt.detail.path); + }; + window.addEventListener(eventTypes.revealPath, handleRevealPathEvent); + return () => { + window.removeEventListener(eventTypes.revealPath, handleRevealPathEvent); + }; + }, [revealPath]); + (0, import_react139.useEffect)(() => { + const reloadData = () => { + setFlattenedTree( + retrieveData(superstate, activeViewSpaces, active, expandedSpaces) + ); + }; + const spaceUpdated = (payload) => { + if (refreshableSpaces.some((f2) => f2 == payload.path)) { + reloadData(); + } + }; + props.superstate.eventsDispatcher.addListener( + "spaceStateUpdated", + spaceUpdated + ); + return () => { + props.superstate.eventsDispatcher.removeListener( + "spaceStateUpdated", + spaceUpdated + ); + }; + }, [ + expandedSpaces, + activeViewSpaces, + active, + expandedSpaces, + refreshableSpaces, + setFlattenedTree + ]); + (0, import_react139.useEffect)(() => { + setFlattenedTree( + retrieveData(superstate, activeViewSpaces, active, expandedSpaces) + ); + }, [expandedSpaces, activeViewSpaces, active]); + const changeActivePath = (path3) => { + setActivePath(path3); + }; + const overIndex = (0, import_react139.useMemo)( + () => flattenedTree.findIndex((f2) => f2.id == overId), + [overId, flattenedTree] + ); + const activeIndex = (0, import_react139.useMemo)( + () => active?.id ? flattenedTree.findIndex((f2) => f2.id == active.id) : -1, + [active, flattenedTree] + ); + const sortedIds = (0, import_react139.useMemo)( + () => flattenedTree.map(({ id: id3 }) => id3), + [flattenedTree] + ); + const selectRange2 = (0, import_react139.useCallback)( + (fromId) => { + const startIndex = sortedIds.findIndex((f2) => f2 == fromId); + const selectedPathsStartIndex = sortedIds.findIndex( + (f2) => f2 == selectedPaths[0]?.id + ); + const selectedPathsEndIndex = sortedIds.findIndex( + (f2) => f2 == selectedPaths[selectedPaths.length - 1]?.id + ); + if (startIndex < selectedPathsStartIndex) { + setSelectedPaths( + flattenedTree.slice(startIndex, selectedPathsEndIndex + 1).filter((f2) => f2.item) + ); + } else { + setSelectedPaths( + flattenedTree.slice(selectedPathsStartIndex, startIndex + 1).filter((f2) => f2.item) + ); + } }, - disableY: true - })), /* @__PURE__ */ import_react128.default.createElement("div", { - className: "mk-frame-padding-handle-h", - style: { - position: "absolute", - transform: `translate(${0}px, ${props.clientSize.height - inset("paddingBottom")}px)`, - height: inset("paddingBottom"), - zIndex: "var(--mk-layer-editor-overlay)" + [sortedIds, selectedPaths, setSelectedPaths, flattenedTree] + ); + const [projected, setProjected] = (0, import_react139.useState)(null); + (0, import_react139.useEffect)(() => { + const dragDepth = getDragDepth(offset2.x, indentationWidth); + const _projected = overId ? getProjection( + active, + flattenedTree, + dragPaths, + overIndex, + dragDepth, + offset2.y, + activeIndex < overIndex, + modifier, + active?.space + ) : null; + setProjected((p2) => !(0, import_lodash17.isEqual)(p2, _projected) ? _projected : p2); + }, [ + active, + flattenedTree, + overId, + overIndex, + dragPaths, + offset2, + activeIndex, + modifier, + indentationWidth, + activeViewSpaces + ]); + const dragStarted = (activeId) => { + const activeItem = flattenedTree.find(({ id: id3 }) => id3 === activeId); + setActive(activeItem); + setOverId(activeId); + if (activeItem) { + if (selectedPaths.length > 1) { + setDragPaths(selectedPaths.map((f2) => f2.path)); + } else { + setDragPaths([activeItem.path]); + } } - }, /* @__PURE__ */ import_react128.default.createElement(FrameDraggableHandle, { - ...handleProps, - value: offset2["paddingBottom"] ?? offset2.padding, - cursor: "n-resize", - max: props.clientSize.height, - onDragMove: (value, modifiers) => { - setNewOffset("paddingBottom", value, modifiers); - }, - onDragEnd: (value, modifiers) => { - saveValue("paddingBottom", value, modifiers); - }, - reverseX: true, - disableX: true - })))); -}; - -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx -var import_classnames9 = __toESM(require_classnames()); - -// node_modules/re-resizable/lib/index.js -var React127 = __toESM(require_react()); -var import_react_dom10 = __toESM(require_react_dom()); - -// node_modules/re-resizable/lib/resizer.js -var React126 = __toESM(require_react()); -var __extends = function() { - var extendStatics = function(d4, b2) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { - d5.__proto__ = b3; - } || function(d5, b3) { - for (var p in b3) - if (Object.prototype.hasOwnProperty.call(b3, p)) - d5[p] = b3[p]; - }; - return extendStatics(d4, b2); + document.body.style.setProperty("cursor", "grabbing"); }; - return function(d4, b2) { - extendStatics(d4, b2); - function __() { - this.constructor = d4; + const parentName = (0, import_react139.useMemo)( + () => projected ? flattenedTree.find((f2) => f2.id == projected.parentId)?.item?.name : null, + [flattenedTree, projected] + ); + const overName = (0, import_react139.useMemo)( + () => projected && flattenedTree.find((f2) => f2.id == projected.overId)?.item?.name, + [flattenedTree, projected] + ); + const dragOver = (e5, _overId, position3) => { + const modifier2 = eventToModifier(e5); + setModifier(modifier2); + e5.dataTransfer.dropEffect = modifier2; + if (projected) { + superstate.ui.setDragLabel( + `${projected.reorder && !projected.insert ? i18n_default.labels.reorderIn : modifier2 == "move" || !modifier2 ? i18n_default.labels.moveTo : modifier2 == "link" ? i18n_default.labels.addTo : i18n_default.labels.copyTo} ${projected.insert ? overName : parentName ?? "Spaces"}` + ); + } + if (dragPaths.length > 1) { + if (_overId && _overId != overId) + setOverId(_overId); + return; + } + if (_overId && _overId != overId) + setOverId(_overId); + const x2 = offset2.x; + const y3 = offset2.y; + const newX = 2 * Math.round(Math.max(1, position3.x - indentationWidth - 20)); + const newY = 2 * Math.round(position3.y / 2); + if (x2 != newX || y3 != newY) { + setOffset({ + x: newX, + y: newY + }); } - d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); }; -}(); -var __assign2 = function() { - __assign2 = Object.assign || function(t5) { - for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) { - s4 = arguments[i4]; - for (var p in s4) - if (Object.prototype.hasOwnProperty.call(s4, p)) - t5[p] = s4[p]; + (0, import_react139.useEffect)(() => { + if (dragPaths.length == 0) { + setOverId(null); + setActive(null); + setOffset({ x: 0, y: 0 }); + setModifier(null); + setProjected(null); + dragCounter.current = 0; + document.body.style.setProperty("cursor", ""); } - return t5; + }, [dragPaths]); + const dragEnded = (e5, overId2) => { + const modifiers = eventToModifier(e5); + dropPathsInTree( + superstate, + dragPaths, + active?.id, + overId2, + projected, + flattenedTree, + activeViewSpaces, + modifiers + ); + resetState(); }; - return __assign2.apply(this, arguments); -}; -var rowSizeBase = { - width: "100%", - height: "10px", - top: "0px", - left: "0px", - cursor: "row-resize" -}; -var colSizeBase = { - width: "10px", - height: "100%", - top: "0px", - left: "0px", - cursor: "col-resize" -}; -var edgeBase = { - width: "20px", - height: "20px", - position: "absolute" -}; -var styles = { - top: __assign2(__assign2({}, rowSizeBase), { top: "-5px" }), - right: __assign2(__assign2({}, colSizeBase), { left: void 0, right: "-5px" }), - bottom: __assign2(__assign2({}, rowSizeBase), { top: void 0, bottom: "-5px" }), - left: __assign2(__assign2({}, colSizeBase), { left: "-5px" }), - topRight: __assign2(__assign2({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }), - bottomRight: __assign2(__assign2({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }), - bottomLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }), - topLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" }) -}; -var Resizer = function(_super) { - __extends(Resizer2, _super); - function Resizer2() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.onMouseDown = function(e5) { - _this.props.onResizeStart(e5, _this.props.direction); - }; - _this.onTouchStart = function(e5) { - _this.props.onResizeStart(e5, _this.props.direction); - }; - return _this; + const handleCollapse = (0, import_react139.useCallback)( + (folder, open) => { + const folderOpen = expandedSpaces?.includes(folder.id); + const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter( + (openFolder) => folder.id !== openFolder + ); + superstate.settings.expandedSpaces = newOpenFolders; + superstate.saveSettings(); + }, + [superstate, expandedSpaces] + ); + function resetState() { + setDragPaths([]); + setOverId(null); + setActive(null); + setOffset({ x: 0, y: 0 }); + setModifier(null); + setProjected(null); + dragCounter.current = 0; + document.body.style.setProperty("cursor", ""); } - Resizer2.prototype.render = function() { - return React126.createElement("div", { className: this.props.className || "", style: __assign2(__assign2({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children); - }; - return Resizer2; -}(React126.PureComponent); - -// node_modules/re-resizable/lib/index.js -var __extends2 = function() { - var extendStatics = function(d4, b2) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { - d5.__proto__ = b3; - } || function(d5, b3) { - for (var p in b3) - if (Object.prototype.hasOwnProperty.call(b3, p)) - d5[p] = b3[p]; - }; - return extendStatics(d4, b2); + const dragCounter = (0, import_react139.useRef)(0); + const dragEnter = () => { + dragCounter.current++; }; - return function(d4, b2) { - extendStatics(d4, b2); - function __() { - this.constructor = d4; + const dragLeave = () => { + dragCounter.current--; + if (dragCounter.current == 0) { + setOverId(null); + setOffset({ x: 0, y: 0 }); + setProjected(null); + dragCounter.current = 0; } - d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); }; -}(); -var __assign3 = function() { - __assign3 = Object.assign || function(t5) { - for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) { - s4 = arguments[i4]; - for (var p in s4) - if (Object.prototype.hasOwnProperty.call(s4, p)) - t5[p] = s4[p]; + const rowHeights = (0, import_react139.useMemo)( + () => flattenedTree.map((f2) => spaceRowHeight(superstate, f2.type == "group")), + [flattenedTree] + ); + return /* @__PURE__ */ import_react139.default.createElement("div", { + className: `mk-path-tree`, + onDragEnter: () => dragEnter(), + onDragLeave: () => dragLeave(), + onDragOver: (e5) => e5.preventDefault(), + onDrop: (e5) => { + if (overId) { + dragEnded(e5, overId); + } else { + resetState(); + } } - return t5; - }; - return __assign3.apply(this, arguments); -}; -var DEFAULT_SIZE = { - width: "auto", - height: "auto" -}; -var clamp2 = function(n3, min5, max5) { - return Math.max(Math.min(n3, max5), min5); -}; -var snap = function(n3, size2) { - return Math.round(n3 / size2) * size2; -}; -var hasDirection = function(dir, target) { - return new RegExp(dir, "i").test(target); -}; -var isTouchEvent2 = function(event) { - return Boolean(event.touches && event.touches.length); -}; -var isMouseEvent = function(event) { - return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0)); -}; -var findClosestSnap = function(n3, snapArray, snapGap) { - if (snapGap === void 0) { - snapGap = 0; - } - var closestGapIndex = snapArray.reduce(function(prev, curr, index2) { - return Math.abs(curr - n3) < Math.abs(snapArray[prev] - n3) ? index2 : prev; - }, 0); - var gap = Math.abs(snapArray[closestGapIndex] - n3); - return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n3; -}; -var getStringSize = function(n3) { - n3 = n3.toString(); - if (n3 === "auto") { - return n3; - } - if (n3.endsWith("px")) { - return n3; - } - if (n3.endsWith("%")) { - return n3; - } - if (n3.endsWith("vh")) { - return n3; - } - if (n3.endsWith("vw")) { - return n3; - } - if (n3.endsWith("vmax")) { - return n3; - } - if (n3.endsWith("vmin")) { - return n3; - } - return n3 + "px"; + }, /* @__PURE__ */ import_react139.default.createElement(VirtualizedList, { + vRef: listRef, + rowHeights, + flattenedTree, + projected, + handleCollapse, + activePath, + superstate, + selectedPaths, + selectRange: selectRange2, + indentationWidth, + dragStarted, + dragOver, + dragEnded, + overIndex, + activeIndex + }), modifier && !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react139.default.createElement("div", { + className: "mk-hint-dnd", + style: { + position: "absolute", + bottom: "10px", + left: "10px", + background: "var(--mk-ui-active)", + boxShadow: "var(--background-modifier-box-shadow)", + padding: "4px 8px", + borderRadius: "4px", + color: "var(--text-on-accent)", + fontSize: "12px" + } + }, /* @__PURE__ */ import_react139.default.createElement("div", null, i18n_default.hintText.dragDropModifierKeys.replace("${1}", "shift").replace("${2}", normalizedAltName())))); }; -var getPixelSize = function(size2, parentSize, innerWidth2, innerHeight2) { - if (size2 && typeof size2 === "string") { - if (size2.endsWith("px")) { - return Number(size2.replace("px", "")); + +// src/core/react/components/Navigator/MainList.tsx +var import_react143 = __toESM(require_react()); + +// src/core/react/components/Navigator/MainMenu.tsx +var import_classnames5 = __toESM(require_classnames()); +var import_react140 = __toESM(require_react()); +var MainMenu = (props) => { + const { superstate } = props; + const { setActivePath, setDragPaths } = (0, import_react140.useContext)(NavigatorContext); + const ref2 = (0, import_react140.useRef)(); + return /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-main-menu-container" + }, /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-main-menu-inner" + }, /* @__PURE__ */ import_react140.default.createElement("div", { + className: (0, import_classnames5.default)("mk-main-menu") + }, /* @__PURE__ */ import_react140.default.createElement("div", { + className: `mk-main-menu-button mk-main-menu-button-primary`, + ref: ref2, + onClick: (e5) => { + props.superstate.ui.mainMenu(ref2.current, superstate); } - if (size2.endsWith("%")) { - var ratio = Number(size2.replace("%", "")) / 100; - return parentSize * ratio; + }, props.superstate.settings.systemName, /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//chevrons-up-down") } - if (size2.endsWith("vw")) { - var ratio = Number(size2.replace("vw", "")) / 100; - return innerWidth2 * ratio; + })), /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-main-menu-button", + onClick: (e5) => props.superstate.ui.quickOpen(superstate) + }, /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//search") } - if (size2.endsWith("vh")) { - var ratio = Number(size2.replace("vh", "")) / 100; - return innerHeight2 * ratio; + }))), /* @__PURE__ */ import_react140.default.createElement("button", { + "aria-label": i18n_default.buttons.newNote, + className: "mk-main-menu-button", + onClick: (e5) => defaultAddAction(superstate, null, e5.metaKey ? "tab" : false) + }, /* @__PURE__ */ import_react140.default.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//new-note") } - } - return size2; + })))); }; -var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) { - maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2); - maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2); - minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2); - minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2); - return { - maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth), - maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight), - minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth), - minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight) - }; + +// src/core/react/components/Navigator/Waypoints/Waypoints.tsx +var import_react142 = __toESM(require_react()); +var import_react_dom8 = __toESM(require_react_dom()); + +// src/core/react/components/Navigator/Waypoints/Waypoint.tsx +var import_classnames6 = __toESM(require_classnames()); +var import_react141 = __toESM(require_react()); +var SortablePinnedSpaceItem = ({ + id: id3, + index: index3, + ...props +}) => { + return /* @__PURE__ */ import_react141.default.createElement(PinnedSpace, { + index: index3, + ...props + }); }; -var definedProps = [ - "as", - "style", - "className", - "grid", - "snap", - "bounds", - "boundsByDirection", - "size", - "defaultSize", - "minWidth", - "minHeight", - "maxWidth", - "maxHeight", - "lockAspectRatio", - "lockAspectRatioExtraWidth", - "lockAspectRatioExtraHeight", - "enable", - "handleStyles", - "handleClasses", - "handleWrapperStyle", - "handleWrapperClass", - "children", - "onResizeStart", - "onResize", - "onResizeStop", - "handleComponent", - "scale", - "resizeRatio", - "snapGap" -]; -var baseClassName = "__resizable_base__"; -var Resizable = function(_super) { - __extends2(Resizable2, _super); - function Resizable2(props) { - var _this = _super.call(this, props) || this; - _this.ratio = 1; - _this.resizable = null; - _this.parentLeft = 0; - _this.parentTop = 0; - _this.resizableLeft = 0; - _this.resizableRight = 0; - _this.resizableTop = 0; - _this.resizableBottom = 0; - _this.targetLeft = 0; - _this.targetTop = 0; - _this.appendBase = function() { - if (!_this.resizable || !_this.window) { - return null; - } - var parent = _this.parentNode; - if (!parent) { - return null; - } - var element = _this.window.document.createElement("div"); - element.style.width = "100%"; - element.style.height = "100%"; - element.style.position = "absolute"; - element.style.transform = "scale(0, 0)"; - element.style.left = "0"; - element.style.flex = "0 0 100%"; - if (element.classList) { - element.classList.add(baseClassName); - } else { - element.className += baseClassName; +var PinnedSpace = (0, import_react141.forwardRef)( + ({ + pin, + indicator, + highlighted, + superstate, + style, + clone: clone5, + ghost, + dragStart, + dragOver, + dragEnded, + index: index3 + }, ref2) => { + const innerRef = (0, import_react141.useRef)(null); + const { + activePath, + waypoints, + setWaypoints, + setModifier + } = (0, import_react141.useContext)(NavigatorContext); + const onDragStarted = (e5) => { + if (dragStart && pin) { + dragStart(index3); } - parent.appendChild(element); - return element; }; - _this.removeBase = function(base2) { - var parent = _this.parentNode; - if (!parent) { - return; + const onDragEnded = (e5) => { + if (dragEnded) { + dragEnded(); } - parent.removeChild(base2); }; - _this.ref = function(c3) { - if (c3) { - _this.resizable = c3; - } + const innerProps = { + draggable: true, + onDragStart: onDragStarted, + onDragEnd: onDragEnded, + onDrop: onDragEnded }; - _this.state = { - isResizing: false, - width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width, - height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height, - direction: "right", - original: { - x: 0, - y: 0, - width: 0, - height: 0 + return pin ? /* @__PURE__ */ import_react141.default.createElement("div", { + onContextMenu: (e5) => { + const menuOptions = [ + { + name: "Change Sticker", + icon: "ui//edit", + value: "change-sticker", + onClick: () => { + superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react141.default.createElement(StickerModal_default, { + ui: superstate.ui, + hide: _props.hide, + selectedSticker: (emoji) => { + setWaypoints( + waypoints.map( + (f2, i4) => i4 == index3 ? { ...f2, sticker: emoji } : f2 + ) + ); + } + })); + } + }, + { + name: "Close", + icon: "ui//close", + value: "close", + onClick: () => { + setWaypoints(waypoints.filter((f2, i4) => i4 != index3)); + superstate.saveSettings(); + } + } + ]; + superstate.ui.openMenu( + e5.target.getBoundingClientRect(), + defaultMenu(superstate.ui, menuOptions) + ); }, - backgroundStyle: { - height: "100%", - width: "100%", - backgroundColor: "rgba(0,0,0,0)", - cursor: "auto", - opacity: 0, - position: "fixed", - zIndex: 9999, - top: "0", - left: "0", - bottom: "0", - right: "0" + ref: innerRef, + className: "mk-waypoint", + onClick: (e5) => { + superstate.settings.currentWaypoint = index3; + superstate.saveSettings(); }, - flexBasis: void 0 - }; - _this.onResizeStart = _this.onResizeStart.bind(_this); - _this.onMouseMove = _this.onMouseMove.bind(_this); - _this.onMouseUp = _this.onMouseUp.bind(_this); - return _this; - } - Object.defineProperty(Resizable2.prototype, "parentNode", { - get: function() { - if (!this.resizable) { - return null; - } - return this.resizable.parentNode; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "window", { - get: function() { - if (!this.resizable) { - return null; - } - if (!this.resizable.ownerDocument) { - return null; - } - return this.resizable.ownerDocument.defaultView; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "propsSize", { - get: function() { - return this.props.size || this.props.defaultSize || DEFAULT_SIZE; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "size", { - get: function() { - var width = 0; - var height = 0; - if (this.resizable && this.window) { - var orgWidth = this.resizable.offsetWidth; - var orgHeight = this.resizable.offsetHeight; - var orgPosition = this.resizable.style.position; - if (orgPosition !== "relative") { - this.resizable.style.position = "relative"; - } - width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth; - height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight; - this.resizable.style.position = orgPosition; - } - return { width, height }; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "sizeStyle", { - get: function() { - var _this = this; - var size2 = this.props.size; - var getSize = function(key2) { - if (typeof _this.state[key2] === "undefined" || _this.state[key2] === "auto") { - return "auto"; - } - if (_this.propsSize && _this.propsSize[key2] && _this.propsSize[key2].toString().endsWith("%")) { - if (_this.state[key2].toString().endsWith("%")) { - return _this.state[key2].toString(); - } - var parentSize = _this.getParentSize(); - var value = Number(_this.state[key2].toString().replace("px", "")); - var percent = value / parentSize[key2] * 100; - return percent + "%"; - } - return getStringSize(_this.state[key2]); - }; - var width = size2 && typeof size2.width !== "undefined" && !this.state.isResizing ? getStringSize(size2.width) : getSize("width"); - var height = size2 && typeof size2.height !== "undefined" && !this.state.isResizing ? getStringSize(size2.height) : getSize("height"); - return { width, height }; - }, - enumerable: false, - configurable: true - }); - Resizable2.prototype.getParentSize = function() { - if (!this.parentNode) { - if (!this.window) { - return { width: 0, height: 0 }; + onDragOver: (e5) => { + e5.preventDefault(); + setModifier(eventToModifier(e5)); + if (!innerRef.current) + return; + const rect = innerRef.current.getBoundingClientRect(); + const x2 = e5.clientX - rect.left; + if (dragOver && pin) + dragOver(index3, x2); + }, + ...innerProps + }, /* @__PURE__ */ import_react141.default.createElement("div", { + ref: ref2, + className: (0, import_classnames6.default)( + "mk-waypoints-item", + "clickable-icon", + "nav-action-button", + (superstate.settings.currentWaypoint == index3 || highlighted) && "mk-active", + indicator && "mk-indicator", + clone5 && "mk-clone", + ghost && "mk-ghost" + ), + style: { + ...style + }, + dangerouslySetInnerHTML: { + __html: superstate.ui.getSticker(pin.sticker) } - return { width: this.window.innerWidth, height: this.window.innerHeight }; - } - var base2 = this.appendBase(); - if (!base2) { - return { width: 0, height: 0 }; - } - var wrapChanged = false; - var wrap = this.parentNode.style.flexWrap; - if (wrap !== "wrap") { - wrapChanged = true; - this.parentNode.style.flexWrap = "wrap"; + })) : /* @__PURE__ */ import_react141.default.createElement("div", { + ref: innerRef, + className: "mk-waypoint" + }, /* @__PURE__ */ import_react141.default.createElement("div", { + ref: ref2, + onClick: (e5) => { + setWaypoints([ + ...waypoints, + { sticker: "ui//spaces", name: "Waypoint", paths: [] } + ]); + superstate.saveSettings(); + }, + className: (0, import_classnames6.default)( + "mk-waypoints-item", + "clickable-icon", + "nav-action-button", + highlighted && "mk-active", + indicator && "mk-indicator", + clone5 && "mk-clone", + ghost && "mk-ghost" + ) + })); + } +); +PinnedSpace.displayName = "PinnedSpace"; + +// src/core/react/components/Navigator/Waypoints/Waypoints.tsx +var SpaceSwitcher = (props) => { + const { + waypoints, + modifier, + setModifier, + setWaypoints + } = (0, import_react142.useContext)(NavigatorContext); + const { superstate } = props; + const { dragPaths, setDragPaths } = (0, import_react142.useContext)(NavigatorContext); + const [activeId, setActiveId] = (0, import_react142.useState)(null); + const [overId, setOverId] = (0, import_react142.useState)(null); + const dragCounter = (0, import_react142.useRef)(0); + const [offset2, setOffset] = (0, import_react142.useState)(0); + const [projected, setProjected] = (0, import_react142.useState)(null); + const [dropPlaceholder, setDragPlaceholder] = (0, import_react142.useState)(null); + (0, import_react142.useEffect)(() => { + if (overId === null || dragPaths.length == 0) { + setProjected(null); + return; } - base2.style.position = "relative"; - base2.style.minWidth = "100%"; - base2.style.minHeight = "100%"; - var size2 = { - width: base2.offsetWidth, - height: base2.offsetHeight + const waypoint = waypoints.find((f2, i4) => i4 == overId); + if (!waypoint) + return; + const _projected = { + depth: 0, + overId, + parentId: null, + sortable: false, + insert: true, + droppable: true, + copy: false, + reorder: false }; - if (wrapChanged) { - this.parentNode.style.flexWrap = wrap; - } - this.removeBase(base2); - return size2; + setProjected(_projected); + return; + }, [overId, dragPaths, offset2, modifier, waypoints, activeId]); + const resetState = () => { + setModifier(null); + setOverId(null); + setDragPaths([]); + setActiveId(null); + setProjected(null); + setOffset(0); + dragCounter.current = 0; }; - Resizable2.prototype.bindEvents = function() { - if (this.window) { - this.window.addEventListener("mouseup", this.onMouseUp); - this.window.addEventListener("mousemove", this.onMouseMove); - this.window.addEventListener("mouseleave", this.onMouseUp); - this.window.addEventListener("touchmove", this.onMouseMove, { - capture: true, - passive: false - }); - this.window.addEventListener("touchend", this.onMouseUp); - } + const handleDragCancel = () => { + resetState(); }; - Resizable2.prototype.unbindEvents = function() { - if (this.window) { - this.window.removeEventListener("mouseup", this.onMouseUp); - this.window.removeEventListener("mousemove", this.onMouseMove); - this.window.removeEventListener("mouseleave", this.onMouseUp); - this.window.removeEventListener("touchmove", this.onMouseMove, true); - this.window.removeEventListener("touchend", this.onMouseUp); - } + const dragEnter = () => { + dragCounter.current++; }; - Resizable2.prototype.componentDidMount = function() { - if (!this.resizable || !this.window) { - return; + const dragLeave = () => { + dragCounter.current--; + if (dragCounter.current == 0) { + setOverId(null); + setProjected(null); + setOffset(0); + dragCounter.current = 0; } - var computedStyle = this.window.getComputedStyle(this.resizable); - this.setState({ - width: this.state.width || this.size.width, - height: this.state.height || this.size.height, - flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0 - }); }; - Resizable2.prototype.componentWillUnmount = function() { - if (this.window) { - this.unbindEvents(); - } + const adjustTranslate = ({ transform }) => { + return { + ...transform, + x: transform.x, + y: transform.y - 10 + }; }; - Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) { - var propsSize = this.propsSize && this.propsSize[kind]; - return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize; + const dragStarted = (id3) => { + setActiveId(id3); }; - Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) { - var boundsByDirection = this.props.boundsByDirection; - var direction = this.state.direction; - var widthByDirection = boundsByDirection && hasDirection("left", direction); - var heightByDirection = boundsByDirection && hasDirection("top", direction); - var boundWidth; - var boundHeight; - if (this.props.bounds === "parent") { - var parent_1 = this.parentNode; - if (parent_1) { - boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft); - boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop); - } - } else if (this.props.bounds === "window") { - if (this.window) { - boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft; - boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop; - } - } else if (this.props.bounds) { - boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft); - boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop); - } - if (boundWidth && Number.isFinite(boundWidth)) { - maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; - } - if (boundHeight && Number.isFinite(boundHeight)) { - maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; + const dragOver = (id3, x2) => { + setOffset(x2); + if (activeId == null) { + setOverId(id3); + } else { + if (id3 == activeId) + return; + setWaypoints(arrayMove(waypoints, activeId, id3)); + setActiveId(id3); } - return { maxWidth, maxHeight }; }; - Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) { - var scale = this.props.scale || 1; - var resizeRatio = this.props.resizeRatio || 1; - var _a = this.state, direction = _a.direction, original = _a.original; - var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth; - var newWidth = original.width; - var newHeight = original.height; - var extraHeight = lockAspectRatioExtraHeight || 0; - var extraWidth = lockAspectRatioExtraWidth || 0; - if (hasDirection("right", direction)) { - newWidth = original.width + (clientX - original.x) * resizeRatio / scale; - if (lockAspectRatio) { - newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; + const dragEnded = () => { + if (projected && projected.insert) { + const space3 = props.superstate.spacesIndex.get(overId); + if (space3) + dropPathsInSpaceAtIndex( + props.superstate, + dragPaths, + space3.path, + 0, + "link" + ); + } else if (dragPaths.length == 1) { + const toIndex = overId; + if (activeId !== null) { + const fromIndex = activeId; + setWaypoints(arrayMove(waypoints, fromIndex, toIndex)); + } else { + setWaypoints( + waypoints.map( + (f2, i4) => i4 == toIndex ? { ...f2, paths: [...f2.paths, dragPaths[0]] } : f2 + ) + ); } } - if (hasDirection("left", direction)) { - newWidth = original.width - (clientX - original.x) * resizeRatio / scale; - if (lockAspectRatio) { - newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; + resetState(); + }; + function handleDragStart(event) { + const { + active: { id: activeId2 } + } = event; + if (event.active.data.current.type != "path") + return; + dragStarted(activeId2); + } + function handleDragMove({ delta }) { + } + function handleDragOver({ over }) { + const overId2 = over?.id; + if (overId2 !== null) { + if (activeId == null) { + setOverId(overId2); + } else { + setWaypoints( + arrayMove(waypoints, overId2, parseInt(activeId)) + ); } } - if (hasDirection("bottom", direction)) { - newHeight = original.height + (clientY - original.y) * resizeRatio / scale; - if (lockAspectRatio) { - newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; - } + } + function handleDragEnd({ active, over }) { + dragEnded(); + } + (0, import_react142.useEffect)(() => { + window.addEventListener("dragend", resetState); + return () => { + window.removeEventListener("dragend", resetState); + }; + }); + const width = isTouchScreen(props.superstate.ui) ? 48 : 32; + const calcXOffset = (index3) => { + if (!projected || projected.insert) + return 0; + const fromIndex = activeId; + const targetIndex = overId; + if (activeId === null) { + if (index3 >= targetIndex) + return width; + return 0; } - if (hasDirection("top", direction)) { - newHeight = original.height - (clientY - original.y) * resizeRatio / scale; - if (lockAspectRatio) { - newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; - } + if (index3 == fromIndex) { + return width * (targetIndex - fromIndex); + } else if (index3 > fromIndex && index3 <= targetIndex) { + return -width; + } else if (index3 < fromIndex && index3 >= targetIndex) { + return width; + } else { + return 0; } - return { newWidth, newHeight }; }; - Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max5, min5) { - var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth; - var computedMinWidth = typeof min5.width === "undefined" ? 10 : min5.width; - var computedMaxWidth = typeof max5.width === "undefined" || max5.width < 0 ? newWidth : max5.width; - var computedMinHeight = typeof min5.height === "undefined" ? 10 : min5.height; - var computedMaxHeight = typeof max5.height === "undefined" || max5.height < 0 ? newHeight : max5.height; - var extraHeight = lockAspectRatioExtraHeight || 0; - var extraWidth = lockAspectRatioExtraWidth || 0; - if (lockAspectRatio) { - var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth; - var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth; - var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight; - var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight; - var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth); - var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth); - var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight); - var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight); - newWidth = clamp2(newWidth, lockedMinWidth, lockedMaxWidth); - newHeight = clamp2(newHeight, lockedMinHeight, lockedMaxHeight); - } else { - newWidth = clamp2(newWidth, computedMinWidth, computedMaxWidth); - newHeight = clamp2(newHeight, computedMinHeight, computedMaxHeight); + return /* @__PURE__ */ import_react142.default.createElement(import_react142.default.Fragment, null, /* @__PURE__ */ import_react142.default.createElement("div", { + className: "mk-waypoints nav-header", + onDragEnter: () => dragEnter(), + onDragLeave: () => dragLeave(), + onDragOver: (e5) => e5.preventDefault() + }, /* @__PURE__ */ import_react142.default.createElement("div", { + className: "mk-waypoints-inner nav-buttons-container" + }, waypoints.map((pin, i4) => /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, { + id: i4, + superstate: props.superstate, + highlighted: overId == i4 && projected && projected.insert && projected.droppable, + style: { + transform: CSS.Translate.toString({ + x: calcXOffset(i4), + y: 0, + scaleX: 0, + scaleY: 0 + }) + }, + index: i4, + pin, + key: i4, + dragStart: dragStarted, + dragOver, + dragEnded, + dragActive: activeId !== null, + ghost: activeId === i4 + })), /* @__PURE__ */ import_react142.default.createElement("div", { + className: "mk-waypoint-new", + onClick: (e5) => { + const newWaypoints = [ + ...waypoints, + { sticker: "ui//spaces", name: "Waypoint", paths: [] } + ]; + props.superstate.settings.currentWaypoint = newWaypoints.length - 1; + setWaypoints(newWaypoints); + }, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") } - return { newWidth, newHeight }; + }), overId != null && activeId === null && /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, { + id: waypoints.length, + superstate: props.superstate, + highlighted: false, + index: waypoints.length, + pin: null + })), (0, import_react_dom8.createPortal)( + /* @__PURE__ */ import_react142.default.createElement(DragOverlay, { + dropAnimation: null, + modifiers: [adjustTranslate], + zIndex: 1600 + }, activeId !== null ? /* @__PURE__ */ import_react142.default.createElement(SortablePinnedSpaceItem, { + id: -1, + superstate: props.superstate, + highlighted: false, + clone: true, + index: activeId, + indicator: false, + pin: waypoints[activeId] + }) : null), + document.body + ))); +}; + +// src/core/react/components/Navigator/MainList.tsx +var MainList = (props) => { + const [indexing, setIndexing] = import_react143.default.useState(false); + (0, import_react143.useEffect)(() => { + const reindex = async () => { + setIndexing(true); + }; + const finishedIndex = async () => { + setIndexing(false); + }; + props.superstate.eventsDispatcher.addListener("superstateReindex", reindex); + props.superstate.eventsDispatcher.addListener( + "superstateUpdated", + finishedIndex + ); + return () => { + props.superstate.eventsDispatcher.removeListener( + "superstateReindex", + reindex + ); + props.superstate.eventsDispatcher.removeListener( + "superstateUpdated", + finishedIndex + ); + }; + }, []); + return /* @__PURE__ */ import_react143.default.createElement(import_react143.default.Fragment, null, /* @__PURE__ */ import_react143.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, { + FallbackComponent: ErrorFallback + }, /* @__PURE__ */ import_react143.default.createElement("div", { + className: "mk-progress-bar" + }, indexing && /* @__PURE__ */ import_react143.default.createElement("div", { + className: "mk-progress-bar-value" + })), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react143.default.createElement(MainMenu, { + superstate: props.superstate + }), /* @__PURE__ */ import_react143.default.createElement(SpaceSwitcher, { + superstate: props.superstate + }), /* @__PURE__ */ import_react143.default.createElement(SpaceTreeComponent, { + superstate: props.superstate + }))); +}; +function ErrorFallback({ error }) { + const { resetBoundary } = (0, import_react_error_boundary_cjs.useErrorBoundary)(); + const copyError = () => { + navigator.clipboard.writeText(error.message); }; - Resizable2.prototype.setBoundingClientRect = function() { - if (this.props.bounds === "parent") { - var parent_2 = this.parentNode; - if (parent_2) { - var parentRect = parent_2.getBoundingClientRect(); - this.parentLeft = parentRect.left; - this.parentTop = parentRect.top; + return /* @__PURE__ */ import_react143.default.createElement("div", { + role: "alert" + }, /* @__PURE__ */ import_react143.default.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ import_react143.default.createElement("p", { + style: { color: "red" } + }, error.message), /* @__PURE__ */ import_react143.default.createElement("button", { + onClick: copyError + }, "Copy Error"), /* @__PURE__ */ import_react143.default.createElement("button", { + onClick: resetBoundary + }, "Reload")); +} + +// src/core/react/components/SpaceView/Contexts/SpaceView.tsx +var SpaceView = (props) => { + return /* @__PURE__ */ import_react144.default.createElement(import_react_error_boundary_cjs.ErrorBoundary, { + FallbackComponent: ErrorFallback + }, /* @__PURE__ */ import_react144.default.createElement(PathProvider, { + superstate: props.superstate, + path: props.path, + readMode: false + }, /* @__PURE__ */ import_react144.default.createElement(SpaceProvider, { + superstate: props.superstate + }, /* @__PURE__ */ import_react144.default.createElement(FramesMDBProvider, { + superstate: props.superstate, + schema: "main" + }, /* @__PURE__ */ import_react144.default.createElement(FrameSelectionProvider, { + id: "main", + superstate: props.superstate, + editMode: props.readOnly ? 0 /* Read */ : 1 /* Page */ + }, /* @__PURE__ */ import_react144.default.createElement(SpaceRoot, { + superstate: props.superstate + }, props.children)))))); +}; +var SpaceRoot = (props) => { + const { pathState } = (0, import_react144.useContext)(PathContext); + const { tableData } = (0, import_react144.useContext)(FramesMDBContext); + const cols = [ + ...[...props.superstate.spacesMap.get(pathState.path) ?? []].flatMap( + (f2) => props.superstate.contextsIndex.get(f2)?.cols.map((g) => ({ ...g, table: f2 })) + ), + ...tableData?.cols.map((f2) => ({ ...f2, table: "" })) ?? [] + ]; + return /* @__PURE__ */ import_react144.default.createElement(FrameEditorProvider, { + superstate: props.superstate, + editMode: 1 /* Page */, + cols + }, props.children); +}; + +// src/core/react/components/PathView/PathView.tsx +var PathView = (props) => { + const [pathState, setPathState] = (0, import_react145.useState)( + props.superstate.pathsIndex.get(props.path) + ); + const ref2 = (0, import_react145.useRef)(null); + (0, import_react145.useEffect)(() => { + const uri = props.superstate.spaceManager.uriByString(props.path); + const pathState2 = props.superstate.pathsIndex.get(props.path); + if (!pathState2 && (uri?.scheme == "https" || uri?.scheme == "http")) { + setPathState({ + path: props.path, + displayName: uri.path, + label: { + sticker: uri.scheme, + name: uri.path, + color: "" + }, + hidden: false, + subtype: "md", + type: "remote" + }); + return; + } + setPathState(pathState2); + }, [props.path]); + return /* @__PURE__ */ import_react145.default.createElement("div", { + className: "mk-path-view", + style: { ...props.styles ?? {} } + }, pathState?.type == "remote" ? pathState.subtype == "note" ? /* @__PURE__ */ import_react145.default.createElement(FileLinkViewComponent, { + path: pathState.path, + superstate: props.superstate, + flow: true + }) : /* @__PURE__ */ import_react145.default.createElement("iframe", { + src: props.path + }) : pathState?.type == "space" ? /* @__PURE__ */ import_react145.default.createElement(SpaceView, { + superstate: props.superstate, + path: props.path, + readOnly: props.readOnly + }, /* @__PURE__ */ import_react145.default.createElement(SpaceOuter_default, { + superstate: props.superstate, + ref: ref2 + }, /* @__PURE__ */ import_react145.default.createElement(FrameEditorInstance, { + containerRef: props.containerRef, + superstate: props.superstate + }))) : props.superstate.ui.availableViews().some((f2) => f2 == props.path?.split(".").pop()) ? /* @__PURE__ */ import_react145.default.createElement(NoteView, { + superstate: props.superstate, + path: props.path, + load: true, + classname: "mk-flow-node" + }) : /* @__PURE__ */ import_react145.default.createElement(import_react145.default.Fragment, null)); +}; + +// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx +var import_react147 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Frames/SpaceCommand/Suggester.tsx +var import_react146 = __toESM(require_react()); +var import_react_dom9 = __toESM(require_react_dom()); +var Suggester = (0, import_react146.forwardRef)( + (props, outerRef) => { + const ref2 = (0, import_react146.useRef)(null); + const [index3, setIndex] = (0, import_react146.useState)(0); + const [isReady, setIsReady] = (0, import_react146.useState)(false); + const menuRef = (0, import_react146.useRef)(null); + const [pos, setPos] = (0, import_react146.useState)({ x: 0, y: 0 }); + const [active, setActive] = (0, import_react146.useState)(false); + const [section, setSection] = (0, import_react146.useState)(""); + (0, import_react146.useEffect)(() => { + const resizeObserver = new ResizeObserver((entries) => { + if (menuRef.current) { + const rect = menuRef.current.getBoundingClientRect(); + setIsReady(true); + setPos( + calculateBoundsBasedOnPosition( + ref2.current.getBoundingClientRect(), + rect, + { width: window.innerWidth, height: innerHeight }, + "bottom" + ) + ); + } + }); + if (menuRef.current && ref2.current) { + resizeObserver.observe(menuRef.current); + resizeObserver.observe(ref2.current); } - } - if (this.props.bounds && typeof this.props.bounds !== "string") { - var targetRect = this.props.bounds.getBoundingClientRect(); - this.targetLeft = targetRect.left; - this.targetTop = targetRect.top; - } - if (this.resizable) { - var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom; - this.resizableLeft = left; - this.resizableRight = right; - this.resizableTop = top_1; - this.resizableBottom = bottom; - } - }; - Resizable2.prototype.onResizeStart = function(event, direction) { - if (!this.resizable || !this.window) { - return; - } - var clientX = 0; - var clientY = 0; - if (event.nativeEvent && isMouseEvent(event.nativeEvent)) { - clientX = event.nativeEvent.clientX; - clientY = event.nativeEvent.clientY; - } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) { - clientX = event.nativeEvent.touches[0].clientX; - clientY = event.nativeEvent.touches[0].clientY; - } - if (this.props.onResizeStart) { - if (this.resizable) { - var startResize = this.props.onResizeStart(event, direction, this.resizable); - if (startResize === false) { - return; + return () => { + resizeObserver.disconnect(); + }; + }, [menuRef.current]); + const keyDown = (e5) => { + if (e5.key == "Delete" || e5.key == "Backspace") { + if (ref2.current.innerText == "" && props.onDelete) { + props.onDelete(); } } - } - if (this.props.size) { - if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) { - this.setState({ height: this.props.size.height }); + if (e5.key == "Tab") { + if (props.sections && props.onSelectSection) { + e5.preventDefault(); + e5.stopPropagation(); + setSection((p2) => { + const sectionIndex = props.sections.findIndex((g) => g.value == p2); + if (e5.shiftKey) { + if (sectionIndex == 0) { + return p2; + } + props.onSelectSection(props.sections[sectionIndex - 1].value); + return props.sections[sectionIndex - 1].value; + } + if (sectionIndex == props.sections.length - 1) { + return p2; + } + props.onSelectSection(props.sections[sectionIndex + 1].value); + return props.sections[sectionIndex + 1].value; + }); + } } - if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) { - this.setState({ width: this.props.size.width }); + if (e5.key == "ArrowUp") { + const size2 = props.suggestions.length - 1; + const newIndex = index3 < 0 ? size2 : index3 - 1; + if (props.suggestions[newIndex]?.disabled) { + setIndex(newIndex < 0 ? size2 : newIndex - 1); + } else { + setIndex(newIndex); + } + e5.preventDefault(); } - } - this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height; - var flexBasis; - var computedStyle = this.window.getComputedStyle(this.resizable); - if (computedStyle.flexBasis !== "auto") { - var parent_3 = this.parentNode; - if (parent_3) { - var dir = this.window.getComputedStyle(parent_3).flexDirection; - this.flexDir = dir.startsWith("row") ? "row" : "column"; - flexBasis = computedStyle.flexBasis; + if (e5.key == "ArrowDown") { + const size2 = props.suggestions.length - 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; + if (props.suggestions[newIndex]?.disabled) { + setIndex(newIndex >= size2 ? 0 : newIndex + 1); + } else { + setIndex(newIndex); + } + e5.preventDefault(); } - } - this.setBoundingClientRect(); - this.bindEvents(); - var state = { - original: { - x: clientX, - y: clientY, - width: this.size.width, - height: this.size.height - }, - isResizing: true, - backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }), - direction, - flexBasis - }; - this.setState(state); - }; - Resizable2.prototype.onMouseMove = function(event) { - var _this = this; - if (!this.state.isResizing || !this.resizable || !this.window) { - return; - } - if (this.window.TouchEvent && isTouchEvent2(event)) { - try { - event.preventDefault(); - event.stopPropagation(); - } catch (e5) { + if (e5.key == "Enter") { + props.onSelect(props.suggestions[index3]); + e5.preventDefault(); } - } - var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight; - var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX; - var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY; - var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height; - var parentSize = this.getParentSize(); - var max5 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight); - maxWidth = max5.maxWidth; - maxHeight = max5.maxHeight; - minWidth = max5.minWidth; - minHeight = max5.minHeight; - var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth; - var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight); - if (this.props.snap && this.props.snap.x) { - newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap); - } - if (this.props.snap && this.props.snap.y) { - newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap); - } - var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight }); - newWidth = newSize.newWidth; - newHeight = newSize.newHeight; - if (this.props.grid) { - var newGridWidth = snap(newWidth, this.props.grid[0]); - var newGridHeight = snap(newHeight, this.props.grid[1]); - var gap = this.props.snapGap || 0; - newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth; - newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight; - } - var delta = { - width: newWidth - original.width, - height: newHeight - original.height }; - if (width && typeof width === "string") { - if (width.endsWith("%")) { - var percent = newWidth / parentSize.width * 100; - newWidth = percent + "%"; - } else if (width.endsWith("vw")) { - var vw = newWidth / this.window.innerWidth * 100; - newWidth = vw + "vw"; - } else if (width.endsWith("vh")) { - var vh = newWidth / this.window.innerHeight * 100; - newWidth = vh + "vh"; - } - } - if (height && typeof height === "string") { - if (height.endsWith("%")) { - var percent = newHeight / parentSize.height * 100; - newHeight = percent + "%"; - } else if (height.endsWith("vw")) { - var vw = newHeight / this.window.innerWidth * 100; - newHeight = vw + "vw"; - } else if (height.endsWith("vh")) { - var vh = newHeight / this.window.innerHeight * 100; - newHeight = vh + "vh"; - } - } - var newState = { - width: this.createSizeForCssProperty(newWidth, "width"), - height: this.createSizeForCssProperty(newHeight, "height") + const CLASS_NAMES2 = { + root: "mk-menu-container", + rootFocused: "mk-focused", + selected: "mk-selected", + selectedTagWrapper: "mk-menu-selected-tag-wrapper", + selectedTag: "mk-menu-selected-tag", + selectedTagName: "mk-menu-selected-tag-name", + search: "mk-menu-search", + searchWrapper: "mk-menu-search-container", + searchInput: "mk-menu-search-input", + suggestions: "mk-menu-suggestions", + suggestionActive: "mk-active", + suggestionDisabled: "mk-disabled" }; - if (this.flexDir === "row") { - newState.flexBasis = newState.width; - } else if (this.flexDir === "column") { - newState.flexBasis = newState.height; + return /* @__PURE__ */ import_react146.default.createElement(import_react146.default.Fragment, null, /* @__PURE__ */ import_react146.default.createElement("div", { + ref: (node2) => { + ref2.current = node2; + if (outerRef) { + if (typeof outerRef === "function") { + outerRef(node2); + } else { + outerRef.current = node2; + } + } + }, + onFocus: () => { + if (props.onFocus) { + props.onFocus(); + } + setActive(true); + }, + onBlur: () => { + if (props.onBlur) + props.onBlur(); + setActive(false); + }, + "data-placeholder": props.placeholder, + onInput: (e5) => props.onChange(e5.currentTarget.innerText), + onKeyDown: (e5) => keyDown(e5), + className: "mk-suggester", + contentEditable: true + }), active && (0, import_react_dom9.createPortal)( + /* @__PURE__ */ import_react146.default.createElement("div", { + ref: menuRef, + className: `mk-menu mk-menu-suggester ${isReady ? "mk-ready" : ""}`, + style: { + position: "absolute", + top: pos.y, + left: pos.x, + zIndex: 1e3, + width: "300px", + "--mk-menu-max-height": "300px", + visibility: active ? "visible" : "hidden" + } + }, props.sections ? /* @__PURE__ */ import_react146.default.createElement("div", { + className: "mk-menu-sections" + }, props.sections.map((f2, i4) => /* @__PURE__ */ import_react146.default.createElement("div", { + key: i4, + onClick: () => setSection(f2.value), + className: `${section == f2.value ? "is-active" : ""} mk-menu-section` + }, f2.name == "" ? i18n_default.labels.all : f2.name))) : /* @__PURE__ */ import_react146.default.createElement(import_react146.default.Fragment, null), /* @__PURE__ */ import_react146.default.createElement(SelectMenuSuggestions_default, { + expanded: false, + addKeyword: "Add", + options: props.suggestions, + query: "", + refs: null, + hide: () => null, + selectOption: props.onSelect, + id: "", + classNames: CLASS_NAMES2, + index: index3, + setIndex, + allowNew: false, + ui: props.superstate.ui, + isDisclosureMenu: false + })), + document.body + )); + } +); +Suggester.displayName = "Suggester"; + +// src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx +function parseContent(input) { + const regex1 = /!\[!\[(.*?)\]\]/; + const regex2 = /!!\[\[(.*?)\]\]/; + const match1 = input.match(regex1); + const match2 = input.match(regex2); + return match1 ? match1[1] : match2 ? match2[1] : input; +} +var FlowNodeView = (props) => { + const { spaceState } = (0, import_react147.useContext)(SpaceContext); + const pathState = (0, import_react147.useMemo)(() => { + const fullPath = props.state?.props?.value; + const path3 = fullPath ? props.superstate.spaceManager.resolvePath( + parseContent(fullPath), + props.source + ) : null; + const uri = props.superstate.spaceManager.uriByString(fullPath); + if (uri?.scheme == "https" || uri?.scheme == "http") { + return { + path: fullPath, + displayName: uri.path, + label: { + sticker: uri.scheme, + name: uri.path, + color: "" + }, + hidden: false, + subtype: "md", + type: "remote" + }; } - (0, import_react_dom10.flushSync)(function() { - _this.setState(newState); - }); - if (this.props.onResize) { - this.props.onResize(event, direction, this.resizable, delta); + return props.superstate.pathsIndex.get(path3); + }, [props.state, props.source]); + const { updateNode, nodes } = (0, import_react147.useContext)(FramesEditorRootContext); + const { selectionMode } = (0, import_react147.useContext)(FrameSelectionContext); + const [expanded, setExpanded] = (0, import_react147.useState)( + props.state?.styles?.["--mk-expanded"] + ); + const updateValue2 = (newValue) => { + if (newValue != props.state.props?.value) { + if (props.treeNode.editorProps?.linkedNode) { + const node2 = nodes.find( + (f2) => f2.id == props.treeNode.editorProps.linkedNode.node + ); + updateNode(node2, { + props: { + ...node2.props, + [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) + } + }); + } else { + updateNode(props.treeNode.node, { + props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } + }); + } } }; - Resizable2.prototype.onMouseUp = function(event) { - var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original; - if (!isResizing || !this.resizable) { - return; - } - var delta = { - width: this.size.width - original.width, - height: this.size.height - original.height + const hideToggle = props.state?.styles?.["--mk-link"]; + const { id: id3 } = (0, import_react147.useContext)(FrameInstanceContext); + const [pathString, setPathString] = (0, import_react147.useState)(""); + const options = (0, import_react147.useMemo)(() => { + const fuseOptions = { + keys: ["name", "value"] }; - if (this.props.onResizeStop) { - this.props.onResizeStop(event, direction, this.resizable, delta); - } - if (this.props.size) { - this.setState(this.props.size); - } - this.unbindEvents(); - this.setState({ - isResizing: false, - backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: "auto" }) - }); - }; - Resizable2.prototype.updateSize = function(size2) { - this.setState({ width: size2.width, height: size2.height }); + const suggestions = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden && f2.subtype == "md" || f2.subtype == "space").map((f2) => ({ + name: f2.displayName, + value: f2.path, + description: f2.path, + icon: f2.label?.sticker + })); + const fuse = new Fuse(suggestions, fuseOptions); + return pathString?.length == 0 ? suggestions : fuse.search(pathString).map((result) => result.item); + }, [pathString]); + const toggleCollapse = () => { + setExpanded((p2) => !p2); + if (selectionMode > 0 /* Read */) + updateNode(props.treeNode.node, { + styles: { + ...props.treeNode.node.styles, + "--mk-expanded": (!props.state?.styles?.["--mk-expanded"]).toString() + } + }); }; - Resizable2.prototype.renderResizer = function() { - var _this = this; - var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent; - if (!enable) { - return null; + const [isTransition, startTransition] = (0, import_react147.useTransition)(); + return /* @__PURE__ */ import_react147.default.createElement("div", { + className: "mk-node-flow" + }, !props.state?.styles?.["--mk-min-mode"] && /* @__PURE__ */ import_react147.default.createElement(import_react147.default.Fragment, null, pathState ? /* @__PURE__ */ import_react147.default.createElement("div", { + className: "mk-node-link" + }, /* @__PURE__ */ import_react147.default.createElement(PathCrumb, { + superstate: props.superstate, + path: pathState.path + }), !hideToggle && /* @__PURE__ */ import_react147.default.createElement(CollapseToggle, { + superstate: props.superstate, + collapsed: !expanded, + onToggle: toggleCollapse + })) : selectionMode > 0 /* Read */ && /* @__PURE__ */ import_react147.default.createElement("div", { + className: "mk-node-text-placeholder" + }, /* @__PURE__ */ import_react147.default.createElement(Suggester, { + placeholder: i18n_default.hintText.selectNote, + onChange: (e5) => { + setPathString(e5); + }, + suggestions: options, + superstate: props.superstate, + onSelect: (option2) => { + updateValue2(option2.value); } - var resizers = Object.keys(enable).map(function(dir) { - if (enable[dir] !== false) { - return React127.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null); - } - return null; - }); - return React127.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers); - }; - Resizable2.prototype.render = function() { - var _this = this; - var extendsProps = Object.keys(this.props).reduce(function(acc, key2) { - if (definedProps.indexOf(key2) !== -1) { - return acc; - } - acc[key2] = _this.props[key2]; - return acc; - }, {}); - var style = __assign3(__assign3(__assign3({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 }); - if (this.state.flexBasis) { - style.flexBasis = this.state.flexBasis; + }))), props.state && expanded && (props.state?.props?.value?.length > 0 ? /* @__PURE__ */ import_react147.default.createElement(PathView, { + id: id3, + superstate: props.superstate, + path: pathState?.path ?? props.state?.props?.value, + containerRef: props.containerRef, + styles: {}, + readOnly: true + }) : /* @__PURE__ */ import_react147.default.createElement("div", { + onClick: () => newPathInSpace( + props.superstate, + spaceState, + "md", + null, + true + ).then((f2) => updateValue2(f2)) + }, "New Note"))); +}; + +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameHoverMenu.tsx +var import_react148 = __toESM(require_react()); +var FrameHoverMenu = (props) => { + const { spaceInfo } = (0, import_react148.useContext)(SpaceContext); + const { addNode, moveUp, moveDown, setLastCreatedId } = (0, import_react148.useContext)( + FramesEditorRootContext + ); + const { select, selection: selection2 } = (0, import_react148.useContext)(FrameSelectionContext); + const selected = selection2.includes(props.node.id); + return /* @__PURE__ */ import_react148.default.createElement(import_react148.default.Fragment, null, /* @__PURE__ */ import_react148.default.createElement("div", { + className: `${"mk-editor-frame-hover-horizontal"}`, + style: { + pointerEvents: "auto", + opacity: props.visible ? "1" : "0" } - var Wrapper = this.props.as || "div"; - return React127.createElement( - Wrapper, - __assign3({ ref: this.ref, style, className: this.props.className }, extendsProps), - this.state.isResizing && React127.createElement("div", { style: this.state.backgroundStyle }), - this.props.children, - this.renderResizer() - ); - }; - Resizable2.defaultProps = { - as: "div", - onResizeStart: function() { - }, - onResize: function() { + }, props.dragRef && /* @__PURE__ */ import_react148.default.createElement("div", { + className: "mk-icon-small mk-editor-frame-hover-button", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//handle") }, - onResizeStop: function() { + style: { cursor: "grab" }, + ref: props.dragRef, + onClick: (e5) => { + e5.stopPropagation(); + if (selection2.length == 1 && selected) { + select(null); + return; + } + if (e5.shiftKey) { + select(props.node.id, true); + } else { + select(props.node.id); + } }, - enable: { - top: true, - right: true, - bottom: true, - left: true, - topRight: true, - bottomRight: true, - bottomLeft: true, - topLeft: true + ...props.listeners ?? {}, + ...props.attributes ?? {} + }), !isTouchScreen(props.superstate.ui) && /* @__PURE__ */ import_react148.default.createElement("div", { + onClick: (e5) => { + addNode(newNode.node, props.node).then( + (f2) => setLastCreatedId(f2.id) + ); + e5.stopPropagation(); }, - style: {}, - grid: [1, 1], - lockAspectRatio: false, - lockAspectRatioExtraWidth: 0, - lockAspectRatioExtraHeight: 0, - scale: 1, - resizeRatio: 1, - snapGap: 0 - }; - return Resizable2; -}(React127.PureComponent); + className: "mk-icon-small mk-editor-frame-hover-button", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//plus") + } + }))); +}; -// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx -var import_react129 = __toESM(require_react()); -var FrameResizer = (props) => { - const labelForValue = (value) => { - if (!value) - return null; - if (value == "auto") - return "Fit"; - if (value == "100%") - return "Fill"; - return value; +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/FrameNodeEditorContainer.tsx +var import_react149 = __toESM(require_react()); +var FrameNodeEditorContainer = (props) => { + const menuRef = (0, import_react149.useRef)(null); + const [pos, setPos] = (0, import_react149.useState)(0); + const calculateXBasedOnBounds = (targetRect, rect, containerRect) => { + const x2 = targetRect.x - props.containerRect.x; + const overflowX = x2 + rect.width - containerRect.width; + let newX = x2; + if (overflowX > 0) { + if (targetRect.x - props.containerRect.x - rect.width > 0) + newX = containerRect.width - rect.width; + else { + newX = 0; + } + } + return newX; }; - const [modifiers, setModifiers] = import_react129.default.useState(null); - const [size2, setSize2] = import_react129.default.useState({ - width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth, - height: props.size.height - }); - import_react129.default.useEffect(() => { - setSize2({ - width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth, - height: props.size.height + const [ready, setReady] = (0, import_react149.useState)(false); + (0, import_react149.useEffect)(() => { + const resizeObserver = new ResizeObserver((entries) => { + const rect = entries[0].target.getBoundingClientRect(); + setReady(true); + setPos( + calculateXBasedOnBounds(props.nodeRect, rect, props.containerRect) + ); }); - }, [props.size, props.resizeMode]); - (0, import_react129.useEffect)(() => { - const captureShift = (e5) => { - setModifiers({ shiftKey: e5.shiftKey }); - }; - props.superstate.ui.inputManager.on("keydown", captureShift); - props.superstate.ui.inputManager.on("keyup", captureShift); + if (menuRef.current) + resizeObserver.observe(menuRef.current); return () => { - props.superstate.ui.inputManager.off("keydown", captureShift); - props.superstate.ui.inputManager.off("keyup", captureShift); + resizeObserver.disconnect(); }; - }, [setModifiers]); - return /* @__PURE__ */ import_react129.default.createElement("div", { + }, [menuRef]); + return /* @__PURE__ */ import_react149.default.createElement("div", { + className: "mk-editor-frame-node-container", + ref: menuRef, style: { - position: "absolute", - top: 0, - left: 0, - width: props.clientSize.width, - height: props.clientSize.height - } - }, /* @__PURE__ */ import_react129.default.createElement(Resizable, { - lockAspectRatio: modifiers?.shiftKey, - className: (0, import_classnames9.default)( - props.resizeMode == 2 /* ResizeColumn */ ? "mk-frame-column" : "mk-frame-bounds" - ), - enable: props.resizeMode == 2 /* ResizeColumn */ ? { right: true } : { - right: true, - bottom: true, - bottomRight: true - }, - onResize: (e5, direction, ref2, d4) => { - setSize2({ - width: ref2.clientWidth, - height: ref2.clientHeight - }); - }, - onResizeStop: (e5, direction, ref2, d4) => { - const captureClick = (e6) => { - e6.stopPropagation(); - window.removeEventListener("click", captureClick, true); - }; - window.addEventListener("click", captureClick, true); - props.resizeMode == 2 /* ResizeColumn */ ? props.resize({ - minWidth: `'${ref2.clientWidth}px'` - }) : direction == "bottom" ? props.resize({ - height: `'${ref2.clientHeight}px'` - }) : direction == "right" ? props.resize({ - width: `'${ref2.clientWidth}px'` - }) : props.resize({ - width: `'${ref2.clientWidth}px'`, - height: `'${ref2.clientHeight}px'` - }); - e5.stopPropagation(); - }, - onResizeStart: (e5) => { - e5.stopPropagation(); - }, - handleClasses: props.resizeMode == 2 /* ResizeColumn */ ? { - right: "mk-frame-column-resize-handle" - } : props.resizeMode == 1 /* ResizeSelected */ ? { bottomRight: "mk-frame-resize-handle" } : {}, - handleWrapperStyle: { - pointerEvents: "auto" - }, - size: { - width: size2.width && size2.width != "auto" ? size2.width : "100%", - height: size2.height && size2.height != "auto" ? size2.height : "100%" + visibility: ready ? "visible" : "hidden", + pointerEvents: "auto", + left: pos, + bottom: `calc(100% - ${props.nodeRect.y - props.containerRect.y - 10}px)`, + maxWidth: props.containerRect.width }, - ...props.listeners - }), props.clientSize?.width > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react129.default.createElement("div", { - className: "mk-frame-resize-label-width" - }, /* @__PURE__ */ import_react129.default.createElement("div", null, /* @__PURE__ */ import_react129.default.createElement("span", null, labelForValue(size2.width) ?? i18n_default.editor.fit), size2.width && size2.width != "auto" ? /* @__PURE__ */ import_react129.default.createElement("div", { onClick: (e5) => { - props.resize({ - width: wrapQuotes("auto") - }); + e5.preventDefault(); e5.stopPropagation(); - }, - "aria-label": i18n_default.editor.scaleToFit, - style: { display: "flex" }, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker( - "ui//fold-horizontal" - ) } - }) : /* @__PURE__ */ import_react129.default.createElement("div", { - onClick: (e5) => { - props.resize({ - width: wrapQuotes("100%") + }, props.children); +}; + +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx +var import_classnames7 = __toESM(require_classnames()); +var import_react151 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDraggableHandle.tsx +var import_react150 = __toESM(require_react()); +var FrameDraggableHandle = (props) => { + const [modifier, setModifier] = (0, import_react150.useState)(null); + const startValue = (0, import_react150.useRef)(props.value); + const currentValue = (0, import_react150.useRef)(props.value); + const [, setStartPos] = (0, import_react150.useState)([0, 0]); + const step = props.step ?? 1; + const handleMove = (0, import_react150.useCallback)( + (e5) => { + setStartPos((pos) => { + const { clientX: x2, clientY: y22 } = e5; + const [x1, y1] = pos; + const a4 = props.reverseX ? x1 - x2 : x2 - x1; + const b2 = props.reverseY ? y22 - y1 : y1 - y22; + const mod3 = props.mod ?? 1; + const stepModifer = step * mod3; + let delta = Math.sqrt((a4 + b2) / 2 * (a4 + b2) / 2) * stepModifer; + if (a4 + b2 < 0) + delta = -delta; + if (props.disableX) + delta = b2 * stepModifer; + if (props.disableY) + delta = a4 * stepModifer; + let newValue = startValue.current + delta; + newValue = props.min != null ? Math.max(newValue, props.min) : newValue; + newValue = props.max != null ? Math.min(newValue, props.max) : newValue; + currentValue.current = newValue; + props.onDragMove(newValue, { + ctrlKey: e5.ctrlKey, + metaKey: e5.metaKey, + altKey: e5.altKey, + shiftKey: e5.shiftKey + }); + return pos; }); e5.stopPropagation(); }, - "aria-label": i18n_default.editor.scaleToFill, - style: { display: "flex" }, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker( - "ui//unfold-horizontal" - ) - } - }))), props.clientSize?.height > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react129.default.createElement("div", { - className: "mk-frame-resize-label-height" - }, /* @__PURE__ */ import_react129.default.createElement("div", null, /* @__PURE__ */ import_react129.default.createElement("span", null, labelForValue(size2.height) ?? i18n_default.editor.fit), size2.height && size2.height != "auto" ? /* @__PURE__ */ import_react129.default.createElement("div", { - onClick: (e5) => { - props.resize({ - height: wrapQuotes("auto") + [modifier, props.max, props.min, step, props.onDragMove, props.mod] + ); + const handleMoveEnd = (0, import_react150.useCallback)( + (e5) => { + const captureClick = (e6) => { + e6.stopPropagation(); + window.removeEventListener("click", captureClick, true); + }; + window.addEventListener( + "click", + captureClick, + true + ); + document.removeEventListener("mousemove", handleMove); + document.removeEventListener("mouseup", handleMoveEnd); + props.onDragEnd(currentValue.current, { + ctrlKey: e5.ctrlKey, + metaKey: e5.metaKey, + altKey: e5.altKey, + shiftKey: e5.shiftKey }); + e5.preventDefault(); e5.stopPropagation(); }, - "aria-label": i18n_default.editor.scaleToFit, - style: { display: "flex" }, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//fold-vertical") - } - }) : /* @__PURE__ */ import_react129.default.createElement("div", { - onClick: (e5) => { - props.resize({ - height: wrapQuotes("100%") - }); + [handleMove, props.onDragEnd] + ); + const handleDown = (0, import_react150.useCallback)( + (e5) => { + startValue.current = props.value; + setStartPos([e5.clientX, e5.clientY]); + document.addEventListener("mousemove", handleMove); + document.addEventListener("mouseup", handleMoveEnd); e5.stopPropagation(); }, - "aria-label": i18n_default.editor.scaleToFill, - style: { display: "flex" }, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker( - "ui//unfold-vertical" - ) + [handleMove, handleMoveEnd, props.value] + ); + const handleKeyDown = (e5) => { + if (e5.metaKey) { + setModifier("metaKey"); + } else if (e5.ctrlKey) { + setModifier("ctrlKey"); + } else if (e5.altKey) { + setModifier("altKey"); + } else if (e5.shiftKey) { + setModifier("shiftKey"); } - })))); -}; - -// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx -var import_react147 = __toESM(require_react()); - -// src/core/react/components/SpaceView/Frames/EditorNodes/AudioNodeView.tsx -var import_react130 = __toESM(require_react()); -var AudioNodeView = (props) => { - const value = props.state.props.value; - const sourcePath = (0, import_react130.useMemo)(() => { - return props.superstate.ui.getUIPath(value); - }, [value]); - return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react130.default.createElement("audio", { - controls: true, - preload: "none", - src: sourcePath - }) : /* @__PURE__ */ import_react130.default.createElement(import_react130.default.Fragment, null); -}; - -// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx -var import_react136 = __toESM(require_react()); - -// src/core/react/components/UI/Dropdown.tsx -var import_react131 = __toESM(require_react()); -var Dropdown2 = (props) => { - const openMenu = (e5) => { - const offset2 = e5.target.getBoundingClientRect(); - props.superstate.ui.openMenu(offset2, { - ui: props.superstate.ui, - editable: true, - value: [props.value], - options: props.options, - saveOptions: (options, value) => { - props.selectValue(value[0]); - } - }); }; - return /* @__PURE__ */ import_react131.default.createElement("div", { - className: "mk-cell-option-item", - onClick: (e5) => props.triggerMenu ? props.triggerMenu(e5) : openMenu(e5) - }, /* @__PURE__ */ import_react131.default.createElement("div", null, props.options ? props.options.find((f2) => f2.value == props.value)?.name : props.value), /* @__PURE__ */ import_react131.default.createElement("div", { - className: "mk-cell-option-select mk-icon-xxsmall mk-icon-rotated", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//collapse-solid") + const handleKeyUp = () => { + setModifier(null); + }; + (0, import_react150.useEffect)(() => { + document.addEventListener("keydown", handleKeyDown); + document.addEventListener("keyup", handleKeyUp); + return () => { + document.removeEventListener("mousemove", handleMove); + document.removeEventListener("mouseup", handleMoveEnd); + document.removeEventListener("keydown", handleKeyDown); + document.removeEventListener("keyup", handleKeyUp); + }; + }, []); + return /* @__PURE__ */ import_react150.default.createElement("div", { + className: "mk-frame-draggable-handle", + onMouseDown: handleDown, + "data-placeholder": currentValue.current.toString(), + style: { + cursor: props.cursor, + width: "100%", + height: "100%", + pointerEvents: "auto" } - })); + }, /* @__PURE__ */ import_react150.default.createElement("span", null)); }; -// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx -var import_react134 = __toESM(require_react()); - -// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx -var import_react133 = __toESM(require_react()); - -// src/core/react/components/SpaceEditor/Actions/BuiltinPropertyEditor.tsx -var import_react132 = __toESM(require_react()); -var BuiltinPropertyEditor = (props) => { - const allOptions = (0, import_react132.useMemo)(() => { - const options = props.fields.map((f2) => ({ - id: f2.name, - field: f2.name, - vType: f2.type, - label: f2.name, - defaultFilter: "is", - type: "property", - description: "" - })); - return options; - }, []); - const editFormula = (e5) => { - const _props = { - superstate: props.superstate, - saveFormula: (value) => props.saveTree({ - ...props.actionTree, - props: { - ...props.actionTree.props, - $function: value - } - }), - formula: props.actionTree.props["$function"], - value: props.values, - fields: props.fields, - path: props.path - }; - props.superstate.ui.openCustomMenu( - e5.target.getBoundingClientRect(), - /* @__PURE__ */ import_react132.default.createElement(FormulaEditor, { - ..._props - }), - { ..._props }, - "bottom" - ); - }; - return props.command.schema.id == "formula" ? /* @__PURE__ */ import_react132.default.createElement("button", { - onClick: (e5) => editFormula(e5) - }, "Edit Formula") : props.command.schema.id == "filter" ? /* @__PURE__ */ import_react132.default.createElement(SpaceQuery, { - superstate: props.superstate, - filters: props.actionTree.props["$function"] ?? [], - setFilters: (filters) => { - props.saveTree({ - ...props.actionTree, - props: { - ...props.actionTree.props, - $function: filters - } - }); +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameCorners.tsx +var FrameCorners = (props) => { + const match2 = props.styles.borderRadius ? props.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; + const numericValue = match2 ? parseInt(match2[1]) : 0; + const unit2 = match2 && match2[2] ? match2[2] : "px"; + const [offset2, setOffset] = import_react151.default.useState(Math.max(8, numericValue)); + (0, import_react151.useEffect)(() => { + setOffset(numericValue); + }, [numericValue]); + const handleProps = { + min: 0, + max: Math.min(props.clientSize.height / 2, props.clientSize.width / 2), + value: offset2, + onDragMove: (value) => { + setOffset(value); }, - fields: allOptions, - sections: [], - removeable: true - }) : /* @__PURE__ */ import_react132.default.createElement(import_react132.default.Fragment, null); -}; - -// src/core/react/components/SpaceEditor/Actions/ActionNode.tsx -var ActionNode = (props) => { - const [action, setAction] = import_react133.default.useState(props.actionTree?.action); - const command = (0, import_react133.useMemo)( - () => props.superstate.cli.commandForAction(action), - [action] - ); - (0, import_react133.useEffect)(() => { - setAction(props.actionTree?.action); - }, [props.actionTree]); - const selectAction = (e5, add4) => { - const options = [...allActions(props.superstate, props.path)]; - const sections = [...new Set(options.map((f2) => f2.section))].map((f2) => ({ - name: f2, - value: f2 - })); - const offset2 = e5.target.getBoundingClientRect(); - props.superstate.ui.openMenu(offset2, { - ui: props.superstate.ui, - editable: true, - value: [action], - options, - sections, - showSections: true, - saveOptions: (options2, value) => { - if (add4) { - props.saveTree({ - ...props.actionTree, - children: [ - ...props.actionTree.children, - { action: value[0], props: {}, propsValue: {}, children: [] } - ] - }); - return; - } - props.saveTree({ ...props.actionTree, action: value[0] }); - } - }); - }; - const selectLinkedProp = (e5, prop2) => { - const options = props.fields.map((f2) => ({ name: f2.name, value: f2.name })); - const offset2 = e5.target.getBoundingClientRect(); - props.superstate.ui.openMenu(offset2, { - ui: props.superstate.ui, - editable: true, - value: [], - options, - saveOptions: (options2, value) => { - props.saveTree({ - ...props.actionTree, - linked: { ...props.actionTree.linked, [prop2]: value[0] } - }); - } - }); + onDragEnd: (value) => { + props.saveStyles({ borderRadius: `"${value}${unit2}"` }); + } }; - return /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-editor-actions-node" - }, /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-editor-actions-body" - }, /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-editor-actions-name" - }, /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-path-icon", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker( - command ? stickerForSchema(command.schema) : "ui//plus" - ) + const minOffset = Math.max(8, offset2); + return /* @__PURE__ */ import_react151.default.createElement("div", { + style: { + position: "absolute", + top: 0, + left: 0, + width: props.clientSize.width, + height: props.clientSize.height, + display: "flex", + zIndex: 200, + borderRadius: offset2, + border: "1px solid var(--mk-ui-border-accent)" } - }), /* @__PURE__ */ import_react133.default.createElement("div", { - onClick: (e5) => !command && selectAction(e5), - className: "mk-editor-actions-selector" - }, command?.schema.name ?? "Select"), /* @__PURE__ */ import_react133.default.createElement("span", null), props.deleteTree && /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-icon-small", - onClick: (e5) => props.deleteTree(), - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//close") + }, /* @__PURE__ */ import_react151.default.createElement("div", { + className: (0, import_classnames7.default)("mk-frame-corners") + }, /* @__PURE__ */ import_react151.default.createElement("div", { + className: "mk-frame-corner", + style: { + position: "absolute", + transform: `translate(${minOffset}px, ${minOffset}px)`, + zIndex: "var(--mk-layer-editor-overlay)" } - })), command && /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-editor-actions-fields" - }, command.schema.type == "builtin" ? /* @__PURE__ */ import_react133.default.createElement(BuiltinPropertyEditor, { - superstate: props.superstate, - command, - actionTree: props.actionTree, - saveTree: props.saveTree, - fields: [...props.fields, props.prevField].filter((f2) => f2), - values: props.values, - path: props.path - }) : command?.fields.map((f2, i4) => { - return /* @__PURE__ */ import_react133.default.createElement(DataPropertyView, { - key: i4, - superstate: props.superstate, - column: f2, - columns: props.fields, - initialValue: props.actionTree.props[f2.name], - updateValue: (value) => { - const newTree = { ...props.actionTree }; - newTree.props[f2.name] = value; - props.saveTree(newTree); - }, - updateFieldValue: (fieldValue, value) => { - const newTree = { ...props.actionTree }; - newTree.props[f2.name] = value; - newTree.propsValue[f2.name] = fieldValue; - props.saveTree(newTree); - }, - editMode: 5 /* EditModeAlways */, - linkProp: (e5) => selectLinkedProp(e5, f2.name) - }); - }))), /* @__PURE__ */ import_react133.default.createElement("div", { - className: props.hasSiblings ? "mk-editor-actions-children" : "" - }, props.actionTree.children.map((child, i4) => /* @__PURE__ */ import_react133.default.createElement(ActionNode, { - key: i4, - hasSiblings: props.actionTree.children.length > 1, - prevField: command?.fields[i4], - superstate: props.superstate, - path: props.path, - fields: props.fields, - actionTree: child, - saveTree: (tree) => { - const newTree = { ...props.actionTree }; - newTree.children[i4] = tree; - props.saveTree(newTree); - }, - values: props.values, - deleteTree: () => { - const newTree = { ...props.actionTree }; - newTree.children.splice(i4, 1); - props.saveTree(newTree); + }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, { + ...handleProps, + cursor: "nwse-resize", + reverseY: true + })), /* @__PURE__ */ import_react151.default.createElement("div", { + className: "mk-frame-corner", + style: { + position: "absolute", + transform: `translate(${props.clientSize.width - minOffset}px, ${minOffset}px)`, + zIndex: "var(--mk-layer-editor-overlay)" } - })), props.actionTree.children.length == 0 && /* @__PURE__ */ import_react133.default.createElement("button", { - onClick: (e5) => selectAction(e5, true), - className: "mk-inline-button" - }, /* @__PURE__ */ import_react133.default.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, { + ...handleProps, + cursor: "nesw-resize", + reverseX: true, + reverseY: true + })), /* @__PURE__ */ import_react151.default.createElement("div", { + className: "mk-frame-corner", + style: { + position: "absolute", + transform: `translate(${minOffset}px, ${props.clientSize.height - minOffset}px)`, + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, { + ...handleProps, + cursor: "nesw-resize" + })), /* @__PURE__ */ import_react151.default.createElement("div", { + className: "mk-frame-corner", + style: { + position: "absolute", + transform: `translate(${props.clientSize.width - minOffset}px, ${props.clientSize.height - minOffset}px)`, + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react151.default.createElement(FrameDraggableHandle, { + ...handleProps, + reverseX: true, + cursor: "nwse-resize" + })))); +}; + +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameDropZone.tsx +var import_classnames8 = __toESM(require_classnames()); +var import_react152 = __toESM(require_react()); +var FrameDropZone = (props) => { + const { instance, id: id3 } = (0, import_react152.useContext)(FrameInstanceContext); + const { spaceInfo } = (0, import_react152.useContext)(SpaceContext); + const { setNodeRef } = useDroppable({ + id: props.id + props.direction, + data: { + id: props.id + props.direction, + direction: props.direction, + type: "node", + parent: props.parentId, + root: id3, + frame: props.schemaID, + space: spaceInfo.path, + node: props.node + } + }); + const offset2 = 20; + const left = props.direction == "left" ? -offset2 : props.direction == "right" ? props.width : 0; + const top = props.direction == "bottom" ? props.insertMode != 0 ? props.height : props.height / 2 : props.direction == "top" && props.insertMode != 0 ? -offset2 : 0; + const width = props.direction == "left" || props.direction == "right" ? offset2 : props.width; + const height = props.direction == "top" || props.direction == "bottom" ? props.insertMode != 0 ? offset2 : props.height / 2 : props.height; + const indicator = props.insertMode != 0 ? props.direction == "top" ? "bottom" : props.direction == "bottom" ? "top" : props.direction : props.direction; + return /* @__PURE__ */ import_react152.default.createElement("div", { + ref: setNodeRef, + className: (0, import_classnames8.default)( + props.active ? `mk-indicator-${indicator}` : "", + "mk-frame-drop-zone" + ), + style: { + left, + top, + width, + height } - }), "Add Step"))); + }); }; - -// src/core/react/components/SpaceEditor/Actions/ActionEditor.tsx -var ActionEditor = (props) => { - const [actionTree, setActionTree] = import_react134.default.useState( - parseActionString(props.formula) ?? { - action: "", - props: {}, - propsValue: {}, - children: [] - } - ); - return /* @__PURE__ */ import_react134.default.createElement("div", { - className: "mk-editor-actions-nodes" - }, /* @__PURE__ */ import_react134.default.createElement(ActionNode, { - hasSiblings: false, - superstate: props.superstate, - prevField: null, - actionTree, - path: props.path, - fields: props.fields, - values: props.value, - saveTree: (tree) => { - props.saveFormula(JSON.stringify(tree)); - setActionTree(tree); +var FrameEditorDropZone = (props) => { + const { frameSchema } = (0, import_react152.useContext)(FramesMDBContext); + const { hoverNode } = (0, import_react152.useContext)(FrameInstanceContext); + const directions2 = [ + ...props.mode == 1 /* DropModeRowColumn */ ? ["top", "bottom", "left", "right"] : props.mode == 2 /* DropModeRowOnly */ ? ["top", "bottom"] : props.mode == 3 /* DropModeColumnOnly */ ? ["left", "right"] : [], + ...props.insertMode == 1 ? ["inside"] : [] + ]; + return /* @__PURE__ */ import_react152.default.createElement("div", { + className: `mk-frame-drop-zone-container`, + style: { + width: props.width, + height: props.height } - })); + }, directions2.map((d4) => /* @__PURE__ */ import_react152.default.createElement(FrameDropZone, { + ...props, + key: d4, + active: hoverNode?.node == props.node && hoverNode?.direction == d4, + direction: d4, + mode: props.mode, + schemaID: frameSchema.id + }))); }; -// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx -var import_react135 = __toESM(require_react()); - -// node_modules/@uiw/codemirror-theme-github/esm/index.js -var defaultSettingsGithubLight = { - background: "#fff", - foreground: "#24292e", - selection: "#BBDFFF", - selectionMatch: "#BBDFFF", - gutterBackground: "#fff", - gutterForeground: "#6e7781" -}; -var githubLightInit = (options) => { - var { - theme = "light", - settings = {}, - styles: styles2 = [] - } = options || {}; - return createTheme({ - theme, - settings: _extends({}, defaultSettingsGithubLight, settings), - styles: [{ - tag: [tags2.standard(tags2.tagName), tags2.tagName], - color: "#116329" - }, { - tag: [tags2.comment, tags2.bracket], - color: "#6a737d" - }, { - tag: [tags2.className, tags2.propertyName], - color: "#6f42c1" - }, { - tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator], - color: "#005cc5" - }, { - tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName], - color: "#d73a49" - }, { - tag: [tags2.string, tags2.meta, tags2.regexp], - color: "#032f62" - }, { - tag: [tags2.name, tags2.quote], - color: "#22863a" - }, { - tag: [tags2.heading, tags2.strong], - color: "#24292e", - fontWeight: "bold" - }, { - tag: [tags2.emphasis], - color: "#24292e", - fontStyle: "italic" - }, { - tag: [tags2.deleted], - color: "#b31d28", - backgroundColor: "ffeef0" - }, { - tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)], - color: "#e36209" - }, { - tag: [tags2.url, tags2.escape, tags2.regexp, tags2.link], - color: "#032f62" - }, { - tag: tags2.link, - textDecoration: "underline" - }, { - tag: tags2.strikethrough, - textDecoration: "line-through" - }, { - tag: tags2.invalid, - color: "#cb2431" - }, ...styles2] +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameGapHandle.tsx +var import_react153 = __toESM(require_react()); +var reduceFlexItems = (items, container, xAxis, axisGap) => { + const rows = {}; + let row2 = 0; + let currentRowWidth = 0; + const axisValue = xAxis ? "width" : "height"; + const nonAxisValue = !xAxis ? "width" : "height"; + items.forEach((f2, i4, array) => { + if (i4 == 0) { + rows[row2] = { + start: i4, + end: i4, + maxValue: f2[nonAxisValue], + items: [{ ...f2, row: row2 }] + }; + currentRowWidth = f2[axisValue]; + } else if (array[i4][axisValue] + axisGap > container[axisValue]) { + row2++; + rows[row2] = { + start: i4, + end: i4, + maxValue: f2[nonAxisValue], + items: [{ ...f2, row: row2 }] + }; + } else if (array[i4][axisValue] + axisGap + currentRowWidth > container[axisValue]) { + row2++; + rows[row2] = { + start: i4, + end: i4, + maxValue: f2[nonAxisValue], + items: [{ ...f2, row: row2 }] + }; + currentRowWidth = f2[axisValue]; + } else { + if (rows[row2]) { + rows[row2] = { + start: rows[row2].start, + end: i4, + maxValue: Math.max(rows[row2].maxValue, f2[nonAxisValue]), + items: [...rows[row2].items, { ...f2, row: row2 }] + }; + currentRowWidth += f2[axisValue] + axisGap; + } else { + console.log("Warning: Flexbox found orphan row"); + } + } }); + return rows; }; -var githubLight = githubLightInit(); -var defaultSettingsGithubDark = { - background: "#0d1117", - foreground: "#c9d1d9", - caret: "#c9d1d9", - selection: "#003d73", - selectionMatch: "#003d73", - lineHighlight: "#36334280" -}; -var githubDarkInit = (options) => { - var { - theme = "dark", - settings = {}, - styles: styles2 = [] - } = options || {}; - return createTheme({ - theme, - settings: _extends({}, defaultSettingsGithubDark, settings), - styles: [{ - tag: [tags2.standard(tags2.tagName), tags2.tagName], - color: "#7ee787" - }, { - tag: [tags2.comment, tags2.bracket], - color: "#8b949e" - }, { - tag: [tags2.className, tags2.propertyName], - color: "#d2a8ff" - }, { - tag: [tags2.variableName, tags2.attributeName, tags2.number, tags2.operator], - color: "#79c0ff" - }, { - tag: [tags2.keyword, tags2.typeName, tags2.typeOperator, tags2.typeName], - color: "#ff7b72" - }, { - tag: [tags2.string, tags2.meta, tags2.regexp], - color: "#a5d6ff" - }, { - tag: [tags2.name, tags2.quote], - color: "#7ee787" - }, { - tag: [tags2.heading, tags2.strong], - color: "#d2a8ff", - fontWeight: "bold" - }, { - tag: [tags2.emphasis], - color: "#d2a8ff", - fontStyle: "italic" - }, { - tag: [tags2.deleted], - color: "#ffdcd7", - backgroundColor: "ffeef0" - }, { - tag: [tags2.atom, tags2.bool, tags2.special(tags2.variableName)], - color: "#ffab70" - }, { - tag: tags2.link, - textDecoration: "underline" - }, { - tag: tags2.strikethrough, - textDecoration: "line-through" - }, { - tag: tags2.invalid, - color: "#f97583" - }, ...styles2] +var FrameGapHandle = (props) => { + const calculateOffset = (value) => { + const match2 = value ? value.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; + const numericValue = match2 ? parseInt(match2[1]) : 0; + return numericValue; + }; + const [offset2, setOffset] = import_react153.default.useState({ + row: calculateOffset(props.styles["rowGap"]), + column: calculateOffset(props.styles["columnGap"]) }); -}; -var githubDark = githubDarkInit(); - -// src/core/react/components/SpaceEditor/Actions/ScriptEditor.tsx -var ScriptEditor = (props) => { - const { command } = props; - const value = (0, import_react135.useMemo)(() => { - if (!command) - return ""; - return `const ${command.schema.id} = (${command.fields.map((f2) => `${f2.name}: ${f2.type}`).join(", ")}, $api: API, $contexts) => { -${command.code} -}`; - }, [command]); - const saveCommand = (value2) => { - props.saveCommand({ - ...command, - code: value2.split("\n").slice(1, -1).join("\n"), - codeType: "script" + (0, import_react153.useEffect)(() => { + setOffset({ + row: calculateOffset(props.styles["rowGap"]), + column: calculateOffset(props.styles["columnGap"]) }); - }; - return /* @__PURE__ */ import_react135.default.createElement("div", null, /* @__PURE__ */ import_react135.default.createElement(esm_default, { - className: "mk-editor-code", - value, - height: "100%", - theme: githubDark, - extensions: [javascript({ jsx: true })], - onChange: saveCommand - }), /* @__PURE__ */ import_react135.default.createElement(ActionTester, { - type: "script", - code: command.code, - fields: command.fields, - value: {}, - superstate: props.superstate, - path: props.path - })); -}; - -// src/core/react/components/SpaceEditor/Actions/SpaceActions.tsx -var SpaceCommand = (props) => { - const [command, setCommand] = (0, import_react136.useState)(null); - const uri = (0, import_react136.useMemo)(() => { - return props.superstate.spaceManager.uriByString(props.action); - }, [props.action]); - const saveCommand = (command2) => { - setCommand(command2); - if (uri.authority == "$actions") { - props.superstate.spaceManager.saveSystemCommand( - uri.path.split("/").pop(), - command2 + }, [props.styles]); + const handleProps = { + value: offset2[props.direction], + onDragMove: (value) => { + setOffset({ + ...offset2, + [props.direction == "column" ? "row" : "column"]: value + }); + }, + onDragEnd: (value) => { + props.saveStyles( + props.direction == "column" ? { + rowGap: `"${value}px"` + } : { + columnGap: `"${value}px"` + } ); - return; } - props.superstate.spaceManager.saveCommand( - uri.path, - command2.schema.id, - () => command2 - ); }; - (0, import_react136.useEffect)(() => { - setCommand(props.superstate.cli.commandForAction(props.action)); - }, [props.action]); - (0, import_react136.useEffect)(() => { - const listener = (f2) => { - if (f2.path == uri.basePath) - setCommand(props.superstate.cli.commandForAction(props.action)); - }; - props.superstate.eventsDispatcher.addListener( - "actionStateUpdated", - listener - ); - return () => { - props.superstate.eventsDispatcher.removeListener( - "actionStateUpdated", - listener + const offAxisHandleProps = { + value: offset2[props.direction == "column" ? "row" : "column"], + onDragMove: (value) => { + setOffset({ + ...offset2, + [props.direction]: value + }); + }, + onDragEnd: (value) => { + props.saveStyles( + props.direction == "column" ? { + columnGap: `"${value}px"` + } : { + rowGap: `"${value}px"` + } ); - }; - }); - const saveField = (source, field) => { - saveCommand({ - ...command, - fields: [...command.fields, field] - }); + } }; - const deleteProperty2 = (field) => { - saveCommand({ - ...command, - fields: command.fields.filter((f2) => f2.name != field.name) + const rows = (0, import_react153.useMemo)( + () => reduceFlexItems( + props.childSizes, + { + width: props.clientSize.width - props.clientSize.paddingLeft - props.clientSize.paddingRight, + height: props.clientSize.height - props.clientSize.paddingTop - props.clientSize.paddingBottom + }, + props.direction == "row", + offset2[props.direction == "column" ? "row" : "column"] + ), + [props.childSizes, props.clientSize, props.direction, offset2] + ); + const items = (0, import_react153.useMemo)(() => { + const items2 = []; + Object.keys(rows).forEach((f2) => { + items2.push(...rows[f2].items); }); - }; - const updateField = (newField, oldField) => { - saveCommand({ - ...command, - fields: command.fields.map((f2) => { - if (f2.name == oldField.name) { - return newField; - } - return f2; - }) + return items2; + }, [rows]); + return /* @__PURE__ */ import_react153.default.createElement("div", { + className: `mk-frame-gaps ${parseStylesToClass(props.styles)}`, + style: { + position: "absolute", + top: 0, + left: 0, + width: props.clientSize.width, + height: props.clientSize.height, + padding: props.clientSize.paddingTop, + paddingLeft: props.clientSize.paddingLeft, + paddingBottom: props.clientSize.paddingBottom, + paddingRight: props.clientSize.paddingRight, + flexWrap: props.styles.flexWrap + } + }, props.direction === "row" ? items.map((f2, i4, array) => /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null, /* @__PURE__ */ import_react153.default.createElement("div", { + style: { width: f2.width, height: f2.height } + }), i4 == array.length - 1 ? /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react153.default.createElement("div", { + key: i4, + className: "mk-frame-gap-handle-h", + style: { + width: "100%", + height: Math.max(8, Math.abs(offset2["row"])), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, { + ...offAxisHandleProps, + cursor: "col-resize", + disableX: true, + reverseY: true + })) : /* @__PURE__ */ import_react153.default.createElement("div", { + key: i4, + className: "mk-frame-gap-handle-v", + style: { + width: Math.max(8, Math.abs(offset2["column"])), + height: rows[f2.row].maxValue, + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, { + ...handleProps, + cursor: "col-resize", + disableY: true + })))) : items.map((f2, i4, array) => /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null, /* @__PURE__ */ import_react153.default.createElement("div", { + style: { width: f2.width, height: f2.height } + }), i4 == array.length - 1 ? /* @__PURE__ */ import_react153.default.createElement(import_react153.default.Fragment, null) : rows[f2.row].end == i4 ? /* @__PURE__ */ import_react153.default.createElement("div", { + key: i4, + className: "mk-frame-gap-handle-v", + style: { + height: "100%", + width: Math.max(8, Math.abs(offset2["column"])), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, { + ...offAxisHandleProps, + cursor: "col-resize", + disableX: true, + reverseY: true + })) : /* @__PURE__ */ import_react153.default.createElement("div", { + key: i4, + className: "mk-frame-gap-handle-h", + style: { + height: Math.max(8, Math.abs(offset2["row"])), + width: rows[f2.row].maxValue, + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react153.default.createElement(FrameDraggableHandle, { + ...handleProps, + cursor: "row-resize", + disableX: true, + reverseY: true + }))))); +}; + +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FramePaddingHandle.tsx +var import_classnames9 = __toESM(require_classnames()); +var import_react154 = __toESM(require_react()); +var FramePadding = (props) => { + const paddingTypes = [ + "padding", + "paddingTop", + "paddingBottom", + "paddingLeft", + "paddingRight" + ]; + const [offset2, setOffset] = import_react154.default.useState({ + padding: 0, + paddingTop: null, + paddingBottom: null, + paddingLeft: null, + paddingRight: null + }); + const unit2 = "px"; + (0, import_react154.useEffect)(() => { + const getNumericValue = (type) => { + if (!props.styles[type]) + return null; + const match2 = props.styles[type] ? props.styles[type].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/) : null; + const numericValue = Math.max(match2 ? parseInt(match2[1]) : 0, 8); + return numericValue; + }; + setOffset((p2) => { + return paddingTypes.reduce((a4, c3) => { + return { + ...a4, + [c3]: getNumericValue(c3) + }; + }, p2); }); + }, [props.styles]); + const [shiftModifier, setShiftModifier] = import_react154.default.useState(false); + const handleProps = { + min: 0, + mod: 2 }; - const newProperty = (e5) => { - const offset2 = e5.target.getBoundingClientRect(); - showNewPropertyMenu( - props.superstate, - offset2, - [], - [], - saveField, - command.schema.id, - null, - true, - true + const inset = (type) => Math.max(5, offset2[type] ?? offset2.padding); + const setNewOffset = (type, value, modifiers) => { + setOffset( + (p2) => modifiers.shiftKey ? { + padding: value, + paddingBottom: null, + paddingTop: null, + paddingLeft: null, + paddingRight: null + } : { ...p2, [type]: value } ); }; - const menuItems = [ - { name: "Actions", value: "actions" }, - { name: "Script", value: "script" }, - { name: "Formula", value: "formula" } - ]; - const defaultValueForField = (field) => { - const parsedValue = parseFieldValue(field.value, field.type); - if (parsedValue) { - return parsedValue?.default; - } - }; - const saveDefaultValueForField = (field, value) => { - const parsedValue = parseFieldValue(field.value, field.type) ?? {}; - parsedValue.default = value; - updateField( - { - ...field, - value: JSON.stringify(parsedValue) - }, - field + const saveValue = (type, value, modifiers) => { + props.saveStyles( + modifiers.shiftKey ? { + padding: `'${value}${unit2}'`, + paddingBottom: "", + paddingTop: "", + paddingLeft: "", + paddingRight: "" + } : { [type]: `'${value}${unit2}'` } ); }; - const defaultValues = (0, import_react136.useMemo)(() => { - return command?.fields.reduce((p, c3) => { - return { ...p, [c3.name]: defaultValueForField(c3) }; - }, {}) ?? {}; - }, [command?.fields]); - return /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-editor-actions" - }, command && /* @__PURE__ */ import_react136.default.createElement(import_react136.default.Fragment, null, /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-props-contexts" - }, /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-path-context-row" - }, /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-path-context-field" - }, "Type"), /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-path-context-value" - }, /* @__PURE__ */ import_react136.default.createElement(Dropdown2, { - superstate: props.superstate, - options: menuItems, - value: command.schema.type, - selectValue: (value) => saveCommand({ - ...command, - schema: { - ...command.schema, - type: value + (0, import_react154.useEffect)(() => { + const handleKeyDown = (e5) => { + if (e5.key === "Shift") { + setShiftModifier(true); } - }) - }))), /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-path-context-row" - }, /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-path-context-field" - }, "Properties")), /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-cell-object" - }, command.fields.map((f2) => { - return /* @__PURE__ */ import_react136.default.createElement(DataPropertyView, { - key: f2.name, - superstate: props.superstate, - initialValue: defaultValueForField(f2), - column: f2, - editMode: 5 /* EditModeAlways */, - updateValue: (value) => { - saveDefaultValueForField(f2, value); - }, - updateFieldValue: (fieldValue, value) => { - saveCommand({ - ...command, - fields: command.fields.map((g) => { - if (f2.name == g.name) { - return { - ...g, - value: fieldValue - }; - } - return g; - }) - }); - }, - propertyMenu: (e5) => { - const offset2 = e5.target.getBoundingClientRect(); - showPropertyMenu({ - superstate: props.superstate, - rect: offset2, - editable: true, - options: [], - field: f2, - fields: command.fields, - contextPath: null, - saveField: (newField) => updateField(newField, f2), - deleteColumn: deleteProperty2 - }); + }; + const handleKeyUp = (e5) => { + if (e5.key === "Shift") { + setShiftModifier(false); } - }); - })), /* @__PURE__ */ import_react136.default.createElement("button", { - className: "mk-inline-button", - onClick: (e5) => newProperty(e5) - }, /* @__PURE__ */ import_react136.default.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + }; + window.addEventListener("keydown", handleKeyDown); + window.addEventListener("keyup", handleKeyUp); + return () => { + window.removeEventListener("keydown", handleKeyDown); + window.removeEventListener("keyup", handleKeyUp); + }; + }, []); + return /* @__PURE__ */ import_react154.default.createElement("div", { + style: { + position: "absolute", + top: 0, + left: 0, + width: props.clientSize.width, + height: props.clientSize.height, + display: "flex", + zIndex: 200, + border: "1px solid var(--mk-ui-color-border-accent)" } - }), i18n_default.labels.newProperty)), command.schema.type == "script" ? /* @__PURE__ */ import_react136.default.createElement(ScriptEditor, { - superstate: props.superstate, - command, - saveCommand, - values: defaultValues, - path: uri.path - }) : command.schema.type == "actions" ? /* @__PURE__ */ import_react136.default.createElement(ActionEditor, { - superstate: props.superstate, - formula: command.code, - path: uri.path, - saveOutputType: (outputType) => { - saveCommand({ - ...command, - codeType: outputType - }); + }, /* @__PURE__ */ import_react154.default.createElement("div", { + className: (0, import_classnames9.default)( + "mk-frame-paddings", + shiftModifier && "mk-modifier-shift" + ) + }, /* @__PURE__ */ import_react154.default.createElement("div", { + className: "mk-frame-padding-handle-h", + style: { + position: "absolute", + transform: `translate(${0}px, ${0}px)`, + height: inset("paddingTop"), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, { + ...handleProps, + value: offset2["paddingTop"] ?? offset2.padding, + cursor: "s-resize", + max: props.clientSize.height, + onDragMove: (value, modifiers) => { + setNewOffset("paddingTop", value, modifiers); }, - saveFormula: (formula) => { - saveCommand({ - ...command, - code: formula - }); + onDragEnd: (value, modifiers) => { + saveValue("paddingTop", value, modifiers); }, - fields: command.fields, - value: defaultValues - }) : command.schema.type == "formula" ? /* @__PURE__ */ import_react136.default.createElement(FormulaEditor, { - superstate: props.superstate, - formula: command.code, - saveFormula: (formula) => { - saveCommand({ - ...command, - code: formula - }); + reverseY: true, + disableX: true + })), /* @__PURE__ */ import_react154.default.createElement("div", { + className: "mk-frame-padding-handle-v", + style: { + position: "absolute", + transform: `translate(${props.clientSize.width - inset("paddingRight")}px, ${0}px)`, + width: inset("paddingRight"), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, { + ...handleProps, + value: offset2["paddingRight"] ?? offset2.padding, + cursor: "w-resize", + onDragMove: (value, modifiers) => { + setNewOffset("paddingRight", value, modifiers); }, - fields: command.fields, - value: defaultValues, - path: uri.path - }) : /* @__PURE__ */ import_react136.default.createElement("div", null))); + max: props.clientSize.width, + onDragEnd: (value, modifiers) => { + saveValue("paddingRight", value, modifiers); + }, + reverseX: true, + reverseY: true, + disableY: true + })), /* @__PURE__ */ import_react154.default.createElement("div", { + className: "mk-frame-padding-handle-v", + style: { + position: "absolute", + transform: `translate(${0}px, ${0}px)`, + width: inset("paddingLeft"), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, { + ...handleProps, + value: offset2["paddingLeft"] ?? offset2.padding, + cursor: "e-resize", + max: props.clientSize.width, + onDragMove: (value, modifiers) => { + setNewOffset("paddingLeft", value, modifiers); + }, + onDragEnd: (value, modifiers) => { + saveValue("paddingLeft", value, modifiers); + }, + disableY: true + })), /* @__PURE__ */ import_react154.default.createElement("div", { + className: "mk-frame-padding-handle-h", + style: { + position: "absolute", + transform: `translate(${0}px, ${props.clientSize.height - inset("paddingBottom")}px)`, + height: inset("paddingBottom"), + zIndex: "var(--mk-layer-editor-overlay)" + } + }, /* @__PURE__ */ import_react154.default.createElement(FrameDraggableHandle, { + ...handleProps, + value: offset2["paddingBottom"] ?? offset2.padding, + cursor: "n-resize", + max: props.clientSize.height, + onDragMove: (value, modifiers) => { + setNewOffset("paddingBottom", value, modifiers); + }, + onDragEnd: (value, modifiers) => { + saveValue("paddingBottom", value, modifiers); + }, + reverseX: true, + disableX: true + })))); }; -// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx -var import_react138 = __toESM(require_react()); +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx +var import_classnames10 = __toESM(require_classnames()); -// src/core/react/components/SpaceView/Frames/ViewNodes/FrameInstance.tsx -var import_react137 = __toESM(require_react()); -var FrameInstanceView = (props) => { - const { saveState, instance } = (0, import_react137.useContext)(FrameInstanceContext); - return instance.exec && /* @__PURE__ */ import_react137.default.createElement(FrameView, { - superstate: props.superstate, - treeNode: instance.exec, - instance, - saveState, - source: props.source - }, props.children); -}; +// node_modules/re-resizable/lib/index.js +var React152 = __toESM(require_react()); +var import_react_dom10 = __toESM(require_react_dom()); -// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx -var SpaceFragmentViewComponent = (props) => { - const path2 = (0, import_react138.useMemo)( - () => props.superstate.spaceManager.uriByString(props.path, props.source), - [props.path, props.source] - ); - const [spaceFragment, setSpaceFragment] = (0, import_react138.useState)(null); - (0, import_react138.useEffect)(() => { - if (path2.refType == "context") { - setSpaceFragment({ - type: "context", - path: path2.basePath, - contextSchema: path2.ref, - frameSchema: path2.query?.frameSchema - }); - } else if (path2.refType == "frame") { - let schema = props.superstate.framesIndex.get(path2.basePath)?.schemas.find((f2) => f2.id == path2.ref); - if (!schema && path2.ref == defaultFrameListViewSchema.id) { - schema = defaultFrameListViewSchema; - setSpaceFragment({ - type: "context", - path: path2.basePath, - frameSchema: schema.id - }); - } - if (schema?.type == "view") { - setSpaceFragment({ - type: "context", - path: path2.basePath, - frameSchema: path2.ref - }); - } else { - setSpaceFragment({ - type: "frame", - path: path2.basePath, - frameSchema: path2.ref - }); - } - } else if (path2.refType == "action") { - setSpaceFragment({ - type: "action", - path: path2.basePath, - actionSchema: path2.ref - }); - } else { - setSpaceFragment({ - type: "context", - path: path2.basePath, - frameSchema: defaultFrameListViewID - }); +// node_modules/re-resizable/lib/resizer.js +var React151 = __toESM(require_react()); +var __extends = function() { + var extendStatics = function(d4, b2) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { + d5.__proto__ = b3; + } || function(d5, b3) { + for (var p2 in b3) + if (Object.prototype.hasOwnProperty.call(b3, p2)) + d5[p2] = b3[p2]; + }; + return extendStatics(d4, b2); + }; + return function(d4, b2) { + extendStatics(d4, b2); + function __() { + this.constructor = d4; } - }, [path2]); - return /* @__PURE__ */ import_react138.default.createElement(import_react138.default.Fragment, null, spaceFragment?.path && (spaceFragment?.type == "context" ? /* @__PURE__ */ import_react138.default.createElement(PathProvider, { - superstate: props.superstate, - path: spaceFragment.path, - readMode: false - }, /* @__PURE__ */ import_react138.default.createElement(SpaceProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react138.default.createElement(FramesMDBProvider, { - superstate: props.superstate, - contextSchema: spaceFragment.contextSchema, - schema: spaceFragment.frameSchema - }, /* @__PURE__ */ import_react138.default.createElement(ContextEditorProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react138.default.createElement(ContextListContainer, { - superstate: props.superstate, - minMode: props.minMode, - containerRef: props.containerRef, - setView: props.setFrameSchema - }))))) : spaceFragment?.type == "frame" ? /* @__PURE__ */ import_react138.default.createElement(FrameRootProvider, { - superstate: props.superstate, - path: path2, - cols: [] - }, /* @__PURE__ */ import_react138.default.createElement(FrameInstanceProvider, { - id: props.id, - superstate: props.superstate, - props: {}, - editable: false - }, /* @__PURE__ */ import_react138.default.createElement(FrameInstanceView, { - superstate: props.superstate, - source: props.source - }))) : spaceFragment?.type == "action" ? /* @__PURE__ */ import_react138.default.createElement(SpaceCommand, { - superstate: props.superstate, - action: props.path - }) : /* @__PURE__ */ import_react138.default.createElement(import_react138.default.Fragment, null))); -}; - -// src/core/react/components/SpaceView/Frames/EditorNodes/ContextNodeView.tsx -var import_react139 = __toESM(require_react()); -var ContextNodeView = (props) => { - const fullPath = props.state?.props?.value; - const { updateNode } = (0, import_react139.useContext)(FramesEditorRootContext); - const { id: id3 } = (0, import_react139.useContext)(FrameInstanceContext); - const selectLink = (e5) => { - showSpacesMenu( - e5, - props.superstate, - (link) => updateNode(props.treeNode.node, { - props: { - ...props.treeNode.node.props, - value: wrapQuotes(link + "#^" + defaultContextSchemaID) - } - }) - ); + d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); }; - const setFrameSchema = (schema) => { - if (props.treeNode.node.props.value == "$contexts['$space']['space']") { - updateNode(props.treeNode.node, { - props: { - ...props.treeNode.node.props, - value: `$contexts['$space']['space']+"/#*${schema}"` - } - }); - return; +}(); +var __assign2 = function() { + __assign2 = Object.assign || function(t5) { + for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) { + s4 = arguments[i4]; + for (var p2 in s4) + if (Object.prototype.hasOwnProperty.call(s4, p2)) + t5[p2] = s4[p2]; } - updateNode(props.treeNode.node, { - props: { - ...props.treeNode.node.props, - value: wrapQuotes( - contextPathFromPath( - props.superstate, - props.superstate.spaceManager.resolvePath(fullPath, props.source) - )?.space + "#*" + schema - ) - } - }); + return t5; }; - return props.state && fullPath ? /* @__PURE__ */ import_react139.default.createElement(SpaceFragmentViewComponent, { - id: id3, - source: props.source, - superstate: props.superstate, - path: fullPath, - minMode: props.state?.styles?.["--mk-min-mode"], - containerRef: props.containerRef, - setFrameSchema - }) : /* @__PURE__ */ import_react139.default.createElement("div", { - className: "mk-frame-placeholder", - onClick: (e5) => selectLink(e5) - }, i18n_default.labels.selectSpace); + return __assign2.apply(this, arguments); +}; +var rowSizeBase = { + width: "100%", + height: "10px", + top: "0px", + left: "0px", + cursor: "row-resize" +}; +var colSizeBase = { + width: "10px", + height: "100%", + top: "0px", + left: "0px", + cursor: "col-resize" +}; +var edgeBase = { + width: "20px", + height: "20px", + position: "absolute" +}; +var styles = { + top: __assign2(__assign2({}, rowSizeBase), { top: "-5px" }), + right: __assign2(__assign2({}, colSizeBase), { left: void 0, right: "-5px" }), + bottom: __assign2(__assign2({}, rowSizeBase), { top: void 0, bottom: "-5px" }), + left: __assign2(__assign2({}, colSizeBase), { left: "-5px" }), + topRight: __assign2(__assign2({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }), + bottomRight: __assign2(__assign2({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }), + bottomLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }), + topLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" }) }; +var Resizer = function(_super) { + __extends(Resizer2, _super); + function Resizer2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.onMouseDown = function(e5) { + _this.props.onResizeStart(e5, _this.props.direction); + }; + _this.onTouchStart = function(e5) { + _this.props.onResizeStart(e5, _this.props.direction); + }; + return _this; + } + Resizer2.prototype.render = function() { + return React151.createElement("div", { className: this.props.className || "", style: __assign2(__assign2({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children); + }; + return Resizer2; +}(React151.PureComponent); -// src/core/react/components/SpaceView/Frames/EditorNodes/IconNodeView.tsx -var import_react140 = __toESM(require_react()); -var IconNodeView = (props) => { - const { - selectionMode, - selected: frameSelected, - selection: selection2 - } = (0, import_react140.useContext)(FrameSelectionContext); - const { updateNode, nodes } = (0, import_react140.useContext)(FramesEditorRootContext); - const updateValue2 = (newValue) => { - if (newValue != props.state.props?.value) { - if (props.treeNode.editorProps?.linkedNode) { - const node = nodes.find( - (f2) => f2.id == props.treeNode.editorProps.linkedNode.node - ); - updateNode(node, { - props: { - ...node.props, - [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) - } - }); - } else { - updateNode(props.treeNode.node, { - props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } - }); - } +// node_modules/re-resizable/lib/index.js +var __extends2 = function() { + var extendStatics = function(d4, b2) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { + d5.__proto__ = b3; + } || function(d5, b3) { + for (var p2 in b3) + if (Object.prototype.hasOwnProperty.call(b3, p2)) + d5[p2] = b3[p2]; + }; + return extendStatics(d4, b2); + }; + return function(d4, b2) { + extendStatics(d4, b2); + function __() { + this.constructor = d4; } + d4.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); }; - const selected = selection2?.includes(props.treeNode.node.id); - const editable = (0, import_react140.useMemo)(() => { - if (selectionMode == 0 /* Read */) - return false; - if (selectionMode == 1 /* Page */) - return true; - if (selectionMode == 3 /* Group */ && selected) - return true; - if (props.treeNode.isRef) { - if (props.treeNode.editorProps.linkedNode && frameSelected) - return true; - return false; +}(); +var __assign3 = function() { + __assign3 = Object.assign || function(t5) { + for (var s4, i4 = 1, n3 = arguments.length; i4 < n3; i4++) { + s4 = arguments[i4]; + for (var p2 in s4) + if (Object.prototype.hasOwnProperty.call(s4, p2)) + t5[p2] = s4[p2]; } - return true; - }, [props.treeNode, selectionMode, frameSelected, selected]); - const selectIcon = () => { - props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react140.default.createElement(StickerModal_default, { - ui: props.superstate.ui, - hide: _props.hide, - selectedSticker: (emoji) => updateValue2(emoji) - })); + return t5; }; - const [stickerType, stickerPath] = props.state.props?.value ? parseStickerString(props.state.props?.value) : [null, null]; - return props.state && (props.state.props?.value?.length > 0 ? stickerType == "image" ? /* @__PURE__ */ import_react140.default.createElement("img", { - className: "mk-frame-icon", - src: props.superstate.ui.getUIPath( - props.superstate.imagesCache.get(stickerPath) - ) - }) : /* @__PURE__ */ import_react140.default.createElement("div", { - className: "mk-frame-icon", - style: {}, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(props.state.props?.value) + return __assign3.apply(this, arguments); +}; +var DEFAULT_SIZE = { + width: "auto", + height: "auto" +}; +var clamp2 = function(n3, min5, max5) { + return Math.max(Math.min(n3, max5), min5); +}; +var snap = function(n3, size2) { + return Math.round(n3 / size2) * size2; +}; +var hasDirection = function(dir, target) { + return new RegExp(dir, "i").test(target); +}; +var isTouchEvent2 = function(event) { + return Boolean(event.touches && event.touches.length); +}; +var isMouseEvent = function(event) { + return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0)); +}; +var findClosestSnap = function(n3, snapArray, snapGap) { + if (snapGap === void 0) { + snapGap = 0; + } + var closestGapIndex = snapArray.reduce(function(prev, curr, index3) { + return Math.abs(curr - n3) < Math.abs(snapArray[prev] - n3) ? index3 : prev; + }, 0); + var gap = Math.abs(snapArray[closestGapIndex] - n3); + return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n3; +}; +var getStringSize = function(n3) { + n3 = n3.toString(); + if (n3 === "auto") { + return n3; + } + if (n3.endsWith("px")) { + return n3; + } + if (n3.endsWith("%")) { + return n3; + } + if (n3.endsWith("vh")) { + return n3; + } + if (n3.endsWith("vw")) { + return n3; + } + if (n3.endsWith("vmax")) { + return n3; + } + if (n3.endsWith("vmin")) { + return n3; + } + return n3 + "px"; +}; +var getPixelSize = function(size2, parentSize, innerWidth2, innerHeight2) { + if (size2 && typeof size2 === "string") { + if (size2.endsWith("px")) { + return Number(size2.replace("px", "")); } - }) : editable ? /* @__PURE__ */ import_react140.default.createElement("div", { - onClick: () => selectIcon(), - "aria-label": "Select Sticker", - className: "mk-node-icon-placeholder", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//smile") + if (size2.endsWith("%")) { + var ratio = Number(size2.replace("%", "")) / 100; + return parentSize * ratio; + } + if (size2.endsWith("vw")) { + var ratio = Number(size2.replace("vw", "")) / 100; + return innerWidth2 * ratio; + } + if (size2.endsWith("vh")) { + var ratio = Number(size2.replace("vh", "")) / 100; + return innerHeight2 * ratio; } - }) : /* @__PURE__ */ import_react140.default.createElement(import_react140.default.Fragment, null)); + } + return size2; }; - -// src/core/react/components/SpaceView/Frames/EditorNodes/ImageNodeView.tsx -var import_react141 = __toESM(require_react()); -var ImageNodeView = (props) => { - const value = props.state.props.value; - const sourcePath = (0, import_react141.useMemo)(() => { - return props.superstate.ui.getUIPath(value, true); - }, [value]); - const { nodes, updateNode } = (0, import_react141.useContext)(FramesEditorRootContext); - const { linkedProps } = (0, import_react141.useContext)(FrameInstanceContext); - const { - selectionMode, - selected: frameSelected, - selection: selection2 - } = (0, import_react141.useContext)(FrameSelectionContext); - const selected = selection2?.includes(props.treeNode.node.id); - const showModal2 = () => { - if (!stringIsConst(props.treeNode.node.props.value) && !linkedProps.some( - (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2 - )) - return; - props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react141.default.createElement(ImageModal_default, { - superstate: props.superstate, - hide: _props.hide, - selectedPath: (image) => saveValue(image) - })); +var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) { + maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2); + maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2); + minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2); + minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2); + return { + maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth), + maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight), + minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth), + minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight) }; - const saveValue = (newValue) => { - if (newValue != props.state.props?.value) { - if (props.treeNode.editorProps?.linkedNode) { - const node = nodes.find( - (f2) => f2.id == props.treeNode.editorProps.linkedNode.node - ); - updateNode(node, { - props: { - ...node.props, - [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) - } - }); +}; +var definedProps = [ + "as", + "style", + "className", + "grid", + "snap", + "bounds", + "boundsByDirection", + "size", + "defaultSize", + "minWidth", + "minHeight", + "maxWidth", + "maxHeight", + "lockAspectRatio", + "lockAspectRatioExtraWidth", + "lockAspectRatioExtraHeight", + "enable", + "handleStyles", + "handleClasses", + "handleWrapperStyle", + "handleWrapperClass", + "children", + "onResizeStart", + "onResize", + "onResizeStop", + "handleComponent", + "scale", + "resizeRatio", + "snapGap" +]; +var baseClassName = "__resizable_base__"; +var Resizable = function(_super) { + __extends2(Resizable2, _super); + function Resizable2(props) { + var _this = _super.call(this, props) || this; + _this.ratio = 1; + _this.resizable = null; + _this.parentLeft = 0; + _this.parentTop = 0; + _this.resizableLeft = 0; + _this.resizableRight = 0; + _this.resizableTop = 0; + _this.resizableBottom = 0; + _this.targetLeft = 0; + _this.targetTop = 0; + _this.appendBase = function() { + if (!_this.resizable || !_this.window) { + return null; + } + var parent = _this.parentNode; + if (!parent) { + return null; + } + var element3 = _this.window.document.createElement("div"); + element3.style.width = "100%"; + element3.style.height = "100%"; + element3.style.position = "absolute"; + element3.style.transform = "scale(0, 0)"; + element3.style.left = "0"; + element3.style.flex = "0 0 100%"; + if (element3.classList) { + element3.classList.add(baseClassName); } else { - updateNode(props.treeNode.node, { - props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } - }); + element3.className += baseClassName; } - } - }; - const editable = (0, import_react141.useMemo)(() => { - if (selectionMode == 0 /* Read */) - return false; - if (selectionMode == 1 /* Page */) - return true; - if (selectionMode == 3 /* Group */ && selected) - return true; - if (props.treeNode.isRef) { - if (props.treeNode.editorProps.linkedNode && frameSelected) - return true; - return false; - } - return true; - }, [props.treeNode, selectionMode, frameSelected, selected]); - return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react141.default.createElement("img", { - className: "mk-node-image", - width: props.state?.styles.width, - height: props.state?.styles.height, - style: { - borderRadius: props.state?.styles.borderRadius, - maxHeight: props.state?.styles.maxHeight + parent.appendChild(element3); + return element3; + }; + _this.removeBase = function(base3) { + var parent = _this.parentNode; + if (!parent) { + return; + } + parent.removeChild(base3); + }; + _this.ref = function(c3) { + if (c3) { + _this.resizable = c3; + } + }; + _this.state = { + isResizing: false, + width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width, + height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height, + direction: "right", + original: { + x: 0, + y: 0, + width: 0, + height: 0 + }, + backgroundStyle: { + height: "100%", + width: "100%", + backgroundColor: "rgba(0,0,0,0)", + cursor: "auto", + opacity: 0, + position: "fixed", + zIndex: 9999, + top: "0", + left: "0", + bottom: "0", + right: "0" + }, + flexBasis: void 0 + }; + _this.onResizeStart = _this.onResizeStart.bind(_this); + _this.onMouseMove = _this.onMouseMove.bind(_this); + _this.onMouseUp = _this.onMouseUp.bind(_this); + return _this; + } + Object.defineProperty(Resizable2.prototype, "parentNode", { + get: function() { + if (!this.resizable) { + return null; + } + return this.resizable.parentNode; }, - src: sourcePath - }) : editable ? /* @__PURE__ */ import_react141.default.createElement("div", { - className: "mk-node-image-placeholder", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getPlaceholderImage("image-select") + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "window", { + get: function() { + if (!this.resizable) { + return null; + } + if (!this.resizable.ownerDocument) { + return null; + } + return this.resizable.ownerDocument.defaultView; }, - style: { - borderRadius: props.state?.styles.borderRadius, - maxHeight: props.state?.styles.maxHeight + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "propsSize", { + get: function() { + return this.props.size || this.props.defaultSize || DEFAULT_SIZE; }, - onClick: (e5) => showModal2() - }) : /* @__PURE__ */ import_react141.default.createElement(import_react141.default.Fragment, null); -}; - -// src/core/react/components/SpaceView/Frames/EditorNodes/InputNodeView.tsx -var import_react142 = __toESM(require_react()); -var InputNodeView = (props) => { - const { selectionMode } = (0, import_react142.useContext)(FrameSelectionContext); - const { saveState, instance } = (0, import_react142.useContext)(FrameInstanceContext); - const [value, setValue] = (0, import_react142.useState)(""); - const state = props.state; - const type = props.state.styles?.as; - (0, import_react142.useEffect)(() => { - const linkedNode = parseLinkedNode(props.state?.props?.value); - if (linkedNode) { - const node = linkedNode.node == "$root" ? instance.exec.id : linkedNode.node; - setValue(instance.state?.[node]?.props?.[linkedNode.prop]); - } - }, [props.state.props]); - return /* @__PURE__ */ import_react142.default.createElement("input", { - className: "mk-node-input", - type, - value: type == "checkbox" ? null : value, - checked: value == "true", - onKeyDown: (e5) => { - e5.stopPropagation(); - if (e5.key == "Enter") { - const _value = type == "text" ? e5.currentTarget.value : type == "checkbox" ? (!e5.currentTarget.checked).toString() : e5.currentTarget.value; - setValue(""); - if (typeof state.actions?.onEnter == "function") { - state.actions?.onEnter( - e5, - _value, - instance.state, - (s4) => saveState(s4, instance), - props.superstate.api - ); + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "size", { + get: function() { + var width = 0; + var height = 0; + if (this.resizable && this.window) { + var orgWidth = this.resizable.offsetWidth; + var orgHeight = this.resizable.offsetHeight; + var orgPosition = this.resizable.style.position; + if (orgPosition !== "relative") { + this.resizable.style.position = "relative"; } + width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth; + height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight; + this.resizable.style.position = orgPosition; } + return { width, height }; }, - onChange: (e5) => { - const _value = type == "text" ? e5.target.value : type == "checkbox" ? (!e5.target.checked).toString() : e5.target.value; - setValue(_value); - if (typeof state.actions?.onChange == "function") { - state.actions?.onChange( - e5, - _value, - instance.state, - (s4) => saveState(s4, instance), - props.superstate.api - ); - } - }, - placeholder: state.styles.placeholder, - style: { - ...state?.styles - } + enumerable: false, + configurable: true }); -}; - -// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx -var import_react146 = __toESM(require_react()); - -// src/core/react/hooks/useEffectOnce.ts -var import_react143 = __toESM(require_react()); -function useEffectOnce(cb) { - (0, import_react143.useEffect)(cb, []); -} - -// src/core/react/hooks/useEventListener.ts -var import_react144 = __toESM(require_react()); -function useEventListener(eventType, callback, element = window) { - const callbackRef = (0, import_react144.useRef)(callback); - (0, import_react144.useEffect)(() => { - callbackRef.current = callback; - }, [callback]); - (0, import_react144.useEffect)(() => { - if (element == null) - return; - const handler = (e5) => callbackRef.current(e5); - element.addEventListener(eventType, handler); - return () => element.removeEventListener(eventType, handler); - }, [eventType, element]); -} - -// src/core/react/hooks/useTimeout.tsx -var import_react145 = __toESM(require_react()); -function useTimeout(callback, delay) { - const callbackRef = (0, import_react145.useRef)(callback); - const timeoutRef = (0, import_react145.useRef)(null); - (0, import_react145.useEffect)(() => { - callbackRef.current = callback; - }, [callback]); - const set = (0, import_react145.useCallback)(() => { - timeoutRef.current = setTimeout(() => callbackRef.current(), delay); - }, [delay]); - const clear = (0, import_react145.useCallback)(() => { - timeoutRef.current && clearTimeout(timeoutRef.current); - }, []); - (0, import_react145.useEffect)(() => { - set(); - return clear; - }, [delay, set, clear]); - const reset2 = (0, import_react145.useCallback)(() => { - clear(); - set(); - }, [clear, set]); - return { reset: reset2, clear }; -} - -// src/core/react/hooks/useLongPress.tsx -function useLongPress(ref2, cb, { delay = 400 } = {}) { - const { reset: reset2, clear } = useTimeout(cb, delay); - useEffectOnce(clear); - useEventListener("mousedown", reset2, ref2.current); - useEventListener("touchstart", reset2, ref2.current); - useEventListener("mouseup", clear, ref2.current); - useEventListener("mouseleave", clear, ref2.current); - useEventListener("touchend", clear, ref2.current); -} - -// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx -var TextNodeView = (props) => { - const { - selectionMode, - selection: selection2, - selectable, - selected: frameSelected, - select - } = (0, import_react146.useContext)(FrameSelectionContext); - const fileNameRef = (0, import_react146.useRef)(null); - const { updateNode, nodes, deleteNode } = (0, import_react146.useContext)(FramesEditorRootContext); - const updateValue2 = (newValue) => { - if (newValue != props.state.props?.value) { - if (props.treeNode.editorProps?.linkedNode) { - const node = nodes.find( - (f2) => f2.id == props.treeNode.editorProps.linkedNode.node - ); - updateNode(node, { - props: { - ...node.props, - [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) + Object.defineProperty(Resizable2.prototype, "sizeStyle", { + get: function() { + var _this = this; + var size2 = this.props.size; + var getSize = function(key3) { + if (typeof _this.state[key3] === "undefined" || _this.state[key3] === "auto") { + return "auto"; + } + if (_this.propsSize && _this.propsSize[key3] && _this.propsSize[key3].toString().endsWith("%")) { + if (_this.state[key3].toString().endsWith("%")) { + return _this.state[key3].toString(); } - }); - } else { - updateNode(props.treeNode.node, { - props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } - }); + var parentSize = _this.getParentSize(); + var value = Number(_this.state[key3].toString().replace("px", "")); + var percent = value / parentSize[key3] * 100; + return percent + "%"; + } + return getStringSize(_this.state[key3]); + }; + var width = size2 && typeof size2.width !== "undefined" && !this.state.isResizing ? getStringSize(size2.width) : getSize("width"); + var height = size2 && typeof size2.height !== "undefined" && !this.state.isResizing ? getStringSize(size2.height) : getSize("height"); + return { width, height }; + }, + enumerable: false, + configurable: true + }); + Resizable2.prototype.getParentSize = function() { + if (!this.parentNode) { + if (!this.window) { + return { width: 0, height: 0 }; } + return { width: this.window.innerWidth, height: this.window.innerHeight }; } - }; - const onBlur = (e5) => { - const newValue = e5.target.innerHTML; - updateValue2(newValue); - }; - const onKeyPress = (e5) => { - e5.stopPropagation(); - }; - const onKeyUp = (e5) => { - e5.stopPropagation(); - }; - const onKeyDown = (e5) => { - e5.stopPropagation(); - if (e5.key == "Delete" || e5.key == "Backspace") { - if (e5.target.innerHTML == "") - deleteNode(props.treeNode.node); - } - if (e5.key == "a" && e5.metaKey) { - e5.preventDefault(); - const selection3 = window.getSelection(); - const range2 = document.createRange(); - range2.selectNodeContents(e5.target); - selection3.removeAllRanges(); - selection3.addRange(range2); + var base3 = this.appendBase(); + if (!base3) { + return { width: 0, height: 0 }; } - if (e5.key == "Enter") { - e5.target.blur(); - e5.preventDefault(); + var wrapChanged = false; + var wrap3 = this.parentNode.style.flexWrap; + if (wrap3 !== "wrap") { + wrapChanged = true; + this.parentNode.style.flexWrap = "wrap"; } - if (e5.key == "Escape") { - e5.target.blur(); - e5.preventDefault(); + base3.style.position = "relative"; + base3.style.minWidth = "100%"; + base3.style.minHeight = "100%"; + var size2 = { + width: base3.offsetWidth, + height: base3.offsetHeight + }; + if (wrapChanged) { + this.parentNode.style.flexWrap = wrap3; } + this.removeBase(base3); + return size2; }; - const onClick = (e5) => { - if (editable) { - e5.stopPropagation(); + Resizable2.prototype.bindEvents = function() { + if (this.window) { + this.window.addEventListener("mouseup", this.onMouseUp); + this.window.addEventListener("mousemove", this.onMouseMove); + this.window.addEventListener("mouseleave", this.onMouseUp); + this.window.addEventListener("touchmove", this.onMouseMove, { + capture: true, + passive: false + }); + this.window.addEventListener("touchend", this.onMouseUp); } }; - const onMouseDown = (e5) => { - if (editable) - e5.stopPropagation(); - if (selectionMode == 3 /* Group */ && !props.treeNode.isRef) { - select(props.treeNode.id); + Resizable2.prototype.unbindEvents = function() { + if (this.window) { + this.window.removeEventListener("mouseup", this.onMouseUp); + this.window.removeEventListener("mousemove", this.onMouseMove); + this.window.removeEventListener("mouseleave", this.onMouseUp); + this.window.removeEventListener("touchmove", this.onMouseMove, true); + this.window.removeEventListener("touchend", this.onMouseUp); } }; - const onLongPress = () => { - if (editable) { - select(props.treeNode.node.id, false); + Resizable2.prototype.componentDidMount = function() { + if (!this.resizable || !this.window) { return; } + var computedStyle = this.window.getComputedStyle(this.resizable); + this.setState({ + width: this.state.width || this.size.width, + height: this.state.height || this.size.height, + flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0 + }); }; - useLongPress(fileNameRef, onLongPress); - const selected = selection2.includes(props.treeNode.id); - const { linkedProps } = (0, import_react146.useContext)(FrameInstanceContext); - const editable = (0, import_react146.useMemo)(() => { - if (selectionMode == 0 /* Read */) - return false; - if (props.treeNode.isRef) { - if (props.treeNode.editorProps.linkedNode && frameSelected) - return true; - return false; + Resizable2.prototype.componentWillUnmount = function() { + if (this.window) { + this.unbindEvents(); } - if (linkedProps.some( - (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2 - )) - return true; - if (!stringIsConst(props.treeNode.node.props.value)) - return false; - if (selectionMode == 1 /* Page */) - return true; - if (selectionMode == 3 /* Group */ && selected) - return true; - return false; - }, [props.treeNode, selectionMode, frameSelected, selected, linkedProps]); - return props.state && /* @__PURE__ */ import_react146.default.createElement("div", { - className: `mk-frame-text`, - "data-placeholder": editable || selectable ? i18n_default.labels.textPlaceholder : "", - dangerouslySetInnerHTML: { - __html: props.state.props?.value - }, - onClick, - onMouseDown, - onBlur, - onDrop: (e5) => e5.preventDefault(), - onKeyDown, - onKeyPress, - onKeyUp, - ref: fileNameRef, - contentEditable: editable - }); -}; - -// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx -var FrameView = (props) => { - const nodeProps = { - superstate: props.superstate, - treeNode: props.treeNode, - state: props.instance.state[props.treeNode.id] }; - const innerComponents = props.treeNode.node.type == "input" ? /* @__PURE__ */ import_react147.default.createElement(InputNodeView, { - ...nodeProps - }) : props.treeNode.node.type == "text" ? /* @__PURE__ */ import_react147.default.createElement(TextNodeView, { - ...nodeProps - }) : props.treeNode.node.type == "icon" ? /* @__PURE__ */ import_react147.default.createElement(IconNodeView, { - ...nodeProps - }) : props.treeNode.node.type == "audio" ? /* @__PURE__ */ import_react147.default.createElement(AudioNodeView, { - ...nodeProps - }) : props.treeNode.node.type == "image" ? /* @__PURE__ */ import_react147.default.createElement(ImageNodeView, { - ...nodeProps - }) : props.treeNode.node.type == "space" ? /* @__PURE__ */ import_react147.default.createElement(ContextNodeView, { - ...nodeProps, - source: props.source - }) : props.treeNode.node.type == "content" ? /* @__PURE__ */ import_react147.default.createElement(ContentNodeView, null, props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react147.default.createElement(FrameView, { - superstate: props.superstate, - key: i4, - treeNode: c3, - instance: props.instance, - saveState: props.saveState, - source: props.source - }, props.children)), props.children) : props.treeNode.node.type == "flow" ? /* @__PURE__ */ import_react147.default.createElement(FlowNodeView, { - ...nodeProps, - source: props.source - }) : props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react147.default.createElement(FrameView, { - superstate: props.superstate, - key: i4, - treeNode: c3, - instance: props.instance, - saveState: props.saveState, - source: props.source - }, props.children)); - const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false; - return props.instance.state[props.treeNode.id] && !hidden && /* @__PURE__ */ import_react147.default.createElement("div", { - className: `mk-frame ${parseStylesToClass( - props.instance.state[props.treeNode.id]?.styles - )}`, - "data-path": props.treeNode.id, - "data-type": props.treeNode.node.type, - onContextMenu: (e5) => { - if (typeof props.instance.state[props.treeNode.id].actions?.onContextMenu == "function") { - props.instance.state[props.treeNode.id].actions?.onContextMenu( - e5, - null, - props.instance.state, - (s4) => props.saveState(s4, props.instance), - props.superstate.api - ); - e5.stopPropagation(); + Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) { + var propsSize = this.propsSize && this.propsSize[kind]; + return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize; + }; + Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) { + var boundsByDirection = this.props.boundsByDirection; + var direction = this.state.direction; + var widthByDirection = boundsByDirection && hasDirection("left", direction); + var heightByDirection = boundsByDirection && hasDirection("top", direction); + var boundWidth; + var boundHeight; + if (this.props.bounds === "parent") { + var parent_1 = this.parentNode; + if (parent_1) { + boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft); + boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop); } - }, - onClick: (e5) => { - if (e5.detail === 1) { - if (typeof props.instance.state[props.treeNode.id].actions?.onClick == "function") { - props.instance.state[props.treeNode.id].actions?.onClick( - e5, - null, - props.instance.state, - (s4) => props.saveState(s4, props.instance), - props.superstate.api - ); - e5.stopPropagation(); - } - } else if (e5.detail === 2) { - if (typeof props.instance.state[props.treeNode.id].actions?.onDoubleClick == "function") { - props.instance.state[props.treeNode.id].actions?.onDoubleClick( - e5, - null, - props.instance.state, - (s4) => props.saveState(s4, props.instance), - props.superstate.api - ); - e5.stopPropagation(); - } + } else if (this.props.bounds === "window") { + if (this.window) { + boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft; + boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop; } - }, - style: { - ...defaultFrameStyles, - ...props.instance.state[props.treeNode.id]?.styles - } - }, innerComponents); -}; - -// src/core/react/components/SpaceView/Frames/EditorNodes/NewNodeView.tsx -var import_react148 = __toESM(require_react()); -var NewNodeView = (props) => { - const ref2 = import_react148.default.createRef(); - const { spaceState } = (0, import_react148.useContext)(SpaceContext); - const { - updateNode, - nodes, - deleteNode, - addNode, - saveNodes, - lastCreatedId, - setLastCreatedId - } = (0, import_react148.useContext)(FramesEditorRootContext); - const { selection: selection2, select } = (0, import_react148.useContext)(FrameSelectionContext); - const [type, setType] = (0, import_react148.useState)("label"); - const { instance } = (0, import_react148.useContext)(FrameInstanceContext); - const spaces2 = [...props.superstate.allSpaces(true)].filter((f2) => f2.type != "default").map((f2) => ({ - name: f2.name, - value: f2.path, - icon: props.superstate.pathsIndex.get(f2.path)?.label?.sticker, - description: f2.type == "tag" ? f2.name : f2.type == "folder" ? f2.path : f2.name - })); - const paths = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden).filter((f2) => f2.type == "space" || f2.subtype == "md").map((f2) => ({ - name: f2.displayName, - value: f2.path, - description: f2.path, - section: "flow", - icon: f2.label?.sticker - })); - const fuseOptions = { - minMatchCharLength: 1, - threshold: 0, - keys: ["name", "value"] - }; - const [query, setQuery] = (0, import_react148.useState)(""); - const suggestions = (0, import_react148.useMemo)(() => { - const menuOptions = []; - const label = { - name: i18n_default.frames.label.label, - description: query, - icon: "ui//baseline", - section: "label", - value: "" - }; - menuOptions.push(label); - const note = { - name: i18n_default.frames.note.label, - description: query, - icon: "ui//file-text", - value: "", - section: "flow" - }; - menuOptions.push(note); - const kit = [ - { - name: i18n_default.frames.table.label, - description: i18n_default.frames.table.description, - icon: "ui//table", - section: "list", - value: "" - }, - ...[contextNode, dividerNode, iconNode, imageNode, groupNode].map( - (f2) => ({ - name: f2.node.name, - value: f2, - icon: f2.def?.icon, - section: "base", - description: f2.def?.description - }) - ), - ...[ - buttonNode, - ratingNode, - callout, - toggleNode, - progressNode, - circularProgressNode, - tabsNode - ].map((f2) => ({ - name: f2.node.name, - value: f2, - icon: f2.def?.icon, - section: "kit", - description: f2.def?.description - })) - ]; - const fuse = new Fuse(kit, fuseOptions); - const kitOptions = query.length == 0 ? kit : fuse.search(query).map((result) => result.item).slice(0, 10); - if (kitOptions.length > 0) { - menuOptions.push(menuSection("Kit")); - } - menuOptions.push(...kitOptions); - if (query.length > 0) { - const fuse2 = new Fuse([...paths], fuseOptions); - const options = query.length == 0 ? [] : fuse2.search(query).map((result) => result.item).slice(0, 10); - if (options.length > 0) - menuOptions.push(menuSection("Paths")); - menuOptions.push(...options); + } else if (this.props.bounds) { + boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft); + boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop); } - return menuOptions; - }, [query, type]); - const selectOption = (option) => { - if (!props.treeNode) { - clear(); + if (boundWidth && Number.isFinite(boundWidth)) { + maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; } - if (option.section == "kit" || option.section == "base") { - if (props.treeNode) { - let node = relinkProps( - "$root", - props.treeNode.node.schemaId, - option.value.node, - props.treeNode.node.schemaId - ); - node = relinkProps( - node.id, - props.treeNode.node.id, - node, - props.treeNode.node.schemaId - ); - saveNodes([ - { - ...node, - type: option.section == "base" ? node.type : "frame", - styles: option.value.node.styles, - ref: option.section == "base" ? "" : "spaces://$kit/#*" + option.value.def.id, - parentId: props.treeNode.node.parentId, - schemaId: props.treeNode.node.schemaId, - id: props.treeNode.node.id, - rank: props.treeNode.node.rank - } - ]).then((f2) => select(props.treeNode.id)); - } else { - addNode( - option.section == "base" ? option.value.node : { - ...option.value.node, - type: "frame", - styles: option.value.node.styles, - ref: "spaces://$kit/#*" + option.value.def.id - }, - instance.exec.node, - true - ).then((f2) => select(f2.id)); - } - } else if (option.section == "label") { - if (props.treeNode) { - saveNodes([ - { - ...props.treeNode.node, - type: "text", - name: textNode.node.name, - props: { - ...props.treeNode.node.props, - value: wrapQuotes(query) - }, - styles: textNode.node.styles - } - ]).then((f2) => select(props.treeNode.id)); - } else { - addNode( - { - ...textNode.node, - props: { - value: wrapQuotes(query) - } - }, - instance.exec.node, - true - ).then((f2) => select(f2.id)); - } - } else if (option.section == "flow") { - if (option.value.length > 0) { - if (props.treeNode) { - saveNodes([ - { - ...props.treeNode.node, - type: "flow", - name: flowNode.node.name, - props: { - ...props.treeNode.node.props, - value: wrapQuotes(option.value) - }, - styles: flowNode.node.styles - } - ]); - } else { - addNode( - { - ...flowNode.node, - props: { - value: wrapQuotes(option.value) - } - }, - instance.exec.node, - true - ); - } - } else { - newPathInSpace(props.superstate, spaceState, "md", query, true).then( - (f2) => { - if (props.treeNode) { - saveNodes([ - { - ...props.treeNode.node, - name: flowNode.node.name, - type: "flow", - props: { - value: wrapQuotes(f2) - }, - styles: { - ...flowNode.node.styles - } - } - ]); - } else { - addNode( - { - ...flowNode.node, - props: { - value: wrapQuotes(f2) - } - }, - instance.exec.node, - true - ); - } - } - ); - } - } else if (option.section == "list") { - createInlineTable(props.superstate, spaceState.path).then((f2) => { - if (props.treeNode) { - saveNodes([ - { - ...props.treeNode.node, - name: contextNode.node.name, - type: "space", - props: { value: wrapQuotes(`${spaceState.path}/#*${f2}`) }, - styles: { - ...contextNode.node.styles - } - } - ]); - } else { - addNode( - { - ...textNode.node, - name: contextNode.node.name, - type: "space", - props: { value: wrapQuotes(`${spaceState.path}/#^${f2}`) } - }, - instance.exec.node, - true - ); - } - }); + if (boundHeight && Number.isFinite(boundHeight)) { + maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; } + return { maxWidth, maxHeight }; }; - const clear = () => { - setQuery(""); - ref2.current.blur(); - ref2.current.innerHTML = ""; - }; - (0, import_react148.useEffect)(() => { - if (ref2.current && lastCreatedId && lastCreatedId == props.treeNode?.node.id) { - ref2.current.focus(); - setLastCreatedId(null); + Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) { + var scale = this.props.scale || 1; + var resizeRatio = this.props.resizeRatio || 1; + var _a = this.state, direction = _a.direction, original = _a.original; + var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth; + var newWidth = original.width; + var newHeight = original.height; + var extraHeight = lockAspectRatioExtraHeight || 0; + var extraWidth = lockAspectRatioExtraWidth || 0; + if (hasDirection("right", direction)) { + newWidth = original.width + (clientX - original.x) * resizeRatio / scale; + if (lockAspectRatio) { + newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; + } } - }, [ref2, selection2, props.treeNode]); - return /* @__PURE__ */ import_react148.default.createElement("div", { - className: "mk-node-new" - }, /* @__PURE__ */ import_react148.default.createElement(Suggester, { - superstate: props.superstate, - placeholder: i18n_default.hintText.newFrame, - suggestions, - onChange: (query2) => setQuery(query2), - onSelect: (option) => { - selectOption(option); - }, - onFocus: () => { - select(null); - }, - ref: ref2, - onDelete: () => props.treeNode ? deleteNode(props.treeNode?.node) : clear(), - onSelectSection: (option) => setType(option) - })); -}; - -// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx -var defaultFrameStyles = { - position: "relative" -}; -var FrameEditorInner = (0, import_react149.memo)(function FrameEditorInner2(props) { - const nodeProps = { - superstate: props.superstate, - treeNode: props.treeNode, - state: props.state - }; - const { treeNode } = props; - const { pathState } = (0, import_react149.useContext)(PathContext); - const { instance } = (0, import_react149.useContext)(FrameInstanceContext); - return /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, treeNode.node.type == "new" ? /* @__PURE__ */ import_react149.default.createElement(NewNodeView, { - ...nodeProps - }) : treeNode.node.type == "input" ? /* @__PURE__ */ import_react149.default.createElement(InputNodeView, { - ...nodeProps - }) : treeNode.node.type == "text" ? /* @__PURE__ */ import_react149.default.createElement(TextNodeView, { - ...nodeProps - }) : treeNode.node.type == "icon" ? /* @__PURE__ */ import_react149.default.createElement(IconNodeView, { - ...nodeProps - }) : treeNode.node.type == "audio" ? /* @__PURE__ */ import_react149.default.createElement(AudioNodeView, { - ...nodeProps - }) : treeNode.node.type == "image" ? /* @__PURE__ */ import_react149.default.createElement(ImageNodeView, { - ...nodeProps - }) : treeNode.node.type == "space" ? /* @__PURE__ */ import_react149.default.createElement(ContextNodeView, { - ...nodeProps, - containerRef: props.containerRef, - source: pathState.path - }) : treeNode.node.type == "flow" ? /* @__PURE__ */ import_react149.default.createElement(FlowNodeView, { - ...nodeProps, - source: pathState.path, - containerRef: props.containerRef - }) : treeNode.node.type == "content" ? /* @__PURE__ */ import_react149.default.createElement(ContentNodeView, { - editable: !props.treeNode.isRef - }, props.treeNode.children.map( - (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, { - superstate: props.superstate, - key: c3.id, - treeNode: c3, - instance: props.instance, - containerRef: props.containerRef - }, props.children) - ), props.children) : (treeNode.node.type == "column" || treeNode.node.type == "container") && treeNode.children.length == 0 ? null : props.treeNode.id == props.instance.exec.id || treeNode.node.type == "column" || treeNode.node.type == "container" ? props.treeNode.children.map( - (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, { - superstate: props.superstate, - key: c3.id, - treeNode: c3, - instance: props.instance, - containerRef: props.containerRef - }, props.children) - ) : /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameSelectionProvider, { - superstate: props.superstate, - id: treeNode.id, - editMode: props.editMode - }, treeNode.children.map( - (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react149.default.createElement(FrameEditorNodeView, { - superstate: props.superstate, - key: c3.id, - treeNode: c3, - instance: props.instance, - containerRef: props.containerRef - }, props.children) - )))); -}); -var FrameEditorNodeView = (props) => { - const { - selectionMode, - selectable, - selected: _selected, - isParentToSelection, - select, - selection: selection2 - } = (0, import_react149.useContext)(FrameSelectionContext); - const { - updateNode, - addNode, - deleteNode, - nodes, - selectedSlide - } = (0, import_react149.useContext)(FramesEditorRootContext); - const { setDragNode } = (0, import_react149.useContext)(WindowContext); - const { saveState, selectableNodeBounds, id: id3 } = (0, import_react149.useContext)(FrameInstanceContext); - const { dragActive } = (0, import_react149.useContext)(WindowContext); - const editMode = props.treeNode.isRef ? 0 /* Read */ : props.treeNode.id == props.instance.exec.id ? selectionMode : 3 /* Group */; - const selected = selection2.some((f2) => f2 == props.treeNode.id); - const isSelectable = selectable && !props.treeNode.isRef && !selected; - const state = props.instance.state[props.treeNode.id]; - const deltas = (0, import_react149.useMemo)( - () => selectedSlide ? nodes.find( - (f2) => f2.ref == props.treeNode.id && selectedSlide == f2.parentId - ) ?? null : null, - [nodes, props.treeNode, selectedSlide] - ); - const treeNode = (0, import_react149.useMemo)( - () => deltas ? { - ...props.treeNode, - node: { - ...props.treeNode.node, - styles: { - ...props.treeNode.node.styles, - ...deltas.styles - }, - props: { - ...props.treeNode.node.props, - ...deltas.props - }, - actions: { - ...props.treeNode.node.actions, - ...deltas.actions - } + if (hasDirection("left", direction)) { + newWidth = original.width - (clientX - original.x) * resizeRatio / scale; + if (lockAspectRatio) { + newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; } - } : props.treeNode, - [deltas, props.treeNode] - ); - const { frameSchema } = (0, import_react149.useContext)(FramesMDBContext); - const dragId = id3 + frameSchema.id + props.treeNode.id; - const [hover, setHover] = (0, import_react149.useState)(false); - const [isMouseOverElement, setIsMouseOverElement] = import_react149.default.useState(false); - const [isMouseOverPortal, setIsMouseOverPortal] = import_react149.default.useState(false); - const draggable = props.treeNode.editorProps.dragMode == 1 /* DragHandle */ || (isSelectable && !isParentToSelection || selected) && props.treeNode.editorProps.dragMode != 0; - const { - attributes, - listeners, - setNodeRef: setDraggableNodeRef, - transform - } = useDraggable({ - id: dragId, - data: { - id: dragId, - root: id3, - type: "node", - parent: props.treeNode.node.parentId, - frame: frameSchema.id, - node: props.treeNode.id - }, - disabled: !draggable - }); - const ref2 = (0, import_react149.useRef)(null); - const onLongPress = () => { - if (isSelectable && props.treeNode.id != props.instance.exec.id) { - select(treeNode.node.id); - return; } - }; - const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false; - const nodeProps = { - superstate: props.superstate, - treeNode, - state - }; - const saveStyles = (size2) => { - updateNode(treeNode.node, { - styles: { ...size2 } - }); - }; - const onClick = (e5) => { - if (isSelectable && (selectionMode != 1 /* Page */ || isParentToSelection && props.treeNode.id != props.instance.exec.id)) { - if (e5.shiftKey) { - select(treeNode.node.id, true); - } else { - select(treeNode.node.id); + if (hasDirection("bottom", direction)) { + newHeight = original.height + (clientY - original.y) * resizeRatio / scale; + if (lockAspectRatio) { + newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; } - e5.stopPropagation(); - return; - } else if (props.treeNode.id == props.instance.exec.id) { - select(null); } - if (!selected) { - if (e5.detail === 1) { - if (typeof state.actions?.onClick == "function") { - state.actions?.onClick( - e5, - null, - props.instance.state, - (s4) => saveState(s4, props.instance), - props.superstate.api - ); - e5.stopPropagation(); - } - } else if (e5.detail === 2 || isTouchScreen(props.superstate.ui)) { - if (typeof state.actions?.onDoubleClick == "function") { - state.actions?.onDoubleClick( - e5, - null, - props.instance.state, - (s4) => saveState(s4, props.instance), - props.superstate.api - ); - e5.stopPropagation(); - } + if (hasDirection("top", direction)) { + newHeight = original.height - (clientY - original.y) * resizeRatio / scale; + if (lockAspectRatio) { + newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; } + } + return { newWidth, newHeight }; + }; + Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max5, min5) { + var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth; + var computedMinWidth = typeof min5.width === "undefined" ? 10 : min5.width; + var computedMaxWidth = typeof max5.width === "undefined" || max5.width < 0 ? newWidth : max5.width; + var computedMinHeight = typeof min5.height === "undefined" ? 10 : min5.height; + var computedMaxHeight = typeof max5.height === "undefined" || max5.height < 0 ? newHeight : max5.height; + var extraHeight = lockAspectRatioExtraHeight || 0; + var extraWidth = lockAspectRatioExtraWidth || 0; + if (lockAspectRatio) { + var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth; + var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth; + var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight; + var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight; + var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth); + var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth); + var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight); + var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight); + newWidth = clamp2(newWidth, lockedMinWidth, lockedMaxWidth); + newHeight = clamp2(newHeight, lockedMinHeight, lockedMaxHeight); } else { - e5.stopPropagation(); + newWidth = clamp2(newWidth, computedMinWidth, computedMaxWidth); + newHeight = clamp2(newHeight, computedMinHeight, computedMaxHeight); } + return { newWidth, newHeight }; }; - (0, import_react149.useEffect)(() => { - selection2.some((f2) => f2 != props.treeNode.id) && setHover(false); - }, [selection2, props.treeNode]); - const [canEditLayout, setCanEditLayout] = (0, import_react149.useState)(false); - (0, import_react149.useEffect)(() => { - if (selected && isTouchScreen(props.superstate.ui) && (props.treeNode.node.type == "group" || props.treeNode.node.type == "image" || selectionMode >= 3 /* Group */)) { - setCanEditLayout(true); - } else { - if (selected && canEditLayout) { - } else { - setCanEditLayout(false); + Resizable2.prototype.setBoundingClientRect = function() { + if (this.props.bounds === "parent") { + var parent_2 = this.parentNode; + if (parent_2) { + var parentRect = parent_2.getBoundingClientRect(); + this.parentLeft = parentRect.left; + this.parentTop = parentRect.top; } } - }, [props.treeNode, selectionMode, selected]); - const dropMode = props.treeNode.editorProps.dropMode; - const computedStyle = ref2.current && getComputedStyle(ref2.current); - const clientWidth = ref2.current && ref2.current.clientWidth; - const clientHeight = ref2.current && ref2.current.clientHeight; - const [childNodeSizes, setChildNodeSizes] = (0, import_react149.useState)([]); - const calculateRectInContainer = (rect, containerRect2) => { - return { - left: rect.x - containerRect2.x, - top: rect.y - containerRect2.y, - width: rect.width, - height: rect.height - }; - }; - (0, import_react149.useEffect)(() => { - if (!ref2.current || !props.containerRef?.current) { - return () => null; + if (this.props.bounds && typeof this.props.bounds !== "string") { + var targetRect = this.props.bounds.getBoundingClientRect(); + this.targetLeft = targetRect.left; + this.targetTop = targetRect.top; + } + if (this.resizable) { + var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom; + this.resizableLeft = left; + this.resizableRight = right; + this.resizableTop = top_1; + this.resizableBottom = bottom; } - if (props.treeNode.node.parentId == props.instance.exec.id) - selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer( - ref2.current.getBoundingClientRect(), - props.containerRef.current.getBoundingClientRect() - ); - setChildNodeSizes(() => { - const sizes = Array.from(ref2.current?.children ?? []).map( - (node) => { - return { - x: node.offsetLeft, - y: node.offsetTop, - width: node.clientWidth, - height: node.clientHeight - }; - } - ); - return sizes; - }); - const resizeObserver = new ResizeObserver(() => { - if (props.treeNode.node.parentId == props.instance.exec.id && ref2.current) - selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer( - ref2.current.getBoundingClientRect(), - props.containerRef.current.getBoundingClientRect() - ); - setChildNodeSizes(() => { - const sizes = Array.from(ref2.current?.children ?? []).map( - (node) => { - return { - x: node.offsetLeft, - y: node.offsetTop, - width: node.clientWidth, - height: node.clientHeight - }; - } - ); - return sizes; - }); - }); - resizeObserver.observe(ref2.current); - return () => resizeObserver.disconnect(); - }, [state]); - const nodeRect = ref2.current?.getBoundingClientRect(); - const containerRect = props.containerRef?.current?.getBoundingClientRect(); - const styles2 = { - ...defaultFrameStyles, - ...props.treeNode.node.type != "flow" ? state?.styles : { - width: state?.styles?.width, - height: state?.styles?.height, - "--max-width": state?.styles?.["--max-width"] - }, - "--translate-x": `${transform?.x ?? 0}px`, - "--translate-y": `${transform?.y ?? 0}px` }; - useDndMonitor({ - onDragStart: (e5) => { - if (e5.active?.id == dragId) { - setDragNode( - /* @__PURE__ */ import_react149.default.createElement("div", { - style: { - width: ref2.current.clientWidth - } - }, /* @__PURE__ */ import_react149.default.createElement(FrameView, { - superstate: props.superstate, - treeNode: props.treeNode, - instance: props.instance, - saveState: null - })) - ); - } + Resizable2.prototype.onResizeStart = function(event, direction) { + if (!this.resizable || !this.window) { + return; } - }); - return /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, (!hidden || !props.treeNode.isRef) && /* @__PURE__ */ import_react149.default.createElement("div", { - ref: (el) => { - ref2.current = el; - selectionMode > 1 /* Page */ && draggable && setDraggableNodeRef(el); - }, - onContextMenu: () => isTouchScreen(props.superstate.ui) && onLongPress(), - className: (0, import_classnames10.default)( - `mk-frame-edit ${parseStylesToClass(state?.styles)}`, - isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable", - selected && selectionMode == 1 /* Page */ && "mk-selected" - ), - "data-path": treeNode.id, - "data-type": treeNode.node.type, - onMouseEnter: () => { - setHover(true); - setIsMouseOverElement(true); - }, - onMouseLeave: () => { - if (!isMouseOverPortal) { - setHover(false); - } - setIsMouseOverElement(false); - }, - ...{ onClick }, - ...selectionMode > 1 /* Page */ ? { ...listeners, ...attributes } : {}, - style: styles2 - }, /* @__PURE__ */ import_react149.default.createElement(FrameEditorInner, { - ...nodeProps, - containerRef: props.containerRef, - editMode, - instance: props.instance - }, props.children)), state && props.treeNode.node.type != "new" && props.containerRef?.current && selectionMode > 0 /* Read */ && ref2.current && (0, import_react_dom11.createPortal)( - /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement("div", { - style: { - position: "absolute", - top: nodeRect.top - containerRect.top, - left: nodeRect.left - containerRect.left, - width: clientWidth, - height: clientHeight, - pointerEvents: "none" - }, - className: (0, import_classnames10.default)( - !dragActive && isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable", - !dragActive && selected && (selectionMode != 1 /* Page */ || props.treeNode.node.type == "group") && "mk-f-edit", - !dragActive && hover && selectionMode != 1 /* Page */ && "mk-f-edit-hover" - ), - onClick: (e5) => { - if (isSelectable && selectionMode != 1 /* Page */) { - if (e5.shiftKey) { - select(treeNode.node.id, true); - } else { - select(treeNode.node.id); - } - e5.stopPropagation(); + var clientX = 0; + var clientY = 0; + if (event.nativeEvent && isMouseEvent(event.nativeEvent)) { + clientX = event.nativeEvent.clientX; + clientY = event.nativeEvent.clientY; + } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) { + clientX = event.nativeEvent.touches[0].clientX; + clientY = event.nativeEvent.touches[0].clientY; + } + if (this.props.onResizeStart) { + if (this.resizable) { + var startResize = this.props.onResizeStart(event, direction, this.resizable); + if (startResize === false) { return; } } - }, props.treeNode.editorProps.resizeMode == 2 /* ResizeColumn */ && /* @__PURE__ */ import_react149.default.createElement(FrameResizer, { - size: state?.styles, - superstate: props.superstate, - resizeMode: props.treeNode.editorProps.resizeMode, - resize: saveStyles, - clientSize: { - width: clientWidth, - height: clientHeight - } - }), dragActive && (selectionMode == 1 /* Page */ || selectionMode == 3 /* Group */) && dropMode > 0 /* DropModeNone */ && /* @__PURE__ */ import_react149.default.createElement(FrameEditorDropZone, { - parentId: treeNode.node.parentId, - superstate: props.superstate, - height: clientHeight, - width: clientWidth, - node: treeNode.node.id, - id: dragId, - mode: dropMode, - insertMode: treeNode.node.type == "group" ? 1 : treeNode.node.type == "space" ? -1 : 0 - }), canEditLayout && /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameResizer, { - superstate: props.superstate, - resizeMode: 1 /* ResizeSelected */, - size: state?.styles, - resize: saveStyles, - clientSize: { - width: clientWidth, - height: clientHeight + } + if (this.props.size) { + if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) { + this.setState({ height: this.props.size.height }); } - }), /* @__PURE__ */ import_react149.default.createElement(FrameCorners, { - styles: state?.styles, - saveStyles, - clientSize: { - width: clientWidth, - height: clientHeight + if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) { + this.setState({ width: this.props.size.width }); } - }), (treeNode.node.type == "group" || treeNode.node.type == "content") && (state.styles?.layout == "row" || state.styles?.layout == "column") && /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null, /* @__PURE__ */ import_react149.default.createElement(FrameGapHandle, { - childSizes: childNodeSizes, - clientSize: { - width: clientWidth, - height: clientHeight, - paddingBottom: parseInt( - computedStyle?.paddingBottom ?? "0" - ), - paddingLeft: parseInt( - computedStyle?.paddingLeft ?? "0" - ), - paddingRight: parseInt( - computedStyle?.paddingRight ?? "0" - ), - paddingTop: parseInt( - computedStyle?.paddingTop ?? "0" - ) - }, - styles: state?.styles, - saveStyles, - direction: state?.styles.layout == "column" ? "column" : "row" - }), /* @__PURE__ */ import_react149.default.createElement(FramePadding, { - clientSize: { - width: clientWidth, - height: clientHeight - }, - styles: state?.styles, - saveStyles - }))), treeNode.editorProps.dragMode == 1 /* DragHandle */ && (!isTouchScreen(props.superstate.ui) || selected) ? /* @__PURE__ */ import_react149.default.createElement("div", { - onMouseEnter: () => { - setIsMouseOverPortal(true); - setHover(true); - }, - onMouseLeave: () => { - if (!isMouseOverElement) { - setHover(false); - } - setIsMouseOverPortal(false); - }, - className: "mk-editor-frame-hover-menu-container", - style: { - zIndex: hover ? "calc(var(--layer-popover) + 1)" : "var(--layer-popover)" + } + this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height; + var flexBasis; + var computedStyle = this.window.getComputedStyle(this.resizable); + if (computedStyle.flexBasis !== "auto") { + var parent_3 = this.parentNode; + if (parent_3) { + var dir = this.window.getComputedStyle(parent_3).flexDirection; + this.flexDir = dir.startsWith("row") ? "row" : "column"; + flexBasis = computedStyle.flexBasis; } - }, /* @__PURE__ */ import_react149.default.createElement(FrameHoverMenu, { - superstate: props.superstate, - node: treeNode.node, - mode: selectionMode == 1 /* Page */ ? 0 : 1, - selected, - visible: isTouchScreen(props.superstate.ui) || hover, - dragRef: setDraggableNodeRef, - attributes, - listeners - })) : /* @__PURE__ */ import_react149.default.createElement(import_react149.default.Fragment, null)), selection2 && !dragActive && selected && selection2.length == 1 ? /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditorContainer, { - nodeRect, - containerRect - }, /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditor, { - editLayout: (state2) => setCanEditLayout(state2), - superstate: props.superstate, - node: treeNode.node, - duplicateFrame: () => { - addNode(treeNode.node, treeNode.node); + } + this.setBoundingClientRect(); + this.bindEvents(); + var state = { + original: { + x: clientX, + y: clientY, + width: this.size.width, + height: this.size.height }, - state, - deleteFrame: () => deleteNode(treeNode.node), - fields: propertiesForNode(treeNode.node) - })) : selection2.length > 1 && selection2[0] == treeNode.id ? /* @__PURE__ */ import_react149.default.createElement(FrameNodeEditorContainer, { - nodeRect, - containerRect - }, /* @__PURE__ */ import_react149.default.createElement(FrameMultiNodeEditor, { - superstate: props.superstate - })) : null), - props.containerRef.current - )); -}; - -// src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx -var FrameEditorInstance = (props) => { - const { spaceInfo } = (0, import_react150.useContext)(SpaceContext); - const { undoLastAction, redoAction, frameSchema } = (0, import_react150.useContext)(FramesMDBContext); - const { nodes, addNode, saveNodes, setLastCreatedId } = (0, import_react150.useContext)( - FramesEditorRootContext - ); - const { hoverNode, setHoverNode, instance, id: id3 } = (0, import_react150.useContext)(FrameInstanceContext); - const { selectionMode, selection: selection2, select } = (0, import_react150.useContext)( - FrameSelectionContext - ); - const resetState = () => { - setHoverNode(null); + isResizing: true, + backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }), + direction, + flexBasis + }; + this.setState(state); }; - useDndMonitor({ - onDragOver: ({ active, over }) => { - const overId = over?.data.current.node; - if (over?.data.current.root == id3) { - if (overId) - setHoverNode({ - id: over?.data.current.id, - node: over?.data.current.node, - direction: over?.data.current?.direction - }); - } else { - setHoverNode(null); - } - }, - onDragCancel: () => { - resetState(); - }, - onDragEnd: ({ active, over }) => { - if (!active || !hoverNode) { - resetState(); - return; + Resizable2.prototype.onMouseMove = function(event) { + var _this = this; + if (!this.state.isResizing || !this.resizable || !this.window) { + return; + } + if (this.window.TouchEvent && isTouchEvent2(event)) { + try { + event.preventDefault(); + event.stopPropagation(); + } catch (e5) { } - const overId = hoverNode?.node; - if (overId == active.data.current.id || hoverNode?.id != over.data.current.id) { - resetState(); - return; + } + var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight; + var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX; + var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY; + var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height; + var parentSize = this.getParentSize(); + var max5 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight); + maxWidth = max5.maxWidth; + maxHeight = max5.maxHeight; + minWidth = max5.minWidth; + minHeight = max5.minHeight; + var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth; + var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight); + if (this.props.snap && this.props.snap.x) { + newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap); + } + if (this.props.snap && this.props.snap.y) { + newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap); + } + var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight }); + newWidth = newSize.newWidth; + newHeight = newSize.newHeight; + if (this.props.grid) { + var newGridWidth = snap(newWidth, this.props.grid[0]); + var newGridHeight = snap(newHeight, this.props.grid[1]); + var gap = this.props.snapGap || 0; + newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth; + newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight; + } + var delta = { + width: newWidth - original.width, + height: newHeight - original.height + }; + if (width && typeof width === "string") { + if (width.endsWith("%")) { + var percent = newWidth / parentSize.width * 100; + newWidth = percent + "%"; + } else if (width.endsWith("vw")) { + var vw = newWidth / this.window.innerWidth * 100; + newWidth = vw + "vw"; + } else if (width.endsWith("vh")) { + var vh = newWidth / this.window.innerHeight * 100; + newWidth = vh + "vh"; } - const overParentNode = findParent(instance.exec, overId); - const overNode = overParentNode?.children.find( - (f2) => f2.id == overId - ); - if (active.data.current.type == "node") { - const activeParentNode = findParent( - instance.exec, - active.data.current.node - ); - const activeNode = activeParentNode?.children.find( - (f2) => f2.id == active.data.current.node - ); - if (overNode && activeNode) { - const [newNodes, deleteNodes] = dropFrame( - activeNode.node, - overNode, - instance.exec, - nodes, - hoverNode.direction - ); - saveNodes(newNodes, deleteNodes); - } - } else if (active.data.current.type == "property") { - if (active.data.current.path == spaceInfo.path && overNode) { - const [newNodes, deleteNodes] = dropFrame( - propertyToNode( - active.data.current.property, - active.data.current.context - ), - overNode, - instance.exec, - nodes, - hoverNode.direction - ); - saveNodes(newNodes, deleteNodes); - } - } else if (active.data.current.type == "listItem") { - if (overNode) { - const [newNodes, deleteNodes] = dropFrame( - { - ...flowNode.node, - props: { - value: `'${active.data.current.contexts?.$context?.["_keyValue"]}'` - } - }, - overNode, - instance.exec, - nodes, - hoverNode.direction - ); - saveNodes(newNodes, deleteNodes); - } - } else if (active.data.current.type == "context") { - if (overNode) { - const space2 = props.superstate.spacesIndex.get( - active.data.current.space - ); - if (space2) { - const [newNodes, deleteNodes] = dropFrame( - { - ...contextNode.node, - props: { - value: wrapQuotes( - contextPathForSpace(space2, active.data.current.schema) - ) - } - }, - overNode, - instance.exec, - nodes, - hoverNode.direction - ); - saveNodes(newNodes, deleteNodes); - } - } + } + if (height && typeof height === "string") { + if (height.endsWith("%")) { + var percent = newHeight / parentSize.height * 100; + newHeight = percent + "%"; + } else if (height.endsWith("vw")) { + var vw = newHeight / this.window.innerWidth * 100; + newHeight = vw + "vw"; + } else if (height.endsWith("vh")) { + var vh = newHeight / this.window.innerHeight * 100; + newHeight = vh + "vh"; } - resetState(); } - }); - const propertyToNode = (property, context) => { - let node = textNode.node; - if (property.type == "boolean") { - node = { - ...inputNode.node, - styles: { ...inputNode.node.styles, as: `'checkbox'` } - }; - } else if (property.type == "link" || property.type == "context" || property.type == "file") { - node = flowNode.node; - } else if (property.type == "image") { - node = imageNode.node; + var newState = { + width: this.createSizeForCssProperty(newWidth, "width"), + height: this.createSizeForCssProperty(newHeight, "height") + }; + if (this.flexDir === "row") { + newState.flexBasis = newState.width; + } else if (this.flexDir === "column") { + newState.flexBasis = newState.height; } - if (node.type == "input") { - node = { - ...node, - props: { ...node.props, value: wrapQuotes(property.name) } - }; - } else { - if (context.length > 0) { - node = { - ...node, - props: { - ...node.props, - value: `$contexts['${context}']['${property.name}']` - } - }; - } else { - node = { - ...node, - props: { - ...node.props, - value: `${frameSchema.id}.props['${property.name}']` - } - }; - } + (0, import_react_dom10.flushSync)(function() { + _this.setState(newState); + }); + if (this.props.onResize) { + this.props.onResize(event, direction, this.resizable, delta); } - return node; }; - const handleKeyDown = (0, import_react150.useCallback)( - (e5) => { - if (e5.key == "ArrowUp") { - if (selection2.length > 0) { - const node = nodes.find((f2) => f2.id == selection2[0]); - if (node) { - const parent = findParent(instance.exec, node.id); - if (parent) { - const index2 = parent.children.find((f2) => f2.id == node.id).node.rank; - if (index2 > 0) { - select( - parent.children.find((f2) => f2.node.rank == index2 - 1)?.id - ); - } - } - } - } - } - if (e5.key == "ArrowDown") { - if (selection2.length > 0) { - const node = nodes.find((f2) => f2.id == selection2[0]); - if (node) { - const parent = findParent(instance.exec, node.id); - if (parent) { - const index2 = parent.children.find((f2) => f2.id == node.id).node.rank; - if (index2 < parent.children.length - 1) { - select( - parent.children.find((f2) => f2.node.rank == index2 + 1)?.id - ); - } - } - } - } - } - if (e5.key == "Delete" || e5.key == "Backspace") { - if (selection2.length > 0) - saveNodes( - [], - selection2.map((f2) => nodes.find((g) => g.id == f2)).filter((f2) => f2) - ); + Resizable2.prototype.onMouseUp = function(event) { + var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original; + if (!isResizing || !this.resizable) { + return; + } + var delta = { + width: this.size.width - original.width, + height: this.size.height - original.height + }; + if (this.props.onResizeStop) { + this.props.onResizeStop(event, direction, this.resizable, delta); + } + if (this.props.size) { + this.setState(this.props.size); + } + this.unbindEvents(); + this.setState({ + isResizing: false, + backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: "auto" }) + }); + }; + Resizable2.prototype.updateSize = function(size2) { + this.setState({ width: size2.width, height: size2.height }); + }; + Resizable2.prototype.renderResizer = function() { + var _this = this; + var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent; + if (!enable) { + return null; + } + var resizers = Object.keys(enable).map(function(dir) { + if (enable[dir] !== false) { + return React152.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null); } - if (e5.key == "z" && e5.metaKey) { - if (e5.shiftKey) { - redoAction(); - } else { - undoLastAction(); - } + return null; + }); + return React152.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers); + }; + Resizable2.prototype.render = function() { + var _this = this; + var extendsProps = Object.keys(this.props).reduce(function(acc, key3) { + if (definedProps.indexOf(key3) !== -1) { + return acc; } - }, - [selection2, nodes, undoLastAction, redoAction, saveNodes] - ); - (0, import_react150.useEffect)(() => { - props.superstate.ui.inputManager.on("keydown", handleKeyDown); - return () => { - props.superstate.ui.inputManager.off("keydown", handleKeyDown); - }; - }, [handleKeyDown]); - return /* @__PURE__ */ import_react150.default.createElement(import_react150.default.Fragment, null, instance.exec && /* @__PURE__ */ import_react150.default.createElement("div", { - className: "mk-f-root", - style: { position: "relative" } - }, selectionMode >= 3 /* Group */ && /* @__PURE__ */ import_react150.default.createElement("div", { - className: "mk-f-root-label", - onClick: (e5) => { - select(instance.exec.id); - e5.stopPropagation(); + acc[key3] = _this.props[key3]; + return acc; + }, {}); + var style = __assign3(__assign3(__assign3({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 }); + if (this.state.flexBasis) { + style.flexBasis = this.state.flexBasis; } - }, instance.exec.node.name), /* @__PURE__ */ import_react150.default.createElement(FrameEditorNodeView, { - key: spaceInfo.path, - superstate: props.superstate, - treeNode: instance.exec, - instance, - containerRef: props.containerRef - }, props.children), instance.exec.children.length == 0 && /* @__PURE__ */ import_react150.default.createElement(NewNodeView, { - superstate: props.superstate, - treeNode: null, - state: null - }))); -}; - -// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx -var ContextListInstance = (props) => { - const [contexts, setContexts] = (0, import_react151.useState)(props.contexts); - (0, import_react151.useEffect)( - () => setContexts((p) => import_lodash18.default.isEqual(props.contexts, p) ? p : props.contexts), - [props.contexts] - ); - const { spaceInfo } = (0, import_react151.useContext)(SpaceContext); - const { dbSchema } = (0, import_react151.useContext)(ContextEditorContext); - const { setDragNode } = (0, import_react151.useContext)(WindowContext); - const ref2 = import_react151.default.useRef(null); - const { - attributes, - listeners, - active, - setNodeRef: setDraggableNodeRef, - transform, - isDragging, - transition, - isOver, - over - } = useSortable({ - id: props.id, - data: { - id: props.id, - type: props.type, - space: spaceInfo?.path, - schema: dbSchema?.id, - props: props.props, - contexts + var Wrapper = this.props.as || "div"; + return React152.createElement( + Wrapper, + __assign3({ ref: this.ref, style, className: this.props.className }, extendsProps), + this.state.isResizing && React152.createElement("div", { style: this.state.backgroundStyle }), + this.props.children, + this.renderResizer() + ); + }; + Resizable2.defaultProps = { + as: "div", + onResizeStart: function() { }, - disabled: props.type != "listItem" || props.editMode > 0 /* Read */, - animateLayoutChanges: defaultAnimateLayoutChanges - }); - useDndMonitor({ - onDragStart: (e5) => { - if (e5.active.data.current.id == props.id) { - setDragNode( - /* @__PURE__ */ import_react151.default.createElement("div", { - dangerouslySetInnerHTML: { __html: ref2.current.innerHTML } - }) - ); - } + onResize: function() { }, - onDragOver: (over2) => { + onResizeStop: function() { }, - onDragEnd: ({ active: active2, over: over2 }) => { - const dragReorder = over2 && over2.data.current.space == spaceInfo?.path && over2.data.current.schema == dbSchema?.id; - dropListItem(dragReorder, over2, props, active2, spaceInfo); - } - }); - return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react151.default.createElement(FrameSelectionProvider, { - superstate: props.superstate, - id: props.id, - editMode: props.editMode, - selected: props.editMode == 3 /* Group */ - }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, { - id: props.id, - superstate: props.superstate, - props: props.props, - propSetters: props.propSetters, - contexts, - editable: true - }, /* @__PURE__ */ import_react151.default.createElement(FrameEditorInstance, { - superstate: props.superstate, - containerRef: props.containerRef - }, props.children))) : /* @__PURE__ */ import_react151.default.createElement(import_react151.default.Fragment, null, over?.id == props.id && active.data.current.type == props.type && !(active.data.current.space == spaceInfo?.path && active.data.current.schema == dbSchema?.id && active.data.current.props?._groupValue == props.props?._groupValue) && /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, { - id: props.id, - superstate: props.superstate, - props: props.props, - propSetters: props.propSetters, - contexts, - editable: false - }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceView, { - superstate: props.superstate - })), /* @__PURE__ */ import_react151.default.createElement("div", { - ref: (el) => { - setDraggableNodeRef(el); - ref2.current = el; + enable: { + top: true, + right: true, + bottom: true, + left: true, + topRight: true, + bottomRight: true, + bottomLeft: true, + topLeft: true }, - ...attributes, - ...listeners, - style: { - transform: CSS.Transform.toString(transform), - transition - } - }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceProvider, { - id: props.id, - superstate: props.superstate, - props: props.props, - propSetters: props.propSetters, - contexts, - editable: false - }, /* @__PURE__ */ import_react151.default.createElement(FrameInstanceView, { - superstate: props.superstate - }, props.children)))); -}; -var dropListItem = async (dragReorder, over, props, active, spaceInfo) => { - if (dragReorder && over.id == props.id) { - if (active.data.current.schema == defaultContextSchemaID) { - const activePath = active.data.current.contexts?.$context?.["_keyValue"]; - const context = over.data.current.contexts?.$context; - const groupValueMismatch = props.props?._groupValue != active.data.current.props?._groupValue; - if (activePath && context) { - if (groupValueMismatch) { - { - saveProperties(props.superstate, activePath, { - [props.props?._groupField]: props.props?._groupValue - }); - } - } else { - updatePathRankInSpace( - props.superstate, - activePath, - context._index, - spaceInfo.path - ); - } - } - } else { - const context = over.data.current.contexts?.$context; - updateTableValue( - props.superstate.spaceManager, - spaceInfo, - active.data.current.schema, - active.data.current.contexts?.$context?.["_index"], - props.props?._groupField, - props.props?._groupValue, - context?._index - ); - } - } -}; - -// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx -var import_react153 = __toESM(require_react()); - -// src/core/react/components/SpaceView/Contexts/ContextBuilder/FrameContainerView.tsx -var import_react152 = __toESM(require_react()); -var FrameContainerView = (props) => { - const { selected: _selected } = (0, import_react152.useContext)(FrameSelectionContext); - return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react152.default.createElement(FramesMDBProvider, { - superstate: props.superstate, - schema: props.uri.ref - }, /* @__PURE__ */ import_react152.default.createElement(FrameEditorProvider, { - superstate: props.superstate, - cols: props.cols, - editMode: props.editMode - }, props.children)) : /* @__PURE__ */ import_react152.default.createElement(FrameRootProvider, { - superstate: props.superstate, - path: props.uri, - cols: props.cols - }, props.children); -}; + style: {}, + grid: [1, 1], + lockAspectRatio: false, + lockAspectRatioExtraWidth: 0, + lockAspectRatioExtraHeight: 0, + scale: 1, + resizeRatio: 1, + snapGap: 0 + }; + return Resizable2; +}(React152.PureComponent); -// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx -var ContextListView = (props) => { - const { editSection, selectedIndex, setSelectedIndex, groupURI, itemURI } = props; - const { spaceInfo } = (0, import_react153.useContext)(SpaceContext); - const { - predicate, - filteredData: data2, - editMode, - sortedColumns, - contextTable, - cols, - dbSchema - } = (0, import_react153.useContext)(ContextEditorContext); - const { instance } = (0, import_react153.useContext)(FrameInstanceContext); - const groupBy2 = predicate?.groupBy?.length > 0 ? cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) : null; - const groupByOptions = (0, import_react153.useMemo)(() => { - const groupByOptions2 = instance?.state[instance?.root?.id].props?.groupOptions; - if (groupByOptions2) - return ensureArray(groupByOptions2); - if (!groupBy2) - return [""]; - const options = uniq([ - "", - ...(parseFieldValue(groupBy2.value, groupBy2.type, props.superstate)?.options ?? []).map((f2) => f2.value), - ...data2.reduce( - (p, c3) => [...p, c3[groupBy2.name + groupBy2.table] ?? ""], - [] - ) - ]); - return options; - }, [groupBy2, data2, instance]); - const groupByFilter = (0, import_react153.useMemo)(() => { - const filter4 = instance?.state[instance?.root?.id].props?.groupFilter; - return filterFnTypes[filter4] ?? filterFnTypes.is; - }, [instance]); - const items = (0, import_react153.useMemo)(() => { - return groupByOptions.reduce((p, c3) => { - if (!groupBy2) { - return c3 == "" ? { - ...p, - [c3]: data2 ?? [] - } : { - ...p, - [c3]: [] - }; - } - const newItems = data2.filter((r2) => { - return groupByFilter.fn(r2[groupBy2.name + groupBy2.table], c3); - }); - return newItems.length > 0 ? { - ...p, - [c3]: newItems - } : { - ...p, - [c3]: [] - }; - }, {}); - }, [data2, groupByOptions, groupByFilter, groupBy2]); - const primaryKey = (0, import_react153.useMemo)(() => { - return cols.find((f2) => f2.primary == "true")?.name; - }, [cols]); - const visibleCols = (0, import_react153.useMemo)(() => { - return sortedColumns.filter((f2) => !predicate?.colsHidden.includes(f2.name)); - }, [predicate, sortedColumns]); - const context = { - _path: spaceInfo?.path, - _schema: dbSchema?.id, - _key: primaryKey, - _properties: visibleCols +// src/core/react/components/SpaceView/Frames/FrameNodeEditor/Overlays/FrameResizer.tsx +var import_react155 = __toESM(require_react()); +var FrameResizer = (props) => { + const labelForValue = (value) => { + if (!value) + return null; + if (value == "auto") + return "Fit"; + if (value == "100%") + return "Fill"; + return value; }; - const contextMap = (0, import_react153.useMemo)(() => { - return dbSchema?.primary == "true" ? data2.reduce((p, c3) => { - return { - ...p, - [c3["_index"]]: { - $context: { - _index: c3["_index"], - _keyValue: c3[primaryKey], - _schema: dbSchema.id, - _name: props.superstate.pathsIndex.get(c3[primaryKey])?.name, - ...context - }, - $properties: cols, - [spaceInfo.path]: cols.reduce((a4, b2) => { - return { - ...a4, - [b2.name]: c3[b2.name] - }; - }, {}), - ...Object.keys(contextTable).reduce((d4, e5) => { - return { - ...d4, - [e5]: contextTable[e5].cols.reduce((a4, b2) => { - return { - ...a4, - [b2.name]: c3[b2.name + e5] - }; - }, {}) - }; - }, {}) - } - }; - }, {}) : data2.reduce((p, c3) => { - return { - ...p, - [c3["_index"]]: { - $context: { - _index: c3["_index"], - _keyValue: c3[primaryKey], - _schema: dbSchema.id, - _name: c3[primaryKey], - ...context - }, - $properties: cols, - [spaceInfo.path]: cols.reduce((a4, b2) => { - return { - ...a4, - [b2.name]: c3[b2.name] - }; - }, {}) - } - }; - }, {}); - }, [data2, cols, contextTable]); - return /* @__PURE__ */ import_react153.default.createElement(FrameContainerView, { - superstate: props.superstate, - uri: groupURI, - editMode: editSection == "listGroup" ? editMode : 0 /* Read */, - cols: [] - }, /* @__PURE__ */ import_react153.default.createElement(SortableContext, { - items: Object.keys(items).map( - (f2, i4) => spaceInfo.path + "listGroup" + i4 + const [modifiers, setModifiers] = import_react155.default.useState(null); + const [size2, setSize2] = import_react155.default.useState({ + width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth, + height: props.size.height + }); + import_react155.default.useEffect(() => { + setSize2({ + width: props.resizeMode != 2 /* ResizeColumn */ ? props.size.width : props.size.minWidth, + height: props.size.height + }); + }, [props.size, props.resizeMode]); + (0, import_react155.useEffect)(() => { + const captureShift = (e5) => { + setModifiers({ shiftKey: e5.shiftKey }); + }; + props.superstate.ui.inputManager.on("keydown", captureShift); + props.superstate.ui.inputManager.on("keyup", captureShift); + return () => { + props.superstate.ui.inputManager.off("keydown", captureShift); + props.superstate.ui.inputManager.off("keyup", captureShift); + }; + }, [setModifiers]); + return /* @__PURE__ */ import_react155.default.createElement("div", { + style: { + position: "absolute", + top: 0, + left: 0, + width: props.clientSize.width, + height: props.clientSize.height + } + }, /* @__PURE__ */ import_react155.default.createElement(Resizable, { + lockAspectRatio: modifiers?.shiftKey, + className: (0, import_classnames10.default)( + props.resizeMode == 2 /* ResizeColumn */ ? "mk-frame-column" : "mk-frame-bounds" ), - strategy: rectSortingStrategy - }, Object.keys(items).map((c3, i4) => /* @__PURE__ */ import_react153.default.createElement(ContextListInstance, { - key: "listGroup" + i4, - id: spaceInfo.path + "listGroup" + i4, - type: "listGroup", - superstate: props.superstate, - uri: groupURI, - props: { - _selectedIndex: selectedIndex, - _groupValue: c3, - _groupField: groupBy2?.name, - _groupType: groupBy2?.type, - ...predicate.listGroupProps + enable: props.resizeMode == 2 /* ResizeColumn */ ? { right: true } : { + right: true, + bottom: true, + bottomRight: true }, - propSetters: null, - editMode: editSection == "listGroup" ? editMode : 0 /* Read */, - cols: [], - containerRef: props.containerRef, - contexts: { $context: context } - }, /* @__PURE__ */ import_react153.default.createElement(FrameContainerView, { - uri: itemURI, - superstate: props.superstate, - cols: [], - editMode: editSection == "listItem" ? editMode : 0 /* Read */ - }, /* @__PURE__ */ import_react153.default.createElement(SortableContext, { - items: items[c3].flatMap( - (f2, k2) => spaceInfo.path + "listGroup" + i4 + "_listItem" + k2 - ), - strategy: rectSortingStrategy - }, items[c3].map((f2, j) => { - return /* @__PURE__ */ import_react153.default.createElement(ContextListInstance, { - key: "listGroup" + i4 + "_listItem" + j, - id: spaceInfo.path + "listGroup" + i4 + "_listItem" + j, - type: "listItem", - uri: itemURI, - superstate: props.superstate, - cols: [], - props: { - _selectedIndex: selectedIndex, - _groupValue: c3, - _groupField: groupBy2?.name, - ...predicate.listItemProps - }, - propSetters: { - _selectedIndex: setSelectedIndex - }, - containerRef: props.containerRef, - editMode: editSection == "listItem" ? editMode : 0 /* Read */, - contexts: contextMap[f2["_index"]] - }); - }))))))); -}; - -// src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx -var ContextListContainer = (props) => { - const { predicate, editMode, setEditMode, dbSchema } = (0, import_react154.useContext)(ContextEditorContext); - const { frameSchema } = (0, import_react154.useContext)(FramesMDBContext); - const [editSection, setEditSection] = (0, import_react154.useState)(null); - const [selectedIndex, setSelectedIndex] = (0, import_react154.useState)(null); - const [uris, setURIs] = (0, import_react154.useState)( - predicate ? { - listView: props.superstate.spaceManager.uriByString( - initiateString(predicate.listView, "spaces://$kit/#*listView") - ), - listGroup: props.superstate.spaceManager.uriByString( - initiateString(predicate.listGroup, "spaces://$kit/#*listGroup") - ), - listItem: props.superstate.spaceManager.uriByString( - initiateString(predicate.listItem, "spaces://$kit/#*rowItem") - ) - } : null - ); - (0, import_react154.useEffect)(() => { - if (!predicate) - return; - const newURIs = { - listView: props.superstate.spaceManager.uriByString( - initiateString(predicate.listView, "spaces://$kit/#*listView") - ), - listGroup: props.superstate.spaceManager.uriByString( - initiateString(predicate.listGroup, "spaces://$kit/#*listGroup") - ), - listItem: props.superstate.spaceManager.uriByString( - initiateString(predicate.listItem, "spaces://$kit/#*rowItem") + onResize: (e5, direction, ref2, d4) => { + setSize2({ + width: ref2.clientWidth, + height: ref2.clientHeight + }); + }, + onResizeStop: (e5, direction, ref2, d4) => { + const captureClick = (e6) => { + e6.stopPropagation(); + window.removeEventListener("click", captureClick, true); + }; + window.addEventListener("click", captureClick, true); + props.resizeMode == 2 /* ResizeColumn */ ? props.resize({ + minWidth: `'${ref2.clientWidth}px'` + }) : direction == "bottom" ? props.resize({ + height: `'${ref2.clientHeight}px'` + }) : direction == "right" ? props.resize({ + width: `'${ref2.clientWidth}px'` + }) : props.resize({ + width: `'${ref2.clientWidth}px'`, + height: `'${ref2.clientHeight}px'` + }); + e5.stopPropagation(); + }, + onResizeStart: (e5) => { + e5.stopPropagation(); + }, + handleClasses: props.resizeMode == 2 /* ResizeColumn */ ? { + right: "mk-frame-column-resize-handle" + } : props.resizeMode == 1 /* ResizeSelected */ ? { bottomRight: "mk-frame-resize-handle" } : {}, + handleWrapperStyle: { + pointerEvents: "auto" + }, + size: { + width: size2.width && size2.width != "auto" ? size2.width : "100%", + height: size2.height && size2.height != "auto" ? size2.height : "100%" + }, + ...props.listeners + }), props.clientSize?.width > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react155.default.createElement("div", { + className: "mk-frame-resize-label-width" + }, /* @__PURE__ */ import_react155.default.createElement("div", null, /* @__PURE__ */ import_react155.default.createElement("span", null, labelForValue(size2.width) ?? i18n_default.editor.fit), size2.width && size2.width != "auto" ? /* @__PURE__ */ import_react155.default.createElement("div", { + onClick: (e5) => { + props.resize({ + width: wrapQuotes("auto") + }); + e5.stopPropagation(); + }, + "aria-label": i18n_default.editor.scaleToFit, + style: { display: "flex" }, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker( + "ui//fold-horizontal" ) - }; - setURIs((p) => !import_lodash19.default.isEqual(newURIs, p) ? newURIs : p); - }, [predicate]); - return /* @__PURE__ */ import_react154.default.createElement("div", { - className: "mk-context-container" - }, !props.minMode && /* @__PURE__ */ import_react154.default.createElement(FilterBar, { - superstate: props.superstate, - setView: props.setView - }), uris ? predicate.view == "table" || predicate.view == "db" || dbSchema?.primary != "true" && !frameSchema ? /* @__PURE__ */ import_react154.default.createElement(TableView, { - superstate: props.superstate - }) : /* @__PURE__ */ import_react154.default.createElement("div", { - className: "mk-editor-context" - }, /* @__PURE__ */ import_react154.default.createElement(FrameSelectionProvider, { - superstate: props.superstate, - id: "list", - editMode: editSection == "listView" ? editMode : 0 /* Read */ - }, editMode > 0 && /* @__PURE__ */ import_react154.default.createElement(ContextListEditSelector, { - editSection, - superstate: props.superstate, - setEditSection, - setEditMode - }), /* @__PURE__ */ import_react154.default.createElement(FrameContainerView, { - superstate: props.superstate, - uri: uris.listView, - cols: [], - editMode: editSection == "listView" ? editMode : 0 /* Read */ - }, /* @__PURE__ */ import_react154.default.createElement(ContextListInstance, { - superstate: props.superstate, - id: "listView", - type: "listView", - uri: uris.listView, - props: { - _selectedIndex: selectedIndex, - ...predicate.listViewProps + } + }) : /* @__PURE__ */ import_react155.default.createElement("div", { + onClick: (e5) => { + props.resize({ + width: wrapQuotes("100%") + }); + e5.stopPropagation(); }, - propSetters: { _selectedIndex: setSelectedIndex }, - containerRef: props.containerRef, - editMode: editSection == "listView" ? editMode : 0 /* Read */, - cols: [], - contexts: null - }, /* @__PURE__ */ import_react154.default.createElement(ContextListView, { - superstate: props.superstate, - containerRef: props.containerRef, - editSection, - selectedIndex, - setSelectedIndex, - groupURI: uris.listGroup, - itemURI: uris.listItem - }))))) : /* @__PURE__ */ import_react154.default.createElement(import_react154.default.Fragment, null)); -}; - -// src/core/react/components/MDBView/MDBViewer.tsx -var MDBViewer = (props) => { - return /* @__PURE__ */ import_react155.default.createElement(PathProvider, { - superstate: props.superstate, - path: props.space.path, - readMode: false - }, /* @__PURE__ */ import_react155.default.createElement(SpaceProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react155.default.createElement(FramesMDBProvider, { - superstate: props.superstate, - schema: props.schema - }, /* @__PURE__ */ import_react155.default.createElement(ContextEditorProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react155.default.createElement(ContextListContainer, { - superstate: props.superstate - }))))); -}; - -// src/core/react/components/MarkdownEditor/Backlinks.tsx -var import_react156 = __toESM(require_react()); -var BacklinkItem = (props) => { - const [block, setBlock] = (0, import_react156.useState)([null, null]); - const refreshBlock = (path2) => { - const fCache = props.superstate.pathsIndex.get(path2); - const link = [ - ...fCache.metadata.links ?? [], - ...fCache.metadata.embeds ?? [] - ].find((f2) => props.source.includes(f2.displayText)); - if (link) { - const block2 = fCache.metadata.sections.find( - (f2) => f2.position.start.offset <= link.position.start.offset && f2.position.end.offset >= link.position.end.offset - ); - setBlock([ - Math.max(1, block2.position.start.line), - Math.max(block2.position.start.line + 1, block2.position.end.line + 1) - ]); - } else { - setBlock([null, null]); + "aria-label": i18n_default.editor.scaleToFill, + style: { display: "flex" }, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker( + "ui//unfold-horizontal" + ) } - }; - (0, import_react156.useEffect)(() => { - refreshBlock(props.path); - }, []); - (0, import_react156.useEffect)(() => { - refreshBlock(props.path); - }, [props.path]); - const [collapsed, setCollapsed] = (0, import_react156.useState)(false); - return /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null, /* @__PURE__ */ import_react156.default.createElement("div", { - className: "mk-path-context-title" - }, /* @__PURE__ */ import_react156.default.createElement(CollapseToggle, { - superstate: props.superstate, - collapsed, - onToggle: (c3) => setCollapsed(c3) - }), /* @__PURE__ */ import_react156.default.createElement("div", { + }))), props.clientSize?.height > 50 && props.resizeMode == 1 /* ResizeSelected */ && /* @__PURE__ */ import_react155.default.createElement("div", { + className: "mk-frame-resize-label-height" + }, /* @__PURE__ */ import_react155.default.createElement("div", null, /* @__PURE__ */ import_react155.default.createElement("span", null, labelForValue(size2.height) ?? i18n_default.editor.fit), size2.height && size2.height != "auto" ? /* @__PURE__ */ import_react155.default.createElement("div", { onClick: (e5) => { - props.superstate.ui.openPath(props.path, false); + props.resize({ + height: wrapQuotes("auto") + }); e5.stopPropagation(); + }, + "aria-label": i18n_default.editor.scaleToFit, + style: { display: "flex" }, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//fold-vertical") } - }, pathNameToString(props.path))), !collapsed ? /* @__PURE__ */ import_react156.default.createElement("div", { - className: "mk-path-context-backlink" - }, /* @__PURE__ */ import_react156.default.createElement(NoteView, { - load: true, - superstate: props.superstate, - path: props.path, - properties: { from: block[0], to: block[1] }, - classname: "mk-path-context-flow" - })) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null)); -}; -var Backlinks = (props) => { - const [collapsed, setCollapsed] = (0, import_react156.useState)( - !props.superstate.settings.inlineBacklinksExpanded - ); - const [backlinks, setBacklinks] = (0, import_react156.useState)([]); - (0, import_react156.useEffect)(() => { - if (!props.path) - return; - Promise.all( - uniq([...props.superstate.linksMap.getInverse(props.path)]).map( - (f2) => props.superstate.spaceManager.pathExists(f2) ? f2 : null - ) - ).then((bls) => setBacklinks(bls.filter((f2) => f2))); - }, [props.path]); - (0, import_react156.useEffect)(() => { - props.superstate.settings.inlineBacklinksExpanded = !collapsed; - props.superstate.saveSettings(); - }, [collapsed]); - const toggleBacklinks = () => { - setCollapsed(!collapsed); - }; - (0, import_react156.useEffect)(() => { - window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks); - return () => { - window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks); - }; - }, [collapsed]); - return backlinks.length > 0 && props.path ? /* @__PURE__ */ import_react156.default.createElement("div", { - className: "mk-path-context-component mk-note-footer" - }, /* @__PURE__ */ import_react156.default.createElement("div", { - className: "mk-path-context-section" - }, /* @__PURE__ */ import_react156.default.createElement("div", { + }) : /* @__PURE__ */ import_react155.default.createElement("div", { onClick: (e5) => { - setCollapsed(!collapsed); + props.resize({ + height: wrapQuotes("100%") + }); e5.stopPropagation(); }, - className: "mk-path-context-title" - }, /* @__PURE__ */ import_react156.default.createElement("div", { - className: `mk-icon-xsmall`, + "aria-label": i18n_default.editor.scaleToFill, + style: { display: "flex" }, dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//backlink") + __html: props.superstate.ui.getSticker( + "ui//unfold-vertical" + ) } - }), i18n_default.labels.backlinks, /* @__PURE__ */ import_react156.default.createElement(CollapseToggleSmall, { - superstate: props.superstate, - collapsed, - onToggle: () => null - })), /* @__PURE__ */ import_react156.default.createElement("div", null, !collapsed && backlinks.map((f2, i4) => /* @__PURE__ */ import_react156.default.createElement(BacklinkItem, { - path: f2, - key: i4, - superstate: props.superstate, - source: props.path - }))))) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null); + })))); }; -// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx +// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx +var import_react167 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Frames/EditorNodes/AudioNodeView.tsx +var import_react156 = __toESM(require_react()); +var AudioNodeView = (props) => { + const value = props.state.props.value; + const sourcePath = (0, import_react156.useMemo)(() => { + return props.superstate.ui.getUIPath(value); + }, [value]); + return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react156.default.createElement("audio", { + controls: true, + preload: "none", + src: sourcePath + }) : /* @__PURE__ */ import_react156.default.createElement(import_react156.default.Fragment, null); +}; + +// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx var import_react158 = __toESM(require_react()); -// src/core/react/components/SpaceView/Contexts/SpaceEditor/SpaceProperties.tsx +// src/core/react/components/SpaceView/Frames/ViewNodes/FrameInstance.tsx var import_react157 = __toESM(require_react()); -var SpaceHeaderView = (props) => { - const { pathState } = (0, import_react157.useContext)(PathContext); - const { spaceState } = (0, import_react157.useContext)(SpaceContext); - const [tab, setTab] = (0, import_react157.useState)(0); - const tabs = [ - { label: "Items", icon: "ui//file-stack", tab: 0 }, - { label: "Lists", icon: "ui//layout-list", tab: 2 }, - { label: "Actions", icon: "ui//mouse-pointer-click", tab: 3 } - ]; - return /* @__PURE__ */ import_react157.default.createElement(import_react157.default.Fragment, null, /* @__PURE__ */ import_react157.default.createElement("div", { - className: "mk-header-space" - }, /* @__PURE__ */ import_react157.default.createElement("div", { - className: "mk-tabs-space" - }, tabs.map((f2, i4) => /* @__PURE__ */ import_react157.default.createElement("div", { - key: i4, - onClick: () => { - openSpaceEditorModal(props.superstate, spaceState, f2.tab); - }, - className: `mk-path-info` - }, /* @__PURE__ */ import_react157.default.createElement("div", { - "aria-label": f2.label, - className: "mk-icon-small", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(f2.icon) - } - }), f2.label))), /* @__PURE__ */ import_react157.default.createElement("div", { - className: "mk-props-contexts" - }, /* @__PURE__ */ import_react157.default.createElement(PathContextList, { - superstate: props.superstate, - color: "var(--tag-background)", - path: pathState.path - }), /* @__PURE__ */ import_react157.default.createElement(PropertiesView, { +var FrameInstanceView = (props) => { + const { saveState, instance } = (0, import_react157.useContext)(FrameInstanceContext); + return instance.exec && /* @__PURE__ */ import_react157.default.createElement(FrameView, { superstate: props.superstate, - spaces: props.spaces.map((f2) => f2.path), - force: true, - excludeKeys: [ - ...FMMetadataKeys(props.superstate.settings), - ...FMSpaceKeys(props.superstate.settings) - ], - editable: true - })))); + treeNode: instance.exec, + instance, + saveState, + source: props.source + }, props.children); }; -// src/core/react/components/SpaceView/Contexts/SpaceEditor/NoteSpacesBar.tsx -var NoteSpacesBar = (props) => { - const { addToSpace, removeFromSpace, pathState } = (0, import_react158.useContext)(PathContext); - const showContextMenu = (e5, path2) => { - const space2 = props.superstate.spacesIndex.get(path2); - if (!space2) - return; - e5.preventDefault(); - const menuOptions = []; - menuOptions.push({ - name: i18n_default.menu.openSpace, - icon: "ui//layout-grid", - onClick: (e6) => { - props.superstate.ui.openPath(space2.path, e6.metaKey); +// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentView.tsx +var SpaceFragmentViewComponent = (props) => { + const path3 = (0, import_react158.useMemo)( + () => props.superstate.spaceManager.uriByString(props.path, props.source), + [props.path, props.source] + ); + const [spaceFragment, setSpaceFragment] = (0, import_react158.useState)(null); + (0, import_react158.useEffect)(() => { + if (path3.refType == "context") { + setSpaceFragment({ + type: "context", + path: path3.basePath, + contextSchema: path3.ref, + frameSchema: path3.query?.frameSchema + }); + } else if (path3.refType == "frame") { + let schema = props.superstate.framesIndex.get(path3.basePath)?.schemas.find((f2) => f2.id == path3.ref); + if (!schema && path3.ref == defaultFrameListViewSchema.id) { + schema = defaultFrameListViewSchema; + setSpaceFragment({ + type: "context", + path: path3.basePath, + frameSchema: schema.id + }); } - }); - menuOptions.push({ - name: i18n_default.labels.newProperty, - icon: "ui//plus", - onClick: (e6) => { - newProperty(e6, space2.path); + if (schema?.type == "view") { + setSpaceFragment({ + type: "context", + path: path3.basePath, + frameSchema: path3.ref + }); + } else { + setSpaceFragment({ + type: "frame", + path: path3.basePath, + frameSchema: path3.ref + }); } - }); - if (removeFromSpace) - menuOptions.push({ - name: i18n_default.menu.removeFromSpace, - icon: "ui//trash", - onClick: (e6) => { - removeFromSpace(space2.path); - } + } else if (path3.refType == "action") { + setSpaceFragment({ + type: "action", + path: path3.basePath, + actionSchema: path3.ref }); - const offset2 = e5.target.getBoundingClientRect(); - props.superstate.ui.openMenu( - offset2, - defaultMenu(props.superstate.ui, menuOptions) + } else { + setSpaceFragment({ + type: "context", + path: path3.basePath, + frameSchema: defaultFrameListViewID + }); + } + }, [path3]); + return /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, spaceFragment?.path && (spaceFragment?.type == "context" ? /* @__PURE__ */ import_react158.default.createElement(PathProvider, { + superstate: props.superstate, + path: spaceFragment.path, + readMode: false + }, /* @__PURE__ */ import_react158.default.createElement(SpaceProvider, { + superstate: props.superstate + }, /* @__PURE__ */ import_react158.default.createElement(FramesMDBProvider, { + superstate: props.superstate, + contextSchema: spaceFragment.contextSchema, + schema: spaceFragment.frameSchema + }, /* @__PURE__ */ import_react158.default.createElement(ContextEditorProvider, { + superstate: props.superstate + }, /* @__PURE__ */ import_react158.default.createElement(ContextListContainer, { + superstate: props.superstate, + minMode: props.minMode, + containerRef: props.containerRef, + setView: props.setFrameSchema + }))))) : spaceFragment?.type == "frame" ? /* @__PURE__ */ import_react158.default.createElement(FrameRootProvider, { + superstate: props.superstate, + path: path3, + cols: [] + }, /* @__PURE__ */ import_react158.default.createElement(FrameInstanceProvider, { + id: props.id, + superstate: props.superstate, + props: {}, + editable: false + }, /* @__PURE__ */ import_react158.default.createElement(FrameInstanceView, { + superstate: props.superstate, + source: props.source + }))) : spaceFragment?.type == "action" ? /* @__PURE__ */ import_react158.default.createElement(SpaceCommand, { + superstate: props.superstate, + action: props.path + }) : /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null))); +}; + +// src/core/react/components/SpaceView/Frames/EditorNodes/ContextNodeView.tsx +var import_react159 = __toESM(require_react()); +var ContextNodeView = (props) => { + const fullPath = props.state?.props?.value; + const { updateNode } = (0, import_react159.useContext)(FramesEditorRootContext); + const { id: id3 } = (0, import_react159.useContext)(FrameInstanceContext); + const selectLink = (e5) => { + showSpacesMenu( + e5, + props.superstate, + (link3) => updateNode(props.treeNode.node, { + props: { + ...props.treeNode.node.props, + value: wrapQuotes(link3 + "#^" + defaultContextSchemaID) + } + }) ); }; - const spacesFromPath = (path2) => { - return [...props.superstate.spacesMap.get(path2)].map((f2) => props.superstate.spacesIndex.get(f2)).filter((f2) => f2 && f2.type != "default" && f2.path != "/").map((f2) => props.superstate.pathsIndex.get(f2.path)).sort( - (f2, k2) => path2.startsWith(f2.path) ? -1 : path2.startsWith(k2.path) ? 1 : 0 - ).filter((f2) => f2); - }; - const spacePathStates = (0, import_react158.useMemo)( - () => spacesFromPath(pathState.path), - [pathState] - ); - const spaces2 = (0, import_react158.useMemo)( - () => [...props.superstate.spacesMap.get(pathState?.path) ?? []].map((f2) => props.superstate.spacesIndex.get(f2)?.space).filter((f2) => f2), - [pathState] - ); - const saveField = (source, field) => { - if (source == "fm") { - props.superstate.spaceManager.addProperty(pathState.path, field); + const setFrameSchema = (schema) => { + if (props.treeNode.node.props.value == "$contexts['$space']['space']") { + updateNode(props.treeNode.node, { + props: { + ...props.treeNode.node.props, + value: `$contexts['$space']['space']+"/#*${schema}"` + } + }); return; } - props.superstate.spaceManager.addSpaceProperty(source, field); - }; - const newProperty = (e5, space2) => { - const offset2 = e5.target.getBoundingClientRect(); - showNewPropertyMenu( - props.superstate, - offset2, - [], - [], - (source, field) => saveField(space2, field), - defaultContextSchemaID, - space2 - ); + updateNode(props.treeNode.node, { + props: { + ...props.treeNode.node.props, + value: wrapQuotes( + contextPathFromPath( + props.superstate, + props.superstate.spaceManager.resolvePath(fullPath, props.source) + )?.space + "#*" + schema + ) + } + }); }; - const showAddMenu = (e5) => { - const offset2 = e5.target.getBoundingClientRect(); - showSpacesMenu( - offset2, - props.superstate, - (link, isNew) => { - if (isNew) { - if (link.charAt(0) == "#") { - addTagToPath(props.superstate, pathState.path, link); - } else { - createSpace(props.superstate, link, { links: [pathState.path] }); + return props.state && fullPath ? /* @__PURE__ */ import_react159.default.createElement(SpaceFragmentViewComponent, { + id: id3, + source: props.source, + superstate: props.superstate, + path: fullPath, + minMode: props.state?.styles?.["--mk-min-mode"], + containerRef: props.containerRef, + setFrameSchema + }) : /* @__PURE__ */ import_react159.default.createElement("div", { + className: "mk-frame-placeholder", + onClick: (e5) => selectLink(e5) + }, i18n_default.labels.selectSpace); +}; + +// src/core/react/components/SpaceView/Frames/EditorNodes/IconNodeView.tsx +var import_react160 = __toESM(require_react()); +var IconNodeView = (props) => { + const { + selectionMode, + selected: frameSelected, + selection: selection2 + } = (0, import_react160.useContext)(FrameSelectionContext); + const { updateNode, nodes } = (0, import_react160.useContext)(FramesEditorRootContext); + const updateValue2 = (newValue) => { + if (newValue != props.state.props?.value) { + if (props.treeNode.editorProps?.linkedNode) { + const node2 = nodes.find( + (f2) => f2.id == props.treeNode.editorProps.linkedNode.node + ); + updateNode(node2, { + props: { + ...node2.props, + [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) } - } else { - addToSpace(link); - } - }, - false, - true - ); + }); + } else { + updateNode(props.treeNode.node, { + props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } + }); + } + } }; - return /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, /* @__PURE__ */ import_react158.default.createElement("div", { - className: "mk-props-contexts" - }, /* @__PURE__ */ import_react158.default.createElement("div", { - className: "mk-path-context-row" - }, /* @__PURE__ */ import_react158.default.createElement("div", { - className: "mk-props-contexts-space-list" - }, spacePathStates.map((f2, i4) => /* @__PURE__ */ import_react158.default.createElement("div", { - key: i4, - className: "mk-props-contexts-space-name", - onContextMenu: (e5) => showContextMenu(e5, f2.path), - onClick: (e5) => props.superstate.ui.openPath(f2.path, e5.metaKey), - style: f2.label?.color?.length > 0 ? { - "--tag-background": f2.label?.color, - "--tag-color": "var(--color-white)" - } : {} - }, /* @__PURE__ */ import_react158.default.createElement("div", { - className: `mk-icon-xsmall`, - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(f2.label?.sticker) + const selected = selection2?.includes(props.treeNode.node.id); + const editable = (0, import_react160.useMemo)(() => { + if (selectionMode == 0 /* Read */) + return false; + if (selectionMode == 1 /* Page */) + return true; + if (selectionMode == 3 /* Group */ && selected) + return true; + if (props.treeNode.isRef) { + if (props.treeNode.editorProps.linkedNode && frameSelected) + return true; + return false; } - }), f2.name)), /* @__PURE__ */ import_react158.default.createElement("div", { - className: "mk-props-contexts-space-name", - onClick: (e5) => showAddMenu(e5), - style: { - opacity: 0.5 + return true; + }, [props.treeNode, selectionMode, frameSelected, selected]); + const selectIcon = () => { + props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react160.default.createElement(StickerModal_default, { + ui: props.superstate.ui, + hide: _props.hide, + selectedSticker: (emoji) => updateValue2(emoji) + })); + }; + const [stickerType, stickerPath] = props.state.props?.value ? parseStickerString(props.state.props?.value) : [null, null]; + return props.state && (props.state.props?.value?.length > 0 ? stickerType == "image" ? /* @__PURE__ */ import_react160.default.createElement("img", { + className: "mk-frame-icon", + src: props.superstate.ui.getUIPath( + props.superstate.imagesCache.get(stickerPath) + ) + }) : /* @__PURE__ */ import_react160.default.createElement("div", { + className: "mk-frame-icon", + style: {}, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(props.state.props?.value) } - }, /* @__PURE__ */ import_react158.default.createElement("span", { - className: "mk-icon-xsmall", + }) : editable ? /* @__PURE__ */ import_react160.default.createElement("div", { + onClick: () => selectIcon(), + "aria-label": "Select Sticker", + className: "mk-node-icon-placeholder", dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + __html: props.superstate.ui.getSticker("ui//smile") } - }), i18n_default.buttons.addToSpace))), pathState.type == "space" ? /* @__PURE__ */ import_react158.default.createElement(SpaceHeaderView, { - superstate: props.superstate, - spacePathStates, - spaces: spaces2 - }) : /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null, /* @__PURE__ */ import_react158.default.createElement(PathContextList, { - superstate: props.superstate, - color: "var(--tag-background)", - path: pathState.path - }), /* @__PURE__ */ import_react158.default.createElement(PropertiesView, { - superstate: props.superstate, - spaces: spaces2.map((f2) => f2.path), - force: true, - excludeKeys: [ - ...FMMetadataKeys(props.superstate.settings), - ...FMSpaceKeys(props.superstate.settings) - ], - editable: true - })))); + }) : /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null)); }; -// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx +// src/core/react/components/SpaceView/Frames/EditorNodes/ImageNodeView.tsx var import_react161 = __toESM(require_react()); +var ImageNodeView = (props) => { + const value = props.state.props.value; + const sourcePath = (0, import_react161.useMemo)(() => { + return props.superstate.ui.getUIPath(value, true); + }, [value]); + const { nodes, updateNode } = (0, import_react161.useContext)(FramesEditorRootContext); + const { linkedProps } = (0, import_react161.useContext)(FrameInstanceContext); + const { + selectionMode, + selected: frameSelected, + selection: selection2 + } = (0, import_react161.useContext)(FrameSelectionContext); + const selected = selection2?.includes(props.treeNode.node.id); + const showModal2 = () => { + if (!stringIsConst(props.treeNode.node.props.value) && !linkedProps.some( + (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2 + )) + return; + props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react161.default.createElement(ImageModal_default, { + superstate: props.superstate, + hide: _props.hide, + selectedPath: (image3) => saveValue(image3) + })); + }; + const saveValue = (newValue) => { + if (newValue != props.state.props?.value) { + if (props.treeNode.editorProps?.linkedNode) { + const node2 = nodes.find( + (f2) => f2.id == props.treeNode.editorProps.linkedNode.node + ); + updateNode(node2, { + props: { + ...node2.props, + [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) + } + }); + } else { + updateNode(props.treeNode.node, { + props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } + }); + } + } + }; + const editable = (0, import_react161.useMemo)(() => { + if (selectionMode == 0 /* Read */) + return false; + if (selectionMode == 1 /* Page */) + return true; + if (selectionMode == 3 /* Group */ && selected) + return true; + if (props.treeNode.isRef) { + if (props.treeNode.editorProps.linkedNode && frameSelected) + return true; + return false; + } + return true; + }, [props.treeNode, selectionMode, frameSelected, selected]); + return props.state?.props.value?.length > 0 ? /* @__PURE__ */ import_react161.default.createElement("img", { + className: "mk-node-image", + width: props.state?.styles.width, + height: props.state?.styles.height, + style: { + borderRadius: props.state?.styles.borderRadius, + maxHeight: props.state?.styles.maxHeight + }, + src: sourcePath + }) : editable ? /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-node-image-placeholder", + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getPlaceholderImage("image-select") + }, + style: { + borderRadius: props.state?.styles.borderRadius, + maxHeight: props.state?.styles.maxHeight + }, + onClick: (e5) => showModal2() + }) : /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null); +}; -// src/core/react/components/SpaceView/TitleComponent.tsx -var import_react159 = __toESM(require_react()); -var TitleComponent = (props) => { - const { pathState } = (0, import_react159.useContext)(PathContext); - const { spaceState } = (0, import_react159.useContext)(SpaceContext); - const fileNameRef = (0, import_react159.useRef)(null); - const name317 = (0, import_react159.useMemo)( - () => pathState ? props.superstate.settings.spacesUseAlias ? pathState?.displayName : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null, - [pathState] - ); - const contentEditable = !props.readOnly && spaceState?.type != "default"; - const onBlur = (e5) => { - const newValue = e5.target.innerText; - if (newValue != name317) { - if (pathState.path == "/") { - props.superstate.settings.systemName = newValue; - props.superstate.saveSettings(); - props.superstate.reloadSpaceByPath("/"); - return; +// src/core/react/components/SpaceView/Frames/EditorNodes/InputNodeView.tsx +var import_react162 = __toESM(require_react()); +var InputNodeView = (props) => { + const { selectionMode } = (0, import_react162.useContext)(FrameSelectionContext); + const { saveState, instance } = (0, import_react162.useContext)(FrameInstanceContext); + const [value, setValue] = (0, import_react162.useState)(""); + const state = props.state; + const type = props.state.styles?.as; + (0, import_react162.useEffect)(() => { + const linkedNode = parseLinkedNode(props.state?.props?.value); + if (linkedNode) { + const node2 = linkedNode.node == "$root" ? instance.exec.id : linkedNode.node; + setValue(instance.state?.[node2]?.props?.[linkedNode.prop]); + } + }, [props.state.props]); + return /* @__PURE__ */ import_react162.default.createElement("input", { + className: "mk-node-input", + type, + value: type == "checkbox" ? null : value, + checked: value == "true", + onKeyDown: (e5) => { + e5.stopPropagation(); + if (e5.key == "Enter") { + const _value = type == "text" ? e5.currentTarget.value : type == "checkbox" ? (!e5.currentTarget.checked).toString() : e5.currentTarget.value; + setValue(""); + if (typeof state.actions?.onEnter == "function") { + state.actions?.onEnter( + e5, + _value, + instance.state, + (s4) => saveState(s4, instance), + props.superstate.api + ); + } } - if (props.superstate.settings.spacesUseAlias) { - updatePrimaryAlias( - props.superstate, - pathState.path, - pathState.metadata.aliases, - newValue + }, + onChange: (e5) => { + const _value = type == "text" ? e5.target.value : type == "checkbox" ? (!e5.target.checked).toString() : e5.target.value; + setValue(_value); + if (typeof state.actions?.onChange == "function") { + state.actions?.onChange( + e5, + _value, + instance.state, + (s4) => saveState(s4, instance), + props.superstate.api + ); + } + }, + placeholder: state.styles.placeholder, + style: { + ...state?.styles + } + }); +}; + +// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx +var import_react166 = __toESM(require_react()); + +// src/core/react/hooks/useEffectOnce.ts +var import_react163 = __toESM(require_react()); +function useEffectOnce(cb) { + (0, import_react163.useEffect)(cb, []); +} + +// src/core/react/hooks/useEventListener.ts +var import_react164 = __toESM(require_react()); +function useEventListener(eventType, callback, element3 = window) { + const callbackRef = (0, import_react164.useRef)(callback); + (0, import_react164.useEffect)(() => { + callbackRef.current = callback; + }, [callback]); + (0, import_react164.useEffect)(() => { + if (element3 == null) + return; + const handler = (e5) => callbackRef.current(e5); + element3.addEventListener(eventType, handler); + return () => element3.removeEventListener(eventType, handler); + }, [eventType, element3]); +} + +// src/core/react/hooks/useTimeout.tsx +var import_react165 = __toESM(require_react()); +function useTimeout(callback, delay) { + const callbackRef = (0, import_react165.useRef)(callback); + const timeoutRef = (0, import_react165.useRef)(null); + (0, import_react165.useEffect)(() => { + callbackRef.current = callback; + }, [callback]); + const set = (0, import_react165.useCallback)(() => { + timeoutRef.current = setTimeout(() => callbackRef.current(), delay); + }, [delay]); + const clear = (0, import_react165.useCallback)(() => { + timeoutRef.current && clearTimeout(timeoutRef.current); + }, []); + (0, import_react165.useEffect)(() => { + set(); + return clear; + }, [delay, set, clear]); + const reset2 = (0, import_react165.useCallback)(() => { + clear(); + set(); + }, [clear, set]); + return { reset: reset2, clear }; +} + +// src/core/react/hooks/useLongPress.tsx +function useLongPress(ref2, cb, { delay = 400 } = {}) { + const { reset: reset2, clear } = useTimeout(cb, delay); + useEffectOnce(clear); + useEventListener("mousedown", reset2, ref2.current); + useEventListener("touchstart", reset2, ref2.current); + useEventListener("mouseup", clear, ref2.current); + useEventListener("mouseleave", clear, ref2.current); + useEventListener("touchend", clear, ref2.current); +} + +// src/core/react/components/SpaceView/Frames/EditorNodes/TextNodeView.tsx +var TextNodeView = (props) => { + const { + selectionMode, + selection: selection2, + selectable, + selected: frameSelected, + select + } = (0, import_react166.useContext)(FrameSelectionContext); + const fileNameRef = (0, import_react166.useRef)(null); + const { updateNode, nodes, deleteNode } = (0, import_react166.useContext)(FramesEditorRootContext); + const updateValue2 = (newValue) => { + if (newValue != props.state.props?.value) { + if (props.treeNode.editorProps?.linkedNode) { + const node2 = nodes.find( + (f2) => f2.id == props.treeNode.editorProps.linkedNode.node ); + updateNode(node2, { + props: { + ...node2.props, + [props.treeNode.editorProps.linkedNode.prop]: wrapQuotes(newValue) + } + }); } else { - renamePathByName(props.superstate, pathState.path, newValue); + updateNode(props.treeNode.node, { + props: { ...props.treeNode.node.props, value: wrapQuotes(newValue) } + }); } } }; + const onBlur = (e5) => { + const newValue = e5.target.innerHTML; + updateValue2(newValue); + }; const onKeyPress = (e5) => { e5.stopPropagation(); }; @@ -127942,13 +138904,17 @@ var TitleComponent = (props) => { }; const onKeyDown = (e5) => { e5.stopPropagation(); + if (e5.key == "Delete" || e5.key == "Backspace") { + if (e5.target.innerHTML == "") + deleteNode(props.treeNode.node); + } if (e5.key == "a" && e5.metaKey) { e5.preventDefault(); - const selection2 = window.getSelection(); + const selection3 = window.getSelection(); const range2 = document.createRange(); range2.selectNodeContents(e5.target); - selection2.removeAllRanges(); - selection2.addRange(range2); + selection3.removeAllRanges(); + selection3.addRange(range2); } if (e5.key == "Enter") { e5.target.blur(); @@ -127959,2130 +138925,1750 @@ var TitleComponent = (props) => { e5.preventDefault(); } }; - const hasSticker = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0; - const hasBanner = pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner]; - return pathState && /* @__PURE__ */ import_react159.default.createElement(import_react159.default.Fragment, null, props.superstate.settings.spacesStickers && /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-header-icon", - style: hasBanner ? { - "--label-color": "var(--mk-ui-background)" - } : {} - }, hasSticker ? /* @__PURE__ */ import_react159.default.createElement(PathStickerContainer, { - superstate: props.superstate, - path: pathState.path - }) : /* @__PURE__ */ import_react159.default.createElement("button", { - className: "mk-inline-button", - onClick: (e5) => props.superstate.ui.openPalette( - (_props) => /* @__PURE__ */ import_react159.default.createElement(StickerModal_default, { - ui: props.superstate.ui, - hide: _props.hide, - selectedSticker: (emoji) => savePathIcon(props.superstate, pathState.path, emoji) - }) - ) - }, /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//smile") + const onClick = (e5) => { + if (editable) { + e5.stopPropagation(); } - }), i18n_default.buttons.addIcon), /* @__PURE__ */ import_react159.default.createElement("span", null), !hasBanner && /* @__PURE__ */ import_react159.default.createElement("button", { - className: "mk-inline-button", - onClick: (e5) => props.superstate.ui.openPalette( - (_props) => /* @__PURE__ */ import_react159.default.createElement(ImageModal_default, { - superstate: props.superstate, - hide: _props.hide, - selectedPath: (image) => savePathBanner( - props.superstate, - pathState.path, - image - ) - }) - ) - }, /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//mk-make-image") + }; + const onMouseDown = (e5) => { + if (editable) + e5.stopPropagation(); + if (selectionMode == 3 /* Group */ && !props.treeNode.isRef) { + select(props.treeNode.id); } - }), i18n_default.buttons.addCover)), /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-title-container" - }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-title-prefix" - }, "#") : "", /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-inline-title inline-title", - ref: fileNameRef, - contentEditable, + }; + const onLongPress = () => { + if (editable) { + select(props.treeNode.node.id, false); + return; + } + }; + useLongPress(fileNameRef, onLongPress); + const selected = selection2.includes(props.treeNode.id); + const { linkedProps } = (0, import_react166.useContext)(FrameInstanceContext); + const editable = (0, import_react166.useMemo)(() => { + if (selectionMode == 0 /* Read */) + return false; + if (props.treeNode.isRef) { + if (props.treeNode.editorProps.linkedNode && frameSelected) + return true; + return false; + } + if (linkedProps.some( + (f2) => props.treeNode.editorProps.linkedNode?.node == props.treeNode.node.schemaId && props.treeNode.editorProps.linkedNode?.prop == f2 + )) + return true; + if (!stringIsConst(props.treeNode.node.props.value)) + return false; + if (selectionMode == 1 /* Page */) + return true; + if (selectionMode == 3 /* Group */ && selected) + return true; + return false; + }, [props.treeNode, selectionMode, frameSelected, selected, linkedProps]); + return props.state && /* @__PURE__ */ import_react166.default.createElement("div", { + className: `mk-frame-text`, + "data-placeholder": editable || selectable ? i18n_default.labels.textPlaceholder : "", + dangerouslySetInnerHTML: { + __html: props.state.props?.value + }, + onClick, + onMouseDown, onBlur, onDrop: (e5) => e5.preventDefault(), onKeyDown, onKeyPress, onKeyUp, - dangerouslySetInnerHTML: { - __html: name317 - } - }))); + ref: fileNameRef, + contentEditable: editable + }); }; -// src/core/react/components/MarkdownEditor/BannerView.tsx -var import_react160 = __toESM(require_react()); -var BannerView = (props) => { - const [hasSticker, setHasSticker] = (0, import_react160.useState)(false); - const { pathState } = (0, import_react160.useContext)(PathContext); - const [banner, setBanner] = (0, import_react160.useState)( - props.superstate.spaceManager.uriByString( - pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner] - ) - ); - (0, import_react160.useEffect)(() => { - const banner2 = props.superstate.spaceManager.uriByString( - pathState?.metadata.property?.[props.superstate.settings.fmKeyBanner] - ); - const hasSticker2 = pathState?.metadata.property?.[props.superstate.settings.fmKeySticker]?.length > 0; - setHasSticker(hasSticker2); - if (banner2) { - setBanner(banner2); - } else { - setBanner(null); +// src/core/react/components/SpaceView/Frames/ViewNodes/FrameView.tsx +var FrameView = (props) => { + const nodeProps = { + superstate: props.superstate, + treeNode: props.treeNode, + state: props.instance.state[props.treeNode.id] + }; + const innerComponents = props.treeNode.node.type == "input" ? /* @__PURE__ */ import_react167.default.createElement(InputNodeView, { + ...nodeProps + }) : props.treeNode.node.type == "text" ? /* @__PURE__ */ import_react167.default.createElement(TextNodeView, { + ...nodeProps + }) : props.treeNode.node.type == "icon" ? /* @__PURE__ */ import_react167.default.createElement(IconNodeView, { + ...nodeProps + }) : props.treeNode.node.type == "audio" ? /* @__PURE__ */ import_react167.default.createElement(AudioNodeView, { + ...nodeProps + }) : props.treeNode.node.type == "image" ? /* @__PURE__ */ import_react167.default.createElement(ImageNodeView, { + ...nodeProps + }) : props.treeNode.node.type == "space" ? /* @__PURE__ */ import_react167.default.createElement(ContextNodeView, { + ...nodeProps, + source: props.source + }) : props.treeNode.node.type == "content" ? /* @__PURE__ */ import_react167.default.createElement(ContentNodeView, null, props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react167.default.createElement(FrameView, { + superstate: props.superstate, + key: i4, + treeNode: c3, + instance: props.instance, + saveState: props.saveState, + source: props.source + }, props.children)), props.children) : props.treeNode.node.type == "flow" ? /* @__PURE__ */ import_react167.default.createElement(FlowNodeView, { + ...nodeProps, + source: props.source + }) : props.treeNode.children.filter((f2) => f2.node.type != "slides").map((c3, i4) => /* @__PURE__ */ import_react167.default.createElement(FrameView, { + superstate: props.superstate, + key: i4, + treeNode: c3, + instance: props.instance, + saveState: props.saveState, + source: props.source + }, props.children)); + const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false; + return props.instance.state[props.treeNode.id] && !hidden && /* @__PURE__ */ import_react167.default.createElement("div", { + className: `mk-frame ${parseStylesToClass( + props.instance.state[props.treeNode.id]?.styles + )}`, + "data-path": props.treeNode.id, + "data-type": props.treeNode.node.type, + onContextMenu: (e5) => { + if (typeof props.instance.state[props.treeNode.id].actions?.onContextMenu == "function") { + props.instance.state[props.treeNode.id].actions?.onContextMenu( + e5, + null, + props.instance.state, + (s4) => props.saveState(s4, props.instance), + props.superstate.api + ); + e5.stopPropagation(); + } + }, + onClick: (e5) => { + if (e5.detail === 1) { + if (typeof props.instance.state[props.treeNode.id].actions?.onClick == "function") { + props.instance.state[props.treeNode.id].actions?.onClick( + e5, + null, + props.instance.state, + (s4) => props.saveState(s4, props.instance), + props.superstate.api + ); + e5.stopPropagation(); + } + } else if (e5.detail === 2) { + if (typeof props.instance.state[props.treeNode.id].actions?.onDoubleClick == "function") { + props.instance.state[props.treeNode.id].actions?.onDoubleClick( + e5, + null, + props.instance.state, + (s4) => props.saveState(s4, props.instance), + props.superstate.api + ); + e5.stopPropagation(); + } + } + }, + style: { + ...defaultFrameStyles, + ...props.instance.state[props.treeNode.id]?.styles } - }, [pathState]); - const offset2 = pathState?.metadata.property?.banner_y ? `${(parseFloat(pathState?.metadata.property?.banner_y) * 100).toString()}%` : "center"; - const triggerBannerContextMenu = (e5) => { - e5.preventDefault(); - const menuOptions = [ + }, innerComponents); +}; + +// src/core/react/components/SpaceView/Frames/EditorNodes/NewNodeView.tsx +var import_react168 = __toESM(require_react()); +var NewNodeView = (props) => { + const ref2 = import_react168.default.createRef(); + const { spaceState } = (0, import_react168.useContext)(SpaceContext); + const { + updateNode, + nodes, + deleteNode, + addNode, + saveNodes, + lastCreatedId, + setLastCreatedId + } = (0, import_react168.useContext)(FramesEditorRootContext); + const { selection: selection2, select } = (0, import_react168.useContext)(FrameSelectionContext); + const [type, setType] = (0, import_react168.useState)("label"); + const { instance } = (0, import_react168.useContext)(FrameInstanceContext); + const spaces2 = [...props.superstate.allSpaces(true)].filter((f2) => f2.type != "default").map((f2) => ({ + name: f2.name, + value: f2.path, + icon: props.superstate.pathsIndex.get(f2.path)?.label?.sticker, + description: f2.type == "tag" ? f2.name : f2.type == "folder" ? f2.path : f2.name + })); + const paths = [...props.superstate.pathsIndex.values()].filter((f2) => !f2.hidden).filter((f2) => f2.type == "space" || f2.subtype == "md").map((f2) => ({ + name: f2.displayName, + value: f2.path, + description: f2.path, + section: "flow", + icon: f2.label?.sticker + })); + const fuseOptions = { + minMatchCharLength: 1, + threshold: 0, + keys: ["name", "value"] + }; + const [query, setQuery] = (0, import_react168.useState)(""); + const suggestions = (0, import_react168.useMemo)(() => { + const menuOptions = []; + const label = { + name: i18n_default.frames.label.label, + description: query, + icon: "ui//baseline", + section: "label", + value: "" + }; + menuOptions.push(label); + const note = { + name: i18n_default.frames.note.label, + description: query, + icon: "ui//file-text", + value: "", + section: "flow" + }; + menuOptions.push(note); + const kit = [ { - name: i18n_default.buttons.changeBanner, - value: "change", - icon: "ui//image", - onClick: (ev) => { - props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react160.default.createElement(ImageModal_default, { - superstate: props.superstate, - hide: _props.hide, - selectedPath: (image) => savePathBanner(props.superstate, pathState.path, image) - })); + name: i18n_default.frames.table.label, + description: i18n_default.frames.table.description, + icon: "ui//table", + section: "list", + value: "" + }, + ...[contextNode, dividerNode, iconNode, imageNode, groupNode].map( + (f2) => ({ + name: f2.node.name, + value: f2, + icon: f2.def?.icon, + section: "base", + description: f2.def?.description + }) + ), + ...[ + buttonNode, + ratingNode, + callout, + toggleNode, + progressNode, + circularProgressNode, + tabsNode + ].map((f2) => ({ + name: f2.node.name, + value: f2, + icon: f2.def?.icon, + section: "kit", + description: f2.def?.description + })) + ]; + const fuse = new Fuse(kit, fuseOptions); + const kitOptions = query.length == 0 ? kit : fuse.search(query).map((result) => result.item).slice(0, 10); + if (kitOptions.length > 0) { + menuOptions.push(menuSection("Kit")); + } + menuOptions.push(...kitOptions); + if (query.length > 0) { + const fuse2 = new Fuse([...paths], fuseOptions); + const options = query.length == 0 ? [] : fuse2.search(query).map((result) => result.item).slice(0, 10); + if (options.length > 0) + menuOptions.push(menuSection("Paths")); + menuOptions.push(...options); + } + return menuOptions; + }, [query, type]); + const selectOption = (option2) => { + if (!props.treeNode) { + clear(); + } + if (option2.section == "kit" || option2.section == "base") { + if (props.treeNode) { + let node2 = relinkProps( + "$root", + props.treeNode.node.schemaId, + option2.value.node, + props.treeNode.node.schemaId + ); + node2 = relinkProps( + node2.id, + props.treeNode.node.id, + node2, + props.treeNode.node.schemaId + ); + saveNodes([ + { + ...node2, + type: option2.section == "base" ? node2.type : "frame", + styles: option2.value.node.styles, + ref: option2.section == "base" ? "" : "spaces://$kit/#*" + option2.value.def.id, + parentId: props.treeNode.node.parentId, + schemaId: props.treeNode.node.schemaId, + id: props.treeNode.node.id, + rank: props.treeNode.node.rank + } + ]).then((f2) => select(props.treeNode.id)); + } else { + addNode( + option2.section == "base" ? option2.value.node : { + ...option2.value.node, + type: "frame", + styles: option2.value.node.styles, + ref: "spaces://$kit/#*" + option2.value.def.id + }, + instance.exec.node, + true + ).then((f2) => select(f2.id)); + } + } else if (option2.section == "label") { + if (props.treeNode) { + saveNodes([ + { + ...props.treeNode.node, + type: "text", + name: textNode.node.name, + props: { + ...props.treeNode.node.props, + value: wrapQuotes(query) + }, + styles: textNode.node.styles + } + ]).then((f2) => select(props.treeNode.id)); + } else { + addNode( + { + ...textNode.node, + props: { + value: wrapQuotes(query) + } + }, + instance.exec.node, + true + ).then((f2) => select(f2.id)); + } + } else if (option2.section == "flow") { + if (option2.value.length > 0) { + if (props.treeNode) { + saveNodes([ + { + ...props.treeNode.node, + type: "flow", + name: flowNode.node.name, + props: { + ...props.treeNode.node.props, + value: wrapQuotes(option2.value) + }, + styles: flowNode.node.styles + } + ]); + } else { + addNode( + { + ...flowNode.node, + props: { + value: wrapQuotes(option2.value) + } + }, + instance.exec.node, + true + ); } - }, - { - name: i18n_default.buttons.removeBanner, - value: "remove", - icon: "ui//file-minus", - onClick: (ev) => { - if (props.superstate.spacesIndex.has(pathState.path)) { - props.superstate.spaceManager.deleteProperty( - props.superstate.spacesIndex.get(pathState.path).defPath, - props.superstate.settings.fmKeyBanner - ); + } else { + newPathInSpace(props.superstate, spaceState, "md", query, true).then( + (f2) => { + if (props.treeNode) { + saveNodes([ + { + ...props.treeNode.node, + name: flowNode.node.name, + type: "flow", + props: { + value: wrapQuotes(f2) + }, + styles: { + ...flowNode.node.styles + } + } + ]); + } else { + addNode( + { + ...flowNode.node, + props: { + value: wrapQuotes(f2) + } + }, + instance.exec.node, + true + ); + } } - props.superstate.spaceManager.deleteProperty( - pathState.path, - props.superstate.settings.fmKeyBanner + ); + } + } else if (option2.section == "list") { + createInlineTable(props.superstate, spaceState.path).then((f2) => { + if (props.treeNode) { + saveNodes([ + { + ...props.treeNode.node, + name: contextNode.node.name, + type: "space", + props: { value: wrapQuotes(`${spaceState.path}/#*${f2}`) }, + styles: { + ...contextNode.node.styles + } + } + ]); + } else { + addNode( + { + ...textNode.node, + name: contextNode.node.name, + type: "space", + props: { value: wrapQuotes(`${spaceState.path}/#^${f2}`) } + }, + instance.exec.node, + true ); } - } - ]; - props.superstate.ui.openMenu( - { - x: e5.clientX, - y: e5.clientY, - width: 0, - height: 0 - }, - defaultMenu(props.superstate.ui, menuOptions) - ); - return false; + }); + } }; - return banner ? /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null, /* @__PURE__ */ import_react160.default.createElement("div", { - className: `mk-space-banner`, - onContextMenu: triggerBannerContextMenu, - style: { - "--mk-banner-height": props.superstate.settings.bannerHeight + "px", - backgroundImage: `url("${banner.scheme == "vault" ? props.superstate.ui.getUIPath(banner.basePath) : banner.fullPath}")`, - backgroundPositionY: offset2 + const clear = () => { + setQuery(""); + ref2.current.blur(); + ref2.current.innerHTML = ""; + }; + (0, import_react168.useEffect)(() => { + if (ref2.current && lastCreatedId && lastCreatedId == props.treeNode?.node.id) { + ref2.current.focus(); + setLastCreatedId(null); } - }), /* @__PURE__ */ import_react160.default.createElement("div", { - className: `mk-spacer`, - style: { - "--mk-header-height": ((isTouchScreen(props.superstate.ui) ? 1 : 0) * 26 + (props.superstate.settings.bannerHeight - 62) + (!props.superstate.settings.spacesStickers || props.superstate.settings.inlineContextNameLayout == "horizontal" ? 50 : hasSticker ? 0 : 30)).toString() + "px" + }, [ref2, selection2, props.treeNode]); + return /* @__PURE__ */ import_react168.default.createElement("div", { + className: "mk-node-new" + }, /* @__PURE__ */ import_react168.default.createElement(Suggester, { + superstate: props.superstate, + placeholder: i18n_default.hintText.newFrame, + suggestions, + onChange: (query2) => setQuery(query2), + onSelect: (option2) => { + selectOption(option2); }, - onContextMenu: (e5) => e5.preventDefault() - })) : /* @__PURE__ */ import_react160.default.createElement(import_react160.default.Fragment, null); + onFocus: () => { + select(null); + }, + ref: ref2, + onDelete: () => props.treeNode ? deleteNode(props.treeNode?.node) : clear(), + onSelectSection: (option2) => setType(option2) + })); }; -// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx -var MarkdownHeaderView = (props) => { - const { pathState } = (0, import_react161.useContext)(PathContext); - const [collapsed, setCollapsed] = (0, import_react161.useState)( - !props.superstate.settings.inlineContextExpanded - ); - (0, import_react161.useEffect)(() => { - props.superstate.settings.inlineContextExpanded = !collapsed; - props.superstate.saveSettings(); - }, [collapsed]); - (0, import_react161.useLayoutEffect)(() => { - props.editorView?.requestMeasure(); - }, []); - return pathState && /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, /* @__PURE__ */ import_react161.default.createElement("div", { - className: "mk-path-context-component" - }, /* @__PURE__ */ import_react161.default.createElement("div", { - className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` - }, /* @__PURE__ */ import_react161.default.createElement(BannerView, { - superstate: props.superstate - }), /* @__PURE__ */ import_react161.default.createElement(TitleComponent, { +// src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx +var defaultFrameStyles = { + position: "relative" +}; +var FrameEditorInner = (0, import_react169.memo)(function FrameEditorInner2(props) { + const nodeProps = { superstate: props.superstate, - readOnly: !props.editable - }), /* @__PURE__ */ import_react161.default.createElement("div", { - style: { position: "relative" } - }, /* @__PURE__ */ import_react161.default.createElement("div", { - className: "mk-fold" - }, /* @__PURE__ */ import_react161.default.createElement(CollapseToggle, { + treeNode: props.treeNode, + state: props.state + }; + const { treeNode } = props; + const { pathState } = (0, import_react169.useContext)(PathContext); + const { instance } = (0, import_react169.useContext)(FrameInstanceContext); + return /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, treeNode.node.type == "new" ? /* @__PURE__ */ import_react169.default.createElement(NewNodeView, { + ...nodeProps + }) : treeNode.node.type == "input" ? /* @__PURE__ */ import_react169.default.createElement(InputNodeView, { + ...nodeProps + }) : treeNode.node.type == "text" ? /* @__PURE__ */ import_react169.default.createElement(TextNodeView, { + ...nodeProps + }) : treeNode.node.type == "icon" ? /* @__PURE__ */ import_react169.default.createElement(IconNodeView, { + ...nodeProps + }) : treeNode.node.type == "audio" ? /* @__PURE__ */ import_react169.default.createElement(AudioNodeView, { + ...nodeProps + }) : treeNode.node.type == "image" ? /* @__PURE__ */ import_react169.default.createElement(ImageNodeView, { + ...nodeProps + }) : treeNode.node.type == "space" ? /* @__PURE__ */ import_react169.default.createElement(ContextNodeView, { + ...nodeProps, + containerRef: props.containerRef, + source: pathState.path + }) : treeNode.node.type == "flow" ? /* @__PURE__ */ import_react169.default.createElement(FlowNodeView, { + ...nodeProps, + source: pathState.path, + containerRef: props.containerRef + }) : treeNode.node.type == "content" ? /* @__PURE__ */ import_react169.default.createElement(ContentNodeView, { + editable: !props.treeNode.isRef + }, props.treeNode.children.map( + (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, { + superstate: props.superstate, + key: c3.id, + treeNode: c3, + instance: props.instance, + containerRef: props.containerRef + }, props.children) + ), props.children) : (treeNode.node.type == "column" || treeNode.node.type == "container") && treeNode.children.length == 0 ? null : props.treeNode.id == props.instance.exec.id || treeNode.node.type == "column" || treeNode.node.type == "container" ? props.treeNode.children.map( + (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, { + superstate: props.superstate, + key: c3.id, + treeNode: c3, + instance: props.instance, + containerRef: props.containerRef + }, props.children) + ) : /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameSelectionProvider, { superstate: props.superstate, - collapsed, - onToggle: (c3) => setCollapsed(c3) - })))), props.editable && !collapsed && /* @__PURE__ */ import_react161.default.createElement(NoteSpacesBar, { - superstate: props.superstate - }))); -}; - -// src/core/react/components/Navigator/Navigator.tsx -var import_react162 = __toESM(require_react()); -var Navigator = (props) => { - return /* @__PURE__ */ import_react162.default.createElement("div", { - className: "mk-sidebar" - }, /* @__PURE__ */ import_react162.default.createElement(SidebarProvider, { - superstate: props.superstate - }, /* @__PURE__ */ import_react162.default.createElement(MainList, { - superstate: props.superstate - }))); -}; - -// src/core/react/components/SpaceView/Editor/EmbedView/SpaceFragmentWrapper.tsx -var import_react163 = __toESM(require_react()); -var import_react164 = __toESM(require_react()); -var SpaceFragmentTitleComponent = (props) => { - const { pathState } = (0, import_react164.useContext)(PathContext); - const fileNameRef = (0, import_react164.useRef)(null); - const contentEditable = true; - const onBlur = (e5) => { - const newValue = e5.target.innerHTML; - if (newValue != props.name) { - props.saveName(newValue); + id: treeNode.id, + editMode: props.editMode + }, treeNode.children.map( + (c3, i4) => c3.node.type == "slides" ? null : /* @__PURE__ */ import_react169.default.createElement(FrameEditorNodeView, { + superstate: props.superstate, + key: c3.id, + treeNode: c3, + instance: props.instance, + containerRef: props.containerRef + }, props.children) + )))); +}); +var FrameEditorNodeView = (props) => { + const { + selectionMode, + selectable, + selected: _selected, + isParentToSelection, + select, + selection: selection2 + } = (0, import_react169.useContext)(FrameSelectionContext); + const { + updateNode, + addNode, + deleteNode, + nodes, + selectedSlide + } = (0, import_react169.useContext)(FramesEditorRootContext); + const { setDragNode } = (0, import_react169.useContext)(WindowContext); + const { saveState, selectableNodeBounds, id: id3 } = (0, import_react169.useContext)(FrameInstanceContext); + const { dragActive } = (0, import_react169.useContext)(WindowContext); + const editMode = props.treeNode.isRef ? 0 /* Read */ : props.treeNode.id == props.instance.exec.id ? selectionMode : 3 /* Group */; + const selected = selection2.some((f2) => f2 == props.treeNode.id); + const isSelectable = selectable && !props.treeNode.isRef && !selected; + const state = props.instance.state[props.treeNode.id]; + const deltas = (0, import_react169.useMemo)( + () => selectedSlide ? nodes.find( + (f2) => f2.ref == props.treeNode.id && selectedSlide == f2.parentId + ) ?? null : null, + [nodes, props.treeNode, selectedSlide] + ); + const treeNode = (0, import_react169.useMemo)( + () => deltas ? { + ...props.treeNode, + node: { + ...props.treeNode.node, + styles: { + ...props.treeNode.node.styles, + ...deltas.styles + }, + props: { + ...props.treeNode.node.props, + ...deltas.props + }, + actions: { + ...props.treeNode.node.actions, + ...deltas.actions + } + } + } : props.treeNode, + [deltas, props.treeNode] + ); + const { frameSchema } = (0, import_react169.useContext)(FramesMDBContext); + const dragId = id3 + frameSchema.id + props.treeNode.id; + const [hover, setHover] = (0, import_react169.useState)(false); + const [isMouseOverElement, setIsMouseOverElement] = import_react169.default.useState(false); + const [isMouseOverPortal, setIsMouseOverPortal] = import_react169.default.useState(false); + const draggable = props.treeNode.editorProps.dragMode == 1 /* DragHandle */ || (isSelectable && !isParentToSelection || selected) && props.treeNode.editorProps.dragMode != 0; + const { + attributes, + listeners, + setNodeRef: setDraggableNodeRef, + transform + } = useDraggable({ + id: dragId, + data: { + id: dragId, + root: id3, + type: "node", + parent: props.treeNode.node.parentId, + frame: frameSchema.id, + node: props.treeNode.id + }, + disabled: !draggable + }); + const ref2 = (0, import_react169.useRef)(null); + const onLongPress = () => { + if (isSelectable && props.treeNode.id != props.instance.exec.id) { + select(treeNode.node.id); + return; } }; - const onKeyPress = (e5) => { - e5.stopPropagation(); - }; - const onKeyUp = (e5) => { - e5.stopPropagation(); - }; - const onKeyDown = (e5) => { - e5.stopPropagation(); - if (e5.key == "a" && e5.metaKey) { - e5.preventDefault(); - const selection2 = window.getSelection(); - const range2 = document.createRange(); - range2.selectNodeContents(e5.target); - selection2.removeAllRanges(); - selection2.addRange(range2); - } - if (e5.key == "Enter") { - e5.target.blur(); - e5.preventDefault(); - } - if (e5.key == "Escape") { - e5.target.blur(); - e5.preventDefault(); - } + const hidden = props.instance.state[props.treeNode.id]?.styles ? props.instance.state[props.treeNode.id]?.styles?.hidden ? true : false : false; + const nodeProps = { + superstate: props.superstate, + treeNode, + state }; - const triggerStickerMenu = (e5) => { - props.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react163.default.createElement(StickerModal_default, { - ui: props.superstate.ui, - hide: _props.hide, - selectedSticker: (emoji) => props.saveSticker(emoji) - })); + const saveStyles = (size2) => { + updateNode(treeNode.node, { + styles: { ...size2 } + }); }; - return /* @__PURE__ */ import_react163.default.createElement("div", null, /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-header-icon" - }), /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-title-container" - }, pathState?.subtype == "tag" ? /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-title-prefix" - }, "#") : "", /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-inline-title inline-title", - ref: fileNameRef, - contentEditable, - onBlur, - onDrop: (e5) => e5.preventDefault(), - onKeyDown, - onKeyPress, - onKeyUp, - dangerouslySetInnerHTML: { - __html: props.name - } - }))); -}; -var SpaceFragmentWrapper = (props) => { - const [schema, setSchema] = import_react163.default.useState(null); - (0, import_react163.useEffect)(() => { - const uri = props.superstate.spaceManager.uriByString(props.path); - if (uri.refType == "context") { - const schema2 = props.superstate.contextsIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref); - if (schema2) { - setSchema({ - id: schema2.id, - name: schema2.name, - type: "context", - path: uri.basePath - }); + const onClick = (e5) => { + if (isSelectable && (selectionMode != 1 /* Page */ || isParentToSelection && props.treeNode.id != props.instance.exec.id)) { + if (e5.shiftKey) { + select(treeNode.node.id, true); + } else { + select(treeNode.node.id); } + e5.stopPropagation(); + return; + } else if (props.treeNode.id == props.instance.exec.id) { + select(null); } - if (uri.refType == "frame") { - const schema2 = props.superstate.framesIndex.get(uri.path)?.schemas.find((s4) => s4.id == uri.ref); - if (schema2) { - const frameSchema = mdbSchemaToFrameSchema(schema2); - setSchema({ - id: schema2.id, - name: frameSchema.name, - sticker: frameSchema.def?.icon, - type: "frame", - path: uri.basePath - }); + if (!selected) { + if (e5.detail === 1) { + if (typeof state.actions?.onClick == "function") { + state.actions?.onClick( + e5, + null, + props.instance.state, + (s4) => saveState(s4, props.instance), + props.superstate.api + ); + e5.stopPropagation(); + } + } else if (e5.detail === 2 || isTouchScreen(props.superstate.ui)) { + if (typeof state.actions?.onDoubleClick == "function") { + state.actions?.onDoubleClick( + e5, + null, + props.instance.state, + (s4) => saveState(s4, props.instance), + props.superstate.api + ); + e5.stopPropagation(); + } } + } else { + e5.stopPropagation(); } - if (uri.refType == "action") { - const schema2 = props.superstate.actionsIndex.get(uri.path)?.find((s4) => s4.schema.id == uri.ref)?.schema; - if (schema2) { - setSchema({ - id: schema2.id, - name: schema2.name, - sticker: schema2.def?.icon, - type: "action", - path: uri.basePath - }); + }; + (0, import_react169.useEffect)(() => { + selection2.some((f2) => f2 != props.treeNode.id) && setHover(false); + }, [selection2, props.treeNode]); + const [canEditLayout, setCanEditLayout] = (0, import_react169.useState)(false); + (0, import_react169.useEffect)(() => { + if (selected && isTouchScreen(props.superstate.ui) && (props.treeNode.node.type == "group" || props.treeNode.node.type == "image" || selectionMode >= 3 /* Group */)) { + setCanEditLayout(true); + } else { + if (selected && canEditLayout) { + } else { + setCanEditLayout(false); } } - }, [props.path]); - const saveName = (name317) => { - if (schema.type == "context") { - props.superstate.spaceManager.saveTableSchema( - schema.path, - schema.id, - (schema2) => ({ ...schema2, name: name317 }) - ); - } - if (schema.type == "frame") { - props.superstate.spaceManager.saveFrameSchema( - schema.path, - schema.id, - (schema2) => ({ ...schema2, name: name317 }) - ); - } - if (schema.type == "action") { - props.superstate.spaceManager.saveCommand( - schema.path, - schema.id, - (command) => ({ ...command, schema: { ...command.schema, name: name317 } }) - ); - } + }, [props.treeNode, selectionMode, selected]); + const dropMode = props.treeNode.editorProps.dropMode; + const computedStyle = ref2.current && getComputedStyle(ref2.current); + const clientWidth = ref2.current && ref2.current.clientWidth; + const clientHeight = ref2.current && ref2.current.clientHeight; + const [childNodeSizes, setChildNodeSizes] = (0, import_react169.useState)([]); + const calculateRectInContainer = (rect, containerRect2) => { + return { + left: rect.x - containerRect2.x, + top: rect.y - containerRect2.y, + width: rect.width, + height: rect.height + }; }; - const saveSticker = (name317) => { - if (schema.type == "frame") { - props.superstate.spaceManager.saveFrameSchema( - schema.path, - schema.id, - (schema2) => { - const frameSchema = mdbSchemaToFrameSchema(schema2); - const newFrameSchema = { - ...frameSchema, - def: { ...frameSchema.def, icon: name317 } - }; - return frameSchemaToTableSchema(newFrameSchema); - } - ); + (0, import_react169.useEffect)(() => { + if (!ref2.current || !props.containerRef?.current) { + return () => null; } - if (schema.type == "action") { - props.superstate.spaceManager.saveCommand( - schema.path, - schema.id, - (command) => { + if (props.treeNode.node.parentId == props.instance.exec.id) + selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer( + ref2.current.getBoundingClientRect(), + props.containerRef.current.getBoundingClientRect() + ); + setChildNodeSizes(() => { + const sizes = Array.from(ref2.current?.children ?? []).map( + (node2) => { return { - ...command, - schema: { - ...command.schema, - def: { ...command.schema?.def ?? {}, icon: name317 } - } + x: node2.offsetLeft, + y: node2.offsetTop, + width: node2.clientWidth, + height: node2.clientHeight }; } ); - } + return sizes; + }); + const resizeObserver = new ResizeObserver(() => { + if (props.treeNode.node.parentId == props.instance.exec.id && ref2.current) + selectableNodeBounds.current[props.treeNode.id] = calculateRectInContainer( + ref2.current.getBoundingClientRect(), + props.containerRef.current.getBoundingClientRect() + ); + setChildNodeSizes(() => { + const sizes = Array.from(ref2.current?.children ?? []).map( + (node2) => { + return { + x: node2.offsetLeft, + y: node2.offsetTop, + width: node2.clientWidth, + height: node2.clientHeight + }; + } + ); + return sizes; + }); + }); + resizeObserver.observe(ref2.current); + return () => resizeObserver.disconnect(); + }, [state]); + const nodeRect = ref2.current?.getBoundingClientRect(); + const containerRect = props.containerRef?.current?.getBoundingClientRect(); + const styles2 = { + ...defaultFrameStyles, + ...props.treeNode.node.type != "flow" ? state?.styles : { + width: state?.styles?.width, + height: state?.styles?.height, + "--max-width": state?.styles?.["--max-width"] + }, + "--translate-x": `${transform?.x ?? 0}px`, + "--translate-y": `${transform?.y ?? 0}px` }; - return /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-editor-space-fragment markdown-source-view mod-cm6 is-readable-line-width" - }, /* @__PURE__ */ import_react163.default.createElement("div", { - className: "mk-editor-header" - }, schema && /* @__PURE__ */ import_react163.default.createElement(SpaceFragmentTitleComponent, { - superstate: props.superstate, - readOnly: true, - name: schema.name, - sticker: schema.sticker, - saveName, - saveSticker - })), props.children); -}; - -// src/adapters/obsidian/utils/createTable.ts -var createTable2 = (object, columns) => { - const columnNames = columns.map((f2) => f2.name); - const base2 = "|"; - let outputString = base2 + columnNames.join(base2) + "|\n"; - columns.forEach((f2) => { - outputString += base2 + "----"; - }); - outputString += base2 + "\n"; - object.forEach((row2) => { - outputString += columnNames.map((c3) => base2 + row2[c3]).join("") + "|\n"; - }); - return outputString; -}; - -// src/adapters/obsidian/ui/editors/EmbedContextView.tsx -var import_obsidian = require("obsidian"); -var import_react165 = __toESM(require_react()); -var EMBED_CONTEXT_VIEW_TYPE = "mk-space-embed"; -var EmbedContextView = class extends import_obsidian.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - } - getViewType() { - return EMBED_CONTEXT_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - onunload() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.source = state.source; - this.constructInlineContext(); - await super.setState(state, result); - const title = pathDisplayName(this.path, this.plugin.superstate); - this.leaf.tabHeaderInnerTitleEl.innerText = title; - this.leaf.view.titleEl = title; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = title; + useDndMonitor({ + onDragStart: (e5) => { + if (e5.active?.id == dragId) { + setDragNode( + /* @__PURE__ */ import_react169.default.createElement("div", { + style: { + width: ref2.current.clientWidth + } + }, /* @__PURE__ */ import_react169.default.createElement(FrameView, { + superstate: props.superstate, + treeNode: props.treeNode, + instance: props.instance, + saveState: null + })) + ); + } } - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - state.source = this.source; - return state; - } - constructInlineContext() { - this.destroy(); - this.root = this.plugin.ui.createRoot(this.contentEl); - if (this.root) { - this.root.render( - /* @__PURE__ */ import_react165.default.createElement(SpaceFragmentViewComponent, { - id: this.path, - superstate: this.plugin.superstate, - path: this.path, - source: this.source - }) - ); - } else { - this.plugin.ui.manager.eventsDispatch.addOnceListener( - "windowReady", - () => { - this.constructInlineContext(); + }); + return /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, (!hidden || !props.treeNode.isRef) && /* @__PURE__ */ import_react169.default.createElement("div", { + ref: (el) => { + ref2.current = el; + selectionMode > 1 /* Page */ && draggable && setDraggableNodeRef(el); + }, + onContextMenu: () => isTouchScreen(props.superstate.ui) && onLongPress(), + className: (0, import_classnames11.default)( + `mk-frame-edit ${parseStylesToClass(state?.styles)}`, + isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable", + selected && selectionMode == 1 /* Page */ && "mk-selected" + ), + "data-path": treeNode.id, + "data-type": treeNode.node.type, + onMouseEnter: () => { + setHover(true); + setIsMouseOverElement(true); + }, + onMouseLeave: () => { + if (!isMouseOverPortal) { + setHover(false); + } + setIsMouseOverElement(false); + }, + ...{ onClick }, + ...selectionMode > 1 /* Page */ ? { ...listeners, ...attributes } : {}, + style: styles2 + }, /* @__PURE__ */ import_react169.default.createElement(FrameEditorInner, { + ...nodeProps, + containerRef: props.containerRef, + editMode, + instance: props.instance + }, props.children)), state && props.treeNode.node.type != "new" && props.containerRef?.current && selectionMode > 0 /* Read */ && ref2.current && (0, import_react_dom11.createPortal)( + /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement("div", { + style: { + position: "absolute", + top: nodeRect.top - containerRect.top, + left: nodeRect.left - containerRect.left, + width: clientWidth, + height: clientHeight, + pointerEvents: "none" + }, + className: (0, import_classnames11.default)( + !dragActive && isSelectable && selectionMode != 1 /* Page */ && "mk-f-editable", + !dragActive && selected && (selectionMode != 1 /* Page */ || props.treeNode.node.type == "group") && "mk-f-edit", + !dragActive && hover && selectionMode != 1 /* Page */ && "mk-f-edit-hover" + ), + onClick: (e5) => { + if (isSelectable && selectionMode != 1 /* Page */) { + if (e5.shiftKey) { + select(treeNode.node.id, true); + } else { + select(treeNode.node.id); + } + e5.stopPropagation(); + return; } - ); - } - } + } + }, props.treeNode.editorProps.resizeMode == 2 /* ResizeColumn */ && /* @__PURE__ */ import_react169.default.createElement(FrameResizer, { + size: state?.styles, + superstate: props.superstate, + resizeMode: props.treeNode.editorProps.resizeMode, + resize: saveStyles, + clientSize: { + width: clientWidth, + height: clientHeight + } + }), dragActive && (selectionMode == 1 /* Page */ || selectionMode == 3 /* Group */) && dropMode > 0 /* DropModeNone */ && /* @__PURE__ */ import_react169.default.createElement(FrameEditorDropZone, { + parentId: treeNode.node.parentId, + superstate: props.superstate, + height: clientHeight, + width: clientWidth, + node: treeNode.node.id, + id: dragId, + mode: dropMode, + insertMode: treeNode.node.type == "group" ? 1 : treeNode.node.type == "space" ? -1 : 0 + }), canEditLayout && /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameResizer, { + superstate: props.superstate, + resizeMode: 1 /* ResizeSelected */, + size: state?.styles, + resize: saveStyles, + clientSize: { + width: clientWidth, + height: clientHeight + } + }), /* @__PURE__ */ import_react169.default.createElement(FrameCorners, { + styles: state?.styles, + saveStyles, + clientSize: { + width: clientWidth, + height: clientHeight + } + }), (treeNode.node.type == "group" || treeNode.node.type == "content") && (state.styles?.layout == "row" || state.styles?.layout == "column") && /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(FrameGapHandle, { + childSizes: childNodeSizes, + clientSize: { + width: clientWidth, + height: clientHeight, + paddingBottom: parseInt( + computedStyle?.paddingBottom ?? "0" + ), + paddingLeft: parseInt( + computedStyle?.paddingLeft ?? "0" + ), + paddingRight: parseInt( + computedStyle?.paddingRight ?? "0" + ), + paddingTop: parseInt( + computedStyle?.paddingTop ?? "0" + ) + }, + styles: state?.styles, + saveStyles, + direction: state?.styles.layout == "column" ? "column" : "row" + }), /* @__PURE__ */ import_react169.default.createElement(FramePadding, { + clientSize: { + width: clientWidth, + height: clientHeight + }, + styles: state?.styles, + saveStyles + }))), treeNode.editorProps.dragMode == 1 /* DragHandle */ && (!isTouchScreen(props.superstate.ui) || selected) ? /* @__PURE__ */ import_react169.default.createElement("div", { + onMouseEnter: () => { + setIsMouseOverPortal(true); + setHover(true); + }, + onMouseLeave: () => { + if (!isMouseOverElement) { + setHover(false); + } + setIsMouseOverPortal(false); + }, + className: "mk-editor-frame-hover-menu-container", + style: { + zIndex: hover ? "calc(var(--layer-popover) + 1)" : "var(--layer-popover)" + } + }, /* @__PURE__ */ import_react169.default.createElement(FrameHoverMenu, { + superstate: props.superstate, + node: treeNode.node, + mode: selectionMode == 1 /* Page */ ? 0 : 1, + selected, + visible: isTouchScreen(props.superstate.ui) || hover, + dragRef: setDraggableNodeRef, + attributes, + listeners + })) : /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null)), selection2 && !dragActive && selected && selection2.length == 1 ? /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditorContainer, { + nodeRect, + containerRect + }, /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditor, { + editLayout: (state2) => setCanEditLayout(state2), + superstate: props.superstate, + node: treeNode.node, + duplicateFrame: () => { + addNode(treeNode.node, treeNode.node); + }, + state, + deleteFrame: () => deleteNode(treeNode.node), + fields: propertiesForNode(treeNode.node) + })) : selection2.length > 1 && selection2[0] == treeNode.id ? /* @__PURE__ */ import_react169.default.createElement(FrameNodeEditorContainer, { + nodeRect, + containerRect + }, /* @__PURE__ */ import_react169.default.createElement(FrameMultiNodeEditor, { + superstate: props.superstate + })) : null), + props.containerRef.current + )); }; -// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx -var import_obsidian3 = require("obsidian"); -var import_react168 = __toESM(require_react()); - -// src/adapters/text/removemd.js -function removemd(md, options) { - options = options || {}; - options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false; - options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true; - options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true; - options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true; - options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false; - options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false; - options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : []; - var output = md || ""; - output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*/gm, ""); - try { - if (options.stripListLeaders) { - if (options.listUnicodeChar) - output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1"); - else - output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1"); - } - if (options.gfm) { - output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, ""); - } - if (options.abbr) { - output = output.replace(/\*\[.*\]:.*\n/, ""); - } - output = output.replace(/<[^>]*>/g, ""); - var htmlReplaceRegex = new RegExp("<[^>]*>", "g"); - if (options.htmlTagsToSkip.length > 0) { - var joinedHtmlTagsToSkip = "(?!" + options.htmlTagsToSkip.join("|") + ")"; - htmlReplaceRegex = new RegExp( - "<" + joinedHtmlTagsToSkip + "[^>]*>", - "ig" +// src/core/react/components/SpaceView/Frames/ViewNodes/FrameEditorInstance.tsx +var FrameEditorInstance = (props) => { + const { spaceInfo } = (0, import_react170.useContext)(SpaceContext); + const { undoLastAction, redoAction, frameSchema } = (0, import_react170.useContext)(FramesMDBContext); + const { nodes, addNode, saveNodes, setLastCreatedId } = (0, import_react170.useContext)( + FramesEditorRootContext + ); + const { hoverNode, setHoverNode, instance, id: id3 } = (0, import_react170.useContext)(FrameInstanceContext); + const { selectionMode, selection: selection2, select } = (0, import_react170.useContext)( + FrameSelectionContext + ); + const resetState = () => { + setHoverNode(null); + }; + useDndMonitor({ + onDragOver: ({ active, over }) => { + const overId = over?.data.current.node; + if (over?.data.current.root == id3) { + if (overId) + setHoverNode({ + id: over?.data.current.id, + node: over?.data.current.node, + direction: over?.data.current?.direction + }); + } else { + setHoverNode(null); + } + }, + onDragCancel: () => { + resetState(); + }, + onDragEnd: ({ active, over }) => { + if (!active || !hoverNode) { + resetState(); + return; + } + const overId = hoverNode?.node; + if (overId == active.data.current.id || hoverNode?.id != over.data.current.id) { + resetState(); + return; + } + const overParentNode = findParent(instance.exec, overId); + const overNode = overParentNode?.children.find( + (f2) => f2.id == overId ); + if (active.data.current.type == "node") { + const activeParentNode = findParent( + instance.exec, + active.data.current.node + ); + const activeNode = activeParentNode?.children.find( + (f2) => f2.id == active.data.current.node + ); + if (overNode && activeNode) { + const [newNodes, deleteNodes] = dropFrame( + activeNode.node, + overNode, + instance.exec, + nodes, + hoverNode.direction + ); + saveNodes(newNodes, deleteNodes); + } + } else if (active.data.current.type == "property") { + if (active.data.current.path == spaceInfo.path && overNode) { + const [newNodes, deleteNodes] = dropFrame( + propertyToNode( + active.data.current.property, + active.data.current.context + ), + overNode, + instance.exec, + nodes, + hoverNode.direction + ); + saveNodes(newNodes, deleteNodes); + } + } else if (active.data.current.type == "listItem") { + if (overNode) { + const [newNodes, deleteNodes] = dropFrame( + { + ...flowNode.node, + props: { + value: `'${active.data.current.contexts?.$context?.["_keyValue"]}'` + } + }, + overNode, + instance.exec, + nodes, + hoverNode.direction + ); + saveNodes(newNodes, deleteNodes); + } + } else if (active.data.current.type == "context") { + if (overNode) { + const space3 = props.superstate.spacesIndex.get( + active.data.current.space + ); + if (space3) { + const [newNodes, deleteNodes] = dropFrame( + { + ...contextNode.node, + props: { + value: wrapQuotes( + contextPathForSpace(space3, active.data.current.schema) + ) + } + }, + overNode, + instance.exec, + nodes, + hoverNode.direction + ); + saveNodes(newNodes, deleteNodes); + } + } + } + resetState(); } - output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1"); - } catch (e5) { - console.error(e5); - return md; - } - return output; -} - -// src/adapters/text/textCacher.ts -var regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms; -var textCacheExperimental = { - wordCount: (str) => { - const spaceDelimitedChars = /'’A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source; - const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source; - const nonSpaceDelimitedWordsOther = /[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source; - const pattern = new RegExp( - [ - `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`, - nonSpaceDelimitedWords, - nonSpaceDelimitedWordsOther - ].join("|"), - "g" - ); - return (str.replace(regexYaml, "").match(pattern) || []).length; - }, - preview: (str) => { - return removemd(str.replace(regexYaml, "")); - } -}; -var TextCacher = class { - constructor(plugin) { - this.plugin = plugin; - this.supportedFileTypes = ["md"]; - this.id = "text.make.md"; - this.plugin = plugin; - this.cache = /* @__PURE__ */ new Map(); - } - initiate(middleware) { - this.middleware = middleware; - this.middleware.eventDispatch.addListener("onModify", this.refreshCache.bind(this)); - } - refreshCache(payload) { - if (this.supportedFileTypes.find((type) => type == payload.file.extension)) - this.parseCache(payload.file, true); - } - async parseCache(file, refresh) { - if (!file) - return; - const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)); - const updatedCache = {}; - Object.keys(textCacheExperimental).forEach((key2) => { - const runner = textCacheExperimental[key2]; - updatedCache[key2] = runner(contents); - }); - this.cache.set(file.path, updatedCache); - this.middleware.updateFileCache(file.path, updatedCache, refresh); - } -}; - -// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx -var import_obsidian2 = require("obsidian"); -var import_classnames11 = __toESM(require_classnames()); -var import_react167 = __toESM(require_react()); - -// src/adapters/obsidian/filetypes/frontmatter/frontMatterKeys.ts -var frontMatterKeys = (fm) => { - return Object.keys(fm ?? {}).filter((f2) => f2 != "position"); -}; - -// src/adapters/obsidian/ui/editors/markdownView/RemoteMarkdownHeaderView.tsx -var import_react166 = __toESM(require_react()); -var RemoteMarkdownHeaderView = (props) => { - const { name: name317, fm } = props; - const [collapsed, setCollapsed] = (0, import_react166.useState)(false); - const tags3 = fm.tags ?? []; - const [values2, setValues] = (0, import_react166.useState)({}); - const [columns, setColumns] = (0, import_react166.useState)([]); - (0, import_react166.useEffect)(() => { - const newCols = []; - const newValues = {}; - const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); - const cols = fmKeys.map((f2) => ({ - table: "", - name: f2, - schemaId: "", - type: yamlTypeToMDBType(detectPropertyType(fm[f2], f2)) - })); - if (fm) { - newCols.push(...cols); - Object.keys(fm).forEach((c3) => { - newValues[c3] = parseProperty(c3, fm[c3]); - }); + }); + const propertyToNode = (property, context) => { + let node2 = textNode.node; + if (property.type == "boolean") { + node2 = { + ...inputNode.node, + styles: { ...inputNode.node.styles, as: `'checkbox'` } + }; + } else if (property.type == "link" || property.type == "context" || property.type == "file") { + node2 = flowNode.node; + } else if (property.type == "image") { + node2 = imageNode.node; } - setValues(newValues); - setColumns(newCols); - }, []); - const pathState = (0, import_react166.useMemo)( - () => ({ - name: name317, - path: name317, - displayName: name317, - type: "note", - label: { - sticker: fm.sticker, - color: fm.color, - name: name317 - }, - metadata: { - property: { - banner: fm.banner + if (node2.type == "input") { + node2 = { + ...node2, + props: { ...node2.props, value: wrapQuotes(property.name) } + }; + } else { + if (context.length > 0) { + node2 = { + ...node2, + props: { + ...node2.props, + value: `$contexts['${context}']['${property.name}']` + } + }; + } else { + node2 = { + ...node2, + props: { + ...node2.props, + value: `${frameSchema.id}.props['${property.name}']` + } + }; + } + } + return node2; + }; + const handleKeyDown = (0, import_react170.useCallback)( + (e5) => { + if (e5.key == "ArrowUp") { + if (selection2.length > 0) { + const node2 = nodes.find((f2) => f2.id == selection2[0]); + if (node2) { + const parent = findParent(instance.exec, node2.id); + if (parent) { + const index3 = parent.children.find((f2) => f2.id == node2.id).node.rank; + if (index3 > 0) { + select( + parent.children.find((f2) => f2.node.rank == index3 - 1)?.id + ); + } + } + } } } - }), - [fm, name317] + if (e5.key == "ArrowDown") { + if (selection2.length > 0) { + const node2 = nodes.find((f2) => f2.id == selection2[0]); + if (node2) { + const parent = findParent(instance.exec, node2.id); + if (parent) { + const index3 = parent.children.find((f2) => f2.id == node2.id).node.rank; + if (index3 < parent.children.length - 1) { + select( + parent.children.find((f2) => f2.node.rank == index3 + 1)?.id + ); + } + } + } + } + } + if (e5.key == "Delete" || e5.key == "Backspace") { + if (selection2.length > 0) + saveNodes( + [], + selection2.map((f2) => nodes.find((g) => g.id == f2)).filter((f2) => f2) + ); + } + if (e5.key == "z" && e5.metaKey) { + if (e5.shiftKey) { + redoAction(); + } else { + undoLastAction(); + } + } + }, + [selection2, nodes, undoLastAction, redoAction, saveNodes] ); - return /* @__PURE__ */ import_react166.default.createElement(PathProvider, { - superstate: props.superstate, - path: props.name, - pathState, - readMode: true - }, pathState.metadata.property.banner && /* @__PURE__ */ import_react166.default.createElement(BannerView, { - superstate: props.superstate - }), /* @__PURE__ */ import_react166.default.createElement("div", { - className: "mk-path-context-component" - }, /* @__PURE__ */ import_react166.default.createElement("div", { - className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` - }, /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react166.default.createElement("div", { - className: "mk-header-icon" - }, /* @__PURE__ */ import_react166.default.createElement("div", { - className: `mk-path-icon` - }, /* @__PURE__ */ import_react166.default.createElement("div", { - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(fm.sticker) + (0, import_react170.useEffect)(() => { + props.superstate.ui.inputManager.on("keydown", handleKeyDown); + return () => { + props.superstate.ui.inputManager.off("keydown", handleKeyDown); + }; + }, [handleKeyDown]); + return /* @__PURE__ */ import_react170.default.createElement(import_react170.default.Fragment, null, instance.exec && /* @__PURE__ */ import_react170.default.createElement("div", { + className: "mk-f-root", + style: { position: "relative" } + }, selectionMode >= 3 /* Group */ && /* @__PURE__ */ import_react170.default.createElement("div", { + className: "mk-f-root-label", + onClick: (e5) => { + select(instance.exec.id); + e5.stopPropagation(); } - }))) : /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null), /* @__PURE__ */ import_react166.default.createElement("div", { - className: "mk-inline-title inline-title" - }, pathNameToString(name317))))), !collapsed ? /* @__PURE__ */ import_react166.default.createElement("div", { - className: "mk-path-context-component" - }, /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null, /* @__PURE__ */ import_react166.default.createElement("div", { - className: "mk-path-context-section" - }, columns.map((f2, i4) => /* @__PURE__ */ import_react166.default.createElement(DataPropertyView, { - key: i4, + }, instance.exec.node.name), /* @__PURE__ */ import_react170.default.createElement(FrameEditorNodeView, { + key: spaceInfo.path, superstate: props.superstate, - initialValue: values2[f2.name], - row: {}, - column: { ...f2, table: "" }, - editMode: 2 /* EditModeView */, - updateValue: () => { - }, - updateFieldValue: (fieldValue, value) => { - }, - contextTable: {} - }))))) : /* @__PURE__ */ import_react166.default.createElement(import_react166.default.Fragment, null)); + treeNode: instance.exec, + instance, + containerRef: props.containerRef + }, props.children), instance.exec.children.length == 0 && /* @__PURE__ */ import_react170.default.createElement(NewNodeView, { + superstate: props.superstate, + treeNode: null, + state: null + }))); }; -// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx -var FileLinkViewComponent = (props) => { - const ref2 = (0, import_react167.useRef)(null); - const [markdown, setMarkdown] = (0, import_react167.useState)(""); - const [fm, setFM] = (0, import_react167.useState)({}); - (0, import_react167.useEffect)(() => { - if (ref2.current) { - import_obsidian2.MarkdownRenderer.render( - props.app, - markdown, - ref2.current, - props.path, - props.component - ); - const observer = new MutationObserver(() => { - const links = ref2.current.querySelectorAll("a"); - links.forEach((link) => { - if (link.getAttribute("href").endsWith(".md")) { - link.addEventListener("click", (event) => { - event.preventDefault(); - }); - } - }); - }); - observer.observe(ref2.current, { childList: true, subtree: true }); - return () => observer.disconnect(); - } - }, [markdown]); - (0, import_react167.useEffect)(() => { - fetch(props.path).then((res) => res.text()).then((f2) => { - setMarkdown(f2); - const match2 = f2.match(regexYaml); - if (match2) { - const yamlContent = match2[1]; - setFM((0, import_obsidian2.parseYaml)(yamlContent)); +// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListInstance.tsx +var ContextListInstance = (props) => { + const [contexts, setContexts] = (0, import_react171.useState)(props.contexts); + (0, import_react171.useEffect)( + () => setContexts((p2) => import_lodash18.default.isEqual(props.contexts, p2) ? p2 : props.contexts), + [props.contexts] + ); + const { spaceInfo } = (0, import_react171.useContext)(SpaceContext); + const { dbSchema } = (0, import_react171.useContext)(ContextEditorContext); + const { setDragNode } = (0, import_react171.useContext)(WindowContext); + const ref2 = import_react171.default.useRef(null); + const { + attributes, + listeners, + active, + setNodeRef: setDraggableNodeRef, + transform, + isDragging, + transition, + isOver, + over + } = useSortable({ + id: props.id, + data: { + id: props.id, + type: props.type, + space: spaceInfo?.path, + schema: dbSchema?.id, + props: props.props, + contexts + }, + disabled: props.type != "listItem" || props.editMode > 0 /* Read */, + animateLayoutChanges: defaultAnimateLayoutChanges + }); + useDndMonitor({ + onDragStart: (e5) => { + if (e5.active.data.current.id == props.id) { + setDragNode( + /* @__PURE__ */ import_react171.default.createElement("div", { + dangerouslySetInnerHTML: { __html: ref2.current.innerHTML } + }) + ); } - }); - }, [props.path]); - return /* @__PURE__ */ import_react167.default.createElement("div", { - className: (0, import_classnames11.default)( - "markdown-preview-view markdown-rendered node-insert-event allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter", - props.superstate.settings.readableLineWidth ? "is-readable-line-width" : "" - ) - }, /* @__PURE__ */ import_react167.default.createElement("div", { - className: "mk-remote-header" - }, /* @__PURE__ */ import_react167.default.createElement(RemoteMarkdownHeaderView, { + }, + onDragOver: (over2) => { + }, + onDragEnd: ({ active: active2, over: over2 }) => { + const dragReorder = over2 && over2.data.current.space == spaceInfo?.path && over2.data.current.schema == dbSchema?.id; + dropListItem(dragReorder, over2, props, active2, spaceInfo); + } + }); + return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react171.default.createElement(FrameSelectionProvider, { superstate: props.superstate, - name: "Release Notes", - fm - })), /* @__PURE__ */ import_react167.default.createElement("div", { - className: "markdown-preview-sizer markdown-preview-section", - ref: ref2 - })); -}; - -// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx -var LINK_VIEW_TYPE = "mk-uri-view"; -var FileLinkView = class extends import_obsidian3.ItemView { - constructor(leaf, app2, viewType, superstate) { - super(leaf); - this.superstate = superstate; - this.navigation = true; - this.app = app2; - this.viewType = viewType; - } - getViewType() { - return LINK_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.constructView(this.path); - const displayName = this.path; - await super.setState(state, result); - this.leaf.tabHeaderInnerTitleEl.innerText = displayName; - this.leaf.view.titleEl = displayName; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = displayName; + id: props.id, + editMode: props.editMode, + selected: props.editMode == 3 /* Group */ + }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, { + id: props.id, + superstate: props.superstate, + props: props.props, + propSetters: props.propSetters, + contexts, + editable: true + }, /* @__PURE__ */ import_react171.default.createElement(FrameEditorInstance, { + superstate: props.superstate, + containerRef: props.containerRef + }, props.children))) : /* @__PURE__ */ import_react171.default.createElement(import_react171.default.Fragment, null, over?.id == props.id && active.data.current.type == props.type && !(active.data.current.space == spaceInfo?.path && active.data.current.schema == dbSchema?.id && active.data.current.props?._groupValue == props.props?._groupValue) && /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, { + id: props.id, + superstate: props.superstate, + props: props.props, + propSetters: props.propSetters, + contexts, + editable: false + }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceView, { + superstate: props.superstate + })), /* @__PURE__ */ import_react171.default.createElement("div", { + ref: (el) => { + setDraggableNodeRef(el); + ref2.current = el; + }, + ...attributes, + ...listeners, + style: { + transform: CSS.Transform.toString(transform), + transition } - result.history = true; - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - return state; - } - constructView(path2) { - this.destroy(); - this.root = this.superstate.ui.createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ import_react168.default.createElement("div", { - className: "markdown-reading-view" - }, /* @__PURE__ */ import_react168.default.createElement(FileLinkViewComponent, { - superstate: this.superstate, - path: path2, - app: this.app, - component: this - })) - ); - } -}; - -// src/adapters/obsidian/utils/file.ts -var import_obsidian6 = require("obsidian"); - -// src/core/react/components/System/SystemSettings.tsx -var import_react174 = __toESM(require_react()); - -// src/core/assets/icons.ts -var uiIconSet = { - "rows": ``, - "close": ` - - `, - "flow-hover": ` - - `, - "folder": ` - - `, - "open-link": ` - - `, - "file": ` - - `, - "expand": ` - - `, - "json": ``, - "new-folder": ``, - "new-note": ``, - "collapse": ` - - `, - "options": ` - - `, - "plus": ` - - - `, - "collapse-solid": ` - - `, - "search": ` - - - `, - "view-options": ` - - - `, - "clear": ` - - - `, - "new-file": ` - - - `, - "blink": ` - - - - - `, - "spaces": ` - - `, - "home": ` - - `, - "tags": ``, - "handle": ` - - - - - - - - `, - "props": ` - - - - - `, - "new-space": ` - - - `, - "file-solid": ` - - - - `, - "folder-solid": ` - - - `, - "sync": ` - - - `, - "stack": ` - - - `, - "cut": ` - - - `, - "backlink": ` - - - `, - "canvas": ` - - - - - - `, - "video": ` - - - `, - "edit": ` - - - `, - "list": ` - - - - `, - "build": ` - - - `, - "check": ` - - - `, - "layout": ` - - - `, - "colors": ` - - - `, - "mk-make-todo": ` - - - - `, - "mk-make-list": ` - - - - - - - - `, - "mk-make-ordered": ` - - - - - - - - `, - "mk-make-h1": ` - - - - `, - "mk-make-h2": ` - - - - `, - "mk-make-h3": ` - - - - `, - "mk-make-quote": ` - - - - - - `, - "mk-make-hr": ` - - - `, - "mk-make-link": ` - - - `, - "mk-make-image": ` - - - - - - `, - "mk-make-codeblock": ` - - - - - `, - "mk-make-callout": ` - - - - `, - "mk-make-note": ` - - - - - - `, - "mk-make-flow": ` - - - `, - "mk-make-tag": ` - - - `, - "callout": ``, - "mk-make-table": ` - - - - - `, - "mk-make-date": ` - - - `, - "mk-make-indent": ` - - - - - - - `, - "mk-make-unindent": ` - - - - - - `, - "mk-mark-strong": ` - - - `, - "mk-mark-em": ` - - `, - "mk-mark-strikethrough": ` - - - - `, - "mk-mark-code": ` - - - - - `, - "mk-mark-link": ` - - `, - "mk-mark-blocklink": ` - - - - - `, - "mk-mark-highlight": ` - - - - - - `, - "mk-make-attach": ` - - - - - `, - "mk-make-keyboard": ` - - - - `, - "mk-make-slash": ` - - - - `, - "mk-make-style": ` - - `, - "mk-mark-color": ` - - - `, - "any": ` - - - `, - "all": ` - - - - `, - "context": ` - - - - - - `, - "full-width": ``, - "file-stack": ``, - "layout-panel-left": ``, - "align-center": ` - - -`, - "align-left": ` - - -`, - "align-right": ` - - -`, - "arrow-down": ` - - -`, - "arrow-left": ` - - -`, - "arrow-right": ` - - -`, - "arrow-up-down": ` - - -`, - "arrow-up-right": ` - - -`, - "baseline": ` - - -`, - "binary": ` - - -`, - "bold": ` - - -`, - "book-open": ` - - -`, - "box-select": ` - - -`, - "brush": ` - - -`, - "calendar": ` - - -`, - "case-insensitive": ` - - -`, - "check-square": ` - - - -`, - "chevron-left": ` - - -`, - "chevron-right": ` - - -`, - "chevrons-down-up": ` - - -`, - "chevrons-up-down": ` - - -`, - "clock": ` - - - -`, - "code": ` - - -`, - "columns": ` - - -`, - "combine": ` - - - -`, - "copy-check": ` - - - - -`, - "copy-x": ` - - - -`, - "copy": ` - - - -`, - "documents": ` - - - - -`, - "edit-3": ` - - -`, - "eye-off": ` - - - -`, - "eye": ` - - - -`, - "file-minus": ` - - - -`, - "file-plus-2": ` - - - -`, - "file-question": ` - - - -`, - "file-search": ` - - - -`, - "file-text": ` - - - -`, - "filter": ` - - -`, - "fold-horizontal": ` - - -`, - "fold-vertical": ` - - -`, - "folder-plus": ` - - -`, - "gallery-horizontal-end": ` - - -`, - "gem": ` - - - -`, - "go-to-file": ` - - - -`, - "heading-1": ` - - -`, - "heading-2": ` - - -`, - "heading-3": ` - - -`, - "heading-4": ` - - -`, - "heading-5": ` - - -`, - "heading-6": ` - - - -`, - "help-circle": ` - - - -`, - "image": ` - - - -`, - "infinity": ` - - -`, - "input": ` - - -`, - "italic": ` - - -`, - "justify": ` - - -`, - "layout-dashboard": ` - - -`, - "grid": ``, - "layout-grid": ` - - -`, - "layout-list": ` - - -`, - "lightbulb": ` - - -`, - "link": ` - - - -`, - "links-coming-in": ` - - - -`, - "links-going-out": ` - - - -`, - "list-tree": ` - - - -`, - "minus": ``, - "mouse-pointer-click": ` - - -`, - "paintbrush": ` - - - -`, - "palette": ` - - - -`, - "panel-top-close": ` - - - -`, - "paper-plane": ` - - -`, - "pie-chart": ` - - - -`, - "pin-off": ` - - -`, - "pin": ` - - -`, - "plug": ` - - -`, - "scaling": ` - - - -`, - "settings": ` - - - -`, - "smile": ` - - - -`, - "sort-asc": ` - - -`, - "sort-desc": ` - - -`, - "star": ` - - -`, - "sticker": ` - - - -`, - "text": ``, - "table-2": ` - - -`, - "table": ` - - -`, - "trash": ` - - -`, - "type": ` - - -`, - "underline": ` - - -`, - "unfold-horizontal": ` - - -`, - "unfold-vertical": ` - - -`, - "unplug": ` - - -`, - "wrap-text": ` - - - -`, - "x-square": ` - - -`, - "zap": ` - - -`, - "vault": ``, - "mk-logo": ``, - "package-plus": ``, - "square-kanban": ``, - "formula": ``, - "clipboard-pen": ``, - "clipboard-add": ``, - "live": ``, - "insert": ``, - "tabs": `` + }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, { + id: props.id, + superstate: props.superstate, + props: props.props, + propSetters: props.propSetters, + contexts, + editable: false + }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceView, { + superstate: props.superstate + }, props.children)))); }; - -// src/core/react/components/System/IconsSet.tsx -var import_react169 = __toESM(require_react()); -var IconSet = (props) => { - const [iconSets, setIconSets] = import_react169.default.useState([]); - const [icons, setIcons] = import_react169.default.useState([]); - (0, import_react169.useEffect)(() => { - Object.keys(uiIconSet).filter((f2, i4) => i4 < 10).forEach((icon) => { - setIcons((f2) => [...f2, "ui//" + icon]); - }); - }, []); - return /* @__PURE__ */ import_react169.default.createElement("div", null, /* @__PURE__ */ import_react169.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react169.default.createElement("div", { - key: i4, - className: "mk-icon-small", - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(c3) +var dropListItem = async (dragReorder, over, props, active, spaceInfo) => { + if (dragReorder && over.id == props.id) { + if (active.data.current.schema == defaultContextSchemaID) { + const activePath = active.data.current.contexts?.$context?.["_keyValue"]; + const context = over.data.current.contexts?.$context; + const groupValueMismatch = props.props?._groupValue != active.data.current.props?._groupValue; + if (activePath && context) { + if (groupValueMismatch) { + { + saveProperties(props.superstate, activePath, { + [props.props?._groupField]: props.props?._groupValue + }); + } + } else { + updatePathRankInSpace( + props.superstate, + activePath, + context._index, + spaceInfo.path + ); + } + } + } else { + const context = over.data.current.contexts?.$context; + updateTableValue( + props.superstate.spaceManager, + spaceInfo, + active.data.current.schema, + active.data.current.contexts?.$context?.["_index"], + props.props?._groupField, + props.props?._groupValue, + context?._index + ); } - })))); + } }; -// src/core/react/components/System/ImageSet.tsx -var import_react170 = __toESM(require_react()); -var ImageSet = (props) => { - const [images, setImages] = import_react170.default.useState([]); - const [currentSet, setCurrentSet] = import_react170.default.useState(null); - const addImage = (image) => { - setImages([...images, image]); - }; - return /* @__PURE__ */ import_react170.default.createElement("div", null); +// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx +var import_react173 = __toESM(require_react()); + +// src/core/react/components/SpaceView/Contexts/ContextBuilder/FrameContainerView.tsx +var import_react172 = __toESM(require_react()); +var FrameContainerView = (props) => { + const { selected: _selected } = (0, import_react172.useContext)(FrameSelectionContext); + return props.editMode >= 1 /* Page */ && props.uri.authority != "$kit" ? /* @__PURE__ */ import_react172.default.createElement(FramesMDBProvider, { + superstate: props.superstate, + schema: props.uri.ref + }, /* @__PURE__ */ import_react172.default.createElement(FrameEditorProvider, { + superstate: props.superstate, + cols: props.cols, + editMode: props.editMode + }, props.children)) : /* @__PURE__ */ import_react172.default.createElement(FrameRootProvider, { + superstate: props.superstate, + path: props.uri, + cols: props.cols + }, props.children); }; -// src/core/react/components/System/MaterialsSet.tsx -var import_react171 = __toESM(require_react()); -var MaterialsSet = (props) => { - const [materials, setMaterials] = import_react171.default.useState([]); - return /* @__PURE__ */ import_react171.default.createElement("div", null, /* @__PURE__ */ import_react171.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react171.default.createElement("div", { - key: i4, - "aria-label": c3[0], - onMouseDown: () => { - }, - className: "mk-color", - style: { background: c3[1] } - })), /* @__PURE__ */ import_react171.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react171.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react171.default.createElement("div", { - key: i4, - "aria-label": c3[0], - onMouseDown: () => { +// src/core/react/components/SpaceView/Contexts/ContextBuilder/ContextListView.tsx +var ContextListView = (props) => { + const { editSection, selectedIndex, setSelectedIndex, groupURI, itemURI } = props; + const { spaceInfo } = (0, import_react173.useContext)(SpaceContext); + const { + predicate, + filteredData: data3, + editMode, + sortedColumns, + contextTable, + cols, + dbSchema + } = (0, import_react173.useContext)(ContextEditorContext); + const { instance } = (0, import_react173.useContext)(FrameInstanceContext); + const groupBy2 = predicate?.groupBy?.length > 0 ? cols.find((f2) => f2.name + f2.table == predicate.groupBy[0]) : null; + const groupByOptions = (0, import_react173.useMemo)(() => { + const groupByOptions2 = instance?.state[instance?.root?.id].props?.groupOptions; + if (groupByOptions2) + return ensureArray(groupByOptions2); + if (!groupBy2) + return [""]; + const options = uniq([ + "", + ...(parseFieldValue(groupBy2.value, groupBy2.type, props.superstate)?.options ?? []).map((f2) => f2.value), + ...data3.reduce( + (p2, c3) => [...p2, c3[groupBy2.name + groupBy2.table] ?? ""], + [] + ) + ]); + return options; + }, [groupBy2, data3, instance]); + const groupByFilter = (0, import_react173.useMemo)(() => { + const filter4 = instance?.state[instance?.root?.id].props?.groupFilter; + return filterFnTypes[filter4] ?? filterFnTypes.is; + }, [instance]); + const items = (0, import_react173.useMemo)(() => { + return groupByOptions.reduce((p2, c3) => { + if (!groupBy2) { + return c3 == "" ? { + ...p2, + [c3]: data3 ?? [] + } : { + ...p2, + [c3]: [] + }; + } + const newItems = data3.filter((r2) => { + return groupByFilter.fn(r2[groupBy2.name + groupBy2.table], c3); + }); + return newItems.length > 0 ? { + ...p2, + [c3]: newItems + } : { + ...p2, + [c3]: [] + }; + }, {}); + }, [data3, groupByOptions, groupByFilter, groupBy2]); + const primaryKey = (0, import_react173.useMemo)(() => { + return cols.find((f2) => f2.primary == "true")?.name; + }, [cols]); + const visibleCols = (0, import_react173.useMemo)(() => { + return sortedColumns.filter((f2) => !predicate?.colsHidden.includes(f2.name)); + }, [predicate, sortedColumns]); + const context = { + _path: spaceInfo?.path, + _schema: dbSchema?.id, + _key: primaryKey, + _properties: visibleCols + }; + const contextMap = (0, import_react173.useMemo)(() => { + return dbSchema?.primary == "true" ? data3.reduce((p2, c3) => { + return { + ...p2, + [c3["_index"]]: { + $context: { + _index: c3["_index"], + _keyValue: c3[primaryKey], + _schema: dbSchema.id, + _name: props.superstate.pathsIndex.get(c3[primaryKey])?.name, + ...context + }, + $properties: cols, + [spaceInfo.path]: cols.reduce((a4, b2) => { + return { + ...a4, + [b2.name]: c3[b2.name] + }; + }, {}), + ...Object.keys(contextTable).reduce((d4, e5) => { + return { + ...d4, + [e5]: contextTable[e5].cols.reduce((a4, b2) => { + return { + ...a4, + [b2.name]: c3[b2.name + e5] + }; + }, {}) + }; + }, {}) + } + }; + }, {}) : data3.reduce((p2, c3) => { + return { + ...p2, + [c3["_index"]]: { + $context: { + _index: c3["_index"], + _keyValue: c3[primaryKey], + _schema: dbSchema.id, + _name: c3[primaryKey], + ...context + }, + $properties: cols, + [spaceInfo.path]: cols.reduce((a4, b2) => { + return { + ...a4, + [b2.name]: c3[b2.name] + }; + }, {}) + } + }; + }, {}); + }, [data3, cols, contextTable]); + return /* @__PURE__ */ import_react173.default.createElement(FrameContainerView, { + superstate: props.superstate, + uri: groupURI, + editMode: editSection == "listGroup" ? editMode : 0 /* Read */, + cols: [] + }, /* @__PURE__ */ import_react173.default.createElement(SortableContext, { + items: Object.keys(items).map( + (f2, i4) => spaceInfo.path + "listGroup" + i4 + ), + strategy: rectSortingStrategy + }, Object.keys(items).map((c3, i4) => /* @__PURE__ */ import_react173.default.createElement(ContextListInstance, { + key: "listGroup" + i4, + id: spaceInfo.path + "listGroup" + i4, + type: "listGroup", + superstate: props.superstate, + uri: groupURI, + props: { + _selectedIndex: selectedIndex, + _groupValue: c3, + _groupField: groupBy2?.name, + _groupType: groupBy2?.type, + ...predicate.listGroupProps }, - className: "mk-color", - style: { background: c3[1] } - })))); + propSetters: null, + editMode: editSection == "listGroup" ? editMode : 0 /* Read */, + cols: [], + containerRef: props.containerRef, + contexts: { $context: context } + }, /* @__PURE__ */ import_react173.default.createElement(FrameContainerView, { + uri: itemURI, + superstate: props.superstate, + cols: [], + editMode: editSection == "listItem" ? editMode : 0 /* Read */ + }, /* @__PURE__ */ import_react173.default.createElement(SortableContext, { + items: items[c3].flatMap( + (f2, k2) => spaceInfo.path + "listGroup" + i4 + "_listItem" + k2 + ), + strategy: rectSortingStrategy + }, items[c3].map((f2, j) => { + return /* @__PURE__ */ import_react173.default.createElement(ContextListInstance, { + key: "listGroup" + i4 + "_listItem" + j, + id: spaceInfo.path + "listGroup" + i4 + "_listItem" + j, + type: "listItem", + uri: itemURI, + superstate: props.superstate, + cols: [], + props: { + _selectedIndex: selectedIndex, + _groupValue: c3, + _groupField: groupBy2?.name, + ...predicate.listItemProps + }, + propSetters: { + _selectedIndex: setSelectedIndex + }, + containerRef: props.containerRef, + editMode: editSection == "listItem" ? editMode : 0 /* Read */, + contexts: contextMap[f2["_index"]] + }); + }))))))); }; -// src/core/react/components/System/SystemActions.tsx -var import_react172 = __toESM(require_react()); -var SystemActionsEditor = (props) => { - const [selectedCommand, setSelectedCommand] = (0, import_react172.useState)(); - const saveCommand = (command) => { - props.superstate.spaceManager.saveSystemCommand( - selectedCommand.library, - command - ); - }; - const addLibrary = () => { - props.superstate.spaceManager.saveSystemCommand( - selectedCommand.library, - null - ); - }; - return /* @__PURE__ */ import_react172.default.createElement("div", { - style: { display: "flex" } - }, selectedCommand && /* @__PURE__ */ import_react172.default.createElement("div", null, /* @__PURE__ */ import_react172.default.createElement(SpaceCommand, { +// src/core/react/components/SpaceView/Contexts/ContextListContainer.tsx +var ContextListContainer = (props) => { + const { predicate, editMode, setEditMode, dbSchema } = (0, import_react174.useContext)(ContextEditorContext); + const { frameSchema } = (0, import_react174.useContext)(FramesMDBContext); + const [editSection, setEditSection] = (0, import_react174.useState)(null); + const [selectedIndex, setSelectedIndex] = (0, import_react174.useState)(null); + const [uris, setURIs] = (0, import_react174.useState)( + predicate ? { + listView: props.superstate.spaceManager.uriByString( + initiateString(predicate.listView, "spaces://$kit/#*listView") + ), + listGroup: props.superstate.spaceManager.uriByString( + initiateString(predicate.listGroup, "spaces://$kit/#*listGroup") + ), + listItem: props.superstate.spaceManager.uriByString( + initiateString(predicate.listItem, "spaces://$kit/#*rowItem") + ) + } : null + ); + (0, import_react174.useEffect)(() => { + if (!predicate) + return; + const newURIs = { + listView: props.superstate.spaceManager.uriByString( + initiateString(predicate.listView, "spaces://$kit/#*listView") + ), + listGroup: props.superstate.spaceManager.uriByString( + initiateString(predicate.listGroup, "spaces://$kit/#*listGroup") + ), + listItem: props.superstate.spaceManager.uriByString( + initiateString(predicate.listItem, "spaces://$kit/#*rowItem") + ) + }; + setURIs((p2) => !import_lodash19.default.isEqual(newURIs, p2) ? newURIs : p2); + }, [predicate]); + return /* @__PURE__ */ import_react174.default.createElement("div", { + className: "mk-context-container" + }, !props.minMode && /* @__PURE__ */ import_react174.default.createElement(FilterBar, { superstate: props.superstate, - action: "spaces://$actions/" + selectedCommand.library + "/#;" + selectedCommand.command.schema.id - }))); + setView: props.setView + }), uris ? predicate.view == "table" || predicate.view == "db" || dbSchema?.primary != "true" && !frameSchema ? /* @__PURE__ */ import_react174.default.createElement(TableView, { + superstate: props.superstate + }) : /* @__PURE__ */ import_react174.default.createElement("div", { + className: "mk-editor-context" + }, /* @__PURE__ */ import_react174.default.createElement(FrameSelectionProvider, { + superstate: props.superstate, + id: "list", + editMode: editSection == "listView" ? editMode : 0 /* Read */ + }, editMode > 0 && /* @__PURE__ */ import_react174.default.createElement(ContextListEditSelector, { + editSection, + superstate: props.superstate, + setEditSection, + setEditMode + }), /* @__PURE__ */ import_react174.default.createElement(FrameContainerView, { + superstate: props.superstate, + uri: uris.listView, + cols: [], + editMode: editSection == "listView" ? editMode : 0 /* Read */ + }, /* @__PURE__ */ import_react174.default.createElement(ContextListInstance, { + superstate: props.superstate, + id: "listView", + type: "listView", + uri: uris.listView, + props: { + _selectedIndex: selectedIndex, + ...predicate.listViewProps + }, + propSetters: { _selectedIndex: setSelectedIndex }, + containerRef: props.containerRef, + editMode: editSection == "listView" ? editMode : 0 /* Read */, + cols: [], + contexts: null + }, /* @__PURE__ */ import_react174.default.createElement(ContextListView, { + superstate: props.superstate, + containerRef: props.containerRef, + editSection, + selectedIndex, + setSelectedIndex, + groupURI: uris.listGroup, + itemURI: uris.listItem + }))))) : /* @__PURE__ */ import_react174.default.createElement(import_react174.default.Fragment, null)); }; -// src/core/react/components/System/Templates.tsx -var import_react173 = __toESM(require_react()); -var Templates = (props) => { - return /* @__PURE__ */ import_react173.default.createElement("div", null, /* @__PURE__ */ import_react173.default.createElement("h1", null, "Templates")); +// src/core/react/components/MDBView/MDBViewer.tsx +var MDBViewer = (props) => { + return /* @__PURE__ */ import_react175.default.createElement(PathProvider, { + superstate: props.superstate, + path: props.space.path, + readMode: false + }, /* @__PURE__ */ import_react175.default.createElement(SpaceProvider, { + superstate: props.superstate + }, /* @__PURE__ */ import_react175.default.createElement(FramesMDBProvider, { + superstate: props.superstate, + schema: props.schema + }, /* @__PURE__ */ import_react175.default.createElement(ContextEditorProvider, { + superstate: props.superstate + }, /* @__PURE__ */ import_react175.default.createElement(ContextListContainer, { + superstate: props.superstate + }))))); }; -// src/core/react/components/System/SystemSettings.tsx -var SystemSettings = (props) => { - const [tab, setTab] = (0, import_react174.useState)(0); - const [loadout, setLoadOut] = (0, import_react174.useState)(); - const loadouts = props.superstate.loadouts; - return /* @__PURE__ */ import_react174.default.createElement("div", null, /* @__PURE__ */ import_react174.default.createElement("div", { - style: { display: "flex", flexDirection: "column" } - }, "System Name", /* @__PURE__ */ import_react174.default.createElement("input", { - value: props.superstate.settings.systemName, - onChange: (e5) => { - props.superstate.settings.systemName = e5.target.value; +// src/core/react/components/MarkdownEditor/Backlinks.tsx +var import_react176 = __toESM(require_react()); +var BacklinkItem = (props) => { + const [block, setBlock] = (0, import_react176.useState)([null, null]); + const refreshBlock = (path3) => { + const fCache = props.superstate.pathsIndex.get(path3); + const link3 = [ + ...fCache.metadata.links ?? [], + ...fCache.metadata.embeds ?? [] + ].find((f2) => props.source.includes(f2.displayText)); + if (link3) { + const block2 = fCache.metadata.sections.find( + (f2) => f2.position.start.offset <= link3.position.start.offset && f2.position.end.offset >= link3.position.end.offset + ); + setBlock([ + Math.max(1, block2.position.start.line), + Math.max(block2.position.start.line + 1, block2.position.end.line + 1) + ]); + } else { + setBlock([null, null]); } - }), /* @__PURE__ */ import_react174.default.createElement("div", null, /* @__PURE__ */ import_react174.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react174.default.createElement("div", { - key: i4, - onClick: () => { - setLoadOut(l2); + }; + (0, import_react176.useEffect)(() => { + refreshBlock(props.path); + }, []); + (0, import_react176.useEffect)(() => { + refreshBlock(props.path); + }, [props.path]); + const [collapsed, setCollapsed] = (0, import_react176.useState)(false); + return /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null, /* @__PURE__ */ import_react176.default.createElement("div", { + className: "mk-path-context-title" + }, /* @__PURE__ */ import_react176.default.createElement(CollapseToggle, { + superstate: props.superstate, + collapsed, + onToggle: (c3) => setCollapsed(c3) + }), /* @__PURE__ */ import_react176.default.createElement("div", { + onClick: (e5) => { + props.superstate.ui.openPath(props.path, false); + e5.stopPropagation(); } - }, l2.name)), /* @__PURE__ */ import_react174.default.createElement("button", { - dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker("ui//plus") + }, pathNameToString(props.path))), !collapsed ? /* @__PURE__ */ import_react176.default.createElement("div", { + className: "mk-path-context-backlink" + }, /* @__PURE__ */ import_react176.default.createElement(NoteView, { + load: true, + superstate: props.superstate, + path: props.path, + properties: { from: block[0], to: block[1] }, + classname: "mk-path-context-flow" + })) : /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null)); +}; +var Backlinks = (props) => { + const [collapsed, setCollapsed] = (0, import_react176.useState)( + !props.superstate.settings.inlineBacklinksExpanded + ); + const [backlinks, setBacklinks] = (0, import_react176.useState)([]); + (0, import_react176.useEffect)(() => { + if (!props.path) + return; + Promise.all( + uniq([...props.superstate.linksMap.getInverse(props.path)]).map( + (f2) => props.superstate.spaceManager.pathExists(f2) ? f2 : null + ) + ).then((bls) => setBacklinks(bls.filter((f2) => f2))); + }, [props.path]); + (0, import_react176.useEffect)(() => { + props.superstate.settings.inlineBacklinksExpanded = !collapsed; + props.superstate.saveSettings(); + }, [collapsed]); + const toggleBacklinks = () => { + setCollapsed(!collapsed); + }; + (0, import_react176.useEffect)(() => { + window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + return () => { + window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + }; + }, [collapsed]); + return backlinks.length > 0 && props.path ? /* @__PURE__ */ import_react176.default.createElement("div", { + className: "mk-path-context-component mk-note-footer" + }, /* @__PURE__ */ import_react176.default.createElement("div", { + className: "mk-path-context-section" + }, /* @__PURE__ */ import_react176.default.createElement("div", { + onClick: (e5) => { + setCollapsed(!collapsed); + e5.stopPropagation(); }, - onClick: () => props.superstate.ui.openModal( - "New Loadout", - (_props) => /* @__PURE__ */ import_react174.default.createElement(InputModal, { - value: "", - saveLabel: "Save", - hide: _props.hide, - saveValue: (label) => { - setLoadOut({ - name: label - }); - } - }) - ) - })), /* @__PURE__ */ import_react174.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react174.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react174.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react174.default.createElement(MaterialsSet, { - superstate: props.superstate - }), "Icons", /* @__PURE__ */ import_react174.default.createElement(IconSet, { - superstate: props.superstate - }), "Images", /* @__PURE__ */ import_react174.default.createElement(ImageSet, { - superstate: props.superstate - }), /* @__PURE__ */ import_react174.default.createElement(Templates, { - superstate: props.superstate - }), /* @__PURE__ */ import_react174.default.createElement(SystemActionsEditor, { - superstate: props.superstate - }))); + className: "mk-path-context-title" + }, /* @__PURE__ */ import_react176.default.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//backlink") + } + }), i18n_default.labels.backlinks, /* @__PURE__ */ import_react176.default.createElement(CollapseToggleSmall, { + superstate: props.superstate, + collapsed, + onToggle: () => null + })), /* @__PURE__ */ import_react176.default.createElement("div", null, !collapsed && backlinks.map((f2, i4) => /* @__PURE__ */ import_react176.default.createElement(BacklinkItem, { + path: f2, + key: i4, + superstate: props.superstate, + source: props.path + }))))) : /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null); }; -// src/adapters/obsidian/SpaceViewContainer.tsx -var import_obsidian4 = require("obsidian"); +// src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx var import_react177 = __toESM(require_react()); - -// src/core/react/components/SpaceView/SpaceHeader.tsx -var import_react175 = __toESM(require_react()); -var SpaceHeader = (props) => { - const { readMode } = (0, import_react175.useContext)(PathContext); - const { spaceState } = (0, import_react175.useContext)(SpaceContext); - const [collapsed, setCollapsed] = (0, import_react175.useState)( +var MarkdownHeaderView = (props) => { + const { pathState } = (0, import_react177.useContext)(PathContext); + const [collapsed, setCollapsed] = (0, import_react177.useState)( !props.superstate.settings.inlineContextExpanded ); - (0, import_react175.useEffect)(() => { + (0, import_react177.useEffect)(() => { props.superstate.settings.inlineContextExpanded = !collapsed; props.superstate.saveSettings(); }, [collapsed]); - return /* @__PURE__ */ import_react175.default.createElement(import_react175.default.Fragment, null, /* @__PURE__ */ import_react175.default.createElement(BannerView, { + (0, import_react177.useLayoutEffect)(() => { + props.editorView?.requestMeasure(); + }, []); + return pathState && /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement("div", { + className: "mk-path-context-component" + }, /* @__PURE__ */ import_react177.default.createElement("div", { + className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` + }, /* @__PURE__ */ import_react177.default.createElement(BannerView, { superstate: props.superstate - }), /* @__PURE__ */ import_react175.default.createElement("div", { - className: "mk-space-header" - }, /* @__PURE__ */ import_react175.default.createElement("div", { - className: "mk-path-context-label" - }, /* @__PURE__ */ import_react175.default.createElement(TitleComponent, { + }), /* @__PURE__ */ import_react177.default.createElement(TitleComponent, { superstate: props.superstate, - readOnly: readMode - }), /* @__PURE__ */ import_react175.default.createElement("div", { + readOnly: !props.editable + }), /* @__PURE__ */ import_react177.default.createElement("div", { style: { position: "relative" } - }, /* @__PURE__ */ import_react175.default.createElement("div", { + }, /* @__PURE__ */ import_react177.default.createElement("div", { className: "mk-fold" - }, /* @__PURE__ */ import_react175.default.createElement(CollapseToggle, { + }, /* @__PURE__ */ import_react177.default.createElement(CollapseToggle, { superstate: props.superstate, collapsed, onToggle: (c3) => setCollapsed(c3) - })))), !collapsed && spaceState?.type == "folder" && /* @__PURE__ */ import_react175.default.createElement(NoteSpacesBar, { + })))), props.editable && !collapsed && /* @__PURE__ */ import_react177.default.createElement(NoteSpacesBar, { superstate: props.superstate }))); }; -// src/core/react/components/SpaceView/SpaceInner.tsx -var import_react176 = __toESM(require_react()); -var SpaceInner = (props) => { - const ref2 = (0, import_react176.useRef)(null); - const { spaceState } = (0, import_react176.useContext)(SpaceContext); - return /* @__PURE__ */ import_react176.default.createElement(import_react176.default.Fragment, null, /* @__PURE__ */ import_react176.default.createElement(SpaceHeader, { +// src/core/react/components/Navigator/Navigator.tsx +var import_react178 = __toESM(require_react()); +var Navigator = (props) => { + return /* @__PURE__ */ import_react178.default.createElement("div", { + className: "mk-sidebar" + }, /* @__PURE__ */ import_react178.default.createElement(SidebarProvider, { superstate: props.superstate - }), spaceState && /* @__PURE__ */ import_react176.default.createElement(SpaceOuter_default, { - superstate: props.superstate, - ref: ref2 - }, /* @__PURE__ */ import_react176.default.createElement(FrameEditorInstance, { - containerRef: ref2, + }, /* @__PURE__ */ import_react178.default.createElement(MainList, { superstate: props.superstate }))); }; -// src/adapters/obsidian/SpaceViewContainer.tsx -var SPACE_VIEW_TYPE = "mk-space"; -var SpaceViewContainer = class extends import_obsidian4.ItemView { - constructor(leaf, superstate, ObsidianUI2, viewType) { - super(leaf); - this.navigation = true; - this.superstate = superstate; - this.viewType = viewType; - this.ui = ObsidianUI2; - } - getViewType() { - return SPACE_VIEW_TYPE; - } - getDisplayText() { - return pathDisplayName(this.path, this.superstate); - } - async onClose() { - this.destroy(); - } - destroy() { - this.superstate.eventsDispatcher.removeListener( - "spaceChanged", - this.changePath - ); - this.superstate.eventsDispatcher.removeListener( - "spaceDeleted", - this.closePath - ); - this.root?.unmount(); - } - async onOpen() { - this.destroy(); - } - changePath(payload) { - if (this.path == payload.path) { - this.leaf.setViewState({ - type: SPACE_VIEW_TYPE, - state: { path: payload.newPath } - }); - } - } - closePath(payload) { - if (this?.path == payload.path) { - this.leaf.setViewState({ - type: null - }); - } - } - async setState(state, result) { - this.path = state.path; - if (!this.path) - return; - this.constructNote(this.path); - const displayName = pathDisplayName(this.path, this.superstate); - const spaceCache = this.superstate.spacesIndex.get(this.path); - await super.setState(state, result); - this.leaf.tabHeaderInnerTitleEl.innerText = displayName; - this.leaf.view.titleEl = displayName; - const headerEl = this.leaf.view.headerEl; - if (headerEl && spaceCache) { - headerEl.querySelector(".view-header-title").innerText = displayName; - if (spaceCache.type == "folder") { - const titleParent = headerEl.querySelector(".view-header-title-parent"); - titleParent.innerHTML = ""; - const parentPaths = getParentFolderPaths(spaceCache.path); - if (titleParent) { - parentPaths.forEach((f2) => { - const breadcrumb = titleParent.createEl("span"); - breadcrumb.addClass("view-header-breadcrumb"); - breadcrumb.innerText = folderPathToString(f2); - breadcrumb.addEventListener( - "click", - () => this.superstate.ui.openPath(f2, false) - ); - const breadcrumbSeparator = titleParent.createEl("span"); - breadcrumbSeparator.addClass("view-header-breadcrumb-separator"); - breadcrumbSeparator.innerText = "/"; - }); - } - } - } - result.history = true; - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - return state; - } - constructNote(path2) { - this.destroy(); - this.superstate.eventsDispatcher.addListener( - "spaceChanged", - this.changePath, - 0, - this - ); - this.superstate.eventsDispatcher.addListener( - "spaceDeleted", - this.closePath, - 0, - this - ); - this.root = this.ui.createRoot(this.contentEl); - if (this.root) { - this.root.render( - /* @__PURE__ */ import_react177.default.createElement("div", { - className: "mk-space-view" - }, path2 == "spaces://$settings" ? /* @__PURE__ */ import_react177.default.createElement(SystemSettings, { - superstate: this.superstate - }) : /* @__PURE__ */ import_react177.default.createElement(SpaceView, { - path: path2, - superstate: this.superstate, - key: path2, - readOnly: false - }, /* @__PURE__ */ import_react177.default.createElement("div", { - className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width" - }, /* @__PURE__ */ import_react177.default.createElement(SpaceInner, { - superstate: this.superstate - })))) - ); - } else { - this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => { - this.constructNote(path2); - }); - } - } -}; - -// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx -var import_obsidian5 = require("obsidian"); -var import_react178 = __toESM(require_react()); -var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment"; -var SpaceFragmentView = class extends import_obsidian5.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - } - getViewType() { - return SPACE_FRAGMENT_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - onunload() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.source = state.source; - this.constructInlineContext(); - await super.setState(state, result); - const title = pathDisplayName(this.path, this.plugin.superstate); - this.leaf.tabHeaderInnerTitleEl.innerText = title; - this.leaf.view.titleEl = title; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = title; - } - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - state.source = this.source; - return state; - } - constructInlineContext() { - this.destroy(); - this.root = this.plugin.ui.createRoot(this.contentEl); - if (this.root) { - this.root.render( - /* @__PURE__ */ import_react178.default.createElement(SpaceFragmentWrapper, { - superstate: this.plugin.superstate, - path: this.path - }, /* @__PURE__ */ import_react178.default.createElement(SpaceFragmentViewComponent, { - id: this.path, - superstate: this.plugin.superstate, - path: this.path, - source: this.source - })) - ); - } else { - this.plugin.ui.manager.eventsDispatch.addOnceListener( - "windowReady", - () => { - this.constructInlineContext(); - } - ); - } - } -}; - -// src/adapters/obsidian/utils/file.ts -var tFileToAFile = (file) => { - if (!file) - return null; - if (file instanceof import_obsidian6.TFile && file.stat) { - return { - isFolder: false, - name: file.basename, - filename: file.name, - path: file.path, - parent: file.parent?.path, - extension: file.extension, - ...file.stat - }; - } - return { - isFolder: true, - name: file.name, - filename: file.name, - path: file.path, - parent: file.parent?.path - }; -}; -var defaultConfigFile = async (plugin) => { - return await plugin.app.vault.adapter.read( - (0, import_obsidian6.normalizePath)(plugin.app.vault.configDir + "/app.json") - ); -}; -var fileExtensionForFile = (path2) => path2?.indexOf(".") > 0 ? path2.split(".").pop() : "md"; -var fileNameForFile = (path2) => path2?.indexOf("/") > 0 ? path2.split("/").pop().split(".").shift() : path2.split(".").shift(); -var uniqueFileName = (oldName, name317, extension, folder) => { - let newName = sanitizeFileName(name317); - let uniqueName = false; - let append = 1; - while (!uniqueName) { - if (!folder.children.some((f2) => f2.name == `${newName}.${extension}` && f2.name != oldName)) { - uniqueName = true; - } else { - newName = `${newName} ${append}`; - append += 1; - } - } - return `${newName}.${extension}`; -}; -function getAllAbstractFilesInVault(app2) { - const files = []; - const rootFolder = app2.vault.getRoot(); - function recursiveFx(folder) { - for (const child of folder.children) { - if (child instanceof import_obsidian6.TFolder) { - const childFolder = child; - if (childFolder.children) - recursiveFx(childFolder); - } - files.push(child); - } - } - recursiveFx(rootFolder); - files.push(rootFolder); - return files; -} -var openPath = async (leaf, path2, plugin, flow) => { - const uri = plugin.superstate.spaceManager.uriByString(path2); - if (!uri) - return; - if (uri.scheme == "https" || uri.scheme == "http") { - window.open(uri.fullPath, "_blank"); - return; - } - if (uri.scheme == "obsidian") { - await leaf.setViewState({ - type: uri.authority - }); - return; - } - if (uri.ref) { - const cache2 = plugin.superstate.pathsIndex.get(uri.path); - if (cache2?.type == "space" || uri.scheme == "spaces") { - if (flow) { - await leaf.setViewState({ - type: EMBED_CONTEXT_VIEW_TYPE, - state: { path: uri.fullPath } - }); - } else { - await leaf.setViewState({ - type: SPACE_FRAGMENT_VIEW_TYPE, - state: { path: uri.fullPath } - }); - } - return; - } - } - if (uri.scheme == "spaces") { - openTagContext(leaf, uri.authority, plugin.app); - return; - } - plugin.files.getFile(path2).then((f2) => { - if (f2) { - openAFile(leaf, f2, plugin); - } else { - if (path2.contains("/")) { - const folder = removeTrailingSlashFromFolder(getParentPathFromString(path2)); - const spaceFolder = plugin.superstate.spacesIndex.get(folder); - if (spaceFolder) { - newPathInSpace( - plugin.superstate, - spaceFolder, - fileExtensionForFile(path2), - fileNameForFile(path2) - ); - } - } else { - defaultSpace(plugin.superstate, plugin.superstate.pathsIndex.get(plugin.superstate.ui.activePath)).then((f3) => { - if (f3) - newPathInSpace( - plugin.superstate, - f3, - fileExtensionForFile(path2), - fileNameForFile(path2) - ); - }); - } - } +// src/adapters/obsidian/utils/createTable.ts +var createTable2 = (object, columns) => { + const columnNames = columns.map((f2) => f2.name); + const base3 = "|"; + let outputString = base3 + columnNames.join(base3) + "|\n"; + columns.forEach((f2) => { + outputString += base3 + "----"; }); -}; -var getLeaf = (app2, location) => { - let leaf; - if (location == "system" || location == "hover") { - return null; - } else if (location == "right") { - leaf = app2.workspace.getRightLeaf(false); - } else if (location == "left") { - leaf = app2.workspace.getLeftLeaf(false); - } else { - leaf = app2.workspace.getLeaf(location); - } - return leaf; -}; -var openURL = async (url, app2, location) => { - if (location == "system") { - window.open(url, "_blank"); - return; - } - const leaf = getLeaf(app2, location); - if (url.endsWith(".md")) { - const viewType = LINK_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: url } - }); - await app2.workspace.requestSaveLayout(); - } else if (url.endsWith(".mdb")) { - const viewType = SPACE_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: url } - }); - await app2.workspace.requestSaveLayout(); - } else { - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: EMBED_CONTEXT_VIEW_TYPE, - state: { path: url } - }); - } - if (import_obsidian6.Platform.isMobile) { - app2.workspace.leftSplit.collapse(); - } -}; -var openAFile = async (leaf, file, plugin) => { - if (file.isFolder) { - openTFolder(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin); - } else if (file) { - openTFile(leaf, getAbstractFileAtPath(plugin.app, file.path), plugin.app); - } else { - return; - } -}; -var openTFile = async (leaf, file, app2) => { - if (!file) - return; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.openFile(file); -}; -var openTFolder = async (leaf, file, plugin) => { - if (!plugin.superstate.settings.spaceViewEnabled) { - const space2 = plugin.superstate.spacesIndex.get(file.path)?.space.defPath; - if (!space2) - return; - const spaceFile = getAbstractFileAtPath(plugin.app, space2); - if (!spaceFile) - return; - plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); - leaf.openFile(spaceFile); - return; - } - const viewType = SPACE_VIEW_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: file.path } + outputString += base3 + "\n"; + object.forEach((row2) => { + outputString += columnNames.map((c3) => base3 + row2[c3]).join("") + "|\n"; }); - await app.workspace.requestSaveLayout(); - if (import_obsidian6.Platform.isMobile) { - app.workspace.leftSplit.collapse(); - } -}; -var openTagContext = async (leaf, tag2, app2) => { - const viewType = SPACE_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ type: viewType, state: { path: "spaces://" + tag2 } }); - await app2.workspace.requestSaveLayout(); - if (import_obsidian6.Platform.isMobile) { - app2.workspace.leftSplit.collapse(); - } -}; -var getAbstractFileAtPath = (app2, path2) => { - return app2.vault.getAbstractFileByPath(path2); + return outputString; }; // src/adapters/obsidian/ui/editors/markdownView/FlowEditorHover.tsx @@ -130216,18 +140802,18 @@ var FlowEditorHover = (props) => { }; // src/adapters/obsidian/utils/flow/flowEditor.ts -var import_state9 = require("@codemirror/state"); +var import_state10 = require("@codemirror/state"); // src/adapters/obsidian/ui/editors/FlowEditor.tsx var import_obsidian8 = require("obsidian"); var popovers = /* @__PURE__ */ new WeakMap(); var mouseCoords = { x: 0, y: 0 }; -function nosuper(base2) { +function nosuper(base3) { const derived = function() { return Object.setPrototypeOf(new import_obsidian8.Component(), new.target.prototype); }; - derived.prototype = base2.prototype; - return Object.setPrototypeOf(derived, base2); + derived.prototype = base3.prototype; + return Object.setPrototypeOf(derived, base3); } var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) { constructor(parent, targetEl, plugin, waitTime, onShowCallback) { @@ -130351,9 +140937,9 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) { ); this.registerEvent( app.workspace.on("layout-change", () => { - this.rootSplit.children.forEach((item, index2) => { + this.rootSplit.children.forEach((item, index3) => { if (item instanceof import_obsidian8.WorkspaceTabs) { - this.rootSplit.replaceChild(index2, item.children[0]); + this.rootSplit.replaceChild(index3, item.children[0]); } }); }) @@ -130524,10 +141110,10 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) { eState }; } - buildEphemeralState(file, link) { + buildEphemeralState(file, link3) { const cache2 = this.plugin.app.metadataCache.getFileCache(file); - const subpath = cache2 ? (0, import_obsidian8.resolveSubpath)(cache2, link?.subpath || "") : void 0; - const eState = { subpath: link?.subpath }; + const subpath = cache2 ? (0, import_obsidian8.resolveSubpath)(cache2, link3?.subpath || "") : void 0; + const eState = { subpath: link3?.subpath }; if (subpath) { eState.line = subpath.start.line; eState.startLoc = subpath.start; @@ -130538,42 +141124,42 @@ var FlowEditor = class extends nosuper(import_obsidian8.HoverPopover) { }; // src/adapters/obsidian/ui/editors/markdownView/flowEditor/atomic.ts -var import_state8 = require("@codemirror/state"); +var import_state9 = require("@codemirror/state"); // src/adapters/obsidian/ui/editors/markdownView/flowEditor/selectiveEditor.ts -var import_state7 = require("@codemirror/state"); +var import_state8 = require("@codemirror/state"); var import_view9 = require("@codemirror/view"); var combinedRangeFacets = (rangeA, rangeB) => { const startRange = !rangeA?.[0] ? rangeB[0] : !rangeB?.[0] ? rangeA[0] : Math.max(rangeA?.[0], rangeB?.[0]); const endRange = !rangeA?.[1] ? rangeB[1] : !rangeB?.[1] ? rangeA[1] : Math.min(rangeA?.[1], rangeB?.[1]); return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; }; -var editableRange = import_state7.Annotation.define(); -var contentRange = import_state7.Annotation.define(); +var editableRange = import_state8.Annotation.define(); +var contentRange = import_state8.Annotation.define(); var hiddenLine = import_view9.Decoration.replace({ inclusive: true, block: true }); -var hideLine = import_state7.StateField.define({ +var hideLine = import_state8.StateField.define({ create() { return import_view9.Decoration.none; }, - update(value, tr) { - const builder = new import_state7.RangeSetBuilder(); - const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); + update(value, tr2) { + const builder = new import_state8.RangeSetBuilder(); + const betterFacet = combinedRangeFacets(tr2.state.field(selectiveLinesFacet, false), tr2.state.field(frontmatterFacet, false)); if (betterFacet?.[0] != null) { const starterLine = Math.min( - tr.state.doc.lines, + tr2.state.doc.lines, betterFacet[0] ); builder.add( - tr.state.doc.line(1).from, - tr.state.doc.line(starterLine).from - 1, + tr2.state.doc.line(1).from, + tr2.state.doc.line(starterLine).from - 1, hiddenLine ); - if (tr.newDoc.lines != betterFacet[1]) + if (tr2.newDoc.lines != betterFacet[1]) builder.add( - tr.state.doc.line( - Math.min(tr.newDoc.lines, betterFacet[1]) + tr2.state.doc.line( + Math.min(tr2.newDoc.lines, betterFacet[1]) ).to, - tr.state.doc.line(tr.newDoc.lines).to, + tr2.state.doc.line(tr2.newDoc.lines).to, hiddenLine ); } @@ -130582,32 +141168,32 @@ var hideLine = import_state7.StateField.define({ }, provide: (f2) => import_view9.EditorView.decorations.from(f2) }); -var frontmatterFacet = import_state7.StateField.define({ +var frontmatterFacet = import_state8.StateField.define({ create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(contentRange)) { - if (tr.annotation(contentRange)[0]) { + update(value, tr2) { + if (tr2.annotation(contentRange)) { + if (tr2.annotation(contentRange)[0]) { return [ - tr.annotation(contentRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) + tr2.annotation(contentRange)[0], + Math.min(tr2.state.doc.lines, tr2.annotation(contentRange)[1]) ]; } - return tr.annotation(contentRange); + return tr2.annotation(contentRange); } return value; } }); -var selectiveLinesFacet = import_state7.StateField.define({ +var selectiveLinesFacet = import_state8.StateField.define({ create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(editableRange)) { - if (tr.annotation(editableRange)[0]) { + update(value, tr2) { + if (tr2.annotation(editableRange)) { + if (tr2.annotation(editableRange)[0]) { return [ - tr.annotation(editableRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) + tr2.annotation(editableRange)[0], + Math.min(tr2.state.doc.lines, tr2.annotation(editableRange)[1]) ]; } - return tr.annotation(editableRange); + return tr2.annotation(editableRange); } return value; } @@ -130618,20 +141204,20 @@ var lineRangeToPosRange = (state, range2) => { to: state.doc.line(Math.min(state.doc.lines, range2[1])).to }; }; -var smartDelete = import_state7.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") && !tr.annotation(import_state7.Transaction.userEvent).endsWith(".smart")) { - const initialSelections = tr.startState.selection.ranges.map((range2) => ({ +var smartDelete = import_state8.EditorState.transactionFilter.of( + (tr2) => { + if (tr2.isUserEvent("delete") && !tr2.annotation(import_state8.Transaction.userEvent).endsWith(".smart")) { + const initialSelections = tr2.startState.selection.ranges.map((range2) => ({ from: range2.from, to: range2.to })); - const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); + const betterFacet = combinedRangeFacets(tr2.startState.field(selectiveLinesFacet, false), tr2.startState.field(frontmatterFacet, false)); if (initialSelections.length > 0 && betterFacet?.[0]) { const posRange = lineRangeToPosRange( - tr.startState, + tr2.startState, betterFacet ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { + if (tr2.changes.touchesRange(0, posRange.from - 1)) { const minFrom = Math.max(posRange.from, initialSelections[0].from); const minTo = Math.min(posRange.to, initialSelections[0].to); return [{ @@ -130639,42 +141225,42 @@ var smartDelete = import_state7.EditorState.transactionFilter.of( from: Math.min(minFrom, minTo), to: Math.max(minFrom, minTo) }, - annotations: import_state7.Transaction.userEvent.of( - `${tr.annotation(import_state7.Transaction.userEvent)}.smart` + annotations: import_state8.Transaction.userEvent.of( + `${tr2.annotation(import_state8.Transaction.userEvent)}.smart` ) }]; } } } - return tr; + return tr2; } ); -var preventModifyTargetRanges = import_state7.EditorState.transactionFilter.of( - (tr) => { +var preventModifyTargetRanges = import_state8.EditorState.transactionFilter.of( + (tr2) => { const newTrans = []; try { - const editableLines = tr.startState.field(selectiveLinesFacet, false); - const contentLines = tr.startState.field(frontmatterFacet, false); + const editableLines = tr2.startState.field(selectiveLinesFacet, false); + const contentLines = tr2.startState.field(frontmatterFacet, false); const selectiveLines = combinedRangeFacets(editableLines, contentLines); - if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { + if (tr2.isUserEvent("input") || tr2.isUserEvent("delete") || tr2.isUserEvent("move")) { if (selectiveLines?.[0]) { const posRange = lineRangeToPosRange( - tr.startState, + tr2.startState, selectiveLines ); - if (!tr.changes.touchesRange(posRange.from, posRange.to)) { + if (!tr2.changes.touchesRange(posRange.from, posRange.to)) { return []; } } } - if (tr.state.doc.lines != tr.startState.doc.lines) { - const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; + if (tr2.state.doc.lines != tr2.startState.doc.lines) { + const numberNewLines = tr2.state.doc.lines - tr2.startState.doc.lines; if (selectiveLines?.[0]) { const posRange = lineRangeToPosRange( - tr.startState, + tr2.startState, selectiveLines ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { + if (tr2.changes.touchesRange(0, posRange.from - 1)) { const newAnnotations = []; if (editableLines[0]) { newAnnotations.push(editableRange.of([ @@ -130691,7 +141277,7 @@ var preventModifyTargetRanges = import_state7.EditorState.transactionFilter.of( newTrans.push({ annotations: newAnnotations }); - } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { + } else if (tr2.changes.touchesRange(posRange.from - 1, posRange.to)) { const newAnnotations = []; if (editableLines[0]) { newAnnotations.push(editableRange.of([ @@ -130714,7 +141300,7 @@ var preventModifyTargetRanges = import_state7.EditorState.transactionFilter.of( } catch (e5) { return []; } - return [tr, ...newTrans]; + return [tr2, ...newTrans]; } ); var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; @@ -130726,14 +141312,14 @@ var editBlockExtensions = () => [ ]; // src/adapters/obsidian/ui/editors/markdownView/flowEditor/atomic.ts -var arrowKeyAnnotation = import_state8.Annotation.define(); +var arrowKeyAnnotation = import_state9.Annotation.define(); // src/adapters/obsidian/utils/flow/flowEditor.ts -var getLineRangeFromRef = (path2, ref2, plugin) => { +var getLineRangeFromRef = (path3, ref2, plugin) => { if (!ref2) { return [void 0, void 0]; } - const cache2 = plugin.app.metadataCache.getCache(path2); + const cache2 = plugin.app.metadataCache.getCache(path3); if (!cache2) return [void 0, void 0]; const headings = cache2.headings; @@ -130745,15 +141331,15 @@ var getLineRangeFromRef = (path2, ref2, plugin) => { blocks[ref2.substring(1)].position.end.line + 1 ]; } - const heading3 = headings?.find((f2) => f2.heading.replace("#", " ") == ref2); - if (heading3) { - const index2 = headings.findIndex((f2) => f2.heading == heading3.heading); - const level = headings[index2]?.level; + const heading5 = headings?.find((f2) => f2.heading.replace("#", " ") == ref2); + if (heading5) { + const index3 = headings.findIndex((f2) => f2.heading == heading5.heading); + const level = headings[index3]?.level; const nextIndex2 = headings.findIndex( - (f2, i4) => i4 > index2 && f2.level <= level + (f2, i4) => i4 > index3 && f2.level <= level ); - const start = plugin.superstate.settings.editorFlowStyle == "classic" ? heading3.position.start.line + 1 : heading3.position.start.line + 2; - if (index2 < headings.length - 1 && nextIndex2 != -1) { + const start = plugin.superstate.settings.editorFlowStyle == "classic" ? heading5.position.start.line + 1 : heading5.position.start.line + 2; + if (index3 < headings.length - 1 && nextIndex2 != -1) { return [start, headings[nextIndex2].position.end.line]; } return [start, sections[sections.length - 1].position.end.line + 1]; @@ -130823,20 +141409,20 @@ var loadFlowEditor = async (leaf, cm, flowEditorInfo2, source, plugin) => { const dom = cm.dom.querySelector( "#mk-flow-" + flowEditorInfo2.id ); - const path2 = plugin.superstate.spaceManager.uriByString(flowEditorInfo2.link, source); - const basePath = plugin.superstate.spaceManager.resolvePath(path2.basePath, source); + const path3 = plugin.superstate.spaceManager.uriByString(flowEditorInfo2.link, source); + const basePath = plugin.superstate.spaceManager.resolvePath(path3.basePath, source); if (dom) { - const spaceCache = plugin.superstate.spacesIndex.get(path2.basePath); + const spaceCache = plugin.superstate.spacesIndex.get(path3.basePath); if (spaceCache) { if (!dom.hasAttribute("ready")) { dom.setAttribute("ready", ""); - plugin.superstate.ui.openPath(path2.fullPath, false, dom); + plugin.superstate.ui.openPath(path3.fullPath, false, dom); return; } } else { - const file = getAbstractFileAtPath(plugin.app, path2.basePath) ?? getAbstractFileAtPath(plugin.app, basePath); + const file = getAbstractFileAtPath(plugin.app, path3.basePath) ?? getAbstractFileAtPath(plugin.app, basePath); if (file) { - const selectiveRange = getLineRangeFromRef(file.path, path2.refStr, plugin); + const selectiveRange = getLineRangeFromRef(file.path, path3.refStr, plugin); if (!dom.hasAttribute("ready")) { dom.setAttribute("ready", ""); plugin.superstate.ui.openPath(basePath, false, dom, { from: selectiveRange[0], to: selectiveRange[1] }); @@ -130877,16 +141463,16 @@ var openPathInElement = (plugin, parentLeaf, initiatingEl, fileName, onShowCallb // src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx var import_obsidian9 = require("obsidian"); -var toggleFlowEditor = import_state10.Annotation.define(); -var cacheFlowEditorHeight = import_state10.Annotation.define(); -var preloadFlowEditor = import_state10.EditorState.transactionFilter.of( - (tr) => { +var toggleFlowEditor = import_state11.Annotation.define(); +var cacheFlowEditorHeight = import_state11.Annotation.define(); +var preloadFlowEditor = import_state11.EditorState.transactionFilter.of( + (tr2) => { const newTrans = []; - const value = tr.state.field(flowEditorInfo, false); - if (value && !tr.annotation(toggleFlowEditor)) { + const value = tr2.state.field(flowEditorInfo, false); + if (value && !tr2.annotation(toggleFlowEditor)) { newTrans.push( ...value.filter((f2) => f2.expandedState == 1).map((f2) => { - if (tr.state.field(flowTypeStateField, false) == "doc") { + if (tr2.state.field(flowTypeStateField, false) == "doc") { return { annotations: toggleFlowEditor.of([f2.id, 2]) }; @@ -130898,7 +141484,7 @@ var preloadFlowEditor = import_state10.EditorState.transactionFilter.of( }) ); } - return [tr, ...newTrans]; + return [tr2, ...newTrans]; } ); var internalLinkToggle = import_view10.ViewPlugin.fromClass( @@ -130913,8 +141499,8 @@ var internalLinkToggle = import_view10.ViewPlugin.fromClass( return; } const pos = view.posAtDOM(e5.target); - const { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); - for (const match2 of text2.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)) { + const { from: lineFrom, to: lineTo, text: text7 } = view.state.doc.lineAt(pos); + for (const match2 of text7.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)) { const stateField = view.state.field(flowEditorInfo, false); const info = stateField.find( (f2) => f2.to == lineFrom + match2.index + match2[1].length + 2 && pos >= f2.from && pos <= f2.to @@ -130975,26 +141561,26 @@ var internalLinkHover = (plugin) => hoverTooltip((view, pos, side) => { }); return hovObject; }); -var flowEditorInfo = import_state10.StateField.define({ +var flowEditorInfo = import_state11.StateField.define({ create() { return []; }, - update(value, tr) { + update(value, tr2) { const newValues = []; - const previous = value; + const previous2 = value; const usedContainers = []; - const str = tr.newDoc.sliceString(0); + const str = tr2.newDoc.sliceString(0); const reverseExpandedState = (state) => { const news = state != 2 ? 2 : 0; return news; }; for (const match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; + const link3 = match2[1]; + const existingLinks = previous2.filter((f2) => f2.link == link3); + const offset2 = usedContainers.filter((f2) => f2 == link3).length; const existingInfo = existingLinks[offset2]; const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); + usedContainers.push(link3); const info = { id: id3, link: match2[1], @@ -131002,19 +141588,19 @@ var flowEditorInfo = import_state10.StateField.define({ from: match2.index + 4, to: match2.index + 4 + match2[1].length, embed: 1, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 }; newValues.push(info); } for (const match2 of str.matchAll(/\[\[([^\]]+)\]\]/g)) { if (str.charAt(match2.index - 1) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; + const link3 = match2[1]; + const existingLinks = previous2.filter((f2) => f2.link == link3); + const offset2 = usedContainers.filter((f2) => f2 == link3).length; const existingInfo = existingLinks[offset2]; const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); + usedContainers.push(link3); const info = { id: id3, link: match2[1], @@ -131022,17 +141608,17 @@ var flowEditorInfo = import_state10.StateField.define({ from: match2.index + 2, to: match2.index + 2 + match2[1].length, embed: 0, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 + height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 }; newValues.push(info); } else if (str.charAt(match2.index - 2) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; + const link3 = match2[1]; + const existingLinks = previous2.filter((f2) => f2.link == link3); + const offset2 = usedContainers.filter((f2) => f2 == link3).length; const existingInfo = existingLinks[offset2]; const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); + usedContainers.push(link3); const info = { id: id3, link: match2[1], @@ -131040,8 +141626,8 @@ var flowEditorInfo = import_state10.StateField.define({ from: match2.index + 3, to: match2.index + 3 + match2[1].length, embed: 2, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + height: existingInfo ? tr2.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr2.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr2.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr2.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 }; newValues.push(info); } @@ -131051,7 +141637,7 @@ var flowEditorInfo = import_state10.StateField.define({ } }); var flowEditorRangeset = (state, plugin) => { - const builder = new import_state10.RangeSetBuilder(); + const builder = new import_state11.RangeSetBuilder(); const infoFields = state.field(flowEditorInfo, false); for (const info of infoFields) { const { from, to: to2, embed: embedType, expandedState } = info; @@ -131078,12 +141664,12 @@ var flowEditorRangeset = (state, plugin) => { const dec = builder.finish(); return dec; }; -var flowEditorField = (plugin) => import_state10.StateField.define({ +var flowEditorField = (plugin) => import_state11.StateField.define({ create(state) { return flowEditorRangeset(state, plugin); }, - update(value, tr) { - return flowEditorRangeset(tr.state, plugin); + update(value, tr2) { + return flowEditorRangeset(tr2.state, plugin); }, provide: (f2) => import_view10.EditorView.decorations.from(f2) }); @@ -131204,10 +141790,10 @@ var flowViewUpdates = (plugin) => import_view11.EditorView.updateListener.of((v2 }); // src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx -var import_state12 = require("@codemirror/state"); +var import_state13 = require("@codemirror/state"); // src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts -var import_state11 = require("@codemirror/state"); +var import_state12 = require("@codemirror/state"); // src/adapters/obsidian/ui/editors/markdownView/obsidianSyntax.ts var oMarks = [ @@ -131235,7 +141821,7 @@ var oMarks = [ ]; // src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts -var toggleMark = import_state11.Annotation.define(); +var toggleMark = import_state12.Annotation.define(); var trimSpace = (pos, moveDirLeft, state) => { if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ") return pos + 1; @@ -131251,18 +141837,18 @@ var newPosAfterFormatting = (pos, moveDirLeft, state) => { let lastFormatPos = start; const exitFormatRange = false; iterateTreeInSelection({ from: start, to: end }, state, { - enter: (node) => { + enter: (node2) => { if (exitFormatRange) return false; - if (node.name.includes("formatting")) { - if (!moveDirLeft && node.from > start) { + if (node2.name.includes("formatting")) { + if (!moveDirLeft && node2.from > start) { return false; } if (moveDirLeft) { - newPos = node.from; - lastFormatPos = node.to; + newPos = node2.from; + lastFormatPos = node2.to; } else { - newPos = node.to; + newPos = node2.to; } } } @@ -131285,10 +141871,10 @@ var expandRange = (selection2, state) => { ); return { from, to: to2 }; }; -var addMarkAtPos = (pos, mark) => ({ - changes: { from: pos, to: pos, insert: mark.formatChar } +var addMarkAtPos = (pos, mark2) => ({ + changes: { from: pos, to: pos, insert: mark2.formatChar } }); -var rangeIsMark = (state, mark, selection2) => posIsMark(selection2.from, state, mark.mark) && posIsMark(selection2.to, state, mark.mark); +var rangeIsMark = (state, mark2, selection2) => posIsMark(selection2.from, state, mark2.mark) && posIsMark(selection2.to, state, mark2.mark); var posIsMark = (pos, state, markString) => { let isMark = false; iterateTreeAtPos(pos, state, { @@ -131302,41 +141888,41 @@ var posIsMark = (pos, state, markString) => { var nodeNameContainsMark = (name317, markString) => { return name317.includes(markString); }; -var edgeIsMark = (pos, state, mark) => posIsMark(pos, state, mark.mark); -var edgeIsMarkFormat = (pos, state, mark) => posIsMark(pos, state, mark.formatting) ? true : mark.altFormatting ? posIsMark(pos, state, mark.altFormatting) : false; -var transactionChangesForMark = (range2, mark, state) => { +var edgeIsMark = (pos, state, mark2) => posIsMark(pos, state, mark2.mark); +var edgeIsMarkFormat = (pos, state, mark2) => posIsMark(pos, state, mark2.formatting) ? true : mark2.altFormatting ? posIsMark(pos, state, mark2.altFormatting) : false; +var transactionChangesForMark = (range2, mark2, state) => { const newTrans = []; - if (rangeIsMark(state, mark, range2)) { - if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMarkFormat(range2.to, state, mark)) { - newTrans.push(addMarkAtPos(range2.to, mark)); + if (rangeIsMark(state, mark2, range2)) { + if (edgeIsMarkFormat(range2.from, state, mark2) && !edgeIsMarkFormat(range2.to, state, mark2)) { + newTrans.push(addMarkAtPos(range2.to, mark2)); } - if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMarkFormat(range2.from, state, mark)) { - newTrans.push(addMarkAtPos(range2.from, mark)); + if (edgeIsMarkFormat(range2.to, state, mark2) && !edgeIsMarkFormat(range2.from, state, mark2)) { + newTrans.push(addMarkAtPos(range2.from, mark2)); } - } else if (edgeIsMark(range2.from, state, mark)) { - if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMark(range2.from - 1, state, mark)) { - newTrans.push(addMarkAtPos(range2.from, mark)); + } else if (edgeIsMark(range2.from, state, mark2)) { + if (edgeIsMarkFormat(range2.from, state, mark2) && !edgeIsMark(range2.from - 1, state, mark2)) { + newTrans.push(addMarkAtPos(range2.from, mark2)); } - newTrans.push(addMarkAtPos(range2.to, mark)); - } else if (edgeIsMark(range2.to, state, mark)) { - if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMark(range2.to + 1, state, mark)) { - newTrans.push(addMarkAtPos(range2.to, mark)); + newTrans.push(addMarkAtPos(range2.to, mark2)); + } else if (edgeIsMark(range2.to, state, mark2)) { + if (edgeIsMarkFormat(range2.to, state, mark2) && !edgeIsMark(range2.to + 1, state, mark2)) { + newTrans.push(addMarkAtPos(range2.to, mark2)); } - newTrans.push(addMarkAtPos(range2.from, mark)); + newTrans.push(addMarkAtPos(range2.from, mark2)); } else { - newTrans.push(addMarkAtPos(range2.to, mark)); - newTrans.push(addMarkAtPos(range2.from, mark)); + newTrans.push(addMarkAtPos(range2.to, mark2)); + newTrans.push(addMarkAtPos(range2.from, mark2)); } return newTrans; }; -var removeAllInternalMarks = (sel, state, mark) => { +var removeAllInternalMarks = (sel, state, mark2) => { const returnTrans = []; iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { enter: ({ name: name317, from, to: to2 }) => { - if (nodeNameContainsMark(name317, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name317, mark.altFormatting) : false)) + if (nodeNameContainsMark(name317, mark2.formatting) || (mark2.altFormatting ? nodeNameContainsMark(name317, mark2.altFormatting) : false)) returnTrans.push({ from, - to: from + mark.formatChar.length + to: from + mark2.formatChar.length }); } }); @@ -131344,51 +141930,51 @@ var removeAllInternalMarks = (sel, state, mark) => { changes: returnTrans }; }; -var toggleMarkExtension = import_state11.EditorState.transactionFilter.of( - (tr) => { - if (!tr.annotation(toggleMark)) - return tr; - const markToggle = tr.annotation(toggleMark); - const mark = oMarks.find((f2) => f2.mark == markToggle); - if (!mark) { - return tr; +var toggleMarkExtension = import_state12.EditorState.transactionFilter.of( + (tr2) => { + if (!tr2.annotation(toggleMark)) + return tr2; + const markToggle = tr2.annotation(toggleMark); + const mark2 = oMarks.find((f2) => f2.mark == markToggle); + if (!mark2) { + return tr2; } - const selection2 = tr.startState.selection.main; + const selection2 = tr2.startState.selection.main; const newTrans = []; if (selection2.head == selection2.anchor) { - if (tr.startState.sliceDoc( - selection2.head - mark.formatChar.length, + if (tr2.startState.sliceDoc( + selection2.head - mark2.formatChar.length, selection2.head - ) == mark.formatChar && tr.startState.sliceDoc( + ) == mark2.formatChar && tr2.startState.sliceDoc( selection2.head, - selection2.head + mark.formatChar.length - ) == mark.formatChar) { + selection2.head + mark2.formatChar.length + ) == mark2.formatChar) { newTrans.push({ changes: { - from: selection2.head - mark.formatChar.length, - to: selection2.head + mark.formatChar.length + from: selection2.head - mark2.formatChar.length, + to: selection2.head + mark2.formatChar.length } }); } else { newTrans.push({ changes: { from: selection2.head, - insert: mark.formatChar + mark.formatChar + insert: mark2.formatChar + mark2.formatChar }, selection: { - anchor: selection2.head + mark.formatChar.length, - head: selection2.head + mark.formatChar.length + anchor: selection2.head + mark2.formatChar.length, + head: selection2.head + mark2.formatChar.length } }); } - return [tr, ...newTrans]; + return [tr2, ...newTrans]; } - const range2 = expandRange(selection2, tr.startState); - newTrans.push(removeAllInternalMarks(range2, tr.startState, mark)); + const range2 = expandRange(selection2, tr2.startState); + newTrans.push(removeAllInternalMarks(range2, tr2.startState, mark2)); const newFrom = range2.from; const newTo = range2.to; - newTrans.push(...transactionChangesForMark(range2, mark, tr.startState)); - return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; + newTrans.push(...transactionChangesForMark(range2, mark2, tr2.startState)); + return [tr2, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; } ); @@ -131463,8 +142049,8 @@ function resolveStyles() { // src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx var loadStylerIntoContainer = (el, plugin) => { - const root = plugin.ui.createRoot(el); - root.render( + const root4 = plugin.ui.createRoot(el); + root4.render( /* @__PURE__ */ import_react182.default.createElement(InlineMenuComponent, { mobile: true, activeMarks: [], @@ -131672,12 +142258,12 @@ var InlineMenuComponent = (props) => { // src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx var import_react183 = __toESM(require_react()); -var cursorTooltipField = (plugin) => import_state12.StateField.define({ +var cursorTooltipField = (plugin) => import_state13.StateField.define({ create: getCursorTooltips(plugin), - update(tooltips2, tr) { - if (!tr.docChanged && !tr.selection) + update(tooltips2, tr2) { + if (!tr2.docChanged && !tr2.selection) return tooltips2; - return getCursorTooltips(plugin)(tr.state); + return getCursorTooltips(plugin)(tr2.state); }, provide: (f2) => showTooltip.computeN([f2], (state) => state.field(f2)) }); @@ -131713,19 +142299,19 @@ function cursorTooltip(plugin) { } // src/adapters/obsidian/ui/editors/markdownView/placeholder.ts -var import_state13 = require("@codemirror/state"); +var import_state14 = require("@codemirror/state"); var import_view12 = require("@codemirror/view"); var placeholderLine = (plugin) => import_view12.Decoration.line({ attributes: { "data-ph": i18n_default.labels.placeholder.replace("${1}", plugin.superstate.settings.menuTriggerChar) }, class: "mk-placeholder" }); -var placeholderExtension = (plugin) => import_state13.StateField.define({ +var placeholderExtension = (plugin) => import_state14.StateField.define({ create() { return import_view12.Decoration.none; }, - update(value, tr) { - const builder = new import_state13.RangeSetBuilder(); - const currentLine = tr.state.doc.lineAt(tr.state.selection.main.head); + update(value, tr2) { + const builder = new import_state14.RangeSetBuilder(); + const currentLine = tr2.state.doc.lineAt(tr2.state.selection.main.head); if (currentLine?.length == 0) builder.add(currentLine.from, currentLine.from, placeholderLine(plugin)); const dec = builder.finish(); @@ -131786,17 +142372,17 @@ var getCMFromElement = (el, app2) => { return rcm; }; var replaceAllTables = (plugin, el, ctx) => { - el.querySelectorAll("p").forEach((element) => { - for (const match2 of element.textContent.matchAll( + el.querySelectorAll("p").forEach((element3) => { + for (const match2 of element3.textContent.matchAll( /(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g )) { - const link = match2[1]; - const reactEl = plugin.ui.createRoot(element.parentElement); + const link3 = match2[1]; + const reactEl = plugin.ui.createRoot(element3.parentElement); reactEl.render( /* @__PURE__ */ import_react184.default.createElement(NoteView, { load: true, superstate: plugin.superstate, - path: link + path: link3 }) ); } @@ -131844,10 +142430,10 @@ var replaceAllEmbed = (el, ctx, superstate, app2) => { const reactEl = superstate.ui.createRoot(div2); const cm = getCMFromElement(el, app2); const pos = cm?.posAtDOM(dom); - const index2 = [...Array.from(dom.parentElement.childNodes)].indexOf( + const index3 = [...Array.from(dom.parentElement.childNodes)].indexOf( dom ); - const nextDom = dom.parentElement.childNodes[index2]; + const nextDom = dom.parentElement.childNodes[index3]; const endPos = cm?.posAtDOM(nextDom); if (ctx.sourcePath) reactEl.render( @@ -132052,9 +142638,9 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { this.plugin.saveSettings(); }) ); - new import_obsidian10.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.spaceRowHeight.toString()).onChange(async (value) => { - text2.setValue(parseInt(value).toString()); + new import_obsidian10.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.spaceRowHeight.toString()).onChange(async (value) => { + text7.setValue(parseInt(value).toString()); this.plugin.superstate.settings.spaceRowHeight = parseInt(value); await this.plugin.saveSettings(); }); @@ -132106,13 +142692,13 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { i18n_default.settings.spacesDeleteOptions["system-trash"] ); dropdown.setValue(this.plugin.superstate.settings.deleteFileOption); - dropdown.onChange((option) => { - this.plugin.superstate.settings.deleteFileOption = option; + dropdown.onChange((option2) => { + this.plugin.superstate.settings.deleteFileOption = option2; this.plugin.saveSettings(); }); }); - new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.newNotePlaceholder.name).setDesc(i18n_default.settings.newNotePlaceholder.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.newNotePlaceholder).onChange(async (value) => { + new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.newNotePlaceholder.name).setDesc(i18n_default.settings.newNotePlaceholder.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.newNotePlaceholder).onChange(async (value) => { this.plugin.superstate.settings.newNotePlaceholder = value; await this.plugin.saveSettings(); }); @@ -132127,17 +142713,17 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { }) ); } - new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.coverHeight.name).setDesc(i18n_default.settings.coverHeight.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.bannerHeight.toString()).onChange(async (value) => { - text2.setValue(parseInt(value).toString()); + new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.coverHeight.name).setDesc(i18n_default.settings.coverHeight.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.bannerHeight.toString()).onChange(async (value) => { + text7.setValue(parseInt(value).toString()); this.plugin.superstate.settings.bannerHeight = parseInt(value); await this.plugin.saveSettings(); }); }); if (this.plugin.superstate.settings.spaceViewEnabled) { containerEl.createEl("h3", { text: i18n_default.settings.sectionSpaceView }); - new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultSpaceTemplate.name).setDesc(i18n_default.settings.defaultSpaceTemplate.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.defaultSpaceTemplate).onChange(async (value) => { + new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultSpaceTemplate.name).setDesc(i18n_default.settings.defaultSpaceTemplate.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.defaultSpaceTemplate).onChange(async (value) => { this.plugin.superstate.settings.defaultSpaceTemplate = value; await this.plugin.saveSettings(); }); @@ -132158,8 +142744,8 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { this.plugin.reloadExtensions(false); }) ); - new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.defaultDateFormat).onChange(async (value) => { + new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.defaultDateFormat).onChange(async (value) => { this.plugin.superstate.settings.defaultDateFormat = value; await this.plugin.saveSettings(); }); @@ -132218,8 +142804,8 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { dropdown.addOption("vertical", i18n_default.settings.layoutVertical); dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal); dropdown.setValue(this.plugin.superstate.settings.inlineContextNameLayout); - dropdown.onChange((option) => { - this.plugin.superstate.settings.inlineContextNameLayout = option; + dropdown.onChange((option2) => { + this.plugin.superstate.settings.inlineContextNameLayout = option2; this.plugin.saveSettings(); }); }); @@ -132283,17 +142869,17 @@ var MakeMDPluginSettingsTab = class extends import_obsidian10.PluginSettingTab { this.plugin.reloadExtensions(false); }) ); - new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.menuTriggerChar).onChange(async (value) => { + new import_obsidian10.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text7) => { + text7.setValue(this.plugin.superstate.settings.menuTriggerChar).onChange(async (value) => { if (value.length < 1) { - text2.setValue(this.plugin.superstate.settings.menuTriggerChar); + text7.setValue(this.plugin.superstate.settings.menuTriggerChar); return; } let char = value[0]; if (value.length === 2) { char = value.replace(this.plugin.superstate.settings.menuTriggerChar, ""); } - text2.setValue(char); + text7.setValue(char); this.plugin.superstate.settings.menuTriggerChar = char; await this.plugin.saveSettings(); }); @@ -132475,18 +143061,18 @@ var MDBFileViewer = class extends import_obsidian12.FileView { state.schema = this.schema; return state; } - constructInlineContext(path2, schema) { - const space2 = this.plugin.superstate.spaceManager.spaceInfoForPath( - getParentPathFromString(path2) + constructInlineContext(path3, schema) { + const space3 = this.plugin.superstate.spaceManager.spaceInfoForPath( + getParentPathFromString(path3) ); this.destroy(); - if (space2) { + if (space3) { this.root = this.plugin.ui.createRoot(this.contentEl); if (this.root) { this.root.render( /* @__PURE__ */ import_react187.default.createElement(MDBViewer, { superstate: this.plugin.superstate, - space: space2, + space: space3, schema }) ); @@ -132494,7 +143080,7 @@ var MDBFileViewer = class extends import_obsidian12.FileView { this.plugin.ui.manager.eventsDispatch.addOnceListener( "windowReady", () => { - this.constructInlineContext(path2, schema); + this.constructInlineContext(path3, schema); } ); } @@ -132558,14 +143144,14 @@ var VIEW_DISPLAY_TEXT2 = i18n_default.views.explorer; // src/adapters/obsidian/ui/editors/ReadingModeHeader.tsx var import_react189 = __toESM(require_react()); var ReadingModeHeader = (props) => { - const [path2, setPath] = (0, import_react189.useState)(props.filePath); + const [path3, setPath] = (0, import_react189.useState)(props.filePath); const ref2 = (0, import_react189.useRef)(null); (0, import_react189.useEffect)(() => { setPath(props.filePath); }, [props.filePath]); - const changeActiveFile = (path3) => { + const changeActiveFile = (path4) => { if (ref2.current.closest(".mod-active")) - setPath(path3); + setPath(path4); }; (0, import_react189.useEffect)(() => { props.superstate.ui.eventsDispatch.addListener( @@ -132583,7 +143169,7 @@ var ReadingModeHeader = (props) => { ref: ref2 }, /* @__PURE__ */ import_react189.default.createElement(PathProvider, { superstate: props.superstate, - path: path2, + path: path3, readMode: true }, /* @__PURE__ */ import_react189.default.createElement(MarkdownHeaderView, { superstate: props.superstate, @@ -132596,7 +143182,7 @@ var import_obsidian14 = require("obsidian"); var import_react190 = __toESM(require_react()); var replaceInlineContext = (plugin, el, ctx) => { replaceMarkdownForReadingMode(el, async (dom) => { - const element = dom.querySelector(".mod-header"); + const element3 = dom.querySelector(".mod-header"); if (!el.parentElement) return; let outerdom = dom; @@ -132605,20 +143191,20 @@ var replaceInlineContext = (plugin, el, ctx) => { } if (outerdom.hasClass("mk-floweditor")) return; - if (element) { - let ctxElement = element?.querySelector(".mk-inline-context"); + if (element3) { + let ctxElement = element3?.querySelector(".mk-inline-context"); if (!ctxElement) { - ctxElement = element.createDiv(); + ctxElement = element3.createDiv(); ctxElement.classList.add("mk-inline-context"); - element.prepend(ctxElement); + element3.prepend(ctxElement); } if (ctxElement.getAttribute("data-path") != ctx.sourcePath) { ctxElement.setAttribute("data-path", ctx.sourcePath); - ctx.addChild(new import_obsidian14.MarkdownRenderChild(element)); - const root = plugin.ui.createRoot(ctxElement); - const construct = (root2) => { + ctx.addChild(new import_obsidian14.MarkdownRenderChild(element3)); + const root4 = plugin.ui.createRoot(ctxElement); + const construct = (root5) => { if (ctx.sourcePath.match(urlRegex)) { - root2.render( + root5.render( /* @__PURE__ */ import_react190.default.createElement(RemoteMarkdownHeaderView, { superstate: plugin.superstate, fm: ctx.frontmatter, @@ -132626,7 +143212,7 @@ var replaceInlineContext = (plugin, el, ctx) => { }) ); } else { - root2.render( + root5.render( /* @__PURE__ */ import_react190.default.createElement(ReadingModeHeader, { superstate: plugin.superstate, filePath: ctx.sourcePath @@ -132634,14 +143220,14 @@ var replaceInlineContext = (plugin, el, ctx) => { ); } }; - if (root) { - construct(root); + if (root4) { + construct(root4); } else { plugin.ui.manager.eventsDispatch.addOnceListener( "windowReady", () => { - const root2 = plugin.ui.createRoot(ctxElement); - construct(root2); + const root5 = plugin.ui.createRoot(ctxElement); + construct(root5); } ); } @@ -133639,7 +144225,7 @@ var lucideIcons = [ // node_modules/monkey-around/mjs/index.js function around(obj, factories) { - const removers = Object.keys(factories).map((key2) => around1(obj, key2, factories[key2])); + const removers = Object.keys(factories).map((key3) => around1(obj, key3, factories[key3])); return removers.length === 1 ? removers[0] : function() { removers.forEach((r2) => r2()); }; @@ -133782,8 +144368,8 @@ var modifyFlowDom = (plugin) => { sizerEl.prepend(inlineContext); } } - const construct = (root2) => { - root2.render( + const construct = (root5) => { + root5.render( /* @__PURE__ */ import_react191.default.createElement(PathProvider, { superstate: plugin.superstate, path: file.path, @@ -133796,18 +144382,18 @@ var modifyFlowDom = (plugin) => { })) ); }; - let root = plugin.ui.getRoot(inlineContext); - if (!root) { - root = plugin.ui.createRoot(inlineContext); + let root4 = plugin.ui.getRoot(inlineContext); + if (!root4) { + root4 = plugin.ui.createRoot(inlineContext); } - if (root) { - construct(root); + if (root4) { + construct(root4); } else { plugin.ui.manager.eventsDispatch.addOnceListener("windowReady", () => { - let root2 = plugin.ui.getRoot(inlineContext); - if (!root2) - root2 = plugin.ui.createRoot(inlineContext); - construct(root2); + let root5 = plugin.ui.getRoot(inlineContext); + if (!root5) + root5 = plugin.ui.createRoot(inlineContext); + construct(root5); }); } if (plugin.superstate.settings.inlineBacklinks) { @@ -133832,20 +144418,20 @@ var modifyFlowDom = (plugin) => { // src/adapters/mdb/db/db.ts var import_jszip = __toESM(require_jszip_min()); import_jszip.default.support.nodebuffer = false; -var getDBFile = async (plugin, path2, isRemote) => { +var getDBFile = async (plugin, path3, isRemote) => { if (isRemote) { - return fetch(path2).then((res) => res.arrayBuffer()); + return fetch(path3).then((res) => res.arrayBuffer()); } - if (!await plugin.middleware.fileExists(path2)) { + if (!await plugin.middleware.fileExists(path3)) { return null; } const file = await plugin.middleware.readBinaryToFile( - path2 + path3 ); return file; }; -var getDB = async (plugin, sqlJS, path2, isRemote) => { - const buf = await getDBFile(plugin, path2, isRemote); +var getDB = async (plugin, sqlJS, path3, isRemote) => { + const buf = await getDBFile(plugin, path3, isRemote); if (buf) { const db = await new sqlJS.Database(new Uint8Array(buf)); try { @@ -133859,8 +144445,8 @@ var getDB = async (plugin, sqlJS, path2, isRemote) => { } return new sqlJS.Database(); }; -var getZippedDB = async (plugin, sqlJS, path2, isRemote) => { - const buf = await getZippedDBFile(plugin, path2, isRemote); +var getZippedDB = async (plugin, sqlJS, path3, isRemote) => { + const buf = await getZippedDBFile(plugin, path3, isRemote); if (buf) { const db = await new sqlJS.Database(new Uint8Array(buf)); try { @@ -133874,30 +144460,30 @@ var getZippedDB = async (plugin, sqlJS, path2, isRemote) => { } return new sqlJS.Database(); }; -var getZippedDBFile = async (plugin, path2, isRemote) => { +var getZippedDBFile = async (plugin, path3, isRemote) => { if (isRemote) { - return fetch(path2).then((res) => res.arrayBuffer()); + return fetch(path3).then((res) => res.arrayBuffer()); } - if (!await plugin.middleware.fileExists(path2)) { + if (!await plugin.middleware.fileExists(path3)) { return null; } const zip = new import_jszip.default(); const file = await plugin.middleware.readBinaryToFile( - path2 + path3 ); - let buffer; + let buffer2; try { - buffer = await zip.loadAsync(file).then((f2) => zip.file("data.mdb").async("arraybuffer")); + buffer2 = await zip.loadAsync(file).then((f2) => zip.file("data.mdb").async("arraybuffer")); } catch (e5) { console.log(e5); } - return buffer; + return buffer2; }; -var saveZippedDBFile = async (plugin, path2, binary) => { +var saveZippedDBFile = async (plugin, path3, binary) => { if (!await plugin.middleware.fileExists( - removeTrailingSlashFromFolder(getParentPathFromString(path2)) + removeTrailingSlashFromFolder(getParentPathFromString(path3)) )) { - await plugin.middleware.createFolder(getParentPathFromString(path2)); + await plugin.middleware.createFolder(getParentPathFromString(path3)); } const zip = new import_jszip.default(); zip.file("data.mdb", binary); @@ -133909,27 +144495,27 @@ var saveZippedDBFile = async (plugin, path2, binary) => { } }); const file = plugin.middleware.writeBinaryToFile( - path2, + path3, zipFile ); return file; }; -var saveDBFile = async (plugin, path2, binary) => { +var saveDBFile = async (plugin, path3, binary) => { if (!await plugin.middleware.fileExists( - removeTrailingSlashFromFolder(getParentPathFromString(path2)) + removeTrailingSlashFromFolder(getParentPathFromString(path3)) )) { - await plugin.middleware.createFolder(getParentPathFromString(path2)); + await plugin.middleware.createFolder(getParentPathFromString(path3)); } const file = plugin.middleware.writeBinaryToFile( - path2, + path3, binary ); return file; }; var mdbTablesToDBTables = (tables, uniques) => { - return Object.keys(tables).reduce((p, c3) => { + return Object.keys(tables).reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { uniques: uniques?.[c3] ?? [], cols: tables[c3].cols.map((f2) => f2.name), @@ -133940,13 +144526,13 @@ var mdbTablesToDBTables = (tables, uniques) => { }; var dbResultsToDBTables = (res) => { return res.reduce( - (p, c3, i4) => [ - ...p, + (p2, c3, i4) => [ + ...p2, { cols: c3.columns, rows: c3 ? c3.values.map( (r2) => c3.columns.reduce( - (prev, curr, index2) => ({ ...prev, [curr]: r2[index2] }), + (prev, curr, index3) => ({ ...prev, [curr]: r2[index3] }), {} ) ) : [] @@ -133955,9 +144541,9 @@ var dbResultsToDBTables = (res) => { [] ); }; -var selectDB = (db, table, condition, fields) => { +var selectDB = (db, table2, condition, fields) => { const fieldsStr = fields ?? "*"; - const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table};`; + const sqlstr = condition ? `SELECT ${fieldsStr} FROM "${table2}" WHERE ${condition};` : `SELECT ${fieldsStr} FROM ${table2};`; let tables; try { tables = dbResultsToDBTables(db.exec(sqlstr)); @@ -133986,16 +144572,16 @@ var insertIntoDB = (db, tables, replace) => { console.log(e5); } }; -var deleteFromDB = (db, table, condition) => { - const sqlstr = `DELETE FROM "${table}" WHERE ${condition};`; +var deleteFromDB = (db, table2, condition) => { + const sqlstr = `DELETE FROM "${table2}" WHERE ${condition};`; try { db.exec(sqlstr); } catch (e5) { console.log(e5); } }; -var dropTable = (db, table) => { - const sqlstr = `DROP TABLE IF EXISTS "${table}";`; +var dropTable = (db, table2) => { + const sqlstr = `DROP TABLE IF EXISTS "${table2}";`; try { db.exec(sqlstr); } catch (e5) { @@ -134008,8 +144594,8 @@ var replaceDB = (db, tables) => { const tableFields = tables[t5].cols; const fieldQuery = serializeSQLFieldNames(uniq(tableFields).filter((f2) => f2).map((f2) => `'${sanitizeSQLStatement(f2)}' char`)); const createQuery = `CREATE TABLE IF NOT EXISTS "${t5}" (${fieldQuery}); `; - const idxQuery = tables[t5].uniques.filter((f2) => f2).reduce((p, c3) => { - return `${p} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t5}_${c3.replace( + const idxQuery = tables[t5].uniques.filter((f2) => f2).reduce((p2, c3) => { + return `${p2} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t5}_${c3.replace( /,/g, "_" )}" ON "${t5}"(${c3});`; @@ -134038,28 +144624,28 @@ var replaceDB = (db, tables) => { } return true; }; -var saveZippedDBToPath = async (plugin, path2, tables) => { +var saveZippedDBToPath = async (plugin, path3, tables) => { const sqlJS = await plugin.sqlJS(); - const db = await getZippedDB(plugin, sqlJS, path2); + const db = await getZippedDB(plugin, sqlJS, path3); if (!db) { db.close(); return false; } replaceDB(db, tables); - await saveZippedDBFile(plugin, path2, db.export().buffer); + await saveZippedDBFile(plugin, path3, db.export().buffer); db.close(); return true; }; -var saveDBToPath = async (plugin, path2, tables) => { +var saveDBToPath = async (plugin, path3, tables) => { const sqlJS = await plugin.sqlJS(); - const db = await getDB(plugin, sqlJS, path2); + const db = await getDB(plugin, sqlJS, path3); if (!db) { db.close(); return false; } const result = replaceDB(db, tables); if (result) { - await saveDBFile(plugin, path2, db.export().buffer); + await saveDBFile(plugin, path3, db.export().buffer); } db.close(); return result; @@ -134073,16 +144659,16 @@ var vaultSchema = { }; // src/adapters/mdb/utils/mdb.ts -var dbTableToMDBTable = (table, schema, fields) => { +var dbTableToMDBTable = (table2, schema, fields) => { return { schema, cols: fields, - rows: table?.rows ?? [] + rows: table2?.rows ?? [] }; }; -var getMDB = async (plugin, path2) => { +var getMDB = async (plugin, path3) => { const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(plugin, path2, false); + const buf = await getDBFile(plugin, path3, false); if (!buf) { return null; } @@ -134106,7 +144692,7 @@ var getMDB = async (plugin, path2) => { db.exec( `SELECT * FROM "${f2.id}"` ) - )[0] })).reduce((p, c3) => ({ ...p, ...c3 }), {}); + )[0] })).reduce((p2, c3) => ({ ...p2, ...c3 }), {}); } catch (e5) { db.close(); return null; @@ -134118,7 +144704,7 @@ var getMDB = async (plugin, path2) => { tables: dbTable }; }; -var getMDBTable = async (adapter, dbPath, table) => { +var getMDBTable = async (adapter, dbPath, table2) => { const sqlJS = await adapter.sqlJS(); const buf = await getDBFile(adapter, dbPath, false); if (!buf) { @@ -134129,10 +144715,10 @@ var getMDBTable = async (adapter, dbPath, table) => { let schema; try { fieldsTables = dbResultsToDBTables( - db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table}'`) + db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table2}'`) ); schema = dbResultsToDBTables( - db.exec(`SELECT * FROM m_schema WHERE id = '${table}'`) + db.exec(`SELECT * FROM m_schema WHERE id = '${table2}'`) )[0]?.rows[0]; } catch (e5) { adapter.plugin.superstate.ui.error(e5); @@ -134148,7 +144734,7 @@ var getMDBTable = async (adapter, dbPath, table) => { try { dbTable = dbResultsToDBTables( db.exec( - `SELECT * FROM "${table}"` + `SELECT * FROM "${table2}"` ) ); } catch (e5) { @@ -134215,24 +144801,24 @@ var getMDBTables = async (plugin, dbPath) => { db.close(); return mdbTables; }; -var deleteMDBTable = async (plugin, table, dbPath) => { +var deleteMDBTable = async (plugin, table2, dbPath) => { const sqlJS = await plugin.sqlJS(); const buf = await getDBFile(plugin, dbPath, false); if (!buf) { return false; } const db = new sqlJS.Database(new Uint8Array(buf)); - deleteFromDB(db, "m_schema", `id = '${sanitizeSQLStatement(table)}'`); - deleteFromDB(db, "m_schema", `def = '${sanitizeSQLStatement(table)}'`); - deleteFromDB(db, "m_fields", `schemaId = '${sanitizeSQLStatement(table)}'`); - dropTable(db, table); + deleteFromDB(db, "m_schema", `id = '${sanitizeSQLStatement(table2)}'`); + deleteFromDB(db, "m_schema", `def = '${sanitizeSQLStatement(table2)}'`); + deleteFromDB(db, "m_fields", `schemaId = '${sanitizeSQLStatement(table2)}'`); + dropTable(db, table2); await saveDBFile(plugin, dbPath, db.export().buffer); db.close(); return true; }; -var getMDBTableSchemas = async (plugin, path2) => { +var getMDBTableSchemas = async (plugin, path3) => { const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(plugin, path2, false); + const buf = await getDBFile(plugin, path3, false); if (!buf) { return null; } @@ -134241,7 +144827,7 @@ var getMDBTableSchemas = async (plugin, path2) => { try { schemas = db.exec(`SELECT * FROM m_schema`); } catch (e5) { - console.log(e5, path2); + console.log(e5, path3); } db.close(); return (schemas[0]?.values ?? []).map((f2) => { @@ -134249,9 +144835,9 @@ var getMDBTableSchemas = async (plugin, path2) => { return { id: id3, name: name317, type, def, predicate, primary }; }); }; -var getMDBTableProperties = async (adapter, path2) => { +var getMDBTableProperties = async (adapter, path3) => { const sqlJS = await adapter.sqlJS(); - const buf = await getDBFile(adapter, path2, false); + const buf = await getDBFile(adapter, path3, false); if (!buf) { return null; } @@ -134345,16 +144931,16 @@ var deletePropertyToDBTables = (column2, fields) => { }; // src/adapters/mdb/utils/schema.ts -var saveSchemaToDBTables = (table, schemas) => { - const newSchema = schemas.find((f2) => f2.id == table.id) ? true : false; +var saveSchemaToDBTables = (table2, schemas) => { + const newSchema = schemas.find((f2) => f2.id == table2.id) ? true : false; const newSchemaTable = newSchema ? { uniques: [], cols: ["id", "name", "type", "def", "predicate", "primary"], - rows: schemas.map((f2) => f2.id == table.id ? table : f2) + rows: schemas.map((f2) => f2.id == table2.id ? table2 : f2) } : { uniques: [], cols: ["id", "name", "type", "def", "predicate", "primary"], - rows: [...schemas, table] + rows: [...schemas, table2] }; return { m_schema: newSchemaTable @@ -134372,9 +144958,9 @@ var MDBFileTypeAdapter = class { const sqljs = await loadSQL(); return sqljs; } - async newFile(parent, name317, type, content3) { + async newFile(parent, name317, type, content5) { const newPath = `${parent}/${name317}.${type}`; - await saveDBToPath(this, newPath, content3); + await saveDBToPath(this, newPath, content5); return this.middleware.getFile(newPath); } initiate(middleware) { @@ -134436,12 +145022,12 @@ var MDBFileTypeAdapter = class { return getMDBTable(this, file.path, fragmentId); } if (fragmentType == "mdbCommand") { - const table = await getMDBTable(this, file.path, fragmentId); - if (table) + const table2 = await getMDBTable(this, file.path, fragmentId); + if (table2) return { - schema: mdbSchemaToCommandSchema(table.schema), - fields: table.cols.filter((f2) => f2.name != "$function"), - code: table.cols.find((f2) => f2.name == "$function")?.value ?? "" + schema: mdbSchemaToCommandSchema(table2.schema), + fields: table2.cols.filter((f2) => f2.name != "$function"), + code: table2.cols.find((f2) => f2.name == "$function")?.value ?? "" }; } if (fragmentType == "mdbCommands") { @@ -134455,49 +145041,49 @@ var MDBFileTypeAdapter = class { }); } } - async newContent(file, fragmentType, name317, content3, options) { + async newContent(file, fragmentType, name317, content5, options) { if (fragmentType == "schema") { const schemas = await this.readContent(file, "schemas", null); - const dbTables = saveSchemaToDBTables(content3, schemas); + const dbTables = saveSchemaToDBTables(content5, schemas); return saveDBToPath(this, file.path, dbTables); } if (fragmentType == "field") { const oldFields = await this.readContent(file, "fields", null); - const dbTables = savePropertyToDBTables(content3, oldFields); + const dbTables = savePropertyToDBTables(content5, oldFields); return saveDBToPath(this, file.path, dbTables); } if (fragmentType == "table") { - return saveDBToPath(this, file.path, { [name317]: content3 }); + return saveDBToPath(this, file.path, { [name317]: content5 }); } if (fragmentType == "tables") { - return saveDBToPath(this, file.path, content3); + return saveDBToPath(this, file.path, content5); } if (fragmentType == "mdbTable") { - return saveDBToPath(this, file.path, mdbTablesToDBTables({ [name317]: content3 })); + return saveDBToPath(this, file.path, mdbTablesToDBTables({ [name317]: content5 })); } if (fragmentType == "mdbFrame") { - return saveDBToPath(this, file.path, mdbFrameToDBTables({ [name317]: content3 })); + return saveDBToPath(this, file.path, mdbFrameToDBTables({ [name317]: content5 })); } } - async saveContent(file, fragmentType, fragmentId, content3) { + async saveContent(file, fragmentType, fragmentId, content5) { if (fragmentType == "schema") { const schemas = await this.readContent(file, "schemas", null) ?? []; - const dbTables = saveSchemaToDBTables(content3(schemas.find((t5) => t5.id == fragmentId)), schemas); + const dbTables = saveSchemaToDBTables(content5(schemas.find((t5) => t5.id == fragmentId)), schemas); return saveDBToPath(this, file.path, dbTables); } if (fragmentType == "field") { const oldFields = await this.readContent(file, "fields", null); const oldField = oldFields.find((t5) => t5.name == fragmentId.name && t5.schemaId == fragmentId.schemaId); - const dbTables = savePropertyToDBTables(content3(oldField), oldFields, oldField); + const dbTables = savePropertyToDBTables(content5(oldField), oldFields, oldField); return saveDBToPath(this, file.path, dbTables); } if (fragmentType == "table") { - return saveDBToPath(this, file.path, { [fragmentId]: content3(this.cache.get(file.path)["tables"][fragmentId]) }); + return saveDBToPath(this, file.path, { [fragmentId]: content5(this.cache.get(file.path)["tables"][fragmentId]) }); } if (fragmentType == "mdbTable") { const mdbTable = await this.readContent(file, "mdbTable", fragmentId); const oldFields = await this.readContent(file, "fields", null); - const tables = { [fragmentId]: content3(mdbTable) }; + const tables = { [fragmentId]: content5(mdbTable) }; const newFields = { m_fields: { uniques: fieldSchema.uniques, @@ -134509,13 +145095,13 @@ var MDBFileTypeAdapter = class { } if (fragmentType == "mdbFrame") { const mdbTable = await this.readContent(file, "mdbFrame", fragmentId); - return saveDBToPath(this, file.path, mdbFrameToDBTables({ [fragmentId]: content3(mdbTable) })); + return saveDBToPath(this, file.path, mdbFrameToDBTables({ [fragmentId]: content5(mdbTable) })); } if (fragmentType == "mdbCommand") { const mdbTable = await this.readContent(file, "mdbCommand", fragmentId); const schemas = await this.readContent(file, "schemas", null) ?? []; const schema = schemas.find((t5) => t5.id == fragmentId); - const newCommand = content3(mdbTable); + const newCommand = content5(mdbTable); const newSchema = frameSchemaToTableSchema(newCommand.schema); if (!import_lodash20.default.isEqual(newSchema, schema)) { const dbTables = saveSchemaToDBTables(newSchema, schemas); @@ -134616,9 +145202,9 @@ var getAllFilesForTag = (plugin, tag2) => { })(); return tagsCache; }; -var addTagToProperties = (manager, tag2, path2) => { +var addTagToProperties = (manager, tag2, path3) => { const newTag = validateName(tag2); - editTagInProperties(manager, "", newTag, path2); + editTagInProperties(manager, "", newTag, path3); }; var positionsForTag = (plugin, tag2, file) => { const currentCache = plugin.app.metadataCache.getFileCache(file); @@ -134649,8 +145235,8 @@ var renameTagInMarkdownFile = async (plugin, tag2, newTag, tFile) => { await editTagInProperties(plugin.superstate.spaceManager, tag2, newTag, tFile.path); } }; -var removeTagInProperties = async (manager, oldTag, path2) => { - const fm = await manager.readProperties(path2); +var removeTagInProperties = async (manager, oldTag, path3) => { + const fm = await manager.readProperties(path3); const processKey = (value) => { if (Array.isArray(value)) { return value.filter((f2) => stringFromTag(oldTag) != f2); @@ -134673,10 +145259,10 @@ var removeTagInProperties = async (manager, oldTag, path2) => { return false; }); editKeys.forEach((tag2) => { - manager.saveProperties(path2, { [tag2]: processKey(fm[tag2]) }); + manager.saveProperties(path3, { [tag2]: processKey(fm[tag2]) }); }); }; -var editTagInProperties = async (manager, oldTag, newTag, path2) => { +var editTagInProperties = async (manager, oldTag, newTag, path3) => { const addTag2 = (value) => { if (Array.isArray(value)) { return uniq([...value, stringFromTag(newTag)]).filter((f2) => f2?.length > 0); @@ -134688,7 +145274,7 @@ var editTagInProperties = async (manager, oldTag, newTag, path2) => { } return stringFromTag(newTag); }; - const fm = await manager.readProperties(path2); + const fm = await manager.readProperties(path3); if (fm) { const processKey = (value) => { if (Array.isArray(value)) { @@ -134718,18 +145304,18 @@ var editTagInProperties = async (manager, oldTag, newTag, path2) => { return false; }); if (editKeys.length > 0) { - editKeys.forEach((key2) => { - manager.saveProperties(path2, { - [key2]: processKey(fm[key2]) + editKeys.forEach((key3) => { + manager.saveProperties(path3, { + [key3]: processKey(fm[key3]) }); }); } else { - manager.saveProperties(path2, { + manager.saveProperties(path3, { tags: addTag2(fm["tags"]) }); } } else { - manager.saveProperties(path2, { + manager.saveProperties(path3, { tags: stringFromTag(newTag) }); } @@ -134739,19 +145325,19 @@ var editTagInFileBody = async (plugin, oldTag, newTag, positions, file) => { if (positions.length == 0) return false; const original = await plugin.files.readTextFromFile(file.path); - let text2 = original; + let text7 = original; let offset2 = 0; for (const { start, end } of positions) { const startOff = start.offset + offset2; const endOff = end.offset + offset2; - if (text2.slice(startOff, endOff) !== oldTag) { + if (text7.slice(startOff, endOff) !== oldTag) { return false; } - text2 = text2.slice(0, startOff) + newTag + text2.slice(startOff + oldTag.length); + text7 = text7.slice(0, startOff) + newTag + text7.slice(startOff + oldTag.length); offset2 += offsetOffset; } - if (text2 !== original) { - await plugin.files.writeTextToFile(file.path, text2); + if (text7 !== original) { + await plugin.files.writeTextToFile(file.path, text7); return true; } }; @@ -134803,19 +145389,19 @@ var LocalStorageCache = class { reset() { replaceDB(this.db, this.defaultTables); } - async store(path2, cache2, type) { + async store(path3, cache2, type) { if (!this.db) return; await insertIntoDB(this.db, { - [type]: { ...this.defaultTables[type], rows: [{ path: path2, cache: cache2, version: this.indexVersion }] } + [type]: { ...this.defaultTables[type], rows: [{ path: path3, cache: cache2, version: this.indexVersion }] } }, true); this.debounceSaveSpaceDatabase(); return; } - async remove(path2, type) { + async remove(path3, type) { if (!this.db) return; - await deleteFromDB(this.db, type, `path='${path2}'`); + await deleteFromDB(this.db, type, `path='${path3}'`); this.debounceSaveSpaceDatabase(); return; } @@ -134842,9 +145428,9 @@ var MobileCachePersister = class { this.indexVersion = Date.now().toString(); this.debounceSaveSpaceDatabase = (0, import_lodash23.debounce)( (maps) => { - const tables = Object.keys(maps).reduce((p, c3) => { + const tables = Object.keys(maps).reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { ...CacheDBSchema, rows: [...this.maps[c3].values()] @@ -134879,7 +145465,7 @@ var MobileCachePersister = class { replaceDB(db, this.types.reduce((acc, type) => ({ ...acc, [type]: CacheDBSchema }), {})); await saveZippedDBFile(this.mdbAdapter, this.storageDBPath, db.export().buffer); } - this.maps = this.types.reduce((p, type) => ({ ...p, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {}); + this.maps = this.types.reduce((p2, type) => ({ ...p2, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {}); db.close(); } async reset() { @@ -134889,13 +145475,13 @@ var MobileCachePersister = class { this.maps = this.types.reduce((acc, type) => ({ ...acc, [type]: new Map((selectDB(db, type)?.rows ?? []).map((f2) => [f2.path, f2])) }), {}); db.close(); } - async store(path2, cache2, type) { - this.maps[type].set(path2, { path: path2, cache: cache2, version: this.indexVersion }); + async store(path3, cache2, type) { + this.maps[type].set(path3, { path: path3, cache: cache2, version: this.indexVersion }); this.debounceSaveSpaceDatabase(this.maps); return; } - async remove(path2, type) { - this.maps[type].delete(path2); + async remove(path3, type) { + this.maps[type].delete(path3); this.debounceSaveSpaceDatabase(this.maps); return; } @@ -135036,56 +145622,56 @@ var ObsidianFileSystem = class { this.vaultQueue = this.vaultQueue.then(operation).catch(() => { }); } - updateFileCache(path2, cache2, refresh) { + updateFileCache(path3, cache2, refresh) { if (!cache2) return; - const oldCache = this.cache.get(path2); + const oldCache = this.cache.get(path3); const newCache = { ...oldCache, ...cache2 }; if (oldCache && import_lodash24.default.isEqual(newCache, oldCache)) { return; } - this.cache.set(path2, newCache); - this.persister.store(path2, JSON.stringify(newCache), "file"); + this.cache.set(path3, newCache); + this.persister.store(path3, JSON.stringify(newCache), "file"); if (refresh) - this.middleware.eventDispatch.dispatchEvent("onCacheUpdated", { path: path2 }); + this.middleware.eventDispatch.dispatchEvent("onCacheUpdated", { path: path3 }); } readAllTags() { return loadTags(this.plugin.app, this.plugin.superstate.settings); } - async addTagToFile(path2, tag2) { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + async addTagToFile(path3, tag2) { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (!file) return; if (file.extension == "md") { addTagToProperties(this.plugin.superstate.spaceManager, tag2, file.path); return; } - const vaultItem = this.cache.get(path2); + const vaultItem = this.cache.get(path3); if (!vaultItem) return; - this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags, tag2])); + this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags, tag2])); } - async renameTagForFile(path2, oldTag, newTag) { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + async renameTagForFile(path3, oldTag, newTag) { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (file.extension == "md") { renameTagInMarkdownFile(this.plugin, oldTag, newTag, file); return; } - const vaultItem = this.cache.get(path2); + const vaultItem = this.cache.get(path3); if (!vaultItem) return; - this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != oldTag), newTag])); + this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != oldTag), newTag])); } - async removeTagFromFile(path2, tag2) { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + async removeTagFromFile(path3, tag2) { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (file.extension == "md") { removeTagFromMarkdownFile(this.plugin, tag2, file); return; } - const vaultItem = this.cache.get(path2); + const vaultItem = this.cache.get(path3); if (!vaultItem) return; - this.updateFileLabel(path2, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != tag2)])); + this.updateFileLabel(path3, "tags", serializeMultiDisplayString([...vaultItem.tags.filter((t5) => t5 != tag2)])); } async loadCacheFromObsidianCache() { await this.persister.initialize(); @@ -135166,25 +145752,25 @@ var ObsidianFileSystem = class { allFiles() { return getAllAbstractFilesInVault(this.plugin.app).map((f2) => tFileToAFile(f2)); } - getFileCache(path2, source) { - return this.cache.get(path2); + getFileCache(path3, source) { + return this.cache.get(path3); } - parentPathForPath(path2) { + parentPathForPath(path3) { return removeTrailingSlashFromFolder( - getParentPathFromString(path2) + getParentPathFromString(path3) ); } - resolvePath(path2, source) { - if (!source || !path2) - return path2; - return this.plugin.app.metadataCache.getFirstLinkpathDest(path2, source)?.path ?? path2; + resolvePath(path3, source) { + if (!source || !path3) + return path3; + return this.plugin.app.metadataCache.getFirstLinkpathDest(path3, source)?.path ?? path3; } - updateFileLabel(path2, label, content3) { + updateFileLabel(path3, label, content5) { { - const newVaultDB = this.vaultDBCache.map((f2) => f2.path == path2 ? { ...f2, [label]: content3 } : f2); + const newVaultDB = this.vaultDBCache.map((f2) => f2.path == path3 ? { ...f2, [label]: content5 } : f2); this.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultDB } }); - const file = this.cache.get(path2); - this.middleware.updateFileCache(path2, { label: { ...file.label, [label]: content3 } }, true); + const file = this.cache.get(path3); + this.middleware.updateFileCache(path3, { label: { ...file.label, [label]: content5 } }, true); } } async saveSpacesDatabaseToDisk(tables, save = true) { @@ -135201,23 +145787,23 @@ var ObsidianFileSystem = class { initiate(middleware) { this.middleware = middleware; } - resourcePathForPath(path2) { - if (!path2) - return path2; - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + resourcePathForPath(path3) { + if (!path3) + return path3; + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (file instanceof import_obsidian20.TFile) { return this.plugin.app.vault.getResourcePath(file); - } else if (path2.match(urlRegex)) { - return path2; + } else if (path3.match(urlRegex)) { + return path3; } const returnPath = this.parentPathForPath(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot())); - return `${returnPath}/${path2}`; + return `${returnPath}/${path3}`; } async getRoot() { return tFileToAFile(this.plugin.app.vault.getRoot()); } - async copyFile(path2, folder, newName) { - const file = await this.getFile(path2); + async copyFile(path3, folder, newName) { + const file = await this.getFile(path3); if (!file) return; newName = newName ? file.extension?.length > 0 ? newName + "." + file.extension : newName : file.filename; @@ -135233,7 +145819,7 @@ var ObsidianFileSystem = class { const files = await this.plugin.app.vault.adapter.list(folder2); for (const f2 of files.files) { if (newName != file.name) { - if (folder2 == path2 && f2.split("/").pop() == file.name + ".md") { + if (folder2 == path3 && f2.split("/").pop() == file.name + ".md") { await this.plugin.app.vault.adapter.copy(f2, newPath2 + "/" + newName + ".md"); continue; } @@ -135267,96 +145853,96 @@ var ObsidianFileSystem = class { this.cache.set(newFile.path, { ...this.cache.get(file.path), file: newFile, - label: { ...this.cache.get(path2)?.label, name: newFile.name }, + label: { ...this.cache.get(path3)?.label, name: newFile.name }, parent: newFile.parent, type: newFile.isFolder ? "space" : "file", subtype: newFile.isFolder ? "folder" : newFile.extension }); return newPath; } - async writeTextToFile(path2, content3) { - const newFile = this.plugin.app.vault.getAbstractFileByPath(path2); + async writeTextToFile(path3, content5) { + const newFile = this.plugin.app.vault.getAbstractFileByPath(path3); if (!newFile) { - await this.plugin.app.vault.adapter.write(path2, content3); + await this.plugin.app.vault.adapter.write(path3, content5); } else { - await this.plugin.app.vault.modify(newFile, content3); + await this.plugin.app.vault.modify(newFile, content5); } } - async readTextFromFile(path2) { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + async readTextFromFile(path3) { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (file) { return this.plugin.app.vault.read(file); } - if (await this.fileExists(path2)) - return this.plugin.app.vault.adapter.read(path2); + if (await this.fileExists(path3)) + return this.plugin.app.vault.adapter.read(path3); return null; } - async writeBinaryToFile(path2, buffer) { + async writeBinaryToFile(path3, buffer2) { return this.plugin.app.vault.adapter.writeBinary( - path2, - buffer + path3, + buffer2 ); } - async readBinaryToFile(path2) { - return this.plugin.app.vault.adapter.readBinary(path2); + async readBinaryToFile(path3) { + return this.plugin.app.vault.adapter.readBinary(path3); } - async renameFile(path2, newPath) { + async renameFile(path3, newPath) { return this.plugin.app.fileManager.renameFile( - this.plugin.app.vault.getAbstractFileByPath(path2), + this.plugin.app.vault.getAbstractFileByPath(path3), newPath ); } - async createFolder(path2) { - if (!await this.fileExists(path2)) { - await this.plugin.app.vault.adapter.mkdir(path2); - return this.getFile(path2); + async createFolder(path3) { + if (!await this.fileExists(path3)) { + await this.plugin.app.vault.adapter.mkdir(path3); + return this.getFile(path3); } else { - return this.getFile(path2); + return this.getFile(path3); } } - async fileExists(path2) { - return this.plugin.app.vault.adapter.exists(path2); + async fileExists(path3) { + return this.plugin.app.vault.adapter.exists(path3); } - async getFile(path2, source) { + async getFile(path3, source) { let aFile; if (source) { - aFile = tFileToAFile(this.plugin.app.metadataCache.getFirstLinkpathDest(path2, source)); + aFile = tFileToAFile(this.plugin.app.metadataCache.getFirstLinkpathDest(path3, source)); } else { - aFile = tFileToAFile(this.plugin.app.vault.getAbstractFileByPath(path2)); + aFile = tFileToAFile(this.plugin.app.vault.getAbstractFileByPath(path3)); } if (!aFile) { - if (!await this.fileExists(path2)) { + if (!await this.fileExists(path3)) { return null; } - const fileStat = await this.plugin.app.vault.adapter.stat(path2); + const fileStat = await this.plugin.app.vault.adapter.stat(path3); if (!fileStat) return null; const type = fileStat?.type; - const extension = type == "file" ? path2.split(".").pop() : null; - const folder = path2.split("/").slice(0, -1).join("/"); - const filename = path2.split("/").pop(); + const extension2 = type == "file" ? path3.split(".").pop() : null; + const folder = path3.split("/").slice(0, -1).join("/"); + const filename = path3.split("/").pop(); const name317 = type == "file" ? filename.substring(0, filename.lastIndexOf(".")) : filename; aFile = { - path: path2, + path: path3, name: name317, filename, parent: folder, isFolder: type == "folder", - extension + extension: extension2 }; } return aFile; } - async deleteFile(path2) { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + async deleteFile(path3) { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (!file) { - const fileExists = await this.fileExists(path2); + const fileExists = await this.fileExists(path3); if (fileExists) { - const stat = await this.plugin.app.vault.adapter.stat(path2); + const stat = await this.plugin.app.vault.adapter.stat(path3); if (stat.type == "folder") { - return this.plugin.app.vault.adapter.rmdir(path2, true); + return this.plugin.app.vault.adapter.rmdir(path3, true); } else { - return this.plugin.app.vault.adapter.remove(path2); + return this.plugin.app.vault.adapter.remove(path3); } } } @@ -135374,13 +145960,13 @@ var ObsidianFileSystem = class { filesForTag(tag2) { return getAllFilesForTag(this.plugin, tag2); } - childrenForFolder(path2, type) { + childrenForFolder(path3, type) { if (type == "folder") { - return this.plugin.app.vault.adapter.list(path2).then((g) => g.folders); + return this.plugin.app.vault.adapter.list(path3).then((g) => g.folders); } else if (type == "file") { - return this.plugin.app.vault.adapter.list(path2).then((g) => g.files); + return this.plugin.app.vault.adapter.list(path3).then((g) => g.files); } - return this.plugin.app.vault.adapter.list(path2).then((g) => [...g.files, ...g.folders]); + return this.plugin.app.vault.adapter.list(path3).then((g) => [...g.files, ...g.folders]); } }; @@ -135511,13 +146097,13 @@ var ObsidianMarkdownFiletypeAdapter = class { const fm = frontMatterForFile(this.app, tfile); const fmKeys = frontMatterKeys(fm); const rows = fmKeys.reduce( - (p, c3) => ({ ...p, [c3]: parseProperty(c3, fm[c3]) }), + (p2, c3) => ({ ...p2, [c3]: parseProperty(c3, fm[c3]) }), {} ); return rows; } } - async newFile(parent, name317, type, content3) { + async newFile(parent, name317, type, content5) { let parentFolder = getAbstractFileAtPath(this.app, parent); if (!parentFolder) { await this.middleware.createFolder(parent); @@ -135527,22 +146113,22 @@ var ObsidianMarkdownFiletypeAdapter = class { parentFolder ? parentFolder instanceof import_obsidian21.TFolder ? parentFolder : parentFolder.parent : this.app.vault.getRoot(), name317 ).then(async (f2) => { - if (content3) { - await this.app.vault.modify(f2, content3); + if (content5) { + await this.app.vault.modify(f2, content5); } return tFileToAFile(f2); }); } - async saveContent(file, fragmentType, fragmentId, content3) { + async saveContent(file, fragmentType, fragmentId, content5) { if (fragmentType == "label") { const afile = this.app.vault.getAbstractFileByPath(file.path); if (afile && afile instanceof import_obsidian21.TFile) { if (this.app.fileManager.processFrontMatter) { await this.app.fileManager.processFrontMatter(afile, (frontmatter) => { if (fragmentId == "sticker") { - frontmatter[this.plugin.superstate.settings.fmKeySticker] = content3(frontmatter); + frontmatter[this.plugin.superstate.settings.fmKeySticker] = content5(frontmatter); } else if (fragmentId == "color") { - frontmatter[this.plugin.superstate.settings.fmKeyColor] = content3(frontmatter); + frontmatter[this.plugin.superstate.settings.fmKeyColor] = content5(frontmatter); } }); } @@ -135553,7 +146139,7 @@ var ObsidianMarkdownFiletypeAdapter = class { if (afile && afile instanceof import_obsidian21.TFile) { if (this.app.fileManager.processFrontMatter) { await this.app.fileManager.processFrontMatter(afile, (frontmatter) => { - const newFrontmatter = content3(frontmatter); + const newFrontmatter = content5(frontmatter); const newKeys = Object.keys(newFrontmatter); newKeys.forEach((f2) => { frontmatter[f2] = newFrontmatter?.[f2]; @@ -135795,17 +146381,17 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest { return; if (cmd.value == "note") { const offset2 = _evt.target.getBoundingClientRect(); - showLinkMenu(offset2, this.plugin.superstate, (link) => { - editor.replaceRange(`![![${link}]]`, { ...start, ch: startCh }, end); + showLinkMenu(offset2, this.plugin.superstate, (link3) => { + editor.replaceRange(`![![${link3}]]`, { ...start, ch: startCh }, end); this.resetInfos(); this.close(); }); } else if (cmd.value == "context") { const offset2 = _evt.target.getBoundingClientRect(); - showSpacesMenu(offset2, this.plugin.superstate, (link) => { + showSpacesMenu(offset2, this.plugin.superstate, (link3) => { editor.replaceRange( contextEmbedStringFromContext( - this.plugin.superstate.spacesIndex.get(link), + this.plugin.superstate.spacesIndex.get(link3), "files" ), { ...start, ch: startCh }, @@ -135820,8 +146406,8 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest { }); } else if (cmd.value == "link") { const offset2 = _evt.target.getBoundingClientRect(); - showLinkMenu(offset2, this.plugin.superstate, (link) => { - editor.replaceRange(`[[${link}]]`, { ...start, ch: startCh }, end); + showLinkMenu(offset2, this.plugin.superstate, (link3) => { + editor.replaceRange(`[[${link3}]]`, { ...start, ch: startCh }, end); this.resetInfos(); this.close(); }); @@ -135829,9 +146415,9 @@ var MakeMenu = class extends import_obsidian22.EditorSuggest { this.plugin.superstate.ui.openPalette((_props) => /* @__PURE__ */ import_react192.default.createElement(ImageModal_default, { superstate: this.plugin.superstate, hide: _props.hide, - selectedPath: (image) => { + selectedPath: (image3) => { editor.replaceRange( - `![[${image}]]`, + `![[${image3}]]`, { ...start, ch: startCh }, end ); @@ -141283,8 +151869,8 @@ var StickerMenu = class extends import_obsidian23.EditorSuggest { this.cmdStartCh = 0; this.plugin = plugin; this.emojis = Object.keys(emojis).reduce( - (p, c3) => [ - ...p, + (p2, c3) => [ + ...p2, ...emojis[c3].map((e5) => ({ label: e5.n[0], desc: e5.n[1], @@ -141389,9 +151975,9 @@ var modifyTabSticker = (plugin) => { if (pathCache?.label.sticker && leaf.tabHeaderInnerIconEl) { const [stickerType, stickerPath] = parseStickerString(pathCache.label.sticker); if (stickerType == "image") { - const path2 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath)); - if (path2) - leaf.tabHeaderInnerIconEl.innerHTML = ``; + const path3 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath)); + if (path3) + leaf.tabHeaderInnerIconEl.innerHTML = ``; } else { const icon = stickerFromString(pathCache.label.sticker, plugin); leaf.tabHeaderInnerIconEl.innerHTML = icon; @@ -141406,10 +151992,10 @@ var modifyTabSticker = (plugin) => { if (fileCache?.label?.sticker && leaf.tabHeaderInnerIconEl) { const [stickerType, stickerPath] = parseStickerString(fileCache.label.sticker); if (stickerType == "image") { - const path2 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath)); - if (!path2) - return path2; - leaf.tabHeaderInnerIconEl.innerHTML = ``; + const path3 = plugin.superstate.ui.getUIPath(plugin.superstate.imagesCache.get(stickerPath)); + if (!path3) + return path3; + leaf.tabHeaderInnerIconEl.innerHTML = ``; } else { const icon = stickerFromString(fileCache.label.sticker, plugin); leaf.tabHeaderInnerIconEl.innerHTML = icon; @@ -141433,7 +152019,7 @@ function useInTreeCreateRoot() { }; const createRoot2 = (0, import_react194.useCallback)( (container, options) => { - const root = { + const root4 = { render: (children) => { setRoots((roots2) => { const newRoots = new Map(roots2); @@ -141458,15 +152044,15 @@ function useInTreeCreateRoot() { return new Map(roots2).set(container, null); }); setRootMap((r2) => { - return new Map(r2).set(container, root); + return new Map(r2).set(container, root4); }); - return root; + return root4; }, [] ); const portals = (0, import_react194.useMemo)(() => { - return [...roots.entries()].map(([container, root]) => { - return (0, import_react_dom12.createPortal)(root, container); + return [...roots.entries()].map(([container, root4]) => { + return (0, import_react_dom12.createPortal)(root4, container); }); }, [roots]); return { createRoot: createRoot2, portals, getRoot }; @@ -141609,20 +152195,20 @@ var showModal = (props) => { portalElement.classList.add("mk-modal-wrapper"); } document.body.appendChild(portalElement); - const hideFunction = (root2) => { + const hideFunction = (root5) => { let hasBeenCalled = false; return () => { if (hasBeenCalled) return; - root2.unmount(); + root5.unmount(); document.body.removeChild(portalElement); hasBeenCalled = true; }; }; - const root = props.ui.createRoot(portalElement); - const hide = hideFunction(root); + const root4 = props.ui.createRoot(portalElement); + const hide = hideFunction(root4); const updateRoot = (newProps) => { - root.render( + root4.render( /* @__PURE__ */ import_react197.default.createElement(ModalWrapper, { ui: props.ui.manager, hide: () => hide(), @@ -141677,14 +152263,14 @@ var HiddenPaths = (props) => { superstate.saveSettings(); superstate.initializePaths(); }; - const removeExtension = (index2) => { - superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index2); + const removeExtension = (index3) => { + superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index3); superstate.saveSettings(); superstate.initializePaths(); }; - const removeItem = (index2) => { + const removeItem = (index3) => { superstate.settings.hiddenFiles = superstate.settings.hiddenFiles.filter( - (f2, i4) => i4 != index2 + (f2, i4) => i4 != index3 ); superstate.saveSettings(); superstate.initializePaths(); @@ -141736,8 +152322,8 @@ var HiddenPaths = (props) => { className: "setting-item setting-item-heading" }, i18n_default.labels.hiddenFilePattern), /* @__PURE__ */ import_react198.default.createElement("div", { className: "setting-item-description" - }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenExtensions.map((f2, index2) => /* @__PURE__ */ import_react198.default.createElement("div", { - key: index2, + }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenExtensions.map((f2, index3) => /* @__PURE__ */ import_react198.default.createElement("div", { + key: index3, className: "mobile-option-setting-item" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "mobile-option-setting-item-name" @@ -141747,7 +152333,7 @@ var HiddenPaths = (props) => { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//close") }, - onClick: () => removeExtension(index2) + onClick: () => removeExtension(index3) })))), /* @__PURE__ */ import_react198.default.createElement("div", { className: "setting-item" }, /* @__PURE__ */ import_react198.default.createElement("input", { @@ -141760,8 +152346,8 @@ var HiddenPaths = (props) => { className: "setting-item setting-item-heading" }, i18n_default.subViews.filesAndFolders), /* @__PURE__ */ import_react198.default.createElement("div", { className: "setting-item-description" - }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenPaths.map((f2, index2) => /* @__PURE__ */ import_react198.default.createElement("div", { - key: index2, + }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react198.default.createElement("div", null, hiddenPaths.map((f2, index3) => /* @__PURE__ */ import_react198.default.createElement("div", { + key: index3, className: "mobile-option-setting-item" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "mobile-option-setting-item-name" @@ -141771,7 +152357,7 @@ var HiddenPaths = (props) => { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//close") }, - onClick: () => removeItem(index2) + onClick: () => removeItem(index3) })))), /* @__PURE__ */ import_react198.default.createElement("div", { className: "setting-item" }, /* @__PURE__ */ import_react198.default.createElement("button", { @@ -141795,11 +152381,11 @@ var showMainMenu = (el, superstate, app2) => { if (isMobile) { const mobileDrawer = app2.workspace.leftSplit; const leaves = mobileDrawer.children; - const index2 = leaves.reduce((p, c3, i4) => { - return c3.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p; + const index3 = leaves.reduce((p2, c3, i4) => { + return c3.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p2; }, -1); - spaceActive2 = index2 == mobileDrawer.currentTab; - leafs2.push(...leaves.filter((l2, i4) => i4 != index2)); + spaceActive2 = index3 == mobileDrawer.currentTab; + leafs2.push(...leaves.filter((l2, i4) => i4 != index3)); } return { leafs: leafs2, spaceActive: spaceActive2 }; }; @@ -141926,8 +152512,8 @@ var ObsidianUI = class { this.getSticker = (icon) => { return stickerFromString(icon, this.plugin); }; - this.openToast = (content3) => { - new import_obsidian25.Notice(content3); + this.openToast = (content5) => { + new import_obsidian25.Notice(content5); }; this.openPalette = (modal, className) => { return showModal({ ui: this, fc: modal, isPalette: true, className }); @@ -141935,14 +152521,14 @@ var ObsidianUI = class { this.openModal = (title, modal, className, props) => { return showModal({ ui: this, fc: modal, title, className, props }); }; - this.openPopover = (position, popover) => { + this.openPopover = (position3, popover) => { }; this.dragStarted = (e5, paths) => { if (paths.length == 0) return; if (paths.length == 1) { - const path2 = paths[0]; - const file = getAbstractFileAtPath(this.plugin.app, path2); + const path3 = paths[0]; + const file = getAbstractFileAtPath(this.plugin.app, path3); if (!file) return; if (file instanceof import_obsidian25.TFile) { @@ -142006,8 +152592,8 @@ var ObsidianUI = class { html: this.plugin.superstate.iconsCache.get(f2) })); const allEmojis = Object.keys(emojis).reduce( - (p, c3) => [ - ...p, + (p2, c3) => [ + ...p2, ...emojis[c3].map((e5) => ({ type: "emoji", name: e5.n[0], @@ -142019,8 +152605,8 @@ var ObsidianUI = class { ); return [...allEmojis, ...allCustom, ...allLucide]; }; - this.getUIPath = (path2, thumbnail) => { - const file = this.plugin.app.vault.getAbstractFileByPath(path2); + this.getUIPath = (path3, thumbnail) => { + const file = this.plugin.app.vault.getAbstractFileByPath(path3); if (file instanceof import_obsidian25.TFile) { if (thumbnail) { const thumb = this.plugin.superstate.pathsIndex.get(file.path)?.label?.thumbnail; @@ -142029,25 +152615,25 @@ var ObsidianUI = class { } } return this.plugin.app.vault.getResourcePath(file); - } else if (path2?.match(urlRegex)) { - return path2; + } else if (path3?.match(urlRegex)) { + return path3; } const returnPath = getParentPathFromString( this.plugin.app.vault.getResourcePath( this.plugin.app.vault.getRoot() ) ); - return `${returnPath}${path2}`; + return `${returnPath}${path3}`; }; - this.viewsByPath = (path2) => { - const abstractFile = getAbstractFileAtPath(this.plugin.app, path2); + this.viewsByPath = (path3) => { + const abstractFile = getAbstractFileAtPath(this.plugin.app, path3); if (abstractFile instanceof import_obsidian25.TFile) { return this.plugin.app.workspace.getLeavesOfType("markdown").filter((f2) => { - return f2.view.file?.path == path2; + return f2.view.file?.path == path3; }).map((f2) => { return { path: f2.view.file?.path, - openPath: (path3) => { + openPath: (path4) => { f2.openFile(abstractFile); }, parent: null, @@ -142056,14 +152642,14 @@ var ObsidianUI = class { }); } else { return this.plugin.app.workspace.getLeavesOfType(SPACE_VIEW_TYPE).filter((f2) => { - return f2.view.getState().path == path2; + return f2.view.getState().path == path3; }).map((f2) => { return { path: f2.view.getState().path, - openPath: (path3) => { + openPath: (path4) => { f2.setViewState({ type: SPACE_VIEW_TYPE, - state: { path: path3 } + state: { path: path4 } }); }, parent: null, @@ -142072,13 +152658,13 @@ var ObsidianUI = class { }); } }; - this.openPath = (path2, newLeaf, source, props) => { + this.openPath = (path3, newLeaf, source, props) => { if (newLeaf == "system") { - this.plugin.app.showInFolder(path2); + this.plugin.app.showInFolder(path3); return; } if (newLeaf == "hover") { - this.plugin.app.workspace.trigger("link-hover", {}, source, path2, path2); + this.plugin.app.workspace.trigger("link-hover", {}, source, path3, path3); return; } else if (source) { openPathInElement( @@ -142088,12 +152674,12 @@ var ObsidianUI = class { null, async (editor) => { const leaf2 = editor.attachLeaf(); - if (this.plugin.app.vault.getAbstractFileByPath(path2) instanceof import_obsidian25.TFile) { + if (this.plugin.app.vault.getAbstractFileByPath(path3) instanceof import_obsidian25.TFile) { await leaf2.openFile( - this.plugin.app.vault.getAbstractFileByPath(path2) + this.plugin.app.vault.getAbstractFileByPath(path3) ); } else { - await openPath(leaf2, path2, this.plugin, true); + await openPath(leaf2, path3, this.plugin, true); } if (!props || !leaf2.view?.editor) { return; @@ -142136,7 +152722,7 @@ var ObsidianUI = class { return; } const leaf = getLeaf(this.plugin.app, newLeaf); - openPath(leaf, path2, this.plugin); + openPath(leaf, path3, this.plugin); }; this.primaryInteractionType = () => { return import_obsidian25.Platform.isMobile ? 0 /* Touch */ : 1 /* Mouse */; @@ -142165,9 +152751,9 @@ var migrate09 = async (plugin) => { if (needsMigrate) { const updatedFrames = { ...f2.frames[mainFrameID], cols: f2.frames[mainFrameID].cols.filter((f3) => f3.name != "space" && f3.name != "note"), rows: f2.frames[mainFrameID].rows.map( (r2) => { - const node = frameToNode(r2); - if (node.props?.value == "main.props.note" || node.props?.value == "main.props.space") { - const newNode2 = { ...node, props: { ...node.props, value: node.props.value.replace("main.props", "$contexts.$space") } }; + const node2 = frameToNode(r2); + if (node2.props?.value == "main.props.note" || node2.props?.value == "main.props.space") { + const newNode2 = { ...node2, props: { ...node2.props, value: node2.props.value.replace("main.props", "$contexts.$space") } }; return nodeToFrame(newNode2); } return r2; @@ -142342,7 +152928,7 @@ var import_react201 = __toESM(require_react()); var BlinkComponent = (props) => { const [previewPath, setPreviewPath] = (0, import_react201.useState)(null); const [query, setQuery] = (0, import_react201.useState)(""); - const [index2, setIndex] = (0, import_react201.useState)(0); + const [index3, setIndex] = (0, import_react201.useState)(0); const onChange = (query2) => { setQuery(query2); }; @@ -142367,10 +152953,10 @@ var BlinkComponent = (props) => { }, [query, filters]); const [suggestions, setFilteredPaths] = (0, import_react201.useState)([]); (0, import_react201.useEffect)(() => { - const runQuery = (path2, _queries) => { + const runQuery = (path3, _queries) => { props.superstate.searcher.run({ type: "search", - path: path2, + path: path3, payload: { queries: _queries, count: 10 } }).then( (g) => setFilteredPaths( @@ -142386,11 +152972,11 @@ var BlinkComponent = (props) => { (0, import_lodash25.debounce)(() => runQuery(query, queries), 300)(); }, [query, queries]); (0, import_react201.useEffect)(() => { - const path2 = suggestions[index2]?.value; - if (!path2 || path2 == previewPath) + const path3 = suggestions[index3]?.value; + if (!path3 || path3 == previewPath) return; - setPreviewPath(suggestions[index2]?.value); - }, [index2, suggestions]); + setPreviewPath(suggestions[index3]?.value); + }, [index3, suggestions]); const selectItem = (item, e5) => { if (!item) return; @@ -142411,7 +152997,7 @@ var BlinkComponent = (props) => { } if (e5.key == "ArrowUp") { const size2 = 0; - const newIndex = index2 <= size2 ? suggestions.length - 1 : index2 - 1; + const newIndex = index3 <= size2 ? suggestions.length - 1 : index3 - 1; if (suggestions.length == 0) return; if (suggestions[newIndex].disabled) { @@ -142423,7 +153009,7 @@ var BlinkComponent = (props) => { } if (e5.key == "ArrowDown") { const size2 = suggestions.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; if (suggestions[newIndex].disabled) { setIndex(newIndex >= size2 ? 0 : newIndex + 1); } else { @@ -142434,7 +153020,7 @@ var BlinkComponent = (props) => { } if (e5.key == "Enter") { props.superstate.ui.openPath( - suggestions[index2].value, + suggestions[index3].value, e5.ctrlKey || e5.metaKey ? e5.altKey ? "split" : "tab" : false ); props.hide(); @@ -142511,7 +153097,7 @@ var BlinkComponent = (props) => { selectOption: selectItem, id: "", classNames: CLASS_NAMES2, - index: index2, + index: index3, setIndex, allowNew: false, ui: props.superstate.ui, @@ -142598,16 +153184,16 @@ var TestToggleSection = (props) => { }; var TestComponent = (props) => { const { superstate } = props; - const [space2, setSpace] = (0, import_react203.useState)(null); - const [path2, setPath] = (0, import_react203.useState)(null); + const [space3, setSpace] = (0, import_react203.useState)(null); + const [path3, setPath] = (0, import_react203.useState)(null); const [sticker, setSticker] = (0, import_react203.useState)(null); - const [image, setImage] = (0, import_react203.useState)(null); + const [image3, setImage] = (0, import_react203.useState)(null); const [output, setOutput] = (0, import_react203.useState)(""); (0, import_react203.useEffect)(() => { superstate.eventsDispatcher.addListener( "spaceStateUpdated", (payload) => { - if (payload.path == space2?.path) { + if (payload.path == space3?.path) { setSpace(superstate.spacesIndex.get(payload.path)); } } @@ -142615,7 +153201,7 @@ var TestComponent = (props) => { superstate.eventsDispatcher.addListener( "pathStateUpdated", (payload) => { - if (payload.path == path2?.path) { + if (payload.path == path3?.path) { setPath(superstate.pathsIndex.get(payload.path)); } } @@ -142632,11 +153218,11 @@ var TestComponent = (props) => { section: "Space" }, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => setSpace(superstate.spacesIndex.get(value)) - }, "Select Space"), /* @__PURE__ */ import_react203.default.createElement("p", null, space2?.path ?? "No Selected Space", /* @__PURE__ */ import_react203.default.createElement("button", { - onClick: () => setSpace(superstate.spacesIndex.get(space2.path)) + }, "Select Space"), /* @__PURE__ */ import_react203.default.createElement("p", null, space3?.path ?? "No Selected Space", /* @__PURE__ */ import_react203.default.createElement("button", { + onClick: () => setSpace(superstate.spacesIndex.get(space3.path)) }, "Refresh"), /* @__PURE__ */ import_react203.default.createElement("button", { - onClick: () => setPath(superstate.pathsIndex.get(space2.path)) - }, "Set Path")), space2 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Contexts ", space2.contexts?.map((f2) => f2), superstate.getSpaceItems(space2.path).map((f2, i4) => /* @__PURE__ */ import_react203.default.createElement("div", { + onClick: () => setPath(superstate.pathsIndex.get(space3.path)) + }, "Set Path")), space3 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Contexts ", space3.contexts?.map((f2) => f2), superstate.getSpaceItems(space3.path).map((f2, i4) => /* @__PURE__ */ import_react203.default.createElement("div", { key: i4 }, f2.path, " ", /* @__PURE__ */ import_react203.default.createElement("button", { onClick: () => setSpace(superstate.spacesIndex.get(f2.path)) @@ -142648,13 +153234,13 @@ var TestComponent = (props) => { section: "Path" }, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => setPath(superstate.pathsIndex.get(value)) - }, "Select Path"), /* @__PURE__ */ import_react203.default.createElement("p", null, path2?.path ?? "No Selected Path"), path2 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Sticker", /* @__PURE__ */ import_react203.default.createElement("div", { + }, "Select Path"), /* @__PURE__ */ import_react203.default.createElement("p", null, path3?.path ?? "No Selected Path"), path3 && /* @__PURE__ */ import_react203.default.createElement("div", null, "Sticker", /* @__PURE__ */ import_react203.default.createElement("div", { dangerouslySetInnerHTML: { - __html: superstate.ui.getSticker(path2?.label.sticker) + __html: superstate.ui.getSticker(path3?.label.sticker) }, style: { height: "50px", width: "50px" } }), "Banner", /* @__PURE__ */ import_react203.default.createElement("img", { - src: superstate.ui.getUIPath(path2?.metadata.banner), + src: superstate.ui.getUIPath(path3?.metadata.banner), style: { height: "50px", width: "50px" } }))), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Sticker"), /* @__PURE__ */ import_react203.default.createElement("div", { dangerouslySetInnerHTML: { @@ -142662,7 +153248,7 @@ var TestComponent = (props) => { }, style: { height: "50px", width: "50px" } }), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Image"), /* @__PURE__ */ import_react203.default.createElement("img", { - src: superstate.ui.getUIPath(image), + src: superstate.ui.getUIPath(image3), style: { height: "50px", width: "50px" } }), /* @__PURE__ */ import_react203.default.createElement("h2", null, "Output"), /* @__PURE__ */ import_react203.default.createElement("div", null, output)), /* @__PURE__ */ import_react203.default.createElement("div", null, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => { @@ -142678,38 +153264,38 @@ var TestComponent = (props) => { }, "Acorn"), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, { section: "Space" }, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => superstate.spaceManager.createSpace(value, space2.path, {}) + action: (value) => superstate.spaceManager.createSpace(value, space3.path, {}) }, "Create Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => superstate.spaceManager.renameSpace(space2.path, value) + action: (value) => superstate.spaceManager.renameSpace(space3.path, value) }, "Rename Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => removeSpace(superstate, value) }, "Delete Space"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => saveSpaceMetadataValue(props.superstate, space2.path, "contexts", [ + action: (value) => saveSpaceMetadataValue(props.superstate, space3.path, "contexts", [ value ]) }, "Set Space Context"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => removeSpace(superstate, value) }, "Remove Space Context"), /* @__PURE__ */ import_react203.default.createElement(TestActionComponent, { - action: () => savePathBanner(superstate, space2.path, image) + action: () => savePathBanner(superstate, space3.path, image3) }, "Set Space Banner"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => updatePrimaryAlias(superstate, space2.path, [], value) + action: (value) => updatePrimaryAlias(superstate, space3.path, [], value) }, "Set Space Alias"), /* @__PURE__ */ import_react203.default.createElement(TestActionComponent, { - action: () => savePathSticker(superstate, space2.path, sticker) + action: () => savePathSticker(superstate, space3.path, sticker) }, "Set Space Sticker")), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, { section: "Path" }, /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => newPathInSpace(superstate, space2, "md", value) + action: (value) => newPathInSpace(superstate, space3, "md", value) }, "Create Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => superstate.spaceManager.copyPath(path2.path, value) + action: (value) => superstate.spaceManager.copyPath(path3.path, value) }, "Copy Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => superstate.spaceManager.renamePath( - path2.path, - movePath(path2.path, value) + path3.path, + movePath(path3.path, value) ) }, "Move Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { action: (value) => deletePath(superstate, value) }, "Delete Path"), /* @__PURE__ */ import_react203.default.createElement(TestInputComponent, { - action: (value) => pinPathToSpaceAtIndex(superstate, space2, value) + action: (value) => pinPathToSpaceAtIndex(superstate, space3, value) }, "Pin Path")), /* @__PURE__ */ import_react203.default.createElement(TestToggleSection, { section: "Modals" }, /* @__PURE__ */ import_react203.default.createElement("button", { @@ -142848,30 +153434,30 @@ var JSONFiletypeAdapter = class { this.cache.set(file.path, updatedCache); this.middleware.updateFileCache(file.path, updatedCache, refresh); } - async newFile(parent, name317, type, content3) { + async newFile(parent, name317, type, content5) { name317 = uniqueFileName(name317 ?? "Untitled", name317 ?? "Untitled", type, getAbstractFileAtPath(this.plugin.app, parent)); const newPath = parent == "/" ? name317 : `${parent}/${name317}`; - await this.middleware.writeTextToFile(newPath, content3); + await this.middleware.writeTextToFile(newPath, content5); return this.middleware.getFile(newPath); } }; // src/adapters/obsidian/ui/kit/kits.ts var import_obsidian28 = require("obsidian"); -var installSpaceTemplate = async (plugin, superstate, space2, template2) => { +var installSpaceTemplate = async (plugin, superstate, space3, template2) => { if (template2.type === "folder") { if (template2.content) - await installSpaceKit(plugin, superstate, template2.content, space2 + "/.space/templates", true); + await installSpaceKit(plugin, superstate, template2.content, space3 + "/.space/templates", true); } else { - await plugin.files.writeTextToFile(space2 + "/.space/templates/" + template2.name, template2.content); + await plugin.files.writeTextToFile(space3 + "/.space/templates/" + template2.name, template2.content); } }; var mdbFramesToDBTables = (tables) => { const schemas = Object.values(tables).map((t5) => t5.schema); const fields = Object.values(tables).flatMap((t5) => t5.cols); - const dbTables = Object.keys(tables).reduce((p, c3) => { + const dbTables = Object.keys(tables).reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { uniques: defaultFrameSchema.uniques, cols: defaultFrameSchema.cols, @@ -142896,9 +153482,9 @@ var mdbFramesToDBTables = (tables) => { var mdbToDBTables = (tables) => { const schemas = Object.values(tables).map((t5) => t5.schema); const fields = Object.values(tables).flatMap((t5) => t5.cols); - const dbTables = Object.keys(tables).reduce((p, c3) => { + const dbTables = Object.keys(tables).reduce((p2, c3) => { return { - ...p, + ...p2, [c3]: { uniques: [], cols: tables[c3].cols.map((f2) => f2.name), @@ -142920,29 +153506,29 @@ var mdbToDBTables = (tables) => { } }; }; -var installSpaceKit = async (plugin, superstate, kit, space2, isTemplate) => { +var installSpaceKit = async (plugin, superstate, kit, space3, isTemplate) => { if (!kit) return; - const path2 = space2 == "/" ? kit.name : space2 + "/" + kit.name; + const path3 = space3 == "/" ? kit.name : space3 + "/" + kit.name; let newSpace; if (isTemplate) { - await plugin.files.createFolder(path2); + await plugin.files.createFolder(path3); newSpace = { name: kit.name, type: "folder", - path: path2, + path: path3, space: { - path: path2, + path: path3, name: kit.name, isRemote: false, readOnly: false, - defPath: `${path2}/${kit.name}.md`, - dbPath: `${path2}/.space/context.mdb`, - framePath: `${path2}/.space/views.mdb` + defPath: `${path3}/${kit.name}.md`, + dbPath: `${path3}/.space/context.mdb`, + framePath: `${path3}/.space/views.mdb` } }; } else { - newSpace = await createSpace(superstate, path2, kit.definition); + newSpace = await createSpace(superstate, path3, kit.definition); await saveProperties(superstate, newSpace.path, kit.properties); } if (kit.content) { @@ -142969,7 +153555,7 @@ var installSpaceKit = async (plugin, superstate, kit, space2, isTemplate) => { }, "tables", "", mdbToDBTables(kit.context), {}); } if (kit.templates?.length > 0) { - await plugin.files.createFolder(space2 + "/.space/templates"); + await plugin.files.createFolder(space3 + "/.space/templates"); for (const template2 of kit.templates) { await installSpaceTemplate(plugin, superstate, newSpace.path, template2); } @@ -143001,7 +153587,7 @@ var installKitModal = (plugin, superstate, kit) => { }; var InstallKit = (props) => { const [kit, setKit] = (0, import_react204.useState)(props.kit); - const [space2, setSpace] = (0, import_react204.useState)("/"); + const [space3, setSpace] = (0, import_react204.useState)("/"); const installKit = () => { if (!kit.startsWith("https://www.make.md/static/kits/")) { props.superstate.ui.notify("Invalid Kit URL"); @@ -143017,7 +153603,7 @@ var InstallKit = (props) => { props.plugin, props.superstate, safelyParseJSON(f2), - space2 + space3 ); }).then((f2) => { props.superstate.ui.notify("Kit added"); @@ -143040,9 +153626,9 @@ var InstallKit = (props) => { superstate: props.superstate, triggerMenu: (e5) => { const offset2 = e5.target.getBoundingClientRect(); - showSpacesMenu(offset2, props.superstate, (link) => setSpace(link)); + showSpacesMenu(offset2, props.superstate, (link3) => setSpace(link3)); }, - value: props.superstate.spacesIndex.get(space2)?.name, + value: props.superstate.spacesIndex.get(space3)?.name, selectValue: (value) => { setSpace(value); } @@ -143055,6 +153641,341 @@ var InstallKit = (props) => { }, "Cancel"))); }; +// src/core/spaceManager/webAdapter/webCache.ts +var WebCacher = class { + constructor(adapter) { + this.adapter = adapter; + this.cache = /* @__PURE__ */ new Map(); + this.notes = /* @__PURE__ */ new Map(); + this.loading = {}; + this.parentMap = new IndexMap(); + } + async loadedKit(basePath, path3, kit) { + if (!kit) + return; + this.cache.set(path3, { ...kit, path: path3 }); + this.notes.set(path3 + "/.def", { name: kit.name, properties: kit.properties, content: kit.content }); + await this.adapter.onNoteCreate(path3 + "/.def", kit.content); + await this.adapter.onCreate(path3, kit); + for (const child of kit.notes) { + this.notes.set(path3 + "/" + child.name, { name: child.name, properties: child.properties, content: child.content }); + } + for (const child of kit.children) { + const childPath = basePath + "/" + child.path; + this.parentMap.set(childPath, /* @__PURE__ */ new Set([path3])); + await this.loadedKit(basePath, childPath, child); + } + } + async load(path3) { + if (this.cache.has(path3)) { + return this.cache.get(path3); + } + this.loading[path3] = true; + return new Promise((resolve2, reject) => { + return fetch(path3).then((response) => { + this.loading[path3] = false; + if (response.status !== 200) { + return reject(response.statusText); + } + return response.json(); + }).then((f2) => { + const kit = f2; + return this.loadedKit(path3, path3, kit).then((g) => f2); + }).then((kit) => { + return resolve2(kit); + }); + }); + } +}; + +// src/core/spaceManager/webAdapter/webAdapter.ts +var WebSpaceAdapter = class { + constructor() { + this.schemes = ["http", "https"]; + this.onNoteCreate = async (path3, content5) => { + this.spaceManager.onPathCreated(path3); + }; + this.onCreate = async (path3, kit) => { + const space3 = this.spaceInfoForPath(path3); + await this.spaceManager.onSpaceCreated(path3); + await this.spaceManager.superstate.reloadContext(space3); + await this.spaceManager.superstate.reloadFrames(space3); + }; + this.webCache = new WebCacher(this); + } + initiateAdapter(manager) { + this.spaceManager = manager; + } + async readTemplates(path3) { + return []; + } + async saveTemplate(path3, space3) { + return null; + } + deleteTemplate(path3, space3) { + return; + } + async readWaypoints() { + return []; + } + async saveWaypoints(waypoints) { + return; + } + async readTemplate(name317) { + return; + } + async readAllKits() { + return []; + } + async readAllTemplates() { + return {}; + } + async readKitFrames(name317) { + return {}; + } + async saveFrameKit(frames, name317) { + return; + } + async saveSpaceTemplate(frames, name317) { + return; + } + allPaths(type) { + return []; + } + async pathExists(path3) { + return true; + } + async createItemAtPath(parent, type, name317, content5) { + return null; + } + async renamePath(oldPath, path3) { + return; + } + async deletePath(path3) { + return; + } + async getPathInfo(path3) { + return {}; + } + keysForCacheType(path3) { + return null; + } + async readPathCache(path3) { + if (this.webCache.notes.has(path3)) { + return { + metadata: { properties: {} }, + type: "remote", + subtype: "note", + contentTypes: [], + tags: [], + label: { + name: this.webCache.notes.get(path3).name, + sticker: this.webCache.notes.get(path3).properties.sticker, + color: null + }, + parent: [...this.webCache.parentMap.get(path3)]?.[0] + }; + } + const space3 = await this.webCache.load(path3); + return { + metadata: { properties: space3.properties }, + type: "space", + subtype: "web", + contentTypes: [], + tags: [], + label: { + name: space3.name, + sticker: space3.properties.sticker, + color: space3.properties.color + }, + parent: [...this.webCache.parentMap.get(path3)]?.[0] + }; + } + async readPath(path3) { + return this.webCache.notes.get(path3).content; + } + async copyPath(path3, newPath, newName) { + return; + } + async writeToPath(path3, content5, binary) { + return; + } + async childrenForPath(path3, type) { + return [...this.webCache.parentMap.getInverse(path3)]; + } + parentPathForPath(path3) { + return [...this.webCache.parentMap.get(path3)]?.[0]; + } + async readFrame(path3, schema) { + const space3 = await this.webCache.load(path3); + return space3.frames[schema]; + } + async readAllFrames(path3) { + const space3 = await this.webCache.load(path3); + return space3.frames; + } + async readTable(path3, schema) { + const space3 = await this.webCache.load(path3); + return space3.context[schema]; + } + async spaceInitiated(path3) { + if (this.webCache.cache.has(path3)) + return true; + return false; + } + async contextInitiated(path3) { + if (this.webCache.cache.has(path3)) + return true; + return false; + } + async tablesForSpace(path3) { + const space3 = await this.webCache.load(path3); + return Object.values(space3.context).map((f2) => f2.schema); + } + async createTable(path3, schema) { + return; + } + async saveTableSchema(path3, schemaId, saveSchema) { + return false; + } + async saveTable(path3, table2, force) { + return false; + } + async deleteTable(path3, name317) { + return; + } + async readAllTables(path3) { + const space3 = await this.webCache.load(path3); + return space3.context; + } + async framesForSpace(path3) { + const space3 = await this.webCache.load(path3); + return Object.values(space3.frames).map((f2) => f2.schema); + } + async createFrame(path3, schema) { + return; + } + async deleteFrame(path3, name317) { + return; + } + async saveFrameSchema(path3, schemaId, saveSchema) { + return false; + } + async saveFrame(path3, frame) { + return false; + } + async commandsForSpace(path3) { + return []; + } + async runCommand(path3, name317, args) { + return null; + } + async createCommand(path3, schema) { + return; + } + async readSystemCommands() { + return []; + } + async readLibraryCommands(name317) { + return []; + } + async saveSystemCommand(lib, command) { + return; + } + async deleteCommand(path3, name317) { + return; + } + async saveCommand(path3, schemaId, saveCommand) { + return false; + } + async contextForSpace(path3) { + return null; + } + async addSpaceProperty(path3, property) { + return; + } + async deleteSpaceProperty(path3, property) { + return; + } + async saveSpaceProperty(path3, property, oldProperty) { + return false; + } + async addProperty(path3, property) { + return; + } + async readLabel(path3) { + return null; + } + async saveLabel(path3, label, value) { + return; + } + async renameProperty(path3, property, newProperty) { + return; + } + async readProperties(path3) { + const space3 = await this.webCache.load(path3); + return space3.context[defaultContextSchemaID].cols; + } + async deleteProperty(path3, property) { + return; + } + async saveProperties(path3, properties3) { + return; + } + allSpaces() { + return []; + } + readTags() { + return []; + } + spaceInfoForPath(path3) { + return { + name: path3.split("/").pop(), + path: path3, + isRemote: true, + readOnly: true, + defPath: path3 + "/.def" + }; + } + allCaches() { + return /* @__PURE__ */ new Map(); + } + async spaceDefForSpace(path3) { + const space3 = await this.webCache.load(path3); + return space3.definition; + } + async createSpace(name317, parentPath, definition3) { + return; + } + async saveSpace(path3, definitionFn, properties3) { + return; + } + renameSpace(oldPath, newPath) { + return; + } + deleteSpace(path3) { + return; + } + childrenForSpace(path3) { + return [...this.webCache.parentMap.getInverse(path3)]; + } + addTag(path3, tag2) { + return; + } + renameTag(path3, tag2, newTag) { + return; + } + deleteTag(path3, tag2) { + return; + } + pathsForTag(tag2) { + return []; + } + resolvePath(path3, source) { + return path3; + } +}; + // src/main.ts var makeMDVersion = 0.9; var MakeMDPlugin = class extends import_obsidian29.Plugin { @@ -143296,9 +154217,9 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin { return filePath; } activeFileChange() { - const path2 = this.getActiveFile(); - if (path2) { - this.superstate.ui.setActivePath(path2); + const path3 = this.getActiveFile(); + if (path3) { + this.superstate.ui.setActivePath(path3); } } releaseTheNotes() { @@ -143460,25 +154381,25 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin { "mk-flow-" + this.superstate.settings.editorFlowStyle, true ); - this.registerMarkdownPostProcessor((element, context) => { + this.registerMarkdownPostProcessor((element3, context) => { const removeAllFlowMarks = (el) => { const embeds = el.querySelectorAll(".internal-embed.markdown-embed"); - for (let index2 = 0; index2 < embeds.length; index2++) { - const embed = embeds.item(index2); + for (let index3 = 0; index3 < embeds.length; index3++) { + const embed = embeds.item(index3); if (embed.previousSibling && embed.previousSibling.textContent.slice(-1) == "!") embed.previousSibling.textContent = embed.previousSibling.textContent.slice(0, -1); } }; - removeAllFlowMarks(element); - replaceAllTables(this, element, context); - replaceAllEmbed(element, context, this.superstate, this.app); + removeAllFlowMarks(element3); + replaceAllTables(this, element3, context); + replaceAllEmbed(element3, context, this.superstate, this.app); }); } loadMakerMode() { if (this.superstate.settings.makerMode) { if (this.superstate.settings.inlineContext) { - this.registerMarkdownPostProcessor((element, context) => { - replaceInlineContext(this, element, context); + this.registerMarkdownPostProcessor((element3, context) => { + replaceInlineContext(this, element3, context); }); document.body.classList.toggle( "mk-inline-context-enabled", @@ -143507,6 +154428,7 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin { this.files.initiateFiletypeAdapter(new ImageFileTypeAdapter(this)); this.files.initiateFiletypeAdapter(new IconFileTypeAdapter(this)); const filesystemCosmoform = new FilesystemSpaceAdapter(this.files); + const webSpaceAdapter = new WebSpaceAdapter(); this.ui = new ObsidianUI(this); const uiManager = UIManager2.create(this.ui); const commandsManager = CLIManager.create(new ObsidianCommands(this)); @@ -143523,6 +154445,7 @@ var MakeMDPlugin = class extends import_obsidian29.Plugin { if (this.superstate.settings.experimental) this.files.initiateFiletypeAdapter(new TextCacher(this)); this.superstate.spaceManager.addSpaceAdapter(filesystemCosmoform, true); + this.superstate.spaceManager.addSpaceAdapter(webSpaceAdapter); (0, import_obsidian29.addIcon)("mk-logo", mkLogo); this.superstate.saveSettings = () => this.saveSettings(); this.loadViews(); @@ -143601,6 +154524,12 @@ https://github.com/nodeca/pica * Copyright (c) 2022 Michael Mclaughlin * MIT Licence */ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ /** * react-table * diff --git a/manifest.json b/manifest.json index e3b506b..46b7666 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "0.9.29", + "version": "0.9.30", "minAppVersion": "0.16.0", "description": "Make.md brings powerful and modern note-taking features to Obsidian. Capture, organize and connect information with more flexibility without any code.", "author": "MAKE.md", diff --git a/styles.css b/styles.css index 6e01475..c23dee4 100644 --- a/styles.css +++ b/styles.css @@ -4432,8 +4432,8 @@ body:not(.is-mobile) .markdown-source-view.mod-cm6.is-readable-line-width .mk-sp gap: 8px; } .mk-cell-image img { - width: 60px; - height: 60px; + min-width: 60px; + min-height: 60px; } .mk-path-context-value .mk-cell-image img { height: 60px;