/* ------------------------------------------- Meta Bind Plugin - Release Build ------------------------------------------- By: Moritz Jung (https://mprojectscode.github.io/) Time: Wed, 13 Dec 2023 15:35:06 GMT Version: 0.10.1 ------------------------------------------- THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ "use strict";var D5=Object.create;var gu=Object.defineProperty;var E5=Object.getOwnPropertyDescriptor;var C5=Object.getOwnPropertyNames;var S5=Object.getPrototypeOf,N5=Object.prototype.hasOwnProperty;var M5=(n,e,t)=>e in n?gu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var kr=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),T5=(n,e)=>{for(var t in e)gu(n,t,{get:e[t],enumerable:!0})},F_=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of C5(e))!N5.call(n,i)&&i!==t&&gu(n,i,{get:()=>e[i],enumerable:!(r=E5(e,i))||r.enumerable});return n};var gr=(n,e,t)=>(t=n!=null?D5(S5(n)):{},F_(e||!n||!n.__esModule?gu(t,"default",{value:n,enumerable:!0}):t,n)),F5=n=>F_(gu({},"__esModule",{value:!0}),n);var Wr=(n,e,t)=>(M5(n,typeof e!="symbol"?e+"":e,t),t);var hc=kr(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.P_HELPERS=Bn.ParserHelpers=Bn.validateRegexFlags=Bn.validateRange=Bn.getIndex=Bn.arrayUnion=void 0;var dd=gc();function G6(n,e){if(n===void 0&&e===void 0)return;if(n===void 0)return e;if(e===void 0)return n;let t=[...n];for(let r of e)t.includes(r)||t.push(r);return t}Bn.arrayUnion=G6;function W6(n){return n===void 0?-1:n.index}Bn.getIndex=W6;function j6(n,e){if(e{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.ParserContext=void 0;var hd=hc(),gd=class n{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new n(this.input,{index:this.position.index,column:this.position.column,line:this.position.line})}getPosition(){return{index:this.position.index,column:this.position.column,line:this.position.line}}atEOF(){return this.position.index>=this.input.length}advanceTo(e){if(er)return t;let a=i===r?(0,hd.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};vc.ParserContext=gd});var si=kr(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.P_UTILS=void 0;var yc=gc(),lr=ui(),vd=class n{static position(){return new yc.Parser(e=>e.succeed(e.getPosition()))}static any(){return new yc.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new yc.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new yc.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return lr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return lr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return lr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return lr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return lr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return lr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return lr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return lr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return lr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return lr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return lr.P.string("\r")}static lf(){return lr.P.string(` `)}static crlf(){return lr.P.string(`\r `)}static newline(){return lr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,r){return lr.P.sequenceMap((i,a)=>i.reduce((o,l)=>r(l,o),a),e.many(),t)}static postfix(e,t,r){return lr.P.sequenceMap((i,a)=>a.reduce((o,l)=>r(l,o),i),t,e.many())}static binaryRight(e,t,r){return lr.P.sequenceMap((i,a)=>i.reverse().reduce((o,l)=>{let[u,s]=l;return r(u,s,o)},a),lr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,r){return lr.P.sequenceMap((i,a)=>a.reduce((o,l)=>{let[u,s]=l;return r(o,u,s)},i),t,lr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,r){return lr.P.sequenceMap((i,a,o)=>i.reverse().reduce((l,u)=>{let[s,c,f]=u;return r({from:s,to:o},c,f,l)},a),lr.P.sequence(n.position(),t,e.trim(this.optionalWhitespace())).many(),t,n.position())}static binaryLeftRange(e,t,r){return lr.P.sequenceMap((i,a,o)=>o.reduce((l,u)=>{let[s,c,f]=u;return r({from:i,to:f},l,s,c)},a),n.position(),t,lr.P.sequence(e.trim(this.optionalWhitespace()),t,n.position()).many())}static func(e,t,r){let i=typeof e=="string"?lr.P.string(e):e;return lr.P.sequenceMap((a,o,l,u,s,c)=>r(a,u),i,lr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),lr.P.string(")"))}};xc.P_UTILS=vd});var GA=kr(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.ParsingError=bs.createParsingErrorMessage=void 0;function HA(n,e,t){let r=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${r} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=n.split(` `)[e.furthest.line-1],l=`${e.furthest.line} | `;i+=` ${l}${o}`,i+=` ${" ".repeat(e.furthest.column-1+l.length)}^ (${r})`}return i}bs.createParsingErrorMessage=HA;var yd=class extends Error{constructor(e,t){super(HA(e,t,!0))}};bs.ParsingError=yd});var gc=kr(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.Parser=void 0;var J6=$A(),li=ui(),xd=hc(),ws=si(),Y6=GA(),bd=class n{constructor(e){this.p=e}tryParse(e){return this.p(new J6.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new Y6.ParsingError(e,t)}or(e){return li.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(li.P.string(e))}wrap(e,t){let r=this;return new n(function(a){let o=e.p(a);if(!o.success)return o;let l=a.merge(o,r.p(a));if(!l.success)return l;let u=a.merge(l,t.p(a));return u.success?a.merge(u,a.succeed(l.value)):u})}wrapString(e,t){return this.wrap(li.P.string(e),li.P.string(t))}then(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let t=this;return new n(function(i){let a=t.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 li.P.sequence(this,e)}many(){let e=this;return new n(function(r){let i,a=r.position.index,o=[];for(;;){let l=r.copy(),u=e.p(l);if(i=r.merge(i,u),i.success){if(l.position.index===a)throw new Error("infinite loop in many() parser detected");r.moveToPosition(l.position),o.push(i.value)}else return r.merge(i,r.succeed(o))}})}repeat(e,t){(0,xd.validateRange)(e,t);let r=this;return new n(function(a){let o,l,u=[],s=0;for(;st.concat(r),this.repeat(e,e),this.many())}separateBy(e){return li.P.separateBy(this,e)}separateByNotEmpty(e){return li.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new n(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return li.P.sequenceMap(function(t,r,i){return{value:r,range:{from:t,to:i}}},ws.P_UTILS.position(),this,ws.P_UTILS.position())}namedMarker(e){return li.P.sequenceMap(function(r,i,a){return{value:i,name:e,range:{from:r,to:a}}},ws.P_UTILS.position(),this,ws.P_UTILS.position())}node(e){return li.P.sequenceMap(function(r,i,a){return e(i,{from:r,to:a})},ws.P_UTILS.position(),this,ws.P_UTILS.position())}followedBy(e){return this.skip(xd.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(xd.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new n(function(i){let a=t.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let t=this;return new n(function(i){var a;let o=t.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(li.P.succeed(e))}chain(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let l=e(a.value).p(i);return i.merge(a,l)})}thenEof(){let e=this;return new n(function(r){let i=e.p(r);return i.success?r.atEOF()?i:r.merge(i,r.fail("eof")):i})}memorize(){let e=this,t="",r=new Map,i=new Map;return new n(function(o){let l=o.position.index;if(o.input!==t)t=o.input,r.clear(),i.clear();else{let s=r.get(l),c=i.get(l);if(s!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},s)}let u=e.p(o);return r.set(l,Object.assign({},u)),i.set(l,o.getPosition()),u})}};bc.Parser=bd});var ui=kr(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.P=void 0;var Yn=gc(),wc=hc(),wd=class n{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Yn.Parser(function(r){let i,a=new Array(e.length);for(let o=0;oe[a](t,i)),Object.defineProperty(r,a,{get:()=>{if(t[a]!==void 0)return t[a];throw new Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let a in e)t[a]=e[a](r,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Yn.Parser(function(r){let i;for(let a of e){let o=a,l=r.copy(),u=o.p(l);if(i=r.merge(i,u),i.success)return r.moveToPosition(l.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(n.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,t.then(e).many())}static string(e){let t="'"+e+"'";return new Yn.Parser(function(i){for(let a=0;a=0&&u<=l.length){let c=l[0],f=l[u];return a.succeedOffset(c.length,f)}let s="expected valid match group (0 to "+l.length+") in "+r;return a.fail(s)}else return a.fail(r)}):new Yn.Parser(function(a){let o=a.input.slice(a.position.index),l=e.exec(o);if(l!==null){let u=l[0];return a.succeedOffset(u.length,u)}else return a.fail(r)})}static succeed(e){return new Yn.Parser(function(r){return r.succeed(e)})}static fail(e){return new Yn.Parser(function(r){return r.fail(e)})}static oneOf(e){return wc.P_HELPERS.test(function(r){return e.includes(r)}).describe(`one character of '${e}'`)}static noneOf(e){return wc.P_HELPERS.test(function(r){return!e.includes(r)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(t=>this.string(t))).describe(e.map(t=>`'${t}'`).join(" or "))}static manyOf(e){return new Yn.Parser(function(r){let i=r.position.index;for(;i{(function(n,e){typeof ah=="object"&&typeof oh!="undefined"?oh.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis!="undefined"?globalThis:n||self,n["'typed'"]=e())})(ah,function(){"use strict";function n(){return!0}function e(){return!1}function t(){}let r="Argument is not a typed-function.";function i(){function o(H){return typeof H=="object"&&H!==null&&H.constructor===Object}let l=[{name:"number",test:function(H){return typeof H=="number"}},{name:"string",test:function(H){return typeof H=="string"}},{name:"boolean",test:function(H){return typeof H=="boolean"}},{name:"Function",test:function(H){return typeof H=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(H){return H instanceof Date}},{name:"RegExp",test:function(H){return H instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(H){return H===null}},{name:"undefined",test:function(H){return H===void 0}}],u={name:"any",test:n,isAny:!0},s,c,f=0,p={createCount:0};function m(H){let ne=s.get(H);if(ne)return ne;let pe='Unknown type "'+H+'"',_e=H.toLowerCase(),Ne;for(Ne of c)if(Ne.toLowerCase()===_e){pe+='. Did you mean "'+Ne+'" ?';break}throw new TypeError(pe)}function h(H){let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",pe=ne?m(ne).index:c.length,_e=[];for(let De=0;De{let _e=s.get(pe);return!_e.isAny&&_e.test(H)});return ne.length?ne:["any"]}function w(H){return H&&typeof H=="function"&&"_typedFunctionData"in H}function v(H,ne,pe){if(!w(H))throw new TypeError(r);let _e=pe&&pe.exact,Ne=Array.isArray(ne)?ne.join(","):ne,De=E(Ne),Ce=b(De);if(!_e||Ce in H.signatures){let se=H._typedFunctionData.signatureMap.get(Ce);if(se)return se}let Oe=De.length,M;if(_e){M=[];let se;for(se in H.signatures)M.push(H._typedFunctionData.signatureMap.get(se))}else M=H._typedFunctionData.signatures;for(let se=0;se!Hn.has(_i.name)))continue}Ke.push(st)}}if(M=Ke,M.length===0)break}let q;for(q of M)if(q.params.length<=Oe)return q;throw new TypeError("Signature not found (signature: "+(H.name||"unnamed")+"("+b(De,", ")+"))")}function x(H,ne,pe){return v(H,ne,pe).implementation}function _(H,ne){let pe=m(ne);if(pe.test(H))return H;let _e=pe.conversionsTo;if(_e.length===0)throw new Error("There are no conversions to "+ne+" defined.");for(let Ne=0;Ne<_e.length;Ne++)if(m(_e[Ne].from).test(H))return _e[Ne].convert(H);throw new Error("Cannot convert "+H+" to "+ne)}function b(H){let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return H.map(pe=>pe.name).join(ne)}function D(H){let ne=H.indexOf("...")===0,_e=(ne?H.length>3?H.slice(3):"any":H).split("|").map(Oe=>m(Oe.trim())),Ne=!1,De=ne?"...":"";return{types:_e.map(function(Oe){return Ne=Oe.isAny||Ne,De+=Oe.name+"|",{name:Oe.name,typeIndex:Oe.index,test:Oe.test,isAny:Oe.isAny,conversion:null,conversionIndex:-1}}),name:De.slice(0,-1),hasAny:Ne,hasConversion:!1,restParam:ne}}function C(H){let ne=H.types.map(Ce=>Ce.name),pe=P(ne),_e=H.hasAny,Ne=H.name,De=pe.map(function(Ce){let Oe=m(Ce.from);return _e=Oe.isAny||_e,Ne+="|"+Ce.from,{name:Ce.from,typeIndex:Oe.index,test:Oe.test,isAny:Oe.isAny,conversion:Ce,conversionIndex:Ce.index}});return{types:H.types.concat(De),name:Ne,hasAny:_e,hasConversion:De.length>0,restParam:H.restParam}}function A(H){return H.typeSet||(H.typeSet=new Set,H.types.forEach(ne=>H.typeSet.add(ne.name))),H.typeSet}function E(H){let ne=[];if(typeof H!="string")throw new TypeError("Signatures must be strings");let pe=H.trim();if(pe==="")return ne;let _e=pe.split(",");for(let Ne=0;Ne<_e.length;++Ne){let De=D(_e[Ne].trim());if(De.restParam&&Ne!==_e.length-1)throw new SyntaxError('Unexpected rest parameter "'+_e[Ne]+'": only allowed for the last parameter');if(De.types.length===0)return null;ne.push(De)}return ne}function F(H){let ne=U(H);return ne?ne.restParam:!1}function I(H){if(!H||H.types.length===0)return n;if(H.types.length===1)return m(H.types[0].name).test;if(H.types.length===2){let ne=m(H.types[0].name).test,pe=m(H.types[1].name).test;return function(Ne){return ne(Ne)||pe(Ne)}}else{let ne=H.types.map(function(pe){return m(pe.name).test});return function(_e){for(let Ne=0;Ne=Ne+1}}else return H.length===0?function(De){return De.length===0}:H.length===1?(pe=I(H[0]),function(De){return pe(De[0])&&De.length===1}):H.length===2?(pe=I(H[0]),_e=I(H[1]),function(De){return pe(De[0])&&_e(De[1])&&De.length===2}):(ne=H.map(I),function(De){for(let Ce=0;Ce{let Ne=R(_e.params,ne),De;for(De of Ne)pe.add(De)}),pe.has("any")?["any"]:Array.from(pe)}function V(H,ne,pe){let _e,Ne,De=H||"unnamed",Ce=pe,Oe;for(Oe=0;Oe{let st=k(Ke.params,Oe),fr=I(st);(Oe0){let Ke=y(ne[Oe]);return _e=new TypeError("Unexpected type of argument in function "+De+" (expected: "+Ne.join(" or ")+", actual: "+Ke.join(" | ")+", index: "+Oe+")"),_e.data={category:"wrongType",fn:De,index:Oe,actual:Ke,expected:Ne},_e}}else Ce=Ee}let M=Ce.map(function(Ee){return F(Ee.params)?1/0:Ee.params.length});if(ne.lengthq)return _e=new TypeError("Too many arguments in function "+De+" (expected: "+q+", actual: "+ne.length+")"),_e.data={category:"tooManyArgs",fn:De,index:ne.length,expectedLength:q},_e;let se=[];for(let Ee=0;Ee0)return 1;let _e=X(H)-X(ne);return _e<0?-1:_e>0?1:0}function W(H,ne){let pe=H.params,_e=ne.params,Ne=U(pe),De=U(_e),Ce=F(pe),Oe=F(_e);if(Ce&&Ne.hasAny){if(!Oe||!De.hasAny)return 1}else if(Oe&&De.hasAny)return-1;let M=0,q=0,se;for(se of pe)se.hasAny&&++M,se.hasConversion&&++q;let Ee=0,Ke=0;for(se of _e)se.hasAny&&++Ee,se.hasConversion&&++Ke;if(M!==Ee)return M-Ee;if(Ce&&Ne.hasConversion){if(!Oe||!De.hasConversion)return 1}else if(Oe&&De.hasConversion)return-1;if(q!==Ke)return q-Ke;if(Ce){if(!Oe)return 1}else if(Oe)return-1;let st=(pe.length-_e.length)*(Ce?-1:1);if(st!==0)return st;let fr=[],Hn=0;for(let ts=0;ts1&&ne.sort((Ne,De)=>Ne.index-De.index);let pe=ne[0].conversionsTo;if(H.length===1)return pe;pe=pe.concat([]);let _e=new Set(H);for(let Ne=1;NeNe.hasConversion)){let Ne=F(H),De=H.map(ve);pe=function(){let Oe=[],M=Ne?arguments.length-1:arguments.length;for(let q=0;qM.name).join("|"),hasAny:Oe.some(M=>M.isAny),hasConversion:!1,restParam:!0}),Ce.push(De)}else Ce=De.types.map(function(Oe){return{types:[Oe],name:Oe.name,hasAny:Oe.isAny,hasConversion:Oe.conversion,restParam:!1}});return $(Ce,function(Oe){return ne(pe,_e+1,Ne.concat([Oe]))})}else return[Ne]}return ne(H,0,[])}function oe(H,ne){let pe=Math.max(H.length,ne.length);for(let Oe=0;Oe=_e:Ce?_e>=Ne:_e===Ne}function ge(H){return H.map(ne=>Le(ne)?he(ne.referToSelf.callback):ye(ne)?re(ne.referTo.references,ne.referTo.callback):ne)}function ue(H,ne,pe){let _e=[],Ne;for(Ne of H){let De=pe[Ne];if(typeof De!="number")throw new TypeError('No definition for referenced signature "'+Ne+'"');if(De=ne[De],typeof De!="function")return!1;_e.push(De)}return _e}function ce(H,ne,pe){let _e=ge(H),Ne=new Array(_e.length).fill(!1),De=!0;for(;De;){De=!1;let Ce=!0;for(let Oe=0;Oe<_e.length;++Oe){if(Ne[Oe])continue;let M=_e[Oe];if(Le(M))_e[Oe]=M.referToSelf.callback(pe),_e[Oe].referToSelf=M.referToSelf,Ne[Oe]=!0,Ce=!1;else if(ye(M)){let q=ue(M.referTo.references,_e,ne);q?(_e[Oe]=M.referTo.callback.apply(this,q),_e[Oe].referTo=M.referTo,Ne[Oe]=!0,Ce=!1):De=!0}}if(Ce&&De)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return _e}function me(H){let ne=/\bthis(\(|\.signatures\b)/;Object.keys(H).forEach(pe=>{let _e=H[pe];if(ne.test(_e.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function de(H,ne){if(p.createCount++,Object.keys(ne).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&me(ne);let pe=[],_e=[],Ne={},De=[],Ce;for(Ce in ne){if(!Object.prototype.hasOwnProperty.call(ne,Ce))continue;let ar=E(Ce);if(!ar)continue;pe.forEach(function(hu){if(oe(hu,ar))throw new TypeError('Conflicting signatures "'+b(hu)+'" and "'+b(ar)+'".')}),pe.push(ar);let Fn=_e.length;_e.push(ne[Ce]);let _5=ar.map(C),Vl;for(Vl of ie(_5)){let hu=b(Vl);De.push({params:Vl,name:hu,fn:Fn}),Vl.every(A5=>!A5.hasConversion)&&(Ne[hu]=Fn)}}De.sort(W);let Oe=ce(_e,Ne,du),M;for(M in Ne)Object.prototype.hasOwnProperty.call(Ne,M)&&(Ne[M]=Oe[Ne[M]]);let q=[],se=new Map;for(M of De)se.has(M.name)||(M.fn=Oe[M.fn],q.push(M),se.set(M.name,M));let Ee=q[0]&&q[0].params.length<=2&&!F(q[0].params),Ke=q[1]&&q[1].params.length<=2&&!F(q[1].params),st=q[2]&&q[2].params.length<=2&&!F(q[2].params),fr=q[3]&&q[3].params.length<=2&&!F(q[3].params),Hn=q[4]&&q[4].params.length<=2&&!F(q[4].params),_i=q[5]&&q[5].params.length<=2&&!F(q[5].params),ts=Ee&&Ke&&st&&fr&&Hn&&_i;for(let ar=0;arar.test),b5=q.map(ar=>ar.implementation),w5=function(){for(let Fn=v5;Fnb(E(pe))),ne=U(arguments);if(typeof ne!="function")throw new TypeError("Callback function expected as last argument");return re(H,ne)}function re(H,ne){return{referTo:{references:H,callback:ne}}}function he(H){if(typeof H!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:H}}}function ye(H){return H&&typeof H.referTo=="object"&&Array.isArray(H.referTo.references)&&typeof H.referTo.callback=="function"}function Le(H){return H&&typeof H.referToSelf=="object"&&typeof H.referToSelf.callback=="function"}function Ae(H,ne){if(!H)return ne;if(ne&&ne!==H){let pe=new Error("Function names do not match (expected: "+H+", actual: "+ne+")");throw pe.data={actual:ne,expected:H},pe}return H}function ct(H){let ne;for(let pe in H)Object.prototype.hasOwnProperty.call(H,pe)&&(w(H[pe])||typeof H[pe].signature=="string")&&(ne=Ae(ne,H[pe].name));return ne}function xt(H,ne){let pe;for(pe in ne)if(Object.prototype.hasOwnProperty.call(ne,pe)){if(pe in H&&ne[pe]!==H[pe]){let _e=new Error('Signature "'+pe+'" is defined twice');throw _e.data={signature:pe,sourceFunction:ne[pe],destFunction:H[pe]},_e}H[pe]=ne[pe]}}let Vt=p;p=function(H){let ne=typeof H=="string",pe=ne?1:0,_e=ne?H:"",Ne={};for(let De=pe;DeNe.from===H.from);if(!pe)throw new Error("Attempt to remove nonexistent conversion from "+H.from+" to "+H.to);if(pe.convert!==H.convert)throw new Error("Conversion to remove does not match existing conversion");let _e=ne.conversionsTo.indexOf(pe);ne.conversionsTo.splice(_e,1)},p.resolve=function(H,ne){if(!w(H))throw new TypeError(r);let pe=H._typedFunctionData.signatures;for(let _e=0;_e{(function(n){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},r=function(s){var c=Math.PI/4;if(-c>s||s>c)return Math.cos(s)-1;var f=s*s;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(s,c){var f=Math.abs(s),p=Math.abs(c);return f<3e3&&p<3e3?Math.sqrt(f*f+p*p):(f0&&a();break;case"number":f.im=0,f.re=s;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function u(s,c){if(!(this instanceof u))return new u(s,c);var f=l(s,c);this.re=f.re,this.im=f.im}u.prototype={re:0,im:0,sign:function(){var s=this.abs();return new u(this.re/s,this.im/s)},add:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re+f.re,this.im+f.im)},sub:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re-f.re,this.im-f.im)},mul:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:f.im===0&&this.im===0?new u(this.re*f.re,0):new u(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(s,c){var f=new u(s,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return u.NAN;if(this.isInfinite()||f.isZero())return u.INFINITY;if(this.isZero()||f.isInfinite())return u.ZERO;s=this.re,c=this.im;var p=f.re,m=f.im,h,d;return m===0?new u(s/p,c/p):Math.abs(p)0)return new u(Math.pow(s,f.re),0);if(s===0)switch((f.re%4+4)%4){case 0:return new u(Math.pow(c,f.re),0);case 1:return new u(0,Math.pow(c,f.re));case 2:return new u(-Math.pow(c,f.re),0);case 3:return new u(0,-Math.pow(c,f.re))}}if(s===0&&c===0&&f.re>0&&f.im>=0)return u.ZERO;var p=Math.atan2(c,s),m=o(s,c);return s=Math.exp(f.re*m-f.im*p),c=f.im*m+f.re*p,new u(s*Math.cos(c),s*Math.sin(c))},sqrt:function(){var s=this.re,c=this.im,f=this.abs(),p,m;if(s>=0){if(c===0)return new u(Math.sqrt(s),0);p=.5*Math.sqrt(2*(f+s))}else p=Math.abs(c)/Math.sqrt(2*(f-s));return s<=0?m=.5*Math.sqrt(2*(f-s)):m=Math.abs(c)/Math.sqrt(2*(f+s)),new u(p,c<0?-m:m)},exp:function(){var s=Math.exp(this.re);return this.im,new u(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,c=this.im;return new u(Math.expm1(s)*Math.cos(c)+r(c),Math.exp(s)*Math.sin(c))},log:function(){var s=this.re,c=this.im;return c===0&&s>0,new u(o(s,c),Math.atan2(c,s))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,c=this.im;return new u(Math.sin(s)*e(c),Math.cos(s)*t(c))},cos:function(){var s=this.re,c=this.im;return new u(Math.cos(s)*e(c),-Math.sin(s)*t(c))},tan:function(){var s=2*this.re,c=2*this.im,f=Math.cos(s)+e(c);return new u(Math.sin(s)/f,t(c)/f)},cot:function(){var s=2*this.re,c=2*this.im,f=Math.cos(s)-e(c);return new u(-Math.sin(s)/f,t(c)/f)},sec:function(){var s=this.re,c=this.im,f=.5*e(2*c)+.5*Math.cos(2*s);return new u(Math.cos(s)*e(c)/f,Math.sin(s)*t(c)/f)},csc:function(){var s=this.re,c=this.im,f=.5*e(2*c)-.5*Math.cos(2*s);return new u(Math.sin(s)*e(c)/f,-Math.cos(s)*t(c)/f)},asin:function(){var s=this.re,c=this.im,f=new u(c*c-s*s+1,-2*s*c).sqrt(),p=new u(f.re-c,f.im+s).log();return new u(p.im,-p.re)},acos:function(){var s=this.re,c=this.im,f=new u(c*c-s*s+1,-2*s*c).sqrt(),p=new u(f.re-c,f.im+s).log();return new u(Math.PI/2-p.im,p.re)},atan:function(){var s=this.re,c=this.im;if(s===0){if(c===1)return new u(0,1/0);if(c===-1)return new u(0,-1/0)}var f=s*s+(1-c)*(1-c),p=new u((1-c*c-s*s)/f,-2*s/f).log();return new u(-.5*p.im,.5*p.re)},acot:function(){var s=this.re,c=this.im;if(c===0)return new u(Math.atan2(1,s),0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).atan():new u(s!==0?s/0:0,c!==0?-c/0:0).atan()},asec:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(0,1/0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).acos():new u(s!==0?s/0:0,c!==0?-c/0:0).acos()},acsc:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(Math.PI/2,1/0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).asin():new u(s!==0?s/0:0,c!==0?-c/0:0).asin()},sinh:function(){var s=this.re,c=this.im;return new u(t(s)*Math.cos(c),e(s)*Math.sin(c))},cosh:function(){var s=this.re,c=this.im;return new u(e(s)*Math.cos(c),t(s)*Math.sin(c))},tanh:function(){var s=2*this.re,c=2*this.im,f=e(s)+Math.cos(c);return new u(t(s)/f,Math.sin(c)/f)},coth:function(){var s=2*this.re,c=2*this.im,f=e(s)-Math.cos(c);return new u(t(s)/f,-Math.sin(c)/f)},csch:function(){var s=this.re,c=this.im,f=Math.cos(2*c)-e(2*s);return new u(-2*t(s)*Math.cos(c)/f,2*e(s)*Math.sin(c)/f)},sech:function(){var s=this.re,c=this.im,f=Math.cos(2*c)+e(2*s);return new u(2*e(s)*Math.cos(c)/f,-2*t(s)*Math.sin(c)/f)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var c=this.asin();return this.re=-this.im,this.im=s,s=c.re,c.re=-c.im,c.im=s,c},acosh:function(){var s=this.acos();if(s.im<=0){var c=s.re;s.re=-s.im,s.im=c}else{var c=s.im;s.im=-s.re,s.re=c}return s},atanh:function(){var s=this.re,c=this.im,f=s>1&&c===0,p=1-s,m=1+s,h=p*p+c*c,d=h!==0?new u((m*p-c*c)/h,(c*p+m*c)/h):new u(s!==-1?s/0:0,c!==0?c/0:0),g=d.re;return d.re=o(d.re,d.im)/2,d.im=Math.atan2(d.im,g)/2,f&&(d.im=-d.im),d},acoth:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(0,Math.PI/2);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).atanh():new u(s!==0?s/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var s=this.re,c=this.im;if(c===0)return new u(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).asinh():new u(s!==0?s/0:0,c!==0?-c/0:0).asinh()},asech:function(){var s=this.re,c=this.im;if(this.isZero())return u.INFINITY;var f=s*s+c*c;return f!==0?new u(s/f,-c/f).acosh():new u(s!==0?s/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return u.INFINITY;if(this.isInfinite())return u.ZERO;var s=this.re,c=this.im,f=s*s+c*c;return new u(s/f,-c/f)},conjugate:function(){return new u(this.re,-this.im)},neg:function(){return new u(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new u(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new u(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new u(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,c){var f=new u(s,c);return Math.abs(f.re-this.re)<=u.EPSILON&&Math.abs(f.im-this.im)<=u.EPSILON},clone:function(){return new u(this.re,this.im)},toString:function(){var s=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s){(function(n){"use strict";var e=2e3,t={s:1,n:0,d:1};function r(d,g){if(isNaN(d=parseInt(d,10)))throw m();return d*g}function i(d,g){if(g===0)throw p();var y=Object.create(f.prototype);y.s=d<0?-1:1,d=d<0?-d:d;var w=c(d,g);return y.n=d/w,y.d=g/w,y}function a(d){for(var g={},y=d,w=2,v=4;v<=y;){for(;y%w===0;)y/=w,g[w]=(g[w]||0)+1;v+=1+2*w++}return y!==d?y>1&&(g[y]=(g[y]||0)+1):g[d]=(g[d]||0)+1,g}var o=function(d,g){var y=0,w=1,v=1,x=0,_=0,b=0,D=1,C=1,A=0,E=1,F=1,I=1,O=1e7,k;if(d!=null)if(g!==void 0){if(y=d,w=g,v=y*w,y%1!==0||w%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)y=d.n,w=d.d,"s"in d&&(y*=d.s);else if(0 in d)y=d[0],1 in d&&(w=d[1]);else throw m();v=y*w;break}case"number":{if(d<0&&(v=d,d=-d),d%1===0)y=d;else if(d>0){for(d>=1&&(C=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=C);E<=O&&I<=O;)if(k=(A+F)/(E+I),d===k){E+I<=O?(y=A+F,w=E+I):I>E?(y=F,w=I):(y=A,w=E);break}else d>k?(A+=F,E+=I):(F+=A,I+=E),E>O?(y=F,w=I):(y=A,w=E);y*=C}else(isNaN(d)||isNaN(g))&&(w=y=NaN);break}case"string":{if(E=d.match(/\d+|./g),E===null)throw m();if(E[A]==="-"?(v=-1,A++):E[A]==="+"&&A++,E.length===A+1?_=r(E[A++],v):E[A+1]==="."||E[A]==="."?(E[A]!=="."&&(x=r(E[A++],v)),A++,(A+1===E.length||E[A+1]==="("&&E[A+3]===")"||E[A+1]==="'"&&E[A+3]==="'")&&(_=r(E[A],v),D=Math.pow(10,E[A].length),A++),(E[A]==="("&&E[A+2]===")"||E[A]==="'"&&E[A+2]==="'")&&(b=r(E[A+1],v),C=Math.pow(10,E[A+1].length)-1,A+=3)):E[A+1]==="/"||E[A+1]===":"?(_=r(E[A],v),D=r(E[A+2],1),A+=3):E[A+3]==="/"&&E[A+1]===" "&&(x=r(E[A],v),_=r(E[A+2],v),D=r(E[A+4],1),A+=5),E.length<=A){w=D*C,v=y=b+w*x+C*_;break}}default:throw m()}if(w===0)throw p();t.s=v<0?-1:1,t.n=Math.abs(y),t.d=Math.abs(w)};function l(d,g,y){for(var w=1;g>0;d=d*d%y,g>>=1)g&1&&(w=w*d%y);return w}function u(d,g){for(;g%2===0;g/=2);for(;g%5===0;g/=5);if(g===1)return 0;for(var y=10%g,w=1;y!==1;w++)if(y=y*10%g,w>e)return 0;return w}function s(d,g,y){for(var w=1,v=l(10,y,g),x=0;x<300;x++){if(w===v)return x;w=w*10%g,v=v*10%g}return 0}function c(d,g){if(!d)return g;if(!g)return d;for(;;){if(d%=g,!d)return g;if(g%=d,!g)return d}}function f(d,g){if(o(d,g),this instanceof f)d=c(t.d,t.n),this.s=t.s,this.n=t.n/d,this.d=t.d/d;else return i(t.s*t.n,t.d)}var p=function(){return new Error("Division by Zero")},m=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(d,g){return o(d,g),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(d,g){return o(d,g),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(d,g){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(d===void 0)return i(this.s*this.n%this.d,1);if(o(d,g),t.n===0&&this.d===0)throw p();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(d,g){return o(d,g),i(c(t.n,this.n)*c(t.d,this.d),t.d*this.d)},lcm:function(d,g){return o(d,g),t.n===0&&this.n===0?i(0,1):i(t.n*this.n,c(t.n,this.n)*c(t.d,this.d))},ceil:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(d*this.s*this.n/this.d),d)},floor:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(d*this.s*this.n/this.d),d)},round:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(d*this.s*this.n/this.d),d)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(d,g){if(o(d,g),t.d===1)return t.s<0?i(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):i(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var y=a(this.n),w=a(this.d),v=1,x=1;for(var _ in y)if(_!=="1"){if(_==="0"){v=0;break}if(y[_]*=t.n,y[_]%t.d===0)y[_]/=t.d;else return null;v*=Math.pow(_,y[_])}for(var _ in w)if(_!=="1"){if(w[_]*=t.n,w[_]%t.d===0)w[_]/=t.d;else return null;x*=Math.pow(_,w[_])}return t.s<0?i(x,v):i(v,x)},equals:function(d,g){return o(d,g),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(d,g){o(d,g);var y=this.s*this.n*t.d-t.s*t.n*this.d;return(0=0;x--)v=v.inverse().add(y[x]);if(Math.abs(v.sub(g).valueOf())0&&(y+=g,y+=" ",w%=v),y+=w,y+="/",y+=v),y},toLatex:function(d){var g,y="",w=this.n,v=this.d;return this.s<0&&(y+="-"),v===1?y+=w:(d&&(g=Math.floor(w/v))>0&&(y+=g,w%=v),y+="\\frac{",y+=w,y+="}{",y+=v,y+="}"),y},toContinued:function(){var d,g=this.n,y=this.d,w=[];if(isNaN(g)||isNaN(y))return w;do w.push(Math.floor(g/y)),d=g%y,g=y,y=d;while(g!==1);return w},toString:function(d){var g=this.n,y=this.d;if(isNaN(g)||isNaN(y))return"NaN";d=d||15;var w=u(g,y),v=s(g,y,w),x=this.s<0?"-":"";if(x+=g/y|0,g%=y,g*=10,g&&(x+="."),w){for(var _=v;_--;)x+=g/y|0,g%=y,g*=10;x+="(";for(var _=w;_--;)x+=g/y|0,g%=y,g*=10;x+=")"}else for(var _=d;g&&_--;)x+=g/y|0,g%=y,g*=10;return x}},typeof Fh=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,EC.exports=f):n.Fraction=f})(Fh)});var qN=kr((Txe,UN)=>{UN.exports=function n(e,t){"use strict";var r=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,l=/^0/,u=function(v){return n.insensitive&&(""+v).toLowerCase()||""+v},s=u(e).replace(i,"")||"",c=u(t).replace(i,"")||"",f=s.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=c.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(s.match(o),16)||f.length!==1&&s.match(a)&&Date.parse(s),h=parseInt(c.match(o),16)||m&&c.match(a)&&Date.parse(c)||null,d,g;if(h){if(mh)return 1}for(var y=0,w=Math.max(f.length,p.length);yg)return 1}return 0}});var HM=kr((jAe,$M)=>{"use strict";var nx=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,r=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?EG:i,o=String(n),l="",u=a(nx({},AG),r?nx({},DG):{}),s=Object.keys(u),c=function(){var p=!1;s.forEach(function(m,h){p||o.length>=m.length&&o.slice(0,m.length)===m&&(l+=u[s[h]],o=o.slice(m.length,o.length),p=!0)}),p||(l+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return l}});var bO=kr((xO,ib)=>{(function(n,e,t){function r(l){var u=this,s=o();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=s(" "),u.s1=s(" "),u.s2=s(" "),u.s0-=s(l),u.s0<0&&(u.s0+=1),u.s1-=s(l),u.s1<0&&(u.s1+=1),u.s2-=s(l),u.s2<0&&(u.s2+=1),s=null}function i(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function a(l,u){var s=new r(l),c=u&&u.state,f=s.next;return f.int32=function(){return s.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,s),f.state=function(){return i(s,{})}),f}function o(){var l=4022871197,u=function(s){s=String(s);for(var c=0;c>>0,f-=l,f*=l,l=f>>>0,f-=l,l+=f*4294967296}return(l>>>0)*23283064365386963e-26};return u}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.alea=a})(xO,typeof ib=="object"&&ib,typeof define=="function"&&define)});var _O=kr((wO,ab)=>{(function(n,e,t){function r(o){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var c=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^c^c>>>8},o===(o|0)?l.x=o:u+=o;for(var s=0;s>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor128=a})(wO,typeof ab=="object"&&ab,typeof define=="function"&&define)});var DO=kr((AO,ob)=>{(function(n,e,t){function r(o){var l=this,u="";l.next=function(){var c=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(c^c<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,o===(o|0)?l.x=o:u+=o;for(var s=0;s>>4),l.next()}function i(o,l){return l.x=o.x,l.y=o.y,l.z=o.z,l.w=o.w,l.v=o.v,l.d=o.d,l}function a(o,l){var u=new r(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorwow=a})(AO,typeof ob=="object"&&ob,typeof define=="function"&&define)});var CO=kr((EO,sb)=>{(function(n,e,t){function r(o){var l=this;l.next=function(){var s=l.x,c=l.i,f,p,m;return f=s[c],f^=f>>>7,p=f^f<<24,f=s[c+1&7],p^=f^f>>>10,f=s[c+3&7],p^=f^f>>>3,f=s[c+4&7],p^=f^f<<7,f=s[c+7&7],f=f^f<<13,p^=f^f<<9,s[c]=p,l.i=c+1&7,p};function u(s,c){var f,p,m=[];if(c===(c|0))p=m[0]=c;else for(c=""+c,f=0;f0;--f)s.next()}u(l,o)}function i(o,l){return l.x=o.x.slice(),l.i=o.i,l}function a(o,l){o==null&&(o=+new Date);var u=new r(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(s.x&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorshift7=a})(EO,typeof sb=="object"&&sb,typeof define=="function"&&define)});var NO=kr((SO,ub)=>{(function(n,e,t){function r(o){var l=this;l.next=function(){var s=l.w,c=l.X,f=l.i,p,m;return l.w=s=s+1640531527|0,m=c[f+34&127],p=c[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=c[f]=m^p,l.i=f,m+(s^s>>>16)|0};function u(s,c){var f,p,m,h,d,g=[],y=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,y=Math.max(y,c.length)),m=0,h=-32;h>>15,p^=p<<4,p^=p>>>13,h>=0&&(d=d+1640531527|0,f=g[h&127]^=p+d,m=f==0?m+1:0);for(m>=128&&(g[(c&&c.length||0)&127]=-1),m=127,h=4*128;h>0;--h)p=g[m+34&127],f=g[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,g[m]=p^f;s.w=d,s.X=g,s.i=m}u(l,o)}function i(o,l){return l.i=o.i,l.w=o.w,l.X=o.X.slice(),l}function a(o,l){o==null&&(o=+new Date);var u=new r(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(s.X&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor4096=a})(SO,typeof ub=="object"&&ub,typeof define=="function"&&define)});var TO=kr((MO,lb)=>{(function(n,e,t){function r(o){var l=this,u="";l.next=function(){var c=l.b,f=l.c,p=l.d,m=l.a;return c=c<<25^c>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-c|0,l.b=c=c<<20^c>>>12^f,l.c=f=f-p|0,l.d=p<<16^f>>>16^m,l.a=m-c|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,o===Math.floor(o)?(l.a=o/4294967296|0,l.b=o|0):u+=o;for(var s=0;s>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.tychei=a})(MO,typeof lb=="object"&&lb,typeof define=="function"&&define)});var IO=kr((FO,Fp)=>{(function(n,e,t){var r=256,i=6,a=52,o="random",l=t.pow(r,i),u=t.pow(2,a),s=u*2,c=r-1,f;function p(v,x,_){var b=[];x=x==!0?{entropy:!0}:x||{};var D=g(d(x.entropy?[v,w(e)]:v==null?y():v,3),b),C=new m(b),A=function(){for(var E=C.g(i),F=l,I=0;E=s;)E/=2,F/=2,I>>>=1;return(E+I)/F};return A.int32=function(){return C.g(4)|0},A.quick=function(){return C.g(4)/4294967296},A.double=A,g(w(C.S),e),(x.pass||_||function(E,F,I,O){return O&&(O.S&&h(O,C),E.state=function(){return h(C,{})}),I?(t[o]=E,F):E})(A,D,"global"in x?x.global:this==t,x.state)}function m(v){var x,_=v.length,b=this,D=0,C=b.i=b.j=0,A=b.S=[];for(_||(v=[_++]);D{var zW=bO(),$W=_O(),HW=DO(),GW=CO(),WW=NO(),jW=TO(),jo=IO();jo.alea=zW;jo.xor128=$W;jo.xorwow=HW;jo.xorshift7=GW;jo.xor4096=WW;jo.tychei=jW;BO.exports=jo});var PJ={};T5(PJ,{MetaBindBuild:()=>sd,default:()=>Rm});module.exports=F5(PJ);var km=require("obsidian");var en=require("obsidian");var I_=["January","February","March","April","May","June","July","August","September","October","November","December"],po=[{index:0,name:"Sunday",shortName:"Su"},{index:1,name:"Monday",shortName:"Mo"},{index:2,name:"Tuesday",shortName:"Tu"},{index:3,name:"Wednesday",shortName:"We"},{index:4,name:"Thursday",shortName:"Th"},{index:5,name:"Friday",shortName:"Fr"},{index:6,name:"Saturday",shortName:"Sa"}],Ai={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",useUsDateInputOrder:!1,firstWeekday:po[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,inputFieldTemplates:[],excludedFolders:["templates"],inputTemplates:void 0};var AA=require("obsidian");function Se(){}function I5(n,e){for(let t in e)n[t]=e[t];return n}function Lm(n){return n()}function ql(){return Object.create(null)}function at(n){n.forEach(Lm)}function zl(n){return typeof n=="function"}function Ue(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}var Ul;function rs(n,e){return n===e?!0:(Ul||(Ul=document.createElement("a")),Ul.href=e,n===Ul.href)}function B_(n){return Object.keys(n).length===0}function Qi(n,e,t,r){if(n){let i=O_(n,e,t,r);return n[0](i)}}function O_(n,e,t,r){return n[1]&&r?I5(t.ctx.slice(),n[1](r(e))):t.ctx}function Ki(n,e,t,r){if(n[2]&&r){let i=n[2](r(t));if(e.dirty===void 0)return i;if(typeof i=="object"){let a=[],o=Math.max(e.dirty.length,i.length);for(let l=0;l32){let e=[],t=n.ctx.length/32;for(let r=0;r{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var r;for(let i of t)n.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};$l.entries="WeakMap"in vu?new WeakMap:void 0;var P_=!1;function R_(){P_=!0}function k_(){P_=!1}function z(n,e){n.appendChild(e)}function jr(n,e,t){let r=L_(n);if(!r.getElementById(e)){let i=j("style");i.id=e,i.textContent=t,P5(r,i)}}function L_(n){if(!n)return document;let e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function P5(n,e){return z(n.head||n,e),e.sheet}function Y(n,e,t){n.insertBefore(e,t||null)}function J(n){n.parentNode&&n.parentNode.removeChild(n)}function Ct(n,e){for(let t=0;tn.removeEventListener(e,t,r)}function L(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function ai(n){return n===""?null:+n}function V_(n){return Array.from(n.childNodes)}function rt(n,e){e=""+e,n.data!==e&&(n.data=e)}function Xe(n,e){n.value=e==null?"":e}function ns(n,e,t,r){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,r?"important":"")}function Cr(n,e,t){for(let r=0;r{e[t.slot||"default"]=!0}),e}var Ma;function ra(n){Ma=n}function Gl(){if(!Ma)throw new Error("Function called outside component initialization");return Ma}function Kr(n){Gl().$$.on_mount.push(n)}function mo(n){Gl().$$.on_destroy.push(n)}function yu(){let n=Gl();return(e,t,{cancelable:r=!1}={})=>{let i=n.$$.callbacks[e];if(i){let a=Hl(e,t,{cancelable:r});return i.slice().forEach(o=>{o.call(n,a)}),!a.defaultPrevented}return!0}}function q_(n,e){let t=n.$$.callbacks[e.type];t&&t.slice().forEach(r=>r.call(this,e))}var ho=[];var Fr=[],as=[],Um=[],q5=Promise.resolve(),qm=!1;function z_(){qm||(qm=!0,q5.then(Wl))}function Zr(n){as.push(n)}function go(n){Um.push(n)}var Vm=new Set,is=0;function Wl(){if(is!==0)return;let n=Ma;do{try{for(;isn.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),as=e}var jl=new Set,vo;function gt(){vo={r:0,c:[],p:vo}}function vt(){vo.r||at(vo.c),vo=vo.p}function te(n,e){n&&n.i&&(jl.delete(n),n.i(e))}function ae(n,e,t,r){if(n&&n.o){if(jl.has(n))return;jl.add(n),vo.c.push(()=>{jl.delete(n),r&&(t&&n.d(1),r())}),n.o(e)}else r&&r()}function We(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function H_(n,e){n.d(1),e.delete(n.key)}function Zl(n,e){ae(n,1,1,()=>{e.delete(n.key)})}function os(n,e,t,r,i,a,o,l,u,s,c,f){let p=n.length,m=a.length,h=p,d={};for(;h--;)d[n[h].key]=h;let g=[],y=new Map,w=new Map,v=[];for(h=m;h--;){let D=f(i,a,h),C=t(D),A=o.get(C);A?r&&v.push(()=>A.p(D,e)):(A=s(C,D),A.c()),y.set(C,g[h]=A),C in d&&w.set(C,Math.abs(h-d[C]))}let x=new Set,_=new Set;function b(D){te(D,1),D.m(l,c),o.set(D.key,D),c=D.first,m--}for(;p&&m;){let D=g[m-1],C=n[p-1],A=D.key,E=C.key;D===C?(c=D.first,p--,m--):y.has(E)?!o.has(A)||x.has(A)?b(D):_.has(E)?p--:w.get(A)>w.get(E)?(_.add(A),b(D)):(x.add(E),p--):(u(C,o),p--)}for(;p--;){let D=n[p];y.has(D.key)||u(D,o)}for(;m;)b(g[m-1]);return at(v),g}var $5=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],H5=new Set([...$5]);function yo(n,e,t){let r=n.$$.props[e];r!==void 0&&(n.$$.bound[r]=t,t(n.$$.ctx[r]))}function Fe(n){n&&n.c()}function Me(n,e,t){let{fragment:r,after_update:i}=n.$$;r&&r.m(e,t),Zr(()=>{let a=n.$$.on_mount.map(Lm).filter(zl);n.$$.on_destroy?n.$$.on_destroy.push(...a):at(a),n.$$.on_mount=[]}),i.forEach(Zr)}function Te(n,e){let t=n.$$;t.fragment!==null&&($_(t.after_update),at(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function W5(n,e){n.$$.dirty[0]===-1&&(ho.push(n),z_(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{let h=m.length?m[0]:p;return s.ctx&&i(s.ctx[f],s.ctx[f]=h)&&(!s.skip_bound&&s.bound[f]&&s.bound[f](h),c&&W5(n,f)),p}):[],s.update(),c=!0,at(s.before_update),s.fragment=r?r(s.ctx):!1,e.target){if(e.hydrate){R_();let f=V_(e.target);s.fragment&&s.fragment.l(f),f.forEach(J)}else s.fragment&&s.fragment.c();e.intro&&te(n.$$.fragment),Me(n,e.target,e.anchor),k_(),Wl()}ra(u)}var j5;typeof HTMLElement=="function"&&(j5=class extends HTMLElement{constructor(e,t,r){super();Wr(this,"$$ctor");Wr(this,"$$s");Wr(this,"$$c");Wr(this,"$$cn",!1);Wr(this,"$$d",{});Wr(this,"$$r",!1);Wr(this,"$$p_d",{});Wr(this,"$$l",{});Wr(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let o;return{c:function(){o=j("slot"),a!=="default"&&L(o,"name",a)},m:function(s,c){Y(s,o,c)},d:function(s){s&&J(o)}}}};if(await Promise.resolve(),!this.$$cn)return;let t={},r=U_(this);for(let a of this.$$s)a in r&&(t[a]=[e(a)]);for(let a of this.attributes){let o=this.$$g_p(a.name);o in this.$$d||(this.$$d[o]=zm(o,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let o=zm(a,this.$$d[a],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,o)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let o of this.$$l[a]){let l=this.$$c.$on(a,o);this.$$l_u.set(o,l)}this.$$l={}}}attributeChangedCallback(e,t,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=zm(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function zm(n,e,t,r){var a;let i=(a=t[n])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ve=class{constructor(){Wr(this,"$$");Wr(this,"$$set")}$destroy(){Te(this,1),this.$destroy=Se}$on(e,t){if(!zl(t))return Se;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!B_(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var G_="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(G_);var Lr=class extends Error{constructor(t){super("");this.errorLevel=t.errorLevel,this.effect=t.effect,this.cause=t.cause,this.tip=t.tip,this.docs=t.docs,this.context=t.context,this.positionContext=t.positionContext,this.updateMessage()}updateMessage(){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}"`}log(){console.log(this.message,this.stack,this.context)}},ln=class extends Lr{getErrorType(){return"MB_INTERNAL"}},na=class extends Lr{getErrorType(){return"MB_PARSING"}},xu=class extends Lr{getErrorType(){return"MB_VALIDATION"}},xo=class extends Lr{getErrorType(){return"MB_BIND_TARGET"}};var sr=class extends Lr{getErrorType(){return"MB_ARGUMENT"}},bo=class extends Lr{getErrorType(){return"MB_JS"}},ia=class extends Lr{getErrorType(){return"MB_EXPRESSION"}};var bu=class extends Lr{getErrorType(){return"MB_EXAMPLE"}},ss=class extends Lr{getErrorType(){return"MB_EMBED"}},Jl=class extends Lr{getErrorType(){return"MB_BUTTON"}};function W_(n,e,t){let r=n.slice();return r[1]=e[t],r}function Z5(n){let e,t,r,i=n[0].stack+"",a;return{c(){e=j("div"),t=j("pre"),r=j("code"),a=Pe(i),L(r,"class","language-none mb-none"),L(t,"class","mb-pre"),L(e,"class","mb-card")},m(o,l){Y(o,e,l),z(e,t),z(t,r),z(r,a)},p(o,l){l&1&&i!==(i=o[0].stack+"")&&rt(a,i)},d(o){o&&J(e)}}}function J5(n){let e,t,r,i=n[0].errorLevel+"",a,o,l=n[0].getErrorType()+"",u,s,c,f,p=n[0].effect+"",m,h,d,g,y,w,v,x,_,b=n[0].cause+"",D,C,A,E,F,I,O=n[0].effect+"",k,R,T,N,V=n[0].positionContext&&j_(n),B=n[0].tip&&Z_(n),X=n[0].docs&&J_(n),ee=n[0].context&&X_(n);return{c(){e=j("div"),t=j("h6"),r=j("span"),a=Pe(i),o=Pe(` [`),u=Pe(l),s=Pe("]"),f=Pe(` - `),m=Pe(p),h=fe(),V&&V.c(),d=fe(),g=j("table"),y=j("tbody"),w=j("tr"),v=j("td"),v.textContent="Cause",x=fe(),_=j("td"),D=Pe(b),C=fe(),A=j("tr"),E=j("td"),E.textContent="Effect",F=fe(),I=j("td"),k=Pe(O),R=fe(),B&&B.c(),T=fe(),X&&X.c(),N=fe(),ee&&ee.c(),L(r,"class",c=n[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),L(e,"class","mb-card mb-card-full-width markdown-rendered")},m(W,P){Y(W,e,P),z(e,t),z(t,r),z(r,a),z(r,o),z(r,u),z(r,s),z(t,f),z(t,m),z(e,h),V&&V.m(e,null),z(e,d),z(e,g),z(g,y),z(y,w),z(w,v),z(w,x),z(w,_),z(_,D),z(y,C),z(y,A),z(A,E),z(A,F),z(A,I),z(I,k),z(y,R),B&&B.m(y,null),z(y,T),X&&X.m(y,null),z(y,N),ee&&ee.m(y,null)},p(W,P){P&1&&i!==(i=W[0].errorLevel+"")&&rt(a,i),P&1&&l!==(l=W[0].getErrorType()+"")&&rt(u,l),P&1&&c!==(c=W[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")&&L(r,"class",c),P&1&&p!==(p=W[0].effect+"")&&rt(m,p),W[0].positionContext?V?V.p(W,P):(V=j_(W),V.c(),V.m(e,d)):V&&(V.d(1),V=null),P&1&&b!==(b=W[0].cause+"")&&rt(D,b),P&1&&O!==(O=W[0].effect+"")&&rt(k,O),W[0].tip?B?B.p(W,P):(B=Z_(W),B.c(),B.m(y,T)):B&&(B.d(1),B=null),W[0].docs?X?X.p(W,P):(X=J_(W),X.c(),X.m(y,N)):X&&(X.d(1),X=null),W[0].context?ee?ee.p(W,P):(ee=X_(W),ee.c(),ee.m(y,null)):ee&&(ee.d(1),ee=null)},d(W){W&&J(e),V&&V.d(),B&&B.d(),X&&X.d(),ee&&ee.d()}}}function j_(n){let e,t,r=n[0].positionContext+"",i;return{c(){e=j("pre"),t=j("code"),i=Pe(r),L(t,"class","language-none mb-none"),L(e,"class","mb-pre")},m(a,o){Y(a,e,o),z(e,t),z(t,i)},p(a,o){o&1&&r!==(r=a[0].positionContext+"")&&rt(i,r)},d(a){a&&J(e)}}}function Z_(n){let e,t,r,i,a=n[0].tip+"",o;return{c(){e=j("tr"),t=j("td"),t.textContent="Tip",r=fe(),i=j("td"),o=Pe(a)},m(l,u){Y(l,e,u),z(e,t),z(e,r),z(e,i),z(i,o)},p(l,u){u&1&&a!==(a=l[0].tip+"")&&rt(o,a)},d(l){l&&J(e)}}}function J_(n){let e,t,r,i,a=We(n[0].docs),o=[];for(let l=0;l{"error"in i&&t(0,r=i.error)},[r]}var $m=class extends Ve{constructor(e){super(),qe(this,e,X5,Y5,Ue,{error:0})}},Hm=$m;function Q_(n,e,t){let r=n.slice();return r[2]=e[t],r}function K_(n,e,t){let r=n.slice();return r[5]=e[t],r}function eA(n){let e,t,r;return{c(){e=j("p"),t=j("code"),r=Pe(n[1]),L(t,"class","language-none meta-bind-none")},m(i,a){Y(i,e,a),z(e,t),z(t,r)},p(i,a){a&2&&rt(r,i[1])},d(i){i&&J(e)}}}function tA(n){let e,t,r,i,a,o,l=We(n[0].getErrors()),u=[];for(let c=0;cae(u[c],1,1,()=>{u[c]=null});return{c(){e=j("h6"),e.textContent="Errors",t=fe(),r=j("p"),r.textContent="Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",i=fe();for(let c=0;cae(u[c],1,1,()=>{u[c]=null});return{c(){e=j("h6"),e.textContent="Warnings",t=fe(),r=j("p"),r.textContent=`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,i=fe();for(let c=0;c{u=null}),vt()),f&1&&(i=c[0].hasWarnings()),i?s?(s.p(c,f),f&1&&te(s,1)):(s=nA(c),s.c(),te(s,1),s.m(a.parentNode,a)):s&&(gt(),ae(s,1,1,()=>{s=null}),vt())},i(c){o||(te(u),te(s),o=!0)},o(c){ae(u),ae(s),o=!1},d(c){c&&(J(e),J(r),J(a)),l&&l.d(c),u&&u.d(c),s&&s.d(c)}}}function K5(n,e,t){let{errorCollection:r}=e,{declaration:i}=e;return n.$$set=a=>{"errorCollection"in a&&t(0,r=a.errorCollection),"declaration"in a&&t(1,i=a.declaration)},[r,i]}var Gm=class extends Ve{constructor(e){super(),qe(this,e,K5,Q5,Ue,{errorCollection:0,declaration:1})}},us=Gm;function e8(n){let e,t,r=n[1].default,i=Qi(r,n,n[0],null);return{c(){e=j("div"),i&&i.c(),L(e,"class","modal-button-container")},m(a,o){Y(a,e,o),i&&i.m(e,null),t=!0},p(a,[o]){i&&i.p&&(!t||o&1)&&ea(i,r,a,a[0],t?Ki(r,a[0],o,null):ta(a[0]),null)},i(a){t||(te(i,a),t=!0)},o(a){ae(i,a),t=!1},d(a){a&&J(e),i&&i.d(a)}}}function t8(n,e,t){let{$$slots:r={},$$scope:i}=e;return n.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,r]}var Wm=class extends Ve{constructor(e){super(),qe(this,e,t8,e8,Ue,{})}},ls=Wm;var Wt;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},n.getValidEnumValues=i=>{let a=n.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(let l of a)o[l]=i[l];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(a){return i[a]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},n.find=(i,a)=>{for(let o of i)if(a(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}n.joinValues=r,n.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Wt||(Wt={}));var Zm;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Zm||(Zm={}));var Je=Wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ta=n=>{switch(typeof n){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return isNaN(n)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(n)?Je.array:n===null?Je.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Je.promise:typeof Map!="undefined"&&n instanceof Map?Je.map:typeof Set!="undefined"&&n instanceof Set?Je.set:typeof Date!="undefined"&&n instanceof Date?Je.date:Je.object;default:return Je.unknown}},$e=Wt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),r8=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),jn=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let l=r,u=0;for(;ut.message){let t={},r=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};jn.create=n=>new jn(n);var wu=(n,e)=>{let t;switch(n.code){case $e.invalid_type:n.received===Je.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case $e.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Wt.jsonStringifyReplacer)}`;break;case $e.unrecognized_keys:t=`Unrecognized key(s) in object: ${Wt.joinValues(n.keys,", ")}`;break;case $e.invalid_union:t="Invalid input";break;case $e.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Wt.joinValues(n.options)}`;break;case $e.invalid_enum_value:t=`Invalid enum value. Expected ${Wt.joinValues(n.options)}, received '${n.received}'`;break;case $e.invalid_arguments:t="Invalid function arguments";break;case $e.invalid_return_type:t="Invalid function return type";break;case $e.invalid_date:t="Invalid date";break;case $e.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Wt.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case $e.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case $e.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case $e.custom:t="Invalid input";break;case $e.invalid_intersection_types:t="Intersection results could not be merged";break;case $e.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case $e.not_finite:t="Number must be finite";break;default:t=e.defaultError,Wt.assertNever(n)}return{message:t}},sA=wu;function n8(n){sA=n}function Xl(){return sA}var Ql=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,a=[...t,...i.path||[]],o={...i,path:a},l="",u=r.filter(s=>!!s).slice().reverse();for(let s of u)l=s(o,{data:e,defaultError:l}).message;return{...i,path:a,message:i.message||l}},i8=[];function Qe(n,e){let t=Ql({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Xl(),wu].filter(r=>!!r)});n.common.issues.push(t)}var cn=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return Nt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t)r.push({key:await i.key,value:await i.value});return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Nt;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value!="undefined"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},Nt=Object.freeze({status:"aborted"}),uA=n=>({status:"dirty",value:n}),An=n=>({status:"valid",value:n}),Jm=n=>n.status==="aborted",Ym=n=>n.status==="dirty",_u=n=>n.status==="valid",Kl=n=>typeof Promise!="undefined"&&n instanceof Promise,ft;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ft||(ft={}));var oi=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},aA=(n,e)=>{if(_u(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new jn(n.common.issues);return this._error=t,this._error}}};function Ft(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,l)=>o.code!=="invalid_type"?{message:l.defaultError}:typeof l.data=="undefined"?{message:r!=null?r:l.defaultError}:{message:t!=null?t:l.defaultError},description:i}}var It=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ta(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ta(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new cn,ctx:{common:e.parent.common,data:e.data,parsedType:Ta(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Kl(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let i={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ta(e)},a=this._parseSync({data:e,path:i.path,parent:i});return aA(i,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ta(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(Kl(i)?i:Promise.resolve(i));return aA(r,a)}refine(e,t){let r=i=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{let o=e(i),l=()=>a.addIssue({code:$e.custom,...r(i)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new Zn({schema:this,typeName:yt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Di.create(this,this._def)}nullable(){return sa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oa.create(this,this._def)}promise(){return Ba.create(this,this._def)}or(e){return So.create([this,e],this._def)}and(e){return No.create(this,e,this._def)}transform(e){return new Zn({...Ft(this._def),schema:this,typeName:yt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Bo({...Ft(this._def),innerType:this,defaultValue:t,typeName:yt.ZodDefault})}brand(){return new nc({typeName:yt.ZodBranded,type:this,...Ft(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new hs({...Ft(this._def),innerType:this,catchValue:t,typeName:yt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Au.create(this,e)}readonly(){return vs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},a8=/^c[^\s-]{8,}$/i,o8=/^[a-z][a-z0-9]*$/,s8=/^[0-9A-HJKMNP-TV-Z]{26}$/,u8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,l8=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",jm,f8=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,p8=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,m8=n=>n.precision?n.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`):n.precision===0?n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function d8(n,e){return!!((e==="v4"||!e)&&f8.test(n)||(e==="v6"||!e)&&p8.test(n))}var Fa=class n extends It{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Je.string){let a=this._getOrReturnCtx(e);return Qe(a,{code:$e.invalid_type,expected:Je.string,received:a.parsedType}),Nt}let r=new cn,i;for(let a of this._def.checks)if(a.kind==="min")e.data.lengtha.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:$e.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,l=e.data.lengthe.test(i),{validation:t,code:$e.invalid_string,...ft.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ft.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ft.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ft.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ft.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ft.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ft.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ft.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ft.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...ft.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ft.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...ft.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ft.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ft.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ft.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ft.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ft.errToObj(t)})}nonempty(e){return this.min(1,ft.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new Fa({checks:[],typeName:yt.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...Ft(n)})};function h8(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,a=parseInt(n.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var wo=class n extends It{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Je.number){let a=this._getOrReturnCtx(e);return Qe(a,{code:$e.invalid_type,expected:Je.number,received:a.parsedType}),Nt}let r,i=new cn;for(let a of this._def.checks)a.kind==="int"?Wt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?h8(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.not_finite,message:a.message}),i.dirty()):Wt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ft.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ft.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ft.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ft.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ft.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ft.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ft.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ft.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ft.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ft.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ft.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ft.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ft.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ft.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&Wt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew wo({checks:[],typeName:yt.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Ft(n)});var _o=class n extends It{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Je.bigint){let a=this._getOrReturnCtx(e);return Qe(a,{code:$e.invalid_type,expected:Je.bigint,received:a.parsedType}),Nt}let r,i=new cn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:$e.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Wt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ft.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ft.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ft.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ft.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ft.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ft.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ft.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ft.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ft.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ft.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new _o({checks:[],typeName:yt.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...Ft(n)})};var Ao=class extends It{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Je.boolean){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.boolean,received:r.parsedType}),Nt}return An(e.data)}};Ao.create=n=>new Ao({typeName:yt.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Ft(n)});var Do=class n extends It{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Je.date){let a=this._getOrReturnCtx(e);return Qe(a,{code:$e.invalid_type,expected:Je.date,received:a.parsedType}),Nt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return Qe(a,{code:$e.invalid_date}),Nt}let r=new cn,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()a.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:$e.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Wt.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ft.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ft.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Do({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:yt.ZodDate,...Ft(n)});var fs=class extends It{_parse(e){if(this._getType(e)!==Je.symbol){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.symbol,received:r.parsedType}),Nt}return An(e.data)}};fs.create=n=>new fs({typeName:yt.ZodSymbol,...Ft(n)});var Eo=class extends It{_parse(e){if(this._getType(e)!==Je.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.undefined,received:r.parsedType}),Nt}return An(e.data)}};Eo.create=n=>new Eo({typeName:yt.ZodUndefined,...Ft(n)});var Co=class extends It{_parse(e){if(this._getType(e)!==Je.null){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.null,received:r.parsedType}),Nt}return An(e.data)}};Co.create=n=>new Co({typeName:yt.ZodNull,...Ft(n)});var Ia=class extends It{constructor(){super(...arguments),this._any=!0}_parse(e){return An(e.data)}};Ia.create=n=>new Ia({typeName:yt.ZodAny,...Ft(n)});var aa=class extends It{constructor(){super(...arguments),this._unknown=!0}_parse(e){return An(e.data)}};aa.create=n=>new aa({typeName:yt.ZodUnknown,...Ft(n)});var Ei=class extends It{_parse(e){let t=this._getOrReturnCtx(e);return Qe(t,{code:$e.invalid_type,expected:Je.never,received:t.parsedType}),Nt}};Ei.create=n=>new Ei({typeName:yt.ZodNever,...Ft(n)});var ps=class extends It{_parse(e){if(this._getType(e)!==Je.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.void,received:r.parsedType}),Nt}return An(e.data)}};ps.create=n=>new ps({typeName:yt.ZodVoid,...Ft(n)});var oa=class n extends It{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Je.array)return Qe(t,{code:$e.invalid_type,expected:Je.array,received:t.parsedType}),Nt;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,l=t.data.lengthi.maxLength.value&&(Qe(t,{code:$e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>i.type._parseAsync(new oi(t,o,t.path,l)))).then(o=>cn.mergeArray(r,o));let a=[...t.data].map((o,l)=>i.type._parseSync(new oi(t,o,t.path,l)));return cn.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:ft.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:ft.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:ft.toString(t)}})}nonempty(e){return this.min(1,e)}};oa.create=(n,e)=>new oa({type:n,minLength:null,maxLength:null,exactLength:null,typeName:yt.ZodArray,...Ft(e)});function cs(n){if(n instanceof In){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=Di.create(cs(r))}return new In({...n._def,shape:()=>e})}else return n instanceof oa?new oa({...n._def,type:cs(n.element)}):n instanceof Di?Di.create(cs(n.unwrap())):n instanceof sa?sa.create(cs(n.unwrap())):n instanceof Li?Li.create(n.items.map(e=>cs(e))):n}var In=class n extends It{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Wt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Je.object){let s=this._getOrReturnCtx(e);return Qe(s,{code:$e.invalid_type,expected:Je.object,received:s.parsedType}),Nt}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(let s in i.data)o.includes(s)||l.push(s);let u=[];for(let s of o){let c=a[s],f=i.data[s];u.push({key:{status:"valid",value:s},value:c._parse(new oi(i,f,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof Ei){let s=this._def.unknownKeys;if(s==="passthrough")for(let c of l)u.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(s==="strict")l.length>0&&(Qe(i,{code:$e.unrecognized_keys,keys:l}),r.dirty());else if(s!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let s=this._def.catchall;for(let c of l){let f=i.data[c];u.push({key:{status:"valid",value:c},value:s._parse(new oi(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let s=[];for(let c of u){let f=await c.key;s.push({key:f,value:await c.value,alwaysSet:c.alwaysSet})}return s}).then(s=>cn.mergeObjectSync(r,s)):cn.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return ft.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,a,o,l;let u=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(l=ft.errToObj(e).message)!==null&&l!==void 0?l:u}:{message:u}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:yt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};return Wt.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}omit(e){let t={};return Wt.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}deepPartial(){return cs(this)}partial(e){let t={};return Wt.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new n({...this._def,shape:()=>t})}required(e){let t={};return Wt.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Di;)a=a._def.innerType;t[r]=a}}),new n({...this._def,shape:()=>t})}keyof(){return lA(Wt.objectKeys(this.shape))}};In.create=(n,e)=>new In({shape:()=>n,unknownKeys:"strip",catchall:Ei.create(),typeName:yt.ZodObject,...Ft(e)});In.strictCreate=(n,e)=>new In({shape:()=>n,unknownKeys:"strict",catchall:Ei.create(),typeName:yt.ZodObject,...Ft(e)});In.lazycreate=(n,e)=>new In({shape:n,unknownKeys:"strip",catchall:Ei.create(),typeName:yt.ZodObject,...Ft(e)});var So=class extends It{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(a){for(let l of a)if(l.result.status==="valid")return l.result;for(let l of a)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let o=a.map(l=>new jn(l.ctx.common.issues));return Qe(t,{code:$e.invalid_union,unionErrors:o}),Nt}if(t.common.async)return Promise.all(r.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let u of r){let s={...t,common:{...t.common,issues:[]},parent:null},c=u._parseSync({data:t.data,path:t.path,parent:s});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:s}),s.common.issues.length&&o.push(s.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let l=o.map(u=>new jn(u));return Qe(t,{code:$e.invalid_union,unionErrors:l}),Nt}}get options(){return this._def.options}};So.create=(n,e)=>new So({options:n,typeName:yt.ZodUnion,...Ft(e)});var Yl=n=>n instanceof Mo?Yl(n.schema):n instanceof Zn?Yl(n.innerType()):n instanceof To?[n.value]:n instanceof Fo?n.options:n instanceof Io?Object.keys(n.enum):n instanceof Bo?Yl(n._def.innerType):n instanceof Eo?[void 0]:n instanceof Co?[null]:null,ec=class n extends It{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Je.object)return Qe(t,{code:$e.invalid_type,expected:Je.object,received:t.parsedType}),Nt;let r=this.discriminator,i=t.data[r],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Qe(t,{code:$e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Nt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let a of t){let o=Yl(a.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of o){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,a)}}return new n({typeName:yt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Ft(r)})}};function Xm(n,e){let t=Ta(n),r=Ta(e);if(n===e)return{valid:!0,data:n};if(t===Je.object&&r===Je.object){let i=Wt.objectKeys(e),a=Wt.objectKeys(n).filter(l=>i.indexOf(l)!==-1),o={...n,...e};for(let l of a){let u=Xm(n[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===Je.array&&r===Je.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let a=0;a{if(Jm(a)||Jm(o))return Nt;let l=Xm(a.value,o.value);return l.valid?((Ym(a)||Ym(o))&&t.dirty(),{status:t.value,value:l.data}):(Qe(r,{code:$e.invalid_intersection_types}),Nt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};No.create=(n,e,t)=>new No({left:n,right:e,typeName:yt.ZodIntersection,...Ft(t)});var Li=class n extends It{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.array)return Qe(r,{code:$e.invalid_type,expected:Je.array,received:r.parsedType}),Nt;if(r.data.lengththis._def.items.length&&(Qe(r,{code:$e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new oi(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>cn.mergeArray(t,o)):cn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};Li.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Li({items:n,typeName:yt.ZodTuple,rest:null,...Ft(e)})};var tc=class n extends It{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.object)return Qe(r,{code:$e.invalid_type,expected:Je.object,received:r.parsedType}),Nt;let i=[],a=this._def.keyType,o=this._def.valueType;for(let l in r.data)i.push({key:a._parse(new oi(r,l,r.path,l)),value:o._parse(new oi(r,r.data[l],r.path,l))});return r.common.async?cn.mergeObjectAsync(t,i):cn.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof It?new n({keyType:e,valueType:t,typeName:yt.ZodRecord,...Ft(r)}):new n({keyType:Fa.create(),valueType:e,typeName:yt.ZodRecord,...Ft(t)})}},ms=class extends It{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.map)return Qe(r,{code:$e.invalid_type,expected:Je.map,received:r.parsedType}),Nt;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,u],s)=>({key:i._parse(new oi(r,l,r.path,[s,"key"])),value:a._parse(new oi(r,u,r.path,[s,"value"]))}));if(r.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of o){let s=await u.key,c=await u.value;if(s.status==="aborted"||c.status==="aborted")return Nt;(s.status==="dirty"||c.status==="dirty")&&t.dirty(),l.set(s.value,c.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let u of o){let s=u.key,c=u.value;if(s.status==="aborted"||c.status==="aborted")return Nt;(s.status==="dirty"||c.status==="dirty")&&t.dirty(),l.set(s.value,c.value)}return{status:t.value,value:l}}}};ms.create=(n,e,t)=>new ms({valueType:e,keyType:n,typeName:yt.ZodMap,...Ft(t)});var ds=class n extends It{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.set)return Qe(r,{code:$e.invalid_type,expected:Je.set,received:r.parsedType}),Nt;let i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Qe(r,{code:$e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let s=new Set;for(let c of u){if(c.status==="aborted")return Nt;c.status==="dirty"&&t.dirty(),s.add(c.value)}return{status:t.value,value:s}}let l=[...r.data.values()].map((u,s)=>a._parse(new oi(r,u,r.path,s)));return r.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new n({...this._def,minSize:{value:e,message:ft.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:ft.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ds.create=(n,e)=>new ds({valueType:n,minSize:null,maxSize:null,typeName:yt.ZodSet,...Ft(e)});var rc=class n extends It{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Je.function)return Qe(t,{code:$e.invalid_type,expected:Je.function,received:t.parsedType}),Nt;function r(l,u){return Ql({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xl(),wu].filter(s=>!!s),issueData:{code:$e.invalid_arguments,argumentsError:u}})}function i(l,u){return Ql({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xl(),wu].filter(s=>!!s),issueData:{code:$e.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ba){let l=this;return An(async function(...u){let s=new jn([]),c=await l._def.args.parseAsync(u,a).catch(m=>{throw s.addIssue(r(u,m)),s}),f=await Reflect.apply(o,this,c);return await l._def.returns._def.type.parseAsync(f,a).catch(m=>{throw s.addIssue(i(f,m)),s})})}else{let l=this;return An(function(...u){let s=l._def.args.safeParse(u,a);if(!s.success)throw new jn([r(u,s.error)]);let c=Reflect.apply(o,this,s.data),f=l._def.returns.safeParse(c,a);if(!f.success)throw new jn([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:Li.create(e).rest(aa.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||Li.create([]).rest(aa.create()),returns:t||aa.create(),typeName:yt.ZodFunction,...Ft(r)})}},Mo=class extends It{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Mo.create=(n,e)=>new Mo({getter:n,typeName:yt.ZodLazy,...Ft(e)});var To=class extends It{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:$e.invalid_literal,expected:this._def.value}),Nt}return{status:"valid",value:e.data}}get value(){return this._def.value}};To.create=(n,e)=>new To({value:n,typeName:yt.ZodLiteral,...Ft(e)});function lA(n,e){return new Fo({values:n,typeName:yt.ZodEnum,...Ft(e)})}var Fo=class n extends It{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{expected:Wt.joinValues(r),received:t.parsedType,code:$e.invalid_type}),Nt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{received:t.data,code:$e.invalid_enum_value,options:r}),Nt}return An(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return n.create(e)}exclude(e){return n.create(this.options.filter(t=>!e.includes(t)))}};Fo.create=lA;var Io=class extends It{_parse(e){let t=Wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Je.string&&r.parsedType!==Je.number){let i=Wt.objectValues(t);return Qe(r,{expected:Wt.joinValues(i),received:r.parsedType,code:$e.invalid_type}),Nt}if(t.indexOf(e.data)===-1){let i=Wt.objectValues(t);return Qe(r,{received:r.data,code:$e.invalid_enum_value,options:i}),Nt}return An(e.data)}get enum(){return this._def.values}};Io.create=(n,e)=>new Io({values:n,typeName:yt.ZodNativeEnum,...Ft(e)});var Ba=class extends It{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Je.promise&&t.common.async===!1)return Qe(t,{code:$e.invalid_type,expected:Je.promise,received:t.parsedType}),Nt;let r=t.parsedType===Je.promise?t.data:Promise.resolve(t.data);return An(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ba.create=(n,e)=>new Ba({type:n,typeName:yt.ZodPromise,...Ft(e)});var Zn=class extends It{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===yt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{Qe(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(o).then(l=>this._def.schema._parseAsync({data:l,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}if(i.type==="refinement"){let o=l=>{let u=i.refinement(l,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){let l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?Nt:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?Nt:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_u(o))return o;let l=i.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>_u(o)?Promise.resolve(i.transform(o.value,a)).then(l=>({status:t.value,value:l})):o);Wt.assertNever(i)}};Zn.create=(n,e,t)=>new Zn({schema:n,typeName:yt.ZodEffects,effect:e,...Ft(t)});Zn.createWithPreprocess=(n,e,t)=>new Zn({schema:e,effect:{type:"preprocess",transform:n},typeName:yt.ZodEffects,...Ft(t)});var Di=class extends It{_parse(e){return this._getType(e)===Je.undefined?An(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Di.create=(n,e)=>new Di({innerType:n,typeName:yt.ZodOptional,...Ft(e)});var sa=class extends It{_parse(e){return this._getType(e)===Je.null?An(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};sa.create=(n,e)=>new sa({innerType:n,typeName:yt.ZodNullable,...Ft(e)});var Bo=class extends It{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===Je.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Bo.create=(n,e)=>new Bo({innerType:n,typeName:yt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ft(e)});var hs=class extends It{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kl(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new jn(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};hs.create=(n,e)=>new hs({innerType:n,typeName:yt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ft(e)});var gs=class extends It{_parse(e){if(this._getType(e)!==Je.nan){let r=this._getOrReturnCtx(e);return Qe(r,{code:$e.invalid_type,expected:Je.nan,received:r.parsedType}),Nt}return{status:"valid",value:e.data}}};gs.create=n=>new gs({typeName:yt.ZodNaN,...Ft(n)});var g8=Symbol("zod_brand"),nc=class extends It{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Au=class n extends It{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Nt:a.status==="dirty"?(t.dirty(),uA(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Nt:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:yt.ZodPipeline})}},vs=class extends It{_parse(e){let t=this._def.innerType._parse(e);return _u(t)&&(t.value=Object.freeze(t.value)),t}};vs.create=(n,e)=>new vs({innerType:n,typeName:yt.ZodReadonly,...Ft(e)});var cA=(n,e={},t)=>n?Ia.create().superRefine((r,i)=>{var a,o;if(!n(r)){let l=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(o=(a=l.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0,s=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...s,fatal:u})}}):Ia.create(),v8={object:In.lazycreate},yt;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(yt||(yt={}));var y8=(n,e={message:`Input not instance of ${n.name}`})=>cA(t=>t instanceof n,e),fA=Fa.create,pA=wo.create,x8=gs.create,b8=_o.create,mA=Ao.create,w8=Do.create,_8=fs.create,A8=Eo.create,D8=Co.create,E8=Ia.create,C8=aa.create,S8=Ei.create,N8=ps.create,M8=oa.create,T8=In.create,F8=In.strictCreate,I8=So.create,B8=ec.create,O8=No.create,P8=Li.create,R8=tc.create,k8=ms.create,L8=ds.create,V8=rc.create,U8=Mo.create,q8=To.create,z8=Fo.create,$8=Io.create,H8=Ba.create,oA=Zn.create,G8=Di.create,W8=sa.create,j8=Zn.createWithPreprocess,Z8=Au.create,J8=()=>fA().optional(),Y8=()=>pA().optional(),X8=()=>mA().optional(),Q8={string:n=>Fa.create({...n,coerce:!0}),number:n=>wo.create({...n,coerce:!0}),boolean:n=>Ao.create({...n,coerce:!0}),bigint:n=>_o.create({...n,coerce:!0}),date:n=>Do.create({...n,coerce:!0})},K8=Nt,er=Object.freeze({__proto__:null,defaultErrorMap:wu,setErrorMap:n8,getErrorMap:Xl,makeIssue:Ql,EMPTY_PATH:i8,addIssueToContext:Qe,ParseStatus:cn,INVALID:Nt,DIRTY:uA,OK:An,isAborted:Jm,isDirty:Ym,isValid:_u,isAsync:Kl,get util(){return Wt},get objectUtil(){return Zm},ZodParsedType:Je,getParsedType:Ta,ZodType:It,ZodString:Fa,ZodNumber:wo,ZodBigInt:_o,ZodBoolean:Ao,ZodDate:Do,ZodSymbol:fs,ZodUndefined:Eo,ZodNull:Co,ZodAny:Ia,ZodUnknown:aa,ZodNever:Ei,ZodVoid:ps,ZodArray:oa,ZodObject:In,ZodUnion:So,ZodDiscriminatedUnion:ec,ZodIntersection:No,ZodTuple:Li,ZodRecord:tc,ZodMap:ms,ZodSet:ds,ZodFunction:rc,ZodLazy:Mo,ZodLiteral:To,ZodEnum:Fo,ZodNativeEnum:Io,ZodPromise:Ba,ZodEffects:Zn,ZodTransformer:Zn,ZodOptional:Di,ZodNullable:sa,ZodDefault:Bo,ZodCatch:hs,ZodNaN:gs,BRAND:g8,ZodBranded:nc,ZodPipeline:Au,ZodReadonly:vs,custom:cA,Schema:It,ZodSchema:It,late:v8,get ZodFirstPartyTypeKind(){return yt},coerce:Q8,any:E8,array:M8,bigint:b8,boolean:mA,date:w8,discriminatedUnion:B8,effect:oA,enum:z8,function:V8,instanceof:y8,intersection:O8,lazy:U8,literal:q8,map:k8,nan:x8,nativeEnum:$8,never:S8,null:D8,nullable:W8,number:pA,object:T8,oboolean:X8,onumber:Y8,optional:G8,ostring:J8,pipeline:Z8,preprocess:j8,promise:H8,record:R8,set:L8,strictObject:F8,string:fA,symbol:_8,transformer:oA,tuple:P8,undefined:A8,union:I8,unknown:C8,void:N8,NEVER:K8,ZodIssueCode:$e,quotelessJson:r8,ZodError:jn});function dA(n,e){return(t,r)=>t[n]===void 0==(t[e]===void 0)?(r.addIssue({code:er.ZodIssueCode.custom,message:`Either ${n} or ${e} must be filled, but not both`}),!1):!0}function ua(){return function(n){return n}}var Oa=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(Oa||{}),Du=(o=>(o.COMMAND="command",o.JS="js",o.OPEN="open",o.INPUT="input",o.SLEEP="sleep",o.TEMPLATER_CREATE_NOTE="templaterCreateNote",o))(Du||{}),e6=ua()(er.object({type:er.literal("command"),command:er.string()})),t6=ua()(er.object({type:er.literal("js"),file:er.string()})),r6=ua()(er.object({type:er.literal("open"),link:er.string()})),n6=ua()(er.object({type:er.literal("input"),str:er.string()})),i6=ua()(er.object({type:er.literal("sleep"),ms:er.number()})),a6=ua()(er.object({type:er.literal("templaterCreateNote"),templateFile:er.string(),folderPath:er.string().optional(),fileName:er.string().optional(),openNote:er.boolean().optional()})),hA=ua()(er.union([e6,t6,r6,n6,i6,a6])),o6=er.enum(Object.values(Oa)),gA=ua()(er.object({label:er.string(),style:o6,id:er.string().optional(),hidden:er.boolean().optional(),action:hA.optional(),actions:hA.array().optional()}).superRefine(dA("action","actions")));function s6(n){jr(n,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function u6(n){let e,t,r,i,a=n[4].default,o=Qi(a,n,n[3],null);return{c(){e=j("button"),o&&o.c(),L(e,"aria-label",n[2]),e.disabled=n[1],L(e,"class","svelte-12xcpmj"),_t(e,"mod-cta",n[0]==="primary"),_t(e,"mod-warning",n[0]==="destructive"),_t(e,"mod-plain",n[0]==="plain"),_t(e,"disabled",n[1])},m(l,u){Y(l,e,u),o&&o.m(e,null),t=!0,r||(i=be(e,"click",n[5]),r=!0)},p(l,[u]){o&&o.p&&(!t||u&8)&&ea(o,a,l,l[3],t?Ki(a,l[3],u,null):ta(l[3]),null),(!t||u&4)&&L(e,"aria-label",l[2]),(!t||u&2)&&(e.disabled=l[1]),(!t||u&1)&&_t(e,"mod-cta",l[0]==="primary"),(!t||u&1)&&_t(e,"mod-warning",l[0]==="destructive"),(!t||u&1)&&_t(e,"mod-plain",l[0]==="plain"),(!t||u&2)&&_t(e,"disabled",l[1])},i(l){t||(te(o,l),t=!0)},o(l){ae(o,l),t=!1},d(l){l&&J(e),o&&o.d(l),r=!1,i()}}}function l6(n,e,t){let{$$slots:r={},$$scope:i}=e,{variant:a="default"}=e,{disabled:o=!1}=e,{tooltip:l=""}=e;function u(s){q_.call(this,n,s)}return n.$$set=s=>{"variant"in s&&t(0,a=s.variant),"disabled"in s&&t(1,o=s.disabled),"tooltip"in s&&t(2,l=s.tooltip),"$$scope"in s&&t(3,i=s.$$scope)},[a,o,l,i,r,u]}var Qm=class extends Ve{constructor(e){super(),qe(this,e,l6,u6,Ue,{variant:0,disabled:1,tooltip:2},s6)}},Ut=Qm;var yA=require("obsidian");function vA(n){let e;return{c(){e=j("div"),L(e,"class","mb-icon-wrapper")},m(t,r){Y(t,e,r),n[2](e)},p:Se,d(t){t&&J(e),n[2](null)}}}function c6(n){let e,t=n[0].length>0&&vA(n);return{c(){t&&t.c(),e=or()},m(r,i){t&&t.m(r,i),Y(r,e,i)},p(r,[i]){r[0].length>0?t?t.p(r,i):(t=vA(r),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Se,o:Se,d(r){r&&J(e),t&&t.d(r)}}}function f6(n,e,t){let{iconName:r=""}=e,i;Kr(()=>{(0,yA.setIcon)(i,r)});function a(o){Fr[o?"unshift":"push"](()=>{i=o,t(1,i)})}return n.$$set=o=>{"iconName"in o&&t(0,r=o.iconName)},[r,i,a]}var Km=class extends Ve{constructor(e){super(),qe(this,e,f6,c6,Ue,{iconName:0})}},ur=Km;function xA(n,e,t){let r=n.slice();return r[12]=e[t],r[13]=e,r[14]=t,r}function p6(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function bA(n){let e,t,r,i,a,o,l,u,s,c;function f(){n[7].call(r,n[13],n[14])}function p(){return n[8](n[12])}return o=new Ut({props:{tooltip:"Delete",$$slots:{default:[p6]},$$scope:{ctx:n}}}),o.$on("click",p),{c(){e=j("tr"),t=j("td"),r=j("input"),i=fe(),a=j("td"),Fe(o.$$.fragment),l=fe(),L(r,"type","text"),L(r,"placeholder","path/to/folder"),ns(r,"width","100%"),ns(t,"width","100%")},m(m,h){Y(m,e,h),z(e,t),z(t,r),Xe(r,n[12]),z(e,i),z(e,a),Me(o,a,null),z(e,l),u=!0,s||(c=be(r,"input",f),s=!0)},p(m,h){n=m,h&1&&r.value!==n[12]&&Xe(r,n[12]);let d={};h&32768&&(d.$$scope={dirty:h,ctx:n}),o.$set(d)},i(m){u||(te(o.$$.fragment,m),u=!0)},o(m){ae(o.$$.fragment,m),u=!1},d(m){m&&J(e),Te(o),s=!1,c()}}}function m6(n){let e;return{c(){e=Pe("Add Folder")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function wA(n){let e,t,r,i,a;return i=new us({props:{errorCollection:n[1],declaration:void 0}}),{c(){e=j("div"),t=j("h3"),t.textContent="Some Folder Paths are invalid",r=fe(),Fe(i.$$.fragment),L(t,"class","mod-error")},m(o,l){Y(o,e,l),z(e,t),z(e,r),Me(i,e,null),a=!0},p(o,l){let u={};l&2&&(u.errorCollection=o[1]),i.$set(u)},i(o){a||(te(i.$$.fragment,o),a=!0)},o(o){ae(i.$$.fragment,o),a=!1},d(o){o&&J(e),Te(i)}}}function d6(n){let e;return{c(){e=Pe("Save")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function h6(n){let e;return{c(){e=Pe("Cancel")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function g6(n){let e,t,r,i;return e=new Ut({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[d6]},$$scope:{ctx:n}}}),e.$on("click",n[10]),r=new Ut({props:{tooltip:"Revert Changes",$$slots:{default:[h6]},$$scope:{ctx:n}}}),r.$on("click",n[11]),{c(){Fe(e.$$.fragment),t=fe(),Fe(r.$$.fragment)},m(a,o){Me(e,a,o),Y(a,t,o),Me(r,a,o),i=!0},p(a,o){let l={};o&32768&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o&32768&&(u.$$scope={dirty:o,ctx:a}),r.$set(u)},i(a){i||(te(e.$$.fragment,a),te(r.$$.fragment,a),i=!0)},o(a){ae(e.$$.fragment,a),ae(r.$$.fragment,a),i=!1},d(a){a&&J(t),Te(e,a),Te(r,a)}}}function v6(n){let e,t,r,i,a,o,l,u,s,c,f,p=We(n[0]),m=[];for(let g=0;gae(m[g],1,1,()=>{m[g]=null});l=new Ut({props:{variant:"primary",tooltip:"Add new excluded Folder",$$slots:{default:[m6]},$$scope:{ctx:n}}}),l.$on("click",n[9]);let d=n[1]&&wA(n);return c=new ls({props:{$$slots:{default:[g6]},$$scope:{ctx:n}}}),{c(){e=j("div"),t=j("table"),r=j("thead"),r.innerHTML="Folder Path ",i=fe(),a=j("tbody");for(let g=0;g{d=null}),vt());let v={};y&32768&&(v.$$scope={dirty:y,ctx:g}),c.$set(v)},i(g){if(!f){for(let y=0;yg!==d))}function l(){r.push(""),t(0,r)}function u(){t(1,a=i.save(r)),a===void 0&&i.close()}function s(){i.close()}function c(d,g){d[g]=this.value,t(0,r)}let f=d=>o(d),p=()=>l(),m=()=>u(),h=()=>s();return n.$$set=d=>{"excludedFolders"in d&&t(0,r=d.excludedFolders),"modal"in d&&t(6,i=d.modal)},[r,a,o,l,u,s,i,c,f,p,m,h]}var ed=class extends Ve{constructor(e){super(),qe(this,e,y6,v6,Ue,{excludedFolders:0,modal:6})}},_A=ed;var vr=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Lr?this.errors.push(e):this.otherError=e,console.warn(e)):console.warn("[MB_ERROR_CONTAINER] received invalid error type",e)}merge(e){return this.errors=this.errors.concat(e.errors),e.otherError&&(this.otherError=e.otherError),this}hasErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="ERROR"||e.errorLevel==="CRITICAL")return!0;return!1}hasCriticalErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="CRITICAL")return!0;return!1}hasWarnings(){for(let e of this.errors)if(e.errorLevel==="WARNING")return!0;return!1}isEmpty(){return this.errors.length===0&&!this.otherError}getErrors(){let e=this.errors.filter(t=>t.errorLevel==="ERROR"||t.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var ic=class extends AA.Modal{constructor(t,r){super(t);this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new _A({target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(t){for(let r of t)if(r===""){let i=new vr("Excluded Folders");return i.add(new Error(`Invalid Folder Path '${r}'. Folder path may not be empty.`)),i}this.plugin.settings.excludedFolders=t,this.plugin.saveSettings()}};var MA=require("obsidian");function x6(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function b6(n){let e,t,r,i,a,o,l,u,s,c,f,p;return s=new Ut({props:{tooltip:"Delete Template",$$slots:{default:[x6]},$$scope:{ctx:n}}}),s.$on("click",n[4]),{c(){e=j("tr"),t=j("td"),r=j("input"),i=fe(),a=j("td"),o=j("input"),l=fe(),u=j("td"),Fe(s.$$.fragment),L(r,"type","text"),L(r,"placeholder","template-name"),L(o,"type","text"),L(o,"placeholder","INPUT[slider(addLabels)]"),ns(o,"width","100%"),ns(a,"width","100%")},m(m,h){Y(m,e,h),z(e,t),z(t,r),Xe(r,n[0].name),z(e,i),z(e,a),z(a,o),Xe(o,n[0].declaration),z(e,l),z(e,u),Me(s,u,null),c=!0,f||(p=[be(r,"input",n[2]),be(o,"input",n[3])],f=!0)},p(m,[h]){h&1&&r.value!==m[0].name&&Xe(r,m[0].name),h&1&&o.value!==m[0].declaration&&Xe(o,m[0].declaration);let d={};h&64&&(d.$$scope={dirty:h,ctx:m}),s.$set(d)},i(m){c||(te(s.$$.fragment,m),c=!0)},o(m){ae(s.$$.fragment,m),c=!1},d(m){m&&J(e),Te(s),f=!1,at(p)}}}function w6(n,e,t){let{template:r}=e,i=yu();function a(){console.log("dispatch"),i("delete-template",{name:r.name})}function o(){r.name=this.value,t(0,r)}function l(){r.declaration=this.value,t(0,r)}let u=()=>a();return n.$$set=s=>{"template"in s&&t(0,r=s.template)},[r,a,o,l,u]}var td=class extends Ve{constructor(e){super(),qe(this,e,w6,b6,Ue,{template:0})}},DA=td;function EA(n,e,t){let r=n.slice();return r[11]=e[t],r}function CA(n){let e,t;return e=new DA({props:{template:n[11]}}),e.$on("delete-template",n[7]),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.template=r[11]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function _6(n){let e;return{c(){e=Pe("Add Template")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function SA(n){let e,t,r,i,a;return i=new us({props:{errorCollection:n[1],declaration:void 0}}),{c(){e=j("div"),t=j("h3"),t.textContent="Some Templates Failed to Parse",r=fe(),Fe(i.$$.fragment),L(t,"class","mod-error")},m(o,l){Y(o,e,l),z(e,t),z(e,r),Me(i,e,null),a=!0},p(o,l){let u={};l&2&&(u.errorCollection=o[1]),i.$set(u)},i(o){a||(te(i.$$.fragment,o),a=!0)},o(o){ae(i.$$.fragment,o),a=!1},d(o){o&&J(e),Te(i)}}}function A6(n){let e;return{c(){e=Pe("Save")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function D6(n){let e;return{c(){e=Pe("Cancel")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function E6(n){let e,t,r,i;return e=new Ut({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[A6]},$$scope:{ctx:n}}}),e.$on("click",n[9]),r=new Ut({props:{tooltip:"Revert Changes",$$slots:{default:[D6]},$$scope:{ctx:n}}}),r.$on("click",n[10]),{c(){Fe(e.$$.fragment),t=fe(),Fe(r.$$.fragment)},m(a,o){Me(e,a,o),Y(a,t,o),Me(r,a,o),i=!0},p(a,o){let l={};o&16384&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o&16384&&(u.$$scope={dirty:o,ctx:a}),r.$set(u)},i(a){i||(te(e.$$.fragment,a),te(r.$$.fragment,a),i=!0)},o(a){ae(e.$$.fragment,a),ae(r.$$.fragment,a),i=!1},d(a){a&&J(t),Te(e,a),Te(r,a)}}}function C6(n){let e,t,r,i,a,o,l,u,s,c,f,p=We(n[0]),m=[];for(let g=0;gae(m[g],1,1,()=>{m[g]=null});l=new Ut({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[_6]},$$scope:{ctx:n}}}),l.$on("click",n[8]);let d=n[1]&&SA(n);return c=new ls({props:{$$slots:{default:[E6]},$$scope:{ctx:n}}}),{c(){e=j("div"),t=j("table"),r=j("thead"),r.innerHTML="Template Name Template Declaration ",i=fe(),a=j("tbody");for(let g=0;g{d=null}),vt());let v={};y&16384&&(v.$$scope={dirty:y,ctx:g}),c.$set(v)},i(g){if(!f){for(let y=0;yd.name!==h))}function l(){r.push({name:"",declaration:""}),t(0,r)}function u(){t(1,a=i.save(r)),a===void 0&&i.close()}function s(){i.close()}let c=h=>o(h.detail.name),f=()=>l(),p=()=>u(),m=()=>s();return n.$$set=h=>{"inputFieldTemplates"in h&&t(0,r=h.inputFieldTemplates),"modal"in h&&t(6,i=h.modal)},[r,a,o,l,u,s,i,c,f,p,m]}var rd=class extends Ve{constructor(e){super(),qe(this,e,S6,C6,Ue,{inputFieldTemplates:0,modal:6})}},NA=rd;var ac=class extends MA.Modal{constructor(t,r){super(t);this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new NA({target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(t){let r=this.plugin.api.inputFieldParser.parseTemplates(t);if(r.hasErrors())return r;this.plugin.settings.inputFieldTemplates=t,this.plugin.saveSettings()}};var wt=class{static linkToInputField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfields/${e.toLowerCase()}/`}static linkToInputFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfieldarguments/${e.toLowerCase()}/`}static linkToViewField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/${e.toLowerCase()}/`}static linkToViewFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfieldarguments/${e.toLowerCase()}/`}static linkToInputFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/inputfields/"}static linkToViewFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/viewfields/"}static linkToButtons(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToButtonConfig(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToSearch(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/?s=${encodeURIComponent(e)}`}static linkToHome(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/"}static linkToGithub(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin"}static linkToIssues(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues"}static linkToCanaryBuilds(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/installation/#canary-builds"}static open(e){window.open(e,"_blank")}};var LA=require("obsidian");var TA=require("obsidian");var oc=class extends TA.Modal{constructor(t,r,i){super(t);this.errorCollection=r,this.declaration=i}onOpen(){this.modalEl.addClass("mb-error-collection-modal"),this.titleEl.innerText="Meta Bind Field",this.component=new us({target:this.contentEl,props:{errorCollection:this.errorCollection,declaration:this.declaration}})}onClose(){var t;(t=this.component)==null||t.$destroy()}};function FA(n){let e,t,r,i,a;function o(s,c){return c&1&&(t=null),c&1&&(r=null),t==null&&(t=!!s[0].hasErrors()),t?T6:(r==null&&(r=!!s[0].hasWarnings()),r?M6:N6)}let l=o(n,-1),u=l(n);return{c(){e=j("div"),u.c(),L(e,"class","mb-error-collection"),L(e,"role","button"),L(e,"tabindex","0")},m(s,c){Y(s,e,c),u.m(e,null),i||(a=[be(e,"click",n[4]),be(e,"keydown",n[5])],i=!0)},p(s,c){l!==(l=o(s,c))&&(u.d(1),u=l(s),u&&(u.c(),u.m(e,null)))},d(s){s&&J(e),u.d(),i=!1,at(a)}}}function N6(n){let e,t,r,i;return{c(){e=Gn("svg"),t=Gn("circle"),r=Gn("path"),i=Gn("path"),L(t,"cx","12"),L(t,"cy","12"),L(t,"r","10"),L(r,"d","M12 16v-4"),L(i,"d","M12 8h.01"),L(e,"xmlns","http://www.w3.org/2000/svg"),L(e,"width","24"),L(e,"height","24"),L(e,"viewBox","0 0 24 24"),L(e,"fill","none"),L(e,"stroke","currentColor"),L(e,"stroke-width","2"),L(e,"stroke-linecap","round"),L(e,"stroke-linejoin","round"),L(e,"class","lucide lucide-info")},m(a,o){Y(a,e,o),z(e,t),z(e,r),z(e,i)},d(a){a&&J(e)}}}function M6(n){let e,t,r,i;return{c(){e=Gn("svg"),t=Gn("path"),r=Gn("line"),i=Gn("line"),L(t,"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"),L(r,"x1","12"),L(r,"x2","12"),L(r,"y1","9"),L(r,"y2","13"),L(i,"x1","12"),L(i,"x2","12.01"),L(i,"y1","17"),L(i,"y2","17"),L(e,"xmlns","http://www.w3.org/2000/svg"),L(e,"width","24"),L(e,"height","24"),L(e,"viewBox","0 0 24 24"),L(e,"fill","none"),L(e,"stroke","currentColor"),L(e,"stroke-width","2"),L(e,"stroke-linecap","round"),L(e,"stroke-linejoin","round"),L(e,"class","lucide lucide-alert-triangle")},m(a,o){Y(a,e,o),z(e,t),z(e,r),z(e,i)},d(a){a&&J(e)}}}function T6(n){let e,t,r,i,a,o;return{c(){e=Gn("svg"),t=Gn("circle"),r=Gn("line"),i=Gn("line"),a=fe(),o=j("span"),o.textContent="[META_BIND_ERROR]",L(t,"cx","12"),L(t,"cy","12"),L(t,"r","10"),L(r,"x1","12"),L(r,"x2","12"),L(r,"y1","8"),L(r,"y2","12"),L(i,"x1","12"),L(i,"x2","12.01"),L(i,"y1","16"),L(i,"y2","16"),L(e,"xmlns","http://www.w3.org/2000/svg"),L(e,"width","24"),L(e,"height","24"),L(e,"viewBox","0 0 24 24"),L(e,"fill","none"),L(e,"stroke","currentColor"),L(e,"stroke-width","2"),L(e,"stroke-linecap","round"),L(e,"stroke-linejoin","round"),L(e,"class","lucide lucide-alert-circle"),L(o,"class","mb-error")},m(l,u){Y(l,e,u),z(e,t),z(e,r),z(e,i),Y(l,a,u),Y(l,o,u)},d(l){l&&(J(e),J(a),J(o))}}}function F6(n){let e=!n[0].isEmpty(),t,r=e&&FA(n);return{c(){r&&r.c(),t=or()},m(i,a){r&&r.m(i,a),Y(i,t,a)},p(i,[a]){a&1&&(e=!i[0].isEmpty()),e?r?r.p(i,a):(r=FA(i),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},i:Se,o:Se,d(i){i&&J(t),r&&r.d(i)}}}function I6(n,e,t){let{app:r}=e,{errorCollection:i}=e,{declaration:a}=e;function o(){new oc(r,i,a).open()}let l=()=>o(),u=s=>{s.key===" "&&o()};return n.$$set=s=>{"app"in s&&t(2,r=s.app),"errorCollection"in s&&t(0,i=s.errorCollection),"declaration"in s&&t(3,a=s.declaration)},[i,o,r,a,l,u]}var nd=class extends Ve{constructor(e){super(),qe(this,e,I6,F6,Ue,{app:2,errorCollection:0,declaration:3})}},Jn=nd;var ys=(D=>(D.TOGGLE="toggle",D.SLIDER="slider",D.TEXT="text",D.TEXT_AREA_DEPRECATED="text_area",D.TEXT_AREA="textArea",D.SELECT="select",D.MULTI_SELECT_DEPRECATED="multi_select",D.MULTI_SELECT="multiSelect",D.DATE="date",D.TIME="time",D.DATE_PICKER_DEPRECATED="date_picker",D.DATE_PICKER="datePicker",D.NUMBER="number",D.SUGGESTER="suggester",D.EDITOR="editor",D.IMAGE_SUGGESTER="imageSuggester",D.PROGRESS_BAR="progressBar",D.INLINE_SELECT="inlineSelect",D.LIST="list",D.LIST_SUGGESTER="listSuggester",D.INLINE_LIST_SUGGESTER="inlineListSuggester",D.INLINE_LIST="inlineList",D.INVALID="invalid",D))(ys||{}),Sr=(g=>(g.CLASS="class",g.ADD_LABELS="addLabels",g.MIN_VALUE="minValue",g.MAX_VALUE="maxValue",g.STEP_SIZE="stepSize",g.OPTION="option",g.TITLE="title",g.OPTION_QUERY="optionQuery",g.SHOWCASE="showcase",g.ON_VALUE="onValue",g.OFF_VALUE="offValue",g.DEFAULT_VALUE="defaultValue",g.PLACEHOLDER="placeholder",g.USE_LINKS="useLinks",g.LIMIT="limit",g.INVALID="invalid",g))(Sr||{}),IA={toggle:{type:"toggle",allowInBlock:!0,allowInline:!0},slider:{type:"slider",allowInBlock:!0,allowInline:!0},text:{type:"text",allowInBlock:!0,allowInline:!0},text_area:{type:"text_area",allowInBlock:!0,allowInline:!0},textArea:{type:"textArea",allowInBlock:!0,allowInline:!0},select:{type:"select",allowInBlock:!0,allowInline:!1},multi_select:{type:"multi_select",allowInBlock:!0,allowInline:!1},multiSelect:{type:"multiSelect",allowInBlock:!0,allowInline:!1},date:{type:"date",allowInBlock:!0,allowInline:!0},time:{type:"time",allowInBlock:!0,allowInline:!0},date_picker:{type:"date_picker",allowInBlock:!0,allowInline:!0},datePicker:{type:"datePicker",allowInBlock:!0,allowInline:!0},number:{type:"number",allowInBlock:!0,allowInline:!0},suggester:{type:"suggester",allowInBlock:!0,allowInline:!0},editor:{type:"editor",allowInBlock:!0,allowInline:!1},imageSuggester:{type:"imageSuggester",allowInBlock:!0,allowInline:!1},progressBar:{type:"progressBar",allowInBlock:!0,allowInline:!1},inlineSelect:{type:"inlineSelect",allowInBlock:!0,allowInline:!0},list:{type:"list",allowInBlock:!0,allowInline:!1},listSuggester:{type:"listSuggester",allowInBlock:!0,allowInline:!1},inlineListSuggester:{type:"inlineListSuggester",allowInBlock:!0,allowInline:!0},inlineList:{type:"inlineList",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}},tr={addLabels:{type:"addLabels",allowedFieldTypes:["slider","progressBar"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},defaultValue:{type:"defaultValue",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},maxValue:{type:"maxValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the maximally allowed value"}]],allowMultiple:!1},minValue:{type:"minValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the minimally allowed value"}]],allowMultiple:!1},stepSize:{type:"stepSize",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the step size for sliders"}]],allowMultiple:!1},offValue:{type:"offValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},onValue:{type:"onValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},option:{type:"option",allowedFieldTypes:["select","multi_select","multiSelect","suggester","imageSuggester","inlineSelect","listSuggester","inlineListSuggester"],values:[[{name:"value",allowed:[],description:"the value and display name of the option"}],[{name:"value",allowed:[],description:"the value of the option"},{name:"name",allowed:[],description:"the display name of the option"}]],allowMultiple:!0},optionQuery:{type:"optionQuery",allowedFieldTypes:["suggester","imageSuggester","listSuggester","inlineListSuggester"],values:[[{name:"value",allowed:[],description:"the query for options"}]],allowMultiple:!0},placeholder:{type:"placeholder",allowedFieldTypes:["text","textArea","text_area","number","list","inlineList"],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},showcase:{type:"showcase",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},title:{type:"title",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},useLinks:{type:"useLinks",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},limit:{type:"limit",allowedFieldTypes:["text","textArea","list","inlineList"],values:[[{name:"value",allowed:["number"],description:"a character limit for text fields"}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},Eu=(i=>(i.MATH="math",i.TEXT="text",i.LINK="link",i.INVALID="invalid",i))(Eu||{}),xs=(r=>(r.RENDER_MARKDOWN="renderMarkdown",r.HIDDEN="hidden",r.INVALID="invalid",r))(xs||{}),sc={renderMarkdown:{type:"renderMarkdown",allowedFieldTypes:["text"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},hidden:{type:"hidden",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}};var B6={date:"date",datePicker:"datePicker",editor:"editor",imageSuggester:'imageSuggester(optionQuery(""))',inlineList:"inlineList",inlineListSuggester:"inlineListSuggester(option(apple), option(banana), option(lemon))",inlineSelect:"inlineSelect(option(apple), option(banana), option(lemon))",list:"list",listSuggester:"listSuggester(option(apple), option(banana), option(lemon))",multiSelect:"multiSelect(option(apple), option(banana), option(lemon))",number:"number",progressBar:"progressBar",select:"select(option(apple), option(banana), option(lemon))",slider:"slider(addLabels)",suggester:"suggester(option(apple), option(banana), option(lemon))",text:"text",textArea:"textArea",time:"time",toggle:"toggle",date_picker:"",multi_select:"",text_area:"",invalid:""};function id(n){let e=[];for(let[t,r]of Object.entries(B6)){if(r==="")continue;let i=n.api.inputField.createInputFieldDeclarationFromString(`INPUT[${r}]`);i=n.api.inputField.addArgument(i,{name:"showcase",value:["true"]}),i=n.api.inputField.addArgument(i,{name:"title",value:[t]}),e.push([t,i])}return e}var BA=require("obsidian");function O6(n){let e;return{c(){e=j("div")},m(t,r){Y(t,e,r),n[4](e)},p:Se,i:Se,o:Se,d(t){t&&J(e),n[4](null)}}}function P6(n,e,t){let{type:r}=e,{declaration:i}=e,{plugin:a}=e,o,l;Kr(()=>{o=new BA.Component,a.api.createInputField(i,"block","",l,o),o.load()}),mo(()=>{o.unload()});function u(s){Fr[s?"unshift":"push"](()=>{l=s,t(0,l)})}return n.$$set=s=>{"type"in s&&t(1,r=s.type),"declaration"in s&&t(2,i=s.declaration),"plugin"in s&&t(3,a=s.plugin)},[l,r,i,a,u]}var ad=class extends Ve{constructor(e){super(),qe(this,e,P6,O6,Ue,{type:1,declaration:2,plugin:3})}},OA=ad;function PA(n,e,t){let r=n.slice();return r[7]=e[t],r}function R6(n){let e;return{c(){e=Pe("Docs")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function k6(n){let e;return{c(){e=Pe("GitHub")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function L6(n){let e;return{c(){e=Pe("Report Issue")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function RA(n){let e,t;return e=new OA({props:{type:n[7][0],declaration:n[7][1],plugin:n[1]}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.type=r[7][0]),i&2&&(a.declaration=r[7][1]),i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function V6(n){let e,t,r,i,a,o,l,u,s,c,f,p,m,h,d,g,y,w,v,x,_,b,D,C,A,E,F,I,O,k,R,T,N,V,B,X,ee,W,P,K,ve,ie,oe,ge,ue,ce;l=new Ut({props:{variant:"primary",$$slots:{default:[R6]},$$scope:{ctx:n}}}),l.$on("click",n[4]),s=new Ut({props:{variant:"default",$$slots:{default:[k6]},$$scope:{ctx:n}}}),s.$on("click",n[5]),f=new Ut({props:{variant:"default",$$slots:{default:[L6]},$$scope:{ctx:n}}}),f.$on("click",n[6]),A=new Jn({props:{app:n[0],declaration:U6,errorCollection:n[2]}}),O=new Jn({props:{app:n[0],declaration:q6,errorCollection:n[3]}});let me=We(id(n[1])),de=[];for(let we=0;weae(de[we],1,1,()=>{de[we]=null});return{c(){e=j("div"),t=j("h1"),t.textContent="Meta Bind FAQ",r=fe(),i=j("h2"),i.textContent="Quick Access",a=fe(),o=j("p"),Fe(l.$$.fragment),u=fe(),Fe(s.$$.fragment),c=fe(),Fe(f.$$.fragment),p=fe(),m=j("h2"),m.textContent="Error Messages",h=fe(),d=j("p"),g=Pe("When creating "),y=j("a"),y.textContent="Input Fields",v=Pe(` or `),x=j("a"),x.textContent="View Fields",b=fe(),D=j("strong"),D.textContent="warnings",C=Pe(` ( `),Fe(A.$$.fragment),E=Pe(` ) and `),F=j("strong"),F.textContent="errors",I=Pe(` ( `),Fe(O.$$.fragment),k=Pe(` ) can occur. These are `),R=j("strong"),R.textContent="clickable",T=Pe(` and will show a modal with detailed information about the error when clicked.`),N=fe(),V=j("h2"),V.textContent="Input Fields",B=fe(),X=j("p"),X.innerHTML=`Input Fields let you change the frontmatter of your notes from inside of notes.`,ee=fe();for(let we=0;weView Fields 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.`,ie=fe(),oe=j("h2"),oe.textContent="Bind Targets",ge=fe(),ue=j("p"),ue.innerHTML=`Bind Targets let the plugin know what frontmatter properties to bind Input Fields and View Fields to.`,L(y,"href",w=wt.linkToInputFields()),L(x,"href",_=wt.linkToViewFields()),L(e,"class","mb-faq-view markdown-rendered")},m(we,U){Y(we,e,U),z(e,t),z(e,r),z(e,i),z(e,a),z(e,o),Me(l,o,null),z(o,u),Me(s,o,null),z(o,c),Me(f,o,null),z(e,p),z(e,m),z(e,h),z(e,d),z(d,g),z(d,y),z(d,v),z(d,x),z(d,b),z(d,D),z(d,C),Me(A,d,null),z(d,E),z(d,F),z(d,I),Me(O,d,null),z(d,k),z(d,R),z(d,T),z(e,N),z(e,V),z(e,B),z(e,X),z(e,ee);for(let G=0;G{a.add(new bu({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),t(2,a),o.add(new bu({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"})),t(3,o)});let l=()=>{wt.open(wt.linkToHome())},u=()=>{wt.open(wt.linkToGithub())},s=()=>{wt.open(wt.linkToIssues())};return n.$$set=c=>{"app"in c&&t(0,r=c.app),"plugin"in c&&t(1,i=c.plugin)},[r,i,a,o,l,u,s]}var od=class extends Ve{constructor(e){super(),qe(this,e,z6,V6,Ue,{app:0,plugin:1})}},kA=od;var Oo="mb-faq-view-type",uc=class extends LA.ItemView{constructor(t,r){super(t);this.plugin=r}getViewType(){return Oo}getDisplayText(){return"Meta Bind FAQ"}async onOpen(){let t=this.containerEl.children[1];t.empty(),this.component=new kA({target:t,props:{app:this.app,plugin:this.plugin}})}async onClose(){var t;(t=this.component)==null||t.$destroy()}};var lc=class extends en.PluginSettingTab{constructor(t,r){super(t,r);this.plugin=r}display(){let{containerEl:t}=this;if(t.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){t.createEl("p",{text:`You are using a ${this.plugin.build} build (${this.plugin.manifest.version}). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let r=new en.ButtonComponent(t);r.setButtonText("Learn About Canary Builds"),r.setCta(),r.onClick(()=>{wt.open(wt.linkToCanaryBuilds())})}new en.Setting(t).setName("Quick access").addButton(r=>{r.setCta(),r.setButtonText("Docs"),r.onClick(()=>{wt.open(wt.linkToHome())})}).addButton(r=>{r.setButtonText("Open FAQ"),r.onClick(()=>{this.plugin.activateView(Oo)})}).addButton(r=>{r.setButtonText("GitHub"),r.onClick(()=>{wt.open(wt.linkToGithub())})}).addButton(r=>{r.setButtonText("Report Issue"),r.onClick(()=>{wt.open(wt.linkToIssues())})}),t.createEl("h2",{text:"General Settings"}),new en.Setting(t).setName("Enable Syntax Highlighting").setDesc("Enable syntax highlighting for. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableSyntaxHighlighting),r.onChange(i=>{this.plugin.settings.enableSyntaxHighlighting=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("Input Field Templates").setDesc("You can specify input field templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.").addButton(r=>{r.setButtonText("Edit Templates"),r.onClick(()=>{new ac(this.app,this.plugin).open()})}),new en.Setting(t).setName("Excluded Folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(r=>{r.setButtonText("Edit Excluded Folders"),r.onClick(()=>{new ic(this.app,this.plugin).open()})}),new en.Setting(t).setName("View Fields display null as empty").setDesc("Display nothing instead of null, if the frontmatter value is empty, in text view fields.").addToggle(r=>{r.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),r.onChange(i=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("Enable JS Input Fields").setDesc("Enable the processing of JavaScript input fields. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableJs),r.onChange(i=>{this.plugin.settings.enableJs=i,this.plugin.saveSettings()})}),t.createEl("h2",{text:"Date and Time Settings"}),new en.Setting(t).setName("Date format").setDesc("The date format to be used by this plugin. Changing this setting will break the parsing of existing date inputs. Here is a list of all available date tokes https://momentjs.com/docs/#/displaying/.").addText(r=>{r.setValue(this.plugin.settings.preferredDateFormat),r.onChange(i=>{this.plugin.settings.preferredDateFormat=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("Use US date input field order").setDesc("When enabled the month input is before the day input.").addToggle(r=>{r.setValue(this.plugin.settings.useUsDateInputOrder),r.onChange(i=>{this.plugin.settings.useUsDateInputOrder=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(r=>{for(let i of po)r.addOption(i.name,i.name);r.setValue(this.plugin.settings.firstWeekday.name),r.onChange(i=>{this.plugin.settings.firstWeekday=po.find(a=>a.name===i),this.plugin.saveSettings()})}),t.createEl("h2",{text:"Advanced Settings"}),new en.Setting(t).setName("Dev Mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(r=>{r.setValue(this.plugin.settings.devMode),r.onChange(i=>{this.plugin.settings.devMode=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("Disable Code Block Restrictions").setDesc("Disable restrictions on which input fields can be created in which code blocks. Not recommended unless you know what you are doing.").addToggle(r=>{r.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),r.onChange(i=>{this.plugin.settings.ignoreCodeBlockRestrictions=i,this.plugin.saveSettings()})}),new en.Setting(t).setName("Sync interval").setDesc(`The interval in milli-seconds between disk writes. Changing this number is not recommended except if your hard drive is exceptionally slow. Standard: ${Ai.syncInterval}; Minimum: ${Ai.minSyncInterval}; Maximum: ${Ai.maxSyncInterval}`).addText(r=>{r.setValue(this.plugin.settings.syncInterval.toString()),r.onChange(i=>{this.plugin.settings.syncInterval=Number.parseInt(i),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=Ai.syncInterval),this.plugin.settings.syncIntervalAi.maxSyncInterval&&(this.plugin.settings.syncInterval=Ai.maxSyncInterval),this.plugin.saveSettings()})})}};var ud=require("obsidian"),Vr=class n{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,ud.moment)(e,n.dateFormat)}static getDefaultDate(){return(0,ud.moment)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};function Cu(n,e,t){return Math.min(Math.max(n,e),t)}function cc(n,e,t){return n!==void 0?Math.min(Math.max(n,e),t):void 0}function ld(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}function cd(n,e){return(n%e+e)%e}function VA(n,e){if(n==null&&e==null)return!0;if(n==null||e==null||n.length!==e.length)return!1;for(let t=0;tthis.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){let e=this.dependencySubscriptions.map(r=>r.callbackSignal.get()),t=await this.computeFunction(e);this.callbackSignal.set(t),this.metadataManager.updateCache(t,this)}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}notify(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var ca=class{static get(e,t){return t.get(e).child}static tryGet(e,t){var r;return(r=t.tryGet(e))==null?void 0:r.child}static fullGet(e,t){return t.get(e)}static set(e,t,r){t.set(e,r)}static setAndCreate(e,t,r){t.setAndCreate(e,r)}};var Mu=(i=>(i.FRONTMATTER="frontmatter",i.MEMORY="memory",i.GLOBAL_MEMORY="globalMemory",i.SCOPE="scope",i))(Mu||{});var UA=5,$6=5*60;function md(n,e){return n===void 0||e===void 0||n.storageType!==e.storageType||n.storagePath!==e.storagePath?!1:qA(n.storageProp.toStringArray(),e.storageProp.toStringArray(),e.listenToChildren)}function qA(n,e,t){return VA(n,e)||fd(e,n)?!0:t&&fd(n,e)}function H6(n){return n===void 0?"undefined":`${n.storagePath}#${n.storageProp.toString()}`}var mc=class{constructor(e){this.cache=new Map,this.globalCache={metadata:Su({}),memory:{},subscriptions:[]},this.metadataAdapter=e,this.metadataAdapter.setManagerInstance(this),this.metadataAdapter.load()}unload(){this.metadataAdapter.unload()}subscribeSubscription(e){var r,i;if(e.bindTarget===void 0)return;if(((r=e.bindTarget)==null?void 0:r.storageType)==="scope")throw new ln({errorLevel:"CRITICAL",effect:"can not subscribe subscription",cause:"local scope should be resolved by the time the subscription is created"});if(((i=e.bindTarget)==null?void 0:i.storageType)==="globalMemory"){console.debug(`meta-bind | MetadataManager >> registered ${e.uuid} to global memory cache -> ${e.bindTarget.storageProp.toString()}`),this.globalCache.subscriptions.push(e),e.notify(this.getPropertyFromCache(this.globalCache,e.bindTarget.storageType,e.bindTarget.storageProp));return}let t=this.getCacheForFile(e.bindTarget.storagePath);if(t)console.debug(`meta-bind | MetadataManager >> registered ${e.uuid} to existing file cache ${e.bindTarget.storagePath} -> ${e.bindTarget.storageProp.toString()}`),t.inactive=!1,t.cyclesSinceInactive=0,t.subscriptions.push(e),e.notify(this.getPropertyFromCache(t,e.bindTarget.storageType,e.bindTarget.storageProp));else{console.debug(`meta-bind | MetadataManager >> registered ${e.uuid} to newly created file cache ${e.bindTarget.storagePath} -> ${e.bindTarget.storageProp.toString()}`);let{metadata:a,extraCache:o}=this.metadataAdapter.getMetadataAndExtraCache(e),l={extraCache:o,metadata:a,memory:{},subscriptions:[e],cyclesSinceLastChange:UA+1,cyclesSinceInactive:0,inactive:!1,changed:!1};console.log(`meta-bind | MetadataManager >> loaded metadata for file ${e.bindTarget.storagePath}`,l.metadata),e.notify(this.getPropertyFromCache(l,e.bindTarget.storageType,e.bindTarget.storageProp)),this.createCacheForFile(e.bindTarget.storagePath,l)}}subscribe(e,t,r,i){let a=new fc(e,t,this,r,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,r,i,a,o){let l=new pc(e,t,this,r,i,a,o);return this.checkForLoops(l),l.init(),this.subscribeSubscription(l),l}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.first(),r=e.last();if(!(r===void 0||t===void 0)){if(md(t.bindTarget,r.bindTarget))throw new xo({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${H6(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(r))this.recCheckForLoops([...e,i])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(t=>this.getAllSubscriptionsToBindTarget(t.bindTarget)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let t=this.getCacheForFile(e.storagePath);if(!t)return[];let r=[];for(let i of t.subscriptions)md(i.bindTarget,e)&&r.push(i);return t.subscriptions.filter(i=>md(i.bindTarget,e))}unsubscribe(e){if(e.bindTarget===void 0)return;let t=e.bindTarget.storagePath,r=this.getCacheForFile(t);r&&(console.debug(`meta-bind | MetadataManager >> unregistered ${e.uuid} to from file cache ${t}`),r.subscriptions=r.subscriptions.filter(i=>i.uuid!==e.uuid),r.subscriptions.length===0&&(console.debug(`meta-bind | MetadataManager >> marked unused file cache as inactive ${t}`),r.inactive=!0))}getCacheForFile(e){return this.cache.get(e)}createCacheForFile(e,t){if(this.cache.has(e))throw new ln({errorLevel:"CRITICAL",effect:"can not create metadata file cache",cause:"cache for file already exists"});this.cache.set(e,t)}cycle(){let e=[];for(let[t,r]of this.cache)r.changed&&this.updateExternal(t,r),r.cyclesSinceLastChange+=1,r.inactive&&(r.cyclesSinceInactive+=1),r.cyclesSinceInactive>$6&&e.push(t);for(let t of e)this.cache.delete(t)}async updateExternal(e,t){try{await this.metadataAdapter.updateMetadata(e,t)}catch(r){t.changed=!1,console.warn("failed to update frontmatter",r)}}updateCache(e,t){if(t.bindTarget===void 0)return;let r=t.bindTarget.storageProp,i=t.bindTarget.storagePath,a=t.bindTarget.storageType;if(console.debug(`meta-bind | MetadataManager >> updating "${JSON.stringify(r)}" in "${i}" metadata cache to`,e),a==="frontmatter"){let o=this.getCacheForFile(i);if(!o)return;ca.setAndCreate(o.metadata,r,e),o.cyclesSinceLastChange=0,o.changed=!0,this.notifyFileCacheListeners(o,"frontmatter",r,t.uuid)}else if(a==="memory"){let o=this.getCacheForFile(i);if(!o)return;ca.setAndCreate(o.memory,r,e),this.notifyFileCacheListeners(o,"memory",r,t.uuid)}else a==="globalMemory"&&(ca.setAndCreate(this.globalCache.memory,r,e),this.notifyFileCacheListeners(this.globalCache,"globalMemory",r,t.uuid))}updateCacheOnExternalFrontmatterUpdate(e,t){let r=this.getCacheForFile(e);if(!r||r.cyclesSinceLastChange> updating "${e}" on frontmatter update`,i),r.metadata=i,this.notifyFileCacheListeners(r,"frontmatter")}notifyFileCacheListeners(e,t,r,i){for(let a of e.subscriptions)if(!(i&&i===a.uuid)&&a.bindTarget!==void 0&&a.bindTarget.storageType===t)if(r){if(qA(r.toStringArray(),a.bindTarget.storageProp.toStringArray(),a.bindTarget.listenToChildren)){let o=this.getPropertyFromCache(e,a.bindTarget.storageType,a.bindTarget.storageProp);console.debug(`meta-bind | MetadataManager >> notifying input field ${a.uuid} of updated metadata value`,o),a.notify(o)}}else{let o=this.getPropertyFromCache(e,a.bindTarget.storageType,a.bindTarget.storageProp);console.debug(`meta-bind | MetadataManager >> notifying input field ${a.uuid} of updated metadata`,a.bindTarget.storageProp,e.metadata,o),a.notify(o)}}deleteCacheInstantly(e){let t=this.getCacheForFile(e);if(t!==void 0){for(let r of t.subscriptions)r.delete();this.cache.delete(e)}}getPropertyFromCache(e,t,r){if(t==="frontmatter")return ca.tryGet(e.metadata,r);if(t==="memory")return ca.tryGet(e.memory,r);if(t==="globalMemory"){if(this.globalCache!==e)throw new ln({errorLevel:"CRITICAL",effect:"can not get property from cache",cause:"cache is not the global cache"});return ca.tryGet(e.memory,r)}throw new ln({errorLevel:"CRITICAL",effect:"can not get property from cache",cause:`bind target storage type "${t}" is not supported`})}};var zA=require("obsidian");var fn=class extends zA.MarkdownRenderChild{constructor(t,r,i,a,o){super(t);this.renderChildType=r,this.plugin=i,this.filePath=a,this.uuid=o,this.errorCollection=new vr(this.uuid)}};var Po=class extends fn{constructor(t,r,i,a,o,l){super(t,r,a,o,l);this.errorCollection.merge(i.errorCollection),this.fullDeclaration=i.fullDeclaration,this.inputFieldDeclaration=i}getArguments(t){if(this.inputFieldDeclaration.errorCollection.hasErrors())throw new ln({errorLevel:"CRITICAL",effect:"can not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.inputFieldDeclaration.argumentContainer.getAll(t)}getArgument(t){return this.getArguments(t).at(0)}getBindTarget(){return this.inputFieldDeclaration.bindTarget}getUuid(){return this.uuid}getFilePath(){return this.filePath}shouldAddCardContainer(){let t=this.inputFieldDeclaration.inputFieldType==="select"||this.inputFieldDeclaration.inputFieldType==="multi_select"||this.inputFieldDeclaration.inputFieldType==="multiSelect"||this.inputFieldDeclaration.inputFieldType==="list",r=pd(this.getArgument("showcase"))||pd(this.getArgument("title"));return this.renderChildType==="block"&&(t||r)}createErrorIndicator(t){new Jn({target:t,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}})}createWrapper(){let t=this.getArgument("title");if(this.shouldAddCardContainer()){let r=this.containerEl.createDiv({cls:"mb-card"});return t&&r.createEl("h3",{text:t.value}),r}else return this.containerEl}addShowcaseArgument(t){let r=this.getArgument("showcase");this.shouldAddCardContainer()&&r&&t.createEl("code",{cls:"mb-none"}).createEl("a",{text:this.fullDeclaration,href:wt.linkToInputField(this.inputFieldDeclaration.inputFieldType),cls:"mb-no-link"})}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.plugin.api.inputFieldFactory.createInputField(this.inputFieldDeclaration.inputFieldType,this.renderChildType,this)}catch(t){this.errorCollection.add(t)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new ln({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}onload(){var a;if(console.log("meta-bind | InputFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("mb-input"),this.containerEl.empty(),this.plugin.mdrcManager.registerMDRC(this),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(this.containerEl);return}let t=this.createWrapper();this.createErrorIndicator(t);let r=t.createDiv();r.addClass("mb-input-wrapper"),(a=this.inputField)==null||a.mount(r);let i=this.getArguments("class");i&&r.addClasses(i.map(o=>o.value).flat()),this.renderChildType==="block"?this.containerEl.addClass("mb-input-block"):this.containerEl.addClass("mb-input-inline"),this.addShowcaseArgument(t)}onunload(){var t;console.log("meta-bind | InputFieldMarkdownRenderChild >> unload",this),(t=this.inputField)==null||t.destroy(),this.plugin.mdrcManager.unregisterMDRC(this),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind input field",cls:"mb-error"}),super.onunload()}};var qr=gr(ui()),Xn=gr(si());var pn=gr(ui()),YA=gr(si());var Ur=gr(ui()),Pa=gr(si()),Dn=Ur.P.sequence(Pa.P_UTILS.unicodeLetter(),Ur.P.or(Pa.P_UTILS.unicodeAlphanumeric(),Ur.P.oneOf("-_")).many()).map(n=>n[0]+n[1].join("")).describe("identifier"),WA=Ur.P.sequenceMap((n,e)=>n+e.map(t=>t[0]+t[1]).join(""),Dn,Ur.P.sequence(Pa.P_UTILS.optionalWhitespace(),Dn).many()).describe("identifier with spaces"),X6=Ur.P.string("\\").then(Pa.P_UTILS.any()).map(n=>n==="'"?"'":n==="\\"?"\\":"\\"+n);function jA(n){return Ur.P.or(X6,Ur.P.noneOf(n+"\\")).many().map(e=>e.join("")).trim(Ur.P.string(n))}var _d=jA("'"),ZA=jA('"');function On(n,e){return{value:n,position:e}}var Ad=Ur.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),Q6=Ur.P.or(_d,Ad).node(On),K6=Ur.P.separateBy(Q6,Ur.P.string(",").describe('argument value separator ","').trim(Pa.P_UTILS.optionalWhitespace())),eV=Ur.P.sequenceMap((n,e)=>({name:n,value:e}),Dn.node(On),K6.trim(Pa.P_UTILS.optionalWhitespace()).wrap(Ur.P.string("(").describe('argument value paren "("'),Ur.P.string(")").describe('argument value paren ")"')).optional([])),Tu=Ur.P.separateBy(eV,Ur.P.string(",").describe('argument separator ","').trim(Pa.P_UTILS.optionalWhitespace()));var Ac=class{constructor(e,t,r){this.parent=e,this.access=t,this.child=r}};function tV(n,e){return n[e]}function JA(n,e,t){n[e]=t}var Ro=class{constructor(e,t){if(this.type=e,this.prop=e==="object"?t:"",this.index=e==="array"?Number(t):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 Ac(e,this,tV(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 Ac(e,this,e[this.index])}}set(e,t){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");JA(e,this.prop,t)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=t}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");JA(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 Fu=pn.P.manyNotOf("{}[]#^|:?").box("file path"),XA=Dn.node((n,e)=>({type:"object",prop:On(n,e)})),Dd=pn.P.or(YA.P_UTILS.digits().wrap(pn.P.string("["),pn.P.string("]")).node((n,e)=>({type:"array",prop:On(n,e)})),ZA.wrap(pn.P.string("["),pn.P.string("]")).node((n,e)=>({type:"object",prop:On(n,e)}))),rV=pn.P.or(pn.P.sequenceMap(n=>({storagePath:void 0,listenToChildren:!1,storageProp:n}),Dd.atLeast(1)),pn.P.sequenceMap((n,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[n,...e]}),XA,Dd.many())),nV=pn.P.sequenceMap((n,e)=>[n,...e],XA,Dd.many()),Cd=pn.P.sequenceMap((n,e)=>(n.storageProp=n.storageProp.concat(e.flat()),n),rV,pn.P.string(".").then(nV).many()),Vi=pn.P.sequenceMap((n,e,t)=>(t.storageType=n,t.storagePath=e,t),Dn.describe("storage type").node(On).skip(pn.P.string("^").describe('storage type separator "^"')).optional(),Fu.describe("storage path").node(On).skip(pn.P.string("#").describe('storage/file path separator "#"')).optional(),Cd.describe("property path")).box("bind target");var iV=qr.P.string("\\").then(Xn.P_UTILS.any()).map(n=>n==="["?"[":n==="]"?"]":n==="{"?"{":n==="}"?"}":n==="\\"?"\\":"\\"+n),Dc=qr.P.sequenceMap((n,e)=>n+e.flat().join(""),qr.P.manyNotOf("{}[]\\"),qr.P.sequence(iV,qr.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),aV=qr.P.sequenceMap((n,e)=>[n,...e.flat()],Dc,qr.P.sequence(Vi.wrapString("{","}"),Dc).many()),oV=qr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{viewFieldType:n,writeToBindTarget:r,arguments:e,templateDeclaration:void 0}},Dn.node(On).trim(Xn.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Tu.trim(Xn.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(Xn.P_UTILS.optionalWhitespace()).optional([]),qr.P.sequence(qr.P.string(":").trim(Xn.P_UTILS.optionalWhitespace()),Vi).trim(Xn.P_UTILS.optionalWhitespace()).optional()),Sd=qr.P.sequenceMap((n,e,t,r)=>r===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(r.templateDeclaration=e,r),qr.P.string("VIEW"),aV.wrapString("[","]"),Xn.P_UTILS.optionalWhitespace(),oV.wrapString("[","]").optional(),Xn.P_UTILS.eof()),sV=qr.P.sequenceMap((n,e,t,r)=>(e!==void 0&&(n.listenToChildren=!0),{bindTarget:n,name:r}),Vi.wrapString("{","}"),qr.P.string(" and children").optional(),qr.P.string(" as "),Dn),QA=qr.P.sequenceMap((n,e,t)=>({bindTargetMappings:n,writeToBindTarget:e,code:t}),sV.separateBy(Xn.P_UTILS.whitespace()).skip(Xn.P_UTILS.whitespace()),qr.P.string("save to ").then(Vi.wrapString("{","}")).skip(Xn.P_UTILS.whitespace()).optional(),qr.P.string("---").then(Xn.P_UTILS.remaining()));function Jr(n,e){let t=n.tryParse(e);if(t.success)return t.value;throw new Iu("ERROR","parsiNOM parser",e,t)}var Iu=class extends Lr{constructor(t,r,i,a){super({errorLevel:t,effect:"failed to parse",cause:`expected ${a.expected.sort().join(" or ")}`});this.str=i,this.parseFailure=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_PARSINOM"}updateMessage2(){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}" `;let r=this.str.split(` `)[this.parseFailure.furthest.line-1],i=`${this.parseFailure.furthest.line} | `;this.positionContext=`${i}${r}`,this.positionContext+=` ${this.getUnderline(i.length)} `,this.message+=` `+this.positionContext}getUnderline(t){let r=" ".repeat(this.parseFailure.furthest.column+t-1),i=`^ (${this.cause})`;return r+i}},Br=class extends Lr{constructor(t,r,i,a,o,l){super({errorLevel:t,effect:"failed to validate parser result",cause:i,docs:l});this.str=a,this.position=o,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],i=`${this.position.from.line} | `;this.positionContext=`${i}${r}`,this.positionContext+=` ${this.getUnderline(i.length,r.length)} `,this.message+=` `+this.positionContext}}getUnderline(t,r){if(this.position===void 0)return"";let i=" ".repeat(this.position.from.column+t-1),a=this.position.to.line===this.position.from.line?this.position.to.column:r,o="^".repeat(a-this.position.from.column);return i+o}};var _s=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(Sr))e[t]=0;for(let t of this.arguments){let r=t.getConfig();if(e[r.type]+=1,e[r.type]>1&&!r.allowMultiple)throw new sr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${r.type}' does not allow duplicates`,docs:[wt.linkToSearch(r.type)]})}}mergeByOverride(e){for(let t of e.arguments){let r=t.getConfig();r.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==r.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let r=t.getConfig();if(!r.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===r.type).length>0)throw new sr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(t)}return this.validate(),this}getAll(e){return this.arguments.filter(t=>t.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var As=class extends _s{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Ds=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(r=>r.length===e.length)===void 0)throw new sr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(r=>r.length===0?"none":r.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[wt.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 Es=class extends Ds{};var Ec=class extends Es{constructor(){super(...arguments);this.value=!0}_parseValue(t){var r;this.value=t[0]===void 0||((r=t[0])==null?void 0:r.value.toLowerCase())==="true"}getConfig(){return sc.renderMarkdown}};var Cc=class extends Es{constructor(){super(...arguments);this.value=!0}_parseValue(t){var r;this.value=t[0]===void 0||((r=t[0])==null?void 0:r.value.toLowerCase())==="true"}getConfig(){return sc.hidden}};var KA={renderMarkdown:Ec,hidden:Cc},Sc=class{static createViewFieldArgument(e){if(e in KA){let t=KA[e];if(t)return new t}throw new na({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var Nc=class{constructor(e,t,r){this.unvalidatedDeclaration=e,this.plugin=r,this.filePath=t,this.errorCollection=new vr("view field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,viewFieldType:t,writeToBindTarget:r,argumentContainer:i,templateDeclaration:a,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(o),o}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return"math";for(let t of Object.entries(Eu))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new Br("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be a view field type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.writeToBindTarget!==void 0)return this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let t=new As;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=Sc.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Br("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.fullDeclaration,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(xs))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Br("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}validateTemplateDeclaration(e){var t,r;try{return(r=(t=this.unvalidatedDeclaration.templateDeclaration)==null?void 0:t.map(i=>typeof i=="string"?i:this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,i,this.filePath,e)))!=null?r:[]}catch(i){return this.errorCollection.add(i),[]}}};var Mc=class{constructor(e){this.plugin=e}parseString(e,t,r){let i=new vr("ViewFieldDeclaration");try{let a=Jr(Sd,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],this.validateDeclaration(a,t,r)}catch(a){i.add(a)}return{fullDeclaration:e,errorCollection:i,templateDeclaration:[],viewFieldType:"invalid",argumentContainer:new As,writeToBindTarget:void 0}}parseStringWithoutValidation(e){let t=new vr("ViewFieldDeclaration");try{let r=Jr(Sd,e);return r.fullDeclaration=e,r.errorCollection=t,r.arguments=[...r.arguments],r}catch(r){t.add(r)}return{fullDeclaration:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}validateDeclaration(e,t,r){return new Nc(e,t,this.plugin).validate(r)}parseJsString(e,t){let r={};r.errorCollection=new vr("JsViewFieldDeclaration"),r.fullDeclaration=e;try{let i=Jr(QA,e);r.bindTargetMappings=i.bindTargetMappings.map(a=>({bindTarget:this.plugin.api.bindTargetParser.validateBindTarget(e,a.bindTarget,t),name:a.name})),i.writeToBindTarget!==void 0&&(r.writeToBindTarget=this.plugin.api.bindTargetParser.validateBindTarget(e,i.writeToBindTarget,t)),r.code=i.code}catch(i){r.errorCollection.add(i)}return r}};var Cs=class n{constructor(e){this.path=e}get(e){if(this.path.length===0)throw new Error("can not use empty path to access object");let t=this.path[0].get(e);for(let r of this.path.slice(1))t=r.get(t.child);return t}tryGet(e){try{return this.get(e)}catch(t){return}}set(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);for(let i of this.path.slice(1))r=i.get(r.child);r.access.set(r.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);r.child===void 0&&(r.access.set(r.parent,this.getNextPathElementValue(0,t)),r=r.access.get(r.parent));for(let i=1;ie.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new n(this.path.concat(e.path))}};var Tc=class{constructor(e){this.plugin=e}parseAndValidateBindTarget(e,t,r){return this.validateBindTarget(e,this.parseBindTarget(e),t,r)}parseBindTarget(e){return Jr(Vi,e)}validateBindTarget(e,t,r,i){let a={};if(a.storageProp=new Cs(t.storageProp.map(o=>new Ro(o.type,o.prop.value))),t.storageType===void 0?a.storageType="frontmatter":a.storageType=this.validateStorageType(t.storageType,e),a.storageType==="frontmatter")t.storagePath===void 0?a.storagePath=this.validateStoragePathAsFilePath({value:r},e):a.storagePath=this.validateStoragePathAsFilePath(t.storagePath,e);else if(a.storageType==="memory")t.storagePath===void 0?a.storagePath=this.validateStoragePathAsFilePath({value:r},e):a.storagePath=this.validateStoragePathAsFilePath(t.storagePath,e);else if(a.storageType==="globalMemory"){if(t.storagePath!==void 0)throw new Br("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type GLOBAL_MEMORY does not support a storage path.",e,t.storagePath.position);a.storagePath=""}else if(a.storageType==="scope"){if(t.storagePath!==void 0)throw new Br("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type SCOPE does not support a storage path.",e,t.storagePath.position);a.storagePath="",this.resolveScope(a,i)}return a.listenToChildren=t.listenToChildren,a}resolveScope(e,t){if(t===void 0)throw new Br("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return console.log("resolve scope",e,t.scope),e.storageType=t.scope.storageType,e.storagePath=t.scope.storagePath,e.storageProp=t.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,t){for(let r of Object.entries(Mu))if(r[1]===(e==null?void 0:e.value))return r[1];throw new Br("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e==null?void 0:e.value}'.`,t,e==null?void 0:e.position)}validateStoragePathAsFilePath(e,t){let r=e==null?void 0:e.value;if(r===void 0)throw new Br("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",t,e==null?void 0:e.position);let i=this.plugin.internal.getFilePathByName(r);if(i===void 0)throw new Br("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${r}' not found.`,t,e==null?void 0:e.position);return i}};var Ss=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=jt(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}notifyListeners(e){for(let t of this.listeners)t.callback(e)}},Or=class extends Ss{constructor(t){super();this.value=t}get(){return this.value}set(t){this.value=t,this.notifyListeners(t)}},Fc=class extends Ss{constructor(t,r){super();this.dependency=t,this.value=r(t.get()),this.dependencyListener=t.registerListener({callback:i=>this.set(r(i))})}get(){return this.value}set(t){this.value=t,this.notifyListeners(t)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};var Ns=class extends fn{};var Ms=class extends Ns{constructor(t,r,i,a,o,l){var u,s;super(t,r,a,o,l);if(this.errorCollection.merge(i.errorCollection),this.fullDeclaration=i.fullDeclaration,this.viewFieldDeclaration=i,this.variables=[],this.inputSignal=new Or(void 0),this.errorCollection.isEmpty())try{this.viewField=this.plugin.api.viewFieldFactory.createViewField(i.viewFieldType,this),this.variables=(s=(u=this.viewField)==null?void 0:u.buildVariables(this.viewFieldDeclaration))!=null?s:[]}catch(c){this.errorCollection.add(c)}}registerSelfToMetadataManager(){try{this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.uuid,this.inputSignal,this.viewFieldDeclaration.writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>{var t;return await((t=this.viewField)==null?void 0:t.computeValue(this.variables))},()=>this.unload()),this.inputSignal.registerListener({callback:t=>{var r;return void((r=this.viewField)==null?void 0:r.update(t))}})}catch(t){this.errorCollection.add(t)}}unregisterSelfFromMetadataManager(){var t;(t=this.metadataSubscription)==null||t.unsubscribe()}getArguments(t){if(this.viewFieldDeclaration.errorCollection.hasErrors())throw new ln({errorLevel:"ERROR",effect:"an not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.viewFieldDeclaration.argumentContainer.getAll(t)}getArgument(t){return this.getArguments(t).at(0)}onload(){var r;if(console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("mb-view"),this.containerEl.empty(),this.plugin.mdrcManager.registerMDRC(this),this.errorCollection.hasErrors()||this.registerSelfToMetadataManager(),new Jn({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.errorCollection.hasErrors())return;let t=createDiv();t.addClass("mb-view-wrapper"),(r=this.viewField)==null||r.render(t),this.containerEl.appendChild(t)}onunload(){var t;console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),(t=this.viewField)==null||t.destroy(),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind view field",cls:"mb-error"}),super.onunload()}};function Nd(n){var e;return(e=n.plugins.getPlugin("js-engine"))==null?void 0:e.api}var Ic=class extends Ns{constructor(t,r,i,a,o,l){var u;super(t,r,a,o,l);if(this.errorCollection.merge(i.errorCollection),this.fullDeclaration=i.fullDeclaration,this.viewFieldDeclaration=i,this.variables=[],this.file=this.plugin.app.vault.getAbstractFileByPath(this.filePath),this.errorCollection.isEmpty())try{for(let s of(u=this.viewFieldDeclaration.bindTargetMappings)!=null?u:[])this.variables.push({bindTargetDeclaration:s.bindTarget,inputSignal:new Or(void 0),uuid:jt(),contextName:s.name})}catch(s){this.errorCollection.add(s)}}buildContext(){var r,i;let t={};for(let a of(r=this.variables)!=null?r:[])!a.contextName||!a.inputSignal||(t[a.contextName]=(i=a.inputSignal.get())!=null?i:"");return t}async evaluateExpression(){if(!this.plugin.settings.enableJs)throw new bo({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS expressions are disabled in the plugin settings."});let t=Nd(this.plugin.app);if(t===void 0)throw new bo({errorLevel:"ERROR",effect:"can not evaluate js view field",cause:"js view fields need the JS Engine plugin to be installed"});return await t.internal.execute({code:this.viewFieldDeclaration.code,context:{file:this.file,line:0,metadata:this.plugin.app.metadataCache.getFileCache(this.file)},container:this.renderContainer,component:this,contextOverrides:{bound:this.buildContext()}})}registerSelfToMetadataManager(){let t=new Or(void 0);this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.uuid,t,this.viewFieldDeclaration.writeToBindTarget,this.variables.map(r=>({bindTarget:r.bindTargetDeclaration,callbackSignal:r.inputSignal})),async()=>await this.update(),()=>this.unload())}unregisterSelfFromMetadataManager(){var t;(t=this.metadataSubscription)==null||t.unsubscribe()}async onload(){if(console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("mb-view"),this.containerEl.empty(),this.plugin.mdrcManager.registerMDRC(this),Nd(this.plugin.app)===void 0&&this.errorCollection.add(new bo({errorLevel:"ERROR",effect:"can not create js view field",cause:"js view fields need the JS Engine plugin to be installed"})),new Jn({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.errorCollection.hasErrors())return;this.registerSelfToMetadataManager();let t=createDiv();t.addClass("mb-view-wrapper"),this.renderContainer=t,await this.update(),this.containerEl.appendChild(t)}onunload(){console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind view field",cls:"mb-error"}),super.onunload()}async update(){if(this.renderContainer)try{let t=Nd(this.plugin.app);if(t===void 0)throw new bo({errorLevel:"ERROR",effect:"can not evaluate js view field",cause:"js view fields need the JS Engine plugin to be installed"});let r=await this.evaluateExpression(),i=t.internal.createRenderer(this.renderContainer,this.filePath,this);return await i.render(r.result),i.renderToSimpleObject(r.result)}catch(t){t instanceof Error&&(this.renderContainer.innerText=t.message,this.renderContainer.addClass("mb-error"));return}}};var Ts=class extends _s{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Zt=class extends Ds{};var Bc=class extends Zt{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return tr.class}};var Oc=class extends Zt{constructor(){super(...arguments);this.value=!0}_parseValue(t){var r;this.value=t[0]===void 0||((r=t[0])==null?void 0:r.value.toLowerCase())==="true"}getConfig(){return tr.addLabels}};var Pc=class extends Zt{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return tr.minValue}};var Rc=class extends Zt{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return tr.maxValue}};var Ra=gr(ui()),Bu=gr(si());var En=gr(ui());var eD=gr(si());var uV=En.P.sequence(Fu,En.P.string("#").then(En.P.manyNotOf("[]#|^:")).optional(),En.P.string("|").then(En.P.manyNotOf("[]")).optional()),Md=En.P.or(En.P.sequenceMap((n,e)=>({isEmbed:n!==void 0,target:e[0],block:e[1],alias:e[2],internal:!0}),En.P.string("!").optional(),uV.wrapString("[[","]]")),En.P.sequenceMap((n,e,t)=>{let r=!Nu(t);return{isEmbed:n!==void 0,target:t,block:void 0,alias:e,internal:r}},En.P.string("!").optional(),En.P.manyNotOf("[]").wrapString("[","]"),En.P.manyNotOf("()").wrapString("(",")"))),lV=En.P.separateBy(Md,En.P.string(",").trim(eD.P_UTILS.optionalWhitespace())),tn=class n{static parseLink(e){return Jr(Md.thenEof(),e)}static parseLinkList(e){return Jr(lV.thenEof(),e)}static isLink(e){return Md.thenEof().tryParse(e).success}static urlToLink(e){return{isEmbed:!1,target:e.href,block:void 0,alias:e.hostname,internal:!1}}static parseLinkOrUrl(e){return Nu(e)?n.urlToLink(new URL(e)):n.parseLink(e)}};var rD=Ra.P.sequenceMap((n,e)=>n===void 0?e:-e,Ra.P.string("-").optional(),Ra.P.or(Ra.P.sequenceMap((n,e,t)=>Number(n+e+t),Bu.P_UTILS.digits(),Ra.P.string("."),Bu.P_UTILS.digits()),Bu.P_UTILS.digits().map(n=>Number(n)))).thenEof(),nD=Ra.P.sequenceMap((n,e)=>n===void 0?e:-e,Ra.P.string("-").optional(),Bu.P_UTILS.digits().map(n=>Number(n))).thenEof();function fa(n){if(n.toLowerCase()==="null")return null;if(n==="true")return!0;if(n==="false")return!1;{let e=rD.tryParse(n);return e.success?e.value:n}}function Ou(n){return n===void 0||n===null?"":typeof n=="string"?n:typeof n=="boolean"?n?"true":"false":n.toString()}function ka(n){return n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"}function Ui(n){if(n!==void 0){if(ka(n))return[n];if(typeof n=="object"&&Array.isArray(n))return n.filter(e=>ka(e))}}function Fs(n){if(typeof n=="number")return n;if(typeof n=="string"){let e=rD.tryParse(n);if(e.success)return e.value}}function Is(n){return ka(n)?Ou(n):void 0}function La(n){return ka(n)?n:void 0}function kc(n,e){return Array.isArray(n)?n.map(t=>Td(t,e)).filter(t=>t!=="").join(", "):Td(n,e)}function Td(n,e){return n==null?e?"":"null":typeof n=="function"?"":typeof n=="object"||Array.isArray(n)?JSON.stringify(n):n.toString()}function iD(n,e){return Array.isArray(n)?n.map(t=>tD(t,e)).filter(t=>t!==""):tD(n,e)}function tD(n,e){return typeof n=="string"?tn.isLink(n)?tn.parseLink(n):Nu(n)?tn.urlToLink(new URL(n)):n:Td(n,e)}var Lc=class extends Zt{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=fa(t[0].value),this.name=t[0].value):t.length===2&&(this.value=fa(t[0].value),this.name=t[1].value)}getConfig(){return tr.option}};var Vc=class extends Zt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return tr.title}};var Uc=class extends Zt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return tr.optionQuery}};var qc=class extends Zt{constructor(){super(...arguments);this.value=!0}_parseValue(t){var r;this.value=t[0]===void 0||((r=t[0])==null?void 0:r.value.toLowerCase())==="true"}getConfig(){return tr.showcase}};var zc=class extends Zt{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=fa(t[0].value)}getConfig(){return tr.offValue}};var $c=class extends Zt{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=fa(t[0].value)}getConfig(){return tr.onValue}};var Hc=class extends Zt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=fa(t[0].value)}getConfig(){return tr.defaultValue}};var Gc=class extends Zt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return tr.placeholder}};var Wc=class extends Zt{constructor(){super(...arguments);this.value=!0}_parseValue(t){var r;this.value=t[0]===void 0||((r=t[0])==null?void 0:r.value.toLowerCase())==="true"}getConfig(){return tr.useLinks}};var jc=class extends Zt{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return tr.stepSize}};var Zc=class extends Zt{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new sr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[wt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return tr.limit}};var aD={class:Bc,addLabels:Oc,minValue:Pc,maxValue:Rc,stepSize:jc,option:Lc,title:Vc,optionQuery:Uc,showcase:qc,offValue:zc,onValue:$c,defaultValue:Hc,placeholder:Gc,useLinks:Wc,limit:Zc},Jc=class{static createInputFieldArgument(e){if(e in aD){let t=aD[e];if(t)return new t}throw new na({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var Pu=class{constructor(e,t,r){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=r,this.errorCollection=new vr("input field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,inputFieldType:t,bindTarget:r,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let t of Object.entries(ys))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new Br("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be an input field type but received '${e==null?void 0:e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e==null?void 0:e.position)),"invalid"}checkForDeprecation(e){var t;(e.inputFieldType==="date_picker"||e.inputFieldType==="text_area"||e.inputFieldType==="multi_select")&&this.errorCollection.add(new Br("WARNING","Declaration Validator",`'${e.inputFieldType}' is deprecated, as it has been renamed to be in camel case ('input_field_type' => 'inputFieldType').`,this.unvalidatedDeclaration.fullDeclaration,(t=this.unvalidatedDeclaration.inputFieldType)==null?void 0:t.position))}validateBindTarget(e){if(this.unvalidatedDeclaration.bindTarget!==void 0)return this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}validateArguments(e){let t=new Ts;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=Jc.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Br("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.fullDeclaration,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(Sr))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Br("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}};var pr=gr(ui());var mn=gr(si());var cV=pr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},Dn.node(On).trim(mn.P_UTILS.optionalWhitespace()).describe("input field type"),Tu.trim(mn.P_UTILS.optionalWhitespace()).wrap(pr.P.string("(").describe('arguments paren "("'),pr.P.string(")").describe('arguments paren ")"')).trim(mn.P_UTILS.optionalWhitespace()).optional([]),pr.P.sequence(pr.P.string(":").trim(mn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Vi).trim(mn.P_UTILS.optionalWhitespace()).optional()),oD=pr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},Dn.node(On).trim(mn.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Tu.trim(mn.P_UTILS.optionalWhitespace()).wrap(pr.P.string("(").describe('arguments paren "("'),pr.P.string(")").describe('arguments paren ")"')).trim(mn.P_UTILS.optionalWhitespace()).optional([]),pr.P.sequence(pr.P.string(":").trim(mn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Vi).trim(mn.P_UTILS.optionalWhitespace()).optional()),Fd=pr.P.or(pr.P.sequenceMap((n,e,t)=>(t.templateName=e,t),pr.P.string("INPUT"),pr.P.sequenceMap((n,e,t)=>e,pr.P.string("["),WA.node(On).trim(mn.P_UTILS.optionalWhitespace()).describe("template name"),pr.P.string("]").skip(mn.P_UTILS.optionalWhitespace())),oD.wrap(pr.P.string("["),pr.P.string("]")),mn.P_UTILS.eof()),pr.P.sequenceMap((n,e)=>e,pr.P.string("INPUT"),cV.wrap(pr.P.string("["),pr.P.string("]")),mn.P_UTILS.eof())),sD=pr.P.sequenceMap((n,e)=>e,pr.P.string("INPUT"),oD.wrap(pr.P.string("["),pr.P.string("]")),mn.P_UTILS.eof());var Yc=class{constructor(e){this.plugin=e,this.templates=[]}parseString(e,t,r){let i=new vr("InputFieldParser");try{let a=Jr(Fd,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],a=this.applyTemplate(a),new Pu(this.plugin,a,t).validate(r)}catch(a){i.add(a)}return{fullDeclaration:e,inputFieldType:"invalid",bindTarget:void 0,argumentContainer:new Ts,errorCollection:i}}parseStringWithoutValidation(e){let t=new vr("InputFieldParser");try{let r=Jr(Fd,e);return r.fullDeclaration=e,r.errorCollection=t,r.arguments=[...r.arguments],r}catch(r){t.add(r)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}validateDeclaration(e,t,r){return new Pu(this.plugin,e,t).validate(r)}parseTemplateString(e){let t=new vr("InputFieldParser");try{let r=Jr(sD,e);return r.fullDeclaration=e,r.errorCollection=t,r.arguments=[...r.arguments],r}catch(r){t.add(r)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new vr("input field template parser");for(let r of e){let i=this.parseTemplateString(r.declaration);t.merge(i.errorCollection);let a={name:r.name,template:i};this.templates.push(Su(a))}return t}getTemplate(e){var t;return(t=this.templates.find(r=>r.name===e))==null?void 0:t.template}applyTemplate(e){if(e.templateName===void 0)return e;let t=this.getTemplate(e.templateName.value);return t===void 0?(e.errorCollection.add(new Br("WARNING","Input Field Parser",`Invalid template name. Could not find template with name '${e.templateName.value}'`,e.fullDeclaration,e.templateName.position,["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/"])),e):this.plugin.api.inputField.merge(t,e)}};var Xc=class{constructor(e){this.api=e}createInputFieldDeclaration(e,t){let r=new vr("input field declaration"),i=(t!=null?t:[]).map(a=>({name:{value:a.name},value:a.value.map(o=>({value:o}))}));return{fullDeclaration:"",inputFieldType:e?{value:e}:void 0,bindTarget:void 0,arguments:i,errorCollection:r}}createInputFieldDeclarationFromString(e){return this.api.inputFieldParser.parseStringWithoutValidation(e)}setType(e,t){return e.inputFieldType={value:t},e}setArguments(e,t){return e.arguments=t.map(r=>({name:{value:r.name},value:r.value.map(i=>({value:i}))})),e}addArgument(e,t){return Array.isArray(t)?e.arguments=e.arguments.concat(t.map(r=>({name:{value:r.name},value:r.value.map(i=>({value:i}))}))):e.arguments.push({name:{value:t.name},value:t.value.map(r=>({value:r}))}),e}setBindTargetFile(e,t){return e.bindTarget?e.bindTarget.storagePath={value:t}:e.bindTarget={storagePath:{value:t},storageProp:[],listenToChildren:!1},e}setBindTargetMetadataField(e,t){return typeof t=="string"&&(t=[t]),e.bindTarget?e.bindTarget.storageProp=t.map(r=>({type:"object",prop:{value:r}})):e.bindTarget={storagePath:void 0,storageProp:t.map(r=>({type:"object",prop:{value:r}})),listenToChildren:!1},e}setTemplateName(e,t){return e.templateName={value:t},e}applyTemplate(e){return this.api.inputFieldParser.applyTemplate(e)}getTemplate(e){return this.api.inputFieldParser.getTemplate(e)}merge(e,t){var i,a,o;let r={};return e.bindTarget===void 0?r=t.bindTarget:(r=e.bindTarget,((i=t.bindTarget)==null?void 0:i.storagePath)!==void 0&&(r.storagePath=t.bindTarget.storagePath),((a=t.bindTarget)==null?void 0:a.storageProp)!==void 0&&(r.storageProp=t.bindTarget.storageProp)),{fullDeclaration:t.fullDeclaration,inputFieldType:(o=t.inputFieldType)!=null?o:e.inputFieldType,bindTarget:r,arguments:t.arguments.concat(e.arguments).reduce((l,u)=>(l.find(s=>s.name===u.name)===void 0&&l.push(u),l),[]),errorCollection:new vr("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}};var Qc=class extends fn{onload(){console.log("meta-bind | ExcludedMDRC >> load",this),this.plugin.mdrcManager.registerMDRC(this),this.containerEl.empty(),this.containerEl.createEl("span",{text:"[META_BIND] This folder has been excluded in the settings",cls:"mb-error"})}onunload(){console.log("meta-bind | ExcludedMDRC >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this)}};var Kc=class{constructor(e){this.scope=e}};var uD=require("obsidian");function fV(n){let e,t;return{c(){e=j("td"),t=j("div")},m(r,i){Y(r,e,i),z(e,t),n[3](t)},p:Se,i:Se,o:Se,d(r){r&&J(e),n[3](null)}}}function pV(n,e,t){let{table:r}=e,{cell:i}=e,a,o;Kr(()=>{o=new uD.Component,o.load(),r.createCell(i,a,o)}),mo(()=>{o.unload()});function l(u){Fr[u?"unshift":"push"](()=>{a=u,t(0,a)})}return n.$$set=u=>{"table"in u&&t(1,r=u.table),"cell"in u&&t(2,i=u.cell)},[a,r,i,l]}var Id=class extends Ve{constructor(e){super(),qe(this,e,pV,fV,Ue,{table:1,cell:2})}},lD=Id;function cD(n,e,t){let r=n.slice();return r[7]=e[t],r}function fD(n,e,t){let r=n.slice();return r[10]=e[t],r[11]=e,r[12]=t,r}function pD(n,e,t){let r=n.slice();return r[13]=e[t],r}function mD(n){let e,t=n[13]+"",r;return{c(){e=j("th"),r=Pe(t)},m(i,a){Y(i,e,a),z(e,r)},p(i,a){a&2&&t!==(t=i[13]+"")&&rt(r,t)},d(i){i&&J(e)}}}function mV(n){let e,t,r;return{c(){e=j("td"),t=Pe("invalid data"),L(e,"class","meta-bind-error"),L(e,"colspan",r=n[1].length)},m(i,a){Y(i,e,a),z(e,t)},p(i,a){a&2&&r!==(r=i[1].length)&&L(e,"colspan",r)},i:Se,o:Se,d(i){i&&J(e)}}}function dV(n){let e,t,r=We(n[7].cells),i=[];for(let o=0;oae(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;oyo(e,"cell",i)),{c(){Fe(e.$$.fragment)},m(o,l){Me(e,o,l),r=!0},p(o,l){n=o;let u={};l&1&&(u.table=n[0]),!t&&l&4&&(t=!0,u.cell=n[10],go(()=>t=!1)),e.$set(u)},i(o){r||(te(e.$$.fragment,o),r=!0)},o(o){ae(e.$$.fragment,o),r=!1},d(o){Te(e,o)}}}function hV(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function hD(n,e){let t,r,i,a,o,l,u,s,c=[dV,mV],f=[];function p(h,d){return h[7].isValid?0:1}r=p(e,-1),i=f[r]=c[r](e);function m(){return e[5](e[7])}return l=new Ut({props:{$$slots:{default:[hV]},$$scope:{ctx:e}}}),l.$on("click",m),{key:n,first:null,c(){t=j("tr"),i.c(),a=fe(),o=j("td"),Fe(l.$$.fragment),u=fe(),this.first=t},m(h,d){Y(h,t,d),f[r].m(t,null),z(t,a),z(t,o),Me(l,o,null),z(t,u),s=!0},p(h,d){e=h;let g=r;r=p(e,d),r===g?f[r].p(e,d):(gt(),ae(f[g],1,1,()=>{f[g]=null}),vt(),i=f[r],i?i.p(e,d):(i=f[r]=c[r](e),i.c()),te(i,1),i.m(t,a));let y={};d&65536&&(y.$$scope={dirty:d,ctx:e}),l.$set(y)},i(h){s||(te(i),te(l.$$.fragment,h),s=!0)},o(h){ae(i),ae(l.$$.fragment,h),s=!1},d(h){h&&J(t),f[r].d(),Te(l)}}}function gV(n){let e;return{c(){e=Pe("Add Column")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function vV(n){let e,t,r,i,a,o,l,u,s=[],c=new Map,f,p,m,h=We(n[1]),d=[];for(let w=0;ww[7].index;for(let w=0;wr.removeColumn(c.index),s=()=>r.addColumn();return n.$$set=c=>{"table"in c&&t(0,r=c.table),"tableHead"in c&&t(1,i=c.tableHead)},[r,i,a,o,l,u,s]}var Bd=class extends Ve{constructor(e){super(),qe(this,e,yV,vV,Ue,{table:0,tableHead:1,updateTable:3})}get updateTable(){return this.$$.ctx[3]}},gD=Bd;function ef(n){return new Cs(n.map(e=>nD.tryParse(e).success?new Ro("array",e):new Ro("object",e)))}var tf=class extends fn{constructor(t,r,i,a,o,l,u,s){super(t,r,i,a,o);this.bindTarget=l,this.tableHead=u,this.columns=s,this.inputSignal=new Or(void 0),this.outputSignal=new Or(void 0),this.value=void 0}registerSelfToMetadataManager(){this.metadataManagerOutputSignalListener=this.outputSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.metadataSubscription=this.plugin.metadataManager.subscribe(this.uuid,this.inputSignal,this.bindTarget,()=>this.unload())}unregisterSelfFromMetadataManager(){var t;this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),(t=this.metadataSubscription)==null||t.unsubscribe()}updateMetadataManager(t){var r;(r=this.metadataSubscription)==null||r.update(t)}updateDisplayValue(t){var i;t=t!=null?t:[];let r=[];for(let a=0;a"inputFieldType"in u?(console.log("validate",u,this.filePath,o),this.plugin.api.inputFieldParser.validateDeclaration(u,this.filePath,o)):this.plugin.api.viewFieldParser.validateDeclaration(u,this.filePath,o));r.push({cells:l,index:a,value:t[a],isValid:!0})}else r.push({cells:[],index:a,value:t[a],isValid:!1});(i=this.tableComponent)==null||i.updateTable(r)}createCell(t,r,i){let a=jt();if("inputFieldType"in t){let o=new Po(r,"inline",t,this.plugin,this.filePath,`${this.uuid}/${a}`);i.addChild(o)}else{let o=new Ms(r,"inline",t,this.plugin,this.filePath,`${this.uuid}/${a}`);i.addChild(o)}}removeColumn(t){var r;this.value=(r=this.value)!=null?r:[],this.value.splice(t,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){var t;this.value=(t=this.value)!=null?t:[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onload(){this.plugin.mdrcManager.registerMDRC(this),this.tableComponent=new gD({target:this.containerEl,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:t=>{this.value=t,this.updateDisplayValue(t)}}),this.registerSelfToMetadataManager()}onunload(){var t;this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),(t=this.tableComponent)==null||t.$destroy()}};var rf=class extends Ss{constructor(t){super();this.mounted=!1,this.svelteComponent=t}setValue(t){var r;(r=this.svelteComponentInstance)==null||r.setValue(t)}mount(t,r,i={}){let a=Object.assign({value:r,onValueChange:o=>{this.notifyListeners(o)}},i);this.svelteComponentInstance=new this.svelteComponent({target:t,props:a}),this.mounted=!0}unmount(){var t;this.listeners=[],(t=this.svelteComponentInstance)==null||t.$destroy(),this.mounted=!1}isMounted(){return this.mounted}};var Bt=class{constructor(e){this.base=e,this.inputSignal=new Or(void 0),this.inputFieldComponent=new rf(this.getSvelteComponent()),this.computedSignal=new Fc(this.inputSignal,t=>{let r=this.filterValue(t);return r!==void 0?r:this.getDefaultValue()})}destroy(){this.inputFieldComponent.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let r=this.rawReverseMapValue(this.getDefaultValue());return r!==void 0?r:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.computedSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.computedSignal.set(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){var t;(t=this.metadataSubscription)==null||t.update(e)}getDefaultValue(){let e=this.base.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let t=this.filterValue(e.value);return t!==void 0?t:this.mapValue(this.getFallbackDefaultValue())}getMountArgs(){return{}}mount(e){this.computedSignal.registerListener({callback:r=>this.inputFieldComponent.setValue(this.reverseMapValue(r))});let t=this.base.getBindTarget();t&&(this.inputFieldComponent.registerListener({callback:r=>{this.notifySubscription(this.mapValue(r))}}),this.metadataSubscription=this.base.plugin.metadataManager.subscribe(this.base.getUuid(),this.inputSignal,t,()=>this.base.unload())),this.inputFieldComponent.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}unmount(){var e;this.computedSignal.listeners=[],(e=this.metadataSubscription)==null||e.unsubscribe(),this.inputFieldComponent.unmount()}onmount(){}onunmount(){}};function xV(n){let e,t,r,i;return{c(){e=j("div"),t=j("input"),L(t,"type","checkbox"),L(t,"tabindex","-1"),t.checked=n[0],L(e,"class","checkbox-container"),L(e,"role","switch"),L(e,"tabindex","0"),L(e,"aria-checked",n[0]),_t(e,"is-enabled",n[0])},m(a,o){Y(a,e,o),z(e,t),r||(i=[be(e,"click",n[5]),be(e,"keypress",n[6])],r=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&L(e,"aria-checked",a[0]),o&1&&_t(e,"is-enabled",a[0])},i:Se,o:Se,d(a){a&&J(e),r=!1,at(i)}}}function bV(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(c){t(0,r=c)}function o(){t(0,r=!r),console.log("toggle"),i(r)}function l(c){c.key===" "&&o()}let u=()=>o(),s=c=>l(c);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"onValueChange"in c&&t(3,i=c.onValueChange)},[r,o,l,i,a,u,s]}var Od=class extends Ve{constructor(e){super(),qe(this,e,bV,xV,Ue,{value:0,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},vD=Od;var nf=class extends Bt{constructor(t){var r,i,a,o;super(t);this.onValue=(i=(r=this.base.getArgument("onValue"))==null?void 0:r.value)!=null?i:!0,this.offValue=(o=(a=this.base.getArgument("offValue"))==null?void 0:a.value)!=null?o:!1}filterValue(t){return t===this.onValue||t===this.offValue?La(t):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return vD}rawReverseMapValue(t){return t===this.onValue?!0:(t===this.offValue,!1)}rawMapValue(t){return t?this.onValue:this.offValue}};function yD(n){let e,t=xD(n[0].length,n[2])+"",r,i;return{c(){e=j("span"),r=Pe(t),L(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){Y(a,e,o),z(e,r)},p(a,o){o&5&&t!==(t=xD(a[0].length,a[2])+"")&&rt(r,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&L(e,"class",i)},d(a){a&&J(e)}}}function wV(n){let e,t,r,i,a,o=n[2]!==void 0&&yD(n);return{c(){e=j("input"),t=fe(),o&&o.c(),r=or(),L(e,"type","text"),L(e,"tabindex","0"),L(e,"placeholder",n[1]),L(e,"maxlength",n[2])},m(l,u){Y(l,e,u),Xe(e,n[0]),Y(l,t,u),o&&o.m(l,u),Y(l,r,u),i||(a=[be(e,"input",n[5]),be(e,"input",n[6])],i=!0)},p(l,[u]){u&2&&L(e,"placeholder",l[1]),u&4&&L(e,"maxlength",l[2]),u&1&&e.value!==l[0]&&Xe(e,l[0]),l[2]!==void 0?o?o.p(l,u):(o=yD(l),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null)},i:Se,o:Se,d(l){l&&(J(e),J(t),J(r)),o&&o.d(l),i=!1,at(a)}}}function xD(n,e){let t=e.toString();return`${n.toString().padStart(t.length,"0")}/${t}`}function _V(n,e,t){let{value:r}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,r=c)}function u(){r=this.value,t(0,r)}let s=()=>o(r);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"placeholder"in c&&t(1,i=c.placeholder),"limit"in c&&t(2,a=c.limit),"onValueChange"in c&&t(3,o=c.onValueChange)},[r,i,a,o,l,u,s]}var Pd=class extends Ve{constructor(e){super(),qe(this,e,_V,wV,Ue,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},bD=Pd;var af=class extends Bt{constructor(e){super(e)}filterValue(e){return Is(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return bD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,r;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(r=this.base.getArgument("limit"))==null?void 0:r.value}}};function AV(n){let e,t,r;return{c(){e=j("input"),L(e,"class","mb-slider-input"),L(e,"type","range"),L(e,"tabindex","0"),L(e,"min",n[1]),L(e,"max",n[2]),L(e,"step",n[3])},m(i,a){Y(i,e,a),Xe(e,n[0]),t||(r=[be(e,"change",n[9]),be(e,"input",n[9]),be(e,"input",n[10])],t=!0)},p(i,a){a&2&&L(e,"min",i[1]),a&4&&L(e,"max",i[2]),a&8&&L(e,"step",i[3]),a&1&&Xe(e,i[0])},d(i){i&&J(e),t=!1,at(r)}}}function DV(n){let e,t,r,i,a,o,l,u,s;return{c(){e=j("span"),t=Pe(n[1]),r=fe(),i=j("input"),a=fe(),o=j("span"),l=Pe(n[2]),L(e,"class","mb-slider-input-label"),L(i,"class","mb-slider-input"),L(i,"type","range"),L(i,"tabindex","0"),L(i,"min",n[1]),L(i,"max",n[2]),L(i,"step",n[3]),L(o,"class","mb-slider-input-label")},m(c,f){Y(c,e,f),z(e,t),Y(c,r,f),Y(c,i,f),Xe(i,n[0]),Y(c,a,f),Y(c,o,f),z(o,l),u||(s=[be(i,"change",n[7]),be(i,"input",n[7]),be(i,"input",n[8])],u=!0)},p(c,f){f&2&&rt(t,c[1]),f&2&&L(i,"min",c[1]),f&4&&L(i,"max",c[2]),f&8&&L(i,"step",c[3]),f&1&&Xe(i,c[0]),f&4&&rt(l,c[2])},d(c){c&&(J(e),J(r),J(i),J(a),J(o)),u=!1,at(s)}}}function EV(n){let e;function t(a,o){return a[4]?DV:AV}let r=t(n,-1),i=r(n);return{c(){i.c(),e=or()},m(a,o){i.m(a,o),Y(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Se,o:Se,d(a){a&&J(e),i.d(a)}}}function CV(n,e,t){let{value:r}=e,{minValue:i}=e,{maxValue:a}=e,{stepSize:o}=e,{addLabels:l}=e,{onValueChange:u}=e;function s(h){t(0,r=h)}function c(){r=ai(this.value),t(0,r)}let f=()=>u(r);function p(){r=ai(this.value),t(0,r)}let m=()=>u(r);return n.$$set=h=>{"value"in h&&t(0,r=h.value),"minValue"in h&&t(1,i=h.minValue),"maxValue"in h&&t(2,a=h.maxValue),"stepSize"in h&&t(3,o=h.stepSize),"addLabels"in h&&t(4,l=h.addLabels),"onValueChange"in h&&t(5,u=h.onValueChange)},[r,i,a,o,l,u,s,c,f,p,m]}var Rd=class extends Ve{constructor(e){super(),qe(this,e,CV,EV,Ue,{value:0,minValue:1,maxValue:2,stepSize:3,addLabels:4,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},wD=Rd;var of=class extends Bt{constructor(t){var r,i,a,o,l,u;super(t);if(this.minValue=(i=(r=this.base.getArgument("minValue"))==null?void 0:r.value)!=null?i:0,this.maxValue=(o=(a=this.base.getArgument("maxValue"))==null?void 0:a.value)!=null?o:100,this.stepSize=(u=(l=this.base.getArgument("stepSize"))==null?void 0:l.value)!=null?u:1,this.minValue>=this.maxValue)throw new sr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(t){return cc(Fs(t),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return wD}rawReverseMapValue(t){return t}rawMapValue(t){return t}getMountArgs(){var t;return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:((t=this.base.getArgument("addLabels"))==null?void 0:t.value)===!0}}};function SV(n){let e,t,r;return{c(){e=j("textarea"),L(e,"tabindex","0"),L(e,"placeholder",n[1]),L(e,"maxlength",n[2])},m(i,a){Y(i,e,a),Xe(e,n[0]),t||(r=[be(e,"input",n[5]),be(e,"input",n[6])],t=!0)},p(i,[a]){a&2&&L(e,"placeholder",i[1]),a&4&&L(e,"maxlength",i[2]),a&1&&Xe(e,i[0])},i:Se,o:Se,d(i){i&&J(e),t=!1,at(r)}}}function NV(n,e,t){let{value:r}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,r=c)}function u(){r=this.value,t(0,r)}let s=()=>o(r);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"placeholder"in c&&t(1,i=c.placeholder),"limit"in c&&t(2,a=c.limit),"onValueChange"in c&&t(3,o=c.onValueChange)},[r,i,a,o,l,u,s]}var kd=class extends Ve{constructor(e){super(),qe(this,e,NV,SV,Ue,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},_D=kd;var Ru=class extends Bt{constructor(e){super(e)}filterValue(e){return Is(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return _D}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,r;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(r=this.base.getArgument("limit"))==null?void 0:r.value}}};function MV(n){let e,t;return{c(){e=j("a"),t=Pe(n[2]),L(e,"data-href",n[2]),L(e,"href",n[2]),L(e,"class",n[1]),L(e,"target","_blank"),L(e,"rel","noopener")},m(r,i){Y(r,e,i),z(e,t)},p(r,i){i&4&&rt(t,r[2]),i&4&&L(e,"data-href",r[2]),i&4&&L(e,"href",r[2]),i&2&&L(e,"class",r[1])},d(r){r&&J(e)}}}function TV(n){let e,t=n[0].alias+"",r;return{c(){e=j("a"),r=Pe(t),L(e,"data-href",n[2]),L(e,"href",n[2]),L(e,"class",n[1]),L(e,"target","_blank"),L(e,"rel","noopener"),L(e,"aria-label",n[2])},m(i,a){Y(i,e,a),z(e,r)},p(i,a){a&1&&t!==(t=i[0].alias+"")&&rt(r,t),a&4&&L(e,"data-href",i[2]),a&4&&L(e,"href",i[2]),a&2&&L(e,"class",i[1]),a&4&&L(e,"aria-label",i[2])},d(i){i&&J(e)}}}function FV(n){let e;function t(a,o){return a[0].alias?TV:MV}let r=t(n,-1),i=r(n);return{c(){i.c(),e=or()},m(a,o){i.m(a,o),Y(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Se,o:Se,d(a){a&&J(e),i.d(a)}}}function IV(n,e,t){let r,i,{mdLink:a}=e;return n.$$set=o=>{"mdLink"in o&&t(0,a=o.mdLink)},n.$$.update=()=>{n.$$.dirty&1&&t(2,r=a.block?`${a.target}#${a.block}`:a.target),n.$$.dirty&1&&t(1,i=a.internal?"internal-link":"external-link")},[a,i,r]}var Ld=class extends Ve{constructor(e){super(),qe(this,e,IV,FV,Ue,{mdLink:0})}},Va=Ld;var BV=n=>({element:n&1}),AD=n=>({element:n[0][n[0].length-1]});function DD(n,e,t){let r=n.slice();return r[3]=e[t],r}var OV=n=>({element:n&1}),ED=n=>({element:n[3]});function CD(n){let e,t,r,i,a,o=n[2].default,l=Qi(o,n,n[1],ED);return{c(){l&&l.c(),e=fe(),t=j("span"),t.textContent=",",r=fe(),i=j("span")},m(u,s){l&&l.m(u,s),Y(u,e,s),Y(u,t,s),Y(u,r,s),Y(u,i,s),a=!0},p(u,s){l&&l.p&&(!a||s&3)&&ea(l,o,u,u[1],a?Ki(o,u[1],s,OV):ta(u[1]),ED)},i(u){a||(te(l,u),a=!0)},o(u){ae(l,u),a=!1},d(u){u&&(J(e),J(t),J(r),J(i)),l&&l.d(u)}}}function PV(n){let e,t,r=We(n[0].slice(0,n[0].length-1)),i=[];for(let u=0;uae(i[u],1,1,()=>{i[u]=null}),o=n[2].default,l=Qi(o,n,n[1],AD);return{c(){for(let u=0;u{"elements"in o&&t(0,a=o.elements),"$$scope"in o&&t(1,i=o.$$scope)},[a,i,r]}var Vd=class extends Ve{constructor(e){super(),qe(this,e,RV,PV,Ue,{elements:0})}},sf=Vd;function kV(n){let e,t,r;return t=new Va({props:{mdLink:n[0]}}),{c(){e=j("span"),Fe(t.$$.fragment)},m(i,a){Y(i,e,a),Me(t,e,null),r=!0},p(i,a){let o={};a&1&&(o.mdLink=i[0]),t.$set(o)},i(i){r||(te(t.$$.fragment,i),r=!0)},o(i){ae(t.$$.fragment,i),r=!1},d(i){i&&J(e),Te(t)}}}function LV(n){let e,t,r;return t=new sf({props:{elements:n[0],$$slots:{default:[zV,({element:i})=>({2:i}),({element:i})=>i?4:0]},$$scope:{ctx:n}}}),{c(){e=j("span"),Fe(t.$$.fragment)},m(i,a){Y(i,e,a),Me(t,e,null),r=!0},p(i,a){let o={};a&1&&(o.elements=i[0]),a&12&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(te(t.$$.fragment,i),r=!0)},o(i){ae(t.$$.fragment,i),r=!1},d(i){i&&J(e),Te(t)}}}function VV(n){let e,t;return{c(){e=j("span"),t=Pe(n[0])},m(r,i){Y(r,e,i),z(e,t)},p(r,i){i&1&&rt(t,r[0])},i:Se,o:Se,d(r){r&&J(e)}}}function UV(n){let e,t;return e=new Va({props:{mdLink:n[2]}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&4&&(a.mdLink=r[2]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function qV(n){let e,t=n[2]+"",r;return{c(){e=j("span"),r=Pe(t)},m(i,a){Y(i,e,a),z(e,r)},p(i,a){a&4&&t!==(t=i[2]+"")&&rt(r,t)},i:Se,o:Se,d(i){i&&J(e)}}}function zV(n){let e,t,r,i,a=[qV,UV],o=[];function l(u,s){return typeof u[2]=="string"?0:1}return e=l(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=or()},m(u,s){o[e].m(u,s),Y(u,r,s),i=!0},p(u,s){let c=e;e=l(u,s),e===c?o[e].p(u,s):(gt(),ae(o[c],1,1,()=>{o[c]=null}),vt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),te(t,1),t.m(r.parentNode,r))},i(u){i||(te(t),i=!0)},o(u){ae(t),i=!1},d(u){u&&J(r),o[e].d(u)}}}function $V(n){let e,t,r,i,a,o=[VV,LV,kV],l=[];function u(s,c){return c&1&&(e=null),typeof s[0]=="string"?0:(e==null&&(e=!!Array.isArray(s[0])),e?1:2)}return t=u(n,-1),r=l[t]=o[t](n),{c(){r.c(),i=or()},m(s,c){l[t].m(s,c),Y(s,i,c),a=!0},p(s,[c]){let f=t;t=u(s,c),t===f?l[t].p(s,c):(gt(),ae(l[f],1,1,()=>{l[f]=null}),vt(),r=l[t],r?r.p(s,c):(r=l[t]=o[t](s),r.c()),te(r,1),r.m(i.parentNode,i))},i(s){a||(te(r),a=!0)},o(s){ae(r),a=!1},d(s){s&&J(i),l[t].d(s)}}}function HV(n,e,t){let r,{value:i=void 0}=e;return n.$$set=a=>{"value"in a&&t(1,i=a.value)},n.$$.update=()=>{n.$$.dirty&2&&t(0,r=iD(i))},[r,i]}var Ud=class extends Ve{constructor(e){super(),qe(this,e,HV,$V,Ue,{value:1})}},ci=Ud;function SD(n,e,t){let r=n.slice();return r[8]=e[t],r}function ND(n){let e,t,r,i,a,o;t=new ci({props:{value:n[8].name}});function l(){return n[6](n[8])}function u(...s){return n[7](n[8],...s)}return{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),L(e,"class","mb-select-input-element"),L(e,"role","button"),L(e,"tabindex","0"),_t(e,"is-selected",n[8].value===n[0])},m(s,c){Y(s,e,c),Me(t,e,null),z(e,r),i=!0,a||(o=[be(e,"click",l),be(e,"keypress",u)],a=!0)},p(s,c){n=s;let f={};c&2&&(f.value=n[8].name),t.$set(f),(!i||c&3)&&_t(e,"is-selected",n[8].value===n[0])},i(s){i||(te(t.$$.fragment,s),i=!0)},o(s){ae(t.$$.fragment,s),i=!1},d(s){s&&J(e),Te(t),a=!1,at(o)}}}function GV(n){let e,t,r=We(n[1]),i=[];for(let o=0;oae(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;ol(f.value),c=(f,p)=>u(p,f.value);return n.$$set=f=>{"value"in f&&t(0,r=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[r,i,l,u,a,o,s,c]}var qd=class extends Ve{constructor(e){super(),qe(this,e,WV,GV,Ue,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},MD=qd;var uf=class extends Bt{constructor(t){super(t);this.options=this.base.getArguments("option")}filterValue(t){return La(t)}getFallbackDefaultValue(){return null}getSvelteComponent(){return MD}rawMapValue(t){return t}rawReverseMapValue(t){return t}getMountArgs(){return{options:this.options}}};function TD(n,e,t){let r=n.slice();return r[8]=e[t],r}function FD(n){let e,t,r,i,a,o;t=new ci({props:{value:n[8].name}});function l(){return n[6](n[8])}function u(...s){return n[7](n[8],...s)}return{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),L(e,"class","mb-select-input-element"),L(e,"role","button"),L(e,"tabindex","0"),_t(e,"is-selected",n[0].includes(n[8].value))},m(s,c){Y(s,e,c),Me(t,e,null),z(e,r),i=!0,a||(o=[be(e,"click",l),be(e,"keypress",u)],a=!0)},p(s,c){n=s;let f={};c&2&&(f.value=n[8].name),t.$set(f),(!i||c&3)&&_t(e,"is-selected",n[0].includes(n[8].value))},i(s){i||(te(t.$$.fragment,s),i=!0)},o(s){ae(t.$$.fragment,s),i=!1},d(s){s&&J(e),Te(t),a=!1,at(o)}}}function jV(n){let e,t,r=We(n[1]),i=[];for(let o=0;oae(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;op!==f)):(r.push(f),t(0,r)),a(r)}function u(f,p){f.key===" "&&l(p)}let s=f=>l(f.value),c=(f,p)=>u(p,f.value);return n.$$set=f=>{"value"in f&&t(0,r=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[r,i,l,u,a,o,s,c]}var zd=class extends Ve{constructor(e){super(),qe(this,e,ZV,jV,Ue,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},ID=zd;var ku=class extends Bt{constructor(t){super(t);this.options=this.base.getArguments("option")}filterValue(t){return Ui(t)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return ID}rawMapValue(t){return t}rawReverseMapValue(t){return t}getMountArgs(){return{options:this.options}}};function JV(n){jr(n,"svelte-f2wb67",".date-picker-input.svelte-f2wb67{background:var(--background-modifier-form-field);border-radius:var(--mb-border-radius);border:var(--mb-border-width) solid var(--background-modifier-border);padding:5px 5px 5px 7px;cursor:pointer;position:relative;color:var(--text-normal);display:inline-flex;align-items:center;gap:5px;font-size:var(--font-ui-small)}.date-picker-text.svelte-f2wb67{display:inline-block}")}function YV(n){let e,t,r=(n[0]?n[0].format(n[1]):"none")+"",i,a,o,l,u,s;return o=new ur({props:{iconName:"calendar"}}),{c(){e=j("div"),t=j("span"),i=Pe(r),a=fe(),Fe(o.$$.fragment),L(t,"class","date-picker-text svelte-f2wb67"),L(e,"class","date-picker-input svelte-f2wb67"),L(e,"role","button"),L(e,"tabindex","0")},m(c,f){Y(c,e,f),z(e,t),z(t,i),z(e,a),Me(o,e,null),l=!0,u||(s=[be(e,"click",n[2]),be(e,"keydown",n[3])],u=!0)},p(c,[f]){(!l||f&3)&&r!==(r=(c[0]?c[0].format(c[1]):"none")+"")&&rt(i,r)},i(c){l||(te(o.$$.fragment,c),l=!0)},o(c){ae(o.$$.fragment,c),l=!1},d(c){c&&J(e),Te(o),u=!1,at(s)}}}function XV(n,e,t){let{value:r}=e,{dateFormat:i}=e,{showDatePicker:a}=e,{onValueChange:o}=e;function l(c){t(0,r=c)}function u(c){a()}function s(c){c.key===" "&&a()}return n.$$set=c=>{"value"in c&&t(0,r=c.value),"dateFormat"in c&&t(1,i=c.dateFormat),"showDatePicker"in c&&t(4,a=c.showDatePicker),"onValueChange"in c&&t(5,o=c.onValueChange)},[r,i,u,s,a,o,l]}var $d=class extends Ve{constructor(e){super(),qe(this,e,XV,YV,Ue,{value:0,dateFormat:1,showDatePicker:4,onValueChange:5,setValue:6},JV)}get setValue(){return this.$$.ctx[6]}},BD=$d;var Lu=class extends Bt{constructor(t){super(t);this.options=this.base.getArguments("option")}filterValue(t){if(t===null)return null;if(t===void 0||typeof t!="string")return;let r=Vr.parse(t);if(r.isValid())return Vr.stringify(r)}getFallbackDefaultValue(){return Vr.getDefaultDate()}getSvelteComponent(){return BD}rawMapValue(t){return t===null?null:Vr.stringify(t)}rawReverseMapValue(t){if(t===null)return null;let r=Vr.parse(t);if(r.isValid())return r}getMountArgs(){return{dateFormat:this.base.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.base.plugin.internal.openDatePickerModal(this)}}}};function QV(n){let e,t,r;return{c(){e=j("input"),L(e,"type","number"),L(e,"tabindex","0"),L(e,"placeholder",n[1])},m(i,a){Y(i,e,a),Xe(e,n[0]),t||(r=[be(e,"input",n[4]),be(e,"input",n[5])],t=!0)},p(i,[a]){a&2&&L(e,"placeholder",i[1]),a&1&&ai(e.value)!==i[0]&&Xe(e,i[0])},i:Se,o:Se,d(i){i&&J(e),t=!1,at(r)}}}function KV(n,e,t){let{value:r}=e,{placeholder:i}=e,{onValueChange:a}=e;function o(s){t(0,r=s)}function l(){r=ai(this.value),t(0,r)}let u=()=>a(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"placeholder"in s&&t(1,i=s.placeholder),"onValueChange"in s&&t(2,a=s.onValueChange)},[r,i,a,o,l,u]}var Hd=class extends Ve{constructor(e){super(),qe(this,e,KV,QV,Ue,{value:0,placeholder:1,onValueChange:2,setValue:3})}get setValue(){return this.$$.ctx[3]}},OD=Hd;var lf=class extends Bt{constructor(e){super(e)}filterValue(e){return Fs(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return OD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e;return{placeholder:(e=this.base.getArgument("placeholder"))!=null?e:"Number"}}};function e9(n){let e,t;return{c(){e=j("span"),t=Pe(n[1])},m(r,i){Y(r,e,i),z(e,t)},p(r,i){i&2&&rt(t,r[1])},i:Se,o:Se,d(r){r&&J(e)}}}function t9(n){let e,t,r;function i(o){n[9](o)}let a={};return n[0]!==void 0&&(a.mdLink=n[0]),e=new Va({props:a}),Fr.push(()=>yo(e,"mdLink",i)),{c(){Fe(e.$$.fragment)},m(o,l){Me(e,o,l),r=!0},p(o,l){let u={};!t&&l&1&&(t=!0,u.mdLink=o[0],go(()=>t=!1)),e.$set(u)},i(o){r||(te(e.$$.fragment,o),r=!0)},o(o){ae(e.$$.fragment,o),r=!1},d(o){Te(e,o)}}}function r9(n){let e,t,r,i,a,o,l,u,s,c=[t9,e9],f=[];function p(m,h){return m[2]?0:1}return r=p(n,-1),i=f[r]=c[r](n),o=new ur({props:{iconName:"list"}}),{c(){e=j("div"),t=j("div"),i.c(),a=fe(),Fe(o.$$.fragment),L(t,"class","mb-suggest-text"),L(e,"class","mb-suggest-input"),L(e,"role","button"),L(e,"tabindex","0")},m(m,h){Y(m,e,h),z(e,t),f[r].m(t,null),z(e,a),Me(o,e,null),l=!0,u||(s=[be(e,"click",n[3]),be(e,"keydown",n[4])],u=!0)},p(m,[h]){let d=r;r=p(m,h),r===d?f[r].p(m,h):(gt(),ae(f[d],1,1,()=>{f[d]=null}),vt(),i=f[r],i?i.p(m,h):(i=f[r]=c[r](m),i.c()),te(i,1),i.m(t,null))},i(m){l||(te(i),te(o.$$.fragment,m),l=!0)},o(m){ae(i),ae(o.$$.fragment,m),l=!1},d(m){m&&J(e),f[r].d(),Te(o),u=!1,at(s)}}}function n9(n,e,t){let{value:r}=e,{showSuggester:i}=e,{onValueChange:a}=e,o,l,u=!1;Kr(()=>{s(r)});function s(m){var h;let d=(h=m==null?void 0:m.toString())!==null&&h!==void 0?h:"null";if(t(2,u=tn.isLink(d)),u)try{t(0,o=tn.parseLink(d))}catch(g){console.warn(g)}else t(1,l=d)}function c(m){m.target instanceof HTMLAnchorElement||i()}function f(m){m.key===" "&&i()}function p(m){o=m,t(0,o)}return n.$$set=m=>{"value"in m&&t(5,r=m.value),"showSuggester"in m&&t(6,i=m.showSuggester),"onValueChange"in m&&t(7,a=m.onValueChange)},[o,l,u,c,f,r,i,a,s,p]}var Gd=class extends Ve{constructor(e){super(),qe(this,e,n9,r9,Ue,{value:5,showSuggester:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},PD=Gd;var cf=class extends Bt{constructor(e){super(e)}filterValue(e){return La(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return PD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}};function i9(n){jr(n,"svelte-1aj1f3m",".editor-input.svelte-1aj1f3m.svelte-1aj1f3m{background:var(--background-secondary);width:100%;height:500px;padding:0;position:relative;margin-left:0}.editor-input.svelte-1aj1f3m>textarea.svelte-1aj1f3m{background:var(--background-secondary);border:none;padding:var(--size-4-4) var(--size-4-8);margin:0;position:absolute;inset:0;resize:none}.editor-input.svelte-1aj1f3m>div.svelte-1aj1f3m{padding:var(--size-4-4) var(--size-4-8);position:absolute;inset:0}")}function a9(n){let e,t,r,i,a,o;return{c(){e=j("div"),t=j("textarea"),r=fe(),i=j("div"),L(t,"class","svelte-1aj1f3m"),L(i,"class","svelte-1aj1f3m"),L(e,"class","editor-input card svelte-1aj1f3m"),L(e,"role","button"),L(e,"tabindex","0")},m(l,u){Y(l,e,u),z(e,t),n[9](t),Xe(t,n[0]),z(e,r),z(e,i),n[13](i),a||(o=[be(t,"input",n[10]),be(t,"focusout",n[11]),be(t,"input",n[12]),be(e,"click",n[14]),be(e,"keypress",n[15])],a=!0)},p(l,[u]){u&1&&Xe(t,l[0])},i:Se,o:Se,d(l){l&&J(e),n[9](null),n[13](null),a=!1,at(o)}}}function o9(n,e,t){let{value:r}=e,{onValueChange:i}=e,{render:a}=e,o,l;Kr(()=>{o.toggleVisibility(!0),l.toggleVisibility(!1),a(o,r)});function u(v){t(0,r=v),a(o,v)}function s(){o.toggleVisibility(!0),l.toggleVisibility(!1),a(o,r)}function c(){console.log("focus in"),o.toggleVisibility(!1),l.toggleVisibility(!0),l.focus()}function f(v){v.key===" "&&c()}function p(v){Fr[v?"unshift":"push"](()=>{l=v,t(3,l)})}function m(){r=this.value,t(0,r)}let h=()=>s(),d=()=>i(r);function g(v){Fr[v?"unshift":"push"](()=>{o=v,t(2,o)})}let y=()=>c(),w=v=>f(v);return n.$$set=v=>{"value"in v&&t(0,r=v.value),"onValueChange"in v&&t(1,i=v.onValueChange),"render"in v&&t(7,a=v.render)},[r,i,o,l,s,c,f,a,u,p,m,h,d,g,y,w]}var Wd=class extends Ve{constructor(e){super(),qe(this,e,o9,a9,Ue,{value:0,onValueChange:1,render:7,setValue:8},i9)}get setValue(){return this.$$.ctx[8]}},RD=Wd;var ff=class extends Bt{constructor(t){super(t)}filterValue(t){return ka(t)?t==null?void 0:t.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return RD}rawReverseMapValue(t){return t}rawMapValue(t){return t}getMountArgs(){return{render:(t,r)=>void this.renderInElement(t,r)}}async renderInElement(t,r){var i;(i=this.mdUnloadCallback)==null||i.call(this),t.innerHTML="",this.mdUnloadCallback=await this.base.plugin.internal.renderMarkdown(r,t,this.base.getFilePath())}onunmount(){var t;super.onunmount(),(t=this.mdUnloadCallback)==null||t.call(this)}};var{window:Vu}=vu;function s9(n){let e,t,r,i,a,o,l,u,s,c,f,p,m,h;return{c(){e=j("div"),t=j("div"),i=fe(),a=j("span"),o=Pe(n[0]),l=fe(),u=j("span"),s=Pe(n[1]),c=fe(),f=j("span"),p=Pe(n[2]),L(t,"class","mb-progress-bar-progress"),L(t,"style",r=`width: ${n[5](n[0])}%`),L(t,"role","slider"),L(t,"aria-valuemin",n[1]),L(t,"aria-valuemax",n[2]),L(t,"aria-valuenow",n[0]),L(t,"tabindex","0"),L(a,"class","mb-progress-bar-value"),L(u,"class","mb-progress-bar-label-left"),L(f,"class","mb-progress-bar-label-right"),L(e,"class","mb-progress-bar-input"),L(e,"tabindex","0"),L(e,"role","button")},m(d,g){Y(d,e,g),z(e,t),z(e,i),z(e,a),z(a,o),z(e,l),z(e,u),z(u,s),z(e,c),z(e,f),z(f,p),n[14](e),m||(h=[be(Vu,"touchmove",n[8],{passive:!1}),be(Vu,"touchcancel",n[6]),be(Vu,"touchend",n[6]),be(Vu,"mousemove",n[8]),be(Vu,"mouseup",n[6]),be(t,"dragstart",n[13]),be(e,"keydown",n[9]),be(e,"mousedown",n[7]),be(e,"touchstart",n[7])],m=!0)},p(d,[g]){g&1&&r!==(r=`width: ${d[5](d[0])}%`)&&L(t,"style",r),g&2&&L(t,"aria-valuemin",d[1]),g&4&&L(t,"aria-valuemax",d[2]),g&1&&L(t,"aria-valuenow",d[0]),g&1&&rt(o,d[0]),g&2&&rt(s,d[1]),g&4&&rt(p,d[2])},i:Se,o:Se,d(d){d&&J(e),n[14](null),m=!1,at(h)}}}function u9(n,e){return Number.parseFloat((Math.round(n/e)*e).toFixed(15))}function l9(n,e,t){let{onValueChange:r}=e,{value:i}=e,{minValue:a}=e,{maxValue:o}=e,{stepSize:l}=e,u=!1,s,c=0,f;function p(D){t(0,i=D)}function m(D){t(0,i=D),r(D)}function h(D){return D=Cu(D,a,o),ld(D,a,o,0,100)}function d(){t(3,u=!0)}function g(){t(3,u=!1)}function y(D){d(),w(D)}function w(D){if(!u)return;D.stopPropagation&&D.stopPropagation(),D.preventDefault&&D.preventDefault();let C=D instanceof TouchEvent?D.touches[0].clientX:D.clientX;v(C)}function v(D){let C=s.getBoundingClientRect();D=Cu(D,C.left,C.right);let A=ld(D,C.left,C.right,a,o);A=u9(A,l),m(A)}function x(D){c<50&&(c+=1);let C=Math.ceil(c/5);if(D.key==="ArrowUp"||D.key==="ArrowRight"){let A=Cu(i+C,a,o);m(A)}if(D.key==="ArrowDown"||D.key==="ArrowLeft"){let A=Cu(i-C,a,o);m(A)}window.clearTimeout(f),f=window.setTimeout(()=>c=1,100)}let _=()=>t(3,u=!0);function b(D){Fr[D?"unshift":"push"](()=>{s=D,t(4,s)})}return n.$$set=D=>{"onValueChange"in D&&t(10,r=D.onValueChange),"value"in D&&t(0,i=D.value),"minValue"in D&&t(1,a=D.minValue),"maxValue"in D&&t(2,o=D.maxValue),"stepSize"in D&&t(11,l=D.stepSize)},[i,a,o,u,s,h,g,y,w,x,r,l,p,_,b]}var jd=class extends Ve{constructor(e){super(),qe(this,e,l9,s9,Ue,{onValueChange:10,value:0,minValue:1,maxValue:2,stepSize:11,setValue:12})}get setValue(){return this.$$.ctx[12]}},kD=jd;var pf=class extends Bt{constructor(t){var r,i,a,o,l,u;super(t);if(this.minValue=(i=(r=this.base.getArgument("minValue"))==null?void 0:r.value)!=null?i:0,this.maxValue=(o=(a=this.base.getArgument("maxValue"))==null?void 0:a.value)!=null?o:100,this.stepSize=(u=(l=this.base.getArgument("stepSize"))==null?void 0:l.value)!=null?u:1,this.minValue>=this.maxValue)throw new sr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(t){return cc(Fs(t),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return kD}rawReverseMapValue(t){return t}rawMapValue(t){return t}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};function LD(n,e,t){let r=n.slice();return r[7]=e[t],r}function VD(n){let e,t=n[7].name+"",r,i;return{c(){e=j("option"),r=Pe(t),e.__value=i=n[7].value,Xe(e,e.__value)},m(a,o){Y(a,e,o),z(e,r)},p(a,o){o&2&&t!==(t=a[7].name+"")&&rt(r,t),o&2&&i!==(i=a[7].value)&&(e.__value=i,Xe(e,e.__value))},d(a){a&&J(e)}}}function c9(n){let e,t,r,i=We(n[1]),a=[];for(let o=0;on[5].call(e))},m(o,l){Y(o,e,l);for(let u=0;ul();return n.$$set=c=>{"value"in c&&t(0,r=c.value),"options"in c&&t(1,i=c.options),"onValueChange"in c&&t(3,a=c.onValueChange)},[r,i,l,a,o,u,s]}var Zd=class extends Ve{constructor(e){super(),qe(this,e,f9,c9,Ue,{value:0,options:1,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},UD=Zd;var mf=class extends Bt{constructor(t){super(t);this.options=this.base.getArguments("option")}filterValue(t){return La(t)}getFallbackDefaultValue(){return null}getSvelteComponent(){return UD}rawMapValue(t){return t}rawReverseMapValue(t){return t}getMountArgs(){return{options:this.options}}};function Bs(n){return app.vault.adapter.getResourcePath(n)}function qD(n){var e;return(e=n.plugins.getPlugin("dataview"))==null?void 0:e.api}function p9(n){jr(n,"svelte-hrm3dz",".mb-image-suggest-input.svelte-hrm3dz{background:var(--background-secondary);border-radius:var(--mb-border-radius);border:var(--mb-border-width) solid var(--background-modifier-border);padding:var(--size-4-2);width:100%}.mb-image-suggest-image.svelte-hrm3dz{width:100%;height:fit-content;max-height:500px;object-fit:contain}.mb-image-suggest-footer.svelte-hrm3dz{display:flex;flex-direction:row;color:var(--text-normal);align-items:baseline}.mb-image-suggest-footer-text.svelte-hrm3dz{flex:1;margin-left:var(--size-4-2)}")}function zD(n){let e,t;return{c(){e=j("img"),L(e,"class","mb-image-suggest-image svelte-hrm3dz"),rs(e.src,t=Bs(n[0]))||L(e,"src",t),L(e,"alt",n[0])},m(r,i){Y(r,e,i)},p(r,i){i&1&&!rs(e.src,t=Bs(r[0]))&&L(e,"src",t),i&1&&L(e,"alt",r[0])},d(r){r&&J(e)}}}function m9(n){let e,t,r,i,a=(n[0]||"no image selected")+"",o,l,u,s,c,f=n[0]&&zD(n);return{c(){e=j("div"),f&&f.c(),t=fe(),r=j("div"),i=j("span"),o=Pe(a),l=fe(),u=j("button"),u.textContent="Change Image",L(i,"class","mb-image-suggest-footer-text svelte-hrm3dz"),L(u,"class","btn btn-active"),L(r,"class","mb-image-suggest-footer svelte-hrm3dz"),L(e,"class","mb-image-suggest-input svelte-hrm3dz")},m(p,m){Y(p,e,m),f&&f.m(e,null),z(e,t),z(e,r),z(r,i),z(i,o),z(r,l),z(r,u),s||(c=[be(u,"click",n[1]),be(u,"keydown",n[2])],s=!0)},p(p,[m]){p[0]?f?f.p(p,m):(f=zD(p),f.c(),f.m(e,t)):f&&(f.d(1),f=null),m&1&&a!==(a=(p[0]||"no image selected")+"")&&rt(o,a)},i:Se,o:Se,d(p){p&&J(e),f&&f.d(),s=!1,at(c)}}}function d9(n,e,t){let{value:r}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(s){t(0,r=s)}function l(s){i()}function u(s){s.key===" "&&i()}return n.$$set=s=>{"value"in s&&t(0,r=s.value),"showSuggester"in s&&t(3,i=s.showSuggester),"onValueChange"in s&&t(4,a=s.onValueChange)},[r,l,u,i,a,o]}var Jd=class extends Ve{constructor(e){super(),qe(this,e,d9,m9,Ue,{value:0,showSuggester:3,onValueChange:4,setValue:5},p9)}get setValue(){return this.$$.ctx[5]}},$D=Jd;var df=class extends Bt{constructor(e){super(e)}filterValue(e){return ka(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return $D}rawMapValue(e){return e}rawReverseMapValue(e){return Ou(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};function HD(n,e,t){let r=n.slice();return r[11]=e[t],r[13]=t,r}function GD(n){let e;return{c(){e=j("span"),e.textContent="Empty",L(e,"class","mb-list-empty")},m(t,r){Y(t,e,r)},p:Se,d(t){t&&J(e)}}}function h9(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function WD(n){let e,t,r,i,a,o;t=new ci({props:{value:n[11]}});function l(){return n[8](n[13])}return i=new Ut({props:{$$slots:{default:[h9]},$$scope:{ctx:n}}}),i.$on("click",l),{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),Fe(i.$$.fragment),a=fe(),L(e,"class","mb-list-item")},m(u,s){Y(u,e,s),Me(t,e,null),z(e,r),Me(i,e,null),z(e,a),o=!0},p(u,s){n=u;let c={};s&1&&(c.value=n[11]),t.$set(c);let f={};s&16384&&(f.$$scope={dirty:s,ctx:n}),i.$set(f)},i(u){o||(te(t.$$.fragment,u),te(i.$$.fragment,u),o=!0)},o(u){ae(t.$$.fragment,u),ae(i.$$.fragment,u),o=!1},d(u){u&&J(e),Te(t),Te(i)}}}function jD(n){let e,t=ZD(n[0].length,n[1])+"",r,i;return{c(){e=j("span"),r=Pe(t),L(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[1]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){Y(a,e,o),z(e,r)},p(a,o){o&3&&t!==(t=ZD(a[0].length,a[1])+"")&&rt(r,t),o&3&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[1]?"mb-content-limit-indicator-overflow":""}`)&&L(e,"class",i)},d(a){a&&J(e)}}}function g9(n){let e,t;return e=new ur({props:{iconName:"plus"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function v9(n){let e,t,r,i,a,o,l,u,s,c,f=We(n[0]),p=[];for(let g=0;gae(p[g],1,1,()=>{p[g]=null}),h=null;f.length||(h=GD(n));let d=n[1]!==void 0&&jD(n);return l=new Ut({props:{disabled:!n[3],$$slots:{default:[g9]},$$scope:{ctx:n}}}),l.$on("click",n[10]),{c(){e=j("div");for(let g=0;gc(h);function p(){l=this.value,t(3,l)}let m=()=>s();return n.$$set=h=>{"value"in h&&t(0,r=h.value),"limit"in h&&t(1,i=h.limit),"placeholder"in h&&t(2,a=h.placeholder),"onValueChange"in h&&t(6,o=h.onValueChange)},[r,i,a,l,s,c,o,u,f,p,m]}var Yd=class extends Ve{constructor(e){super(),qe(this,e,y9,v9,Ue,{value:0,limit:1,placeholder:2,onValueChange:6,setValue:7})}get setValue(){return this.$$.ctx[7]}},JD=Yd;var hf=class extends Bt{constructor(e){super(e)}filterValue(e){return Ui(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return JD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){var e,t,r;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"New Entry...",limit:(r=this.base.getArgument("limit"))==null?void 0:r.value}}};function YD(n,e,t){let r=n.slice();return r[9]=e[t],r[11]=t,r}function XD(n){let e;return{c(){e=j("span"),e.textContent="Empty",L(e,"class","mb-list-empty")},m(t,r){Y(t,e,r)},p:Se,d(t){t&&J(e)}}}function x9(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function QD(n){let e,t,r,i,a,o;t=new ci({props:{value:n[9]}});function l(){return n[8](n[11])}return i=new Ut({props:{$$slots:{default:[x9]},$$scope:{ctx:n}}}),i.$on("click",l),{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),Fe(i.$$.fragment),a=fe(),L(e,"class","mb-list-item")},m(u,s){Y(u,e,s),Me(t,e,null),z(e,r),Me(i,e,null),z(e,a),o=!0},p(u,s){n=u;let c={};s&1&&(c.value=n[9]),t.$set(c);let f={};s&4096&&(f.$$scope={dirty:s,ctx:n}),i.$set(f)},i(u){o||(te(t.$$.fragment,u),te(i.$$.fragment,u),o=!0)},o(u){ae(t.$$.fragment,u),ae(i.$$.fragment,u),o=!1},d(u){u&&J(e),Te(t),Te(i)}}}function b9(n){let e,t,r,i,a,o,l,u,s,c,f=We(n[0]),p=[];for(let d=0;dae(p[d],1,1,()=>{p[d]=null}),h=null;return f.length||(h=XD(n)),l=new ur({props:{iconName:"list"}}),{c(){e=j("div");for(let d=0;dAdd Element...",o=fe(),Fe(l.$$.fragment),L(e,"class","mb-list-items"),L(a,"class","mb-suggest-text"),L(i,"class","mb-suggest-input"),L(i,"role","button"),L(i,"tabindex","0"),L(r,"class","mb-list-input")},m(d,g){Y(d,e,g);for(let y=0;yu(p);return n.$$set=p=>{"value"in p&&t(0,r=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[r,u,s,c,i,a,o,l,f]}var Xd=class extends Ve{constructor(e){super(),qe(this,e,w9,b9,Ue,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},KD=Xd;var gf=class extends Bt{constructor(e){super(e)}filterValue(e){return Ui(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return KD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}};function eE(n,e,t){let r=n.slice();return r[26]=e[t][0],r[27]=e[t][1],r}function tE(n,e,t){let r=n.slice();return r[23]=e[t],r}function rE(n,e,t){let r=n.slice();return r[23]=e[t],r}function nE(n,e,t){let r=n.slice();return r[26]=e[t][0],r[27]=e[t][1],r}function _9(n){let e,t,r,i,a,o=We(Object.values(n[2])),l=[];for(let c=0;cn[16].call(e)),L(r,"class","dropdown mb-input-element-group-element"),n[4]===void 0&&Zr(()=>n[18].call(r))},m(c,f){Y(c,e,f);for(let p=0;pn[12].call(e)),L(r,"class","dropdown mb-input-element-group-element"),n[5]===void 0&&Zr(()=>n[14].call(r))},m(c,f){Y(c,e,f);for(let p=0;p{t(1,o={0:"January",1:"February",2:"March",3:"April",4:"May",5:"June",6:"July",7:"August",8:"September",9:"October",10:"November",11:"December"});for(let E=1;E<=31;E++)t(2,l[E.toString()]=E.toString(),l);t(3,u=r.year().toString()),t(4,s=r.month().toString()),t(5,c=r.date().toString())});function f(E){t(9,r=E),t(3,u=r.year().toString()),t(4,s=r.month().toString()),t(5,c=r.date().toString())}function p(){let E=Number.parseInt(u),F=Number.isNaN(E)?Vr.getDefaultYear():E;r.year(F),a(r)}function m(){r.month(s);let E=d(r.date());r.date(E),t(5,c=E.toString()),a(r)}function h(){let E=Number.parseInt(c),F=d(E);r.date(F),t(5,c=F.toString()),a(r)}function d(E){return Number.isNaN(E)?Vr.getDefaultDay():E<1?1:E>r.daysInMonth()?r.daysInMonth():E}function g(){s=Wn(this),t(4,s),t(1,o)}let y=()=>m();function w(){c=Wn(this),t(5,c),t(2,l)}let v=()=>h();function x(){c=Wn(this),t(5,c),t(2,l)}let _=()=>h();function b(){s=Wn(this),t(4,s),t(1,o)}let D=()=>m();function C(){u=ai(this.value),t(3,u)}let A=()=>p();return n.$$set=E=>{"value"in E&&t(9,r=E.value),"useUsInputOrder"in E&&t(0,i=E.useUsInputOrder),"onValueChange"in E&&t(10,a=E.onValueChange)},[i,o,l,u,s,c,p,m,h,r,a,f,g,y,w,v,x,_,b,D,C,A]}var Qd=class extends Ve{constructor(e){super(),qe(this,e,E9,D9,Ue,{value:9,useUsInputOrder:0,onValueChange:10,setValue:11},null,[-1,-1])}get setValue(){return this.$$.ctx[11]}},uE=Qd;var vf=class extends Bt{constructor(e){super(e)}filterValue(e){if(e==null||typeof e!="string")return;let t=Vr.parse(e);if(t.isValid())return Vr.stringify(t)}getFallbackDefaultValue(){return Vr.getDefaultDate()}getSvelteComponent(){return uE}rawMapValue(e){return Vr.stringify(e)}rawReverseMapValue(e){return Vr.parse(e)}getMountArgs(){return{useUsInputOrder:this.base.plugin.settings.useUsDateInputOrder}}};var Kd=gr(ui()),Uu=gr(si()),eh=class{constructor(){this._hour=Qn.getDefaultHour(),this._minute=Qn.getDefaultHour()}getHour(){return this._hour}setHour(e){if(e<0||e>24){this._hour=Qn.getDefaultHour();return}this._hour=e}getMinute(){return this._minute}setMinute(e){if(e<0||e>59){this._minute=Qn.getDefaultMinute();return}this._minute=e}getUniformHour(){return this.getHour().toString().padStart(2,"0")}getUniformMinute(){return this.getMinute().toString().padStart(2,"0")}setHourFromString(e){let t=Number.parseInt(e);this.setHour(Number.isNaN(t)?Qn.getDefaultHour():t)}setMinuteFromString(e){let t=Number.parseInt(e);this.setMinute(Number.isNaN(t)?Qn.getDefaultMinute():t)}},C9=Kd.P.sequenceMap((n,e,t,r,i)=>({hour:Number.parseInt(n+e),minute:Number.parseInt(r+i)}),Uu.P_UTILS.digit(),Uu.P_UTILS.digit(),Kd.P.string(":"),Uu.P_UTILS.digit(),Uu.P_UTILS.digit()),Qn=class n{static parse(e){if(!e)return;let t=n.getDefaultTime(),r=C9.tryParse(e);if(r.success&&!(Number.isNaN(r.value.hour)||Number.isNaN(r.value.minute))&&!(r.value.hour<0||r.value.hour>=24)&&!(r.value.minute<0||r.value.minute>=60))return t.setHour(r.value.hour),t.setMinute(r.value.minute),t}static stringify(e){return`${e.getUniformHour()}:${e.getUniformMinute()}`}static getDefaultTime(){return new eh}static getDefaultHour(){return 0}static getDefaultMinute(){return 0}};function lE(n,e,t){let r=n.slice();return r[13]=e[t][0],r[14]=e[t][1],r}function cE(n,e,t){let r=n.slice();return r[17]=e[t][0],r[18]=e[t][1],r}function fE(n){let e,t=n[18]+"",r,i;return{c(){e=j("option"),r=Pe(t),e.__value=i=n[17],Xe(e,e.__value)},m(a,o){Y(a,e,o),z(e,r)},p(a,o){o&1&&t!==(t=a[18]+"")&&rt(r,t),o&1&&i!==(i=a[17])&&(e.__value=i,Xe(e,e.__value))},d(a){a&&J(e)}}}function pE(n){let e,t=n[14]+"",r,i;return{c(){e=j("option"),r=Pe(t),e.__value=i=n[13],Xe(e,e.__value)},m(a,o){Y(a,e,o),z(e,r)},p(a,o){o&2&&t!==(t=a[14]+"")&&rt(r,t),o&2&&i!==(i=a[13])&&(e.__value=i,Xe(e,e.__value))},d(a){a&&J(e)}}}function S9(n){let e,t,r,i,a,o,l=We(Object.entries(n[0])),u=[];for(let f=0;fn[9].call(t)),L(i,"class","dropdown mb-input-element-group-element"),n[3]===void 0&&Zr(()=>n[11].call(i)),L(e,"class","mb-input-element-group")},m(f,p){Y(f,e,p),z(e,t);for(let m=0;m{for(let g=0;g<=24;g++)t(0,a[g.toString()]=g.toString().padStart(2,"0"),a);for(let g=0;g<=59;g++)t(1,o[g.toString()]=g.toString().padStart(2,"0"),o);t(3,u=r.getMinute().toString()),t(2,l=r.getHour().toString())});function s(g){t(6,r=g),t(3,u=r.getMinute().toString()),t(2,l=r.getHour().toString())}function c(){r.setMinuteFromString(u),i(r)}function f(){r.setHourFromString(l),i(r)}function p(){l=Wn(this),t(2,l),t(0,a)}let m=()=>f();function h(){u=Wn(this),t(3,u),t(1,o)}let d=()=>c();return n.$$set=g=>{"value"in g&&t(6,r=g.value),"onValueChange"in g&&t(7,i=g.onValueChange)},[a,o,l,u,c,f,r,i,s,p,m,h,d]}var th=class extends Ve{constructor(e){super(),qe(this,e,N9,S9,Ue,{value:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},mE=th;var yf=class extends Bt{constructor(e){super(e)}filterValue(e){let t=Is(e);return Qn.parse(t)?t:void 0}getFallbackDefaultValue(){return Qn.getDefaultTime()}getSvelteComponent(){return mE}rawMapValue(e){return Qn.stringify(e)}rawReverseMapValue(e){return Qn.parse(e)}};function dE(n,e,t){let r=n.slice();return r[9]=e[t],r[11]=t,r}function hE(n){let e,t,r,i,a,o,l,u;t=new ci({props:{value:n[9]}}),a=new ur({props:{iconName:"x"}});function s(){return n[8](n[11])}return{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),i=j("button"),Fe(a.$$.fragment),L(i,"class","mb-inline-list-item-button"),L(e,"class","mb-inline-list-item")},m(c,f){Y(c,e,f),Me(t,e,null),z(e,r),z(e,i),Me(a,i,null),o=!0,l||(u=be(i,"click",s),l=!0)},p(c,f){n=c;let p={};f&1&&(p.value=n[9]),t.$set(p)},i(c){o||(te(t.$$.fragment,c),te(a.$$.fragment,c),o=!0)},o(c){ae(t.$$.fragment,c),ae(a.$$.fragment,c),o=!1},d(c){c&&J(e),Te(t),Te(a),l=!1,u()}}}function M9(n){let e,t,r,i,a,o,l,u,s,c=We(n[0]),f=[];for(let m=0;mae(f[m],1,1,()=>{f[m]=null});return o=new ur({props:{iconName:"plus"}}),{c(){e=j("div");for(let m=0;mu(p);return n.$$set=p=>{"value"in p&&t(0,r=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[r,u,s,c,i,a,o,l,f]}var rh=class extends Ve{constructor(e){super(),qe(this,e,T9,M9,Ue,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},gE=rh;var xf=class extends Bt{constructor(e){super(e)}filterValue(e){return Ui(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return gE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}};function vE(n,e,t){let r=n.slice();return r[9]=e[t],r[11]=t,r}function yE(n){let e,t,r,i,a,o,l,u;t=new ci({props:{value:n[9]}}),a=new ur({props:{iconName:"x"}});function s(){return n[8](n[11])}return{c(){e=j("div"),Fe(t.$$.fragment),r=fe(),i=j("button"),Fe(a.$$.fragment),L(i,"class","mb-inline-list-item-button"),L(e,"class","mb-inline-list-item")},m(c,f){Y(c,e,f),Me(t,e,null),z(e,r),z(e,i),Me(a,i,null),o=!0,l||(u=be(i,"click",s),l=!0)},p(c,f){n=c;let p={};f&1&&(p.value=n[9]),t.$set(p)},i(c){o||(te(t.$$.fragment,c),te(a.$$.fragment,c),o=!0)},o(c){ae(t.$$.fragment,c),ae(a.$$.fragment,c),o=!1},d(c){c&&J(e),Te(t),Te(a),l=!1,u()}}}function F9(n){let e,t,r,i,a,o,l,u,s,c=We(n[0]),f=[];for(let m=0;mae(f[m],1,1,()=>{f[m]=null});return o=new ur({props:{iconName:"plus"}}),{c(){e=j("div");for(let m=0;mu(p);return n.$$set=p=>{"value"in p&&t(0,r=p.value),"showInput"in p&&t(4,i=p.showInput),"onValueChange"in p&&t(5,a=p.onValueChange)},[r,u,s,c,i,a,o,l,f]}var nh=class extends Ve{constructor(e){super(),qe(this,e,I9,F9,Ue,{value:0,showInput:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},xE=nh;var bf=class extends Bt{constructor(e){super(e)}filterValue(e){return Ui(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return xE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.base.plugin.internal.openTextPromptModal("","Meta Bind List","New List Element","",e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},()=>{})}};var wf=class{constructor(e){this.plugin=e}createInputField(e,t,r){if(e!=="invalid"&&this.checkRenderChildTypeAllowed(e,t),e==="toggle")return new nf(r);if(e==="slider")return new of(r);if(e==="text")return new af(r);if(e==="textArea")return new Ru(r);if(e==="text_area")return new Ru(r);if(e==="select")return new uf(r);if(e==="multiSelect")return new ku(r);if(e==="multi_select")return new ku(r);if(e==="datePicker")return new Lu(r);if(e==="date_picker")return new Lu(r);if(e==="number")return new lf(r);if(e==="suggester")return new cf(r);if(e==="editor")return new ff(r);if(e==="progressBar")return new pf(r);if(e==="inlineSelect")return new mf(r);if(e==="imageSuggester")return new df(r);if(e==="list")return new hf(r);if(e==="listSuggester")return new gf(r);if(e==="date")return new vf(r);if(e==="time")return new yf(r);if(e==="inlineListSuggester")return new xf(r);if(e==="inlineList")return new bf(r)}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let r=IA[e];if(t==="block"&&!r.allowInBlock)throw new na({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[wt.linkToInputField(e)]});if(t==="inline"&&!r.allowInline)throw new na({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[wt.linkToInputField(e)]})}};var Ua=class{constructor(e){this.renderChild=e,this.hidden=!1}async render(e){var t,r;this.container=e,this.container.addClass("mb-view-text"),this.hidden=(r=(t=this.renderChild.getArgument("hidden"))==null?void 0:t.value)!=null?r:!1,this.hidden&&this.container.addClass("mb-view-hidden"),await this._render(e),await this.update(this.getDefaultDisplayValue())}async update(e){var t;if(this.container&&!this.hidden){let r=(t=kc(e,this.renderChild.plugin.settings.viewFieldDisplayNullAsEmpty))!=null?t:"";this.container.empty(),await this._update(this.container,r)}}};function mr(){return mr=Object.assign?Object.assign.bind():function(n){for(var e=1;e0?1:n<0?-1:0},RE=Math.log2||function(e){return Math.log(e)/Math.LN2},kE=Math.log10||function(e){return Math.log(e)/Math.LN10},Ef=Math.log1p||function(n){return Math.log(n+1)},LE=Math.cbrt||function(e){if(e===0)return e;var t=e<0,r;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},VE=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function uh(n,e,t){var r={2:"0b",8:"0o",16:"0x"},i=r[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ze(t))throw new Error("size must be an integer");if(n>2**(t-1)-1||n<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!ze(n))throw new Error("Value must be an integer");n<0&&(n=n+2**t),a="i".concat(t)}var o="";return n<0&&(n=-n,o="-"),"".concat(o).concat(i).concat(n.toString(e)).concat(a)}function Ni(n,e){if(typeof e=="function")return e(n);if(n===1/0)return"Infinity";if(n===-1/0)return"-Infinity";if(isNaN(n))return"NaN";var t="auto",r,i;if(e&&(e.notation&&(t=e.notation),nt(e)?r=e:nt(e.precision)&&(r=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(t){case"fixed":return lh(n,r);case"exponential":return UE(n,r);case"engineering":return O9(n,r);case"bin":return uh(n,2,i);case"oct":return uh(n,8,i);case"hex":return uh(n,16,i);case"auto":return P9(n,r,e&&e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Cf(n){var e=String(n).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+n);var t=e[1],r=e[2],i=parseFloat(e[4]||"0"),a=r.indexOf(".");i+=a!==-1?a-1:r.length-1;var o=r.replace(".","").replace(/^0*/,function(l){return i-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return o.length===0&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function O9(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=Cf(n),r=Sf(t,e),i=r.exponent,a=r.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(nt(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var l=Math.abs(i-o)-(a.length-1),u=0;u0;)c++,s--;var f=a.slice(c).join(""),p=nt(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,c).join("")+p+"e"+(i>=0?"+":"")+o.toString();return r.sign+m}function lh(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=Cf(n),r=typeof e=="number"?Sf(t,t.exponent+1+e):t,i=r.coefficients,a=r.exponent+1,o=a+(e||0);return i.length0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function P9(n,e,t){if(isNaN(n)||!isFinite(n))return String(n);var r=t&&t.lowerExp!==void 0?t.lowerExp:-3,i=t&&t.upperExp!==void 0?t.upperExp:5,a=Cf(n),o=e?Sf(a,e):a;if(o.exponent=i)return UE(n,e);var l=o.coefficients,u=o.exponent;l.length0?u:0;return se){var i=r.splice(e,r.length-e);if(i[0]>=5){var a=e-1;for(r[a]++;r[a]===10;)r.pop(),a===0&&(r.unshift(0),t.exponent++,a++),a--,r[a]++}}return t}function Ps(n){for(var e=[],t=0;t0?!0:n<0?!1:1/n===1/0,r=e>0?!0:e<0?!1:1/e===1/0;return t^r?-n:n}function ch(n,e,t){var r=n.constructor,i=new r(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ze(t))throw new Error("size must be an integer");if(n.greaterThan(i.pow(t-1).sub(1))||n.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!n.isInteger())throw new Error("Value must be an integer");n.lessThan(0)&&(n=n.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(n.toBinary()).concat(a);case 8:return"".concat(n.toOctal()).concat(a);case 16:return"".concat(n.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function ZE(n,e){if(typeof e=="function")return e(n);if(!n.isFinite())return n.isNaN()?"NaN":n.gt(0)?"Infinity":"-Infinity";var t="auto",r,i;if(e!==void 0&&(e.notation&&(t=e.notation),typeof e=="number"?r=e:e.precision!==void 0&&(r=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(t){case"fixed":return L9(n,r);case"exponential":return jE(n,r);case"engineering":return k9(n,r);case"bin":return ch(n,2,i);case"oct":return ch(n,8,i);case"hex":return ch(n,16,i);case"auto":{var a=e&&e.lowerExp!==void 0?e.lowerExp:-3,o=e&&e.upperExp!==void 0?e.upperExp:5;if(n.isZero())return"0";var l,u=n.toSignificantDigits(r),s=u.e;return s>=a&&s=0?"+":"")+r.toString()}function jE(n,e){return e!==void 0?n.toExponential(e-1):n.toExponential()}function L9(n,e){return n.toFixed(e)}function YE(n,e){var t=n.length-e.length,r=n.length;return n.substring(t,r)===e}function it(n,e){var t=V9(n,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function V9(n,e){if(typeof n=="number")return Ni(n,e);if(tt(n))return ZE(n,e);if(U9(n))return!e||e.fraction!=="decimal"?n.s*n.n+"/"+n.d:n.toString();if(Array.isArray(n))return XE(n,e);if(xr(n))return Vo(n);if(typeof n=="function")return n.syntax?String(n.syntax):"function";if(n&&typeof n=="object"){if(typeof n.format=="function")return n.format(e);if(n&&n.toString(e)!=={}.toString())return n.toString(e);var t=Object.keys(n).map(r=>Vo(r)+": "+it(n[r],e));return"{"+t.join(", ")+"}"}return String(n)}function Vo(n){for(var e=String(n),t="",r=0;r/g,">"),e}function XE(n,e){if(Array.isArray(n)){for(var t="[",r=n.length,i=0;ie?1:-1}function ot(n,e,t){if(!(this instanceof ot))throw new SyntaxError("Constructor must be called with the new operator");this.actual=n,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(n)?"["+n.join(", ")+"]":n)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}ot.prototype=new RangeError;ot.prototype.constructor=RangeError;ot.prototype.name="DimensionError";ot.prototype.isDimensionError=!0;function on(n,e,t){if(!(this instanceof on))throw new SyntaxError("Constructor must be called with the new operator");this.index=n,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}on.prototype=new RangeError;on.prototype.constructor=RangeError;on.prototype.name="IndexError";on.prototype.isIndexError=!0;function et(n){for(var e=[];Array.isArray(n);)e.push(n.length),n=n[0];return e}function QE(n,e,t){var r,i=n.length;if(i!==e[t])throw new ot(i,e[t]);if(t")}function ph(n,e){var t=e.length===0;if(t){if(Array.isArray(n))throw new ot(n.length,0)}else QE(n,e,0)}function zu(n,e){var t=n.isMatrix?n._size:et(n),r=e._sourceSize;r.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new ot(i,t[a])})}function zt(n,e){if(n!==void 0){if(!nt(n)||!ze(n))throw new TypeError("Index must be an integer (value: "+n+")");if(n<0||typeof e=="number"&&n>=e)throw new on(n,e)}}function Uo(n){for(var e=0;e=0,u=e%t===0;if(l)if(u)r[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function KE(n){return n.reduce((e,t)=>e*t,1)}function q9(n,e){for(var t=n,r,i=e.length-1;i>0;i--){var a=e[i];r=[];for(var o=t.length/a,l=0;le.test(t))}function mh(n,e){return Array.prototype.join.call(n,e)}function ma(n){if(!Array.isArray(n))throw new TypeError("Array input expected");if(n.length===0)return n;var e=[],t=0;e[0]={value:n[0],identifier:0};for(var r=1;r1)return n.slice(1).reduce(function(t,r){return rC(t,r,e,0)},n[0]);throw new Error("Wrong number of arguments in function concat")}function z9(){for(var n=arguments.length,e=new Array(n),t=0;tp.length),i=Math.max(...r),a=new Array(i).fill(null),o=0;oa[c]&&(a[c]=l[s])}for(var f=0;f1||n[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(n,") not possible to broadcast dimension ").concat(r," with size ").concat(n[i]," to size ").concat(e[a]))}}function hh(n,e){var t=et(n);if(Si(t,e))return n;Gu(t,e);var r=z9(t,e),i=r.length,a=[...Array(i-t.length).fill(1),...t],o=H9(n);t.length!W9(a)).every(a=>t[a]!==void 0);if(!r){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(n,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function W9(n){return n&&n[0]==="?"}function j9(n){return n&&n[0]==="?"?n.slice(1):n}function dr(n,e){if(oC(n)&&iC(n,e))return n[e];throw typeof n[e]=="function"&&Bf(n,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function zi(n,e,t){if(oC(n)&&iC(n,e))return n[e]=t,t;throw new Error('No access to property "'+e+'"')}function nC(n,e){return e in n}function iC(n,e){return!n||typeof n!="object"?!1:je(Z9,e)?!0:!(e in Object.prototype||e in Function.prototype)}function aC(n,e){if(!Bf(n,e))throw new Error('No access to method "'+e+'"');return n[e]}function Bf(n,e){return n==null||typeof n[e]!="function"||je(n,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(n)?!1:je(J9,e)?!0:!(e in Object.prototype||e in Function.prototype)}function oC(n){return typeof n=="object"&&n&&n.constructor===Object}var Z9={length:!0,name:!0},J9={toString:!0,valueOf:!0,toLocaleString:!0};var Wu=class{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return dr(this.wrappedObject,e)}set(e,t){return zi(this.wrappedObject,e,t),this}has(e){return nC(this.wrappedObject,e)}};function $i(){return new Map}function da(n){if(!n)return $i();if(Of(n))return n;if(Lo(n))return new Wu(n);throw new Error("createMap can create maps from objects or Maps")}function sC(n){if(n instanceof Wu)return n.wrappedObject;var e={};for(var t of n.keys()){var r=n.get(t);zi(e,t,r)}return e}function Of(n){return n?n instanceof Map||n instanceof Wu||typeof n.set=="function"&&typeof n.get=="function"&&typeof n.keys=="function"&&typeof n.has=="function":!1}function gh(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;rxr&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(l)},{name:"string",test:xr},{name:"Chain",test:Af},{name:"Array",test:Mt},{name:"Matrix",test:He},{name:"DenseMatrix",test:ko},{name:"SparseMatrix",test:Ci},{name:"Range",test:Os},{name:"Index",test:qa},{name:"boolean",test:bE},{name:"ResultSet",test:wE},{name:"Help",test:_f},{name:"function",test:_E},{name:"Date",test:AE},{name:"RegExp",test:DE},{name:"null",test:EE},{name:"undefined",test:CE},{name:"AccessorNode",test:Kn},{name:"ArrayNode",test:nn},{name:"AssignmentNode",test:SE},{name:"BlockNode",test:NE},{name:"ConditionalNode",test:ME},{name:"ConstantNode",test:bt},{name:"FunctionNode",test:Nn},{name:"FunctionAssignmentNode",test:qi},{name:"IndexNode",test:fi},{name:"Node",test:At},{name:"ObjectNode",test:za},{name:"OperatorNode",test:cr},{name:"ParenthesisNode",test:an},{name:"RangeNode",test:TE},{name:"RelationalNode",test:FE},{name:"SymbolNode",test:Qt},{name:"Map",test:Of},{name:"Object",test:Lo}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(u){if(t||vh(u),qE(u)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+u+"). Use function bignumber(x) to convert to BigNumber.");return new t(u)}},{from:"number",to:"Complex",convert:function(u){return r||Pf(u),new r(u,0)}},{from:"BigNumber",to:"Complex",convert:function(u){return r||Pf(u),new r(u.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(u){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(u){return r||Pf(u),new r(u.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(u){a||yh(u);var s=new a(u);if(s.valueOf()!==u)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+u+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(u){var s=Number(u);if(isNaN(s))throw new Error('Cannot convert "'+u+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(u){t||vh(u);try{return new t(u)}catch(s){throw new Error('Cannot convert "'+u+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(u){a||yh(u);try{return new a(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(u){r||Pf(u);try{return new r(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Complex')}}},{from:"boolean",to:"number",convert:function(u){return+u}},{from:"boolean",to:"BigNumber",convert:function(u){return t||vh(u),new t(+u)}},{from:"boolean",to:"Fraction",convert:function(u){return a||yh(u),new a(+u)}},{from:"boolean",to:"string",convert:function(u){return String(u)}},{from:"Array",to:"Matrix",convert:function(u){return i||X9(),new i(u)}},{from:"Matrix",to:"Array",convert:function(u){return u.valueOf()}}]),o.onMismatch=(l,u,s)=>{var c=o.createError(l,u,s);if(["wrongType","mismatch"].includes(c.data.category)&&u.length===1&&Sn(u[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(l,u,s)=>{var c=o.createError(l,u,s);if(["wrongType","mismatch"].includes(c.data.category)&&u.length===1&&Sn(u[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw f.data=c.data,f}throw c},o});function vh(n){throw new Error("Cannot convert value ".concat(n," into a BigNumber: no class 'BigNumber' provided"))}function Pf(n){throw new Error("Cannot convert value ".concat(n," into a Complex number: no class 'Complex' provided"))}function X9(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function yh(n){throw new Error("Cannot convert value ".concat(n," into a Fraction, no class 'Fraction' provided."))}var Q9="ResultSet",K9=[],wh=S(Q9,K9,()=>{function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return n.prototype.type="ResultSet",n.prototype.isResultSet=!0,n.prototype.valueOf=function(){return this.entries},n.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},n.fromJSON=function(e){return new n(e.entries)},n},{isClass:!0});var Vs=9e15,Za=1e9,_h="0123456789abcdef",kf="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Lf="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Ah={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Vs,maxE:Vs,crypto:!1},pC,ha,Dt=!0,Uf="[DecimalError] ",ja=Uf+"Invalid argument: ",mC=Uf+"Precision limit exceeded",dC=Uf+"crypto unavailable",hC="[object Decimal]",dn=Math.floor,$r=Math.pow,eU=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,tU=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,rU=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,gC=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Fi=1e7,mt=7,nU=9007199254740991,iU=kf.length-1,Dh=Lf.length-1,Ie={toStringTag:hC};Ie.absoluteValue=Ie.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),ut(n)};Ie.ceil=function(){return ut(new this.constructor(this),this.e+1,2)};Ie.clampedTo=Ie.clamp=function(n,e){var t,r=this,i=r.constructor;if(n=new i(n),e=new i(e),!n.s||!e.s)return new i(NaN);if(n.gt(e))throw Error(ja+e);return t=r.cmp(n),t<0?n:r.cmp(e)>0?e:new i(r)};Ie.comparedTo=Ie.cmp=function(n){var e,t,r,i,a=this,o=a.d,l=(n=new a.constructor(n)).d,u=a.s,s=n.s;if(!o||!l)return!u||!s?NaN:u!==s?u:o===l?0:!o^u<0?1:-1;if(!o[0]||!l[0])return o[0]?u:l[0]?-s:0;if(u!==s)return u;if(a.e!==n.e)return a.e>n.e^u<0?1:-1;for(r=o.length,i=l.length,e=0,t=rl[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1};Ie.cosine=Ie.cos=function(){var n,e,t=this,r=t.constructor;return t.d?t.d[0]?(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+mt,r.rounding=1,t=aU(r,wC(r,t)),r.precision=n,r.rounding=e,ut(ha==2||ha==3?t.neg():t,n,e,!0)):new r(1):new r(NaN)};Ie.cubeRoot=Ie.cbrt=function(){var n,e,t,r,i,a,o,l,u,s,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Dt=!1,a=c.s*$r(c.s*c,1/3),!a||Math.abs(a)==1/0?(t=sn(c.d),n=c.e,(a=(n-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=$r(t,1/3),n=dn((n+1)/3)-(n%3==(n<0?-1:2)),a==1/0?t="5e"+n:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+n),r=new f(t),r.s=c.s):r=new f(a.toString()),o=(n=f.precision)+3;;)if(l=r,u=l.times(l).times(l),s=u.plus(c),r=hr(s.plus(c).times(l),s.plus(u),o+2,1),sn(l.d).slice(0,o)===(t=sn(r.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(ut(l,n+1,0),l.times(l).times(l).eq(c))){r=l;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(ut(r,n+1,1),e=!r.times(r).times(r).eq(c));break}return Dt=!0,ut(r,n,f.rounding,e)};Ie.decimalPlaces=Ie.dp=function(){var n,e=this.d,t=NaN;if(e){if(n=e.length-1,t=(n-dn(this.e/mt))*mt,n=e[n],n)for(;n%10==0;n/=10)t--;t<0&&(t=0)}return t};Ie.dividedBy=Ie.div=function(n){return hr(this,new this.constructor(n))};Ie.dividedToIntegerBy=Ie.divToInt=function(n){var e=this,t=e.constructor;return ut(hr(e,new t(n),0,1,1),t.precision,t.rounding)};Ie.equals=Ie.eq=function(n){return this.cmp(n)===0};Ie.floor=function(){return ut(new this.constructor(this),this.e+1,3)};Ie.greaterThan=Ie.gt=function(n){return this.cmp(n)>0};Ie.greaterThanOrEqualTo=Ie.gte=function(n){var e=this.cmp(n);return e==1||e===0};Ie.hyperbolicCosine=Ie.cosh=function(){var n,e,t,r,i,a=this,o=a.constructor,l=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return l;t=o.precision,r=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(n=Math.ceil(i/3),e=(1/zf(4,n)).toString()):(n=16,e="2.3283064365386962890625e-10"),a=Us(o,1,a.times(e),new o(1),!0);for(var u,s=n,c=new o(8);s--;)u=a.times(a),a=l.minus(u.times(c.minus(u.times(c))));return ut(a,o.precision=t,o.rounding=r,!0)};Ie.hyperbolicSine=Ie.sinh=function(){var n,e,t,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,t=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=Us(a,2,i,i,!0);else{n=1.4*Math.sqrt(r),n=n>16?16:n|0,i=i.times(1/zf(5,n)),i=Us(a,2,i,i,!0);for(var o,l=new a(5),u=new a(16),s=new a(20);n--;)o=i.times(i),i=i.times(l.plus(o.times(u.times(o).plus(s))))}return a.precision=e,a.rounding=t,ut(i,e,t,!0)};Ie.hyperbolicTangent=Ie.tanh=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+7,r.rounding=1,hr(t.sinh(),t.cosh(),r.precision=n,r.rounding=e)):new r(t.s)};Ie.inverseCosine=Ie.acos=function(){var n,e=this,t=e.constructor,r=e.abs().cmp(1),i=t.precision,a=t.rounding;return r!==-1?r===0?e.isNeg()?Ti(t,i,a):new t(0):new t(NaN):e.isZero()?Ti(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),n=Ti(t,i+4,a).times(.5),t.precision=i,t.rounding=a,n.minus(e))};Ie.inverseHyperbolicCosine=Ie.acosh=function(){var n,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(n=r.precision,e=r.rounding,r.precision=n+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,Dt=!1,t=t.times(t).minus(1).sqrt().plus(t),Dt=!0,r.precision=n,r.rounding=e,t.ln()):new r(t)};Ie.inverseHyperbolicSine=Ie.asinh=function(){var n,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,Dt=!1,t=t.times(t).plus(1).sqrt().plus(t),Dt=!0,r.precision=n,r.rounding=e,t.ln())};Ie.inverseHyperbolicTangent=Ie.atanh=function(){var n,e,t,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(n=a.precision,e=a.rounding,r=i.sd(),Math.max(r,n)<2*-i.e-1?ut(new a(i),n,e,!0):(a.precision=t=r-i.e,i=hr(i.plus(1),new a(1).minus(i),t+n,1),a.precision=n+4,a.rounding=1,i=i.ln(),a.precision=n,a.rounding=e,i.times(.5))):new a(NaN)};Ie.inverseSine=Ie.asin=function(){var n,e,t,r,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,r=a.rounding,e!==-1?e===0?(n=Ti(a,t+4,r).times(.5),n.s=i.s,n):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=r,i.times(2)))};Ie.inverseTangent=Ie.atan=function(){var n,e,t,r,i,a,o,l,u,s=this,c=s.constructor,f=c.precision,p=c.rounding;if(s.isFinite()){if(s.isZero())return new c(s);if(s.abs().eq(1)&&f+4<=Dh)return o=Ti(c,f+4,p).times(.25),o.s=s.s,o}else{if(!s.s)return new c(NaN);if(f+4<=Dh)return o=Ti(c,f+4,p).times(.5),o.s=s.s,o}for(c.precision=l=f+10,c.rounding=1,t=Math.min(28,l/mt+2|0),n=t;n;--n)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(Dt=!1,e=Math.ceil(l/mt),r=1,u=s.times(s),o=new c(s),i=s;n!==-1;)if(i=i.times(u),a=o.minus(i.div(r+=2)),i=i.times(u),o=a.plus(i.div(r+=2)),o.d[e]!==void 0)for(n=e;o.d[n]===a.d[n]&&n--;);return t&&(o=o.times(2<this.d.length-2};Ie.isNaN=function(){return!this.s};Ie.isNegative=Ie.isNeg=function(){return this.s<0};Ie.isPositive=Ie.isPos=function(){return this.s>0};Ie.isZero=function(){return!!this.d&&this.d[0]===0};Ie.lessThan=Ie.lt=function(n){return this.cmp(n)<0};Ie.lessThanOrEqualTo=Ie.lte=function(n){return this.cmp(n)<1};Ie.logarithm=Ie.log=function(n){var e,t,r,i,a,o,l,u,s=this,c=s.constructor,f=c.precision,p=c.rounding,m=5;if(n==null)n=new c(10),e=!0;else{if(n=new c(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new c(NaN);e=n.eq(10)}if(t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new c(t&&!t[0]?-1/0:s.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)a=!0;else{for(i=t[0];i%10===0;)i/=10;a=i!==1}if(Dt=!1,l=f+m,o=Wa(s,l),r=e?Vf(c,l+10):Wa(n,l),u=hr(o,r,l,1),ju(u.d,i=f,p))do if(l+=10,o=Wa(s,l),r=e?Vf(c,l+10):Wa(n,l),u=hr(o,r,l,1),!a){+sn(u.d).slice(i+1,i+15)+1==1e14&&(u=ut(u,f+1,0));break}while(ju(u.d,i+=10,p));return Dt=!0,ut(u,f,p)};Ie.minus=Ie.sub=function(n){var e,t,r,i,a,o,l,u,s,c,f,p,m=this,h=m.constructor;if(n=new h(n),!m.d||!n.d)return!m.s||!n.s?n=new h(NaN):m.d?n.s=-n.s:n=new h(n.d||m.s!==n.s?m:NaN),n;if(m.s!=n.s)return n.s=-n.s,m.plus(n);if(s=m.d,p=n.d,l=h.precision,u=h.rounding,!s[0]||!p[0]){if(p[0])n.s=-n.s;else if(s[0])n=new h(m);else return new h(u===3?-0:0);return Dt?ut(n,l,u):n}if(t=dn(n.e/mt),c=dn(m.e/mt),s=s.slice(),a=c-t,a){for(f=a<0,f?(e=s,a=-a,o=p.length):(e=p,t=c,o=s.length),r=Math.max(Math.ceil(l/mt),o)+2,a>r&&(a=r,e.length=1),e.reverse(),r=a;r--;)e.push(0);e.reverse()}else{for(r=s.length,o=p.length,f=r0;--r)s[o++]=0;for(r=p.length;r>a;){if(s[--r]o?a+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=s.length,i=c.length,o-i<0&&(i=o,t=c,c=s,s=t),e=0;i;)e=(s[--i]=s[i]+c[i]+e)/Fi|0,s[i]%=Fi;for(e&&(s.unshift(e),++r),o=s.length;s[--o]==0;)s.pop();return n.d=s,n.e=qf(s,r),Dt?ut(n,l,u):n};Ie.precision=Ie.sd=function(n){var e,t=this;if(n!==void 0&&n!==!!n&&n!==1&&n!==0)throw Error(ja+n);return t.d?(e=vC(t.d),n&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ie.round=function(){var n=this,e=n.constructor;return ut(new e(n),n.e+1,e.rounding)};Ie.sine=Ie.sin=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+mt,r.rounding=1,t=sU(r,wC(r,t)),r.precision=n,r.rounding=e,ut(ha>2?t.neg():t,n,e,!0)):new r(NaN)};Ie.squareRoot=Ie.sqrt=function(){var n,e,t,r,i,a,o=this,l=o.d,u=o.e,s=o.s,c=o.constructor;if(s!==1||!l||!l[0])return new c(!s||s<0&&(!l||l[0])?NaN:l?o:1/0);for(Dt=!1,s=Math.sqrt(+o),s==0||s==1/0?(e=sn(l),(e.length+u)%2==0&&(e+="0"),s=Math.sqrt(e),u=dn((u+1)/2)-(u<0||u%2),s==1/0?e="5e"+u:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),r=new c(e)):r=new c(s.toString()),t=(u=c.precision)+3;;)if(a=r,r=a.plus(hr(o,a,t+2,1)).times(.5),sn(a.d).slice(0,t)===(e=sn(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(ut(a,u+1,0),a.times(a).eq(o))){r=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(ut(r,u+1,1),n=!r.times(r).eq(o));break}return Dt=!0,ut(r,u,c.rounding,n)};Ie.tangent=Ie.tan=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+10,r.rounding=1,t=t.sin(),t.s=1,t=hr(t,new r(1).minus(t.times(t)).sqrt(),n+10,0),r.precision=n,r.rounding=e,ut(ha==2||ha==4?t.neg():t,n,e,!0)):new r(NaN)};Ie.times=Ie.mul=function(n){var e,t,r,i,a,o,l,u,s,c=this,f=c.constructor,p=c.d,m=(n=new f(n)).d;if(n.s*=c.s,!p||!p[0]||!m||!m[0])return new f(!n.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?n.s/0:n.s*0);for(t=dn(c.e/mt)+dn(n.e/mt),u=p.length,s=m.length,u=0;){for(e=0,i=u+r;i>r;)l=a[i]+m[r]*p[i-r-1]+e,a[i--]=l%Fi|0,e=l/Fi|0;a[i]=(a[i]+e)%Fi|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),n.d=a,n.e=qf(a,t),Dt?ut(n,f.precision,f.rounding):n};Ie.toBinary=function(n,e){return Sh(this,2,n,e)};Ie.toDecimalPlaces=Ie.toDP=function(n,e){var t=this,r=t.constructor;return t=new r(t),n===void 0?t:(Rn(n,0,Za),e===void 0?e=r.rounding:Rn(e,0,8),ut(t,n+t.e+1,e))};Ie.toExponential=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Hi(r,!0):(Rn(n,0,Za),e===void 0?e=i.rounding:Rn(e,0,8),r=ut(new i(r),n+1,e),t=Hi(r,!0,n+1)),r.isNeg()&&!r.isZero()?"-"+t:t};Ie.toFixed=function(n,e){var t,r,i=this,a=i.constructor;return n===void 0?t=Hi(i):(Rn(n,0,Za),e===void 0?e=a.rounding:Rn(e,0,8),r=ut(new a(i),n+i.e+1,e),t=Hi(r,!1,n+r.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Ie.toFraction=function(n){var e,t,r,i,a,o,l,u,s,c,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(s=t=new d(1),r=u=new d(0),e=new d(r),a=e.e=vC(h)-m.e-1,o=a%mt,e.d[0]=$r(10,o<0?mt+o:o),n==null)n=a>0?e:s;else{if(l=new d(n),!l.isInt()||l.lt(s))throw Error(ja+l);n=l.gt(e)?a>0?e:s:l}for(Dt=!1,l=new d(sn(h)),c=d.precision,d.precision=a=h.length*mt*2;f=hr(l,e,0,1,1),i=t.plus(f.times(r)),i.cmp(n)!=1;)t=r,r=i,i=s,s=u.plus(f.times(i)),u=i,i=e,e=l.minus(f.times(i)),l=i;return i=hr(n.minus(t),r,0,1,1),u=u.plus(i.times(s)),t=t.plus(i.times(r)),u.s=s.s=m.s,p=hr(s,r,a,1).minus(m).abs().cmp(hr(u,t,a,1).minus(m).abs())<1?[s,r]:[u,t],d.precision=c,Dt=!0,p};Ie.toHexadecimal=Ie.toHex=function(n,e){return Sh(this,16,n,e)};Ie.toNearest=function(n,e){var t=this,r=t.constructor;if(t=new r(t),n==null){if(!t.d)return t;n=new r(1),e=r.rounding}else{if(n=new r(n),e===void 0?e=r.rounding:Rn(e,0,8),!t.d)return n.s?t:n;if(!n.d)return n.s&&(n.s=t.s),n}return n.d[0]?(Dt=!1,t=hr(t,n,0,e,1).times(n),Dt=!0,ut(t)):(n.s=t.s,t=n),t};Ie.toNumber=function(){return+this};Ie.toOctal=function(n,e){return Sh(this,8,n,e)};Ie.toPower=Ie.pow=function(n){var e,t,r,i,a,o,l=this,u=l.constructor,s=+(n=new u(n));if(!l.d||!n.d||!l.d[0]||!n.d[0])return new u($r(+l,s));if(l=new u(l),l.eq(1))return l;if(r=u.precision,a=u.rounding,n.eq(1))return ut(l,r,a);if(e=dn(n.e/mt),e>=n.d.length-1&&(t=s<0?-s:s)<=nU)return i=yC(u,l,t,r),n.s<0?new u(1).div(i):ut(i,r,a);if(o=l.s,o<0){if(eu.maxE+1||e0?o/0:0):(Dt=!1,u.rounding=l.s=1,t=Math.min(12,(e+"").length),i=Eh(n.times(Wa(l,r+t)),r),i.d&&(i=ut(i,r+5,1),ju(i.d,r,a)&&(e=r+10,i=ut(Eh(n.times(Wa(l,e+t)),e),e+5,1),+sn(i.d).slice(r+1,r+15)+1==1e14&&(i=ut(i,r+1,0)))),i.s=o,Dt=!0,u.rounding=a,ut(i,r,a))};Ie.toPrecision=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Hi(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(Rn(n,1,Za),e===void 0?e=i.rounding:Rn(e,0,8),r=ut(new i(r),n,e),t=Hi(r,n<=r.e||r.e<=i.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+t:t};Ie.toSignificantDigits=Ie.toSD=function(n,e){var t=this,r=t.constructor;return n===void 0?(n=r.precision,e=r.rounding):(Rn(n,1,Za),e===void 0?e=r.rounding:Rn(e,0,8)),ut(new r(t),n,e)};Ie.toString=function(){var n=this,e=n.constructor,t=Hi(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+t:t};Ie.truncated=Ie.trunc=function(){return ut(new this.constructor(this),this.e+1,1)};Ie.valueOf=Ie.toJSON=function(){var n=this,e=n.constructor,t=Hi(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+t:t};function sn(n){var e,t,r,i=n.length-1,a="",o=n[0];if(i>0){for(a+=o,e=1;et)throw Error(ja+n)}function ju(n,e,t,r){var i,a,o,l;for(a=n[0];a>=10;a/=10)--e;return--e<0?(e+=mt,i=0):(i=Math.ceil((e+1)/mt),e%=mt),a=$r(10,mt-e),l=n[i]%a|0,r==null?e<3?(e==0?l=l/100|0:e==1&&(l=l/10|0),o=t<4&&l==99999||t>3&&l==49999||l==5e4||l==0):o=(t<4&&l+1==a||t>3&&l+1==a/2)&&(n[i+1]/a/100|0)==$r(10,e-2)-1||(l==a/2||l==0)&&(n[i+1]/a/100|0)==0:e<4?(e==0?l=l/1e3|0:e==1?l=l/100|0:e==2&&(l=l/10|0),o=(r||t<4)&&l==9999||!r&&t>3&&l==4999):o=((r||t<4)&&l+1==a||!r&&t>3&&l+1==a/2)&&(n[i+1]/a/1e3|0)==$r(10,e-3)-1,o}function Rf(n,e,t){for(var r,i=[0],a,o=0,l=n.length;ot-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/t|0,i[r]%=t)}return i.reverse()}function aU(n,e){var t,r,i;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),i=(1/zf(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),n.precision+=t,e=Us(n,1,e.times(i),new n(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=t,e}var hr=function(){function n(r,i,a){var o,l=0,u=r.length;for(r=r.slice();u--;)o=r[u]*i+l,r[u]=o%a|0,l=o/a|0;return l&&r.unshift(l),r}function e(r,i,a,o){var l,u;if(a!=o)u=a>o?1:-1;else for(l=u=0;li[l]?1:-1;break}return u}function t(r,i,a,o){for(var l=0;a--;)r[a]-=l,l=r[a]1;)r.shift()}return function(r,i,a,o,l,u){var s,c,f,p,m,h,d,g,y,w,v,x,_,b,D,C,A,E,F,I,O=r.constructor,k=r.s==i.s?1:-1,R=r.d,T=i.d;if(!R||!R[0]||!T||!T[0])return new O(!r.s||!i.s||(R?T&&R[0]==T[0]:!T)?NaN:R&&R[0]==0||!T?k*0:k/0);for(u?(m=1,c=r.e-i.e):(u=Fi,m=mt,c=dn(r.e/m)-dn(i.e/m)),F=T.length,A=R.length,y=new O(k),w=y.d=[],f=0;T[f]==(R[f]||0);f++);if(T[f]>(R[f]||0)&&c--,a==null?(b=a=O.precision,o=O.rounding):l?b=a+(r.e-i.e)+1:b=a,b<0)w.push(1),h=!0;else{if(b=b/m+2|0,f=0,F==1){for(p=0,T=T[0],b++;(f1&&(T=n(T,p,u),R=n(R,p,u),F=T.length,A=R.length),C=F,v=R.slice(0,F),x=v.length;x=u/2&&++E;do p=0,s=e(T,v,F,x),s<0?(_=v[0],F!=x&&(_=_*u+(v[1]||0)),p=_/E|0,p>1?(p>=u&&(p=u-1),d=n(T,p,u),g=d.length,x=v.length,s=e(d,v,g,x),s==1&&(p--,t(d,F=10;p/=10)f++;y.e=f+c*m-1,ut(y,l?a+y.e+1:a,o,h)}return y}}();function ut(n,e,t,r){var i,a,o,l,u,s,c,f,p,m=n.constructor;e:if(e!=null){if(f=n.d,!f)return n;for(i=1,l=f[0];l>=10;l/=10)i++;if(a=e-i,a<0)a+=mt,o=e,c=f[p=0],u=c/$r(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/mt),l=f.length,p>=l)if(r){for(;l++<=p;)f.push(0);c=u=0,i=1,a%=mt,o=a-mt+1}else break e;else{for(c=l=f[p],i=1;l>=10;l/=10)i++;a%=mt,o=a-mt+i,u=o<0?0:c/$r(10,i-o-1)%10|0}if(r=r||e<0||f[p+1]!==void 0||(o<0?c:c%$r(10,i-o-1)),s=t<4?(u||r)&&(t==0||t==(n.s<0?3:2)):u>5||u==5&&(t==4||r||t==6&&(a>0?o>0?c/$r(10,i-o):0:f[p-1])%10&1||t==(n.s<0?8:7)),e<1||!f[0])return f.length=0,s?(e-=n.e+1,f[0]=$r(10,(mt-e%mt)%mt),n.e=-e||0):f[0]=n.e=0,n;if(a==0?(f.length=p,l=1,p--):(f.length=p+1,l=$r(10,mt-a),f[p]=o>0?(c/$r(10,i-o)%$r(10,o)|0)*l:0),s)for(;;)if(p==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=l,l=1;o>=10;o/=10)l++;a!=l&&(n.e++,f[0]==Fi&&(f[0]=1));break}else{if(f[p]+=l,f[p]!=Fi)break;f[p--]=0,l=1}for(a=f.length;f[--a]===0;)f.pop()}return Dt&&(n.e>m.maxE?(n.d=null,n.e=NaN):n.e0?a=a.charAt(0)+"."+a.slice(1)+Ga(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(n.e<0?"e":"e+")+n.e):i<0?(a="0."+Ga(-i-1)+a,t&&(r=t-o)>0&&(a+=Ga(r))):i>=o?(a+=Ga(i+1-o),t&&(r=t-i-1)>0&&(a=a+"."+Ga(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=Ga(r))),a}function qf(n,e){var t=n[0];for(e*=mt;t>=10;t/=10)e++;return e}function Vf(n,e,t){if(e>iU)throw Dt=!0,t&&(n.precision=t),Error(mC);return ut(new n(kf),e,1,!0)}function Ti(n,e,t){if(e>Dh)throw Error(mC);return ut(new n(Lf),e,t,!0)}function vC(n){var e=n.length-1,t=e*mt+1;if(e=n[e],e){for(;e%10==0;e/=10)t--;for(e=n[0];e>=10;e/=10)t++}return t}function Ga(n){for(var e="";n--;)e+="0";return e}function yC(n,e,t,r){var i,a=new n(1),o=Math.ceil(r/mt+4);for(Dt=!1;;){if(t%2&&(a=a.times(e),cC(a.d,o)&&(i=!0)),t=dn(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),cC(e.d,o)}return Dt=!0,a}function lC(n){return n.d[n.d.length-1]&1}function xC(n,e,t){for(var r,i=new n(e[0]),a=0;++a17)return new p(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(e==null?(Dt=!1,u=h):u=e,l=new p(.03125);n.e>-2;)n=n.times(l),f+=5;for(r=Math.log($r(2,f))/Math.LN10*2+5|0,u+=r,t=a=o=new p(1),p.precision=u;;){if(a=ut(a.times(n),u,1),t=t.times(++c),l=o.plus(hr(a,t,u,1)),sn(l.d).slice(0,u)===sn(o.d).slice(0,u)){for(i=f;i--;)o=ut(o.times(o),u,1);if(e==null)if(s<3&&ju(o.d,u-r,m,s))p.precision=u+=10,t=a=l=new p(1),c=0,s++;else return ut(o,p.precision=h,m,Dt=!0);else return p.precision=h,o}o=l}}function Wa(n,e){var t,r,i,a,o,l,u,s,c,f,p,m=1,h=10,d=n,g=d.d,y=d.constructor,w=y.rounding,v=y.precision;if(d.s<0||!g||!g[0]||!d.e&&g[0]==1&&g.length==1)return new y(g&&!g[0]?-1/0:d.s!=1?NaN:g?0:d);if(e==null?(Dt=!1,c=v):c=e,y.precision=c+=h,t=sn(g),r=t.charAt(0),Math.abs(a=d.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)d=d.times(n),t=sn(d.d),r=t.charAt(0),m++;a=d.e,r>1?(d=new y("0."+t),a++):d=new y(r+"."+t.slice(1))}else return s=Vf(y,c+2,v).times(a+""),d=Wa(new y(r+"."+t.slice(1)),c-h).plus(s),y.precision=v,e==null?ut(d,v,w,Dt=!0):d;for(f=d,u=o=d=hr(d.minus(1),d.plus(1),c,1),p=ut(d.times(d),c,1),i=3;;){if(o=ut(o.times(p),c,1),s=u.plus(hr(o,new y(i),c,1)),sn(s.d).slice(0,c)===sn(u.d).slice(0,c))if(u=u.times(2),a!==0&&(u=u.plus(Vf(y,c+2,v).times(a+""))),u=hr(u,new y(m),c,1),e==null)if(ju(u.d,c-h,w,l))y.precision=c+=h,s=o=d=hr(f.minus(1),f.plus(1),c,1),p=ut(d.times(d),c,1),i=l=1;else return ut(u,y.precision=v,w,Dt=!0);else return y.precision=v,u;u=s,i+=2}}function bC(n){return String(n.s*n.s/0)}function Ch(n,e){var t,r,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,n.e=t=t-r-1,n.d=[],r=(t+1)%mt,t<0&&(r+=mt),rn.constructor.maxE?(n.d=null,n.e=NaN):n.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),gC.test(e))return Ch(n,e)}else if(e==="Infinity"||e==="NaN")return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(tU.test(e))t=16,e=e.toLowerCase();else if(eU.test(e))t=2;else if(rU.test(e))t=8;else throw Error(ja+e);for(a=e.search(/p/i),a>0?(u=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,r=n.constructor,o&&(e=e.replace(".",""),l=e.length,a=l-a,i=yC(r,new r(t),a,a*2)),s=Rf(e,t,Fi),c=s.length-1,a=c;s[a]===0;--a)s.pop();return a<0?new r(n.s*0):(n.e=qf(s,c),n.d=s,Dt=!1,o&&(n=hr(n,i,l*4)),u&&(n=n.times(Math.abs(u)<54?$r(2,u):Zu.pow(2,u))),Dt=!0,n)}function sU(n,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:Us(n,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/zf(5,t)),e=Us(n,2,e,e);for(var i,a=new n(5),o=new n(16),l=new n(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(l))));return e}function Us(n,e,t,r,i){var a,o,l,u,s=1,c=n.precision,f=Math.ceil(c/mt);for(Dt=!1,u=t.times(t),l=new n(r);;){if(o=hr(l.times(u),new n(e++*e++),c,1),l=i?r.plus(o):r.minus(o),r=hr(o.times(u),new n(e++*e++),c,1),o=l.plus(r),o.d[f]!==void 0){for(a=f;o.d[a]===l.d[a]&&a--;);if(a==-1)break}a=l,l=r,r=o,o=a,s++}return Dt=!0,o.d.length=f+1,o}function zf(n,e){for(var t=n;--e;)t*=n;return t}function wC(n,e){var t,r=e.s<0,i=Ti(n,n.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return ha=r?4:1,e;if(t=e.divToInt(i),t.isZero())ha=r?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return ha=lC(t)?r?2:3:r?4:1,e;ha=lC(t)?r?1:4:r?3:2}return e.minus(i).abs()}function Sh(n,e,t,r){var i,a,o,l,u,s,c,f,p,m=n.constructor,h=t!==void 0;if(h?(Rn(t,1,Za),r===void 0?r=m.rounding:Rn(r,0,8)):(t=m.precision,r=m.rounding),!n.isFinite())c=bC(n);else{for(c=Hi(n),o=c.indexOf("."),h?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,o>=0&&(c=c.replace(".",""),p=new m(1),p.e=c.length-o,p.d=Rf(Hi(p),10,i),p.e=p.d.length),f=Rf(c,10,i),a=u=f.length;f[--u]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(n=new m(n),n.d=f,n.e=a,n=hr(n,p,t,r,0,i),f=n.d,a=n.e,s=pC),o=f[t],l=i/2,s=s||f[t+1]!==void 0,s=r<4?(o!==void 0||s)&&(r===0||r===(n.s<0?3:2)):o>l||o===l&&(r===4||s||r===6&&f[t-1]&1||r===(n.s<0?8:7)),f.length=t,s)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,c="";o1)if(e==16||e==8){for(o=e==16?4:3,--u;u%o;u++)c+="0";for(f=Rf(c,i,e),u=f.length;!f[u-1];--u);for(o=1,c="1.";ou)for(a-=u;a--;)c+="0";else ae)return n.length=e,!0}function uU(n){return new this(n).abs()}function lU(n){return new this(n).acos()}function cU(n){return new this(n).acosh()}function fU(n,e){return new this(n).plus(e)}function pU(n){return new this(n).asin()}function mU(n){return new this(n).asinh()}function dU(n){return new this(n).atan()}function hU(n){return new this(n).atanh()}function gU(n,e){n=new this(n),e=new this(e);var t,r=this.precision,i=this.rounding,a=r+4;return!n.s||!e.s?t=new this(NaN):!n.d&&!e.d?(t=Ti(this,a,1).times(e.s>0?.25:.75),t.s=n.s):!e.d||n.isZero()?(t=e.s<0?Ti(this,r,i):new this(0),t.s=n.s):!n.d||e.isZero()?(t=Ti(this,a,1).times(.5),t.s=n.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(hr(n,e,a,1)),e=Ti(this,a,1),this.precision=r,this.rounding=i,t=n.s<0?t.minus(e):t.plus(e)):t=this.atan(hr(n,e,a,1)),t}function vU(n){return new this(n).cbrt()}function yU(n){return ut(n=new this(n),n.e+1,2)}function xU(n,e,t){return new this(n).clamp(e,t)}function bU(n){if(!n||typeof n!="object")throw Error(Uf+"Object expected");var e,t,r,i=n.defaults===!0,a=["precision",1,Za,"rounding",0,8,"toExpNeg",-Vs,0,"toExpPos",0,Vs,"maxE",0,Vs,"minE",-Vs,0,"modulo",0,9];for(e=0;e=a[e+1]&&r<=a[e+2])this[t]=r;else throw Error(ja+t+": "+r);if(t="crypto",i&&(this[t]=Ah[t]),(r=n[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(dC);else this[t]=!1;else throw Error(ja+t+": "+r);return this}function wU(n){return new this(n).cos()}function _U(n){return new this(n).cosh()}function _C(n){var e,t,r;function i(a){var o,l,u,s=this;if(!(s instanceof i))return new i(a);if(s.constructor=i,fC(a)){s.s=a.s,Dt?!a.d||a.e>i.maxE?(s.e=NaN,s.d=null):a.e=10;l/=10)o++;Dt?o>i.maxE?(s.e=NaN,s.d=null):o=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:l[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);a=214e7?crypto.randomBytes(4).copy(e,a):(l.push(i%1e7),a+=4);a=r/4}else throw Error(dC);else for(;a=10;i/=10)r++;r{var{on:e,config:t}=n,r=qo.clone({precision:t.precision,modulo:qo.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(i){return new r(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&r.config({precision:i.precision})}),r},{isClass:!0});var Yr=gr(DC(),1);var JU="Complex",YU=[],Th=S(JU,YU,()=>(Object.defineProperty(Yr.default,"name",{value:"Complex"}),Yr.default.prototype.constructor=Yr.default,Yr.default.prototype.type="Complex",Yr.default.prototype.isComplex=!0,Yr.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Yr.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Yr.default.prototype.format=function(n){var e="",t=this.im,r=this.re,i=Ni(this.re,n),a=Ni(this.im,n),o=nt(n)?n:n?n.precision:null;if(o!==null){var l=Math.pow(10,-o);Math.abs(r/t)e.re?1:n.ree.im?1:n.im(Object.defineProperty(Gi.default,"name",{value:"Fraction"}),Gi.default.prototype.constructor=Gi.default,Gi.default.prototype.type="Fraction",Gi.default.prototype.isFraction=!0,Gi.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Gi.default.fromJSON=function(n){return new Gi.default(n)},Gi.default),{isClass:!0});var KU="Range",e7=[],Bh=S(KU,e7,()=>{function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=r!=null;if(i){if(tt(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(tt(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(tt(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(t):0,this.step=o?parseFloat(r):1}return n.prototype.type="Range",n.prototype.isRange=!0,n.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),r=t.map(function(a){return parseFloat(a)}),i=r.some(function(a){return isNaN(a)});if(i)return null;switch(r.length){case 2:return new n(r[0],r[1]);case 3:return new n(r[0],r[2],r[1]);default:return null}},n.prototype.clone=function(){return new n(this.start,this.end,this.step)},n.prototype.size=function(){var e=0,t=this.start,r=this.step,i=this.end,a=i-t;return pi(r)===pi(a)?e=Math.ceil(a/r):a===0&&(e=0),isNaN(e)&&(e=0),[e]},n.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},n.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},n.prototype.forEach=function(e){var t=this.start,r=this.step,i=this.end,a=0;if(r>0)for(;ti;)e(t,[a],this),t+=r,a++},n.prototype.map=function(e){var t=[];return this.forEach(function(r,i,a){t[i[0]]=e(r,i,a)}),t},n.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},n.prototype.valueOf=function(){return this.toArray()},n.prototype.format=function(e){var t=Ni(this.start,e);return this.step!==1&&(t+=":"+Ni(this.step,e)),t+=":"+Ni(this.end,e),t},n.prototype.toString=function(){return this.format()},n.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},n.fromJSON=function(e){return new n(e.start,e.end,e.step)},n},{isClass:!0});var t7="Matrix",r7=[],Oh=S(t7,r7,()=>{function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator")}return n.prototype.type="Matrix",n.prototype.isMatrix=!0,n.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},n.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},n.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},n.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},n.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},n.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},n.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},n.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},n.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},n.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},n.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},n.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},n.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},n.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},n.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},n.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},n.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},n},{isClass:!0});function SC(n){var e=0,t=1,r=Object.create(null),i=Object.create(null),a=0,o=function(u){var s=i[u];if(s&&(delete r[s],delete i[u],--e,t===s)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(r,++t););}};return n=Math.abs(n),{hit:function(u){var s=i[u],c=++a;if(r[c]=u,i[u]=c,!s)return++e,e<=n?void 0:(u=r[t],o(u),u);if(delete r[s],t===s)for(;!Object.prototype.hasOwnProperty.call(r,++t););},delete:o,clear:function(){e=a=0,t=1,r=Object.create(null),i=Object.create(null)}}}function zo(n){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t==null?Number.POSITIVE_INFINITY:t,e=e==null?JSON.stringify:e,function r(){typeof r.cache!="object"&&(r.cache={values:new Map,lru:SC(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a{var{Matrix:e}=n;function t(c,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!xr(f))throw new Error("Invalid datatype: "+f);if(He(c))c.type==="DenseMatrix"?(this._data=Ye(c._data),this._size=Ye(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&Mt(c.data)&&Mt(c.size))this._data=c.data,this._size=c.size,ph(this._data,this._size),this._datatype=f||c.datatype;else if(Mt(c))this._data=s(c),this._size=et(this._data),ph(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+St(c)+")");this._data=[],this._size=[0],this._datatype=f}}t.prototype=new e,t.prototype.createDenseMatrix=function(c,f){return new t(c,f)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Ha(this._data,St)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(c,f){return new t(c,f)},t.prototype.subset=function(c,f,p){switch(arguments.length){case 1:return r(this,c);case 2:case 3:return a(this,c,f,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(c){if(!Mt(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new ot(c.length,this._size.length);for(var f=0;f");var v=f.max().map(function(b){return b+1});u(c,v,m);var x=h.length,_=0;o(c._data,f,p,x,_)}return c}function o(c,f,p,m,h){var d=h===m-1,g=f.dimension(h);d?g.forEach(function(y,w){zt(y),c[y]=p[w[0]]}):g.forEach(function(y,w){zt(y),o(c[y],f,p[w[0]],m,h+1)})}t.prototype.resize=function(c,f,p){if(!Sn(c))throw new TypeError("Array or Matrix expected");var m=c.valueOf().map(d=>Array.isArray(d)&&d.length===1?d[0]:d),h=p?this.clone():this;return l(h,m,f)};function l(c,f,p){if(f.length===0){for(var m=c._data;Mt(m);)m=m[0];return m}return c._size=f.slice(0),c._data=Mi(c._data,c._size,p),c}t.prototype.reshape=function(c,f){var p=f?this.clone():this;p._data=$u(p._data,c);var m=p._size.reduce((h,d)=>h*d);return p._size=Hu(c,m),p};function u(c,f,p){for(var m=c._size.slice(0),h=!1;m.lengthm[d]&&(m[d]=f[d],h=!0);h&&l(c,m,p)}t.prototype.clone=function(){var c=new t({data:Ye(this._data),size:Ye(this._size),datatype:this._datatype});return c},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(c){var f=this,p=$f(c),m=function g(y,w){return Mt(y)?y.map(function(v,x){return g(v,w.concat(x))}):p===1?c(y):p===2?c(y,w):c(y,w,f)},h=m(this._data,[]),d=this._datatype!==void 0?Ha(h,St):void 0;return new t(h,d)},t.prototype.forEach=function(c){var f=this,p=function m(h,d){Mt(h)?h.forEach(function(g,y){m(g,d.concat(y))}):c(h,d,f)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var c=function*f(p,m){if(Mt(p))for(var h=0;h[v[y]]);f.push(new t(w,c._datatype))},d=0;d0?c:0,p=c<0?-c:0,m=this._size[0],h=this._size[1],d=Math.min(m-p,h-f),g=[],y=0;y0?p:0,d=p<0?-p:0,g=c[0],y=c[1],w=Math.min(g-d,y-h),v;if(Mt(f)){if(f.length!==w)throw new Error("Invalid value array length");v=function(C){return f[C]}}else if(He(f)){var x=f.size();if(x.length!==1||x[0]!==w)throw new Error("Invalid matrix length");v=function(C){return f.get([C])}}else v=function(){return f};m||(m=tt(v(0))?v(0).mul(0):0);var _=[];if(c.length>0){_=Mi(_,c,m);for(var b=0;b{var{typed:e}=n;return e(NC,{any:Ye})});function Hf(n){var e=n.length,t=n[0].length,r,i,a=[];for(i=0;i=r.length)throw new on(e,r.length);return He(n)?n.create(Gf(n.valueOf(),e,t)):Gf(n,e,t)}function Gf(n,e,t){var r,i,a,o;if(e<=0)if(Array.isArray(n[0])){for(o=Hf(n),i=[],r=0;r{var{typed:e}=n;return e(MC,{number:ze,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var kn="number",ga="number, number";function Vh(n){return Math.abs(n)}Vh.signature=kn;function Uh(n,e){return n+e}Uh.signature=ga;function qh(n,e){return n-e}qh.signature=ga;function zh(n,e){return n*e}zh.signature=ga;function s7(n,e){return n/e}s7.signature=ga;function $h(n){return-n}$h.signature=kn;function Hh(n){return n}Hh.signature=kn;function qs(n){return LE(n)}qs.signature=kn;function Gh(n){return n*n*n}Gh.signature=kn;function Wh(n){return Math.exp(n)}Wh.signature=kn;function jh(n){return VE(n)}jh.signature=kn;function u7(n,e){if(!ze(n)||!ze(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=n%e,n=e,e=t;return n<0?-n:n}u7.signature=ga;function Zh(n,e){if(!ze(n)||!ze(e))throw new Error("Parameters in function lcm must be integer numbers");if(n===0||e===0)return 0;for(var t,r=n*e;e!==0;)t=e,e=n%t,n=t;return Math.abs(r/n)}Zh.signature=ga;function TC(n,e){return e?Math.log(n)/Math.log(e):Math.log(n)}function Jh(n){return kE(n)}Jh.signature=kn;function Yh(n){return RE(n)}Yh.signature=kn;function l7(n){return Ef(n)}l7.signature=kn;function c7(n,e){return e===0?n:n-e*Math.floor(n/e)}c7.signature=ga;function Xh(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=e<0;if(t&&(e=-e),e===0)throw new Error("Root must be non-zero");if(n<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(n===0)return t?1/0:0;if(!isFinite(n))return t?0:n;var r=Math.pow(Math.abs(n),1/e);return r=n<0?-r:r,t?1/r:r}function Wf(n){return pi(n)}Wf.signature=kn;function f7(n){return Math.sqrt(n)}f7.signature=kn;function Qh(n){return n*n}Qh.signature=kn;function Kh(n,e){var t,r,i,a=0,o=1,l=1,u=0;if(!ze(n)||!ze(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)r=Math.floor(n/e),i=n-r*e,t=a,a=o-r*a,o=t,t=l,l=u-r*l,u=t,n=e,e=i;var s;return n<0?s=[-n,-o,-u]:s=[n,n?o:0,u],s}Kh.signature=ga;function eg(n,e){return n*n<1&&e===1/0||n*n>1&&e===-1/0?0:Math.pow(n,e)}eg.signature=ga;function tg(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!ze(e)||e<0||e>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(lh(n,e))}function p7(n){return Math.abs(n)}p7.signature=kn;var m7="number",zs="number, number";function rg(n,e){if(!ze(n)||!ze(e))throw new Error("Integers expected in function bitAnd");return n&e}rg.signature=zs;function ng(n){if(!ze(n))throw new Error("Integer expected in function bitNot");return~n}ng.signature=m7;function ig(n,e){if(!ze(n)||!ze(e))throw new Error("Integers expected in function bitOr");return n|e}ig.signature=zs;function ag(n,e){if(!ze(n)||!ze(e))throw new Error("Integers expected in function bitXor");return n^e}ag.signature=zs;function og(n,e){if(!ze(n)||!ze(e))throw new Error("Integers expected in function leftShift");return n<>e}sg.signature=zs;function ug(n,e){if(!ze(n)||!ze(e))throw new Error("Integers expected in function rightLogShift");return n>>>e}ug.signature=zs;function ei(n,e){if(e>1;return ei(n,t)*ei(t+1,e)}function lg(n,e){if(!ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinations");if(!ze(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>n)throw new TypeError("k must be less than or equal to n");for(var t=n-e,r=1,i=e171?1/0:ei(1,n-1);if(n<.5)return Math.PI/(Math.sin(Math.PI*n)*Ju(1-n));if(n>=171.35)return 1/0;if(n>85){var t=n*n,r=t*n,i=r*n,a=i*n;return Math.sqrt(2*Math.PI/n)*Math.pow(n/Math.E,n)*(1+1/(12*n)+1/(288*t)-139/(51840*r)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*n))}--n,e=$o[0];for(var o=1;o<$o.length;++o)e+=$o[o]/(n+o);var l=n+hg+.5;return Math.sqrt(2*Math.PI)*Math.pow(l,n+.5)*Math.exp(-l)*e}Ju.signature="number";var hg=4.7421875,$o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],gg=.9189385332046728,h7=5,g7=7,PC=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Yu(n){if(n<0)return NaN;if(n===0)return 1/0;if(!isFinite(n))return n;if(n<.5)return Math.log(Math.PI/Math.sin(Math.PI*n))-Yu(1-n);n=n-1;for(var e=n+h7+.5,t=PC[0],r=g7-1;r>=1;r--)t+=PC[r]/(n+r);return gg+(n+.5)*Math.log(e)-e+Math.log(t)}Yu.signature="number";var br="number",v7="number, number";function y7(n){return Math.acos(n)}y7.signature=br;function vg(n){return zE(n)}vg.signature=br;function yg(n){return Math.atan(1/n)}yg.signature=br;function xg(n){return isFinite(n)?(Math.log((n+1)/n)+Math.log(n/(n-1)))/2:0}xg.signature=br;function bg(n){return Math.asin(1/n)}bg.signature=br;function wg(n){var e=1/n;return Math.log(e+Math.sqrt(e*e+1))}wg.signature=br;function _g(n){return Math.acos(1/n)}_g.signature=br;function Ag(n){var e=1/n,t=Math.sqrt(e*e-1);return Math.log(t+e)}Ag.signature=br;function x7(n){return Math.asin(n)}x7.signature=br;function Dg(n){return $E(n)}Dg.signature=br;function b7(n){return Math.atan(n)}b7.signature=br;function w7(n,e){return Math.atan2(n,e)}w7.signature=v7;function Eg(n){return HE(n)}Eg.signature=br;function _7(n){return Math.cos(n)}_7.signature=br;function A7(n){return Nf(n)}A7.signature=br;function Cg(n){return 1/Math.tan(n)}Cg.signature=br;function Sg(n){var e=Math.exp(2*n);return(e+1)/(e-1)}Sg.signature=br;function Ng(n){return 1/Math.sin(n)}Ng.signature=br;function Mg(n){return n===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(n)-Math.exp(-n)))*pi(n)}Mg.signature=br;function Tg(n){return 1/Math.cos(n)}Tg.signature=br;function Fg(n){return 2/(Math.exp(n)+Math.exp(-n))}Fg.signature=br;function D7(n){return Math.sin(n)}D7.signature=br;function Ig(n){return GE(n)}Ig.signature=br;function E7(n){return Math.tan(n)}E7.signature=br;function C7(n){return Mf(n)}C7.signature=br;var Xu="number";function S7(n){return ze(n)}S7.signature=Xu;function Bg(n){return n<0}Bg.signature=Xu;function Og(n){return n>0}Og.signature=Xu;function Pg(n){return n===0}Pg.signature=Xu;function Rg(n){return Number.isNaN(n)}Rg.signature=Xu;var RC="isNegative",N7=["typed"],kg=S(RC,N7,n=>{var{typed:e}=n;return e(RC,{number:Bg,BigNumber:function(r){return r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s<0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var kC="isNumeric",M7=["typed"],Lg=S(kC,M7,n=>{var{typed:e}=n;return e(kC,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var LC="hasNumericValue",T7=["typed","isNumeric"],Vg=S(LC,T7,n=>{var{typed:e,isNumeric:t}=n;return e(LC,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var VC="isPositive",F7=["typed"],Ug=S(VC,F7,n=>{var{typed:e}=n;return e(VC,{number:Og,BigNumber:function(r){return!r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s>0&&r.n>0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var UC="isZero",I7=["typed"],qg=S(UC,I7,n=>{var{typed:e}=n;return e(UC,{number:Pg,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var qC="isNaN",B7=["typed"],zg=S(qC,B7,n=>{var{typed:e}=n;return e(qC,{number:Rg,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return Ze(r,Number.isNaN)}})});var zC="typeOf",O7=["typed"],$g=S(zC,O7,n=>{var{typed:e}=n;return e(zC,{any:St})});function Xr(n,e,t){if(t==null)return n.eq(e);if(n.eq(e))return!0;if(n.isNaN()||e.isNaN())return!1;if(n.isFinite()&&e.isFinite()){var r=n.minus(e).abs();if(r.isZero())return!0;var i=n.constructor.max(n.abs(),e.abs());return r.lte(i.times(t))}return!1}function $C(n,e,t){return Nr(n.re,e.re,t)&&Nr(n.im,e.im,t)}var di=S("compareUnits",["typed"],n=>{var{typed:e}=n;return{"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(!r.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),i.valueType()])(r.value,i.value)})}});var jf="equalScalar",P7=["typed","config"],Hg=S(jf,P7,n=>{var{typed:e,config:t}=n,r=di({typed:e});return e(jf,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Nr(a,o,t.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||Xr(a,o,t.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return $C(a,o,t.epsilon)}},r)}),ice=S(jf,["typed","config"],n=>{var{typed:e,config:t}=n;return e(jf,{"number, number":function(i,a){return Nr(i,a,t.epsilon)}})});var R7="SparseMatrix",k7=["typed","equalScalar","Matrix"],Gg=S(R7,k7,n=>{var{typed:e,equalScalar:t,Matrix:r}=n;function i(d,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!xr(g))throw new Error("Invalid datatype: "+g);if(He(d))a(this,d,g);else if(d&&Mt(d.index)&&Mt(d.ptr)&&Mt(d.size))this._values=d.values,this._index=d.index,this._ptr=d.ptr,this._size=d.size,this._datatype=g||d.datatype;else if(Mt(d))o(this,d,g);else{if(d)throw new TypeError("Unsupported type of data ("+St(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(d,g,y){g.type==="SparseMatrix"?(d._values=g._values?Ye(g._values):void 0,d._index=Ye(g._index),d._ptr=Ye(g._ptr),d._size=Ye(g._size),d._datatype=y||g._datatype):o(d,g.valueOf(),y||g._datatype)}function o(d,g,y){d._values=[],d._index=[],d._ptr=[],d._datatype=y;var w=g.length,v=0,x=t,_=0;if(xr(y)&&(x=e.find(t,[y,y])||t,_=e.convert(0,y)),w>0){var b=0;do{d._ptr.push(d._index.length);for(var D=0;D");if(v.length===1){var C=g.dimension(0);C.forEach(function(F,I){zt(F),d.set([F,0],y[I[0]],w)})}else{var A=g.dimension(0),E=g.dimension(1);A.forEach(function(F,I){zt(F),E.forEach(function(O,k){zt(O),d.set([F,O],y[I[0]][k[0]],w)})})}}return d}i.prototype.get=function(d){if(!Mt(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new ot(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=d[0],y=d[1];zt(g,this._size[0]),zt(y,this._size[1]);var w=s(g,this._ptr[y],this._ptr[y+1],this._index);return wx-1||v>_-1)&&(p(this,Math.max(w+1,x),Math.max(v+1,_),y),x=this._size[0],_=this._size[1]),zt(w,x),zt(v,_);var C=s(w,this._ptr[v],this._ptr[v+1],this._index);return CArray.isArray(x)&&x.length===1?x[0]:x);if(w.length!==2)throw new Error("Only two dimensions matrix are supported");w.forEach(function(x){if(!nt(x)||!ze(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+it(w)+")")});var v=y?this.clone():this;return p(v,w[0],w[1],g)};function p(d,g,y,w){var v=w||0,x=t,_=0;xr(d._datatype)&&(x=e.find(t,[d._datatype,d._datatype])||t,_=e.convert(0,d._datatype),v=e.convert(v,d._datatype));var b=!x(v,_),D=d._size[0],C=d._size[1],A,E,F;if(y>C){for(E=C;ED){if(b){var I=0;for(E=0;Eg-1&&(d._values.splice(F,1),d._index.splice(F,1),k++)}d._ptr[E]=d._values.length}return d._size[0]=g,d._size[1]=y,d}i.prototype.reshape=function(d,g){if(!Mt(d))throw new TypeError("Array expected");if(d.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");d.forEach(function(B){if(!nt(B)||!ze(B)||B<=-2||B===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+it(d)+")")});var y=this._size[0]*this._size[1];d=Hu(d,y);var w=d[0]*d[1];if(y!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=g?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return v;for(var x=[],_=0;_=g&&T<=y&&F(d._values[R],T-g,I-w)}else{for(var N={},V=O;V "+(this._values?it(this._values[D],d):"X")}return v},i.prototype.toString=function(){return it(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(d){if(d){if(tt(d)&&(d=d.toNumber()),!nt(d)||!ze(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var g=d>0?d:0,y=d<0?-d:0,w=this._size[0],v=this._size[1],x=Math.min(w-y,v-g),_=[],b=[],D=[];D[0]=0;for(var C=g;C0?y:0,D=y<0?-y:0,C=d[0],A=d[1],E=Math.min(C-D,A-b),F;if(Mt(g)){if(g.length!==E)throw new Error("Invalid value array length");F=function(X){return g[X]}}else if(He(g)){var I=g.size();if(I.length!==1||I[0]!==E)throw new Error("Invalid matrix length");F=function(X){return g.get([X])}}else F=function(){return g};for(var O=[],k=[],R=[],T=0;T=0&&N=D||v[A]!==g)){var F=w?w[C]:void 0;v.splice(A,0,g),w&&w.splice(A,0,F),v.splice(A<=C?C+1:C,1),w&&w.splice(A<=C?C+1:C,1);continue}if(A=D||v[C]!==d)){var I=w?w[A]:void 0;v.splice(C,0,d),w&&w.splice(C,0,I),v.splice(C<=A?A+1:A,1),w&&w.splice(C<=A?A+1:A,1)}}},i},{isClass:!0});var L7="number",V7=["typed"];function U7(n){var e=n.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],i=e[3];return{input:n,radix:t,integerPart:r,fractionalPart:i}}else return null}function q7(n){for(var e=parseInt(n.integerPart,n.radix),t=0,r=0;r{var{typed:e}=n,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=U7(i);if(a)return q7(a);var o=0,l=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(o=Number(l[2]),i=l[1]);var u=Number(i);if(isNaN(u))throw new SyntaxError('String "'+i+'" is not a valid number');if(l){if(u>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));u>=2**(o-1)&&(u=u-2**o)}return u},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t});var HC="string",z7=["typed"],jg=S(HC,z7,n=>{var{typed:e}=n;return e(HC,{"":function(){return""},number:Ni,null:function(r){return"null"},boolean:function(r){return r+""},string:function(r){return r},"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t)),any:function(r){return String(r)}})});var GC="boolean",$7=["typed"],Zg=S(GC,$7,n=>{var{typed:e}=n;return e(GC,{"":function(){return!1},boolean:function(r){return r},number:function(r){return!!r},null:function(r){return!1},BigNumber:function(r){return!r.isZero()},string:function(r){var i=r.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(r);if(r!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+r+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var H7="bignumber",G7=["typed","BigNumber"],Jg=S(H7,G7,n=>{var{typed:e,BigNumber:t}=n;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],l=t(a[1]),u=new t(2).pow(Number(o));if(l.gt(u.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new t(2).pow(Number(o)-1);return l.gte(s)?l.sub(u):l}return new t(i)},BigNumber:function(i){return i},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))})});var W7="complex",j7=["typed","Complex"],Yg=S(W7,j7,n=>{var{typed:e,Complex:t}=n;return e("complex",{"":function(){return t.ZERO},number:function(i){return new t(i,0)},"number, number":function(i,a){return new t(i,a)},"BigNumber, BigNumber":function(i,a){return new t(i.toNumber(),a.toNumber())},Fraction:function(i){return new t(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return t(i)},null:function(i){return t(0)},Object:function(i){if("re"in i&&"im"in i)return new t(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new t(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))})});var Z7="fraction",J7=["typed","Fraction"],Xg=S(Z7,J7,n=>{var{typed:e,Fraction:t}=n;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,a){return new t(i,a)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))})});var WC="matrix",Y7=["typed","Matrix","DenseMatrix","SparseMatrix"],Qg=S(WC,Y7,n=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e(WC,{"":function(){return a([])},string:function(l){return a([],l)},"string, string":function(l,u){return a([],l,u)},Array:function(l){return a(l)},Matrix:function(l){return a(l,l.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,l,u){if(l==="dense"||l==="default"||l===void 0)return new r(o,u);if(l==="sparse")return new i(o,u);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}});var jC="matrixFromFunction",X7=["typed","matrix","isZero"],Kg=S(jC,X7,n=>{var{typed:e,matrix:t,isZero:r}=n;return e(jC,{"Array | Matrix, function, string, string":function(o,l,u,s){return i(o,l,u,s)},"Array | Matrix, function, string":function(o,l,u){return i(o,l,u)},"Matrix, function":function(o,l){return i(o,l,"dense")},"Array, function":function(o,l){return i(o,l,"dense").toArray()},"Array | Matrix, string, function":function(o,l,u){return i(o,u,l)},"Array | Matrix, string, string, function":function(o,l,u,s){return i(o,s,l,u)}});function i(a,o,l,u){var s;return u!==void 0?s=t(l,u):s=t(l),s.resize(a),s.forEach(function(c,f){var p=o(f);r(p)||s.set(f,p)}),s}});var ZC="matrixFromRows",Q7=["typed","matrix","flatten","size"],ev=S(ZC,Q7,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(ZC,{"...Array":function(u){return a(u)},"...Matrix":function(u){return t(a(u.map(s=>s.toArray())))}});function a(l){if(l.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var u=o(l[0]),s=[];for(var c of l){var f=o(c);if(f!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(f|0));s.push(r(c))}return s}function o(l){var u=i(l);if(u.length===1)return u[0];if(u.length===2){if(u[0]===1)return u[1];if(u[1]===1)return u[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var JC="matrixFromColumns",K7=["typed","matrix","flatten","size"],tv=S(JC,K7,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(JC,{"...Array":function(u){return a(u)},"...Matrix":function(u){return t(a(u.map(s=>s.toArray())))}});function a(l){if(l.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var u=o(l[0]),s=[],c=0;c{var{typed:e}=n;return e(YC,{"Unit, Array":function(r,i){return r.splitUnit(i)}})});var XC="unaryMinus",tq=["typed"],nv=S(XC,tq,n=>{var{typed:e}=n;return e(XC,{number:$h,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var i=r.clone();return i.value=e.find(t,i.valueType())(r.value),i}),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t,!0))})});var QC="unaryPlus",rq=["typed","config","BigNumber"],iv=S(QC,rq,n=>{var{typed:e,config:t,BigNumber:r}=n;return e(QC,{number:Hh,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>Ze(a,i,!0)),"boolean | string":function(a){return t.number==="BigNumber"?new r(+a):+a}})});var KC="abs",nq=["typed"],av=S(KC,nq,n=>{var{typed:e}=n;return e(KC,{number:Vh,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t,!0))})});var eS="apply",iq=["typed","isInteger"],Ho=S(eS,iq,n=>{var{typed:e,isInteger:t}=n;return e(eS,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!t(a))throw new TypeError("Integer number expected for dimension");var l=Array.isArray(i)?et(i):i.size();if(a<0||a>=l.length)throw new on(a,l.length);return He(i)?i.create(Zf(i.valueOf(),a,o)):Zf(i,a,o)}})});function Zf(n,e,t){var r,i,a;if(e<=0)if(Array.isArray(n[0])){for(a=aq(n),i=[],r=0;r{var{typed:e}=n;return e(tS,{"number, number":Uh,"Complex, Complex":function(r,i){return r.add(i)},"BigNumber, BigNumber":function(r,i){return r.plus(i)},"Fraction, Fraction":function(r,i){return r.add(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var rS="subtractScalar",sq=["typed"],sv=S(rS,sq,n=>{var{typed:e}=n;return e(rS,{"number, number":qh,"Complex, Complex":function(r,i){return r.sub(i)},"BigNumber, BigNumber":function(r,i){return r.minus(i)},"Fraction, Fraction":function(r,i){return r.sub(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var nS="cbrt",uq=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],uv=S(nS,uq,n=>{var{config:e,typed:t,isNegative:r,unaryMinus:i,matrix:a,Complex:o,BigNumber:l,Fraction:u}=n;return t(nS,{number:qs,Complex:s,"Complex, boolean":s,BigNumber:function(p){return p.cbrt()},Unit:c});function s(f,p){var m=f.arg()/3,h=f.abs(),d=new o(qs(h),0).mul(new o(0,m).exp());if(p){var g=[d,new o(qs(h),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(qs(h),0).mul(new o(0,m-Math.PI*2/3).exp())];return e.matrix==="Array"?g:a(g)}else return d}function c(f){if(f.value&&Cn(f.value)){var p=f.clone();return p.value=1,p=p.pow(1/3),p.value=s(f.value),p}else{var m=r(f.value);m&&(f.value=i(f.value));var h;tt(f.value)?h=new l(1).div(3):pa(f.value)?h=new u(1,3):h=1/3;var d=f.pow(h);return m&&(d.value=i(d.value)),d}}});var lq="matAlgo11xS0s",cq=["typed","equalScalar"],$t=S(lq,cq,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=t,y=0,w=o;typeof p=="string"&&(d=p,g=e.find(t,[d,d]),y=e.convert(0,d),a=e.convert(a,d),w=e.find(o,[d,d]));for(var v=[],x=[],_=[],b=0;b{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var y=[],w=[],v=[],x=0;x{var{typed:e}=n;return function(i,a,o,l){var u=i._data,s=i._size,c=i._datatype,f,p=o;typeof c=="string"&&(f=c,a=e.convert(a,f),p=e.find(o,[f,f]));var m=s.length>0?t(p,0,s,s[0],u,a,l):[];return i.createDenseMatrix({data:m,size:Ye(s),datatype:f})};function t(r,i,a,o,l,u,s){var c=[];if(i===a.length-1)for(var f=0;f{var{typed:e,config:t,round:r}=n;return e(lv,{number:function(a){return Nr(a,r(a),t.epsilon)?r(a):Math.ceil(a)},"number, number":function(a,o){if(Nr(a,r(a,o),t.epsilon))return r(a,o);var[l,u]="".concat(a,"e").split("e"),s=Math.ceil(Number("".concat(l,"e").concat(Number(u)+o)));return[l,u]="".concat(s,"e").split("e"),Number("".concat(l,"e").concat(Number(u)-o))}})}),cv=S(lv,hq,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=n,u=$t({typed:e,equalScalar:a}),s=Ot({typed:e,DenseMatrix:l}),c=Mr({typed:e}),f=gq({typed:e,config:t,round:r});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.ceil()},"Complex, number":function(m,h){return m.ceil(h)},"Complex, BigNumber":function(m,h){return m.ceil(h.toNumber())},BigNumber:function(m){return Xr(m,r(m),t.epsilon)?r(m):m.ceil()},"BigNumber, BigNumber":function(m,h){return Xr(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),qo.ROUND_CEIL)},Fraction:function(m){return m.ceil()},"Fraction, number":function(m,h){return m.ceil(h)},"Fraction, BigNumber":function(m,h){return m.ceil(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>Ze(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Ze(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>u(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var iS="cube",vq=["typed"],fv=S(iS,vq,n=>{var{typed:e}=n;return e(iS,{number:Gh,Complex:function(r){return r.mul(r).mul(r)},BigNumber:function(r){return r.times(r).times(r)},Fraction:function(r){return r.pow(3)},Unit:function(r){return r.pow(3)}})});var aS="exp",yq=["typed"],pv=S(aS,yq,n=>{var{typed:e}=n;return e(aS,{number:Wh,Complex:function(r){return r.exp()},BigNumber:function(r){return r.exp()}})});var oS="expm1",xq=["typed","Complex"],mv=S(oS,xq,n=>{var{typed:e,Complex:t}=n;return e(oS,{number:jh,Complex:function(i){var a=Math.exp(i.re);return new t(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var dv="fix",bq=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],wq=S(dv,["typed","ceil","floor"],n=>{var{typed:e,ceil:t,floor:r}=n;return e(dv,{number:function(a){return a>0?r(a):t(a)},"number, number":function(a,o){return a>0?r(a,o):t(a,o)}})}),hv=S(dv,bq,n=>{var{typed:e,Complex:t,matrix:r,ceil:i,floor:a,equalScalar:o,zeros:l,DenseMatrix:u}=n,s=Ot({typed:e,DenseMatrix:u}),c=Mr({typed:e}),f=wq({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(m){return new t(m.re>0?Math.floor(m.re):Math.ceil(m.re),m.im>0?Math.floor(m.im):Math.ceil(m.im))},"Complex, number":function(m,h){return new t(m.re>0?a(m.re,h):i(m.re,h),m.im>0?a(m.im,h):i(m.im,h))},"Complex, BigNumber":function(m,h){var d=h.toNumber();return new t(m.re>0?a(m.re,d):i(m.re,d),m.im>0?a(m.im,d):i(m.im,d))},BigNumber:function(m){return m.isNegative()?i(m):a(m)},"BigNumber, number | BigNumber":function(m,h){return m.isNegative()?i(m,h):a(m,h)},Fraction:function(m){return m.s<0?m.ceil():m.floor()},"Fraction, number | BigNumber":function(m,h){return m.s<0?i(m,h):a(m,h)},"Array | Matrix":e.referToSelf(p=>m=>Ze(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,h)=>Ze(m,d=>p(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(r(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>o(m,0)?l(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var gv="floor",_q=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Aq=S(gv,["typed","config","round"],n=>{var{typed:e,config:t,round:r}=n;return e(gv,{number:function(a){return Nr(a,r(a),t.epsilon)?r(a):Math.floor(a)},"number, number":function(a,o){if(Nr(a,r(a,o),t.epsilon))return r(a,o);var[l,u]="".concat(a,"e").split("e"),s=Math.floor(Number("".concat(l,"e").concat(Number(u)+o)));return[l,u]="".concat(s,"e").split("e"),Number("".concat(l,"e").concat(Number(u)-o))}})}),Qu=S(gv,_q,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=n,u=$t({typed:e,equalScalar:a}),s=Ot({typed:e,DenseMatrix:l}),c=Mr({typed:e}),f=Aq({typed:e,config:t,round:r});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.floor()},"Complex, number":function(m,h){return m.floor(h)},"Complex, BigNumber":function(m,h){return m.floor(h.toNumber())},BigNumber:function(m){return Xr(m,r(m),t.epsilon)?r(m):m.floor()},"BigNumber, BigNumber":function(m,h){return Xr(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),qo.ROUND_FLOOR)},Fraction:function(m){return m.floor()},"Fraction, number":function(m,h){return m.floor(h)},"Fraction, BigNumber":function(m,h){return m.floor(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>Ze(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Ze(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>u(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var Dq="matAlgo02xDS0",Eq=["typed","equalScalar"],Tr=S(Dq,Eq,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,l){var u=i._data,s=i._size,c=i._datatype,f=a._values,p=a._index,m=a._ptr,h=a._size,d=a._datatype;if(s.length!==h.length)throw new ot(s.length,h.length);if(s[0]!==h[0]||s[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=s[0],y=s[1],w,v=t,x=0,_=o;typeof c=="string"&&c===d&&(w=c,v=e.find(t,[w,w]),x=e.convert(0,w),_=e.find(o,[w,w]));for(var b=[],D=[],C=[],A=0;A{var{typed:e}=n;return function(r,i,a,o){var l=r._data,u=r._size,s=r._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new ot(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],y,w=0,v=a;typeof s=="string"&&s===h&&(y=s,w=e.convert(0,y),v=e.find(a,[y,y]));for(var x=[],_=0;_{var{typed:e,equalScalar:t}=n;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new ot(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],w=c[1],v,x=t,_=0,b=o;typeof f=="string"&&f===g&&(v=f,x=e.find(t,[v,v]),_=e.convert(0,v),b=e.find(o,[v,v]));var D=l&&p?[]:void 0,C=[],A=[],E=D?[]:void 0,F=D?[]:void 0,I=[],O=[],k,R,T,N;for(R=0;R{var{typed:e}=n;return function(i,a,o){var l=i._data,u=i._size,s=i._datatype,c=a._data,f=a._size,p=a._datatype,m=[];if(u.length!==f.length)throw new ot(u.length,f.length);for(var h=0;h0?t(g,0,m,m[0],l,c):[];return i.createDenseMatrix({data:y,size:m,datatype:d})};function t(r,i,a,o,l,u){var s=[];if(i===a.length-1)for(var c=0;c{var{concat:e}=n;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((h,d)=>h===a._size[d]))return[i,a];for(var l=t(i._size,o,0),u=t(a._size,o,0),s=[],c=0;c{var{typed:e,matrix:t,concat:r}=n,i=sS({typed:e}),a=Mr({typed:e}),o=uS({concat:r});return function(u){var s=u.elop,c=u.SD||u.DS,f;s?(f={"DenseMatrix, DenseMatrix":(d,g)=>i(...o(d,g),s),"Array, Array":(d,g)=>i(...o(t(d),t(g)),s).valueOf(),"Array, DenseMatrix":(d,g)=>i(...o(t(d),g),s),"DenseMatrix, Array":(d,g)=>i(...o(d,t(g)),s)},u.SS&&(f["SparseMatrix, SparseMatrix"]=(d,g)=>u.SS(...o(d,g),s,!1)),u.DS&&(f["DenseMatrix, SparseMatrix"]=(d,g)=>u.DS(...o(d,g),s,!1),f["Array, SparseMatrix"]=(d,g)=>u.DS(...o(t(d),g),s,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(d,g)=>c(...o(g,d),s,!0),f["SparseMatrix, Array"]=(d,g)=>c(...o(t(g),d),s,!0))):(f={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,y)=>i(...o(g,y),d)),"Array, Array":e.referToSelf(d=>(g,y)=>i(...o(t(g),t(y)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,y)=>i(...o(t(g),y),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,y)=>i(...o(g,t(y)),d))},u.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,y)=>u.SS(...o(g,y),d,!1))),u.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,y)=>u.DS(...o(g,y),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(g,y)=>u.DS(...o(t(g),y),d,!1))),c&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,y)=>c(...o(y,g),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(g,y)=>c(...o(t(y),g),d,!0))));var p=u.scalar||"any",m=u.Ds||u.Ss;m&&(s?(f["DenseMatrix,"+p]=(d,g)=>a(d,g,s,!1),f[p+", DenseMatrix"]=(d,g)=>a(g,d,s,!0),f["Array,"+p]=(d,g)=>a(t(d),g,s,!1).valueOf(),f[p+", Array"]=(d,g)=>a(t(g),d,s,!0).valueOf()):(f["DenseMatrix,"+p]=e.referToSelf(d=>(g,y)=>a(g,y,d,!1)),f[p+", DenseMatrix"]=e.referToSelf(d=>(g,y)=>a(y,g,d,!0)),f["Array,"+p]=e.referToSelf(d=>(g,y)=>a(t(g),y,d,!1).valueOf()),f[p+", Array"]=e.referToSelf(d=>(g,y)=>a(t(y),g,d,!0).valueOf())));var h=u.sS!==void 0?u.sS:u.Ss;return s?(u.Ss&&(f["SparseMatrix,"+p]=(d,g)=>u.Ss(d,g,s,!1)),h&&(f[p+", SparseMatrix"]=(d,g)=>h(g,d,s,!0))):(u.Ss&&(f["SparseMatrix,"+p]=e.referToSelf(d=>(g,y)=>u.Ss(g,y,d,!1))),h&&(f[p+", SparseMatrix"]=e.referToSelf(d=>(g,y)=>h(y,g,d,!0)))),s&&s.signatures&&Df(f,s.signatures),f}});var lS="mod",Rq=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Ku=S(lS,Rq,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}=n,s=Qu({typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}),c=Tr({typed:e,equalScalar:a}),f=rr({typed:e}),p=Ya({typed:e,equalScalar:a}),m=$t({typed:e,equalScalar:a}),h=Ot({typed:e,DenseMatrix:l}),d=lt({typed:e,matrix:i,concat:u});return e(lS,{"number, number":g,"BigNumber, BigNumber":function(w,v){return v.isZero()?w:w.sub(v.mul(s(w.div(v))))},"Fraction, Fraction":function(w,v){return v.equals(0)?w:w.sub(v.mul(s(w.div(v))))}},d({SS:p,DS:f,SD:c,Ss:m,sS:h}));function g(y,w){return w===0?y:y-w*s(y/w)}});var kq="matAlgo01xDSid",Lq=["typed"],gn=S(kq,Lq,n=>{var{typed:e}=n;return function(r,i,a,o){var l=r._data,u=r._size,s=r._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new ot(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],y=typeof s=="string"&&s===h?s:void 0,w=y?e.find(a,[y,y]):a,v,x,_=[];for(v=0;v{var{typed:e,equalScalar:t}=n;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new ot(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],w=c[1],v,x=t,_=0,b=o;typeof f=="string"&&f===g&&(v=f,x=e.find(t,[v,v]),_=e.convert(0,v),b=e.find(o,[v,v]));var D=l&&p?[]:void 0,C=[],A=[],E=l&&p?[]:void 0,F=l&&p?[]:void 0,I=[],O=[],k,R,T,N,V;for(R=0;R{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var y=[],w=[],v=[],x=0;xArray.isArray(e))}var yv=S(cS,$q,n=>{var{typed:e,matrix:t,config:r,round:i,equalScalar:a,zeros:o,BigNumber:l,DenseMatrix:u,concat:s}=n,c=Ku({typed:e,config:r,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:u,concat:s}),f=gn({typed:e}),p=$s({typed:e,equalScalar:a}),m=Ln({typed:e,DenseMatrix:u}),h=lt({typed:e,matrix:t,concat:s});return e(cS,{"number, number":d,"BigNumber, BigNumber":g,"Fraction, Fraction":(y,w)=>y.gcd(w)},h({SS:p,DS:f,Ss:m}),{[Hq]:e.referToSelf(y=>(w,v,x)=>{for(var _=y(w,v),b=0;bw=>{if(w.length===1&&Array.isArray(w[0])&&fS(w[0]))return y(...w[0]);if(fS(w))return y(...w);throw new va("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(y=>w=>y(w.toArray()))});function d(y,w){if(!ze(y)||!ze(w))throw new Error("Parameters in function gcd must be integer numbers");for(var v;w!==0;)v=c(y,w),y=w,w=v;return y<0?-y:y}function g(y,w){if(!y.isInt()||!w.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new l(0);!w.isZero();){var x=c(y,w);y=w,w=x}return y.lt(v)?y.neg():y}});var Gq="matAlgo06xS0S0",Wq=["typed","equalScalar"],Xa=S(Gq,Wq,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var l=i._values,u=i._size,s=i._datatype,c=a._values,f=a._size,p=a._datatype;if(u.length!==f.length)throw new ot(u.length,f.length);if(u[0]!==f[0]||u[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");var m=u[0],h=u[1],d,g=t,y=0,w=o;typeof s=="string"&&s===p&&(d=s,g=e.find(t,[d,d]),y=e.convert(0,d),w=e.find(o,[d,d]));for(var v=l&&c?[]:void 0,x=[],_=[],b=v?[]:void 0,D=[],C=[],A=0;A{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=Tr({typed:e,equalScalar:r}),o=Xa({typed:e,equalScalar:r}),l=$t({typed:e,equalScalar:r}),u=lt({typed:e,matrix:t,concat:i}),s="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(s,", ").concat(s,", ...").concat(s)]=e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),y=0;yp.lcm(m)},u({SS:o,DS:a,Ss:l}),c);function f(p,m){if(!p.isInt()||!m.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(p.isZero())return p;if(m.isZero())return m;for(var h=p.times(m);!m.isZero();){var d=m;m=p.mod(d),p=d}return h.div(p).abs()}});var mS="log10",Zq=["typed","config","Complex"],bv=S(mS,Zq,n=>{var{typed:e,config:t,Complex:r}=n;return e(mS,{number:function(a){return a>=0||t.predictable?Jh(a):new r(a,0).log().div(Math.LN10)},Complex:function(a){return new r(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new r(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>Ze(a,i))})});var dS="log2",Jq=["typed","config","Complex"],wv=S(dS,Jq,n=>{var{typed:e,config:t,Complex:r}=n;return e(dS,{number:function(o){return o>=0||t.predictable?Yh(o):i(new r(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new r(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>Ze(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new r(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var Yq="multiplyScalar",Xq=["typed"],_v=S(Yq,Xq,n=>{var{typed:e}=n;return e("multiplyScalar",{"number, number":zh,"Complex, Complex":function(r,i){return r.mul(i)},"BigNumber, BigNumber":function(r,i){return r.times(i)},"Fraction, Fraction":function(r,i){return r.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})});var hS="multiply",Qq=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Av=S(hS,Qq,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,equalScalar:a,dot:o}=n,l=$t({typed:e,equalScalar:a}),u=Mr({typed:e});function s(_,b){switch(_.length){case 1:switch(b.length){case 1:if(_[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(_[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+_[0]+") must match Matrix rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;case 2:switch(b.length){case 1:if(_[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+_[1]+") must match Vector length ("+b[0]+")");break;case 2:if(_[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+_[1]+") must match Matrix B rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+_.length+" dimensions)")}}function c(_,b,D){if(D===0)throw new Error("Cannot multiply two empty vectors");return o(_,b)}function f(_,b){if(b.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(_,b)}function p(_,b){var D=_._data,C=_._size,A=_._datatype,E=b._data,F=b._size,I=b._datatype,O=C[0],k=F[1],R,T=r,N=i;A&&I&&A===I&&typeof A=="string"&&(R=A,T=e.find(r,[R,R]),N=e.find(i,[R,R]));for(var V=[],B=0;Boe)for(var ue=0,ce=0;ce(b,D)=>{s(et(b),et(D));var C=_(t(b),t(D));return He(C)?C.valueOf():C}),"Matrix, Matrix":function(b,D){var C=b.size(),A=D.size();return s(C,A),C.length===1?A.length===1?c(b,D,C[0]):f(b,D):A.length===1?m(b,D):h(b,D)},"Matrix, Array":e.referTo("Matrix,Matrix",_=>(b,D)=>_(b,t(D))),"Array, Matrix":e.referToSelf(_=>(b,D)=>_(t(b,D.storage()),D)),"SparseMatrix, any":function(b,D){return l(b,D,i,!1)},"DenseMatrix, any":function(b,D){return u(b,D,i,!1)},"any, SparseMatrix":function(b,D){return l(D,b,i,!0)},"any, DenseMatrix":function(b,D){return u(D,b,i,!0)},"Array, any":function(b,D){return u(t(b),D,i,!1).valueOf()},"any, Array":function(b,D){return u(t(D),b,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(_=>(b,D,C)=>{for(var A=_(b,D),E=0;E{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,concat:a}=n,o=gn({typed:e}),l=Tr({typed:e,equalScalar:r}),u=Xa({typed:e,equalScalar:r}),s=$t({typed:e,equalScalar:r}),c=lt({typed:e,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(gS,{number:Xh,"number, number":Xh,BigNumber:m=>p(m,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",m=>h=>m(t(h),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",m=>h=>m(h,2)),SparseMatrix:e.referTo("SparseMatrix,number",m=>h=>m(h,2)),"SparseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return u(h,d,m);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return o(h,d,m,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",m=>(h,d)=>m(t(h),d)),"number | BigNumber, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return s(d,h,m,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:l,Ss:s,sS:!1}));function p(m,h){var d=i.precision,g=i.clone({precision:d+2}),y=new i(0),w=new g(1),v=h.isNegative();if(v&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(m.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(m.isZero())return v?new g(1/0):0;if(!m.isFinite())return v?y:m;var x=m.abs().pow(w.div(h));return x=m.isNeg()?x.neg():x,new i((v?w.div(x):x).toPrecision(d))}});var vS="sign",ez=["typed","BigNumber","Fraction","complex"],Ev=S(vS,ez,n=>{var{typed:e,BigNumber:t,complex:r,Fraction:i}=n;return e(vS,{number:Wf,Complex:function(o){return o.im===0?r(Wf(o.re)):o.sign()},BigNumber:function(o){return new t(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":e.referToSelf(a=>o=>Ze(o,a,!0)),Unit:e.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return e.find(a,o.valueType())(o.value)})})});var tz="sqrt",rz=["config","typed","Complex"],Cv=S(tz,rz,n=>{var{config:e,typed:t,Complex:r}=n;return t("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new r(a,0).sqrt()}});var yS="square",nz=["typed"],Sv=S(yS,nz,n=>{var{typed:e}=n;return e(yS,{number:Qh,Complex:function(r){return r.mul(r)},BigNumber:function(r){return r.times(r)},Fraction:function(r){return r.mul(r)},Unit:function(r){return r.pow(2)}})});var xS="subtract",iz=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Nv=S(xS,iz,n=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:l}=n,u=gn({typed:e}),s=rr({typed:e}),c=Ya({typed:e,equalScalar:r}),f=Ln({typed:e,DenseMatrix:o}),p=Ot({typed:e,DenseMatrix:o}),m=lt({typed:e,matrix:t,concat:l});return e(xS,{"any, any":i},m({elop:i,SS:c,DS:u,SD:s,Ss:p,sS:f}))});var bS="xgcd",az=["typed","config","matrix","BigNumber"],Mv=S(bS,az,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(bS,{"number, number":function(l,u){var s=Kh(l,u);return t.matrix==="Array"?s:r(s)},"BigNumber, BigNumber":a});function a(o,l){var u,s,c,f=new i(0),p=new i(1),m=f,h=p,d=p,g=f;if(!o.isInt()||!l.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!l.isZero();)s=o.div(l).floor(),c=o.mod(l),u=m,m=h.minus(s.times(m)),h=u,u=d,d=g.minus(s.times(d)),g=u,o=l,l=c;var y;return o.lt(f)?y=[o.neg(),h.neg(),g.neg()]:y=[o,o.isZero()?0:h,g],t.matrix==="Array"?y:r(y)}});var wS="invmod",oz=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Tv=S(wS,oz,n=>{var{typed:e,config:t,BigNumber:r,xgcd:i,equal:a,smaller:o,mod:l,add:u,isInteger:s}=n;return e(wS,{"number, number":c,"BigNumber, BigNumber":c});function c(f,p){if(!s(f)||!s(p))throw new Error("Parameters in function invmod must be integer numbers");if(f=l(f,p),a(p,0))throw new Error("Divisor must be non zero");var m=i(f,p);m=m.valueOf();var[h,d]=m;return a(h,r(1))?(d=l(d,p),o(d,r(0))&&(d=u(d,p)),d):NaN}});var sz="matAlgo09xS0Sf",uz=["typed","equalScalar"],Jf=S(sz,uz,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new ot(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],w=c[1],v,x=t,_=0,b=o;typeof f=="string"&&f===g&&(v=f,x=e.find(t,[v,v]),_=e.convert(0,v),b=e.find(o,[v,v]));var D=l&&p?[]:void 0,C=[],A=[],E=D?[]:void 0,F=[],I,O,k,R,T;for(O=0;O{var{typed:e,matrix:t,equalScalar:r,multiplyScalar:i,concat:a}=n,o=Tr({typed:e,equalScalar:r}),l=Jf({typed:e,equalScalar:r}),u=$t({typed:e,equalScalar:r}),s=lt({typed:e,matrix:t,concat:a});return e(_S,s({elop:i,SS:l,DS:o,Ss:u}))});function AS(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero()||e.eq(-1)||n.eq(e))return n;if(e.isZero()||n.eq(-1))return e;if(!n.isFinite()||!e.isFinite()){if(!n.isFinite()&&!e.isFinite())return n.isNegative()===e.isNegative()?n:new t(0);if(!n.isFinite())return e.isNegative()?n:n.isNegative()?new t(0):e;if(!e.isFinite())return n.isNegative()?e:e.isNegative()?new t(0):n}return Iv(n,e,function(r,i){return r&i})}function Hs(n){if(n.isFinite()&&!n.isInteger())throw new Error("Integer expected in function bitNot");var e=n.constructor,t=e.precision;e.config({precision:1e9});var r=n.plus(new e(1));return r.s=-r.s||null,e.config({precision:t}),r}function DS(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);var r=new t(-1);return n.isZero()||e.eq(r)||n.eq(e)?e:e.isZero()||n.eq(r)?n:!n.isFinite()||!e.isFinite()?!n.isFinite()&&!n.isNegative()&&e.isNegative()||n.isNegative()&&!e.isNegative()&&!e.isFinite()?r:n.isNegative()&&e.isNegative()?n.isFinite()?n:e:n.isFinite()?e:n:Iv(n,e,function(i,a){return i|a})}function Iv(n,e,t){var r=n.constructor,i,a,o=+(n.s<0),l=+(e.s<0);if(o){i=Yf(Hs(n));for(var u=0;u0;)t(c[--m],f[--h])===d&&(g=g.plus(y)),y=y.times(w);for(;h>0;)t(p,f[--h])===d&&(g=g.plus(y)),y=y.times(w);return r.config({precision:v}),d===0&&(g.s=-g.s),g}function Yf(n){for(var e=n.d,t=e[0]+"",r=1;r0)if(++l>s)for(l-=s;l--;)u+="0";else l1&&((c[m+1]===null||c[m+1]===void 0)&&(c[m+1]=0),c[m+1]+=c[m]>>1,c[m]&=1)}return c.reverse()}function ES(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero())return e;if(e.isZero())return n;if(n.eq(e))return new t(0);var r=new t(-1);return n.eq(r)?Hs(e):e.eq(r)?Hs(n):!n.isFinite()||!e.isFinite()?!n.isFinite()&&!e.isFinite()?r:new t(n.isNegative()===e.isNegative()?1/0:-1/0):Iv(n,e,function(i,a){return i^a})}function CS(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:!n.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?n.times(Math.pow(2,e.toNumber())+""):n.times(new t(2).pow(e))}function SS(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:e.isFinite()?e.lt(55)?n.div(Math.pow(2,e.toNumber())+"").floor():n.div(new t(2).pow(e)).floor():n.isNegative()?new t(-1):n.isFinite()?new t(0):new t(NaN)}var NS="bitAnd",cz=["typed","matrix","equalScalar","concat"],Bv=S(NS,cz,n=>{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=Tr({typed:e,equalScalar:r}),o=Xa({typed:e,equalScalar:r}),l=$t({typed:e,equalScalar:r}),u=lt({typed:e,matrix:t,concat:i});return e(NS,{"number, number":rg,"BigNumber, BigNumber":AS},u({SS:o,DS:a,Ss:l}))});var MS="bitNot",fz=["typed"],Ov=S(MS,fz,n=>{var{typed:e}=n;return e(MS,{number:ng,BigNumber:Hs,"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var TS="bitOr",pz=["typed","matrix","equalScalar","DenseMatrix","concat"],Pv=S(TS,pz,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=gn({typed:e}),l=$s({typed:e,equalScalar:r}),u=Ln({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:t,concat:a});return e(TS,{"number, number":ig,"BigNumber, BigNumber":DS},s({SS:l,DS:o,Ss:u}))});var mz="matAlgo07xSSf",dz=["typed","DenseMatrix"],Pr=S(mz,dz,n=>{var{typed:e,DenseMatrix:t}=n;return function(a,o,l){var u=a._size,s=a._datatype,c=o._size,f=o._datatype;if(u.length!==c.length)throw new ot(u.length,c.length);if(u[0]!==c[0]||u[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+c+")");var p=u[0],m=u[1],h,d=0,g=l;typeof s=="string"&&s===f&&(h=s,d=e.convert(0,h),g=e.find(l,[h,h]));var y,w,v=[];for(y=0;y{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=rr({typed:e}),o=Pr({typed:e,DenseMatrix:r}),l=Ot({typed:e,DenseMatrix:r}),u=lt({typed:e,matrix:t,concat:i});return e(FS,{"number, number":ag,"BigNumber, BigNumber":ES},u({SS:o,DS:a,Ss:l}))});var IS="arg",gz=["typed"],kv=S(IS,gz,n=>{var{typed:e}=n;return e(IS,{number:function(r){return Math.atan2(0,r)},BigNumber:function(r){return r.constructor.atan2(0,r)},Complex:function(r){return r.arg()},"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var BS="conj",vz=["typed"],Lv=S(BS,vz,n=>{var{typed:e}=n;return e(BS,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var OS="im",yz=["typed"],Vv=S(OS,yz,n=>{var{typed:e}=n;return e(OS,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var PS="re",xz=["typed"],Uv=S(PS,xz,n=>{var{typed:e}=n;return e(PS,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var RS="not",bz=["typed"],qv=S(RS,bz,n=>{var{typed:e}=n;return e(RS,{"null | undefined":()=>!0,number:fg,Complex:function(r){return r.re===0&&r.im===0},BigNumber:function(r){return r.isZero()||r.isNaN()},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Ze(r,t))})});var kS="or",wz=["typed","matrix","equalScalar","DenseMatrix","concat"],zv=S(kS,wz,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Ya({typed:e,equalScalar:r}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:t,concat:a});return e(kS,{"number, number":pg,"Complex, Complex":function(f,p){return f.re!==0||f.im!==0||p.re!==0||p.im!==0},"BigNumber, BigNumber":function(f,p){return!f.isZero()&&!f.isNaN()||!p.isZero()&&!p.isNaN()},"Unit, Unit":e.referToSelf(c=>(f,p)=>c(f.value||0,p.value||0))},s({SS:l,DS:o,Ss:u}))});var LS="xor",_z=["typed","matrix","DenseMatrix","concat"],$v=S(LS,_z,n=>{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=rr({typed:e}),o=Pr({typed:e,DenseMatrix:r}),l=Ot({typed:e,DenseMatrix:r}),u=lt({typed:e,matrix:t,concat:i});return e(LS,{"number, number":mg,"Complex, Complex":function(c,f){return(c.re!==0||c.im!==0)!=(f.re!==0||f.im!==0)},"BigNumber, BigNumber":function(c,f){return(!c.isZero()&&!c.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":e.referToSelf(s=>(c,f)=>s(c.value||0,f.value||0))},u({SS:o,DS:a,Ss:l}))});var VS="concat",Az=["typed","matrix","isInteger"],el=S(VS,Az,n=>{var{typed:e,matrix:t,isInteger:r}=n;return e(VS,{"...Array | Matrix | number | BigNumber":function(a){var o,l=a.length,u=-1,s,c=!1,f=[];for(o=0;o0&&u>s)throw new on(u,s+1)}else{var m=Ye(p).valueOf(),h=et(m);if(f[o]=m,s=u,u=h.length-1,o>0&&u!==s)throw new ot(s+1,u+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=dh(d,f.shift(),u);return c?t(d):d},"...string":function(a){return a.join("")}})});var US="column",Dz=["typed","Index","matrix","range"],tl=S(US,Dz,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(US,{"Matrix, number":a,"Array, number":function(l,u){return a(r(Ye(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");zt(l,o.size()[1]);var u=i(0,o.size()[0]),s=new t(u,l),c=o.subset(s);return He(c)?c:r([[c]])}});var qS="count",Ez=["typed","size","prod"],Hv=S(qS,Ez,n=>{var{typed:e,size:t,prod:r}=n;return e(qS,{string:function(a){return a.length},"Matrix | Array":function(a){return r(t(a))}})});var zS="cross",Cz=["typed","matrix","subtract","multiply"],Gv=S(zS,Cz,n=>{var{typed:e,matrix:t,subtract:r,multiply:i}=n;return e(zS,{"Matrix, Matrix":function(l,u){return t(a(l.toArray(),u.toArray()))},"Matrix, Array":function(l,u){return t(a(l.toArray(),u))},"Array, Matrix":function(l,u){return t(a(l,u.toArray()))},"Array, Array":a});function a(o,l){var u=Math.max(et(o).length,et(l).length);o=Rs(o),l=Rs(l);var s=et(o),c=et(l);if(s.length!==1||c.length!==1||s[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+s.join(", ")+"], B = ["+c.join(", ")+"])");var f=[r(i(o[1],l[2]),i(o[2],l[1])),r(i(o[2],l[0]),i(o[0],l[2])),r(i(o[0],l[1]),i(o[1],l[0]))];return u>1?[f]:f}});var $S="diag",Sz=["typed","matrix","DenseMatrix","SparseMatrix"],Wv=S($S,Sz,n=>{var{typed:e,matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e($S,{Array:function(s){return a(s,0,et(s),null)},"Array, number":function(s,c){return a(s,c,et(s),null)},"Array, BigNumber":function(s,c){return a(s,c.toNumber(),et(s),null)},"Array, string":function(s,c){return a(s,0,et(s),c)},"Array, number, string":function(s,c,f){return a(s,c,et(s),f)},"Array, BigNumber, string":function(s,c,f){return a(s,c.toNumber(),et(s),f)},Matrix:function(s){return a(s,0,s.size(),s.storage())},"Matrix, number":function(s,c){return a(s,c,s.size(),s.storage())},"Matrix, BigNumber":function(s,c){return a(s,c.toNumber(),s.size(),s.storage())},"Matrix, string":function(s,c){return a(s,0,s.size(),c)},"Matrix, number, string":function(s,c,f){return a(s,c,s.size(),f)},"Matrix, BigNumber, string":function(s,c,f){return a(s,c.toNumber(),s.size(),f)}});function a(u,s,c,f){if(!ze(s))throw new TypeError("Second parameter in function diag must be an integer");var p=s>0?s:0,m=s<0?-s:0;switch(c.length){case 1:return o(u,s,f,c[0],m,p);case 2:return l(u,s,f,c,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(u,s,c,f,p,m){var h=[f+p,f+m];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var d=c==="sparse"?i.diagonal(h,u,s):r.diagonal(h,u,s);return c!==null?d:d.valueOf()}function l(u,s,c,f,p,m){if(He(u)){var h=u.diagonal(s);return c!==null?c!==h.storage()?t(h,c):h:h.valueOf()}for(var d=Math.min(f[0]-p,f[1]-m),g=[],y=0;y=2&&d.push("index: ".concat(St(t))),m.length>=3&&d.push("array: ".concat(St(r))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(n.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(n.name,": ").concat(g.message))}}}var Nz="filter",Mz=["typed"],jv=S(Nz,Mz,n=>{var{typed:e}=n;return e("filter",{"Array, function":HS,"Matrix, function":function(r,i){return r.create(HS(r.toArray(),i))},"Array, RegExp":ks,"Matrix, RegExp":function(r,i){return r.create(ks(r.toArray(),i))}})});function HS(n,e){return If(n,function(t,r,i){return hi(e,t,[r],i,"filter")})}var GS="flatten",Tz=["typed","matrix"],Zv=S(GS,Tz,n=>{var{typed:e,matrix:t}=n;return e(GS,{Array:function(i){return pt(i)},Matrix:function(i){var a=pt(i.toArray());return t(a)}})});var WS="forEach",Fz=["typed"],Jv=S(WS,Fz,n=>{var{typed:e}=n;return e(WS,{"Array, function":Iz,"Matrix, function":function(r,i){r.forEach(i)}})});function Iz(n,e){var t=function r(i,a){if(Array.isArray(i))$a(i,function(o,l){r(o,a.concat(l))});else return hi(e,i,a,n,"forEach")};t(n,[])}var jS="getMatrixDataType",Bz=["typed"],Yv=S(jS,Bz,n=>{var{typed:e}=n;return e(jS,{Array:function(r){return Ha(r,St)},Matrix:function(r){return r.getDataType()}})});var ZS="identity",Oz=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Xv=S(ZS,Oz,n=>{var{typed:e,config:t,matrix:r,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=n;return e(ZS,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(c){return r(c)},"number | BigNumber":function(c){return u(c,c,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return u(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return u(c,f,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,p){return u(c,f,p)},Array:function(c){return l(c)},"Array, string":function(c,f){return l(c,f)},Matrix:function(c){return l(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return l(c.valueOf(),f)}});function l(s,c){switch(s.length){case 0:return c?r(c):[];case 1:return u(s[0],s[0],c);case 2:return u(s[0],s[1],c);default:throw new Error("Vector containing two values expected")}}function u(s,c,f){var p=tt(s)||tt(c)?i:null;if(tt(s)&&(s=s.toNumber()),tt(c)&&(c=c.toNumber()),!ze(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!ze(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var m=p?new i(1):1,h=p?new p(0):0,d=[s,c];if(f){if(f==="sparse")return o.diagonal(d,m,0,h);if(f==="dense")return a.diagonal(d,m,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Mi([],d,h),y=s{var{typed:e,matrix:t,multiplyScalar:r}=n;return e(JS,{"Matrix, Matrix":function(o,l){return t(i(o.toArray(),l.toArray()))},"Matrix, Array":function(o,l){return t(i(o.toArray(),l))},"Array, Matrix":function(o,l){return t(i(o,l.toArray()))},"Array, Array":i});function i(a,o){if(et(a).length===1&&(a=[a]),et(o).length===1&&(o=[o]),et(a).length>2||et(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var l=[],u=[];return a.map(function(s){return o.map(function(c){return u=[],l.push(u),s.map(function(f){return c.map(function(p){return u.push(r(f,p))})})})})&&l}});var YS="map",Rz=["typed"],Kv=S(YS,Rz,n=>{var{typed:e}=n;return e(YS,{"Array, function":kz,"Matrix, function":function(r,i){return r.map(i)}})});function kz(n,e){var t=function r(i,a){return Array.isArray(i)?i.map(function(o,l){return r(o,a.concat(l))}):hi(e,i,a,n,"map")};return t(n,[])}var XS="diff",Lz=["typed","matrix","subtract","number"],nl=S(XS,Lz,n=>{var{typed:e,matrix:t,subtract:r,number:i}=n;return e(XS,{"Array | Matrix":function(c){return He(c)?t(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!ze(f))throw new RangeError("Dimension must be a whole number");return He(c)?t(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",s=>(c,f)=>s(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",s=>(c,f)=>s(c,i(f)))});function a(s,c){if(He(s)&&(s=s.toArray()),!Array.isArray(s))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return s.forEach(p=>{f.push(a(p,c-1))}),f}else{if(c===0)return o(s);throw RangeError("Cannot have negative dimension")}}function o(s){for(var c=[],f=s.length,p=1;p{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e("ones",{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var c=s[s.length-1];if(typeof c=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var c=s.storage();return a(s.valueOf(),c)},"Array | Matrix, string":function(s,c){return a(s.valueOf(),c)}});function a(u,s){var c=o(u),f=c?new i(1):1;if(l(u),s){var p=r(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Mi(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){tt(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!ze(s)||s<0)throw new Error("Parameters in function ones must be positive integers")})}});function Gs(){throw new Error('No "bignumber" implementation available')}function Xf(){throw new Error('No "fraction" implementation available')}function Qf(){throw new Error('No "matrix" implementation available')}var QS="range",qz=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],il=S(QS,qz,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=n;return e(QS,{string:p,"string, boolean":p,"number, number":function(g,y){return f(m(g,y,1,!1))},"number, number, number":function(g,y,w){return f(m(g,y,w,!1))},"number, number, boolean":function(g,y,w){return f(m(g,y,1,w))},"number, number, number, boolean":function(g,y,w,v){return f(m(g,y,w,v))},"BigNumber, BigNumber":function(g,y){var w=g.constructor;return f(m(g,y,new w(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,y,w){return f(m(g,y,w,!1))},"BigNumber, BigNumber, boolean":function(g,y,w){var v=g.constructor;return f(m(g,y,new v(1),w))},"BigNumber, BigNumber, BigNumber, boolean":function(g,y,w,v){return f(m(g,y,w,v))},"Unit, Unit, Unit":function(g,y,w){return f(m(g,y,w,!1))},"Unit, Unit, Unit, boolean":function(g,y,w,v){return f(m(g,y,w,v))}});function f(d){return t.matrix==="Matrix"?r?r(d):Qf():d}function p(d,g){var y=h(d);if(!y)throw new SyntaxError('String "'+d+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&Gs(),f(m(i(y.start),i(y.end),i(y.step)),g)):f(m(y.start,y.end,y.step,g))}function m(d,g,y,w){for(var v=[],x=c(y)?w?o:a:w?u:l,_=d;x(_,g);)v.push(_),_=s(_,y);return v}function h(d){var g=d.split(":"),y=g.map(function(v){return Number(v)}),w=y.some(function(v){return isNaN(v)});if(w)return null;switch(y.length){case 2:return{start:y[0],end:y[1],step:1};case 3:return{start:y[0],end:y[2],step:y[1]};default:return null}}});var KS="reshape",zz=["typed","isInteger","matrix"],ty=S(KS,zz,n=>{var{typed:e,isInteger:t}=n;return e(KS,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!t(o))throw new TypeError("Invalid size for dimension: "+o)}),$u(i,a)}})});var $z="resize",Hz=["config","matrix"],ry=S($z,Hz,n=>{var{config:e,matrix:t}=n;return function(a,o,l){if(arguments.length!==2&&arguments.length!==3)throw new va("resize",arguments.length,2,3);if(He(o)&&(o=o.valueOf()),tt(o[0])&&(o=o.map(function(c){return tt(c)?c.toNumber():c})),He(a))return a.resize(o,l,!0);if(typeof a=="string")return r(a,o,l);var u=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return Ye(a)}else{Array.isArray(a)||(a=[a]),a=Ye(a);var s=Mi(a,o,l);return u?t(s):s}};function r(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new ot(a.length,1);var l=a[0];if(typeof l!="number"||!ze(l))throw new TypeError("Invalid size, must contain positive integers (size: "+it(a)+")");if(i.length>l)return i.substring(0,l);if(i.length{var{typed:e,multiply:t,rotationMatrix:r}=n;return e(eN,{"Array , number | BigNumber | Complex | Unit":function(o,l){i(o,2);var u=t(r(l),o);return u.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,l){return i(o,2),t(r(l),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){i(o,3);var s=t(r(l,u),o);return s},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){return i(o,3),t(r(l,u),o)}});function i(a,o){var l=Array.isArray(a)?et(a):a.size();if(l.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(l.length===2&&l[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(l[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var tN="rotationMatrix",Wz=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],iy=S(tN,Wz,n=>{var{typed:e,config:t,multiplyScalar:r,addScalar:i,unaryMinus:a,norm:o,BigNumber:l,matrix:u,DenseMatrix:s,SparseMatrix:c,cos:f,sin:p}=n;return e(tN,{"":function(){return t.matrix==="Matrix"?u([]):[]},string:function(v){return u(v)},"number | BigNumber | Complex | Unit":function(v){return m(v,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,x){return m(v,x)},"number | BigNumber | Complex | Unit, Array":function(v,x){var _=u(x);return h(_),y(v,_,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,x){h(x);var _=x.storage()||(t.matrix==="Matrix"?"dense":void 0);return y(v,x,_)},"number | BigNumber | Complex | Unit, Array, string":function(v,x,_){var b=u(x);return h(b),y(v,b,_)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,x,_){return h(x),y(v,x,_)}});function m(w,v){var x=tt(w),_=x?new l(-1):-1,b=f(w),D=p(w),C=[[b,r(_,D)],[D,b]];return g(C,v)}function h(w){var v=w.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(w){return w.reduce((v,x)=>r(v,x))}function g(w,v){if(v){if(v==="sparse")return new c(w);if(v==="dense")return new s(w);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return w}function y(w,v,x){var _=o(v);if(_===0)throw new RangeError("Rotation around zero vector");var b=tt(w)?l:null,D=b?new b(1):1,C=b?new b(-1):-1,A=b?new b(v.get([0])/_):v.get([0])/_,E=b?new b(v.get([1])/_):v.get([1])/_,F=b?new b(v.get([2])/_):v.get([2])/_,I=f(w),O=i(D,a(I)),k=p(w),R=i(I,d([A,A,O])),T=i(d([A,E,O]),d([C,F,k])),N=i(d([A,F,O]),d([E,k])),V=i(d([A,E,O]),d([F,k])),B=i(I,d([E,E,O])),X=i(d([E,F,O]),d([C,A,k])),ee=i(d([A,F,O]),d([C,E,k])),W=i(d([E,F,O]),d([A,k])),P=i(I,d([F,F,O])),K=[[R,T,N],[V,B,X],[ee,W,P]];return g(K,x)}});var rN="row",jz=["typed","Index","matrix","range"],al=S(rN,jz,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(rN,{"Matrix, number":a,"Array, number":function(l,u){return a(r(Ye(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");zt(l,o.size()[0]);var u=i(0,o.size()[1]),s=new t(l,u),c=o.subset(s);return He(c)?c:r([[c]])}});var nN="size",Zz=["typed","config","?matrix"],ay=S(nN,Zz,n=>{var{typed:e,config:t,matrix:r}=n;return e(nN,{Matrix:function(a){return a.create(a.size())},Array:et,string:function(a){return t.matrix==="Array"?[a.length]:r([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:r?r([]):Qf()}})});var iN="squeeze",Jz=["typed","matrix"],oy=S(iN,Jz,n=>{var{typed:e,matrix:t}=n;return e(iN,{Array:function(i){return Rs(Ye(i))},Matrix:function(i){var a=Rs(i.toArray());return Array.isArray(a)?t(a):a},any:function(i){return Ye(i)}})});var aN="subset",Yz=["typed","matrix","zeros","add"],ol=S(aN,Yz,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n;return e(aN,{"Matrix, Index":function(l,u){return Uo(u)?t():(zu(l,u),l.subset(u))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(l,u){var s=o(t(l),u);return u.isScalar()?s:s.valueOf()}}),"Object, Index":Qz,"string, Index":Xz,"Matrix, Index, any, any":function(l,u,s,c){return Uo(u)?l:(zu(l,u),l.clone().subset(u,a(s,u),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s,c){var f=o(t(l),u,s,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s){return o(t(l),u,s,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s){return o(l,u,s,void 0)}}),"string, Index, string":oN,"string, Index, string, string":oN,"Object, Index, any":Kz});function a(o,l){if(typeof o=="string")throw new Error("can't boradcast a string");if(l._isScalar)return o;var u=l.size();if(u.every(s=>s>0))try{return i(o,r(u))}catch(s){return o}else return o}});function Xz(n,e){if(!qa(e))throw new TypeError("Index expected");if(Uo(e))return"";if(zu(Array.from(n),e),e.size().length!==1)throw new ot(e.size().length,1);var t=n.length;zt(e.min()[0],t),zt(e.max()[0],t);var r=e.dimension(0),i="";return r.forEach(function(a){i+=n.charAt(a)}),i}function oN(n,e,t,r){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Uo(e))return n;if(zu(Array.from(n),e),e.size().length!==1)throw new ot(e.size().length,1);if(r!==void 0){if(typeof r!="string"||r.length!==1)throw new TypeError("Single character expected as defaultValue")}else r=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new ot(i.size()[0],t.length);var o=n.length;zt(e.min()[0]),zt(e.max()[0]);for(var l=[],u=0;uo)for(var s=o-1,c=l.length;s{var{typed:e,matrix:t}=n;return e(sN,{Array:o=>r(t(o)).valueOf(),Matrix:r,any:Ye});function r(o){var l=o.size(),u;switch(l.length){case 1:u=o.clone();break;case 2:{var s=l[0],c=l[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+it(l)+")");switch(o.storage()){case"dense":u=i(o,s,c);break;case"sparse":u=a(o,s,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+it(l)+")")}return u}function i(o,l,u){for(var s=o._data,c=[],f,p=0;p{var{typed:e,transpose:t,conj:r}=n;return e(uN,{any:function(a){return r(t(a))}})});var lN="zeros",r$=["typed","config","matrix","BigNumber"],ly=S(lN,r$,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(lN,{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var c=s[s.length-1];if(typeof c=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var c=s.storage();return a(s.valueOf(),c)},"Array | Matrix, string":function(s,c){return a(s.valueOf(),c)}});function a(u,s){var c=o(u),f=c?new i(0):0;if(l(u),s){var p=r(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Mi(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){tt(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!ze(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var cN="fft",n$=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],cy=S(cN,n$,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,divideScalar:a,exp:o,tau:l,i:u,dotDivide:s,conj:c,pow:f,ceil:p,log2:m}=n;return e(cN,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(w){var v=et(w);return v.length===1?y(w,v[0]):d(w.map(x=>h(x,v.slice(1))),0)}function d(w,v){var x=et(w);if(v!==0)return new Array(x[0]).fill(0).map((b,D)=>d(w[D],v-1));if(x.length===1)return y(w);function _(b){var D=et(b);return new Array(D[1]).fill(0).map((C,A)=>new Array(D[0]).fill(0).map((E,F)=>b[F][A]))}return _(d(_(w),1))}function g(w){for(var v=w.length,x=o(a(i(-1,i(u,l)),v)),_=[],b=1-v;bi(w[N],_[v-1+N])),...new Array(D-v).fill(0)],A=[...new Array(v+v-1).fill(0).map((T,N)=>a(1,_[N])),...new Array(D-(v+v-1)).fill(0)],E=y(C),F=y(A),I=new Array(D).fill(0).map((T,N)=>i(E[N],F[N])),O=s(c(h(c(I))),D),k=[],R=v-1;RA%2===0),v/2),...y(w.filter((C,A)=>A%2===1),v/2)],_=0;_{var{typed:e,fft:t,dotDivide:r,conj:i}=n;return e(fN,{"Array | Matrix":function(o){var l=He(o)?o.size():et(o);return r(i(t(i(o))),l.reduce((u,s)=>u*s,1))}})});function Qa(n){"@babel/helpers - typeof";return Qa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qa(n)}function py(n,e){if(Qa(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Qa(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function my(n){var e=py(n,"string");return Qa(e)==="symbol"?e:String(e)}function kt(n,e,t){return e=my(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pN(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function a$(n){for(var e=1;e{var{typed:e,add:t,subtract:r,multiply:i,divide:a,max:o,map:l,abs:u,isPositive:s,isNegative:c,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:d}=n;function g(C){return function(A,E,F,I){var O=!(E.length===2&&(E.every(b)||E.every(rn)));if(O)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var k=E[0],R=E[1],T=f(R,k),N=I.firstStep;if(N!==void 0&&!s(N))throw new Error('"firstStep" must be positive');var V=I.maxStep;if(V!==void 0&&!s(V))throw new Error('"maxStep" must be positive');var B=I.minStep;if(B&&c(B))throw new Error('"minStep" must be positive or zero');var X=[k,R,N,B,V].filter(Le=>Le!==void 0);if(!(X.every(b)||X.every(rn)))throw new Error('Inconsistent type of "t" dependant variables');for(var ee=1,W=I.tol?I.tol:1e-4,P=I.minDelta?I.minDelta:.2,K=I.maxDelta?I.maxDelta:5,ve=I.maxIter?I.maxIter:1e4,ie=[k,R,...F,V,B].some(tt),[oe,ge,ue,ce]=ie?[h(C.a),h(C.c),h(C.b),h(C.bp)]:[C.a,C.c,C.b,C.bp],me=N?T?N:d(N):a(r(R,k),ee),de=[k],Be=[F],we=r(ue,ce),U=0,G=0,le=x(T),$=_(T);le(de[U],R);){var Q=[];me=$(de[U],R,me),Q.push(A(de[U],Be[U]));for(var re=1;rern(Le)?Le.value:Le)));he1/4&&(de.push(t(de[U],me)),Be.push(t(Be[U],i(me,ue,Q))),U++);var ye=.84*(W/he)**(1/5);if(p(ye,P)?ye=P:f(ye,K)&&(ye=K),ye=ie?h(ye):ye,me=i(me,ye),V&&f(u(me),V)?me=T?V:d(V):B&&p(u(me),B)&&(me=T?B:d(B)),G++,G>ve)throw new Error("Maximum number of iterations reached, try changing options")}return{t:de,y:Be}}}function y(C,A,E,F){var I=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],O=[null,1/2,3/4,1],k=[2/9,1/3,4/9,0],R=[7/24,1/4,1/3,1/8],T={a:I,c:O,b:k,bp:R};return g(T)(C,A,E,F)}function w(C,A,E,F){var I=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],O=[null,1/5,3/10,4/5,8/9,1,1],k=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],R=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],T={a:I,c:O,b:k,bp:R};return g(T)(C,A,E,F)}function v(C,A,E,F){var I=F.method?F.method:"RK45",O={RK23:y,RK45:w};if(I.toUpperCase()in O){var k=a$({},F);return delete k.method,O[I.toUpperCase()](C,A,E,k)}else{var R=Object.keys(O).map(N=>'"'.concat(N,'"')),T="".concat(R.slice(0,-1).join(", ")," and ").concat(R.slice(-1));throw new Error('Unavailable method "'.concat(I,'". Available methods are ').concat(T))}}function x(C){return C?p:f}function _(C){var A=C?f:p;return function(E,F,I){var O=t(E,I);return A(O,F)?r(F,E):I}}function b(C){return tt(C)||nt(C)}function D(C,A,E,F){var I=v(C,A.toArray(),E.toArray(),F);return{t:m(I.t),y:m(I.y)}}return e("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":D,"function, Array, Array":(C,A,E)=>v(C,A,E,{}),"function, Matrix, Matrix":(C,A,E)=>D(C,A,E,{}),"function, Array, number | BigNumber | Unit":(C,A,E)=>{var F=v(C,A,[E],{});return{t:F.t,y:F.y.map(I=>I[0])}},"function, Matrix, number | BigNumber | Unit":(C,A,E)=>{var F=v(C,A.toArray(),[E],{});return{t:m(F.t),y:m(F.y.map(I=>I[0]))}},"function, Array, number | BigNumber | Unit, Object":(C,A,E,F)=>{var I=v(C,A,[E],F);return{t:I.t,y:I.y.map(O=>O[0])}},"function, Matrix, number | BigNumber | Unit, Object":(C,A,E,F)=>{var I=v(C,A.toArray(),[E],F);return{t:m(I.t),y:m(I.y.map(O=>O[0]))}}})});var u$="erf",l$=["typed"],hy=S(u$,l$,n=>{var{typed:e}=n;return e("name",{number:function(o){var l=Math.abs(o);return l>=p$?pi(o):l<=c$?pi(o)*t(l):l<=4?pi(o)*(1-r(l)):pi(o)*(1-i(l))},"Array | Matrix":e.referToSelf(a=>o=>Ze(o,a))});function t(a){var o=a*a,l=ya[0][4]*o,u=o,s;for(s=0;s<3;s+=1)l=(l+ya[0][s])*o,u=(u+Ws[0][s])*o;return a*(l+ya[0][3])/(u+Ws[0][3])}function r(a){var o=ya[1][8]*a,l=a,u;for(u=0;u<7;u+=1)o=(o+ya[1][u])*a,l=(l+Ws[1][u])*a;var s=(o+ya[1][7])/(l+Ws[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*s}function i(a){var o=1/(a*a),l=ya[2][5]*o,u=o,s;for(s=0;s<4;s+=1)l=(l+ya[2][s])*o,u=(u+Ws[2][s])*o;var c=o*(l+ya[2][4])/(u+Ws[2][4]);c=(f$-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),c$=.46875,f$=.5641895835477563,ya=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Ws=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],p$=Math.pow(2,53);var mN="zeta",m$=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],gy=S(mN,m$,n=>{var{typed:e,config:t,multiply:r,pow:i,divide:a,factorial:o,equal:l,smallerEq:u,isNegative:s,gamma:c,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=n;return e(mN,{number:b=>y(b,D=>D,()=>20),BigNumber:b=>y(b,D=>new d(D),()=>Math.abs(Math.log10(t.epsilon))),Complex:w});function y(b,D,C){return l(b,0)?D(-.5):l(b,1)?D(NaN):isFinite(b)?v(b,D,C,A=>A):s(b)?D(NaN):D(1)}function w(b){return b.re===0&&b.im===0?new h(-.5):b.re===1?new h(NaN,NaN):b.re===1/0&&b.im===0?new h(1):b.im===1/0||b.re===-1/0?new h(NaN,NaN):v(b,D=>D,D=>Math.round(1.3*15+.9*Math.abs(D.im)),D=>D.re)}function v(b,D,C,A){var E=C(b);if(A(b)>-(E-1)/2)return _(b,D(E),D);var F=r(i(2,b),i(D(g),p(b,1)));return F=r(F,f(r(a(D(g),2),b))),F=r(F,c(p(1,b))),r(F,v(p(1,b),D,C,A))}function x(b,D){for(var C=b,A=b;u(A,D);A=m(A,1)){var E=a(r(o(m(D,p(A,1))),i(4,A)),r(o(p(D,A)),o(r(2,A))));C=m(C,E)}return r(D,C)}function _(b,D,C){for(var A=a(1,r(x(C(0),D),p(1,i(2,p(1,b))))),E=C(0),F=C(1);u(F,D);F=m(F,1))E=m(E,a(r((-1)**(F-1),x(F,D)),i(F,b)));return r(A,E)}});var dN="mode",d$=["typed","isNaN","isNumeric"],vy=S(dN,d$,n=>{var{typed:e,isNaN:t,isNumeric:r}=n;return e(dN,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=pt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},u=[],s=0,c=0;cs&&(s=l[f],u=[f])}return u}});function wr(n,e,t){var r;return String(n).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+St(t)+", value: "+JSON.stringify(t)+")":" (type: "+n.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(n).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+St(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):n}var hN="prod",h$=["typed","config","multiplyScalar","numeric"],yy=S(hN,h$,n=>{var{typed:e,config:t,multiplyScalar:r,numeric:i}=n;return e(hN,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(l,u){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return a(l)}});function a(o){var l;if(hn(o,function(u){try{l=l===void 0?u:r(l,u)}catch(s){throw wr(s,"prod",u)}}),typeof l=="string"&&(l=i(l,t.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}});var gN="format",g$=["typed"],xy=S(gN,g$,n=>{var{typed:e}=n;return e(gN,{any:it,"any, Object | function | number":it})});var vN="bin",v$=["typed","format"],by=S(vN,v$,n=>{var{typed:e,format:t}=n;return e(vN,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var yN="oct",y$=["typed","format"],wy=S(yN,y$,n=>{var{typed:e,format:t}=n;return e(yN,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var xN="hex",x$=["typed","format"],_y=S(xN,x$,n=>{var{typed:e,format:t}=n;return e(xN,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var Kf=/\$([\w.]+)/g;var bN="print",b$=["typed"],sl=S(bN,b$,n=>{var{typed:e}=n;return e(bN,{"string, Object | Array":wN,"string, Object | Array, number | Object":wN})});function wN(n,e,t){return n.replace(Kf,function(r,i){var a=i.split("."),o=e[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var l=a.shift();o=l?o[l]:o+"."}return o!==void 0?xr(o)?o:it(o,t):r})}var _N="to",w$=["typed","matrix","concat"],Ay=S(_N,w$,n=>{var{typed:e,matrix:t,concat:r}=n,i=lt({typed:e,matrix:t,concat:r});return e(_N,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var AN="isPrime",_$=["typed"],Dy=S(AN,_$,n=>{var{typed:e}=n;return e(AN,{number:function(r){if(r*0!==0)return!1;if(r<=3)return r>1;if(r%2===0||r%3===0)return!1;for(var i=5;i*i<=r;i+=6)if(r%i===0||r%(i+2)===0)return!1;return!0},BigNumber:function(r){if(r.toNumber()*0!==0)return!1;if(r.lte(3))return r.gt(1);if(r.mod(2).eq(0)||r.mod(3).eq(0))return!1;if(r.lt(Math.pow(2,32))){for(var i=r.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(w,v,x){for(var _=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),w=w.mul(w).mod(x)):(v=v.sub(1),_=w.mul(_).mod(x));return _}var l=r.constructor.clone({precision:r.toFixed(0).length*2});r=new l(r);for(var u=0,s=r.sub(1);s.mod(2).eq(0);)s=s.div(2),u+=1;var c=null;if(r.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(w=>wr=>Ze(r,t))})});var A$="numeric",D$=["number","?bignumber","?fraction"],Ey=S(A$,D$,n=>{var{number:e,bignumber:t,fraction:r}=n,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):Gs,Fraction:r?o=>r(o):Xf};return function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=St(l);if(!(c in i))throw new TypeError("Cannot convert "+l+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(u in a))throw new TypeError("Cannot convert "+l+' to type "'+u+'"; valid output types are '+Object.keys(a).join(", "));return u===c?l:a[u](l)}});var DN="divideScalar",E$=["typed","numeric"],Cy=S(DN,E$,n=>{var{typed:e,numeric:t}=n;return e(DN,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,i)=>r.divide(i),"number | Fraction | Complex | BigNumber, Unit":(r,i)=>i.divideInto(r)})});var EN="pow",C$=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Sy=S(EN,C$,n=>{var{typed:e,config:t,identity:r,multiply:i,matrix:a,inv:o,number:l,fraction:u,Complex:s}=n;return e(EN,{"number, number":c,"Complex, Complex":function(h,d){return h.pow(d)},"BigNumber, BigNumber":function(h,d){return d.isInteger()||h>=0||t.predictable?h.pow(d):new s(h.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(h,d){var g=h.pow(d);if(g!=null)return g;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(h.valueOf(),d.valueOf())},"Array, number":f,"Array, BigNumber":function(h,d){return f(h,d.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(h,d){return p(h,d.toNumber())},"Unit, number | BigNumber":function(h,d){return h.pow(d)}});function c(m,h){if(t.predictable&&!ze(h)&&m<0)try{var d=u(h),g=l(d);if((h===g||Math.abs((h-g)/h)<1e-14)&&d.d%2===1)return(d.n%2===0?1:-1)*Math.pow(-m,h)}catch(y){}return t.predictable&&(m<-1&&h===1/0||m>-1&&m<0&&h===-1/0)?NaN:ze(h)||m>=0||t.predictable?eg(m,h):m*m<1&&h===1/0||m*m>1&&h===-1/0?0:new s(m,0).pow(h,0)}function f(m,h){if(!ze(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=et(m);if(d.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!==d[1])throw new Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");if(h<0)try{return f(o(m),-h)}catch(w){throw w.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):w}for(var g=r(d[0]).valueOf(),y=m;h>=1;)(h&1)===1&&(g=i(y,g)),h>>=1,y=i(y,y);return g}function p(m,h){return a(f(m.valueOf(),h))}});var js="Number of decimals in function round must be an integer",CN="round",S$=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Ny=S(CN,S$,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,BigNumber:a,DenseMatrix:o}=n,l=$t({typed:e,equalScalar:r}),u=Ot({typed:e,DenseMatrix:o}),s=Mr({typed:e});return e(CN,{number:tg,"number, number":tg,"number, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(js);return new a(f).toDecimalPlaces(p.toNumber())},Complex:function(f){return f.round()},"Complex, number":function(f,p){if(p%1)throw new TypeError(js);return f.round(p)},"Complex, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(js);var m=p.toNumber();return f.round(m)},BigNumber:function(f){return f.toDecimalPlaces(0)},"BigNumber, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(js);return f.toDecimalPlaces(p.toNumber())},Fraction:function(f){return f.round()},"Fraction, number":function(f,p){if(p%1)throw new TypeError(js);return f.round(p)},"Fraction, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(js);return f.round(p.toNumber())},"Unit, number, Unit":e.referToSelf(c=>function(f,p,m){var h=f.toNumeric(m);return m.multiply(c(h,p))}),"Unit, BigNumber, Unit":e.referToSelf(c=>(f,p,m)=>c(f,p.toNumber(),m)),"Unit, Unit":e.referToSelf(c=>(f,p)=>c(f,0,p)),"Array | Matrix, number, Unit":e.referToSelf(c=>(f,p,m)=>Ze(f,h=>c(h,p,m),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(c=>(f,p,m)=>c(f,p.toNumber(),m)),"Array | Matrix, Unit":e.referToSelf(c=>(f,p)=>c(f,0,p)),"Array | Matrix":e.referToSelf(c=>f=>Ze(f,c,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(c=>(f,p)=>l(f,p,c,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(c=>(f,p)=>s(f,p,c,!1)),"Array, number | BigNumber":e.referToSelf(c=>(f,p)=>s(t(f),p,c,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(c=>(f,p)=>r(f,0)?i(p.size(),p.storage()):u(p,f,c,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(c=>(f,p)=>r(f,0)?i(p.size(),p.storage()):s(p,f,c,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(c=>(f,p)=>s(t(p),f,c,!0).valueOf())})});var SN="log",N$=["config","typed","divideScalar","Complex"],My=S(SN,N$,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n;return e(SN,{number:function(o){return o>=0||t.predictable?TC(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":e.referToSelf(a=>(o,l)=>r(a(o),a(l)))})});var NN="log1p",M$=["typed","config","divideScalar","log","Complex"],Ty=S(NN,M$,n=>{var{typed:e,config:t,divideScalar:r,log:i,Complex:a}=n;return e(NN,{number:function(u){return u>=-1||t.predictable?Ef(u):o(new a(u,0))},Complex:o,BigNumber:function(u){var s=u.plus(1);return!s.isNegative()||t.predictable?s.ln():o(new a(u.toNumber(),0))},"Array | Matrix":e.referToSelf(l=>u=>Ze(u,l)),"any, any":e.referToSelf(l=>(u,s)=>r(l(u),i(s)))});function o(l){var u=l.re+1;return new a(Math.log(Math.sqrt(u*u+l.im*l.im)),Math.atan2(l.im,u))}});var MN="nthRoots",T$=["config","typed","divideScalar","Complex"],Fy=S(MN,T$,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n,a=[function(u){return new i(u,0)},function(u){return new i(0,u)},function(u){return new i(-u,0)},function(u){return new i(0,-u)}];function o(l,u){if(u<0)throw new Error("Root must be greater than zero");if(u===0)throw new Error("Root must be non-zero");if(u%1!==0)throw new Error("Root must be an integer");if(l===0||l.abs()===0)return[new i(0,0)];var s=typeof l=="number",c;(s||l.re===0||l.im===0)&&(s?c=2*+(l<0):l.im===0?c=2*+(l.re<0):c=2*+(l.im<0)+1);for(var f=l.arg(),p=l.abs(),m=[],h=Math.pow(p,1/u),d=0;d{var{typed:e,equalScalar:t,matrix:r,pow:i,DenseMatrix:a,concat:o}=n,l=rr({typed:e}),u=Pr({typed:e,DenseMatrix:a}),s=$t({typed:e,equalScalar:t}),c=Ot({typed:e,DenseMatrix:a}),f=lt({typed:e,matrix:r,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes("Matrix")&&!m.includes("Array")&&(p[m]=i.signatures[m]);var h=e(p);return e(TN,f({elop:h,SS:u,DS:l,Ss:s,sS:c}))});var FN="dotDivide",I$=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],By=S(FN,I$,n=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:i,DenseMatrix:a,concat:o}=n,l=Tr({typed:e,equalScalar:r}),u=rr({typed:e}),s=Pr({typed:e,DenseMatrix:a}),c=$t({typed:e,equalScalar:r}),f=Ot({typed:e,DenseMatrix:a}),p=lt({typed:e,matrix:t,concat:o});return e(FN,p({elop:i,SS:s,DS:u,SD:l,Ss:c,sS:f}))});function Wi(n){var{DenseMatrix:e}=n;return function(r,i,a){var o=r.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+it(o)+")");var l=o[0],u=o[1];if(l!==u)throw new RangeError("Matrix must be square (size: "+it(o)+")");var s=[];if(He(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var p=0;p{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=n,u=Wi({DenseMatrix:l});return e(IN,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.valueOf()}});function s(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],y=f._data,w=0;wx&&(D.push(g[F]),C.push(I))}if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var O=r(_,b),k=0,R=C.length;k{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=n,u=Wi({DenseMatrix:l});return e(BN,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.valueOf()}});function s(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],y=f._data,w=d-1;w>=0;w--){var v=m[w][0]||0,x=void 0;if(o(v,0))x=0;else{var _=y[w][w];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");x=r(v,_);for(var b=w-1;b>=0;b--)m[b]=[a(m[b][0]||0,i(x,y[b][w]))]}g[w]=[x]}return new l({data:g,size:[h,1]})}function c(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=f._values,y=f._index,w=f._ptr,v=[],x=d-1;x>=0;x--){var _=m[x][0]||0;if(o(_,0))v[x]=[0];else{for(var b=0,D=[],C=[],A=w[x],E=w[x+1],F=E-1;F>=A;F--){var I=y[F];I===x?b=g[F]:I{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=n,u=Wi({DenseMatrix:l});return e(ON,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.map(g=>g.valueOf())}});function s(f,p){for(var m=[u(f,p,!0)._data.map(C=>C[0])],h=f._data,d=f._size[0],g=f._size[1],y=0;ynew l({data:C.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(ee=>ee[0])],h=f._size[0],d=f._size[1],g=f._values,y=f._index,w=f._ptr,v=0;vv&&(D.push(g[I]),C.push(O))}if(o(F,0))if(o(b[v],0)){if(_===0){var N=[...b];N[v]=1;for(var V=0,B=C.length;Vnew l({data:ee.map(W=>[W]),size:[h,1]}))}});var PN="usolveAll",R$=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],ky=S(PN,R$,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=n,u=Wi({DenseMatrix:l});return e(PN,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.map(g=>g.valueOf())}});function s(f,p){for(var m=[u(f,p,!0)._data.map(C=>C[0])],h=f._data,d=f._size[0],g=f._size[1],y=g-1;y>=0;y--)for(var w=m.length,v=0;v=0;D--)b[D]=a(b[D],h[D][y]);m.push(b)}}else{if(v===0)return[];m.splice(v,1),v-=1,w-=1}else{x[y]=r(x[y],h[y][y]);for(var _=y-1;_>=0;_--)x[_]=a(x[_],i(x[y],h[_][y]))}}return m.map(C=>new l({data:C.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(ee=>ee[0])],h=f._size[0],d=f._size[1],g=f._values,y=f._index,w=f._ptr,v=d-1;v>=0;v--)for(var x=m.length,_=0;_=A;I--){var O=y[I];O===v?F=g[I]:Onew l({data:ee.map(W=>[W]),size:[h,1]}))}});var k$="matAlgo08xS0Sid",L$=["typed","equalScalar"],Zs=S(k$,L$,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new ot(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");if(!l||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var y=c[0],w=c[1],v,x=t,_=0,b=o;typeof f=="string"&&f===g&&(v=f,x=e.find(t,[v,v]),_=e.convert(0,v),b=e.find(o,[v,v]));for(var D=[],C=[],A=[],E=[],F=[],I,O,k,R,T=0;T{var{typed:e,matrix:t}=n;return{"Array, number":e.referTo("DenseMatrix, number",r=>(i,a)=>r(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",r=>(i,a)=>r(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf())}});var RN="leftShift",V$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Ly=S(RN,V$,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,l=gn({typed:e}),u=Tr({typed:e,equalScalar:r}),s=Zs({typed:e,equalScalar:r}),c=Ln({typed:e,DenseMatrix:a}),f=$t({typed:e,equalScalar:r}),p=Mr({typed:e}),m=lt({typed:e,matrix:t,concat:o}),h=Js({typed:e,matrix:t});return e(RN,{"number, number":og,"BigNumber, BigNumber":CS,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var kN="rightArithShift",U$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Vy=S(kN,U$,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,l=gn({typed:e}),u=Tr({typed:e,equalScalar:r}),s=Zs({typed:e,equalScalar:r}),c=Ln({typed:e,DenseMatrix:a}),f=$t({typed:e,equalScalar:r}),p=Mr({typed:e}),m=lt({typed:e,matrix:t,concat:o}),h=Js({typed:e,matrix:t});return e(kN,{"number, number":sg,"BigNumber, BigNumber":SS,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var LN="rightLogShift",q$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Uy=S(LN,q$,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,l=gn({typed:e}),u=Tr({typed:e,equalScalar:r}),s=Zs({typed:e,equalScalar:r}),c=Ln({typed:e,DenseMatrix:a}),f=$t({typed:e,equalScalar:r}),p=Mr({typed:e}),m=lt({typed:e,matrix:t,concat:o}),h=Js({typed:e,matrix:t});return e(LN,{"number, number":ug,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var VN="and",z$=["typed","matrix","equalScalar","zeros","not","concat"],qy=S(VN,z$,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,l=Tr({typed:e,equalScalar:r}),u=Xa({typed:e,equalScalar:r}),s=$t({typed:e,equalScalar:r}),c=Mr({typed:e}),f=lt({typed:e,matrix:t,concat:o});return e(VN,{"number, number":dg,"Complex, Complex":function(m,h){return(m.re!==0||m.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(m,h){return!m.isZero()&&!h.isZero()&&!m.isNaN()&&!h.isNaN()},"Unit, Unit":e.referToSelf(p=>(m,h)=>p(m.value||0,h.value||0)),"SparseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):s(m,h,p,!1)),"DenseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):c(m,h,p,!1)),"any, SparseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):s(h,m,p,!0)),"any, DenseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):c(h,m,p,!0)),"Array, any":e.referToSelf(p=>(m,h)=>p(t(m),h).valueOf()),"any, Array":e.referToSelf(p=>(m,h)=>p(m,t(h)).valueOf())},f({SS:u,DS:l}))});var ep="compare",$$=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],zy=S(ep,$$,n=>{var{typed:e,config:t,equalScalar:r,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:l,concat:u}=n,s=rr({typed:e}),c=Ya({typed:e,equalScalar:r}),f=Ot({typed:e,DenseMatrix:l}),p=lt({typed:e,matrix:i,concat:u}),m=di({typed:e});return e(ep,H$({typed:e,config:t}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return Xr(d,g,t.epsilon)?new a(0):new a(d.cmp(g))},"Fraction, Fraction":function(d,g){return new o(d.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:c,DS:s,Ss:f}))}),H$=S(ep,["typed","config"],n=>{var{typed:e,config:t}=n;return e(ep,{"number, number":function(i,a){return Nr(i,a,t.epsilon)?0:i>a?1:-1}})});var Go=gr(qN(),1);var zN="compareNatural",G$=["typed","compare"],$y=S(zN,G$,n=>{var{typed:e,compare:t}=n,r=t.signatures["boolean,boolean"];return e(zN,{"any, any":i});function i(u,s){var c=St(u),f=St(s),p;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return p=t(u,s),p.toString()!=="0"?p>0?1:-1:(0,Go.default)(c,f);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(c)||m.includes(f))return p=a(i,u,s),p!==0?p:(0,Go.default)(c,f);if(c!==f)return(0,Go.default)(c,f);if(c==="Complex")return W$(u,s);if(c==="Unit")return u.equalBase(s)?i(u.value,s.value):o(i,u.formatUnits(),s.formatUnits());if(c==="boolean")return r(u,s);if(c==="string")return(0,Go.default)(u,s);if(c==="Object")return l(i,u,s);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(u,s,c){return Ci(s)&&Ci(c)?o(u,s.toJSON().values,c.toJSON().values):Ci(s)?a(u,s.toArray(),c):Ci(c)?a(u,s,c.toArray()):ko(s)?a(u,s.toJSON().data,c):ko(c)?a(u,s,c.toJSON().data):Array.isArray(s)?Array.isArray(c)?o(u,s,c):a(u,s,[c]):a(u,[s],c)}function o(u,s,c){for(var f=0,p=Math.min(s.length,c.length);fc.length?1:s.lengthe.re?1:n.ree.im?1:n.im{var{typed:e,matrix:t,concat:r}=n,i=lt({typed:e,matrix:t,concat:r});return e($N,Tf,i({elop:Tf,Ds:!0}))});var tp="equal",Z$=["typed","matrix","equalScalar","DenseMatrix","concat"],Gy=S(tp,Z$,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Pr({typed:e,DenseMatrix:i}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:t,concat:a});return e(tp,J$({typed:e,equalScalar:r}),s({elop:r,SS:l,DS:o,Ss:u}))}),J$=S(tp,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e(tp,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:t(i,a)}})});var HN="equalText",Y$=["typed","compareText","isZero"],Wy=S(HN,Y$,n=>{var{typed:e,compareText:t,isZero:r}=n;return e(HN,{"any, any":function(a,o){return r(t(a,o))}})});var rp="smaller",X$=["typed","config","matrix","DenseMatrix","concat"],jy=S(rp,X$,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Pr({typed:e,DenseMatrix:i}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:r,concat:a}),c=di({typed:e});return e(rp,Q$({typed:e,config:t}),{"boolean, boolean":(f,p)=>ff.compare(p)===-1,"Complex, Complex":function(p,m){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),Q$=S(rp,["typed","config"],n=>{var{typed:e,config:t}=n;return e(rp,{"number, number":function(i,a){return i{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Pr({typed:e,DenseMatrix:i}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:r,concat:a}),c=di({typed:e});return e(np,eH({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||Xr(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),eH=S(np,["typed","config"],n=>{var{typed:e,config:t}=n;return e(np,{"number, number":function(i,a){return i<=a||Nr(i,a,t.epsilon)}})});var ip="larger",tH=["typed","config","matrix","DenseMatrix","concat"],Jy=S(ip,tH,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Pr({typed:e,DenseMatrix:i}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:r,concat:a}),c=di({typed:e});return e(ip,rH({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!Xr(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),rH=S(ip,["typed","config"],n=>{var{typed:e,config:t}=n;return e(ip,{"number, number":function(i,a){return i>a&&!Nr(i,a,t.epsilon)}})});var ap="largerEq",nH=["typed","config","matrix","DenseMatrix","concat"],Yy=S(ap,nH,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=rr({typed:e}),l=Pr({typed:e,DenseMatrix:i}),u=Ot({typed:e,DenseMatrix:i}),s=lt({typed:e,matrix:r,concat:a}),c=di({typed:e});return e(ap,iH({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||Xr(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),iH=S(ap,["typed","config"],n=>{var{typed:e,config:t}=n;return e(ap,{"number, number":function(i,a){return i>=a||Nr(i,a,t.epsilon)}})});var GN="deepEqual",aH=["typed","equal"],Xy=S(GN,aH,n=>{var{typed:e,equal:t}=n;return e(GN,{"any, any":function(a,o){return r(a.valueOf(),o.valueOf())}});function r(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var l=0;l{var{typed:e,config:t,equalScalar:r,matrix:i,DenseMatrix:a,concat:o}=n,l=rr({typed:e}),u=Pr({typed:e,DenseMatrix:a}),s=Ot({typed:e,DenseMatrix:a}),c=lt({typed:e,matrix:i,concat:o});return e(op,sH({typed:e,equalScalar:r}),c({elop:f,SS:u,DS:l,Ss:s}));function f(p,m){return!r(p,m)}}),sH=S(op,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e(op,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!t(i,a)}})});var WN="partitionSelect",uH=["typed","isNumeric","isNaN","compare"],Ky=S(WN,uH,n=>{var{typed:e,isNumeric:t,isNaN:r,compare:i}=n,a=i,o=(s,c)=>-i(s,c);return e(WN,{"Array | Matrix, number":function(c,f){return l(c,f,a)},"Array | Matrix, number, string":function(c,f,p){if(p==="asc")return l(c,f,a);if(p==="desc")return l(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(s,c,f){if(!ze(c)||c<0)throw new Error("k must be a non-negative integer");if(He(s)){var p=s.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return u(s.valueOf(),c,f)}if(Array.isArray(s))return u(s,c,f)}function u(s,c,f){if(c>=s.length)throw new Error("k out of bounds");for(var p=0;p=0){var w=s[g];s[g]=s[d],s[d]=w,--g}else++d;f(s[d],y)>0&&--d,c<=d?h=d:m=d+1}return s[c]}});var jN="sort",lH=["typed","matrix","compare","compareNatural"],e0=S(jN,lH,n=>{var{typed:e,matrix:t,compare:r,compareNatural:i}=n,a=r,o=(c,f)=>-r(c,f);return e(jN,{Array:function(f){return u(f),f.sort(a)},Matrix:function(f){return s(f),t(f.toArray().sort(a),f.storage())},"Array, function":function(f,p){return u(f),f.sort(p)},"Matrix, function":function(f,p){return s(f),t(f.toArray().sort(p),f.storage())},"Array, string":function(f,p){return u(f),f.sort(l(p))},"Matrix, string":function(f,p){return s(f),t(f.toArray().sort(l(p)),f.storage())}});function l(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(c){if(et(c).length!==1)throw new Error("One dimensional array expected")}function s(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var ZN="max",cH=["typed","config","numeric","larger"],ul=S(ZN,cH,n=>{var{typed:e,config:t,numeric:r,larger:i}=n;return e(ZN,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return Ja(u,s.valueOf(),a)},"...":function(u){if(mi(u))throw new TypeError("Scalar values expected in function max");return o(u)}});function a(l,u){try{return i(l,u)?l:u}catch(s){throw wr(s,"max",u)}}function o(l){var u;if(hn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw wr(c,"max",s)}}),u===void 0)throw new Error("Cannot calculate max of an empty array");return typeof u=="string"&&(u=r(u,t.number)),u}});var JN="min",fH=["typed","config","numeric","smaller"],ll=S(JN,fH,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n;return e(JN,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return Ja(u,s.valueOf(),a)},"...":function(u){if(mi(u))throw new TypeError("Scalar values expected in function min");return o(u)}});function a(l,u){try{return i(l,u)?l:u}catch(s){throw wr(s,"min",u)}}function o(l){var u;if(hn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw wr(c,"min",s)}}),u===void 0)throw new Error("Cannot calculate min of an empty array");return typeof u=="string"&&(u=r(u,t.number)),u}});var pH="ImmutableDenseMatrix",mH=["smaller","DenseMatrix"],t0=S(pH,mH,n=>{var{smaller:e,DenseMatrix:t}=n;function r(i,a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!xr(a))throw new Error("Invalid datatype: "+a);if(He(i)||Mt(i)){var o=new t(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&Mt(i.data)&&Mt(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min!="undefined"?i.min:null,this._max=typeof i.max!="undefined"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+St(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return r.prototype=new t,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return He(a)?new r({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:Ye(this._data),size:Ye(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(i){return new r(i)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||e(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},r.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||e(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},r},{isClass:!0});var dH="Index",hH=["ImmutableDenseMatrix","getMatrixDataType"],r0=S(dH,hH,n=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=n;function r(a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,l=arguments.length;o{t&&e.push(r)}),e}var gH="FibonacciHeap",vH=["smaller","larger"],n0=S(gH,vH,n=>{var{smaller:e,larger:t}=n,r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var p={key:c,value:f,degree:0};if(this._minimum){var m=this._minimum;p.left=m,p.right=m.right,m.right=p,p.right.left=p,e(c,m.key)&&(this._minimum=p)}else p.left=p,p.right=p,this._minimum=p;return this._size++,p},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var f=this._minimum,p=c.degree,m=c.child;p>0;){var h=m.right;m.left.right=m.right,m.right.left=m.left,m.left=f,m.right=f.right,f.right=m,m.right.left=m,m.parent=null,m=h,p--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=s(f,this._size)),this._size--,this._minimum=f,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,f,p){f.key=p;var m=f.parent;return m&&e(f.key,m.key)&&(o(c,f,m),l(c,m)),e(f.key,c.key)&&(c=f),c}function o(c,f,p){f.left.right=f.right,f.right.left=f.left,p.degree--,p.child===f&&(p.child=f.right),p.degree===0&&(p.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function l(c,f){var p=f.parent;p&&(f.mark?(o(c,f,p),l(p)):f.mark=!0)}var u=function(f,p){f.left.right=f.right,f.right.left=f.left,f.parent=p,p.child?(f.left=p.child,f.right=p.child.right,p.child.right=f,f.right.left=f):(p.child=f,f.right=f,f.left=f),p.degree++,f.mark=!1};function s(c,f){var p=Math.floor(Math.log(f)*r)+1,m=new Array(p),h=0,d=c;if(d)for(h++,d=d.right;d!==c;)h++,d=d.right;for(var g;h>0;){for(var y=d.degree,w=d.right;g=m[y],!!g;){if(t(d.key,g.key)){var v=g;g=d,d=v}u(g,d),m[y]=null,y++}m[y]=d,d=w,h--}c=null;for(var x=0;x{var{addScalar:e,equalScalar:t,FibonacciHeap:r}=n;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var l=this._heap.insert(a,o);this._values[a]=l}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var l=this._values[a];l?l.value=e(l.value,o):(l=this._heap.insert(a,o),this._values[a]=l)},i.prototype.forEach=function(a,o,l){var u=this._heap,s=this._values,c=[],f=u.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(t(f.value,0)||l(f.key,f.value,this)),f=u.extractMinimum(),f&&c.push(f);for(var p=0;p{var{on:e,config:t,addScalar:r,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:l,abs:u,fix:s,round:c,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=n,w=h;function v(U,G){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(U==null||p(U)||Cn(U)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,G===void 0)this.units=[],this.dimensions=V.map($=>0);else if(typeof G=="string"){var le=v.parse(G);this.units=le.units,this.dimensions=le.dimensions}else if(rn(G)&&G.value===null)this.fixPrefix=G.fixPrefix,this.skipAutomaticSimplification=G.skipAutomaticSimplification,this.dimensions=G.dimensions.slice(0),this.units=G.units.map($=>mr({},$));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(U)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var x,_,b;function D(){for(;b===" "||b===" ";)E()}function C(U){return U>="0"&&U<="9"||U==="."}function A(U){return U>="0"&&U<="9"}function E(){_++,b=x.charAt(_)}function F(U){_=U,b=x.charAt(_)}function I(){var U="",G=_;if(b==="+"?E():b==="-"&&(U+=b,E()),!C(b))return F(G),null;if(b==="."){if(U+=b,E(),!A(b))return F(G),null}else{for(;A(b);)U+=b,E();b==="."&&(U+=b,E())}for(;A(b);)U+=b,E();if(b==="E"||b==="e"){var le="",$=_;if(le+=b,E(),(b==="+"||b==="-")&&(le+=b,E()),!A(b))return F($),U;for(U=U+le;A(b);)U+=b,E()}return U}function O(){for(var U="";A(b)||v.isValidAlpha(b);)U+=b,E();var G=U.charAt(0);return v.isValidAlpha(G)?U:null}function k(U){return b===U?(E(),U):null}v.parse=function(U,G){if(G=G||{},x=U,_=-1,b="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var le=new v;le.units=[];var $=1,Q=!1;E(),D();var re=I(),he=null;if(re){if(t.number==="BigNumber")he=new g(re);else if(t.number==="Fraction")try{he=new y(re)}catch(pe){he=parseFloat(re)}else he=parseFloat(re);D(),k("*")?($=1,Q=!0):k("/")&&($=-1,Q=!0)}for(var ye=[],Le=1;;){for(D();b==="(";)ye.push($),Le*=$,$=1,E(),D();var Ae=void 0;if(b){var ct=b;if(Ae=O(),Ae===null)throw new SyntaxError('Unexpected "'+ct+'" in "'+x+'" at index '+_.toString())}else break;var xt=R(Ae);if(xt===null)throw new SyntaxError('Unit "'+Ae+'" not found.');var Vt=$*Le;if(D(),k("^")){D();var Xt=I();if(Xt===null)throw new SyntaxError('In "'+U+'", "^" must be followed by a floating-point number');Vt*=Xt}le.units.push({unit:xt.unit,prefix:xt.prefix,power:Vt});for(var H=0;H1||Math.abs(this.units[0].power-1)>1e-15},v.prototype._normalize=function(U){if(U==null||this.units.length===0)return U;for(var G=U,le=v._getNumberConverter(St(U)),$=0;${if(je(P,U)){var G=P[U],le=G.prefixes[""];return{unit:G,prefix:le}}for(var $ in P)if(je(P,$)&&YE(U,$)){var Q=P[$],re=U.length-$.length,he=U.substring(0,re),ye=je(Q.prefixes,he)?Q.prefixes[he]:void 0;if(ye!==void 0)return{unit:Q,prefix:ye}}return null},{hasher:U=>U[0],limit:100});v.isValuelessUnit=function(U){return R(U)!==null},v.prototype.hasBase=function(U){if(typeof U=="string"&&(U=B[U]),!U)return!1;for(var G=0;G1e-12)return!1;return!0},v.prototype.equalBase=function(U){for(var G=0;G1e-12)return!1;return!0},v.prototype.equals=function(U){return this.equalBase(U)&&f(this.value,U.value)},v.prototype.multiply=function(U){for(var G=this.clone(),le=rn(U)?U:new v(U),$=0;$1e-12&&(je(oe,ye)?G.push({unit:oe[ye].unit,prefix:oe[ye].prefix,power:U.dimensions[he]||0}):re=!0)}G.length1e-12)if(je(ie.si,$))G.push({unit:ie.si[$].unit,prefix:ie.si[$].prefix,power:U.dimensions[le]||0});else throw new Error("Cannot express custom unit "+$+" in SI units")}return U.units=G,U.fixPrefix=!0,U.skipAutomaticSimplification=!0,U},v.prototype.formatUnits=function(){for(var U="",G="",le=0,$=0,Q=0;Q0?(le++,U+=" "+this.units[Q].prefix.name+this.units[Q].unit.name,Math.abs(this.units[Q].power-1)>1e-15&&(U+="^"+this.units[Q].power)):this.units[Q].power<0&&$++;if($>0)for(var re=0;re0?(G+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power+1)>1e-15&&(G+="^"+-this.units[re].power)):(G+=" "+this.units[re].prefix.name+this.units[re].unit.name,G+="^"+this.units[re].power));U=U.substr(1),G=G.substr(1),le>1&&$>0&&(U="("+U+")"),$>1&&le>0&&(G="("+G+")");var he=U;return le>0&&$>0&&(he+=" / "),he+=G,he},v.prototype.format=function(U){var G=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),le=!1;typeof G.value!="undefined"&&G.value!==null&&Cn(G.value)&&(le=Math.abs(G.value.re)<1e-14);for(var $ in G.units)je(G.units,$)&&G.units[$].unit&&(G.units[$].unit.name==="VA"&&le?G.units[$].unit=P.VAR:G.units[$].unit.name==="VAR"&&!le&&(G.units[$].unit=P.VA));G.units.length===1&&!G.fixPrefix&&Math.abs(G.units[0].power-Math.round(G.units[0].power))<1e-14&&(G.units[0].prefix=G._bestPrefix());var Q=G._denormalize(G.value),re=G.value!==null?m(Q,U||{}):"",he=G.formatUnits();return G.value&&Cn(G.value)&&(re="("+re+")"),he.length>0&&re.length>0&&(re+=" "),re+=he,re},v.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var U=this.value!==null?u(this.value):0,G=u(this.units[0].unit.value),le=this.units[0].prefix;if(U===0)return le;var $=this.units[0].power,Q=Math.log(U/Math.pow(le.value*G,$))/Math.LN10-1.2;if(Q>-2.200001&&Q<1.800001)return le;Q=Math.abs(Q);var re=this.units[0].unit.prefixes;for(var he in re)if(je(re,he)){var ye=re[he];if(ye.scientific){var Le=Math.abs(Math.log(U/Math.pow(ye.value*G,$))/Math.LN10-1.2);(Le0)},P={meter:{name:"meter",base:B.LENGTH,prefixes:N.LONG,value:1,offset:0},inch:{name:"inch",base:B.LENGTH,prefixes:N.NONE,value:.0254,offset:0},foot:{name:"foot",base:B.LENGTH,prefixes:N.NONE,value:.3048,offset:0},yard:{name:"yard",base:B.LENGTH,prefixes:N.NONE,value:.9144,offset:0},mile:{name:"mile",base:B.LENGTH,prefixes:N.NONE,value:1609.344,offset:0},link:{name:"link",base:B.LENGTH,prefixes:N.NONE,value:.201168,offset:0},rod:{name:"rod",base:B.LENGTH,prefixes:N.NONE,value:5.0292,offset:0},chain:{name:"chain",base:B.LENGTH,prefixes:N.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:B.LENGTH,prefixes:N.NONE,value:1e-10,offset:0},m:{name:"m",base:B.LENGTH,prefixes:N.SHORT,value:1,offset:0},in:{name:"in",base:B.LENGTH,prefixes:N.NONE,value:.0254,offset:0},ft:{name:"ft",base:B.LENGTH,prefixes:N.NONE,value:.3048,offset:0},yd:{name:"yd",base:B.LENGTH,prefixes:N.NONE,value:.9144,offset:0},mi:{name:"mi",base:B.LENGTH,prefixes:N.NONE,value:1609.344,offset:0},li:{name:"li",base:B.LENGTH,prefixes:N.NONE,value:.201168,offset:0},rd:{name:"rd",base:B.LENGTH,prefixes:N.NONE,value:5.02921,offset:0},ch:{name:"ch",base:B.LENGTH,prefixes:N.NONE,value:20.1168,offset:0},mil:{name:"mil",base:B.LENGTH,prefixes:N.NONE,value:254e-7,offset:0},m2:{name:"m2",base:B.SURFACE,prefixes:N.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:B.SURFACE,prefixes:N.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:B.SURFACE,prefixes:N.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:B.SURFACE,prefixes:N.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:B.SURFACE,prefixes:N.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:B.SURFACE,prefixes:N.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:B.SURFACE,prefixes:N.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:B.SURFACE,prefixes:N.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:B.SURFACE,prefixes:N.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:B.SURFACE,prefixes:N.NONE,value:1e4,offset:0},m3:{name:"m3",base:B.VOLUME,prefixes:N.CUBIC,value:1,offset:0},L:{name:"L",base:B.VOLUME,prefixes:N.SHORT,value:.001,offset:0},l:{name:"l",base:B.VOLUME,prefixes:N.SHORT,value:.001,offset:0},litre:{name:"litre",base:B.VOLUME,prefixes:N.LONG,value:.001,offset:0},cuin:{name:"cuin",base:B.VOLUME,prefixes:N.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:B.VOLUME,prefixes:N.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:B.VOLUME,prefixes:N.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:B.VOLUME,prefixes:N.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:B.VOLUME,prefixes:N.NONE,value:15e-6,offset:0},drop:{name:"drop",base:B.VOLUME,prefixes:N.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:B.VOLUME,prefixes:N.NONE,value:5e-8,offset:0},minim:{name:"minim",base:B.VOLUME,prefixes:N.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:B.VOLUME,prefixes:N.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:B.VOLUME,prefixes:N.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:B.VOLUME,prefixes:N.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:B.VOLUME,prefixes:N.NONE,value:1e-6,offset:0},cup:{name:"cup",base:B.VOLUME,prefixes:N.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:B.VOLUME,prefixes:N.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:B.VOLUME,prefixes:N.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:B.VOLUME,prefixes:N.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:B.VOLUME,prefixes:N.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:B.VOLUME,prefixes:N.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:B.VOLUME,prefixes:N.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:B.VOLUME,prefixes:N.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:B.VOLUME,prefixes:N.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:B.VOLUME,prefixes:N.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:B.VOLUME,prefixes:N.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:B.VOLUME,prefixes:N.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:B.VOLUME,prefixes:N.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:B.VOLUME,prefixes:N.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:B.VOLUME,prefixes:N.NONE,value:.1173478,offset:0},obl:{name:"obl",base:B.VOLUME,prefixes:N.NONE,value:.1589873,offset:0},g:{name:"g",base:B.MASS,prefixes:N.SHORT,value:.001,offset:0},gram:{name:"gram",base:B.MASS,prefixes:N.LONG,value:.001,offset:0},ton:{name:"ton",base:B.MASS,prefixes:N.SHORT,value:907.18474,offset:0},t:{name:"t",base:B.MASS,prefixes:N.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:B.MASS,prefixes:N.LONG,value:1e3,offset:0},grain:{name:"grain",base:B.MASS,prefixes:N.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:B.MASS,prefixes:N.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:B.MASS,prefixes:N.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:B.MASS,prefixes:N.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:B.MASS,prefixes:N.NONE,value:45.359237,offset:0},stick:{name:"stick",base:B.MASS,prefixes:N.NONE,value:.115,offset:0},stone:{name:"stone",base:B.MASS,prefixes:N.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:B.MASS,prefixes:N.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:B.MASS,prefixes:N.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:B.MASS,prefixes:N.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:B.MASS,prefixes:N.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:B.MASS,prefixes:N.NONE,value:45.359237,offset:0},s:{name:"s",base:B.TIME,prefixes:N.SHORT,value:1,offset:0},min:{name:"min",base:B.TIME,prefixes:N.NONE,value:60,offset:0},h:{name:"h",base:B.TIME,prefixes:N.NONE,value:3600,offset:0},second:{name:"second",base:B.TIME,prefixes:N.LONG,value:1,offset:0},sec:{name:"sec",base:B.TIME,prefixes:N.LONG,value:1,offset:0},minute:{name:"minute",base:B.TIME,prefixes:N.NONE,value:60,offset:0},hour:{name:"hour",base:B.TIME,prefixes:N.NONE,value:3600,offset:0},day:{name:"day",base:B.TIME,prefixes:N.NONE,value:86400,offset:0},week:{name:"week",base:B.TIME,prefixes:N.NONE,value:7*86400,offset:0},month:{name:"month",base:B.TIME,prefixes:N.NONE,value:2629800,offset:0},year:{name:"year",base:B.TIME,prefixes:N.NONE,value:31557600,offset:0},decade:{name:"decade",base:B.TIME,prefixes:N.NONE,value:315576e3,offset:0},century:{name:"century",base:B.TIME,prefixes:N.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:B.TIME,prefixes:N.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:B.FREQUENCY,prefixes:N.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:B.FREQUENCY,prefixes:N.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:B.ANGLE,prefixes:N.SHORT,value:1,offset:0},radian:{name:"radian",base:B.ANGLE,prefixes:N.LONG,value:1,offset:0},deg:{name:"deg",base:B.ANGLE,prefixes:N.SHORT,value:null,offset:0},degree:{name:"degree",base:B.ANGLE,prefixes:N.LONG,value:null,offset:0},grad:{name:"grad",base:B.ANGLE,prefixes:N.SHORT,value:null,offset:0},gradian:{name:"gradian",base:B.ANGLE,prefixes:N.LONG,value:null,offset:0},cycle:{name:"cycle",base:B.ANGLE,prefixes:N.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:B.ANGLE,prefixes:N.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:B.ANGLE,prefixes:N.NONE,value:null,offset:0},A:{name:"A",base:B.CURRENT,prefixes:N.SHORT,value:1,offset:0},ampere:{name:"ampere",base:B.CURRENT,prefixes:N.LONG,value:1,offset:0},K:{name:"K",base:B.TEMPERATURE,prefixes:N.SHORT,value:1,offset:0},degC:{name:"degC",base:B.TEMPERATURE,prefixes:N.SHORT,value:1,offset:273.15},degF:{name:"degF",base:B.TEMPERATURE,prefixes:N.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:B.TEMPERATURE,prefixes:N.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:B.TEMPERATURE,prefixes:N.LONG,value:1,offset:0},celsius:{name:"celsius",base:B.TEMPERATURE,prefixes:N.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:B.TEMPERATURE,prefixes:N.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:B.TEMPERATURE,prefixes:N.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:B.AMOUNT_OF_SUBSTANCE,prefixes:N.SHORT,value:1,offset:0},mole:{name:"mole",base:B.AMOUNT_OF_SUBSTANCE,prefixes:N.LONG,value:1,offset:0},cd:{name:"cd",base:B.LUMINOUS_INTENSITY,prefixes:N.SHORT,value:1,offset:0},candela:{name:"candela",base:B.LUMINOUS_INTENSITY,prefixes:N.LONG,value:1,offset:0},N:{name:"N",base:B.FORCE,prefixes:N.SHORT,value:1,offset:0},newton:{name:"newton",base:B.FORCE,prefixes:N.LONG,value:1,offset:0},dyn:{name:"dyn",base:B.FORCE,prefixes:N.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:B.FORCE,prefixes:N.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:B.FORCE,prefixes:N.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:B.FORCE,prefixes:N.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:B.FORCE,prefixes:N.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:B.FORCE,prefixes:N.NONE,value:9.80665,offset:0},J:{name:"J",base:B.ENERGY,prefixes:N.SHORT,value:1,offset:0},joule:{name:"joule",base:B.ENERGY,prefixes:N.LONG,value:1,offset:0},erg:{name:"erg",base:B.ENERGY,prefixes:N.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:B.ENERGY,prefixes:N.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:B.ENERGY,prefixes:N.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:B.ENERGY,prefixes:N.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:B.ENERGY,prefixes:N.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:B.POWER,prefixes:N.SHORT,value:1,offset:0},watt:{name:"watt",base:B.POWER,prefixes:N.LONG,value:1,offset:0},hp:{name:"hp",base:B.POWER,prefixes:N.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:B.POWER,prefixes:N.SHORT,value:d.I,offset:0},VA:{name:"VA",base:B.POWER,prefixes:N.SHORT,value:1,offset:0},Pa:{name:"Pa",base:B.PRESSURE,prefixes:N.SHORT,value:1,offset:0},psi:{name:"psi",base:B.PRESSURE,prefixes:N.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:B.PRESSURE,prefixes:N.NONE,value:101325,offset:0},bar:{name:"bar",base:B.PRESSURE,prefixes:N.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:B.PRESSURE,prefixes:N.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:B.PRESSURE,prefixes:N.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:B.PRESSURE,prefixes:N.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:B.PRESSURE,prefixes:N.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:B.ELECTRIC_CHARGE,prefixes:N.LONG,value:1,offset:0},C:{name:"C",base:B.ELECTRIC_CHARGE,prefixes:N.SHORT,value:1,offset:0},farad:{name:"farad",base:B.ELECTRIC_CAPACITANCE,prefixes:N.LONG,value:1,offset:0},F:{name:"F",base:B.ELECTRIC_CAPACITANCE,prefixes:N.SHORT,value:1,offset:0},volt:{name:"volt",base:B.ELECTRIC_POTENTIAL,prefixes:N.LONG,value:1,offset:0},V:{name:"V",base:B.ELECTRIC_POTENTIAL,prefixes:N.SHORT,value:1,offset:0},ohm:{name:"ohm",base:B.ELECTRIC_RESISTANCE,prefixes:N.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:B.ELECTRIC_INDUCTANCE,prefixes:N.LONG,value:1,offset:0},H:{name:"H",base:B.ELECTRIC_INDUCTANCE,prefixes:N.SHORT,value:1,offset:0},siemens:{name:"siemens",base:B.ELECTRIC_CONDUCTANCE,prefixes:N.LONG,value:1,offset:0},S:{name:"S",base:B.ELECTRIC_CONDUCTANCE,prefixes:N.SHORT,value:1,offset:0},weber:{name:"weber",base:B.MAGNETIC_FLUX,prefixes:N.LONG,value:1,offset:0},Wb:{name:"Wb",base:B.MAGNETIC_FLUX,prefixes:N.SHORT,value:1,offset:0},tesla:{name:"tesla",base:B.MAGNETIC_FLUX_DENSITY,prefixes:N.LONG,value:1,offset:0},T:{name:"T",base:B.MAGNETIC_FLUX_DENSITY,prefixes:N.SHORT,value:1,offset:0},b:{name:"b",base:B.BIT,prefixes:N.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:B.BIT,prefixes:N.BINARY_LONG,value:1,offset:0},B:{name:"B",base:B.BIT,prefixes:N.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:B.BIT,prefixes:N.BINARY_LONG,value:8,offset:0}},K={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function ve(U){if(U.number==="BigNumber"){var G=cl(g);P.rad.value=new g(1),P.deg.value=G.div(180),P.grad.value=G.div(200),P.cycle.value=G.times(2),P.arcsec.value=G.div(648e3),P.arcmin.value=G.div(10800)}else P.rad.value=1,P.deg.value=Math.PI/180,P.grad.value=Math.PI/200,P.cycle.value=Math.PI*2,P.arcsec.value=Math.PI/648e3,P.arcmin.value=Math.PI/10800;P.radian.value=P.rad.value,P.degree.value=P.deg.value,P.gradian.value=P.grad.value}ve(t),e&&e("config",function(U,G){U.number!==G.number&&ve(U)});var ie={si:{NONE:{unit:W,prefix:N.NONE[""]},LENGTH:{unit:P.m,prefix:N.SHORT[""]},MASS:{unit:P.g,prefix:N.SHORT.k},TIME:{unit:P.s,prefix:N.SHORT[""]},CURRENT:{unit:P.A,prefix:N.SHORT[""]},TEMPERATURE:{unit:P.K,prefix:N.SHORT[""]},LUMINOUS_INTENSITY:{unit:P.cd,prefix:N.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:P.mol,prefix:N.SHORT[""]},ANGLE:{unit:P.rad,prefix:N.SHORT[""]},BIT:{unit:P.bits,prefix:N.SHORT[""]},FORCE:{unit:P.N,prefix:N.SHORT[""]},ENERGY:{unit:P.J,prefix:N.SHORT[""]},POWER:{unit:P.W,prefix:N.SHORT[""]},PRESSURE:{unit:P.Pa,prefix:N.SHORT[""]},ELECTRIC_CHARGE:{unit:P.C,prefix:N.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:P.F,prefix:N.SHORT[""]},ELECTRIC_POTENTIAL:{unit:P.V,prefix:N.SHORT[""]},ELECTRIC_RESISTANCE:{unit:P.ohm,prefix:N.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:P.H,prefix:N.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:P.S,prefix:N.SHORT[""]},MAGNETIC_FLUX:{unit:P.Wb,prefix:N.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:P.T,prefix:N.SHORT[""]},FREQUENCY:{unit:P.Hz,prefix:N.SHORT[""]}}};ie.cgs=JSON.parse(JSON.stringify(ie.si)),ie.cgs.LENGTH={unit:P.m,prefix:N.SHORT.c},ie.cgs.MASS={unit:P.g,prefix:N.SHORT[""]},ie.cgs.FORCE={unit:P.dyn,prefix:N.SHORT[""]},ie.cgs.ENERGY={unit:P.erg,prefix:N.NONE[""]},ie.us=JSON.parse(JSON.stringify(ie.si)),ie.us.LENGTH={unit:P.ft,prefix:N.NONE[""]},ie.us.MASS={unit:P.lbm,prefix:N.NONE[""]},ie.us.TEMPERATURE={unit:P.degF,prefix:N.NONE[""]},ie.us.FORCE={unit:P.lbf,prefix:N.NONE[""]},ie.us.ENERGY={unit:P.BTU,prefix:N.BTU[""]},ie.us.POWER={unit:P.hp,prefix:N.NONE[""]},ie.us.PRESSURE={unit:P.psi,prefix:N.NONE[""]},ie.auto=JSON.parse(JSON.stringify(ie.si));var oe=ie.auto;v.setUnitSystem=function(U){if(je(ie,U))oe=ie[U];else throw new Error("Unit system "+U+" does not exist. Choices are: "+Object.keys(ie).join(", "))},v.getUnitSystem=function(){for(var U in ie)if(je(ie,U)&&ie[U]===oe)return U},v.typeConverters={BigNumber:function(G){return G!=null&&G.isFraction?new g(G.n).div(G.d).times(G.s):new g(G+"")},Fraction:function(G){return new y(G)},Complex:function(G){return G},number:function(G){return G!=null&&G.isFraction?h(G):G}},v.prototype._numberConverter=function(){var U=v.typeConverters[this.valueType()];if(U)return U;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(U){if(!v.typeConverters[U])throw new TypeError('Unsupported type "'+U+'"');return v.typeConverters[U]};for(var ge in P)if(je(P,ge)){var ue=P[ge];ue.dimensions=ue.base.dimensions}for(var ce in K)if(je(K,ce)){var me=P[K[ce]],de={};for(var Be in me)je(me,Be)&&(de[Be]=me[Be]);de.name=ce,P[ce]=de}v.isValidAlpha=function(G){return/^[a-zA-Z]$/.test(G)};function we(U){for(var G=0;G0&&!(v.isValidAlpha(b)||A(b)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+U+'"')}}return v.createUnit=function(U,G){if(typeof U!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(G&&G.override){for(var le in U)if(je(U,le)&&v.deleteUnit(le),U[le].aliases)for(var $=0;$1e-12){ne=!1;break}if(ne){Xt=!0,Ae.base=B[H];break}}if(!Xt){ye=ye||U+"_STUFF";var _e={dimensions:le.dimensions.slice(0)};_e.key=ye,B[ye]=_e,oe[ye]={unit:Ae,prefix:N.NONE[""]},Ae.base=B[ye]}}else{if(ye=ye||U+"_STUFF",V.indexOf(ye)>=0)throw new Error('Cannot create new base unit "'+U+'": a base unit with that name already exists (and cannot be overridden)');V.push(ye);for(var ct in B)je(B,ct)&&(B[ct].dimensions[V.length-1]=0);for(var xt={dimensions:[]},Vt=0;Vt{var{typed:e,Unit:t}=n;return e(tM,{Unit:function(i){return i.clone()},string:function(i){return t.isValuelessUnit(i)?new t(null,i):t.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new t(i,a)},"number | BigNumber | Fraction":function(i){return new t(i)},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))})});var rM="sparse",AH=["typed","SparseMatrix"],u0=S(rM,AH,n=>{var{typed:e,SparseMatrix:t}=n;return e(rM,{"":function(){return new t([])},string:function(i){return new t([],i)},"Array | Matrix":function(i){return new t(i)},"Array | Matrix, string":function(i,a){return new t(i,a)}})});var nM="createUnit",DH=["typed","Unit"],l0=S(nM,DH,n=>{var{typed:e,Unit:t}=n;return e(nM,{"Object, Object":function(i,a){return t.createUnit(i,a)},Object:function(i){return t.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var l={};return l[i]=a,t.createUnit(l,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,t.createUnit(o,{})},string:function(i){var a={};return a[i]={},t.createUnit(a,{})}})});var iM="acos",EH=["typed","config","Complex"],c0=S(iM,EH,n=>{var{typed:e,config:t,Complex:r}=n;return e(iM,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new r(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var aM="acosh",CH=["typed","config","Complex"],f0=S(aM,CH,n=>{var{typed:e,config:t,Complex:r}=n;return e(aM,{number:function(a){return a>=1||t.predictable?vg(a):a<=-1?new r(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new r(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var oM="acot",SH=["typed","BigNumber"],p0=S(oM,SH,n=>{var{typed:e,BigNumber:t}=n;return e(oM,{number:yg,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var sM="acoth",NH=["typed","config","Complex","BigNumber"],m0=S(sM,NH,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(sM,{number:function(o){return o>=1||o<=-1||t.predictable?xg(o):new r(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var uM="acsc",MH=["typed","config","Complex","BigNumber"],d0=S(uM,MH,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(uM,{number:function(o){return o<=-1||o>=1||t.predictable?bg(o):new r(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var lM="acsch",TH=["typed","BigNumber"],h0=S(lM,TH,n=>{var{typed:e,BigNumber:t}=n;return e(lM,{number:wg,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var cM="asec",FH=["typed","config","Complex","BigNumber"],g0=S(cM,FH,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(cM,{number:function(o){return o<=-1||o>=1||t.predictable?_g(o):new r(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var fM="asech",IH=["typed","config","Complex","BigNumber"],v0=S(fM,IH,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(fM,{number:function(o){if(o<=1&&o>=-1||t.predictable){var l=1/o;if(l>0||t.predictable)return Ag(o);var u=Math.sqrt(l*l-1);return new r(Math.log(u-l),Math.PI)}return new r(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var pM="asin",BH=["typed","config","Complex"],y0=S(pM,BH,n=>{var{typed:e,config:t,Complex:r}=n;return e(pM,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new r(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var OH="asinh",PH=["typed"],x0=S(OH,PH,n=>{var{typed:e}=n;return e("asinh",{number:Dg,Complex:function(r){return r.asinh()},BigNumber:function(r){return r.asinh()}})});var RH="atan",kH=["typed"],b0=S(RH,kH,n=>{var{typed:e}=n;return e("atan",{number:function(r){return Math.atan(r)},Complex:function(r){return r.atan()},BigNumber:function(r){return r.atan()}})});var mM="atan2",LH=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],w0=S(mM,LH,n=>{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,DenseMatrix:a,concat:o}=n,l=Tr({typed:e,equalScalar:r}),u=rr({typed:e}),s=Jf({typed:e,equalScalar:r}),c=$t({typed:e,equalScalar:r}),f=Ot({typed:e,DenseMatrix:a}),p=lt({typed:e,matrix:t,concat:o});return e(mM,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,h)=>i.atan2(m,h)},p({scalar:"number | BigNumber",SS:s,DS:u,SD:l,Ss:c,sS:f}))});var dM="atanh",VH=["typed","config","Complex"],_0=S(dM,VH,n=>{var{typed:e,config:t,Complex:r}=n;return e(dM,{number:function(a){return a<=1&&a>=-1||t.predictable?Eg(a):new r(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var gi=S("trigUnit",["typed"],n=>{var{typed:e}=n;return{Unit:e.referToSelf(t=>r=>{if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,r.valueType())(r.value)})}});var hM="cos",UH=["typed"],A0=S(hM,UH,n=>{var{typed:e}=n,t=gi({typed:e});return e(hM,{number:Math.cos,"Complex | BigNumber":r=>r.cos()},t)});var gM="cosh",qH=["typed"],D0=S(gM,qH,n=>{var{typed:e}=n;return e(gM,{number:Nf,"Complex | BigNumber":t=>t.cosh()})});var vM="cot",zH=["typed","BigNumber"],E0=S(vM,zH,n=>{var{typed:e,BigNumber:t}=n,r=gi({typed:e});return e(vM,{number:Cg,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},r)});var yM="coth",$H=["typed","BigNumber"],C0=S(yM,$H,n=>{var{typed:e,BigNumber:t}=n;return e(yM,{number:Sg,Complex:r=>r.coth(),BigNumber:r=>new t(1).div(r.tanh())})});var xM="csc",HH=["typed","BigNumber"],S0=S(xM,HH,n=>{var{typed:e,BigNumber:t}=n,r=gi({typed:e});return e(xM,{number:Ng,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},r)});var bM="csch",GH=["typed","BigNumber"],N0=S(bM,GH,n=>{var{typed:e,BigNumber:t}=n;return e(bM,{number:Mg,Complex:r=>r.csch(),BigNumber:r=>new t(1).div(r.sinh())})});var wM="sec",WH=["typed","BigNumber"],M0=S(wM,WH,n=>{var{typed:e,BigNumber:t}=n,r=gi({typed:e});return e(wM,{number:Tg,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},r)});var _M="sech",jH=["typed","BigNumber"],T0=S(_M,jH,n=>{var{typed:e,BigNumber:t}=n;return e(_M,{number:Fg,Complex:r=>r.sech(),BigNumber:r=>new t(1).div(r.cosh())})});var AM="sin",ZH=["typed"],F0=S(AM,ZH,n=>{var{typed:e}=n,t=gi({typed:e});return e(AM,{number:Math.sin,"Complex | BigNumber":r=>r.sin()},t)});var DM="sinh",JH=["typed"],I0=S(DM,JH,n=>{var{typed:e}=n;return e(DM,{number:Ig,"Complex | BigNumber":t=>t.sinh()})});var EM="tan",YH=["typed"],B0=S(EM,YH,n=>{var{typed:e}=n,t=gi({typed:e});return e(EM,{number:Math.tan,"Complex | BigNumber":r=>r.tan()},t)});var XH="tanh",QH=["typed"],O0=S(XH,QH,n=>{var{typed:e}=n;return e("tanh",{number:Mf,"Complex | BigNumber":t=>t.tanh()})});var CM="setCartesian",KH=["typed","size","subset","compareNatural","Index","DenseMatrix"],P0=S(CM,KH,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(CM,{"Array | Matrix, Array | Matrix":function(u,s){var c=[];if(r(t(u),new a(0))!==0&&r(t(s),new a(0))!==0){var f=pt(Array.isArray(u)?u:u.toArray()).sort(i),p=pt(Array.isArray(s)?s:s.toArray()).sort(i);c=[];for(var m=0;m{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(SM,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(r(t(u),new a(0))===0)c=[];else{if(r(t(s),new a(0))===0)return pt(u.toArray());var f=ma(pt(Array.isArray(u)?u:u.toArray()).sort(i)),p=ma(pt(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m,h=0;h{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(NM,{"Array | Matrix":function(u){var s;if(r(t(u),new a(0))===0)s=[];else{var c=pt(Array.isArray(u)?u:u.toArray()).sort(i);s=[],s.push(c[0]);for(var f=1;f{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(MM,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(r(t(u),new a(0))===0||r(t(s),new a(0))===0)c=[];else{var f=ma(pt(Array.isArray(u)?u:u.toArray()).sort(i)),p=ma(pt(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m=0;m{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(TM,{"Array | Matrix, Array | Matrix":function(l,u){if(r(t(l),new a(0))===0)return!0;if(r(t(u),new a(0))===0)return!1;for(var s=ma(pt(Array.isArray(l)?l:l.toArray()).sort(i)),c=ma(pt(Array.isArray(u)?u:u.toArray()).sort(i)),f,p=0;p{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(FM,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(l,u){if(r(t(u),new a(0))===0)return 0;for(var s=pt(Array.isArray(u)?u:u.toArray()),c=0,f=0;f{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(IM,{"Array | Matrix":function(s){if(r(t(s),new a(0))===0)return[];for(var c=pt(Array.isArray(s)?s:s.toArray()).sort(i),f=[],p=0;p.toString(2).length<=c.length;)f.push(o(c,p.toString(2).split("").reverse())),p++;return l(f)}});function o(u,s){for(var c=[],f=0;f0;c--)for(var f=0;fu[f+1].length&&(s=u[f],u[f]=u[f+1],u[f+1]=s);return u}});var BM="setSize",oG=["typed","compareNatural"],z0=S(BM,oG,n=>{var{typed:e,compareNatural:t}=n;return e(BM,{"Array | Matrix":function(i){return Array.isArray(i)?pt(i).length:pt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?pt(i).length:pt(i.toArray()).length;for(var o=pt(Array.isArray(i)?i:i.toArray()).sort(t),l=1,u=1;u{var{typed:e,size:t,concat:r,subset:i,setDifference:a,Index:o}=n;return e(OM,{"Array | Matrix, Array | Matrix":function(u,s){if(i(t(u),new o(0))===0)return pt(s);if(i(t(s),new o(0))===0)return pt(u);var c=pt(u),f=pt(s);return r(a(c,f),a(f,c))}})});var PM="setUnion",uG=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],H0=S(PM,uG,n=>{var{typed:e,size:t,concat:r,subset:i,setIntersect:a,setSymDifference:o,Index:l}=n;return e(PM,{"Array | Matrix, Array | Matrix":function(s,c){if(i(t(s),new l(0))===0)return pt(c);if(i(t(c),new l(0))===0)return pt(s);var f=pt(s),p=pt(c);return r(o(f,p),a(f,p))}})});var RM="add",lG=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],G0=S(RM,lG,n=>{var{typed:e,matrix:t,addScalar:r,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:l}=n,u=gn({typed:e}),s=$s({typed:e,equalScalar:i}),c=Ln({typed:e,DenseMatrix:a}),f=lt({typed:e,matrix:t,concat:l});return e(RM,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),y=0;y{var{typed:e,abs:t,addScalar:r,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:l,isPositive:u}=n;return e(kM,{"... number | BigNumber":s,Array:s,Matrix:c=>s(pt(c.toArray()))});function s(c){for(var f=0,p=0,m=0;m{var{typed:e,abs:t,add:r,pow:i,conj:a,sqrt:o,multiply:l,equalScalar:u,larger:s,smaller:c,matrix:f,ctranspose:p,eigs:m}=n;return e(LM,{number:Math.abs,Complex:function(C){return C.abs()},BigNumber:function(C){return C.abs()},boolean:function(C){return Math.abs(C)},Array:function(C){return b(f(C),2)},Matrix:function(C){return b(C,2)},"Array, number | BigNumber | string":function(C,A){return b(f(C),A)},"Matrix, number | BigNumber | string":function(C,A){return b(C,A)}});function h(D){var C=0;return D.forEach(function(A){var E=t(A);s(E,C)&&(C=E)},!0),C}function d(D){var C;return D.forEach(function(A){var E=t(A);(!C||c(E,C))&&(C=E)},!0),C||0}function g(D,C){if(C===Number.POSITIVE_INFINITY||C==="inf")return h(D);if(C===Number.NEGATIVE_INFINITY||C==="-inf")return d(D);if(C==="fro")return b(D,2);if(typeof C=="number"&&!isNaN(C)){if(!u(C,0)){var A=0;return D.forEach(function(E){A=r(i(t(E),C),A)},!0),i(A,1/C)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function y(D){var C=0;return D.forEach(function(A,E){C=r(C,l(A,a(A)))}),t(o(C))}function w(D){var C=[],A=0;return D.forEach(function(E,F){var I=F[1],O=r(C[I]||0,t(E));s(O,A)&&(A=O),C[I]=O},!0),A}function v(D){var C=D.size();if(C[0]!==C[1])throw new RangeError("Invalid matrix dimensions");var A=p(D),E=l(A,D),F=m(E).values.toArray(),I=F[F.length-1];return t(o(I))}function x(D){var C=[],A=0;return D.forEach(function(E,F){var I=F[0],O=r(C[I]||0,t(E));s(O,A)&&(A=O),C[I]=O},!0),A}function _(D,C){if(C===1)return w(D);if(C===Number.POSITIVE_INFINITY||C==="inf")return x(D);if(C==="fro")return y(D);if(C===2)return v(D);throw new Error("Unsupported parameter value "+C)}function b(D,C){var A=D.size();if(A.length===1)return g(D,C);if(A.length===2){if(A[0]&&A[1])return _(D,C);throw new RangeError("Invalid matrix dimensions")}}});var VM="dot",pG=["typed","addScalar","multiplyScalar","conj","size"],Z0=S(VM,pG,n=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:i,size:a}=n;return e(VM,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":u});function o(c,f){var p=s(c),m=s(f),h,d;if(p.length===1)h=p[0];else if(p.length===2&&p[1]===1)h=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m.length===1)d=m[0];else if(m.length===2&&m[1]===1)d=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.join(", ")+")");if(h!==d)throw new RangeError("Vectors must have equal length ("+h+" != "+d+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function l(c,f){var p=o(c,f),m=He(c)?c._data:c,h=He(c)?c._datatype:void 0,d=He(f)?f._data:f,g=He(f)?f._datatype:void 0,y=s(c).length===2,w=s(f).length===2,v=t,x=r;if(h&&g&&h===g&&typeof h=="string"){var _=h;v=e.find(t,[_,_]),x=e.find(r,[_,_])}if(!y&&!w){for(var b=x(i(m[0]),d[0]),D=1;Db){x++;continue}_===b&&(g=y(g,w(m[v],d[x])),v++,x++)}return g}function s(c){return He(c)?c.size():a(c)}});var mG="trace",dG=["typed","matrix","add"],J0=S(mG,dG,n=>{var{typed:e,matrix:t,add:r}=n;return e("trace",{Array:function(l){return i(t(l))},SparseMatrix:a,DenseMatrix:i,any:Ye});function i(o){var l=o._size,u=o._data;switch(l.length){case 1:if(l[0]===1)return Ye(u[0]);throw new RangeError("Matrix must be square (size: "+it(l)+")");case 2:{var s=l[0],c=l[1];if(s===c){for(var f=0,p=0;p0)for(var h=0;hh)break}return m}throw new RangeError("Matrix must be square (size: "+it(c)+")")}});var UM="index",hG=["typed","Index"],Y0=S(UM,hG,n=>{var{typed:e,Index:t}=n;return e(UM,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(l){return tt(l)?l.toNumber():Mt(l)||He(l)?l.map(function(u){return tt(u)?u.toNumber():u}):l}),o=new t;return t.apply(o,a),o}})});var up=new Set(["end"]);var gG="Node",vG=["mathWithTransform"],X0=S(gG,vG,n=>{var{mathWithTransform:e}=n;function t(i){for(var a of[...up])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class r{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(e,{}),o={},l=null;function u(s){var c=da(s);return t(c),a(c,o,l)}return{evaluate:u}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!At(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(l,u){l.forEach(function(s,c,f){u(s,c,f),o(s,u)})}o(this,a)}transform(a){function o(l,u,s){var c=a(l,u,s);return c!==l?c:l.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(l,u,s){a(l,u,s)&&o.push(l)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Si(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toString(a)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this.toHTML(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return r},{isClass:!0,isNode:!0});function nr(n){return n&&n.isIndexError?new on(n.index+1,n.min+1,n.max!==void 0?n.max+1:void 0):n}function lp(n){var{subset:e}=n;return function(r,i){try{if(Array.isArray(r))return e(r,i);if(r&&typeof r.subset=="function")return r.subset(i);if(typeof r=="string")return e(r,i);if(typeof r=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return dr(r,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw nr(a)}}}var cp="AccessorNode",yG=["subset","Node"],Q0=S(cp,yG,n=>{var{subset:e,Node:t}=n,r=lp({subset:e});function i(o){return!(Kn(o)||nn(o)||bt(o)||Nn(o)||za(o)||an(o)||Qt(o))}class a extends t{constructor(l,u){if(super(),!At(l))throw new TypeError('Node expected for parameter "object"');if(!fi(u))throw new TypeError('IndexNode expected for parameter "index"');this.object=l,this.index=u}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return cp}get isAccessorNode(){return!0}_compile(l,u){var s=this.object._compile(l,u),c=this.index._compile(l,u);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(m,h,d){return dr(s(m,h,d),f)}}else return function(m,h,d){var g=s(m,h,d),y=c(m,h,g);return r(g,y)}}forEach(l){l(this.object,"object",this),l(this.index,"index",this)}map(l){return new a(this._ifNode(l(this.object,"object",this)),this._ifNode(l(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(l){var u=this.object.toString(l);return i(this.object)&&(u="("+u+")"),u+this.index.toString(l)}toHTML(l){var u=this.object.toHTML(l);return i(this.object)&&(u='('+u+')'),u+this.index.toHTML(l)}_toTex(l){var u=this.object.toTex(l);return i(this.object)&&(u="\\left(' + object + '\\right)"),u+this.index.toTex(l)}toJSON(){return{mathjs:cp,object:this.object,index:this.index}}static fromJSON(l){return new a(l.object,l.index)}}return kt(a,"name",cp),a},{isClass:!0,isNode:!0});var fp="ArrayNode",xG=["Node"],K0=S(fp,xG,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(At))throw new TypeError("Array containing Nodes expected")}get type(){return fp}get isArrayNode(){return!0}_compile(i,a){var o=Pn(this.items,function(s){return s._compile(i,a)}),l=i.config.matrix!=="Array";if(l){var u=i.matrix;return function(c,f,p){return u(Pn(o,function(m){return m(c,f,p)}))}}else return function(c,f,p){return Pn(o,function(m){return m(c,f,p)})}}forEach(i){for(var a=0;a['+a.join(',')+']'}_toTex(i){function a(o,l){var u=o.some(nn)&&!o.every(nn),s=l||u,c=s?"&":"\\\\",f=o.map(function(p){return p.items?a(p.items,!l):p.toTex(i)}).join(c);return u||!s||s&&!l?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return kt(t,"name",fp),t},{isClass:!0,isNode:!0});function qM(n){var{subset:e,matrix:t}=n;return function(i,a,o){try{if(Array.isArray(i)){var l=t(i).subset(a,o).valueOf();return l.forEach((u,s)=>{i[s]=u}),i}else{if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return e(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return zi(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(u){throw nr(u)}}}var vi=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function pp(n,e){if(!e||e!=="auto")return n;for(var t=n;an(t);)t=t.content;return t}function qt(n,e,t,r){var i=n;e!=="keep"&&(i=n.getContent());for(var a=i.getIdentifier(),o=null,l=0;l{var{subset:e,matrix:t,Node:r}=n,i=lp({subset:e}),a=qM({subset:e,matrix:t});function o(u,s,c){s||(s="keep");var f=qt(u,s,c),p=qt(u.value,s,c);return s==="all"||p!==null&&p<=f}class l extends r{constructor(s,c,f){if(super(),this.object=s,this.index=f?c:null,this.value=f||c,!Qt(s)&&!Kn(s))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Qt(s)&&s.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!fi(this.index))throw new TypeError('IndexNode expected as "index"');if(!At(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return dp}get isAssignmentNode(){return!0}_compile(s,c){var f=this.object._compile(s,c),p=this.index?this.index._compile(s,c):null,m=this.value._compile(s,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(x,_,b){var D=f(x,_,b),C=m(x,_,b);return zi(D,d,C),C}}else{if(Qt(this.object))return function(x,_,b){var D=f(x,_,b),C=m(x,_,b),A=p(x,_,D);return x.set(h,a(D,A,C)),C};var g=this.object.object._compile(s,c);if(this.object.index.isObjectProperty()){var y=this.object.index.getObjectProperty();return function(x,_,b){var D=g(x,_,b),C=dr(D,y),A=p(x,_,C),E=m(x,_,b);return zi(D,y,a(C,A,E)),E}}else{var w=this.object.index._compile(s,c);return function(x,_,b){var D=g(x,_,b),C=w(x,_,D),A=i(D,C),E=p(x,_,A),F=m(x,_,b);return a(D,C,a(A,E,F)),F}}}else{if(!Qt(this.object))throw new TypeError("SymbolNode expected as object");return function(x,_,b){var D=m(x,_,b);return x.set(h,D),D}}}forEach(s){s(this.object,"object",this),this.index&&s(this.index,"index",this),s(this.value,"value",this)}map(s){var c=this._ifNode(s(this.object,"object",this)),f=this.index?this._ifNode(s(this.index,"index",this)):null,p=this._ifNode(s(this.value,"value",this));return new l(c,f,p)}clone(){return new l(this.object,this.index,this.value)}_toString(s){var c=this.object.toString(s),f=this.index?this.index.toString(s):"",p=this.value.toString(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="("+p+")"),c+f+" = "+p}toJSON(){return{mathjs:dp,object:this.object,index:this.index,value:this.value}}static fromJSON(s){return new l(s.object,s.index,s.value)}toHTML(s){var c=this.object.toHTML(s),f=this.index?this.index.toHTML(s):"",p=this.value.toHTML(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p='('+p+')'),c+f+'='+p}_toTex(s){var c=this.object.toTex(s),f=this.index?this.index.toTex(s):"",p=this.value.toTex(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="\\left(".concat(p,"\\right)")),c+f+"="+p}}return kt(l,"name",dp),l},{isClass:!0,isNode:!0});var hp="BlockNode",wG=["ResultSet","Node"],tx=S(hp,wG,n=>{var{ResultSet:e,Node:t}=n;class r extends t{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var l=o&&o.node,u=o&&o.visible!==void 0?o.visible:!0;if(!At(l))throw new TypeError('Property "node" must be a Node');if(typeof u!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:l,visible:u}})}get type(){return hp}get isBlockNode(){return!0}_compile(a,o){var l=Pn(this.blocks,function(u){return{evaluate:u.node._compile(a,o),visible:u.visible}});return function(s,c,f){var p=[];return $a(l,function(h){var d=h.evaluate(s,c,f);h.visible&&p.push(d)}),new e(p)}}forEach(a){for(var o=0;o;')}).join('
')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\; `)}}return kt(r,"name",hp),r},{isClass:!0,isNode:!0});var gp="ConditionalNode",_G=["Node"],rx=S(gp,_G,n=>{var{Node:e}=n;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(tt(i))return!i.isZero();if(Cn(i))return!!(i.re||i.im);if(rn(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+St(i)+'"')}class r extends e{constructor(a,o,l){if(super(),!At(a))throw new TypeError("Parameter condition must be a Node");if(!At(o))throw new TypeError("Parameter trueExpr must be a Node");if(!At(l))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=l}get type(){return gp}get isConditionalNode(){return!0}_compile(a,o){var l=this.condition._compile(a,o),u=this.trueExpr._compile(a,o),s=this.falseExpr._compile(a,o);return function(f,p,m){return t(l(f,p,m))?u(f,p,m):s(f,p,m)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new r(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=qt(this,o,a&&a.implicit),u=this.condition.toString(a),s=qt(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=l)&&(u="("+u+")");var c=this.trueExpr.toString(a),f=qt(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=l)&&(c="("+c+")");var p=this.falseExpr.toString(a),m=qt(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=l)&&(p="("+p+")"),u+" ? "+c+" : "+p}toJSON(){return{mathjs:gp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new r(a.condition,a.trueExpr,a.falseExpr)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=qt(this,o,a&&a.implicit),u=this.condition.toHTML(a),s=qt(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=l)&&(u='('+u+')');var c=this.trueExpr.toHTML(a),f=qt(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=l)&&(c='('+c+')');var p=this.falseExpr.toHTML(a),m=qt(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=l)&&(p='('+p+')'),u+'?'+c+':'+p}_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 kt(r,"name",gp),r},{isClass:!0,isNode:!0});var WM=gr(HM(),1);var ix={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:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Lt={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},ax={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Lt.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Lt.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Lt.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Lt.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Lt.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Lt.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Lt.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Lt.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Lt.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Lt.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Lt.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Lt.bitAnd,"${args[1]}\\right)")},bitNot:{1:Lt.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Lt.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Lt.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Lt.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Lt.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Lt.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Lt.and,"${args[1]}\\right)")},not:{1:Lt.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Lt.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Lt.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Lt.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Lt.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Lt.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Lt.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Lt.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Lt.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Lt.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Lt.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Lt.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Lt.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Lt.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(ix.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},jM="\\mathrm{${name}}\\left(${args}\\right)",GM={deg:"^\\circ"};function vp(n){return(0,WM.default)(n,{preserveFormatting:!0})}function yp(n,e){return e=typeof e=="undefined"?!1:e,e?je(GM,n)?GM[n]:"\\mathrm{"+vp(n)+"}":je(ix,n)?ix[n]:vp(n)}var xp="ConstantNode",CG=["Node"],ox=S(xp,CG,n=>{var{Node:e}=n;class t extends e{constructor(i){super(),this.value=i}get type(){return xp}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new t(this.value)}_toString(i){return it(this.value,i)}toHTML(i){var a=this._toString(i);switch(St(this.value)){case"number":case"BigNumber":case"Fraction":return''+a+"";case"string":return''+a+"";case"boolean":return''+a+"";case"null":return''+a+"";case"undefined":return''+a+"";default:return''+a+""}}toJSON(){return{mathjs:xp,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i);switch(St(this.value)){case"string":return"\\mathtt{"+vp(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return kt(t,"name",xp),t},{isClass:!0,isNode:!0});var bp="FunctionAssignmentNode",SG=["typed","Node"],sx=S(bp,SG,n=>{var{typed:e,Node:t}=n;function r(a,o,l){var u=qt(a,o,l),s=qt(a.expr,o,l);return o==="all"||s!==null&&s<=u}class i extends t{constructor(o,l,u){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(l))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!At(u))throw new TypeError('Node expected for parameter "expr"');if(up.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var s=new Set;for(var c of l){var f=typeof c=="string"?c:c.name;if(s.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));s.add(f)}this.name=o,this.params=l.map(function(p){return p&&p.name||p}),this.types=l.map(function(p){return p&&p.type||"any"}),this.expr=u}get type(){return bp}get isFunctionAssignmentNode(){return!0}_compile(o,l){var u=Object.create(l);$a(this.params,function(h){u[h]=!0});var s=this.expr._compile(o,u),c=this.name,f=this.params,p=mh(this.types,","),m=c+"("+mh(this.params,", ")+")";return function(d,g,y){var w={};w[p]=function(){for(var x=Object.create(g),_=0;_'+zr(this.params[s])+"");var c=this.expr.toHTML(o);return r(this,l,o&&o.implicit)&&(c='('+c+')'),''+zr(this.name)+'('+u.join(',')+')='+c}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toTex(o);return r(this,l,o&&o.implicit)&&(u="\\left(".concat(u,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(yp).join(",")+"\\right)="+u}}return kt(i,"name",bp),i},{isClass:!0,isNode:!0});var wp="IndexNode",NG=["Node","size"],ux=S(wp,NG,n=>{var{Node:e,size:t}=n;class r extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(At))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return wp}get isIndexNode(){return!0}_compile(a,o){var l=Pn(this.dimensions,function(s,c){var f=s.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var p=Object.create(o);p.end=!0;var m=s._compile(a,p);return function(d,g,y){if(!He(y)&&!Mt(y)&&!xr(y))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+St(y));var w=t(y).valueOf(),v=Object.create(g);return v.end=w[c],m(d,v,y)}}else return s._compile(a,o)}),u=dr(a,"index");return function(c,f,p){var m=Pn(l,function(h){return h(c,f,p)});return u(...m)}}forEach(a){for(var o=0;o.'+zr(this.getObjectProperty())+"":'['+o.join(',')+']'}_toTex(a){var o=this.dimensions.map(function(l){return l.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return kt(r,"name",wp),r},{isClass:!0,isNode:!0});var _p="ObjectNode",MG=["Node"],lx=S(_p,MG,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return At(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return _p}get isObjectNode(){return!0}_compile(i,a){var o={};for(var l in this.properties)if(je(this.properties,l)){var u=Vo(l),s=JSON.parse(u),c=dr(this.properties,l);o[s]=c._compile(i,a)}return function(p,m,h){var d={};for(var g in o)je(o,g)&&(d[g]=o[g](p,m,h));return d}}forEach(i){for(var a in this.properties)je(this.properties,a)&&i(this.properties[a],"properties["+Vo(a)+"]",this)}map(i){var a={};for(var o in this.properties)je(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Vo(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)je(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)je(this.properties,o)&&a.push(Vo(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:_p,properties:this.properties}}static fromJSON(i){return new t(i.properties)}toHTML(i){var a=[];for(var o in this.properties)je(this.properties,o)&&a.push(''+zr(o)+':'+this.properties[o].toHTML(i));return'{'+a.join(',')+'}'}_toTex(i){var a=[];for(var o in this.properties)je(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var l="\\left\\{\\begin{array}{ll}"+a.join(` `)+"\\end{array}\\right\\}";return l}}return kt(t,"name",_p),t},{isClass:!0,isNode:!0});var Ap="OperatorNode",TG=["Node"],cx=S(Ap,TG,n=>{var{Node:e}=n;function t(a,o){var l=a;if(o==="auto")for(;an(l);)l=l.content;return bt(l)?!0:cr(l)?t(l.args[0],o):!1}function r(a,o,l,u,s){var c=qt(a,o,l),f=Ys(a,o);if(o==="all"||u.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return u.map(function(E){switch(E.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(u.length){case 0:p=[];break;case 1:{var m=qt(u[0],o,l,a);if(s&&m!==null){var h,d;if(o==="keep"?(h=u[0].getIdentifier(),d=a.getIdentifier()):(h=u[0].getContent().getIdentifier(),d=a.getContent().getIdentifier()),vi[c][d].latexLeftParens===!1){p=[!1];break}if(vi[m][h].latexParens===!1){p=[!1];break}}if(m===null){p=[!1];break}if(m<=c){p=[!0];break}p=[!1]}break;case 2:{var g,y=qt(u[0],o,l,a),w=mp(a,u[0],o);y===null?g=!1:y===c&&f==="right"&&!w||y=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&l==="hide")for(var A=1;A2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=s.map(function(y,w){return y=y.toString(o),c[w]&&(y="("+y+")"),y});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?g.join(" "):g.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Ap,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}toHTML(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=r(this,l,u,s,!1);if(s.length===1){var f=Ys(this,l),p=s[0].toHTML(o);return c[0]&&(p='('+p+')'),f==="right"?''+zr(this.op)+""+p:p+''+zr(this.op)+""}else if(s.length===2){var m=s[0].toHTML(o),h=s[1].toHTML(o);return c[0]&&(m='('+m+')'),c[1]&&(h='('+h+')'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?m+''+h:m+''+zr(this.op)+""+h}else{var d=s.map(function(g,y){return g=g.toHTML(o),c[y]&&(g='('+g+')'),g});return s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?d.join(''):d.join(''+zr(this.op)+""):''+zr(this.fn)+'('+d.join(',')+')'}}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=r(this,l,u,s,!0),f=Lt[this.fn];if(f=typeof f=="undefined"?this.op:f,s.length===1){var p=Ys(this,l),m=s[0].toTex(o);return c[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?f+m:m+f}else if(s.length===2){var h=s[0],d=h.toTex(o);c[0]&&(d="\\left(".concat(d,"\\right)"));var g=s[1],y=g.toTex(o);c[1]&&(y="\\left(".concat(y,"\\right)"));var w;switch(l==="keep"?w=h.getIdentifier():w=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+y+"}";case"OperatorNode:pow":switch(d="{"+d+"}",y="{"+y+"}",w){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&u==="hide")return d+"~"+y}return d+f+y}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=s.map(function(x,_){return x=x.toTex(o),c[_]&&(x="\\left(".concat(x,"\\right)")),x});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&u==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+s.map(function(x){return x.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return kt(i,"name",Ap),i},{isClass:!0,isNode:!0});var Dp="ParenthesisNode",FG=["Node"],fx=S(Dp,FG,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),!At(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Dp}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new t(a)}clone(){return new t(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:Dp,content:this.content}}static fromJSON(i){return new t(i.content)}toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'('+this.content.toHTML(i)+')':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return kt(t,"name",Dp),t},{isClass:!0,isNode:!0});var Ep="RangeNode",IG=["Node"],px=S(Ep,IG,n=>{var{Node:e}=n;function t(i,a,o){var l=qt(i,a,o),u={},s=qt(i.start,a,o);if(u.start=s!==null&&s<=l||a==="all",i.step){var c=qt(i.step,a,o);u.step=c!==null&&c<=l||a==="all"}var f=qt(i.end,a,o);return u.end=f!==null&&f<=l||a==="all",u}class r extends e{constructor(a,o,l){if(super(),!At(a))throw new TypeError("Node expected");if(!At(o))throw new TypeError("Node expected");if(l&&!At(l))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=l||null}get type(){return Ep}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Qt(o)&&o.name==="end"});return a.length>0}_compile(a,o){var l=a.range,u=this.start._compile(a,o),s=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(p,m,h){return l(u(p,m,h),s(p,m,h),c(p,m,h))}}else return function(p,m,h){return l(u(p,m,h),s(p,m,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new r(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new r(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u,s=this.start.toString(a);if(l.start&&(s="("+s+")"),u=s,this.step){var c=this.step.toString(a);l.step&&(c="("+c+")"),u+=":"+c}var f=this.end.toString(a);return l.end&&(f="("+f+")"),u+=":"+f,u}toJSON(){return{mathjs:Ep,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new r(a.start,a.end,a.step)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u,s=this.start.toHTML(a);if(l.start&&(s='('+s+')'),u=s,this.step){var c=this.step.toHTML(a);l.step&&(c='('+c+')'),u+=':'+c}var f=this.end.toHTML(a);return l.end&&(f='('+f+')'),u+=':'+f,u}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u=this.start.toTex(a);if(l.start&&(u="\\left(".concat(u,"\\right)")),this.step){var s=this.step.toTex(a);l.step&&(s="\\left(".concat(s,"\\right)")),u+=":"+s}var c=this.end.toTex(a);return l.end&&(c="\\left(".concat(c,"\\right)")),u+=":"+c,u}}return kt(r,"name",Ep),r},{isClass:!0,isNode:!0});var Cp="RelationalNode",BG=["Node"],mx=S(Cp,BG,n=>{var{Node:e}=n,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return Cp}get isRelationalNode(){return!0}_compile(a,o){var l=this,u=this.params.map(s=>s._compile(a,o));return function(c,f,p){for(var m,h=u[0](c,f,p),d=0;da(o,"params["+l+"]",this),this)}map(a){return new r(this.conditionals.slice(),this.params.map((o,l)=>this._ifNode(a(o,"params["+l+"]",this)),this))}clone(){return new r(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=qt(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=qt(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?"("+f.toString(a)+")":f.toString(a)}),s=u[0],c=0;c('+f.toHTML(a)+')':f.toHTML(a)}),s=u[0],c=0;c'+zr(t[this.conditionals[c]])+""+u[c+1];return s}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=qt(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=qt(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),s=u[0],c=0;c{var{math:e,Unit:t,Node:r}=n;function i(o){return t?t.isValuelessUnit(o):!1}class a extends r{constructor(l){if(super(),typeof l!="string")throw new TypeError('String expected for parameter "name"');this.name=l}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(l,u){var s=this.name;if(u[s]===!0)return function(f,p,m){return dr(p,s)};if(s in l)return function(f,p,m){return f.has(s)?f.get(s):dr(l,s)};var c=i(s);return function(f,p,m){return f.has(s)?f.get(s):c?new t(null,s):a.onUndefinedSymbol(s)}}forEach(l){}map(l){return this.clone()}static onUndefinedSymbol(l){throw new Error("Undefined symbol "+l)}clone(){return new a(this.name)}_toString(l){return this.name}toHTML(l){var u=zr(this.name);return u==="true"||u==="false"?''+u+"":u==="i"?''+u+"":u==="Infinity"?''+u+"":u==="NaN"?''+u+"":u==="null"?''+u+"":u==="undefined"?''+u+"":''+u+""}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(l){return new a(l.name)}_toTex(l){var u=!1;typeof e[this.name]=="undefined"&&i(this.name)&&(u=!0);var s=yp(this.name,u);return s[0]==="\\"?s:" "+s}}return a},{isClass:!0,isNode:!0});function Wo(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r{var e,{math:t,Node:r,SymbolNode:i}=n,a=u=>it(u,{truncate:78});function o(u,s,c){for(var f="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,h;(h=p.exec(u))!==null;)if(f+=u.substring(m,h.index),m=h.index,h[0]==="$$")f+="$",m++;else{m+=h[0].length;var d=s[h[1]];if(!d)throw new ReferenceError("Template: Property "+h[1]+" does not exist.");if(h[2]===void 0)switch(typeof d){case"string":f+=d;break;case"object":if(At(d))f+=d.toTex(c);else if(Array.isArray(d))f+=d.map(function(g,y){if(At(g))return g.toTex(c);throw new TypeError("Template: "+h[1]+"["+y+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes")}else if(At(d[h[2]]&&d[h[2]]))f+=d[h[2]].toTex(c);else throw new TypeError("Template: "+h[1]+"["+h[2]+"] is not a Node.")}return f+=u.slice(m),f}class l extends r{constructor(s,c){if(super(),typeof s=="string"&&(s=new i(s)),!At(s))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(At))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=s,this.args=c||[]}get name(){return this.fn.name||""}get type(){return Sp}get isFunctionNode(){return!0}_compile(s,c){var f=this.args.map(C=>C._compile(s,c));if(Qt(this.fn)){var p=this.fn.name;if(c[p]){var y=this.args;return function(A,E,F){var I=dr(E,p);if(typeof I!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(I)));if(I.rawArgs)return I(y,s,Wo(A,E),A);var O=f.map(k=>k(A,E,F));return I.apply(I,O)}}else{var m=p in s?dr(s,p):void 0,h=typeof m=="function"&&m.rawArgs===!0,d=C=>{var A;if(C.has(p))A=C.get(p);else if(p in s)A=dr(s,p);else return l.onUndefinedFunction(p);if(typeof A=="function")return A;throw new TypeError("'".concat(p,`' is not a function; its value is: `).concat(a(A)))};if(h){var g=this.args;return function(A,E,F){var I=d(A);return I(g,s,Wo(A,E),A)}}else switch(f.length){case 0:return function(A,E,F){var I=d(A);return I()};case 1:return function(A,E,F){var I=d(A),O=f[0];return I(O(A,E,F))};case 2:return function(A,E,F){var I=d(A),O=f[0],k=f[1];return I(O(A,E,F),k(A,E,F))};default:return function(A,E,F){var I=d(A),O=f.map(k=>k(A,E,F));return I(...O)}}}}else if(Kn(this.fn)&&fi(this.fn.index)&&this.fn.index.isObjectProperty()){var w=this.fn.object._compile(s,c),v=this.fn.index.getObjectProperty(),x=this.args;return function(A,E,F){var I=w(A,E,F),O=aC(I,v);if(O!=null&&O.rawArgs)return O(x,s,Wo(A,E),A);var k=f.map(R=>R(A,E,F));return O.apply(I,k)}}else{var _=this.fn.toString(),b=this.fn._compile(s,c),D=this.args;return function(A,E,F){var I=b(A,E,F);if(typeof I!="function")throw new TypeError("Expression '".concat(_,"' did not evaluate to a function; value is:")+` `.concat(a(I)));if(I.rawArgs)return I(D,s,Wo(A,E),A);var O=f.map(k=>k(A,E,F));return I.apply(I,O)}}}forEach(s){s(this.fn,"fn",this);for(var c=0;c'+zr(this.fn)+'('+c.join(',')+')'}toTex(s){var c;return s&&typeof s.handler=="object"&&je(s.handler,this.name)&&(c=s.handler[this.name](this,s)),typeof c!="undefined"?c:super.toTex(s)}_toTex(s){var c=this.args.map(function(m){return m.toTex(s)}),f;ax[this.name]&&(f=ax[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(f=t[this.name].toTex);var p;switch(typeof f){case"function":p=f(this,s);break;case"string":p=o(f,this,s);break;case"object":switch(typeof f[c.length]){case"function":p=f[c.length](this,s);break;case"string":p=o(f[c.length],this,s);break}}return typeof p!="undefined"?p:o(jM,this,s)}getIdentifier(){return this.type+":"+this.name}}return e=l,kt(l,"name",Sp),kt(l,"onUndefinedFunction",function(u){throw new Error("Undefined function "+u)}),kt(l,"fromJSON",function(u){return new e(u.fn,u.args)}),l},{isClass:!0,isNode:!0});var ZM="parse",kG=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],gx=S(ZM,kG,n=>{var{typed:e,numeric:t,config:r,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:l,ConditionalNode:u,ConstantNode:s,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:w}=n,v=e(ZM,{string:function(q){return ee(q,{})},"Array | Matrix":function(q){return x(q,{})},"string, Object":function(q,se){var Ee=se.nodes!==void 0?se.nodes:{};return ee(q,Ee)},"Array | Matrix, Object":x});function x(M){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=q.nodes!==void 0?q.nodes:{};return Ze(M,function(Ee){if(typeof Ee!="string")throw new TypeError("String expected");return ee(Ee,se)})}var _={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},b={",":!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},D={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},C={true:!0,false:!1,null:null,undefined:void 0},A=["NaN","Infinity"],E={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:` `,r:"\r",t:" "};function F(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:_.NULL,nestingLevel:0,conditionalLevel:null}}function I(M,q){return M.expression.substr(M.index,q)}function O(M){return I(M,1)}function k(M){M.index++}function R(M){return M.expression.charAt(M.index-1)}function T(M){return M.expression.charAt(M.index+1)}function N(M){for(M.tokenType=_.NULL,M.token="",M.comment="";;){if(O(M)==="#")for(;O(M)!==` `&&O(M)!=="";)M.comment+=O(M),k(M);if(v.isWhitespace(O(M),M.nestingLevel))k(M);else break}if(O(M)===""){M.tokenType=_.DELIMITER;return}if(O(M)===` `&&!M.nestingLevel){M.tokenType=_.DELIMITER,M.token=O(M),k(M);return}var q=O(M),se=I(M,2),Ee=I(M,3);if(Ee.length===3&&b[Ee]){M.tokenType=_.DELIMITER,M.token=Ee,k(M),k(M),k(M);return}if(se.length===2&&b[se]){M.tokenType=_.DELIMITER,M.token=se,k(M),k(M);return}if(b[q]){M.tokenType=_.DELIMITER,M.token=q,k(M);return}if(v.isDigitDot(q)){M.tokenType=_.NUMBER;var Ke=I(M,2);if(Ke==="0b"||Ke==="0o"||Ke==="0x"){for(M.token+=O(M),k(M),M.token+=O(M),k(M);v.isHexDigit(O(M));)M.token+=O(M),k(M);if(O(M)===".")for(M.token+=".",k(M);v.isHexDigit(O(M));)M.token+=O(M),k(M);else if(O(M)==="i")for(M.token+="i",k(M);v.isDigit(O(M));)M.token+=O(M),k(M);return}if(O(M)==="."){if(M.token+=O(M),k(M),!v.isDigit(O(M))){M.tokenType=_.DELIMITER;return}}else{for(;v.isDigit(O(M));)M.token+=O(M),k(M);v.isDecimalMark(O(M),T(M))&&(M.token+=O(M),k(M))}for(;v.isDigit(O(M));)M.token+=O(M),k(M);if(O(M)==="E"||O(M)==="e"){if(v.isDigit(T(M))||T(M)==="-"||T(M)==="+"){if(M.token+=O(M),k(M),(O(M)==="+"||O(M)==="-")&&(M.token+=O(M),k(M)),!v.isDigit(O(M)))throw Ce(M,'Digit expected, got "'+O(M)+'"');for(;v.isDigit(O(M));)M.token+=O(M),k(M);if(v.isDecimalMark(O(M),T(M)))throw Ce(M,'Digit expected, got "'+O(M)+'"')}else if(T(M)===".")throw k(M),Ce(M,'Digit expected, got "'+O(M)+'"')}return}if(v.isAlpha(O(M),R(M),T(M))){for(;v.isAlpha(O(M),R(M),T(M))||v.isDigit(O(M));)M.token+=O(M),k(M);je(D,M.token)?M.tokenType=_.DELIMITER:M.tokenType=_.SYMBOL;return}for(M.tokenType=_.UNKNOWN;O(M)!=="";)M.token+=O(M),k(M);throw Ce(M,'Syntax error in part "'+M.token+'"')}function V(M){do N(M);while(M.token===` `)}function B(M){M.nestingLevel++}function X(M){M.nestingLevel--}v.isAlpha=function(q,se,Ee){return v.isValidLatinOrGreek(q)||v.isValidMathSymbol(q,Ee)||v.isValidMathSymbol(se,q)},v.isValidLatinOrGreek=function(q){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(q)},v.isValidMathSymbol=function(q,se){return/^[\uD835]$/.test(q)&&/^[\uDC00-\uDFFF]$/.test(se)&&/^[^\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(se)},v.isWhitespace=function(q,se){return q===" "||q===" "||q===` `&&se>0},v.isDecimalMark=function(q,se){return q==="."&&se!=="/"&&se!=="*"&&se!=="^"},v.isDigitDot=function(q){return q>="0"&&q<="9"||q==="."},v.isDigit=function(q){return q>="0"&&q<="9"},v.isHexDigit=function(q){return q>="0"&&q<="9"||q>="a"&&q<="f"||q>="A"&&q<="F"};function ee(M,q){var se=F();mr(se,{expression:M,extraNodes:q}),N(se);var Ee=W(se);if(se.token!=="")throw se.tokenType===_.DELIMITER?Oe(se,"Unexpected operator "+se.token):Ce(se,'Unexpected part "'+se.token+'"');return Ee}function W(M){var q,se=[],Ee;for(M.token!==""&&M.token!==` `&&M.token!==";"&&(q=P(M),M.comment&&(q.comment=M.comment));M.token===` `||M.token===";";)se.length===0&&q&&(Ee=M.token!==";",se.push({node:q,visible:Ee})),N(M),M.token!==` `&&M.token!==";"&&M.token!==""&&(q=P(M),M.comment&&(q.comment=M.comment),Ee=M.token!==";",se.push({node:q,visible:Ee}));return se.length>0?new l(se):(q||(q=new s(void 0),M.comment&&(q.comment=M.comment)),q)}function P(M){var q,se,Ee,Ke,st=K(M);if(M.token==="="){if(Qt(st))return q=st.name,V(M),Ee=P(M),new o(new w(q),Ee);if(Kn(st))return V(M),Ee=P(M),new o(st.object,st.index,Ee);if(Nn(st)&&Qt(st.fn)&&(Ke=!0,se=[],q=st.name,st.args.forEach(function(fr,Hn){Qt(fr)?se[Hn]=fr.name:Ke=!1}),Ke))return V(M),Ee=P(M),new c(q,se,Ee);throw Ce(M,"Invalid left hand side of assignment operator =")}return st}function K(M){for(var q=ve(M);M.token==="?";){var se=M.conditionalLevel;M.conditionalLevel=M.nestingLevel,V(M);var Ee=q,Ke=P(M);if(M.token!==":")throw Ce(M,"False part of conditional expression expected");M.conditionalLevel=null,V(M);var st=P(M);q=new u(Ee,Ke,st),M.conditionalLevel=se}return q}function ve(M){for(var q=ie(M);M.token==="or";)V(M),q=new h("or","or",[q,ie(M)]);return q}function ie(M){for(var q=oe(M);M.token==="xor";)V(M),q=new h("xor","xor",[q,oe(M)]);return q}function oe(M){for(var q=ge(M);M.token==="and";)V(M),q=new h("and","and",[q,ge(M)]);return q}function ge(M){for(var q=ue(M);M.token==="|";)V(M),q=new h("|","bitOr",[q,ue(M)]);return q}function ue(M){for(var q=ce(M);M.token==="^|";)V(M),q=new h("^|","bitXor",[q,ce(M)]);return q}function ce(M){for(var q=me(M);M.token==="&";)V(M),q=new h("&","bitAnd",[q,me(M)]);return q}function me(M){for(var q=[de(M)],se=[],Ee={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};je(Ee,M.token);){var Ke={name:M.token,fn:Ee[M.token]};se.push(Ke),V(M),q.push(de(M))}return q.length===1?q[0]:q.length===2?new h(se[0].name,se[0].fn,q):new y(se.map(st=>st.fn),q)}function de(M){var q,se,Ee,Ke;q=Be(M);for(var st={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};je(st,M.token);)se=M.token,Ee=st[se],V(M),Ke=[q,Be(M)],q=new h(se,Ee,Ke);return q}function Be(M){var q,se,Ee,Ke;q=we(M);for(var st={to:"to",in:"to"};je(st,M.token);)se=M.token,Ee=st[se],V(M),se==="in"&&M.token===""?q=new h("*","multiply",[q,new w("in")],!0):(Ke=[q,we(M)],q=new h(se,Ee,Ke));return q}function we(M){var q,se=[];if(M.token===":"?q=new s(1):q=U(M),M.token===":"&&M.conditionalLevel!==M.nestingLevel){for(se.push(q);M.token===":"&&se.length<3;)V(M),M.token===")"||M.token==="]"||M.token===","||M.token===""?se.push(new w("end")):se.push(U(M));se.length===3?q=new g(se[0],se[2],se[1]):q=new g(se[0],se[1])}return q}function U(M){var q,se,Ee,Ke;q=G(M);for(var st={"+":"add","-":"subtract"};je(st,M.token);){se=M.token,Ee=st[se],V(M);var fr=G(M);fr.isPercentage?Ke=[q,new h("*","multiply",[q,fr])]:Ke=[q,fr],q=new h(se,Ee,Ke)}return q}function G(M){var q,se,Ee,Ke;q=le(M),se=q;for(var st={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};je(st,M.token);)Ee=M.token,Ke=st[Ee],V(M),se=le(M),q=new h(Ee,Ke,[q,se]);return q}function le(M){var q,se;for(q=$(M),se=q;M.tokenType===_.SYMBOL||M.token==="in"&&bt(q)||M.tokenType===_.NUMBER&&!bt(se)&&(!cr(se)||se.op==="!")||M.token==="(";)se=$(M),q=new h("*","multiply",[q,se],!0);return q}function $(M){for(var q=Q(M),se=q,Ee=[];M.token==="/"&&qu(se);)if(Ee.push(mr({},M)),V(M),M.tokenType===_.NUMBER)if(Ee.push(mr({},M)),V(M),M.tokenType===_.SYMBOL||M.token==="(")mr(M,Ee.pop()),Ee.pop(),se=Q(M),q=new h("/","divide",[q,se]);else{Ee.pop(),mr(M,Ee.pop());break}else{mr(M,Ee.pop());break}return q}function Q(M){var q,se,Ee,Ke;q=re(M);for(var st={"%":"mod",mod:"mod"};je(st,M.token);)se=M.token,Ee=st[se],V(M),se==="%"&&M.tokenType===_.DELIMITER&&M.token!=="("?q=new h("/","divide",[q,new s(100)],!1,!0):(Ke=[q,re(M)],q=new h(se,Ee,Ke));return q}function re(M){var q,se,Ee,Ke={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return je(Ke,M.token)?(Ee=Ke[M.token],q=M.token,V(M),se=[re(M)],new h(q,Ee,se)):he(M)}function he(M){var q,se,Ee,Ke;return q=ye(M),(M.token==="^"||M.token===".^")&&(se=M.token,Ee=se==="^"?"pow":"dotPow",V(M),Ke=[q,re(M)],q=new h(se,Ee,Ke)),q}function ye(M){var q,se,Ee,Ke;q=Le(M);for(var st={"!":"factorial","'":"ctranspose"};je(st,M.token);)se=M.token,Ee=st[se],N(M),Ke=[q],q=new h(se,Ee,Ke),q=ct(M,q);return q}function Le(M){var q=[];if(M.tokenType===_.SYMBOL&&je(M.extraNodes,M.token)){var se=M.extraNodes[M.token];if(N(M),M.token==="("){if(q=[],B(M),N(M),M.token!==")")for(q.push(P(M));M.token===",";)N(M),q.push(P(M));if(M.token!==")")throw Ce(M,"Parenthesis ) expected");X(M),N(M)}return new se(q)}return Ae(M)}function Ae(M){var q,se;return M.tokenType===_.SYMBOL||M.tokenType===_.DELIMITER&&M.token in D?(se=M.token,N(M),je(C,se)?q=new s(C[se]):A.indexOf(se)!==-1?q=new s(t(se,"number")):q=new w(se),q=ct(M,q),q):xt(M)}function ct(M,q,se){for(var Ee;(M.token==="("||M.token==="["||M.token===".")&&(!se||se.indexOf(M.token)!==-1);)if(Ee=[],M.token==="(")if(Qt(q)||Kn(q)){if(B(M),N(M),M.token!==")")for(Ee.push(P(M));M.token===",";)N(M),Ee.push(P(M));if(M.token!==")")throw Ce(M,"Parenthesis ) expected");X(M),N(M),q=new f(q,Ee)}else return q;else if(M.token==="["){if(B(M),N(M),M.token!=="]")for(Ee.push(P(M));M.token===",";)N(M),Ee.push(P(M));if(M.token!=="]")throw Ce(M,"Parenthesis ] expected");X(M),N(M),q=new i(q,new p(Ee))}else{N(M);var Ke=M.tokenType===_.SYMBOL||M.tokenType===_.DELIMITER&&M.token in D;if(!Ke)throw Ce(M,"Property name expected after dot");Ee.push(new s(M.token)),N(M);var st=!0;q=new i(q,new p(Ee,st))}return q}function xt(M){var q,se;return M.token==='"'||M.token==="'"?(se=Vt(M,M.token),q=new s(se),q=ct(M,q),q):Xt(M)}function Vt(M,q){for(var se="";O(M)!==""&&O(M)!==q;)if(O(M)==="\\"){k(M);var Ee=O(M),Ke=E[Ee];if(Ke!==void 0)se+=Ke,M.index+=1;else if(Ee==="u"){var st=M.expression.slice(M.index+1,M.index+5);if(/^[0-9A-Fa-f]{4}$/.test(st))se+=String.fromCharCode(parseInt(st,16)),M.index+=5;else throw Ce(M,"Invalid unicode character \\u".concat(st))}else throw Ce(M,"Bad escape character \\".concat(Ee))}else se+=O(M),k(M);if(N(M),M.token!==q)throw Ce(M,"End of string ".concat(q," expected"));return N(M),se}function Xt(M){var q,se,Ee,Ke;if(M.token==="["){if(B(M),N(M),M.token!=="]"){var st=H(M);if(M.token===";"){for(Ee=1,se=[st];M.token===";";)N(M),se[Ee]=H(M),Ee++;if(M.token!=="]")throw Ce(M,"End of matrix ] expected");X(M),N(M),Ke=se[0].items.length;for(var fr=1;fr{var{typed:e,parse:t}=n;return e(JM,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return Ze(i,function(a){return t(a).compile()})}})});var YM="evaluate",VG=["typed","parse"],yx=S(YM,VG,n=>{var{typed:e,parse:t}=n;return e(YM,{string:function(i){var a=$i();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=$i();return Ze(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return Ze(i,function(o){return t(o).compile().evaluate(a)})}})});var UG="Parser",qG=["evaluate"],xx=S(UG,qG,n=>{var{evaluate:e}=n;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:$i(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(r){return e(r,this.scope)},t.prototype.get=function(r){if(this.scope.has(r))return this.scope.get(r)},t.prototype.getAll=function(){return sC(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(r,i){return this.scope.set(r,i),i},t.prototype.remove=function(r){this.scope.delete(r)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var XM="parser",zG=["typed","Parser"],bx=S(XM,zG,n=>{var{typed:e,Parser:t}=n;return e(XM,{"":function(){return new t}})});var QM="lup",$G=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],wx=S(QM,$G,n=>{var{typed:e,matrix:t,abs:r,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:l,larger:u,equalScalar:s,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=n;return e(QM,{DenseMatrix:function(y){return h(y)},SparseMatrix:function(y){return d(y)},Array:function(y){var w=t(y),v=h(w);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function h(g){var y=g._size[0],w=g._size[1],v=Math.min(y,w),x=Ye(g._data),_=[],b=[y,v],D=[],C=[v,w],A,E,F,I=[];for(A=0;A0)for(A=0;A0&&P.forEach(0,T-1,function(ue,ce){p._forEachRow(ue,D,C,A,function(me,de){me>ue&&P.accumulate(me,c(o(de,ce)))})});var ie=T,oe=P.get(T),ge=r(oe);P.forEach(T+1,y-1,function(ue,ce){var me=r(ce);u(me,ge)&&(ie=ue,ge=me,oe=ce)}),T!==ie&&(p._swapRows(T,ie,E[1],D,C,A),p._swapRows(T,ie,k[1],F,I,O),P.swap(T,ie),X(T,ie)),P.forEach(0,y-1,function(ue,ce){ue<=T?(F.push(ce),I.push(ue)):(ce=a(ce,oe),s(ce,0)||(D.push(ce),C.push(ue)))})};for(T=0;T{var{typed:e,matrix:t,zeros:r,identity:i,isZero:a,equal:o,sign:l,sqrt:u,conj:s,unaryMinus:c,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=n;return mr(e(KM,{DenseMatrix:function(x){return y(x)},SparseMatrix:function(x){return w(x)},Array:function(x){var _=t(x),b=y(_);return{Q:b.Q.valueOf(),R:b.R.valueOf()}}}),{_denseQRimpl:g});function g(v){var x=v._size[0],_=v._size[1],b=i([x],"dense"),D=b._data,C=v.clone(),A=C._data,E,F,I,O=r([x],"");for(I=0;I0)for(var b=_[0][0].type==="Complex"?d(0):0,D=0;D<_.length;++D)for(var C=0;C=0;){var u=t[o+l],s=t[r+u];s===-1?(l--,a[e++]=u):(t[r+u]=t[i+s],++l,t[o+l]=s)}return e}function tT(n,e){if(!n)return null;var t=0,r,i=[],a=[],o=0,l=e,u=2*e;for(r=0;r=0;r--)n[r]!==-1&&(a[l+r]=a[o+n[r]],a[o+n[r]]=r);for(r=0;r{var{add:e,multiply:t,transpose:r}=n;return function(c,f){if(!f||c<=0||c>3)return null;var p=f._size,m=p[0],h=p[1],d=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var y=i(c,f,m,h,g);nT(y,u,null);for(var w=y._index,v=y._ptr,x=v[h],_=[],b=[],D=0,C=h+1,A=2*(h+1),E=3*(h+1),F=4*(h+1),I=5*(h+1),O=6*(h+1),k=7*(h+1),R=_,T=a(h,v,b,D,E,R,A,k,C,O,F,I),N=o(h,v,b,I,F,O,g,C,E,R,A),V=0,B,X,ee,W,P,K,ve,ie,oe,ge,ue,ce,me,de,Be,we;NU?(K=ee,ve=$,ie=b[D+ee]-U):(K=w[$++],ve=v[K],ie=b[D+K]),P=1;P<=ie;P++)B=w[ve++],!((oe=b[C+B])<=0)&&(le+=oe,b[C+B]=-oe,w[re++]=B,b[A+B]!==-1&&(R[b[A+B]]=R[B]),R[B]!==-1?b[A+R[B]]=b[A+B]:b[E+b[I+B]]=b[A+B]);K!==ee&&(v[K]=Ii(ee),b[O+K]=0)}for(U!==0&&(x=re),b[I+ee]=le,v[ee]=Q,b[D+ee]=re-Q,b[F+ee]=-2,T=l(T,d,b,O,h),ge=Q;ge=T?b[O+K]-=oe:b[O+K]!==0&&(b[O+K]=b[I+K]+he)}for(ge=Q;ge0?(we+=ye,w[de++]=K,Be+=K):(v[K]=Ii(ee),b[O+K]=0)}b[F+B]=de-ce+1;var Le=de,Ae=ce+b[D+B];for($=me+1;$=0))for(Be=R[B],B=b[k+Be],b[k+Be]=-1;B!==-1&&b[A+B]!==-1;B=b[A+B],T++){for(ie=b[D+B],ue=b[F+B],$=v[B]+1;$<=v[B]+ie-1;$++)b[O+w[$]]=T;var xt=B;for(X=b[A+B];X!==-1;){var Vt=b[D+X]===ie&&b[F+X]===ue;for($=v[X]+1;Vt&&$<=v[X]+ie-1;$++)b[O+w[$]]!==T&&(Vt=0);Vt?(v[X]=Ii(B),b[C+B]+=b[C+X],b[C+X]=0,b[F+X]=-1,X=b[A+X],b[A+xt]=X):(xt=X,X=b[A+X])}}for($=Q,ge=Q;ge=0;X--)b[C+X]>0||(b[A+X]=b[E+v[X]],b[E+v[X]]=X);for(K=h;K>=0;K--)b[C+K]<=0||v[K]!==-1&&(b[A+K]=b[E+v[K]],b[E+v[K]]=K);for(ee=0,B=0;B<=h;B++)v[B]===-1&&(ee=Np(B,ee,b,E,A,_,O));return _.splice(_.length-1,1),_};function i(s,c,f,p,m){var h=r(c);if(s===1&&p===f)return e(c,h);if(s===2){for(var d=h._index,g=h._ptr,y=0,w=0;wm))for(var x=g[w+1];vd)f[g+_]=0,f[m+_]=-1,x++,c[_]=Ii(s),f[g+s]++;else{var D=f[y+b];D!==-1&&(w[D]=_),f[v+_]=f[y+b],f[y+b]=_}}return x}function l(s,c,f,p,m){if(s<2||s+c<0){for(var h=0;h{var{transpose:e}=n;return function(t,r,i,a){if(!t||!r||!i)return null;var o=t._size,l=o[0],u=o[1],s,c,f,p,m,h,d,g=4*u+(a?u+l+1:0),y=[],w=0,v=u,x=2*u,_=3*u,b=4*u,D=5*u+1;for(f=0;f=1&&C[c]++,I.jleaf===2&&C[I.q]--}r[c]!==-1&&(y[w+c]=r[c])}for(c=0;c{var{add:e,multiply:t,transpose:r}=n,i=iT({add:e,multiply:t,transpose:r}),a=oT({transpose:r});return function(u,s,c){var f=s._ptr,p=s._size,m=p[1],h,d={};if(d.q=i(u,s),u&&!d.q)return null;if(c){var g=u?eT(s,null,d.q,0):s;d.parent=rT(g,1);var y=tT(d.parent,m);if(d.cp=a(g,d.parent,y,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,h=0;h=0;D--)for(A=s[D],E=s[D+1],C=A;C=0;b--)d[b]=-1,D=g[b],D!==-1&&(y[_+D]++===0&&(y[x+D]=b),y[w+b]=y[v+D],y[v+D]=b);for(u.lnz=0,u.m2=p,D=0;D=0;){n=r[p];var m=i?i[n]:n;fl(o,n)||(Mp(o,n),r[u+p]=m<0?0:Ax(o[m]));var h=1;for(c=r[u+p],f=m<0?0:Ax(o[m+1]);c{var{divideScalar:e,multiply:t,subtract:r}=n;return function(a,o,l,u,s,c,f){var p=a._values,m=a._index,h=a._ptr,d=a._size,g=d[1],y=o._values,w=o._index,v=o._ptr,x,_,b,D,C=lT(a,o,l,u,c);for(x=C;x{var{abs:e,divideScalar:t,multiply:r,subtract:i,larger:a,largerEq:o,SparseMatrix:l}=n,u=cT({divideScalar:t,multiply:r,subtract:i});return function(c,f,p){if(!c)return null;var m=c._size,h=m[1],d,g=100,y=100;f&&(d=f.q,g=f.lnz||g,y=f.unz||y);var w=[],v=[],x=[],_=new l({values:w,index:v,ptr:x,size:[h,h]}),b=[],D=[],C=[],A=new l({values:b,index:D,ptr:C,size:[h,h]}),E=[],F,I,O=[],k=[];for(F=0;F{var{typed:e,abs:t,add:r,multiply:i,transpose:a,divideScalar:o,subtract:l,larger:u,largerEq:s,SparseMatrix:c}=n,f=sT({add:r,multiply:i,transpose:a}),p=fT({abs:t,divideScalar:o,multiply:i,subtract:l,larger:u,largerEq:s,SparseMatrix:c});return e(pT,{"SparseMatrix, number, number":function(h,d,g){if(!ze(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var y=f(d,h,!1),w=p(h,y,g);return{L:w.L,U:w.U,p:w.pinv,q:y.q,toString:function(){return"L: "+this.L.toString()+` U: `+this.U.toString()+` p: `+this.p.toString()+(this.q?` q: `+this.q.toString():"")+` `}}}})});function Ex(n,e){var t,r=e.length,i=[];if(n)for(t=0;t{var{typed:e,matrix:t,lup:r,slu:i,usolve:a,lsolve:o,DenseMatrix:l}=n,u=Wi({DenseMatrix:l});return e(mT,{"Array, Array | Matrix":function(p,m){p=t(p);var h=r(p),d=c(h.L,h.U,h.p,null,m);return d.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix, number, number":function(p,m,h,d){var g=i(p,h,d);return c(g.L,g.U,g.p,g.q,m)},"Object, Array | Matrix":function(p,m){return c(p.L,p.U,p.p,p.q,m)}});function s(f){if(He(f))return f;if(Mt(f))return t(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,p,m,h,d){f=s(f),p=s(p),m&&(d=u(f,d,!0),d._data=Ex(m,d._data));var g=o(f,d),y=a(p,g);return h&&(y._data=Ex(h,y._data)),y}});var dT="polynomialRoot",nW=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Sx=S(dT,nW,n=>{var{typed:e,isZero:t,equalScalar:r,add:i,subtract:a,multiply:o,divide:l,sqrt:u,unaryMinus:s,cbrt:c,typeOf:f,im:p,re:m}=n;return e(dT,{"number|Complex, ...number|Complex":(h,d)=>{for(var g=[h,...d];g.length>0&&t(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(d,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[s(l(g[0],g[1]))];case 3:{var[y,w,v]=g,x=o(2,v),_=o(w,w),b=o(4,v,y);if(r(_,b))return[l(s(w),x)];var D=u(a(_,b));return[l(a(D,w),x),l(a(s(D),w),x)]}case 4:{var[C,A,E,F]=g,I=s(o(3,F)),O=o(E,E),k=o(3,F,A),R=i(o(2,E,E,E),o(27,F,F,C)),T=o(9,F,E,A);if(r(O,k)&&r(R,T))return[l(E,I)];var N=a(O,k),V=a(R,T),B=i(o(18,F,E,A,C),o(E,E,A,A)),X=i(o(4,E,E,E,C),o(4,F,A,A,A),o(27,F,F,C,C));if(r(B,X))return[l(a(o(4,F,E,A),i(o(9,F,F,C),o(E,E,E))),o(F,N)),l(a(o(9,F,C),o(E,A)),o(2,N))];var ee;r(O,k)?ee=V:ee=l(i(V,u(a(o(V,V),o(4,N,N,N)))),2);var W=!0,P=c(ee,W).toArray().map(K=>l(i(E,K,l(N,K)),I));return P.map(K=>f(K)==="Complex"&&r(m(K),m(K)+p(K))?m(K):K)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var iW="Help",aW=["parse"],Nx=S(iW,aW,n=>{var{parse:e}=n;function t(r){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!r)throw new Error('Argument "doc" missing');this.doc=r}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var r=this.doc||{},i=` `;if(r.name&&(i+="Name: "+r.name+` `),r.category&&(i+="Category: "+r.category+` `),r.description&&(i+=`Description: `+r.description+` `),r.syntax&&(i+=`Syntax: `+r.syntax.join(` `)+` `),r.examples){i+=`Examples: `;for(var a={},o=0;oa!=="mathjs").forEach(a=>{i[a]=r[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var oW="Chain",sW=["?on","math","typed"],Mx=S(oW,sW,n=>{var{on:e,math:t,typed:r}=n;function i(s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Af(s)?this.value=s.value:this.value=s}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 it(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(s){return new i(s.value)};function a(s,c){typeof c=="function"&&(i.prototype[s]=l(c))}function o(s,c){IE(i.prototype,s,function(){var p=c();if(typeof p=="function")return l(p)})}function l(s){return function(){if(arguments.length===0)return new i(s(this.value));for(var c=[this.value],f=0;fs[h])};for(var p in s)f(p)}};var u={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),e&&e("import",function(s,c,f){f||o(s,c)}),i},{isClass:!0});var Tx={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 hT={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var gT={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 vT={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 yT={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var xT={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var bT={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var wT={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 _T={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var AT={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var DT={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 Fx={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 ET={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var CT={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var ST={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var NT={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var MT={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var TT={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var FT={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var IT={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var BT={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var OT={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var PT={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var RT={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var kT={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var LT={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var VT={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var UT={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var qT={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var zT={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var $T={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var HT={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var GT={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var WT={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var jT={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var ZT={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var JT={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var YT={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var XT={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var QT={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var KT={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var e2={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var t2={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var r2={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var n2={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var i2={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var a2={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var o2={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var s2={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var u2={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var l2={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var c2={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var f2={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var p2={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var m2={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var d2={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var h2={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var g2={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var v2={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var y2={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var x2={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var b2={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var w2={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var _2={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var A2={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var D2={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var E2={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var C2={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var S2={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var N2={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var M2={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var T2={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var F2={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var I2={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var B2={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var O2={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var P2={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var R2={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var k2={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var L2={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var V2={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var U2={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var q2={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var z2={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var $2={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var H2={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var G2={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var W2={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var j2={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var Z2={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var J2={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var Y2={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var X2={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var Q2={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var K2={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var eF={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var tF={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var rF={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var nF={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var iF={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var aF={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var oF={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var sF={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var uF={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var lF={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var cF={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var fF={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var pF={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var mF={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var dF={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var hF={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var gF={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var vF={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var yF={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var xF={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var bF={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var wF={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var _F={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var AF={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var DF={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var EF={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var CF={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false }"],seealso:["inv"]};var SF={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var NF={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var MF={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var TF={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var FF={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var IF={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var BF={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var OF={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var PF={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var RF={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var kF={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var LF={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var VF={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var UF={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var qF={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var zF={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var $F={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var HF={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var GF={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var WF={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var jF={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var ZF={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var JF={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var YF={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var XF={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var QF={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var KF={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var eI={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var tI={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var rI={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var nI={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var iI={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var aI={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var oI={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var sI={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var uI={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var lI={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var cI={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var fI={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var pI={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var mI={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var dI={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var hI={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var gI={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var vI={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var yI={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var xI={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var bI={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var wI={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var _I={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var AI={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var DI={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var EI={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var CI={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var SI={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var NI={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var MI={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var TI={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var FI={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var II={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var BI={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var OI={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var PI={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var RI={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var kI={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var LI={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var VI={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var UI={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var qI={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var zI={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var $I={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var HI={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var GI={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var WI={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 jI={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 ZI={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 JI={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 YI={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 XI={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 QI={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 KI={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 eB={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var tB={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 rB={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var nB={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 iB={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var aB={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var oB={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var sB={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var uB={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var lB={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var cB={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var fB={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var pB={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var mB={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var dB={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var hB={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var gB={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var vB={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var yB={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var xB={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var bB={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var wB={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var _B={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var AB={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var DB={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var EB={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var CB={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var SB={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var NB={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var MB={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var TB={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var FB={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var IB={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var BB={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var OB={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var PB={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var RB={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var kB={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var LB={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var VB={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var UB={bignumber:TT,boolean:FT,complex:IT,createUnit:BT,fraction:OT,index:PT,matrix:RT,number:kT,sparse:LT,splitUnit:VT,string:UT,unit:qT,e:Tx,E:Tx,false:hT,i:gT,Infinity:vT,LN2:xT,LN10:yT,LOG2E:wT,LOG10E:bT,NaN:_T,null:AT,pi:Fx,PI:Fx,phi:DT,SQRT1_2:ET,SQRT2:CT,tau:ST,true:NT,version:MT,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:GT,lsolve:jT,lsolveAll:ZT,lup:JT,lusolve:YT,leafCount:WT,polynomialRoot:XT,resolve:e2,simplify:t2,simplifyConstant:r2,simplifyCore:n2,symbolicEqual:a2,rationalize:KT,slu:i2,usolve:o2,usolveAll:s2,qr:QT,abs:u2,add:l2,cbrt:c2,ceil:f2,cube:p2,divide:m2,dotDivide:d2,dotMultiply:h2,dotPow:g2,exp:v2,expm:y2,expm1:x2,fix:b2,floor:w2,gcd:_2,hypot:A2,lcm:E2,log:C2,log2:M2,log1p:N2,log10:S2,mod:T2,multiply:F2,norm:I2,nthRoot:B2,nthRoots:O2,pow:P2,round:R2,sign:k2,sqrt:L2,sqrtm:V2,square:$2,subtract:H2,unaryMinus:G2,unaryPlus:W2,xgcd:j2,invmod:D2,bitAnd:Z2,bitNot:J2,bitOr:Y2,bitXor:X2,leftShift:Q2,rightArithShift:K2,rightLogShift:eF,bellNumbers:tF,catalan:rF,composition:nF,stirlingS2:iF,config:zT,import:$T,typed:HT,arg:aF,conj:oF,re:uF,im:sF,evaluate:lF,help:cF,distance:fF,intersect:pF,and:mF,not:dF,or:hF,xor:gF,concat:yF,count:xF,cross:bF,column:vF,ctranspose:wF,det:_F,diag:AF,diff:DF,dot:EF,getMatrixDataType:TF,identity:FF,filter:SF,flatten:NF,forEach:MF,inv:IF,pinv:BF,eigs:CF,kron:OF,matrixFromFunction:kF,matrixFromRows:LF,matrixFromColumns:RF,map:PF,ones:VF,partitionSelect:UF,range:qF,resize:$F,reshape:zF,rotate:HF,rotationMatrix:GF,row:WF,size:jF,sort:ZF,squeeze:JF,subset:YF,trace:XF,transpose:QF,zeros:KF,fft:eI,ifft:tI,sylvester:U2,schur:q2,lyap:z2,solveODE:VB,combinations:rI,combinationsWithRep:nI,factorial:iI,gamma:aI,kldivergence:sI,lgamma:oI,multinomial:uI,permutations:lI,pickRandom:cI,random:fI,randomInt:pI,compare:mI,compareNatural:dI,compareText:hI,deepEqual:gI,equal:vI,equalText:yI,larger:xI,largerEq:bI,smaller:wI,smallerEq:_I,unequal:AI,setCartesian:DI,setDifference:EI,setDistinct:CI,setIntersect:SI,setIsSubset:NI,setMultiplicity:MI,setPowerset:TI,setSize:FI,setSymDifference:II,setUnion:BI,zpk2tf:OI,freqz:PI,erf:RI,zeta:kI,cumsum:jI,mad:LI,max:VI,mean:UI,median:qI,min:zI,mode:$I,prod:HI,quantileSeq:GI,std:WI,sum:ZI,variance:JI,corr:YI,acos:XI,acosh:QI,acot:KI,acoth:eB,acsc:tB,acsch:rB,asec:nB,asech:iB,asin:aB,asinh:oB,atan:sB,atanh:lB,atan2:uB,cos:cB,cosh:fB,cot:pB,coth:mB,csc:dB,csch:hB,sec:gB,sech:vB,sin:yB,sinh:xB,tan:bB,tanh:wB,to:_B,clone:DB,format:EB,bin:AB,oct:RB,hex:SB,isNaN:MB,isInteger:NB,isNegative:TB,isNumeric:FB,hasNumericValue:CB,isPositive:IB,isPrime:BB,isZero:OB,print:kB,typeOf:LB,numeric:PB};var qB="help",uW=["typed","mathWithTransform","Help"],Ix=S(qB,uW,n=>{var{typed:e,mathWithTransform:t,Help:r}=n;return e(qB,{any:function(a){var o,l=a;if(typeof a!="string"){for(o in t)if(je(t,o)&&a===t[o]){l=o;break}}var u=dr(UB,l);if(!u){var s=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+s+'"')}return new r(u)}})});var zB="chain",lW=["typed","Chain"],Bx=S(zB,lW,n=>{var{typed:e,Chain:t}=n;return e(zB,{"":function(){return new t},any:function(i){return new t(i)}})});var $B="det",cW=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],Ox=S($B,cW,n=>{var{typed:e,matrix:t,subtractScalar:r,multiply:i,divideScalar:a,isZero:o,unaryMinus:l}=n;return e($B,{any:function(c){return Ye(c)},"Array | Matrix":function(c){var f;switch(He(c)?f=c.size():Array.isArray(c)?(c=t(c),f=c.size()):f=[],f.length){case 0:return Ye(c);case 1:if(f[0]===1)return Ye(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+it(f)+")");case 2:{var p=f[0],m=f[1];if(p===m)return u(c.clone().valueOf(),p,m);if(m===0)return 1;throw new RangeError("Matrix must be square (size: "+it(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+it(f)+")")}}});function u(s,c,f){if(c===1)return Ye(s[0][0]);if(c===2)return r(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var p=!1,m=new Array(c).fill(0).map((D,C)=>C),h=0;h{var{typed:e,matrix:t,divideScalar:r,addScalar:i,multiply:a,unaryMinus:o,det:l,identity:u,abs:s}=n;return e(HB,{"Array | Matrix":function(p){var m=He(p)?p.size():et(p);switch(m.length){case 1:if(m[0]===1)return He(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+it(m)+")");case 2:{var h=m[0],d=m[1];if(h===d)return He(p)?t(c(p.valueOf(),h,d),p.storage()):c(p,h,d);throw new RangeError("Matrix must be square (size: "+it(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+it(m)+")")}},any:function(p){return r(1,p)}});function c(f,p,m){var h,d,g,y,w;if(p===1){if(y=f[0][0],y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,y)]]}else if(p===2){var v=l(f);if(v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(f[1][1],v),r(o(f[0][1]),v)],[r(o(f[1][0]),v),r(f[0][0],v)]]}else{var x=f.concat();for(h=0;hD&&(D=s(x[h][b]),C=h),h++;if(D===0)throw Error("Cannot calculate inverse, determinant is zero");h=C,h!==b&&(w=x[b],x[b]=x[h],x[h]=w,w=_[b],_[b]=_[h],_[h]=w);var A=x[b],E=_[b];for(h=0;h{var{typed:e,matrix:t,inv:r,deepEqual:i,equal:a,dotDivide:o,dot:l,ctranspose:u,divideScalar:s,multiply:c,add:f,Complex:p}=n;return e(GB,{"Array | Matrix":function(v){var x=He(v)?v.size():et(v);switch(x.length){case 1:return y(v)?u(v):x[0]===1?r(v):o(u(v),l(v,v));case 2:{if(y(v))return u(v);var _=x[0],b=x[1];if(_===b)try{return r(v)}catch(D){if(!(D instanceof Error&&D.message.match(/Cannot calculate inverse, determinant is zero/)))throw D}return He(v)?t(m(v.valueOf(),_,b),v.storage()):m(v,_,b)}default:throw new RangeError("Matrix must be two dimensional (size: "+it(x)+")")}},any:function(v){return a(v,0)?Ye(v):s(1,v)}});function m(w,v,x){var{C:_,F:b}=d(w,v,x),D=c(r(c(u(_),_)),u(_)),C=c(u(b),r(c(b,u(b))));return c(C,D)}function h(w,v,x){for(var _=Ye(w),b=0,D=0;DC.filter((E,F)=>F!g(l(_[A],_[A])));return{C:b,F:D}}function g(w){return a(f(w,p(1,1)),f(0,p(1,1)))}function y(w){return i(f(w,p(1,1)),f(c(w,0),p(1,1)))}});function WB(n){var{addScalar:e,subtract:t,flatten:r,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:l,abs:u,bignumber:s,diag:c,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:w,larger:v,smaller:x,matrixFromColumns:_,dot:b}=n;function D(W,P,K,ve){var ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,oe=C(W,P,K,ve,ie);A(W,P,K,ve,ie,oe);var{values:ge,C:ue}=E(W,P,K,ve,ie);if(ie){var ce=F(W,P,ue,oe,ge,K,ve);return{values:ge,eigenvectors:ce}}return{values:ge}}function C(W,P,K,ve,ie){var oe=ve==="BigNumber",ge=ve==="Complex",ue=oe?s(0):0,ce=oe?s(1):ge?w(1):1,me=oe?s(1):1,de=oe?s(10):2,Be=a(de,de),we;ie&&(we=Array(P).fill(ce));for(var U=!1;!U;){U=!0;for(var G=0;G1&&(U=c(Array(de-1).fill(ue)))),de-=1,ce.pop();for(var ye=0;ye2&&(U=c(Array(de-2).fill(ue)))),de-=2,ce.pop(),ce.pop();for(var Ae=0;Ae+t(u(Vt),u(Xt))),G>100){var ct=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+me.join(", "));throw ct.values=me,ct.vectors=[],ct}var xt=ie?i(we,R(Be,P)):void 0;return{values:me,C:xt}}function F(W,P,K,ve,ie,oe,ge){var ue=m(K),ce=i(ue,W,K),me=ge==="BigNumber",de=ge==="Complex",Be=me?s(0):de?w(0):0,we=me?s(1):de?w(1):1,U=[],G=[];for(var le of ie){var $=T(U,le,y);$===-1?(U.push(le),G.push(1)):G[$]+=1}for(var Q=[],re=U.length,he=Array(P).fill(Be),ye=c(Array(P).fill(we)),Le=function(){var xt=U[Ae],Vt=t(ce,i(xt,ye)),Xt=g(Vt,he);for(Xt.shift();Xt.lengthi(ne,pe)),Q.push(...Xt.map(pe=>({value:xt,vector:r(pe)})))},Ae=0;Ae=5)return null;for(ue=0;;){var ce=d(W,ge);if(x(X(B(ge,[ce])),ve))break;if(++ue>=10)return null;ge=ee(ce)}return ge}function V(W,P,K){var ve=K==="BigNumber",ie=K==="Complex",oe=Array(W).fill(0).map(ge=>2*Math.random()-1);return ve&&(oe=oe.map(ge=>s(ge))),ie&&(oe=oe.map(ge=>w(ge))),oe=B(oe,P),ee(oe,K)}function B(W,P){var K=f(W);for(var ve of P)ve=p(ve,K),W=t(W,i(o(b(ve,W),b(ve,ve)),ve));return W}function X(W){return u(l(b(W,W)))}function ee(W,P){var K=P==="BigNumber",ve=P==="Complex",ie=K?s(1):ve?w(1):1;return i(o(ie,X(W)),W)}return D}function jB(n){var{config:e,addScalar:t,subtract:r,abs:i,atan:a,cos:o,sin:l,multiplyScalar:u,inv:s,bignumber:c,multiply:f,add:p}=n;function m(A,E){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,I=arguments.length>3?arguments[3]:void 0,O=arguments.length>4?arguments[4]:void 0;if(I==="number")return h(A,F,O);if(I==="BigNumber")return d(A,F,O);throw TypeError("Unsupported data type: "+I)}function h(A,E,F){var I=A.length,O=Math.abs(E/I),k,R;if(F){R=new Array(I);for(var T=0;T=Math.abs(O);){var V=N[0][0],B=N[0][1];k=g(A[V][V],A[B][B],A[V][B]),A=_(A,k,V,B),F&&(R=w(R,k,V,B)),N=b(A)}for(var X=Array(I).fill(0),ee=0;ee=i(O);){var V=N[0][0],B=N[0][1];k=y(A[V][V],A[B][B],A[V][B]),A=x(A,k,V,B),F&&(R=v(R,k,V,B)),N=D(A)}for(var X=Array(I).fill(0),ee=0;ee({value:O[P],vector:W}));return{values:O,eigenvectors:ee}}return m}var mW="eigs",dW=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],kx=S(mW,dW,n=>{var{config:e,typed:t,matrix:r,addScalar:i,subtract:a,equal:o,abs:l,atan:u,cos:s,sin:c,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:d,add:g,larger:y,column:w,flatten:v,number:x,complex:_,sqrt:b,diag:D,size:C,reshape:A,qr:E,usolve:F,usolveAll:I,im:O,re:k,smaller:R,matrixFromColumns:T,dot:N}=n,V=jB({config:e,addScalar:i,subtract:a,column:w,flatten:v,equal:o,abs:l,atan:u,cos:s,sin:c,multiplyScalar:f,inv:m,bignumber:h,complex:_,multiply:d,add:g}),B=WB({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:v,divideScalar:p,sqrt:b,abs:l,bignumber:h,diag:D,size:C,reshape:A,qr:E,inv:m,usolve:F,usolveAll:I,equal:o,complex:_,larger:y,smaller:R,matrixFromColumns:T,dot:N});return t("eigs",{Array:function(oe){return X(r(oe))},"Array, number|BigNumber":function(oe,ge){return X(r(oe),{precision:ge})},"Array, Object"(ie,oe){return X(r(ie),oe)},Matrix:function(oe){return X(oe,{matricize:!0})},"Matrix, number|BigNumber":function(oe,ge){return X(oe,{precision:ge,matricize:!0})},"Matrix, Object":function(oe,ge){var ue={matricize:!0};return mr(ue,ge),X(oe,ue)}});function X(ie){var oe,ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ue="eigenvectors"in ge?ge.eigenvectors:!0,ce=(oe=ge.precision)!==null&&oe!==void 0?oe:e.epsilon,me=ee(ie,ce,ue);return ge.matricize&&(me.values=r(me.values),ue&&(me.eigenvectors=me.eigenvectors.map(de=>{var{value:Be,vector:we}=de;return{value:Be,vector:r(we)}}))),ue&&Object.defineProperty(me,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),me}function ee(ie,oe,ge){var ue=ie.toArray(),ce=ie.size();if(ce.length!==2||ce[0]!==ce[1])throw new RangeError("Matrix must be square (size: ".concat(it(ce),")"));var me=ce[0];if(P(ue,me,oe)&&(K(ue,me),W(ue,me,oe))){var de=ve(ie,ue,me);return V(ue,me,oe,de,ge)}var Be=ve(ie,ue,me);return B(ue,me,oe,Be,ge)}function W(ie,oe,ge){for(var ue=0;ue{var{typed:e,abs:t,add:r,identity:i,inv:a,multiply:o}=n;return e(ZB,{Matrix:function(f){var p=f.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+it(p)+")");for(var m=p[0],h=1e-15,d=l(f),g=u(d,h),y=g.q,w=g.j,v=o(f,Math.pow(2,-w)),x=i(m),_=i(m),b=1,D=v,C=-1,A=1;A<=y;A++)A>1&&(D=o(D,v),C=-C),b=b*(y-A+1)/((2*y-A+1)*A),x=r(x,o(b,D)),_=r(_,o(b*C,D));for(var E=o(a(_),x),F=0;F{var{typed:e,abs:t,add:r,multiply:i,map:a,sqrt:o,subtract:l,inv:u,size:s,max:c,identity:f}=n,p=1e3,m=1e-6;function h(d){var g,y=0,w=d,v=f(s(d));do{var x=w;if(w=i(.5,r(x,u(v))),v=i(.5,r(v,u(x))),g=c(t(l(w,x))),g>m&&++y>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>m);return w}return e(JB,{"Array | Matrix":function(g){var y=He(g)?g.size():et(g);switch(y.length){case 1:if(y[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+it(y)+")");case 2:{var w=y[0],v=y[1];if(w===v)return h(g);throw new RangeError("Matrix must be square (size: "+it(y)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+it(y)+")")}}})});var YB="sylvester",vW=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Ux=S(YB,vW,n=>{var{typed:e,schur:t,matrixFromColumns:r,matrix:i,multiply:a,range:o,concat:l,transpose:u,index:s,subset:c,add:f,subtract:p,identity:m,lusolve:h,abs:d}=n;return e(YB,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(w,v,x){return g(i(w),v,x)},"Array, Array, Matrix":function(w,v,x){return g(i(w),i(v),x)},"Array, Matrix, Array":function(w,v,x){return g(i(w),v,i(x))},"Matrix, Array, Matrix":function(w,v,x){return g(w,i(v),x)},"Matrix, Array, Array":function(w,v,x){return g(w,i(v),i(x))},"Matrix, Matrix, Array":function(w,v,x){return g(w,v,i(x))},"Array, Array, Array":function(w,v,x){return g(i(w),i(v),i(x)).toArray()}});function g(y,w,v){for(var x=w.size()[0],_=y.size()[0],b=t(y),D=b.T,C=b.U,A=t(a(-1,w)),E=A.T,F=A.U,I=a(a(u(C),v),F),O=o(0,_),k=[],R=(de,Be)=>l(de,Be,1),T=(de,Be)=>l(de,Be,0),N=0;N1e-5){for(var V=T(c(I,s(O,N)),c(I,s(O,N+1))),B=0;B{var{typed:e,matrix:t,identity:r,multiply:i,qr:a,norm:o,subtract:l}=n;return e(XB,{Array:function(c){var f=u(t(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return u(c)}});function u(s){var c=s.size()[0],f=s,p=r(c),m=0,h;do{h=f;var d=a(f),g=d.Q,y=d.R;if(f=i(y,g),p=i(p,g),m++>100)break}while(o(l(f,h))>1e-4);return{U:p,T:f}}});var QB="lyap",xW=["typed","matrix","sylvester","multiply","transpose"],zx=S(QB,xW,n=>{var{typed:e,matrix:t,sylvester:r,multiply:i,transpose:a}=n;return e(QB,{"Matrix, Matrix":function(l,u){return r(l,a(l),i(-1,u))},"Array, Matrix":function(l,u){return r(t(l),a(t(l)),i(-1,u))},"Matrix, Array":function(l,u){return r(l,a(t(l)),t(i(-1,u)))},"Array, Array":function(l,u){return r(t(l),a(t(l)),t(i(-1,u))).toArray()}})});var bW="divide",wW=["typed","matrix","multiply","equalScalar","divideScalar","inv"],$x=S(bW,wW,n=>{var{typed:e,matrix:t,multiply:r,equalScalar:i,divideScalar:a,inv:o}=n,l=$t({typed:e,equalScalar:i}),u=Mr({typed:e});return e("divide",Df({"Array | Matrix, Array | Matrix":function(c,f){return r(c,o(f))},"DenseMatrix, any":function(c,f){return u(c,f,a,!1)},"SparseMatrix, any":function(c,f){return l(c,f,a,!1)},"Array, any":function(c,f){return u(t(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return r(c,o(f))}},a.signatures))});var KB="distance",_W=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Hx=S(KB,_W,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:l,abs:u}=n;return e(KB,{"Array, Array, Array":function(_,b,D){if(_.length===2&&b.length===2&&D.length===2){if(!c(_))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(b))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(b,D))throw new TypeError("LinePoint1 should not be same with LinePoint2");var C=r(D[1],b[1]),A=r(b[0],D[0]),E=r(i(D[0],b[1]),i(b[0],D[1]));return g(_[0],_[1],C,A,E)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(_,b,D){if(Object.keys(_).length===2&&Object.keys(b).length===2&&Object.keys(D).length===2){if(!c(_))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(b))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(D))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(b),h(D)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in _&&"pointY"in _&&"lineOnePtX"in b&&"lineOnePtY"in b&&"lineTwoPtX"in D&&"lineTwoPtY"in D){var C=r(D.lineTwoPtY,b.lineOnePtY),A=r(b.lineOnePtX,D.lineTwoPtX),E=r(i(D.lineTwoPtX,b.lineOnePtY),i(b.lineOnePtX,D.lineTwoPtY));return g(_.pointX,_.pointY,C,A,E)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(_,b){if(_.length===2&&b.length===3){if(!c(_))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(_[0],_[1],b[0],b[1],b[2])}else if(_.length===3&&b.length===6){if(!f(_))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(b))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(_[0],_[1],_[2],b[0],b[1],b[2],b[3],b[4],b[5])}else if(_.length===b.length&&_.length>0){if(!p(_))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(b))throw new TypeError("All values of an array should be numbers or BigNumbers");return w(_,b)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(_,b){if(Object.keys(_).length===2&&Object.keys(b).length===3){if(!c(_))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(b))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in _&&"pointY"in _&&"xCoeffLine"in b&&"yCoeffLine"in b&&"constant"in b)return g(_.pointX,_.pointY,b.xCoeffLine,b.yCoeffLine,b.constant);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(b).length===6){if(!f(_))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(b))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in _&&"pointY"in _&&"x0"in b&&"y0"in b&&"z0"in b&&"a"in b&&"b"in b&&"c"in b)return y(_.pointX,_.pointY,_.pointZ,b.x0,b.y0,b.z0,b.a,b.b,b.c);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===2&&Object.keys(b).length===2){if(!c(_))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(b))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in _&&"pointOneY"in _&&"pointTwoX"in b&&"pointTwoY"in b)return w([_.pointOneX,_.pointOneY],[b.pointTwoX,b.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(b).length===3){if(!f(_))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(b))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in _&&"pointOneY"in _&&"pointOneZ"in _&&"pointTwoX"in b&&"pointTwoY"in b&&"pointTwoZ"in b)return w([_.pointOneX,_.pointOneY,_.pointOneZ],[b.pointTwoX,b.pointTwoY,b.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(_){if(!d(_))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(_)}});function s(x){return typeof x=="number"||tt(x)}function c(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])}function f(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])&&s(x[2])}function p(x){return Array.isArray(x)||(x=h(x)),x.every(s)}function m(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])&&s(x[2])&&s(x[3])&&s(x[4])&&s(x[5])}function h(x){for(var _=Object.keys(x),b=[],D=0;D<_.length;D++)b.push(x[_[D]]);return b}function d(x){if(x[0].length===2&&s(x[0][0])&&s(x[0][1])){if(x.some(_=>_.length!==2||!s(_[0])||!s(_[1])))return!1}else if(x[0].length===3&&s(x[0][0])&&s(x[0][1])&&s(x[0][2])){if(x.some(_=>_.length!==3||!s(_[0])||!s(_[1])||!s(_[2])))return!1}else return!1;return!0}function g(x,_,b,D,C){var A=u(t(t(i(b,x),i(D,_)),C)),E=l(t(i(b,b),i(D,D)));return a(A,E)}function y(x,_,b,D,C,A,E,F,I){var O=[r(i(r(C,_),I),i(r(A,b),F)),r(i(r(A,b),E),i(r(D,x),I)),r(i(r(D,x),F),i(r(C,_),E))];O=l(t(t(i(O[0],O[0]),i(O[1],O[1])),i(O[2],O[2])));var k=l(t(t(i(E,E),i(F,F)),i(I,I)));return a(O,k)}function w(x,_){for(var b=x.length,D=0,C=0,A=0;A{var{typed:e,config:t,abs:r,add:i,addScalar:a,matrix:o,multiply:l,multiplyScalar:u,divideScalar:s,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=n;return e("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(F,I,O){var k=g(F.valueOf(),I.valueOf(),O.valueOf());return k===null?null:o(k)},"Matrix, Matrix, Matrix, Matrix":function(F,I,O,k){var R=y(F.valueOf(),I.valueOf(),O.valueOf(),k.valueOf());return R===null?null:o(R)}});function g(E,F,I){if(E=w(E),F=w(F),I=w(I),!x(E))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!_(I))throw new TypeError("Array with 4 numbers expected as third argument");return A(E[0],E[1],E[2],F[0],F[1],F[2],I[0],I[1],I[2],I[3])}function y(E,F,I,O){if(E=w(E),F=w(F),I=w(I),O=w(O),E.length===2){if(!v(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(I))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return b(E,F,I,O)}else if(E.length===3){if(!x(E))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(I))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(O))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return C(E[0],E[1],E[2],F[0],F[1],F[2],I[0],I[1],I[2],O[0],O[1],O[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function w(E){return E.length===1?E[0]:E.length>1&&Array.isArray(E[0])&&E.every(F=>Array.isArray(F)&&F.length===1)?m(E):E}function v(E){return E.length===2&&d(E[0])&&d(E[1])}function x(E){return E.length===3&&d(E[0])&&d(E[1])&&d(E[2])}function _(E){return E.length===4&&d(E[0])&&d(E[1])&&d(E[2])&&d(E[3])}function b(E,F,I,O){var k=E,R=I,T=c(k,F),N=c(R,O),V=c(u(T[0],N[1]),u(N[0],T[1]));if(h(V)||f(r(V),t.epsilon))return null;var B=u(N[0],k[1]),X=u(N[1],k[0]),ee=u(N[0],R[1]),W=u(N[1],R[0]),P=s(a(c(c(B,X),ee),W),V);return i(l(T,P),k)}function D(E,F,I,O,k,R,T,N,V,B,X,ee){var W=u(c(E,F),c(I,O)),P=u(c(k,R),c(T,N)),K=u(c(V,B),c(X,ee));return a(a(W,P),K)}function C(E,F,I,O,k,R,T,N,V,B,X,ee){var W=D(E,T,B,T,F,N,X,N,I,V,ee,V),P=D(B,T,O,E,X,N,k,F,ee,V,R,I),K=D(E,T,O,E,F,N,k,F,I,V,R,I),ve=D(B,T,B,T,X,N,X,N,ee,V,ee,V),ie=D(O,E,O,E,k,F,k,F,R,I,R,I),oe=c(u(W,P),u(K,ve)),ge=c(u(ie,ve),u(P,P));if(h(ge))return null;var ue=s(oe,ge),ce=s(a(W,u(ue,P)),ve),me=a(E,u(ue,c(O,E))),de=a(F,u(ue,c(k,F))),Be=a(I,u(ue,c(R,I))),we=a(T,u(ce,c(B,T))),U=a(N,u(ce,c(X,N))),G=a(V,u(ce,c(ee,V)));return p(me,we)&&p(de,U)&&p(Be,G)?[me,de,Be]:null}function A(E,F,I,O,k,R,T,N,V,B){var X=u(E,T),ee=u(O,T),W=u(F,N),P=u(k,N),K=u(I,V),ve=u(R,V),ie=c(c(c(B,X),W),K),oe=c(c(c(a(a(ee,P),ve),X),W),K),ge=s(ie,oe),ue=a(E,u(ge,c(O,E))),ce=a(F,u(ge,c(k,F))),me=a(I,u(ge,c(R,I)));return[ue,ce,me]}});var eO="sum",EW=["typed","config","add","numeric"],pl=S(eO,EW,n=>{var{typed:e,config:t,add:r,numeric:i}=n;return e(eO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(u){if(mi(u))throw new TypeError("Scalar values expected in function sum");return a(u)}});function a(l){var u;return hn(l,function(s){try{u=u===void 0?s:r(u,s)}catch(c){throw wr(c,"sum",s)}}),u===void 0&&(u=i(0,t.number)),typeof u=="string"&&(u=i(u,t.number)),u}function o(l,u){try{var s=Ja(l,u,r);return s}catch(c){throw wr(c,"sum")}}});var Tp="cumsum",CW=["typed","add","unaryPlus"],ml=S(Tp,CW,n=>{var{typed:e,add:t,unaryPlus:r}=n;return e(Tp,{Array:i,Matrix:function(s){return s.create(i(s.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(s,c){return s.create(o(s.valueOf(),c))},"...":function(s){if(mi(s))throw new TypeError("All values expected to be scalar in function cumsum");return i(s)}});function i(u){try{return a(u)}catch(s){throw wr(s,Tp)}}function a(u){if(u.length===0)return[];for(var s=[r(u[0])],c=1;c=c.length)throw new on(s,c.length);try{return l(u,s)}catch(f){throw wr(f,Tp)}}function l(u,s){var c,f,p;if(s<=0){var m=u[0][0];if(Array.isArray(m)){for(p=Hf(u),f=[],c=0;c{var{typed:e,add:t,divide:r}=n;return e(tO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(l){if(mi(l))throw new TypeError("Scalar values expected in function mean");return a(l)}});function i(o,l){try{var u=Ja(o,l,t),s=Array.isArray(o)?et(o):o.size();return r(u,s[l])}catch(c){throw wr(c,"mean")}}function a(o){var l,u=0;if(hn(o,function(s){try{l=l===void 0?s:t(l,s),u++}catch(c){throw wr(c,"mean",s)}}),u===0)throw new Error("Cannot calculate the mean of an empty array");return r(l,u)}});var rO="median",NW=["typed","add","divide","compare","partitionSelect"],Wx=S(rO,NW,n=>{var{typed:e,add:t,divide:r,compare:i,partitionSelect:a}=n;function o(s){try{s=pt(s.valueOf());var c=s.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,p=a(s,f+1),m=s[f],h=0;h0&&(m=s[h]);return u(m,p)}else{var d=a(s,(c-1)/2);return l(d)}}catch(g){throw wr(g,"median")}}var l=e({"number | BigNumber | Complex | Unit":function(c){return c}}),u=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return r(t(c,f),2)}});return e(rO,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(mi(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var nO="mad",MW=["typed","abs","map","median","subtract"],jx=S(nO,MW,n=>{var{typed:e,abs:t,map:r,median:i,subtract:a}=n;return e(nO,{"Array | Matrix":o,"...":function(u){return o(u)}});function o(l){if(l=pt(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var u=i(l);return i(r(l,function(s){return t(a(s,u))}))}catch(s){throw s instanceof TypeError&&s.message.indexOf("median")!==-1?new TypeError(s.message.replace("median","mad")):wr(s,"mad")}}});var Zx="unbiased",iO="variance",TW=["typed","add","subtract","multiply","divide","apply","isNaN"],hl=S(iO,TW,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:l}=n;return e(iO,{"Array | Matrix":function(f){return u(f,Zx)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(f,p){return s(f,p,Zx)},"Array | Matrix, number | BigNumber, string":s,"...":function(f){return u(f,Zx)}});function u(c,f){var p,m=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(hn(c,function(g){try{p=p===void 0?g:t(p,g),m++}catch(y){throw wr(y,"variance",g)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var h=a(p,m);if(p=void 0,hn(c,function(g){var y=r(g,h);p=p===void 0?i(y,y):t(p,i(y,y))}),l(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var d=tt(p)?p.mul(0):0;return m===1?d:a(p,m-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function s(c,f,p){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,m=>u(m,p))}catch(m){throw wr(m,"variance")}}});var aO="quantileSeq",FW=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],gl=S(aO,FW,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=n,m=Ho({typed:e,isInteger:s});return e(aO,{"Array | Matrix, number | BigNumber":(w,v)=>d(w,v,!1),"Array | Matrix, number | BigNumber, number":(w,v,x)=>h(w,v,!1,x,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(w,v,x,_)=>h(w,v,x,_,d),"Array | Matrix, Array | Matrix":(w,v)=>g(w,v,!1),"Array | Matrix, Array | Matrix, number":(w,v,x)=>h(w,v,!1,x,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(w,v,x,_)=>h(w,v,x,_,g)});function h(w,v,x,_,b){return m(w,_,D=>b(D,v,x))}function d(w,v,x){var _,b=w.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return nt(v)?y(b,v,x):t(y(b,v,x));if(p(v,1)){if(!s(v))throw new Error("N must be a positive integer");if(p(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var D=r(v,1);_=[];for(var C=0;c(C,v);C++){var A=a(C+1,D);_.push(y(b,A,x))}return nt(v)?_:t(_)}}function g(w,v,x){for(var _=w.valueOf(),b=v.valueOf(),D=[],C=0;C0&&(E=_[I])}return r(o(E,i(1,A)),o(F,A))}});var oO="std",IW=["typed","map","sqrt","variance"],vl=S(oO,IW,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n;return e(oO,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(l){return a(l)}});function a(o,l){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var u=i.apply(null,arguments);return Sn(u)?t(u,r):r(u)}catch(s){throw s instanceof TypeError&&s.message.indexOf(" variance")!==-1?new TypeError(s.message.replace(" variance"," std")):s}}});var sO="corr",BW=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Jx=S(sO,BW,n=>{var{typed:e,matrix:t,sqrt:r,sum:i,add:a,subtract:o,multiply:l,pow:u,divide:s}=n;return e(sO,{"Array, Array":function(m,h){return c(m,h)},"Matrix, Matrix":function(m,h){var d=c(m.toArray(),h.toArray());return Array.isArray(d)?t(d):d}});function c(p,m){var h=[];if(Array.isArray(p[0])&&Array.isArray(m[0])){if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var d=0;da(b,l(D,m[C])),0),w=i(p.map(b=>u(b,2))),v=i(m.map(b=>u(b,2))),x=o(l(h,y),l(d,g)),_=r(l(o(l(h,w),u(d,2)),o(l(h,v),u(g,2))));return s(x,_)}});var uO="combinations",OW=["typed"],Yx=S(uO,OW,n=>{var{typed:e}=n;return e(uO,{"number, number":lg,"BigNumber, BigNumber":function(r,i){var a=r.constructor,o,l,u=r.minus(i),s=new a(1);if(!lO(r)||!lO(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(r))throw new TypeError("k must be less than n in function combinations");if(o=s,i.lt(u))for(l=s;l.lte(u);l=l.plus(s))o=o.times(i.plus(l)).dividedBy(l);else for(l=s;l.lte(i);l=l.plus(s))o=o.times(u.plus(l)).dividedBy(l);return o}})});function lO(n){return n.isInteger()&&n.gte(0)}var cO="combinationsWithRep",PW=["typed"],Xx=S(cO,PW,n=>{var{typed:e}=n;return e(cO,{"number, number":function(r,i){if(!ze(r)||r<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ze(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(r<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i{var{typed:e,config:t,multiplyScalar:r,pow:i,BigNumber:a,Complex:o}=n;function l(s){if(s.im===0)return Ju(s.re);if(s.re<.5){var c=new o(1-s.re,-s.im),f=new o(Math.PI*s.re,Math.PI*s.im);return new o(Math.PI).div(f.sin()).div(l(c))}s=new o(s.re-1,s.im);for(var p=new o($o[0],0),m=1;m<$o.length;++m){var h=new o($o[m],0);p=p.add(h.div(s.add(m)))}var d=new o(s.re+hg+.5,s.im),g=Math.sqrt(2*Math.PI),y=d.pow(s.add(.5)),w=d.neg().exp();return p.mul(g).mul(y).mul(w)}return e(pO,{number:Ju,Complex:l,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):u(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function u(s){if(s<8)return new a([1,1,2,6,24,120,720,5040][s]);var c=t.precision+(Math.log(s.toNumber())|0),f=a.clone({precision:c});if(s%2===1)return s.times(u(new a(s-1)));for(var p=s,m=new f(s),h=s.toNumber();p>2;)p-=2,h+=p,m=m.times(h);return new a(m.toPrecision(a.precision))}});var mO="lgamma",kW=["Complex","typed"],Kx=S(mO,kW,n=>{var{Complex:e,typed:t}=n,r=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(mO,{number:Yu,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(s){var c=6.283185307179586,f=1.1447298858494002,p=.1;if(s.isNaN())return new e(NaN,NaN);if(s.im===0)return new e(Yu(s.re),0);if(s.re>=r||Math.abs(s.im)>=i)return l(s);if(s.re<=p){var m=WE(c,s.im)*Math.floor(.5*s.re+.25),h=s.mul(Math.PI).sin().log(),d=o(new e(1-s.re,-s.im));return new e(f,m).sub(h).sub(d)}else return s.im>=0?u(s):u(s.conjugate()).conjugate()}function l(s){for(var c=s.sub(.5).mul(s.log()).sub(s).add(gg),f=new e(1,0).div(s),p=f.div(s),m=a[0],h=a[1],d=2*p.re,g=p.re*p.re+p.im*p.im,y=2;y<8;y++){var w=h;h=-g*m+a[y],m=d*m+w}var v=f.mul(p.mul(m).add(h));return c.add(v)}function u(s){var c=0,f=0,p=s;for(s=s.add(1);s.re<=r;){p=p.mul(s);var m=p.im<0?1:0;m!==0&&f===0&&c++,f=m,s=s.add(1)}return l(s).sub(p.log()).sub(new e(0,c*2*Math.PI*1))}});var dO="factorial",LW=["typed","gamma"],eb=S(dO,LW,n=>{var{typed:e,gamma:t}=n;return e(dO,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return t(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return t(i.plus(1))},"Array | Matrix":e.referToSelf(r=>i=>Ze(i,r))})});var hO="kldivergence",VW=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],tb=S(hO,VW,n=>{var{typed:e,matrix:t,divide:r,sum:i,multiply:a,map:o,dotDivide:l,log:u,isNumeric:s}=n;return e(hO,{"Array, Array":function(p,m){return c(t(p),t(m))},"Matrix, Array":function(p,m){return c(p,t(m))},"Array, Matrix":function(p,m){return c(t(p),m)},"Matrix, Matrix":function(p,m){return c(p,m)}});function c(f,p){var m=p.size().length,h=f.size().length;if(m>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(m!==h)throw new Error("Length of two vectors must be equal");var d=i(f);if(d===0)throw new Error("Sum of elements in first object must be non zero");var g=i(p);if(g===0)throw new Error("Sum of elements in second object must be non zero");var y=r(f,i(f)),w=r(p,i(p)),v=i(a(y,o(l(y,w),x=>u(x))));return s(v)?v:Number.NaN}});var gO="multinomial",UW=["typed","add","divide","multiply","factorial","isInteger","isPositive"],rb=S(gO,UW,n=>{var{typed:e,add:t,divide:r,multiply:i,factorial:a,isInteger:o,isPositive:l}=n;return e(gO,{"Array | Matrix":function(s){var c=0,f=1;return hn(s,function(p){if(!o(p)||!l(p))throw new TypeError("Positive integer value expected in function multinomial");c=t(c,p),f=i(f,a(p))}),r(a(c),f)}})});var vO="permutations",qW=["typed","factorial"],nb=S(vO,qW,n=>{var{typed:e,factorial:t}=n;return e(vO,{"number | BigNumber":t,"number, number":function(i,a){if(!ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return ei(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,l;if(!yO(i)||!yO(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var u=i.mul(0).add(1);for(o=u,l=i.minus(a).plus(1);l.lte(i);l=l.plus(1))o=o.times(l);return o}})});function yO(n){return n.isInteger()&&n.gte(0)}var cb=gr(OO(),1),ZW=(0,cb.default)(Date.now());function xa(n){var e;function t(i){e=i===null?ZW:(0,cb.default)(String(i))}t(n);function r(){return e()}return r}var PO="pickRandom",JW=["typed","config","?on"],fb=S(PO,JW,n=>{var{typed:e,config:t,on:r}=n,i=xa(t.randomSeed);return r&&r("config",function(o,l){o.randomSeed!==l.randomSeed&&(i=xa(o.randomSeed))}),e(PO,{"Array | Matrix":function(l){return a(l,{})},"Array | Matrix, Object":function(l,u){return a(l,u)},"Array | Matrix, number":function(l,u){return a(l,{number:u})},"Array | Matrix, Array | Matrix":function(l,u){return a(l,{weights:u})},"Array | Matrix, Array | Matrix, number":function(l,u,s){return a(l,{number:s,weights:u})},"Array | Matrix, number, Array | Matrix":function(l,u,s){return a(l,{number:u,weights:s})}});function a(o,l){var{number:u,weights:s,elementWise:c=!0}=l,f=typeof u=="undefined";f&&(u=1);var p=He(o)?o.create:He(s)?s.create:null;o=o.valueOf(),s&&(s=s.valueOf()),c===!0&&(o=pt(o),s=pt(s));var m=0;if(typeof s!="undefined"){if(s.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,d=s.length;h1)for(var r=0,i=n.shift();r{var{typed:e,config:t,on:r}=n,i=xa(t.randomSeed);return r&&r("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=xa(l.randomSeed))}),e(RO,{"":()=>o(0,1),number:l=>o(0,l),"number, number":(l,u)=>o(l,u),"Array | Matrix":l=>a(l,0,1),"Array | Matrix, number":(l,u)=>a(l,0,u),"Array | Matrix, number, number":(l,u,s)=>a(l,u,s)});function a(l,u,s){var c=yl(l.valueOf(),()=>o(u,s));return He(l)?l.create(c):c}function o(l,u){return l+i()*(u-l)}});var kO="randomInt",XW=["typed","config","?on"],mb=S(kO,XW,n=>{var{typed:e,config:t,on:r}=n,i=xa(t.randomSeed);return r&&r("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=xa(l.randomSeed))}),e(kO,{"":()=>o(0,1),number:l=>o(0,l),"number, number":(l,u)=>o(l,u),"Array | Matrix":l=>a(l,0,1),"Array | Matrix, number":(l,u)=>a(l,0,u),"Array | Matrix, number, number":(l,u,s)=>a(l,u,s)});function a(l,u,s){var c=yl(l.valueOf(),()=>o(u,s));return He(l)?l.create(c):c}function o(l,u){return Math.floor(l+i()*(u-l))}});var LO="stirlingS2",QW=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],db=S(LO,QW,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,pow:o,factorial:l,combinations:u,isNegative:s,isInteger:c,number:f,bignumber:p,larger:m}=n,h=[],d=[];return e(LO,{"number | BigNumber, number | BigNumber":function(y,w){if(!c(y)||s(y)||!c(w)||s(w))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(w,y))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(nt(y)&&nt(w)),x=v?d:h,_=v?p:f,b=f(y),D=f(w);if(x[b]&&x[b].length>D)return x[b][D];for(var C=0;C<=b;++C)if(x[C]||(x[C]=[_(C===0?1:0)]),C!==0)for(var A=x[C],E=x[C-1],F=A.length;F<=C&&F<=D;++F)F===C?A[F]=1:A[F]=t(i(_(F),E[F]),E[F-1]);return x[b][D]}})});var VO="bellNumbers",KW=["typed","addScalar","isNegative","isInteger","stirlingS2"],hb=S(VO,KW,n=>{var{typed:e,addScalar:t,isNegative:r,isInteger:i,stirlingS2:a}=n;return e(VO,{"number | BigNumber":function(l){if(!i(l)||r(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var u=0,s=0;s<=l;s++)u=t(u,a(l,s));return u}})});var UO="catalan",ej=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],gb=S(UO,ej,n=>{var{typed:e,addScalar:t,divideScalar:r,multiplyScalar:i,combinations:a,isNegative:o,isInteger:l}=n;return e(UO,{"number | BigNumber":function(s){if(!l(s)||o(s))throw new TypeError("Non-negative integer value expected in function catalan");return r(a(i(s,2),s),t(s,1))}})});var qO="composition",tj=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],vb=S(qO,tj,n=>{var{typed:e,addScalar:t,combinations:r,isPositive:i,isNegative:a,isInteger:o,larger:l}=n;return e(qO,{"number | BigNumber, number | BigNumber":function(s,c){if(!o(s)||!i(s)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(l(c,s))throw new TypeError("k must be less than or equal to n in function composition");return r(t(s,-1),t(c,-1))}})});var zO="leafCount",rj=["parse","typed"],yb=S(zO,rj,n=>{var{parse:e,typed:t}=n;function r(i){var a=0;return i.forEach(o=>{a+=r(o)}),a||1}return t(zO,{Node:function(a){return r(a)}})});function xb(n){return bt(n)||cr(n)&&n.isUnary()&&bt(n.args[0])}function xl(n){return!!(bt(n)||(Nn(n)||cr(n))&&n.args.every(xl)||an(n)&&xl(n.content))}function $O(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bb(n){for(var e=1;e{var{FunctionNode:e,OperatorNode:t,SymbolNode:r}=n,i=!0,a=!1,o="defaultF",l={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},u={divide:{total:a},log:{total:a}},s={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(v,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,b=o;if(typeof v=="string"?b=v:cr(v)?b=v.fn.toString():Nn(v)?b=v.name:an(v)&&(b="paren"),je(_,b)){var D=_[b];if(je(D,x))return D[x];if(je(l,b))return l[b][x]}if(je(_,o)){var C=_[o];return je(C,x)?C[x]:l[o][x]}if(je(l,b)){var A=l[b];if(je(A,x))return A[x]}return l[o][x]}function f(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(v,"commutative",x)}function p(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(v,"associative",x)}function m(v,x){var _=bb({},v);for(var b in x)je(v,b)?_[b]=bb(bb({},x[b]),v[b]):_[b]=x[b];return _}function h(v,x){if(!v.args||v.args.length===0)return v;v.args=d(v,x);for(var _=0;_2&&p(v,x)){for(var C=v.args.pop();v.args.length>0;)C=_([v.args.pop(),C]);v.args=C.args}}}function y(v,x){if(!(!v.args||v.args.length===0)){for(var _=w(v),b=v.args.length,D=0;D2&&p(v,x)){for(var C=v.args.shift();v.args.length>0;)C=_([C,v.args.shift()]);v.args=C.args}}}function w(v){return cr(v)?function(x){try{return new t(v.op,v.fn,x,v.implicit)}catch(_){return console.error(_),[]}}:function(x){return new e(new r(v.name),x)}}return{createMakeNodeFunction:w,hasProperty:c,isCommutative:f,isAssociative:p,mergeContext:m,flatten:h,allChildren:d,unflattenr:g,unflattenl:y,defaultContext:l,realContext:u,positiveContext:s}});var aj="simplify",oj=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],wb=S(aj,oj,n=>{var{config:e,typed:t,parse:r,add:i,subtract:a,multiply:o,divide:l,pow:u,isZero:s,equal:c,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:w,ArrayNode:v,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:D,OperatorNode:C,ParenthesisNode:A,SymbolNode:E}=n,{hasProperty:F,isCommutative:I,isAssociative:O,mergeContext:k,flatten:R,unflattenr:T,unflattenl:N,createMakeNodeFunction:V,defaultContext:B,realContext:X,positiveContext:ee}=Xs({FunctionNode:_,OperatorNode:C,SymbolNode:E});t.addConversion({from:"Object",to:"Map",convert:da});var W=t("simplify",{Node:ue,"Node, Map":($,Q)=>ue($,!1,Q),"Node, Map, Object":($,Q,re)=>ue($,!1,Q,re),"Node, Array":ue,"Node, Array, Map":ue,"Node, Array, Map, Object":ue});t.removeConversion({from:"Object",to:"Map",convert:da}),W.defaultContext=B,W.realContext=X,W.positiveContext=ee;function P($){return $.transform(function(Q,re,he){return an(Q)?P(Q.content):Q})}var K={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};W.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function ve($,Q){var re={};if($.s){var he=$.s.split("->");if(he.length===2)re.l=he[0],re.r=he[1];else throw SyntaxError("Could not parse rule: "+$.s)}else re.l=$.l,re.r=$.r;re.l=P(r(re.l)),re.r=P(r(re.r));for(var ye of["imposeContext","repeat","assuming"])ye in $&&(re[ye]=$[ye]);if($.evaluate&&(re.evaluate=r($.evaluate)),O(re.l,Q)){var Le=!I(re.l,Q),Ae;Le&&(Ae=ge());var ct=V(re.l),xt=ge();re.expanded={},re.expanded.l=ct([re.l,xt]),R(re.expanded.l,Q),T(re.expanded.l,Q),re.expanded.r=ct([re.r,xt]),Le&&(re.expandedNC1={},re.expandedNC1.l=ct([Ae,re.l]),re.expandedNC1.r=ct([Ae,re.r]),re.expandedNC2={},re.expandedNC2.l=ct([Ae,re.expanded.l]),re.expandedNC2.r=ct([Ae,re.expanded.r]))}return re}function ie($,Q){for(var re=[],he=0;he<$.length;he++){var ye=$[he],Le=void 0,Ae=typeof ye;switch(Ae){case"string":ye={s:ye};case"object":Le=ve(ye,Q);break;case"function":Le=ye;break;default:throw TypeError("Unsupported type of rule: "+Ae)}re.push(Le)}return re}var oe=0;function ge(){return new E("_p"+oe++)}function ue($,Q){var re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$i(),he=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},ye=he.consoleDebug;Q=ie(Q||W.rules,he.context);var Le=f($,re);Le=P(Le);for(var Ae={},ct=Le.toString({parenthesis:"all"});!Ae[ct];){Ae[ct]=!0,oe=0;var xt=ct;ye&&console.log("Working on: ",ct);for(var Vt=0;Vt ").concat(Q[Vt].r.toString()))),ye){var H=Le.toString({parenthesis:"all"});H!==xt&&(console.log("Applying",Xt,"produced",H),xt=H)}N(Le,he.context)}ct=Le.toString({parenthesis:"all"})}return Le}function ce($,Q,re){var he=$;if($)for(var ye=0;ye<$.length;++ye){var Le=me($[ye],Q,re);Le!==$[ye]&&(he===$&&(he=$.slice()),he[ye]=Le)}return he}function me($,Q,re){if(Q.assuming){for(var he in Q.assuming)for(var ye in Q.assuming[he])if(F(he,ye,re)!==Q.assuming[he][ye])return $}var Le=k(Q.imposeContext,re),Ae=$;if(Ae instanceof C||Ae instanceof _){var ct=ce(Ae.args,Q,re);ct!==Ae.args&&(Ae=Ae.clone(),Ae.args=ct)}else if(Ae instanceof A){if(Ae.content){var xt=me(Ae.content,Q,re);xt!==Ae.content&&(Ae=new A(xt))}}else if(Ae instanceof v){var Vt=ce(Ae.items,Q,re);Vt!==Ae.items&&(Ae=new v(Vt))}else if(Ae instanceof w){var Xt=Ae.object;Ae.object&&(Xt=me(Ae.object,Q,re));var H=Ae.index;Ae.index&&(H=me(Ae.index,Q,re)),(Xt!==Ae.object||H!==Ae.index)&&(Ae=new w(Xt,H))}else if(Ae instanceof b){var ne=ce(Ae.dimensions,Q,re);ne!==Ae.dimensions&&(Ae=new b(ne))}else if(Ae instanceof D){var pe=!1,_e={};for(var Ne in Ae.properties)_e[Ne]=me(Ae.properties[Ne],Q,re),_e[Ne]!==Ae.properties[Ne]&&(pe=!0);pe&&(Ae=new D(_e))}var De=Q.r,Ce=G(Q.l,Ae,Le)[0];if(!Ce&&Q.expanded&&(De=Q.expanded.r,Ce=G(Q.expanded.l,Ae,Le)[0]),!Ce&&Q.expandedNC1&&(De=Q.expandedNC1.r,Ce=G(Q.expandedNC1.l,Ae,Le)[0],Ce||(De=Q.expandedNC2.r,Ce=G(Q.expandedNC2.l,Ae,Le)[0])),Ce){var Oe=Ae.implicit;Ae=De.clone(),Oe&&"implicit"in De&&(Ae.implicit=!0),Ae=Ae.transform(function(M){return M.isSymbolNode&&je(Ce.placeholders,M.name)?Ce.placeholders[M.name].clone():M})}return Q.repeat&&Ae!==$&&(Ae=me(Ae,Q,re)),Ae}function de($,Q){var re=[],he,ye,Le=V($);if(I($,Q))for(var Ae=0;Ae<$.args.length;Ae++)ye=$.args.slice(0),ye.splice(Ae,1),he=ye.length===1?ye[0]:Le(ye),re.push(Le([$.args[Ae],he]));else for(var ct=1;ct<$.args.length;ct++){var xt=$.args[0];ct>1&&(xt=Le($.args.slice(0,ct))),ye=$.args.slice(ct),he=ye.length===1?ye[0]:Le(ye),re.push(Le([xt,he]))}return re}function Be($,Q){var re={placeholders:{}};if(!$.placeholders&&!Q.placeholders)return re;if($.placeholders){if(!Q.placeholders)return $}else return Q;for(var he in $.placeholders)if(je($.placeholders,he)&&(re.placeholders[he]=$.placeholders[he],je(Q.placeholders,he)&&!le($.placeholders[he],Q.placeholders[he])))return null;for(var ye in Q.placeholders)je(Q.placeholders,ye)&&(re.placeholders[ye]=Q.placeholders[ye]);return re}function we($,Q){var re=[];if($.length===0||Q.length===0)return re;for(var he,ye=0;ye<$.length;ye++)for(var Le=0;Le2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var xt=G($.args[0],Q.args[1],re);if(xt.length===0)return[];var Vt=G($.args[1],Q.args[0],re);if(Vt.length===0)return[];Le=[xt,Vt]}ye=U(Le)}else if(Q.args.length>=2&&$.args.length===2){for(var Xt=de(Q,re),H=[],ne=0;ne2)throw Error("Unexpected non-binary associative function: "+$.toString());return[]}}else if($ instanceof E){if($.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(K[$.name]){if($.name!==Q.name)return[]}else switch($.name[1]>="a"&&$.name[1]<="z"?$.name.substring(0,2):$.name[0]){case"n":case"_p":ye[0].placeholders[$.name]=Q;break;case"c":case"cl":if(bt(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"v":if(!bt(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"vl":if(Qt(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"cd":if(xb(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"vd":if(!xb(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"ce":if(xl(Q))ye[0].placeholders[$.name]=Q;else return[];break;case"ve":if(!xl(Q))ye[0].placeholders[$.name]=Q;else return[];break;default:throw new Error("Invalid symbol in rule: "+$.name)}}else if($ instanceof x){if(!c($.value,Q.value))return[]}else return[];return ye}function le($,Q){if($ instanceof x&&Q instanceof x){if(!c($.value,Q.value))return!1}else if($ instanceof E&&Q instanceof E){if($.name!==Q.name)return!1}else if($ instanceof C&&Q instanceof C||$ instanceof _&&Q instanceof _){if($ instanceof C){if($.op!==Q.op||$.fn!==Q.fn)return!1}else if($ instanceof _&&$.name!==Q.name)return!1;if($.args.length!==Q.args.length)return!1;for(var re=0;re<$.args.length;re++)if(!le($.args[re],Q.args[re]))return!1}else return!1;return!0}return W});var sj="simplifyConstant",uj=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],_b=S(sj,uj,n=>{var{typed:e,config:t,mathWithTransform:r,matrix:i,fraction:a,bignumber:o,AccessorNode:l,ArrayNode:u,ConstantNode:s,FunctionNode:c,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=n,{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:w}=Xs({FunctionNode:c,OperatorNode:m,SymbolNode:h}),v=e("simplifyConstant",{Node:R=>D(k(R,{})),"Node, Object":function(T,N){return D(k(T,N))}});function x(R){return pa(R)?R.valueOf():R instanceof Array?R.map(x):He(R)?i(x(R.valueOf())):R}function _(R,T,N){try{return r[R].apply(null,T)}catch(V){return T=T.map(x),A(r[R].apply(null,T),N)}}var b=e({Fraction:F,number:function(T){return T<0?E(new s(-T)):new s(T)},BigNumber:function(T){return T<0?E(new s(-T)):new s(T)},Complex:function(T){throw new Error("Cannot convert Complex number to Node")},string:function(T){return new s(T)},Matrix:function(T){return new u(T.valueOf().map(N=>b(N)))}});function D(R){return At(R)?R:b(R)}function C(R,T){var N=T&&T.exactFractions!==!1;if(N&&isFinite(R)&&a){var V=a(R),B=T&&typeof T.fractionsLimit=="number"?T.fractionsLimit:1/0;if(V.valueOf()===R&&V.n0;)if(bt(V[0])&&typeof V[0].value!="string"){var B=A(V.shift().value,N);nn(R)?R=R.items[B-1]:(R=R.valueOf()[B-1],R instanceof Array&&(R=i(R)))}else if(V.length>1&&bt(V[1])&&typeof V[1].value!="string"){var X=A(V[1].value,N),ee=[],W=nn(R)?R.items:R.valueOf();for(var P of W)if(nn(P))ee.push(P.items[X-1]);else if(He(R))ee.push(P[X-1]);else break;if(ee.length===W.length)nn(R)?R=new u(ee):R=i(ee),V.splice(1,1);else break}else break;return V.length===T.dimensions.length?new l(D(R),T):V.length>0?(T=new f(V),new l(D(R),T)):R}if(za(R)&&T.dimensions.length===1&&bt(T.dimensions[0])){var K=T.dimensions[0].value;return K in R.properties?R.properties[K]:new s}return new l(D(R),T)}function O(R,T,N,V){var B=T.shift(),X=T.reduce((ee,W)=>{if(!At(W)){var P=ee.pop();if(At(P))return[P,W];try{return ee.push(_(R,[P,W],V)),ee}catch(ve){ee.push(P)}}ee.push(D(ee.pop()));var K=ee.length===1?ee[0]:N(ee);return[N([K,D(W)])]},[B]);return X.length===1?X[0]:N([X[0],b(X[1])])}function k(R,T){switch(R.type){case"SymbolNode":return R;case"ConstantNode":switch(typeof R.value){case"number":return A(R.value,T);case"string":return R.value;default:if(!isNaN(R.value))return A(R.value,T)}return R;case"FunctionNode":if(r[R.name]&&r[R.name].rawArgs)return R;{var N=["add","multiply"];if(N.indexOf(R.name)===-1){var V=R.args.map(me=>k(me,T));if(!V.some(At))try{return _(R.name,V,T)}catch(me){}if(R.name==="size"&&V.length===1&&nn(V[0])){for(var B=[],X=V[0];nn(X);)B.push(X.items.length),X=X.items[0];return i(B)}return new c(R.name,V.map(D))}}case"OperatorNode":{var ee=R.fn.toString(),W,P,K=w(R);if(cr(R)&&R.isUnary())W=[k(R.args[0],T)],At(W[0])?P=K(W):P=_(ee,W,T);else if(g(R,T.context))if(W=y(R,T.context),W=W.map(me=>k(me,T)),d(ee,T.context)){for(var ve=[],ie=[],oe=0;oe1?(P=O(ee,ve,K,T),ie.unshift(P),P=O(ee,ie,K,T)):P=O(ee,W,K,T)}else P=O(ee,W,K,T);else W=R.args.map(me=>k(me,T)),P=O(ee,W,K,T);return P}case"ParenthesisNode":return k(R.content,T);case"AccessorNode":return I(k(R.object,T),k(R.index,T),T);case"ArrayNode":{var ge=R.items.map(me=>k(me,T));return ge.some(At)?new u(ge.map(D)):i(ge)}case"IndexNode":return new f(R.dimensions.map(me=>v(me,T)));case"ObjectNode":{var ue={};for(var ce in R.properties)ue[ce]=v(R.properties[ce],T);return new p(ue)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(R.type))}}return v});var HO="simplifyCore",lj=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Ab=S(HO,lj,n=>{var{typed:e,parse:t,equal:r,isZero:i,add:a,subtract:o,multiply:l,divide:u,pow:s,AccessorNode:c,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:w}=n,v=new p(0),x=new p(1),_=new p(!0),b=new p(!1);function D(F){return cr(F)&&["and","not","or"].includes(F.op)}var{hasProperty:C,isCommutative:A}=Xs({FunctionNode:m,OperatorNode:g,SymbolNode:w});function E(F){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O=I?I.context:void 0;if(C(F,"trivial",O)){if(Nn(F)&&F.args.length===1)return E(F.args[0],I);var k=!1,R=0;if(F.forEach(ie=>{++R,R===1&&(k=E(ie,I))}),R===1)return k}var T=F;if(Nn(T)){var N=zM(T.name);if(N){if(T.args.length>2&&C(T,"associative",O))for(;T.args.length>2;){var V=T.args.pop(),B=T.args.pop();T.args.push(new g(N,T.name,[V,B]))}T=new g(N,T.name,T.args)}else return new m(E(T.fn),T.args.map(ie=>E(ie,I)))}if(cr(T)&&T.isUnary()){var X=E(T.args[0],I);if(T.op==="~"&&cr(X)&&X.isUnary()&&X.op==="~"||T.op==="not"&&cr(X)&&X.isUnary()&&X.op==="not"&&D(X.args[0]))return X.args[0];var ee=!0;if(T.op==="-"&&cr(X)&&(X.isBinary()&&X.fn==="subtract"&&(T=new g("-","subtract",[X.args[1],X.args[0]]),ee=!1),X.isUnary()&&X.op==="-"))return X.args[0];if(ee)return new g(T.op,T.fn,[X])}if(cr(T)&&T.isBinary()){var W=E(T.args[0],I),P=E(T.args[1],I);if(T.op==="+"){if(bt(W)&&i(W.value))return P;if(bt(P)&&i(P.value))return W;cr(P)&&P.isUnary()&&P.op==="-"&&(P=P.args[0],T=new g("-","subtract",[W,P]))}if(T.op==="-")return cr(P)&&P.isUnary()&&P.op==="-"?E(new g("+","add",[W,P.args[0]]),I):bt(W)&&i(W.value)?E(new g("-","unaryMinus",[P])):bt(P)&&i(P.value)?W:new g(T.op,T.fn,[W,P]);if(T.op==="*"){if(bt(W)){if(i(W.value))return v;if(r(W.value,1))return P}if(bt(P)){if(i(P.value))return v;if(r(P.value,1))return W;if(A(T,O))return new g(T.op,T.fn,[P,W],T.implicit)}return new g(T.op,T.fn,[W,P],T.implicit)}if(T.op==="/")return bt(W)&&i(W.value)?v:bt(P)&&r(P.value,1)?W:new g(T.op,T.fn,[W,P]);if(T.op==="^"&&bt(P)){if(i(P.value))return x;if(r(P.value,1))return W}if(T.op==="and"){if(bt(W))if(W.value){if(D(P))return P}else return b;if(bt(P))if(P.value){if(D(W))return W}else return b}if(T.op==="or"){if(bt(W)){if(W.value)return _;if(D(P))return P}if(bt(P)){if(P.value)return _;if(D(W))return W}}return new g(T.op,T.fn,[W,P])}if(cr(T))return new g(T.op,T.fn,T.args.map(ie=>E(ie,I)));if(nn(T))return new f(T.items.map(ie=>E(ie,I)));if(Kn(T))return new c(E(T.object,I),E(T.index,I));if(fi(T))return new h(T.dimensions.map(ie=>E(ie,I)));if(za(T)){var K={};for(var ve in T.properties)K[ve]=E(T.properties[ve],I);return new d(K)}return T}return e(HO,{Node:E,"Node,Object":E})});var cj="resolve",fj=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],Db=S(cj,fj,n=>{var{typed:e,parse:t,ConstantNode:r,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=n;function l(u,s){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!s)return u;if(Qt(u)){if(c.has(u.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var p=s.get(u.name);if(At(p)){var m=new Set(c);return m.add(u.name),l(p,s,m)}else return typeof p=="number"?t(String(p)):p!==void 0?new r(p):u}else if(cr(u)){var h=u.args.map(function(g){return l(g,s,c)});return new a(u.op,u.fn,h,u.implicit)}else{if(an(u))return new o(l(u.content,s,c));if(Nn(u)){var d=u.args.map(function(g){return l(g,s,c)});return new i(u.name,d)}}return u.map(g=>l(g,s,c))}return e("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(u,s)=>l(u,da(s)),"Array | Matrix":e.referToSelf(u=>s=>s.map(c=>u(c))),"Array | Matrix, null | undefined":e.referToSelf(u=>s=>s.map(c=>u(c))),"Array, Object":e.referTo("Array,Map",u=>(s,c)=>u(s,da(c))),"Matrix, Object":e.referTo("Matrix,Map",u=>(s,c)=>u(s,da(c))),"Array | Matrix, Map":e.referToSelf(u=>(s,c)=>s.map(f=>u(f,c)))})});var GO="symbolicEqual",pj=["parse","simplify","typed","OperatorNode"],Eb=S(GO,pj,n=>{var{parse:e,simplify:t,typed:r,OperatorNode:i}=n;function a(o,l){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=new i("-","subtract",[o,l]),c=t(s,{},u);return bt(c)&&!c.value}return r(GO,{"Node, Node":a,"Node, Node, Object":a})});var WO="derivative",mj=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Cb=S(WO,mj,n=>{var{typed:e,config:t,parse:r,simplify:i,equal:a,isZero:o,numeric:l,ConstantNode:u,FunctionNode:s,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=n;function m(v,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},b={};g(b,v,x.name);var D=y(v,b);return _.simplify?i(D):D}e.addConversion({from:"identifier",to:"SymbolNode",convert:r});var h=e(WO,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});e.removeConversion({from:"identifier",to:"SymbolNode",convert:r}),h._simplify=!0,h.toTex=function(v){return d.apply(null,v.args)};var d=e("_derivTex",{"Node, SymbolNode":function(x,_){return bt(x)&&St(x.value)==="string"?d(r(x.value).toString(),_.toString(),1):d(x.toTex(),_.toString(),1)},"Node, ConstantNode":function(x,_){if(St(_.value)==="string")return d(x,r(_.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(x,_,b){return d(x.toString(),_.name,b.value)},"string, string, number":function(x,_,b){var D;return b===1?D="{d\\over d"+_+"}":D="{d^{"+b+"}\\over d"+_+"^{"+b+"}}",D+"\\left[".concat(x,"\\right]")}}),g=e("constTag",{"Object, ConstantNode, string":function(x,_){return x[_]=!0,!0},"Object, SymbolNode, string":function(x,_,b){return _.name!==b?(x[_]=!0,!0):!1},"Object, ParenthesisNode, string":function(x,_,b){return g(x,_.content,b)},"Object, FunctionAssignmentNode, string":function(x,_,b){return _.params.indexOf(b)===-1?(x[_]=!0,!0):g(x,_.expr,b)},"Object, FunctionNode | OperatorNode, string":function(x,_,b){if(_.args.length>0){for(var D=g(x,_.args[0],b),C=1;C<_.args.length;++C)D=g(x,_.args[C],b)&&D;if(D)return x[_]=!0,!0}return!1}}),y=e("_derivative",{"ConstantNode, Object":function(x){return w(0)},"SymbolNode, Object":function(x,_){return _[x]!==void 0?w(0):w(1)},"ParenthesisNode, Object":function(x,_){return new f(y(x.content,_))},"FunctionAssignmentNode, Object":function(x,_){return _[x]!==void 0?w(0):y(x.expr,_)},"FunctionNode, Object":function(x,_){if(_[x]!==void 0)return w(0);var b=x.args[0],D,C=!1,A=!1,E;switch(x.name){case"cbrt":C=!0,E=new c("*","multiply",[w(3),new c("^","pow",[b,new c("/","divide",[w(2),w(3)])])]);break;case"sqrt":case"nthRoot":if(x.args.length===1)C=!0,E=new c("*","multiply",[w(2),new s("sqrt",[b])]);else if(x.args.length===2)return D=new c("/","divide",[w(1),x.args[1]]),_[D]=_[x.args[1]],y(new c("^","pow",[b,D]),_);break;case"log10":D=w(10);case"log":if(!D&&x.args.length===1)E=b.clone(),C=!0;else if(x.args.length===1&&D||x.args.length===2&&_[x.args[1]]!==void 0)E=new c("*","multiply",[b.clone(),new s("log",[D||x.args[1]])]),C=!0;else if(x.args.length===2)return y(new c("/","divide",[new s("log",[b]),new s("log",[x.args[1]])]),_);break;case"pow":if(x.args.length===2)return _[D]=_[x.args[1]],y(new c("^","pow",[b,x.args[1]]),_);break;case"exp":E=new s("exp",[b.clone()]);break;case"sin":E=new s("cos",[b.clone()]);break;case"cos":E=new c("-","unaryMinus",[new s("sin",[b.clone()])]);break;case"tan":E=new c("^","pow",[new s("sec",[b.clone()]),w(2)]);break;case"sec":E=new c("*","multiply",[x,new s("tan",[b.clone()])]);break;case"csc":A=!0,E=new c("*","multiply",[x,new s("cot",[b.clone()])]);break;case"cot":A=!0,E=new c("^","pow",[new s("csc",[b.clone()]),w(2)]);break;case"asin":C=!0,E=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"acos":C=!0,A=!0,E=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"atan":C=!0,E=new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)]);break;case"asec":C=!0,E=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acsc":C=!0,A=!0,E=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acot":C=!0,A=!0,E=new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)]);break;case"sinh":E=new s("cosh",[b.clone()]);break;case"cosh":E=new s("sinh",[b.clone()]);break;case"tanh":E=new c("^","pow",[new s("sech",[b.clone()]),w(2)]);break;case"sech":A=!0,E=new c("*","multiply",[x,new s("tanh",[b.clone()])]);break;case"csch":A=!0,E=new c("*","multiply",[x,new s("coth",[b.clone()])]);break;case"coth":A=!0,E=new c("^","pow",[new s("csch",[b.clone()]),w(2)]);break;case"asinh":C=!0,E=new s("sqrt",[new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"acosh":C=!0,E=new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"atanh":C=!0,E=new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])]);break;case"asech":C=!0,A=!0,E=new c("*","multiply",[b.clone(),new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])])]);break;case"acsch":C=!0,A=!0,E=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acoth":C=!0,A=!0,E=new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])]);break;case"abs":E=new c("/","divide",[new s(new p("abs"),[b.clone()]),b.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+x.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var F,I;C?(F="/",I="divide"):(F="*",I="multiply");var O=y(b,_);return A&&(O=new c("-","unaryMinus",[O])),new c(F,I,[O,E])},"OperatorNode, Object":function(x,_){if(_[x]!==void 0)return w(0);if(x.op==="+")return new c(x.op,x.fn,x.args.map(function(R){return y(R,_)}));if(x.op==="-"){if(x.isUnary())return new c(x.op,x.fn,[y(x.args[0],_)]);if(x.isBinary())return new c(x.op,x.fn,[y(x.args[0],_),y(x.args[1],_)])}if(x.op==="*"){var b=x.args.filter(function(R){return _[R]!==void 0});if(b.length>0){var D=x.args.filter(function(R){return _[R]===void 0}),C=D.length===1?D[0]:new c("*","multiply",D),A=b.concat(y(C,_));return new c("*","multiply",A)}return new c("+","add",x.args.map(function(R){return new c("*","multiply",x.args.map(function(T){return T===R?y(T,_):T.clone()}))}))}if(x.op==="/"&&x.isBinary()){var E=x.args[0],F=x.args[1];return _[F]!==void 0?new c("/","divide",[y(E,_),F]):_[E]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[E]),new c("/","divide",[y(F,_),new c("^","pow",[F.clone(),w(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(E,_),F.clone()]),new c("*","multiply",[E.clone(),y(F,_)])]),new c("^","pow",[F.clone(),w(2)])])}if(x.op==="^"&&x.isBinary()){var I=x.args[0],O=x.args[1];if(_[I]!==void 0)return bt(I)&&(o(I.value)||a(I.value,1))?w(0):new c("*","multiply",[x,new c("*","multiply",[new s("log",[I.clone()]),y(O.clone(),_)])]);if(_[O]!==void 0){if(bt(O)){if(o(O.value))return w(0);if(a(O.value,1))return y(I,_)}var k=new c("^","pow",[I.clone(),new c("-","subtract",[O,w(1)])]);return new c("*","multiply",[O.clone(),new c("*","multiply",[y(I,_),k])])}return new c("*","multiply",[new c("^","pow",[I.clone(),O.clone()]),new c("+","add",[new c("*","multiply",[y(I,_),new c("/","divide",[O.clone(),I.clone()])]),new c("*","multiply",[y(O,_),new s("log",[I.clone()])])])])}throw new Error('Cannot process operator "'+x.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function w(v,x){return new u(l(v,x||t.number))}return h});var jO="rationalize",dj=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],Sb=S(jO,dj,n=>{var{config:e,typed:t,equal:r,isZero:i,add:a,subtract:o,multiply:l,divide:u,pow:s,parse:c,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:w,ArrayNode:v,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:D,OperatorNode:C,SymbolNode:A,ParenthesisNode:E}=n;function F(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,B=O(),X=I(T,N,!0,B.firstRules),ee=X.variables.length,W={exactFractions:!1},P={exactFractions:!0};if(T=X.expression,ee>=1){T=k(T);var K,ve,ie=!0,oe=!1;T=m(T,B.firstRules,{},W);for(var ge;ve=ie?B.distrDivRules:B.sucDivRules,T=m(T,ve,{},P),ie=!ie,ge=T.toString(),ge!==K;)oe=!0,K=ge;oe&&(T=m(T,B.firstRulesAgain,{},W)),T=m(T,B.finalRules,{},W)}var ue=[],ce={};return T.type==="OperatorNode"&&T.isBinary()&&T.op==="/"?(ee===1&&(T.args[0]=R(T.args[0],ue),T.args[1]=R(T.args[1])),V&&(ce.numerator=T.args[0],ce.denominator=T.args[1])):(ee===1&&(T=R(T,ue)),V&&(ce.numerator=T,ce.denominator=null)),V?(ce.coefficients=ue,ce.variables=X.variables,ce.expression=T,ce):T}return t(jO,{Node:F,"Node, boolean":(T,N)=>F(T,{},N),"Node, Object":F,"Node, Object, boolean":F});function I(T,N,V,B){var X=[],ee=m(T,B,N,{exactFractions:!1});V=!!V;var W="+-*"+(V?"/":"");K(ee);var P={};return P.expression=ee,P.variables=X,P;function K(ve){var ie=ve.type;if(ie==="FunctionNode")throw new Error("There is an unsolved function call");if(ie==="OperatorNode")if(ve.op==="^"){if(ve.args[1].type!=="ConstantNode"||!ze(parseFloat(ve.args[1].value)))throw new Error("There is a non-integer exponent");K(ve.args[0])}else{if(W.indexOf(ve.op)===-1)throw new Error("Operator "+ve.op+" invalid in polynomial expression");for(var oe=0;oe1;if(B==="OperatorNode"&&T.isBinary()){var ee=!1,W;if(T.op==="^"&&(T.args[0].type==="ParenthesisNode"||T.args[0].type==="OperatorNode")&&T.args[1].type==="ConstantNode"&&(W=parseFloat(T.args[1].value),ee=W>=2&&ze(W)),ee){if(W>2){var P=T.args[0],K=new C("^","pow",[T.args[0].cloneDeep(),new x(W-1)]);T=new C("*","multiply",[P,K])}else T=new C("*","multiply",[T.args[0],T.args[0].cloneDeep()]);X&&(V==="content"?N.content=T:N.args[V]=T)}}if(B==="ParenthesisNode")k(T.content,T,"content");else if(B!=="ConstantNode"&&B!=="SymbolNode")for(var ve=0;ve=0;P--)if(N[P]!==0){var K=new x(ee?N[P]:Math.abs(N[P])),ve=N[P]<0?"-":"+";if(P>0){var ie=new A(X);if(P>1){var oe=new x(P);ie=new C("^","pow",[ie,oe])}N[P]===-1&&ee?K=new C("-","unaryMinus",[ie]):Math.abs(N[P])===1?K=ie:K=new C("*","multiply",[K,ie])}ee?W=K:ve==="+"?W=new C("+","add",[W,K]):W=new C("-","subtract",[W,K]),ee=!1}if(ee)return new x(0);return W;function ge(ue,ce,me){var de=ue.type;if(de==="FunctionNode")throw new Error("There is an unsolved function call");if(de==="OperatorNode"){if("+-*^".indexOf(ue.op)===-1)throw new Error("Operator "+ue.op+" invalid");if(ce!==null){if((ue.fn==="unaryMinus"||ue.fn==="pow")&&ce.fn!=="add"&&ce.fn!=="subtract"&&ce.fn!=="multiply")throw new Error("Invalid "+ue.op+" placing");if((ue.fn==="subtract"||ue.fn==="add"||ue.fn==="multiply")&&ce.fn!=="add"&&ce.fn!=="subtract")throw new Error("Invalid "+ue.op+" placing");if((ue.fn==="subtract"||ue.fn==="add"||ue.fn==="unaryMinus")&&me.noFil!==0)throw new Error("Invalid "+ue.op+" placing")}(ue.op==="^"||ue.op==="*")&&(me.fire=ue.op);for(var Be=0;BeB&&(N[we]=0),N[we]+=me.cte*(me.oper==="+"?1:-1),B=Math.max(we,B);return}me.cte=we,me.fire===""&&(N[0]+=me.cte*(me.oper==="+"?1:-1))}else throw new Error("Type "+de+" is not allowed")}}});var ZO="zpk2tf",hj=["typed","add","multiply","Complex","number"],Nb=S(ZO,hj,n=>{var{typed:e,add:t,multiply:r,Complex:i,number:a}=n;return e(ZO,{"Array,Array,number":function(s,c,f){return o(s,c,f)},"Array,Array":function(s,c){return o(s,c,1)},"Matrix,Matrix,number":function(s,c,f){return o(s.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(s,c){return o(s.valueOf(),c.valueOf(),1)}});function o(u,s,c){u.some(w=>w.type==="BigNumber")&&(u=u.map(w=>a(w))),s.some(w=>w.type==="BigNumber")&&(s=s.map(w=>a(w)));for(var f=[i(1,0)],p=[i(1,0)],m=0;m=0&&f-p{var{typed:e,add:t,multiply:r,Complex:i,divide:a,matrix:o}=n;return e(JO,{"Array, Array":function(c,f){var p=u(512);return l(c,f,p)},"Array, Array, Array":function(c,f,p){return l(c,f,p)},"Array, Array, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=u(p);return l(c,f,m)},"Matrix, Matrix":function(c,f){var p=u(512),{w:m,h}=l(c.valueOf(),f.valueOf(),p);return{w:o(m),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,p){var{h:m}=l(c.valueOf(),f.valueOf(),p.valueOf());return{h:o(m),w:o(p)}},"Matrix, Matrix, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=u(p),{h}=l(c.valueOf(),f.valueOf(),m);return{h:o(h),w:o(m)}}});function l(s,c,f){for(var p=[],m=[],h=0;h{var{classes:e}=n;return function(r,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var xj="replacer",bj=[],Fb=S(xj,bj,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var YO="12.1.0";var Ib=S("true",[],()=>!0),Bb=S("false",[],()=>!1),Ob=S("null",[],()=>null),Pb=ti("Infinity",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1/0):1/0}),Rb=ti("NaN",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(NaN):NaN}),kb=ti("pi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?cl(t):FC}),Lb=ti("tau",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?KN(t):IC}),Vb=ti("e",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?XN(t):BC}),Ub=ti("phi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?QN(t):OC}),qb=ti("LN2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),zb=ti("LN10",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),$b=ti("LOG2E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),Hb=ti("LOG10E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),Gb=ti("SQRT1_2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),Wb=ti("SQRT2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),jb=ti("i",["Complex"],n=>{var{Complex:e}=n;return e.I});var Zb=S("version",[],()=>YO);function ti(n,e,t){return S(n,e,t,{recreateOnConfigChange:!0})}var Jb=Et("speedOfLight","299792458","m s^-1"),Yb=Et("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Xb=Et("planckConstant","6.62607015e-34","J s"),Qb=Et("reducedPlanckConstant","1.0545718176461565e-34","J s"),Kb=Et("magneticConstant","1.25663706212e-6","N A^-2"),e1=Et("electricConstant","8.8541878128e-12","F m^-1"),t1=Et("vacuumImpedance","376.730313667","ohm"),r1=Et("coulomb","8.987551792261171e9","N m^2 C^-2"),n1=Et("elementaryCharge","1.602176634e-19","C"),i1=Et("bohrMagneton","9.2740100783e-24","J T^-1"),a1=Et("conductanceQuantum","7.748091729863649e-5","S"),o1=Et("inverseConductanceQuantum","12906.403729652257","ohm"),s1=Et("magneticFluxQuantum","2.0678338484619295e-15","Wb"),u1=Et("nuclearMagneton","5.0507837461e-27","J T^-1"),l1=Et("klitzing","25812.807459304513","ohm");var c1=Et("bohrRadius","5.29177210903e-11","m"),f1=Et("classicalElectronRadius","2.8179403262e-15","m"),p1=Et("electronMass","9.1093837015e-31","kg"),m1=Et("fermiCoupling","1.1663787e-5","GeV^-2"),d1=Ip("fineStructure",.0072973525693),h1=Et("hartreeEnergy","4.3597447222071e-18","J"),g1=Et("protonMass","1.67262192369e-27","kg"),v1=Et("deuteronMass","3.3435830926e-27","kg"),y1=Et("neutronMass","1.6749271613e-27","kg"),x1=Et("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),b1=Et("rydberg","10973731.568160","m^-1"),w1=Et("thomsonCrossSection","6.6524587321e-29","m^2"),_1=Ip("weakMixingAngle",.2229),A1=Ip("efimovFactor",22.7),D1=Et("atomicMass","1.66053906660e-27","kg"),E1=Et("avogadro","6.02214076e23","mol^-1"),C1=Et("boltzmann","1.380649e-23","J K^-1"),S1=Et("faraday","96485.33212331001","C mol^-1"),N1=Et("firstRadiation","3.7417718521927573e-16","W m^2"),M1=Et("loschmidt","2.686780111798444e25","m^-3"),T1=Et("gasConstant","8.31446261815324","J K^-1 mol^-1"),F1=Et("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),I1=Et("molarVolume","0.022413969545014137","m^3 mol^-1"),B1=Ip("sackurTetrode",-1.16487052358),O1=Et("secondRadiation","0.014387768775039337","m K"),P1=Et("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),R1=Et("wienDisplacement","2.897771955e-3","m K"),k1=Et("molarMass","0.99999999965e-3","kg mol^-1"),L1=Et("molarMassC12","11.9999999958e-3","kg mol^-1"),V1=Et("gravity","9.80665","m s^-2"),U1=Et("planckLength","1.616255e-35","m"),q1=Et("planckMass","2.176435e-8","kg"),z1=Et("planckTime","5.391245e-44","s"),$1=Et("planckCharge","1.87554603778e-18","C"),H1=Et("planckTemperature","1.416785e+32","K");function Et(n,e,t){var r=["config","Unit","BigNumber"];return S(n,r,i=>{var{config:a,Unit:o,BigNumber:l}=i,u=a.number==="BigNumber"?new l(e):parseFloat(e),s=new o(u,t);return s.fixPrefix=!0,s})}function Ip(n,e){var t=["config","BigNumber"];return S(n,t,r=>{var{config:i,BigNumber:a}=r;return i.number==="BigNumber"?new a(e):e})}var wj="apply",_j=["typed","isInteger"],G1=S(wj,_j,n=>{var{typed:e,isInteger:t}=n,r=Ho({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];nt(o)?a[1]=o-1:tt(o)&&(a[1]=o.minus(1));try{return r.apply(null,a)}catch(l){throw nr(l)}}})},{isTransformFunction:!0});var Aj="column",Dj=["typed","Index","matrix","range"],W1=S(Aj,Dj,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=tl({typed:e,Index:t,matrix:r,range:i});return e("column",{"...any":function(l){var u=l.length-1,s=l[u];nt(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw nr(c)}}})},{isTransformFunction:!0});function Qs(n,e,t){var r=n.filter(function(l){return Qt(l)&&!(l.name in e)&&!t.has(l.name)})[0];if(!r)throw new Error('No undefined variable found in inline expression "'+n+'"');var i=r.name,a=Wo(t),o=n.compile();return function(u){return a.set(i,u),o.evaluate(a)}}var Ej="filter",Cj=["typed"],j1=S(Ej,Cj,n=>{var{typed:e}=n;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(Qt(i[1])||qi(i[1])?u=i[1].compile().evaluate(o):u=Qs(i[1],a,o)),r(l,u)}t.rawArgs=!0;var r=e("filter",{"Array, function":XO,"Matrix, function":function(a,o){return a.create(XO(a.toArray(),o))},"Array, RegExp":ks,"Matrix, RegExp":function(a,o){return a.create(ks(a.toArray(),o))}});return t},{isTransformFunction:!0});function XO(n,e){return If(n,function(t,r,i){return hi(e,t,[r+1],i,"filter")})}var Sj="forEach",Nj=["typed"],Z1=S(Sj,Nj,n=>{var{typed:e}=n;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(Qt(i[1])||qi(i[1])?u=i[1].compile().evaluate(o):u=Qs(i[1],a,o)),r(l,u)}t.rawArgs=!0;var r=e("forEach",{"Array | Matrix, function":function(a,o){var l=function u(s,c){if(Array.isArray(s))$a(s,function(f,p){u(f,c.concat(p+1))});else return hi(o,s,c,a,"forEach")};l(a.valueOf(),[])}});return t},{isTransformFunction:!0});var Mj="index",Tj=["Index","getMatrixDataType"],J1=S(Mj,Tj,n=>{var{Index:e,getMatrixDataType:t}=n;return function(){for(var i=[],a=0,o=arguments.length;a0?0:2;else if(l&&l.isSet===!0)l=l.map(function(s){return s-1});else if(Mt(l)||He(l))t(l)!=="boolean"&&(l=l.map(function(s){return s-1}));else if(nt(l))l--;else if(tt(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=l}var u=new e;return e.apply(u,i),u}},{isTransformFunction:!0});var Fj="map",Ij=["typed"],Y1=S(Fj,Ij,n=>{var{typed:e}=n;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(Qt(i[1])||qi(i[1])?u=i[1].compile().evaluate(o):u=Qs(i[1],a,o)),r(l,u)}t.rawArgs=!0;var r=e("map",{"Array, function":function(a,o){return QO(a,o,a)},"Matrix, function":function(a,o){return a.create(QO(a.valueOf(),o,a))}});return t},{isTransformFunction:!0});function QO(n,e,t){function r(i,a){return Array.isArray(i)?Pn(i,function(o,l){return r(o,a.concat(l+1))}):hi(e,i,a,t,"map")}return r(n,[])}function vn(n){if(n.length===2&&Sn(n[0])){n=n.slice();var e=n[1];nt(e)?n[1]=e-1:tt(e)&&(n[1]=e.minus(1))}return n}var Bj="max",Oj=["typed","config","numeric","larger"],X1=S(Bj,Oj,n=>{var{typed:e,config:t,numeric:r,larger:i}=n,a=ul({typed:e,config:t,numeric:r,larger:i});return e("max",{"...any":function(l){l=vn(l);try{return a.apply(null,l)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var Pj="mean",Rj=["typed","add","divide"],Q1=S(Pj,Rj,n=>{var{typed:e,add:t,divide:r}=n,i=dl({typed:e,add:t,divide:r});return e("mean",{"...any":function(o){o=vn(o);try{return i.apply(null,o)}catch(l){throw nr(l)}}})},{isTransformFunction:!0});var kj="min",Lj=["typed","config","numeric","smaller"],K1=S(kj,Lj,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n,a=ll({typed:e,config:t,numeric:r,smaller:i});return e("min",{"...any":function(l){l=vn(l);try{return a.apply(null,l)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var Vj="range",Uj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],ew=S(Vj,Uj,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=n,f=il({typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c});return e("range",{"...any":function(m){var h=m.length-1,d=m[h];return typeof d!="boolean"&&m.push(!0),f.apply(null,m)}})},{isTransformFunction:!0});var qj="row",zj=["typed","Index","matrix","range"],tw=S(qj,zj,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=al({typed:e,Index:t,matrix:r,range:i});return e("row",{"...any":function(l){var u=l.length-1,s=l[u];nt(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw nr(c)}}})},{isTransformFunction:!0});var $j="subset",Hj=["typed","matrix","zeros","add"],rw=S($j,Hj,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=ol({typed:e,matrix:t,zeros:r,add:i});return e("subset",{"...any":function(l){try{return a.apply(null,l)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var Gj="concat",Wj=["typed","matrix","isInteger"],nw=S(Gj,Wj,n=>{var{typed:e,matrix:t,isInteger:r}=n,i=el({typed:e,matrix:t,isInteger:r});return e("concat",{"...any":function(o){var l=o.length-1,u=o[l];nt(u)?o[l]=u-1:tt(u)&&(o[l]=u.minus(1));try{return i.apply(null,o)}catch(s){throw nr(s)}}})},{isTransformFunction:!0});var KO="diff",jj=["typed","matrix","subtract","number","bignumber"],iw=S(KO,jj,n=>{var{typed:e,matrix:t,subtract:r,number:i,bignumber:a}=n,o=nl({typed:e,matrix:t,subtract:r,number:i,bignumber:a});return e(KO,{"...any":function(u){u=vn(u);try{return o.apply(null,u)}catch(s){throw nr(s)}}})},{isTransformFunction:!0});var Zj="std",Jj=["typed","map","sqrt","variance"],aw=S(Zj,Jj,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n,a=vl({typed:e,map:t,sqrt:r,variance:i});return e("std",{"...any":function(l){l=vn(l);try{return a.apply(null,l)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var eP="sum",Yj=["typed","config","add","numeric"],ow=S(eP,Yj,n=>{var{typed:e,config:t,add:r,numeric:i}=n,a=pl({typed:e,config:t,add:r,numeric:i});return e(eP,{"...any":function(l){l=vn(l);try{return a.apply(null,l)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var Xj="quantileSeq",Qj=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],sw=S(Xj,Qj,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=n,m=gl({typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(d,g,y)=>m(d,g,h(y)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(d,g,y,w)=>m(d,g,y,h(w)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(d,g,y)=>m(d,g,h(y)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(d,g,y,w)=>m(d,g,y,h(w))});function h(d){return vn([[],d])[1]}},{isTransformFunction:!0});var tP="cumsum",Kj=["typed","add","unaryPlus"],uw=S(tP,Kj,n=>{var{typed:e,add:t,unaryPlus:r}=n,i=ml({typed:e,add:t,unaryPlus:r});return e(tP,{"...any":function(o){if(o.length===2&&Sn(o[0])){var l=o[1];nt(l)?o[1]=l-1:tt(l)&&(o[1]=l.minus(1))}try{return i.apply(null,o)}catch(u){throw nr(u)}}})},{isTransformFunction:!0});var rP="variance",eZ=["typed","add","subtract","multiply","divide","apply","isNaN"],lw=S(rP,eZ,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:l}=n,u=hl({typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:l});return e(rP,{"...any":function(c){c=vn(c);try{return u.apply(null,c)}catch(f){throw nr(f)}}})},{isTransformFunction:!0});var nP="print",tZ=["typed","matrix","zeros","add"],cw=S(nP,tZ,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=sl({typed:e,matrix:t,zeros:r,add:i});return e(nP,{"string, Object | Array":function(u,s){return a(o(u),s)},"string, Object | Array, number | Object":function(u,s,c){return a(o(u),s,c)}});function o(l){return l.replace(Kf,u=>{var s=u.slice(1).split("."),c=s.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var Re=Nh({config:xe}),ir=Th({}),fw=Vb({BigNumber:Re,config:xe}),iP=Bb({}),aP=d1({BigNumber:Re,config:xe}),Ka=Ih({}),pw=jb({Complex:ir}),oP=Pb({BigNumber:Re,config:xe}),sP=zb({BigNumber:Re,config:xe}),uP=Hb({BigNumber:Re,config:xe}),bl=Oh({}),lP=Rb({BigNumber:Re,config:xe}),cP=Ob({}),fP=Ub({BigNumber:Re,config:xe}),pP=Bh({}),mw=wh({}),mP=Gb({BigNumber:Re,config:xe}),dP=B1({BigNumber:Re,config:xe}),dw=Lb({BigNumber:Re,config:xe}),hP=Ib({}),gP=Zb({}),Tt=Ph({Matrix:bl}),vP=A1({BigNumber:Re,config:xe}),yP=qb({BigNumber:Re,config:xe}),Bp=kb({BigNumber:Re,config:xe}),xP=Fb({}),bP=Wb({BigNumber:Re,config:xe}),Z=bh({BigNumber:Re,Complex:ir,DenseMatrix:Tt,Fraction:Ka}),Op=iv({BigNumber:Re,config:xe,typed:Z}),wP=_1({BigNumber:Re,config:xe}),yn=av({typed:Z}),_P=c0({Complex:ir,config:xe,typed:Z}),AP=p0({BigNumber:Re,typed:Z}),DP=d0({BigNumber:Re,Complex:ir,config:xe,typed:Z}),Rr=ov({typed:Z}),EP=kv({typed:Z}),CP=v0({BigNumber:Re,Complex:ir,config:xe,typed:Z}),SP=x0({typed:Z}),hw=b0({typed:Z}),NP=_0({Complex:ir,config:xe,typed:Z}),Vn=Jg({BigNumber:Re,typed:Z}),MP=Ov({typed:Z}),TP=Zg({typed:Z}),FP=Rh({typed:Z}),wl=Yx({typed:Z}),_l=Yg({Complex:ir,typed:Z}),eo=Lv({typed:Z}),Pp=A0({typed:Z}),IP=E0({BigNumber:Re,typed:Z}),BP=S0({BigNumber:Re,typed:Z}),OP=fv({typed:Z}),Pt=Hg({config:xe,typed:Z}),PP=hy({typed:Z}),gw=pv({typed:Z}),RP=mv({Complex:ir,typed:Z}),kP=jv({typed:Z}),LP=Jv({typed:Z}),Ks=xy({typed:Z}),Rp=Yv({typed:Z}),VP=_y({format:Ks,typed:Z}),kp=Vv({typed:Z}),Mn=Lh({typed:Z}),ba=kg({typed:Z}),to=Ug({typed:Z}),yi=qg({typed:Z}),UP=$b({BigNumber:Re,config:xe}),qP=Kx({Complex:ir,typed:Z}),zP=bv({Complex:ir,config:xe,typed:Z}),vw=wv({Complex:ir,config:xe,typed:Z}),ro=Kv({typed:Z}),Ar=_v({typed:Z}),yw=qv({typed:Z}),ji=Wg({typed:Z}),$P=wy({format:Ks,typed:Z}),HP=fb({config:xe,typed:Z}),GP=sl({typed:Z}),WP=pb({config:xe,typed:Z}),Lp=Uv({typed:Z}),jP=M0({BigNumber:Re,typed:Z}),xw=Ev({BigNumber:Re,Fraction:Ka,complex:_l,typed:Z}),Al=F0({typed:Z}),Zi=Gg({Matrix:bl,equalScalar:Pt,typed:Z}),ZP=rv({typed:Z}),JP=Sv({typed:Z}),YP=jg({typed:Z}),ri=sv({typed:Z}),XP=B0({typed:Z}),bw=$g({typed:Z}),QP=f0({Complex:ir,config:xe,typed:Z}),KP=h0({BigNumber:Re,typed:Z}),Vp=Ho({isInteger:Mn,typed:Z}),e3=g0({BigNumber:Re,Complex:ir,config:xe,typed:Z}),t3=by({format:Ks,typed:Z}),r3=Xx({typed:Z}),n3=D0({typed:Z}),i3=N0({BigNumber:Re,typed:Z}),eu=zg({typed:Z}),a3=Dy({typed:Z}),o3=mb({config:xe,typed:Z}),s3=T0({BigNumber:Re,typed:Z}),u3=I0({typed:Z}),l3=u0({SparseMatrix:Zi,typed:Z}),xi=Cv({Complex:ir,config:xe,typed:Z}),c3=O0({typed:Z}),Bi=nv({typed:Z}),f3=m0({BigNumber:Re,Complex:ir,config:xe,typed:Z}),p3=C0({BigNumber:Re,typed:Z}),Zo=Xg({Fraction:Ka,typed:Z}),no=Lg({typed:Z}),ke=Qg({DenseMatrix:Tt,Matrix:bl,SparseMatrix:Zi,typed:Z}),m3=Kg({isZero:yi,matrix:ke,typed:Z}),d3=vy({isNaN:eu,isNumeric:no,typed:Z}),bi=Ey({bignumber:Vn,fraction:Zo,number:ji}),ww=yy({config:xe,multiplyScalar:Ar,numeric:bi,typed:Z}),_w=ty({isInteger:Mn,matrix:ke,typed:Z}),Qr=ay({matrix:ke,config:xe,typed:Z}),h3=oy({matrix:ke,typed:Z}),tu=sy({matrix:ke,typed:Z}),Aw=Mv({BigNumber:Re,config:xe,matrix:ke,typed:Z}),xn=ly({BigNumber:Re,config:xe,matrix:ke,typed:Z}),g3=y0({Complex:ir,config:xe,typed:Z}),Dw=uv({BigNumber:Re,Complex:ir,Fraction:Ka,config:xe,isNegative:ba,matrix:ke,typed:Z,unaryMinus:Bi}),Ht=el({isInteger:Mn,matrix:ke,typed:Z}),v3=Hv({prod:ww,size:Qr,typed:Z}),Up=uy({conj:eo,transpose:tu,typed:Z}),Ew=Wv({DenseMatrix:Tt,SparseMatrix:Zi,matrix:ke,typed:Z}),yr=Cy({numeric:bi,typed:Z}),ru=By({DenseMatrix:Tt,concat:Ht,divideScalar:yr,equalScalar:Pt,matrix:ke,typed:Z}),ni=Gy({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),nu=Zv({matrix:ke,typed:Z}),y3=Vg({isNumeric:no,typed:Z}),wa=Xv({BigNumber:Re,DenseMatrix:Tt,SparseMatrix:Zi,config:xe,matrix:ke,typed:Z}),x3=Qv({matrix:ke,multiplyScalar:Ar,typed:Z}),Dl=Yy({DenseMatrix:Tt,concat:Ht,config:xe,matrix:ke,typed:Z}),b3=Ly({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z,zeros:xn}),Cw=Oy({DenseMatrix:Tt,divideScalar:yr,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,subtractScalar:ri,typed:Z}),qp=tv({flatten:nu,matrix:ke,size:Qr,typed:Z}),w3=Dv({BigNumber:Re,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),_3=ey({BigNumber:Re,config:xe,matrix:ke,typed:Z}),zp=_x({addScalar:Rr,complex:_l,conj:eo,divideScalar:yr,equal:ni,identity:wa,isZero:yi,matrix:ke,multiplyScalar:Ar,sign:xw,sqrt:xi,subtractScalar:ri,typed:Z,unaryMinus:Bi,zeros:xn}),A3=ry({config:xe,matrix:ke}),D3=Vy({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z,zeros:xn}),Jo=Ny({BigNumber:Re,DenseMatrix:Tt,equalScalar:Pt,matrix:ke,typed:Z,zeros:xn}),bn=jy({DenseMatrix:Tt,concat:Ht,config:xe,matrix:ke,typed:Z}),Dr=Nv({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,subtractScalar:ri,typed:Z,unaryMinus:Bi}),E3=Ay({concat:Ht,matrix:ke,typed:Z}),C3=Qy({DenseMatrix:Tt,concat:Ht,config:xe,equalScalar:Pt,matrix:ke,typed:Z}),$p=Py({DenseMatrix:Tt,divideScalar:yr,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,subtractScalar:ri,typed:Z}),S3=$v({DenseMatrix:Tt,concat:Ht,matrix:ke,typed:Z}),Rt=G0({DenseMatrix:Tt,SparseMatrix:Zi,addScalar:Rr,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),N3=w0({BigNumber:Re,DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),M3=Bv({concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),T3=Rv({DenseMatrix:Tt,concat:Ht,matrix:ke,typed:Z}),F3=gb({addScalar:Rr,combinations:wl,divideScalar:yr,isInteger:Mn,isNegative:ba,multiplyScalar:Ar,typed:Z}),io=zy({BigNumber:Re,DenseMatrix:Tt,Fraction:Ka,concat:Ht,config:xe,equalScalar:Pt,matrix:ke,typed:Z}),Sw=Hy({concat:Ht,matrix:ke,typed:Z}),I3=ml({add:Rt,typed:Z,unaryPlus:Op}),Hp=Xy({equal:ni,typed:Z}),B3=nl({matrix:ke,number:ji,subtract:Dr,typed:Z}),O3=Hx({abs:yn,addScalar:Rr,deepEqual:Hp,divideScalar:yr,multiplyScalar:Ar,sqrt:xi,subtractScalar:ri,typed:Z}),El=Z0({addScalar:Rr,conj:eo,multiplyScalar:Ar,size:Qr,typed:Z}),P3=Wy({compareText:Sw,isZero:yi,typed:Z}),Nw=Qu({DenseMatrix:Tt,config:xe,equalScalar:Pt,matrix:ke,round:Jo,typed:Z,zeros:xn}),R3=yv({BigNumber:Re,DenseMatrix:Tt,concat:Ht,config:xe,equalScalar:Pt,matrix:ke,round:Jo,typed:Z,zeros:xn}),k3=W0({abs:yn,addScalar:Rr,divideScalar:yr,isPositive:to,multiplyScalar:Ar,smaller:bn,sqrt:xi,typed:Z}),Mw=t0({DenseMatrix:Tt,smaller:bn}),un=r0({ImmutableDenseMatrix:Mw,getMatrixDataType:Rp}),wn=Jy({DenseMatrix:Tt,concat:Ht,config:xe,matrix:ke,typed:Z}),Gp=My({Complex:ir,config:xe,divideScalar:yr,typed:Z}),L3=Ry({DenseMatrix:Tt,divideScalar:yr,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,subtractScalar:ri,typed:Z}),V3=ev({flatten:nu,matrix:ke,size:Qr,typed:Z}),U3=ll({config:xe,numeric:bi,smaller:bn,typed:Z}),Tw=Ku({DenseMatrix:Tt,concat:Ht,config:xe,equalScalar:Pt,matrix:ke,round:Jo,typed:Z,zeros:xn}),Gt=Av({addScalar:Rr,dot:El,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,typed:Z}),q3=Fy({Complex:ir,config:xe,divideScalar:yr,typed:Z}),z3=zv({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),Cl=Ky({compare:io,isNaN:eu,isNumeric:no,typed:Z}),$3=Uy({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z,zeros:xn}),Fw=Dx({SparseMatrix:Zi,abs:yn,add:Rt,divideScalar:yr,larger:wn,largerEq:Dl,multiply:Gt,subtract:Dr,transpose:tu,typed:Z}),Un=ol({add:Rt,matrix:ke,typed:Z,zeros:xn}),Wp=pl({add:Rt,config:xe,numeric:bi,typed:Z}),H3=J0({add:Rt,matrix:ke,typed:Z}),Iw=ky({DenseMatrix:Tt,divideScalar:yr,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,subtractScalar:ri,typed:Z}),G3=Nb({Complex:ir,add:Rt,multiply:Gt,number:ji,typed:Z}),W3=Pv({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),jp=cv({DenseMatrix:Tt,config:xe,equalScalar:Pt,matrix:ke,round:Jo,typed:Z,zeros:xn}),Oi=$y({compare:io,typed:Z}),j3=vb({addScalar:Rr,combinations:wl,isInteger:Mn,isNegative:ba,isPositive:to,larger:wn,typed:Z}),Z3=Gv({matrix:ke,multiply:Gt,subtract:Dr,typed:Z}),Bw=Ox({divideScalar:yr,isZero:yi,matrix:ke,multiply:Gt,subtractScalar:ri,typed:Z,unaryMinus:Bi}),J3=Fv({concat:Ht,equalScalar:Pt,matrix:ke,multiplyScalar:Ar,typed:Z}),Ow=n0({larger:wn,smaller:bn}),Pw=hv({Complex:ir,DenseMatrix:Tt,ceil:jp,equalScalar:Pt,floor:Nw,matrix:ke,typed:Z,zeros:xn}),Rw=Y0({Index:un,typed:Z}),Y3=Gx({abs:yn,add:Rt,addScalar:Rr,config:xe,divideScalar:yr,equalScalar:Pt,flatten:nu,isNumeric:no,isZero:yi,matrix:ke,multiply:Gt,multiplyScalar:Ar,smaller:bn,subtract:Dr,typed:Z}),X3=Tv({BigNumber:Re,add:Rt,config:xe,equal:ni,isInteger:Mn,mod:Tw,smaller:bn,typed:Z,xgcd:Aw}),Q3=xv({concat:Ht,equalScalar:Pt,matrix:ke,typed:Z}),K3=Ty({Complex:ir,config:xe,divideScalar:yr,log:Gp,typed:Z}),Zp=ul({config:xe,larger:wn,numeric:bi,typed:Z}),eR=P0({DenseMatrix:Tt,Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),tR=k0({DenseMatrix:Tt,Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),rR=V0({Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),nR=q0({Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),Yo=Zy({DenseMatrix:Tt,concat:Ht,config:xe,matrix:ke,typed:Z}),iR=e0({compare:io,compareNatural:Oi,matrix:ke,typed:Z}),aR=qy({concat:Ht,equalScalar:Pt,matrix:ke,not:yw,typed:Z,zeros:xn}),Xo=il({bignumber:Vn,matrix:ke,add:Rt,config:xe,isPositive:to,larger:wn,largerEq:Dl,smaller:bn,smallerEq:Yo,typed:Z}),oR=al({Index:un,matrix:ke,range:Xo,typed:Z}),kw=R0({DenseMatrix:Tt,Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),sR=U0({Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),Lw=$0({Index:un,concat:Ht,setDifference:kw,size:Qr,subset:Un,typed:Z}),Vw=i0({FibonacciHeap:Ow,addScalar:Rr,equalScalar:Pt}),Uw=tl({Index:un,matrix:ke,range:Xo,typed:Z}),ao=Px({abs:yn,addScalar:Rr,det:Bw,divideScalar:yr,identity:wa,matrix:ke,multiply:Gt,typed:Z,unaryMinus:Bi}),qw=wx({DenseMatrix:Tt,Spa:Vw,SparseMatrix:Zi,abs:yn,addScalar:Rr,divideScalar:yr,equalScalar:Pt,larger:wn,matrix:ke,multiplyScalar:Ar,subtractScalar:ri,typed:Z,unaryMinus:Bi}),uR=Rx({Complex:ir,add:Rt,ctranspose:Up,deepEqual:Hp,divideScalar:yr,dot:El,dotDivide:ru,equal:ni,inv:ao,matrix:ke,multiply:Gt,typed:Z}),ii=Sy({Complex:ir,config:xe,fraction:Zo,identity:wa,inv:ao,matrix:ke,multiply:Gt,number:ji,typed:Z}),zw=L0({DenseMatrix:Tt,Index:un,compareNatural:Oi,size:Qr,subset:Un,typed:Z}),lR=H0({Index:un,concat:Ht,setIntersect:zw,setSymDifference:Lw,size:Qr,subset:Un,typed:Z}),cR=Vx({abs:yn,add:Rt,identity:wa,inv:ao,map:ro,max:Zp,multiply:Gt,size:Qr,sqrt:xi,subtract:Dr,typed:Z}),dt=o0({BigNumber:Re,Complex:ir,Fraction:Ka,abs:yn,addScalar:Rr,config:xe,divideScalar:yr,equal:ni,fix:Pw,format:Ks,isNumeric:no,multiplyScalar:Ar,number:ji,pow:ii,round:Jo,subtractScalar:ri}),fR=t1({BigNumber:Re,Unit:dt,config:xe}),pR=R1({BigNumber:Re,Unit:dt,config:xe}),mR=D1({BigNumber:Re,Unit:dt,config:xe}),dR=i1({BigNumber:Re,Unit:dt,config:xe}),hR=C1({BigNumber:Re,Unit:dt,config:xe}),gR=a1({BigNumber:Re,Unit:dt,config:xe}),vR=r1({BigNumber:Re,Unit:dt,config:xe}),yR=v1({BigNumber:Re,Unit:dt,config:xe}),xR=Iy({DenseMatrix:Tt,concat:Ht,equalScalar:Pt,matrix:ke,pow:ii,typed:Z}),bR=e1({BigNumber:Re,Unit:dt,config:xe}),wR=n1({BigNumber:Re,Unit:dt,config:xe}),_R=Lx({abs:yn,add:Rt,identity:wa,inv:ao,multiply:Gt,typed:Z}),AR=S1({BigNumber:Re,Unit:dt,config:xe}),$w=cy({addScalar:Rr,ceil:jp,conj:eo,divideScalar:yr,dotDivide:ru,exp:gw,i:pw,log2:vw,matrix:ke,multiplyScalar:Ar,pow:ii,tau:dw,typed:Z}),Jp=Qx({BigNumber:Re,Complex:ir,config:xe,multiplyScalar:Ar,pow:ii,typed:Z}),DR=Yb({BigNumber:Re,Unit:dt,config:xe}),ER=h1({BigNumber:Re,Unit:dt,config:xe}),CR=fy({conj:eo,dotDivide:ru,fft:$w,typed:Z}),SR=l1({BigNumber:Re,Unit:dt,config:xe}),NR=M1({BigNumber:Re,Unit:dt,config:xe}),MR=Kb({BigNumber:Re,Unit:dt,config:xe}),TR=k1({BigNumber:Re,Unit:dt,config:xe}),FR=F1({BigNumber:Re,Unit:dt,config:xe}),IR=y1({BigNumber:Re,Unit:dt,config:xe}),BR=u1({BigNumber:Re,Unit:dt,config:xe}),OR=$1({BigNumber:Re,Unit:dt,config:xe}),PR=U1({BigNumber:Re,Unit:dt,config:xe}),RR=H1({BigNumber:Re,Unit:dt,config:xe}),kR=g1({BigNumber:Re,Unit:dt,config:xe}),LR=x1({BigNumber:Re,Unit:dt,config:xe}),VR=Qb({BigNumber:Re,Unit:dt,config:xe}),UR=b1({BigNumber:Re,Unit:dt,config:xe}),qR=O1({BigNumber:Re,Unit:dt,config:xe}),zR=Jb({BigNumber:Re,Unit:dt,config:xe}),$R=P1({BigNumber:Re,Unit:dt,config:xe}),HR=w1({BigNumber:Re,Unit:dt,config:xe}),GR=E1({BigNumber:Re,Unit:dt,config:xe}),WR=c1({BigNumber:Re,Unit:dt,config:xe}),jR=l0({Unit:dt,typed:Z}),Hr=$x({divideScalar:yr,equalScalar:Pt,inv:ao,matrix:ke,multiply:Gt,typed:Z}),ZR=p1({BigNumber:Re,Unit:dt,config:xe}),iu=eb({gamma:Jp,typed:Z}),JR=N1({BigNumber:Re,Unit:dt,config:xe}),YR=V1({BigNumber:Re,Unit:dt,config:xe}),XR=o1({BigNumber:Re,Unit:dt,config:xe}),Hw=Cx({DenseMatrix:Tt,lsolve:Cw,lup:qw,matrix:ke,slu:Fw,typed:Z,usolve:$p}),QR=s1({BigNumber:Re,Unit:dt,config:xe}),KR=L1({BigNumber:Re,Unit:dt,config:xe}),ek=rb({add:Rt,divide:Hr,factorial:iu,isInteger:Mn,isPositive:to,multiply:Gt,typed:Z}),tk=nb({factorial:iu,typed:Z}),rk=q1({BigNumber:Re,Unit:dt,config:xe}),nk=Sx({add:Rt,cbrt:Dw,divide:Hr,equalScalar:Pt,im:kp,isZero:yi,multiply:Gt,re:Lp,sqrt:xi,subtract:Dr,typeOf:bw,typed:Z,unaryMinus:Bi}),ik=z0({compareNatural:Oi,typed:Z}),ak=dy({abs:yn,add:Rt,bignumber:Vn,divide:Hr,isNegative:ba,isPositive:to,larger:wn,map:ro,matrix:ke,max:Zp,multiply:Gt,smaller:bn,subtract:Dr,typed:Z,unaryMinus:Bi}),Gw=db({bignumber:Vn,addScalar:Rr,combinations:wl,divideScalar:yr,factorial:iu,isInteger:Mn,isNegative:ba,larger:wn,multiplyScalar:Ar,number:ji,pow:ii,subtractScalar:ri,typed:Z}),ok=s0({Unit:dt,typed:Z}),sk=hb({addScalar:Rr,isInteger:Mn,isNegative:ba,stirlingS2:Gw,typed:Z}),Ww=kx({abs:yn,add:Rt,addScalar:Rr,atan:hw,bignumber:Vn,column:Uw,complex:_l,config:xe,cos:Pp,diag:Ew,divideScalar:yr,dot:El,equal:ni,flatten:nu,im:kp,inv:ao,larger:wn,matrix:ke,matrixFromColumns:qp,multiply:Gt,multiplyScalar:Ar,number:ji,qr:zp,re:Lp,reshape:_w,sin:Al,size:Qr,smaller:bn,sqrt:xi,subtract:Dr,typed:Z,usolve:$p,usolveAll:Iw}),uk=m1({BigNumber:Re,Unit:dt,config:xe}),lk=T1({BigNumber:Re,Unit:dt,config:xe}),jw=dl({add:Rt,divide:Hr,typed:Z}),ck=I1({BigNumber:Re,Unit:dt,config:xe}),fk=Xb({BigNumber:Re,Unit:dt,config:xe}),pk=gl({bignumber:Vn,add:Rt,compare:io,divide:Hr,isInteger:Mn,larger:wn,multiply:Gt,partitionSelect:Cl,smaller:bn,smallerEq:Yo,subtract:Dr,typed:Z}),Yp=hl({add:Rt,apply:Vp,divide:Hr,isNaN:eu,multiply:Gt,subtract:Dr,typed:Z}),mk=f1({BigNumber:Re,Unit:dt,config:xe}),Zw=Wx({add:Rt,compare:io,divide:Hr,partitionSelect:Cl,typed:Z}),dk=Jx({add:Rt,divide:Hr,matrix:ke,mean:jw,multiply:Gt,pow:ii,sqrt:xi,subtract:Dr,sum:Wp,typed:Z}),hk=Mb({Complex:ir,add:Rt,divide:Hr,matrix:ke,multiply:Gt,typed:Z}),gk=jx({abs:yn,map:ro,median:Zw,subtract:Dr,typed:Z}),vk=vl({map:ro,sqrt:xi,typed:Z,variance:Yp}),yk=gy({BigNumber:Re,Complex:ir,add:Rt,config:xe,divide:Hr,equal:ni,factorial:iu,gamma:Jp,isNegative:ba,multiply:Gt,pi:Bp,pow:ii,sin:Al,smallerEq:Yo,subtract:Dr,typed:Z}),Xp=j0({abs:yn,add:Rt,conj:eo,ctranspose:Up,eigs:Ww,equalScalar:Pt,larger:wn,matrix:ke,multiply:Gt,pow:ii,smaller:bn,sqrt:xi,typed:Z}),Jw=iy({BigNumber:Re,DenseMatrix:Tt,SparseMatrix:Zi,addScalar:Rr,config:xe,cos:Pp,matrix:ke,multiplyScalar:Ar,norm:Xp,sin:Al,typed:Z,unaryMinus:Bi}),xk=tb({divide:Hr,dotDivide:ru,isNumeric:no,log:Gp,map:ro,matrix:ke,multiply:Gt,sum:Wp,typed:Z}),bk=z1({BigNumber:Re,Unit:dt,config:xe}),Yw=qx({identity:wa,matrix:ke,multiply:Gt,norm:Xp,qr:zp,subtract:Dr,typed:Z}),wk=ny({multiply:Gt,rotationMatrix:Jw,typed:Z}),Xw=Ux({abs:yn,add:Rt,concat:Ht,identity:wa,index:Rw,lusolve:Hw,matrix:ke,matrixFromColumns:qp,multiply:Gt,range:Xo,schur:Yw,subset:Un,subtract:Dr,transpose:tu,typed:Z}),_k=zx({matrix:ke,multiply:Gt,sylvester:Xw,transpose:tu,typed:Z});var au={},ou={},Ak={},_n=X0({mathWithTransform:ou}),su=lx({Node:_n}),_a=cx({Node:_n}),Qo=fx({Node:_n}),Dk=mx({Node:_n}),uu=K0({Node:_n}),Ek=tx({Node:_n,ResultSet:mw}),Ck=rx({Node:_n}),oo=ox({Node:_n}),Sk=px({Node:_n}),rZ=Tb({classes:Ak}),Qw=Mx({math:au,typed:Z}),Nk=sx({Node:_n,typed:Z}),nZ=Bx({Chain:Qw,typed:Z}),lu=ux({Node:_n,size:Qr}),cu=Q0({Node:_n,subset:Un}),Mk=ex({matrix:ke,Node:_n,subset:Un}),so=dx({Unit:dt,Node:_n,math:au}),uo=hx({Node:_n,SymbolNode:so,math:au}),Pi=gx({AccessorNode:cu,ArrayNode:uu,AssignmentNode:Mk,BlockNode:Ek,ConditionalNode:Ck,ConstantNode:oo,FunctionAssignmentNode:Nk,FunctionNode:uo,IndexNode:lu,ObjectNode:su,OperatorNode:_a,ParenthesisNode:Qo,RangeNode:Sk,RelationalNode:Dk,SymbolNode:so,config:xe,numeric:bi,typed:Z}),Tk=Db({ConstantNode:oo,FunctionNode:uo,OperatorNode:_a,ParenthesisNode:Qo,parse:Pi,typed:Z}),Kw=_b({bignumber:Vn,fraction:Zo,AccessorNode:cu,ArrayNode:uu,ConstantNode:oo,FunctionNode:uo,IndexNode:lu,ObjectNode:su,OperatorNode:_a,SymbolNode:so,config:xe,mathWithTransform:ou,matrix:ke,typed:Z}),e_=vx({parse:Pi,typed:Z}),Fk=Nx({parse:Pi}),iZ=yb({parse:Pi,typed:Z}),t_=Ab({AccessorNode:cu,ArrayNode:uu,ConstantNode:oo,FunctionNode:uo,IndexNode:lu,ObjectNode:su,OperatorNode:_a,ParenthesisNode:Qo,SymbolNode:so,add:Rt,divide:Hr,equal:ni,isZero:yi,multiply:Gt,parse:Pi,pow:ii,subtract:Dr,typed:Z}),Ik=yx({parse:Pi,typed:Z}),aZ=Ix({Help:Fk,mathWithTransform:ou,typed:Z}),Bk=xx({evaluate:Ik}),Qp=wb({bignumber:Vn,fraction:Zo,AccessorNode:cu,ArrayNode:uu,ConstantNode:oo,FunctionNode:uo,IndexNode:lu,ObjectNode:su,OperatorNode:_a,ParenthesisNode:Qo,SymbolNode:so,add:Rt,config:xe,divide:Hr,equal:ni,isZero:yi,mathWithTransform:ou,matrix:ke,multiply:Gt,parse:Pi,pow:ii,resolve:Tk,simplifyConstant:Kw,simplifyCore:t_,subtract:Dr,typed:Z}),oZ=Eb({OperatorNode:_a,parse:Pi,simplify:Qp,typed:Z}),sZ=bx({Parser:Bk,typed:Z}),uZ=Sb({bignumber:Vn,fraction:Zo,AccessorNode:cu,ArrayNode:uu,ConstantNode:oo,FunctionNode:uo,IndexNode:lu,ObjectNode:su,OperatorNode:_a,ParenthesisNode:Qo,SymbolNode:so,add:Rt,config:xe,divide:Hr,equal:ni,isZero:yi,mathWithTransform:ou,matrix:ke,multiply:Gt,parse:Pi,pow:ii,simplify:Qp,simplifyConstant:Kw,simplifyCore:t_,subtract:Dr,typed:Z}),lZ=Cb({ConstantNode:oo,FunctionNode:uo,OperatorNode:_a,ParenthesisNode:Qo,SymbolNode:so,config:xe,equal:ni,isZero:yi,numeric:bi,parse:Pi,simplify:Qp,typed:Z});mr(au,{e:fw,false:iP,fineStructure:aP,i:pw,Infinity:oP,LN10:sP,LOG10E:uP,NaN:lP,null:cP,phi:fP,SQRT1_2:mP,sackurTetrode:dP,tau:dw,true:hP,E:fw,version:gP,efimovFactor:vP,LN2:yP,pi:Bp,replacer:xP,reviver:rZ,SQRT2:bP,typed:Z,unaryPlus:Op,PI:Bp,weakMixingAngle:wP,abs:yn,acos:_P,acot:AP,acsc:DP,addScalar:Rr,arg:EP,asech:CP,asinh:SP,atan:hw,atanh:NP,bignumber:Vn,bitNot:MP,boolean:TP,clone:FP,combinations:wl,complex:_l,conj:eo,cos:Pp,cot:IP,csc:BP,cube:OP,equalScalar:Pt,erf:PP,exp:gw,expm1:RP,filter:kP,forEach:LP,format:Ks,getMatrixDataType:Rp,hex:VP,im:kp,isInteger:Mn,isNegative:ba,isPositive:to,isZero:yi,LOG2E:UP,lgamma:qP,log10:zP,log2:vw,map:ro,multiplyScalar:Ar,not:yw,number:ji,oct:$P,pickRandom:HP,print:GP,random:WP,re:Lp,sec:jP,sign:xw,sin:Al,splitUnit:ZP,square:JP,string:YP,subtractScalar:ri,tan:XP,typeOf:bw,acosh:QP,acsch:KP,apply:Vp,asec:e3,bin:t3,chain:nZ,combinationsWithRep:r3,cosh:n3,csch:i3,isNaN:eu,isPrime:a3,randomInt:o3,sech:s3,sinh:u3,sparse:l3,sqrt:xi,tanh:c3,unaryMinus:Bi,acoth:f3,coth:p3,fraction:Zo,isNumeric:no,matrix:ke,matrixFromFunction:m3,mode:d3,numeric:bi,prod:ww,reshape:_w,size:Qr,squeeze:h3,transpose:tu,xgcd:Aw,zeros:xn,asin:g3,cbrt:Dw,concat:Ht,count:v3,ctranspose:Up,diag:Ew,divideScalar:yr,dotDivide:ru,equal:ni,flatten:nu,hasNumericValue:y3,identity:wa,kron:x3,largerEq:Dl,leftShift:b3,lsolve:Cw,matrixFromColumns:qp,nthRoot:w3,ones:_3,qr:zp,resize:A3,rightArithShift:D3,round:Jo,smaller:bn,subtract:Dr,to:E3,unequal:C3,usolve:$p,xor:S3,add:Rt,atan2:N3,bitAnd:M3,bitXor:T3,catalan:F3,compare:io,compareText:Sw,cumsum:I3,deepEqual:Hp,diff:B3,distance:O3,dot:El,equalText:P3,floor:Nw,gcd:R3,hypot:k3,larger:wn,log:Gp,lsolveAll:L3,matrixFromRows:V3,min:U3,mod:Tw,multiply:Gt,nthRoots:q3,or:z3,partitionSelect:Cl,rightLogShift:$3,slu:Fw,subset:Un,sum:Wp,trace:H3,usolveAll:Iw,zpk2tf:G3,bitOr:W3,ceil:jp,compareNatural:Oi,composition:j3,cross:Z3,det:Bw,dotMultiply:J3,fix:Pw,index:Rw,intersect:Y3,invmod:X3,lcm:Q3,log1p:K3,max:Zp,setCartesian:eR,setDistinct:tR,setIsSubset:rR,setPowerset:nR,smallerEq:Yo,sort:iR,and:aR,range:Xo,row:oR,setDifference:kw,setMultiplicity:sR,setSymDifference:Lw,column:Uw,inv:ao,lup:qw,pinv:uR,pow:ii,setIntersect:zw,setUnion:lR,sqrtm:cR,vacuumImpedance:fR,wienDisplacement:pR,atomicMass:mR,bohrMagneton:dR,boltzmann:hR,conductanceQuantum:gR,coulomb:vR,deuteronMass:yR,dotPow:xR,electricConstant:bR,elementaryCharge:wR,expm:_R,faraday:AR,fft:$w,gamma:Jp,gravitationConstant:DR,hartreeEnergy:ER,ifft:CR,klitzing:SR,loschmidt:NR,magneticConstant:MR,molarMass:TR,molarPlanckConstant:FR,neutronMass:IR,nuclearMagneton:BR,planckCharge:OR,planckLength:PR,planckTemperature:RR,protonMass:kR,quantumOfCirculation:LR,reducedPlanckConstant:VR,rydberg:UR,secondRadiation:qR,speedOfLight:zR,stefanBoltzmann:$R,thomsonCrossSection:HR,avogadro:GR,bohrRadius:WR,createUnit:jR,divide:Hr,electronMass:ZR,factorial:iu,firstRadiation:JR,gravity:YR,inverseConductanceQuantum:XR,lusolve:Hw,magneticFluxQuantum:QR,molarMassC12:KR,multinomial:ek,parse:Pi,permutations:tk,planckMass:rk,polynomialRoot:nk,resolve:Tk,setSize:ik,simplifyConstant:Kw,solveODE:ak,stirlingS2:Gw,unit:ok,bellNumbers:sk,compile:e_,eigs:Ww,fermiCoupling:uk,gasConstant:lk,leafCount:iZ,mean:jw,molarVolume:ck,planckConstant:fk,quantileSeq:pk,simplifyCore:t_,variance:Yp,classicalElectronRadius:mk,evaluate:Ik,help:aZ,median:Zw,simplify:Qp,symbolicEqual:oZ,corr:dk,freqz:hk,mad:gk,parser:sZ,rationalize:uZ,std:vk,zeta:yk,derivative:lZ,norm:Xp,rotationMatrix:Jw,kldivergence:xk,planckTime:bk,schur:Yw,rotate:wk,sylvester:Xw,lyap:_k,config:xe});mr(ou,au,{filter:j1({typed:Z}),forEach:Z1({typed:Z}),map:Y1({typed:Z}),apply:G1({isInteger:Mn,typed:Z}),concat:nw({isInteger:Mn,matrix:ke,typed:Z}),max:X1({config:xe,larger:wn,numeric:bi,typed:Z}),print:cw({add:Rt,matrix:ke,typed:Z,zeros:xn}),diff:iw({bignumber:Vn,matrix:ke,number:ji,subtract:Dr,typed:Z}),min:K1({config:xe,numeric:bi,smaller:bn,typed:Z}),subset:rw({add:Rt,matrix:ke,typed:Z,zeros:xn}),cumsum:uw({add:Rt,typed:Z,unaryPlus:Op}),index:J1({Index:un,getMatrixDataType:Rp}),sum:ow({add:Rt,config:xe,numeric:bi,typed:Z}),range:ew({bignumber:Vn,matrix:ke,add:Rt,config:xe,isPositive:to,larger:wn,largerEq:Dl,smaller:bn,smallerEq:Yo,typed:Z}),row:tw({Index:un,matrix:ke,range:Xo,typed:Z}),column:W1({Index:un,matrix:ke,range:Xo,typed:Z}),mean:Q1({add:Rt,divide:Hr,typed:Z}),quantileSeq:sw({add:Rt,bignumber:Vn,compare:io,divide:Hr,isInteger:Mn,larger:wn,multiply:Gt,partitionSelect:Cl,smaller:bn,smallerEq:Yo,subtract:Dr,typed:Z}),variance:lw({add:Rt,apply:Vp,divide:Hr,isNaN:eu,multiply:Gt,subtract:Dr,typed:Z}),std:aw({map:ro,sqrt:xi,typed:Z,variance:Yp})});mr(Ak,{BigNumber:Re,Complex:ir,Fraction:Ka,Matrix:bl,Node:_n,ObjectNode:su,OperatorNode:_a,ParenthesisNode:Qo,Range:pP,RelationalNode:Dk,ResultSet:mw,ArrayNode:uu,BlockNode:Ek,ConditionalNode:Ck,ConstantNode:oo,DenseMatrix:Tt,RangeNode:Sk,Chain:Qw,FunctionAssignmentNode:Nk,SparseMatrix:Zi,IndexNode:lu,ImmutableDenseMatrix:Mw,Index:un,AccessorNode:cu,AssignmentNode:Mk,FibonacciHeap:Ow,Spa:Vw,Unit:dt,SymbolNode:so,FunctionNode:uo,Help:Fk,Parser:Bk});Qw.createProxy(au);var Kp=class extends Ua{constructor(t){super(t);this.hidden=!1,this.hasError=!1}buildVariables(t){var a;let r=0;this.expressionStr="";let i=[];for(let o of(a=t.templateDeclaration)!=null?a:[])if(typeof o!="string"){let l={bindTargetDeclaration:o,inputSignal:new Or(void 0),uuid:jt(),contextName:`MB_VAR_${r}`};i.push(l),this.expressionStr+=l.contextName,r+=1}else this.expressionStr+=o;return this.expression=e_(this.expressionStr),i}_render(t){}_update(t,r){this.hasError?t.addClass("mb-error"):t.removeClass("mb-error"),t.innerText=r}destroy(){}buildContext(t){var i;let r={};for(let a of t!=null?t:[])!a.contextName||!a.inputSignal||(r[a.contextName]=(i=a.inputSignal.get())!=null?i:"");return r}computeValue(t){if(this.hasError=!1,!this.expression)return this.handleComputeError(new ia({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let r=this.buildContext(t);try{return this.expression.evaluate(r).toString()}catch(i){return i instanceof Error?this.handleComputeError(new ia({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:i,context:{expression:this.expressionStr,context:r}})):this.handleComputeError(new Error("failed to evaluate js expression because of: unexpected thrown value"))}}getDefaultDisplayValue(){return""}handleComputeError(t){return this.hasError=!0,console.warn(t),t.message}};var tm=require("obsidian");var em=class extends Ua{constructor(t){super(t);this.renderMarkdown=!1,this.markdownComponent=new tm.Component}buildVariables(t){var a;this.textParts=[];let r=0,i=[];for(let o of(a=t.templateDeclaration)!=null?a:[])if(typeof o!="string"){let l={bindTargetDeclaration:o,inputSignal:new Or(void 0),uuid:jt(),contextName:`MB_VAR_${r}`};i.push(l),this.textParts.push(r),r+=1}else this.textParts.push(o);return i}_render(t){var r,i;this.renderMarkdown=(i=(r=this.renderChild.getArgument("renderMarkdown"))==null?void 0:r.value)!=null?i:!1,this.markdownComponent.load(),this.renderMarkdown&&t.addClass("mb-view-markdown")}async _update(t,r){this.renderMarkdown?(this.markdownComponent.unload(),this.markdownComponent.load(),await tm.MarkdownRenderer.render(this.renderChild.plugin.app,r,t,this.renderChild.filePath,this.markdownComponent)):t.innerText=r}destroy(){this.markdownComponent.unload()}computeValue(t){if(!this.textParts)throw new ia({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(r=>typeof r=="number"?kc(t[r].inputSignal.get(),this.renderChild.plugin.settings.viewFieldDisplayNullAsEmpty):r).join("")}getDefaultDisplayValue(){return""}};function cZ(n){let e,t;return e=new sf({props:{elements:n[0],$$slots:{default:[mZ,({element:r})=>({1:r}),({element:r})=>r?2:0]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.elements=r[0]),i&6&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function fZ(n){let e,t;return e=new Va({props:{mdLink:n[0][0]}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.mdLink=r[0][0]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function pZ(n){let e;return{c(){e=j("span")},m(t,r){Y(t,e,r)},p:Se,i:Se,o:Se,d(t){t&&J(e)}}}function mZ(n){let e,t;return e=new Va({props:{mdLink:n[1]}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.mdLink=r[1]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function dZ(n){let e,t,r,i,a=[pZ,fZ,cZ],o=[];function l(u,s){return u[0].length===0?0:u[0].length===1?1:2}return e=l(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=or()},m(u,s){o[e].m(u,s),Y(u,r,s),i=!0},p(u,[s]){let c=e;e=l(u,s),e===c?o[e].p(u,s):(gt(),ae(o[c],1,1,()=>{o[c]=null}),vt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),te(t,1),t.m(r.parentNode,r))},i(u){i||(te(t),i=!0)},o(u){ae(t),i=!1},d(u){u&&J(r),o[e].d(u)}}}function hZ(n,e,t){let{mdLinkList:r}=e;return n.$$set=i=>{"mdLinkList"in i&&t(0,r=i.mdLinkList)},[r]}var r_=class extends Ve{constructor(e){super(),qe(this,e,hZ,dZ,Ue,{mdLinkList:0})}},n_=r_;var rm=class extends Ua{constructor(t){super(t)}buildVariables(t){let r=t.templateDeclaration.filter(o=>typeof o=="string"?o:!0);if(r.length!==1)throw new xu({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});let i=r[0];if(typeof i=="string")throw new xu({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});return[{bindTargetDeclaration:i,inputSignal:new Or(void 0),uuid:jt(),contextName:"MB_VAR_0"}]}_render(t){this.component=new n_({target:t,props:{mdLinkList:[]}})}async _update(t,r){let i=tn.parseLinkList(r);this.component=new n_({target:t,props:{mdLinkList:i}})}destroy(){var t;(t=this.component)==null||t.$destroy()}computeValue(t){if(t.length!==1)throw new ia({errorLevel:"CRITICAL",effect:"failed to evaluate link view field",cause:"there should be exactly one variable"});let i=t[0].inputSignal.get();return typeof i=="string"?this.convertToLink(i):Array.isArray(i)?i.filter(o=>typeof o=="string").map(o=>this.convertToLink(o)).filter(o=>o!=="").join(", "):""}convertToLink(t){return tn.isLink(t)?t:tn.isLink(`[[${t}]]`)?`[[${t}]]`:this.getUrl(t)?`[${this.getUrl(t).hostname}](${t})`:""}getUrl(t){try{return new URL(t)}catch(r){return}}getDefaultDisplayValue(){return""}};var nm=class{constructor(e){this.plugin=e}createViewField(e,t){if(e==="math")return new Kp(t);if(e==="text")return new em(t);if(e==="link")return new rm(t)}};var im=class{constructor(){this.buttons=new Map,this.buttonLoadListeners=new Map}registerButtonLoadListener(e,t,r){let i=this.getButton(e,t);i&&r(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(t)||a.set(t,new Map);let o=a.get(t),l=jt();return o.set(l,r),()=>this.removeButtonLoadListener(e,t,l)}notifyButtonLoadListeners(e,t){let r=this.getButton(e,t);if(!r)throw new Error(`ButtonManager | button with id ${t} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);if(a)for(let[o,l]of a)l(r)}removeButtonLoadListener(e,t,r){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(r),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){if(t.id===void 0)throw new Error("ButtonManager | button id is undefined");this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(t.id,t),this.notifyButtonLoadListeners(e,t.id)}getButtons(e){return this.buttons.get(e)}getButton(e,t){let r=this.buttons.get(e);if(r)return r.get(t)}removeButton(e,t){let r=this.buttons.get(e);r&&(r.delete(t),r.size===0&&this.buttons.delete(e))}};var am=class{constructor(e){this.plugin=e}createDefaultAction(e){if(e==="command")return{type:"command",command:""};if(e==="open")return{type:"open",link:""};if(e==="js")return{type:"js",file:""};if(e==="input")return{type:"input",str:""};if(e==="sleep")return{type:"sleep",ms:0};if(e==="templaterCreateNote")return{type:"templaterCreateNote",templateFile:"",folderPath:"",fileName:"",openNote:!0};throw new Error(`Unknown button action type: ${e}`)}async runAction(e,t){if(e.type==="command"){await this.runCommandAction(e);return}else if(e.type==="js"){await this.runJSAction(e,t);return}else if(e.type==="open"){await this.runOpenAction(e,t);return}else if(e.type==="input"){await this.runInputAction(e);return}else if(e.type==="sleep"){await this.runSleepAction(e);return}else if(e.type==="templaterCreateNote"){await this.runTemplaterCreateNoteAction(e);return}throw new Error("Unknown button action type")}async runCommandAction(e){this.plugin.internal.executeCommandById(e.command)}async runJSAction(e,t){(await this.plugin.internal.jsEngineRunFile(e.file,t))()}async runOpenAction(e,t){let r=tn.parseLinkOrUrl(e.link);r.internal?this.plugin.internal.openFile(r.target,t):wt.open(r.target)}async runInputAction(e){let t=document.activeElement;t&&t instanceof HTMLInputElement&&(t.setRangeText(e.str,t.selectionStart,t.selectionEnd,"end"),t.trigger("input"))}async runSleepAction(e){await new Promise(t=>setTimeout(t,e.ms))}async runTemplaterCreateNoteAction(e){throw new Error("Not supported")}};var sm=require("obsidian"),om=class extends am{constructor(t){super(t);this.plugin=t}async runTemplaterCreateNoteAction(t){var o,l;let r=this.plugin.app.plugins.getPlugin("templater-obsidian");if(!r)throw new Error("Templater plugin not found");let i=r.templater,a=this.plugin.app.vault.getAbstractFileByPath(t.templateFile);if(!a||!(a instanceof sm.TFile))throw new Error(`Template file not found: ${t.templateFile}`);if(t.folderPath===void 0)await i.create_new_note_from_template(a,void 0,t.fileName,(o=t.openNote)!=null?o:!0);else{let u=this.plugin.app.vault.getAbstractFileByPath(t.folderPath);if(!u||!(u instanceof sm.TFolder))throw new Error(`Folder not found: ${t.folderPath}`);await i.create_new_note_from_template(a,u,t.fileName,(l=t.openNote)!=null?l:!0)}}};var Ok=require("obsidian");function i_(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(r.next(c))}catch(f){o(f)}}function u(c){try{s(r.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((r=r.apply(n,e||[])).next())})}function gZ(n){jr(n,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function vZ(n){let e,t,r,i;return{c(){e=j("button"),t=Pe(n[3]),L(e,"class","mb-button-inner svelte-12xcpmj"),L(e,"aria-label",n[2]),e.disabled=n[0],_t(e,"mod-cta",n[1]==="primary"),_t(e,"mod-warning",n[1]==="destructive"),_t(e,"mod-plain",n[1]==="plain"),_t(e,"disabled",n[0]),_t(e,"mb-error",n[4])},m(a,o){Y(a,e,o),z(e,t),r||(i=be(e,"click",n[7]),r=!0)},p(a,[o]){o&8&&rt(t,a[3]),o&4&&L(e,"aria-label",a[2]),o&1&&(e.disabled=a[0]),o&2&&_t(e,"mod-cta",a[1]==="primary"),o&2&&_t(e,"mod-warning",a[1]==="destructive"),o&2&&_t(e,"mod-plain",a[1]==="plain"),o&1&&_t(e,"disabled",a[0]),o&16&&_t(e,"mb-error",a[4])},i:Se,o:Se,d(a){a&&J(e),r=!1,i()}}}function yZ(n,e,t){let{variant:r="default"}=e,{disabled:i=!1}=e,{tooltip:a=""}=e,{label:o=""}=e,{error:l=!1}=e,{onClick:u=()=>i_(void 0,void 0,void 0,function*(){})}=e;function s(){return i_(this,void 0,void 0,function*(){if(!i){t(0,i=!0);try{yield u()}catch(f){console.log("failed to run button component on click",f)}finally{t(0,i=!1)}}})}let c=()=>s();return n.$$set=f=>{"variant"in f&&t(1,r=f.variant),"disabled"in f&&t(0,i=f.disabled),"tooltip"in f&&t(2,a=f.tooltip),"label"in f&&t(3,o=f.label),"error"in f&&t(4,l=f.error),"onClick"in f&&t(6,u=f.onClick)},[i,r,a,o,l,s,u,c]}var a_=class extends Ve{constructor(e){super(),qe(this,e,yZ,vZ,Ue,{variant:1,disabled:0,tooltip:2,label:3,error:4,onClick:6},gZ)}},Sl=a_;var lo=class extends fn{constructor(t,r,i,a,o){super(t,"block",i,a,o);this.content=r}createErrorIndicator(t){new Jn({target:t,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.content}})}async runAction(t){if(t.action)await this.plugin.api.buttonActionRunner.runAction(t.action,this.filePath);else if(t.actions)for(let r of t.actions)await this.plugin.api.buttonActionRunner.runAction(r,this.filePath);else console.error("meta-bind | ButtonMDRC >> no action defined")}onload(){console.log("meta-bind | ButtonMDRC >> onload"),this.containerEl.addClass("mb-button","mb-button-block"),this.plugin.mdrcManager.registerMDRC(this);let t=(0,Ok.parseYaml)(this.content),r=gA.safeParse(t);if(!r.success){this.errorCollection.add(new Jl({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:r.error.message,docs:[wt.linkToButtonConfig()]})),this.createErrorIndicator(this.containerEl);return}this.buttonConfig=r.data,this.buttonConfig.id&&this.plugin.api.buttonManager.addButton(this.filePath,this.buttonConfig),!this.buttonConfig.hidden&&(this.buttonComponent=new Sl({target:this.containerEl,props:{variant:this.buttonConfig.style,label:this.buttonConfig.label,onClick:async()=>{await this.runAction(this.buttonConfig)}}}))}onunload(){var t,r;console.log("meta-bind | ButtonMDRC >> onunload"),(t=this.buttonConfig)!=null&&t.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.buttonConfig.id),(r=this.buttonComponent)==null||r.$destroy(),this.containerEl.empty(),this.containerEl.addClass("mb-error"),this.containerEl.innerText="unloaded meta bind button",this.plugin.mdrcManager.unregisterMDRC(this)}};var Nl=gr(ui());var Pk=gr(si()),xZ=Nl.P.sequenceMap((n,e)=>e,Nl.P.string("BUTTON"),Nl.P.manyNotOf("[],").separateBy(Nl.P.string(",").trim(Pk.P_UTILS.optionalWhitespace())).wrapString("[","]")),um=class{static parseString(e){return Jr(xZ,e)}};var Rk=require("obsidian"),lm=class extends fn{constructor(t,r,i,a,o){super(t,"inline",i,a,o);this.content=r,this.callbackComponent=new Rk.Component}createErrorIndicator(t){new Jn({target:t,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.content}})}async runAction(t){if(t.action)await this.plugin.api.buttonActionRunner.runAction(t.action,this.filePath);else if(t.actions)for(let r of t.actions)await this.plugin.api.buttonActionRunner.runAction(r,this.filePath);else console.error("ButtonMDRC | no action defined")}render(t,r){r.empty(),this.buttonComponent=new Sl({target:r,props:{variant:t.style,label:t.label,onClick:async()=>{await this.runAction(t)}}})}renderInitialButton(t){this.buttonComponent=new Sl({target:t,props:{variant:"default",label:"Button ID not Found",error:!0,onClick:async()=>{}}})}onload(){console.log("meta-bind | InlineButtonMDRC >> onload"),this.containerEl.empty(),this.containerEl.addClass("mb-button-group"),this.plugin.mdrcManager.registerMDRC(this),this.callbackComponent.load();let t=[];try{t=um.parseString(this.content)}catch(r){this.errorCollection.add(r),this.createErrorIndicator(this.containerEl);return}for(let r of t){let i=this.containerEl.createSpan();i.addClass("mb-button","mb-button-inline"),this.renderInitialButton(i),this.callbackComponent.register(this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,r,a=>this.render(a,i)))}}onunload(){var t;console.log("meta-bind | InlineButtonMDRC >> onunload"),this.callbackComponent.unload(),(t=this.buttonComponent)==null||t.$destroy(),this.containerEl.empty(),this.containerEl.addClass("mb-error"),this.containerEl.innerText="unloaded meta bind button",this.plugin.mdrcManager.unregisterMDRC(this)}};var Ml=gr(ui());var Er=gr(si());var ht=class n{static sequence(...e){return Ml.P.sequenceMap((...t)=>t.flat(2).filter(r=>r!==void 0),...e)}static separateBy(e,t){return n.sequence(e,n.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((r,i)=>[new Tl(i,t)])}static highlightStr(e,t){return n.highlight(Ml.P.string(e),t)}},o_=ht.highlight(Dn,"ident"),cm=ht.highlight(Dn,"keyword"),s_=ht.highlightStr(",","control"),fm=ht.highlightStr("(","control"),pm=ht.highlightStr(")","control"),fu=ht.highlightStr("[","control"),pu=ht.highlightStr("]","control"),bZ=ht.highlight(_d,"string"),wZ=ht.highlight(Ad,"ident"),_Z=Ml.P.or(wZ,bZ),AZ=ht.separateBy(_Z,s_.trim(Er.P_UTILS.optionalWhitespace())),DZ=ht.sequence(cm,ht.sequence(fm,AZ.trim(Er.P_UTILS.optionalWhitespace()),pm).optional()),u_=ht.separateBy(DZ,s_.trim(Er.P_UTILS.optionalWhitespace())),mu=ht.sequence(ht.sequence(o_,ht.highlightStr("^","control")).optional(),ht.sequence(ht.highlight(Fu,"ident"),ht.highlightStr("#","control")).optional(),ht.highlight(Cd,"ident")),EZ=ht.sequence(cm.trim(Er.P_UTILS.optionalWhitespace()),ht.sequence(fm,u_.trim(Er.P_UTILS.optionalWhitespace()),pm).trim(Er.P_UTILS.optionalWhitespace()).optional(),ht.sequence(ht.highlightStr(":","control").trim(Er.P_UTILS.optionalWhitespace()),mu).trim(Er.P_UTILS.optionalWhitespace()).optional()),CZ=ht.sequence(cm.trim(Er.P_UTILS.optionalWhitespace()).optional(),ht.sequence(fm,u_.trim(Er.P_UTILS.optionalWhitespace()),pm).trim(Er.P_UTILS.optionalWhitespace()).optional(),ht.sequence(ht.highlightStr(":","control").trim(Er.P_UTILS.optionalWhitespace()),mu).trim(Er.P_UTILS.optionalWhitespace()).optional()),Lk=Ml.P.or(ht.sequence(ht.highlightStr("INPUT","control"),fu,o_.trim(Er.P_UTILS.optionalWhitespace()),pu.skip(Er.P_UTILS.optionalWhitespace()),fu,CZ,pu),ht.sequence(ht.highlightStr("INPUT","control"),fu,EZ,pu)),kk=ht.highlight(Dc,"ident"),SZ=ht.sequence(ht.highlightStr("{","string"),mu,ht.highlightStr("}","string")),NZ=ht.sequence(kk,ht.sequence(SZ,kk).many()),MZ=ht.sequence(cm.trim(Er.P_UTILS.optionalWhitespace()).optional(),ht.sequence(fm,u_.trim(Er.P_UTILS.optionalWhitespace()).optional(),pm).trim(Er.P_UTILS.optionalWhitespace()).optional(),ht.sequence(ht.highlightStr(":","control").trim(Er.P_UTILS.optionalWhitespace()),mu).trim(Er.P_UTILS.optionalWhitespace()).optional()),Vk=ht.sequence(ht.highlightStr("VIEW","control"),fu,NZ,pu,ht.sequence(fu.skip(Er.P_UTILS.optionalWhitespace()),MZ,pu).optional()),Uk=ht.sequence(ht.highlightStr("BUTTON","control"),fu,ht.separateBy(o_,s_.trim(Er.P_UTILS.optionalWhitespace())),pu);var qk=require("@codemirror/view");var Fl=class extends qk.WidgetType{constructor(t,r,i,a){super();this.content=t,this.filePath=r,this.parentComponent=i,this.plugin=a}eq(t){return t.content===this.content}toDOM(t){let r=document.createElement("span");return r.addClass("cm-inline-code"),this.renderChild=this.createRenderChild(r,this.parentComponent),r}destroy(t){var r;(r=this.renderChild)==null||r.unload(),super.destroy(t)}},mm=class extends Fl{createRenderChild(e,t){return Tn.createInlineInputFieldMDRC(this.content,this.filePath,e,t,this.plugin)}},dm=class extends Fl{createRenderChild(e,t){return Tn.createInlineViewFieldMDRC(this.content,this.filePath,e,t,this.plugin)}},hm=class extends Fl{createRenderChild(e,t){return Tn.createInlineButtonMDRC(this.content,this.filePath,e,t,this.plugin)}};var Tn=class n{static getDeclarationPrefix(e){if(e==="INPUT_FIELD")return"INPUT";if(e==="VIEW_FIELD")return"VIEW";if(e==="BUTTON")return"BUTTON";throw new ln({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}static isDeclaration(e,t){let r=n.getDeclarationPrefix(e)+"[",i="]";return t.startsWith(r)&&t.endsWith(i)}static isDeclarationAndGetMDRCType(e){if(e.endsWith("]"))for(let t of Object.values(gm)){let r=n.getDeclarationPrefix(t)+"[";if(e.startsWith(r))return t}}static constructMDRCWidget(e,t,r,i,a){if(e==="INPUT_FIELD")return new mm(t,r,i,a);if(e==="VIEW_FIELD")return new dm(t,r,i,a);if(e==="BUTTON")return new hm(t,r,i,a);throw new ln({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}static constructMDRC(e,t,r,i,a,o){if(e==="INPUT_FIELD")return n.createInlineInputFieldMDRC(t,r,i,a,o);if(e==="VIEW_FIELD")return n.createInlineViewFieldMDRC(t,r,i,a,o);if(e==="BUTTON")return n.createInlineButtonMDRC(t,r,i,a,o);throw new ln({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}static createInlineInputFieldMDRC(e,t,r,i,a){return a.api.createInputFieldFromString(e,"inline",t,r,i)}static createInlineViewFieldMDRC(e,t,r,i,a){return a.api.createViewFieldFromString(e,"inline",t,r,i)}static createInlineButtonMDRC(e,t,r,i,a){return a.api.createInlineButtonFromString(e,t,r,i)}},gm=(r=>(r.INPUT_FIELD="INPUT_FIELD",r.VIEW_FIELD="VIEW_FIELD",r.BUTTON="BUTTON",r))(gm||{});var zk=gr(si()),Tl=class{constructor(e,t){this.range=e,this.tokenClass=t}},co=class{constructor(e,t,r){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=r}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e;return this.str[this.parsingError.parseFailure.furthest.index]===` `?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 Tl({from:this.parsingError.parseFailure.furthest,to:e},"error")]}},vm=class{constructor(e){this.plugin=e,this.api=e.api}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,Lk)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,Vk)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,Uk)}highlight(e,t,r){if(t==="INPUT_FIELD")return this.highlightInputFieldDeclaration(e,r);if(t==="VIEW_FIELD")return this.highlightViewFieldDeclaration(e,r);if(t==="BUTTON")return this.highlightInlineButtonDeclaration(e,r);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,mu)}highlightWithParser(e,t,r){try{return t?new co(e,Jr(r.trim(zk.P_UTILS.optionalWhitespace()).thenEof(),e)):new co(e,Jr(r.thenEof(),e))}catch(i){return i instanceof Iu?new co(e,[],i):(console.error(i),new co(e,[]))}}};var ym=class{constructor(e){this.plugin=e,this.inputField=new Xc(this),this.inputFieldParser=new Yc(this.plugin),this.viewFieldParser=new Mc(this.plugin),this.bindTargetParser=new Tc(this.plugin),this.inputFieldFactory=new wf(this.plugin),this.viewFieldFactory=new nm(this.plugin),this.buttonActionRunner=new om(this.plugin),this.buttonManager=new im,this.syntaxHighlighting=new vm(this.plugin)}createInputField(e,t,r,i,a,o){if(this.plugin.isFilePathExcluded(r))return this.createExcludedField(i,r,a);let l=this.inputFieldParser.validateDeclaration(e,r,o),u=new Po(i,t,l,this.plugin,r,jt());return a.addChild(u),u}createInputFieldFromString(e,t,r,i,a,o){if(this.plugin.isFilePathExcluded(r))return this.createExcludedField(i,r,a);let l=this.inputFieldParser.parseString(e,r,o),u=new Po(i,t,l,this.plugin,r,jt());return a.addChild(u),u}createViewFieldFromString(e,t,r,i,a,o){if(this.plugin.isFilePathExcluded(r))return this.createExcludedField(i,r,a);let l=this.viewFieldParser.parseString(e,r,o),u=new Ms(i,t,l,this.plugin,r,jt());return a.addChild(u),u}createJsViewFieldFromString(e,t,r,i,a){if(this.plugin.isFilePathExcluded(r))return this.createExcludedField(i,r,a);let o=this.viewFieldParser.parseJsString(e,r),l=new Ic(i,t,o,this.plugin,r,jt());return a.addChild(l),l}createExcludedField(e,t,r){let i=new Qc(e,"inline",this.plugin,t,jt());return r.addChild(i),i}createSignal(e){return new Or(e)}listenToMetadata(e,t,r,i=!1,a){let o=jt(),l=this.plugin.metadataManager.subscribe(o,e,{storageType:"frontmatter",storagePath:t,storageProp:ef(r),listenToChildren:i},a!=null?a:()=>{});return()=>{l.unsubscribe()}}createTable(e,t,r,i,a,o){let l=new tf(e,"inline",this.plugin,t,jt(),i,a,o);return r.addChild(l),l}createBindTarget(e,t){return this.bindTargetParser.parseAndValidateBindTarget(e,t)}createButtonFromString(e,t,r,i){if(this.plugin.isFilePathExcluded(t))return this.createExcludedField(r,t,i);let a=new lo(r,e,this.plugin,t,jt());return i.addChild(a),a}createInlineButtonFromString(e,t,r,i){if(this.plugin.isFilePathExcluded(t))return this.createExcludedField(r,t,i);let a=new lm(r,e,this.plugin,t,jt());return i.addChild(a),a}};var $k=require("obsidian");var l_=po[1];function Hk(n){l_=n}function c_(n){return I_[n]}function Gk(n,e){let t=(0,$k.moment)(new Date(e,n)).daysInMonth(),r=new Array(42).fill(0),i=TZ(new Date(e,n,1));for(let a=0;a({index:cd(e.index-l_.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function jk(){let n=0;return()=>++n}var es=require("@codemirror/view"),b_=require("@codemirror/language"),_m=require("obsidian");var Zk=require("obsidian");var Aa=class{static checkSelectionOverlap(e,t,r){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=r)return!0;return!1}static checkRangeOverlap(e,t,r,i){return e<=i&&r<=t}static getContent(e,t,r){return e.sliceDoc(t,r)}static getCurrentFile(e){return e.state.field(Zk.editorInfoField).file}static existsDecorationBetween(e,t,r){let i=!1;return e.between(t,r,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,r,i){let a=!1;return e.between(r,i,(o,l,u)=>{u.spec.mb_widgetType===t&&(a=!0)}),a}};var _r=class extends Error{},Il=class extends Error{};var f_=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(r.next(c))}catch(f){o(f)}}function u(c){try{s(r.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((r=r.apply(n,e||[])).next())})},Ji=function(n){return this instanceof Ji?(this.v=n,this):new Ji(n)},Xk=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(r[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Ji?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}},Ri;(function(n){n[n.SHORTEST=0]="SHORTEST",n[n.LONGEST=1]="LONGEST",n[n.STRICT_EQUAL=2]="STRICT_EQUAL"})(Ri||(Ri={}));function*p_(n,e,...t){if(t.length===0)return;let r=[];for(let i of t)r.push(Qk(i));e:for(;;){let i=eL.map(r,u=>u.next()),a=[],o=!0,l=!1;for(let u of i){let s;u.done?(o=!1,s=e):(l=!0,s=u.value),a.push(s)}if(!o&&l)switch(n){case Ri.SHORTEST:break e;case Ri.STRICT_EQUAL:throw new Il("Iterators must have equal lengths")}if(!l)break;yield a}}function m_(n,e,...t){return Xk(this,arguments,function*(){if(t.length===0)return yield Ji(void 0);let i=[];for(let a of t)i.push(Kk(a));e:for(;;){let a=[];for(let s of i){let c=yield Ji(s.next());a.push(c)}let o=[],l=!0,u=!1;for(let s of a){let c;s.done?(l=!1,c=e):(u=!0,c=s.value),o.push(c)}if(!l&&u)switch(n){case Ri.SHORTEST:break e;case Ri.STRICT_EQUAL:throw new Il("Iterators must have equal lengths")}if(!u)break;yield yield Ji(o)}})}var Jk=class{constructor(e,t){this.parent=e,this.id=t}getId(){return this.id}valid(){return this.parent.valid(this)}next(){let e={value:this.current(),done:!this.valid()};return e.done||this.parent.next(this),e}current(){return this.parent.valid(this)?this.parent.current(this):void 0}*[Symbol.iterator](){for(;this.parent.valid(this);)yield this.parent.current(this),this.parent.next(this)}};var Yk=class{constructor(e,t){this.parent=e,this.id=t}getId(){return this.id}valid(){return f_(this,void 0,void 0,function*(){return yield this.parent.valid(this)})}next(){return f_(this,void 0,void 0,function*(){let e={value:yield this.current(),done:!(yield this.valid())};return e.done||(yield this.parent.next(this)),e})}current(){return f_(this,void 0,void 0,function*(){return(yield this.parent.valid(this))?yield this.parent.current(this):void 0})}[Symbol.asyncIterator](){return Xk(this,arguments,function*(){for(;yield Ji(this.parent.valid(this));)yield yield Ji(yield Ji(this.parent.current(this))),yield Ji(this.parent.next(this))})}};var tL=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},Da=function(n){return this instanceof Da?(this.v=n,this):new Da(n)},rL=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(r[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Da?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*nL(...n){for(let e of p_(Ri.SHORTEST,void 0,...n))yield e}function iL(...n){return rL(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,l=tL(m_(Ri.SHORTEST,void 0,...n)),u;u=yield Da(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Da(a)}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Da(i.call(l)))}finally{if(r)throw r.error}}})}function*aL(...n){for(let e of p_(Ri.STRICT_EQUAL,void 0,...n))yield e}function oL(...n){return rL(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,l=tL(m_(Ri.STRICT_EQUAL,void 0,...n)),u;u=yield Da(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Da(a)}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Da(i.call(l)))}finally{if(r)throw r.error}}})}var sL=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(r.next(c))}catch(f){o(f)}}function u(c){try{s(r.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((r=r.apply(n,e||[])).next())})},FZ=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function IZ(n,e,t){let r=t;for(let i of Jt(n))r=e(r,i);return r}function BZ(n,e,t){var r,i,a,o;return sL(this,void 0,void 0,function*(){let l=t;try{for(var u=!0,s=FZ(Yt(n)),c;c=yield s.next(),r=c.done,!r;){o=c.value,u=!1;try{l=yield e(l,o)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l})}function d_(n){switch(!0){case n instanceof Array:return n.length;case Yi(n):return n.length;case n instanceof Set:return n.size;case n instanceof Map:return n.size}return IZ(n,e=>e+1,0)}function uL(n){return sL(this,void 0,void 0,function*(){switch(!0){case n instanceof Array:case Yi(n):case n instanceof Set:case n instanceof Map:return d_(n)}return yield BZ(n,e=>e+1,0)})}var ki=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(r.next(c))}catch(f){o(f)}}function u(c){try{s(r.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((r=r.apply(n,e||[])).next())})},Ea=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function lL(n,e){for(let t of Jt(n))if(!e(t))return!1;return!0}function cL(n,e){var t,r,i,a;return ki(this,void 0,void 0,function*(){try{for(var o=!0,l=Ea(Yt(n)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(!(yield e(a)))return!1}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return!0})}function fL(n){let e=new Set;for(let t of Jt(n)){if(e.has(t))return!1;e.add(t)}return!0}function pL(n){var e,t,r,i;return ki(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,l=Ea(Yt(n)),u;u=yield l.next(),e=u.done,!e;){i=u.value,o=!1;try{let s=i;if(a.has(s))return!1;a.add(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(r=l.return)&&(yield r.call(l))}finally{if(t)throw t.error}}return!0})}function mL(n,e){for(let t of Jt(n))if(e(t))return!0;return!1}function dL(n,e){var t,r,i,a;return ki(this,void 0,void 0,function*(){try{for(var o=!0,l=Ea(Yt(n)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(yield e(a))return!0}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return!1})}function hL(n,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let r=0;for(let i of Jt(n))if(t(i)&&(r++,r>e))return!1;return r===e}function gL(n,e,t){var r,i,a,o;return ki(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=f=>!!f);let l=0;try{for(var u=!0,s=Ea(Yt(n)),c;c=yield s.next(),r=c.done,!r;){o=c.value,u=!1;try{if((yield t(o))&&(l++,l>e))return!1}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l===e})}function vL(n){for(let e of Jt(n))return!1;return!0}function yL(n){var e,t,r,i;return ki(this,void 0,void 0,function*(){try{for(var a=!0,o=Ea(Yt(n)),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let u=i;return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function qn(n){return n==null?!1:typeof n[Symbol.iterator]=="function"}function Ca(n){return n==null?!1:typeof n[Symbol.asyncIterator]=="function"}function wi(n){return n==null?!1:n.next!==void 0&&typeof n.next=="function"}function xL(n){for(let[e,t]of Ko(Jt(n)))if(et)return!1;return!0}function _L(n){var e,t,r,i;return ki(this,void 0,void 0,function*(){try{for(var a=!0,o=Ea(Ol(Yt(n))),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let[u,s]=i;if(u>s)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function Yi(n){return typeof n=="string"||n instanceof String}function AL(n,e){for(let t of Jt(n))if(e(t))return!1;return!0}function DL(n,e){var t,r,i,a;return ki(this,void 0,void 0,function*(){try{for(var o=!0,l=Ea(Yt(n)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(yield e(a))return!1}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return!0})}function EL(...n){try{for(let e of aL(...n))for(let[t,r]of Ko(e))if(t!==r)return!1}catch(e){return!1}return!0}function CL(...n){var e,t,r,i;return ki(this,void 0,void 0,function*(){try{try{for(var a=!0,o=Ea(oL(...n)),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let u=i;for(let[s,c]of Ko(u))if(s!==c)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}}catch(u){return!1}return!0})}function SL(...n){if(n.length<=1)return!0;let e=n.map(t=>d_(t));return new Set(e).size===1}function NL(...n){return ki(this,void 0,void 0,function*(){if(n.length<=1)return!0;let e=yield xm(n,t=>ki(this,void 0,void 0,function*(){return yield uL(t)}));return new Set(yield Bl(e)).size===1})}var OZ=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(r.next(c))}catch(f){o(f)}}function u(c){try{s(r.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((r=r.apply(n,e||[])).next())})},Xi=function(n){return this instanceof Xi?(this.v=n,this):new Xi(n)},h_=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(r[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Xi?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}},ML=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function Jt(n){if(qn(n))return n;if(wi(n))return{[Symbol.iterator](){return n}};if(typeof n=="object"&&n!==null)return function*(){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(yield[e,n[e]])}();throw new _r("Given collection is not iterable or iterator.")}function Yt(n){if(Ca(n))return n;if(wi(n))return{[Symbol.asyncIterator](){return h_(this,arguments,function*(){for(;;){let t=yield Xi(n.next());if(t.done)return yield Xi(void 0);yield yield Xi(t.value)}})}};if(typeof n=="object"&&n!==null&&(n=Jt(n)),qn(n))return{[Symbol.asyncIterator](){return h_(this,arguments,function*(){for(let t of n)yield yield Xi(t)})}};throw new _r("Given collection is not async iterable or iterator.")}function Qk(n){if(wi(n))return n;if(qn(n))return function*(){for(let e of n)yield e}();throw new _r("Given collection is not iterable or iterator.")}function Kk(n){if((wi(n)||qn(n))&&(n=Yt(n)),Ca(n))return function(){return h_(this,arguments,function*(){var e,t,r,i;try{for(var a=!0,o=ML(n),l;l=yield Xi(o.next()),e=l.done,!e;){i=l.value,a=!1;try{yield yield Xi(i)}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(r=o.return)&&(yield Xi(r.call(o)))}finally{if(t)throw t.error}}})}();throw new _r("Given collection is not iterable or iterator.")}function g_(n){let e=[];for(let t of Jt(n))e.push(t);return e}function Bl(n){var e,t,r,i;return OZ(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,l=ML(Yt(n)),u;u=yield l.next(),e=u.done,!e;){i=u.value,o=!1;try{let s=i;a.push(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(r=l.return)&&(yield r.call(l))}finally{if(t)throw t.error}}return a})}var fo=function(n){return this instanceof fo?(this.v=n,this):new fo(n)},PZ=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},RZ=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(r[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof fo?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*v_(n,e){let t=new Set;if(n instanceof Map){e===void 0&&(e=r=>r[1]);for(let r of n){let i=e(r);t.has(i)||(yield r,t.add(i))}}else{e===void 0&&(e=r=>r);for(let r of Jt(n)){let i=e(r);t.has(i)||(yield r,t.add(i))}}}function TL(n,e){return RZ(this,arguments,function*(){var r,i,a,o;let l=new Set;if(n instanceof Map)for(let f of v_(n,e))yield yield fo(yield fo(f));else{e===void 0&&(e=f=>f);try{for(var u=!0,s=PZ(Yt(n)),c;c=yield fo(s.next()),r=c.done,!r;){o=c.value,u=!1;try{let f=o,p=e(f);l.has(p)||(yield yield fo(f),l.add(p))}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!r&&(a=s.return)&&(yield fo(a.call(s)))}finally{if(i)throw i.error}}}})}var Ir=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},Ge=function(n){return this instanceof Ge?(this.v=n,this):new Ge(n)},Gr=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(r[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Ge?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*FL(n,e){for(let t of Jt(n))yield e(t)}function xm(n,e){return Gr(this,arguments,function*(){var r,i,a,o;try{for(var l=!0,u=Ir(Yt(n)),s;s=yield Ge(u.next()),r=s.done,!r;){o=s.value,l=!1;try{yield yield Ge(yield Ge(e(o)))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!r&&(a=u.return)&&(yield Ge(a.call(u)))}finally{if(i)throw i.error}}})}function*IL(n,e){for(let[t,r]of nL(n,e))r&&(yield t)}function BL(n,e){return Gr(this,arguments,function*(){var r,i,a,o;try{for(var l=!0,u=Ir(iL(n,e)),s;s=yield Ge(u.next()),r=s.done,!r;){o=s.value,l=!1;try{let[c,f]=o;f&&(yield yield Ge(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!r&&(a=u.return)&&(yield Ge(a.call(u)))}finally{if(i)throw i.error}}})}function*OL(n,e){let t=!0;for(let r of Jt(n)){if(t){if(!e(r)){t=!1,yield r;continue}continue}yield r}}function PL(n,e){return Gr(this,arguments,function*(){var r,i,a,o;let l=!0;try{for(var u=!0,s=Ir(Yt(n)),c;c=yield Ge(s.next()),r=c.done,!r;){o=c.value,u=!1;try{let f=o;if(l){if(!(yield Ge(e(f)))){l=!1,yield yield Ge(f);continue}continue}yield yield Ge(f)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!r&&(a=s.return)&&(yield Ge(a.call(s)))}finally{if(i)throw i.error}}})}function*RL(n,e){for(let t of Jt(n))if(e(t))yield t;else break}function kL(n,e){return Gr(this,arguments,function*(){var r,i,a,o;try{for(var l=!0,u=Ir(Yt(n)),s;s=yield Ge(u.next()),r=s.done,!r;){o=s.value,l=!1;try{let c=o;if(yield Ge(e(c)))yield yield Ge(c);else break}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!r&&(a=u.return)&&(yield Ge(a.call(u)))}finally{if(i)throw i.error}}})}function*LL(n,e){if(e<0)throw new _r(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield n}function VL(n,e){return Gr(this,arguments,function*(){if(e<0)throw new _r(`Number of repetitions cannot be negative: ${e}`);let r=yield Ge(n);for(let i=e;i>0;--i)yield yield Ge(r)})}function*UL(n,e){for(let t of Jt(n)){let r=e(t,e);if(qn(r))for(let i of Jt(r))yield i;else yield r}}function qL(n,e){return Gr(this,arguments,function*(){var r,i,a,o,l,u,s,c;try{for(var f=!0,p=Ir(Yt(n)),m;m=yield Ge(p.next()),r=m.done,!r;){o=m.value,f=!1;try{let w=yield Ge(e(o,e));if(qn(w)||Ca(w))try{for(var h=!0,d=(u=void 0,Ir(Yt(w))),g;g=yield Ge(d.next()),l=g.done,!l;){c=g.value,h=!1;try{yield yield Ge(c)}finally{h=!0}}}catch(v){u={error:v}}finally{try{!h&&!l&&(s=d.return)&&(yield Ge(s.call(d)))}finally{if(u)throw u.error}}else yield yield Ge(w)}finally{f=!0}}}catch(y){i={error:y}}finally{try{!f&&!r&&(a=p.return)&&(yield Ge(a.call(p)))}finally{if(i)throw i.error}}})}function*y_(n,e=1/0){if(e<1){for(let t of Jt(n))n instanceof Map&&(t=t[1]),yield t;return}for(let t of Jt(n))if(n instanceof Map&&(t=t[1]),(qn(t)||wi(t))&&!Yi(t))for(let r of y_(t,e-1))yield r;else yield t}function x_(n,e=1/0){return Gr(this,arguments,function*(){var r,i,a,o,l,u,s,c,f,p,m,h;if(e<1){try{for(var d=!0,g=Ir(Yt(n)),y;y=yield Ge(g.next()),r=y.done,!r;){o=y.value,d=!1;try{let C=o;n instanceof Map&&(C=C[1]),yield yield Ge(C)}finally{d=!0}}}catch(C){i={error:C}}finally{try{!d&&!r&&(a=g.return)&&(yield Ge(a.call(g)))}finally{if(i)throw i.error}}return yield Ge(void 0)}try{for(var w=!0,v=Ir(Yt(n)),x;x=yield Ge(v.next()),l=x.done,!l;){c=x.value,w=!1;try{let C=c;if(n instanceof Map&&(C=C[1]),(Ca(C)||qn(C)||wi(C))&&!Yi(C))try{for(var _=!0,b=(p=void 0,Ir(x_(C,e-1))),D;D=yield Ge(b.next()),f=D.done,!f;){h=D.value,_=!1;try{yield yield Ge(h)}finally{_=!0}}}catch(A){p={error:A}}finally{try{!_&&!f&&(m=b.return)&&(yield Ge(m.call(b)))}finally{if(p)throw p.error}}else yield yield Ge(C)}finally{w=!0}}}catch(C){u={error:C}}finally{try{!w&&!l&&(s=v.return)&&(yield Ge(s.call(v)))}finally{if(u)throw u.error}}})}function*zL(n,e){for(let t of Jt(n))e(t)&&(yield t)}function $L(n,e){return Gr(this,arguments,function*(){var r,i,a,o;try{for(var l=!0,u=Ir(Yt(n)),s;s=yield Ge(u.next()),r=s.done,!r;){o=s.value,l=!1;try{let c=o;(yield Ge(e(c)))&&(yield yield Ge(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!r&&(a=u.return)&&(yield Ge(a.call(u)))}finally{if(i)throw i.error}}})}function*bm(n,e,t,r=!0){if(e<1)throw new _r(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new _r("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Jt(n))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&r&&(yield i)}function wm(n,e,t,r=!0){return Gr(this,arguments,function*(){var a,o,l,u;if(e<1)throw new _r(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new _r("Overlap size must be less than chunk size");let s=[],c=!1;try{for(var f=!0,p=Ir(Yt(n)),m;m=yield Ge(p.next()),a=m.done,!a;){u=m.value,f=!1;try{let h=u;c=!1,s.push(h),s.length===e&&(yield yield Ge(s),s=s.slice(e-t),c=!0)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(l=p.return)&&(yield Ge(l.call(p)))}finally{if(o)throw o.error}}!c&&s.length>0&&r&&(yield yield Ge(s))})}function*HL(n,e){for(let t of bm(n,e,0))yield t}function GL(n,e){return Gr(this,arguments,function*(){var r,i,a,o;try{for(var l=!0,u=Ir(wm(n,e,0)),s;s=yield Ge(u.next()),r=s.done,!r;){o=s.value,l=!1;try{yield yield Ge(o)}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!r&&(a=u.return)&&(yield Ge(a.call(u)))}finally{if(i)throw i.error}}})}function*Ko(n){let e=bm(n,2,1,!1);for(let t of e)yield t}function Ol(n){return Gr(this,arguments,function*(){var t,r,i,a;let o=wm(n,2,1,!1);try{for(var l=!0,u=Ir(o),s;s=yield Ge(u.next()),t=s.done,!t;){a=s.value,l=!1;try{yield yield Ge(a)}finally{l=!0}}}catch(c){r={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield Ge(i.call(u)))}finally{if(r)throw r.error}}})}function*WL(n,e){if(e<0)throw new _r(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let r of Jt(n)){if(t>=e)return;yield r,++t}}function jL(n,e){return Gr(this,arguments,function*(){var r,i,a,o;if(e<0)throw new _r(`Limit must be \u2265 0. Got ${e}`);let l=0;try{for(var u=!0,s=Ir(Yt(n)),c;c=yield Ge(s.next()),r=c.done,!r;){o=c.value,u=!1;try{let f=o;if(l>=e)return yield Ge(void 0);yield yield Ge(f),++l}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!r&&(a=s.return)&&(yield Ge(a.call(s)))}finally{if(i)throw i.error}}})}function*ZL(n){let e=0;for(let t of Jt(n))yield[e++,t]}function JL(n){return Gr(this,arguments,function*(){var t,r,i,a;let o=0;try{for(var l=!0,u=Ir(Yt(n)),s;s=yield Ge(u.next()),t=s.done,!t;){a=s.value,l=!1;try{let c=a;yield yield Ge([o++,c])}finally{l=!0}}}catch(c){r={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield Ge(i.call(u)))}finally{if(r)throw r.error}}})}function*YL(n,e=0,t,r=1){if(e<0)throw new _r("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new _r("Parameter 'count' cannot be negative");if(r<=0)throw new _r("Parameter 'step' must be positive");let i=0,a=0;for(let o of Jt(n))if(!(i++=e)&&(yield i),++r}function t4(n,e,t=0){return Gr(this,arguments,function*(){var i,a,o,l;if(e<0||t<0)throw new _r;let u=-t;try{for(var s=!0,c=Ir(Yt(n)),f;f=yield Ge(c.next()),i=f.done,!i;){l=f.value,s=!1;try{let p=l;(u<0||u>=e)&&(yield yield Ge(p)),++u}finally{s=!0}}}catch(p){a={error:p}}finally{try{!s&&!i&&(o=c.return)&&(yield Ge(o.call(c)))}finally{if(a)throw a.error}}})}function*r4(n){for(let[,e]of Jt(n))yield e}function n4(n){return Gr(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,l=Ir(Yt(n)),u;u=yield Ge(l.next()),t=u.done,!t;){a=u.value,o=!1;try{let[,s]=a;yield yield Ge(s)}finally{o=!0}}}catch(s){r={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Ge(i.call(l)))}finally{if(r)throw r.error}}})}function*i4(n,e,t){let r=new Map,i=a=>{r.has(a)||(t!==void 0?r.set(a,{}):r.set(a,[]))};for(let a of Jt(n)){let o=e(a),l=t!==void 0?t(a):void 0,u=(qn(o)||wi(o))&&!Yi(o)?o:[o];for(let s of v_(u))i(s),l===void 0?r.get(s).push(a):r.get(s)[l]=a}for(let a of r)yield a}function a4(n,e,t){return Gr(this,arguments,function*(){var i,a,o,l,u,s,c,f;let p=new Map,m=x=>{p.has(x)||(t!==void 0?p.set(x,{}):p.set(x,[]))};try{for(var h=!0,d=Ir(Yt(n)),g;g=yield Ge(d.next()),i=g.done,!i;){l=g.value,h=!1;try{let x=l,_=yield Ge(e(x)),b=t!==void 0?yield Ge(t(x)):void 0,D=(Ca(_)||qn(_)||wi(_))&&!Yi(_)?_:[_];try{for(var y=!0,w=(s=void 0,Ir(TL(D))),v;v=yield Ge(w.next()),u=v.done,!u;){f=v.value,y=!1;try{let C=f;m(C),b===void 0?p.get(C).push(x):p.get(C)[b]=x}finally{y=!0}}}catch(C){s={error:C}}finally{try{!y&&!u&&(c=w.return)&&(yield Ge(c.call(w)))}finally{if(s)throw s.error}}}finally{h=!0}}}catch(x){a={error:x}}finally{try{!h&&!i&&(o=d.return)&&(yield Ge(o.call(d)))}finally{if(a)throw a.error}}for(let x of p)yield yield Ge(x)})}function*o4(n,e){let t=g_(n);e!==void 0?t.sort(e):t.sort();for(let r of t)yield r}function s4(n,e){return Gr(this,arguments,function*(){let r=yield Ge(Bl(n));e!==void 0?r.sort(e):r.sort();for(let i of r)yield yield Ge(i)})}var eL={chunkwise:HL,chunkwiseOverlap:bm,compress:IL,dropWhile:OL,enumerate:ZL,filter:zL,flatMap:UL,flatten:y_,groupBy:i4,keys:QL,limit:WL,map:FL,pairwise:Ko,repeat:LL,skip:e4,slice:YL,sort:o4,takeWhile:RL,values:r4,chunkwiseAsync:GL,chunkwiseOverlapAsync:wm,compressAsync:BL,dropWhileAsync:PL,enumerateAsync:JL,filterAsync:$L,flatMapAsync:qL,flattenAsync:x_,groupByAsync:a4,keysAsync:KL,limitAsync:jL,mapAsync:xm,pairwiseAsync:Ol,repeatAsync:VL,skipAsync:t4,sliceAsync:XL,sortAsync:s4,takeWhileAsync:kL,valuesAsync:n4};var u4={allMatch:lL,allUnique:fL,anyMatch:mL,exactlyN:hL,isEmpty:vL,isAsyncIterable:Ca,isIterable:qn,isIterator:wi,isReversed:xL,isSorted:wL,isString:Yi,noneMatch:AL,same:EL,sameCount:SL,allMatchAsync:cL,allUniqueAsync:pL,anyMatchAsync:dL,exactlyNAsync:gL,isEmptyAsync:yL,isReversedAsync:bL,isSortedAsync:_L,noneMatchAsync:DL,sameAsync:CL,sameCountAsync:NL};function l4(n){return es.ViewPlugin.fromClass(class{constructor(e){var t;this.component=new _m.Component,this.component.load(),this.decorations=(t=this.renderWidgets(e))!=null?t:es.Decoration.none}isLivePreview(e){return e.field(_m.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,r,i)=>{var o,l;return u4.anyMatch(e.visibleRanges,u=>Aa.checkRangeOverlap(t,r,u.from,u.to))?!0:((l=(o=i.spec).mb_unload)==null||l.call(o),!1)}});for(let{from:t,to:r}of e.visibleRanges)(0,b_.syntaxTree)(e.state).iterate({from:t,to:r,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,t){this.decorations.between(e.from-1,e.to+1,(r,i,a)=>{this.decorations=this.decorations.update({filterFrom:r,filterTo:i,filter:(o,l,u)=>{var s,c;return t&&u.spec.mb_widgetType===t?!0:((c=(s=u.spec).mb_unload)==null||c.call(s),!1)}})})}addDecoration(e,t,r,i,a){let o=e.from-1,l=e.to+1;if(Aa.existsDecorationOfTypeBetween(this.decorations,r,o,l))return;let u=Aa.getCurrentFile(t);if(!u)return;let s=this.renderWidget(e,a,r,i,u),c=Array.isArray(s)?s:[s];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,t){var i;let r=new Set((i=t.type.name)==null?void 0:i.split("_"));if(r.has("inline-code")&&!r.has("formatting")){let a=e.state.selection,o=Aa.checkSelectionOverlap(a,t.from-1,t.to+1),l=this.readNode(e,t.from,t.to),u=this.isLivePreview(e.state);return{shouldRender:!o&&u,shouldHighlight:(o||!u)&&n.settings.enableSyntaxHighlighting,content:l.content,widgetType:l.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,r){let i=Aa.getContent(e.state,t,r);return{content:i,widgetType:Tn.isDeclarationAndGetMDRCType(i)}}renderWidgets(e){let t=Aa.getCurrentFile(e);if(!t)return;let r=[];for(let i of e.visibleRanges)(0,b_.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,l=this.getRenderInfo(e,o);if(!l.widgetType||!l.content)return;let u;l.shouldRender&&(u=this.renderWidget(o,l.widgetType,"field",l.content,t)),l.shouldHighlight&&(u=this.renderWidget(o,l.widgetType,"highlight",l.content,t)),u&&(Array.isArray(u)?r.push(...u):r.push(u))}});return es.Decoration.set(r,!0)}renderWidget(e,t,r,i,a){if(r==="field"){let o=Tn.constructMDRCWidget(t,i,a.path,this.component,n);return es.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{var l;(l=o.renderChild)==null||l.unload()}}).range(e.from-1,e.to+1)}else return n.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(l=>es.Decoration.mark({class:`mb-highlight-${l.tokenClass}`}).range(e.from+l.range.from.index,e.from+l.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Am=class{constructor(){this.activeMDRCs=new Map}unload(){for(let e of this.activeMDRCs.values())console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),e.unload()}registerMDRC(e){console.debug(`meta-bind | MDRCManager >> registered MDRC ${e.uuid}`),this.activeMDRCs.set(e.uuid,e)}unregisterMDRC(e){console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),this.activeMDRCs.delete(e.uuid)}};var c4=require("obsidian");var Dm=class{constructor(e){this.app=e.app,this.plugin=e}getMetadataAndExtraCache(e){var i,a;if(e.bindTarget===void 0)throw new xo({errorLevel:"CRITICAL",effect:"can not get metadata and extra cache",cause:"subscription bind target undefined"});let t=this.plugin.app.vault.getAbstractFileByPath(e.bindTarget.storagePath);if(!(t instanceof c4.TFile))throw new xo({errorLevel:"CRITICAL",effect:"can not get metadata and extra cache",cause:"bind target file path does not point to a tFile"});let r=(i=this.plugin.app.metadataCache.getFileCache(t))==null?void 0:i.frontmatter;return{extraCache:{file:t},metadata:(a=structuredClone(r))!=null?a:{}}}setManagerInstance(e){this.manager=e}async updateMetadata(e,t){let r=t.extraCache.file;await this.plugin.app.fileManager.processFrontMatter(r,i=>{t.changed=!1,Object.assign(i,t.metadata)})}load(){this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(e,t,r)=>{var i,a;(a=this.manager)==null||a.updateCacheOnExternalFrontmatterUpdate(e.path,(i=r.frontmatter)!=null?i:{})})),this.plugin.registerEvent(this.plugin.app.vault.on("delete",e=>{var t;(t=this.manager)==null||t.deleteCacheInstantly(e.path)})),this.plugin.registerEvent(this.plugin.app.vault.on("rename",(e,t)=>{var r;(r=this.manager)==null||r.deleteCacheInstantly(t)})),this.manager!==void 0&&(this.interval=window.setInterval(()=>{var e;return(e=this.manager)==null?void 0:e.cycle()},this.plugin.settings.syncInterval))}unload(){this.interval!==void 0&&window.clearInterval(this.interval)}};var f4=require("obsidian");var w_=8,Pl=class extends fn{constructor(t,r,i,a,o,l){super(t,"block",i,a,o);this.content=r,this.depth=l}async parseContent(){let t=this.content.split(` `).map(l=>l.trim()).filter(l=>l.length>0);if(t.length===0)return"";if(t.length>1)throw new ss({errorLevel:"ERROR",effect:"can not create embed",cause:"embed may only contain one link"});let r=t[0],i=tn.parseLink(r);if(!i.internal)throw new ss({errorLevel:"ERROR",effect:"can not create embed",cause:"embed link is not an internal link"});let a=this.plugin.app.metadataCache.getFirstLinkpathDest(i.target,this.filePath);if(a===null)throw new ss({errorLevel:"ERROR",effect:"can not create embed",cause:"link target not found"});return(await this.plugin.app.vault.cachedRead(a)).replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`)}async onload(){if(this.plugin.mdrcManager.registerMDRC(this),this.depth>=w_)this.containerEl.empty(),this.containerEl.addClass("mb-error"),this.containerEl.innerText="Max embed depth reached";else{let t=await this.parseContent();await f4.MarkdownRenderer.render(this.plugin.app,t,this.containerEl,this.filePath,this)}}onunload(){this.plugin.mdrcManager.unregisterMDRC(this)}};var Na=require("obsidian");var Rl=require("obsidian"),Em=class extends Rl.Modal{constructor(t,r,i,a,o,l,u){super(t);this.value=r,this.title=i,this.subTitle=a,this.description=o,this.onSubmit=l,this.onCancel=u}onOpen(){this.contentEl.empty(),this.contentEl.createEl("h2",{text:this.title});let t=new Rl.Setting(this.contentEl);t.setName(this.subTitle),t.setDesc(this.description),t.addText(i=>{i.setValue(this.value),i.setPlaceholder(this.subTitle),i.onChange(a=>{this.value=a})});let r=new Rl.Setting(this.contentEl);r.addButton(i=>{i.setButtonText("Apply"),i.setCta(),i.onClick(()=>{this.onSubmit(this.value),this.close()})}),r.addButton(i=>{i.setButtonText("Cancel"),i.onClick(()=>{this.onCancel(),this.close()})})}onClose(){super.onClose()}};var m4=require("obsidian");var p4=require("obsidian"),Cm=class extends p4.FuzzySuggestModal{constructor(t,r,i){super(t);this.options=r,this.onSelect=i}getItemText(t){return t.displayValue}getItems(){return this.options}onChooseItem(t,r){this.onSelect(t)}};var Sa=class{constructor(e,t){this.value=e,this.displayValue=t}valueAsString(){var e,t;return(t=(e=this.value)==null?void 0:e.toString())!=null?t:"null"}};function kZ(n,e,t,r,i){let a=[];for(let o of t)a.push(new Sa(o.value,o.name));if(r.length>0){if(!n)return new m4.Notice("meta-bind | dataview needs to be installed and enabled to use suggest option queries"),a;for(let o of r)n.pages(o.value,e).forEach(u=>{try{let s=u.file;i?a.push(new Sa(`[[${s.path}|${s.name}]]`,`file: ${s.name}`)):a.push(new Sa(s.name,`file: ${s.name}`))}catch(s){console.warn("meta-bind | error while computing suggest options",s)}})}return a}function LZ(n,e){let t=e.app,r=qD(t),i=n.base.getArguments("option"),a=n.base.getArguments("optionQuery"),o=n.base.getArgument("useLinks");return kZ(r,n.base.getFilePath(),i,a,o===void 0||o.value)}function d4(n,e,t){new Cm(t.app,LZ(n,t),e).open()}var zn=require("obsidian");var b4=require("obsidian");function VZ(n){jr(n,"svelte-1m4qg39",".image-card-image.svelte-1m4qg39{width:100%;height:fit-content;max-height:500px;object-fit:contain}.image-card-text.svelte-1m4qg39{display:block;margin:var(--size-4-2);margin-bottom:var(--size-4-4)}")}function UZ(n){let e,t,r,i,a,o,l,u;return{c(){e=j("div"),t=j("img"),i=fe(),a=j("span"),o=Pe(n[0]),L(t,"class","image-card-image svelte-1m4qg39"),rs(t.src,r=Bs(n[0]))||L(t,"src",r),L(t,"alt",n[0]),L(a,"class","image-card-text svelte-1m4qg39"),L(e,"class","image-card svelte-1m4qg39"),L(e,"role","button"),L(e,"tabindex","0")},m(s,c){Y(s,e,c),z(e,t),z(e,i),z(e,a),z(a,o),l||(u=[be(e,"click",n[3]),be(e,"keydown",n[4])],l=!0)},p(s,[c]){c&1&&!rs(t.src,r=Bs(s[0]))&&L(t,"src",r),c&1&&L(t,"alt",s[0]),c&1&&rt(o,s[0])},i:Se,o:Se,d(s){s&&J(e),l=!1,at(u)}}}function qZ(n,e,t){let{image:r}=e,{onSelect:i}=e;function a(u,s){u.key===" "&&i(s)}let o=()=>i(r),l=u=>a(u,r);return n.$$set=u=>{"image"in u&&t(0,r=u.image),"onSelect"in u&&t(1,i=u.onSelect)},[r,i,a,o,l]}var __=class extends Ve{constructor(e){super(),qe(this,e,qZ,UZ,Ue,{image:0,onSelect:1},VZ)}},h4=__;var y4=require("obsidian");function g4(n,e,t){let r=n.slice();return r[6]=e[t],r}function v4(n){let e,t;return e=new h4({props:{image:n[6].value,onSelect:n[0]}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i&4&&(a.image=r[6].value),i&1&&(a.onSelect=r[0]),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function zZ(n){let e,t,r,i,a,o,l,u=We(n[2]),s=[];for(let f=0;fae(s[f],1,1,()=>{s[f]=null});return{c(){e=j("div"),t=j("input"),r=fe(),i=j("div");for(let f=0;f{"options"in s&&t(3,r=s.options),"onSelect"in s&&t(0,i=s.onSelect)},n.$$.update=()=>{n.$$.dirty&2&&l(a)},[i,a,o,r,u]}var A_=class extends Ve{constructor(e){super(),qe(this,e,$Z,zZ,Ue,{options:3,onSelect:0})}},x4=A_;var Sm=class extends b4.Modal{constructor(t,r,i){super(t);this.options=r,this.onSelect=i}onOpen(){this.modalEl.style.width="100%",new x4({target:this.contentEl,props:{options:this.options,onSelect:t=>{this.onSelect(t),this.close()}}})}};function w4(n){let e=[];for(let t of n.children)t instanceof zn.TFile&&_4(t.extension)&&e.push(new Sa(t.path,t.name)),t instanceof zn.TFolder&&e.push(...w4(t));return e}function HZ(n,e,t){let r=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:"expected suggest option query for image suggester to start and end with double quotation marks"});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof zn.TFolder)){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}r.push(...w4(o))}for(let i of n){let a=Ou(i.value);if(!a){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof zn.TFile)){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!_4(o.extension)){let l=new sr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new zn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}r.push(new Sa(o.path,o.name))}return r}function _4(n){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(n)}function GZ(n,e){let t=n.base.getArguments("option"),r=n.base.getArguments("optionQuery");return HZ(t,r,e)}function A4(n,e,t){new Sm(t.app,GZ(n,t),e).open()}var M4=require("obsidian");var C4=require("obsidian");function WZ(n){jr(n,"svelte-12l82wb",".calendar.svelte-12l82wb{margin-top:10px}.calendar-header.svelte-12l82wb{display:flex;justify-content:space-around;flex-wrap:wrap;gap:var(--size-4-1);background:var(--background-secondary);border-radius:var(--mb-border-radius);margin-bottom:var(--size-4-1)}.calendar-content.svelte-12l82wb{display:grid;flex-wrap:wrap;grid-template-columns:repeat(7, 1fr);gap:var(--size-4-1)}.cell.svelte-12l82wb{min-width:40px;padding:var(--size-4-2);display:flex;justify-content:center;align-items:center;border-radius:var(--mb-border-radius)}.content-cell.svelte-12l82wb{cursor:pointer}.cell-text.svelte-12l82wb{margin:auto;text-align:center}.selected.svelte-12l82wb{background:var(--interactive-accent);color:var(--text-on-accent)}.highlight.svelte-12l82wb:hover{background:var(--interactive-hover)}.selected.highlight.svelte-12l82wb:hover{background:var(--interactive-accent-hover)}")}function D4(n,e,t){let r=n.slice();return r[10]=e[t],r}function jZ(n,e,t){let r=n.slice();return r[13]=e[t],r}function ZZ(n){let e,t,r;return{c(){e=j("div"),t=j("span"),t.textContent=`${n[13]}`,r=fe(),L(t,"class","cell-text svelte-12l82wb"),L(e,"class","cell header-cell svelte-12l82wb")},m(i,a){Y(i,e,a),z(e,t),z(e,r)},p:Se,d(i){i&&J(e)}}}function E4(n,e){let t,r,i=(e[10]||"")+"",a,o,l,u;function s(){return e[6](e[10])}function c(...f){return e[7](e[10],...f)}return{key:n,first:null,c(){var f,p,m;t=j("div"),r=j("span"),a=Pe(i),o=fe(),L(r,"class","cell-text svelte-12l82wb"),L(t,"class","cell svelte-12l82wb"),L(t,"role","button"),L(t,"tabindex","0"),_t(t,"highlight",e[10]),_t(t,"content-cell",e[10]),_t(t,"selected",((f=e[0])==null?void 0:f.year())===e[2]&&((p=e[0])==null?void 0:p.month())===e[1]&&((m=e[0])==null?void 0:m.date())===e[10]),this.first=t},m(f,p){Y(f,t,p),z(t,r),z(r,a),z(t,o),l||(u=[be(t,"click",s),be(t,"keydown",c)],l=!0)},p(f,p){var m,h,d;e=f,p&8&&i!==(i=(e[10]||"")+"")&&rt(a,i),p&8&&_t(t,"highlight",e[10]),p&8&&_t(t,"content-cell",e[10]),p&15&&_t(t,"selected",((m=e[0])==null?void 0:m.year())===e[2]&&((h=e[0])==null?void 0:h.month())===e[1]&&((d=e[0])==null?void 0:d.date())===e[10])},d(f){f&&J(t),l=!1,at(u)}}}function JZ(n){let e,t,r,i,a=[],o=new Map,l=We(Wk()),u=[];for(let f=0;fjk();for(let f=0;fs(m),p=(m,h)=>c(h,m);return n.$$set=m=>{"selectedDate"in m&&t(0,i=m.selectedDate),"month"in m&&t(1,a=m.month),"year"in m&&t(2,o=m.year)},n.$$.update=()=>{n.$$.dirty&6&&t(3,l=Gk(a,o))},[i,a,o,l,s,c,f,p]}var D_=class extends Ve{constructor(e){super(),qe(this,e,YZ,JZ,Ue,{selectedDate:0,month:1,year:2},WZ)}},S4=D_;var E_=require("obsidian");function XZ(n){jr(n,"svelte-berpp6",".date-picker.svelte-berpp6{display:block;padding:var(--size-4-4)}.date-picker-header.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:space-around}.date-picker-header-text.svelte-berpp6{flex:1;text-align:center;display:flex;gap:var(--size-4-2);align-items:center;justify-content:center;width:min-content}.date-picker-header-text-year.svelte-berpp6{width:60px;padding:var(--size-4-2)}.date-picker-header-text-month.svelte-berpp6{height:min-content}.month-switch-button.svelte-berpp6{margin:0}.date-picker-footer.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:center}.none-button.svelte-berpp6{margin:0}")}function QZ(n){let e,t,r,i,a,o,l=c_(n[1])+"",u,s,c,f,p,m,h,d,g,y,w,v,x,_;return d=new S4({props:{month:n[1],year:n[2],selectedDate:n[0]}}),d.$on("dateChange",n[6]),{c(){e=j("div"),t=j("div"),r=j("button"),r.textContent="Prev",i=fe(),a=j("div"),o=j("span"),u=Pe(l),s=fe(),c=j("input"),p=fe(),m=j("button"),m.textContent="Next",h=fe(),Fe(d.$$.fragment),g=fe(),y=j("div"),w=j("button"),w.textContent="Set no Date",L(r,"class","month-switch-button svelte-berpp6"),L(o,"class","date-picker-header-text-month svelte-berpp6"),L(c,"class","date-picker-header-text-year svelte-berpp6"),L(c,"type","number"),c.value=f=n[2].toString(),L(a,"class","date-picker-header-text svelte-berpp6"),L(m,"class","month-switch-button svelte-berpp6"),L(t,"class","date-picker-header svelte-berpp6"),L(w,"class","none-button svelte-berpp6"),L(y,"class","date-picker-footer svelte-berpp6"),L(e,"class","date-picker svelte-berpp6")},m(b,D){Y(b,e,D),z(e,t),z(t,r),z(t,i),z(t,a),z(a,o),z(o,u),z(a,s),z(a,c),z(t,p),z(t,m),z(e,h),Me(d,e,null),z(e,g),z(e,y),z(y,w),v=!0,x||(_=[be(r,"click",n[4]),be(c,"input",n[5]),be(m,"click",n[3]),be(w,"click",n[7])],x=!0)},p(b,[D]){(!v||D&2)&&l!==(l=c_(b[1])+"")&&rt(u,l),(!v||D&4&&f!==(f=b[2].toString())&&c.value!==f)&&(c.value=f);let C={};D&2&&(C.month=b[1]),D&4&&(C.year=b[2]),D&1&&(C.selectedDate=b[0]),d.$set(C)},i(b){v||(te(d.$$.fragment,b),v=!0)},o(b){ae(d.$$.fragment,b),v=!1},d(b){b&&J(e),Te(d),x=!1,at(_)}}}function KZ(n,e,t){let{selectedDate:r=(0,E_.moment)()}=e,{dateChangeCallback:i}=e,a,o;function l(){if(a===11){t(1,a=0),t(2,o+=1);return}t(1,a=a+1)}function u(){if(a===0){t(1,a=11),t(2,o-=1);return}t(1,a-=1)}function s(p){let m=p.target.value,h=Number.parseInt(m);Number.isNaN(h)||t(2,o=h)}function c(p){t(0,r=p.detail),i(p.detail)}function f(){t(0,r=null),i(null)}return n.$$set=p=>{"selectedDate"in p&&t(0,r=p.selectedDate),"dateChangeCallback"in p&&t(8,i=p.dateChangeCallback)},n.$$.update=()=>{if(n.$$.dirty&1)if(r)t(1,a=r.month()),t(2,o=r.year());else{let p=(0,E_.moment)();t(1,a=p.month()),t(2,o=p.year())}},[r,a,o,l,u,s,c,f,i]}var C_=class extends Ve{constructor(e){super(),qe(this,e,KZ,QZ,Ue,{selectedDate:0,dateChangeCallback:8},XZ)}},N4=C_;var Nm=class extends M4.Modal{constructor(t,r){super(t);this.datePicker=r}onOpen(){this.datePickerInput=new N4({target:this.contentEl,props:{selectedDate:this.datePicker.getInternalValue(),dateChangeCallback:t=>{this.datePicker.setInternalValue(t),this.close()}}})}onClose(){var t;(t=this.datePickerInput)==null||t.$destroy()}};function T4(n){var e;return(e=n.plugins.getPlugin("js-engine"))==null?void 0:e.api}var Mm=class{constructor(e){this.plugin=e,this.app=e.app}openDatePickerModal(e){new Nm(this.app,e).open()}openImageSuggesterModal(e,t){A4(e,t,this.plugin)}openSuggesterModal(e,t){d4(e,t,this.plugin)}openTextPromptModal(e,t,r,i,a,o){new Em(this.app,e,t,r,i,a,o).open()}async renderMarkdown(e,t,r){let i=new Na.Component;return await Na.MarkdownRenderer.render(this.app,e,t,r,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}async jsEngineRunFile(e,t,r){let i=T4(this.app);if(!i)throw new Error("js-engine plugin not found");let a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof Na.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new Na.Component;return await i.internal.executeFile(e,{component:l,container:r,context:{metadata:o,file:a,line:0}}),()=>l.unload()}async jsEngineRunCode(e,t,r){let i=T4(this.app);if(!i)throw new Error("js-engine plugin not found");let a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof Na.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new Na.Component;return await i.internal.execute({code:e,component:l,container:r,context:{metadata:o,file:a,line:0}}),()=>l.unload()}openFile(e,t){this.app.workspace.openLinkText(e,t,!0)}getFilePathByName(e){var t;return(t=this.app.metadataCache.getFirstLinkpathDest(e,""))==null?void 0:t.path}};var W4=require("obsidian");function eJ(n){jr(n,"svelte-17mpvkc",".vertical.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1)}.vertical-control.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1);width:100%}")}function tJ(n){var d,g;let e,t,r,i=((d=n[0])!=null?d:"")+"",a,o,l,u=((g=n[1])!=null?g:"")+"",s,c,f,p,m=n[5].default,h=Qi(m,n,n[4],null);return{c(){e=j("div"),t=j("div"),r=j("div"),a=Pe(i),o=fe(),l=j("div"),s=Pe(u),c=fe(),f=j("div"),h&&h.c(),L(r,"class","setting-item-name"),L(l,"class","setting-item-description"),L(t,"class","setting-item-info"),L(f,"class","setting-item-control svelte-17mpvkc"),_t(f,"vertical-control",n[3]),L(e,"class","setting-item svelte-17mpvkc"),_t(e,"setting-item-heading",n[2]),_t(e,"vertical",n[3])},m(y,w){Y(y,e,w),z(e,t),z(t,r),z(r,a),z(t,o),z(t,l),z(l,s),z(e,c),z(e,f),h&&h.m(f,null),p=!0},p(y,[w]){var v,x;(!p||w&1)&&i!==(i=((v=y[0])!=null?v:"")+"")&&rt(a,i),(!p||w&2)&&u!==(u=((x=y[1])!=null?x:"")+"")&&rt(s,u),h&&h.p&&(!p||w&16)&&ea(h,m,y,y[4],p?Ki(m,y[4],w,null):ta(y[4]),null),(!p||w&8)&&_t(f,"vertical-control",y[3]),(!p||w&4)&&_t(e,"setting-item-heading",y[2]),(!p||w&8)&&_t(e,"vertical",y[3])},i(y){p||(te(h,y),p=!0)},o(y){ae(h,y),p=!1},d(y){y&&J(e),h&&h.d(y)}}}function rJ(n,e,t){let{$$slots:r={},$$scope:i}=e,{name:a=void 0}=e,{description:o=void 0}=e,{heading:l=!1}=e,{vertical:u=!1}=e;return n.$$set=s=>{"name"in s&&t(0,a=s.name),"description"in s&&t(1,o=s.description),"heading"in s&&t(2,l=s.heading),"vertical"in s&&t(3,u=s.vertical),"$$scope"in s&&t(4,i=s.$$scope)},[a,o,l,u,i,r]}var S_=class extends Ve{constructor(e){super(),qe(this,e,rJ,tJ,Ue,{name:0,description:1,heading:2,vertical:3},eJ)}},$n=S_;var H4=require("obsidian");var F4=require("obsidian"),Tm=class extends F4.FuzzySuggestModal{constructor(t,r){super(t.app);this.plugin=t,this.selectCallback=r}getItems(){return this.app.commands.listCommands()}getItemText(t){return t.name}onChooseItem(t,r){this.selectCallback(t)}};var Im=require("obsidian"),Fm=class extends Im.FuzzySuggestModal{constructor(t,r){super(t.app);this.plugin=t,this.selectCallback=r}getItems(){return this.app.vault.getAllLoadedFiles().filter(t=>t instanceof Im.TFolder)}getItemText(t){return t.path}onChooseItem(t,r){this.selectCallback(t)}};var Om=require("obsidian"),Bm=class extends Om.FuzzySuggestModal{constructor(t,r){super(t.app);this.plugin=t,this.selectCallback=r}getItems(){return this.app.vault.getAllLoadedFiles().filter(t=>t instanceof Om.TFile)}getItemText(t){return t.path}onChooseItem(t,r){this.selectCallback(t)}};function nJ(n){let e,t,r,i;return{c(){e=j("div"),t=j("input"),L(t,"type","checkbox"),L(t,"tabindex","-1"),t.checked=n[0],L(e,"class","checkbox-container"),L(e,"role","switch"),L(e,"tabindex","0"),L(e,"aria-checked",n[0]),_t(e,"is-enabled",n[0])},m(a,o){Y(a,e,o),z(e,t),r||(i=be(e,"click",n[1]),r=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&L(e,"aria-checked",a[0]),o&1&&_t(e,"is-enabled",a[0])},i:Se,o:Se,d(a){a&&J(e),r=!1,i()}}}function iJ(n,e,t){let{checked:r}=e,i=()=>t(0,r=!r);return n.$$set=a=>{"checked"in a&&t(0,r=a.checked)},[r,i]}var N_=class extends Ve{constructor(e){super(),qe(this,e,iJ,nJ,Ue,{checked:0})}},M_=N_;function I4(n,e,t){let r=n.slice();return r[36]=e[t],r[37]=e,r[38]=t,r}function B4(n,e,t){let r=n.slice();return r[39]=e[t],r}function O4(n,e,t){let r=n.slice();return r[39]=e[t],r}function aJ(n){let e,t,r;return{c(){e=j("input"),L(e,"type","text")},m(i,a){Y(i,e,a),Xe(e,n[1].label),t||(r=be(e,"input",n[10]),t=!0)},p(i,a){a[0]&2&&e.value!==i[1].label&&Xe(e,i[1].label)},d(i){i&&J(e),t=!1,r()}}}function P4(n){let e,t=n[39]+"",r,i;return{c(){e=j("option"),r=Pe(t),e.__value=i=n[39],Xe(e,e.__value)},m(a,o){Y(a,e,o),z(e,r)},p:Se,d(a){a&&J(e)}}}function oJ(n){let e,t,r,i=We(Object.values(Oa)),a=[];for(let o=0;on[11].call(e))},m(o,l){Y(o,e,l);for(let u=0;uyo(e,"checked",i)),{c(){Fe(e.$$.fragment)},m(o,l){Me(e,o,l),r=!0},p(o,l){let u={};!t&&l[0]&2&&(t=!0,u.checked=o[1].hidden,go(()=>t=!1)),e.$set(u)},i(o){r||(te(e.$$.fragment,o),r=!0)},o(o){ae(e.$$.fragment,o),r=!1},d(o){Te(e,o)}}}function R4(n){let e,t=n[39]+"",r,i;return{c(){e=j("option"),r=Pe(t),e.__value=i=n[39],Xe(e,e.__value)},m(a,o){Y(a,e,o),z(e,r)},p:Se,d(a){a&&J(e)}}}function lJ(n){let e;return{c(){e=Pe("Add Action")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function k4(n){let e,t;return e=new $n({props:{name:"Command: "+(n[36].command||"none"),description:"The command to execute when this action runs.",$$slots:{default:[pJ]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i[0]&2&&(a.name="Command: "+(r[36].command||"none")),i[0]&2|i[1]&8192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function cJ(n){let e;return{c(){e=Pe("Change")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function fJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function pJ(n){let e,t,r,i;function a(){return n[16](n[36])}e=new Ut({props:{variant:"primary",$$slots:{default:[cJ]},$$scope:{ctx:n}}}),e.$on("click",a);function o(){return n[17](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[fJ]},$$scope:{ctx:n}}}),r.$on("click",o),{c(){Fe(e.$$.fragment),t=fe(),Fe(r.$$.fragment)},m(l,u){Me(e,l,u),Y(l,t,u),Me(r,l,u),i=!0},p(l,u){n=l;let s={};u[1]&8192&&(s.$$scope={dirty:u,ctx:n}),e.$set(s);let c={};u[1]&8192&&(c.$$scope={dirty:u,ctx:n}),r.$set(c)},i(l){i||(te(e.$$.fragment,l),te(r.$$.fragment,l),i=!0)},o(l){ae(e.$$.fragment,l),ae(r.$$.fragment,l),i=!1},d(l){l&&J(t),Te(e,l),Te(r,l)}}}function L4(n){let e,t;return e=new $n({props:{name:"Link",description:"The link to open.",$$slots:{default:[dJ]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i[0]&2|i[1]&8192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function mJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function dJ(n){let e,t,r,i,a,o;function l(){n[18].call(e,n[37],n[38])}function u(){return n[19](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[mJ]},$$scope:{ctx:n}}}),r.$on("click",u),{c(){e=j("input"),t=fe(),Fe(r.$$.fragment),L(e,"type","text"),L(e,"placeholder","[[Some Note]] or https://www.example.com")},m(s,c){Y(s,e,c),Xe(e,n[36].link),Y(s,t,c),Me(r,s,c),i=!0,a||(o=be(e,"input",l),a=!0)},p(s,c){n=s,c[0]&2&&e.value!==n[36].link&&Xe(e,n[36].link);let f={};c[1]&8192&&(f.$$scope={dirty:c,ctx:n}),r.$set(f)},i(s){i||(te(r.$$.fragment,s),i=!0)},o(s){ae(r.$$.fragment,s),i=!1},d(s){s&&(J(e),J(t)),Te(r,s),a=!1,o()}}}function V4(n){let e,t;return e=new $n({props:{name:"JS File",description:"The JavaScript file to run.",$$slots:{default:[gJ]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i[0]&2|i[1]&8192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function hJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function gJ(n){let e,t,r,i,a,o;function l(){n[20].call(e,n[37],n[38])}function u(){return n[21](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[hJ]},$$scope:{ctx:n}}}),r.$on("click",u),{c(){e=j("input"),t=fe(),Fe(r.$$.fragment),L(e,"type","text"),L(e,"placeholder","someJsFile.js")},m(s,c){Y(s,e,c),Xe(e,n[36].file),Y(s,t,c),Me(r,s,c),i=!0,a||(o=be(e,"input",l),a=!0)},p(s,c){n=s,c[0]&2&&e.value!==n[36].file&&Xe(e,n[36].file);let f={};c[1]&8192&&(f.$$scope={dirty:c,ctx:n}),r.$set(f)},i(s){i||(te(r.$$.fragment,s),i=!0)},o(s){ae(r.$$.fragment,s),i=!1},d(s){s&&(J(e),J(t)),Te(r,s),a=!1,o()}}}function U4(n){let e,t;return e=new $n({props:{name:"Text",description:"The text to input at the cursor.",$$slots:{default:[yJ]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i[0]&2|i[1]&8192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function vJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function yJ(n){let e,t,r,i,a,o;function l(){n[22].call(e,n[37],n[38])}function u(){return n[23](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[vJ]},$$scope:{ctx:n}}}),r.$on("click",u),{c(){e=j("input"),t=fe(),Fe(r.$$.fragment),L(e,"type","text"),L(e,"placeholder","some text")},m(s,c){Y(s,e,c),Xe(e,n[36].str),Y(s,t,c),Me(r,s,c),i=!0,a||(o=be(e,"input",l),a=!0)},p(s,c){n=s,c[0]&2&&e.value!==n[36].str&&Xe(e,n[36].str);let f={};c[1]&8192&&(f.$$scope={dirty:c,ctx:n}),r.$set(f)},i(s){i||(te(r.$$.fragment,s),i=!0)},o(s){ae(r.$$.fragment,s),i=!1},d(s){s&&(J(e),J(t)),Te(r,s),a=!1,o()}}}function q4(n){let e,t;return e=new $n({props:{name:"Sleep Time",description:"The time to sleep in milliseconds.",$$slots:{default:[bJ]},$$scope:{ctx:n}}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p(r,i){let a={};i[0]&2|i[1]&8192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function xJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function bJ(n){let e,t,r,i,a,o;function l(){n[24].call(e,n[37],n[38])}function u(){return n[25](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[xJ]},$$scope:{ctx:n}}}),r.$on("click",u),{c(){e=j("input"),t=fe(),Fe(r.$$.fragment),L(e,"type","number"),L(e,"placeholder","100 ms")},m(s,c){Y(s,e,c),Xe(e,n[36].ms),Y(s,t,c),Me(r,s,c),i=!0,a||(o=be(e,"input",l),a=!0)},p(s,c){n=s,c[0]&2&&ai(e.value)!==n[36].ms&&Xe(e,n[36].ms);let f={};c[1]&8192&&(f.$$scope={dirty:c,ctx:n}),r.$set(f)},i(s){i||(te(r.$$.fragment,s),i=!0)},o(s){ae(r.$$.fragment,s),i=!1},d(s){s&&(J(e),J(t)),Te(r,s),a=!1,o()}}}function z4(n){let e,t,r,i,a,o,l,u,s,c,f,p;function m(){return n[26](n[38])}return r=new Ut({props:{variant:"destructive",$$slots:{default:[wJ]},$$scope:{ctx:n}}}),r.$on("click",m),a=new $n({props:{name:"Template File: "+(n[36].templateFile||"none"),description:"The template file to create a new note of.",$$slots:{default:[AJ]},$$scope:{ctx:n}}}),l=new $n({props:{name:"Folder: "+(n[36].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[EJ]},$$scope:{ctx:n}}}),s=new $n({props:{name:"File Name: "+(n[36].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[CJ]},$$scope:{ctx:n}}}),f=new $n({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[SJ]},$$scope:{ctx:n}}}),{c(){e=j("p"),t=Pe(`Remove Action `),Fe(r.$$.fragment),i=fe(),Fe(a.$$.fragment),o=fe(),Fe(l.$$.fragment),u=fe(),Fe(s.$$.fragment),c=fe(),Fe(f.$$.fragment)},m(h,d){Y(h,e,d),z(e,t),Me(r,e,null),Y(h,i,d),Me(a,h,d),Y(h,o,d),Me(l,h,d),Y(h,u,d),Me(s,h,d),Y(h,c,d),Me(f,h,d),p=!0},p(h,d){n=h;let g={};d[1]&8192&&(g.$$scope={dirty:d,ctx:n}),r.$set(g);let y={};d[0]&2&&(y.name="Template File: "+(n[36].templateFile||"none")),d[0]&2|d[1]&8192&&(y.$$scope={dirty:d,ctx:n}),a.$set(y);let w={};d[0]&2&&(w.name="Folder: "+(n[36].folderPath||"none")),d[0]&2|d[1]&8192&&(w.$$scope={dirty:d,ctx:n}),l.$set(w);let v={};d[0]&2&&(v.name="File Name: "+(n[36].fileName||"default")),d[0]&2|d[1]&8192&&(v.$$scope={dirty:d,ctx:n}),s.$set(v);let x={};d[0]&2|d[1]&8192&&(x.$$scope={dirty:d,ctx:n}),f.$set(x)},i(h){p||(te(r.$$.fragment,h),te(a.$$.fragment,h),te(l.$$.fragment,h),te(s.$$.fragment,h),te(f.$$.fragment,h),p=!0)},o(h){ae(r.$$.fragment,h),ae(a.$$.fragment,h),ae(l.$$.fragment,h),ae(s.$$.fragment,h),ae(f.$$.fragment,h),p=!1},d(h){h&&(J(e),J(i),J(o),J(u),J(c)),Te(r),Te(a,h),Te(l,h),Te(s,h),Te(f,h)}}}function wJ(n){let e,t;return e=new ur({props:{iconName:"x"}}),{c(){Fe(e.$$.fragment)},m(r,i){Me(e,r,i),t=!0},p:Se,i(r){t||(te(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){Te(e,r)}}}function _J(n){let e;return{c(){e=Pe("Change")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function AJ(n){let e,t;function r(){return n[27](n[36])}return e=new Ut({props:{variant:"primary",$$slots:{default:[_J]},$$scope:{ctx:n}}}),e.$on("click",r),{c(){Fe(e.$$.fragment)},m(i,a){Me(e,i,a),t=!0},p(i,a){n=i;let o={};a[1]&8192&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(i){t||(te(e.$$.fragment,i),t=!0)},o(i){ae(e.$$.fragment,i),t=!1},d(i){Te(e,i)}}}function DJ(n){let e;return{c(){e=Pe("Change")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function EJ(n){let e,t;function r(){return n[28](n[36])}return e=new Ut({props:{variant:"primary",$$slots:{default:[DJ]},$$scope:{ctx:n}}}),e.$on("click",r),{c(){Fe(e.$$.fragment)},m(i,a){Me(e,i,a),t=!0},p(i,a){n=i;let o={};a[1]&8192&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(i){t||(te(e.$$.fragment,i),t=!0)},o(i){ae(e.$$.fragment,i),t=!1},d(i){Te(e,i)}}}function CJ(n){let e,t,r;function i(){n[29].call(e,n[37],n[38])}return{c(){e=j("input"),L(e,"type","text"),L(e,"placeholder","some name")},m(a,o){Y(a,e,o),Xe(e,n[36].fileName),t||(r=be(e,"input",i),t=!0)},p(a,o){n=a,o[0]&2&&e.value!==n[36].fileName&&Xe(e,n[36].fileName)},d(a){a&&J(e),t=!1,r()}}}function SJ(n){let e,t,r;function i(o){n[30](o,n[36])}let a={};return n[36].openNote!==void 0&&(a.checked=n[36].openNote),e=new M_({props:a}),Fr.push(()=>yo(e,"checked",i)),{c(){Fe(e.$$.fragment)},m(o,l){Me(e,o,l),r=!0},p(o,l){n=o;let u={};!t&&l[0]&2&&(t=!0,u.checked=n[36].openNote,go(()=>t=!1)),e.$set(u)},i(o){r||(te(e.$$.fragment,o),r=!0)},o(o){ae(e.$$.fragment,o),r=!1},d(o){Te(e,o)}}}function $4(n,e){let t,r=e[9](e[36].type)+"",i,a,o,l,u,s,c,f,p,m=e[36].type==="command"&&k4(e),h=e[36].type==="open"&&L4(e),d=e[36].type==="js"&&V4(e),g=e[36].type==="input"&&U4(e),y=e[36].type==="sleep"&&q4(e),w=e[36].type==="templaterCreateNote"&&z4(e);return{key:n,first:null,c(){t=j("h5"),i=Pe(r),a=fe(),m&&m.c(),o=fe(),h&&h.c(),l=fe(),d&&d.c(),u=fe(),g&&g.c(),s=fe(),y&&y.c(),c=fe(),w&&w.c(),f=or(),this.first=t},m(v,x){Y(v,t,x),z(t,i),Y(v,a,x),m&&m.m(v,x),Y(v,o,x),h&&h.m(v,x),Y(v,l,x),d&&d.m(v,x),Y(v,u,x),g&&g.m(v,x),Y(v,s,x),y&&y.m(v,x),Y(v,c,x),w&&w.m(v,x),Y(v,f,x),p=!0},p(v,x){e=v,(!p||x[0]&2)&&r!==(r=e[9](e[36].type)+"")&&rt(i,r),e[36].type==="command"?m?(m.p(e,x),x[0]&2&&te(m,1)):(m=k4(e),m.c(),te(m,1),m.m(o.parentNode,o)):m&&(gt(),ae(m,1,1,()=>{m=null}),vt()),e[36].type==="open"?h?(h.p(e,x),x[0]&2&&te(h,1)):(h=L4(e),h.c(),te(h,1),h.m(l.parentNode,l)):h&&(gt(),ae(h,1,1,()=>{h=null}),vt()),e[36].type==="js"?d?(d.p(e,x),x[0]&2&&te(d,1)):(d=V4(e),d.c(),te(d,1),d.m(u.parentNode,u)):d&&(gt(),ae(d,1,1,()=>{d=null}),vt()),e[36].type==="input"?g?(g.p(e,x),x[0]&2&&te(g,1)):(g=U4(e),g.c(),te(g,1),g.m(s.parentNode,s)):g&&(gt(),ae(g,1,1,()=>{g=null}),vt()),e[36].type==="sleep"?y?(y.p(e,x),x[0]&2&&te(y,1)):(y=q4(e),y.c(),te(y,1),y.m(c.parentNode,c)):y&&(gt(),ae(y,1,1,()=>{y=null}),vt()),e[36].type==="templaterCreateNote"?w?(w.p(e,x),x[0]&2&&te(w,1)):(w=z4(e),w.c(),te(w,1),w.m(f.parentNode,f)):w&&(gt(),ae(w,1,1,()=>{w=null}),vt())},i(v){p||(te(m),te(h),te(d),te(g),te(y),te(w),p=!0)},o(v){ae(m),ae(h),ae(d),ae(g),ae(y),ae(w),p=!1},d(v){v&&(J(t),J(a),J(o),J(l),J(u),J(s),J(c),J(f)),m&&m.d(v),h&&h.d(v),d&&d.d(v),g&&g.d(v),y&&y.d(v),w&&w.d(v)}}}function NJ(n){let e;return{c(){e=Pe("Copy to Clipboard")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function MJ(n){let e;return{c(){e=Pe("Cancel")},m(t,r){Y(t,e,r)},d(t){t&&J(e)}}}function TJ(n){let e,t,r,i;return e=new Ut({props:{variant:"primary",$$slots:{default:[NJ]},$$scope:{ctx:n}}}),e.$on("click",n[32]),r=new Ut({props:{variant:"default",$$slots:{default:[MJ]},$$scope:{ctx:n}}}),r.$on("click",n[33]),{c(){Fe(e.$$.fragment),t=fe(),Fe(r.$$.fragment)},m(a,o){Me(e,a,o),Y(a,t,o),Me(r,a,o),i=!0},p(a,o){let l={};o[1]&8192&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o[1]&8192&&(u.$$scope={dirty:o,ctx:a}),r.$set(u)},i(a){i||(te(e.$$.fragment,a),te(r.$$.fragment,a),i=!0)},o(a){ae(e.$$.fragment,a),ae(r.$$.fragment,a),i=!1},d(a){a&&J(t),Te(e,a),Te(r,a)}}}function FJ(n){let e,t,r,i,a,o,l,u,s,c,f,p,m,h,d,g,y=[],w=new Map,v,x,_,b,D,C,A,E,F;r=new $n({props:{name:"Label",description:"The label shown on the button.",$$slots:{default:[aJ]},$$scope:{ctx:n}}}),a=new $n({props:{name:"Style",description:"The style variant of the button",$$slots:{default:[oJ]},$$scope:{ctx:n}}}),l=new $n({props:{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",$$slots:{default:[sJ]},$$scope:{ctx:n}}}),s=new $n({props:{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",$$slots:{default:[uJ]},$$scope:{ctx:n}}});let I=We(Object.values(Du)),O=[];for(let T=0;TT[38];for(let T=0;Tn[14].call(m))},m(T,N){Y(T,e,N),Y(T,t,N),Me(r,T,N),Y(T,i,N),Me(a,T,N),Y(T,o,N),Me(l,T,N),Y(T,u,N),Me(s,T,N),Y(T,c,N),Y(T,f,N),Y(T,p,N),Y(T,m,N);for(let V=0;V{o==null||o.unload()});function u(P,K){o==null||o.unload(),K&&(K.empty(),o=new lo(K,(0,H4.stringifyYaml)(P),r.plugin,"",jt()),o.load())}function s(){var P;(P=i.actions)===null||P===void 0||P.push(r.plugin.api.buttonActionRunner.createDefaultAction(l)),t(1,i)}function c(P){i.actions.splice(P,1),t(1,i)}function f(P){new Tm(r.plugin,K=>{P.command=K.id,t(1,i)}).open()}function p(P){new Bm(r.plugin,K=>{P.templateFile=K.path,t(1,i)}).open()}function m(P){new Fm(r.plugin,K=>{P.folderPath=K.path,t(1,i)}).open()}function h(P){return P==="command"?"Run a Command":P==="open"?"Open a Link":P==="js"?"Run a JavaScript File":P==="input"?"Insert Text at Cursor":P==="sleep"?"Sleep for Some Time":P==="templaterCreateNote"?"Create a New Note Using Templater":"CHANGE ME"}function d(){i.label=this.value,t(1,i)}function g(){i.style=Wn(this),t(1,i)}function y(){i.id=this.value,t(1,i)}function w(P){n.$$.not_equal(i.hidden,P)&&(i.hidden=P,t(1,i))}function v(){l=Wn(this),t(3,l)}let x=()=>s(),_=P=>f(P),b=P=>c(P);function D(P,K){P[K].link=this.value,t(1,i)}let C=P=>c(P);function A(P,K){P[K].file=this.value,t(1,i)}let E=P=>c(P);function F(P,K){P[K].str=this.value,t(1,i)}let I=P=>c(P);function O(P,K){P[K].ms=ai(this.value),t(1,i)}let k=P=>c(P),R=P=>c(P),T=P=>p(P),N=P=>m(P);function V(P,K){P[K].fileName=this.value,t(1,i)}function B(P,K){n.$$.not_equal(K.openNote,P)&&(K.openNote=P,t(1,i))}function X(P){Fr[P?"unshift":"push"](()=>{a=P,t(2,a)})}let ee=()=>r.okay(i),W=()=>r.cancel();return n.$$set=P=>{"modal"in P&&t(0,r=P.modal)},n.$$.update=()=>{n.$$.dirty[0]&6&&u(i,a)},[r,i,a,l,s,c,f,p,m,h,d,g,y,w,v,x,_,b,D,C,A,E,F,I,O,k,R,T,N,V,B,X,ee,W]}var T_=class extends Ve{constructor(e){super(),qe(this,e,IJ,FJ,Ue,{modal:0},null,[-1,-1])}},G4=T_;var Pm=class extends W4.Modal{constructor(t,r){super(t.app);this.plugin=t,this.onOkay=r}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new G4({target:this.contentEl,props:{modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}okay(t){this.close(),this.onOkay(t)}cancel(){this.close()}};var BJ=["true","false","on","off","yes","no"],OJ=new RegExp("\\b(("+BJ.join(")|(")+"))$","i"),kl={name:"yaml",token:function(n,e){var t=n.peek(),r=e.escaped;if(e.escaped=!1,t=="#"&&(n.pos==0||/\s/.test(n.string.charAt(n.pos-1))))return n.skipToEnd(),"comment";if(n.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&n.indentation()>e.keyCol)return n.skipToEnd(),"string";if(e.literal&&(e.literal=!1),n.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,n.match("---")||n.match("..."))return"def";if(n.match(/^\s*-\s+/))return"meta"}if(n.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!r&&t==",")return n.next(),"meta";if(e.inlinePairs>0&&!r&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,n.next(),"meta";if(e.pairStart){if(n.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(n.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&n.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&n.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(n.match(OJ))return"keyword"}return!e.pair&&n.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=n.indentation(),"atom"):e.pair&&n.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",n.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function j4(n){if(!n.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>{var i,a;return(a=(i=kl).startState)==null?void 0:a.call(i,4)},blankLine:i=>{var a,o;return(o=(a=kl).blankLine)==null?void 0:o.call(a,i,4)},copyState:i=>{var a,o;return(o=(a=kl).startState)==null?void 0:o.call(a,4)},token:(i,a)=>{var o,l;return`line-HyperMD-codeblock ${(l=(o=kl).token)==null?void 0:l.call(o,i,a)}`}}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",t=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let u=[i.string],s=1,c=i.lookAhead(s);for(;c!==void 0&&!e.test(c)&&(u.push(c),s+=1,c=i.lookAhead(s),!(s>100)););a.str=u.filter(p=>p.trim()!=="").join(` `);let f=Tn.isDeclarationAndGetMDRCType(a.str.trim());f===void 0?a.highlights=new co(a.str,[]):(a.mdrcType=f,a.highlights=n.api.syntaxHighlighting.highlight(a.str,a.mdrcType,!0))}let l=a.highlights.getHighlights().filter(u=>u.range.from.line===a.line).find(u=>u.range.from.column===i.pos+1);return l===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1(r.DEV="dev",r.CANARY="canary",r.RELEASE="release",r))(sd||{}),Rm=class extends km.Plugin{async onload(){console.log("meta-bind | Main >> load"),this.build=this.determineBuild(),await this.loadSettings(),await this.saveSettings(),this.addSettingTab(new lc(this.app,this)),this.api=new ym(this),this.internal=new Mm(this),this.mdrcManager=new Am;let t=new Dm(this);this.metadataManager=new mc(t),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(l4(this)),this.addCommands(),j4(this),this.registerView(Oo,r=>new uc(r,this)),this.addStatusBarBuildIndicator()}onunload(){console.log("meta-bind | Main >> unload"),this.mdrcManager.unload(),this.metadataManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}addPostProcessors(){this.registerMarkdownPostProcessor((t,r)=>{let i=t.querySelectorAll("code");for(let a=0;a{let a=r,o=t.trim(),l=Tn.isDeclarationAndGetMDRCType(o);l==="INPUT_FIELD"&&this.api.createInputFieldFromString(o,"block",i.sourcePath,a,i,void 0),l==="VIEW_FIELD"&&this.api.createViewFieldFromString(o,"block",i.sourcePath,a,i),l==="BUTTON"&&this.api.createInlineButtonFromString(o,i.sourcePath,a,i)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(t,r,i)=>{this.api.createJsViewFieldFromString(t,"block",i.sourcePath,r,i)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(t,r,i)=>{let a=new Pl(r,t,this,i.sourcePath,jt(),0);i.addChild(a)});for(let t=1;t<=w_;t++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${t}`,(r,i,a)=>{let o=new Pl(i,r,this,a.sourcePath,jt(),t);a.addChild(o)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(t,r,i)=>{let a=new lo(r,t,this,i.sourcePath,jt());i.addChild(a)})}addCommands(){this.addCommand({id:"open-docs",name:"Open Meta Bind Docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.addCommand({id:"open-faq",name:"Open Meta Bind FAQ",callback:()=>{this.activateView(Oo)}}),this.addCommand({id:"open-help",name:"Open Meta Bind Help",callback:()=>{this.activateView(Oo)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{new Pm(this,t=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button ${(0,km.stringifyYaml)(t)} \`\`\``)}).open()}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let t=this.addStatusBarItem();t.setText("Meta Bind Dev Build"),t.addClass("mb-error"),this.register(()=>t.remove())}if(this.build==="canary"){let t=this.addStatusBarItem();t.setText(`Meta Bind Canary Build (${this.manifest.version})`),t.addClass("mb-error"),this.register(()=>t.remove())}}loadTemplates(){let t=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);t.hasErrors()&&console.warn("meta-bind | failed to parse templates",t)}isFilePathExcluded(t){for(let r of this.settings.excludedFolders)if(t.startsWith(r))return!0;return!1}async loadSettings(){console.log("meta-bind | Main >> settings load");let t=await this.loadData();t=this.applyTemplatesMigration(Object.assign({},Ai,t)),this.settings=t,await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),Vr.dateFormat=this.settings.preferredDateFormat,Hk(this.settings.firstWeekday),await this.saveData(this.settings)}applyTemplatesMigration(t){return t}async activateView(t){let{workspace:r}=this.app,i,a=r.getLeavesOfType(t);a.length>0?i=a[0]:(i=r.getLeaf("tab"),await i.setViewState({type:t,active:!0})),r.revealLeaf(i)}}; /*! Bundled license information: complex.js/complex.js: (** * @license Complex.js v2.1.1 12/05/2020 * * Copyright (c) 2020, Robert Eisele (robert@xarg.org) * Dual licensed under the MIT or GPL Version 2 licenses. **) fraction.js/fraction.js: (** * @license Fraction.js v4.3.0 20/08/2023 * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ * * Copyright (c) 2023, Robert Eisele (robert@raw.org) * Dual licensed under the MIT or GPL Version 2 licenses. **) 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 * MIT Licence *) */