WritingSpace/.obsidian/plugins/obsidian-meta-bind-plugin/main.js

185 lines
1.1 MiB
JavaScript
Raw Normal View History

2025-01-22 08:00:25 +00:00
/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Wed, 15 Jan 2025 13:02:01 GMT
Version: 1.3.1
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
-------------------------------------------
Copyright (C) 2025 Moritz Jung
-------------------------------------------
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
"use strict";var H7=Object.create;var od=Object.defineProperty;var G7=Object.getOwnPropertyDescriptor;var W7=Object.getOwnPropertyNames;var Y7=Object.getPrototypeOf,j7=Object.prototype.hasOwnProperty;var ai=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Z7=(t,e)=>{for(var r in e)od(t,r,{get:e[r],enumerable:!0})},LC=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of W7(e))!j7.call(t,i)&&i!==r&&od(t,i,{get:()=>e[i],enumerable:!(n=G7(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?H7(Y7(t)):{},LC(e||!t||!t.__esModule?od(r,"default",{value:t,enumerable:!0}):r,t)),J7=t=>LC(od({},"__esModule",{value:!0}),t);var mp=ai((Wx,Ac)=>{(function(t,e){typeof Wx=="object"&&typeof Ac<"u"?Ac.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Wx,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(g){t=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function i(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function a(g,S){return Object.prototype.hasOwnProperty.call(g,S)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var S;for(S in g)if(a(g,S))return!1;return!0}function s(g){return g===void 0}function l(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function u(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function c(g,S){var I=[],$,H=g.length;for($=0;$<H;++$)I.push(S(g[$],$));return I}function f(g,S){for(var I in S)a(S,I)&&(g[I]=S[I]);return a(S,"toString")&&(g.toString=S.toString),a(S,"valueOf")&&(g.valueOf=S.valueOf),g}function m(g,S,I,$){return gC(g,S,I,$,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function d(g){return g._pf==null&&(g._pf=p()),g._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(g){var S=Object(this),I=S.length>>>0,$;for($=0;$<I;$++)if($ in S&&g.call(this,S[$],$,S))return!0;return!1};function x(g){var S=null,I=!1,$=g._d&&!isNaN(g._d.getTime());if($&&(S=d(g),I=h.call(S.parsedDateParts,function(H){return H!=null}),$=S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&I),g._strict&&($=$&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=$;else return $;return g._isValid}function b(g){var S=m(NaN);return g!=null?f(d(S),g):d(S).userInvalidated=!0,S}var T=e.momentProperties=[],v=!1;function A(g,S){var I,$,H,oe=T.length;if(s(S._isAMomentObject)||(g._isAMomentObject=S._isAMomentObject),s(S._i)||(g._i=S._i),s(S._f)||(g._f=S._f),s(S._l)||(g._l=S._l),s(S._strict)||(g._strict=S._strict),s(S._tzm)||(g._tzm=S._tzm),s(S._isUTC)||(g._isUTC=S._isUTC),s(S._offset)||(g._offset=S._offset),s(S._pf)||(g._pf=d(S)),s(S._locale)||(g._locale=S._locale),oe>0)for(I=0;I<oe;I++)$=T[I],H=S[$],s(H)||(g[$]=H);return g}function w(g){A(this,g),this._d=new Date(g._d!=null?g._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),v===!1&&(v=!0,e.updateOffset(this),v=!1)}function y(g){return g instanceof w||g!=null&&g._isAMomentObject!=null}function E(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function D(g,S){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),I){var $=[],H,oe,Me,gt=arguments.length;for(oe=0;oe<gt;oe++){if(H="",typeof arguments[oe]=="object"){H+=`
[`+oe+"] ";for(Me in arguments[0])a(arguments[0],Me)&&(H+=Me+": "+arguments[0][Me]+", ");H=H.slice(0,-2)}else H=arguments[oe];$.push(H)}E(g+`
Arguments: `+Array.prototype.slice.call($).join("")+`
`+new Error().stack),I=!1}return S.apply(this,arguments)},S)}var _={};function N(g,S){e.deprecationHandler!=null&&e.deprecationHandler(g,S),_[g]||(E(S),_[g]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function C(g){return typeof Function<"u"&&g instanceof Function||Object.prototype.toString.call(g)==="[object Function]"}function B(g){var S,I;for(I in g)a(g,I)&&(S=g[I],C(S)?this[I]=S:this["_"+I]=S);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function R(g,S){var I=f({},g),$;for($ in S)a(S,$)&&(i(g[$])&&i(S[$])?(I[$]={},f(I[$],g[$]),f(I[$],S[$])):S[$]!=null?I[$]=S[$]:delete I[$]);for($ in g)a(g,$)&&!a(S,$)&&i(g[$])&&(I[$]=f({},I[$]));return I}function V(g){g!=null&&this.set(g)}var L;Object.keys?L=Object.keys:L=function(g){var S,I=[];for(S in g)a(g,S)&&I.push(S);return I};var P={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function k(g,S,I){var $=this._calendar[g]||this._calendar.sameElse;return C($)?$.call(S,I):$}function W(g,S,I){var $=""+Math.abs(g),H=S-$.length,oe=g>=0;return(oe?I?"+":"":"-")+Math.pow(10,Math.max(0,H)).toString().substr(1)+$}var O=/(\[[^\[]*\])|(\\)?([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,X=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ae={},J={};function U(g,S,I,$){var H=$;typeof $=="string"&&(H=function(){return this[$]()}),g&&(J[g]=H),S&&(J[S[0]]=function(){return W(H.apply(this,arguments),S[1],S[2])}),I&&(J[I]=function(){return this.localeData().ordinal(H.apply(this,arguments),g)})}function de(g){return g.match(/\[[\s\S]/)?g.replace(/^\[|\]$/g,""):g.replace(/\\/g,"")}function we(g){var S=g.match(O),I,$;for(I=0,$=S.length;I<$;I++)J[S[I]]?S[I]=J[S[I]]:S[I]=de(S[I]);return function(H){var oe="",Me;for(Me=0;Me<$;Me++)oe+=C(S[Me])?S[Me].call(H,g):S[Me];return oe}}function se(g,S){return g.isValid()?(S=be(S,g.localeData()),ae[S]=ae[S]||we(S),ae[S](g)):g.localeData().invalidDate()}function be(g,S){var I=5;function $(H){return S.longDateFormat(H)||H}for(X.lastIndex=0;I>=0&&X.test(g);)g=g.replace(X,$),X.lastIndex=0,I-=1;return g}var K={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function j(g){var S=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return S||!I?S:(this._longDateFormat[g]=I.match(O).map(function($){return $==="MMMM"||$==="MM"||$==="DD"||$==="dddd"?$.slice(1):$}).join(""),this._longDateFormat[g])}var ne="Invalid date";function pe(){return this._invalidDate}var fe="%d",Ae=/\d{1,2}/;function _e(g){return this._ordinal.replace("%d",g)}var G={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Z(g,S,I,$){var H=this._relativeTime[I];return C(H)?H(g,S,I,$):H.replace(/%d/i,g)}function ge(g,S){var I=this._relativeTime[g>0?"future":"past"];return C(I)?I(S):I.replace(/%s/i,S)}var xe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Ee(g){return typeof g=="string"?xe[g]||xe[g.
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,r){return this.succeedAt(this.position.index+e,r)}failOffset(e,r){return this.failAt(this.position.index+e,r)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,r){return this.advanceTo(e),{success:!0,value:r,furthest:void 0,expected:void 0}}failAt(e,r){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(r)?r:[r]}}merge(e,r){if(e===void 0)return r;let n=(0,Jx.getIndex)(e.furthest),i=(0,Jx.getIndex)(r.furthest);if(i>n)return r;let a=i===n?(0,Jx.arrayUnion)(e.expected,r.expected):e.expected;return r.furthest=e.furthest,r.expected=a,r}};Id.ParserContext=Xx});var Ma=ai(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.P_UTILS=void 0;var Pd=Fd(),en=ca(),Qx=class t{static position(){return new Pd.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Pd.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Pd.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Pd.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return en.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return en.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return en.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return en.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return en.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return en.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return en.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return en.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return en.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return en.P.regexp(/^\s+/).describe("whitespace")}static cr(){return en.P.string("\r")}static lf(){return en.P.string(`
`)}static crlf(){return en.P.string(`\r
`)}static newline(){return en.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,r,n){return en.P.sequenceMap((i,a)=>i.reduce((o,s)=>n(s,o),a),e.many(),r)}static postfix(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>n(s,o),i),r,e.many())}static binaryRight(e,r,n){return en.P.sequenceMap((i,a)=>i.reverse().reduce((o,s)=>{let[l,u]=s;return n(l,u,o)},a),en.P.sequence(r,e.trim(this.optionalWhitespace())).many(),r)}static binaryLeft(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>{let[l,u]=s;return n(o,l,u)},i),r,en.P.sequence(e.trim(this.optionalWhitespace()),r).many())}static binaryRightRange(e,r,n){return en.P.sequenceMap((i,a,o)=>i.reverse().reduce((s,l)=>{let[u,c,f]=l;return n({from:u,to:o},c,f,s)},a),en.P.sequence(t.position(),r,e.trim(this.optionalWhitespace())).many(),r,t.position())}static binaryLeftRange(e,r,n){return en.P.sequenceMap((i,a,o)=>o.reduce((s,l)=>{let[u,c,f]=l;return n({from:i,to:f},s,u,c)},a),t.position(),r,en.P.sequence(e.trim(this.optionalWhitespace()),r,t.position()).many())}static func(e,r,n){let i=typeof e=="string"?en.P.string(e):e;return en.P.sequenceMap((a,o,s,l,u,c)=>n(a,l),i,en.P.string("("),this.optionalWhitespace(),r,this.optionalWhitespace(),en.P.string(")"))}};Bd.P_UTILS=Qx});var uF=ai(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.ParsingError=Ec.createParsingErrorMessage=void 0;function sF(t,e,r){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(r){let o=t.split(`
`)[e.furthest.line-1],s=`${e.furthest.line} | `;i+=`
${s}${o}`,i+=`
${" ".repeat(e.furthest.column-1+s.length)}^ (${n})`}return i}Ec.createParsingErrorMessage=sF;var Kx=class extends Error{constructor(e,r){super(sF(e,r,!0))}};Ec.ParsingError=Kx});var Fd=ai(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.Parser=void 0;var dH=oF(),ro=ca(),eb=Nd(),Tc=Ma(),hH=uF(),tb=class t{constructor(e){this.p=e}tryParse(e){return this.p(new dH.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let r=this.tryParse(e);if(r.success)return r.value;throw new hH.ParsingError(e,r)}or(e){return ro.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(ro.P.string(e))}wrap(e,r){let n=this;return new t(function(a){let o=e.p(a);if(!o.success)return o;let s=a.merge(o,n.p(a));if(!s.success)return s;let l=a.merge(s,r.p(a));return l.success?a.merge(l,a.succeed(s.value)):l})}wrapString(e,r){return this.wrap(ro.P.string(e),ro.P.string(r))}then(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success?i.merge(o,i.succeed(a.value)):o})}and(e){return ro.P.sequence(this,e)}many(){let e=this;return new t(function(n){let i,a=n.position.index,o=[];for(;;){let s=n.copy(),l=e.p(s);if(i=n.merge(i,l),i.success){if(s.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(s.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,r){(0,eb.validateRange)(e,r);let n=this;return new t(function(a){let o,s,l=[],u=0;for(;u<e;u++)if(o=n.p(a),s=a.merge(s,o),o.success)l.push(o.value);else return s;for(;u<r;u++){let c=a.copy();if(o=n.p(c),s=a.merge(s,o),o.success)a.moveToPosition(c.position),l.push(o.value);else break}return a.merge(s,a.succeed(l))})}atMost(e){return this.repeat(0,e)}atLeast(e){return ro.P.sequenceMap((r,n)=>r.concat(n),this.repeat(e,e),this.many())}separateBy(e){return ro.P.separateBy(this,e)}separateByNotEmpty(e){return ro.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let r=this;return new t(function(i){let a=r.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return ro.P.sequenceMap(function(r,n,i){return{value:n,range:{from:r,to:i}}},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}namedMarker(e){return ro.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}node(e){return ro.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}followedBy(e){return this.skip(eb.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(eb.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let r=this;return new t(function(i){let a=r.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let r=this;return new t(function(i){var a;let o=r.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=[`(${(a=o.expected)===null||a===void 0?void 0:a.join(" or ")} as part of ${e})`]),o})}optional(e){return this.or(ro.P.succeed(e))}chain(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let s=e(a.value).p(i);return i.merge(a,s)})}thenEof(){let e=this;return new t(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,r="",n=new Map,i=new Map;return new t(function(o){let s=o.position.index;if(o.input!==r)r=o.input,n.clear(),i.clear();else{let u=n.get(s),c=i.get(s);if(u!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},u)}let l=e.p(o);return n.set(s,Object.assign({},l)),i.set(s,o.getPosition()),l})}};kd.Parser=tb});var ca=ai(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.P=void 0;var Ca=Fd(),$d=Nd(),rb=class t{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Ca.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let l=e[o].p(n);if(i=n.merge(i,l),!i.su
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`;let r=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} | `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let r=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return r+n}},Vn=class extends Jn{constructor(e,r,n,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:n,docs:o}),this.str=i,this.position=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let r=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} | `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length,r.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,r){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:r,a="^".repeat(i-this.position.from.column);return n+a}};var fd=class extends xc{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}syncExternal(e){}},pd=class{constructor(e,r){this.id=e,this.manager=r,this.cache={data:{},...this.manager.getDefaultCacheItem()}}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind target validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){return this.cache}iterateCacheItems(){return[this.cache][Symbol.iterator]()}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,r){return eo.tryGet(e.data,r)}shouldDelete(e){return!1}subscribe(e){return this.cache.subscriptions.push(e),this.cache}syncExternal(e){}unsubscribe(e){return this.cache.subscriptions=this.cache.subscriptions.filter(r=>r.uuid!==e.uuid),this.cache}writeCache(e,r){return eo.setAndCreate(this.cache.data,r.storageProp,e),this.cache}writeEntireCache(e,r){r.data=e}readEntireCacheItem(e){return e.data}},md=class{constructor(e,r){this.id=e,this.manager=r}getOrCreateCacheItem(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,r){}shouldDelete(e){return!0}subscribe(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,r){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,r){}readEntireCacheItem(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};var vn=class extends Error{},lp=class extends Error{};var VC=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},X7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function Q7(t,e,r){let n=r;for(let i of Rr(t))n=e(n,i);return n}function K7(t,e,r){return VC(this,void 0,void 0,function*(){var n,i,a,o;let s=r;try{for(var l=!0,u=X7(Lr(t)),c;c=yield u.next(),n=c.done,!n;l=!0)o=c.value,l=!1,s=yield e(s,o)}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield a.call(u))}finally{if(i)throw i.error}}return s})}function Px(t){switch(!0){case t instanceof Array:return t.length;case es(t):return t.length;case t instanceof Set:return t.size;case t instanceof Map:return t.size}return Q7(t,e=>e+1,0)}function UC(t){return VC(this,void 0,void 0,function*(){switch(!0){case t instanceof Array:
`?e={index:this.parsingError.parseFailure.furthest.index+1,column:1,line:this.parsingError.parseFailure.furthest.line+1}:e={index:this.parsingError.parseFailure.furthest.index+1,column:this.parsingError.parseFailure.furthest.column+1,line:this.parsingError.parseFailure.furthest.line},[new Sc({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};function lF(t){if(!t.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",r=>({startState:()=>hp.startState?.(4),blankLine:i=>hp.blankLine?.(i,4),copyState:i=>hp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${hp.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",r=>({startState:()=>dp.startState?.(4),blankLine:i=>dp.blankLine?.(i,4),copyState:i=>dp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${dp.token?.(i,a)}`}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",r=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let l=[i.string],u=1,c=i.lookAhead(u);for(;c!==void 0&&!e.test(c)&&(l.push(c),u+=1,c=i.lookAhead(u),!(u>100)););a.str=l.filter(m=>m.trim()!=="").join(`
`);let f=t.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new Ps(a.str,[]):(a.fieldType=f,a.highlights=t.api.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let s=a.highlights.getHighlights().filter(l=>l.range.from.line===a.line).find(l=>l.range.from.column===i.pos+1);return s===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<s.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${s.tokenClass}`)}}))}var ib=require("@codemirror/language"),pl=require("@codemirror/view");var Rd=require("obsidian");var cF=require("obsidian");var Bs=class{static checkSelectionOverlap(e,r,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=r&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,r,n,i){return e<=i&&n<=r}static getContent(e,r,n){return e.sliceDoc(r,n)}static getCurrentFile(e){return e.state.field(cF.editorInfoField).file}static existsDecorationBetween(e,r,n){let i=!1;return e.between(r,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,r,n,i){let a=!1;return e.between(n,i,(o,s,l)=>{l.spec.mb_widgetType===r&&(a=!0)}),a}};function fF(t){return pl.ViewPlugin.fromClass(class{constructor(e){this.component=new Rd.Component,this.component.load(),this.decorations=this.renderWidgets(e)??pl.Decoration.none,e.dom.addEventListener("click",r=>this.handleClick(r))}handleClick(e){if(e.target instanceof HTMLElement){let r=e.target;for(;r!==null;){if(r.classList.contains("mb-input")){e.stopPropagation();break}r=r.parentElement}}}isLivePreview(e){return e.field(Rd.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(r,n,i)=>zC.anyMatch(e.visibleRanges,o=>Bs.checkRangeOverlap(r,n,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:r,to:n}of e.visibleRanges)(0,ib.syntaxTree)(e.state).iterate({from:r,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,r){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,filterTo:i,filter:(o,s,l)=>{let u=l.spec;return r&&u.mb_widgetType===r?!0:(u.mb_unload?.(),!1)}})})}addDecoration(e,r,n,i,a){let o=e.from-1,s=e.to+1;if(Bs.existsDecorationOfTypeBetween(this.decorations,n,o,s))return;let l=Bs.getCurrentFile(r);if(!l)return;let u=this.renderWidget(e,a,n,i,l),c=Array.isArray(u)?u:[u];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,r){let n=new Set(r.type.name?.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let i=Bs.checkSelectionOverlap(e.state.selection,r.from-1,r.to+1),a=this.readNode(e,r.from,r.to),o=this.isLivePreview(e.state),s=!i&&o;return{shouldRender:s,shouldHighlight:!s&&t.settings.enableSyntaxHighlighting,content:a.content,widgetType:a.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,r,n){let i=Bs.getContent(e.state,r,n);return{content:i,widgetType:t.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let r=Bs.getCurrentFile(e);if(!r)return;let n=[];for(let i of e.visibleRanges)(0,ib.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,s=this.getRenderInfo(e,o);if(!s.widgetType||!s.content)return;let l;s.shouldRender&&(l=this.renderWidget(o,s.widgetType,"field",s.content,r)),s.shouldHighlight&&(l=this.renderWidget(o,s.widgetType,"highlight",s.content,r)),l&&(Array.isArray(l)?n.push(...l):n.push(l))}});return pl.Decoration.set(n,!0)}renderWidget(e,r,n,i,a){if(n==="field"){let o=t.api.constructMDRCWidget(r,i,a.path,this.component);return pl.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return t.api.syntaxHighlightin
\`\`\`meta-bind
INPUT[${n}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function hF(t){let e=[];for(let r of Object.values(ab))for(let n of r)e.push([n.title,`\`${n.display}\``]);return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function vF(t,e,r){let n=dF(r),i=hF(r);t.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(s=>{s.setTitle("Input Field");let l=s.setSubmenu();for(let[u,c]of n)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Vd(e,c))})}),o.addItem(s=>{s.setTitle("View Field");let l=s.setSubmenu();for(let[u,c]of i)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Vd(e,c))})}),o.addItem(s=>{s.setTitle("Inline Button"),s.onClick(()=>{Vd(e,"`BUTTON[example-id]`")})}),o.addItem(s=>{s.setTitle("Button"),s.onClick(()=>{r.internal.openButtonBuilderModal({onOkay:l=>{Vd(e,`\`\`\`meta-bind-button
${(0,gF.stringifyYaml)(l)}
\`\`\``)},submitText:"Insert"})})})})}function Vd(t,e){t.replaceSelection(e)}var m9=require("obsidian");var NF=zr(Ma());var Sn=zr(Ma()),lb=zr(ca());var _F=zr(Ma()),Zi=zr(ca());var yp=zr(Ma()),Fa=zr(ca()),Mi=Fa.P.sequence(Fa.P.or(yp.P_UTILS.unicodeLetter(),Fa.P.oneOf("_$")),Fa.P.or(yp.P_UTILS.unicodeAlphanumeric(),Fa.P.oneOf("-_$")).many()).map(t=>t[0]+t[1].join("")).describe("identifier"),yF=Fa.P.sequenceMap((t,e)=>t+e.map(r=>r[0]+r[1]).join(""),Mi,Fa.P.sequence(yp.P_UTILS.optionalWhitespace(),Mi).many()).describe("identifier with spaces"),yH=Fa.P.string("\\").then(yp.P_UTILS.any()).map(t=>t==="'"?"'":t==="\\"?"\\":"\\"+t);function xF(t){return Fa.P.or(yH,Fa.P.noneOf(t+"\\")).many().map(e=>e.join("")).trim(Fa.P.string(t))}var Ud=xF("'"),bF=xF('"'),Dc=Fa.P.manyNotOf("{}[]#^|:?").box("file path");function ji(t,e){return{value:t,position:e}}function Ia(t){if(t!==void 0)return typeof t=="string"?{value:t}:t}var dl=(r=>(r.OBJECT="object",r.ARRAY="array",r))(dl||{}),qd=class{constructor(e,r,n){this.parent=e,this.access=r,this.child=n}};function xH(t,e){return t[e]}function wF(t,e,r){t[e]=r}var ml=class{constructor(e,r){if(this.type=e,this.prop=e==="object"?r:"",this.index=e==="array"?Number(r):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new qd(e,this,xH(e,this.prop))}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");return new qd(e,this,e[this.index])}}set(e,r){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(e,this.prop,r)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=r}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(e,this.prop,void 0)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=void 0}}};var AF=Mi.node((t,e)=>({type:"object",prop:ji(t,e)})),ob=Zi.P.or(_F.P_UTILS.digits().wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"array",prop:ji(t,e)})),bF.wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"object",prop:ji(t,e)}))),bH=Zi.P.or(Zi.P.sequenceMap(t=>({storagePath:void 0,listenToChildren:!1,storageProp:t}),ob.atLeast(1)),Zi.P.sequenceMap((t,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[t,...e]}),AF,ob.many())),wH=Zi.P.sequenceMap((t,e)=>[t,...e],AF,ob.many()),sb=Zi.P.sequenceMap((t,e)=>(t.storageProp=t.storageProp.concat(e.flat()),t),bH,Zi.P.string(".").then(wH).many()),rs=Zi.P.sequenceMap((t,e,r)=>(r.storageType=t,r.storagePath=e,r),Mi.describe("storage type").node(ji).skip(Zi.P.string("^").describe('storage type separator "^"')).optional(),Dc.describe("storage path").node(ji).skip(Zi.P.string("#").describe('storage/file path separator "#"')).optional(),sb.describe("property path")).box("bind target");var zd=zr(Ma()),ns=zr(ca());var ub=ns.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),_H=ns.P.or(Ud,ub).node(ji),AH=ns.P.separateBy(_H,ns.P.string(",").describe('argument value separator ","').trim(zd.P_UTILS.optionalWhitespace())),SH=ns.P.sequenceMap((t,e)=>({name:t,value:e}),Mi.node(ji),AH.trim(zd.P_UTILS.optionalWhitespace()).wrap(ns.P.string("(").describe('argument value paren "("'),ns.P.string(")").describe('argument value paren ")"')).optional([])),xp=ns.P.separateBy(SH,ns.P.string(",").describe('argument separator ","').trim(zd.P_UTILS.optionalWhitespace()));var fa=zr(Ma()),Un=zr(ca());var EH=Un.P.string("\\").then(fa.P_UTILS.any()).map(t=>t==="["?"[":t==="]"?"]":t==="{"?"{":t==="}"?"}":t==="\\"?"\\":"\\"+t),Hd=Un.P.sequenceMap((t,e)=>t+e.flat().join(""),Un.P.manyNotOf("{}[]\\"),Un.P.sequence(EH,Un.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),TH=Un.P.sequenceMap((t,e)=>[t,...e.flat()],Hd,Un.P.s
`);if(r.line<1||r.line>l.length+1)throw new Error("Line number out of bounds");return l=[...l.slice(0,r.line-1),o,...l.slice(r.line-1)],l.join(`
`)})}create(){return{type:"insertIntoNote",line:0,value:"Some text",templater:!1}}getActionLabel(){return"Insert text into the note"}};var lh=class extends Wr{constructor(e){super("js",e)}async run(e,r,n,i,a){if(!this.plugin.settings.enableJs)throw new No({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.plugin.internal.jsEngineRunFile(r.file,n,o))()}create(){return{type:"js",file:"",args:{}}}getActionLabel(){return"Run a JavaScript file"}};var cI=zr(Ma()),ui=zr(ca());var fI=ui.P.sequence(Dc,ui.P.or(ui.P.string("#").then(ui.P.manyNotOf("[]#|:")),ui.P.string("#").result(void 0),ui.P.succeed(void 0)),ui.P.string("|").then(ui.P.manyNotOf("[]")).optional()),ch=ui.P.or(ui.P.sequenceMap((t,e)=>new Fl(t!==void 0,e[0],e[1],e[2],!0),ui.P.string("!").optional(),fI.wrapString("[[","]]")),ui.P.sequenceMap((t,e,r)=>{let n=!_c(r);return new Fl(t!==void 0,r,void 0,e,n)},ui.P.string("!").optional(),ui.P.manyNotOf("[]").wrapString("[","]"),ui.P.manyNotOf("()").wrapString("(",")"))),gW=ui.P.separateBy(ch,ui.P.string(",").trim(cI.P_UTILS.optionalWhitespace())),Fl=class t{constructor(e,r,n,i,a){this.isEmbed=e,this.target=r,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new t(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,r,n){this.internal?e.internal.file.open(this.fullTarget(),r,n):xd(this.target)}toString(){let e=this.isEmbed?"!":"";if(this.internal){let r=this.alias?`|${this.alias}`:"";return`${e}[[${this.fullTarget()}${r}]]`}else{let r=this.alias??this.fullTarget();return`${e}[${r}](${this.fullTarget()})`}}},Cn=class t{static parseLink(e){return Xn(ch.thenEof(),e)}static parseLinkList(e){return Xn(gW.thenEof(),e)}static isLink(e){return ch.thenEof().tryParse(e).success}static urlToLink(e){return Fl.fromUrl(e)}static parseLinkOrUrl(e){return _c(e)?t.urlToLink(new URL(e)):t.parseLink(e)}static interpretAsLink(e){let r=ch.thenEof().tryParse(e);if(r.success)return r.value;let n=fI.thenEof().tryParse(e);if(n.success)return new Fl(!1,n.value[0],n.value[1],n.value[2],!0);if(_c(e)){let i=new URL(e);return Fl.fromUrl(i)}}};var fh=class extends Wr{constructor(e){super("open",e)}async run(e,r,n,i,a){let o=a.type==="middle"||a.ctrlKey||(r.newTab??!1),s=Cn.interpretAsLink(r.link);if(!s)throw new Error("Invalid link");s.open(this.plugin,n,o)}create(){return{type:"open",link:"",newTab:!0}}getActionLabel(){return"Open a link"}};var ph=class extends Wr{constructor(e){super("regexpReplaceInNote",e)}async run(e,r,n,i,a){if(r.regexp==="")throw new Error("Regexp cannot be empty");await this.plugin.internal.file.atomicModify(n,o=>o.replace(new RegExp(r.regexp,r.regexpFlags??"g"),r.replacement))}create(){return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"}}getActionLabel(){return"Replace text in note using regexp"}};var mh=class extends Wr{constructor(e){super("replaceInNote",e)}async run(e,r,n,i,a){if(r.fromLine>r.toLine)throw new Error("From line cannot be greater than to line");let o=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,s=>{let l=s.split(`
`);if(r.fromLine<0||r.toLine>l.length+1)throw new Error("Line numbers out of bounds");return l=[...l.slice(0,r.fromLine-1),o,...l.slice(r.toLine)],l.join(`
`)})}create(){return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace text in note"}};var dh=class extends Wr{constructor(e){super("replaceSelf",e)}async run(e,r,n,i,a){if(i.isInline)throw new Error("Replace self action not supported for inline buttons");if(i.position===void 0)throw new Error("Position of the button in the note is unknown");if(i.position.lineStart>i.position.lineEnd)throw new Error("Position of the button in the note is invalid");let o=i.position,s=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,l=>{let u=l.split(`
`);if(o.lineStart<0||o.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,o.lineStart),s,...u.slice(o.lineEnd+1)],u.join(`
`)})}create(){return{type:"replaceSelf",replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace button with text"}};var hh=class extends Wr{constructor(e){super("runTemplaterFile",e)}async run(e,r,n,i,a){let o=this.plugin.api.buttonActionRunner.resolveFilePath(r.templateFile);await this.plugin.internal.evaluateTemplaterTemplate(o,o)}create(){return{type:"runTemplaterFile",templateFile:""}}getActionLabel(){return"Run a templater file"}};var gh=class extends Wr{constructor(e){super("sleep",e)}async run(e,r,n,i,a){await new Promise(o=>setTimeout(o,r.ms))}create(){return{type:"sleep",ms:0}}getActionLabel(){return"Sleep for some time"}};var vh=class extends Wr{constructor(e){super("templaterCreateNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists&&r.fileName){let o=wd(bd(r.folderPath??"",r.fileName),"md");if(await this.plugin.internal.file.exists(o)){this.plugin.internal.file.open(o,"",!1);return}}await this.plugin.internal.createNoteWithTemplater(r.templateFile,r.folderPath,r.fileName,r.openNote)}create(){return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note using Templater"}};var Tp=zr(Ma()),wu=zr(ca());var dI=wu.P.sequenceMap((t,e)=>t===void 0?e:-e,wu.P.string("-").optional(),wu.P.or(wu.P.sequenceMap((t,e,r)=>Number(t+e+r),Tp.P_UTILS.digits(),wu.P.string("."),Tp.P_UTILS.digits()),Tp.P_UTILS.digits().map(t=>Number(t)))).thenEof(),hI=wu.P.sequenceMap((t,e)=>t===void 0?e:-e,wu.P.string("-").optional(),Tp.P_UTILS.digits().map(t=>Number(t))).thenEof();function Oa(t){if(t.toLowerCase()==="null")return null;if(t==="true")return!0;if(t==="false")return!1;{let e=dI.tryParse(t);return e.success?e.value:t}}function ko(t){return t===void 0||t===null?"":typeof t=="string"?t:typeof t=="boolean"?t?"true":"false":t.toString()}function _u(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"}function ao(t){if(t!=null){if(_u(t))return[t];if(typeof t=="object"&&Array.isArray(t))return t.filter(e=>_u(e))}}function zc(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=dI.tryParse(t);if(e.success)return e.value}}function os(t){return _u(t)?ko(t):void 0}function Au(t){return _u(t)?t:void 0}function Il(t,e){return Array.isArray(t)?t.map(r=>xb(r,e)).filter(r=>r!=="").join(", "):xb(t,e)}function xb(t,e){return t==null?e?"":"null":typeof t=="function"?"<function>":typeof t=="object"||Array.isArray(t)?JSON.stringify(t):t.toString()}function gI(t,e){return Array.isArray(t)?t.map(r=>mI(r,e)).filter(r=>r!==""):mI(t,e)}function mI(t,e){return typeof t=="string"?Cn.isLink(t)?Cn.parseLink(t):_c(t)?Cn.urlToLink(new URL(t)):t:xb(t,e)}var yh=class extends Wr{constructor(e){super("updateMetadata",e)}async run(e,r,n,i,a){let o=this.plugin.api.bindTargetParser.fromStringAndValidate(r.bindTarget,n);if(r.evaluate){if(!this.plugin.settings.enableJs)throw new No({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let s=new Function("x","getMetadata",`return ${r.value};`);this.plugin.api.updateMetadata(o,l=>s(l,u=>this.plugin.api.getMetadata(this.plugin.api.parseBindTarget(u,n))))}else this.plugin.api.setMetadata(o,Oa(r.value))}create(){return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""}}getActionLabel(){return"Update metadata"}};var xh=class{constructor(e){this.plugin=e,this.actionContexts={command:new ih(e),open:new fh(e),js:new lh(e),input:new sh(e),sleep:new gh(e),templaterCreateNote:new vh(e),updateMetadata:new yh(e),createNote:new ah(e),replaceInNote:new mh(e),replaceSelf:new dh(e),regexpReplaceInNote:new ph(e),insertIntoNote:new uh(e),inlineJS:new oh(e),runTemplaterFile:new hh(e)}}resolveFilePath(e,r){let n=Cn.isLink(e)?Cn.parseLink(e).target:e,i=this.plugin.internal.file.getPathByName(n,r);if(i===void 0)throw new Co({errorLevel:"ERROR",cause:`Could not find a file that matches "${e}".`,effect:`Could not resolve path or link "${e}" relative to "${r}".`});return i}createDefaultButtonConfig(){ret
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function SI(t){if(Ze){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function EI(){if(Ze){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function TI(t){if(Ze){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function DI(){if(Ze){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function MI(){if(Ze){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function CI(){if(Ze){let t=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/invalid_snippet")}function NI(t){if(Ze){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function FI(t){if(Ze){let e=new Error(`props_rest_readonly
Rest element properties of \`$props()\` such as \`${t}\` are readonly
https://svelte.dev/e/props_rest_readonly`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function II(t){if(Ze){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function PI(){if(Ze){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function BI(){if(Ze){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function kI(){if(Ze){let t=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function $I(){if(Ze){let t=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var Vs=!1,ss=!1;var bW="font-weight: bold",wW="font-weight: normal";function Ab(t){Ze?console.warn(`%c[svelte] state_snapshot_uncloneable
%c${t?`The following properties cannot be cloned with \`$state.snapshot\` \u2014 the return value contains the originals:
${t}`:"Value cannot be cloned with `$state.snapshot` \u2014 the original value was returned"}
https://svelte.dev/e/state_snapshot_uncloneable`,bW,wW):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var _W=[];function li(t,e=!1){if(Ze&&!e){let r=[],n=Cp(t,new Map,"",r);if(r.length===1&&r[0]==="")Ab();else if(r.length>0){let i=r.length>10?r.slice(0,7):r.slice(0,10),a=r.length-i.length,o=i.map(s=>`- <value>${s}`).join(`
`);a>0&&(o+=`
- ...and ${a} more`),Ab(o)}return n}return Cp(t,new Map,"",_W)}function Cp(t,e,r,n,i=null){if(typeof t=="object"&&t!==null){var a=e.get(t);if(a!==void 0)return a;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(oo(t)){var o=Array(t.length);e.set(t,o),i!==null&&e.set(i,o);for(var s=0;s<t.length;s+=1){var l=t[s];s in t&&(o[s]=Cp(l,e,Ze?`${r}[${s}]`:r,n))}return o}if(Eu(t)===bh){o={},e.set(t,o),i!==null&&e.set(i,o);for(var u in t)o[u]=Cp(t[u],e,Ze?`${r}.${u}`:r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return Cp(t.toJSON(),e,Ze?`${r}.toJSON()`:r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return Ze&&n.push(r),t}}var Np=null;function Us(t){let e=Error(),r=e.stack;if(r){let n=r.split(`
`),i=[`
`];for(let a=0;a<n.length;a++){let o=n[a];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;gi(e,"stack",{value:i.join(`
`)}),gi(e,"name",{value:`${t}Error`})}return e}var $l=new Set;function Eb(t){$l=t}function Hn(t,e){var r={f:0,v:t,reactions:null,equals:_h,rv:0,wv:0};return Ze&&ss&&(r.created=e??Us("CreatedAt"),r.debug=null),r}function bt(t){return SW(Hn(t))}function Tu(t,e=!1){let r=Hn(t);return e||(r.equals=Gc),Vs&&xr!==null&&xr.l!==null&&(xr.l.s??=[]).push(r),r}function SW(t){return yr!==null&&yr.f&2&&(Oo===null?LI([t]):Oo.push(t)),t}function $e(t,e){return yr!==null&&zs()&&yr.f&18&&(Oo===null||!Oo.includes(t))&&$I(),jc(t,e)}function jc(t,e){if(!t.equals(e)){var r=t.v;if(t.v=e,t.wv=Ip(),Ze&&ss&&(t.updated=Us("UpdatedAt"),rr!=null&&(t.trace_need_increase=!0,t.trace_v??=r)),RI(t,2048),zs()&&rr!==null&&rr.f&1024&&!(rr.f&96)&&(us===null?VI([t]):us.push(t)),Ze&&$l.size>0){let i=Array.from($l);var n=qs;Wc(!0);try{for(let a of i)a.f&1024&&Qi(a,4096),Du(a)&&Ol(a)}finally{Wc(n)}$l.clear()}}return e}function RI(t,e){var r=t.reactions;if(r!==null)for(var n=zs(),i=r.length,a=0;a<i;a++){var o=r[a],s=o.f;if(!(s&2048)&&!(!n&&o===rr)){if(Ze&&s&262144){$l.add(o);continue}Qi(o,e),s&1280&&(s&2?RI(o,4096):Pp(o))}}}var Bp="font-weight: bold",kp="font-weight: normal";function UI(t,e,r){Ze?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Bp,kp):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Zc(t){Ze?console.warn(`%c[svelte] hydration_mismatch
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Bp,kp):console.warn("https://svelte.dev/e/hydration_mismatch")}function qI(){Ze?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Bp,kp):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Tb(t,e){Ze?console.warn(`%c[svelte] ownership_invalid_mutation
%c${t?`${t} mutated a value owned by ${e}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead`:"Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}
https://svelte.dev/e/ownership_invalid_mutation`,Bp,kp):console.warn("https://svelte.dev/e/ownership_invalid_mutation")}function Sh(t){Ze?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Bp,kp):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var Bt=!1;function ma(t){Bt=t}var Kt;function En(t){if(t===null)throw Zc(),Su;return Kt=t}function Fi(){return En(Ii(Kt))}function ce(t){if(Bt){if(Ii(Kt)!==null)throw Zc(),Su;Kt=t}}function Nt(t=1){if(Bt){for(var e=t,r=Kt;e--;)r=Ii(r);Kt=r}}function Jc(){for(var t=0,e=Kt;;){if(e.nodeType===8){var r=e.data;if(r===Bl){if(t===0)return e;t-=1}else(r===Hc||r===Pl)&&(t+=1)}var n=Ii(e);e.remove(),e=n}}var EW={},TW=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,DW=/@(.+):(\d+):(\d+)$/;function MW(){let t=new Error().stack;if(!t)return null;let e=[];for(let r of t.split(`
`)){let n=TW.exec(r)??DW.exec(r);n&&e.push({file:n[1],line:+n[2],column:+n[3]})}return e}function zI(){let t=MW()?.slice(4);if(!t)return null;for(let e=0;e<t.length;e++){let r=t[e],n=EW[r.file];if(!n){if(e===0)return null;continue}for(let i of n){if(i.end==null)return null;if(i.start.line<r.line&&i.end.line>r.line)return i.component}}return null}var CW=Symbol("ADD_OWNER");function Db(t,e){if(e.owners!==null)for(;t;){if(t.owners===null){e.owners=null;break}for(let r of t.owners)e.owners.add(r);t=t.parent}}function HI(t,e){return t.owners===null?!0:t.owners.has(e)||t.parent!==null&&HI(t.parent,e)}function GI(t){return t?.owners?.values().next().value??GI(t.parent)}var NW=!1;function WI(t){if(NW)return;let e=zI();if(e&&!HI(t,e)){let r=GI(t);r[Xi]!==e[Xi]?Tb(e[Xi],r[Xi]):Tb()}}function Le(t,e=null,r){var n=null;if(Ze&&ss&&(n=Us("CreatedAt")),typeof t!="object"||t===null||La in t)return t;let i=Eu(t);if(i!==bh&&i!==wI)return t;var a=new Map,o=oo(t),s=Hn(0);o&&a.set("length",Hn(t.length,n));var l;if(Ze)if(l={parent:e,owners:null},r){let u=r.v?.[kl]?.owners;l.owners=u?new Set(u):null}else l.owners=e===null?xr!==null?new Set([xr.function]):null:new Set;return new Proxy(t,{defineProperty(u,c,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&PI();var m=a.get(c);return m===void 0?(m=Hn(f.value,n),a.set(c,m)):$e(m,Le(f.value,l)),!0},deleteProperty(u,c){var f=a.get(c);if(f===void 0)c in u&&a.set(c,Hn(zn,n));else{if(o&&typeof c=="string"){var m=a.get("length"),p=Number(c);Number.isInteger(p)&&p<m.v&&$e(m,p)}$e(f,zn),YI(s)}return!0},get(u,c,f){if(Ze&&c===kl)return l;if(c===La)return t;var m=a.get(c),p=c in u;if(m===void 0&&(!p||$o(u,c)?.writable)&&(m=Hn(Le(p?u[c]:zn,l),n),a.set(c,m)),m!==void 0){var d=z(m);if(Ze){var h=d?.[kl];h&&h?.parent!==l&&Db(l,h)}return d===zn?void 0:d}return Reflect.get(u,c,f)},getOwnPropertyDescriptor(u,c){var f=Reflect.getOwnPropertyDescriptor(u,c);if(f&&"value"in f){var m=a.get(c);m&&(f.value=z(m))}else if(f===void 0){var p=a.get(c),d=p?.v;if(p!==void 0&&d!==zn)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(u,c){if(Ze&&c===kl||c===La)return!0;var f=a.get(c),m=f!==void 0&&f.v!==zn||Reflect.has(u,c);if(f!==void 0||rr!==null&&(!m||$o(u,c)?.writable)){f===void 0&&(f=Hn(m?Le(u[c],l):zn,n),a.set(c,f));var p=z(f);if(p===zn)return!1}return m},set(u,c,f,m){var p=a.get(c),d=c in u;if(o&&c==="length")for(var h=f;h<p.v;h+=1){var x=a.get(h+"");x!==void 0?$e(x,zn):h in u&&(x=Hn(zn,n),a.set(h+"",x))}if(p===void 0?(!d||$o(u,c)?.writable)&&(p=Hn(void 0,n),$e(p,Le(f,l)),a.set(c,p)):(d=p.v!==zn,$e(p,Le(f,l))),Ze){var b=f?.[kl];b&&b?.parent!==l&&Db(l,b),WI(l)}var T=Reflect.getOwnPropertyDescriptor(u,c);if(T?.set&&T.set.call(m,f),!d){if(o&&typeof c=="string"){var v=a.get("length"),A=Number(c);Number.isInteger(A)&&A>=v.v&&$e(v,A+1)}YI(s)}return!0},ownKeys(u){z(s);var c=Reflect.ownKeys(u).filter(p=>{var d=a.get(p);return d===void 0||d.v!==zn});for(var[f,m]of a)m.v!==zn&&!(f in u)&&c.push(f);return c},setPrototypeOf(){BI()}})}function YI(t,e=1){$e(t,t.v+e)}function Xc(t){return t!==null&&typeof t=="object"&&La in t?t[La]:t}function Mb(t,e){return Object.is(Xc(t),Xc(e))}function jI(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,o){let s=r.call(this,a,o);if(s===-1){for(let l=o??0;l<this.length;l+=1)if(Xc(this[l])===a){Sh("array.indexOf(...)");break}}return s},t.lastIndexOf=function(a,o){let s=n.call(this,a,o??this.length-1);if(s===-1){for(let l=0;l<=(o??this.length-1);l+=1)if(Xc(this[l])===a){Sh("array.lastIndexOf(...)");break}}return s},t.includes=function(a,o){let s=i.call(this,a,o);if(!s){for(let l=0;l<this.length;l+=1)if(Xc(this[l])===a){Sh("array.includes(...)");break}}return s},Array.__svelte_cleanup=()=>{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var Hs,ZI,JI,XI;function Th(){if(Hs===void 0){Hs=window,ZI=document;var t=Element.prototype,e=Node.prototype;JI=$o(e,"firstChild").get,XI=$o(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t
\`${t}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var m2=0,$W=1,u2=new WeakSet,Ih=!1,Ph=m2,Lp=!1,tf=null,qs=!1,Ch=!1;function Wc(t){qs=t}function Bb(t){Ch=t}var Vl=[],rf=0,Vp=[],yr=null;function Ki(t){yr=t}var rr=null;function ei(t){rr=t}var Oo=null;function LI(t){Oo=t}var ya=null,qa=0,us=null;function VI(t){us=t}var d2=1,kh=0,Gs=!1,Fp=null;var xr=null;var co=null;function Ip(){return++d2}function zs(){return!Vs||xr!==null&&xr.l===null}function Du(t){var e=t.f;if(e&2048)return!0;if(e&4096){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,o=(e&512)!==0,s=n&&rr!==null&&!Gs,l=r.length;if(o||s){for(i=0;i<l;i++)a=r[i],(o||!a?.reactions?.includes(t))&&(a.reactions??=[]).push(t);o&&(t.f^=512)}for(i=0;i<l;i++)if(a=r[i],Du(a)&&Pb(a),a.wv>t.wv)return!0}(!n||rr!==null&&!Gs)&&Qi(t,1024)}return!1}function l2(t,e){for(var r=e;r!==null;){if(r.f&128)try{r.fn(t);return}catch{r.f^=128}r=r.parent}throw Ih=!1,t}function c2(t){return(t.f&16384)===0&&(t.parent===null||(t.parent.f&128)===0)}function nf(t,e,r,n){if(Ih){if(r===null&&(Ih=!1),c2(e))throw t;return}if(r!==null&&(Ih=!0),!Ze||n===null||!(t instanceof Error)||u2.has(t)){l2(t,e);return}u2.add(t);let i=[],a=e.fn?.name;a&&i.push(a);let o=n;for(;o!==null;){if(Ze){var s=o.function?.[Xi];if(s){let c=s.split("/").pop();i.push(c)}}o=o.p}let l=/Firefox/.test(navigator.userAgent)?" ":" ";gi(t,"message",{value:t.message+`
${i.map(c=>`
${l}in ${c}`).join("")}
`}),gi(t,"component_stack",{value:i});let u=t.stack;if(u){let c=u.split(`
`),f=[];for(let m=0;m<c.length;m++){let p=c[m];p.includes("svelte/src/internal")||f.push(p)}gi(t,"stack",{value:f.join(`
`)})}if(l2(t,e),c2(e))throw t}function h2(t,e,r=0){var n=t.reactions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];a.f&2?h2(a,e,r+1):e===a&&(r===0?Qi(a,2048):a.f&1024&&Qi(a,4096),Pp(a))}}function Dh(t){var e=ya,r=qa,n=us,i=yr,a=Gs,o=Oo,s=xr,l=t.f;ya=null,qa=0,us=null,yr=l&96?null:t,Gs=!qs&&(l&256)!==0,Oo=null,xr=t.ctx,kh++;try{var u=(0,t.fn)(),c=t.deps;if(ya!==null){var f;if(Rl(t,qa),c!==null&&qa>0)for(c.length=qa+ya.length,f=0;f<ya.length;f++)c[qa+f]=ya[f];else t.deps=c=ya;if(!Gs)for(f=qa;f<c.length;f++)(c[f].reactions??=[]).push(t)}else c!==null&&qa<c.length&&(Rl(t,qa),c.length=qa);if(zs()&&us!==null&&!(t.f&6146))for(f=0;f<us.length;f++)h2(us[f],t);return i!==null&&kh++,u}finally{ya=e,qa=r,us=n,yr=i,Gs=a,Oo=o,xr=s}}function OW(t,e){let r=e.reactions;if(r!==null){var n=bI.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&e.f&2&&(ya===null||!ya.includes(e))&&(Qi(e,4096),e.f&768||(e.f^=512),Rl(e,0))}function Rl(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)OW(t,r[n])}function Ol(t){var e=t.f;if(!(e&16384)){Qi(t,1024);var r=rr,n=xr;if(rr=t,Ze){var i=co;co=t.component_function}try{e&16?r2(t):Lb(t),Rb(t),Ob(t);var a=Dh(t);t.teardown=typeof a=="function"?a:null,t.wv=d2;var o=t.deps;if(Ze&&ss&&t.f&2048&&o!==null)for(let l=0;l<o.length;l++){var s=o[l];s.trace_need_increase&&(s.wv=Ip(),s.trace_need_increase=void 0,s.trace_v=void 0)}Ze&&Vp.push(t)}catch(l){nf(l,t,r,n||t.ctx)}finally{rr=r,Ze&&(co=i)}}}function f2(){console.error("Last ten effects were: ",Vp.slice(-10).map(t=>t.fn)),Vp=[]}function g2(){if(rf>1e3){rf=0;try{DI()}catch(t){if(Ze&&gi(t,"stack",{value:""}),tf!==null)if(Ze)try{nf(t,tf,null,null)}catch(e){throw f2(),e}else nf(t,tf,null,null);else throw Ze&&f2(),t}}rf++}function v2(t){var e=t.length;if(e!==0){g2();var r=qs;qs=!0;try{for(var n=0;n<e;n++){var i=t[n];i.f&1024||(i.f^=1024);var a=[];y2(i,a),RW(a)}}finally{qs=r}}}function RW(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if(!(n.f&24576))try{Du(n)&&(Ol(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Vb(n):n.fn=null))}catch(i){nf(i,n,null,n.ctx)}}}function LW(){if(Lp=!1,rf>1001)return;let t=Vl;Vl=[],v2(t),Lp||(rf=0,tf=null,Ze&&(Vp=[]))}function Pp(t){Ph===m2&&(Lp||(Lp=!0,queueMicrotask(LW))),tf=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if(r&96){if(!(r&1024))return;e.f^=1024}}Vl.push(e)}function y2(t,e){var r=t.first,n=[];e:for(;r!==null;){var i=r.f,a=(i&32)!==0,o=a&&(i&1024)!==0,s=r.next;if(!o&&!(i&8192))if(i&8){if(a)r.f^=1024;else try{Du(r)&&Ol(r)}catch(f){nf(f,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(s===null){let f=r.parent;for(;f!==null;){if(t===f)break e;var u=f.next;if(u!==null){r=u;continue e}f=f.parent}}r=s}for(var c=0;c<n.length;c++)l=n[c],e.push(l),y2(l,e)}function af(t){var e=Ph,r=Vl;try{g2();let i=[];Ph=$W,Vl=i,Lp=!1,v2(r);var n=t?.();return s2(),(Vl.length>0||i.length>0)&&af(),rf=0,tf=null,Ze&&(Vp=[]),n}finally{Ph=e,Vl=r}}function z(t){var e=t.f,r=(e&2)!==0;if(r&&e&16384){var n=Ib(t);return Op(t),n}if(Fp!==null&&Fp.add(t),yr!==null){Oo!==null&&Oo.includes(t)&&kI();var i=yr.deps;t.rv<kh&&(t.rv=kh,ya===null&&i!==null&&i[qa]===t?qa++:ya===null?ya=[t]:ya.push(t))}else if(r&&t.deps===null)for(var a=t,o=a.parent,s=a;o!==null;)if(o.f&2){var l=o;s=l,o=l.parent}else{var u=o;u.deriveds?.includes(s)||(u.deriveds??=[]).push(s);break}if(r&&(a=t,Du(a)&&Pb(a)),Ze&&ss&&Np!==null&&yr!==null&&Np.reaction===yr){if(t.debug)t.debug();else if(t.created){var c=Np.entries.get(t);c===void 0&&(c={read:[]},Np.entries.set(t,c)),c.read.push(Us("TracedAt"))}}return t.v}function xn(t){let e=yr;try{return yr=null,t()}finally{yr=e}}var VW=-7169;function Qi(t,e){t.f=t.f&VW|e}function Te(t,e=!1,r){xr={p:xr,c:null,e:null,m:!1,s:t,x:null,l:null},Vs&&!e&&(xr.l={s:null,u:null,r1:[],r2:Hn(!1)}),Ze&&(xr.function=r,co=r)}function De(t){let e=xr;if(e!==null){t!==void 0&&(e.x=t);let o=e.e;if(o!==null){var r=rr,n=yr;e.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];ei(a.effect),Ki(a.reaction),va(a.fn)}}finally{ei(r),Ki(n)}}xr=e.p,Ze&&(co=e.p?.functi
`).map(a=>a.trim()).filter(a=>a.length>0);if(e.length===0)return{content:""};if(e.length>1)return{error:"Embed may only contain one link"};let r=e[0],n=Cn.parseLink(r);if(!n.internal)return{error:`${r} is not an internal link`};let i=this.plugin.internal.file.getPathByName(n.target,this.getFilePath());return i===void 0?{error:`"${n.target}" is not created yet`}:{content:await this.plugin.internal.file.read(i)}}exceedsMaxDepth(){return this.depth>ld}createEmbedMessage(e,r){e.createSpan({text:r,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let r=await this.parseContent();if(r.error){this.createEmbedMessage(e,r.error);return}if(r.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=r.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.plugin.internal.renderMarkdown(n,e,this.getFilePath())}catch(r){let n=new Qt("Embed");n.add(r),this.plugin.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass("mb-embed"),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass("mb-embed"),this.markdownUnloadCallback?.(),Di(e,"Embed")}};var Jh=class extends qn{constructor(e,r,n){super(e,r,n)}onMount(e){super.onMount(e),mt.empty(e),mt.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){super.onUnmount(e),mt.empty(e),Di(e,"Excluded")}};var Xh=class{constructor(e,r,n){this.plugin=e,this.mounted=!1,this.svelteComponent=r,this.onValueChange=n}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,r,n={}){let i=Object.assign({plugin:this.plugin,value:r,onValueChange:this.onValueChange},n);this.svelteComponentInstance=Vr(this.svelteComponent,{target:e,props:i}),this.mounted=!0}unmount(){this.svelteComponentInstance&&Ur(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}};var cr=class extends Ni{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.svelteWrapper=new Xh(this.plugin,this.getSvelteComponent(),r=>{this.updateDataAttributes(r),this.notifySubscription(this.mapValue(r))}),this.inputSignal=new nh(void 0,r=>{let n=this.filterValue(r);return n!==void 0?n:this.getDefaultValue()})}reverseMapValue(e){let r=this.rawReverseMapValue(e);if(r!==void 0)return r;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.inputSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.inputSignal.setDirect(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.write(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let r=this.filterValue(e.value);return r!==void 0?r:this.mapValue(this.getFallbackDefaultValue())}updateDataAttributes(e){this.mountTarget&&(this.mountTarget.dataset.internalValue=JSON.stringify(e))}getMountArgs(){return{}}onMount(e){this.mountTarget=e,this.inputSignal.registerListener({callback:n=>this.svelteWrapper.setValue(this.reverseMapValue(n))}),this.inputSignal.registerListener({callback:n=>{this.updateDataAttributes(this.reverseMapValue(n))}});let r=this.mountable.getBindTarget();r&&(this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,r,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.mountTarget=void 0,this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper.unmount()}};var PY=(t,e,r,n)=>r.onValueChange(z(n)),BY=ue('<input type="date">');function a0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));fun
Please create a mathjs instance if you want to change the default configuration.
Example:
import { create, all } from 'mathjs';
const mathjs = create(all);
mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(I0)};sn(Ie,I0,{MATRIX_OPTIONS:tP,NUMBER_OPTIONS:rP});var L0=zr(k0(),1);function M(t,e,r,n){function i(a){var o=eP(a,e.map(dZ));return pZ(t,e,a),r(o)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function pZ(t,e,r){var n=e.filter(a=>!mZ(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function mZ(t){return t&&t[0]==="?"}function dZ(t){return t&&t[0]==="?"?t.slice(1):t}function Qe(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function hZ(t){return/^-?\d+$/.test(t)}function Bi(t,e){return e.number==="bigint"&&!hZ(t)?e.numberFallback:e.number}var vo=Math.sign||function(t){return t>0?1:t<0?-1:0},aP=Math.log2||function(e){return Math.log(e)/Math.LN2},oP=Math.log10||function(e){return Math.log(e)/Math.LN10},Ng=Math.log1p||function(t){return Math.log(t+1)},sP=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},uP=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function $0(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Qe(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!Qe(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var o="";return t<0&&(t=-t,o="-"),"".concat(o).concat(i).concat(t.toString(e)).concat(a)}function qo(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=O0(e);switch(r){case"fixed":return R0(t,n);case"exponential":return lP(t,n);case"engineering":return gZ(t,n);case"bin":return $0(t,2,i);case"oct":return $0(t,8,i);case"hex":return $0(t,16,i);case"auto":return vZ(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function O0(t){var e="auto",r,n;if(t!==void 0)if(At(t))r=t;else if(ft(t))r=t.toNumber();else if(ku(t))t.precision!==void 0&&(r=nP(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=nP(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function df(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(s){return i-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function gZ(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=Fg(r,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(At(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var s=Math.abs(i-o)-(a.length-1),l=0;l<s;l++)a.push(0);for(var u=Math.abs(i-o),c=1;u>0;)c++,u--;var f=a.slice(c).join(""),m=At(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+m+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function R0(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=typeof e=="number"?Fg(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(mf(o-i.length))),a<0&&(i=mf(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function lP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=e?Fg(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.c
`||(s==="+"?i++:s==="-"?a++:s==="i"||s==="I"?(i+a===0&&vf(),n[o+1]!==" "&&!isNaN(n[o+1])?(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++):r.im+=parseFloat((a%2?"-":"")+"1"),i=a=0):((i+a===0||isNaN(s))&&vf(),n[o+1]==="i"||n[o+1]==="I"?(r.im+=parseFloat((a%2?"-":"")+s),o++):r.re+=parseFloat((a%2?"-":"")+s),i=a=0))}i+a>0&&vf();break;case"number":r.im=0,r.re=t;break;default:vf()}return isNaN(r.re)||isNaN(r.im),r};function Pe(t,e){if(!(this instanceof Pe))return new Pe(t,e);let r=zl(t,e);this.re=r.re,this.im=r.im}Pe.prototype={re:0,im:0,sign:function(){let t=Z0(this.re,this.im);return new Pe(this.re/t,this.im/t)},add:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;return n&&o||i&&a?Pe.NAN:n||i?Pe.INFINITY:r.im===0&&this.im===0?new Pe(this.re*r.re,0):new Pe(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;if(a&&o||n&&i)return Pe.NAN;if(o||n)return Pe.INFINITY;if(a||i)return Pe.ZERO;if(r.im===0)return new Pe(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,l=r.re*s+r.im;return new Pe((this.re*s+this.im)/l,(this.im*s-this.re)/l)}else{let s=r.im/r.re,l=r.im*s+r.re;return new Pe((this.re+this.im*s)/l,(this.im-this.re*s)/l)}},pow:function(t,e){let r=zl(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return Pe.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new Pe(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new Pe(Math.pow(this.im,r.re),0);case 1:return new Pe(0,Math.pow(this.im,r.re));case 2:return new Pe(-Math.pow(this.im,r.re),0);case 3:return new Pe(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Pe.ZERO;let a=Math.atan2(this.im,this.re),o=J0(this.re,this.im),s=Math.exp(r.re*o-r.im*a),l=r.im*o+r.re*a;return new Pe(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,e=this.im;if(e===0)return t>=0?new Pe(Math.sqrt(t),0):new Pe(0,Math.sqrt(-t));let r=Z0(t,e),n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new Pe(n,e<0?-i:i):new Pe(i,e<0?-n:n)},exp:function(){let t=Math.exp(this.re);return this.im===0?new Pe(t,0):new Pe(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new Pe(Math.expm1(t)*Math.cos(e)+vJ(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return e===0&&t>0?new Pe(Math.log(t),0):new Pe(J0(t,e),Math.atan2(e,t))},abs:function(){return Z0(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new Pe(Math.sin(t)*$i(e),Math.cos(t)*yo(e))},cos:function(){let t=this.re,e=this.im;return new Pe(Math.cos(t)*$i(e),-Math.sin(t)*yo(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+$i(e);return new Pe(Math.sin(t)/r,yo(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-$i(e);return new Pe(-Math.sin(t)/r,yo(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*$i(2*e)+.5*Math.cos(2*t);return new Pe(Math.cos(t)*$i(e)/r,Math.sin(t)*yo(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*$i(2*e)-.5*Math.cos(2*t);return new Pe(Math.sin(t)*$i(e)/r,-Math.cos(t)*yo(e)/r)},asin:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(t===0){if(e===1)return new Pe(0,1/0);if(e===-1)return new Pe(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new Pe((1-e*e-t*t)/r,-2*t/r).log();return new Pe(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(e===0)r
`,A=0;A<b;A++)for(var w=this._ptr[A],y=this._ptr[A+1],E=w;E<y;E++){var D=this._index[E];v+=`
(`+Dt(D,h)+", "+Dt(A,h)+") ==> "+(this._values?Dt(this._values[E],h):"X")}return v},i.prototype.toString=function(){return Dt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(h){if(h){if(ft(h)&&(h=h.toNumber()),!At(h)||!Qe(h))throw new TypeError("The parameter k must be an integer number")}else h=0;var x=h>0?h:0,b=h<0?-h:0,T=this._size[0],v=this._size[1],A=Math.min(T-b,v-x),w=[],y=[],E=[];E[0]=0;for(var D=x;D<v&&w.length<A;D++)for(var _=this._ptr[D],N=this._ptr[D+1],C=_;C<N;C++){var B=this._index[C];if(B===D-x+b){w.push(this._values[C]),y[w.length-1]=B-b;break}}return E.push(w.length),new i({values:w,index:y,ptr:E,size:[A,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,x,b,T,v){if(!vr(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(O){if(ft(O)&&(O=O.toNumber()),!At(O)||!Qe(O)||O<1)throw new Error("Size values must be positive integers");return O}),b){if(ft(b)&&(b=b.toNumber()),!At(b)||!Qe(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var A=r,w=0;bn(v)&&(A=e.find(r,[v,v])||r,w=e.convert(0,v));var y=b>0?b:0,E=b<0?-b:0,D=h[0],_=h[1],N=Math.min(D-E,_-y),C;if(vr(x)){if(x.length!==N)throw new Error("Invalid value array length");C=function(X){return x[X]}}else if(rt(x)){var B=x.size();if(B.length!==1||B[0]!==N)throw new Error("Invalid matrix length");C=function(X){return x.get([X])}}else C=function(){return x};for(var R=[],V=[],L=[],P=0;P<_;P++){L.push(R.length);var k=P-y;if(k>=0&&k<N){var W=C(k);A(W,w)||(V.push(k+E),R.push(W))}}return L.push(R.length),new i({values:R,index:V,ptr:L,size:[D,_]})},i.prototype.swapRows=function(h,x){if(!At(h)||!Qe(h)||!At(x)||!Qe(x))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Br(h,this._size[0]),Br(x,this._size[0]),i._swapRows(h,x,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(h,x,b,T,v){for(var A=T[h],w=T[h+1],y=A;y<w;y++)v(b[y],x[y])},i._swapRows=function(h,x,b,T,v,A){for(var w=0;w<b;w++){var y=A[w],E=A[w+1],D=u(h,y,E,v),_=u(x,y,E,v);if(D<E&&_<E&&v[D]===h&&v[_]===x){if(T){var N=T[D];T[D]=T[_],T[_]=N}continue}if(D<E&&v[D]===h&&(_>=E||v[_]!==x)){var C=T?T[D]:void 0;v.splice(_,0,x),T&&T.splice(_,0,C),v.splice(_<=D?D+1:D,1),T&&T.splice(_<=D?D+1:D,1);continue}if(_<E&&v[_]===x&&(D>=E||v[D]!==h)){var B=T?T[_]:void 0;v.splice(D,0,h),T&&T.splice(D,0,B),v.splice(D<=_?_+1:_,1),T&&T.splice(D<=_?_+1:_,1)}}},i},{isClass:!0});var _X="number",AX=["typed"];function SX(t){var e=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var r={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:t,radix:r,integerPart:n,fractionalPart:i}}else return null}function EX(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is not a valid number');return a}var g_=M(_X,AX,t=>{var{typed:e}=t,r=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=SX(i);if(a)return EX(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var TX="bigint",DX=["typed"],v_=
`)}toJSON(){return{mathjs:wv,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return Er(n,"name",wv),n},{isClass:!0,isNode:!0});var _v="ConditionalNode",ore=["Node"],bS=M(_v,ore,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ft(i))return!i.isZero();if(ra(i))return!!(i.re||i.im);if(bi(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+fr(i)+'"')}class n extends e{constructor(a,o,s){if(super(),!nr(a))throw new TypeError("Parameter condition must be a Node");if(!nr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!nr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return _v}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,m,p){return r(s(f,m,p))?l(f,m,p):u(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toString(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var m=this.falseExpr.toString(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m="("+m+")"),l+" ? "+c+" : "+m}toJSON(){return{mathjs:_v,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return Er(n,"name",_v),n},{isClass:!0,isNode:!0});var cO=zr(uO(),1);var _S={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf
`)+"\\end{array}\\right\\}";return s}}return Er(r,"name",Mv),r},{isClass:!0,isNode:!0});function Kl(t,e){return new ff(t,new Pu(e),new Set(Object.keys(e)))}var Cv="OperatorNode",dre=["Node"],MS=M(Cv,dre,t=>{var{Node:e}=t;function r(a,o){var s=a;if(o==="auto")for(;_i(s);)s=s.content;return Ht(s)?!0:Qr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=Mr(a,o,s),f=If(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(l.length){case 0:m=[];break;case 1:{var p=Mr(l[0],o,s,a);if(u&&p!==null){var d,h;if(o==="keep"?(d=l[0].getIdentifier(),h=a.getIdentifier()):(d=l[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),So[c][h].latexLeftParens===!1){m=[!1];break}if(So[p][d].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=c){m=[!0];break}m=[!1]}break;case 2:{var x,b=Mr(l[0],o,s,a),T=xv(a,l[0],o);b===null?x=!1:b===c&&f==="right"&&!T||b<c?x=!0:x=!1;var v,A=Mr(l[1],o,s,a),w=xv(a,l[1],o);if(A===null?v=!1:A===c&&f==="left"&&!w||A<c?v=!0:v=!1,u){var y,E,D;o==="keep"?(y=a.getIdentifier(),E=a.args[0].getIdentifier(),D=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),D=a.args[1].getContent().getIdentifier()),b!==null&&(So[c][y].latexLeftParens===!1&&(x=!1),So[b][E].latexParens===!1&&(x=!1)),A!==null&&(So[c][y].latexRightParens===!1&&(v=!1),So[A][D].latexParens===!1&&(v=!1))}m=[x,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=l.map(function(N){var C=Mr(N,o,s,a),B=xv(a,N,o),R=If(N,o);return C===null?!1:c===C&&f===R&&!B?!0:C<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<m.length;++_)r(l[_],o)&&!m[_-1]&&(o!=="keep"||!_i(l[_-1]))&&(m[_]=!0);return m}class i extends e{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Cv}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!Eg(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=rn(o,this.fn),u=xo(this.args,function(d){return d._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(h,x,b){return l(c,o,Kl(h,x))}}else if(u.length===1){var f=u[0];return function(h,x,b){return l(f(h,x,b))}}else if(u.length===2){var m=u[0],p=u[1];return function(h,x,b){return l(m(h,x,b),p(h,x,b))}}else return function(h,x,b){return l.apply(null,xo(u,function(T){return T(h,x,b)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=If(this,s),m=u[0].toString(o);c[0]&&(m="("+m+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+m:f==="left"?m+(p?" ":"")+this.op:m+this.op}else if(u.length===2){var d=u[0].toString(o),h=u[1].toString(o);return c[0]&&(d="("+d+")"),c[1]&&(h="("+h+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?d+" "+h:d+" "+this.op+" "+h}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()===
`).concat(a(_)))};if(d){var x=this.args;return function(_,N,C){var B=h(_);if(B.rawArgs===!0)return B(x,u,Kl(_,N));var R=f.map(V=>V(_,N,C));return B(...R)}}else switch(f.length){case 0:return function(_,N,C){var B=h(_);return B()};case 1:return function(_,N,C){var B=h(_),R=f[0];return B(R(_,N,C))};case 2:return function(_,N,C){var B=h(_),R=f[0],V=f[1];return B(R(_,N,C),V(_,N,C))};default:return function(_,N,C){var B=h(_),R=f.map(V=>V(_,N,C));return B(...R)}}}}else if(Ha(this.fn)&&go(this.fn.index)&&this.fn.index.isObjectProperty()){var T=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),A=this.args;return function(_,N,C){var B=T(_,N,C),R=O2(B,v);if(R!=null&&R.rawArgs)return R(A,u,Kl(_,N));var V=f.map(L=>L(_,N,C));return R.apply(B,V)}}else{var w=this.fn.toString(),y=this.fn._compile(u,c),E=this.args;return function(_,N,C){var B=y(_,N,C);if(typeof B!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
`.concat(a(B)));if(B.rawArgs)return B(E,u,Kl(_,N));var R=f.map(V=>V(_,N,C));return B.apply(B,R)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)u(this.args[c],"args["+c+"]",this)}map(u){for(var c=this._ifNode(u(this.fn,"fn",this)),f=[],m=0;m<this.args.length;m++)f[m]=this._ifNode(u(this.args[m],"args["+m+"]",this));return new s(c,f)}clone(){return new s(this.fn,this.args.slice(0))}toString(u){var c,f=this.fn.toString(u);return u&&typeof u.handler=="object"&&st(u.handler,f)&&(c=u.handler[f](this,u)),typeof c<"u"?c:super.toString(u)}_toString(u){var c=this.args.map(function(m){return m.toString(u)}),f=ms(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:Pv,fn:this.fn,args:this.args}}_toHTML(u){var c=this.args.map(function(f){return f.toHTML(u)});return'<span class="math-function">'+ri(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var c;return u&&typeof u.handler=="object"&&st(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;AS[this.name]&&(f=AS[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var m;switch(typeof f){case"function":m=f(this,u);break;case"string":m=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":m=f[c.length](this,u);break;case"string":m=o(f[c.length],this,u);break}}return typeof m<"u"?m:o(fO,this,u)}getIdentifier(){return this.type+":"+this.name}}return e=s,Er(s,"name",Pv),Er(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),Er(s,"fromJSON",function(l){return new e(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var pO="parse",wre=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],BS=M(pO,wre,t=>{var{typed:e,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:d,ParenthesisNode:h,RangeNode:x,RelationalNode:b,SymbolNode:T}=t,v=e(pO,{string:function(Y){return ae(Y,{})},"Array | Matrix":function(Y){return A(Y,{})},"string, Object":function(Y,ie){var Ce=ie.nodes!==void 0?ie.nodes:{};return ae(Y,Ce)},"Array | Matrix, Object":A});function A(F){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=Y.nodes!==void 0?Y.nodes:{};return nt(F,function(Ce){if(typeof Ce!="string")throw new TypeError("String expected");return ae(Ce,ie)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},y={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},D={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],N={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function C(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,Y){return F.expression.substr(F.index,Y)}function R(F){return B(F,1)}function V(F){F.index++}function L(F){return F.expression.charAt(F.index-1)}function P(F){return F.expression.charAt(F.index+1)}function k(F){for(F.tokenType=w.NULL,F.token="",F.comment="";;){if(R(F)==="#")for(;R(F)!==`
`&&R(F)!=="";)F.comment+=R(F),V(F);if(v.isWhitespace(R(F),F.nestingLevel))V(F);else break}if(R(F)===""){F.tokenType=w.DELIMITER;return}if(R(F)===`
`&&!F.nestingLevel){F.tokenType=w.DELIMITER,F.token=R(F),V(F);return}var Y=R(F),ie=B(F,2),Ce=B(F,3);if(Ce.length===3&&y[Ce]){F.tokenType=w.DELIMITER,F.token=Ce,V(F),V(F),V(F);return}if(ie.length===2&&y[ie]){F.tokenType=w.DELIMITER,F.token=ie,V(F),V(F);return}if(y[Y]){F.tokenType=w.DELIMITER,F.token=Y,V(F);return}if(v.isDigitDot(Y)){F.tokenType=w.NUMBER;var tt=B(F,2);if(tt==="0b"||tt==="0o"||tt==="0x"){for(F.token+=R(F),V(F),F.token+=R(F),V(F);v.isHexDigit(R(F));)F.token+=R(F),V(F);if(R(F)===".")for(F.token+=".",V(F);v.isHexDigit(R(F));)F.token+=R(F),V(F);else if(R(F)==="i")for(F.token+="i",V(F);v.isDigit(R(F));)F.token+=R(F),V(F);return}if(R(F)==="."){if(F.token+=R(F),V(F),!v.isDigit(R(F))){F.tokenType=w.DELIMITER;return}}else{for(;v.isDigit(R(F));)F.token+=R(F),V(F);v.isDecimalMark(R(F),P(F))&&(F.token+=R(F),V(F))}for(;v.isDigit(R(F));)F.token+=R(F),V(F);if(R(F)==="E"||R(F)==="e"){if(v.isDigit(P(F))||P(F)==="-"||P(F)==="+"){if(F.token+=R(F),V(F),(R(F)==="+"||R(F)==="-")&&(F.token+=R(F),V(F)),!v.isDigit(R(F)))throw Se(F,'Digit expected, got "'+R(F)+'"');for(;v.isDigit(R(F));)F.token+=R(F),V(F);if(v.isDecimalMark(R(F),P(F)))throw Se(F,'Digit expected, got "'+R(F)+'"')}else if(P(F)===".")throw V(F),Se(F,'Digit expected, got "'+R(F)+'"')}return}if(v.isAlpha(R(F),L(F),P(F))){for(;v.isAlpha(R(F),L(F),P(F))||v.isDigit(R(F));)F.token+=R(F),V(F);st(E,F.token)?F.tokenType=w.DELIMITER:F.tokenType=w.SYMBOL;return}for(F.tokenType=w.UNKNOWN;R(F)!=="";)F.token+=R(F),V(F);throw Se(F,'Syntax error in part "'+F.token+'"')}function W(F){do k(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function X(F){F.nestingLevel--}v.isAlpha=function(Y,ie,Ce){return v.isValidLatinOrGreek(Y)||v.isValidMathSymbol(Y,Ce)||v.isValidMathSymbol(ie,Y)},v.isValidLatinOrGreek=function(Y){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y)},v.isValidMathSymbol=function(Y,ie){return/^[\uD835]$/.test(Y)&&/^[\uDC00-\uDFFF]$/.test(ie)&&/^[^\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(ie)},v.isWhitespace=function(Y,ie){return Y===" "||Y===" "||Y===`
`&&ie>0},v.isDecimalMark=function(Y,ie){return Y==="."&&ie!=="/"&&ie!=="*"&&ie!=="^"},v.isDigitDot=function(Y){return Y>="0"&&Y<="9"||Y==="."},v.isDigit=function(Y){return Y>="0"&&Y<="9"},v.isHexDigit=function(Y){return Y>="0"&&Y<="9"||Y>="a"&&Y<="f"||Y>="A"&&Y<="F"};function ae(F,Y){var ie=C();sn(ie,{expression:F,extraNodes:Y}),k(ie);var Ce=J(ie);if(ie.token!=="")throw ie.tokenType===w.DELIMITER?Xe(ie,"Unexpected operator "+ie.token):Se(ie,'Unexpected part "'+ie.token+'"');return Ce}function J(F){var Y,ie=[],Ce;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(Y=U(F),F.comment&&(Y.comment=F.comment));F.token===`
`||F.token===";";)ie.length===0&&Y&&(Ce=F.token!==";",ie.push({node:Y,visible:Ce})),k(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(Y=U(F),F.comment&&(Y.comment=F.comment),Ce=F.token!==";",ie.push({node:Y,visible:Ce}));return ie.length>0?new s(ie):(Y||(Y=new u(void 0),F.comment&&(Y.comment=F.comment)),Y)}function U(F){var Y,ie,Ce,tt,xt=de(F);if(F.token==="="){if(Gr(xt))return Y=xt.name,W(F),Ce=U(F),new o(new T(Y),Ce);if(Ha(xt))return W(F),Ce=U(F),new o(xt.object,xt.index,Ce);if(na(xt)&&Gr(xt.fn)&&(tt=!0,ie=[],Y=xt.name,xt.args.forEach(function(_r,qe){Gr(_r)?ie[qe]=_r.name:tt=!1}),tt))return W(F),Ce=U(F),new c(Y,ie,Ce);throw Se(F,"Invalid left hand side of assignment operator =")}return xt}function de(F){for(var Y=we(F);F.token==="?";){var ie=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Ce=Y,tt=U(F);if(F.token!==":")throw Se(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var xt=U(F);Y=new l(Ce,tt,xt),F.conditionalLevel=ie}return Y}function we(F){for(var Y=se(F);F.token==="or";)W(F),Y=new d("or","or",[Y,se(F)]);return Y}function se(F){for(var Y=be(F);F.token==="xor";)W(F),Y=new d("xor","xor",[Y,be(F)]);return Y}function be(F){for(var Y=K(F);F.token==="and";)W(F),Y=new d("and","and",[Y,K(F)]);return Y}function K(F){for(var Y=j(F);F.token==="|";)W(F),Y=new d("|","bitOr",[Y,j(F)]);return Y}function j(F){for(var Y=ne(F);F.token==="^|";)W(F),Y=new d("^|","bitXor",[Y,ne(F)]);return Y}function ne(F){for(var Y=pe(F);F.token==="&";)W(F),Y=new d("&","bitAnd",[Y,pe(F)]);return Y}function pe(F){for(var Y=[fe(F)],ie=[],Ce={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};st(Ce,F.token);){var tt={name:F.token,fn:Ce[F.token]};ie.push(tt),W(F),Y.push(fe(F))}return Y.length===1?Y[0]:Y.length===2?new d(ie[0].name,ie[0].fn,Y):new b(ie.map(xt=>xt.fn),Y)}function fe(F){var Y,ie,Ce,tt;Y=Ae(F);for(var xt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};st(xt,F.token);)ie=F.token,Ce=xt[ie],W(F),tt=[Y,Ae(F)],Y=new d(ie,Ce,tt);return Y}function Ae(F){var Y,ie,Ce,tt;Y=_e(F);for(var xt={to:"to",in:"to"};st(xt,F.token);)ie=F.token,Ce=xt[ie],W(F),ie==="in"&&F.token===""?Y=new d("*","multiply",[Y,new T("in")],!0):(tt=[Y,_e(F)],Y=new d(ie,Ce,tt));return Y}function _e(F){var Y,ie=[];if(F.token===":"?Y=new u(1):Y=G(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ie.push(Y);F.token===":"&&ie.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ie.push(new T("end")):ie.push(G(F));ie.length===3?Y=new x(ie[0],ie[2],ie[1]):Y=new x(ie[0],ie[1])}return Y}function G(F){var Y,ie,Ce,tt;Y=Z(F);for(var xt={"+":"add","-":"subtract"};st(xt,F.token);){ie=F.token,Ce=xt[ie],W(F);var _r=Z(F);_r.isPercentage?tt=[Y,new d("*","multiply",[Y,_r])]:tt=[Y,_r],Y=new d(ie,Ce,tt)}return Y}function Z(F){var Y,ie,Ce,tt;Y=ge(F),ie=Y;for(var xt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};st(xt,F.token);)if(Ce=F.token,tt=xt[Ce],W(F),Ce==="%"&&F.tokenType===w.DELIMITER&&F.token!=="(")if(F.token!==""&&xt[F.token]){var _r=new d("/","divide",[Y,new u(100)],!1,!0);Ce=F.token,tt=xt[Ce],W(F),ie=ge(F),Y=new d(Ce,tt,[_r,ie])}else Y=new d("/","divide",[Y,new u(100)],!1,!0);else ie=ge(F),Y=new d(Ce,tt,[Y,ie]);return Y}function ge(F){var Y,ie;for(Y=xe(F),ie=Y;F.tokenType===w.SYMBOL||F.token==="in"&&Ht(Y)||F.token==="in"&&Qr(Y)&&Y.fn==="unaryMinus"&&Ht(Y.args[0])||F.tokenType===w.NUMBER&&!Ht(ie)&&(!Qr(ie)||ie.op==="!")||F.token==="(";)ie=xe(F),Y=new d("*","multiply",[Y,ie],!0);return Y}function xe(F){for(var Y=Ee(F),ie=Y,Ce=[];F.token==="/"&&Yp(ie);)if(Ce.push(sn({},F)),W(F),F.tokenType===w.NUMBER)if(Ce.push(sn({},F)),W(F),F.tokenType===w.SYMBOL||F.token==="("||F.token==="in")sn(F,Ce.pop()),Ce.pop(),ie=Ee(F),Y=new d("/","divide",[Y,ie]);else{Ce.pop(),sn(F,Ce.pop());break}else{sn(F,Ce.pop());break}return Y}function Ee(F){var Y,ie,Ce,tt={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return st(tt,F.token)?(Ce=tt[F.token],Y=F.token,W(F),ie=[Ee(F)],new d(Y,Ce,ie)):Be(F)}function Be(F){var Y,ie,Ce,tt;return Y=Ve(F),(F.token==="^"||F.token===".^")&&(ie=F.token,Ce=ie==="^"?"pow":"dotPow",W(F),tt=[Y,Ee(F)],Y=new d(ie,Ce,
U: `+this.U.toString()+`
P: `+this.p}}}function h(x){var b=x._size[0],T=x._size[1],v=Math.min(b,T),A=x._values,w=x._index,y=x._ptr,E=[],D=[],_=[],N=[b,v],C=[],B=[],R=[],V=[v,T],L,P,k,W=[],O=[];for(L=0;L<b;L++)W[L]=L,O[L]=L;var X=function(U,de){var we=O[U],se=O[de];W[we]=de,W[se]=U,O[U]=se,O[de]=we},ae=function(){var U=new p;P<b&&(_.push(E.length),E.push(1),D.push(P)),R.push(C.length);var de=y[P],we=y[P+1];for(k=de;k<we;k++)L=w[k],U.set(W[L],A[k]);P>0&&U.forEach(0,P-1,function(j,ne){m._forEachRow(j,E,D,_,function(pe,fe){pe>j&&U.accumulate(pe,c(o(fe,ne)))})});var se=P,be=U.get(P),K=n(be);U.forEach(P+1,b-1,function(j,ne){var pe=n(ne);l(pe,K)&&(se=j,K=pe,be=ne)}),P!==se&&(m._swapRows(P,se,N[1],E,D,_),m._swapRows(P,se,V[1],C,B,R),U.swap(P,se),X(P,se)),U.forEach(0,b-1,function(j,ne){j<=P?(C.push(ne),B.push(j)):(ne=a(ne,be),u(ne,0)||(E.push(ne),D.push(j)))})};for(P=0;P<T;P++)ae();return R.push(C.length),_.push(E.length),{L:new m({values:E,index:D,ptr:_,size:N}),U:new m({values:C,index:B,ptr:R,size:V}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var vO="qr",Mre=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],VS=M(vO,Mre,t=>{var{typed:e,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:f,divideScalar:m,multiplyScalar:p,subtractScalar:d,complex:h}=t;return sn(e(vO,{DenseMatrix:function(A){return b(A)},SparseMatrix:function(A){return T(A)},Array:function(A){var w=r(A),y=b(w);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:x});function x(v){var A=v._size[0],w=v._size[1],y=i([A],"dense"),E=y._data,D=v.clone(),_=D._data,N,C,B,R=n([A],"");for(B=0;B<Math.min(w,A);++B){var V=_[B][B],L=c(o(V,0)?1:s(V)),P=u(L),k=0;for(N=B;N<A;N++)k=f(k,p(_[N][B],u(_[N][B])));var W=p(L,l(k));if(!a(W)){var O=d(V,W);for(R[B]=1,N=B+1;N<A;N++)R[N]=m(_[N][B],O);var X=c(u(m(O,W))),ae=void 0;for(C=B;C<w;C++){for(ae=0,N=B;N<A;N++)ae=f(ae,p(u(R[N]),_[N][C]));for(ae=p(ae,X),N=B;N<A;N++)_[N][C]=p(d(_[N][C],p(R[N],ae)),P)}for(N=0;N<A;N++){for(ae=0,C=B;C<A;C++)ae=f(ae,p(E[N][C],R[C]));for(ae=p(ae,X),C=B;C<A;++C)E[N][C]=m(d(E[N][C],p(ae,u(R[C]))),P)}}}return{Q:y,R:D,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function b(v){var A=x(v),w=A.R._data;if(v._data.length>0)for(var y=w[0][0].type==="Complex"?h(0):0,E=0;E<w.length;++E)for(var D=0;D<E&&D<(w[0]||[]).length;++D)w[E][D]=y;return A}function T(v){throw new Error("qr not implemented for sparse matrices yet")}});function yO(t,e,r,n){for(var i=t._values,a=t._index,o=t._ptr,s=t._size,l=t._datatype,u=s[0],c=s[1],f=n&&t._values?[]:null,m=[],p=[],d=0,h=0;h<c;h++){p[h]=d;for(var x=r?r[h]:h,b=o[x],T=o[x+1],v=b;v<T;v++){var A=e?e[a[v]]:a[v];m[d]=A,f&&(f[d]=i[v]),d++}}return p[c]=d,t.createSparseMatrix({values:f,index:m,ptr:p,size:[u,c],datatype:l})}function Bv(t,e,r,n,i,a,o){var s=0;for(r[o]=t;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[e++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return e}function xO(t,e){if(!t)return null;var r=0,n,i=[],a=[],o=0,s=e,l=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)t[n]!==-1&&(a[s+n]=a[o+t[n]],a[o+t[n]]=n);for(n=0;n<e;n++)t[n]===-1&&(r=Bv(n,r,a,o,s,i,l));return i}function bO(t,e){if(!t)return null;var r=t._index,n=t._ptr,i=t._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,f,m;if(e)for(f=0;f<a;f++)l[c+f]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var d=n[p],h=n[p+1],x=d;x<h;x++){var b=r[x];for(f=e?l[c+b]:b;f!==-1&&f<p;f=m)m=l[u+f],l[u+f]=p,m===-1&&(s[f]=p);e&&(l[c+b]=p)}}return s}function wO(t,e,r){for(var n=t._values,i=t._index,a=t._ptr,o=t._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)e(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function Yo(t){return-t-2}var Cre="csAmd",Nre=["add","multiply","transpose"],_O=M(Cre,Nre,t=>{var{add:e,multiply:r,transpose:n}=t;return function(c,f){if(!f||c<=0||c>3)return null;var m=f._size,p=m[0],d=m[1],h=0,x=Math.max(16,10*Math.sqrt(d));x=Math.min(d-2,x);var b=i(c,f,p,d,x);wO(b,l,null);for(var T=b._index,v=b._ptr,A=v[d],w=[],y=[],E=0,D=d+1,_=2*(d+1),N=3*(d+1),C=4*(d+1),B=5*(d+1),R=6*(d+1),V=7*(d+1),L=w,P=a(d,v,y,E,N,L,_,V,D,R,C,B),k=o(d,v,y,B,C,R,x,D,N,L,_),W=0,O,X,ae,J,U,de,we,se,be,K,j,ne,pe,fe,Ae,_e;k<d;){for(ae=-1;W<d&&(ae=y[N+W])===-1;W++);y[_+ae]!==-1&&(L[y[_+ae]]=-1),y[N+W]=y[_+ae];var G=y[C+ae],Z=y[D+ae];k+=Z;var ge=0;y[D+ae]=-Z;var xe=v[ae],Ee=G===0?xe:A,Be=Ee;for(J=1;J<=G+1;J++){for(J>G?(de=ae,we=xe,se=y[E+ae]-G):(de=T[xe++],we=v[de],se=y[E+de]),U=1;U<=se;U++)O=T[we++],!((be=y[D+O])<=0)&&(ge+=be,y[D+O]=-be,T[Be++]=O,y[_+O]!==-1&&(L[y[_+O]]=L[O]),L[O]!==-1?y[_+L[O]]=y[_+O]:y[N+y[B+O]]=y[_+O]);de!==ae&&(v[de]=Yo(ae),y[R+de]=0)}for(G!==0&&(A=Be),y[B+ae]=ge,v[ae]=Ee,y[E+ae]=Be-Ee,y[C+ae]=-2,P=s(P,h,y,R,d),K=Ee;K<Be;K++)if(O=T[K],!((j=y[C+O])<=0)){be=-y[D+O];var Ve=P-be;for(xe=v[O],ne=v[O]+j-1;xe<=ne;xe++)de=T[xe],y[R+de]>=P?y[R+de]-=be:y[R+de]!==0&&(y[R+de]=y[B+de]+Ve)}for(K=Ee;K<Be;K++){for(O=T[K],ne=v[O],pe=ne+y[C+O]-1,fe=ne,Ae=0,_e=0,xe=ne;xe<=pe;xe++)if(de=T[xe],y[R+de]!==0){var et=y[R+de]-P;et>0?(_e+=et,T[fe++]=de,Ae+=de):(v[de]=Yo(ae),y[R+de]=0)}y[C+O]=fe-ne+1;var St=fe,Ye=ne+y[E+O];for(xe=pe+1;xe<Ye;xe++){X=T[xe];var ur=y[D+X];ur<=0||(_e+=ur,T[fe++]=X,Ae+=X)}_e===0?(v[O]=Yo(ae),be=-y[D+O],ge-=be,Z+=be,k+=be,y[D+O]=0,y[C+O]=-1):(y[B+O]=Math.min(y[B+O],_e),T[fe]=T[St],T[St]=T[ne],T[ne]=ae,y[E+O]=fe-ne+1,Ae=(Ae<0?-Ae:Ae)%d,y[_+O]=y[V+Ae],y[V+Ae]=O,L[O]=Ae)}for(y[B+ae]=ge,h=Math.max(h,ge),P=s(P+h,h,y,R,d),K=Ee;K<Be;K++)if(O=T[K],!(y[D+O]>=0))for(Ae=L[O],O=y[V+Ae],y[V+Ae]=-1;O!==-1&&y[_+O]!==-1;O=y[_+O],P++){for(se=y[E+O],j=y[C+O],xe=v[O]+1;xe<=v[O]+se-1;xe++)y[R+T[xe]]=P;var Jt=O;for(X=y[_+O];X!==-1;){var He=y[E+X]===se&&y[C+X]===j;for(xe=v[X]+1;He&&xe<=v[X]+se-1;xe++)y[R+T[xe]]!==P&&(He=0);He?(v[X]=Yo(O),y[D+O]+=y[D+X],y[D+X]=0,y[C+X]=-1,X=y[_+X],y[_+Jt]=X):(Jt=X,X=y[_+X])}}for(xe=Ee,K=Ee;K<Be;K++)O=T[K],!((be=-y[D+O])<=0)&&(y[D+O]=be,_e=y[B+O]+ge-be,_e=Math.min(_e,d-k-be),y[N+_e]!==-1&&(L[y[N+_e]]=O),y[_+O]=y[N+_e],L[O]=-1,y[N+_e]=O,W=Math.min(W,_e),y[B+O]=_e,T[xe++]=O);y[D+ae]=Z,(y[E+ae]=xe-Ee)===0&&(v[ae]=-1,y[R+ae]=0),G!==0&&(A=xe)}for(O=0;O<d;O++)v[O]=Yo(v[O]);for(X=0;X<=d;X++)y[N+X]=-1;for(X=d;X>=0;X--)y[D+X]>0||(y[_+X]=y[N+v[X]],y[N+v[X]]=X);for(de=d;de>=0;de--)y[D+de]<=0||v[de]!==-1&&(y[_+de]=y[N+v[
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function zS(t,e){var r,n=e.length,i=[];if(t)for(r=0;r<n;r++)i[t[r]]=e[r];else for(r=0;r<n;r++)i[r]=e[r];return i}var FO="lusolve",Vre=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],HS=M(FO,Vre,t=>{var{typed:e,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(FO,{"Array, Array | Matrix":function(m,p){m=r(m);var d=n(m),h=c(d.L,d.U,d.p,null,p);return h.valueOf()},"DenseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(m,p,d,h){var x=i(m,d,h);return c(x.L,x.U,x.p,x.q,p)},"Object, Array | Matrix":function(m,p){return c(m.L,m.U,m.p,m.q,p)}});function u(f){if(rt(f))return f;if(vr(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,m,p,d,h){f=u(f),m=u(m),p&&(h=l(f,h,!0),h._data=zS(p,h._data));var x=o(f,h),b=a(m,x);return d&&(b._data=zS(d,b._data)),b}});var IO="polynomialRoot",Ure=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],GS=M(IO,Ure,t=>{var{typed:e,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:m,re:p}=t;return e(IO,{"number|Complex, ...number|Complex":(d,h)=>{for(var x=[d,...h];x.length>0&&r(x[x.length-1]);)x.pop();if(x.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(h,"] must have a non-zero non-constant coefficient"));switch(x.length){case 2:return[u(s(x[0],x[1]))];case 3:{var[b,T,v]=x,A=o(2,v),w=o(T,T),y=o(4,v,b);if(n(w,y))return[s(u(T),A)];var E=l(a(w,y));return[s(a(E,T),A),s(a(u(E),T),A)]}case 4:{var[D,_,N,C]=x,B=u(o(3,C)),R=o(N,N),V=o(3,C,_),L=i(o(2,N,N,N),o(27,C,C,D)),P=o(9,C,N,_);if(n(R,V)&&n(L,P))return[s(N,B)];var k=a(R,V),W=a(L,P),O=i(o(18,C,N,_,D),o(N,N,_,_)),X=i(o(4,N,N,N,D),o(4,C,_,_,_),o(27,C,C,D,D));if(n(O,X))return[s(a(o(4,C,N,_),i(o(9,C,C,D),o(N,N,N))),o(C,k)),s(a(o(9,C,D),o(N,_)),o(2,k))];var ae;n(R,V)?ae=W:ae=s(i(W,l(a(o(W,W),o(4,k,k,k)))),2);var J=!0,U=c(ae,J).toArray().map(de=>s(i(N,de,s(k,de)),B));return U.map(de=>f(de)==="Complex"&&n(p(de),p(de)+m(de))?p(de):de)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var qre="Help",zre=["evaluate"],WS=M(qre,zre,t=>{var{evaluate:e}=t;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`
`),n.category&&(i+="Category: "+n.category+`
`),n.description&&(i+=`Description:
`+n.description+`
`),n.syntax&&(i+=`Syntax:
`+n.syntax.join(`
`)+`
`),n.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),s={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},l=0;l<n.examples.length;l++){var u=n.examples[l];i+=" "+u+`
`;var c=void 0;try{c=e(u,s)}catch(f){c=f}c!==void 0&&!Dg(c)&&(i+=" "+Dt(c,{precision:14})+`
`)}i+=`
`,a&&e("config(originalConfig)",{originalConfig:o})}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},r.prototype.toJSON=function(){var n=yt(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var Hre="Chain",Gre=["?on","math","typed"],YS=M(Hre,Gre,t=>{var{on:e,math:r,typed:n}=t;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Mg(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Dt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){K2(i.prototype,u,function(){var m=c();if(typeof m=="function")return s(m)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(u)){var m=n.resolve(u,c);if(m.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var f=function(d){st(u,d)&&l[d]===void 0&&o(d,()=>u[d])};for(var m in u)f(m)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var jS={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 PO={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var BO={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 kO={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 $O={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var OO={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var RO={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 LO={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 VO={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var UO={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var qO={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 ZS={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 zO={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns
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 f4={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 p4={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 m4={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 d4={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 h4={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 g4={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 v4={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 y4={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 x4={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent 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 b4={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 w4={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var _4={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 A4={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new Cs({errorLevel:"ERROR",effect:"The validation for the button config failed.",cause:"Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.",positionContext:n.message,docs:[jt.linkToButtonConfig()]})}return r.data}validate(e){let r=new Qt("Button"),n;try{n=this.validateConfig(e)}catch(i){r.add(i)}return{declarationString:void 0,config:n,errorCollection:r}}};var jf=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(fn))e[r]=0;for(let r of this.arguments){let n=r.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new Hr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[jt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let r of e.arguments){let n=r.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(r)}return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){let n=r.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new Hr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var dy=class extends jf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Zf=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,r){if(r.find(n=>n.length===e.length)===void 0)throw new Hr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${r.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[jt.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?"all":this.getConfig().allowedFieldTypes.join(", ")}};var Tr=class extends Zf{};var hy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.addLabels}};var gy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.allowOther}};var vy=class extends Tr{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Nr.class}};var yy=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.defaultValue}};var xy=class extends Tr{constructor(){super(...arguments);this.value=void 0}_parseValue(r){if(this.value=Number.parseInt(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.limit}};var by=class extends Tr{constructor(){super(...arguments);this.value=100}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.maxValue}};var wy=class
[${e.error.getErrorType()??""}]`)),ce(u);var f=le(u);ce(l);var m=le(l,2);{var p=B=>{var R=Moe(),V=ye(R),L=ye(V,!0);ce(V),ce(R),Re(()=>ht(L,e.error.positionContext)),ee(B,R)};ot(m,B=>{e.error.positionContext&&B(p)})}var d=le(m,2),h=ye(d),x=ye(h),b=le(ye(x)),T=ye(b,!0);ce(b),ce(x);var v=le(x),A=le(ye(v)),w=ye(A,!0);ce(A),ce(v);var y=le(v);{var E=B=>{var R=Coe(),V=le(ye(R)),L=ye(V,!0);ce(V),ce(R),Re(()=>ht(L,e.error.tip)),ee(B,R)};ot(y,B=>{e.error.tip&&B(E)})}var D=le(y);{var _=B=>{var R=Foe(),V=le(ye(R));Yt(V,21,()=>e.error.docs,er,(L,P)=>{var k=Noe(),W=Je(k),O=ye(W,!0);ce(W),Nt(),Re(()=>{wt(W,"href",z(P)),ht(O,z(P))}),ee(L,k)}),ce(V),ce(R),ee(B,R)};ot(D,B=>{e.error.docs&&B(_)})}var N=le(D);{var C=B=>{var R=Ioe(),V=le(ye(R)),L=ye(V),P=ye(L),k=ye(P,!0);Re(()=>ht(k,JSON.stringify(e.error.context,null,4))),ce(P),ce(L),ce(V),ce(R),ee(B,R)};ot(N,B=>{e.error.context&&B(C)})}ce(h),ce(d),ce(s),Re(()=>{xa(u,Ws(e.error.errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")),ht(f,` - ${e.error.effect??""}`),ht(T,e.error.cause),ht(w,e.error.effect)}),ee(o,s)},a=o=>{var s=Boe(),l=ye(s),u=ye(l),c=ye(u,!0);ce(u),ce(l),ce(s),Re(()=>ht(c,e.error.stack)),ee(o,s)};ot(n,o=>{e.error instanceof Jn?o(i):o(a,!1)})}ee(t,r),De()}var koe=ue("<p> </p>"),$oe=ue('<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>'),Ooe=ue("<p> </p>"),Roe=ue("<h6>Errors</h6> <!> <!>",1),Loe=ue("<p> </p>"),Voe=ue("<h6>Warnings</h6> <!> <!>",1),Uoe=ue("<!> <!> <!> <!>",1);function uu(t,e){Te(e,!0);var r=Uoe(),n=Je(r);{var i=f=>{var m=koe(),p=ye(m,!0);ce(m),Re(()=>ht(p,e.settings.text)),ee(f,m)};ot(n,f=>{e.settings.text&&f(i)})}var a=le(n,2);{var o=f=>{var m=$oe(),p=ye(m),d=ye(p,!0);ce(p),ce(m),Re(()=>ht(d,e.settings.code)),ee(f,m)};ot(a,f=>{e.settings.code&&f(o)})}var s=le(a,2);{var l=f=>{var m=Roe(),p=le(Je(m),2);{var d=x=>{var b=Ooe(),T=ye(b,!0);ce(b),Re(()=>ht(T,e.settings.errorText)),ee(x,b)};ot(p,x=>{e.settings.errorText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getErrors(),er,(x,b)=>{Qy(x,{get error(){return z(b)}})}),ee(f,m)};ot(s,f=>{e.settings.errorCollection.hasErrors()&&f(l)})}var u=le(s,2);{var c=f=>{var m=Voe(),p=le(Je(m),2);{var d=x=>{var b=Loe(),T=ye(b,!0);ce(b),Re(()=>ht(T,e.settings.warningText)),ee(x,b)};ot(p,x=>{e.settings.warningText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getWarnings(),er,(x,b)=>{Qy(x,{get error(){return z(b)}})}),ee(f,m)};ot(u,f=>{e.settings.errorCollection.hasWarnings()&&f(c)})}ee(t,r),De()}var qoe=(t,e)=>e(),zoe=(t,e)=>{t.key===" "&&e()},Hoe=ue('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" x2="12" y1="8" y2="12"></line><line x1="12" x2="12.01" y1="16" y2="16"></line></svg> <span class="mb-error">[META_BIND_ERROR]</span>',1),Goe=Vh('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-triangle"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><line x1="12" x2="12" y1="9" y2="13"></line><line x1="12" x2="12.01" y1="17" y2="17"></line></svg>'),Woe=Vh('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>'),Yoe=ue('<div class="mb-error-collection" role="button" tabindex="0" aria-label="Click to view errors and warnings"><!></div>');function Xf(t,e){Te(e,!0);function r(){e.plugin.internal.openErrorCollectionViewModal(e.settings)}var n=Xr(),i=Je(n);{var a=o=>{var s=Yoe();s.__click=[qoe,r],s.__keydown=[zoe,r];var l=ye(s);{var u=f=>{var m=Hoe();Nt(2),ee(f,m)},c=f=>{var m=Xr(),p=Je(m);{var d=x=>{var b=G
when clicked.</p> <h3>Unloaded Message</h3> <p>A message like this <span class="mb-warning">[MB_UNLOADED] ...</span> means that Obsidian told Meta Bind to unload
the field that was once displayed there. This usually happens when Meta Bind was disabled, such as after a plugin
update, or when another plugin is interfering with Meta Bind.</p> <p>Usually reopening the note or restarting Obsidian causes the field to display normally again.</p> <h3>Bind Targets</h3> <p><a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a> let the plugin know what frontmatter properties to bind <a>Input Fields</a> and <a>View Fields</a> to.</p> <h2>Playground</h2> <h3>Input Fields</h3> <p><a>Input Fields</a> let you change the frontmatter of your notes from inside
of notes.</p> <!> <h3>View Fields</h3> <p><a>View Fields</a> let you view and perform calculations using the frontmatter
of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
fields and as fast as obsidian allows it for changes from other sources.</p> <!></div>`);function XM(t,e){Te(e,!0);let r="INPUT[someInputFieldDeclaration]",n=Le(new Qt("exampleWarningErrorCollection")),i="INPUT[someInputFieldDeclaration]",a=Le(new Qt("exampleErrorErrorCollection"));t0(()=>{n.add(new sp({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),a.add(new sp({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"}))});var o=Koe(),s=ye(o);su(s,{children:(D,_)=>{var N=Qoe(),C=le(Je(N),2),B=ye(C);Et(B,{get variant(){return"primary"},onclick:()=>{jt.open(jt.linkToHome())},children:(L,P)=>{Nt();var k=lr("Docs");ee(L,k)},$$slots:{default:!0}});var R=le(B,2);Et(R,{onclick:()=>{jt.open(jt.linkToGithub())},children:(L,P)=>{Nt();var k=lr("GitHub");ee(L,k)},$$slots:{default:!0}});var V=le(R,2);Et(V,{onclick:()=>{jt.open(jt.linkToIssues())},children:(L,P)=>{Nt();var k=lr("Report Issue");ee(L,k)},$$slots:{default:!0}}),ce(C),ee(D,N)},$$slots:{default:!0}});var l=le(s,6),u=le(ye(l));Re(()=>wt(u,"href",jt.linkToInputFields()));var c=le(u,2);Re(()=>wt(c,"href",jt.linkToViewFields()));var f=le(c,4),m=Vt(()=>({errorCollection:n,code:r}));Xf(f,{get plugin(){return e.plugin},get settings(){return z(m)}});var p=le(f,4),d=Vt(()=>({errorCollection:a,code:i}));Xf(p,{get plugin(){return e.plugin},get settings(){return z(d)}}),Nt(3),ce(l);var h=le(l,10),x=le(ye(h),2);Re(()=>wt(x,"href",jt.linkToInputFields()));var b=le(x,2);Re(()=>wt(b,"href",jt.linkToViewFields())),Nt(),ce(h);var T=le(h,6),v=ye(T);Re(()=>wt(v,"href",jt.linkToInputFields())),Nt(),ce(T);var A=le(T,2);Yt(A,17,()=>mF(e.plugin),er,(D,_)=>{ZM(D,{get declaration(){return z(_)[1]},get plugin(){return e.plugin}})});var w=le(A,4),y=ye(w);Re(()=>wt(y,"href",jt.linkToViewFields())),Nt(),ce(w);var E=le(w,2);Yt(E,17,()=>Object.values(ab),er,(D,_)=>{var N=Xr(),C=Je(N);Yt(C,17,()=>z(_),er,(B,R)=>{JM(B,{get declaration(){return z(R)},get plugin(){return e.plugin}})}),ee(D,N)}),ce(o),ee(t,o),De()}var sc="mb-playground-view-type",lx=class extends A9.ItemView{constructor(e,r){super(e),this.plugin=r}getViewType(){return sc}getDisplayText(){return"Meta Bind playground"}async onOpen(){this.contentEl.empty(),this.component=Vr(XM,{target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component&&Ur(this.component)}};var hi=require("obsidian");var S9=require("obsidian");var jm=require("obsidian");var Ym=require("obsidian");var ese=ue("<span> </span> <!> <!> <!>",1),tse=ue('<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>');function QM(t,e){Te(e,!0);let r=lt(e,"template",15);function n(){e.plugin.internal.openButtonBuilderModal({submitText:"Submit",config:li(r()),onOkay:c=>{r(c)}})}function i(){let c=(0,Ym.stringifyYaml)(li(r()));navigator.clipboard.writeText(c),new Ym.Notice("meta-bind | Copied to clipboard")}var a=tse(),o=ye(a);su(o,{stretchChildren:!0,children:(c,f)=>{var m=ese(),p=Je(m),d=ye(p,!0);ce(p);var h=le(p,2);Et(h,{onclick:()=>n(),get variant(){return"primary"},tooltip:"Edit",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"pen-line"})},$$slots:{default:!0}});var x=le(h,2);Et(x,{onclick:()=>i(),get variant(){return"default"},tooltip:"Copy",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"copy"})},$$slots:{default:!0}});var b=le(x,2);Et(b,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),Re(()=>ht(d,r().id)),ee(c,m)},$$slots:{default:!0}});var s=le(o,2),l=ye(s),u=ye(l,!0);Re(()=>ht(u,(0,Ym.stringifyYaml)(r()))),ce(l),ce(s),ce(a),ee(t,a),De()}var rse=ue('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),nse=ue("<!> <!>",1),ise=ue("<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>");function KM(t,e){Te(e,!0);let r=bt(void 0),n=bt(Le(e.buttonConfigs));function i(x){$e(n,Le(z(n).filter(b=>b!==x)))}function a(){z(n).push(e.modal.plugin.api.buttonActionRunner.createDefaultButto
OR `,issueSeparator:" AND ",prefix:null});console.warn(new Cs({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:T.message,docs:[jt.linkToButtonConfig()]})),console.warn(T),new jm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}z(n).push(x)}function s(){$e(r,Le(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function l(){e.modal.close()}var u=ise(),c=le(ye(u),2);Yt(c,17,()=>z(n),er,(x,b,T)=>{QM(x,{get plugin(){return e.modal.plugin},onDelete:i,get template(){return z(n)[T]},set template(v){z(n)[T]=v}})});var f=le(c,2);Et(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(x,b)=>{Nt();var T=lr("Add Template");ee(x,T)},$$slots:{default:!0}});var m=le(f,2);Et(m,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(x,b)=>{Nt();var T=lr("Add Template from Clipboard");ee(x,T)},$$slots:{default:!0}});var p=le(m,2);{var d=x=>{var b=rse(),T=le(ye(b),2),v=Vt(()=>({errorCollection:z(r)}));uu(T,{get settings(){return z(v)}}),ce(b),ee(x,b)};ot(p,x=>{z(r)&&x(d)})}var h=le(p,2);Qo(h,{children:(x,b)=>{var T=nse(),v=Je(T);Et(v,{onclick:()=>s(),get variant(){return"primary"},tooltip:"Save changes",children:(w,y)=>{Nt();var E=lr("Save");ee(w,E)},$$slots:{default:!0}});var A=le(v,2);Et(A,{onclick:()=>l(),tooltip:"Revert changes",children:(w,y)=>{Nt();var E=lr("Cancel");ee(w,E)},$$slots:{default:!0}}),ee(x,T)},$$slots:{default:!0}}),ce(u),ee(t,u),De()}var cx=class extends S9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Ur(this.component),this.component=Vr(KM,{target:this.contentEl,props:{buttonConfigs:JN(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Ur(this.component)}save(e){let r=this.plugin.api.buttonManager.setButtonTemplates(e);if(r.hasErrors())return r;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var E9=require("obsidian");var ase=ue('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),ose=ue('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),sse=ue("<!> <!>",1),use=ue('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function eC(t,e){Te(e,!0);let r=bt(void 0),n=bt(Le(e.excludedFolders));function i(h){$e(n,Le(z(n).filter(x=>x!==h)))}function a(){z(n).push("")}function o(){$e(r,Le(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=use(),u=ye(l),c=le(ye(u));Yt(c,21,()=>z(n),er,(h,x,b)=>{var T=ase(),v=ye(T),A=ye(v);Tt(A),ce(v);var w=le(v),y=ye(w);Et(y,{onclick:()=>i(z(x)),tooltip:"Delete",children:(E,D)=>{Yr(E,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),ce(w),ce(T),_t(A,()=>z(n)[b],E=>z(n)[b]=E),ee(h,T)}),ce(c),ce(u);var f=le(u,2);Et(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(h,x)=>{Nt();var b=lr("Add folder");ee(h,b)},$$slots:{default:!0}});var m=le(f,2);{var p=h=>{var x=ose(),b=le(ye(x),2),T=Vt(()=>({errorCollection:z(r)}));uu(b,{get settings(){return z(T)}}),ce(x),ee(h,x)};ot(m,h=>{z(r)&&h(p)})}var d=le(m,2);Qo(d,{children:(h,x)=>{var b=sse(),T=Je(b);Et(T,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(A,w)=>{Nt();var y=lr("Save");ee(A,y)},$$slots:{default:!0}});var v=le(T,2);Et(v,{onclick:()=>s(),tooltip:"Revert changes",children:(A,w)=>{Nt();var y=lr("Cancel");ee(A,y)},$$slots:{default:!0}}),ee(h,b)},$$slots:{default:!0}}),ce(l),ee(t,l),De()}var fx=class extends E9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Ur(this.component),this.component=Vr(eC,{target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this,plugin:this.plugin}})}onClose(
${(0,hx.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.addCommand({id:"copy-command-id",name:"Select and copy command id",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.register(()=>e.remove())}if(this.build==="canary"){let e=this.addStatusBarItem();e.setText(`Meta Bind Canary Build (${this.manifest.version})`),e.addClass("mb-error"),this.register(()=>e.remove())}}loadTemplates(){if(!this.api)return;let e=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);e.hasErrors()&&console.warn("meta-bind | failed to parse input field templates",e);let r=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);r.hasErrors()&&console.warn("meta-bind | failed to parse button templates",r)}async loadSettings(){console.log("meta-bind | Main >> loading settings");let e=await this.loadData()??{};typeof e=="object"&&e!=null&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},Po,e),this.updateInternalSettings(),vd(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){oi.dateFormat=this.settings.preferredDateFormat,tF(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:r}=this.app,n,i=r.getLeavesOfType(e);i.length>0?n=i[0]:(n=r.getLeaf("tab"),await n.setViewState({type:e,active:!0})),r.revealLeaf(n)}};
/*! Bundled license information:
moment/moment.js:
(*! moment.js *)
(*! version : 2.30.1 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
decimal.js/decimal.mjs:
(*!
* decimal.js v10.4.3
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*)
*/
/* nosourcemap */