oscar.plaisant@icloud.com 217c1820f7 update
2024-01-10 02:18:57 +01:00

137 lines
971 KiB
JavaScript

/*
-------------------------------------------
Meta Bind Plugin - Release Build
-------------------------------------------
By: Moritz Jung (https://mprojectscode.github.io/)
Time: Thu, 04 Jan 2024 13:16:15 GMT
Version: 0.11.0
-------------------------------------------
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 K5=Object.create;var Iu=Object.defineProperty;var e8=Object.getOwnPropertyDescriptor;var t8=Object.getOwnPropertyNames;var r8=Object.getPrototypeOf,n8=Object.prototype.hasOwnProperty;var i8=(r,e,t)=>e in r?Iu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var zr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),a8=(r,e)=>{for(var t in e)Iu(r,t,{get:e[t],enumerable:!0})},Q_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of t8(e))!n8.call(r,i)&&i!==t&&Iu(r,i,{get:()=>e[i],enumerable:!(n=e8(e,i))||n.enumerable});return r};var ur=(r,e,t)=>(t=r!=null?K5(r8(r)):{},Q_(e||!r||!r.__esModule?Iu(t,"default",{value:r,enumerable:!0}):t,r)),o8=r=>Q_(Iu({},"__esModule",{value:!0}),r);var Yr=(r,e,t)=>(i8(r,typeof e!="symbol"?e+"":e,t),t);var Ac=zr(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.P_HELPERS=On.ParserHelpers=On.validateRegexFlags=On.validateRange=On.getIndex=On.arrayUnion=void 0;var Md=Dc();function m6(r,e){if(r===void 0&&e===void 0)return;if(r===void 0)return e;if(e===void 0)return r;let t=[...r];for(let n of e)t.includes(n)||t.push(n);return t}On.arrayUnion=m6;function d6(r){return r===void 0?-1:r.index}On.getIndex=d6;function h6(r,e){if(e<r)throw new Error(`Invalid Range: max might not be smaller than min. Received [${r}, ${e}].`);if(r<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${r}, ${e}].`);if(r===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${r}, ${e}].`);if(!Number.isInteger(r)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${r}, ${e}].`)}On.validateRange=h6;function g6(r){for(let e of r)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")throw new Error(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}On.validateRegexFlags=g6;var _c=class{followedBy(e){return new Md.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new Md.Parser(function(n){let i=n.copy(),a=e.p(i),o=n.sliceTo(i.position.index);return a.success?n.fail("not '"+o+"'"):n.succeed(void 0)})}test(e){return new Md.Parser(function(n){let i=n.input[n.position.index];return!n.atEOF()&&e(i)?n.succeedOffset(1,i):n.fail(`a character matching ${e}`)})}};On.ParserHelpers=_c;On.P_HELPERS=new _c});var KA=zr(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.ParserContext=void 0;var Td=Ac(),Fd=class r{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new r(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(e<this.position.index)throw new Error(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(let t=this.position.index;t<e;t++)this.input[t]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,t){return this.succeedAt(this.position.index+e,t)}failOffset(e,t){return this.failAt(this.position.index+e,t)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t,furthest:void 0,expected:void 0}}failAt(e,t){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(t)?t:[t]}}merge(e,t){if(e===void 0)return t;let n=(0,Td.getIndex)(e.furthest),i=(0,Td.getIndex)(t.furthest);if(i>n)return t;let a=i===n?(0,Td.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};Ec.ParserContext=Fd});var Xn=zr(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.P_UTILS=void 0;var Sc=Dc(),fr=Rn(),Id=class r{static position(){return new Sc.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Sc.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Sc.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Sc.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return fr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return fr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return fr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return fr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return fr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return fr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return fr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return fr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return fr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return fr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return fr.P.string("\r")}static lf(){return fr.P.string(`
`)}static crlf(){return fr.P.string(`\r
`)}static newline(){return fr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,n){return fr.P.sequenceMap((i,a)=>i.reduce((o,l)=>n(l,o),a),e.many(),t)}static postfix(e,t,n){return fr.P.sequenceMap((i,a)=>a.reduce((o,l)=>n(l,o),i),t,e.many())}static binaryRight(e,t,n){return fr.P.sequenceMap((i,a)=>i.reverse().reduce((o,l)=>{let[u,s]=l;return n(u,s,o)},a),fr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,n){return fr.P.sequenceMap((i,a)=>a.reduce((o,l)=>{let[u,s]=l;return n(o,u,s)},i),t,fr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,n){return fr.P.sequenceMap((i,a,o)=>i.reverse().reduce((l,u)=>{let[s,c,f]=u;return n({from:s,to:o},c,f,l)},a),fr.P.sequence(r.position(),t,e.trim(this.optionalWhitespace())).many(),t,r.position())}static binaryLeftRange(e,t,n){return fr.P.sequenceMap((i,a,o)=>o.reduce((l,u)=>{let[s,c,f]=u;return n({from:i,to:f},l,s,c)},a),r.position(),t,fr.P.sequence(e.trim(this.optionalWhitespace()),t,r.position()).many())}static func(e,t,n){let i=typeof e=="string"?fr.P.string(e):e;return fr.P.sequenceMap((a,o,l,u,s,c)=>n(a,u),i,fr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),fr.P.string(")"))}};Nc.P_UTILS=Id});var tD=zr(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.ParsingError=Es.createParsingErrorMessage=void 0;function eD(r,e,t){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=r.split(`
`)[e.furthest.line-1],l=`${e.furthest.line} | `;i+=`
${l}${o}`,i+=`
${" ".repeat(e.furthest.column-1+l.length)}^ (${n})`}return i}Es.createParsingErrorMessage=eD;var Bd=class extends Error{constructor(e,t){super(eD(e,t,!0))}};Es.ParsingError=Bd});var Dc=zr(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.Parser=void 0;var v6=KA(),pi=Rn(),Pd=Ac(),Ss=Xn(),y6=tD(),Od=class r{constructor(e){this.p=e}tryParse(e){return this.p(new v6.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 pi.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(pi.P.string(e))}wrap(e,t){let n=this;return new r(function(a){let o=e.p(a);if(!o.success)return o;let l=a.merge(o,n.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(pi.P.string(e),pi.P.string(t))}then(e){let t=this;return new r(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 r(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 pi.P.sequence(this,e)}many(){let e=this;return new r(function(n){let i,a=n.position.index,o=[];for(;;){let l=n.copy(),u=e.p(l);if(i=n.merge(i,u),i.success){if(l.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(l.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,t){(0,Pd.validateRange)(e,t);let n=this;return new r(function(a){let o,l,u=[],s=0;for(;s<e;s++)if(o=n.p(a),l=a.merge(l,o),o.success)u.push(o.value);else return l;for(;s<t;s++){let c=a.copy();if(o=n.p(c),l=a.merge(l,o),o.success)a.moveToPosition(c.position),u.push(o.value);else break}return a.merge(l,a.succeed(u))})}atMost(e){return this.repeat(0,e)}atLeast(e){return pi.P.sequenceMap((t,n)=>t.concat(n),this.repeat(e,e),this.many())}separateBy(e){return pi.P.separateBy(this,e)}separateByNotEmpty(e){return pi.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new r(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return pi.P.sequenceMap(function(t,n,i){return{value:n,range:{from:t,to:i}}},Ss.P_UTILS.position(),this,Ss.P_UTILS.position())}namedMarker(e){return pi.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},Ss.P_UTILS.position(),this,Ss.P_UTILS.position())}node(e){return pi.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},Ss.P_UTILS.position(),this,Ss.P_UTILS.position())}followedBy(e){return this.skip(Pd.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(Pd.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new r(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 r(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(pi.P.succeed(e))}chain(e){let t=this;return new r(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 r(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,t="",n=new Map,i=new Map;return new r(function(o){let l=o.position.index;if(o.input!==t)t=o.input,n.clear(),i.clear();else{let s=n.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 n.set(l,Object.assign({},u)),i.set(l,o.getPosition()),u})}};Cc.Parser=Od});var Rn=zr(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.P=void 0;var Qn=Dc(),Mc=Ac(),Rd=class r{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Qn.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let u=e[o].p(n);if(i=n.merge(i,u),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...t){if(t.length===0)throw new Error("sequenceMap must have at least one parser argument");return new Qn.Parser(function(i){let a,o=new Array(t.length);for(let l=0;l<t.length;l++){let s=t[l].p(i);if(a=i.merge(a,s),!a.success)return a;o[l]=a.value}return a.value=e(...o),a})}static createLanguage(e){let t={},n={},i={};for(let a in e)i[a]=r.reference(()=>e[a](t,i)),Object.defineProperty(n,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](n,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Qn.Parser(function(n){let i;for(let a of e){let o=a,l=n.copy(),u=o.p(l);if(i=n.merge(i,u),i.success)return n.moveToPosition(l.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(r.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 Qn.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(t);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,t){(0,Mc.validateRegexFlags)(e.flags);let n=e.source;return t!==void 0?new Qn.Parser(function(a){let o=a.input.slice(a.position.index),l=e.exec(o);if(l!==null){let u=t!=null?t:0;if(u>=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 "+n;return a.fail(s)}else return a.fail(n)}):new Qn.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(n)})}static succeed(e){return new Qn.Parser(function(n){return n.succeed(e)})}static fail(e){return new Qn.Parser(function(n){return n.fail(e)})}static oneOf(e){return Mc.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return Mc.P_HELPERS.test(function(n){return!e.includes(n)}).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 Qn.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static manyNotOf(e){return new Qn.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&!e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static custom(e){return new Qn.Parser(e)}static range(e,t){let n=e.charCodeAt(0),i=t.charCodeAt(0);return Mc.P_HELPERS.test(function(o){let l=o.charCodeAt(0);return n<=l&&l<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new Qn.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e(n.input[i]);)i++;return n.succeedAt(i,n.input.slice(n.position.index,i))})}static reference(e){return new Qn.Parser(function(n){return e().p(n)})}};Tc.P=Rd});var wh=zr((bh,xh)=>{(function(r,e){typeof bh=="object"&&typeof xh!="undefined"?xh.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self,r["'typed'"]=e())})(bh,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function o(j){return typeof j=="object"&&j!==null&&j.constructor===Object}let l=[{name:"number",test:function(j){return typeof j=="number"}},{name:"string",test:function(j){return typeof j=="string"}},{name:"boolean",test:function(j){return typeof j=="boolean"}},{name:"Function",test:function(j){return typeof j=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(j){return j instanceof Date}},{name:"RegExp",test:function(j){return j instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(j){return j===null}},{name:"undefined",test:function(j){return j===void 0}}],u={name:"any",test:r,isAny:!0},s,c,f=0,p={createCount:0};function m(j){let ae=s.get(j);if(ae)return ae;let pe='Unknown type "'+j+'"',_e=j.toLowerCase(),Te;for(Te of c)if(Te.toLowerCase()===_e){pe+='. Did you mean "'+Te+'" ?';break}throw new TypeError(pe)}function h(j){let ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",pe=ae?m(ae).index:c.length,_e=[];for(let De=0;De<j.length;++De){if(!j[De]||typeof j[De].name!="string"||typeof j[De].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Me=j[De].name;if(s.has(Me))throw new TypeError('Duplicate type name "'+Me+'"');_e.push(Me),s.set(Me,{name:Me,test:j[De].test,isAny:j[De].isAny,index:pe+De,conversionsTo:[]})}let Te=c.slice(pe);c=c.slice(0,pe).concat(_e).concat(Te);for(let De=pe+_e.length;De<c.length;++De)s.get(c[De]).index=De}function d(){s=new Map,c=[],f=0,h([u],!1)}d(),h(l);function g(){let j;for(j of c)s.get(j).conversionsTo=[];f=0}function v(j){let ae=c.filter(pe=>{let _e=s.get(pe);return!_e.isAny&&_e.test(j)});return ae.length?ae:["any"]}function w(j){return j&&typeof j=="function"&&"_typedFunctionData"in j}function y(j,ae,pe){if(!w(j))throw new TypeError(n);let _e=pe&&pe.exact,Te=Array.isArray(ae)?ae.join(","):ae,De=E(Te),Me=b(De);if(!_e||Me in j.signatures){let le=j._typedFunctionData.signatureMap.get(Me);if(le)return le}let Re=De.length,C;if(_e){C=[];let le;for(le in j.signatures)C.push(j._typedFunctionData.signatureMap.get(le))}else C=j._typedFunctionData.signatures;for(let le=0;le<Re;++le){let Ee=De[le],et=[],ut;for(ut of C){let dr=k(ut.params,le);if(!(!dr||Ee.restParam&&!dr.restParam)){if(!dr.hasAny){let jn=A(dr);if(Ee.types.some(Ni=>!jn.has(Ni.name)))continue}et.push(ut)}}if(C=et,C.length===0)break}let z;for(z of C)if(z.params.length<=Re)return z;throw new TypeError("Signature not found (signature: "+(j.name||"unnamed")+"("+b(De,", ")+"))")}function x(j,ae,pe){return y(j,ae,pe).implementation}function _(j,ae){let pe=m(ae);if(pe.test(j))return j;let _e=pe.conversionsTo;if(_e.length===0)throw new Error("There are no conversions to "+ae+" defined.");for(let Te=0;Te<_e.length;Te++)if(m(_e[Te].from).test(j))return _e[Te].convert(j);throw new Error("Cannot convert "+j+" to "+ae)}function b(j){let ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return j.map(pe=>pe.name).join(ae)}function D(j){let ae=j.indexOf("...")===0,_e=(ae?j.length>3?j.slice(3):"any":j).split("|").map(Re=>m(Re.trim())),Te=!1,De=ae?"...":"";return{types:_e.map(function(Re){return Te=Re.isAny||Te,De+=Re.name+"|",{name:Re.name,typeIndex:Re.index,test:Re.test,isAny:Re.isAny,conversion:null,conversionIndex:-1}}),name:De.slice(0,-1),hasAny:Te,hasConversion:!1,restParam:ae}}function S(j){let ae=j.types.map(Me=>Me.name),pe=L(ae),_e=j.hasAny,Te=j.name,De=pe.map(function(Me){let Re=m(Me.from);return _e=Re.isAny||_e,Te+="|"+Me.from,{name:Me.from,typeIndex:Re.index,test:Re.test,isAny:Re.isAny,conversion:Me,conversionIndex:Me.index}});return{types:j.types.concat(De),name:Te,hasAny:_e,hasConversion:De.length>0,restParam:j.restParam}}function A(j){return j.typeSet||(j.typeSet=new Set,j.types.forEach(ae=>j.typeSet.add(ae.name))),j.typeSet}function E(j){let ae=[];if(typeof j!="string")throw new TypeError("Signatures must be strings");let pe=j.trim();if(pe==="")return ae;let _e=pe.split(",");for(let Te=0;Te<_e.length;++Te){let De=D(_e[Te].trim());if(De.restParam&&Te!==_e.length-1)throw new SyntaxError('Unexpected rest parameter "'+_e[Te]+'": only allowed for the last parameter');if(De.types.length===0)return null;ae.push(De)}return ae}function M(j){let ae=V(j);return ae?ae.restParam:!1}function F(j){if(!j||j.types.length===0)return r;if(j.types.length===1)return m(j.types[0].name).test;if(j.types.length===2){let ae=m(j.types[0].name).test,pe=m(j.types[1].name).test;return function(Te){return ae(Te)||pe(Te)}}else{let ae=j.types.map(function(pe){return m(pe.name).test});return function(_e){for(let Te=0;Te<ae.length;Te++)if(ae[Te](_e))return!0;return!1}}}function P(j){let ae,pe,_e;if(M(j)){ae=we(j).map(F);let Te=ae.length,De=F(V(j)),Me=function(Re){for(let C=Te;C<Re.length;C++)if(!De(Re[C]))return!1;return!0};return function(C){for(let z=0;z<ae.length;z++)if(!ae[z](C[z]))return!1;return Me(C)&&C.length>=Te+1}}else return j.length===0?function(De){return De.length===0}:j.length===1?(pe=F(j[0]),function(De){return pe(De[0])&&De.length===1}):j.length===2?(pe=F(j[0]),_e=F(j[1]),function(De){return pe(De[0])&&_e(De[1])&&De.length===2}):(ae=j.map(F),function(De){for(let Me=0;Me<ae.length;Me++)if(!ae[Me](De[Me]))return!1;return De.length===ae.length})}function k(j,ae){return ae<j.length?j[ae]:M(j)?V(j):null}function O(j,ae){let pe=k(j,ae);return pe?A(pe):new Set}function I(j){return j.conversion===null||j.conversion===void 0}function T(j,ae){let pe=new Set;return j.forEach(_e=>{let Te=O(_e.params,ae),De;for(De of Te)pe.add(De)}),pe.has("any")?["any"]:Array.from(pe)}function q(j,ae,pe){let _e,Te,De=j||"unnamed",Me=pe,Re;for(Re=0;Re<ae.length;Re++){let Ee=[];if(Me.forEach(et=>{let ut=k(et.params,Re),dr=F(ut);(Re<et.params.length||M(et.params))&&dr(ae[Re])&&Ee.push(et)}),Ee.length===0){if(Te=T(Me,Re),Te.length>0){let et=v(ae[Re]);return _e=new TypeError("Unexpected type of argument in function "+De+" (expected: "+Te.join(" or ")+", actual: "+et.join(" | ")+", index: "+Re+")"),_e.data={category:"wrongType",fn:De,index:Re,actual:et,expected:Te},_e}}else Me=Ee}let C=Me.map(function(Ee){return M(Ee.params)?1/0:Ee.params.length});if(ae.length<Math.min.apply(null,C))return Te=T(Me,Re),_e=new TypeError("Too few arguments in function "+De+" (expected: "+Te.join(" or ")+", index: "+ae.length+")"),_e.data={category:"tooFewArgs",fn:De,index:ae.length,expected:Te},_e;let z=Math.max.apply(null,C);if(ae.length>z)return _e=new TypeError("Too many arguments in function "+De+" (expected: "+z+", actual: "+ae.length+")"),_e.data={category:"tooManyArgs",fn:De,index:ae.length,expectedLength:z},_e;let le=[];for(let Ee=0;Ee<ae.length;++Ee)le.push(v(ae[Ee]).join("|"));return _e=new TypeError('Arguments of type "'+le.join(", ")+'" do not match any of the defined signatures of function '+De+"."),_e.data={category:"mismatch",actual:le},_e}function B(j){let ae=c.length+1;for(let pe=0;pe<j.types.length;pe++)I(j.types[pe])&&(ae=Math.min(ae,j.types[pe].typeIndex));return ae}function U(j){let ae=f+1;for(let pe=0;pe<j.types.length;pe++)I(j.types[pe])||(ae=Math.min(ae,j.types[pe].conversionIndex));return ae}function G(j,ae){if(j.hasAny){if(!ae.hasAny)return 1}else if(ae.hasAny)return-1;if(j.restParam){if(!ae.restParam)return 1}else if(ae.restParam)return-1;if(j.hasConversion){if(!ae.hasConversion)return 1}else if(ae.hasConversion)return-1;let pe=B(j)-B(ae);if(pe<0)return-1;if(pe>0)return 1;let _e=U(j)-U(ae);return _e<0?-1:_e>0?1:0}function H(j,ae){let pe=j.params,_e=ae.params,Te=V(pe),De=V(_e),Me=M(pe),Re=M(_e);if(Me&&Te.hasAny){if(!Re||!De.hasAny)return 1}else if(Re&&De.hasAny)return-1;let C=0,z=0,le;for(le of pe)le.hasAny&&++C,le.hasConversion&&++z;let Ee=0,et=0;for(le of _e)le.hasAny&&++Ee,le.hasConversion&&++et;if(C!==Ee)return C-Ee;if(Me&&Te.hasConversion){if(!Re||!De.hasConversion)return 1}else if(Re&&De.hasConversion)return-1;if(z!==et)return z-et;if(Me){if(!Re)return 1}else if(Re)return-1;let ut=(pe.length-_e.length)*(Me?-1:1);if(ut!==0)return ut;let dr=[],jn=0;for(let cs=0;cs<pe.length;++cs){let nc=G(pe[cs],_e[cs]);dr.push(nc),jn+=nc}if(jn!==0)return jn;let Ni;for(Ni of dr)if(Ni!==0)return Ni;return 0}function L(j){if(j.length===0)return[];let ae=j.map(m);j.length>1&&ae.sort((Te,De)=>Te.index-De.index);let pe=ae[0].conversionsTo;if(j.length===1)return pe;pe=pe.concat([]);let _e=new Set(j);for(let Te=1;Te<ae.length;++Te){let De;for(De of ae[Te].conversionsTo)_e.has(De.from)||(pe.push(De),_e.add(De.from))}return pe}function ie(j,ae){let pe=ae;if(j.some(Te=>Te.hasConversion)){let Te=M(j),De=j.map(ve);pe=function(){let Re=[],C=Te?arguments.length-1:arguments.length;for(let z=0;z<C;z++)Re[z]=De[z](arguments[z]);return Te&&(Re[C]=arguments[C].map(De[C])),ae.apply(this,Re)}}let _e=pe;if(M(j)){let Te=j.length-1;_e=function(){return pe.apply(this,J(arguments,0,Te).concat([J(arguments,Te)]))}}return _e}function ve(j){let ae,pe,_e,Te,De=[],Me=[];switch(j.types.forEach(function(Re){Re.conversion&&(De.push(m(Re.conversion.from).test),Me.push(Re.conversion.convert))}),Me.length){case 0:return function(C){return C};case 1:return ae=De[0],_e=Me[0],function(C){return ae(C)?_e(C):C};case 2:return ae=De[0],pe=De[1],_e=Me[0],Te=Me[1],function(C){return ae(C)?_e(C):pe(C)?Te(C):C};default:return function(C){for(let z=0;z<Me.length;z++)if(De[z](C))return Me[z](C);return C}}}function se(j){function ae(pe,_e,Te){if(_e<pe.length){let De=pe[_e],Me=[];if(De.restParam){let Re=De.types.filter(I);Re.length<De.types.length&&Me.push({types:Re,name:"..."+Re.map(C=>C.name).join("|"),hasAny:Re.some(C=>C.isAny),hasConversion:!1,restParam:!0}),Me.push(De)}else Me=De.types.map(function(Re){return{types:[Re],name:Re.name,hasAny:Re.isAny,hasConversion:Re.conversion,restParam:!1}});return W(Me,function(Re){return ae(pe,_e+1,Te.concat([Re]))})}else return[Te]}return ae(j,0,[])}function ue(j,ae){let pe=Math.max(j.length,ae.length);for(let Re=0;Re<pe;Re++){let C=O(j,Re),z=O(ae,Re),le=!1,Ee;for(Ee of z)if(C.has(Ee)){le=!0;break}if(!le)return!1}let _e=j.length,Te=ae.length,De=M(j),Me=M(ae);return De?Me?_e===Te:Te>=_e:Me?_e>=Te:_e===Te}function he(j){return j.map(ae=>Ue(ae)?ge(ae.referToSelf.callback):ye(ae)?ne(ae.referTo.references,ae.referTo.callback):ae)}function K(j,ae,pe){let _e=[],Te;for(Te of j){let De=pe[Te];if(typeof De!="number")throw new TypeError('No definition for referenced signature "'+Te+'"');if(De=ae[De],typeof De!="function")return!1;_e.push(De)}return _e}function re(j,ae,pe){let _e=he(j),Te=new Array(_e.length).fill(!1),De=!0;for(;De;){De=!1;let Me=!0;for(let Re=0;Re<_e.length;++Re){if(Te[Re])continue;let C=_e[Re];if(Ue(C))_e[Re]=C.referToSelf.callback(pe),_e[Re].referToSelf=C.referToSelf,Te[Re]=!0,Me=!1;else if(ye(C)){let z=K(C.referTo.references,_e,ae);z?(_e[Re]=C.referTo.callback.apply(this,z),_e[Re].referTo=C.referTo,Te[Re]=!0,Me=!1):De=!0}}if(Me&&De)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return _e}function me(j){let ae=/\bthis(\(|\.signatures\b)/;Object.keys(j).forEach(pe=>{let _e=j[pe];if(ae.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(j,ae){if(p.createCount++,Object.keys(ae).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&me(ae);let pe=[],_e=[],Te={},De=[],Me;for(Me in ae){if(!Object.prototype.hasOwnProperty.call(ae,Me))continue;let sr=E(Me);if(!sr)continue;pe.forEach(function(Fu){if(ue(Fu,sr))throw new TypeError('Conflicting signatures "'+b(Fu)+'" and "'+b(sr)+'".')}),pe.push(sr);let Bn=_e.length;_e.push(ae[Me]);let X5=sr.map(S),ic;for(ic of se(X5)){let Fu=b(ic);De.push({params:ic,name:Fu,fn:Bn}),ic.every(Q5=>!Q5.hasConversion)&&(Te[Fu]=Bn)}}De.sort(H);let Re=re(_e,Te,Tu),C;for(C in Te)Object.prototype.hasOwnProperty.call(Te,C)&&(Te[C]=Re[Te[C]]);let z=[],le=new Map;for(C of De)le.has(C.name)||(C.fn=Re[C.fn],z.push(C),le.set(C.name,C));let Ee=z[0]&&z[0].params.length<=2&&!M(z[0].params),et=z[1]&&z[1].params.length<=2&&!M(z[1].params),ut=z[2]&&z[2].params.length<=2&&!M(z[2].params),dr=z[3]&&z[3].params.length<=2&&!M(z[3].params),jn=z[4]&&z[4].params.length<=2&&!M(z[4].params),Ni=z[5]&&z[5].params.length<=2&&!M(z[5].params),cs=Ee&&et&&ut&&dr&&jn&&Ni;for(let sr=0;sr<z.length;++sr)z[sr].test=P(z[sr].params);let nc=Ee?F(z[0].params[0]):e,A5=et?F(z[1].params[0]):e,D5=ut?F(z[2].params[0]):e,E5=dr?F(z[3].params[0]):e,S5=jn?F(z[4].params[0]):e,N5=Ni?F(z[5].params[0]):e,C5=Ee?F(z[0].params[1]):e,M5=et?F(z[1].params[1]):e,T5=ut?F(z[2].params[1]):e,F5=dr?F(z[3].params[1]):e,I5=jn?F(z[4].params[1]):e,B5=Ni?F(z[5].params[1]):e;for(let sr=0;sr<z.length;++sr)z[sr].implementation=ie(z[sr].params,z[sr].fn);let P5=Ee?z[0].implementation:t,O5=et?z[1].implementation:t,R5=ut?z[2].implementation:t,k5=dr?z[3].implementation:t,L5=jn?z[4].implementation:t,U5=Ni?z[5].implementation:t,V5=Ee?z[0].params.length:-1,q5=et?z[1].params.length:-1,z5=ut?z[2].params.length:-1,$5=dr?z[3].params.length:-1,H5=jn?z[4].params.length:-1,G5=Ni?z[5].params.length:-1,W5=cs?6:0,j5=z.length,Z5=z.map(sr=>sr.test),J5=z.map(sr=>sr.implementation),Y5=function(){for(let Bn=W5;Bn<j5;Bn++)if(Z5[Bn](arguments))return J5[Bn].apply(this,arguments);return p.onMismatch(j,arguments,z)};function Tu(sr,Bn){return arguments.length===V5&&nc(sr)&&C5(Bn)?P5.apply(this,arguments):arguments.length===q5&&A5(sr)&&M5(Bn)?O5.apply(this,arguments):arguments.length===z5&&D5(sr)&&T5(Bn)?R5.apply(this,arguments):arguments.length===$5&&E5(sr)&&F5(Bn)?k5.apply(this,arguments):arguments.length===H5&&S5(sr)&&I5(Bn)?L5.apply(this,arguments):arguments.length===G5&&N5(sr)&&B5(Bn)?U5.apply(this,arguments):Y5.apply(this,arguments)}try{Object.defineProperty(Tu,"name",{value:j})}catch(sr){}return Tu.signatures=Te,Tu._typedFunctionData={signatures:z,signatureMap:le},Tu}function Pe(j,ae,pe){throw q(j,ae,pe)}function we(j){return J(j,0,j.length-1)}function V(j){return j[j.length-1]}function J(j,ae,pe){return Array.prototype.slice.call(j,ae,pe)}function ce(j,ae){for(let pe=0;pe<j.length;pe++)if(ae(j[pe]))return j[pe]}function W(j,ae){return Array.prototype.concat.apply([],j.map(ae))}function ee(){let j=we(arguments).map(pe=>b(E(pe))),ae=V(arguments);if(typeof ae!="function")throw new TypeError("Callback function expected as last argument");return ne(j,ae)}function ne(j,ae){return{referTo:{references:j,callback:ae}}}function ge(j){if(typeof j!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:j}}}function ye(j){return j&&typeof j.referTo=="object"&&Array.isArray(j.referTo.references)&&typeof j.referTo.callback=="function"}function Ue(j){return j&&typeof j.referToSelf=="object"&&typeof j.referToSelf.callback=="function"}function Ae(j,ae){if(!j)return ae;if(ae&&ae!==j){let pe=new Error("Function names do not match (expected: "+j+", actual: "+ae+")");throw pe.data={actual:ae,expected:j},pe}return j}function ft(j){let ae;for(let pe in j)Object.prototype.hasOwnProperty.call(j,pe)&&(w(j[pe])||typeof j[pe].signature=="string")&&(ae=Ae(ae,j[pe].name));return ae}function xt(j,ae){let pe;for(pe in ae)if(Object.prototype.hasOwnProperty.call(ae,pe)){if(pe in j&&ae[pe]!==j[pe]){let _e=new Error('Signature "'+pe+'" is defined twice');throw _e.data={signature:pe,sourceFunction:ae[pe],destFunction:j[pe]},_e}j[pe]=ae[pe]}}let zt=p;p=function(j){let ae=typeof j=="string",pe=ae?1:0,_e=ae?j:"",Te={};for(let De=pe;De<arguments.length;++De){let Me=arguments[De],Re={},C;if(typeof Me=="function"?(C=Me.name,typeof Me.signature=="string"?Re[Me.signature]=Me:w(Me)&&(Re=Me.signatures)):o(Me)&&(Re=Me,ae||(C=ft(Me))),Object.keys(Re).length===0){let z=new TypeError("Argument to 'typed' at index "+De+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw z.data={index:De,argument:Me},z}ae||(_e=Ae(_e,C)),xt(Te,Re)}return de(_e||"",Te)},p.create=i,p.createCount=zt.createCount,p.onMismatch=Pe,p.throwMismatchError=Pe,p.createError=q,p.clear=d,p.clearConversions=g,p.addTypes=h,p._findType=m,p.referTo=ee,p.referToSelf=ge,p.convert=_,p.findSignature=y,p.find=x,p.isTypedFunction=w,p.warnAgainstDeprecatedThis=!0,p.addType=function(j,ae){let pe="any";ae!==!1&&s.has("Object")&&(pe="Object"),p.addTypes([j],pe)};function Kt(j){if(!j||typeof j.from!="string"||typeof j.to!="string"||typeof j.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(j.to===j.from)throw new SyntaxError('Illegal to define conversion from "'+j.from+'" to itself.')}return p.addConversion=function(j){Kt(j);let ae=m(j.to);if(ae.conversionsTo.every(function(pe){return pe.from!==j.from}))ae.conversionsTo.push({from:j.from,convert:j.convert,index:f++});else throw new Error('There is already a conversion from "'+j.from+'" to "'+ae.name+'"')},p.addConversions=function(j){j.forEach(p.addConversion)},p.removeConversion=function(j){Kt(j);let ae=m(j.to),pe=ce(ae.conversionsTo,Te=>Te.from===j.from);if(!pe)throw new Error("Attempt to remove nonexistent conversion from "+j.from+" to "+j.to);if(pe.convert!==j.convert)throw new Error("Conversion to remove does not match existing conversion");let _e=ae.conversionsTo.indexOf(pe);ae.conversionsTo.splice(_e,1)},p.resolve=function(j,ae){if(!w(j))throw new TypeError(n);let pe=j._typedFunctionData.signatures;for(let _e=0;_e<pe.length;++_e)if(pe[_e].test(ae))return pe[_e];return null},p}var a=i();return a})});var US=zr(($h,LS)=>{(function(r){"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},n=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):(f<p?(f=p,p=s/c):p=c/s,f*Math.sqrt(1+p*p))},a=function(){throw SyntaxError("Invalid Param")};function o(s,c){var f=Math.abs(s),p=Math.abs(c);return s===0?Math.log(p):c===0?Math.log(f):f<3e3&&p<3e3?Math.log(s*s+c*c)*.5:(s=s/2,c=c/2,.5*Math.log(s*s+c*c)+Math.LN2)}var l=function(s,c){var f={re:0,im:0};if(s==null)f.re=f.im=0;else if(c!==void 0)f.re=s,f.im=c;else switch(typeof s){case"object":if("im"in s&&"re"in s)f.re=s.re,f.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return u.INFINITY;f.re=s.abs*Math.cos(s.arg),f.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return u.INFINITY;f.re=s.r*Math.cos(s.phi),f.im=s.r*Math.sin(s.phi)}else s.length===2?(f.re=s[0],f.im=s[1]):a();break;case"string":f.im=f.re=0;var p=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),m=1,h=0;p===null&&a();for(var d=0;d<p.length;d++){var g=p[d];g===" "||g===" "||g===`
`||(g==="+"?m++:g==="-"?h++:g==="i"||g==="I"?(m+h===0&&a(),p[d+1]!==" "&&!isNaN(p[d+1])?(f.im+=parseFloat((h%2?"-":"")+p[d+1]),d++):f.im+=parseFloat((h%2?"-":"")+"1"),m=h=0):((m+h===0||isNaN(g))&&a(),p[d+1]==="i"||p[d+1]==="I"?(f.im+=parseFloat((h%2?"-":"")+g),d++):f.re+=parseFloat((h%2?"-":"")+g),m=h=0))}m+h>0&&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)<Math.abs(m)?(d=p/m,h=p*d+m,new u((s*d+c)/h,(c*d-s)/h)):(d=m/p,h=m*d+p,new u((s+c*d)/h,(c-s*d)/h))},pow:function(s,c){var f=new u(s,c);if(s=this.re,c=this.im,f.isZero())return u.ONE;if(f.im===0){if(c===0&&s>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)+n(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)<u.EPSILON&&(s=0),Math.abs(c)<u.EPSILON&&(c=0),c===0?f+s:(s!==0?(f+=s,f+=" ",c<0?(c=-c,f+="-"):f+="+",f+=" "):c<0&&(c=-c,f+="-"),c!==1&&(f+=c),f+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},u.ZERO=new u(0,0),u.ONE=new u(1,0),u.I=new u(0,1),u.PI=new u(Math.PI,0),u.E=new u(Math.E,0),u.INFINITY=new u(1/0,1/0),u.NAN=new u(NaN,NaN),u.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return u}):typeof $h=="object"?(Object.defineProperty(u,"__esModule",{value:!0}),u.default=u,u.Complex=u,LS.exports=u):r.Complex=u})($h)});var qS=zr((Gh,VS)=>{(function(r){"use strict";var e=2e3,t={s:1,n:0,d:1};function n(d,g){if(isNaN(d=parseInt(d,10)))throw m();return d*g}function i(d,g){if(g===0)throw p();var v=Object.create(f.prototype);v.s=d<0?-1:1,d=d<0?-d:d;var w=c(d,g);return v.n=d/w,v.d=g/w,v}function a(d){for(var g={},v=d,w=2,y=4;y<=v;){for(;v%w===0;)v/=w,g[w]=(g[w]||0)+1;y+=1+2*w++}return v!==d?v>1&&(g[v]=(g[v]||0)+1):g[d]=(g[d]||0)+1,g}var o=function(d,g){var v=0,w=1,y=1,x=0,_=0,b=0,D=1,S=1,A=0,E=1,M=1,F=1,P=1e7,k;if(d!=null)if(g!==void 0){if(v=d,w=g,y=v*w,v%1!==0||w%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)v=d.n,w=d.d,"s"in d&&(v*=d.s);else if(0 in d)v=d[0],1 in d&&(w=d[1]);else throw m();y=v*w;break}case"number":{if(d<0&&(y=d,d=-d),d%1===0)v=d;else if(d>0){for(d>=1&&(S=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=S);E<=P&&F<=P;)if(k=(A+M)/(E+F),d===k){E+F<=P?(v=A+M,w=E+F):F>E?(v=M,w=F):(v=A,w=E);break}else d>k?(A+=M,E+=F):(M+=A,F+=E),E>P?(v=M,w=F):(v=A,w=E);v*=S}else(isNaN(d)||isNaN(g))&&(w=v=NaN);break}case"string":{if(E=d.match(/\d+|./g),E===null)throw m();if(E[A]==="-"?(y=-1,A++):E[A]==="+"&&A++,E.length===A+1?_=n(E[A++],y):E[A+1]==="."||E[A]==="."?(E[A]!=="."&&(x=n(E[A++],y)),A++,(A+1===E.length||E[A+1]==="("&&E[A+3]===")"||E[A+1]==="'"&&E[A+3]==="'")&&(_=n(E[A],y),D=Math.pow(10,E[A].length),A++),(E[A]==="("&&E[A+2]===")"||E[A]==="'"&&E[A+2]==="'")&&(b=n(E[A+1],y),S=Math.pow(10,E[A+1].length)-1,A+=3)):E[A+1]==="/"||E[A+1]===":"?(_=n(E[A],y),D=n(E[A+2],1),A+=3):E[A+3]==="/"&&E[A+1]===" "&&(x=n(E[A],y),_=n(E[A+2],y),D=n(E[A+4],1),A+=5),E.length<=A){w=D*S,y=v=b+w*x+S*_;break}}default:throw m()}if(w===0)throw p();t.s=y<0?-1:1,t.n=Math.abs(v),t.d=Math.abs(w)};function l(d,g,v){for(var w=1;g>0;d=d*d%v,g>>=1)g&1&&(w=w*d%v);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 v=10%g,w=1;v!==1;w++)if(v=v*10%g,w>e)return 0;return w}function s(d,g,v){for(var w=1,y=l(10,v,g),x=0;x<300;x++){if(w===y)return x;w=w*10%g,y=y*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 v=a(this.n),w=a(this.d),y=1,x=1;for(var _ in v)if(_!=="1"){if(_==="0"){y=0;break}if(v[_]*=t.n,v[_]%t.d===0)v[_]/=t.d;else return null;y*=Math.pow(_,v[_])}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,y):i(y,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 v=this.s*this.n*t.d-t.s*t.n*this.d;return(0<v)-(v<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var g=this.abs(),v=g.toContinued(),w=1;w<v.length;w++){for(var y=i(v[w-1],1),x=w-2;x>=0;x--)y=y.inverse().add(v[x]);if(Math.abs(y.sub(g).valueOf())<d)return y.mul(this.s)}return this},divisible:function(d,g){return o(d,g),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(d){var g,v="",w=this.n,y=this.d;return this.s<0&&(v+="-"),y===1?v+=w:(d&&(g=Math.floor(w/y))>0&&(v+=g,v+=" ",w%=y),v+=w,v+="/",v+=y),v},toLatex:function(d){var g,v="",w=this.n,y=this.d;return this.s<0&&(v+="-"),y===1?v+=w:(d&&(g=Math.floor(w/y))>0&&(v+=g,w%=y),v+="\\frac{",v+=w,v+="}{",v+=y,v+="}"),v},toContinued:function(){var d,g=this.n,v=this.d,w=[];if(isNaN(g)||isNaN(v))return w;do w.push(Math.floor(g/v)),d=g%v,g=v,v=d;while(g!==1);return w},toString:function(d){var g=this.n,v=this.d;if(isNaN(g)||isNaN(v))return"NaN";d=d||15;var w=u(g,v),y=s(g,v,w),x=this.s<0?"-":"";if(x+=g/v|0,g%=v,g*=10,g&&(x+="."),w){for(var _=y;_--;)x+=g/v|0,g%=v,g*=10;x+="(";for(var _=w;_--;)x+=g/v|0,g%=v,g*=10;x+=")"}else for(var _=d;g&&_--;)x+=g/v|0,g%=v,g*=10;return x}},typeof Gh=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,VS.exports=f):r.Fraction=f})(Gh)});var rM=zr((Ixe,tM)=>{tM.exports=function r(e,t){"use strict";var n=/(^([+\-]?(?: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(y){return r.insensitive&&(""+y).toLowerCase()||""+y},s=u(e).replace(i,"")||"",c=u(t).replace(i,"")||"",f=s.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=c.replace(n,"\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(m<h)return-1;if(m>h)return 1}for(var v=0,w=Math.max(f.length,p.length);v<w;v++){if(d=!(f[v]||"").match(l)&&parseFloat(f[v])||f[v]||0,g=!(p[v]||"").match(l)&&parseFloat(p[v])||p[v]||0,isNaN(d)!==isNaN(g))return isNaN(d)?1:-1;if(typeof d!=typeof g&&(d+="",g+=""),d<g)return-1;if(d>g)return 1}return 0}});var aT=zr((JDe,iT)=>{"use strict";var mb=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},ZH={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},JH={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},YH=function(e,t){return mb({},e,t)};iT.exports=function(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,n=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?YH:i,o=String(r),l="",u=a(mb({},ZH),n?mb({},JH):{}),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 OP=zr((PP,dx)=>{(function(r,e,t){function n(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 n(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<s.length;c++){l+=s.charCodeAt(c);var f=.02519603282416938*l;l=f>>>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})(PP,typeof dx=="object"&&dx,typeof define=="function"&&define)});var kP=zr((RP,hx)=>{(function(r,e,t){function n(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<u.length+64;s++)l.x^=u.charCodeAt(s)|0,l.next()}function i(o,l){return l.x=o.x,l.y=o.y,l.z=o.z,l.w=o.w,l}function a(o,l){var u=new n(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.xor128=a})(RP,typeof hx=="object"&&hx,typeof define=="function"&&define)});var UP=zr((LP,gx)=>{(function(r,e,t){function n(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<u.length+64;s++)l.x^=u.charCodeAt(s)|0,s==u.length&&(l.d=l.x<<10^l.x>>>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 n(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})(LP,typeof gx=="object"&&gx,typeof define=="function"&&define)});var qP=zr((VP,vx)=>{(function(r,e,t){function n(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;f<c.length;++f)m[f&7]=m[f&7]<<15^c.charCodeAt(f)+m[f+1&7]<<13;for(;m.length<8;)m.push(0);for(f=0;f<8&&m[f]===0;++f);for(f==8?p=m[7]=-1:p=m[f],s.x=m,s.i=0,f=256;f>0;--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 n(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})(VP,typeof vx=="object"&&vx,typeof define=="function"&&define)});var $P=zr((zP,yx)=>{(function(r,e,t){function n(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=[],v=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,v=Math.max(v,c.length)),m=0,h=-32;h<v;++h)c&&(p^=c.charCodeAt((h+32)%c.length)),h===0&&(d=p),p^=p<<10,p^=p>>>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 n(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})(zP,typeof yx=="object"&&yx,typeof define=="function"&&define)});var GP=zr((HP,bx)=>{(function(r,e,t){function n(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<u.length+20;s++)l.b^=u.charCodeAt(s)|0,l.next()}function i(o,l){return l.a=o.a,l.b=o.b,l.c=o.c,l.d=o.d,l}function a(o,l){var u=new n(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.tychei=a})(HP,typeof bx=="object"&&bx,typeof define=="function"&&define)});var jP=zr((WP,qp)=>{(function(r,e,t){var n=256,i=6,a=52,o="random",l=t.pow(n,i),u=t.pow(2,a),s=u*2,c=n-1,f;function p(y,x,_){var b=[];x=x==!0?{entropy:!0}:x||{};var D=g(d(x.entropy?[y,w(e)]:y==null?v():y,3),b),S=new m(b),A=function(){for(var E=S.g(i),M=l,F=0;E<u;)E=(E+F)*n,M*=n,F=S.g(1);for(;E>=s;)E/=2,M/=2,F>>>=1;return(E+F)/M};return A.int32=function(){return S.g(4)|0},A.quick=function(){return S.g(4)/4294967296},A.double=A,g(w(S.S),e),(x.pass||_||function(E,M,F,P){return P&&(P.S&&h(P,S),E.state=function(){return h(S,{})}),F?(t[o]=E,M):E})(A,D,"global"in x?x.global:this==t,x.state)}function m(y){var x,_=y.length,b=this,D=0,S=b.i=b.j=0,A=b.S=[];for(_||(y=[_++]);D<n;)A[D]=D++;for(D=0;D<n;D++)A[D]=A[S=c&S+y[D%_]+(x=A[D])],A[S]=x;(b.g=function(E){for(var M,F=0,P=b.i,k=b.j,O=b.S;E--;)M=O[P=c&P+1],F=F*n+O[c&(O[P]=O[k=c&k+M])+(O[k]=M)];return b.i=P,b.j=k,F})(n)}function h(y,x){return x.i=y.i,x.j=y.j,x.S=y.S.slice(),x}function d(y,x){var _=[],b=typeof y,D;if(x&&b=="object")for(D in y)try{_.push(d(y[D],x-1))}catch(S){}return _.length?_:b=="string"?y:y+"\0"}function g(y,x){for(var _=y+"",b,D=0;D<_.length;)x[c&D]=c&(b^=x[c&D]*19)+_.charCodeAt(D++);return w(x)}function v(){try{var y;return f&&(y=f.randomBytes)?y=y(n):(y=new Uint8Array(n),(r.crypto||r.msCrypto).getRandomValues(y)),w(y)}catch(b){var x=r.navigator,_=x&&x.plugins;return[+new Date,r,_,r.screen,w(e)]}}function w(y){return String.fromCharCode.apply(0,y)}if(g(t.random(),e),typeof qp=="object"&&qp.exports){qp.exports=p;try{f=require("crypto")}catch(y){}}else typeof define=="function"&&define.amd?define(function(){return p}):t["seed"+o]=p})(typeof self!="undefined"?self:WP,[],Math)});var JP=zr((mke,ZP)=>{var mW=OP(),dW=kP(),hW=UP(),gW=qP(),vW=$P(),yW=GP(),$o=jP();$o.alea=mW;$o.xor128=dW;$o.xorwow=hW;$o.xorshift7=gW;$o.xor4096=vW;$o.tychei=yW;ZP.exports=$o});var FY={};a8(FY,{MetaBindBuild:()=>Nd,default:()=>id});module.exports=o8(FY);var ad=require("obsidian");var on=require("obsidian");var K_=["January","February","March","April","May","June","July","August","September","October","November","December"],wo=[{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"}],Ci={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",useUsDateInputOrder:!1,firstWeekday:wo[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,inputFieldTemplates:[],excludedFolders:["templates"],inputTemplates:void 0};var OA=require("obsidian");function Fe(){}function s8(r,e){for(let t in e)r[t]=e[t];return r}function od(r){return r()}function oc(){return Object.create(null)}function ot(r){r.forEach(od)}function sc(r){return typeof r=="function"}function qe(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}var ac;function fs(r,e){return r===e?!0:(ac||(ac=document.createElement("a")),ac.href=e,r===ac.href)}function eA(r){return Object.keys(r).length===0}function ia(r,e,t,n){if(r){let i=tA(r,e,t,n);return r[0](i)}}function tA(r,e,t,n){return r[1]&&n?s8(t.ctx.slice(),r[1](n(e))):t.ctx}function aa(r,e,t,n){if(r[2]&&n){let i=r[2](n(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;l<o;l+=1)a[l]=e.dirty[l]|i[l];return a}return e.dirty|i}return e.dirty}function oa(r,e,t,n,i,a){if(i){let o=tA(e,t,n,a);r.p(o,i)}}function sa(r){if(r.ctx.length>32){let e=[],t=r.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}var Bu=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var uc=class r{constructor(e){Yr(this,"_listeners","WeakMap"in Bu?new WeakMap:void 0);Yr(this,"_observer");Yr(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var n;for(let i of t)r.entries.set(i.target,i),(n=this._listeners.get(i.target))==null||n(i)})}};uc.entries="WeakMap"in Bu?new WeakMap:void 0;var rA=!1;function nA(){rA=!0}function iA(){rA=!1}function $(r,e){r.appendChild(e)}function Xr(r,e,t){let n=aA(r);if(!n.getElementById(e)){let i=Z("style");i.id=e,i.textContent=t,c8(n,i)}}function aA(r){if(!r)return document;let e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function c8(r,e){return $(r.head||r,e),e.sheet}function Q(r,e,t){r.insertBefore(e,t||null)}function X(r){r.parentNode&&r.parentNode.removeChild(r)}function Nt(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function Z(r){return document.createElement(r)}function Zn(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Be(r){return document.createTextNode(r)}function fe(){return Be(" ")}function lr(){return Be("")}function xe(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function R(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function ci(r){return r===""?null:+r}function oA(r){return Array.from(r.childNodes)}function nt(r,e){e=""+e,r.data!==e&&(r.data=e)}function Ye(r,e){r.value=e==null?"":e}function ps(r,e,t,n){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function Mr(r,e,t){for(let n=0;n<r.options.length;n+=1){let i=r.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function Jn(r){let e=r.querySelector(":checked");return e&&e.__value}function At(r,e,t){r.classList.toggle(e,!!t)}function lc(r,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:n})}function sA(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Ia;function ua(r){Ia=r}function cc(){if(!Ia)throw new Error("Function called outside component initialization");return Ia}function nn(r){cc().$$.on_mount.push(r)}function _o(r){cc().$$.on_destroy.push(r)}function Pu(){let r=cc();return(e,t,{cancelable:n=!1}={})=>{let i=r.$$.callbacks[e];if(i){let a=lc(e,t,{cancelable:n});return i.slice().forEach(o=>{o.call(r,a)}),!a.defaultPrevented}return!0}}function uA(r,e){let t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var Ao=[];var Tr=[],ds=[],ud=[],g8=Promise.resolve(),ld=!1;function lA(){ld||(ld=!0,g8.then(fc))}function Qr(r){ds.push(r)}function Ba(r){ud.push(r)}var sd=new Set,ms=0;function fc(){if(ms!==0)return;let r=Ia;do{try{for(;ms<Ao.length;){let e=Ao[ms];ms++,ua(e),v8(e.$$)}}catch(e){throw Ao.length=0,ms=0,e}for(ua(null),Ao.length=0,ms=0;Tr.length;)Tr.pop()();for(let e=0;e<ds.length;e+=1){let t=ds[e];sd.has(t)||(sd.add(t),t())}ds.length=0}while(Ao.length);for(;ud.length;)ud.pop()();ld=!1,sd.clear(),ua(r)}function v8(r){if(r.fragment!==null){r.update(),ot(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Qr)}}function cA(r){let e=[],t=[];ds.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),ds=e}var pc=new Set,Do;function vt(){Do={r:0,c:[],p:Do}}function yt(){Do.r||ot(Do.c),Do=Do.p}function te(r,e){r&&r.i&&(pc.delete(r),r.i(e))}function oe(r,e,t,n){if(r&&r.o){if(pc.has(r))return;pc.add(r),Do.c.push(()=>{pc.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function je(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function fA(r,e){r.d(1),e.delete(r.key)}function mc(r,e){oe(r,1,1,()=>{e.delete(r.key)})}function hs(r,e,t,n,i,a,o,l,u,s,c,f){let p=r.length,m=a.length,h=p,d={};for(;h--;)d[r[h].key]=h;let g=[],v=new Map,w=new Map,y=[];for(h=m;h--;){let D=f(i,a,h),S=t(D),A=o.get(S);A?n&&y.push(()=>A.p(D,e)):(A=s(S,D),A.c()),v.set(S,g[h]=A),S in d&&w.set(S,Math.abs(h-d[S]))}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],S=r[p-1],A=D.key,E=S.key;D===S?(c=D.first,p--,m--):v.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(S,o),p--)}for(;p--;){let D=r[p];v.has(D.key)||u(D,o)}for(;m;)b(g[m-1]);return ot(y),g}var y8=["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"],b8=new Set([...y8]);function Pa(r,e,t){let n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function Ce(r){r&&r.c()}function Se(r,e,t){let{fragment:n,after_update:i}=r.$$;n&&n.m(e,t),Qr(()=>{let a=r.$$.on_mount.map(od).filter(sc);r.$$.on_destroy?r.$$.on_destroy.push(...a):ot(a),r.$$.on_mount=[]}),i.forEach(Qr)}function Ne(r,e){let t=r.$$;t.fragment!==null&&(cA(t.after_update),ot(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function w8(r,e){r.$$.dirty[0]===-1&&(Ao.push(r),lA(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function ze(r,e,t,n,i,a,o=null,l=[-1]){let u=Ia;ua(r);let s=r.$$={fragment:null,ctx:[],props:a,update:Fe,not_equal:i,bound:oc(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:oc(),dirty:l,skip_bound:!1,root:e.target||u.$$.root};o&&o(s.root);let c=!1;if(s.ctx=t?t(r,e.props||{},(f,p,...m)=>{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&&w8(r,f)),p}):[],s.update(),c=!0,ot(s.before_update),s.fragment=n?n(s.ctx):!1,e.target){if(e.hydrate){nA();let f=oA(e.target);s.fragment&&s.fragment.l(f),f.forEach(X)}else s.fragment&&s.fragment.c();e.intro&&te(r.$$.fragment),Se(r,e.target,e.anchor),iA(),fc()}ua(u)}var _8;typeof HTMLElement=="function"&&(_8=class extends HTMLElement{constructor(e,t,n){super();Yr(this,"$$ctor");Yr(this,"$$s");Yr(this,"$$c");Yr(this,"$$cn",!1);Yr(this,"$$d",{});Yr(this,"$$r",!1);Yr(this,"$$p_d",{});Yr(this,"$$l",{});Yr(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){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,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),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=Z("slot"),a!=="default"&&R(o,"name",a)},m:function(s,c){Q(s,o,c)},d:function(s){s&&X(o)}}}};if(await Promise.resolve(),!this.$$cn)return;let t={},n=sA(this);for(let a of this.$$s)a in n&&(t[a]=[e(a)]);for(let a of this.attributes){let o=this.$$g_p(a.name);o in this.$$d||(this.$$d[o]=cd(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=cd(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,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=cd(e,n,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 cd(r,e,t,n){var a;let i=(a=t[r])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="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(){Yr(this,"$$");Yr(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=Fe}$on(e,t){if(!sc(t))return Fe;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!eA(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var pA="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(pA);var kr=class extends Error{constructor(e){super(""),this.errorLevel=e.errorLevel,this.effect=e.effect,this.cause=e.cause,this.tip=e.tip,this.docs=e.docs,this.context=e.context,this.positionContext=e.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)}},an=class extends kr{getErrorType(){return"MB_INTERNAL"}},la=class extends kr{getErrorType(){return"MB_PARSING"}},Ou=class extends kr{getErrorType(){return"MB_VALIDATION"}},Eo=class extends kr{getErrorType(){return"MB_BIND_TARGET"}};var er=class extends kr{getErrorType(){return"MB_ARGUMENT"}},gs=class extends kr{getErrorType(){return"MB_JS"}},ca=class extends kr{getErrorType(){return"MB_EXPRESSION"}};var Ru=class extends kr{getErrorType(){return"MB_EXAMPLE"}},vs=class extends kr{getErrorType(){return"MB_EMBED"}},dc=class extends kr{getErrorType(){return"MB_BUTTON"}},So=class extends kr{getErrorType(){return"MB_DEPENDENCY"}};function mA(r,e,t){let n=r.slice();return n[1]=e[t],n}function A8(r){let e,t,n,i=r[0].stack+"",a;return{c(){e=Z("div"),t=Z("pre"),n=Z("code"),a=Be(i),R(n,"class","language-none mb-none"),R(t,"class","mb-pre"),R(e,"class","mb-card")},m(o,l){Q(o,e,l),$(e,t),$(t,n),$(n,a)},p(o,l){l&1&&i!==(i=o[0].stack+"")&&nt(a,i)},d(o){o&&X(e)}}}function D8(r){let e,t,n,i=r[0].errorLevel+"",a,o,l=r[0].getErrorType()+"",u,s,c,f,p=r[0].effect+"",m,h,d,g,v,w,y,x,_,b=r[0].cause+"",D,S,A,E,M,F,P=r[0].effect+"",k,O,I,T,q=r[0].positionContext&&dA(r),B=r[0].tip&&hA(r),U=r[0].docs&&gA(r),G=r[0].context&&yA(r);return{c(){e=Z("div"),t=Z("h6"),n=Z("span"),a=Be(i),o=Be(`
[`),u=Be(l),s=Be("]"),f=Be(`
- `),m=Be(p),h=fe(),q&&q.c(),d=fe(),g=Z("table"),v=Z("tbody"),w=Z("tr"),y=Z("td"),y.textContent="Cause",x=fe(),_=Z("td"),D=Be(b),S=fe(),A=Z("tr"),E=Z("td"),E.textContent="Effect",M=fe(),F=Z("td"),k=Be(P),O=fe(),B&&B.c(),I=fe(),U&&U.c(),T=fe(),G&&G.c(),R(n,"class",c=r[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),R(e,"class","mb-card mb-card-full-width markdown-rendered")},m(H,L){Q(H,e,L),$(e,t),$(t,n),$(n,a),$(n,o),$(n,u),$(n,s),$(t,f),$(t,m),$(e,h),q&&q.m(e,null),$(e,d),$(e,g),$(g,v),$(v,w),$(w,y),$(w,x),$(w,_),$(_,D),$(v,S),$(v,A),$(A,E),$(A,M),$(A,F),$(F,k),$(v,O),B&&B.m(v,null),$(v,I),U&&U.m(v,null),$(v,T),G&&G.m(v,null)},p(H,L){L&1&&i!==(i=H[0].errorLevel+"")&&nt(a,i),L&1&&l!==(l=H[0].getErrorType()+"")&&nt(u,l),L&1&&c!==(c=H[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")&&R(n,"class",c),L&1&&p!==(p=H[0].effect+"")&&nt(m,p),H[0].positionContext?q?q.p(H,L):(q=dA(H),q.c(),q.m(e,d)):q&&(q.d(1),q=null),L&1&&b!==(b=H[0].cause+"")&&nt(D,b),L&1&&P!==(P=H[0].effect+"")&&nt(k,P),H[0].tip?B?B.p(H,L):(B=hA(H),B.c(),B.m(v,I)):B&&(B.d(1),B=null),H[0].docs?U?U.p(H,L):(U=gA(H),U.c(),U.m(v,T)):U&&(U.d(1),U=null),H[0].context?G?G.p(H,L):(G=yA(H),G.c(),G.m(v,null)):G&&(G.d(1),G=null)},d(H){H&&X(e),q&&q.d(),B&&B.d(),U&&U.d(),G&&G.d()}}}function dA(r){let e,t,n=r[0].positionContext+"",i;return{c(){e=Z("pre"),t=Z("code"),i=Be(n),R(t,"class","language-none mb-none"),R(e,"class","mb-pre")},m(a,o){Q(a,e,o),$(e,t),$(t,i)},p(a,o){o&1&&n!==(n=a[0].positionContext+"")&&nt(i,n)},d(a){a&&X(e)}}}function hA(r){let e,t,n,i,a=r[0].tip+"",o;return{c(){e=Z("tr"),t=Z("td"),t.textContent="Tip",n=fe(),i=Z("td"),o=Be(a)},m(l,u){Q(l,e,u),$(e,t),$(e,n),$(e,i),$(i,o)},p(l,u){u&1&&a!==(a=l[0].tip+"")&&nt(o,a)},d(l){l&&X(e)}}}function gA(r){let e,t,n,i,a=je(r[0].docs),o=[];for(let l=0;l<a.length;l+=1)o[l]=vA(mA(r,a,l));return{c(){e=Z("tr"),t=Z("td"),t.textContent="Docs",n=fe(),i=Z("td");for(let l=0;l<o.length;l+=1)o[l].c()},m(l,u){Q(l,e,u),$(e,t),$(e,n),$(e,i);for(let s=0;s<o.length;s+=1)o[s]&&o[s].m(i,null)},p(l,u){if(u&1){a=je(l[0].docs);let s;for(s=0;s<a.length;s+=1){let c=mA(l,a,s);o[s]?o[s].p(c,u):(o[s]=vA(c),o[s].c(),o[s].m(i,null))}for(;s<o.length;s+=1)o[s].d(1);o.length=a.length}},d(l){l&&X(e),Nt(o,l)}}}function vA(r){let e,t=r[1]+"",n,i,a;return{c(){e=Z("a"),n=Be(t),a=Z("br"),R(e,"href",i=r[1])},m(o,l){Q(o,e,l),$(e,n),Q(o,a,l)},p(o,l){l&1&&t!==(t=o[1]+"")&&nt(n,t),l&1&&i!==(i=o[1])&&R(e,"href",i)},d(o){o&&(X(e),X(a))}}}function yA(r){let e,t,n,i,a,o,l=JSON.stringify(r[0].context,null,4)+"",u;return{c(){e=Z("tr"),t=Z("td"),t.textContent="Context",n=fe(),i=Z("td"),a=Z("pre"),o=Z("code"),u=Be(l),R(o,"class","language-none mb-none"),R(a,"class","mb-pre")},m(s,c){Q(s,e,c),$(e,t),$(e,n),$(e,i),$(i,a),$(a,o),$(o,u)},p(s,c){c&1&&l!==(l=JSON.stringify(s[0].context,null,4)+"")&&nt(u,l)},d(s){s&&X(e)}}}function E8(r){let e;function t(a,o){return a[0]instanceof kr?D8:A8}let n=t(r,-1),i=n(r);return{c(){i.c(),e=lr()},m(a,o){i.m(a,o),Q(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Fe,o:Fe,d(a){a&&X(e),i.d(a)}}}function S8(r,e,t){let{error:n}=e;return r.$$set=i=>{"error"in i&&t(0,n=i.error)},[n]}var fd=class extends Ve{constructor(e){super(),ze(this,e,S8,E8,qe,{error:0})}},pd=fd;function bA(r,e,t){let n=r.slice();return n[1]=e[t],n}function xA(r,e,t){let n=r.slice();return n[4]=e[t],n}function wA(r){let e,t=r[0].text+"",n;return{c(){e=Z("p"),n=Be(t)},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&1&&t!==(t=i[0].text+"")&&nt(n,t)},d(i){i&&X(e)}}}function _A(r){let e,t,n=r[0].code+"",i;return{c(){e=Z("p"),t=Z("code"),i=Be(n),R(t,"class","language-none meta-bind-none")},m(a,o){Q(a,e,o),$(e,t),$(t,i)},p(a,o){o&1&&n!==(n=a[0].code+"")&&nt(i,n)},d(a){a&&X(e)}}}function AA(r){let e,t,n,i,a,o=r[0].errorText&&DA(r),l=je(r[0].errorCollection.getErrors()),u=[];for(let c=0;c<l.length;c+=1)u[c]=EA(xA(r,l,c));let s=c=>oe(u[c],1,1,()=>{u[c]=null});return{c(){e=Z("h6"),e.textContent="Errors",t=fe(),o&&o.c(),n=fe();for(let c=0;c<u.length;c+=1)u[c].c();i=lr()},m(c,f){Q(c,e,f),Q(c,t,f),o&&o.m(c,f),Q(c,n,f);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(c,f);Q(c,i,f),a=!0},p(c,f){if(c[0].errorText?o?o.p(c,f):(o=DA(c),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),f&1){l=je(c[0].errorCollection.getErrors());let p;for(p=0;p<l.length;p+=1){let m=xA(c,l,p);u[p]?(u[p].p(m,f),te(u[p],1)):(u[p]=EA(m),u[p].c(),te(u[p],1),u[p].m(i.parentNode,i))}for(vt(),p=l.length;p<u.length;p+=1)s(p);yt()}},i(c){if(!a){for(let f=0;f<l.length;f+=1)te(u[f]);a=!0}},o(c){u=u.filter(Boolean);for(let f=0;f<u.length;f+=1)oe(u[f]);a=!1},d(c){c&&(X(e),X(t),X(n),X(i)),o&&o.d(c),Nt(u,c)}}}function DA(r){let e,t=r[0].errorText+"",n;return{c(){e=Z("p"),n=Be(t)},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&1&&t!==(t=i[0].errorText+"")&&nt(n,t)},d(i){i&&X(e)}}}function EA(r){let e,t;return e=new pd({props:{error:r[4]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.error=n[4]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function SA(r){let e,t,n,i,a,o=r[0].warningText&&NA(r),l=je(r[0].errorCollection.getWarnings()),u=[];for(let c=0;c<l.length;c+=1)u[c]=CA(bA(r,l,c));let s=c=>oe(u[c],1,1,()=>{u[c]=null});return{c(){e=Z("h6"),e.textContent="Warnings",t=fe(),o&&o.c(),n=fe();for(let c=0;c<u.length;c+=1)u[c].c();i=lr()},m(c,f){Q(c,e,f),Q(c,t,f),o&&o.m(c,f),Q(c,n,f);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(c,f);Q(c,i,f),a=!0},p(c,f){if(c[0].warningText?o?o.p(c,f):(o=NA(c),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),f&1){l=je(c[0].errorCollection.getWarnings());let p;for(p=0;p<l.length;p+=1){let m=bA(c,l,p);u[p]?(u[p].p(m,f),te(u[p],1)):(u[p]=CA(m),u[p].c(),te(u[p],1),u[p].m(i.parentNode,i))}for(vt(),p=l.length;p<u.length;p+=1)s(p);yt()}},i(c){if(!a){for(let f=0;f<l.length;f+=1)te(u[f]);a=!0}},o(c){u=u.filter(Boolean);for(let f=0;f<u.length;f+=1)oe(u[f]);a=!1},d(c){c&&(X(e),X(t),X(n),X(i)),o&&o.d(c),Nt(u,c)}}}function NA(r){let e,t=r[0].warningText+"",n;return{c(){e=Z("p"),n=Be(t)},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&1&&t!==(t=i[0].warningText+"")&&nt(n,t)},d(i){i&&X(e)}}}function CA(r){let e,t;return e=new pd({props:{error:r[1]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.error=n[1]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function N8(r){let e,t,n=r[0].errorCollection.hasErrors(),i,a=r[0].errorCollection.hasWarnings(),o,l,u=r[0].text&&wA(r),s=r[0].code&&_A(r),c=n&&AA(r),f=a&&SA(r);return{c(){u&&u.c(),e=fe(),s&&s.c(),t=fe(),c&&c.c(),i=fe(),f&&f.c(),o=lr()},m(p,m){u&&u.m(p,m),Q(p,e,m),s&&s.m(p,m),Q(p,t,m),c&&c.m(p,m),Q(p,i,m),f&&f.m(p,m),Q(p,o,m),l=!0},p(p,[m]){p[0].text?u?u.p(p,m):(u=wA(p),u.c(),u.m(e.parentNode,e)):u&&(u.d(1),u=null),p[0].code?s?s.p(p,m):(s=_A(p),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),m&1&&(n=p[0].errorCollection.hasErrors()),n?c?(c.p(p,m),m&1&&te(c,1)):(c=AA(p),c.c(),te(c,1),c.m(i.parentNode,i)):c&&(vt(),oe(c,1,1,()=>{c=null}),yt()),m&1&&(a=p[0].errorCollection.hasWarnings()),a?f?(f.p(p,m),m&1&&te(f,1)):(f=SA(p),f.c(),te(f,1),f.m(o.parentNode,o)):f&&(vt(),oe(f,1,1,()=>{f=null}),yt())},i(p){l||(te(c),te(f),l=!0)},o(p){oe(c),oe(f),l=!1},d(p){p&&(X(e),X(t),X(i),X(o)),u&&u.d(p),s&&s.d(p),c&&c.d(p),f&&f.d(p)}}}function C8(r,e,t){let{settings:n}=e;return r.$$set=i=>{"settings"in i&&t(0,n=i.settings)},[n]}var md=class extends Ve{constructor(e){super(),ze(this,e,C8,N8,qe,{settings:0})}},ys=md;function M8(r){let e,t,n=r[1].default,i=ia(n,r,r[0],null);return{c(){e=Z("div"),i&&i.c(),R(e,"class","modal-button-container")},m(a,o){Q(a,e,o),i&&i.m(e,null),t=!0},p(a,[o]){i&&i.p&&(!t||o&1)&&oa(i,n,a,a[0],t?aa(n,a[0],o,null):sa(a[0]),null)},i(a){t||(te(i,a),t=!0)},o(a){oe(i,a),t=!1},d(a){a&&X(e),i&&i.d(a)}}}function T8(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,n]}var dd=class extends Ve{constructor(e){super(),ze(this,e,T8,M8,qe,{})}},bs=dd;var fa=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(fa||{}),xs=(l=>(l.COMMAND="command",l.JS="js",l.OPEN="open",l.INPUT="input",l.SLEEP="sleep",l.TEMPLATER_CREATE_NOTE="templaterCreateNote",l.UPDATE_METADATA="updateMetadata",l))(xs||{});function F8(r){Xr(r,"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 I8(r){let e,t,n,i,a=r[4].default,o=ia(a,r,r[3],null);return{c(){e=Z("button"),o&&o.c(),R(e,"aria-label",r[2]),e.disabled=r[1],R(e,"class","svelte-12xcpmj"),At(e,"mod-cta",r[0]==="primary"),At(e,"mod-warning",r[0]==="destructive"),At(e,"mod-plain",r[0]==="plain"),At(e,"disabled",r[1])},m(l,u){Q(l,e,u),o&&o.m(e,null),t=!0,n||(i=xe(e,"click",r[5]),n=!0)},p(l,[u]){o&&o.p&&(!t||u&8)&&oa(o,a,l,l[3],t?aa(a,l[3],u,null):sa(l[3]),null),(!t||u&4)&&R(e,"aria-label",l[2]),(!t||u&2)&&(e.disabled=l[1]),(!t||u&1)&&At(e,"mod-cta",l[0]==="primary"),(!t||u&1)&&At(e,"mod-warning",l[0]==="destructive"),(!t||u&1)&&At(e,"mod-plain",l[0]==="plain"),(!t||u&2)&&At(e,"disabled",l[1])},i(l){t||(te(o,l),t=!0)},o(l){oe(o,l),t=!1},d(l){l&&X(e),o&&o.d(l),n=!1,i()}}}function B8(r,e,t){let{$$slots:n={},$$scope:i}=e,{variant:a="default"}=e,{disabled:o=!1}=e,{tooltip:l=""}=e;function u(s){uA.call(this,r,s)}return r.$$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,n,u]}var hd=class extends Ve{constructor(e){super(),ze(this,e,B8,I8,qe,{variant:0,disabled:1,tooltip:2},F8)}},Lt=hd;var TA=require("obsidian");function MA(r){let e;return{c(){e=Z("div"),R(e,"class","mb-icon-wrapper")},m(t,n){Q(t,e,n),r[2](e)},p:Fe,d(t){t&&X(e),r[2](null)}}}function P8(r){let e,t=r[0].length>0&&MA(r);return{c(){t&&t.c(),e=lr()},m(n,i){t&&t.m(n,i),Q(n,e,i)},p(n,[i]){n[0].length>0?t?t.p(n,i):(t=MA(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Fe,o:Fe,d(n){n&&X(e),t&&t.d(n)}}}function O8(r,e,t){let{iconName:n=""}=e,i;nn(()=>{(0,TA.setIcon)(i,n)});function a(o){Tr[o?"unshift":"push"](()=>{i=o,t(1,i)})}return r.$$set=o=>{"iconName"in o&&t(0,n=o.iconName)},[n,i,a]}var gd=class extends Ve{constructor(e){super(),ze(this,e,O8,P8,qe,{iconName:0})}},cr=gd;function FA(r,e,t){let n=r.slice();return n[12]=e[t],n[13]=e,n[14]=t,n}function R8(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function IA(r){let e,t,n,i,a,o,l,u,s,c;function f(){r[7].call(n,r[13],r[14])}function p(){return r[8](r[12])}return o=new Lt({props:{tooltip:"Delete",$$slots:{default:[R8]},$$scope:{ctx:r}}}),o.$on("click",p),{c(){e=Z("tr"),t=Z("td"),n=Z("input"),i=fe(),a=Z("td"),Ce(o.$$.fragment),l=fe(),R(n,"type","text"),R(n,"placeholder","path/to/folder"),ps(n,"width","100%"),ps(t,"width","100%")},m(m,h){Q(m,e,h),$(e,t),$(t,n),Ye(n,r[12]),$(e,i),$(e,a),Se(o,a,null),$(e,l),u=!0,s||(c=xe(n,"input",f),s=!0)},p(m,h){r=m,h&1&&n.value!==r[12]&&Ye(n,r[12]);let d={};h&32768&&(d.$$scope={dirty:h,ctx:r}),o.$set(d)},i(m){u||(te(o.$$.fragment,m),u=!0)},o(m){oe(o.$$.fragment,m),u=!1},d(m){m&&X(e),Ne(o),s=!1,c()}}}function k8(r){let e;return{c(){e=Be("Add Folder")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function BA(r){let e,t,n,i,a;return i=new ys({props:{errorCollection:r[1],declaration:void 0}}),{c(){e=Z("div"),t=Z("h3"),t.textContent="Some Folder Paths are invalid",n=fe(),Ce(i.$$.fragment),R(t,"class","mod-error")},m(o,l){Q(o,e,l),$(e,t),$(e,n),Se(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){oe(i.$$.fragment,o),a=!1},d(o){o&&X(e),Ne(i)}}}function L8(r){let e;return{c(){e=Be("Save")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function U8(r){let e;return{c(){e=Be("Cancel")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function V8(r){let e,t,n,i;return e=new Lt({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[L8]},$$scope:{ctx:r}}}),e.$on("click",r[10]),n=new Lt({props:{tooltip:"Revert Changes",$$slots:{default:[U8]},$$scope:{ctx:r}}}),n.$on("click",r[11]),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment)},m(a,o){Se(e,a,o),Q(a,t,o),Se(n,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}),n.$set(u)},i(a){i||(te(e.$$.fragment,a),te(n.$$.fragment,a),i=!0)},o(a){oe(e.$$.fragment,a),oe(n.$$.fragment,a),i=!1},d(a){a&&X(t),Ne(e,a),Ne(n,a)}}}function q8(r){let e,t,n,i,a,o,l,u,s,c,f,p=je(r[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=IA(FA(r,p,g));let h=g=>oe(m[g],1,1,()=>{m[g]=null});l=new Lt({props:{variant:"primary",tooltip:"Add new excluded Folder",$$slots:{default:[k8]},$$scope:{ctx:r}}}),l.$on("click",r[9]);let d=r[1]&&BA(r);return c=new bs({props:{$$slots:{default:[V8]},$$scope:{ctx:r}}}),{c(){e=Z("div"),t=Z("table"),n=Z("thead"),n.innerHTML="<tr><th>Folder Path</th> <th></th></tr>",i=fe(),a=Z("tbody");for(let g=0;g<m.length;g+=1)m[g].c();o=fe(),Ce(l.$$.fragment),u=fe(),d&&d.c(),s=fe(),Ce(c.$$.fragment)},m(g,v){Q(g,e,v),$(e,t),$(t,n),$(t,i),$(t,a);for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(a,null);$(e,o),Se(l,e,null),$(e,u),d&&d.m(e,null),$(e,s),Se(c,e,null),f=!0},p(g,[v]){if(v&5){p=je(g[0]);let x;for(x=0;x<p.length;x+=1){let _=FA(g,p,x);m[x]?(m[x].p(_,v),te(m[x],1)):(m[x]=IA(_),m[x].c(),te(m[x],1),m[x].m(a,null))}for(vt(),x=p.length;x<m.length;x+=1)h(x);yt()}let w={};v&32768&&(w.$$scope={dirty:v,ctx:g}),l.$set(w),g[1]?d?(d.p(g,v),v&2&&te(d,1)):(d=BA(g),d.c(),te(d,1),d.m(e,s)):d&&(vt(),oe(d,1,1,()=>{d=null}),yt());let y={};v&32768&&(y.$$scope={dirty:v,ctx:g}),c.$set(y)},i(g){if(!f){for(let v=0;v<p.length;v+=1)te(m[v]);te(l.$$.fragment,g),te(d),te(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let v=0;v<m.length;v+=1)oe(m[v]);oe(l.$$.fragment,g),oe(d),oe(c.$$.fragment,g),f=!1},d(g){g&&X(e),Nt(m,g),Ne(l),d&&d.d(),Ne(c)}}}function z8(r,e,t){let{excludedFolders:n}=e,{modal:i}=e,a;function o(d){t(0,n=n.filter(g=>g!==d))}function l(){n.push(""),t(0,n)}function u(){t(1,a=i.save(n)),a===void 0&&i.close()}function s(){i.close()}function c(d,g){d[g]=this.value,t(0,n)}let f=d=>o(d),p=()=>l(),m=()=>u(),h=()=>s();return r.$$set=d=>{"excludedFolders"in d&&t(0,n=d.excludedFolders),"modal"in d&&t(6,i=d.modal)},[n,a,o,l,u,s,i,c,f,p,m,h]}var vd=class extends Ve{constructor(e){super(),ze(this,e,z8,q8,qe,{excludedFolders:0,modal:6})}},PA=vd;var rr=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof kr?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 hc=class extends OA.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new PA({target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){for(let t of e)if(t===""){let n=new rr("Excluded Folders");return n.add(new Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),n}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var qA=require("obsidian");function $8(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function H8(r){let e,t,n,i,a,o,l,u,s,c,f,p;return s=new Lt({props:{tooltip:"Delete Template",$$slots:{default:[$8]},$$scope:{ctx:r}}}),s.$on("click",r[4]),{c(){e=Z("tr"),t=Z("td"),n=Z("input"),i=fe(),a=Z("td"),o=Z("input"),l=fe(),u=Z("td"),Ce(s.$$.fragment),R(n,"type","text"),R(n,"placeholder","template-name"),R(o,"type","text"),R(o,"placeholder","INPUT[slider(addLabels)]"),ps(o,"width","100%"),ps(a,"width","100%")},m(m,h){Q(m,e,h),$(e,t),$(t,n),Ye(n,r[0].name),$(e,i),$(e,a),$(a,o),Ye(o,r[0].declaration),$(e,l),$(e,u),Se(s,u,null),c=!0,f||(p=[xe(n,"input",r[2]),xe(o,"input",r[3])],f=!0)},p(m,[h]){h&1&&n.value!==m[0].name&&Ye(n,m[0].name),h&1&&o.value!==m[0].declaration&&Ye(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){oe(s.$$.fragment,m),c=!1},d(m){m&&X(e),Ne(s),f=!1,ot(p)}}}function G8(r,e,t){let{template:n}=e,i=Pu();function a(){console.log("dispatch"),i("delete-template",{name:n.name})}function o(){n.name=this.value,t(0,n)}function l(){n.declaration=this.value,t(0,n)}let u=()=>a();return r.$$set=s=>{"template"in s&&t(0,n=s.template)},[n,a,o,l,u]}var yd=class extends Ve{constructor(e){super(),ze(this,e,G8,H8,qe,{template:0})}},RA=yd;function kA(r,e,t){let n=r.slice();return n[11]=e[t],n}function LA(r){let e,t;return e=new RA({props:{template:r[11]}}),e.$on("delete-template",r[7]),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.template=n[11]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function W8(r){let e;return{c(){e=Be("Add Template")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function UA(r){let e,t,n,i,a;return i=new ys({props:{errorCollection:r[1],declaration:void 0}}),{c(){e=Z("div"),t=Z("h3"),t.textContent="Some Templates Failed to Parse",n=fe(),Ce(i.$$.fragment),R(t,"class","mod-error")},m(o,l){Q(o,e,l),$(e,t),$(e,n),Se(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){oe(i.$$.fragment,o),a=!1},d(o){o&&X(e),Ne(i)}}}function j8(r){let e;return{c(){e=Be("Save")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function Z8(r){let e;return{c(){e=Be("Cancel")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function J8(r){let e,t,n,i;return e=new Lt({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[j8]},$$scope:{ctx:r}}}),e.$on("click",r[9]),n=new Lt({props:{tooltip:"Revert Changes",$$slots:{default:[Z8]},$$scope:{ctx:r}}}),n.$on("click",r[10]),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment)},m(a,o){Se(e,a,o),Q(a,t,o),Se(n,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}),n.$set(u)},i(a){i||(te(e.$$.fragment,a),te(n.$$.fragment,a),i=!0)},o(a){oe(e.$$.fragment,a),oe(n.$$.fragment,a),i=!1},d(a){a&&X(t),Ne(e,a),Ne(n,a)}}}function Y8(r){let e,t,n,i,a,o,l,u,s,c,f,p=je(r[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=LA(kA(r,p,g));let h=g=>oe(m[g],1,1,()=>{m[g]=null});l=new Lt({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[W8]},$$scope:{ctx:r}}}),l.$on("click",r[8]);let d=r[1]&&UA(r);return c=new bs({props:{$$slots:{default:[J8]},$$scope:{ctx:r}}}),{c(){e=Z("div"),t=Z("table"),n=Z("thead"),n.innerHTML="<tr><th>Template Name</th> <th>Template Declaration</th> <th></th></tr>",i=fe(),a=Z("tbody");for(let g=0;g<m.length;g+=1)m[g].c();o=fe(),Ce(l.$$.fragment),u=fe(),d&&d.c(),s=fe(),Ce(c.$$.fragment)},m(g,v){Q(g,e,v),$(e,t),$(t,n),$(t,i),$(t,a);for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(a,null);$(e,o),Se(l,e,null),$(e,u),d&&d.m(e,null),$(e,s),Se(c,e,null),f=!0},p(g,[v]){if(v&5){p=je(g[0]);let x;for(x=0;x<p.length;x+=1){let _=kA(g,p,x);m[x]?(m[x].p(_,v),te(m[x],1)):(m[x]=LA(_),m[x].c(),te(m[x],1),m[x].m(a,null))}for(vt(),x=p.length;x<m.length;x+=1)h(x);yt()}let w={};v&16384&&(w.$$scope={dirty:v,ctx:g}),l.$set(w),g[1]?d?(d.p(g,v),v&2&&te(d,1)):(d=UA(g),d.c(),te(d,1),d.m(e,s)):d&&(vt(),oe(d,1,1,()=>{d=null}),yt());let y={};v&16384&&(y.$$scope={dirty:v,ctx:g}),c.$set(y)},i(g){if(!f){for(let v=0;v<p.length;v+=1)te(m[v]);te(l.$$.fragment,g),te(d),te(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let v=0;v<m.length;v+=1)oe(m[v]);oe(l.$$.fragment,g),oe(d),oe(c.$$.fragment,g),f=!1},d(g){g&&X(e),Nt(m,g),Ne(l),d&&d.d(),Ne(c)}}}function X8(r,e,t){let{inputFieldTemplates:n}=e,{modal:i}=e,a;function o(h){t(0,n=n.filter(d=>d.name!==h))}function l(){n.push({name:"",declaration:""}),t(0,n)}function u(){t(1,a=i.save(n)),a===void 0&&i.close()}function s(){i.close()}let c=h=>o(h.detail.name),f=()=>l(),p=()=>u(),m=()=>s();return r.$$set=h=>{"inputFieldTemplates"in h&&t(0,n=h.inputFieldTemplates),"modal"in h&&t(6,i=h.modal)},[n,a,o,l,u,s,i,c,f,p,m]}var bd=class extends Ve{constructor(e){super(),ze(this,e,X8,Y8,qe,{inputFieldTemplates:0,modal:6})}},VA=bd;var gc=class extends qA.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new VA({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(e){let t=this.plugin.api.inputFieldParser.parseTemplates(e);if(t.hasErrors())return t;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};function ku(r,e,t){return Math.min(Math.max(r,e),t)}function vc(r,e,t){return r!==void 0?Math.min(Math.max(r,e),t):void 0}function xd(r,e,t,n,i){return(r-e)/(t-e)*(i-n)+n}function wd(r,e){return(r%e+e)%e}function zA(r,e){if(r==null&&e==null)return!0;if(r==null||e==null||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function _d(r,e){for(let t=0;t<e.length;t++)if(r[t]!==e[t])return!1;return!0}function Lu(r){return!!r}function Uu(r){let e=Reflect.ownKeys(r);for(let t of e){let n=r[t];(n&&typeof n=="object"||typeof n=="function")&&Uu(n)}return Object.freeze(r)}function Ht(){return window.crypto.randomUUID()}function ws(r){try{return new URL(r),!0}catch(e){return!1}}function yc(r){window.open(r,"_blank")}function $A(r,e,t=", ",n="and"){return r.length===0?"":(r=r.map(e),r.length===1?r[0]:r.length===2?`${r[0]} ${n} ${r[1]}`:`${r.slice(0,-1).join(t)} ${n} ${r.slice(-1)}`)}function fi(r,e){r.innerHTML="",r.className="";let t=document.createElement("span");t.className="mb-warning mb-unloaded",t.innerText=`[MB_UNLOADED] ${e}`,r.appendChild(t)}var _t=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){yc(e)}};var QA=require("obsidian");var HA=require("obsidian");var _s=class extends HA.Modal{constructor(e,t){super(e),this.settings=t}onOpen(){this.modalEl.addClass("mb-error-collection-modal"),this.titleEl.innerText="Meta Bind Error Overview",this.component=new ys({target:this.contentEl,props:{settings:this.settings}})}onClose(){var e;(e=this.component)==null||e.$destroy()}};function GA(r){let e,t,n,i,a;function o(s,c){return c&1&&(t=null),c&1&&(n=null),t==null&&(t=!!s[0].hasErrors()),t?e6:(n==null&&(n=!!s[0].hasWarnings()),n?K8:Q8)}let l=o(r,-1),u=l(r);return{c(){e=Z("div"),u.c(),R(e,"class","mb-error-collection"),R(e,"role","button"),R(e,"tabindex","0")},m(s,c){Q(s,e,c),u.m(e,null),i||(a=[xe(e,"click",r[4]),xe(e,"keydown",r[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&&X(e),u.d(),i=!1,ot(a)}}}function Q8(r){let e,t,n,i;return{c(){e=Zn("svg"),t=Zn("circle"),n=Zn("path"),i=Zn("path"),R(t,"cx","12"),R(t,"cy","12"),R(t,"r","10"),R(n,"d","M12 16v-4"),R(i,"d","M12 8h.01"),R(e,"xmlns","http://www.w3.org/2000/svg"),R(e,"width","24"),R(e,"height","24"),R(e,"viewBox","0 0 24 24"),R(e,"fill","none"),R(e,"stroke","currentColor"),R(e,"stroke-width","2"),R(e,"stroke-linecap","round"),R(e,"stroke-linejoin","round"),R(e,"class","lucide lucide-info")},m(a,o){Q(a,e,o),$(e,t),$(e,n),$(e,i)},d(a){a&&X(e)}}}function K8(r){let e,t,n,i;return{c(){e=Zn("svg"),t=Zn("path"),n=Zn("line"),i=Zn("line"),R(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"),R(n,"x1","12"),R(n,"x2","12"),R(n,"y1","9"),R(n,"y2","13"),R(i,"x1","12"),R(i,"x2","12.01"),R(i,"y1","17"),R(i,"y2","17"),R(e,"xmlns","http://www.w3.org/2000/svg"),R(e,"width","24"),R(e,"height","24"),R(e,"viewBox","0 0 24 24"),R(e,"fill","none"),R(e,"stroke","currentColor"),R(e,"stroke-width","2"),R(e,"stroke-linecap","round"),R(e,"stroke-linejoin","round"),R(e,"class","lucide lucide-alert-triangle")},m(a,o){Q(a,e,o),$(e,t),$(e,n),$(e,i)},d(a){a&&X(e)}}}function e6(r){let e,t,n,i,a,o;return{c(){e=Zn("svg"),t=Zn("circle"),n=Zn("line"),i=Zn("line"),a=fe(),o=Z("span"),o.textContent="[META_BIND_ERROR]",R(t,"cx","12"),R(t,"cy","12"),R(t,"r","10"),R(n,"x1","12"),R(n,"x2","12"),R(n,"y1","8"),R(n,"y2","12"),R(i,"x1","12"),R(i,"x2","12.01"),R(i,"y1","16"),R(i,"y2","16"),R(e,"xmlns","http://www.w3.org/2000/svg"),R(e,"width","24"),R(e,"height","24"),R(e,"viewBox","0 0 24 24"),R(e,"fill","none"),R(e,"stroke","currentColor"),R(e,"stroke-width","2"),R(e,"stroke-linecap","round"),R(e,"stroke-linejoin","round"),R(e,"class","lucide lucide-alert-circle"),R(o,"class","mb-error")},m(l,u){Q(l,e,u),$(e,t),$(e,n),$(e,i),Q(l,a,u),Q(l,o,u)},d(l){l&&(X(e),X(a),X(o))}}}function t6(r){let e=!r[0].isEmpty(),t,n=e&&GA(r);return{c(){n&&n.c(),t=lr()},m(i,a){n&&n.m(i,a),Q(i,t,a)},p(i,[a]){a&1&&(e=!i[0].isEmpty()),e?n?n.p(i,a):(n=GA(i),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Fe,o:Fe,d(i){i&&X(t),n&&n.d(i)}}}function r6(r,e,t){let{app:n}=e,{errorCollection:i}=e,{declaration:a}=e;function o(){new _s(n,{errorCollection:i,declaration:a,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"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.",code:a}).open()}let l=()=>o(),u=s=>{s.key===" "&&o()};return r.$$set=s=>{"app"in s&&t(2,n=s.app),"errorCollection"in s&&t(0,i=s.errorCollection),"declaration"in s&&t(3,a=s.declaration)},[i,o,n,a,l,u]}var Ad=class extends Ve{constructor(e){super(),ze(this,e,r6,t6,qe,{app:2,errorCollection:0,declaration:3})}},Yn=Ad;var As=(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))(As||{}),Fr=(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))(Fr||{}),WA={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}};var nr={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","partial","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}},Vu=(i=>(i.MATH="math",i.TEXT="text",i.LINK="link",i.INVALID="invalid",i))(Vu||{}),Ds=(n=>(n.RENDER_MARKDOWN="renderMarkdown",n.HIDDEN="hidden",n.INVALID="invalid",n))(Ds||{}),bc={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}},Pn=(t=>(t.INLINE="inline",t.BLOCK="block",t))(Pn||{});var n6={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 Dd(r){let e=[];for(let[t,n]of Object.entries(n6)){if(n==="")continue;let i=r.api.inputField.createInputFieldDeclarationFromString(`INPUT[${n}]`);i=r.api.inputField.addArgument(i,{name:"showcase",value:["true"]}),i=r.api.inputField.addArgument(i,{name:"title",value:[t]}),e.push([t,i])}return e}var jA=require("obsidian");function i6(r){let e;return{c(){e=Z("div")},m(t,n){Q(t,e,n),r[4](e)},p:Fe,i:Fe,o:Fe,d(t){t&&X(e),r[4](null)}}}function a6(r,e,t){let{type:n}=e,{declaration:i}=e,{plugin:a}=e,o,l;nn(()=>{o=new jA.Component,a.api.createInputField(i,"block","",l,o),o.load()}),_o(()=>{o.unload()});function u(s){Tr[s?"unshift":"push"](()=>{l=s,t(0,l)})}return r.$$set=s=>{"type"in s&&t(1,n=s.type),"declaration"in s&&t(2,i=s.declaration),"plugin"in s&&t(3,a=s.plugin)},[l,n,i,a,u]}var Ed=class extends Ve{constructor(e){super(),ze(this,e,a6,i6,qe,{type:1,declaration:2,plugin:3})}},ZA=Ed;function JA(r,e,t){let n=r.slice();return n[7]=e[t],n}function o6(r){let e;return{c(){e=Be("Docs")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function s6(r){let e;return{c(){e=Be("GitHub")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function u6(r){let e;return{c(){e=Be("Report Issue")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function YA(r){let e,t;return e=new ZA({props:{type:r[7][0],declaration:r[7][1],plugin:r[1]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&2&&(a.type=n[7][0]),i&2&&(a.declaration=n[7][1]),i&2&&(a.plugin=n[1]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function l6(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h,d,g,v,w,y,x,_,b,D,S,A,E,M,F,P,k,O,I,T,q,B,U,G,H,L,ie,ve,se,ue,he,K,re;l=new Lt({props:{variant:"primary",$$slots:{default:[o6]},$$scope:{ctx:r}}}),l.$on("click",r[4]),s=new Lt({props:{variant:"default",$$slots:{default:[s6]},$$scope:{ctx:r}}}),s.$on("click",r[5]),f=new Lt({props:{variant:"default",$$slots:{default:[u6]},$$scope:{ctx:r}}}),f.$on("click",r[6]),A=new Yn({props:{app:r[0],declaration:c6,errorCollection:r[2]}}),P=new Yn({props:{app:r[0],declaration:f6,errorCollection:r[3]}});let me=je(Dd(r[1])),de=[];for(let we=0;we<me.length;we+=1)de[we]=YA(JA(r,me,we));let Pe=we=>oe(de[we],1,1,()=>{de[we]=null});return{c(){e=Z("div"),t=Z("h1"),t.textContent="Meta Bind FAQ",n=fe(),i=Z("h2"),i.textContent="Quick Access",a=fe(),o=Z("p"),Ce(l.$$.fragment),u=fe(),Ce(s.$$.fragment),c=fe(),Ce(f.$$.fragment),p=fe(),m=Z("h2"),m.textContent="Error Messages",h=fe(),d=Z("p"),g=Be("When creating "),v=Z("a"),v.textContent="Input Fields",y=Be(` or
`),x=Z("a"),x.textContent="View Fields",b=fe(),D=Z("strong"),D.textContent="warnings",S=Be(` (
`),Ce(A.$$.fragment),E=Be(`
) and `),M=Z("strong"),M.textContent="errors",F=Be(` (
`),Ce(P.$$.fragment),k=Be(`
) can occur. These are `),O=Z("strong"),O.textContent="clickable",I=Be(` and will show a modal with detailed information about the error
when clicked.`),T=fe(),q=Z("h2"),q.textContent="Input Fields",B=fe(),U=Z("p"),U.innerHTML=`<a href="${_t.linkToInputFields()}">Input Fields</a> let you change the frontmatter of your notes from inside
of notes.`,G=fe();for(let we=0;we<de.length;we+=1)de[we].c();H=fe(),L=Z("h2"),L.textContent="View Fields",ie=fe(),ve=Z("p"),ve.innerHTML=`<a href="${_t.linkToViewFields()}">View Fields</a> let you view and perform calculations using the frontmatter
of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
fields and as fast as obsidian allows it for changes from other sources.`,se=fe(),ue=Z("h2"),ue.textContent="Bind Targets",he=fe(),K=Z("p"),K.innerHTML=`<a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a>
let the plugin know what frontmatter properties to bind
<a href="${_t.linkToInputFields()}">Input Fields</a>
and
<a href="${_t.linkToViewFields()}">View Fields</a> to.`,R(v,"href",w=_t.linkToInputFields()),R(x,"href",_=_t.linkToViewFields()),R(e,"class","mb-faq-view markdown-rendered")},m(we,V){Q(we,e,V),$(e,t),$(e,n),$(e,i),$(e,a),$(e,o),Se(l,o,null),$(o,u),Se(s,o,null),$(o,c),Se(f,o,null),$(e,p),$(e,m),$(e,h),$(e,d),$(d,g),$(d,v),$(d,y),$(d,x),$(d,b),$(d,D),$(d,S),Se(A,d,null),$(d,E),$(d,M),$(d,F),Se(P,d,null),$(d,k),$(d,O),$(d,I),$(e,T),$(e,q),$(e,B),$(e,U),$(e,G);for(let J=0;J<de.length;J+=1)de[J]&&de[J].m(e,null);$(e,H),$(e,L),$(e,ie),$(e,ve),$(e,se),$(e,ue),$(e,he),$(e,K),re=!0},p(we,[V]){let J={};V&1024&&(J.$$scope={dirty:V,ctx:we}),l.$set(J);let ce={};V&1024&&(ce.$$scope={dirty:V,ctx:we}),s.$set(ce);let W={};V&1024&&(W.$$scope={dirty:V,ctx:we}),f.$set(W);let ee={};V&1&&(ee.app=we[0]),V&4&&(ee.errorCollection=we[2]),A.$set(ee);let ne={};if(V&1&&(ne.app=we[0]),V&8&&(ne.errorCollection=we[3]),P.$set(ne),V&2){me=je(Dd(we[1]));let ge;for(ge=0;ge<me.length;ge+=1){let ye=JA(we,me,ge);de[ge]?(de[ge].p(ye,V),te(de[ge],1)):(de[ge]=YA(ye),de[ge].c(),te(de[ge],1),de[ge].m(e,H))}for(vt(),ge=me.length;ge<de.length;ge+=1)Pe(ge);yt()}},i(we){if(!re){te(l.$$.fragment,we),te(s.$$.fragment,we),te(f.$$.fragment,we),te(A.$$.fragment,we),te(P.$$.fragment,we);for(let V=0;V<me.length;V+=1)te(de[V]);re=!0}},o(we){oe(l.$$.fragment,we),oe(s.$$.fragment,we),oe(f.$$.fragment,we),oe(A.$$.fragment,we),oe(P.$$.fragment,we),de=de.filter(Boolean);for(let V=0;V<de.length;V+=1)oe(de[V]);re=!1},d(we){we&&X(e),Ne(l),Ne(s),Ne(f),Ne(A),Ne(P),Nt(de,we)}}}var c6="INPUT[someInputFieldDeclaration]",f6="INPUT[someInputFieldDeclaration]";function p6(r,e,t){let{app:n}=e,{plugin:i}=e,a=new rr("exampleWarningErrorCollection"),o=new rr("exampleErrorErrorCollection");nn(()=>{a.add(new Ru({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),t(2,a),o.add(new Ru({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"})),t(3,o)});let l=()=>{_t.open(_t.linkToHome())},u=()=>{_t.open(_t.linkToGithub())},s=()=>{_t.open(_t.linkToIssues())};return r.$$set=c=>{"app"in c&&t(0,n=c.app),"plugin"in c&&t(1,i=c.plugin)},[n,i,a,o,l,u,s]}var Sd=class extends Ve{constructor(e){super(),ze(this,e,p6,l6,qe,{app:0,plugin:1})}},XA=Sd;var No="mb-faq-view-type",xc=class extends QA.ItemView{constructor(e,t){super(e),this.plugin=t}getViewType(){return No}getDisplayText(){return"Meta Bind FAQ"}async onOpen(){let e=this.containerEl.children[1];e.empty(),this.component=new XA({target:e,props:{app:this.app,plugin:this.plugin}})}async onClose(){var e;(e=this.component)==null||e.$destroy()}};var wc=class extends on.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;if(e.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){e.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 t=new on.ButtonComponent(e);t.setButtonText("Learn About Canary Builds"),t.setCta(),t.onClick(()=>{_t.open(_t.linkToCanaryBuilds())})}new on.Setting(e).setName("Quick access").addButton(t=>{t.setCta(),t.setButtonText("Docs"),t.onClick(()=>{_t.open(_t.linkToHome())})}).addButton(t=>{t.setButtonText("Open FAQ"),t.onClick(()=>{this.plugin.activateView(No)})}).addButton(t=>{t.setButtonText("GitHub"),t.onClick(()=>{_t.open(_t.linkToGithub())})}).addButton(t=>{t.setButtonText("Report Issue"),t.onClick(()=>{_t.open(_t.linkToIssues())})}),e.createEl("h2",{text:"General Settings"}),new on.Setting(e).setName("Enable Syntax Highlighting").setDesc("Enable syntax highlighting for. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableSyntaxHighlighting),t.onChange(n=>{this.plugin.settings.enableSyntaxHighlighting=n,this.plugin.saveSettings()})}),new on.Setting(e).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(t=>{t.setButtonText("Edit Templates"),t.onClick(()=>{new gc(this.app,this.plugin).open()})}),new on.Setting(e).setName("Excluded Folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(t=>{t.setButtonText("Edit Excluded Folders"),t.onClick(()=>{new hc(this.app,this.plugin).open()})}),new on.Setting(e).setName("View Fields display null as empty").setDesc("Display nothing instead of null, if the frontmatter value is empty, in text view fields.").addToggle(t=>{t.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),t.onChange(n=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=n,this.plugin.saveSettings()})}),new on.Setting(e).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(t=>{t.setValue(this.plugin.settings.enableJs),t.onChange(n=>{this.plugin.settings.enableJs=n,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and Time Settings"}),new on.Setting(e).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(t=>{t.setValue(this.plugin.settings.preferredDateFormat),t.onChange(n=>{this.plugin.settings.preferredDateFormat=n,this.plugin.saveSettings()})}),new on.Setting(e).setName("Use US date input field order").setDesc("When enabled the month input is before the day input.").addToggle(t=>{t.setValue(this.plugin.settings.useUsDateInputOrder),t.onChange(n=>{this.plugin.settings.useUsDateInputOrder=n,this.plugin.saveSettings()})}),new on.Setting(e).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(t=>{for(let n of wo)t.addOption(n.name,n.name);t.setValue(this.plugin.settings.firstWeekday.name),t.onChange(n=>{this.plugin.settings.firstWeekday=wo.find(i=>i.name===n),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced Settings"}),new on.Setting(e).setName("Dev Mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(t=>{t.setValue(this.plugin.settings.devMode),t.onChange(n=>{this.plugin.settings.devMode=n,this.plugin.saveSettings()})}),new on.Setting(e).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(t=>{t.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),t.onChange(n=>{this.plugin.settings.ignoreCodeBlockRestrictions=n,this.plugin.saveSettings()})}),new on.Setting(e).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: ${Ci.syncInterval}; Minimum: ${Ci.minSyncInterval}; Maximum: ${Ci.maxSyncInterval}`).addText(t=>{t.setValue(this.plugin.settings.syncInterval.toString()),t.onChange(n=>{this.plugin.settings.syncInterval=Number.parseInt(n),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=Ci.syncInterval),this.plugin.settings.syncInterval<Ci.minSyncInterval&&(this.plugin.settings.syncInterval=Ci.minSyncInterval),this.plugin.settings.syncInterval>Ci.maxSyncInterval&&(this.plugin.settings.syncInterval=Ci.maxSyncInterval),this.plugin.saveSettings()})})}};var Cd=require("obsidian"),$r=class r{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,Cd.moment)(e,r.dateFormat)}static getDefaultDate(){return(0,Cd.moment)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var Ra=ur(Rn()),Hu=ur(Xn());var Nn=ur(Rn());var dn=ur(Rn()),oD=ur(Xn());var Or=ur(Rn()),Oa=ur(Xn()),Sn=Or.P.sequence(Or.P.or(Oa.P_UTILS.unicodeLetter(),Or.P.oneOf("_$")),Or.P.or(Oa.P_UTILS.unicodeAlphanumeric(),Or.P.oneOf("-_$")).many()).map(r=>r[0]+r[1].join("")).describe("identifier"),rD=Or.P.sequenceMap((r,e)=>r+e.map(t=>t[0]+t[1]).join(""),Sn,Or.P.sequence(Oa.P_UTILS.optionalWhitespace(),Sn).many()).describe("identifier with spaces"),b6=Or.P.string("\\").then(Oa.P_UTILS.any()).map(r=>r==="'"?"'":r==="\\"?"\\":"\\"+r);function nD(r){return Or.P.or(b6,Or.P.noneOf(r+"\\")).many().map(e=>e.join("")).trim(Or.P.string(r))}var kd=nD("'"),iD=nD('"');function kn(r,e){return{value:r,position:e}}var Ld=Or.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),x6=Or.P.or(kd,Ld).node(kn),w6=Or.P.separateBy(x6,Or.P.string(",").describe('argument value separator ","').trim(Oa.P_UTILS.optionalWhitespace())),_6=Or.P.sequenceMap((r,e)=>({name:r,value:e}),Sn.node(kn),w6.trim(Oa.P_UTILS.optionalWhitespace()).wrap(Or.P.string("(").describe('argument value paren "("'),Or.P.string(")").describe('argument value paren ")"')).optional([])),qu=Or.P.separateBy(_6,Or.P.string(",").describe('argument separator ","').trim(Oa.P_UTILS.optionalWhitespace()));var Mo=(t=>(t.OBJECT="object",t.ARRAY="array",t))(Mo||{}),Fc=class{constructor(e,t,n){this.parent=e,this.access=t,this.child=n}};function A6(r,e){return r[e]}function aD(r,e,t){r[e]=t}var Co=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 Fc(e,this,A6(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 Fc(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");aD(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");aD(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 zu=dn.P.manyNotOf("{}[]#^|:?").box("file path"),sD=Sn.node((r,e)=>({type:"object",prop:kn(r,e)})),Ud=dn.P.or(oD.P_UTILS.digits().wrap(dn.P.string("["),dn.P.string("]")).node((r,e)=>({type:"array",prop:kn(r,e)})),iD.wrap(dn.P.string("["),dn.P.string("]")).node((r,e)=>({type:"object",prop:kn(r,e)}))),D6=dn.P.or(dn.P.sequenceMap(r=>({storagePath:void 0,listenToChildren:!1,storageProp:r}),Ud.atLeast(1)),dn.P.sequenceMap((r,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[r,...e]}),sD,Ud.many())),E6=dn.P.sequenceMap((r,e)=>[r,...e],sD,Ud.many()),Vd=dn.P.sequenceMap((r,e)=>(r.storageProp=r.storageProp.concat(e.flat()),r),D6,dn.P.string(".").then(E6).many()),Hi=dn.P.sequenceMap((r,e,t)=>(t.storageType=r,t.storagePath=e,t),Sn.describe("storage type").node(kn).skip(dn.P.string("^").describe('storage type separator "^"')).optional(),zu.describe("storage path").node(kn).skip(dn.P.string("#").describe('storage/file path separator "#"')).optional(),Vd.describe("property path")).box("bind target");function Ur(r,e){let t=r.tryParse(e);if(t.success)return t.value;throw new $u("ERROR","parsiNOM parser",e,t)}var $u=class extends kr{constructor(e,t,n,i){super({errorLevel:e,effect:"failed to parse",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=n,this.parseFailure=i,this.source=t,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 t=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} | `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let t=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return t+n}},Lr=class extends kr{constructor(e,t,n,i,a,o){super({errorLevel:e,effect:"failed to validate parser result",cause:n,docs:o}),this.str=i,this.position=a,this.source=t,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 t=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} | `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length,t.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,t){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:t,a="^".repeat(i-this.position.from.column);return n+a}};var uD=ur(Xn());var S6=Nn.P.sequence(zu,Nn.P.string("#").then(Nn.P.manyNotOf("[]#|^:")).optional(),Nn.P.string("|").then(Nn.P.manyNotOf("[]")).optional()),qd=Nn.P.or(Nn.P.sequenceMap((r,e)=>({isEmbed:r!==void 0,target:e[0],block:e[1],alias:e[2],internal:!0}),Nn.P.string("!").optional(),S6.wrapString("[[","]]")),Nn.P.sequenceMap((r,e,t)=>{let n=!ws(t);return{isEmbed:r!==void 0,target:t,block:void 0,alias:e,internal:n}},Nn.P.string("!").optional(),Nn.P.manyNotOf("[]").wrapString("[","]"),Nn.P.manyNotOf("()").wrapString("(",")"))),N6=Nn.P.separateBy(qd,Nn.P.string(",").trim(uD.P_UTILS.optionalWhitespace())),sn=class r{static parseLink(e){return Ur(qd.thenEof(),e)}static parseLinkList(e){return Ur(N6.thenEof(),e)}static isLink(e){return qd.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 ws(e)?r.urlToLink(new URL(e)):r.parseLink(e)}static convertToLinkString(e){return r.isLink(e)?e:ws(e)?`[${new URL(e).hostname}](${e})`:r.isLink(`[[${e}]]`)?`[[${e}]]`:""}};var cD=Ra.P.sequenceMap((r,e)=>r===void 0?e:-e,Ra.P.string("-").optional(),Ra.P.or(Ra.P.sequenceMap((r,e,t)=>Number(r+e+t),Hu.P_UTILS.digits(),Ra.P.string("."),Hu.P_UTILS.digits()),Hu.P_UTILS.digits().map(r=>Number(r)))).thenEof(),fD=Ra.P.sequenceMap((r,e)=>r===void 0?e:-e,Ra.P.string("-").optional(),Hu.P_UTILS.digits().map(r=>Number(r))).thenEof();function Kn(r){if(r.toLowerCase()==="null")return null;if(r==="true")return!0;if(r==="false")return!1;{let e=cD.tryParse(r);return e.success?e.value:r}}function Gu(r){return r===void 0||r===null?"":typeof r=="string"?r:typeof r=="boolean"?r?"true":"false":r.toString()}function ka(r){return r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"}function Gi(r){if(r!==void 0){if(ka(r))return[r];if(typeof r=="object"&&Array.isArray(r))return r.filter(e=>ka(e))}}function Ns(r){if(typeof r=="number")return r;if(typeof r=="string"){let e=cD.tryParse(r);if(e.success)return e.value}}function Cs(r){return ka(r)?Gu(r):void 0}function La(r){return ka(r)?r:void 0}function Ic(r,e){return Array.isArray(r)?r.map(t=>zd(t,e)).filter(t=>t!=="").join(", "):zd(r,e)}function zd(r,e){return r==null?e?"":"null":typeof r=="function"?"<function>":typeof r=="object"||Array.isArray(r)?JSON.stringify(r):r.toString()}function pD(r,e){return Array.isArray(r)?r.map(t=>lD(t,e)).filter(t=>t!==""):lD(r,e)}function lD(r,e){return typeof r=="string"?sn.isLink(r)?sn.parseLink(r):ws(r)?sn.urlToLink(new URL(r)):r:zd(r,e)}function mD(r,e){return r.evaluate?new Function("x",`return ${r.value};`)(e):Kn(r.value)}var Bc=class{constructor(e,t,n,i,a){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}update(e){this.metadataManager.updateCache(e,this)}applyUpdate(e){let t=this.callbackSignal.get(),n=mD(e,t);this.update(n)}notify(e){this.callbackSignal.set(e)}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var Pc=class{constructor(e,t,n,i,a,o,l){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.dependencies=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=l,this.deleted=!1}init(){for(let e of this.dependencies){let t=this.uuid+"/"+Ht();this.dependencySubscriptions.push(this.metadataManager.subscribe(t,e.callbackSignal,e.bindTarget,()=>this.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){let e=this.dependencySubscriptions.map(n=>n.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 pa=class{static get(e,t){return t.get(e).child}static tryGet(e,t){var n;return(n=t.tryGet(e))==null?void 0:n.child}static fullGet(e,t){return t.get(e)}static set(e,t,n){t.set(e,n)}static setAndCreate(e,t,n){t.setAndCreate(e,n)}};var To=(i=>(i.FRONTMATTER="frontmatter",i.MEMORY="memory",i.GLOBAL_MEMORY="globalMemory",i.SCOPE="scope",i))(To||{});var dD=5,C6=5*60;function $d(r,e){return r===void 0||e===void 0||r.storageType!==e.storageType||r.storagePath!==e.storagePath?!1:hD(r.storageProp.toStringArray(),e.storageProp.toStringArray(),e.listenToChildren)}function hD(r,e,t){return zA(r,e)||_d(e,r)?!0:t&&_d(r,e)}function M6(r){return r===void 0?"undefined":`${r.storagePath}#${r.storageProp.toString()}`}var Oc=class{constructor(e){this.cache=new Map,this.globalCache={metadata:Uu({}),memory:{},subscriptions:[]},this.metadataAdapter=e,this.metadataAdapter.setManagerInstance(this),this.metadataAdapter.load()}unload(){this.metadataAdapter.unload()}subscribeSubscription(e){var n,i;if(e.bindTarget===void 0)return;if(((n=e.bindTarget)==null?void 0:n.storageType)==="scope")throw new an({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:dD+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,n,i){let a=new Bc(e,t,this,n,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,n,i,a,o){let l=new Pc(e,t,this,n,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(),n=e.last();if(!(n===void 0||t===void 0)){if($d(t.bindTarget,n.bindTarget))throw new Eo({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${M6(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(n))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 n=[];for(let i of t.subscriptions)$d(i.bindTarget,e)&&n.push(i);return t.subscriptions.filter(i=>$d(i.bindTarget,e))}unsubscribe(e){if(e.bindTarget===void 0)return;let t=e.bindTarget.storagePath,n=this.getCacheForFile(t);n&&(console.debug(`meta-bind | MetadataManager >> unregistered ${e.uuid} to from file cache ${t}`),n.subscriptions=n.subscriptions.filter(i=>i.uuid!==e.uuid),n.subscriptions.length===0&&(console.debug(`meta-bind | MetadataManager >> marked unused file cache as inactive ${t}`),n.inactive=!0))}getCacheForFile(e){return this.cache.get(e)}createCacheForFile(e,t){if(this.cache.has(e))throw new an({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,n]of this.cache)n.changed&&this.updateExternal(t,n),n.cyclesSinceLastChange+=1,n.inactive&&(n.cyclesSinceInactive+=1),n.cyclesSinceInactive>C6&&e.push(t);for(let t of e)this.cache.delete(t)}async updateExternal(e,t){try{await this.metadataAdapter.updateMetadata(e,t)}catch(n){t.changed=!1,console.warn("failed to update frontmatter",n)}}updateCache(e,t){if(t.bindTarget===void 0)return;let n=t.bindTarget.storageProp,i=t.bindTarget.storagePath,a=t.bindTarget.storageType;if(console.debug(`meta-bind | MetadataManager >> updating "${JSON.stringify(n)}" in "${i}" metadata cache to`,e),a==="frontmatter"){let o=this.getCacheForFile(i);if(!o)return;pa.setAndCreate(o.metadata,n,e),o.cyclesSinceLastChange=0,o.changed=!0,this.notifyFileCacheListeners(o,"frontmatter",n,t.uuid)}else if(a==="memory"){let o=this.getCacheForFile(i);if(!o)return;pa.setAndCreate(o.memory,n,e),this.notifyFileCacheListeners(o,"memory",n,t.uuid)}else a==="globalMemory"&&(pa.setAndCreate(this.globalCache.memory,n,e),this.notifyFileCacheListeners(this.globalCache,"globalMemory",n,t.uuid))}updateCacheOnExternalFrontmatterUpdate(e,t){let n=this.getCacheForFile(e);if(!n||n.cyclesSinceLastChange<dD)return;let i=structuredClone(t);delete i.position,console.debug(`meta-bind | MetadataManager >> updating "${e}" on frontmatter update`,i),n.metadata=i,this.notifyFileCacheListeners(n,"frontmatter")}notifyFileCacheListeners(e,t,n,i){for(let a of e.subscriptions)if(!(i&&i===a.uuid)&&a.bindTarget!==void 0&&a.bindTarget.storageType===t)if(n){if(hD(n.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 n of t.subscriptions)n.delete();this.cache.delete(e)}}getPropertyFromCache(e,t,n){if(t==="frontmatter")return pa.tryGet(e.metadata,n);if(t==="memory")return pa.tryGet(e.memory,n);if(t==="globalMemory"){if(this.globalCache!==e)throw new an({errorLevel:"CRITICAL",effect:"can not get property from cache",cause:"cache is not the global cache"});return pa.tryGet(e.memory,n)}throw new an({errorLevel:"CRITICAL",effect:"can not get property from cache",cause:`bind target storage type "${t}" is not supported`})}};var gD=require("obsidian");var hn=class extends gD.MarkdownRenderChild{constructor(e,t,n,i,a){super(e),this.renderChildType=t,this.plugin=n,this.filePath=i,this.uuid=a,this.errorCollection=new rr(this.uuid)}};var Fo=class extends hn{constructor(e,t,n,i,a,o){super(e,t,i,a,o),this.errorCollection.merge(n.errorCollection),this.fullDeclaration=n.fullDeclaration,this.inputFieldDeclaration=n}getArguments(e){if(this.inputFieldDeclaration.errorCollection.hasErrors())throw new an({errorLevel:"CRITICAL",effect:"can not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.inputFieldDeclaration.argumentContainer.getAll(e)}getArgument(e){return this.getArguments(e).at(0)}getBindTarget(){return this.inputFieldDeclaration.bindTarget}getUuid(){return this.uuid}getFilePath(){return this.filePath}shouldAddCardContainer(){let e=this.inputFieldDeclaration.inputFieldType==="select"||this.inputFieldDeclaration.inputFieldType==="multi_select"||this.inputFieldDeclaration.inputFieldType==="multiSelect"||this.inputFieldDeclaration.inputFieldType==="list",t=Lu(this.getArgument("showcase"))||Lu(this.getArgument("title"));return this.renderChildType==="block"&&(e||t)}createErrorIndicator(e){new Yn({target:e,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}})}createWrapper(){let e=this.getArgument("title");if(this.shouldAddCardContainer()){let t=this.containerEl.createDiv({cls:"mb-card"});return e&&t.createEl("h3",{text:e.value}),t}else return this.containerEl}addShowcaseArgument(e){let t=this.getArgument("showcase");this.shouldAddCardContainer()&&t&&e.createEl("code",{cls:"mb-none"}).createEl("a",{text:this.fullDeclaration,href:_t.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(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new an({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}onload(){var i;if(console.log("meta-bind | InputFieldMDRC >> 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 e=this.createWrapper();this.createErrorIndicator(e);let t=e.createDiv();t.addClass("mb-input-wrapper"),(i=this.inputField)==null||i.mount(t);let n=this.getArguments("class");n&&t.addClasses(n.map(a=>a.value).flat()),this.renderChildType==="block"?this.containerEl.addClass("mb-input-block"):this.containerEl.addClass("mb-input-inline"),this.addShowcaseArgument(e)}onunload(){var e;console.log("meta-bind | InputFieldMDRC >> unload",this),(e=this.inputField)==null||e.destroy(),this.plugin.mdrcManager.unregisterMDRC(this),fi(this.containerEl,"input field"),super.onunload()}};var Hr=ur(Rn()),ei=ur(Xn());var T6=Hr.P.string("\\").then(ei.P_UTILS.any()).map(r=>r==="["?"[":r==="]"?"]":r==="{"?"{":r==="}"?"}":r==="\\"?"\\":"\\"+r),Rc=Hr.P.sequenceMap((r,e)=>r+e.flat().join(""),Hr.P.manyNotOf("{}[]\\"),Hr.P.sequence(T6,Hr.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),F6=Hr.P.sequenceMap((r,e)=>[r,...e.flat()],Rc,Hr.P.sequence(Hi.wrapString("{","}"),Rc).many()),I6=Hr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{viewFieldType:r,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},Sn.node(kn).trim(ei.P_UTILS.optionalWhitespace()).optional().describe("input field type"),qu.trim(ei.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(ei.P_UTILS.optionalWhitespace()).optional([]),Hr.P.sequence(Hr.P.string(":").trim(ei.P_UTILS.optionalWhitespace()),Hi).trim(ei.P_UTILS.optionalWhitespace()).optional()),Hd=Hr.P.sequenceMap((r,e,t,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),Hr.P.string("VIEW"),F6.wrapString("[","]"),ei.P_UTILS.optionalWhitespace(),I6.wrapString("[","]").optional(),ei.P_UTILS.eof()),B6=Hr.P.sequenceMap((r,e,t,n)=>(e!==void 0&&(r.listenToChildren=!0),{bindTarget:r,name:n}),Hi.wrapString("{","}"),Hr.P.string(" and children").optional(),Hr.P.string(" as "),Sn),vD=Hr.P.sequenceMap((r,e,t)=>({bindTargetMappings:r,writeToBindTarget:e,code:t}),B6.separateBy(ei.P_UTILS.whitespace()).skip(ei.P_UTILS.whitespace()),Hr.P.string("save to ").then(Hi.wrapString("{","}")).skip(ei.P_UTILS.whitespace()).optional(),Hr.P.string("---").then(ei.P_UTILS.remaining()));var Ms=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(Fr))e[t]=0;for(let t of this.arguments){let n=t.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new er({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[_t.linkToSearch(n.type)]})}}mergeByOverride(e){for(let t of e.arguments){let n=t.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let n=t.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new er({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 Ts=class extends Ms{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Fs=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(n=>n.length===e.length)===void 0)throw new er({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[_t.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 Is=class extends Fs{};var kc=class extends Is{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return bc.renderMarkdown}};var Lc=class extends Is{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return bc.hidden}};var yD={renderMarkdown:kc,hidden:Lc},Uc=class{static createViewFieldArgument(e){if(e in yD){let t=yD[e];if(t)return new t}throw new la({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var Vc=class{constructor(e,t,n){this.unvalidatedDeclaration=e,this.plugin=n,this.filePath=t,this.errorCollection=new rr("view field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,viewFieldType:t,writeToBindTarget:n,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(Vu))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new Lr("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 Ts;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Uc.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Lr("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.fullDeclaration,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(Ds))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Lr("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,n;try{return(n=(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?n:[]}catch(i){return this.errorCollection.add(i),[]}}};var qc=class{constructor(e){this.plugin=e}parseString(e,t,n){let i=new rr("ViewFieldDeclaration");try{let a=Ur(Hd,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],this.validateDeclaration(a,t,n)}catch(a){i.add(a)}return{fullDeclaration:e,errorCollection:i,templateDeclaration:[],viewFieldType:"invalid",argumentContainer:new Ts,writeToBindTarget:void 0}}parseStringWithoutValidation(e){let t=new rr("ViewFieldDeclaration");try{let n=Ur(Hd,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}validateDeclaration(e,t,n){return new Vc(e,t,this.plugin).validate(n)}parseJsString(e,t){let n={};n.errorCollection=new rr("JsViewFieldDeclaration"),n.fullDeclaration=e;try{let i=Ur(vD,e);n.bindTargetMappings=i.bindTargetMappings.map(a=>({bindTarget:this.plugin.api.bindTargetParser.validateBindTarget(e,a.bindTarget,t),name:a.name})),i.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.plugin.api.bindTargetParser.validateBindTarget(e,i.writeToBindTarget,t)),n.code=i.code}catch(i){n.errorCollection.add(i)}return n}};var Ua=class r{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 n of this.path.slice(1))t=n.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 n=this.path[0].get(e);for(let i of this.path.slice(1))n=i.get(n.child);n.access.set(n.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(0,t)),n=n.access.get(n.parent));for(let i=1;i<this.path.length;i++)n=this.path[i].get(n.child),n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(i,t)),n=n.access.get(n.parent));n.access.set(n.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let n=this.getNextPathElement(e);return n===void 0?t:n.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new r(this.path.concat(e.path))}};var zc=class{constructor(e){this.plugin=e}parseAndValidateBindTarget(e,t,n){return this.validateBindTarget(e,this.parseBindTarget(e),t,n)}parseBindTarget(e){return Ur(Hi,e)}validateBindTarget(e,t,n,i){let a={};if(a.storageProp=new Ua(t.storageProp.map(o=>new Co(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:n},e):a.storagePath=this.validateStoragePathAsFilePath(t.storagePath,e);else if(a.storageType==="memory")t.storagePath===void 0?a.storagePath=this.validateStoragePathAsFilePath({value:n},e):a.storagePath=this.validateStoragePathAsFilePath(t.storagePath,e);else if(a.storageType==="globalMemory"){if(t.storagePath!==void 0)throw new Lr("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 Lr("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 Lr("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 n of Object.entries(To))if(n[1]===(e==null?void 0:e.value))return n[1];throw new Lr("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 n=e==null?void 0:e.value;if(n===void 0)throw new Lr("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(n);if(i===void 0)throw new Lr("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,t,e==null?void 0:e.position);return i}};var Bs=class extends hn{};var Ps=class extends Bs{constructor(e,t,n,i,a,o){super(e,t,i,a,o),this.errorCollection.merge(n.errorCollection),this.fullDeclaration=n.fullDeclaration,this.viewFieldDeclaration=n}getArguments(e){if(this.viewFieldDeclaration.errorCollection.hasErrors())throw new an({errorLevel:"ERROR",effect:"an not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.viewFieldDeclaration.argumentContainer.getAll(e)}getArgument(e){return this.getArguments(e).at(0)}getDeclaration(){return this.viewFieldDeclaration}getUuid(){return this.uuid}getFilePath(){return this.filePath}createErrorIndicator(e){new Yn({target:e,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}})}createViewField(){if(!this.errorCollection.hasErrors())try{this.viewField=this.plugin.api.viewFieldFactory.createViewField(this.viewFieldDeclaration.viewFieldType,this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new an({errorLevel:"CRITICAL",effect:"can't render view field",cause:"view field is undefined"}))}onload(){var t;if(console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("mb-view"),this.containerEl.empty(),this.plugin.mdrcManager.registerMDRC(this),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(this.containerEl);return}let e=createDiv();e.addClass("mb-view-wrapper");try{(t=this.viewField)==null||t.mount(e)}catch(n){this.errorCollection.add(n)}this.createErrorIndicator(this.containerEl),this.containerEl.append(e),this.renderChildType==="block"?this.containerEl.addClass("mb-view-block"):this.containerEl.addClass("mb-view-inline")}onunload(){var e;console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),(e=this.viewField)==null||e.destroy(),this.plugin.mdrcManager.unregisterMDRC(this),fi(this.containerEl,"view field"),super.onunload()}};var Os=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=Ht(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let t of this.listeners)t.callback(e)}},xr=class extends Os{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},$c=class extends Os{constructor(e,t){super(),this.dependency=e,this.value=t(e.get()),this.dependencyListener=e.registerListener({callback:n=>this.set(t(n))})}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};function Rs(r){return app.vault.adapter.getResourcePath(r)}function bD(r){return r.dependencyManager.checkDependency("dataview").api}function Io(r){return r.dependencyManager.checkDependency("js-engine").api}var Hc=class extends Bs{constructor(e,t,n,i,a,o){var l;if(super(e,t,i,a,o),this.errorCollection.merge(n.errorCollection),this.fullDeclaration=n.fullDeclaration,this.viewFieldDeclaration=n,this.variables=[],this.file=this.plugin.app.vault.getAbstractFileByPath(this.filePath),this.errorCollection.isEmpty())try{for(let u of(l=this.viewFieldDeclaration.bindTargetMappings)!=null?l:[])this.variables.push({bindTargetDeclaration:u.bindTarget,inputSignal:new xr(void 0),uuid:Ht(),contextName:u.name})}catch(u){this.errorCollection.add(u)}}buildContext(){var t,n;let e={};for(let i of(t=this.variables)!=null?t:[])!i.contextName||!i.inputSignal||(e[i.contextName]=(n=i.inputSignal.get())!=null?n:"");return e}async evaluateExpression(){if(!this.plugin.settings.enableJs)throw new gs({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS expressions are disabled in the plugin settings."});let e;try{e=Io(this.plugin)}catch(n){throw n instanceof Error?new gs({errorLevel:"ERROR",effect:"can not create js view field",cause:n}):n}return await e.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 e=new xr(void 0);this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.uuid,e,this.viewFieldDeclaration.writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.update(),()=>this.unload())}unregisterSelfFromMetadataManager(){var e;(e=this.metadataSubscription)==null||e.unsubscribe()}async onload(){console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("mb-view"),this.containerEl.empty(),this.plugin.mdrcManager.registerMDRC(this);try{Io(this.plugin)}catch(t){t instanceof Error?this.errorCollection.add(new gs({errorLevel:"ERROR",effect:"can not create js view field",cause:t})):this.errorCollection.add(t)}if(new Yn({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.errorCollection.hasErrors())return;this.registerSelfToMetadataManager();let e=createDiv();e.addClass("mb-view-wrapper"),this.renderContainer=e,await this.update(),this.containerEl.appendChild(e)}onunload(){console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),fi(this.containerEl,"js view field"),super.onunload()}async update(){if(this.renderContainer)try{let e=Io(this.plugin),t=await this.evaluateExpression(),n=e.internal.createRenderer(this.renderContainer,this.filePath,this);return await n.render(t.result),n.convertToSimpleObject(t.result)}catch(e){e instanceof Error&&(this.renderContainer.innerText=e.message,this.renderContainer.addClass("mb-error"));return}}};var ks=class extends Ms{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Jt=class extends Fs{};var Gc=class extends Jt{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return nr.class}};var Wc=class extends Jt{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return nr.addLabels}};var jc=class extends Jt{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return nr.minValue}};var Zc=class extends Jt{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return nr.maxValue}};var Jc=class extends Jt{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=Kn(t[0].value),this.name=t[0].value):t.length===2&&(this.value=Kn(t[0].value),this.name=t[1].value)}getConfig(){return nr.option}};var Yc=class extends Jt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return nr.title}};var Xc=class extends Jt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return nr.optionQuery}};var Qc=class extends Jt{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return nr.showcase}};var Kc=class extends Jt{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=Kn(t[0].value)}getConfig(){return nr.offValue}};var ef=class extends Jt{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=Kn(t[0].value)}getConfig(){return nr.onValue}};var tf=class extends Jt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=Kn(t[0].value)}getConfig(){return nr.defaultValue}};var rf=class extends Jt{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return nr.placeholder}};function xD(r,e,t){return t==="true"?`[[${r}|${e}]]`:t==="partial"?`[[${e}]]`:`${e}`}var nf=class extends Jt{constructor(){super(...arguments);this.value="true"}_parseValue(t){var i;let n=(i=t[0])==null?void 0:i.value.toLowerCase();if(n===void 0){this.value="true";return}if(n==="true"||n==="partial"||n==="false"){this.value=n;return}throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${$A(["true","partial","false"],a=>`'${a}'`,", ","or")}`,docs:[_t.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return nr.useLinks}};var af=class extends Jt{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return nr.stepSize}};var of=class extends Jt{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new er({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[_t.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return nr.limit}};var wD={class:Gc,addLabels:Wc,minValue:jc,maxValue:Zc,stepSize:af,option:Jc,title:Yc,optionQuery:Xc,showcase:Qc,offValue:Kc,onValue:ef,defaultValue:tf,placeholder:rf,useLinks:nf,limit:of},sf=class{static createInputFieldArgument(e){if(e in wD){let t=wD[e];if(t)return new t}throw new la({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var Wu=class{constructor(e,t,n){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=n,this.errorCollection=new rr("input field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,inputFieldType:t,bindTarget:n,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(As))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new Lr("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 Lr("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 ks;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=sf.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Lr("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.fullDeclaration,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(Fr))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Lr("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 hr=ur(Rn());var gn=ur(Xn());var O6=hr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},Sn.node(kn).trim(gn.P_UTILS.optionalWhitespace()).describe("input field type"),qu.trim(gn.P_UTILS.optionalWhitespace()).wrap(hr.P.string("(").describe('arguments paren "("'),hr.P.string(")").describe('arguments paren ")"')).trim(gn.P_UTILS.optionalWhitespace()).optional([]),hr.P.sequence(hr.P.string(":").trim(gn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Hi).trim(gn.P_UTILS.optionalWhitespace()).optional()),_D=hr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},Sn.node(kn).trim(gn.P_UTILS.optionalWhitespace()).optional().describe("input field type"),qu.trim(gn.P_UTILS.optionalWhitespace()).wrap(hr.P.string("(").describe('arguments paren "("'),hr.P.string(")").describe('arguments paren ")"')).trim(gn.P_UTILS.optionalWhitespace()).optional([]),hr.P.sequence(hr.P.string(":").trim(gn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Hi).trim(gn.P_UTILS.optionalWhitespace()).optional()),Gd=hr.P.or(hr.P.sequenceMap((r,e,t)=>(t.templateName=e,t),hr.P.string("INPUT"),hr.P.sequenceMap((r,e,t)=>e,hr.P.string("["),rD.node(kn).trim(gn.P_UTILS.optionalWhitespace()).describe("template name"),hr.P.string("]").skip(gn.P_UTILS.optionalWhitespace())),_D.wrap(hr.P.string("["),hr.P.string("]")),gn.P_UTILS.eof()),hr.P.sequenceMap((r,e)=>e,hr.P.string("INPUT"),O6.wrap(hr.P.string("["),hr.P.string("]")),gn.P_UTILS.eof())),AD=hr.P.sequenceMap((r,e)=>e,hr.P.string("INPUT"),_D.wrap(hr.P.string("["),hr.P.string("]")),gn.P_UTILS.eof());var uf=class{constructor(e){this.plugin=e,this.templates=[]}parseString(e,t,n){let i=new rr("InputFieldParser");try{let a=Ur(Gd,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],a=this.applyTemplate(a),new Wu(this.plugin,a,t).validate(n)}catch(a){i.add(a)}return{fullDeclaration:e,inputFieldType:"invalid",bindTarget:void 0,argumentContainer:new ks,errorCollection:i}}parseStringWithoutValidation(e){let t=new rr("InputFieldParser");try{let n=Ur(Gd,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}validateDeclaration(e,t,n){return new Wu(this.plugin,e,t).validate(n)}parseTemplateString(e){let t=new rr("InputFieldParser");try{let n=Ur(AD,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new rr("input field template parser");for(let n of e){let i=this.parseTemplateString(n.declaration);t.merge(i.errorCollection);let a={name:n.name,template:i};this.templates.push(Uu(a))}return t}getTemplate(e){var t;return(t=this.templates.find(n=>n.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 Lr("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 lf=class{constructor(e){this.api=e}createInputFieldDeclaration(e,t){let n=new rr("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:n}}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(n=>({name:{value:n.name},value:n.value.map(i=>({value:i}))})),e}addArgument(e,t){return Array.isArray(t)?e.arguments=e.arguments.concat(t.map(n=>({name:{value:n.name},value:n.value.map(i=>({value:i}))}))):e.arguments.push({name:{value:t.name},value:t.value.map(n=>({value:n}))}),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(n=>({type:"object",prop:{value:n}})):e.bindTarget={storagePath:void 0,storageProp:t.map(n=>({type:"object",prop:{value:n}})),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 n;return e.bindTarget===void 0?n=t.bindTarget:(n=e.bindTarget,((i=t.bindTarget)==null?void 0:i.storagePath)!==void 0&&(n.storagePath=t.bindTarget.storagePath),((a=t.bindTarget)==null?void 0:a.storageProp)!==void 0&&(n.storageProp=t.bindTarget.storageProp)),{fullDeclaration:t.fullDeclaration,inputFieldType:(o=t.inputFieldType)!=null?o:e.inputFieldType,bindTarget:n,arguments:t.arguments.concat(e.arguments).reduce((l,u)=>(l.find(s=>s.name===u.name)===void 0&&l.push(u),l),[]),errorCollection:new rr("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}};var cf=class extends hn{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),super.onunload()}};var Ls=class{constructor(e){this.scope=e}};var DD=require("obsidian");function R6(r){let e,t;return{c(){e=Z("td"),t=Z("div")},m(n,i){Q(n,e,i),$(e,t),r[3](t)},p:Fe,i:Fe,o:Fe,d(n){n&&X(e),r[3](null)}}}function k6(r,e,t){let{table:n}=e,{cell:i}=e,a,o;nn(()=>{o=new DD.Component,o.load(),n.createCell(i,a,o)}),_o(()=>{o.unload()});function l(u){Tr[u?"unshift":"push"](()=>{a=u,t(0,a)})}return r.$$set=u=>{"table"in u&&t(1,n=u.table),"cell"in u&&t(2,i=u.cell)},[a,n,i,l]}var Wd=class extends Ve{constructor(e){super(),ze(this,e,k6,R6,qe,{table:1,cell:2})}},ED=Wd;function SD(r,e,t){let n=r.slice();return n[7]=e[t],n}function ND(r,e,t){let n=r.slice();return n[10]=e[t],n[11]=e,n[12]=t,n}function CD(r,e,t){let n=r.slice();return n[13]=e[t],n}function MD(r){let e,t=r[13]+"",n;return{c(){e=Z("th"),n=Be(t)},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&2&&t!==(t=i[13]+"")&&nt(n,t)},d(i){i&&X(e)}}}function L6(r){let e,t,n;return{c(){e=Z("td"),t=Be("invalid data"),R(e,"class","meta-bind-error"),R(e,"colspan",n=r[1].length)},m(i,a){Q(i,e,a),$(e,t)},p(i,a){a&2&&n!==(n=i[1].length)&&R(e,"colspan",n)},i:Fe,o:Fe,d(i){i&&X(e)}}}function U6(r){let e,t,n=je(r[7].cells),i=[];for(let o=0;o<n.length;o+=1)i[o]=TD(ND(r,n,o));let a=o=>oe(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=lr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);Q(o,e,l),t=!0},p(o,l){if(l&5){n=je(o[7].cells);let u;for(u=0;u<n.length;u+=1){let s=ND(o,n,u);i[u]?(i[u].p(s,l),te(i[u],1)):(i[u]=TD(s),i[u].c(),te(i[u],1),i[u].m(e.parentNode,e))}for(vt(),u=n.length;u<i.length;u+=1)a(u);yt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)te(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)oe(i[l]);t=!1},d(o){o&&X(e),Nt(i,o)}}}function TD(r){let e,t,n;function i(o){r[4](o,r[10],r[11],r[12])}let a={table:r[0]};return r[10]!==void 0&&(a.cell=r[10]),e=new ED({props:a}),Tr.push(()=>Pa(e,"cell",i)),{c(){Ce(e.$$.fragment)},m(o,l){Se(e,o,l),n=!0},p(o,l){r=o;let u={};l&1&&(u.table=r[0]),!t&&l&4&&(t=!0,u.cell=r[10],Ba(()=>t=!1)),e.$set(u)},i(o){n||(te(e.$$.fragment,o),n=!0)},o(o){oe(e.$$.fragment,o),n=!1},d(o){Ne(e,o)}}}function V6(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function FD(r,e){let t,n,i,a,o,l,u,s,c=[U6,L6],f=[];function p(h,d){return h[7].isValid?0:1}n=p(e,-1),i=f[n]=c[n](e);function m(){return e[5](e[7])}return l=new Lt({props:{$$slots:{default:[V6]},$$scope:{ctx:e}}}),l.$on("click",m),{key:r,first:null,c(){t=Z("tr"),i.c(),a=fe(),o=Z("td"),Ce(l.$$.fragment),u=fe(),this.first=t},m(h,d){Q(h,t,d),f[n].m(t,null),$(t,a),$(t,o),Se(l,o,null),$(t,u),s=!0},p(h,d){e=h;let g=n;n=p(e,d),n===g?f[n].p(e,d):(vt(),oe(f[g],1,1,()=>{f[g]=null}),yt(),i=f[n],i?i.p(e,d):(i=f[n]=c[n](e),i.c()),te(i,1),i.m(t,a));let v={};d&65536&&(v.$$scope={dirty:d,ctx:e}),l.$set(v)},i(h){s||(te(i),te(l.$$.fragment,h),s=!0)},o(h){oe(i),oe(l.$$.fragment,h),s=!1},d(h){h&&X(t),f[n].d(),Ne(l)}}}function q6(r){let e;return{c(){e=Be("Add Column")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function z6(r){let e,t,n,i,a,o,l,u,s=[],c=new Map,f,p,m,h=je(r[1]),d=[];for(let w=0;w<h.length;w+=1)d[w]=MD(CD(r,h,w));let g=je(r[2]),v=w=>w[7].index;for(let w=0;w<g.length;w+=1){let y=SD(r,g,w),x=v(y);c.set(x,s[w]=FD(x,y))}return p=new Lt({props:{$$slots:{default:[q6]},$$scope:{ctx:r}}}),p.$on("click",r[6]),{c(){e=Z("div"),t=Z("table"),n=Z("thead"),i=Z("tr");for(let w=0;w<d.length;w+=1)d[w].c();a=fe(),o=Z("th"),l=fe(),u=Z("tbody");for(let w=0;w<s.length;w+=1)s[w].c();f=fe(),Ce(p.$$.fragment),R(t,"class","mb-html-table"),R(e,"class","mb-table-wrapper")},m(w,y){Q(w,e,y),$(e,t),$(t,n),$(n,i);for(let x=0;x<d.length;x+=1)d[x]&&d[x].m(i,null);$(i,a),$(i,o),$(t,l),$(t,u);for(let x=0;x<s.length;x+=1)s[x]&&s[x].m(u,null);Q(w,f,y),Se(p,w,y),m=!0},p(w,[y]){if(y&2){h=je(w[1]);let _;for(_=0;_<h.length;_+=1){let b=CD(w,h,_);d[_]?d[_].p(b,y):(d[_]=MD(b),d[_].c(),d[_].m(i,a))}for(;_<d.length;_+=1)d[_].d(1);d.length=h.length}y&7&&(g=je(w[2]),vt(),s=hs(s,y,v,1,w,g,c,u,mc,FD,null,SD),yt());let x={};y&65536&&(x.$$scope={dirty:y,ctx:w}),p.$set(x)},i(w){if(!m){for(let y=0;y<g.length;y+=1)te(s[y]);te(p.$$.fragment,w),m=!0}},o(w){for(let y=0;y<s.length;y+=1)oe(s[y]);oe(p.$$.fragment,w),m=!1},d(w){w&&(X(e),X(f)),Nt(d,w);for(let y=0;y<s.length;y+=1)s[y].d();Ne(p,w)}}}function $6(r,e,t){let{table:n}=e,{tableHead:i=[]}=e,a=[];function o(c){t(2,a=c)}function l(c,f,p,m){p[m]=c,t(2,a)}let u=c=>n.removeColumn(c.index),s=()=>n.addColumn();return r.$$set=c=>{"table"in c&&t(0,n=c.table),"tableHead"in c&&t(1,i=c.tableHead)},[n,i,a,o,l,u,s]}var jd=class extends Ve{constructor(e){super(),ze(this,e,$6,z6,qe,{table:0,tableHead:1,updateTable:3})}get updateTable(){return this.$$.ctx[3]}},ID=jd;function ff(r){return new Ua(r.map(e=>fD.tryParse(e).success?new Co("array",e):new Co("object",e)))}var pf=class extends hn{constructor(e,t,n,i,a,o,l,u){super(e,t,n,i,a),this.bindTarget=o,this.tableHead=l,this.columns=u,this.inputSignal=new xr(void 0),this.outputSignal=new xr(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 e;this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),(e=this.metadataSubscription)==null||e.unsubscribe()}updateMetadataManager(e){var t;(t=this.metadataSubscription)==null||t.update(e)}updateDisplayValue(e){var n;e=e!=null?e:[];let t=[];for(let i=0;i<e.length;i++)if(typeof e[i]=="object"){let a=new Ls({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(ff([i.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),o=this.columns.map(l=>"inputFieldType"in l?(console.log("validate",l,this.filePath,a),this.plugin.api.inputFieldParser.validateDeclaration(l,this.filePath,a)):this.plugin.api.viewFieldParser.validateDeclaration(l,this.filePath,a));t.push({cells:o,index:i,value:e[i],isValid:!0})}else t.push({cells:[],index:i,value:e[i],isValid:!1});(n=this.tableComponent)==null||n.updateTable(t)}createCell(e,t,n){let i=Ht();if("inputFieldType"in e){let a=new Fo(t,"inline",e,this.plugin,this.filePath,`${this.uuid}/${i}`);n.addChild(a)}else{let a=new Ps(t,"inline",e,this.plugin,this.filePath,`${this.uuid}/${i}`);n.addChild(a)}}removeColumn(e){var t;this.value=(t=this.value)!=null?t:[],this.value.splice(e,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){var e;this.value=(e=this.value)!=null?e:[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onload(){this.plugin.mdrcManager.registerMDRC(this),this.tableComponent=new ID({target:this.containerEl,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:e=>{this.value=e,this.updateDisplayValue(e)}}),this.registerSelfToMetadataManager()}onunload(){var e;this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),(e=this.tableComponent)==null||e.$destroy()}};var mf=class extends Os{constructor(e){super(),this.mounted=!1,this.svelteComponent=e}setValue(e){var t;(t=this.svelteComponentInstance)==null||t.setValue(e)}mount(e,t,n={}){let i=Object.assign({value:t,onValueChange:a=>{this.notifyListeners(a)}},n);this.svelteComponentInstance=new this.svelteComponent({target:e,props:i}),this.mounted=!0}unmount(){var e;this.unregisterAllListeners(),(e=this.svelteComponentInstance)==null||e.$destroy(),this.mounted=!1}isMounted(){return this.mounted}};var Ot=class{constructor(e){this.base=e,this.inputSignal=new xr(void 0),this.inputFieldComponent=new mf(this.getSvelteComponent()),this.computedSignal=new $c(this.inputSignal,t=>{let n=this.filterValue(t);return n!==void 0?n:this.getDefaultValue()})}destroy(){this.inputFieldComponent.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n: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.onmount(),this.computedSignal.registerListener({callback:n=>this.inputFieldComponent.setValue(this.reverseMapValue(n))});let t=this.base.getBindTarget();t&&(this.inputFieldComponent.registerListener({callback:n=>{this.notifySubscription(this.mapValue(n))}}),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.onunmount(),this.computedSignal.unregisterAllListeners(),(e=this.metadataSubscription)==null||e.unsubscribe(),this.inputFieldComponent.unmount()}onmount(){}onunmount(){}};function H6(r){let e,t,n,i;return{c(){e=Z("div"),t=Z("input"),R(t,"type","checkbox"),R(t,"tabindex","-1"),t.checked=r[0],R(e,"class","checkbox-container"),R(e,"role","switch"),R(e,"tabindex","0"),R(e,"aria-checked",r[0]),At(e,"is-enabled",r[0])},m(a,o){Q(a,e,o),$(e,t),n||(i=[xe(e,"click",r[5]),xe(e,"keypress",r[6])],n=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&R(e,"aria-checked",a[0]),o&1&&At(e,"is-enabled",a[0])},i:Fe,o:Fe,d(a){a&&X(e),n=!1,ot(i)}}}function G6(r,e,t){let{value:n}=e,{onValueChange:i}=e;function a(c){t(0,n=c)}function o(){t(0,n=!n),console.log("toggle"),i(n)}function l(c){c.key===" "&&o()}let u=()=>o(),s=c=>l(c);return r.$$set=c=>{"value"in c&&t(0,n=c.value),"onValueChange"in c&&t(3,i=c.onValueChange)},[n,o,l,i,a,u,s]}var Zd=class extends Ve{constructor(e){super(),ze(this,e,G6,H6,qe,{value:0,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},BD=Zd;var df=class extends Ot{constructor(e){var t,n,i,a;super(e),this.onValue=(n=(t=this.base.getArgument("onValue"))==null?void 0:t.value)!=null?n:!0,this.offValue=(a=(i=this.base.getArgument("offValue"))==null?void 0:i.value)!=null?a:!1}filterValue(e){return e===this.onValue||e===this.offValue?La(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return BD}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};function PD(r){let e,t=OD(r[0].length,r[2])+"",n,i;return{c(){e=Z("span"),n=Be(t),R(e,"class",i=`mb-content-limit-indicator ${r[0].length>r[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o&5&&t!==(t=OD(a[0].length,a[2])+"")&&nt(n,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&R(e,"class",i)},d(a){a&&X(e)}}}function W6(r){let e,t,n,i,a,o=r[2]!==void 0&&PD(r);return{c(){e=Z("input"),t=fe(),o&&o.c(),n=lr(),R(e,"type","text"),R(e,"tabindex","0"),R(e,"placeholder",r[1]),R(e,"maxlength",r[2])},m(l,u){Q(l,e,u),Ye(e,r[0]),Q(l,t,u),o&&o.m(l,u),Q(l,n,u),i||(a=[xe(e,"input",r[5]),xe(e,"input",r[6])],i=!0)},p(l,[u]){u&2&&R(e,"placeholder",l[1]),u&4&&R(e,"maxlength",l[2]),u&1&&e.value!==l[0]&&Ye(e,l[0]),l[2]!==void 0?o?o.p(l,u):(o=PD(l),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},i:Fe,o:Fe,d(l){l&&(X(e),X(t),X(n)),o&&o.d(l),i=!1,ot(a)}}}function OD(r,e){let t=e.toString();return`${r.toString().padStart(t.length,"0")}/${t}`}function j6(r,e,t){let{value:n}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(){n=this.value,t(0,n)}let s=()=>o(n);return r.$$set=c=>{"value"in c&&t(0,n=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)},[n,i,a,o,l,u,s]}var Jd=class extends Ve{constructor(e){super(),ze(this,e,j6,W6,qe,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},RD=Jd;var hf=class extends Ot{constructor(e){super(e)}filterValue(e){return Cs(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return RD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function Z6(r){let e,t,n;return{c(){e=Z("input"),R(e,"class","mb-slider-input"),R(e,"type","range"),R(e,"tabindex","0"),R(e,"min",r[1]),R(e,"max",r[2]),R(e,"step",r[3])},m(i,a){Q(i,e,a),Ye(e,r[0]),t||(n=[xe(e,"change",r[9]),xe(e,"input",r[9]),xe(e,"input",r[10])],t=!0)},p(i,a){a&2&&R(e,"min",i[1]),a&4&&R(e,"max",i[2]),a&8&&R(e,"step",i[3]),a&1&&Ye(e,i[0])},d(i){i&&X(e),t=!1,ot(n)}}}function J6(r){let e,t,n,i,a,o,l,u,s;return{c(){e=Z("span"),t=Be(r[1]),n=fe(),i=Z("input"),a=fe(),o=Z("span"),l=Be(r[2]),R(e,"class","mb-slider-input-label"),R(i,"class","mb-slider-input"),R(i,"type","range"),R(i,"tabindex","0"),R(i,"min",r[1]),R(i,"max",r[2]),R(i,"step",r[3]),R(o,"class","mb-slider-input-label")},m(c,f){Q(c,e,f),$(e,t),Q(c,n,f),Q(c,i,f),Ye(i,r[0]),Q(c,a,f),Q(c,o,f),$(o,l),u||(s=[xe(i,"change",r[7]),xe(i,"input",r[7]),xe(i,"input",r[8])],u=!0)},p(c,f){f&2&&nt(t,c[1]),f&2&&R(i,"min",c[1]),f&4&&R(i,"max",c[2]),f&8&&R(i,"step",c[3]),f&1&&Ye(i,c[0]),f&4&&nt(l,c[2])},d(c){c&&(X(e),X(n),X(i),X(a),X(o)),u=!1,ot(s)}}}function Y6(r){let e;function t(a,o){return a[4]?J6:Z6}let n=t(r,-1),i=n(r);return{c(){i.c(),e=lr()},m(a,o){i.m(a,o),Q(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Fe,o:Fe,d(a){a&&X(e),i.d(a)}}}function X6(r,e,t){let{value:n}=e,{minValue:i}=e,{maxValue:a}=e,{stepSize:o}=e,{addLabels:l}=e,{onValueChange:u}=e;function s(h){t(0,n=h)}function c(){n=ci(this.value),t(0,n)}let f=()=>u(n);function p(){n=ci(this.value),t(0,n)}let m=()=>u(n);return r.$$set=h=>{"value"in h&&t(0,n=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)},[n,i,a,o,l,u,s,c,f,p,m]}var Yd=class extends Ve{constructor(e){super(),ze(this,e,X6,Y6,qe,{value:0,minValue:1,maxValue:2,stepSize:3,addLabels:4,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},kD=Yd;var gf=class extends Ot{constructor(e){var t,n,i,a,o,l;if(super(e),this.minValue=(n=(t=this.base.getArgument("minValue"))==null?void 0:t.value)!=null?n:0,this.maxValue=(a=(i=this.base.getArgument("maxValue"))==null?void 0:i.value)!=null?a:100,this.stepSize=(l=(o=this.base.getArgument("stepSize"))==null?void 0:o.value)!=null?l:1,this.minValue>=this.maxValue)throw new er({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return vc(Ns(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return kD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e;return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:((e=this.base.getArgument("addLabels"))==null?void 0:e.value)===!0}}};function Q6(r){let e,t,n;return{c(){e=Z("textarea"),R(e,"tabindex","0"),R(e,"placeholder",r[1]),R(e,"maxlength",r[2])},m(i,a){Q(i,e,a),Ye(e,r[0]),t||(n=[xe(e,"input",r[5]),xe(e,"input",r[6])],t=!0)},p(i,[a]){a&2&&R(e,"placeholder",i[1]),a&4&&R(e,"maxlength",i[2]),a&1&&Ye(e,i[0])},i:Fe,o:Fe,d(i){i&&X(e),t=!1,ot(n)}}}function K6(r,e,t){let{value:n}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(){n=this.value,t(0,n)}let s=()=>o(n);return r.$$set=c=>{"value"in c&&t(0,n=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)},[n,i,a,o,l,u,s]}var Xd=class extends Ve{constructor(e){super(),ze(this,e,K6,Q6,qe,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},LD=Xd;var ju=class extends Ot{constructor(e){super(e)}filterValue(e){return Cs(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return LD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function eU(r){let e,t;return{c(){e=Z("a"),t=Be(r[2]),R(e,"data-href",r[2]),R(e,"href",r[2]),R(e,"class",r[1]),R(e,"target","_blank"),R(e,"rel","noopener")},m(n,i){Q(n,e,i),$(e,t)},p(n,i){i&4&&nt(t,n[2]),i&4&&R(e,"data-href",n[2]),i&4&&R(e,"href",n[2]),i&2&&R(e,"class",n[1])},d(n){n&&X(e)}}}function tU(r){let e,t=r[0].alias+"",n;return{c(){e=Z("a"),n=Be(t),R(e,"data-href",r[2]),R(e,"href",r[2]),R(e,"class",r[1]),R(e,"target","_blank"),R(e,"rel","noopener"),R(e,"aria-label",r[2])},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&1&&t!==(t=i[0].alias+"")&&nt(n,t),a&4&&R(e,"data-href",i[2]),a&4&&R(e,"href",i[2]),a&2&&R(e,"class",i[1]),a&4&&R(e,"aria-label",i[2])},d(i){i&&X(e)}}}function rU(r){let e;function t(a,o){return a[0].alias?tU:eU}let n=t(r,-1),i=n(r);return{c(){i.c(),e=lr()},m(a,o){i.m(a,o),Q(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Fe,o:Fe,d(a){a&&X(e),i.d(a)}}}function nU(r,e,t){let n,i,{mdLink:a}=e;return r.$$set=o=>{"mdLink"in o&&t(0,a=o.mdLink)},r.$$.update=()=>{r.$$.dirty&1&&t(2,n=a.block?`${a.target}#${a.block}`:a.target),r.$$.dirty&1&&t(1,i=a.internal?"internal-link":"external-link")},[a,i,n]}var Qd=class extends Ve{constructor(e){super(),ze(this,e,nU,rU,qe,{mdLink:0})}},Va=Qd;var iU=r=>({element:r&1}),UD=r=>({element:r[0][r[0].length-1]});function VD(r,e,t){let n=r.slice();return n[3]=e[t],n}var aU=r=>({element:r&1}),qD=r=>({element:r[3]});function zD(r){let e,t,n,i,a,o=r[2].default,l=ia(o,r,r[1],qD);return{c(){l&&l.c(),e=fe(),t=Z("span"),t.textContent=",",n=fe(),i=Z("span")},m(u,s){l&&l.m(u,s),Q(u,e,s),Q(u,t,s),Q(u,n,s),Q(u,i,s),a=!0},p(u,s){l&&l.p&&(!a||s&3)&&oa(l,o,u,u[1],a?aa(o,u[1],s,aU):sa(u[1]),qD)},i(u){a||(te(l,u),a=!0)},o(u){oe(l,u),a=!1},d(u){u&&(X(e),X(t),X(n),X(i)),l&&l.d(u)}}}function oU(r){let e,t,n=je(r[0].slice(0,r[0].length-1)),i=[];for(let u=0;u<n.length;u+=1)i[u]=zD(VD(r,n,u));let a=u=>oe(i[u],1,1,()=>{i[u]=null}),o=r[2].default,l=ia(o,r,r[1],UD);return{c(){for(let u=0;u<i.length;u+=1)i[u].c();e=fe(),l&&l.c()},m(u,s){for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(u,s);Q(u,e,s),l&&l.m(u,s),t=!0},p(u,[s]){if(s&3){n=je(u[0].slice(0,u[0].length-1));let c;for(c=0;c<n.length;c+=1){let f=VD(u,n,c);i[c]?(i[c].p(f,s),te(i[c],1)):(i[c]=zD(f),i[c].c(),te(i[c],1),i[c].m(e.parentNode,e))}for(vt(),c=n.length;c<i.length;c+=1)a(c);yt()}l&&l.p&&(!t||s&3)&&oa(l,o,u,u[1],t?aa(o,u[1],s,iU):sa(u[1]),UD)},i(u){if(!t){for(let s=0;s<n.length;s+=1)te(i[s]);te(l,u),t=!0}},o(u){i=i.filter(Boolean);for(let s=0;s<i.length;s+=1)oe(i[s]);oe(l,u),t=!1},d(u){u&&X(e),Nt(i,u),l&&l.d(u)}}}function sU(r,e,t){let{$$slots:n={},$$scope:i}=e,{elements:a=[]}=e;return r.$$set=o=>{"elements"in o&&t(0,a=o.elements),"$$scope"in o&&t(1,i=o.$$scope)},[a,i,n]}var Kd=class extends Ve{constructor(e){super(),ze(this,e,sU,oU,qe,{elements:0})}},vf=Kd;function uU(r){let e,t,n;return t=new Va({props:{mdLink:r[0]}}),{c(){e=Z("span"),Ce(t.$$.fragment)},m(i,a){Q(i,e,a),Se(t,e,null),n=!0},p(i,a){let o={};a&1&&(o.mdLink=i[0]),t.$set(o)},i(i){n||(te(t.$$.fragment,i),n=!0)},o(i){oe(t.$$.fragment,i),n=!1},d(i){i&&X(e),Ne(t)}}}function lU(r){let e,t,n;return t=new vf({props:{elements:r[0],$$slots:{default:[mU,({element:i})=>({2:i}),({element:i})=>i?4:0]},$$scope:{ctx:r}}}),{c(){e=Z("span"),Ce(t.$$.fragment)},m(i,a){Q(i,e,a),Se(t,e,null),n=!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){n||(te(t.$$.fragment,i),n=!0)},o(i){oe(t.$$.fragment,i),n=!1},d(i){i&&X(e),Ne(t)}}}function cU(r){let e,t;return{c(){e=Z("span"),t=Be(r[0])},m(n,i){Q(n,e,i),$(e,t)},p(n,i){i&1&&nt(t,n[0])},i:Fe,o:Fe,d(n){n&&X(e)}}}function fU(r){let e,t;return e=new Va({props:{mdLink:r[2]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&4&&(a.mdLink=n[2]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function pU(r){let e,t=r[2]+"",n;return{c(){e=Z("span"),n=Be(t)},m(i,a){Q(i,e,a),$(e,n)},p(i,a){a&4&&t!==(t=i[2]+"")&&nt(n,t)},i:Fe,o:Fe,d(i){i&&X(e)}}}function mU(r){let e,t,n,i,a=[pU,fU],o=[];function l(u,s){return typeof u[2]=="string"?0:1}return e=l(r,-1),t=o[e]=a[e](r),{c(){t.c(),n=lr()},m(u,s){o[e].m(u,s),Q(u,n,s),i=!0},p(u,s){let c=e;e=l(u,s),e===c?o[e].p(u,s):(vt(),oe(o[c],1,1,()=>{o[c]=null}),yt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),te(t,1),t.m(n.parentNode,n))},i(u){i||(te(t),i=!0)},o(u){oe(t),i=!1},d(u){u&&X(n),o[e].d(u)}}}function dU(r){let e,t,n,i,a,o=[cU,lU,uU],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(r,-1),n=l[t]=o[t](r),{c(){n.c(),i=lr()},m(s,c){l[t].m(s,c),Q(s,i,c),a=!0},p(s,[c]){let f=t;t=u(s,c),t===f?l[t].p(s,c):(vt(),oe(l[f],1,1,()=>{l[f]=null}),yt(),n=l[t],n?n.p(s,c):(n=l[t]=o[t](s),n.c()),te(n,1),n.m(i.parentNode,i))},i(s){a||(te(n),a=!0)},o(s){oe(n),a=!1},d(s){s&&X(i),l[t].d(s)}}}function hU(r,e,t){let n,{value:i=void 0}=e;return r.$$set=a=>{"value"in a&&t(1,i=a.value)},r.$$.update=()=>{r.$$.dirty&2&&t(0,n=pD(i))},[n,i]}var eh=class extends Ve{constructor(e){super(),ze(this,e,hU,dU,qe,{value:1})}},mi=eh;function $D(r,e,t){let n=r.slice();return n[8]=e[t],n}function HD(r){let e,t,n,i,a,o;t=new mi({props:{value:r[8].name}});function l(){return r[6](r[8])}function u(...s){return r[7](r[8],...s)}return{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),R(e,"class","mb-select-input-element"),R(e,"role","button"),R(e,"tabindex","0"),At(e,"is-selected",r[8].value===r[0])},m(s,c){Q(s,e,c),Se(t,e,null),$(e,n),i=!0,a||(o=[xe(e,"click",l),xe(e,"keypress",u)],a=!0)},p(s,c){r=s;let f={};c&2&&(f.value=r[8].name),t.$set(f),(!i||c&3)&&At(e,"is-selected",r[8].value===r[0])},i(s){i||(te(t.$$.fragment,s),i=!0)},o(s){oe(t.$$.fragment,s),i=!1},d(s){s&&X(e),Ne(t),a=!1,ot(o)}}}function gU(r){let e,t,n=je(r[1]),i=[];for(let o=0;o<n.length;o+=1)i[o]=HD($D(r,n,o));let a=o=>oe(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=lr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);Q(o,e,l),t=!0},p(o,[l]){if(l&15){n=je(o[1]);let u;for(u=0;u<n.length;u+=1){let s=$D(o,n,u);i[u]?(i[u].p(s,l),te(i[u],1)):(i[u]=HD(s),i[u].c(),te(i[u],1),i[u].m(e.parentNode,e))}for(vt(),u=n.length;u<i.length;u+=1)a(u);yt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)te(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)oe(i[l]);t=!1},d(o){o&&X(e),Nt(i,o)}}}function vU(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(f){t(0,n=f)}function l(f){n===f?t(0,n=null):t(0,n=f),a(n)}function u(f,p){f.key===" "&&l(p)}let s=f=>l(f.value),c=(f,p)=>u(p,f.value);return r.$$set=f=>{"value"in f&&t(0,n=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[n,i,l,u,a,o,s,c]}var th=class extends Ve{constructor(e){super(),ze(this,e,vU,gU,qe,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},GD=th;var yf=class extends Ot{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return La(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return GD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function WD(r,e,t){let n=r.slice();return n[8]=e[t],n}function jD(r){let e,t,n,i,a,o;t=new mi({props:{value:r[8].name}});function l(){return r[6](r[8])}function u(...s){return r[7](r[8],...s)}return{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),R(e,"class","mb-select-input-element"),R(e,"role","button"),R(e,"tabindex","0"),At(e,"is-selected",r[0].includes(r[8].value))},m(s,c){Q(s,e,c),Se(t,e,null),$(e,n),i=!0,a||(o=[xe(e,"click",l),xe(e,"keypress",u)],a=!0)},p(s,c){r=s;let f={};c&2&&(f.value=r[8].name),t.$set(f),(!i||c&3)&&At(e,"is-selected",r[0].includes(r[8].value))},i(s){i||(te(t.$$.fragment,s),i=!0)},o(s){oe(t.$$.fragment,s),i=!1},d(s){s&&X(e),Ne(t),a=!1,ot(o)}}}function yU(r){let e,t,n=je(r[1]),i=[];for(let o=0;o<n.length;o+=1)i[o]=jD(WD(r,n,o));let a=o=>oe(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=lr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);Q(o,e,l),t=!0},p(o,[l]){if(l&15){n=je(o[1]);let u;for(u=0;u<n.length;u+=1){let s=WD(o,n,u);i[u]?(i[u].p(s,l),te(i[u],1)):(i[u]=jD(s),i[u].c(),te(i[u],1),i[u].m(e.parentNode,e))}for(vt(),u=n.length;u<i.length;u+=1)a(u);yt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)te(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)oe(i[l]);t=!1},d(o){o&&X(e),Nt(i,o)}}}function bU(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(f){t(0,n=f)}function l(f){n.includes(f)?t(0,n=n.filter(p=>p!==f)):(n.push(f),t(0,n)),a(n)}function u(f,p){f.key===" "&&l(p)}let s=f=>l(f.value),c=(f,p)=>u(p,f.value);return r.$$set=f=>{"value"in f&&t(0,n=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[n,i,l,u,a,o,s,c]}var rh=class extends Ve{constructor(e){super(),ze(this,e,bU,yU,qe,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},ZD=rh;var Zu=class extends Ot{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return Gi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return ZD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function xU(r){Xr(r,"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 wU(r){let e,t,n=(r[0]?r[0].format(r[1]):"none")+"",i,a,o,l,u,s;return o=new cr({props:{iconName:"calendar"}}),{c(){e=Z("div"),t=Z("span"),i=Be(n),a=fe(),Ce(o.$$.fragment),R(t,"class","date-picker-text svelte-f2wb67"),R(e,"class","date-picker-input svelte-f2wb67"),R(e,"role","button"),R(e,"tabindex","0")},m(c,f){Q(c,e,f),$(e,t),$(t,i),$(e,a),Se(o,e,null),l=!0,u||(s=[xe(e,"click",r[2]),xe(e,"keydown",r[3])],u=!0)},p(c,[f]){(!l||f&3)&&n!==(n=(c[0]?c[0].format(c[1]):"none")+"")&&nt(i,n)},i(c){l||(te(o.$$.fragment,c),l=!0)},o(c){oe(o.$$.fragment,c),l=!1},d(c){c&&X(e),Ne(o),u=!1,ot(s)}}}function _U(r,e,t){let{value:n}=e,{dateFormat:i}=e,{showDatePicker:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(c){a()}function s(c){c.key===" "&&a()}return r.$$set=c=>{"value"in c&&t(0,n=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)},[n,i,u,s,a,o,l]}var nh=class extends Ve{constructor(e){super(),ze(this,e,_U,wU,qe,{value:0,dateFormat:1,showDatePicker:4,onValueChange:5,setValue:6},xU)}get setValue(){return this.$$.ctx[6]}},JD=nh;var Ju=class extends Ot{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!="string")return;let t=$r.parse(e);if(t.isValid())return $r.stringify(t)}getFallbackDefaultValue(){return $r.getDefaultDate()}getSvelteComponent(){return JD}rawMapValue(e){return e===null?null:$r.stringify(e)}rawReverseMapValue(e){if(e===null)return null;let t=$r.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.base.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.base.plugin.internal.openDatePickerModal(this)}}}};function AU(r){let e,t,n;return{c(){e=Z("input"),R(e,"type","number"),R(e,"tabindex","0"),R(e,"placeholder",r[1])},m(i,a){Q(i,e,a),Ye(e,r[0]),t||(n=[xe(e,"input",r[4]),xe(e,"input",r[5])],t=!0)},p(i,[a]){a&2&&R(e,"placeholder",i[1]),a&1&&ci(e.value)!==i[0]&&Ye(e,i[0])},i:Fe,o:Fe,d(i){i&&X(e),t=!1,ot(n)}}}function DU(r,e,t){let{value:n}=e,{placeholder:i}=e,{onValueChange:a}=e;function o(s){t(0,n=s)}function l(){n=ci(this.value),t(0,n)}let u=()=>a(n);return r.$$set=s=>{"value"in s&&t(0,n=s.value),"placeholder"in s&&t(1,i=s.placeholder),"onValueChange"in s&&t(2,a=s.onValueChange)},[n,i,a,o,l,u]}var ih=class extends Ve{constructor(e){super(),ze(this,e,DU,AU,qe,{value:0,placeholder:1,onValueChange:2,setValue:3})}get setValue(){return this.$$.ctx[3]}},YD=ih;var bf=class extends Ot{constructor(e){super(e)}filterValue(e){return Ns(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return YD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e;return{placeholder:(e=this.base.getArgument("placeholder"))!=null?e:"Number"}}};function EU(r){let e,t;return{c(){e=Z("span"),t=Be(r[1])},m(n,i){Q(n,e,i),$(e,t)},p(n,i){i&2&&nt(t,n[1])},i:Fe,o:Fe,d(n){n&&X(e)}}}function SU(r){let e,t,n;function i(o){r[9](o)}let a={};return r[0]!==void 0&&(a.mdLink=r[0]),e=new Va({props:a}),Tr.push(()=>Pa(e,"mdLink",i)),{c(){Ce(e.$$.fragment)},m(o,l){Se(e,o,l),n=!0},p(o,l){let u={};!t&&l&1&&(t=!0,u.mdLink=o[0],Ba(()=>t=!1)),e.$set(u)},i(o){n||(te(e.$$.fragment,o),n=!0)},o(o){oe(e.$$.fragment,o),n=!1},d(o){Ne(e,o)}}}function NU(r){let e,t,n,i,a,o,l,u,s,c=[SU,EU],f=[];function p(m,h){return m[2]?0:1}return n=p(r,-1),i=f[n]=c[n](r),o=new cr({props:{iconName:"list"}}),{c(){e=Z("div"),t=Z("div"),i.c(),a=fe(),Ce(o.$$.fragment),R(t,"class","mb-suggest-text"),R(e,"class","mb-suggest-input"),R(e,"role","button"),R(e,"tabindex","0")},m(m,h){Q(m,e,h),$(e,t),f[n].m(t,null),$(e,a),Se(o,e,null),l=!0,u||(s=[xe(e,"click",r[3]),xe(e,"keydown",r[4])],u=!0)},p(m,[h]){let d=n;n=p(m,h),n===d?f[n].p(m,h):(vt(),oe(f[d],1,1,()=>{f[d]=null}),yt(),i=f[n],i?i.p(m,h):(i=f[n]=c[n](m),i.c()),te(i,1),i.m(t,null))},i(m){l||(te(i),te(o.$$.fragment,m),l=!0)},o(m){oe(i),oe(o.$$.fragment,m),l=!1},d(m){m&&X(e),f[n].d(),Ne(o),u=!1,ot(s)}}}function CU(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e,o,l,u=!1;nn(()=>{s(n)});function s(m){var h;let d=(h=m==null?void 0:m.toString())!==null&&h!==void 0?h:"null";if(t(2,u=sn.isLink(d)),u)try{t(0,o=sn.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 r.$$set=m=>{"value"in m&&t(5,n=m.value),"showSuggester"in m&&t(6,i=m.showSuggester),"onValueChange"in m&&t(7,a=m.onValueChange)},[o,l,u,c,f,n,i,a,s,p]}var ah=class extends Ve{constructor(e){super(),ze(this,e,CU,NU,qe,{value:5,showSuggester:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},XD=ah;var xf=class extends Ot{constructor(e){super(e)}filterValue(e){return La(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return XD}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 MU(r){Xr(r,"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 TU(r){let e,t,n,i,a,o;return{c(){e=Z("div"),t=Z("textarea"),n=fe(),i=Z("div"),R(t,"class","svelte-1aj1f3m"),R(i,"class","svelte-1aj1f3m"),R(e,"class","editor-input card svelte-1aj1f3m"),R(e,"role","button"),R(e,"tabindex","0")},m(l,u){Q(l,e,u),$(e,t),r[9](t),Ye(t,r[0]),$(e,n),$(e,i),r[13](i),a||(o=[xe(t,"input",r[10]),xe(t,"focusout",r[11]),xe(t,"input",r[12]),xe(e,"click",r[14]),xe(e,"keypress",r[15])],a=!0)},p(l,[u]){u&1&&Ye(t,l[0])},i:Fe,o:Fe,d(l){l&&X(e),r[9](null),r[13](null),a=!1,ot(o)}}}function FU(r,e,t){let{value:n}=e,{onValueChange:i}=e,{render:a}=e,o,l;nn(()=>{o.toggleVisibility(!0),l.toggleVisibility(!1),a(o,n)});function u(y){t(0,n=y),a(o,y)}function s(){o.toggleVisibility(!0),l.toggleVisibility(!1),a(o,n)}function c(){console.log("focus in"),o.toggleVisibility(!1),l.toggleVisibility(!0),l.focus()}function f(y){y.key===" "&&c()}function p(y){Tr[y?"unshift":"push"](()=>{l=y,t(3,l)})}function m(){n=this.value,t(0,n)}let h=()=>s(),d=()=>i(n);function g(y){Tr[y?"unshift":"push"](()=>{o=y,t(2,o)})}let v=()=>c(),w=y=>f(y);return r.$$set=y=>{"value"in y&&t(0,n=y.value),"onValueChange"in y&&t(1,i=y.onValueChange),"render"in y&&t(7,a=y.render)},[n,i,o,l,s,c,f,a,u,p,m,h,d,g,v,w]}var oh=class extends Ve{constructor(e){super(),ze(this,e,FU,TU,qe,{value:0,onValueChange:1,render:7,setValue:8},MU)}get setValue(){return this.$$.ctx[8]}},QD=oh;var wf=class extends Ot{constructor(e){super(e)}filterValue(e){return ka(e)?e==null?void 0:e.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return QD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t)}}async renderInElement(e,t){var n;(n=this.mdUnloadCallback)==null||n.call(this),e.innerHTML="",this.mdUnloadCallback=await this.base.plugin.internal.renderMarkdown(t,e,this.base.getFilePath())}onunmount(){var e;super.onunmount(),(e=this.mdUnloadCallback)==null||e.call(this)}};var{window:Yu}=Bu;function IU(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h;return{c(){e=Z("div"),t=Z("div"),i=fe(),a=Z("span"),o=Be(r[0]),l=fe(),u=Z("span"),s=Be(r[1]),c=fe(),f=Z("span"),p=Be(r[2]),R(t,"class","mb-progress-bar-progress"),R(t,"style",n=`width: ${r[5](r[0])}%`),R(t,"role","slider"),R(t,"aria-valuemin",r[1]),R(t,"aria-valuemax",r[2]),R(t,"aria-valuenow",r[0]),R(t,"tabindex","0"),R(a,"class","mb-progress-bar-value"),R(u,"class","mb-progress-bar-label-left"),R(f,"class","mb-progress-bar-label-right"),R(e,"class","mb-progress-bar-input"),R(e,"tabindex","0"),R(e,"role","button")},m(d,g){Q(d,e,g),$(e,t),$(e,i),$(e,a),$(a,o),$(e,l),$(e,u),$(u,s),$(e,c),$(e,f),$(f,p),r[14](e),m||(h=[xe(Yu,"touchmove",r[8],{passive:!1}),xe(Yu,"touchcancel",r[6]),xe(Yu,"touchend",r[6]),xe(Yu,"mousemove",r[8]),xe(Yu,"mouseup",r[6]),xe(t,"dragstart",r[13]),xe(e,"keydown",r[9]),xe(e,"mousedown",r[7]),xe(e,"touchstart",r[7])],m=!0)},p(d,[g]){g&1&&n!==(n=`width: ${d[5](d[0])}%`)&&R(t,"style",n),g&2&&R(t,"aria-valuemin",d[1]),g&4&&R(t,"aria-valuemax",d[2]),g&1&&R(t,"aria-valuenow",d[0]),g&1&&nt(o,d[0]),g&2&&nt(s,d[1]),g&4&&nt(p,d[2])},i:Fe,o:Fe,d(d){d&&X(e),r[14](null),m=!1,ot(h)}}}function BU(r,e){return Number.parseFloat((Math.round(r/e)*e).toFixed(15))}function PU(r,e,t){let{onValueChange:n}=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),n(D)}function h(D){return D=ku(D,a,o),xd(D,a,o,0,100)}function d(){t(3,u=!0)}function g(){t(3,u=!1)}function v(D){d(),w(D)}function w(D){if(!u)return;D.stopPropagation&&D.stopPropagation(),D.preventDefault&&D.preventDefault();let S=D instanceof TouchEvent?D.touches[0].clientX:D.clientX;y(S)}function y(D){let S=s.getBoundingClientRect();D=ku(D,S.left,S.right);let A=xd(D,S.left,S.right,a,o);A=BU(A,l),m(A)}function x(D){c<50&&(c+=1);let S=Math.ceil(c/5);if(D.key==="ArrowUp"||D.key==="ArrowRight"){let A=ku(i+S,a,o);m(A)}if(D.key==="ArrowDown"||D.key==="ArrowLeft"){let A=ku(i-S,a,o);m(A)}window.clearTimeout(f),f=window.setTimeout(()=>c=1,100)}let _=()=>t(3,u=!0);function b(D){Tr[D?"unshift":"push"](()=>{s=D,t(4,s)})}return r.$$set=D=>{"onValueChange"in D&&t(10,n=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,v,w,x,n,l,p,_,b]}var sh=class extends Ve{constructor(e){super(),ze(this,e,PU,IU,qe,{onValueChange:10,value:0,minValue:1,maxValue:2,stepSize:11,setValue:12})}get setValue(){return this.$$.ctx[12]}},KD=sh;var _f=class extends Ot{constructor(e){var t,n,i,a,o,l;if(super(e),this.minValue=(n=(t=this.base.getArgument("minValue"))==null?void 0:t.value)!=null?n:0,this.maxValue=(a=(i=this.base.getArgument("maxValue"))==null?void 0:i.value)!=null?a:100,this.stepSize=(l=(o=this.base.getArgument("stepSize"))==null?void 0:o.value)!=null?l:1,this.minValue>=this.maxValue)throw new er({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return vc(Ns(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return KD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};function eE(r,e,t){let n=r.slice();return n[7]=e[t],n}function tE(r){let e,t=r[7].name+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[7].value,Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o&2&&t!==(t=a[7].name+"")&&nt(n,t),o&2&&i!==(i=a[7].value)&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function OU(r){let e,t,n,i=je(r[1]),a=[];for(let o=0;o<i.length;o+=1)a[o]=tE(eE(r,i,o));return{c(){e=Z("select");for(let o=0;o<a.length;o+=1)a[o].c();R(e,"class","dropdown"),r[0]===void 0&&Qr(()=>r[5].call(e))},m(o,l){Q(o,e,l);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(e,null);Mr(e,r[0],!0),t||(n=[xe(e,"change",r[5]),xe(e,"change",r[6])],t=!0)},p(o,[l]){if(l&2){i=je(o[1]);let u;for(u=0;u<i.length;u+=1){let s=eE(o,i,u);a[u]?a[u].p(s,l):(a[u]=tE(s),a[u].c(),a[u].m(e,null))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}l&3&&Mr(e,o[0])},i:Fe,o:Fe,d(o){o&&X(e),Nt(a,o),t=!1,ot(n)}}}function RU(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(c){t(0,n=c)}function l(){a(n)}function u(){n=Jn(this),t(0,n),t(1,i)}let s=()=>l();return r.$$set=c=>{"value"in c&&t(0,n=c.value),"options"in c&&t(1,i=c.options),"onValueChange"in c&&t(3,a=c.onValueChange)},[n,i,l,a,o,u,s]}var uh=class extends Ve{constructor(e){super(),ze(this,e,RU,OU,qe,{value:0,options:1,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},rE=uh;var Af=class extends Ot{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return La(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return rE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function kU(r){Xr(r,"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 nE(r){let e,t;return{c(){e=Z("img"),R(e,"class","mb-image-suggest-image svelte-hrm3dz"),fs(e.src,t=Rs(r[0]))||R(e,"src",t),R(e,"alt",r[0])},m(n,i){Q(n,e,i)},p(n,i){i&1&&!fs(e.src,t=Rs(n[0]))&&R(e,"src",t),i&1&&R(e,"alt",n[0])},d(n){n&&X(e)}}}function LU(r){let e,t,n,i,a=(r[0]||"no image selected")+"",o,l,u,s,c,f=r[0]&&nE(r);return{c(){e=Z("div"),f&&f.c(),t=fe(),n=Z("div"),i=Z("span"),o=Be(a),l=fe(),u=Z("button"),u.textContent="Change Image",R(i,"class","mb-image-suggest-footer-text svelte-hrm3dz"),R(u,"class","btn btn-active"),R(n,"class","mb-image-suggest-footer svelte-hrm3dz"),R(e,"class","mb-image-suggest-input svelte-hrm3dz")},m(p,m){Q(p,e,m),f&&f.m(e,null),$(e,t),$(e,n),$(n,i),$(i,o),$(n,l),$(n,u),s||(c=[xe(u,"click",r[1]),xe(u,"keydown",r[2])],s=!0)},p(p,[m]){p[0]?f?f.p(p,m):(f=nE(p),f.c(),f.m(e,t)):f&&(f.d(1),f=null),m&1&&a!==(a=(p[0]||"no image selected")+"")&&nt(o,a)},i:Fe,o:Fe,d(p){p&&X(e),f&&f.d(),s=!1,ot(c)}}}function UU(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(s){t(0,n=s)}function l(s){i()}function u(s){s.key===" "&&i()}return r.$$set=s=>{"value"in s&&t(0,n=s.value),"showSuggester"in s&&t(3,i=s.showSuggester),"onValueChange"in s&&t(4,a=s.onValueChange)},[n,l,u,i,a,o]}var lh=class extends Ve{constructor(e){super(),ze(this,e,UU,LU,qe,{value:0,showSuggester:3,onValueChange:4,setValue:5},kU)}get setValue(){return this.$$.ctx[5]}},iE=lh;var Df=class extends Ot{constructor(e){super(e)}filterValue(e){return ka(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return iE}rawMapValue(e){return e}rawReverseMapValue(e){return Gu(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};function aE(r,e,t){let n=r.slice();return n[11]=e[t],n[13]=t,n}function oE(r){let e;return{c(){e=Z("span"),e.textContent="Empty",R(e,"class","mb-list-empty")},m(t,n){Q(t,e,n)},p:Fe,d(t){t&&X(e)}}}function VU(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function sE(r){let e,t,n,i,a,o;t=new mi({props:{value:r[11]}});function l(){return r[8](r[13])}return i=new Lt({props:{$$slots:{default:[VU]},$$scope:{ctx:r}}}),i.$on("click",l),{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),Ce(i.$$.fragment),a=fe(),R(e,"class","mb-list-item")},m(u,s){Q(u,e,s),Se(t,e,null),$(e,n),Se(i,e,null),$(e,a),o=!0},p(u,s){r=u;let c={};s&1&&(c.value=r[11]),t.$set(c);let f={};s&16384&&(f.$$scope={dirty:s,ctx:r}),i.$set(f)},i(u){o||(te(t.$$.fragment,u),te(i.$$.fragment,u),o=!0)},o(u){oe(t.$$.fragment,u),oe(i.$$.fragment,u),o=!1},d(u){u&&X(e),Ne(t),Ne(i)}}}function uE(r){let e,t=lE(r[0].length,r[1])+"",n,i;return{c(){e=Z("span"),n=Be(t),R(e,"class",i=`mb-content-limit-indicator ${r[0].length>r[1]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o&3&&t!==(t=lE(a[0].length,a[1])+"")&&nt(n,t),o&3&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[1]?"mb-content-limit-indicator-overflow":""}`)&&R(e,"class",i)},d(a){a&&X(e)}}}function qU(r){let e,t;return e=new cr({props:{iconName:"plus"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function zU(r){let e,t,n,i,a,o,l,u,s,c,f=je(r[0]),p=[];for(let g=0;g<f.length;g+=1)p[g]=sE(aE(r,f,g));let m=g=>oe(p[g],1,1,()=>{p[g]=null}),h=null;f.length||(h=oE(r));let d=r[1]!==void 0&&uE(r);return l=new Lt({props:{disabled:!r[3],$$slots:{default:[qU]},$$scope:{ctx:r}}}),l.$on("click",r[10]),{c(){e=Z("div");for(let g=0;g<p.length;g+=1)p[g].c();h&&h.c(),t=fe(),n=Z("div"),i=Z("input"),a=fe(),d&&d.c(),o=fe(),Ce(l.$$.fragment),R(e,"class","mb-list-items"),R(i,"type","text"),R(i,"tabindex","0"),R(i,"placeholder",r[2]),R(i,"maxlength",r[1]),R(n,"class","mb-list-input")},m(g,v){Q(g,e,v);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(e,null);h&&h.m(e,null),Q(g,t,v),Q(g,n,v),$(n,i),Ye(i,r[3]),$(n,a),d&&d.m(n,null),$(n,o),Se(l,n,null),u=!0,s||(c=xe(i,"input",r[9]),s=!0)},p(g,[v]){if(v&33){f=je(g[0]);let y;for(y=0;y<f.length;y+=1){let x=aE(g,f,y);p[y]?(p[y].p(x,v),te(p[y],1)):(p[y]=sE(x),p[y].c(),te(p[y],1),p[y].m(e,null))}for(vt(),y=f.length;y<p.length;y+=1)m(y);yt(),!f.length&&h?h.p(g,v):f.length?h&&(h.d(1),h=null):(h=oE(g),h.c(),h.m(e,null))}(!u||v&4)&&R(i,"placeholder",g[2]),(!u||v&2)&&R(i,"maxlength",g[1]),v&8&&i.value!==g[3]&&Ye(i,g[3]),g[1]!==void 0?d?d.p(g,v):(d=uE(g),d.c(),d.m(n,o)):d&&(d.d(1),d=null);let w={};v&8&&(w.disabled=!g[3]),v&16384&&(w.$$scope={dirty:v,ctx:g}),l.$set(w)},i(g){if(!u){for(let v=0;v<f.length;v+=1)te(p[v]);te(l.$$.fragment,g),u=!0}},o(g){p=p.filter(Boolean);for(let v=0;v<p.length;v+=1)oe(p[v]);oe(l.$$.fragment,g),u=!1},d(g){g&&(X(e),X(t),X(n)),Nt(p,g),h&&h.d(),d&&d.d(),Ne(l),s=!1,c()}}}function lE(r,e){let t=e.toString();return`${r.toString().padStart(t.length,"0")}/${t}`}function $U(r,e,t){let{value:n}=e,{limit:i}=e,{placeholder:a}=e,{onValueChange:o}=e,l="";function u(h){t(0,n=h)}function s(){n.push(l),o(n),t(3,l=""),t(0,n)}function c(h){n.splice(h,1),o(n),t(0,n)}let f=h=>c(h);function p(){l=this.value,t(3,l)}let m=()=>s();return r.$$set=h=>{"value"in h&&t(0,n=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)},[n,i,a,l,s,c,o,u,f,p,m]}var ch=class extends Ve{constructor(e){super(),ze(this,e,$U,zU,qe,{value:0,limit:1,placeholder:2,onValueChange:6,setValue:7})}get setValue(){return this.$$.ctx[7]}},cE=ch;var Ef=class extends Ot{constructor(e){super(e)}filterValue(e){return Gi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return cE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"New Entry...",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function fE(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function pE(r){let e;return{c(){e=Z("span"),e.textContent="Empty",R(e,"class","mb-list-empty")},m(t,n){Q(t,e,n)},p:Fe,d(t){t&&X(e)}}}function HU(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function mE(r){let e,t,n,i,a,o;t=new mi({props:{value:r[9]}});function l(){return r[8](r[11])}return i=new Lt({props:{$$slots:{default:[HU]},$$scope:{ctx:r}}}),i.$on("click",l),{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),Ce(i.$$.fragment),a=fe(),R(e,"class","mb-list-item")},m(u,s){Q(u,e,s),Se(t,e,null),$(e,n),Se(i,e,null),$(e,a),o=!0},p(u,s){r=u;let c={};s&1&&(c.value=r[9]),t.$set(c);let f={};s&4096&&(f.$$scope={dirty:s,ctx:r}),i.$set(f)},i(u){o||(te(t.$$.fragment,u),te(i.$$.fragment,u),o=!0)},o(u){oe(t.$$.fragment,u),oe(i.$$.fragment,u),o=!1},d(u){u&&X(e),Ne(t),Ne(i)}}}function GU(r){let e,t,n,i,a,o,l,u,s,c,f=je(r[0]),p=[];for(let d=0;d<f.length;d+=1)p[d]=mE(fE(r,f,d));let m=d=>oe(p[d],1,1,()=>{p[d]=null}),h=null;return f.length||(h=pE(r)),l=new cr({props:{iconName:"list"}}),{c(){e=Z("div");for(let d=0;d<p.length;d+=1)p[d].c();h&&h.c(),t=fe(),n=Z("div"),i=Z("div"),a=Z("div"),a.innerHTML="<span>Add Element...</span>",o=fe(),Ce(l.$$.fragment),R(e,"class","mb-list-items"),R(a,"class","mb-suggest-text"),R(i,"class","mb-suggest-input"),R(i,"role","button"),R(i,"tabindex","0"),R(n,"class","mb-list-input")},m(d,g){Q(d,e,g);for(let v=0;v<p.length;v+=1)p[v]&&p[v].m(e,null);h&&h.m(e,null),Q(d,t,g),Q(d,n,g),$(n,i),$(i,a),$(i,o),Se(l,i,null),u=!0,s||(c=[xe(i,"click",r[2]),xe(i,"keydown",r[3])],s=!0)},p(d,[g]){if(g&3){f=je(d[0]);let v;for(v=0;v<f.length;v+=1){let w=fE(d,f,v);p[v]?(p[v].p(w,g),te(p[v],1)):(p[v]=mE(w),p[v].c(),te(p[v],1),p[v].m(e,null))}for(vt(),v=f.length;v<p.length;v+=1)m(v);yt(),!f.length&&h?h.p(d,g):f.length?h&&(h.d(1),h=null):(h=pE(d),h.c(),h.m(e,null))}},i(d){if(!u){for(let g=0;g<f.length;g+=1)te(p[g]);te(l.$$.fragment,d),u=!0}},o(d){p=p.filter(Boolean);for(let g=0;g<p.length;g+=1)oe(p[g]);oe(l.$$.fragment,d),u=!1},d(d){d&&(X(e),X(t),X(n)),Nt(p,d),h&&h.d(),Ne(l),s=!1,ot(c)}}}function WU(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var fh=class extends Ve{constructor(e){super(),ze(this,e,WU,GU,qe,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},dE=fh;var Sf=class extends Ot{constructor(e){super(e)}filterValue(e){return Gi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return dE}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 hE(r,e,t){let n=r.slice();return n[26]=e[t][0],n[27]=e[t][1],n}function gE(r,e,t){let n=r.slice();return n[23]=e[t],n}function vE(r,e,t){let n=r.slice();return n[23]=e[t],n}function yE(r,e,t){let n=r.slice();return n[26]=e[t][0],n[27]=e[t][1],n}function jU(r){let e,t,n,i,a,o=je(Object.values(r[2])),l=[];for(let c=0;c<o.length;c+=1)l[c]=bE(gE(r,o,c));let u=je(Object.entries(r[1])),s=[];for(let c=0;c<u.length;c+=1)s[c]=xE(hE(r,u,c));return{c(){e=Z("select");for(let c=0;c<l.length;c+=1)l[c].c();t=fe(),n=Z("select");for(let c=0;c<s.length;c+=1)s[c].c();R(e,"class","dropdown mb-input-element-group-element"),r[5]===void 0&&Qr(()=>r[16].call(e)),R(n,"class","dropdown mb-input-element-group-element"),r[4]===void 0&&Qr(()=>r[18].call(n))},m(c,f){Q(c,e,f);for(let p=0;p<l.length;p+=1)l[p]&&l[p].m(e,null);Mr(e,r[5],!0),Q(c,t,f),Q(c,n,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(n,null);Mr(n,r[4],!0),i||(a=[xe(e,"change",r[16]),xe(e,"change",r[17]),xe(n,"change",r[18]),xe(n,"change",r[19])],i=!0)},p(c,f){if(f[0]&4){o=je(Object.values(c[2]));let p;for(p=0;p<o.length;p+=1){let m=gE(c,o,p);l[p]?l[p].p(m,f):(l[p]=bE(m),l[p].c(),l[p].m(e,null))}for(;p<l.length;p+=1)l[p].d(1);l.length=o.length}if(f[0]&36&&Mr(e,c[5]),f[0]&2){u=je(Object.entries(c[1]));let p;for(p=0;p<u.length;p+=1){let m=hE(c,u,p);s[p]?s[p].p(m,f):(s[p]=xE(m),s[p].c(),s[p].m(n,null))}for(;p<s.length;p+=1)s[p].d(1);s.length=u.length}f[0]&18&&Mr(n,c[4])},d(c){c&&(X(e),X(t),X(n)),Nt(l,c),Nt(s,c),i=!1,ot(a)}}}function ZU(r){let e,t,n,i,a,o=je(Object.entries(r[1])),l=[];for(let c=0;c<o.length;c+=1)l[c]=wE(yE(r,o,c));let u=je(Object.values(r[2])),s=[];for(let c=0;c<u.length;c+=1)s[c]=_E(vE(r,u,c));return{c(){e=Z("select");for(let c=0;c<l.length;c+=1)l[c].c();t=fe(),n=Z("select");for(let c=0;c<s.length;c+=1)s[c].c();R(e,"class","dropdown mb-input-element-group-element"),r[4]===void 0&&Qr(()=>r[12].call(e)),R(n,"class","dropdown mb-input-element-group-element"),r[5]===void 0&&Qr(()=>r[14].call(n))},m(c,f){Q(c,e,f);for(let p=0;p<l.length;p+=1)l[p]&&l[p].m(e,null);Mr(e,r[4],!0),Q(c,t,f),Q(c,n,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(n,null);Mr(n,r[5],!0),i||(a=[xe(e,"change",r[12]),xe(e,"change",r[13]),xe(n,"change",r[14]),xe(n,"change",r[15])],i=!0)},p(c,f){if(f[0]&2){o=je(Object.entries(c[1]));let p;for(p=0;p<o.length;p+=1){let m=yE(c,o,p);l[p]?l[p].p(m,f):(l[p]=wE(m),l[p].c(),l[p].m(e,null))}for(;p<l.length;p+=1)l[p].d(1);l.length=o.length}if(f[0]&18&&Mr(e,c[4]),f[0]&4){u=je(Object.values(c[2]));let p;for(p=0;p<u.length;p+=1){let m=vE(c,u,p);s[p]?s[p].p(m,f):(s[p]=_E(m),s[p].c(),s[p].m(n,null))}for(;p<s.length;p+=1)s[p].d(1);s.length=u.length}f[0]&36&&Mr(n,c[5])},d(c){c&&(X(e),X(t),X(n)),Nt(l,c),Nt(s,c),i=!1,ot(a)}}}function bE(r){let e,t=r[23]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[23],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o[0]&4&&t!==(t=a[23]+"")&&nt(n,t),o[0]&4&&i!==(i=a[23])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function xE(r){let e,t=r[27]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[26],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o[0]&2&&t!==(t=a[27]+"")&&nt(n,t),o[0]&2&&i!==(i=a[26])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function wE(r){let e,t=r[27]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[26],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o[0]&2&&t!==(t=a[27]+"")&&nt(n,t),o[0]&2&&i!==(i=a[26])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function _E(r){let e,t=r[23]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[23],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o[0]&4&&t!==(t=a[23]+"")&&nt(n,t),o[0]&4&&i!==(i=a[23])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function JU(r){let e,t,n,i,a;function o(s,c){return s[0]?ZU:jU}let l=o(r,[-1,-1]),u=l(r);return{c(){e=Z("div"),u.c(),t=fe(),n=Z("input"),R(n,"class","mb-date-input-year-input mb-input-element-group-element"),R(n,"type","number"),R(n,"tabindex","0"),R(n,"max","9999"),R(n,"min","0"),R(e,"class","mb-input-element-group")},m(s,c){Q(s,e,c),u.m(e,null),$(e,t),$(e,n),Ye(n,r[3]),i||(a=[xe(n,"input",r[20]),xe(n,"input",r[21])],i=!0)},p(s,c){l===(l=o(s,c))&&u?u.p(s,c):(u.d(1),u=l(s),u&&(u.c(),u.m(e,t))),c[0]&8&&ci(n.value)!==s[3]&&Ye(n,s[3])},i:Fe,o:Fe,d(s){s&&X(e),u.d(),i=!1,ot(a)}}}function YU(r,e,t){let{value:n}=e,{useUsInputOrder:i}=e,{onValueChange:a}=e,o={},l={},u,s,c;nn(()=>{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=n.year().toString()),t(4,s=n.month().toString()),t(5,c=n.date().toString())});function f(E){t(9,n=E),t(3,u=n.year().toString()),t(4,s=n.month().toString()),t(5,c=n.date().toString())}function p(){let E=Number.parseInt(u),M=Number.isNaN(E)?$r.getDefaultYear():E;n.year(M),a(n)}function m(){n.month(s);let E=d(n.date());n.date(E),t(5,c=E.toString()),a(n)}function h(){let E=Number.parseInt(c),M=d(E);n.date(M),t(5,c=M.toString()),a(n)}function d(E){return Number.isNaN(E)?$r.getDefaultDay():E<1?1:E>n.daysInMonth()?n.daysInMonth():E}function g(){s=Jn(this),t(4,s),t(1,o)}let v=()=>m();function w(){c=Jn(this),t(5,c),t(2,l)}let y=()=>h();function x(){c=Jn(this),t(5,c),t(2,l)}let _=()=>h();function b(){s=Jn(this),t(4,s),t(1,o)}let D=()=>m();function S(){u=ci(this.value),t(3,u)}let A=()=>p();return r.$$set=E=>{"value"in E&&t(9,n=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,n,a,f,g,v,w,y,x,_,b,D,S,A]}var ph=class extends Ve{constructor(e){super(),ze(this,e,YU,JU,qe,{value:9,useUsInputOrder:0,onValueChange:10,setValue:11},null,[-1,-1])}get setValue(){return this.$$.ctx[11]}},AE=ph;var Nf=class extends Ot{constructor(e){super(e)}filterValue(e){if(e==null||typeof e!="string")return;let t=$r.parse(e);if(t.isValid())return $r.stringify(t)}getFallbackDefaultValue(){return $r.getDefaultDate()}getSvelteComponent(){return AE}rawMapValue(e){return $r.stringify(e)}rawReverseMapValue(e){return $r.parse(e)}getMountArgs(){return{useUsInputOrder:this.base.plugin.settings.useUsDateInputOrder}}};var mh=ur(Rn()),Xu=ur(Xn()),dh=class{constructor(){this._hour=ti.getDefaultHour(),this._minute=ti.getDefaultHour()}getHour(){return this._hour}setHour(e){if(e<0||e>24){this._hour=ti.getDefaultHour();return}this._hour=e}getMinute(){return this._minute}setMinute(e){if(e<0||e>59){this._minute=ti.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)?ti.getDefaultHour():t)}setMinuteFromString(e){let t=Number.parseInt(e);this.setMinute(Number.isNaN(t)?ti.getDefaultMinute():t)}},XU=mh.P.sequenceMap((r,e,t,n,i)=>({hour:Number.parseInt(r+e),minute:Number.parseInt(n+i)}),Xu.P_UTILS.digit(),Xu.P_UTILS.digit(),mh.P.string(":"),Xu.P_UTILS.digit(),Xu.P_UTILS.digit()),ti=class r{static parse(e){if(!e)return;let t=r.getDefaultTime(),n=XU.tryParse(e);if(n.success&&!(Number.isNaN(n.value.hour)||Number.isNaN(n.value.minute))&&!(n.value.hour<0||n.value.hour>=24)&&!(n.value.minute<0||n.value.minute>=60))return t.setHour(n.value.hour),t.setMinute(n.value.minute),t}static stringify(e){return`${e.getUniformHour()}:${e.getUniformMinute()}`}static getDefaultTime(){return new dh}static getDefaultHour(){return 0}static getDefaultMinute(){return 0}};function DE(r,e,t){let n=r.slice();return n[13]=e[t][0],n[14]=e[t][1],n}function EE(r,e,t){let n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function SE(r){let e,t=r[18]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[17],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o&1&&t!==(t=a[18]+"")&&nt(n,t),o&1&&i!==(i=a[17])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function NE(r){let e,t=r[14]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[13],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p(a,o){o&2&&t!==(t=a[14]+"")&&nt(n,t),o&2&&i!==(i=a[13])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&X(e)}}}function QU(r){let e,t,n,i,a,o,l=je(Object.entries(r[0])),u=[];for(let f=0;f<l.length;f+=1)u[f]=SE(EE(r,l,f));let s=je(Object.entries(r[1])),c=[];for(let f=0;f<s.length;f+=1)c[f]=NE(DE(r,s,f));return{c(){e=Z("div"),t=Z("select");for(let f=0;f<u.length;f+=1)u[f].c();n=fe(),i=Z("select");for(let f=0;f<c.length;f+=1)c[f].c();R(t,"class","dropdown mb-input-element-group-element"),r[2]===void 0&&Qr(()=>r[9].call(t)),R(i,"class","dropdown mb-input-element-group-element"),r[3]===void 0&&Qr(()=>r[11].call(i)),R(e,"class","mb-input-element-group")},m(f,p){Q(f,e,p),$(e,t);for(let m=0;m<u.length;m+=1)u[m]&&u[m].m(t,null);Mr(t,r[2],!0),$(e,n),$(e,i);for(let m=0;m<c.length;m+=1)c[m]&&c[m].m(i,null);Mr(i,r[3],!0),a||(o=[xe(t,"change",r[9]),xe(t,"change",r[10]),xe(i,"change",r[11]),xe(i,"change",r[12])],a=!0)},p(f,[p]){if(p&1){l=je(Object.entries(f[0]));let m;for(m=0;m<l.length;m+=1){let h=EE(f,l,m);u[m]?u[m].p(h,p):(u[m]=SE(h),u[m].c(),u[m].m(t,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=l.length}if(p&5&&Mr(t,f[2]),p&2){s=je(Object.entries(f[1]));let m;for(m=0;m<s.length;m+=1){let h=DE(f,s,m);c[m]?c[m].p(h,p):(c[m]=NE(h),c[m].c(),c[m].m(i,null))}for(;m<c.length;m+=1)c[m].d(1);c.length=s.length}p&10&&Mr(i,f[3])},i:Fe,o:Fe,d(f){f&&X(e),Nt(u,f),Nt(c,f),a=!1,ot(o)}}}function KU(r,e,t){let{value:n}=e,{onValueChange:i}=e,a={},o={},l,u;nn(()=>{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=n.getMinute().toString()),t(2,l=n.getHour().toString())});function s(g){t(6,n=g),t(3,u=n.getMinute().toString()),t(2,l=n.getHour().toString())}function c(){n.setMinuteFromString(u),i(n)}function f(){n.setHourFromString(l),i(n)}function p(){l=Jn(this),t(2,l),t(0,a)}let m=()=>f();function h(){u=Jn(this),t(3,u),t(1,o)}let d=()=>c();return r.$$set=g=>{"value"in g&&t(6,n=g.value),"onValueChange"in g&&t(7,i=g.onValueChange)},[a,o,l,u,c,f,n,i,s,p,m,h,d]}var hh=class extends Ve{constructor(e){super(),ze(this,e,KU,QU,qe,{value:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},CE=hh;var Cf=class extends Ot{constructor(e){super(e)}filterValue(e){let t=Cs(e);return ti.parse(t)?t:void 0}getFallbackDefaultValue(){return ti.getDefaultTime()}getSvelteComponent(){return CE}rawMapValue(e){return ti.stringify(e)}rawReverseMapValue(e){return ti.parse(e)}};function ME(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function TE(r){let e,t,n,i,a,o,l,u;t=new mi({props:{value:r[9]}}),a=new cr({props:{iconName:"x"}});function s(){return r[8](r[11])}return{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),i=Z("button"),Ce(a.$$.fragment),R(i,"class","mb-inline-list-item-button"),R(e,"class","mb-inline-list-item")},m(c,f){Q(c,e,f),Se(t,e,null),$(e,n),$(e,i),Se(a,i,null),o=!0,l||(u=xe(i,"click",s),l=!0)},p(c,f){r=c;let p={};f&1&&(p.value=r[9]),t.$set(p)},i(c){o||(te(t.$$.fragment,c),te(a.$$.fragment,c),o=!0)},o(c){oe(t.$$.fragment,c),oe(a.$$.fragment,c),o=!1},d(c){c&&X(e),Ne(t),Ne(a),l=!1,u()}}}function eV(r){let e,t,n,i,a,o,l,u,s,c=je(r[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=TE(ME(r,c,m));let p=m=>oe(f[m],1,1,()=>{f[m]=null});return o=new cr({props:{iconName:"plus"}}),{c(){e=Z("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),n=Z("div"),i=Z("span"),i.textContent="\u200B",a=fe(),Ce(o.$$.fragment),R(n,"class","mb-inline-list-add"),R(n,"role","button"),R(n,"tabindex","0"),R(e,"class","mb-inline-list")},m(m,h){Q(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);$(e,t),$(e,n),$(n,i),$(n,a),Se(o,n,null),l=!0,u||(s=[xe(n,"click",r[2]),xe(n,"keydown",r[3])],u=!0)},p(m,[h]){if(h&3){c=je(m[0]);let d;for(d=0;d<c.length;d+=1){let g=ME(m,c,d);f[d]?(f[d].p(g,h),te(f[d],1)):(f[d]=TE(g),f[d].c(),te(f[d],1),f[d].m(e,t))}for(vt(),d=c.length;d<f.length;d+=1)p(d);yt()}},i(m){if(!l){for(let h=0;h<c.length;h+=1)te(f[h]);te(o.$$.fragment,m),l=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)oe(f[h]);oe(o.$$.fragment,m),l=!1},d(m){m&&X(e),Nt(f,m),Ne(o),u=!1,ot(s)}}}function tV(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var gh=class extends Ve{constructor(e){super(),ze(this,e,tV,eV,qe,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},FE=gh;var Mf=class extends Ot{constructor(e){super(e)}filterValue(e){return Gi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return FE}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 IE(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function BE(r){let e,t,n,i,a,o,l,u;t=new mi({props:{value:r[9]}}),a=new cr({props:{iconName:"x"}});function s(){return r[8](r[11])}return{c(){e=Z("div"),Ce(t.$$.fragment),n=fe(),i=Z("button"),Ce(a.$$.fragment),R(i,"class","mb-inline-list-item-button"),R(e,"class","mb-inline-list-item")},m(c,f){Q(c,e,f),Se(t,e,null),$(e,n),$(e,i),Se(a,i,null),o=!0,l||(u=xe(i,"click",s),l=!0)},p(c,f){r=c;let p={};f&1&&(p.value=r[9]),t.$set(p)},i(c){o||(te(t.$$.fragment,c),te(a.$$.fragment,c),o=!0)},o(c){oe(t.$$.fragment,c),oe(a.$$.fragment,c),o=!1},d(c){c&&X(e),Ne(t),Ne(a),l=!1,u()}}}function rV(r){let e,t,n,i,a,o,l,u,s,c=je(r[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=BE(IE(r,c,m));let p=m=>oe(f[m],1,1,()=>{f[m]=null});return o=new cr({props:{iconName:"plus"}}),{c(){e=Z("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),n=Z("div"),i=Z("span"),i.textContent="\u200B",a=fe(),Ce(o.$$.fragment),R(n,"class","mb-inline-list-add"),R(n,"role","button"),R(n,"tabindex","0"),R(e,"class","mb-inline-list")},m(m,h){Q(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);$(e,t),$(e,n),$(n,i),$(n,a),Se(o,n,null),l=!0,u||(s=[xe(n,"click",r[2]),xe(n,"keydown",r[3])],u=!0)},p(m,[h]){if(h&3){c=je(m[0]);let d;for(d=0;d<c.length;d+=1){let g=IE(m,c,d);f[d]?(f[d].p(g,h),te(f[d],1)):(f[d]=BE(g),f[d].c(),te(f[d],1),f[d].m(e,t))}for(vt(),d=c.length;d<f.length;d+=1)p(d);yt()}},i(m){if(!l){for(let h=0;h<c.length;h+=1)te(f[h]);te(o.$$.fragment,m),l=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)oe(f[h]);oe(o.$$.fragment,m),l=!1},d(m){m&&X(e),Nt(f,m),Ne(o),u=!1,ot(s)}}}function nV(r,e,t){let{value:n}=e,{showInput:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showInput"in p&&t(4,i=p.showInput),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var vh=class extends Ve{constructor(e){super(),ze(this,e,nV,rV,qe,{value:0,showInput:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},PE=vh;var Tf=class extends Ot{constructor(e){super(e)}filterValue(e){return Gi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return PE}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 Ff=class{constructor(e){this.plugin=e}createInputField(e,t,n){if(e!=="invalid"&&this.checkRenderChildTypeAllowed(e,t),e==="toggle")return new df(n);if(e==="slider")return new gf(n);if(e==="text")return new hf(n);if(e==="textArea")return new ju(n);if(e==="text_area")return new ju(n);if(e==="select")return new yf(n);if(e==="multiSelect")return new Zu(n);if(e==="multi_select")return new Zu(n);if(e==="datePicker")return new Ju(n);if(e==="date_picker")return new Ju(n);if(e==="number")return new bf(n);if(e==="suggester")return new xf(n);if(e==="editor")return new wf(n);if(e==="progressBar")return new _f(n);if(e==="inlineSelect")return new Af(n);if(e==="imageSuggester")return new Df(n);if(e==="list")return new Ef(n);if(e==="listSuggester")return new Sf(n);if(e==="date")return new Nf(n);if(e==="time")return new Cf(n);if(e==="inlineListSuggester")return new Mf(n);if(e==="inlineList")return new Tf(n)}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let n=WA[e];if(t==="block"&&!n.allowInBlock)throw new la({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[_t.linkToInputField(e)]});if(t==="inline"&&!n.allowInline)throw new la({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[_t.linkToInputField(e)]})}};var qa=class{constructor(e){this.base=e,this.inputSignal=new xr(void 0),this.variables=[],this.hidden=!1}async initialRender(e){var t,n;this.container=e,this.container.addClass("mb-view-text"),this.hidden=(n=(t=this.base.getArgument("hidden"))==null?void 0:t.value)!=null?n:!1,this.hidden&&this.container.addClass("mb-view-hidden"),await this.onInitialRender(e),await this.rerender("")}async rerender(e){var t;if(this.container&&!this.hidden){let n=(t=Ic(e,this.base.plugin.settings.viewFieldDisplayNullAsEmpty))!=null?t:"";this.container.empty(),await this.onRerender(this.container,n)}}destroy(){this.unmount()}mount(e){this.onmount(),this.buildVariables(),this.inputSignal.registerListener({callback:t=>void this.rerender(t)}),this.metadataSubscription=this.base.plugin.metadataManager.subscribeComputed(this.base.getUuid(),this.inputSignal,this.base.getDeclaration().writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.computeValue(),()=>this.base.unload()),this.initialRender(e)}unmount(){var e;this.onunmount(),this.inputSignal.unregisterAllListeners(),(e=this.metadataSubscription)==null||e.unsubscribe()}onmount(){}onunmount(){}};function gr(){return gr=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr.apply(this,arguments)}var yh={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function it(r){return typeof r=="number"}function rt(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function Cn(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function ma(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function un(r){return r&&r.constructor.prototype.isUnit===!0||!1}function wr(r){return typeof r=="string"}var Tt=Array.isArray;function Ge(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function Er(r){return Array.isArray(r)||Ge(r)}function Bo(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Mi(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Us(r){return r&&r.constructor.prototype.isRange===!0||!1}function za(r){return r&&r.constructor.prototype.isIndex===!0||!1}function OE(r){return typeof r=="boolean"}function RE(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function If(r){return r&&r.constructor.prototype.isHelp===!0||!1}function kE(r){return typeof r=="function"}function LE(r){return r instanceof Date}function UE(r){return r instanceof RegExp}function Po(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!Cn(r)&&!ma(r))}function VE(r){return r===null}function qE(r){return r===void 0}function ri(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function ln(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function zE(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function $E(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function HE(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function wt(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function Qu(r){return wt(r)||pr(r)&&r.args.length===1&&wt(r.args[0])&&"-+~".includes(r.op)}function Wi(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function Mn(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function di(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function Dt(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function $a(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function pr(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function cn(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function GE(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function WE(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function tr(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function Bf(r){return r&&r.constructor.prototype.isChain===!0||!1}function Ct(r){var e=typeof r;return e==="object"?r===null?"null":rt(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function Qe(r){var e=typeof r;if(e==="number"||e==="string"||e==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(t){return Qe(t)});if(r instanceof Date)return new Date(r.valueOf());if(rt(r))return r;if(Po(r))return iV(r,Qe);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function iV(r,e){var t={};for(var n in r)Ze(r,n)&&(t[n]=e(r[n]));return t}function Pf(r,e){for(var t in e)Ze(e,t)&&(r[t]=e[t]);return r}function Ti(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!Ti(r[n],e[n]))return!1;return!0}else{if(typeof r=="function")return r===e;if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!Ti(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}else return r===e}}function jE(r,e,t){var n=!0,i;Object.defineProperty(r,e,{get:function(){return n&&(i=t(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function Ze(r,e){return r&&Object.hasOwnProperty.call(r,e)}function ZE(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],a=r[i];a!==void 0&&(t[i]=a)}return t}var JE=["Matrix","Array"],YE=["number","BigNumber","Fraction"];var be=function(e){if(e)throw new Error(`The global config is readonly.
Please create a mathjs instance if you want to change the default configuration.
Example:
import { create, all } from 'mathjs';
const mathjs = create(all);
mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(yh)};gr(be,yh,{MATRIX_OPTIONS:JE,NUMBER_OPTIONS:YE});var Bh=ur(wh(),1);function $e(r){return typeof r=="boolean"?!0:isFinite(r)?r===Math.round(r):!1}var hi=Math.sign||function(r){return r>0?1:r<0?-1:0},XE=Math.log2||function(e){return Math.log(e)/Math.LN2},QE=Math.log10||function(e){return Math.log(e)/Math.LN10},Of=Math.log1p||function(r){return Math.log(r+1)},KE=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},eS=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function _h(r,e,t){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!$e(t))throw new Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!$e(r))throw new Error("Value must be an integer");r<0&&(r=r+2**t),a="i".concat(t)}var o="";return r<0&&(r=-r,o="-"),"".concat(o).concat(i).concat(r.toString(e)).concat(a)}function Fi(r,e){if(typeof e=="function")return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var t="auto",n,i;if(e&&(e.notation&&(t=e.notation),it(e)?n=e:it(e.precision)&&(n=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(t){case"fixed":return Ah(r,n);case"exponential":return tS(r,n);case"engineering":return aV(r,n);case"bin":return _h(r,2,i);case"oct":return _h(r,8,i);case"hex":return _h(r,16,i);case"auto":return oV(r,n,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 Rf(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(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 aV(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Rf(r),n=kf(t,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(it(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;u<l;u++)a.push(0);for(var s=Math.abs(i-o),c=1;s>0;)c++,s--;var f=a.slice(c).join(""),p=it(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,c).join("")+p+"e"+(i>=0?"+":"")+o.toString();return n.sign+m}function Ah(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Rf(r),n=typeof e=="number"?kf(t,t.exponent+1+e):t,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(Vs(o-i.length))),a<0&&(i=Vs(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function tS(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Rf(r),n=e?kf(t,e):t,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(Vs(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function oV(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=t&&t.lowerExp!==void 0?t.lowerExp:-3,i=t&&t.upperExp!==void 0?t.upperExp:5,a=Rf(r),o=e?kf(a,e):a;if(o.exponent<n||o.exponent>=i)return tS(r,e);var l=o.coefficients,u=o.exponent;l.length<e&&(l=l.concat(Vs(e-l.length))),l=l.concat(Vs(u-l.length+1+(l.length<e?e-l.length:0))),l=Vs(-u).concat(l);var s=u>0?u:0;return s<l.length-1&&l.splice(s+1,0,"."),o.sign+l.join("")}function kf(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),t.exponent++,a++),a--,n[a]++}}return t}function Vs(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}function rS(r){return r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var sV=Number.EPSILON||2220446049250313e-31;function Ir(r,e,t){if(t==null)return r===e;if(r===e)return!0;if(isNaN(r)||isNaN(e))return!1;if(isFinite(r)&&isFinite(e)){var n=Math.abs(r-e);return n<=sV?!0:n<=Math.max(Math.abs(r),Math.abs(e))*t}return!1}var nS=Math.acosh||function(r){return Math.log(Math.sqrt(r*r-1)+r)},iS=Math.asinh||function(r){return Math.log(Math.sqrt(r*r+1)+r)},aS=Math.atanh||function(r){return Math.log((1+r)/(1-r))/2},Lf=Math.cosh||function(r){return(Math.exp(r)+Math.exp(-r))/2},oS=Math.sinh||function(r){return(Math.exp(r)-Math.exp(-r))/2},Uf=Math.tanh||function(r){var e=Math.exp(2*r);return(e-1)/(e+1)};function sS(r,e){var t=r>0?!0:r<0?!1:1/r===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return t^n?-r:r}function Dh(r,e,t){var n=r.constructor,i=new n(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!$e(t))throw new Error("size must be an integer");if(r.greaterThan(i.pow(t-1).sub(1))||r.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(!r.isInteger())throw new Error("Value must be an integer");r.lessThan(0)&&(r=r.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(a);case 8:return"".concat(r.toOctal()).concat(a);case 16:return"".concat(r.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function lS(r,e){if(typeof e=="function")return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var t="auto",n,i;if(e!==void 0&&(e.notation&&(t=e.notation),typeof e=="number"?n=e:e.precision!==void 0&&(n=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(t){case"fixed":return lV(r,n);case"exponential":return uS(r,n);case"engineering":return uV(r,n);case"bin":return Dh(r,2,i);case"oct":return Dh(r,8,i);case"hex":return Dh(r,16,i);case"auto":{var a=e&&e.lowerExp!==void 0?e.lowerExp:-3,o=e&&e.upperExp!==void 0?e.upperExp:5;if(r.isZero())return"0";var l,u=r.toSignificantDigits(n),s=u.e;return s>=a&&s<o?l=u.toFixed():l=uS(r,n),l.replace(/((\.\d*?)(0+))($|e)/,function(){var c=arguments[2],f=arguments[4];return c!=="."?c+f:f})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function uV(r,e){var t=r.e,n=t%3===0?t:t<0?t-3-t%3:t-t%3,i=r.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.indexOf("e")!==-1){var o=r.constructor;a=new o(a).toFixed()}return a+"e"+(t>=0?"+":"")+n.toString()}function uS(r,e){return e!==void 0?r.toExponential(e-1):r.toExponential()}function lV(r,e){return r.toFixed(e)}function fS(r,e){var t=r.length-e.length,n=r.length;return r.substring(t,n)===e}function at(r,e){var t=cV(r,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function cV(r,e){if(typeof r=="number")return Fi(r,e);if(rt(r))return lS(r,e);if(fV(r))return!e||e.fraction!=="decimal"?r.s*r.n+"/"+r.d:r.toString();if(Array.isArray(r))return pS(r,e);if(wr(r))return Oo(r);if(typeof r=="function")return r.syntax?String(r.syntax):"function";if(r&&typeof r=="object"){if(typeof r.format=="function")return r.format(e);if(r&&r.toString(e)!=={}.toString())return r.toString(e);var t=Object.keys(r).map(n=>Oo(n)+": "+at(r[n],e));return"{"+t.join(", ")+"}"}return String(r)}function Oo(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in cS?cS[i]:i,n++}return'"'+t+'"'}var cS={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Gr(r){var e=String(r);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function pS(r,e){if(Array.isArray(r)){for(var t="[",n=r.length,i=0;i<n;i++)i!==0&&(t+=", "),t+=pS(r[i],e);return t+="]",t}else return at(r,e)}function fV(r){return r&&typeof r=="object"&&typeof r.s=="number"&&typeof r.n=="number"&&typeof r.d=="number"||!1}function Vf(r,e){if(!wr(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ct(r)+", index: 0)");if(!wr(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ct(e)+", index: 1)");return r===e?0:r>e?1:-1}function st(r,e,t){if(!(this instanceof st))throw new SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}st.prototype=new RangeError;st.prototype.constructor=RangeError;st.prototype.name="DimensionError";st.prototype.isDimensionError=!0;function fn(r,e,t){if(!(this instanceof fn))throw new SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==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}fn.prototype=new RangeError;fn.prototype.constructor=RangeError;fn.prototype.name="IndexError";fn.prototype.isIndexError=!0;function tt(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function mS(r,e,t){var n,i=r.length;if(i!==e[t])throw new st(i,e[t]);if(t<e.length-1){var a=t+1;for(n=0;n<i;n++){var o=r[n];if(!Array.isArray(o))throw new st(e.length-1,e.length,"<");mS(r[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(r[n]))throw new st(e.length+1,e.length,">")}function Sh(r,e){var t=e.length===0;if(t){if(Array.isArray(r))throw new st(r.length,0)}else mS(r,e,0)}function Ku(r,e){var t=r.isMatrix?r._size:tt(r),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new st(i,t[a])})}function Gt(r,e){if(r!==void 0){if(!it(r)||!$e(r))throw new TypeError("Index must be an integer (value: "+r+")");if(r<0||typeof e=="number"&&r>=e)throw new fn(r,e)}}function Ro(r){for(var e=0;e<r._dimensions.length;++e){var t=r._dimensions[e];if(t._data&&Tt(t._data)){if(t._size[0]===0)return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(wr(t)&&t.length===0)return!0}return!1}function Ii(r,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!it(i)||!$e(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+at(e)+")")}),(it(r)||rt(r))&&(r=[r]);var n=t!==void 0?t:0;return Eh(r,e,0,n),r}function Eh(r,e,t,n){var i,a,o=r.length,l=e[t],u=Math.min(o,l);if(r.length=l,t<e.length-1){var s=t+1;for(i=0;i<u;i++)a=r[i],Array.isArray(a)||(a=[a],r[i]=a),Eh(a,e,s,n);for(i=u;i<l;i++)a=[],r[i]=a,Eh(a,e,s,n)}else{for(i=0;i<u;i++)for(;Array.isArray(r[i]);)r[i]=r[i][0];for(i=u;i<l;i++)r[i]=n}}function el(r,e){var t=mt(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new st(0,n,"!=");e=tl(e,n);var i=dS(e);if(n!==i)throw new st(i,n,"!=");try{return pV(t,e)}catch(a){throw a instanceof st?new st(i,n,"!="):a}}function tl(r,e){var t=dS(r),n=r.slice(),i=-1,a=r.indexOf(i),o=r.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var l=a>=0,u=e%t===0;if(l)if(u)n[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function dS(r){return r.reduce((e,t)=>e*t,1)}function pV(r,e){for(var t=r,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=t.length/a,l=0;l<o;l++)n.push(t.slice(l*a,(l+1)*a));t=n}return t}function qs(r,e){for(var t=e||tt(r);Array.isArray(r)&&r.length===1;)r=r[0],t.shift();for(var n=t.length;t[n-1]===1;)n--;return n<t.length&&(r=hS(r,n,0),t.length=n),r}function hS(r,e,t){var n,i;if(t<e){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=hS(r[n],e,a)}else for(;Array.isArray(r);)r=r[0];return r}function qf(r,e,t,n){var i=n||tt(r);if(t)for(var a=0;a<t;a++)r=[r],i.unshift(1);for(r=gS(r,e,0);i.length<e;)i.push(1);return r}function gS(r,e,t){var n,i;if(Array.isArray(r)){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=gS(r[n],e,a)}else for(var o=t;o<e;o++)r=[r];return r}function mt(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function t(n){Array.isArray(n)?n.forEach(t):e.push(n)}),e}function Ln(r,e){return Array.prototype.map.call(r,e)}function Ha(r,e){Array.prototype.forEach.call(r,e)}function zf(r,e){if(tt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,e)}function zs(r,e){if(tt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,t=>e.test(t))}function Nh(r,e){return Array.prototype.join.call(r,e)}function da(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;var e=[],t=0;e[0]={value:r[0],identifier:0};for(var n=1;n<r.length;n++)r[n]===r[n-1]?t++:t=0,e.push({value:r[n],identifier:t});return e}function $s(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;for(var e=[],t=0;t<r.length;t++)e.push(r[t].value);return e}function Ga(r,e){for(var t,n=0,i=0;i<r.length;i++){var a=r[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var l=o?Ga(a,e):e(a);if(t===void 0)t=l;else if(t!==l)return"mixed"}return t}function vS(r,e,t,n){if(n<t){if(r.length!==e.length)throw new st(r.length,e.length);for(var i=[],a=0;a<r.length;a++)i[a]=vS(r[a],e[a],t,n+1);return i}else return r.concat(e)}function Ch(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(r.length===1)return r[0];if(r.length>1)return r.slice(1).reduce(function(t,n){return vS(t,n,e,0)},r[0]);throw new Error("Wrong number of arguments in function concat")}function mV(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(p=>p.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var l=e[o],u=n[o],s=0;s<u;s++){var c=i-u+s;l[s]>a[c]&&(a[c]=l[s])}for(var f=0;f<e.length;f++)rl(e[f],a);return a}function rl(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var a=t-n+i;if(r[i]<e[a]&&r[i]>1||r[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[a]))}}function Mh(r,e){var t=tt(r);if(Ti(t,e))return r;rl(t,e);var n=mV(t,e),i=n.length,a=[...Array(i-t.length).fill(1),...t],o=hV(r);t.length<i&&(o=el(o,a),t=tt(o));for(var l=0;l<i;l++)t[l]<n[l]&&(o=dV(o,n[l],l),t=tt(o));return o}function dV(r,e,t){return Ch(...Array(e).fill(r),t)}function hV(r){return gr([],r)}function N(r,e,t,n){function i(a){var o=ZE(a,e.map(yV));return gV(r,e,a),t(o)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function gV(r,e,t){var n=e.filter(a=>!vV(a)).every(a=>t[a]!==void 0);if(!n){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function vV(r){return r&&r[0]==="?"}function yV(r){return r&&r[0]==="?"?r.slice(1):r}function vr(r,e){if(wS(r)&&bS(r,e))return r[e];throw typeof r[e]=="function"&&$f(r,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function ji(r,e,t){if(wS(r)&&bS(r,e))return r[e]=t,t;throw new Error('No access to property "'+e+'"')}function yS(r,e){return e in r}function bS(r,e){return!r||typeof r!="object"?!1:Ze(bV,e)?!0:!(e in Object.prototype||e in Function.prototype)}function xS(r,e){if(!$f(r,e))throw new Error('No access to method "'+e+'"');return r[e]}function $f(r,e){return r==null||typeof r[e]!="function"||Ze(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r)?!1:Ze(xV,e)?!0:!(e in Object.prototype||e in Function.prototype)}function wS(r){return typeof r=="object"&&r&&r.constructor===Object}var bV={length:!0,name:!0},xV={toString:!0,valueOf:!0,toLocaleString:!0};var nl=class{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return vr(this.wrappedObject,e)}set(e,t){return ji(this.wrappedObject,e,t),this}has(e){return yS(this.wrappedObject,e)}};function Zi(){return new Map}function ha(r){if(!r)return Zi();if(Hf(r))return r;if(Po(r))return new nl(r);throw new Error("createMap can create maps from objects or Maps")}function _S(r){if(r instanceof nl)return r.wrappedObject;var e={};for(var t of r.keys()){var n=r.get(t);ji(e,t,n)}return e}function Hf(r){return r?r instanceof Map||r instanceof nl||typeof r.set=="function"&&typeof r.get=="function"&&typeof r.keys=="function"&&typeof r.has=="function":!1}function Th(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];for(var i of t)if(i){if(Hf(i))for(var a of i.keys())r.set(a,i.get(a));else if(Po(i))for(var o of Object.keys(i))r.set(o,i[o])}return r}var AS=function(){return AS=Bh.default.create,Bh.default},wV=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Ph=N("typed",wV,function(e){var{BigNumber:t,Complex:n,DenseMatrix:i,Fraction:a}=e,o=AS();return o.clear(),o.addTypes([{name:"number",test:it},{name:"Complex",test:Cn},{name:"BigNumber",test:rt},{name:"Fraction",test:ma},{name:"Unit",test:un},{name:"identifier",test:l=>wr&&/^(?:[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:wr},{name:"Chain",test:Bf},{name:"Array",test:Tt},{name:"Matrix",test:Ge},{name:"DenseMatrix",test:Bo},{name:"SparseMatrix",test:Mi},{name:"Range",test:Us},{name:"Index",test:za},{name:"boolean",test:OE},{name:"ResultSet",test:RE},{name:"Help",test:If},{name:"function",test:kE},{name:"Date",test:LE},{name:"RegExp",test:UE},{name:"null",test:VE},{name:"undefined",test:qE},{name:"AccessorNode",test:ri},{name:"ArrayNode",test:ln},{name:"AssignmentNode",test:zE},{name:"BlockNode",test:$E},{name:"ConditionalNode",test:HE},{name:"ConstantNode",test:wt},{name:"FunctionNode",test:Mn},{name:"FunctionAssignmentNode",test:Wi},{name:"IndexNode",test:di},{name:"Node",test:Dt},{name:"ObjectNode",test:$a},{name:"OperatorNode",test:pr},{name:"ParenthesisNode",test:cn},{name:"RangeNode",test:GE},{name:"RelationalNode",test:WE},{name:"SymbolNode",test:tr},{name:"Map",test:Hf},{name:"Object",test:Po}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(u){if(t||Fh(u),rS(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 n||Gf(u),new n(u,0)}},{from:"BigNumber",to:"Complex",convert:function(u){return n||Gf(u),new n(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 n||Gf(u),new n(u.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(u){a||Ih(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||Fh(u);try{return new t(u)}catch(s){throw new Error('Cannot convert "'+u+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(u){a||Ih(u);try{return new a(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(u){n||Gf(u);try{return new n(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||Fh(u),new t(+u)}},{from:"boolean",to:"Fraction",convert:function(u){return a||Ih(u),new a(+u)}},{from:"boolean",to:"string",convert:function(u){return String(u)}},{from:"Array",to:"Matrix",convert:function(u){return i||_V(),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&&Er(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&&Er(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 Fh(r){throw new Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function Gf(r){throw new Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function _V(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Ih(r){throw new Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}var AV="ResultSet",DV=[],Oh=N(AV,DV,()=>{function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return r.prototype.type="ResultSet",r.prototype.isResultSet=!0,r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},r.fromJSON=function(e){return new r(e.entries)},r},{isClass:!0});var Hs=9e15,Ja=1e9,Rh="0123456789abcdef",jf="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Zf="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",kh={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Hs,maxE:Hs,crypto:!1},NS,ga,Et=!0,Yf="[DecimalError] ",Za=Yf+"Invalid argument: ",CS=Yf+"Precision limit exceeded",MS=Yf+"crypto unavailable",TS="[object Decimal]",vn=Math.floor,Wr=Math.pow,EV=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,SV=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,NV=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,FS=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Pi=1e7,dt=7,CV=9007199254740991,MV=jf.length-1,Lh=Zf.length-1,Ie={toStringTag:TS};Ie.absoluteValue=Ie.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),lt(r)};Ie.ceil=function(){return lt(new this.constructor(this),this.e+1,2)};Ie.clampedTo=Ie.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Za+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};Ie.comparedTo=Ie.cmp=function(r){var e,t,n,i,a=this,o=a.d,l=(r=new a.constructor(r)).d,u=a.s,s=r.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!==r.e)return a.e>r.e^u<0?1:-1;for(n=o.length,i=l.length,e=0,t=n<i?n:i;e<t;++e)if(o[e]!==l[e])return o[e]>l[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};Ie.cosine=Ie.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+dt,n.rounding=1,t=TV(n,RS(n,t)),n.precision=r,n.rounding=e,lt(ga==2||ga==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Ie.cubeRoot=Ie.cbrt=function(){var r,e,t,n,i,a,o,l,u,s,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Et=!1,a=c.s*Wr(c.s*c,1/3),!a||Math.abs(a)==1/0?(t=pn(c.d),r=c.e,(a=(r-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=Wr(t,1/3),r=vn((r+1)/3)-(r%3==(r<0?-1:2)),a==1/0?t="5e"+r:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new f(t),n.s=c.s):n=new f(a.toString()),o=(r=f.precision)+3;;)if(l=n,u=l.times(l).times(l),s=u.plus(c),n=yr(s.plus(c).times(l),s.plus(u),o+2,1),pn(l.d).slice(0,o)===(t=pn(n.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(lt(l,r+1,0),l.times(l).times(l).eq(c))){n=l;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(lt(n,r+1,1),e=!n.times(n).times(n).eq(c));break}return Et=!0,lt(n,r,f.rounding,e)};Ie.decimalPlaces=Ie.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-vn(this.e/dt))*dt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Ie.dividedBy=Ie.div=function(r){return yr(this,new this.constructor(r))};Ie.dividedToIntegerBy=Ie.divToInt=function(r){var e=this,t=e.constructor;return lt(yr(e,new t(r),0,1,1),t.precision,t.rounding)};Ie.equals=Ie.eq=function(r){return this.cmp(r)===0};Ie.floor=function(){return lt(new this.constructor(this),this.e+1,3)};Ie.greaterThan=Ie.gt=function(r){return this.cmp(r)>0};Ie.greaterThanOrEqualTo=Ie.gte=function(r){var e=this.cmp(r);return e==1||e===0};Ie.hyperbolicCosine=Ie.cosh=function(){var r,e,t,n,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,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(r=Math.ceil(i/3),e=(1/Qf(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),a=Gs(o,1,a.times(e),new o(1),!0);for(var u,s=r,c=new o(8);s--;)u=a.times(a),a=l.minus(u.times(c.minus(u.times(c))));return lt(a,o.precision=t,o.rounding=n,!0)};Ie.hyperbolicSine=Ie.sinh=function(){var r,e,t,n,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,n=i.d.length,n<3)i=Gs(a,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/Qf(5,r)),i=Gs(a,2,i,i,!0);for(var o,l=new a(5),u=new a(16),s=new a(20);r--;)o=i.times(i),i=i.times(l.plus(o.times(u.times(o).plus(s))))}return a.precision=e,a.rounding=t,lt(i,e,t,!0)};Ie.hyperbolicTangent=Ie.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,yr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Ie.inverseCosine=Ie.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,a=t.rounding;return n!==-1?n===0?e.isNeg()?Bi(t,i,a):new t(0):new t(NaN):e.isZero()?Bi(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=Bi(t,i+4,a).times(.5),t.precision=i,t.rounding=a,r.minus(e))};Ie.inverseHyperbolicCosine=Ie.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Et=!1,t=t.times(t).minus(1).sqrt().plus(t),Et=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Ie.inverseHyperbolicSine=Ie.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Et=!1,t=t.times(t).plus(1).sqrt().plus(t),Et=!0,n.precision=r,n.rounding=e,t.ln())};Ie.inverseHyperbolicTangent=Ie.atanh=function(){var r,e,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=a.precision,e=a.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?lt(new a(i),r,e,!0):(a.precision=t=n-i.e,i=yr(i.plus(1),new a(1).minus(i),t+r,1),a.precision=r+4,a.rounding=1,i=i.ln(),a.precision=r,a.rounding=e,i.times(.5))):new a(NaN)};Ie.inverseSine=Ie.asin=function(){var r,e,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,n=a.rounding,e!==-1?e===0?(r=Bi(a,t+4,n).times(.5),r.s=i.s,r):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=n,i.times(2)))};Ie.inverseTangent=Ie.atan=function(){var r,e,t,n,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<=Lh)return o=Bi(c,f+4,p).times(.25),o.s=s.s,o}else{if(!s.s)return new c(NaN);if(f+4<=Lh)return o=Bi(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/dt+2|0),r=t;r;--r)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(Et=!1,e=Math.ceil(l/dt),n=1,u=s.times(s),o=new c(s),i=s;r!==-1;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(r=e;o.d[r]===a.d[r]&&r--;);return t&&(o=o.times(2<<t-1)),Et=!0,lt(o,c.precision=f,c.rounding=p,!0)};Ie.isFinite=function(){return!!this.d};Ie.isInteger=Ie.isInt=function(){return!!this.d&&vn(this.e/dt)>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(r){return this.cmp(r)<0};Ie.lessThanOrEqualTo=Ie.lte=function(r){return this.cmp(r)<1};Ie.logarithm=Ie.log=function(r){var e,t,n,i,a,o,l,u,s=this,c=s.constructor,f=c.precision,p=c.rounding,m=5;if(r==null)r=new c(10),e=!0;else{if(r=new c(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new c(NaN);e=r.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(Et=!1,l=f+m,o=ja(s,l),n=e?Jf(c,l+10):ja(r,l),u=yr(o,n,l,1),il(u.d,i=f,p))do if(l+=10,o=ja(s,l),n=e?Jf(c,l+10):ja(r,l),u=yr(o,n,l,1),!a){+pn(u.d).slice(i+1,i+15)+1==1e14&&(u=lt(u,f+1,0));break}while(il(u.d,i+=10,p));return Et=!0,lt(u,f,p)};Ie.minus=Ie.sub=function(r){var e,t,n,i,a,o,l,u,s,c,f,p,m=this,h=m.constructor;if(r=new h(r),!m.d||!r.d)return!m.s||!r.s?r=new h(NaN):m.d?r.s=-r.s:r=new h(r.d||m.s!==r.s?m:NaN),r;if(m.s!=r.s)return r.s=-r.s,m.plus(r);if(s=m.d,p=r.d,l=h.precision,u=h.rounding,!s[0]||!p[0]){if(p[0])r.s=-r.s;else if(s[0])r=new h(m);else return new h(u===3?-0:0);return Et?lt(r,l,u):r}if(t=vn(r.e/dt),c=vn(m.e/dt),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),n=Math.max(Math.ceil(l/dt),o)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=s.length,o=p.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(s[n]!=p[n]){f=s[n]<p[n];break}a=0}for(f&&(e=s,s=p,p=e,r.s=-r.s),o=s.length,n=p.length-o;n>0;--n)s[o++]=0;for(n=p.length;n>a;){if(s[--n]<p[n]){for(i=n;i&&s[--i]===0;)s[i]=Pi-1;--s[i],s[n]+=Pi}s[n]-=p[n]}for(;s[--o]===0;)s.pop();for(;s[0]===0;s.shift())--t;return s[0]?(r.d=s,r.e=Xf(s,t),Et?lt(r,l,u):r):new h(u===3?-0:0)};Ie.modulo=Ie.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?lt(new n(t),n.precision,n.rounding):(Et=!1,n.modulo==9?(e=yr(t,r.abs(),0,3,1),e.s*=r.s):e=yr(t,r,0,n.modulo,1),e=e.times(r),Et=!0,t.minus(e))};Ie.naturalExponential=Ie.exp=function(){return Uh(this)};Ie.naturalLogarithm=Ie.ln=function(){return ja(this)};Ie.negated=Ie.neg=function(){var r=new this.constructor(this);return r.s=-r.s,lt(r)};Ie.plus=Ie.add=function(r){var e,t,n,i,a,o,l,u,s,c,f=this,p=f.constructor;if(r=new p(r),!f.d||!r.d)return!f.s||!r.s?r=new p(NaN):f.d||(r=new p(r.d||f.s===r.s?f:NaN)),r;if(f.s!=r.s)return r.s=-r.s,f.minus(r);if(s=f.d,c=r.d,l=p.precision,u=p.rounding,!s[0]||!c[0])return c[0]||(r=new p(f)),Et?lt(r,l,u):r;if(a=vn(f.e/dt),n=vn(r.e/dt),s=s.slice(),i=a-n,i){for(i<0?(t=s,i=-i,o=c.length):(t=c,n=a,o=s.length),a=Math.ceil(l/dt),o=a>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)/Pi|0,s[i]%=Pi;for(e&&(s.unshift(e),++n),o=s.length;s[--o]==0;)s.pop();return r.d=s,r.e=Xf(s,n),Et?lt(r,l,u):r};Ie.precision=Ie.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Za+r);return t.d?(e=IS(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ie.round=function(){var r=this,e=r.constructor;return lt(new e(r),r.e+1,e.rounding)};Ie.sine=Ie.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+dt,n.rounding=1,t=IV(n,RS(n,t)),n.precision=r,n.rounding=e,lt(ga>2?t.neg():t,r,e,!0)):new n(NaN)};Ie.squareRoot=Ie.sqrt=function(){var r,e,t,n,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(Et=!1,s=Math.sqrt(+o),s==0||s==1/0?(e=pn(l),(e.length+u)%2==0&&(e+="0"),s=Math.sqrt(e),u=vn((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),n=new c(e)):n=new c(s.toString()),t=(u=c.precision)+3;;)if(a=n,n=a.plus(yr(o,a,t+2,1)).times(.5),pn(a.d).slice(0,t)===(e=pn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(lt(a,u+1,0),a.times(a).eq(o))){n=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(lt(n,u+1,1),r=!n.times(n).eq(o));break}return Et=!0,lt(n,u,c.rounding,r)};Ie.tangent=Ie.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=yr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,lt(ga==2||ga==4?t.neg():t,r,e,!0)):new n(NaN)};Ie.times=Ie.mul=function(r){var e,t,n,i,a,o,l,u,s,c=this,f=c.constructor,p=c.d,m=(r=new f(r)).d;if(r.s*=c.s,!p||!p[0]||!m||!m[0])return new f(!r.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?r.s/0:r.s*0);for(t=vn(c.e/dt)+vn(r.e/dt),u=p.length,s=m.length,u<s&&(a=p,p=m,m=a,o=u,u=s,s=o),a=[],o=u+s,n=o;n--;)a.push(0);for(n=s;--n>=0;){for(e=0,i=u+n;i>n;)l=a[i]+m[n]*p[i-n-1]+e,a[i--]=l%Pi|0,e=l/Pi|0;a[i]=(a[i]+e)%Pi|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),r.d=a,r.e=Xf(a,t),Et?lt(r,f.precision,f.rounding):r};Ie.toBinary=function(r,e){return qh(this,2,r,e)};Ie.toDecimalPlaces=Ie.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Un(r,0,Ja),e===void 0?e=n.rounding:Un(e,0,8),lt(t,r+t.e+1,e))};Ie.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ji(n,!0):(Un(r,0,Ja),e===void 0?e=i.rounding:Un(e,0,8),n=lt(new i(n),r+1,e),t=Ji(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ie.toFixed=function(r,e){var t,n,i=this,a=i.constructor;return r===void 0?t=Ji(i):(Un(r,0,Ja),e===void 0?e=a.rounding:Un(e,0,8),n=lt(new a(i),r+i.e+1,e),t=Ji(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Ie.toFraction=function(r){var e,t,n,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),n=u=new d(0),e=new d(n),a=e.e=IS(h)-m.e-1,o=a%dt,e.d[0]=Wr(10,o<0?dt+o:o),r==null)r=a>0?e:s;else{if(l=new d(r),!l.isInt()||l.lt(s))throw Error(Za+l);r=l.gt(e)?a>0?e:s:l}for(Et=!1,l=new d(pn(h)),c=d.precision,d.precision=a=h.length*dt*2;f=yr(l,e,0,1,1),i=t.plus(f.times(n)),i.cmp(r)!=1;)t=n,n=i,i=s,s=u.plus(f.times(i)),u=i,i=e,e=l.minus(f.times(i)),l=i;return i=yr(r.minus(t),n,0,1,1),u=u.plus(i.times(s)),t=t.plus(i.times(n)),u.s=s.s=m.s,p=yr(s,n,a,1).minus(m).abs().cmp(yr(u,t,a,1).minus(m).abs())<1?[s,n]:[u,t],d.precision=c,Et=!0,p};Ie.toHexadecimal=Ie.toHex=function(r,e){return qh(this,16,r,e)};Ie.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Un(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(Et=!1,t=yr(t,r,0,e,1).times(r),Et=!0,lt(t)):(r.s=t.s,t=r),t};Ie.toNumber=function(){return+this};Ie.toOctal=function(r,e){return qh(this,8,r,e)};Ie.toPower=Ie.pow=function(r){var e,t,n,i,a,o,l=this,u=l.constructor,s=+(r=new u(r));if(!l.d||!r.d||!l.d[0]||!r.d[0])return new u(Wr(+l,s));if(l=new u(l),l.eq(1))return l;if(n=u.precision,a=u.rounding,r.eq(1))return lt(l,n,a);if(e=vn(r.e/dt),e>=r.d.length-1&&(t=s<0?-s:s)<=CV)return i=BS(u,l,t,n),r.s<0?new u(1).div(i):lt(i,n,a);if(o=l.s,o<0){if(e<r.d.length-1)return new u(NaN);if(r.d[e]&1||(o=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=o,l}return t=Wr(+l,s),e=t==0||!isFinite(t)?vn(s*(Math.log("0."+pn(l.d))/Math.LN10+l.e+1)):new u(t+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?o/0:0):(Et=!1,u.rounding=l.s=1,t=Math.min(12,(e+"").length),i=Uh(r.times(ja(l,n+t)),n),i.d&&(i=lt(i,n+5,1),il(i.d,n,a)&&(e=n+10,i=lt(Uh(r.times(ja(l,e+t)),e),e+5,1),+pn(i.d).slice(n+1,n+15)+1==1e14&&(i=lt(i,n+1,0)))),i.s=o,Et=!0,u.rounding=a,lt(i,n,a))};Ie.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ji(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Un(r,1,Ja),e===void 0?e=i.rounding:Un(e,0,8),n=lt(new i(n),r,e),t=Ji(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Ie.toSignificantDigits=Ie.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Un(r,1,Ja),e===void 0?e=n.rounding:Un(e,0,8)),lt(new n(t),r,e)};Ie.toString=function(){var r=this,e=r.constructor,t=Ji(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Ie.truncated=Ie.trunc=function(){return lt(new this.constructor(this),this.e+1,1)};Ie.valueOf=Ie.toJSON=function(){var r=this,e=r.constructor,t=Ji(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function pn(r){var e,t,n,i=r.length-1,a="",o=r[0];if(i>0){for(a+=o,e=1;e<i;e++)n=r[e]+"",t=dt-n.length,t&&(a+=Wa(t)),a+=n;o=r[e],n=o+"",t=dt-n.length,t&&(a+=Wa(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Un(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Za+r)}function il(r,e,t,n){var i,a,o,l;for(a=r[0];a>=10;a/=10)--e;return--e<0?(e+=dt,i=0):(i=Math.ceil((e+1)/dt),e%=dt),a=Wr(10,dt-e),l=r[i]%a|0,n==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)&&(r[i+1]/a/100|0)==Wr(10,e-2)-1||(l==a/2||l==0)&&(r[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=(n||t<4)&&l==9999||!n&&t>3&&l==4999):o=((n||t<4)&&l+1==a||!n&&t>3&&l+1==a/2)&&(r[i+1]/a/1e3|0)==Wr(10,e-3)-1,o}function Wf(r,e,t){for(var n,i=[0],a,o=0,l=r.length;o<l;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Rh.indexOf(r.charAt(o++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function TV(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/Qf(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Gs(r,1,e.times(i),new r(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return r.precision-=t,e}var yr=function(){function r(n,i,a){var o,l=0,u=n.length;for(n=n.slice();u--;)o=n[u]*i+l,n[u]=o%a|0,l=o/a|0;return l&&n.unshift(l),n}function e(n,i,a,o){var l,u;if(a!=o)u=a>o?1:-1;else for(l=u=0;l<a;l++)if(n[l]!=i[l]){u=n[l]>i[l]?1:-1;break}return u}function t(n,i,a,o){for(var l=0;a--;)n[a]-=l,l=n[a]<i[a]?1:0,n[a]=l*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,l,u){var s,c,f,p,m,h,d,g,v,w,y,x,_,b,D,S,A,E,M,F,P=n.constructor,k=n.s==i.s?1:-1,O=n.d,I=i.d;if(!O||!O[0]||!I||!I[0])return new P(!n.s||!i.s||(O?I&&O[0]==I[0]:!I)?NaN:O&&O[0]==0||!I?k*0:k/0);for(u?(m=1,c=n.e-i.e):(u=Pi,m=dt,c=vn(n.e/m)-vn(i.e/m)),M=I.length,A=O.length,v=new P(k),w=v.d=[],f=0;I[f]==(O[f]||0);f++);if(I[f]>(O[f]||0)&&c--,a==null?(b=a=P.precision,o=P.rounding):l?b=a+(n.e-i.e)+1:b=a,b<0)w.push(1),h=!0;else{if(b=b/m+2|0,f=0,M==1){for(p=0,I=I[0],b++;(f<A||p)&&b--;f++)D=p*u+(O[f]||0),w[f]=D/I|0,p=D%I|0;h=p||f<A}else{for(p=u/(I[0]+1)|0,p>1&&(I=r(I,p,u),O=r(O,p,u),M=I.length,A=O.length),S=M,y=O.slice(0,M),x=y.length;x<M;)y[x++]=0;F=I.slice(),F.unshift(0),E=I[0],I[1]>=u/2&&++E;do p=0,s=e(I,y,M,x),s<0?(_=y[0],M!=x&&(_=_*u+(y[1]||0)),p=_/E|0,p>1?(p>=u&&(p=u-1),d=r(I,p,u),g=d.length,x=y.length,s=e(d,y,g,x),s==1&&(p--,t(d,M<g?F:I,g,u))):(p==0&&(s=p=1),d=I.slice()),g=d.length,g<x&&d.unshift(0),t(y,d,x,u),s==-1&&(x=y.length,s=e(I,y,M,x),s<1&&(p++,t(y,M<x?F:I,x,u))),x=y.length):s===0&&(p++,y=[0]),w[f++]=p,s&&y[0]?y[x++]=O[S]||0:(y=[O[S]],x=1);while((S++<A||y[0]!==void 0)&&b--);h=y[0]!==void 0}w[0]||w.shift()}if(m==1)v.e=c,NS=h;else{for(f=1,p=w[0];p>=10;p/=10)f++;v.e=f+c*m-1,lt(v,l?a+v.e+1:a,o,h)}return v}}();function lt(r,e,t,n){var i,a,o,l,u,s,c,f,p,m=r.constructor;e:if(e!=null){if(f=r.d,!f)return r;for(i=1,l=f[0];l>=10;l/=10)i++;if(a=e-i,a<0)a+=dt,o=e,c=f[p=0],u=c/Wr(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/dt),l=f.length,p>=l)if(n){for(;l++<=p;)f.push(0);c=u=0,i=1,a%=dt,o=a-dt+1}else break e;else{for(c=l=f[p],i=1;l>=10;l/=10)i++;a%=dt,o=a-dt+i,u=o<0?0:c/Wr(10,i-o-1)%10|0}if(n=n||e<0||f[p+1]!==void 0||(o<0?c:c%Wr(10,i-o-1)),s=t<4?(u||n)&&(t==0||t==(r.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(a>0?o>0?c/Wr(10,i-o):0:f[p-1])%10&1||t==(r.s<0?8:7)),e<1||!f[0])return f.length=0,s?(e-=r.e+1,f[0]=Wr(10,(dt-e%dt)%dt),r.e=-e||0):f[0]=r.e=0,r;if(a==0?(f.length=p,l=1,p--):(f.length=p+1,l=Wr(10,dt-a),f[p]=o>0?(c/Wr(10,i-o)%Wr(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&&(r.e++,f[0]==Pi&&(f[0]=1));break}else{if(f[p]+=l,f[p]!=Pi)break;f[p--]=0,l=1}for(a=f.length;f[--a]===0;)f.pop()}return Et&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}function Ji(r,e,t){if(!r.isFinite())return OS(r);var n,i=r.e,a=pn(r.d),o=a.length;return e?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+Wa(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r.e<0?"e":"e+")+r.e):i<0?(a="0."+Wa(-i-1)+a,t&&(n=t-o)>0&&(a+=Wa(n))):i>=o?(a+=Wa(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+Wa(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=Wa(n))),a}function Xf(r,e){var t=r[0];for(e*=dt;t>=10;t/=10)e++;return e}function Jf(r,e,t){if(e>MV)throw Et=!0,t&&(r.precision=t),Error(CS);return lt(new r(jf),e,1,!0)}function Bi(r,e,t){if(e>Lh)throw Error(CS);return lt(new r(Zf),e,t,!0)}function IS(r){var e=r.length-1,t=e*dt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Wa(r){for(var e="";r--;)e+="0";return e}function BS(r,e,t,n){var i,a=new r(1),o=Math.ceil(n/dt+4);for(Et=!1;;){if(t%2&&(a=a.times(e),ES(a.d,o)&&(i=!0)),t=vn(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),ES(e.d,o)}return Et=!0,a}function DS(r){return r.d[r.d.length-1]&1}function PS(r,e,t){for(var n,i=new r(e[0]),a=0;++a<e.length;)if(n=new r(e[a]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Uh(r,e){var t,n,i,a,o,l,u,s=0,c=0,f=0,p=r.constructor,m=p.rounding,h=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(Et=!1,u=h):u=e,l=new p(.03125);r.e>-2;)r=r.times(l),f+=5;for(n=Math.log(Wr(2,f))/Math.LN10*2+5|0,u+=n,t=a=o=new p(1),p.precision=u;;){if(a=lt(a.times(r),u,1),t=t.times(++c),l=o.plus(yr(a,t,u,1)),pn(l.d).slice(0,u)===pn(o.d).slice(0,u)){for(i=f;i--;)o=lt(o.times(o),u,1);if(e==null)if(s<3&&il(o.d,u-n,m,s))p.precision=u+=10,t=a=l=new p(1),c=0,s++;else return lt(o,p.precision=h,m,Et=!0);else return p.precision=h,o}o=l}}function ja(r,e){var t,n,i,a,o,l,u,s,c,f,p,m=1,h=10,d=r,g=d.d,v=d.constructor,w=v.rounding,y=v.precision;if(d.s<0||!g||!g[0]||!d.e&&g[0]==1&&g.length==1)return new v(g&&!g[0]?-1/0:d.s!=1?NaN:g?0:d);if(e==null?(Et=!1,c=y):c=e,v.precision=c+=h,t=pn(g),n=t.charAt(0),Math.abs(a=d.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)d=d.times(r),t=pn(d.d),n=t.charAt(0),m++;a=d.e,n>1?(d=new v("0."+t),a++):d=new v(n+"."+t.slice(1))}else return s=Jf(v,c+2,y).times(a+""),d=ja(new v(n+"."+t.slice(1)),c-h).plus(s),v.precision=y,e==null?lt(d,y,w,Et=!0):d;for(f=d,u=o=d=yr(d.minus(1),d.plus(1),c,1),p=lt(d.times(d),c,1),i=3;;){if(o=lt(o.times(p),c,1),s=u.plus(yr(o,new v(i),c,1)),pn(s.d).slice(0,c)===pn(u.d).slice(0,c))if(u=u.times(2),a!==0&&(u=u.plus(Jf(v,c+2,y).times(a+""))),u=yr(u,new v(m),c,1),e==null)if(il(u.d,c-h,w,l))v.precision=c+=h,s=o=d=yr(f.minus(1),f.plus(1),c,1),p=lt(d.times(d),c,1),i=l=1;else return lt(u,v.precision=y,w,Et=!0);else return v.precision=y,u;u=s,i+=2}}function OS(r){return String(r.s*r.s/0)}function Vh(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%dt,t<0&&(n+=dt),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=dt;n<i;)r.d.push(+e.slice(n,n+=dt));e=e.slice(n),n=dt-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),Et&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function FV(r,e){var t,n,i,a,o,l,u,s,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),FS.test(e))return Vh(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(SV.test(e))t=16,e=e.toLowerCase();else if(EV.test(e))t=2;else if(NV.test(e))t=8;else throw Error(Za+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,n=r.constructor,o&&(e=e.replace(".",""),l=e.length,a=l-a,i=BS(n,new n(t),a,a*2)),s=Wf(e,t,Pi),c=s.length-1,a=c;s[a]===0;--a)s.pop();return a<0?new n(r.s*0):(r.e=Xf(s,c),r.d=s,Et=!1,o&&(r=yr(r,i,l*4)),u&&(r=r.times(Math.abs(u)<54?Wr(2,u):al.pow(2,u))),Et=!0,r)}function IV(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Gs(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Qf(5,t)),e=Gs(r,2,e,e);for(var i,a=new r(5),o=new r(16),l=new r(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(l))));return e}function Gs(r,e,t,n,i){var a,o,l,u,s=1,c=r.precision,f=Math.ceil(c/dt);for(Et=!1,u=t.times(t),l=new r(n);;){if(o=yr(l.times(u),new r(e++*e++),c,1),l=i?n.plus(o):n.minus(o),n=yr(o.times(u),new r(e++*e++),c,1),o=l.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===l.d[a]&&a--;);if(a==-1)break}a=l,l=n,n=o,o=a,s++}return Et=!0,o.d.length=f+1,o}function Qf(r,e){for(var t=r;--e;)t*=r;return t}function RS(r,e){var t,n=e.s<0,i=Bi(r,r.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return ga=n?4:1,e;if(t=e.divToInt(i),t.isZero())ga=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return ga=DS(t)?n?2:3:n?4:1,e;ga=DS(t)?n?1:4:n?3:2}return e.minus(i).abs()}function qh(r,e,t,n){var i,a,o,l,u,s,c,f,p,m=r.constructor,h=t!==void 0;if(h?(Un(t,1,Ja),n===void 0?n=m.rounding:Un(n,0,8)):(t=m.precision,n=m.rounding),!r.isFinite())c=OS(r);else{for(c=Ji(r),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=Wf(Ji(p),10,i),p.e=p.d.length),f=Wf(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--:(r=new m(r),r.d=f,r.e=a,r=yr(r,p,t,n,0,i),f=r.d,a=r.e,s=NS),o=f[t],l=i/2,s=s||f[t+1]!==void 0,s=n<4?(o!==void 0||s)&&(n===0||n===(r.s<0?3:2)):o>l||o===l&&(n===4||s||n===6&&f[t-1]&1||n===(r.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="";o<u;o++)c+=Rh.charAt(f[o]);if(h){if(u>1)if(e==16||e==8){for(o=e==16?4:3,--u;u%o;u++)c+="0";for(f=Wf(c,i,e),u=f.length;!f[u-1];--u);for(o=1,c="1.";o<u;o++)c+=Rh.charAt(f[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return r.s<0?"-"+c:c}function ES(r,e){if(r.length>e)return r.length=e,!0}function BV(r){return new this(r).abs()}function PV(r){return new this(r).acos()}function OV(r){return new this(r).acosh()}function RV(r,e){return new this(r).plus(e)}function kV(r){return new this(r).asin()}function LV(r){return new this(r).asinh()}function UV(r){return new this(r).atan()}function VV(r){return new this(r).atanh()}function qV(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,a=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Bi(this,a,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Bi(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Bi(this,a,1).times(.5),t.s=r.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(yr(r,e,a,1)),e=Bi(this,a,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(yr(r,e,a,1)),t}function zV(r){return new this(r).cbrt()}function $V(r){return lt(r=new this(r),r.e+1,2)}function HV(r,e,t){return new this(r).clamp(e,t)}function GV(r){if(!r||typeof r!="object")throw Error(Yf+"Object expected");var e,t,n,i=r.defaults===!0,a=["precision",1,Ja,"rounding",0,8,"toExpNeg",-Hs,0,"toExpPos",0,Hs,"maxE",0,Hs,"minE",-Hs,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(t=a[e],i&&(this[t]=kh[t]),(n=r[t])!==void 0)if(vn(n)===n&&n>=a[e+1]&&n<=a[e+2])this[t]=n;else throw Error(Za+t+": "+n);if(t="crypto",i&&(this[t]=kh[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(MS);else this[t]=!1;else throw Error(Za+t+": "+n);return this}function WV(r){return new this(r).cos()}function jV(r){return new this(r).cosh()}function kS(r){var e,t,n;function i(a){var o,l,u,s=this;if(!(s instanceof i))return new i(a);if(s.constructor=i,SS(a)){s.s=a.s,Et?!a.d||a.e>i.maxE?(s.e=NaN,s.d=null):a.e<i.minE?(s.e=0,s.d=[0]):(s.e=a.e,s.d=a.d.slice()):(s.e=a.e,s.d=a.d?a.d.slice():a.d);return}if(u=typeof a,u==="number"){if(a===0){s.s=1/a<0?-1:1,s.e=0,s.d=[0];return}if(a<0?(a=-a,s.s=-1):s.s=1,a===~~a&&a<1e7){for(o=0,l=a;l>=10;l/=10)o++;Et?o>i.maxE?(s.e=NaN,s.d=null):o<i.minE?(s.e=0,s.d=[0]):(s.e=o,s.d=[a]):(s.e=o,s.d=[a]);return}else if(a*0!==0){a||(s.s=NaN),s.e=NaN,s.d=null;return}return Vh(s,a.toString())}else if(u!=="string")throw Error(Za+a);return(l=a.charCodeAt(0))===45?(a=a.slice(1),s.s=-1):(l===43&&(a=a.slice(1)),s.s=1),FS.test(a)?Vh(s,a):FV(s,a)}if(i.prototype=Ie,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=GV,i.clone=kS,i.isDecimal=SS,i.abs=BV,i.acos=PV,i.acosh=OV,i.add=RV,i.asin=kV,i.asinh=LV,i.atan=UV,i.atanh=VV,i.atan2=qV,i.cbrt=zV,i.ceil=$V,i.clamp=HV,i.cos=WV,i.cosh=jV,i.div=ZV,i.exp=JV,i.floor=YV,i.hypot=XV,i.ln=QV,i.log=KV,i.log10=t7,i.log2=e7,i.max=r7,i.min=n7,i.mod=i7,i.mul=a7,i.pow=o7,i.random=s7,i.round=u7,i.sign=l7,i.sin=c7,i.sinh=f7,i.sqrt=p7,i.sub=m7,i.sum=d7,i.tan=h7,i.tanh=g7,i.trunc=v7,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function ZV(r,e){return new this(r).div(e)}function JV(r){return new this(r).exp()}function YV(r){return lt(r=new this(r),r.e+1,3)}function XV(){var r,e,t=new this(0);for(Et=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Et=!0,new this(1/0);t=e}return Et=!0,t.sqrt()}function SS(r){return r instanceof al||r&&r.toStringTag===TS||!1}function QV(r){return new this(r).ln()}function KV(r,e){return new this(r).log(e)}function e7(r){return new this(r).log(2)}function t7(r){return new this(r).log(10)}function r7(){return PS(this,arguments,"lt")}function n7(){return PS(this,arguments,"gt")}function i7(r,e){return new this(r).mod(e)}function a7(r,e){return new this(r).mul(e)}function o7(r,e){return new this(r).pow(e)}function s7(r){var e,t,n,i,a=0,o=new this(1),l=[];if(r===void 0?r=this.precision:Un(r,1,Ja),n=Math.ceil(r/dt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:l[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);a<n;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(l.push(i%1e7),a+=4);a=n/4}else throw Error(MS);else for(;a<n;)l[a++]=Math.random()*1e7|0;for(n=l[--a],r%=dt,n&&r&&(i=Wr(10,dt-r),l[a]=(n/i|0)*i);l[a]===0;a--)l.pop();if(a<0)t=0,l=[0];else{for(t=-1;l[0]===0;t-=dt)l.shift();for(n=1,i=l[0];i>=10;i/=10)n++;n<dt&&(t-=dt-n)}return o.e=t,o.d=l,o}function u7(r){return lt(r=new this(r),r.e+1,this.rounding)}function l7(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function c7(r){return new this(r).sin()}function f7(r){return new this(r).sinh()}function p7(r){return new this(r).sqrt()}function m7(r,e){return new this(r).sub(e)}function d7(){var r=0,e=arguments,t=new this(e[r]);for(Et=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return Et=!0,lt(t,this.precision,this.rounding)}function h7(r){return new this(r).tan()}function g7(r){return new this(r).tanh()}function v7(r){return lt(r=new this(r),r.e+1,1)}Ie[Symbol.for("nodejs.util.inspect.custom")]=Ie.toString;Ie[Symbol.toStringTag]="Decimal";var al=Ie.constructor=kS(kh);jf=new al(jf);Zf=new al(Zf);var ko=al;var y7="BigNumber",b7=["?on","config"],zh=N(y7,b7,r=>{var{on:e,config:t}=r,n=ko.clone({precision:t.precision,modulo:ko.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var Kr=ur(US(),1);var x7="Complex",w7=[],Hh=N(x7,w7,()=>(Object.defineProperty(Kr.default,"name",{value:"Complex"}),Kr.default.prototype.constructor=Kr.default,Kr.default.prototype.type="Complex",Kr.default.prototype.isComplex=!0,Kr.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Kr.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Kr.default.prototype.format=function(r){var e="",t=this.im,n=this.re,i=Fi(this.re,r),a=Fi(this.im,r),o=it(r)?r:r?r.precision:null;if(o!==null){var l=Math.pow(10,-o);Math.abs(n/t)<l&&(n=0),Math.abs(t/n)<l&&(t=0)}return t===0?e=i:n===0?t===1?e="i":t===-1?e="-i":e=a+"i":t<0?t===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+a+"i",e},Kr.default.fromPolar=function(r){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,Kr.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],n=arguments[1];if(it(t)){if(un(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),it(n))return new Kr.default({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Kr.default.prototype.valueOf=Kr.default.prototype.toString,Kr.default.fromJSON=function(r){return new Kr.default(r)},Kr.default.compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},Kr.default),{isClass:!0});var Yi=ur(qS(),1);var _7="Fraction",A7=[],Wh=N(_7,A7,()=>(Object.defineProperty(Yi.default,"name",{value:"Fraction"}),Yi.default.prototype.constructor=Yi.default,Yi.default.prototype.type="Fraction",Yi.default.prototype.isFraction=!0,Yi.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Yi.default.fromJSON=function(r){return new Yi.default(r)},Yi.default),{isClass:!0});var D7="Range",E7=[],jh=N(D7,E7,()=>{function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=n!=null;if(i){if(rt(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(rt(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(rt(n))n=n.toNumber();else if(typeof n!="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(n):1}return r.prototype.type="Range",r.prototype.isRange=!0,r.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),n=t.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new r(n[0],n[1]);case 3:return new r(n[0],n[2],n[1]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.end,this.step)},r.prototype.size=function(){var e=0,t=this.start,n=this.step,i=this.end,a=i-t;return hi(n)===hi(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},r.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},r.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},r.prototype.forEach=function(e){var t=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;t<i;)e(t,[a],this),t+=n,a++;else if(n<0)for(;t>i;)e(t,[a],this),t+=n,a++},r.prototype.map=function(e){var t=[];return this.forEach(function(n,i,a){t[i[0]]=e(n,i,a)}),t},r.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n[0]]=t}),e},r.prototype.valueOf=function(){return this.toArray()},r.prototype.format=function(e){var t=Fi(this.start,e);return this.step!==1&&(t+=":"+Fi(this.step,e)),t+=":"+Fi(this.end,e),t},r.prototype.toString=function(){return this.format()},r.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},r.fromJSON=function(e){return new r(e.start,e.end,e.step)},r},{isClass:!0});var S7="Matrix",N7=[],Zh=N(S7,N7,()=>{function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function zS(r){var e=0,t=1,n=Object.create(null),i=Object.create(null),a=0,o=function(u){var s=i[u];if(s&&(delete n[s],delete i[u],--e,t===s)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return r=Math.abs(r),{hit:function(u){var s=i[u],c=++a;if(n[c]=u,i[u]=c,!s)return++e,e<=r?void 0:(u=n[t],o(u),u);if(delete n[s],t===s)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:o,clear:function(){e=a=0,t=1,n=Object.create(null),i=Object.create(null)}}}function Lo(r){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 n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:zS(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var l=r.apply(r,i);return n.cache.values.set(o,l),n.cache.values.delete(n.cache.lru.hit(o)),l}}function Kf(r){return Object.keys(r.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var C7="DenseMatrix",M7=["Matrix"],Jh=N(C7,M7,r=>{var{Matrix:e}=r;function t(c,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!wr(f))throw new Error("Invalid datatype: "+f);if(Ge(c))c.type==="DenseMatrix"?(this._data=Qe(c._data),this._size=Qe(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&Tt(c.data)&&Tt(c.size))this._data=c.data,this._size=c.size,Sh(this._data,this._size),this._datatype=f||c.datatype;else if(Tt(c))this._data=s(c),this._size=tt(this._data),Sh(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+Ct(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 Ga(this._data,Ct)},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 n(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(!Tt(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new st(c.length,this._size.length);for(var f=0;f<c.length;f++)Gt(c[f],this._size[f]);for(var p=this._data,m=0,h=c.length;m<h;m++){var d=c[m];Gt(d,p.length),p=p[d]}return p},t.prototype.set=function(c,f,p){if(!Tt(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new st(c.length,this._size.length,"<");var m,h,d,g=c.map(function(w){return w+1});u(this,g,p);var v=this._data;for(m=0,h=c.length-1;m<h;m++)d=c[m],Gt(d,v.length),v=v[d];return d=c[c.length-1],Gt(d,v.length),v[d]=f,this};function n(c,f){if(!za(f))throw new TypeError("Invalid index");var p=f.isScalar();if(p)return c.get(f.min());var m=f.size();if(m.length!==c._size.length)throw new st(m.length,c._size.length);for(var h=f.min(),d=f.max(),g=0,v=c._size.length;g<v;g++)Gt(h[g],c._size[g]),Gt(d[g],c._size[g]);return new t(i(c._data,f,m.length,0),c._datatype)}function i(c,f,p,m){var h=m===p-1,d=f.dimension(m);return h?d.map(function(g){return Gt(g,c.length),c[g]}).valueOf():d.map(function(g){Gt(g,c.length);var v=c[g];return i(v,f,p,m+1)}).valueOf()}function a(c,f,p,m){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var h=f.size(),d=f.isScalar(),g;if(Ge(p)?(g=p.size(),p=p.valueOf()):g=tt(p),d){if(g.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),p,m)}else{if(!Ti(g,h))try{g.length===0?p=Mh([p],h):p=Mh(p,h),g=tt(p)}catch(b){}if(h.length<c._size.length)throw new st(h.length,c._size.length,"<");if(g.length<h.length){for(var v=0,w=0;h[v]===1&&g[v]===1;)v++;for(;h[v]===1;)w++,v++;p=qf(p,h.length,w,g)}if(!Ti(h,g))throw new st(h,g,">");var y=f.max().map(function(b){return b+1});u(c,y,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(v,w){Gt(v),c[v]=p[w[0]]}):g.forEach(function(v,w){Gt(v),o(c[v],f,p[w[0]],m,h+1)})}t.prototype.resize=function(c,f,p){if(!Er(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;Tt(m);)m=m[0];return m}return c._size=f.slice(0),c._data=Ii(c._data,c._size,p),c}t.prototype.reshape=function(c,f){var p=f?this.clone():this;p._data=el(p._data,c);var m=p._size.reduce((h,d)=>h*d);return p._size=tl(c,m),p};function u(c,f,p){for(var m=c._size.slice(0),h=!1;m.length<f.length;)m.push(0),h=!0;for(var d=0,g=f.length;d<g;d++)f[d]>m[d]&&(m[d]=f[d],h=!0);h&&l(c,m,p)}t.prototype.clone=function(){var c=new t({data:Qe(this._data),size:Qe(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=Kf(c),m=function g(v,w){return Tt(v)?v.map(function(y,x){return g(y,w.concat(x))}):p===1?c(v):p===2?c(v,w):c(v,w,f)},h=m(this._data,[]),d=this._datatype!==void 0?Ga(h,Ct):void 0;return new t(h,d)},t.prototype.forEach=function(c){var f=this,p=function m(h,d){Tt(h)?h.forEach(function(g,v){m(g,d.concat(v))}):c(h,d,f)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var c=function*f(p,m){if(Tt(p))for(var h=0;h<p.length;h++)yield*f(p[h],m.concat(h));else yield{value:p,index:m}};yield*c(this._data,[])},t.prototype.rows=function(){var c=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var m of p)c.push(new t([m],this._datatype));return c},t.prototype.columns=function(){var c=this,f=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var m=this._data,h=function(v){var w=m.map(y=>[y[v]]);f.push(new t(w,c._datatype))},d=0;d<p[1];d++)h(d);return f},t.prototype.toArray=function(){return Qe(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(c){return at(this._data,c)},t.prototype.toString=function(){return at(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(c){if(c){if(rt(c)&&(c=c.toNumber()),!it(c)||!$e(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var f=c>0?c:0,p=c<0?-c:0,m=this._size[0],h=this._size[1],d=Math.min(m-p,h-f),g=[],v=0;v<d;v++)g[v]=this._data[v+p][v+f];return new t({data:g,size:[d],datatype:this._datatype})},t.diagonal=function(c,f,p,m){if(!Tt(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(D){if(rt(D)&&(D=D.toNumber()),!it(D)||!$e(D)||D<1)throw new Error("Size values must be positive integers");return D}),p){if(rt(p)&&(p=p.toNumber()),!it(p)||!$e(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var h=p>0?p:0,d=p<0?-p:0,g=c[0],v=c[1],w=Math.min(g-d,v-h),y;if(Tt(f)){if(f.length!==w)throw new Error("Invalid value array length");y=function(S){return f[S]}}else if(Ge(f)){var x=f.size();if(x.length!==1||x[0]!==w)throw new Error("Invalid matrix length");y=function(S){return f.get([S])}}else y=function(){return f};m||(m=rt(y(0))?y(0).mul(0):0);var _=[];if(c.length>0){_=Ii(_,c,m);for(var b=0;b<w;b++)_[b+d][b+h]=y(b)}return new t({data:_,size:[g,v]})},t.fromJSON=function(c){return new t(c)},t.prototype.swapRows=function(c,f){if(!it(c)||!$e(c)||!it(f)||!$e(f))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Gt(c,this._size[0]),Gt(f,this._size[0]),t._swapRows(c,f,this._data),this},t._swapRows=function(c,f,p){var m=p[c];p[c]=p[f],p[f]=m};function s(c){return Ge(c)?s(c.valueOf()):Tt(c)?c.map(s):c}return t},{isClass:!0});var $S="clone",T7=["typed"],Yh=N($S,T7,r=>{var{typed:e}=r;return e($S,{any:Qe})});function ep(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}function gi(r){for(var e=0;e<r.length;e++)if(Er(r[e]))return!0;return!1}function yn(r,e){Ge(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?yn(i,e):e(i)}}function Je(r,e,t){return r&&typeof r.map=="function"?r.map(function(n){return Je(n,e,t)}):e(r)}function Ya(r,e,t){var n=Array.isArray(r)?tt(r):r.size();if(e<0||e>=n.length)throw new fn(e,n.length);return Ge(r)?r.create(tp(r.valueOf(),e,t)):tp(r,e,t)}function tp(r,e,t){var n,i,a,o;if(e<=0)if(Array.isArray(r[0])){for(o=ep(r),i=[],n=0;n<o.length;n++)i[n]=tp(o[n],e-1,t);return i}else{for(a=r[0],n=1;n<r.length;n++)a=t(a,r[n]);return a}else{for(i=[],n=0;n<r.length;n++)i[n]=tp(r[n],e-1,t);return i}}function Xh(r,e,t,n,i,a,o,l,u,s,c){var f=r._values,p=r._index,m=r._ptr,h,d,g,v;if(n)for(d=m[e],g=m[e+1],h=d;h<g;h++)v=p[h],t[v]!==a?(t[v]=a,o.push(v),s?(n[v]=u?l(f[h],c):l(c,f[h]),i[v]=a):n[v]=f[h]):(n[v]=u?l(f[h],n[v]):l(n[v],f[h]),i[v]=a);else for(d=m[e],g=m[e+1],h=d;h<g;h++)v=p[h],t[v]!==a?(t[v]=a,o.push(v)):i[v]=a}var HS="isInteger",F7=["typed"],Qh=N(HS,F7,r=>{var{typed:e}=r;return e(HS,{number:$e,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var Vn="number",va="number, number";function Kh(r){return Math.abs(r)}Kh.signature=Vn;function eg(r,e){return r+e}eg.signature=va;function tg(r,e){return r-e}tg.signature=va;function rg(r,e){return r*e}rg.signature=va;function I7(r,e){return r/e}I7.signature=va;function ng(r){return-r}ng.signature=Vn;function ig(r){return r}ig.signature=Vn;function Ws(r){return KE(r)}Ws.signature=Vn;function ag(r){return r*r*r}ag.signature=Vn;function og(r){return Math.exp(r)}og.signature=Vn;function sg(r){return eS(r)}sg.signature=Vn;function B7(r,e){if(!$e(r)||!$e(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=r%e,r=e,e=t;return r<0?-r:r}B7.signature=va;function ug(r,e){if(!$e(r)||!$e(e))throw new Error("Parameters in function lcm must be integer numbers");if(r===0||e===0)return 0;for(var t,n=r*e;e!==0;)t=e,e=r%t,r=t;return Math.abs(n/r)}ug.signature=va;function GS(r,e){return e?Math.log(r)/Math.log(e):Math.log(r)}function lg(r){return QE(r)}lg.signature=Vn;function cg(r){return XE(r)}cg.signature=Vn;function P7(r){return Of(r)}P7.signature=Vn;function O7(r,e){return e===0?r:r-e*Math.floor(r/e)}O7.signature=va;function fg(r){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(r<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(r===0)return t?1/0:0;if(!isFinite(r))return t?0:r;var n=Math.pow(Math.abs(r),1/e);return n=r<0?-n:n,t?1/n:n}function rp(r){return hi(r)}rp.signature=Vn;function R7(r){return Math.sqrt(r)}R7.signature=Vn;function pg(r){return r*r}pg.signature=Vn;function mg(r,e){var t,n,i,a=0,o=1,l=1,u=0;if(!$e(r)||!$e(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=a,a=o-n*a,o=t,t=l,l=u-n*l,u=t,r=e,e=i;var s;return r<0?s=[-r,-o,-u]:s=[r,r?o:0,u],s}mg.signature=va;function dg(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}dg.signature=va;function hg(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!$e(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(Ah(r,e))}function k7(r){return Math.abs(r)}k7.signature=Vn;var L7="number",js="number, number";function gg(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function bitAnd");return r&e}gg.signature=js;function vg(r){if(!$e(r))throw new Error("Integer expected in function bitNot");return~r}vg.signature=L7;function yg(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function bitOr");return r|e}yg.signature=js;function bg(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function bitXor");return r^e}bg.signature=js;function xg(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function leftShift");return r<<e}xg.signature=js;function wg(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function rightArithShift");return r>>e}wg.signature=js;function _g(r,e){if(!$e(r)||!$e(e))throw new Error("Integers expected in function rightLogShift");return r>>>e}_g.signature=js;function ni(r,e){if(e<r)return 1;if(e===r)return e;var t=e+r>>1;return ni(r,t)*ni(t+1,e)}function Ag(r,e){if(!$e(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(!$e(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>r)throw new TypeError("k must be less than or equal to n");for(var t=r-e,n=1,i=e<t?t+1:e+1,a=2,o=e<t?e:t,l=i;l<=r;++l)for(n*=l;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=ni(a,o)),n}Ag.signature="number, number";var WS=Math.PI,jS=2*Math.PI,ZS=Math.E,JS=1.618033988749895;var U7="number",Dg="number, number";function Eg(r){return!r}Eg.signature=U7;function Sg(r,e){return!!(r||e)}Sg.signature=Dg;function Ng(r,e){return!!r!=!!e}Ng.signature=Dg;function Cg(r,e){return!!(r&&e)}Cg.signature=Dg;function ol(r){var e;if($e(r))return r<=0?isFinite(r)?1/0:NaN:r>171?1/0:ni(1,r-1);if(r<.5)return Math.PI/(Math.sin(Math.PI*r)*ol(1-r));if(r>=171.35)return 1/0;if(r>85){var t=r*r,n=t*r,i=n*r,a=i*r;return Math.sqrt(2*Math.PI/r)*Math.pow(r/Math.E,r)*(1+1/(12*r)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*r))}--r,e=Uo[0];for(var o=1;o<Uo.length;++o)e+=Uo[o]/(r+o);var l=r+Mg+.5;return Math.sqrt(2*Math.PI)*Math.pow(l,r+.5)*Math.exp(-l)*e}ol.signature="number";var Mg=4.7421875,Uo=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Tg=.9189385332046728,V7=5,q7=7,YS=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function sl(r){if(r<0)return NaN;if(r===0)return 1/0;if(!isFinite(r))return r;if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-sl(1-r);r=r-1;for(var e=r+V7+.5,t=YS[0],n=q7-1;n>=1;n--)t+=YS[n]/(r+n);return Tg+(r+.5)*Math.log(e)-e+Math.log(t)}sl.signature="number";var _r="number",z7="number, number";function $7(r){return Math.acos(r)}$7.signature=_r;function Fg(r){return nS(r)}Fg.signature=_r;function Ig(r){return Math.atan(1/r)}Ig.signature=_r;function Bg(r){return isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0}Bg.signature=_r;function Pg(r){return Math.asin(1/r)}Pg.signature=_r;function Og(r){var e=1/r;return Math.log(e+Math.sqrt(e*e+1))}Og.signature=_r;function Rg(r){return Math.acos(1/r)}Rg.signature=_r;function kg(r){var e=1/r,t=Math.sqrt(e*e-1);return Math.log(t+e)}kg.signature=_r;function H7(r){return Math.asin(r)}H7.signature=_r;function Lg(r){return iS(r)}Lg.signature=_r;function G7(r){return Math.atan(r)}G7.signature=_r;function W7(r,e){return Math.atan2(r,e)}W7.signature=z7;function Ug(r){return aS(r)}Ug.signature=_r;function j7(r){return Math.cos(r)}j7.signature=_r;function Z7(r){return Lf(r)}Z7.signature=_r;function Vg(r){return 1/Math.tan(r)}Vg.signature=_r;function qg(r){var e=Math.exp(2*r);return(e+1)/(e-1)}qg.signature=_r;function zg(r){return 1/Math.sin(r)}zg.signature=_r;function $g(r){return r===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*hi(r)}$g.signature=_r;function Hg(r){return 1/Math.cos(r)}Hg.signature=_r;function Gg(r){return 2/(Math.exp(r)+Math.exp(-r))}Gg.signature=_r;function J7(r){return Math.sin(r)}J7.signature=_r;function Wg(r){return oS(r)}Wg.signature=_r;function Y7(r){return Math.tan(r)}Y7.signature=_r;function X7(r){return Uf(r)}X7.signature=_r;var ul="number";function Q7(r){return $e(r)}Q7.signature=ul;function jg(r){return r<0}jg.signature=ul;function Zg(r){return r>0}Zg.signature=ul;function Jg(r){return r===0}Jg.signature=ul;function Yg(r){return Number.isNaN(r)}Yg.signature=ul;var XS="isNegative",K7=["typed"],Xg=N(XS,K7,r=>{var{typed:e}=r;return e(XS,{number:jg,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var QS="isNumeric",e9=["typed"],Qg=N(QS,e9,r=>{var{typed:e}=r;return e(QS,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var KS="hasNumericValue",t9=["typed","isNumeric"],Kg=N(KS,t9,r=>{var{typed:e,isNumeric:t}=r;return e(KS,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var eN="isPositive",r9=["typed"],ev=N(eN,r9,r=>{var{typed:e}=r;return e(eN,{number:Zg,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var tN="isZero",n9=["typed"],tv=N(tN,n9,r=>{var{typed:e}=r;return e(tN,{number:Jg,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var rN="isNaN",i9=["typed"],rv=N(rN,i9,r=>{var{typed:e}=r;return e(rN,{number:Yg,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return Je(n,Number.isNaN)}})});var nN="typeOf",a9=["typed"],nv=N(nN,a9,r=>{var{typed:e}=r;return e(nN,{any:Ct})});function en(r,e,t){if(t==null)return r.eq(e);if(r.eq(e))return!0;if(r.isNaN()||e.isNaN())return!1;if(r.isFinite()&&e.isFinite()){var n=r.minus(e).abs();if(n.isZero())return!0;var i=r.constructor.max(r.abs(),e.abs());return n.lte(i.times(t))}return!1}function iN(r,e,t){return Ir(r.re,e.re,t)&&Ir(r.im,e.im,t)}var vi=N("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[n.valueType(),i.valueType()])(n.value,i.value)})}});var np="equalScalar",o9=["typed","config"],iv=N(np,o9,r=>{var{typed:e,config:t}=r,n=vi({typed:e});return e(np,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Ir(a,o,t.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||en(a,o,t.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return iN(a,o,t.epsilon)}},n)}),ofe=N(np,["typed","config"],r=>{var{typed:e,config:t}=r;return e(np,{"number, number":function(i,a){return Ir(i,a,t.epsilon)}})});var s9="SparseMatrix",u9=["typed","equalScalar","Matrix"],av=N(s9,u9,r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(d,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!wr(g))throw new Error("Invalid datatype: "+g);if(Ge(d))a(this,d,g);else if(d&&Tt(d.index)&&Tt(d.ptr)&&Tt(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(Tt(d))o(this,d,g);else{if(d)throw new TypeError("Unsupported type of data ("+Ct(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(d,g,v){g.type==="SparseMatrix"?(d._values=g._values?Qe(g._values):void 0,d._index=Qe(g._index),d._ptr=Qe(g._ptr),d._size=Qe(g._size),d._datatype=v||g._datatype):o(d,g.valueOf(),v||g._datatype)}function o(d,g,v){d._values=[],d._index=[],d._ptr=[],d._datatype=v;var w=g.length,y=0,x=t,_=0;if(wr(v)&&(x=e.find(t,[v,v])||t,_=e.convert(0,v)),w>0){var b=0;do{d._ptr.push(d._index.length);for(var D=0;D<w;D++){var S=g[D];if(Tt(S)){if(b===0&&y<S.length&&(y=S.length),b<S.length){var A=S[b];x(A,_)||(d._values.push(A),d._index.push(D))}}else b===0&&y<1&&(y=1),x(S,_)||(d._values.push(S),d._index.push(D))}b++}while(b<y)}d._ptr.push(d._index.length),d._size=[w,y]}i.prototype=new n,i.prototype.createSparseMatrix=function(d,g){return new i(d,g)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Ga(this._values,Ct)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(d,g){return new i(d,g)},i.prototype.density=function(){var d=this._size[0],g=this._size[1];return d!==0&&g!==0?this._index.length/(d*g):0},i.prototype.subset=function(d,g,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return l(this,d);case 2:case 3:return u(this,d,g,v);default:throw new SyntaxError("Wrong number of arguments")}};function l(d,g){if(!za(g))throw new TypeError("Invalid index");var v=g.isScalar();if(v)return d.get(g.min());var w=g.size();if(w.length!==d._size.length)throw new st(w.length,d._size.length);var y,x,_,b,D=g.min(),S=g.max();for(y=0,x=d._size.length;y<x;y++)Gt(D[y],d._size[y]),Gt(S[y],d._size[y]);var A=d._values,E=d._index,M=d._ptr,F=g.dimension(0),P=g.dimension(1),k=[],O=[];F.forEach(function(B,U){O[B]=U[0],k[B]=!0});var I=A?[]:void 0,T=[],q=[];return P.forEach(function(B){for(q.push(T.length),_=M[B],b=M[B+1];_<b;_++)y=E[_],k[y]===!0&&(T.push(O[y]),I&&I.push(A[_]))}),q.push(T.length),new i({values:I,index:T,ptr:q,size:w,datatype:d._datatype})}function u(d,g,v,w){if(!g||g.isIndex!==!0)throw new TypeError("Invalid index");var y=g.size(),x=g.isScalar(),_;if(Ge(v)?(_=v.size(),v=v.toArray()):_=tt(v),x){if(_.length!==0)throw new TypeError("Scalar expected");d.set(g.min(),v,w)}else{if(y.length!==1&&y.length!==2)throw new st(y.length,d._size.length,"<");if(_.length<y.length){for(var b=0,D=0;y[b]===1&&_[b]===1;)b++;for(;y[b]===1;)D++,b++;v=qf(v,y.length,D,_)}if(!Ti(y,_))throw new st(y,_,">");if(y.length===1){var S=g.dimension(0);S.forEach(function(M,F){Gt(M),d.set([M,0],v[F[0]],w)})}else{var A=g.dimension(0),E=g.dimension(1);A.forEach(function(M,F){Gt(M),E.forEach(function(P,k){Gt(P),d.set([M,P],v[F[0]][k[0]],w)})})}}return d}i.prototype.get=function(d){if(!Tt(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new st(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=d[0],v=d[1];Gt(g,this._size[0]),Gt(v,this._size[1]);var w=s(g,this._ptr[v],this._ptr[v+1],this._index);return w<this._ptr[v+1]&&this._index[w]===g?this._values[w]:0},i.prototype.set=function(d,g,v){if(!Tt(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new st(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var w=d[0],y=d[1],x=this._size[0],_=this._size[1],b=t,D=0;wr(this._datatype)&&(b=e.find(t,[this._datatype,this._datatype])||t,D=e.convert(0,this._datatype)),(w>x-1||y>_-1)&&(p(this,Math.max(w+1,x),Math.max(y+1,_),v),x=this._size[0],_=this._size[1]),Gt(w,x),Gt(y,_);var S=s(w,this._ptr[y],this._ptr[y+1],this._index);return S<this._ptr[y+1]&&this._index[S]===w?b(g,D)?c(S,y,this._values,this._index,this._ptr):this._values[S]=g:b(g,D)||f(S,w,y,g,this._values,this._index,this._ptr),this};function s(d,g,v,w){if(v-g===0)return v;for(var y=g;y<v;y++)if(w[y]===d)return y;return g}function c(d,g,v,w,y){v.splice(d,1),w.splice(d,1);for(var x=g+1;x<y.length;x++)y[x]--}function f(d,g,v,w,y,x,_){y.splice(d,0,w),x.splice(d,0,g);for(var b=v+1;b<_.length;b++)_[b]++}i.prototype.resize=function(d,g,v){if(!Er(d))throw new TypeError("Array or Matrix expected");var w=d.valueOf().map(x=>Array.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(!it(x)||!$e(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+at(w)+")")});var y=v?this.clone():this;return p(y,w[0],w[1],g)};function p(d,g,v,w){var y=w||0,x=t,_=0;wr(d._datatype)&&(x=e.find(t,[d._datatype,d._datatype])||t,_=e.convert(0,d._datatype),y=e.convert(y,d._datatype));var b=!x(y,_),D=d._size[0],S=d._size[1],A,E,M;if(v>S){for(E=S;E<v;E++)if(d._ptr[E]=d._values.length,b)for(A=0;A<D;A++)d._values.push(y),d._index.push(A);d._ptr[v]=d._values.length}else v<S&&(d._ptr.splice(v+1,S-v),d._values.splice(d._ptr[v],d._values.length),d._index.splice(d._ptr[v],d._index.length));if(S=v,g>D){if(b){var F=0;for(E=0;E<S;E++){d._ptr[E]=d._ptr[E]+F,M=d._ptr[E+1]+F;var P=0;for(A=D;A<g;A++,P++)d._values.splice(M+P,0,y),d._index.splice(M+P,0,A),F++}d._ptr[S]=d._values.length}}else if(g<D){var k=0;for(E=0;E<S;E++){d._ptr[E]=d._ptr[E]-k;var O=d._ptr[E],I=d._ptr[E+1]-k;for(M=O;M<I;M++)A=d._index[M],A>g-1&&(d._values.splice(M,1),d._index.splice(M,1),k++)}d._ptr[E]=d._values.length}return d._size[0]=g,d._size[1]=v,d}i.prototype.reshape=function(d,g){if(!Tt(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(!it(B)||!$e(B)||B<=-2||B===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+at(d)+")")});var v=this._size[0]*this._size[1];d=tl(d,v);var w=d[0]*d[1];if(v!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var y=g?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return y;for(var x=[],_=0;_<y._ptr.length;_++)for(var b=0;b<y._ptr[_+1]-y._ptr[_];b++)x.push(_);for(var D=y._values.slice(),S=y._index.slice(),A=0;A<y._index.length;A++){var E=S[A],M=x[A],F=E*y._size[1]+M;x[A]=F%d[1],S[A]=Math.floor(F/d[1])}y._values.length=0,y._index.length=0,y._ptr.length=d[1]+1,y._size=d.slice();for(var P=0;P<y._ptr.length;P++)y._ptr[P]=0;for(var k=0;k<D.length;k++){var O=S[k],I=x[k],T=D[k],q=s(O,y._ptr[I],y._ptr[I+1],y._index);f(q,O,I,T,y._values,y._index,y._ptr)}return y},i.prototype.clone=function(){var d=new i({values:this._values?Qe(this._values):void 0,index:Qe(this._index),ptr:Qe(this._ptr),size:Qe(this._size),datatype:this._datatype});return d},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(d,g){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,w=this._size[0],y=this._size[1],x=Kf(d),_=function(D,S,A){return x===1?d(D):x===2?d(D,[S,A]):d(D,[S,A],v)};return m(this,0,w-1,0,y-1,_,g)};function m(d,g,v,w,y,x,_){var b=[],D=[],S=[],A=t,E=0;wr(d._datatype)&&(A=e.find(t,[d._datatype,d._datatype])||t,E=e.convert(0,d._datatype));for(var M=function(L,ie,ve){L=x(L,ie,ve),A(L,E)||(b.push(L),D.push(ie))},F=w;F<=y;F++){S.push(b.length);var P=d._ptr[F],k=d._ptr[F+1];if(_)for(var O=P;O<k;O++){var I=d._index[O];I>=g&&I<=v&&M(d._values[O],I-g,F-w)}else{for(var T={},q=P;q<k;q++){var B=d._index[q];T[B]=d._values[q]}for(var U=g;U<=v;U++){var G=U in T?T[U]:0;M(G,U-g,F-w)}}}return S.push(b.length),new i({values:b,index:D,ptr:S,size:[v-g+1,y-w+1]})}i.prototype.forEach=function(d,g){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,w=this._size[0],y=this._size[1],x=0;x<y;x++){var _=this._ptr[x],b=this._ptr[x+1];if(g)for(var D=_;D<b;D++){var S=this._index[D];d(this._values[D],[S,x],v)}else{for(var A={},E=_;E<b;E++){var M=this._index[E];A[M]=this._values[E]}for(var F=0;F<w;F++){var P=F in A?A[F]:0;d(P,[F,x],v)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var d=this._size[1],g=0;g<d;g++)for(var v=this._ptr[g],w=this._ptr[g+1],y=v;y<w;y++){var x=this._index[y];yield{value:this._values[y],index:[x,g]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)};function h(d,g,v,w,y){var x=w[0],_=w[1],b=[],D,S;for(D=0;D<x;D++)for(b[D]=[],S=0;S<_;S++)b[D][S]=0;for(S=0;S<_;S++)for(var A=v[S],E=v[S+1],M=A;M<E;M++)D=g[M],b[D][S]=d?y?Qe(d[M]):d[M]:1;return b}return i.prototype.format=function(d){for(var g=this._size[0],v=this._size[1],w=this.density(),y="Sparse Matrix ["+at(g,d)+" x "+at(v,d)+"] density: "+at(w,d)+`
`,x=0;x<v;x++)for(var _=this._ptr[x],b=this._ptr[x+1],D=_;D<b;D++){var S=this._index[D];y+=`
(`+at(S,d)+", "+at(x,d)+") ==> "+(this._values?at(this._values[D],d):"X")}return y},i.prototype.toString=function(){return at(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(rt(d)&&(d=d.toNumber()),!it(d)||!$e(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var g=d>0?d:0,v=d<0?-d:0,w=this._size[0],y=this._size[1],x=Math.min(w-v,y-g),_=[],b=[],D=[];D[0]=0;for(var S=g;S<y&&_.length<x;S++)for(var A=this._ptr[S],E=this._ptr[S+1],M=A;M<E;M++){var F=this._index[M];if(F===S-g+v){_.push(this._values[M]),b[_.length-1]=F-v;break}}return D.push(_.length),new i({values:_,index:b,ptr:D,size:[x,1]})},i.fromJSON=function(d){return new i(d)},i.diagonal=function(d,g,v,w,y){if(!Tt(d))throw new TypeError("Array expected, size parameter");if(d.length!==2)throw new Error("Only two dimensions matrix are supported");if(d=d.map(function(B){if(rt(B)&&(B=B.toNumber()),!it(B)||!$e(B)||B<1)throw new Error("Size values must be positive integers");return B}),v){if(rt(v)&&(v=v.toNumber()),!it(v)||!$e(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var x=t,_=0;wr(y)&&(x=e.find(t,[y,y])||t,_=e.convert(0,y));var b=v>0?v:0,D=v<0?-v:0,S=d[0],A=d[1],E=Math.min(S-D,A-b),M;if(Tt(g)){if(g.length!==E)throw new Error("Invalid value array length");M=function(U){return g[U]}}else if(Ge(g)){var F=g.size();if(F.length!==1||F[0]!==E)throw new Error("Invalid matrix length");M=function(U){return g.get([U])}}else M=function(){return g};for(var P=[],k=[],O=[],I=0;I<A;I++){O.push(P.length);var T=I-b;if(T>=0&&T<E){var q=M(T);x(q,_)||(k.push(T+D),P.push(q))}}return O.push(P.length),new i({values:P,index:k,ptr:O,size:[S,A]})},i.prototype.swapRows=function(d,g){if(!it(d)||!$e(d)||!it(g)||!$e(g))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Gt(d,this._size[0]),Gt(g,this._size[0]),i._swapRows(d,g,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(d,g,v,w,y){for(var x=w[d],_=w[d+1],b=x;b<_;b++)y(v[b],g[b])},i._swapRows=function(d,g,v,w,y,x){for(var _=0;_<v;_++){var b=x[_],D=x[_+1],S=s(d,b,D,y),A=s(g,b,D,y);if(S<D&&A<D&&y[S]===d&&y[A]===g){if(w){var E=w[S];w[S]=w[A],w[A]=E}continue}if(S<D&&y[S]===d&&(A>=D||y[A]!==g)){var M=w?w[S]:void 0;y.splice(A,0,g),w&&w.splice(A,0,M),y.splice(A<=S?S+1:S,1),w&&w.splice(A<=S?S+1:S,1);continue}if(A<D&&y[A]===g&&(S>=D||y[S]!==d)){var F=w?w[A]:void 0;y.splice(S,0,d),w&&w.splice(S,0,F),y.splice(S<=A?A+1:A,1),w&&w.splice(S<=A?A+1:A,1)}}},i},{isClass:!0});var l9="number",c9=["typed"];function f9(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:r,radix:t,integerPart:n,fractionalPart:i}}else return null}function p9(r){for(var e=parseInt(r.integerPart,r.radix),t=0,n=0;n<r.fractionalPart.length;n++){var i=parseInt(r.fractionalPart[n],r.radix);t+=i/Math.pow(r.radix,n+1)}var a=e+t;if(isNaN(a))throw new SyntaxError('String "'+r.input+'" is not a valid number');return a}var ov=N(l9,c9,r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=f9(i);if(a)return p9(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(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var aN="string",m9=["typed"],sv=N(aN,m9,r=>{var{typed:e}=r;return e(aN,{"":function(){return""},number:Fi,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t)),any:function(n){return String(n)}})});var oN="boolean",d9=["typed"],uv=N(oN,d9,r=>{var{typed:e}=r;return e(oN,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var h9="bignumber",g9=["typed","BigNumber"],lv=N(h9,g9,r=>{var{typed:e,BigNumber:t}=r;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(n=>i=>{var a=i.clone();return a.value=n(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(n=>i=>Je(i,n))})});var v9="complex",y9=["typed","Complex"],cv=N(v9,y9,r=>{var{typed:e,Complex:t}=r;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(n=>i=>Je(i,n))})});var b9="fraction",x9=["typed","Fraction"],fv=N(b9,x9,r=>{var{typed:e,Fraction:t}=r;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(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var sN="matrix",w9=["typed","Matrix","DenseMatrix","SparseMatrix"],pv=N(sN,w9,r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(sN,{"":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 n(o,u);if(l==="sparse")return new i(o,u);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}});var uN="matrixFromFunction",_9=["typed","matrix","isZero"],mv=N(uN,_9,r=>{var{typed:e,matrix:t,isZero:n}=r;return e(uN,{"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);n(p)||s.set(f,p)}),s}});var lN="matrixFromRows",A9=["typed","matrix","flatten","size"],dv=N(lN,A9,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(lN,{"...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(n(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 cN="matrixFromColumns",D9=["typed","matrix","flatten","size"],hv=N(cN,D9,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(cN,{"...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<u;c++)s[c]=[];for(var f of l){var p=o(f);if(p!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(p|0));for(var m=n(f),h=0;h<u;h++)s[h].push(m[h])}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 fN="splitUnit",E9=["typed"],gv=N(fN,E9,r=>{var{typed:e}=r;return e(fN,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var pN="unaryMinus",S9=["typed"],vv=N(pN,S9,r=>{var{typed:e}=r;return e(pN,{number:ng,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>n=>{var i=n.clone();return i.value=e.find(t,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t,!0))})});var mN="unaryPlus",N9=["typed","config","BigNumber"],yv=N(mN,N9,r=>{var{typed:e,config:t,BigNumber:n}=r;return e(mN,{number:ig,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=>Je(a,i,!0)),"boolean | string":function(a){return t.number==="BigNumber"?new n(+a):+a}})});var dN="abs",C9=["typed"],bv=N(dN,C9,r=>{var{typed:e}=r;return e(dN,{number:Kh,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t,!0))})});var hN="apply",M9=["typed","isInteger"],Vo=N(hN,M9,r=>{var{typed:e,isInteger:t}=r;return e(hN,{"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)?tt(i):i.size();if(a<0||a>=l.length)throw new fn(a,l.length);return Ge(i)?i.create(ip(i.valueOf(),a,o)):ip(i,a,o)}})});function ip(r,e,t){var n,i,a;if(e<=0)if(Array.isArray(r[0])){for(a=T9(r),i=[],n=0;n<a.length;n++)i[n]=ip(a[n],e-1,t);return i}else return t(r);else{for(i=[],n=0;n<r.length;n++)i[n]=ip(r[n],e-1,t);return i}}function T9(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}var gN="addScalar",F9=["typed"],xv=N(gN,F9,r=>{var{typed:e}=r;return e(gN,{"number, number":eg,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.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(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var vN="subtractScalar",I9=["typed"],wv=N(vN,I9,r=>{var{typed:e}=r;return e(vN,{"number, number":tg,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.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(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var yN="cbrt",B9=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],_v=N(yN,B9,r=>{var{config:e,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:l,Fraction:u}=r;return t(yN,{number:Ws,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(Ws(h),0).mul(new o(0,m).exp());if(p){var g=[d,new o(Ws(h),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(Ws(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=n(f.value);m&&(f.value=i(f.value));var h;rt(f.value)?h=new l(1).div(3):ma(f.value)?h=new u(1,3):h=1/3;var d=f.pow(h);return m&&(d.value=i(d.value)),d}}});var P9="matAlgo11xS0s",O9=["typed","equalScalar"],Wt=N(P9,O9,r=>{var{typed:e,equalScalar:t}=r;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,v=0,w=o;typeof p=="string"&&(d=p,g=e.find(t,[d,d]),v=e.convert(0,d),a=e.convert(a,d),w=e.find(o,[d,d]));for(var y=[],x=[],_=[],b=0;b<h;b++){_[b]=x.length;for(var D=c[b],S=c[b+1],A=D;A<S;A++){var E=s[A],M=l?w(a,u[A]):w(u[A],a);g(M,v)||(x.push(E),y.push(M))}}return _[h]=x.length,i.createSparseMatrix({values:y,index:x,ptr:_,size:[m,h],datatype:d})}});var R9="matAlgo12xSfs",k9=["typed","DenseMatrix"],kt=N(R9,k9,r=>{var{typed:e,DenseMatrix:t}=r;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 v=[],w=[],y=[],x=0;x<h;x++){for(var _=x+1,b=c[x],D=c[x+1],S=b;S<D;S++){var A=s[S];w[A]=u[S],y[A]=_}for(var E=0;E<m;E++)x===0&&(v[E]=[]),y[E]===_?v[E][x]=l?g(a,w[E]):g(w[E],a):v[E][x]=l?g(a,0):g(0,a)}return new t({data:v,size:[m,h],datatype:d})}});var L9="matAlgo14xDs",U9=["typed"],Br=N(L9,U9,r=>{var{typed:e}=r;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:Qe(s),datatype:f})};function t(n,i,a,o,l,u,s){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=s?n(u,l[f]):n(l[f],u);else for(var p=0;p<o;p++)c[p]=t(n,i+1,a,a[i+1],l[p],u,s);return c}});var Av="ceil",V9=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],q9=N(Av,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Av,{number:function(a){return Ir(a,n(a),t.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Ir(a,n(a,o),t.epsilon))return n(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))}})}),Dv=N(Av,V9,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=r,u=Wt({typed:e,equalScalar:a}),s=kt({typed:e,DenseMatrix:l}),c=Br({typed:e}),f=q9({typed:e,config:t,round:n});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 en(m,n(m),t.epsilon)?n(m):m.ceil()},"BigNumber, BigNumber":function(m,h){return en(m,n(m,h),t.epsilon)?n(m,h):m.toDecimalPlaces(h.toNumber(),ko.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=>Je(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(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 bN="cube",z9=["typed"],Ev=N(bN,z9,r=>{var{typed:e}=r;return e(bN,{number:ag,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var xN="exp",$9=["typed"],Sv=N(xN,$9,r=>{var{typed:e}=r;return e(xN,{number:og,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var wN="expm1",H9=["typed","Complex"],Nv=N(wN,H9,r=>{var{typed:e,Complex:t}=r;return e(wN,{number:sg,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 Cv="fix",G9=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],W9=N(Cv,["typed","ceil","floor"],r=>{var{typed:e,ceil:t,floor:n}=r;return e(Cv,{number:function(a){return a>0?n(a):t(a)},"number, number":function(a,o){return a>0?n(a,o):t(a,o)}})}),Mv=N(Cv,G9,r=>{var{typed:e,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:l,DenseMatrix:u}=r,s=kt({typed:e,DenseMatrix:u}),c=Br({typed:e}),f=W9({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=>Je(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(m,d=>p(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(n(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 Tv="floor",j9=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Z9=N(Tv,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Tv,{number:function(a){return Ir(a,n(a),t.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Ir(a,n(a,o),t.epsilon))return n(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))}})}),ll=N(Tv,j9,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=r,u=Wt({typed:e,equalScalar:a}),s=kt({typed:e,DenseMatrix:l}),c=Br({typed:e}),f=Z9({typed:e,config:t,round:n});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 en(m,n(m),t.epsilon)?n(m):m.floor()},"BigNumber, BigNumber":function(m,h){return en(m,n(m,h),t.epsilon)?n(m,h):m.toDecimalPlaces(h.toNumber(),ko.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=>Je(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(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 J9="matAlgo02xDS0",Y9=["typed","equalScalar"],Pr=N(J9,Y9,r=>{var{typed:e,equalScalar:t}=r;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 st(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],v=s[1],w,y=t,x=0,_=o;typeof c=="string"&&c===d&&(w=c,y=e.find(t,[w,w]),x=e.convert(0,w),_=e.find(o,[w,w]));for(var b=[],D=[],S=[],A=0;A<v;A++){S[A]=D.length;for(var E=m[A],M=m[A+1],F=E;F<M;F++){var P=p[F],k=l?_(f[F],u[P][A]):_(u[P][A],f[F]);y(k,x)||(D.push(P),b.push(k))}}return S[v]=D.length,a.createSparseMatrix({values:b,index:D,ptr:S,size:[g,v],datatype:w})}});var X9="matAlgo03xDSf",Q9=["typed"],ir=N(X9,Q9,r=>{var{typed:e}=r;return function(n,i,a,o){var l=n._data,u=n._size,s=n._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new st(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],v,w=0,y=a;typeof s=="string"&&s===h&&(v=s,w=e.convert(0,v),y=e.find(a,[v,v]));for(var x=[],_=0;_<d;_++)x[_]=[];for(var b=[],D=[],S=0;S<g;S++){for(var A=S+1,E=p[S],M=p[S+1],F=E;F<M;F++){var P=f[F];b[P]=o?y(c[F],l[P][S]):y(l[P][S],c[F]),D[P]=A}for(var k=0;k<d;k++)D[k]===A?x[k][S]=b[k]:x[k][S]=o?y(w,l[k][S]):y(l[k][S],w)}return n.createDenseMatrix({data:x,size:[d,g],datatype:v})}});var K9="matAlgo05xSfSf",eq=["typed","equalScalar"],Xa=N(K9,eq,r=>{var{typed:e,equalScalar:t}=r;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 st(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 v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var D=l&&p?[]:void 0,S=[],A=[],E=D?[]:void 0,M=D?[]:void 0,F=[],P=[],k,O,I,T;for(O=0;O<w;O++){A[O]=S.length;var q=O+1;for(I=s[O],T=s[O+1];I<T;I++)k=u[I],S.push(k),F[k]=q,E&&(E[k]=l[I]);for(I=h[O],T=h[O+1];I<T;I++)k=m[I],F[k]!==q&&S.push(k),P[k]=q,M&&(M[k]=p[I]);if(D)for(I=A[O];I<S.length;){k=S[I];var B=F[k],U=P[k];if(B===q||U===q){var G=B===q?E[k]:_,H=U===q?M[k]:_,L=b(G,H);x(L,_)?S.splice(I,1):(D.push(L),I++)}}}return A[w]=S.length,i.createSparseMatrix({values:D,index:S,ptr:A,size:[v,w],datatype:y})}});var tq="matAlgo13xDD",rq=["typed"],_N=N(tq,rq,r=>{var{typed:e}=r;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 st(u.length,f.length);for(var h=0;h<u.length;h++){if(u[h]!==f[h])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");m[h]=u[h]}var d,g=o;typeof s=="string"&&s===p&&(d=s,g=e.find(o,[d,d]));var v=m.length>0?t(g,0,m,m[0],l,c):[];return i.createDenseMatrix({data:v,size:m,datatype:d})};function t(n,i,a,o,l,u){var s=[];if(i===a.length-1)for(var c=0;c<o;c++)s[c]=n(l[c],u[c]);else for(var f=0;f<o;f++)s[f]=t(n,i+1,a,a[i+1],l[f],u[f]);return s}});var nq="broadcast",iq=["concat"],AN=N(nq,iq,r=>{var{concat:e}=r;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<o;c++)s[c]=Math.max(l[c],u[c]);rl(l,s),rl(u,s);var f=i.clone(),p=a.clone();f._size.length<o?f.reshape(t(f._size,o,1)):p._size.length<o&&p.reshape(t(p._size,o,1));for(var m=0;m<o;m++)f._size[m]<s[m]&&(f=n(f,s[m],m)),p._size[m]<s[m]&&(p=n(p,s[m],m));return[f,p]};function t(i,a,o){return[...Array(a-i.length).fill(o),...i]}function n(i,a,o){return e(...Array(a).fill(i),o)}});var aq="matrixAlgorithmSuite",oq=["typed","matrix","concat"],ct=N(aq,oq,r=>{var{typed:e,matrix:t,concat:n}=r,i=_N({typed:e}),a=Br({typed:e}),o=AN({concat:n});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,v)=>i(...o(g,v),d)),"Array, Array":e.referToSelf(d=>(g,v)=>i(...o(t(g),t(v)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,v)=>i(...o(t(g),v),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,v)=>i(...o(g,t(v)),d))},u.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.SS(...o(g,v),d,!1))),u.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.DS(...o(g,v),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.DS(...o(t(g),v),d,!1))),c&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,v)=>c(...o(v,g),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(g,v)=>c(...o(t(v),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,v)=>a(g,v,d,!1)),f[p+", DenseMatrix"]=e.referToSelf(d=>(g,v)=>a(v,g,d,!0)),f["Array,"+p]=e.referToSelf(d=>(g,v)=>a(t(g),v,d,!1).valueOf()),f[p+", Array"]=e.referToSelf(d=>(g,v)=>a(t(v),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,v)=>u.Ss(g,v,d,!1))),h&&(f[p+", SparseMatrix"]=e.referToSelf(d=>(g,v)=>h(v,g,d,!0)))),s&&s.signatures&&Pf(f,s.signatures),f}});var DN="mod",sq=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],cl=N(DN,sq,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}=r,s=ll({typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}),c=Pr({typed:e,equalScalar:a}),f=ir({typed:e}),p=Xa({typed:e,equalScalar:a}),m=Wt({typed:e,equalScalar:a}),h=kt({typed:e,DenseMatrix:l}),d=ct({typed:e,matrix:i,concat:u});return e(DN,{"number, number":g,"BigNumber, BigNumber":function(w,y){return y.isZero()?w:w.sub(y.mul(s(w.div(y))))},"Fraction, Fraction":function(w,y){return y.equals(0)?w:w.sub(y.mul(s(w.div(y))))}},d({SS:p,DS:f,SD:c,Ss:m,sS:h}));function g(v,w){return w===0?v:v-w*s(v/w)}});var uq="matAlgo01xDSid",lq=["typed"],bn=N(uq,lq,r=>{var{typed:e}=r;return function(n,i,a,o){var l=n._data,u=n._size,s=n._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new st(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],v=typeof s=="string"&&s===h?s:void 0,w=v?e.find(a,[v,v]):a,y,x,_=[];for(y=0;y<d;y++)_[y]=[];var b=[],D=[];for(x=0;x<g;x++){for(var S=x+1,A=p[x],E=p[x+1],M=A;M<E;M++)y=f[M],b[y]=o?w(c[M],l[y][x]):w(l[y][x],c[M]),D[y]=S;for(y=0;y<d;y++)D[y]===S?_[y][x]=b[y]:_[y][x]=l[y][x]}return n.createDenseMatrix({data:_,size:[d,g],datatype:v})}});var cq="matAlgo04xSidSid",fq=["typed","equalScalar"],Zs=N(cq,fq,r=>{var{typed:e,equalScalar:t}=r;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 st(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 v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var D=l&&p?[]:void 0,S=[],A=[],E=l&&p?[]:void 0,M=l&&p?[]:void 0,F=[],P=[],k,O,I,T,q;for(O=0;O<w;O++){A[O]=S.length;var B=O+1;for(T=s[O],q=s[O+1],I=T;I<q;I++)k=u[I],S.push(k),F[k]=B,E&&(E[k]=l[I]);for(T=h[O],q=h[O+1],I=T;I<q;I++)if(k=m[I],F[k]===B){if(E){var U=b(E[k],p[I]);x(U,_)?F[k]=null:E[k]=U}}else S.push(k),P[k]=B,M&&(M[k]=p[I]);if(E&&M)for(I=A[O];I<S.length;)k=S[I],F[k]===B?(D[I]=E[k],I++):P[k]===B?(D[I]=M[k],I++):S.splice(I,1)}return A[w]=S.length,i.createSparseMatrix({values:D,index:S,ptr:A,size:[v,w],datatype:y})}});var pq="matAlgo10xSids",mq=["typed","DenseMatrix"],qn=N(pq,mq,r=>{var{typed:e,DenseMatrix:t}=r;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 v=[],w=[],y=[],x=0;x<h;x++){for(var _=x+1,b=c[x],D=c[x+1],S=b;S<D;S++){var A=s[S];w[A]=u[S],y[A]=_}for(var E=0;E<m;E++)x===0&&(v[E]=[]),y[E]===_?v[E][x]=l?g(a,w[E]):g(w[E],a):v[E][x]=a}return new t({data:v,size:[m,h],datatype:d})}});function ya(r,e,t,n){if(!(this instanceof ya))throw new SyntaxError("Constructor must be called with the new operator");this.fn=r,this.count=e,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+r+" ("+e+" provided, "+t+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}ya.prototype=new Error;ya.prototype.constructor=Error;ya.prototype.name="ArgumentsError";ya.prototype.isArgumentsError=!0;var EN="gcd",dq=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],Fv="number | BigNumber | Fraction | Matrix | Array",hq="".concat(Fv,", ").concat(Fv,", ...").concat(Fv);function SN(r){return!r.some(e=>Array.isArray(e))}var Iv=N(EN,dq,r=>{var{typed:e,matrix:t,config:n,round:i,equalScalar:a,zeros:o,BigNumber:l,DenseMatrix:u,concat:s}=r,c=cl({typed:e,config:n,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:u,concat:s}),f=bn({typed:e}),p=Zs({typed:e,equalScalar:a}),m=qn({typed:e,DenseMatrix:u}),h=ct({typed:e,matrix:t,concat:s});return e(EN,{"number, number":d,"BigNumber, BigNumber":g,"Fraction, Fraction":(v,w)=>v.gcd(w)},h({SS:p,DS:f,Ss:m}),{[hq]:e.referToSelf(v=>(w,y,x)=>{for(var _=v(w,y),b=0;b<x.length;b++)_=v(_,x[b]);return _}),Array:e.referToSelf(v=>w=>{if(w.length===1&&Array.isArray(w[0])&&SN(w[0]))return v(...w[0]);if(SN(w))return v(...w);throw new ya("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(v=>w=>v(w.toArray()))});function d(v,w){if(!$e(v)||!$e(w))throw new Error("Parameters in function gcd must be integer numbers");for(var y;w!==0;)y=c(v,w),v=w,w=y;return v<0?-v:v}function g(v,w){if(!v.isInt()||!w.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var y=new l(0);!w.isZero();){var x=c(v,w);v=w,w=x}return v.lt(y)?v.neg():v}});var gq="matAlgo06xS0S0",vq=["typed","equalScalar"],Qa=N(gq,vq,r=>{var{typed:e,equalScalar:t}=r;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 st(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,v=0,w=o;typeof s=="string"&&s===p&&(d=s,g=e.find(t,[d,d]),v=e.convert(0,d),w=e.find(o,[d,d]));for(var y=l&&c?[]:void 0,x=[],_=[],b=y?[]:void 0,D=[],S=[],A=0;A<h;A++){_[A]=x.length;var E=A+1;if(Xh(i,A,D,b,S,E,x,w),Xh(a,A,D,b,S,E,x,w),b)for(var M=_[A];M<x.length;){var F=x[M];if(S[F]===E){var P=b[F];g(P,v)?x.splice(M,1):(y.push(P),M++)}else x.splice(M,1)}else for(var k=_[A];k<x.length;){var O=x[k];S[O]!==E?x.splice(k,1):k++}}return _[h]=x.length,i.createSparseMatrix({values:y,index:x,ptr:_,size:[m,h],datatype:d})}});var NN="lcm",yq=["typed","matrix","equalScalar","concat"],Bv=N(NN,yq,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=Pr({typed:e,equalScalar:n}),o=Qa({typed:e,equalScalar:n}),l=Wt({typed:e,equalScalar:n}),u=ct({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),v=0;v<d.length;v++)g=p(g,d[v]);return g}),e(NN,{"number, number":ug,"BigNumber, BigNumber":f,"Fraction, Fraction":(p,m)=>p.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 CN="log10",bq=["typed","config","Complex"],Pv=N(CN,bq,r=>{var{typed:e,config:t,Complex:n}=r;return e(CN,{number:function(a){return a>=0||t.predictable?lg(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>Je(a,i))})});var MN="log2",xq=["typed","config","Complex"],Ov=N(MN,xq,r=>{var{typed:e,config:t,Complex:n}=r;return e(MN,{number:function(o){return o>=0||t.predictable?cg(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>Je(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var wq="multiplyScalar",_q=["typed"],Rv=N(wq,_q,r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":rg,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var TN="multiply",Aq=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],kv=N(TN,Aq,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=r,l=Wt({typed:e,equalScalar:a}),u=Br({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,S=_._size,A=_._datatype,E=b._data,M=b._size,F=b._datatype,P=S[0],k=M[1],O,I=n,T=i;A&&F&&A===F&&typeof A=="string"&&(O=A,I=e.find(n,[O,O]),T=e.find(i,[O,O]));for(var q=[],B=0;B<k;B++){for(var U=T(D[0],E[0][B]),G=1;G<P;G++)U=I(U,T(D[G],E[G][B]));q[B]=U}return _.createDenseMatrix({data:q,size:[k],datatype:O})}var m=e("_multiplyMatrixVector",{"DenseMatrix, any":d,"SparseMatrix, any":w}),h=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":x});function d(_,b){var D=_._data,S=_._size,A=_._datatype,E=b._data,M=b._datatype,F=S[0],P=S[1],k,O=n,I=i;A&&M&&A===M&&typeof A=="string"&&(k=A,O=e.find(n,[k,k]),I=e.find(i,[k,k]));for(var T=[],q=0;q<F;q++){for(var B=D[q],U=I(B[0],E[0]),G=1;G<P;G++)U=O(U,I(B[G],E[G]));T[q]=U}return _.createDenseMatrix({data:T,size:[F],datatype:k})}function g(_,b){var D=_._data,S=_._size,A=_._datatype,E=b._data,M=b._size,F=b._datatype,P=S[0],k=S[1],O=M[1],I,T=n,q=i;A&&F&&A===F&&typeof A=="string"&&(I=A,T=e.find(n,[I,I]),q=e.find(i,[I,I]));for(var B=[],U=0;U<P;U++){var G=D[U];B[U]=[];for(var H=0;H<O;H++){for(var L=q(G[0],E[0][H]),ie=1;ie<k;ie++)L=T(L,q(G[ie],E[ie][H]));B[U][H]=L}}return _.createDenseMatrix({data:B,size:[P,O],datatype:I})}function v(_,b){var D=_._data,S=_._size,A=_._datatype,E=b._values,M=b._index,F=b._ptr,P=b._size,k=b._datatype;if(!E)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var O=S[0],I=P[1],T,q=n,B=i,U=a,G=0;A&&k&&A===k&&typeof A=="string"&&(T=A,q=e.find(n,[T,T]),B=e.find(i,[T,T]),U=e.find(a,[T,T]),G=e.convert(0,T));for(var H=[],L=[],ie=[],ve=b.createSparseMatrix({values:H,index:L,ptr:ie,size:[O,I],datatype:T}),se=0;se<I;se++){ie[se]=L.length;var ue=F[se],he=F[se+1];if(he>ue)for(var K=0,re=0;re<O;re++){for(var me=re+1,de=void 0,Pe=ue;Pe<he;Pe++){var we=M[Pe];K!==me?(de=B(D[re][we],E[Pe]),K=me):de=q(de,B(D[re][we],E[Pe]))}K===me&&!U(de,G)&&(L.push(re),H.push(de))}}return ie[I]=L.length,ve}function w(_,b){var D=_._values,S=_._index,A=_._ptr,E=_._datatype;if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=b._data,F=b._datatype,P=_._size[0],k=b._size[0],O=[],I=[],T=[],q,B=n,U=i,G=a,H=0;E&&F&&E===F&&typeof E=="string"&&(q=E,B=e.find(n,[q,q]),U=e.find(i,[q,q]),G=e.find(a,[q,q]),H=e.convert(0,q));var L=[],ie=[];T[0]=0;for(var ve=0;ve<k;ve++){var se=M[ve];if(!G(se,H))for(var ue=A[ve],he=A[ve+1],K=ue;K<he;K++){var re=S[K];ie[re]?L[re]=B(L[re],U(se,D[K])):(ie[re]=!0,I.push(re),L[re]=U(se,D[K]))}}for(var me=I.length,de=0;de<me;de++){var Pe=I[de];O[de]=L[Pe]}return T[1]=I.length,_.createSparseMatrix({values:O,index:I,ptr:T,size:[P,1],datatype:q})}function y(_,b){var D=_._values,S=_._index,A=_._ptr,E=_._datatype;if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=b._data,F=b._datatype,P=_._size[0],k=b._size[0],O=b._size[1],I,T=n,q=i,B=a,U=0;E&&F&&E===F&&typeof E=="string"&&(I=E,T=e.find(n,[I,I]),q=e.find(i,[I,I]),B=e.find(a,[I,I]),U=e.convert(0,I));for(var G=[],H=[],L=[],ie=_.createSparseMatrix({values:G,index:H,ptr:L,size:[P,O],datatype:I}),ve=[],se=[],ue=0;ue<O;ue++){L[ue]=H.length;for(var he=ue+1,K=0;K<k;K++){var re=M[K][ue];if(!B(re,U))for(var me=A[K],de=A[K+1],Pe=me;Pe<de;Pe++){var we=S[Pe];se[we]!==he?(se[we]=he,H.push(we),ve[we]=q(re,D[Pe])):ve[we]=T(ve[we],q(re,D[Pe]))}}for(var V=L[ue],J=H.length,ce=V;ce<J;ce++){var W=H[ce];G[ce]=ve[W]}}return L[O]=H.length,ie}function x(_,b){var D=_._values,S=_._index,A=_._ptr,E=_._datatype,M=b._values,F=b._index,P=b._ptr,k=b._datatype,O=_._size[0],I=b._size[1],T=D&&M,q,B=n,U=i;E&&k&&E===k&&typeof E=="string"&&(q=E,B=e.find(n,[q,q]),U=e.find(i,[q,q]));for(var G=T?[]:void 0,H=[],L=[],ie=_.createSparseMatrix({values:G,index:H,ptr:L,size:[O,I],datatype:q}),ve=T?[]:void 0,se=[],ue,he,K,re,me,de,Pe,we,V=0;V<I;V++){L[V]=H.length;var J=V+1;for(me=P[V],de=P[V+1],re=me;re<de;re++)if(we=F[re],T)for(he=A[we],K=A[we+1],ue=he;ue<K;ue++)Pe=S[ue],se[Pe]!==J?(se[Pe]=J,H.push(Pe),ve[Pe]=U(M[re],D[ue])):ve[Pe]=B(ve[Pe],U(M[re],D[ue]));else for(he=A[we],K=A[we+1],ue=he;ue<K;ue++)Pe=S[ue],se[Pe]!==J&&(se[Pe]=J,H.push(Pe));if(T)for(var ce=L[V],W=H.length,ee=ce;ee<W;ee++){var ne=H[ee];G[ee]=ve[ne]}}return L[I]=H.length,ie}return e(TN,i,{"Array, Array":e.referTo("Matrix, Matrix",_=>(b,D)=>{s(tt(b),tt(D));var S=_(t(b),t(D));return Ge(S)?S.valueOf():S}),"Matrix, Matrix":function(b,D){var S=b.size(),A=D.size();return s(S,A),S.length===1?A.length===1?c(b,D,S[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,S)=>{for(var A=_(b,D),E=0;E<S.length;E++)A=_(A,S[E]);return A})})});var FN="nthRoot",Dq=["typed","matrix","equalScalar","BigNumber","concat"],Lv=N(FN,Dq,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,concat:a}=r,o=bn({typed:e}),l=Pr({typed:e,equalScalar:n}),u=Qa({typed:e,equalScalar:n}),s=Wt({typed:e,equalScalar:n}),c=ct({typed:e,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(FN,{number:fg,"number, number":fg,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}),v=new i(0),w=new g(1),y=h.isNegative();if(y&&(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 y?new g(1/0):0;if(!m.isFinite())return y?v:m;var x=m.abs().pow(w.div(h));return x=m.isNeg()?x.neg():x,new i((y?w.div(x):x).toPrecision(d))}});var IN="sign",Eq=["typed","BigNumber","Fraction","complex"],Uv=N(IN,Eq,r=>{var{typed:e,BigNumber:t,complex:n,Fraction:i}=r;return e(IN,{number:rp,Complex:function(o){return o.im===0?n(rp(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=>Je(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 Sq="sqrt",Nq=["config","typed","Complex"],Vv=N(Sq,Nq,r=>{var{config:e,typed:t,Complex:n}=r;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 n(a,0).sqrt()}});var BN="square",Cq=["typed"],qv=N(BN,Cq,r=>{var{typed:e}=r;return e(BN,{number:pg,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var PN="subtract",Mq=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],zv=N(PN,Mq,r=>{var{typed:e,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:l}=r,u=bn({typed:e}),s=ir({typed:e}),c=Xa({typed:e,equalScalar:n}),f=qn({typed:e,DenseMatrix:o}),p=kt({typed:e,DenseMatrix:o}),m=ct({typed:e,matrix:t,concat:l});return e(PN,{"any, any":i},m({elop:i,SS:c,DS:u,SD:s,Ss:p,sS:f}))});var ON="xgcd",Tq=["typed","config","matrix","BigNumber"],$v=N(ON,Tq,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(ON,{"number, number":function(l,u){var s=mg(l,u);return t.matrix==="Array"?s:n(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 v;return o.lt(f)?v=[o.neg(),h.neg(),g.neg()]:v=[o,o.isZero()?0:h,g],t.matrix==="Array"?v:n(v)}});var RN="invmod",Fq=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Hv=N(RN,Fq,r=>{var{typed:e,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:l,add:u,isInteger:s}=r;return e(RN,{"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,n(1))?(d=l(d,p),o(d,n(0))&&(d=u(d,p)),d):NaN}});var Iq="matAlgo09xS0Sf",Bq=["typed","equalScalar"],ap=N(Iq,Bq,r=>{var{typed:e,equalScalar:t}=r;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 st(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 v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var D=l&&p?[]:void 0,S=[],A=[],E=D?[]:void 0,M=[],F,P,k,O,I;for(P=0;P<w;P++){A[P]=S.length;var T=P+1;if(E)for(O=h[P],I=h[P+1],k=O;k<I;k++)F=m[k],M[F]=T,E[F]=p[k];for(O=s[P],I=s[P+1],k=O;k<I;k++)if(F=u[k],E){var q=M[F]===T?E[F]:_,B=b(l[k],q);x(B,_)||(S.push(F),D.push(B))}else S.push(F)}return A[w]=S.length,i.createSparseMatrix({values:D,index:S,ptr:A,size:[v,w],datatype:y})}});var kN="dotMultiply",Pq=["typed","matrix","equalScalar","multiplyScalar","concat"],Gv=N(kN,Pq,r=>{var{typed:e,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=r,o=Pr({typed:e,equalScalar:n}),l=ap({typed:e,equalScalar:n}),u=Wt({typed:e,equalScalar:n}),s=ct({typed:e,matrix:t,concat:a});return e(kN,s({elop:i,SS:l,DS:o,Ss:u}))});function LN(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero()||e.eq(-1)||r.eq(e))return r;if(e.isZero()||r.eq(-1))return e;if(!r.isFinite()||!e.isFinite()){if(!r.isFinite()&&!e.isFinite())return r.isNegative()===e.isNegative()?r:new t(0);if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e;if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r}return Wv(r,e,function(n,i){return n&i})}function Js(r){if(r.isFinite()&&!r.isInteger())throw new Error("Integer expected in function bitNot");var e=r.constructor,t=e.precision;e.config({precision:1e9});var n=r.plus(new e(1));return n.s=-n.s||null,e.config({precision:t}),n}function UN(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);var n=new t(-1);return r.isZero()||e.eq(n)||r.eq(e)?e:e.isZero()||r.eq(n)?r:!r.isFinite()||!e.isFinite()?!r.isFinite()&&!r.isNegative()&&e.isNegative()||r.isNegative()&&!e.isNegative()&&!e.isFinite()?n:r.isNegative()&&e.isNegative()?r.isFinite()?r:e:r.isFinite()?e:r:Wv(r,e,function(i,a){return i|a})}function Wv(r,e,t){var n=r.constructor,i,a,o=+(r.s<0),l=+(e.s<0);if(o){i=op(Js(r));for(var u=0;u<i.length;++u)i[u]^=1}else i=op(r);if(l){a=op(Js(e));for(var s=0;s<a.length;++s)a[s]^=1}else a=op(e);var c,f,p;i.length<=a.length?(c=i,f=a,p=o):(c=a,f=i,p=l);var m=c.length,h=f.length,d=t(o,l)^1,g=new n(d^1),v=new n(1),w=new n(2),y=n.precision;for(n.config({precision:1e9});m>0;)t(c[--m],f[--h])===d&&(g=g.plus(v)),v=v.times(w);for(;h>0;)t(p,f[--h])===d&&(g=g.plus(v)),v=v.times(w);return n.config({precision:y}),d===0&&(g.s=-g.s),g}function op(r){for(var e=r.d,t=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;t.charAt(o)==="0";)o--;var l=r.e,u=t.slice(0,o+1||1),s=u.length;if(l>0)if(++l>s)for(l-=s;l--;)u+="0";else l<s&&(u=u.slice(0,l)+"."+u.slice(l));for(var c=[0],f=0;f<u.length;){for(var p=c.length;p--;)c[p]*=10;c[0]+=parseInt(u.charAt(f++));for(var m=0;m<c.length;++m)c[m]>1&&((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 VN(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero())return e;if(e.isZero())return r;if(r.eq(e))return new t(0);var n=new t(-1);return r.eq(n)?Js(e):e.eq(n)?Js(r):!r.isFinite()||!e.isFinite()?!r.isFinite()&&!e.isFinite()?n:new t(r.isNegative()===e.isNegative()?1/0:-1/0):Wv(r,e,function(i,a){return i^a})}function qN(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:!r.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?r.times(Math.pow(2,e.toNumber())+""):r.times(new t(2).pow(e))}function zN(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:e.isFinite()?e.lt(55)?r.div(Math.pow(2,e.toNumber())+"").floor():r.div(new t(2).pow(e)).floor():r.isNegative()?new t(-1):r.isFinite()?new t(0):new t(NaN)}var $N="bitAnd",Oq=["typed","matrix","equalScalar","concat"],fl=N($N,Oq,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=Pr({typed:e,equalScalar:n}),o=Qa({typed:e,equalScalar:n}),l=Wt({typed:e,equalScalar:n}),u=ct({typed:e,matrix:t,concat:i});return e($N,{"number, number":gg,"BigNumber, BigNumber":LN},u({SS:o,DS:a,Ss:l}))});var HN="bitNot",Rq=["typed"],jv=N(HN,Rq,r=>{var{typed:e}=r;return e(HN,{number:vg,BigNumber:Js,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var GN="bitOr",kq=["typed","matrix","equalScalar","DenseMatrix","concat"],pl=N(GN,kq,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=bn({typed:e}),l=Zs({typed:e,equalScalar:n}),u=qn({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(GN,{"number, number":yg,"BigNumber, BigNumber":UN},s({SS:l,DS:o,Ss:u}))});var Lq="matAlgo07xSSf",Uq=["typed","DenseMatrix"],Vr=N(Lq,Uq,r=>{var{typed:e,DenseMatrix:t}=r;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 st(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 v,w,y=[];for(v=0;v<p;v++)y[v]=[];var x=[],_=[],b=[],D=[];for(w=0;w<m;w++){var S=w+1;for(n(a,w,b,x,S),n(o,w,D,_,S),v=0;v<p;v++){var A=b[v]===S?x[v]:d,E=D[v]===S?_[v]:d;y[v][w]=g(A,E)}}return new t({data:y,size:[p,m],datatype:h})};function n(i,a,o,l,u){for(var s=i._values,c=i._index,f=i._ptr,p=f[a],m=f[a+1];p<m;p++){var h=c[p];o[h]=u,l[h]=s[p]}}});var WN="bitXor",Vq=["typed","matrix","DenseMatrix","concat"],Zv=N(WN,Vq,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=ir({typed:e}),o=Vr({typed:e,DenseMatrix:n}),l=kt({typed:e,DenseMatrix:n}),u=ct({typed:e,matrix:t,concat:i});return e(WN,{"number, number":bg,"BigNumber, BigNumber":VN},u({SS:o,DS:a,Ss:l}))});var jN="arg",qq=["typed"],Jv=N(jN,qq,r=>{var{typed:e}=r;return e(jN,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var ZN="conj",zq=["typed"],Yv=N(ZN,zq,r=>{var{typed:e}=r;return e(ZN,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var JN="im",$q=["typed"],Xv=N(JN,$q,r=>{var{typed:e}=r;return e(JN,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var YN="re",Hq=["typed"],Qv=N(YN,Hq,r=>{var{typed:e}=r;return e(YN,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var XN="not",Gq=["typed"],Kv=N(XN,Gq,r=>{var{typed:e}=r;return e(XN,{"null | undefined":()=>!0,number:Eg,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var QN="or",Wq=["typed","matrix","equalScalar","DenseMatrix","concat"],ml=N(QN,Wq,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Xa({typed:e,equalScalar:n}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(QN,{"number, number":Sg,"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 KN="xor",jq=["typed","matrix","DenseMatrix","concat"],ey=N(KN,jq,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=ir({typed:e}),o=Vr({typed:e,DenseMatrix:n}),l=kt({typed:e,DenseMatrix:n}),u=ct({typed:e,matrix:t,concat:i});return e(KN,{"number, number":Ng,"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 eC="concat",Zq=["typed","matrix","isInteger"],dl=N(eC,Zq,r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(eC,{"...Array | Matrix | number | BigNumber":function(a){var o,l=a.length,u=-1,s,c=!1,f=[];for(o=0;o<l;o++){var p=a[o];if(Ge(p)&&(c=!0),it(p)||rt(p)){if(o!==l-1)throw new Error("Dimension must be specified as last argument");if(s=u,u=p.valueOf(),!n(u))throw new TypeError("Integer number expected for dimension");if(u<0||o>0&&u>s)throw new fn(u,s+1)}else{var m=Qe(p).valueOf(),h=tt(m);if(f[o]=m,s=u,u=h.length-1,o>0&&u!==s)throw new st(s+1,u+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=Ch(d,f.shift(),u);return c?t(d):d},"...string":function(a){return a.join("")}})});var tC="column",Jq=["typed","Index","matrix","range"],hl=N(tC,Jq,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(tC,{"Matrix, number":a,"Array, number":function(l,u){return a(n(Qe(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Gt(l,o.size()[1]);var u=i(0,o.size()[0]),s=new t(u,l),c=o.subset(s);return Ge(c)?c:n([[c]])}});var rC="count",Yq=["typed","size","prod"],ty=N(rC,Yq,r=>{var{typed:e,size:t,prod:n}=r;return e(rC,{string:function(a){return a.length},"Matrix | Array":function(a){return n(t(a))}})});var nC="cross",Xq=["typed","matrix","subtract","multiply"],ry=N(nC,Xq,r=>{var{typed:e,matrix:t,subtract:n,multiply:i}=r;return e(nC,{"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(tt(o).length,tt(l).length);o=qs(o),l=qs(l);var s=tt(o),c=tt(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=[n(i(o[1],l[2]),i(o[2],l[1])),n(i(o[2],l[0]),i(o[0],l[2])),n(i(o[0],l[1]),i(o[1],l[0]))];return u>1?[f]:f}});var iC="diag",Qq=["typed","matrix","DenseMatrix","SparseMatrix"],ny=N(iC,Qq,r=>{var{typed:e,matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(iC,{Array:function(s){return a(s,0,tt(s),null)},"Array, number":function(s,c){return a(s,c,tt(s),null)},"Array, BigNumber":function(s,c){return a(s,c.toNumber(),tt(s),null)},"Array, string":function(s,c){return a(s,0,tt(s),c)},"Array, number, string":function(s,c,f){return a(s,c,tt(s),f)},"Array, BigNumber, string":function(s,c,f){return a(s,c.toNumber(),tt(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(!$e(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):n.diagonal(h,u,s);return c!==null?d:d.valueOf()}function l(u,s,c,f,p,m){if(Ge(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=[],v=0;v<d;v++)g[v]=u[v+p][v+m];return c!==null?t(g):g}});var gl=ur(wh(),1);function yi(r,e,t,n,i){if(gl.default.isTypedFunction(r)){var a=[e,t,n],o=gl.default.resolve(r,a);if(o)return f(o.implementation,a);var l=[e,t],u=gl.default.resolve(r,l);if(u)return f(u.implementation,l);var s=[e],c=gl.default.resolve(r,s);return c?f(c.implementation,s):f(r,a)}else return r(e,t,n);function f(p,m){try{return p.apply(p,m)}catch(g){var h;if(g instanceof TypeError&&((h=g.data)===null||h===void 0?void 0:h.category)==="wrongType"){var d=[];throw d.push("value: ".concat(Ct(e))),m.length>=2&&d.push("index: ".concat(Ct(t))),m.length>=3&&d.push("array: ".concat(Ct(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(r.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(r.name,": ").concat(g.message))}}}var Kq="filter",ez=["typed"],iy=N(Kq,ez,r=>{var{typed:e}=r;return e("filter",{"Array, function":aC,"Matrix, function":function(n,i){return n.create(aC(n.toArray(),i))},"Array, RegExp":zs,"Matrix, RegExp":function(n,i){return n.create(zs(n.toArray(),i))}})});function aC(r,e){return zf(r,function(t,n,i){return yi(e,t,[n],i,"filter")})}var oC="flatten",tz=["typed","matrix"],ay=N(oC,tz,r=>{var{typed:e,matrix:t}=r;return e(oC,{Array:function(i){return mt(i)},Matrix:function(i){var a=mt(i.toArray());return t(a)}})});var sC="forEach",rz=["typed"],oy=N(sC,rz,r=>{var{typed:e}=r;return e(sC,{"Array, function":nz,"Matrix, function":function(n,i){n.forEach(i)}})});function nz(r,e){var t=function n(i,a){if(Array.isArray(i))Ha(i,function(o,l){n(o,a.concat(l))});else return yi(e,i,a,r,"forEach")};t(r,[])}var uC="getMatrixDataType",iz=["typed"],sy=N(uC,iz,r=>{var{typed:e}=r;return e(uC,{Array:function(n){return Ga(n,Ct)},Matrix:function(n){return n.getDataType()}})});var lC="identity",az=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],uy=N(lC,az,r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=r;return e(lC,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(c){return n(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?n(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=rt(s)||rt(c)?i:null;if(rt(s)&&(s=s.toNumber()),rt(c)&&(c=c.toNumber()),!$e(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!$e(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=Ii([],d,h),v=s<c?s:c,w=0;w<v;w++)g[w][w]=m;return g}});var cC="kron",oz=["typed","matrix","multiplyScalar"],ly=N(cC,oz,r=>{var{typed:e,matrix:t,multiplyScalar:n}=r;return e(cC,{"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(tt(a).length===1&&(a=[a]),tt(o).length===1&&(o=[o]),tt(a).length>2||tt(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(n(f,p))})})})})&&l}});var fC="map",sz=["typed"],cy=N(fC,sz,r=>{var{typed:e}=r;return e(fC,{"Array, function":uz,"Matrix, function":function(n,i){return n.map(i)}})});function uz(r,e){var t=function n(i,a){return Array.isArray(i)?i.map(function(o,l){return n(o,a.concat(l))}):yi(e,i,a,r,"map")};return t(r,[])}var pC="diff",lz=["typed","matrix","subtract","number"],vl=N(pC,lz,r=>{var{typed:e,matrix:t,subtract:n,number:i}=r;return e(pC,{"Array | Matrix":function(c){return Ge(c)?t(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!$e(f))throw new RangeError("Dimension must be a whole number");return Ge(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(Ge(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<f;p++)c.push(l(s[p-1],s[p]));return c}function l(s,c){Ge(s)&&(s=s.toArray()),Ge(c)&&(c=c.toArray());var f=Array.isArray(s),p=Array.isArray(c);if(f&&p)return u(s,c);if(!f&&!p)return n(c,s);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function u(s,c){if(s.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],p=s.length,m=0;m<p;m++)f.push(l(s[m],c[m]));return f}});var cz="ones",fz=["typed","config","matrix","BigNumber"],fy=N(cz,fz,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;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=n(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Ii(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){rt(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!$e(s)||s<0)throw new Error("Parameters in function ones must be positive integers")})}});function Ys(){throw new Error('No "bignumber" implementation available')}function sp(){throw new Error('No "fraction" implementation available')}function up(){throw new Error('No "matrix" implementation available')}var mC="range",pz=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],yl=N(mC,pz,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=r;return e(mC,{string:p,"string, boolean":p,"number, number":function(g,v){return f(m(g,v,1,!1))},"number, number, number":function(g,v,w){return f(m(g,v,w,!1))},"number, number, boolean":function(g,v,w){return f(m(g,v,1,w))},"number, number, number, boolean":function(g,v,w,y){return f(m(g,v,w,y))},"BigNumber, BigNumber":function(g,v){var w=g.constructor;return f(m(g,v,new w(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,v,w){return f(m(g,v,w,!1))},"BigNumber, BigNumber, boolean":function(g,v,w){var y=g.constructor;return f(m(g,v,new y(1),w))},"BigNumber, BigNumber, BigNumber, boolean":function(g,v,w,y){return f(m(g,v,w,y))},"Unit, Unit, Unit":function(g,v,w){return f(m(g,v,w,!1))},"Unit, Unit, Unit, boolean":function(g,v,w,y){return f(m(g,v,w,y))}});function f(d){return t.matrix==="Matrix"?n?n(d):up():d}function p(d,g){var v=h(d);if(!v)throw new SyntaxError('String "'+d+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&Ys(),f(m(i(v.start),i(v.end),i(v.step)),g)):f(m(v.start,v.end,v.step,g))}function m(d,g,v,w){for(var y=[],x=c(v)?w?o:a:w?u:l,_=d;x(_,g);)y.push(_),_=s(_,v);return y}function h(d){var g=d.split(":"),v=g.map(function(y){return Number(y)}),w=v.some(function(y){return isNaN(y)});if(w)return null;switch(v.length){case 2:return{start:v[0],end:v[1],step:1};case 3:return{start:v[0],end:v[2],step:v[1]};default:return null}}});var dC="reshape",mz=["typed","isInteger","matrix"],py=N(dC,mz,r=>{var{typed:e,isInteger:t}=r;return e(dC,{"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)}),el(i,a)}})});var dz="resize",hz=["config","matrix"],my=N(dz,hz,r=>{var{config:e,matrix:t}=r;return function(a,o,l){if(arguments.length!==2&&arguments.length!==3)throw new ya("resize",arguments.length,2,3);if(Ge(o)&&(o=o.valueOf()),rt(o[0])&&(o=o.map(function(c){return rt(c)?c.toNumber():c})),Ge(a))return a.resize(o,l,!0);if(typeof a=="string")return n(a,o,l);var u=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return Qe(a)}else{Array.isArray(a)||(a=[a]),a=Qe(a);var s=Ii(a,o,l);return u?t(s):s}};function n(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 st(a.length,1);var l=a[0];if(typeof l!="number"||!$e(l))throw new TypeError("Invalid size, must contain positive integers (size: "+at(a)+")");if(i.length>l)return i.substring(0,l);if(i.length<l){for(var u=i,s=0,c=l-i.length;s<c;s++)u+=o;return u}else return i}});var hC="rotate",gz=["typed","multiply","rotationMatrix"],dy=N(hC,gz,r=>{var{typed:e,multiply:t,rotationMatrix:n}=r;return e(hC,{"Array , number | BigNumber | Complex | Unit":function(o,l){i(o,2);var u=t(n(l),o);return u.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,l){return i(o,2),t(n(l),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){i(o,3);var s=t(n(l,u),o);return s},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){return i(o,3),t(n(l,u),o)}});function i(a,o){var l=Array.isArray(a)?tt(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 gC="rotationMatrix",vz=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],hy=N(gC,vz,r=>{var{typed:e,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:l,matrix:u,DenseMatrix:s,SparseMatrix:c,cos:f,sin:p}=r;return e(gC,{"":function(){return t.matrix==="Matrix"?u([]):[]},string:function(y){return u(y)},"number | BigNumber | Complex | Unit":function(y){return m(y,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(y,x){return m(y,x)},"number | BigNumber | Complex | Unit, Array":function(y,x){var _=u(x);return h(_),v(y,_,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(y,x){h(x);var _=x.storage()||(t.matrix==="Matrix"?"dense":void 0);return v(y,x,_)},"number | BigNumber | Complex | Unit, Array, string":function(y,x,_){var b=u(x);return h(b),v(y,b,_)},"number | BigNumber | Complex | Unit, Matrix, string":function(y,x,_){return h(x),v(y,x,_)}});function m(w,y){var x=rt(w),_=x?new l(-1):-1,b=f(w),D=p(w),S=[[b,n(_,D)],[D,b]];return g(S,y)}function h(w){var y=w.size();if(y.length<1||y[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(w){return w.reduce((y,x)=>n(y,x))}function g(w,y){if(y){if(y==="sparse")return new c(w);if(y==="dense")return new s(w);throw new TypeError('Unknown matrix type "'.concat(y,'"'))}return w}function v(w,y,x){var _=o(y);if(_===0)throw new RangeError("Rotation around zero vector");var b=rt(w)?l:null,D=b?new b(1):1,S=b?new b(-1):-1,A=b?new b(y.get([0])/_):y.get([0])/_,E=b?new b(y.get([1])/_):y.get([1])/_,M=b?new b(y.get([2])/_):y.get([2])/_,F=f(w),P=i(D,a(F)),k=p(w),O=i(F,d([A,A,P])),I=i(d([A,E,P]),d([S,M,k])),T=i(d([A,M,P]),d([E,k])),q=i(d([A,E,P]),d([M,k])),B=i(F,d([E,E,P])),U=i(d([E,M,P]),d([S,A,k])),G=i(d([A,M,P]),d([S,E,k])),H=i(d([E,M,P]),d([A,k])),L=i(F,d([M,M,P])),ie=[[O,I,T],[q,B,U],[G,H,L]];return g(ie,x)}});var vC="row",yz=["typed","Index","matrix","range"],bl=N(vC,yz,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(vC,{"Matrix, number":a,"Array, number":function(l,u){return a(n(Qe(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Gt(l,o.size()[0]);var u=i(0,o.size()[1]),s=new t(l,u),c=o.subset(s);return Ge(c)?c:n([[c]])}});var yC="size",bz=["typed","config","?matrix"],gy=N(yC,bz,r=>{var{typed:e,config:t,matrix:n}=r;return e(yC,{Matrix:function(a){return a.create(a.size())},Array:tt,string:function(a){return t.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:n?n([]):up()}})});var bC="squeeze",xz=["typed","matrix"],vy=N(bC,xz,r=>{var{typed:e,matrix:t}=r;return e(bC,{Array:function(i){return qs(Qe(i))},Matrix:function(i){var a=qs(i.toArray());return Array.isArray(a)?t(a):a},any:function(i){return Qe(i)}})});var xC="subset",wz=["typed","matrix","zeros","add"],xl=N(xC,wz,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r;return e(xC,{"Matrix, Index":function(l,u){return Ro(u)?t():(Ku(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":Az,"string, Index":_z,"Matrix, Index, any, any":function(l,u,s,c){return Ro(u)?l:(Ku(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":wC,"string, Index, string, string":wC,"Object, Index, any":Dz});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,n(u))}catch(s){return o}else return o}});function _z(r,e){if(!za(e))throw new TypeError("Index expected");if(Ro(e))return"";if(Ku(Array.from(r),e),e.size().length!==1)throw new st(e.size().length,1);var t=r.length;Gt(e.min()[0],t),Gt(e.max()[0],t);var n=e.dimension(0),i="";return n.forEach(function(a){i+=r.charAt(a)}),i}function wC(r,e,t,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Ro(e))return r;if(Ku(Array.from(r),e),e.size().length!==1)throw new st(e.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new st(i.size()[0],t.length);var o=r.length;Gt(e.min()[0]),Gt(e.max()[0]);for(var l=[],u=0;u<o;u++)l[u]=r.charAt(u);if(i.forEach(function(f,p){l[f]=t.charAt(p[0])}),l.length>o)for(var s=o-1,c=l.length;s<c;s++)l[s]||(l[s]=n);return l.join("")}function Az(r,e){if(!Ro(e)){if(e.size().length!==1)throw new st(e.size(),1);var t=e.dimension(0);if(typeof t!="string")throw new TypeError("String expected as index to retrieve an object property");return vr(r,t)}}function Dz(r,e,t){if(Ro(e))return r;if(e.size().length!==1)throw new st(e.size(),1);var n=e.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");var i=Qe(r);return ji(i,n,t),i}var _C="transpose",Ez=["typed","matrix"],yy=N(_C,Ez,r=>{var{typed:e,matrix:t}=r;return e(_C,{Array:o=>n(t(o)).valueOf(),Matrix:n,any:Qe});function n(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: "+at(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: "+at(l)+")")}return u}function i(o,l,u){for(var s=o._data,c=[],f,p=0;p<u;p++){f=c[p]=[];for(var m=0;m<l;m++)f[m]=Qe(s[m][p])}return o.createDenseMatrix({data:c,size:[u,l],datatype:o._datatype})}function a(o,l,u){for(var s=o._values,c=o._index,f=o._ptr,p=s?[]:void 0,m=[],h=[],d=[],g=0;g<l;g++)d[g]=0;var v,w,y;for(v=0,w=c.length;v<w;v++)d[c[v]]++;for(var x=0,_=0;_<l;_++)h.push(x),x+=d[_],d[_]=h[_];for(h.push(x),y=0;y<u;y++)for(var b=f[y],D=f[y+1],S=b;S<D;S++){var A=d[c[S]]++;m[A]=y,s&&(p[A]=Qe(s[S]))}return o.createSparseMatrix({values:p,index:m,ptr:h,size:[u,l],datatype:o._datatype})}});var AC="ctranspose",Sz=["typed","transpose","conj"],by=N(AC,Sz,r=>{var{typed:e,transpose:t,conj:n}=r;return e(AC,{any:function(a){return n(t(a))}})});var DC="zeros",Nz=["typed","config","matrix","BigNumber"],xy=N(DC,Nz,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(DC,{"":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=n(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Ii(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){rt(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!$e(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var EC="fft",Cz=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],wy=N(EC,Cz,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:l,i:u,dotDivide:s,conj:c,pow:f,ceil:p,log2:m}=r;return e(EC,{Array:h,Matrix:function(y){return y.create(h(y.toArray()))}});function h(w){var y=tt(w);return y.length===1?v(w,y[0]):d(w.map(x=>h(x,y.slice(1))),0)}function d(w,y){var x=tt(w);if(y!==0)return new Array(x[0]).fill(0).map((b,D)=>d(w[D],y-1));if(x.length===1)return v(w);function _(b){var D=tt(b);return new Array(D[1]).fill(0).map((S,A)=>new Array(D[0]).fill(0).map((E,M)=>b[M][A]))}return _(d(_(w),1))}function g(w){for(var y=w.length,x=o(a(i(-1,i(u,l)),y)),_=[],b=1-y;b<y;b++)_.push(f(x,a(f(b,2),2)));for(var D=f(2,p(m(y+y-1))),S=[...new Array(y).fill(0).map((I,T)=>i(w[T],_[y-1+T])),...new Array(D-y).fill(0)],A=[...new Array(y+y-1).fill(0).map((I,T)=>a(1,_[T])),...new Array(D-(y+y-1)).fill(0)],E=v(S),M=v(A),F=new Array(D).fill(0).map((I,T)=>i(E[T],M[T])),P=s(c(h(c(F))),D),k=[],O=y-1;O<y+y-1;O++)k.push(i(P[O],_[O]));return k}function v(w){var y=w.length;if(y===1)return[w[0]];if(y%2===0){for(var x=[...v(w.filter((S,A)=>A%2===0),y/2),...v(w.filter((S,A)=>A%2===1),y/2)],_=0;_<y/2;_++){var b=x[_],D=i(x[_+y/2],o(i(i(l,u),a(-_,y))));x[_]=n(b,D),x[_+y/2]=n(b,i(-1,D))}return x}else return g(w)}});var SC="ifft",Mz=["typed","fft","dotDivide","conj"],_y=N(SC,Mz,r=>{var{typed:e,fft:t,dotDivide:n,conj:i}=r;return e(SC,{"Array | Matrix":function(o){var l=Ge(o)?o.size():tt(o);return n(i(t(i(o))),l.reduce((u,s)=>u*s,1))}})});function Ka(r){"@babel/helpers - typeof";return Ka=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},Ka(r)}function Ay(r,e){if(Ka(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Ka(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Dy(r){var e=Ay(r,"string");return Ka(e)=="symbol"?e:String(e)}function Ut(r,e,t){return e=Dy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function NC(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Tz(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?NC(Object(t),!0).forEach(function(n){Ut(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):NC(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Fz="solveODE",Iz=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],Ey=N(Fz,Iz,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,max:o,map:l,abs:u,isPositive:s,isNegative:c,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:d}=r;function g(S){return function(A,E,M,F){var P=!(E.length===2&&(E.every(b)||E.every(un)));if(P)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var k=E[0],O=E[1],I=f(O,k),T=F.firstStep;if(T!==void 0&&!s(T))throw new Error('"firstStep" must be positive');var q=F.maxStep;if(q!==void 0&&!s(q))throw new Error('"maxStep" must be positive');var B=F.minStep;if(B&&c(B))throw new Error('"minStep" must be positive or zero');var U=[k,O,T,B,q].filter(Ue=>Ue!==void 0);if(!(U.every(b)||U.every(un)))throw new Error('Inconsistent type of "t" dependant variables');for(var G=1,H=F.tol?F.tol:1e-4,L=F.minDelta?F.minDelta:.2,ie=F.maxDelta?F.maxDelta:5,ve=F.maxIter?F.maxIter:1e4,se=[k,O,...M,q,B].some(rt),[ue,he,K,re]=se?[h(S.a),h(S.c),h(S.b),h(S.bp)]:[S.a,S.c,S.b,S.bp],me=T?I?T:d(T):a(n(O,k),G),de=[k],Pe=[M],we=n(K,re),V=0,J=0,ce=x(I),W=_(I);ce(de[V],O);){var ee=[];me=W(de[V],O,me),ee.push(A(de[V],Pe[V]));for(var ne=1;ne<he.length;++ne)ee.push(A(t(de[V],i(he[ne],me)),t(Pe[V],i(me,ue[ne],ee))));var ge=o(u(l(i(we,ee),Ue=>un(Ue)?Ue.value:Ue)));ge<H&&H/ge>1/4&&(de.push(t(de[V],me)),Pe.push(t(Pe[V],i(me,K,ee))),V++);var ye=.84*(H/ge)**(1/5);if(p(ye,L)?ye=L:f(ye,ie)&&(ye=ie),ye=se?h(ye):ye,me=i(me,ye),q&&f(u(me),q)?me=I?q:d(q):B&&p(u(me),B)&&(me=I?B:d(B)),J++,J>ve)throw new Error("Maximum number of iterations reached, try changing options")}return{t:de,y:Pe}}}function v(S,A,E,M){var F=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],P=[null,1/2,3/4,1],k=[2/9,1/3,4/9,0],O=[7/24,1/4,1/3,1/8],I={a:F,c:P,b:k,bp:O};return g(I)(S,A,E,M)}function w(S,A,E,M){var F=[[],[.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]],P=[null,1/5,3/10,4/5,8/9,1,1],k=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],O=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],I={a:F,c:P,b:k,bp:O};return g(I)(S,A,E,M)}function y(S,A,E,M){var F=M.method?M.method:"RK45",P={RK23:v,RK45:w};if(F.toUpperCase()in P){var k=Tz({},M);return delete k.method,P[F.toUpperCase()](S,A,E,k)}else{var O=Object.keys(P).map(T=>'"'.concat(T,'"')),I="".concat(O.slice(0,-1).join(", ")," and ").concat(O.slice(-1));throw new Error('Unavailable method "'.concat(F,'". Available methods are ').concat(I))}}function x(S){return S?p:f}function _(S){var A=S?f:p;return function(E,M,F){var P=t(E,F);return A(P,M)?n(M,E):F}}function b(S){return rt(S)||it(S)}function D(S,A,E,M){var F=y(S,A.toArray(),E.toArray(),M);return{t:m(F.t),y:m(F.y)}}return e("solveODE",{"function, Array, Array, Object":y,"function, Matrix, Matrix, Object":D,"function, Array, Array":(S,A,E)=>y(S,A,E,{}),"function, Matrix, Matrix":(S,A,E)=>D(S,A,E,{}),"function, Array, number | BigNumber | Unit":(S,A,E)=>{var M=y(S,A,[E],{});return{t:M.t,y:M.y.map(F=>F[0])}},"function, Matrix, number | BigNumber | Unit":(S,A,E)=>{var M=y(S,A.toArray(),[E],{});return{t:m(M.t),y:m(M.y.map(F=>F[0]))}},"function, Array, number | BigNumber | Unit, Object":(S,A,E,M)=>{var F=y(S,A,[E],M);return{t:F.t,y:F.y.map(P=>P[0])}},"function, Matrix, number | BigNumber | Unit, Object":(S,A,E,M)=>{var F=y(S,A.toArray(),[E],M);return{t:m(F.t),y:m(F.y.map(P=>P[0]))}}})});var Bz="erf",Pz=["typed"],Sy=N(Bz,Pz,r=>{var{typed:e}=r;return e("name",{number:function(o){var l=Math.abs(o);return l>=kz?hi(o):l<=Oz?hi(o)*t(l):l<=4?hi(o)*(1-n(l)):hi(o)*(1-i(l))},"Array | Matrix":e.referToSelf(a=>o=>Je(o,a))});function t(a){var o=a*a,l=ba[0][4]*o,u=o,s;for(s=0;s<3;s+=1)l=(l+ba[0][s])*o,u=(u+Xs[0][s])*o;return a*(l+ba[0][3])/(u+Xs[0][3])}function n(a){var o=ba[1][8]*a,l=a,u;for(u=0;u<7;u+=1)o=(o+ba[1][u])*a,l=(l+Xs[1][u])*a;var s=(o+ba[1][7])/(l+Xs[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=ba[2][5]*o,u=o,s;for(s=0;s<4;s+=1)l=(l+ba[2][s])*o,u=(u+Xs[2][s])*o;var c=o*(l+ba[2][4])/(u+Xs[2][4]);c=(Rz-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),Oz=.46875,Rz=.5641895835477563,ba=[[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]],Xs=[[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]],kz=Math.pow(2,53);var CC="zeta",Lz=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],Ny=N(CC,Lz,r=>{var{typed:e,config:t,multiply:n,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}=r;return e(CC,{number:b=>v(b,D=>D,()=>20),BigNumber:b=>v(b,D=>new d(D),()=>Math.abs(Math.log10(t.epsilon))),Complex:w});function v(b,D,S){return l(b,0)?D(-.5):l(b,1)?D(NaN):isFinite(b)?y(b,D,S,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):y(b,D=>D,D=>Math.round(1.3*15+.9*Math.abs(D.im)),D=>D.re)}function y(b,D,S,A){var E=S(b);if(A(b)>-(E-1)/2)return _(b,D(E),D);var M=n(i(2,b),i(D(g),p(b,1)));return M=n(M,f(n(a(D(g),2),b))),M=n(M,c(p(1,b))),n(M,y(p(1,b),D,S,A))}function x(b,D){for(var S=b,A=b;u(A,D);A=m(A,1)){var E=a(n(o(m(D,p(A,1))),i(4,A)),n(o(p(D,A)),o(n(2,A))));S=m(S,E)}return n(D,S)}function _(b,D,S){for(var A=a(1,n(x(S(0),D),p(1,i(2,p(1,b))))),E=S(0),M=S(1);u(M,D);M=m(M,1))E=m(E,a(n((-1)**(M-1),x(M,D)),i(M,b)));return n(A,E)}});var MC="mode",Uz=["typed","isNaN","isNumeric"],Cy=N(MC,Uz,r=>{var{typed:e,isNaN:t,isNumeric:n}=r;return e(MC,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=mt(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;c<a.length;c++){var f=a[c];if(n(f)&&t(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in l||(l[f]=0),l[f]++,l[f]===s?u.push(f):l[f]>s&&(s=l[f],u=[f])}return u}});function Ar(r,e,t){var n;return String(r).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Ct(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(r).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Ct(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var TC="prod",Vz=["typed","config","multiplyScalar","numeric"],My=N(TC,Vz,r=>{var{typed:e,config:t,multiplyScalar:n,numeric:i}=r;return e(TC,{"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(yn(o,function(u){try{l=l===void 0?u:n(l,u)}catch(s){throw Ar(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 FC="format",qz=["typed"],Ty=N(FC,qz,r=>{var{typed:e}=r;return e(FC,{any:at,"any, Object | function | number":at})});var IC="bin",zz=["typed","format"],Fy=N(IC,zz,r=>{var{typed:e,format:t}=r;return e(IC,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var BC="oct",$z=["typed","format"],Iy=N(BC,$z,r=>{var{typed:e,format:t}=r;return e(BC,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var PC="hex",Hz=["typed","format"],By=N(PC,Hz,r=>{var{typed:e,format:t}=r;return e(PC,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var lp=/\$([\w.]+)/g;var OC="print",Gz=["typed"],wl=N(OC,Gz,r=>{var{typed:e}=r;return e(OC,{"string, Object | Array":RC,"string, Object | Array, number | Object":RC})});function RC(r,e,t){return r.replace(lp,function(n,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?wr(o)?o:at(o,t):n})}var kC="to",Wz=["typed","matrix","concat"],Py=N(kC,Wz,r=>{var{typed:e,matrix:t,concat:n}=r,i=ct({typed:e,matrix:t,concat:n});return e(kC,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var LC="isPrime",jz=["typed"],Oy=N(LC,jz,r=>{var{typed:e}=r;return e(LC,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(w,y,x){for(var _=1;!y.eq(0);)y.mod(2).eq(0)?(y=y.div(2),w=w.mul(w).mod(x)):(y=y.sub(1),_=w.mul(_).mod(x));return _}var l=n.constructor.clone({precision:n.toFixed(0).length*2});n=new l(n);for(var u=0,s=n.sub(1);s.mod(2).eq(0);)s=s.div(2),u+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(w=>w<n);else{var f=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));c=[];for(var p=2;p<=f;p+=1)c.push(f)}for(var m=0;m<c.length;m+=1){var h=c[m],d=o(n.sub(n).add(h),s,n);if(!d.eq(1)){for(var g=0,v=d;!v.eq(n.sub(1));g+=1,v=v.mul(v).mod(n))if(g===u-1)return!1}}return!0},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var Zz="numeric",Jz=["number","?bignumber","?fraction"],Ry=N(Zz,Jz,r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):Ys,Fraction:n?o=>n(o):sp};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=Ct(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 UC="divideScalar",Yz=["typed","numeric"],ky=N(UC,Yz,r=>{var{typed:e,numeric:t}=r;return e(UC,{"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":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var VC="pow",Xz=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Ly=N(VC,Xz,r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:a,inv:o,number:l,fraction:u,Complex:s}=r;return e(VC,{"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&&!$e(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(v){}return t.predictable&&(m<-1&&h===1/0||m>-1&&m<0&&h===-1/0)?NaN:$e(h)||m>=0||t.predictable?dg(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(!$e(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=tt(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=n(d[0]).valueOf(),v=m;h>=1;)(h&1)===1&&(g=i(v,g)),h>>=1,v=i(v,v);return g}function p(m,h){return a(f(m.valueOf(),h))}});var Qs="Number of decimals in function round must be an integer",qC="round",Qz=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Uy=N(qC,Qz,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=r,l=Wt({typed:e,equalScalar:n}),u=kt({typed:e,DenseMatrix:o}),s=Br({typed:e});return e(qC,{number:hg,"number, number":hg,"number, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(Qs);return new a(f).toDecimalPlaces(p.toNumber())},Complex:function(f){return f.round()},"Complex, number":function(f,p){if(p%1)throw new TypeError(Qs);return f.round(p)},"Complex, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(Qs);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(Qs);return f.toDecimalPlaces(p.toNumber())},Fraction:function(f){return f.round()},"Fraction, number":function(f,p){if(p%1)throw new TypeError(Qs);return f.round(p)},"Fraction, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(Qs);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)=>Je(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=>Je(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)=>n(f,0)?i(p.size(),p.storage()):u(p,f,c,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(c=>(f,p)=>n(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 zC="log",Kz=["config","typed","divideScalar","Complex"],Vy=N(zC,Kz,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r;return e(zC,{number:function(o){return o>=0||t.predictable?GS(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)=>n(a(o),a(l)))})});var $C="log1p",e$=["typed","config","divideScalar","log","Complex"],qy=N($C,e$,r=>{var{typed:e,config:t,divideScalar:n,log:i,Complex:a}=r;return e($C,{number:function(u){return u>=-1||t.predictable?Of(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=>Je(u,l)),"any, any":e.referToSelf(l=>(u,s)=>n(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 HC="nthRoots",t$=["config","typed","divideScalar","Complex"],zy=N(HC,t$,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r,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<u;d++){var g=(c+4*d)/u;if(g===Math.round(g)){m.push(a[g%4](h));continue}m.push(new i({r:h,phi:(f+2*Math.PI*d)/u}))}return m}return e(HC,{Complex:function(u){return o(u,2)},"Complex, number":o})});var GC="dotPow",r$=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],$y=N(GC,r$,r=>{var{typed:e,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o}=r,l=ir({typed:e}),u=Vr({typed:e,DenseMatrix:a}),s=Wt({typed:e,equalScalar:t}),c=kt({typed:e,DenseMatrix:a}),f=ct({typed:e,matrix:n,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(GC,f({elop:h,SS:u,DS:l,Ss:s,sS:c}))});var WC="dotDivide",n$=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Hy=N(WC,n$,r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=r,l=Pr({typed:e,equalScalar:n}),u=ir({typed:e}),s=Vr({typed:e,DenseMatrix:a}),c=Wt({typed:e,equalScalar:n}),f=kt({typed:e,DenseMatrix:a}),p=ct({typed:e,matrix:t,concat:o});return e(WC,p({elop:i,SS:s,DS:u,SD:l,Ss:c,sS:f}))});function Xi(r){var{DenseMatrix:e}=r;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+at(o)+")");var l=o[0],u=o[1];if(l!==u)throw new RangeError("Matrix must be square (size: "+at(o)+")");var s=[];if(Ge(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<l;p++)s[p]=[f[p]];return new e({data:s,size:[l,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==l||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Bo(i)){if(a){s=[];for(var m=0;m<l;m++)s[m]=[f[m][0]];return new e({data:s,size:[l,1],datatype:i._datatype})}return i}if(Mi(i)){for(var h=0;h<l;h++)s[h]=[0];for(var d=i._values,g=i._index,v=i._ptr,w=v[1],y=v[0];y<w;y++){var x=g[y];s[x][0]=d[y]}return new e({data:s,size:[l,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(Tt(i)){var _=tt(i);if(_.length===1){if(_[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<l;b++)s[b]=[i[b]];return new e({data:s,size:[l,1]})}if(_.length===2){if(_[0]!==l||_[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var D=0;D<l;D++)s[D]=[i[D][0]];return new e({data:s,size:[l,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var jC="lsolve",i$=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Gy=N(jC,i$,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=Xi({DenseMatrix:l});return e(jC,{"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=[],v=f._data,w=0;w<d;w++){var y=m[w][0]||0,x=void 0;if(o(y,0))x=0;else{var _=v[w][w];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(y,_);for(var b=w+1;b<h;b++)m[b]=[a(m[b][0]||0,i(x,v[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,v=f._index,w=f._ptr,y=[],x=0;x<d;x++){var _=m[x][0]||0;if(o(_,0))y[x]=[0];else{for(var b=0,D=[],S=[],A=w[x],E=w[x+1],M=A;M<E;M++){var F=v[M];F===x?b=g[M]:F>x&&(D.push(g[M]),S.push(F))}if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(_,b),k=0,O=S.length;k<O;k++){var I=S[k];m[I]=[a(m[I][0]||0,i(P,D[k]))]}y[x]=[P]}}return new l({data:y,size:[h,1]})}});var ZC="usolve",a$=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Wy=N(ZC,a$,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=Xi({DenseMatrix:l});return e(ZC,{"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=[],v=f._data,w=d-1;w>=0;w--){var y=m[w][0]||0,x=void 0;if(o(y,0))x=0;else{var _=v[w][w];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(y,_);for(var b=w-1;b>=0;b--)m[b]=[a(m[b][0]||0,i(x,v[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,v=f._index,w=f._ptr,y=[],x=d-1;x>=0;x--){var _=m[x][0]||0;if(o(_,0))y[x]=[0];else{for(var b=0,D=[],S=[],A=w[x],E=w[x+1],M=E-1;M>=A;M--){var F=v[M];F===x?b=g[M]:F<x&&(D.push(g[M]),S.push(F))}if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(_,b),k=0,O=S.length;k<O;k++){var I=S[k];m[I]=[a(m[I][0],i(P,D[k]))]}y[x]=[P]}}return new l({data:y,size:[h,1]})}});var JC="lsolveAll",o$=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],jy=N(JC,o$,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=Xi({DenseMatrix:l});return e(JC,{"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(S=>S[0])],h=f._data,d=f._size[0],g=f._size[1],v=0;v<g;v++)for(var w=m.length,y=0;y<w;y++){var x=m[y];if(o(h[v][v],0))if(o(x[v],0)){if(y===0){var b=[...x];b[v]=1;for(var D=v+1;D<g;D++)b[D]=a(b[D],h[D][v]);m.push(b)}}else{if(y===0)return[];m.splice(y,1),y-=1,w-=1}else{x[v]=n(x[v],h[v][v]);for(var _=v+1;_<g;_++)x[_]=a(x[_],i(x[v],h[_][v]))}}return m.map(S=>new l({data:S.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(G=>G[0])],h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=0;y<d;y++)for(var x=m.length,_=0;_<x;_++){for(var b=m[_],D=[],S=[],A=w[y],E=w[y+1],M=0,F=A;F<E;F++){var P=v[F];P===y?M=g[F]:P>y&&(D.push(g[F]),S.push(P))}if(o(M,0))if(o(b[y],0)){if(_===0){var T=[...b];T[y]=1;for(var q=0,B=S.length;q<B;q++){var U=S[q];T[U]=a(T[U],D[q])}m.push(T)}}else{if(_===0)return[];m.splice(_,1),_-=1,x-=1}else{b[y]=n(b[y],M);for(var k=0,O=S.length;k<O;k++){var I=S[k];b[I]=a(b[I],i(b[y],D[k]))}}}return m.map(G=>new l({data:G.map(H=>[H]),size:[h,1]}))}});var YC="usolveAll",s$=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Zy=N(YC,s$,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=Xi({DenseMatrix:l});return e(YC,{"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(S=>S[0])],h=f._data,d=f._size[0],g=f._size[1],v=g-1;v>=0;v--)for(var w=m.length,y=0;y<w;y++){var x=m[y];if(o(h[v][v],0))if(o(x[v],0)){if(y===0){var b=[...x];b[v]=1;for(var D=v-1;D>=0;D--)b[D]=a(b[D],h[D][v]);m.push(b)}}else{if(y===0)return[];m.splice(y,1),y-=1,w-=1}else{x[v]=n(x[v],h[v][v]);for(var _=v-1;_>=0;_--)x[_]=a(x[_],i(x[v],h[_][v]))}}return m.map(S=>new l({data:S.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(G=>G[0])],h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=d-1;y>=0;y--)for(var x=m.length,_=0;_<x;_++){for(var b=m[_],D=[],S=[],A=w[y],E=w[y+1],M=0,F=E-1;F>=A;F--){var P=v[F];P===y?M=g[F]:P<y&&(D.push(g[F]),S.push(P))}if(o(M,0))if(o(b[y],0)){if(_===0){var T=[...b];T[y]=1;for(var q=0,B=S.length;q<B;q++){var U=S[q];T[U]=a(T[U],D[q])}m.push(T)}}else{if(_===0)return[];m.splice(_,1),_-=1,x-=1}else{b[y]=n(b[y],M);for(var k=0,O=S.length;k<O;k++){var I=S[k];b[I]=a(b[I],i(b[y],D[k]))}}}return m.map(G=>new l({data:G.map(H=>[H]),size:[h,1]}))}});var u$="matAlgo08xS0Sid",l$=["typed","equalScalar"],Ks=N(u$,l$,r=>{var{typed:e,equalScalar:t}=r;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 st(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 v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));for(var D=[],S=[],A=[],E=[],M=[],F,P,k,O,I=0;I<w;I++){A[I]=S.length;var T=I+1;for(P=s[I],k=s[I+1],F=P;F<k;F++)O=u[F],M[O]=T,E[O]=l[F],S.push(O);for(P=h[I],k=h[I+1],F=P;F<k;F++)O=m[F],M[O]===T&&(E[O]=b(E[O],p[F]));for(F=A[I];F<S.length;){O=S[F];var q=E[O];x(q,_)?S.splice(F,1):(D.push(q),F++)}}return A[w]=S.length,i.createSparseMatrix({values:D,index:S,ptr:A,size:[v,w],datatype:y})}});var eu=N("useMatrixForArrayScalar",["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf())}});var XC="leftShift",c$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Jy=N(XC,c$,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=bn({typed:e}),u=Pr({typed:e,equalScalar:n}),s=Ks({typed:e,equalScalar:n}),c=qn({typed:e,DenseMatrix:a}),f=Wt({typed:e,equalScalar:n}),p=Br({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=eu({typed:e,matrix:t});return e(XC,{"number, number":xg,"BigNumber, BigNumber":qN,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var QC="rightArithShift",f$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Yy=N(QC,f$,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=bn({typed:e}),u=Pr({typed:e,equalScalar:n}),s=Ks({typed:e,equalScalar:n}),c=qn({typed:e,DenseMatrix:a}),f=Wt({typed:e,equalScalar:n}),p=Br({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=eu({typed:e,matrix:t});return e(QC,{"number, number":wg,"BigNumber, BigNumber":zN,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var KC="rightLogShift",p$=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Xy=N(KC,p$,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=bn({typed:e}),u=Pr({typed:e,equalScalar:n}),s=Ks({typed:e,equalScalar:n}),c=qn({typed:e,DenseMatrix:a}),f=Wt({typed:e,equalScalar:n}),p=Br({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=eu({typed:e,matrix:t});return e(KC,{"number, number":_g,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var eM="and",m$=["typed","matrix","equalScalar","zeros","not","concat"],_l=N(eM,m$,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=Pr({typed:e,equalScalar:n}),u=Qa({typed:e,equalScalar:n}),s=Wt({typed:e,equalScalar:n}),c=Br({typed:e}),f=ct({typed:e,matrix:t,concat:o});return e(eM,{"number, number":Cg,"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 cp="compare",d$=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],Qy=N(cp,d$,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:l,concat:u}=r,s=ir({typed:e}),c=Xa({typed:e,equalScalar:n}),f=kt({typed:e,DenseMatrix:l}),p=ct({typed:e,matrix:i,concat:u}),m=vi({typed:e});return e(cp,h$({typed:e,config:t}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return en(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$=N(cp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(cp,{"number, number":function(i,a){return Ir(i,a,t.epsilon)?0:i>a?1:-1}})});var qo=ur(rM(),1);var nM="compareNatural",g$=["typed","compare"],Ky=N(nM,g$,r=>{var{typed:e,compare:t}=r,n=t.signatures["boolean,boolean"];return e(nM,{"any, any":i});function i(u,s){var c=Ct(u),f=Ct(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,qo.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,qo.default)(c,f);if(c!==f)return(0,qo.default)(c,f);if(c==="Complex")return v$(u,s);if(c==="Unit")return u.equalBase(s)?i(u.value,s.value):o(i,u.formatUnits(),s.formatUnits());if(c==="boolean")return n(u,s);if(c==="string")return(0,qo.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 Mi(s)&&Mi(c)?o(u,s.toJSON().values,c.toJSON().values):Mi(s)?a(u,s.toArray(),c):Mi(c)?a(u,s,c.toArray()):Bo(s)?a(u,s.toJSON().data,c):Bo(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);f<p;f++){var m=u(s[f],c[f]);if(m!==0)return m}return s.length>c.length?1:s.length<c.length?-1:0}function l(u,s,c){var f=Object.keys(s),p=Object.keys(c);f.sort(qo.default),p.sort(qo.default);var m=o(u,f,p);if(m!==0)return m;for(var h=0;h<f.length;h++){var d=u(s[f[h]],c[p[h]]);if(d!==0)return d}return 0}});function v$(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0}var iM="compareText",y$=["typed","matrix","concat"];Vf.signature="any, any";var e0=N(iM,y$,r=>{var{typed:e,matrix:t,concat:n}=r,i=ct({typed:e,matrix:t,concat:n});return e(iM,Vf,i({elop:Vf,Ds:!0}))});var fp="equal",b$=["typed","matrix","equalScalar","DenseMatrix","concat"],t0=N(fp,b$,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Vr({typed:e,DenseMatrix:i}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(fp,x$({typed:e,equalScalar:n}),s({elop:n,SS:l,DS:o,Ss:u}))}),x$=N(fp,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(fp,{"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 aM="equalText",w$=["typed","compareText","isZero"],r0=N(aM,w$,r=>{var{typed:e,compareText:t,isZero:n}=r;return e(aM,{"any, any":function(a,o){return n(t(a,o))}})});var pp="smaller",_$=["typed","config","matrix","DenseMatrix","concat"],n0=N(pp,_$,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Vr({typed:e,DenseMatrix:i}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=vi({typed:e});return e(pp,A$({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<p,"BigNumber, BigNumber":function(p,m){return p.lt(m)&&!en(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.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}))}),A$=N(pp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(pp,{"number, number":function(i,a){return i<a&&!Ir(i,a,t.epsilon)}})});var mp="smallerEq",D$=["typed","config","matrix","DenseMatrix","concat"],i0=N(mp,D$,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Vr({typed:e,DenseMatrix:i}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=vi({typed:e});return e(mp,E$({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||en(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}))}),E$=N(mp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(mp,{"number, number":function(i,a){return i<=a||Ir(i,a,t.epsilon)}})});var dp="larger",S$=["typed","config","matrix","DenseMatrix","concat"],a0=N(dp,S$,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Vr({typed:e,DenseMatrix:i}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=vi({typed:e});return e(dp,N$({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!en(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}))}),N$=N(dp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(dp,{"number, number":function(i,a){return i>a&&!Ir(i,a,t.epsilon)}})});var hp="largerEq",C$=["typed","config","matrix","DenseMatrix","concat"],o0=N(hp,C$,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=ir({typed:e}),l=Vr({typed:e,DenseMatrix:i}),u=kt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=vi({typed:e});return e(hp,M$({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||en(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}))}),M$=N(hp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(hp,{"number, number":function(i,a){return i>=a||Ir(i,a,t.epsilon)}})});var oM="deepEqual",T$=["typed","equal"],s0=N(oM,T$,r=>{var{typed:e,equal:t}=r;return e(oM,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(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<o;l++)if(!n(i[l],a[l]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:t(i,a)}});var gp="unequal",F$=["typed","config","equalScalar","matrix","DenseMatrix","concat"],u0=N(gp,F$,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=r,l=ir({typed:e}),u=Vr({typed:e,DenseMatrix:a}),s=kt({typed:e,DenseMatrix:a}),c=ct({typed:e,matrix:i,concat:o});return e(gp,I$({typed:e,equalScalar:n}),c({elop:f,SS:u,DS:l,Ss:s}));function f(p,m){return!n(p,m)}}),I$=N(gp,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(gp,{"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 sM="partitionSelect",B$=["typed","isNumeric","isNaN","compare"],l0=N(sM,B$,r=>{var{typed:e,isNumeric:t,isNaN:n,compare:i}=r,a=i,o=(s,c)=>-i(s,c);return e(sM,{"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(!$e(c)||c<0)throw new Error("k must be a non-negative integer");if(Ge(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<s.length;p++)if(t(s[p])&&n(s[p]))return s[p];for(var m=0,h=s.length-1;m<h;){for(var d=m,g=h,v=s[Math.floor(Math.random()*(h-m+1))+m];d<g;)if(f(s[d],v)>=0){var w=s[g];s[g]=s[d],s[d]=w,--g}else++d;f(s[d],v)>0&&--d,c<=d?h=d:m=d+1}return s[c]}});var uM="sort",P$=["typed","matrix","compare","compareNatural"],c0=N(uM,P$,r=>{var{typed:e,matrix:t,compare:n,compareNatural:i}=r,a=n,o=(c,f)=>-n(c,f);return e(uM,{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(tt(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 lM="max",O$=["typed","config","numeric","larger"],Al=N(lM,O$,r=>{var{typed:e,config:t,numeric:n,larger:i}=r;return e(lM,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return Ya(u,s.valueOf(),a)},"...":function(u){if(gi(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 Ar(s,"max",u)}}function o(l){var u;if(yn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw Ar(c,"max",s)}}),u===void 0)throw new Error("Cannot calculate max of an empty array");return typeof u=="string"&&(u=n(u,t.number)),u}});var cM="min",R$=["typed","config","numeric","smaller"],Dl=N(cM,R$,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r;return e(cM,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return Ya(u,s.valueOf(),a)},"...":function(u){if(gi(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 Ar(s,"min",u)}}function o(l){var u;if(yn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw Ar(c,"min",s)}}),u===void 0)throw new Error("Cannot calculate min of an empty array");return typeof u=="string"&&(u=n(u,t.number)),u}});var k$="ImmutableDenseMatrix",L$=["smaller","DenseMatrix"],f0=N(k$,L$,r=>{var{smaller:e,DenseMatrix:t}=r;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!wr(a))throw new Error("Invalid datatype: "+a);if(Ge(i)||Tt(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&&Tt(i.data)&&Tt(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 ("+Ct(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return Ge(a)?new n({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")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:Qe(this._data),size:Qe(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.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},n.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},n},{isClass:!0});var U$="Index",V$=["ImmutableDenseMatrix","getMatrixDataType"],p0=N(U$,V$,r=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=r;function n(a){if(!(this instanceof n))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<l;o++){var u=arguments[o],s=Tt(u),c=Ge(u),f=null;if(Us(u))this._dimensions.push(u),this._isScalar=!1;else if(s||c){var p=void 0;t(u)==="boolean"?(s&&(p=i(fM(u).valueOf())),c&&(p=i(fM(u._data).valueOf())),f=u.valueOf().length):p=i(u.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof u=="number")this._dimensions.push(i([u]));else if(typeof u=="string")this._dimensions.push(u);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}n.prototype.type="Index",n.prototype.isIndex=!0;function i(a){for(var o=0,l=a.length;o<l;o++)if(typeof a[o]!="number"||!$e(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new e(a)}return n.prototype.clone=function(){var a=new n;return a._dimensions=Qe(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},n.create=function(a){var o=new n;return n.apply(o,a),o},n.prototype.size=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?1:u.size()[0]}return a},n.prototype.max=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?u:u.max()}return a},n.prototype.min=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?u:u.min()}return a},n.prototype.forEach=function(a){for(var o=0,l=this._dimensions.length;o<l;o++)a(this._dimensions[o],o,this)},n.prototype.dimension=function(a){return this._dimensions[a]||null},n.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a.push(typeof u=="string"?u:u.toArray())}return a},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];typeof u=="string"?a.push(JSON.stringify(u)):a.push(u.toString())}return"["+a.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(a){return n.create(a.dimensions)},n},{isClass:!0});function fM(r){var e=[];return r.forEach((t,n)=>{t&&e.push(n)}),e}var q$="FibonacciHeap",z$=["smaller","larger"],m0=N(q$,z$,r=>{var{smaller:e,larger:t}=r,n=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)*n)+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 v=d.degree,w=d.right;g=m[v],!!g;){if(t(d.key,g.key)){var y=g;g=d,d=y}u(g,d),m[v]=null,v++}m[v]=d,d=w,h--}c=null;for(var x=0;x<p;x++)g=m[x],g&&(c?(g.left.right=g.right,g.right.left=g.left,g.left=c,g.right=c.right,c.right=g,g.right.left=g,e(g.key,c.key)&&(c=g)):c=g);return c}return i},{isClass:!0});var $$="Spa",H$=["addScalar","equalScalar","FibonacciHeap"],d0=N($$,H$,r=>{var{addScalar:e,equalScalar:t,FibonacciHeap:n}=r;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}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<c.length;p++){var m=c[p];f=u.insert(m.key,m.value),s[f.key]=f}},i.prototype.swap=function(a,o){var l=this._values[a],u=this._values[o];if(!l&&u)l=this._heap.insert(a,u.value),this._heap.remove(u),this._values[a]=l,this._values[o]=void 0;else if(l&&!u)u=this._heap.insert(o,l.value),this._heap.remove(l),this._values[o]=u,this._values[a]=void 0;else if(l&&u){var s=l.value;l.value=u.value,u.value=s}},i},{isClass:!0});var pM=Lo(function(r){return new r(1).exp()},{hasher:vp}),mM=Lo(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:vp}),El=Lo(function(r){return r.acos(-1)},{hasher:vp}),dM=Lo(function(r){return El(r).times(2)},{hasher:vp});function vp(r){return r[0].precision}function hM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function h0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hM(Object(t),!0).forEach(function(n){Ut(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var G$="Unit",W$=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],g0=N(G$,W$,r=>{var{on:e,config:t,addScalar:n,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:v}=r,w=h;function y(V,J){if(!(this instanceof y))throw new Error("Constructor must be called with the new operator");if(!(V==null||p(V)||Cn(V)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,J===void 0)this.units=[],this.dimensions=q.map(W=>0);else if(typeof J=="string"){var ce=y.parse(J);this.units=ce.units,this.dimensions=ce.dimensions}else if(un(J)&&J.value===null)this.fixPrefix=J.fixPrefix,this.skipAutomaticSimplification=J.skipAutomaticSimplification,this.dimensions=J.dimensions.slice(0),this.units=J.units.map(W=>gr({},W));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(V)}Object.defineProperty(y,"name",{value:"Unit"}),y.prototype.constructor=y,y.prototype.type="Unit",y.prototype.isUnit=!0;var x,_,b;function D(){for(;b===" "||b===" ";)E()}function S(V){return V>="0"&&V<="9"||V==="."}function A(V){return V>="0"&&V<="9"}function E(){_++,b=x.charAt(_)}function M(V){_=V,b=x.charAt(_)}function F(){var V="",J=_;if(b==="+"?E():b==="-"&&(V+=b,E()),!S(b))return M(J),null;if(b==="."){if(V+=b,E(),!A(b))return M(J),null}else{for(;A(b);)V+=b,E();b==="."&&(V+=b,E())}for(;A(b);)V+=b,E();if(b==="E"||b==="e"){var ce="",W=_;if(ce+=b,E(),(b==="+"||b==="-")&&(ce+=b,E()),!A(b))return M(W),V;for(V=V+ce;A(b);)V+=b,E()}return V}function P(){for(var V="";A(b)||y.isValidAlpha(b);)V+=b,E();var J=V.charAt(0);return y.isValidAlpha(J)?V:null}function k(V){return b===V?(E(),V):null}y.parse=function(V,J){if(J=J||{},x=V,_=-1,b="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ce=new y;ce.units=[];var W=1,ee=!1;E(),D();var ne=F(),ge=null;if(ne){if(t.number==="BigNumber")ge=new g(ne);else if(t.number==="Fraction")try{ge=new v(ne)}catch(pe){ge=parseFloat(ne)}else ge=parseFloat(ne);D(),k("*")?(W=1,ee=!0):k("/")&&(W=-1,ee=!0)}for(var ye=[],Ue=1;;){for(D();b==="(";)ye.push(W),Ue*=W,W=1,E(),D();var Ae=void 0;if(b){var ft=b;if(Ae=P(),Ae===null)throw new SyntaxError('Unexpected "'+ft+'" in "'+x+'" at index '+_.toString())}else break;var xt=O(Ae);if(xt===null)throw new SyntaxError('Unit "'+Ae+'" not found.');var zt=W*Ue;if(D(),k("^")){D();var Kt=F();if(Kt===null)throw new SyntaxError('In "'+V+'", "^" must be followed by a floating-point number');zt*=Kt}ce.units.push({unit:xt.unit,prefix:xt.prefix,power:zt});for(var j=0;j<q.length;j++)ce.dimensions[j]+=(xt.unit.dimensions[j]||0)*zt;for(D();b===")";){if(ye.length===0)throw new SyntaxError('Unmatched ")" in "'+x+'" at index '+_.toString());Ue/=ye.pop(),E(),D()}if(ee=!1,k("*")?(W=1,ee=!0):k("/")?(W=-1,ee=!0):W=1,xt.unit.base){var ae=xt.unit.base.key;se.auto[ae]={unit:xt.unit,prefix:xt.prefix}}}if(D(),b)throw new SyntaxError('Could not parse: "'+V+'"');if(ee)throw new SyntaxError('Trailing characters: "'+V+'"');if(ye.length!==0)throw new SyntaxError('Unmatched "(" in "'+x+'"');if(ce.units.length===0&&!J.allowNoUnits)throw new SyntaxError('"'+V+'" contains no units');return ce.value=ge!==void 0?ce._normalize(ge):null,ce},y.prototype.clone=function(){var V=new y;V.fixPrefix=this.fixPrefix,V.skipAutomaticSimplification=this.skipAutomaticSimplification,V.value=Qe(this.value),V.dimensions=this.dimensions.slice(0),V.units=[];for(var J=0;J<this.units.length;J++){V.units[J]={};for(var ce in this.units[J])Ze(this.units[J],ce)&&(V.units[J][ce]=this.units[J][ce])}return V},y.prototype.valueType=function(){return Ct(this.value)},y.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},y.prototype._normalize=function(V){if(V==null||this.units.length===0)return V;for(var J=V,ce=y._getNumberConverter(Ct(V)),W=0;W<this.units.length;W++){var ee=ce(this.units[W].unit.value),ne=ce(this.units[W].prefix.value),ge=ce(this.units[W].power);J=a(J,l(a(ee,ne),ge))}return J},y.prototype._denormalize=function(V,J){if(V==null||this.units.length===0)return V;for(var ce=V,W=y._getNumberConverter(Ct(V)),ee=0;ee<this.units.length;ee++){var ne=W(this.units[ee].unit.value),ge=W(this.units[ee].prefix.value),ye=W(this.units[ee].power);ce=o(ce,l(a(ne,ge),ye))}return ce};var O=Lo(V=>{if(Ze(L,V)){var J=L[V],ce=J.prefixes[""];return{unit:J,prefix:ce}}for(var W in L)if(Ze(L,W)&&fS(V,W)){var ee=L[W],ne=V.length-W.length,ge=V.substring(0,ne),ye=Ze(ee.prefixes,ge)?ee.prefixes[ge]:void 0;if(ye!==void 0)return{unit:ee,prefix:ye}}return null},{hasher:V=>V[0],limit:100});y.isValuelessUnit=function(V){return O(V)!==null},y.prototype.hasBase=function(V){if(typeof V=="string"&&(V=B[V]),!V)return!1;for(var J=0;J<q.length;J++)if(Math.abs((this.dimensions[J]||0)-(V.dimensions[J]||0))>1e-12)return!1;return!0},y.prototype.equalBase=function(V){for(var J=0;J<q.length;J++)if(Math.abs((this.dimensions[J]||0)-(V.dimensions[J]||0))>1e-12)return!1;return!0},y.prototype.equals=function(V){return this.equalBase(V)&&f(this.value,V.value)},y.prototype.multiply=function(V){for(var J=this.clone(),ce=un(V)?V:new y(V),W=0;W<q.length;W++)J.dimensions[W]=(this.dimensions[W]||0)+(ce.dimensions[W]||0);for(var ee=0;ee<ce.units.length;ee++){var ne=h0({},ce.units[ee]);J.units.push(ne)}if(this.value!==null||ce.value!==null){var ge=this.value===null?this._normalize(1):this.value,ye=ce.value===null?ce._normalize(1):ce.value;J.value=a(ge,ye)}else J.value=null;return un(V)&&(J.skipAutomaticSimplification=!1),I(J)},y.prototype.divideInto=function(V){return new y(V).divide(this)},y.prototype.divide=function(V){for(var J=this.clone(),ce=un(V)?V:new y(V),W=0;W<q.length;W++)J.dimensions[W]=(this.dimensions[W]||0)-(ce.dimensions[W]||0);for(var ee=0;ee<ce.units.length;ee++){var ne=h0(h0({},ce.units[ee]),{},{power:-ce.units[ee].power});J.units.push(ne)}if(this.value!==null||ce.value!==null){var ge=this.value===null?this._normalize(1):this.value,ye=ce.value===null?ce._normalize(1):ce.value;J.value=o(ge,ye)}else J.value=null;return un(V)&&(J.skipAutomaticSimplification=!1),I(J)},y.prototype.pow=function(V){for(var J=this.clone(),ce=0;ce<q.length;ce++)J.dimensions[ce]=(this.dimensions[ce]||0)*V;for(var W=0;W<J.units.length;W++)J.units[W].power*=V;return J.value!==null?J.value=l(J.value,V):J.value=null,J.skipAutomaticSimplification=!1,I(J)};function I(V){return V.equalBase(B.NONE)&&V.value!==null&&!t.predictable?V.value:V}y.prototype.abs=function(){var V=this.clone();if(V.value!==null)if(V._isDerived()||V.units[0].unit.offset===0)V.value=u(V.value);else{var J=V._numberConverter(),ce=J(V.units[0].unit.value),W=J(V.units[0].unit.offset),ee=a(ce,W);V.value=i(u(n(V.value,ee)),ee)}for(var ne in V.units)(V.units[ne].unit.name==="VA"||V.units[ne].unit.name==="VAR")&&(V.units[ne].unit=L.W);return V},y.prototype.to=function(V){var J=this.value===null?this._normalize(1):this.value,ce;if(typeof V=="string")ce=y.parse(V);else if(un(V))ce=V.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(ce))throw new Error("Units do not match ('".concat(ce.toString(),"' != '").concat(this.toString(),"')"));if(ce.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===ce.units[0].unit.offset)ce.value=Qe(J);else{var W=y._getNumberConverter(Ct(J)),ee=this.units[0].unit.value,ne=this.units[0].unit.offset,ge=a(ee,ne),ye=ce.units[0].unit.value,Ue=ce.units[0].unit.offset,Ae=a(ye,Ue);ce.value=n(J,W(i(ge,Ae)))}return ce.fixPrefix=!0,ce.skipAutomaticSimplification=!0,ce},y.prototype.toNumber=function(V){return w(this.toNumeric(V))},y.prototype.toNumeric=function(V){var J;return V?J=this.to(V):J=this.clone(),J._isDerived()||J.units.length===0?J._denormalize(J.value):J._denormalize(J.value,J.units[0].prefix.value)},y.prototype.toString=function(){return this.format()},y.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},y.fromJSON=function(V){var J=new y(V.value,V.unit);return J.fixPrefix=V.fixPrefix||!1,J},y.prototype.valueOf=y.prototype.toString,y.prototype.simplify=function(){var V=this.clone(),J=[],ce;for(var W in ue)if(Ze(ue,W)&&V.hasBase(B[W])){ce=W;break}if(ce==="NONE")V.units=[];else{var ee;if(ce&&Ze(ue,ce)&&(ee=ue[ce]),ee)V.units=[{unit:ee.unit,prefix:ee.prefix,power:1}];else{for(var ne=!1,ge=0;ge<q.length;ge++){var ye=q[ge];Math.abs(V.dimensions[ge]||0)>1e-12&&(Ze(ue,ye)?J.push({unit:ue[ye].unit,prefix:ue[ye].prefix,power:V.dimensions[ge]||0}):ne=!0)}J.length<V.units.length&&!ne&&(V.units=J)}}return V},y.prototype.toSI=function(){for(var V=this.clone(),J=[],ce=0;ce<q.length;ce++){var W=q[ce];if(Math.abs(V.dimensions[ce]||0)>1e-12)if(Ze(se.si,W))J.push({unit:se.si[W].unit,prefix:se.si[W].prefix,power:V.dimensions[ce]||0});else throw new Error("Cannot express custom unit "+W+" in SI units")}return V.units=J,V.fixPrefix=!0,V.skipAutomaticSimplification=!0,V},y.prototype.formatUnits=function(){for(var V="",J="",ce=0,W=0,ee=0;ee<this.units.length;ee++)this.units[ee].power>0?(ce++,V+=" "+this.units[ee].prefix.name+this.units[ee].unit.name,Math.abs(this.units[ee].power-1)>1e-15&&(V+="^"+this.units[ee].power)):this.units[ee].power<0&&W++;if(W>0)for(var ne=0;ne<this.units.length;ne++)this.units[ne].power<0&&(ce>0?(J+=" "+this.units[ne].prefix.name+this.units[ne].unit.name,Math.abs(this.units[ne].power+1)>1e-15&&(J+="^"+-this.units[ne].power)):(J+=" "+this.units[ne].prefix.name+this.units[ne].unit.name,J+="^"+this.units[ne].power));V=V.substr(1),J=J.substr(1),ce>1&&W>0&&(V="("+V+")"),W>1&&ce>0&&(J="("+J+")");var ge=V;return ce>0&&W>0&&(ge+=" / "),ge+=J,ge},y.prototype.format=function(V){var J=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ce=!1;typeof J.value!="undefined"&&J.value!==null&&Cn(J.value)&&(ce=Math.abs(J.value.re)<1e-14);for(var W in J.units)Ze(J.units,W)&&J.units[W].unit&&(J.units[W].unit.name==="VA"&&ce?J.units[W].unit=L.VAR:J.units[W].unit.name==="VAR"&&!ce&&(J.units[W].unit=L.VA));J.units.length===1&&!J.fixPrefix&&Math.abs(J.units[0].power-Math.round(J.units[0].power))<1e-14&&(J.units[0].prefix=J._bestPrefix());var ee=J._denormalize(J.value),ne=J.value!==null?m(ee,V||{}):"",ge=J.formatUnits();return J.value&&Cn(J.value)&&(ne="("+ne+")"),ge.length>0&&ne.length>0&&(ne+=" "),ne+=ge,ne},y.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 V=this.value!==null?u(this.value):0,J=u(this.units[0].unit.value),ce=this.units[0].prefix;if(V===0)return ce;var W=this.units[0].power,ee=Math.log(V/Math.pow(ce.value*J,W))/Math.LN10-1.2;if(ee>-2.200001&&ee<1.800001)return ce;ee=Math.abs(ee);var ne=this.units[0].unit.prefixes;for(var ge in ne)if(Ze(ne,ge)){var ye=ne[ge];if(ye.scientific){var Ue=Math.abs(Math.log(V/Math.pow(ye.value*J,W))/Math.LN10-1.2);(Ue<ee||Ue===ee&&ye.name.length<ce.name.length)&&(ce=ye,ee=Ue)}}return ce},y.prototype.splitUnit=function(V){for(var J=this.clone(),ce=[],W=0;W<V.length&&(J=J.to(V[W]),W!==V.length-1);W++){var ee=J.toNumeric(),ne=c(ee),ge=void 0,ye=f(ne,ee);ye?ge=ne:ge=s(J.toNumeric());var Ue=new y(ge,V[W].toString());ce.push(Ue),J=i(J,Ue)}for(var Ae=0,ft=0;ft<ce.length;ft++)Ae=n(Ae,ce[ft].value);return f(Ae,this.value)&&(J.value=0),ce.push(J),ce};var T={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};T.SHORTLONG=gr({},T.SHORT,T.LONG),T.BINARY_SHORT=gr({},T.BINARY_SHORT_SI,T.BINARY_SHORT_IEC),T.BINARY_LONG=gr({},T.BINARY_LONG_SI,T.BINARY_LONG_IEC);var q=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],B={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var U in B)Ze(B,U)&&(B[U].key=U);var G={},H={name:"",base:G,value:1,offset:0,dimensions:q.map(V=>0)},L={meter:{name:"meter",base:B.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:B.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:B.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:B.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:B.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:B.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:B.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:B.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:B.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:B.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:B.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:B.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:B.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:B.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:B.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:B.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:B.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:B.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:B.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:B.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:B.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:B.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:B.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:B.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:B.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:B.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:B.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:B.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:B.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:B.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:B.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:B.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:B.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:B.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:B.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:B.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:B.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:B.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:B.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:B.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:B.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:B.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:B.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:B.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:B.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:B.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:B.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:B.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:B.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:B.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:B.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:B.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:B.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:B.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:B.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:B.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:B.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:B.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:B.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:B.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:B.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:B.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:B.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:B.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:B.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:B.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:B.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:B.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:B.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:B.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:B.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:B.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:B.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:B.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:B.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:B.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:B.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:B.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:B.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:B.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:B.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:B.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:B.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:B.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:B.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:B.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:B.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:B.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:B.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:B.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:B.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:B.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:B.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:B.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:B.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:B.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:B.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:B.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:B.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:B.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:B.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:B.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:B.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:B.TEMPERATURE,prefixes:T.SHORT,value:new v(5,9),offset:459.67},degR:{name:"degR",base:B.TEMPERATURE,prefixes:T.SHORT,value:new v(5,9),offset:0},kelvin:{name:"kelvin",base:B.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:B.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:B.TEMPERATURE,prefixes:T.LONG,value:new v(5,9),offset:459.67},rankine:{name:"rankine",base:B.TEMPERATURE,prefixes:T.LONG,value:new v(5,9),offset:0},mol:{name:"mol",base:B.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:B.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:B.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:B.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:B.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:B.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:B.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:B.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:B.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:B.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:B.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:B.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:B.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:B.ENERGY,prefixes:T.LONG,value:1,offset:0},erg:{name:"erg",base:B.ENERGY,prefixes:T.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:B.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:B.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:B.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:B.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:B.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:B.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:B.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:B.POWER,prefixes:T.SHORT,value:d.I,offset:0},VA:{name:"VA",base:B.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:B.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:B.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:B.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:B.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:B.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:B.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:B.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:B.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:B.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:B.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:B.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:B.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:B.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:B.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:B.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:B.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:B.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:B.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:B.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:B.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:B.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:B.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:B.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:B.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:B.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:B.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:B.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},ie={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(V){if(V.number==="BigNumber"){var J=El(g);L.rad.value=new g(1),L.deg.value=J.div(180),L.grad.value=J.div(200),L.cycle.value=J.times(2),L.arcsec.value=J.div(648e3),L.arcmin.value=J.div(10800)}else L.rad.value=1,L.deg.value=Math.PI/180,L.grad.value=Math.PI/200,L.cycle.value=Math.PI*2,L.arcsec.value=Math.PI/648e3,L.arcmin.value=Math.PI/10800;L.radian.value=L.rad.value,L.degree.value=L.deg.value,L.gradian.value=L.grad.value}ve(t),e&&e("config",function(V,J){V.number!==J.number&&ve(V)});var se={si:{NONE:{unit:H,prefix:T.NONE[""]},LENGTH:{unit:L.m,prefix:T.SHORT[""]},MASS:{unit:L.g,prefix:T.SHORT.k},TIME:{unit:L.s,prefix:T.SHORT[""]},CURRENT:{unit:L.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:L.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:L.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:L.mol,prefix:T.SHORT[""]},ANGLE:{unit:L.rad,prefix:T.SHORT[""]},BIT:{unit:L.bits,prefix:T.SHORT[""]},FORCE:{unit:L.N,prefix:T.SHORT[""]},ENERGY:{unit:L.J,prefix:T.SHORT[""]},POWER:{unit:L.W,prefix:T.SHORT[""]},PRESSURE:{unit:L.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:L.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:L.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:L.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:L.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:L.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:L.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:L.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:L.T,prefix:T.SHORT[""]},FREQUENCY:{unit:L.Hz,prefix:T.SHORT[""]}}};se.cgs=JSON.parse(JSON.stringify(se.si)),se.cgs.LENGTH={unit:L.m,prefix:T.SHORT.c},se.cgs.MASS={unit:L.g,prefix:T.SHORT[""]},se.cgs.FORCE={unit:L.dyn,prefix:T.SHORT[""]},se.cgs.ENERGY={unit:L.erg,prefix:T.NONE[""]},se.us=JSON.parse(JSON.stringify(se.si)),se.us.LENGTH={unit:L.ft,prefix:T.NONE[""]},se.us.MASS={unit:L.lbm,prefix:T.NONE[""]},se.us.TEMPERATURE={unit:L.degF,prefix:T.NONE[""]},se.us.FORCE={unit:L.lbf,prefix:T.NONE[""]},se.us.ENERGY={unit:L.BTU,prefix:T.BTU[""]},se.us.POWER={unit:L.hp,prefix:T.NONE[""]},se.us.PRESSURE={unit:L.psi,prefix:T.NONE[""]},se.auto=JSON.parse(JSON.stringify(se.si));var ue=se.auto;y.setUnitSystem=function(V){if(Ze(se,V))ue=se[V];else throw new Error("Unit system "+V+" does not exist. Choices are: "+Object.keys(se).join(", "))},y.getUnitSystem=function(){for(var V in se)if(Ze(se,V)&&se[V]===ue)return V},y.typeConverters={BigNumber:function(J){return J!=null&&J.isFraction?new g(J.n).div(J.d).times(J.s):new g(J+"")},Fraction:function(J){return new v(J)},Complex:function(J){return J},number:function(J){return J!=null&&J.isFraction?h(J):J}},y.prototype._numberConverter=function(){var V=y.typeConverters[this.valueType()];if(V)return V;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},y._getNumberConverter=function(V){if(!y.typeConverters[V])throw new TypeError('Unsupported type "'+V+'"');return y.typeConverters[V]};for(var he in L)if(Ze(L,he)){var K=L[he];K.dimensions=K.base.dimensions}for(var re in ie)if(Ze(ie,re)){var me=L[ie[re]],de={};for(var Pe in me)Ze(me,Pe)&&(de[Pe]=me[Pe]);de.name=re,L[re]=de}y.isValidAlpha=function(J){return/^[a-zA-Z]$/.test(J)};function we(V){for(var J=0;J<V.length;J++){if(b=V.charAt(J),J===0&&!y.isValidAlpha(b))throw new Error('Invalid unit name (must begin with alpha character): "'+V+'"');if(J>0&&!(y.isValidAlpha(b)||A(b)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+V+'"')}}return y.createUnit=function(V,J){if(typeof V!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(J&&J.override){for(var ce in V)if(Ze(V,ce)&&y.deleteUnit(ce),V[ce].aliases)for(var W=0;W<V[ce].aliases.length;W++)y.deleteUnit(V[ce].aliases[W])}var ee;for(var ne in V)Ze(V,ne)&&(ee=y.createUnitSingle(ne,V[ne]));return ee},y.createUnitSingle=function(V,J){if((typeof J=="undefined"||J===null)&&(J={}),typeof V!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Ze(L,V))throw new Error('Cannot create unit "'+V+'": a unit with that name already exists');we(V);var ce=null,W=[],ee=0,ne,ge,ye;if(J&&J.type==="Unit")ce=J.clone();else if(typeof J=="string")J!==""&&(ne=J);else if(typeof J=="object")ne=J.definition,ge=J.prefixes,ee=J.offset,ye=J.baseName,J.aliases&&(W=J.aliases.valueOf());else throw new TypeError('Cannot create unit "'+V+'" from "'+J.toString()+'": expecting "string" or "Unit" or "Object"');if(W){for(var Ue=0;Ue<W.length;Ue++)if(Ze(L,W[Ue]))throw new Error('Cannot create alias "'+W[Ue]+'": a unit with that name already exists')}if(ne&&typeof ne=="string"&&!ce)try{ce=y.parse(ne,{allowNoUnits:!0})}catch(C){throw C.message='Could not create unit "'+V+'" from "'+ne+'": '+C.message,C}else ne&&ne.type==="Unit"&&(ce=ne.clone());W=W||[],ee=ee||0,ge&&ge.toUpperCase?ge=T[ge.toUpperCase()]||T.NONE:ge=T.NONE;var Ae={};if(ce){Ae={name:V,value:ce.value,dimensions:ce.dimensions.slice(0),prefixes:ge,offset:ee};var Kt=!1;for(var j in B)if(Ze(B,j)){for(var ae=!0,pe=0;pe<q.length;pe++)if(Math.abs((Ae.dimensions[pe]||0)-(B[j].dimensions[pe]||0))>1e-12){ae=!1;break}if(ae){Kt=!0,Ae.base=B[j];break}}if(!Kt){ye=ye||V+"_STUFF";var _e={dimensions:ce.dimensions.slice(0)};_e.key=ye,B[ye]=_e,ue[ye]={unit:Ae,prefix:T.NONE[""]},Ae.base=B[ye]}}else{if(ye=ye||V+"_STUFF",q.indexOf(ye)>=0)throw new Error('Cannot create new base unit "'+V+'": a base unit with that name already exists (and cannot be overridden)');q.push(ye);for(var ft in B)Ze(B,ft)&&(B[ft].dimensions[q.length-1]=0);for(var xt={dimensions:[]},zt=0;zt<q.length;zt++)xt.dimensions[zt]=0;xt.dimensions[q.length-1]=1,xt.key=ye,B[ye]=xt,Ae={name:V,value:1,dimensions:B[ye].dimensions.slice(0),prefixes:ge,offset:ee,base:B[ye]},ue[ye]={unit:Ae,prefix:T.NONE[""]}}y.UNITS[V]=Ae;for(var Te=0;Te<W.length;Te++){var De=W[Te],Me={};for(var Re in Ae)Ze(Ae,Re)&&(Me[Re]=Ae[Re]);Me.name=De,y.UNITS[De]=Me}return delete O.cache,new y(null,V)},y.deleteUnit=function(V){delete y.UNITS[V]},y.PREFIXES=T,y.BASE_DIMENSIONS=q,y.BASE_UNITS=B,y.UNIT_SYSTEMS=se,y.UNITS=L,y},{isClass:!0});var gM="unit",j$=["typed","Unit"],v0=N(gM,j$,r=>{var{typed:e,Unit:t}=r;return e(gM,{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(n=>i=>Je(i,n))})});var vM="sparse",Z$=["typed","SparseMatrix"],y0=N(vM,Z$,r=>{var{typed:e,SparseMatrix:t}=r;return e(vM,{"":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 yM="createUnit",J$=["typed","Unit"],b0=N(yM,J$,r=>{var{typed:e,Unit:t}=r;return e(yM,{"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 bM="acos",Y$=["typed","config","Complex"],x0=N(bM,Y$,r=>{var{typed:e,config:t,Complex:n}=r;return e(bM,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var xM="acosh",X$=["typed","config","Complex"],w0=N(xM,X$,r=>{var{typed:e,config:t,Complex:n}=r;return e(xM,{number:function(a){return a>=1||t.predictable?Fg(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var wM="acot",Q$=["typed","BigNumber"],_0=N(wM,Q$,r=>{var{typed:e,BigNumber:t}=r;return e(wM,{number:Ig,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var _M="acoth",K$=["typed","config","Complex","BigNumber"],A0=N(_M,K$,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(_M,{number:function(o){return o>=1||o<=-1||t.predictable?Bg(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var AM="acsc",eH=["typed","config","Complex","BigNumber"],D0=N(AM,eH,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(AM,{number:function(o){return o<=-1||o>=1||t.predictable?Pg(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var DM="acsch",tH=["typed","BigNumber"],E0=N(DM,tH,r=>{var{typed:e,BigNumber:t}=r;return e(DM,{number:Og,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var EM="asec",rH=["typed","config","Complex","BigNumber"],S0=N(EM,rH,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(EM,{number:function(o){return o<=-1||o>=1||t.predictable?Rg(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var SM="asech",nH=["typed","config","Complex","BigNumber"],N0=N(SM,nH,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(SM,{number:function(o){if(o<=1&&o>=-1||t.predictable){var l=1/o;if(l>0||t.predictable)return kg(o);var u=Math.sqrt(l*l-1);return new n(Math.log(u-l),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var NM="asin",iH=["typed","config","Complex"],C0=N(NM,iH,r=>{var{typed:e,config:t,Complex:n}=r;return e(NM,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var aH="asinh",oH=["typed"],M0=N(aH,oH,r=>{var{typed:e}=r;return e("asinh",{number:Lg,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var sH="atan",uH=["typed"],T0=N(sH,uH,r=>{var{typed:e}=r;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var CM="atan2",lH=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],F0=N(CM,lH,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=r,l=Pr({typed:e,equalScalar:n}),u=ir({typed:e}),s=ap({typed:e,equalScalar:n}),c=Wt({typed:e,equalScalar:n}),f=kt({typed:e,DenseMatrix:a}),p=ct({typed:e,matrix:t,concat:o});return e(CM,{"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 MM="atanh",cH=["typed","config","Complex"],I0=N(MM,cH,r=>{var{typed:e,config:t,Complex:n}=r;return e(MM,{number:function(a){return a<=1&&a>=-1||t.predictable?Ug(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var bi=N("trigUnit",["typed"],r=>{var{typed:e}=r;return{Unit:e.referToSelf(t=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,n.valueType())(n.value)})}});var TM="cos",fH=["typed"],B0=N(TM,fH,r=>{var{typed:e}=r,t=bi({typed:e});return e(TM,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},t)});var FM="cosh",pH=["typed"],P0=N(FM,pH,r=>{var{typed:e}=r;return e(FM,{number:Lf,"Complex | BigNumber":t=>t.cosh()})});var IM="cot",mH=["typed","BigNumber"],O0=N(IM,mH,r=>{var{typed:e,BigNumber:t}=r,n=bi({typed:e});return e(IM,{number:Vg,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},n)});var BM="coth",dH=["typed","BigNumber"],R0=N(BM,dH,r=>{var{typed:e,BigNumber:t}=r;return e(BM,{number:qg,Complex:n=>n.coth(),BigNumber:n=>new t(1).div(n.tanh())})});var PM="csc",hH=["typed","BigNumber"],k0=N(PM,hH,r=>{var{typed:e,BigNumber:t}=r,n=bi({typed:e});return e(PM,{number:zg,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},n)});var OM="csch",gH=["typed","BigNumber"],L0=N(OM,gH,r=>{var{typed:e,BigNumber:t}=r;return e(OM,{number:$g,Complex:n=>n.csch(),BigNumber:n=>new t(1).div(n.sinh())})});var RM="sec",vH=["typed","BigNumber"],U0=N(RM,vH,r=>{var{typed:e,BigNumber:t}=r,n=bi({typed:e});return e(RM,{number:Hg,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},n)});var kM="sech",yH=["typed","BigNumber"],V0=N(kM,yH,r=>{var{typed:e,BigNumber:t}=r;return e(kM,{number:Gg,Complex:n=>n.sech(),BigNumber:n=>new t(1).div(n.cosh())})});var LM="sin",bH=["typed"],q0=N(LM,bH,r=>{var{typed:e}=r,t=bi({typed:e});return e(LM,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},t)});var UM="sinh",xH=["typed"],z0=N(UM,xH,r=>{var{typed:e}=r;return e(UM,{number:Wg,"Complex | BigNumber":t=>t.sinh()})});var VM="tan",wH=["typed"],$0=N(VM,wH,r=>{var{typed:e}=r,t=bi({typed:e});return e(VM,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},t)});var _H="tanh",AH=["typed"],H0=N(_H,AH,r=>{var{typed:e}=r;return e("tanh",{number:Uf,"Complex | BigNumber":t=>t.tanh()})});var qM="setCartesian",DH=["typed","size","subset","compareNatural","Index","DenseMatrix"],G0=N(qM,DH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(qM,{"Array | Matrix, Array | Matrix":function(u,s){var c=[];if(n(t(u),new a(0))!==0&&n(t(s),new a(0))!==0){var f=mt(Array.isArray(u)?u:u.toArray()).sort(i),p=mt(Array.isArray(s)?s:s.toArray()).sort(i);c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)c.push([f[m],p[h]])}return Array.isArray(u)&&Array.isArray(s)?c:new o(c)}})});var zM="setDifference",EH=["typed","size","subset","compareNatural","Index","DenseMatrix"],W0=N(zM,EH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(zM,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(n(t(u),new a(0))===0)c=[];else{if(n(t(s),new a(0))===0)return mt(u.toArray());var f=da(mt(Array.isArray(u)?u:u.toArray()).sort(i)),p=da(mt(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m,h=0;h<f.length;h++){m=!1;for(var d=0;d<p.length;d++)if(i(f[h].value,p[d].value)===0&&f[h].identifier===p[d].identifier){m=!0;break}m||c.push(f[h])}}return Array.isArray(u)&&Array.isArray(s)?$s(c):new o($s(c))}})});var $M="setDistinct",SH=["typed","size","subset","compareNatural","Index","DenseMatrix"],j0=N($M,SH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e($M,{"Array | Matrix":function(u){var s;if(n(t(u),new a(0))===0)s=[];else{var c=mt(Array.isArray(u)?u:u.toArray()).sort(i);s=[],s.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&s.push(c[f])}return Array.isArray(u)?s:new o(s)}})});var HM="setIntersect",NH=["typed","size","subset","compareNatural","Index","DenseMatrix"],Z0=N(HM,NH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(HM,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(n(t(u),new a(0))===0||n(t(s),new a(0))===0)c=[];else{var f=da(mt(Array.isArray(u)?u:u.toArray()).sort(i)),p=da(mt(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)if(i(f[m].value,p[h].value)===0&&f[m].identifier===p[h].identifier){c.push(f[m]);break}}return Array.isArray(u)&&Array.isArray(s)?$s(c):new o($s(c))}})});var GM="setIsSubset",CH=["typed","size","subset","compareNatural","Index"],J0=N(GM,CH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(GM,{"Array | Matrix, Array | Matrix":function(l,u){if(n(t(l),new a(0))===0)return!0;if(n(t(u),new a(0))===0)return!1;for(var s=da(mt(Array.isArray(l)?l:l.toArray()).sort(i)),c=da(mt(Array.isArray(u)?u:u.toArray()).sort(i)),f,p=0;p<s.length;p++){f=!1;for(var m=0;m<c.length;m++)if(i(s[p].value,c[m].value)===0&&s[p].identifier===c[m].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var WM="setMultiplicity",MH=["typed","size","subset","compareNatural","Index"],Y0=N(WM,MH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(WM,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(l,u){if(n(t(u),new a(0))===0)return 0;for(var s=mt(Array.isArray(u)?u:u.toArray()),c=0,f=0;f<s.length;f++)i(s[f],l)===0&&c++;return c}})});var jM="setPowerset",TH=["typed","size","subset","compareNatural","Index"],X0=N(jM,TH,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(jM,{"Array | Matrix":function(s){if(n(t(s),new a(0))===0)return[];for(var c=mt(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;f<s.length;f++)s[f]==="1"&&c.push(u[f]);return c}function l(u){for(var s=[],c=u.length-1;c>0;c--)for(var f=0;f<c;f++)u[f].length>u[f+1].length&&(s=u[f],u[f]=u[f+1],u[f+1]=s);return u}});var ZM="setSize",FH=["typed","compareNatural"],Q0=N(ZM,FH,r=>{var{typed:e,compareNatural:t}=r;return e(ZM,{"Array | Matrix":function(i){return Array.isArray(i)?mt(i).length:mt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?mt(i).length:mt(i.toArray()).length;for(var o=mt(Array.isArray(i)?i:i.toArray()).sort(t),l=1,u=1;u<o.length;u++)t(o[u],o[u-1])!==0&&l++;return l}})});var JM="setSymDifference",IH=["typed","size","concat","subset","setDifference","Index"],K0=N(JM,IH,r=>{var{typed:e,size:t,concat:n,subset:i,setDifference:a,Index:o}=r;return e(JM,{"Array | Matrix, Array | Matrix":function(u,s){if(i(t(u),new o(0))===0)return mt(s);if(i(t(s),new o(0))===0)return mt(u);var c=mt(u),f=mt(s);return n(a(c,f),a(f,c))}})});var YM="setUnion",BH=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],eb=N(YM,BH,r=>{var{typed:e,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:l}=r;return e(YM,{"Array | Matrix, Array | Matrix":function(s,c){if(i(t(s),new l(0))===0)return mt(c);if(i(t(c),new l(0))===0)return mt(s);var f=mt(s),p=mt(c);return n(o(f,p),a(f,p))}})});var XM="add",PH=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],tb=N(XM,PH,r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:l}=r,u=bn({typed:e}),s=Zs({typed:e,equalScalar:i}),c=qn({typed:e,DenseMatrix:a}),f=ct({typed:e,matrix:t,concat:l});return e(XM,{"any, any":n,"any, any, ...any":e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),v=0;v<d.length;v++)g=p(g,d[v]);return g})},f({elop:n,DS:u,SS:s,Ss:c}))});var QM="hypot",OH=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],rb=N(QM,OH,r=>{var{typed:e,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:l,isPositive:u}=r;return e(QM,{"... number | BigNumber":s,Array:s,Matrix:c=>s(mt(c.toArray()))});function s(c){for(var f=0,p=0,m=0;m<c.length;m++){if(Cn(c[m]))throw new TypeError("Unexpected type of argument to hypot");var h=t(c[m]);l(p,h)?(f=a(f,a(i(p,h),i(p,h))),f=n(f,1),p=h):f=n(f,u(h)?a(i(h,p),i(h,p)):h)}return a(p,o(f))}});var KM="norm",RH=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],nb=N(KM,RH,r=>{var{typed:e,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:l,equalScalar:u,larger:s,smaller:c,matrix:f,ctranspose:p,eigs:m}=r;return e(KM,{number:Math.abs,Complex:function(S){return S.abs()},BigNumber:function(S){return S.abs()},boolean:function(S){return Math.abs(S)},Array:function(S){return b(f(S),2)},Matrix:function(S){return b(S,2)},"Array, number | BigNumber | string":function(S,A){return b(f(S),A)},"Matrix, number | BigNumber | string":function(S,A){return b(S,A)}});function h(D){var S=0;return D.forEach(function(A){var E=t(A);s(E,S)&&(S=E)},!0),S}function d(D){var S;return D.forEach(function(A){var E=t(A);(!S||c(E,S))&&(S=E)},!0),S||0}function g(D,S){if(S===Number.POSITIVE_INFINITY||S==="inf")return h(D);if(S===Number.NEGATIVE_INFINITY||S==="-inf")return d(D);if(S==="fro")return b(D,2);if(typeof S=="number"&&!isNaN(S)){if(!u(S,0)){var A=0;return D.forEach(function(E){A=n(i(t(E),S),A)},!0),i(A,1/S)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function v(D){var S=0;return D.forEach(function(A,E){S=n(S,l(A,a(A)))}),t(o(S))}function w(D){var S=[],A=0;return D.forEach(function(E,M){var F=M[1],P=n(S[F]||0,t(E));s(P,A)&&(A=P),S[F]=P},!0),A}function y(D){var S=D.size();if(S[0]!==S[1])throw new RangeError("Invalid matrix dimensions");var A=p(D),E=l(A,D),M=m(E).values.toArray(),F=M[M.length-1];return t(o(F))}function x(D){var S=[],A=0;return D.forEach(function(E,M){var F=M[0],P=n(S[F]||0,t(E));s(P,A)&&(A=P),S[F]=P},!0),A}function _(D,S){if(S===1)return w(D);if(S===Number.POSITIVE_INFINITY||S==="inf")return x(D);if(S==="fro")return v(D);if(S===2)return y(D);throw new Error("Unsupported parameter value "+S)}function b(D,S){var A=D.size();if(A.length===1)return g(D,S);if(A.length===2){if(A[0]&&A[1])return _(D,S);throw new RangeError("Invalid matrix dimensions")}}});var eT="dot",kH=["typed","addScalar","multiplyScalar","conj","size"],ib=N(eT,kH,r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:a}=r;return e(eT,{"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=Ge(c)?c._data:c,h=Ge(c)?c._datatype:void 0,d=Ge(f)?f._data:f,g=Ge(f)?f._datatype:void 0,v=s(c).length===2,w=s(f).length===2,y=t,x=n;if(h&&g&&h===g&&typeof h=="string"){var _=h;y=e.find(t,[_,_]),x=e.find(n,[_,_])}if(!v&&!w){for(var b=x(i(m[0]),d[0]),D=1;D<p;D++)b=y(b,x(i(m[D]),d[D]));return b}if(!v&&w){for(var S=x(i(m[0]),d[0][0]),A=1;A<p;A++)S=y(S,x(i(m[A]),d[A][0]));return S}if(v&&!w){for(var E=x(i(m[0][0]),d[0]),M=1;M<p;M++)E=y(E,x(i(m[M][0]),d[M]));return E}if(v&&w){for(var F=x(i(m[0][0]),d[0][0]),P=1;P<p;P++)F=y(F,x(i(m[P][0]),d[P][0]));return F}}function u(c,f){o(c,f);for(var p=c._index,m=c._values,h=f._index,d=f._values,g=0,v=t,w=n,y=0,x=0;y<p.length&&x<h.length;){var _=p[y],b=h[x];if(_<b){y++;continue}if(_>b){x++;continue}_===b&&(g=v(g,w(m[y],d[x])),y++,x++)}return g}function s(c){return Ge(c)?c.size():a(c)}});var LH="trace",UH=["typed","matrix","add"],ab=N(LH,UH,r=>{var{typed:e,matrix:t,add:n}=r;return e("trace",{Array:function(l){return i(t(l))},SparseMatrix:a,DenseMatrix:i,any:Qe});function i(o){var l=o._size,u=o._data;switch(l.length){case 1:if(l[0]===1)return Qe(u[0]);throw new RangeError("Matrix must be square (size: "+at(l)+")");case 2:{var s=l[0],c=l[1];if(s===c){for(var f=0,p=0;p<s;p++)f=n(f,u[p][p]);return f}else throw new RangeError("Matrix must be square (size: "+at(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(l)+")")}}function a(o){var l=o._values,u=o._index,s=o._ptr,c=o._size,f=c[0],p=c[1];if(f===p){var m=0;if(l.length>0)for(var h=0;h<p;h++)for(var d=s[h],g=s[h+1],v=d;v<g;v++){var w=u[v];if(w===h){m=n(m,l[v]);break}if(w>h)break}return m}throw new RangeError("Matrix must be square (size: "+at(c)+")")}});var tT="index",VH=["typed","Index"],ob=N(tT,VH,r=>{var{typed:e,Index:t}=r;return e(tT,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(l){return rt(l)?l.toNumber():Tt(l)||Ge(l)?l.map(function(u){return rt(u)?u.toNumber():u}):l}),o=new t;return t.apply(o,a),o}})});var yp=new Set(["end"]);var qH="Node",zH=["mathWithTransform"],sb=N(qH,zH,r=>{var{mathWithTransform:e}=r;function t(i){for(var a of[...yp])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{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=ha(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(!Dt(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&&Ti(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}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)}_toHTML(){throw new Error("_toHTML 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 n},{isClass:!0,isNode:!0});function ar(r){return r&&r.isIndexError?new fn(r.index+1,r.min+1,r.max!==void 0?r.max+1:void 0):r}function bp(r){var{subset:e}=r;return function(n,i){try{if(Array.isArray(n))return e(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return e(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return vr(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw ar(a)}}}var xp="AccessorNode",$H=["subset","Node"],ub=N(xp,$H,r=>{var{subset:e,Node:t}=r,n=bp({subset:e});function i(o){return!(ri(o)||ln(o)||wt(o)||Mn(o)||$a(o)||cn(o)||tr(o))}class a extends t{constructor(l,u){if(super(),!Dt(l))throw new TypeError('Node expected for parameter "object"');if(!di(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 xp}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 vr(s(m,h,d),f)}}else return function(m,h,d){var g=s(m,h,d),v=c(m,h,g);return n(g,v)}}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='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),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:xp,object:this.object,index:this.index}}static fromJSON(l){return new a(l.object,l.index)}}return Ut(a,"name",xp),a},{isClass:!0,isNode:!0});var wp="ArrayNode",HH=["Node"],lb=N(wp,HH,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(Dt))throw new TypeError("Array containing Nodes expected")}get type(){return wp}get isArrayNode(){return!0}_compile(i,a){var o=Ln(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(Ln(o,function(m){return m(c,f,p)}))}}else return function(c,f,p){return Ln(o,function(m){return m(c,f,p)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new t(a)}clone(){return new t(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:wp,items:this.items}}static fromJSON(i){return new t(i.items)}_toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,l){var u=o.some(ln)&&!o.every(ln),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 Ut(t,"name",wp),t},{isClass:!0,isNode:!0});function rT(r){var{subset:e,matrix:t}=r;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 ji(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(u){throw ar(u)}}}var xi=[{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 _p(r,e){if(!e||e!=="auto")return r;for(var t=r;cn(t);)t=t.content;return t}function $t(r,e,t,n){var i=r;e!=="keep"&&(i=r.getContent());for(var a=i.getIdentifier(),o=null,l=0;l<xi.length;l++)if(a in xi[l]){o=l;break}if(a==="OperatorNode:multiply"&&i.implicit&&t!=="show"){var u=_p(i.args[0],e);!(wt(u)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Qu(_p(n.args[0],e)))&&!(u.getIdentifier()==="OperatorNode:divide"&&Qu(_p(u.args[0],e))&&wt(_p(u.args[1])))&&(o+=1)}return o}function tu(r,e){var t=r;e!=="keep"&&(t=r.getContent());var n=t.getIdentifier(),i=$t(t,e);if(i===null)return null;var a=xi[i][n];if(Ze(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Ap(r,e,t){var n=t!=="keep"?r.getContent():r,i=t!=="keep"?r.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),l=$t(n,t);if(l===null)return null;var u=xi[l][a];if(Ze(u,"associativeWith")&&u.associativeWith instanceof Array){for(var s=0;s<u.associativeWith.length;s++)if(u.associativeWith[s]===o)return!0;return!1}return null}function nT(r){var e="OperatorNode:"+r;for(var t of xi)if(e in t)return t[e].op;return null}var Dp="AssignmentNode",GH=["subset","?matrix","Node"],cb=N(Dp,GH,r=>{var{subset:e,matrix:t,Node:n}=r,i=bp({subset:e}),a=rT({subset:e,matrix:t});function o(u,s,c){s||(s="keep");var f=$t(u,s,c),p=$t(u.value,s,c);return s==="all"||p!==null&&p<=f}class l extends n{constructor(s,c,f){if(super(),this.object=s,this.index=f?c:null,this.value=f||c,!tr(s)&&!ri(s))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(tr(s)&&s.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!di(this.index))throw new TypeError('IndexNode expected as "index"');if(!Dt(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),S=m(x,_,b);return ji(D,d,S),S}}else{if(tr(this.object))return function(x,_,b){var D=f(x,_,b),S=m(x,_,b),A=p(x,_,D);return x.set(h,a(D,A,S)),S};var g=this.object.object._compile(s,c);if(this.object.index.isObjectProperty()){var v=this.object.index.getObjectProperty();return function(x,_,b){var D=g(x,_,b),S=vr(D,v),A=p(x,_,S),E=m(x,_,b);return ji(D,v,a(S,A,E)),E}}else{var w=this.object.index._compile(s,c);return function(x,_,b){var D=g(x,_,b),S=w(x,_,D),A=i(D,S),E=p(x,_,A),M=m(x,_,b);return a(D,S,a(A,E,M)),M}}}else{if(!tr(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='<span class="math-paranthesis math-round-parenthesis">(</span>'+p+'<span class="math-paranthesis math-round-parenthesis">)</span>'),c+f+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+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 Ut(l,"name",Dp),l},{isClass:!0,isNode:!0});var Ep="BlockNode",WH=["ResultSet","Node"],fb=N(Ep,WH,r=>{var{ResultSet:e,Node:t}=r;class n 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(!Dt(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 Ep}get isBlockNode(){return!0}_compile(a,o){var l=Ln(this.blocks,function(u){return{evaluate:u.node._compile(a,o),visible:u.visible}});return function(s,c,f){var p=[];return Ha(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<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],l=0;l<this.blocks.length;l++){var u=this.blocks[l],s=this._ifNode(a(u.node,"blocks["+l+"].node",this));o[l]={node:s,visible:u.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:Ep,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return Ut(n,"name",Ep),n},{isClass:!0,isNode:!0});var Sp="ConditionalNode",jH=["Node"],pb=N(Sp,jH,r=>{var{Node:e}=r;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(rt(i))return!i.isZero();if(Cn(i))return!!(i.re||i.im);if(un(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Ct(i)+'"')}class n extends e{constructor(a,o,l){if(super(),!Dt(a))throw new TypeError("Parameter condition must be a Node");if(!Dt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!Dt(l))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=l}get type(){return Sp}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 n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=$t(this,o,a&&a.implicit),u=this.condition.toString(a),s=$t(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=$t(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=$t(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:Sp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=$t(this,o,a&&a.implicit),u=this.condition.toHTML(a),s=$t(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=l)&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=$t(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=l)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var p=this.falseExpr.toHTML(a),m=$t(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=l)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+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 Ut(n,"name",Sp),n},{isClass:!0,isNode:!0});var sT=ur(aT(),1);var db={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{?}"},Vt={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"},hb={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Vt.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(Vt.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Vt.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Vt.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Vt.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(Vt.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Vt.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(Vt.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(Vt.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Vt.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Vt.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Vt.bitAnd,"${args[1]}\\right)")},bitNot:{1:Vt.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Vt.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Vt.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Vt.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Vt.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Vt.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(Vt.and,"${args[1]}\\right)")},not:{1:Vt.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Vt.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Vt.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Vt.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(Vt.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Vt.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Vt.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Vt.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Vt.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Vt.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Vt.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Vt.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Vt.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(Vt.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(db.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)"}},uT="\\mathrm{${name}}\\left(${args}\\right)",oT={deg:"^\\circ"};function Np(r){return(0,sT.default)(r,{preserveFormatting:!0})}function Cp(r,e){return e=typeof e=="undefined"?!1:e,e?Ze(oT,r)?oT[r]:"\\mathrm{"+Np(r)+"}":Ze(db,r)?db[r]:Np(r)}var Mp="ConstantNode",XH=["Node"],gb=N(Mp,XH,r=>{var{Node:e}=r;class t extends e{constructor(i){super(),this.value=i}get type(){return Mp}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 at(this.value,i)}_toHTML(i){var a=this._toString(i);switch(Ct(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:Mp,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i);switch(Ct(this.value)){case"string":return"\\mathtt{"+Np(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 Ut(t,"name",Mp),t},{isClass:!0,isNode:!0});var Tp="FunctionAssignmentNode",QH=["typed","Node"],vb=N(Tp,QH,r=>{var{typed:e,Node:t}=r;function n(a,o,l){var u=$t(a,o,l),s=$t(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(!Dt(u))throw new TypeError('Node expected for parameter "expr"');if(yp.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 Tp}get isFunctionAssignmentNode(){return!0}_compile(o,l){var u=Object.create(l);Ha(this.params,function(h){u[h]=!0});var s=this.expr._compile(o,u),c=this.name,f=this.params,p=Nh(this.types,","),m=c+"("+Nh(this.params,", ")+")";return function(d,g,v){var w={};w[p]=function(){for(var x=Object.create(g),_=0;_<f.length;_++)x[f[_]]=arguments[_];return s(d,x,v)};var y=e(c,w);return y.syntax=m,d.set(c,y),y}}forEach(o){o(this.expr,"expr",this)}map(o){var l=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),l)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toString(o);return n(this,l,o&&o.implicit)&&(u="("+u+")"),this.name+"("+this.params.join(", ")+") = "+u}toJSON(){var o=this.types;return{mathjs:Tp,name:this.name,params:this.params.map(function(l,u){return{name:l,type:o[u]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var l=o&&o.parenthesis?o.parenthesis:"keep",u=[],s=0;s<this.params.length;s++)u.push('<span class="math-symbol math-parameter">'+Gr(this.params[s])+"</span>");var c=this.expr.toHTML(o);return n(this,l,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Gr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+u.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+c}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toTex(o);return n(this,l,o&&o.implicit)&&(u="\\left(".concat(u,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Cp).join(",")+"\\right)="+u}}return Ut(i,"name",Tp),i},{isClass:!0,isNode:!0});var Fp="IndexNode",KH=["Node","size"],yb=N(Fp,KH,r=>{var{Node:e,size:t}=r;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(Dt))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 Fp}get isIndexNode(){return!0}_compile(a,o){var l=Ln(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,v){if(!Ge(v)&&!Tt(v)&&!wr(v))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Ct(v));var w=t(v).valueOf(),y=Object.create(g);return y.end=w[c],m(d,y,v)}}else return s._compile(a,o)}),u=vr(a,"index");return function(c,f,p){var m=Ln(l,function(h){return h(c,f,p)});return u(...m)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],l=0;l<this.dimensions.length;l++)o[l]=this._ifNode(a(this.dimensions[l],"dimensions["+l+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&wt(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:Fp,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],l=0;l<this.dimensions.length;l++)o[l]=this.dimensions[l].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Gr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(l){return l.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return Ut(n,"name",Fp),n},{isClass:!0,isNode:!0});var Ip="ObjectNode",eG=["Node"],bb=N(Ip,eG,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return Dt(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Ip}get isObjectNode(){return!0}_compile(i,a){var o={};for(var l in this.properties)if(Ze(this.properties,l)){var u=Oo(l),s=JSON.parse(u),c=vr(this.properties,l);o[s]=c._compile(i,a)}return function(p,m,h){var d={};for(var g in o)Ze(o,g)&&(d[g]=o[g](p,m,h));return d}}forEach(i){for(var a in this.properties)Ze(this.properties,a)&&i(this.properties[a],"properties["+Oo(a)+"]",this)}map(i){var a={};for(var o in this.properties)Ze(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Oo(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)Ze(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push(Oo(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Ip,properties:this.properties}}static fromJSON(i){return new t(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Gr(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)Ze(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 Ut(t,"name",Ip),t},{isClass:!0,isNode:!0});var Bp="OperatorNode",tG=["Node"],xb=N(Bp,tG,r=>{var{Node:e}=r;function t(a,o){var l=a;if(o==="auto")for(;cn(l);)l=l.content;return wt(l)?!0:pr(l)?t(l.args[0],o):!1}function n(a,o,l,u,s){var c=$t(a,o,l),f=tu(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=$t(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()),xi[c][d].latexLeftParens===!1){p=[!1];break}if(xi[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,v=$t(u[0],o,l,a),w=Ap(a,u[0],o);v===null?g=!1:v===c&&f==="right"&&!w||v<c?g=!0:g=!1;var y,x=$t(u[1],o,l,a),_=Ap(a,u[1],o);if(x===null?y=!1:x===c&&f==="left"&&!_||x<c?y=!0:y=!1,s){var b,D,S;o==="keep"?(b=a.getIdentifier(),D=a.args[0].getIdentifier(),S=a.args[1].getIdentifier()):(b=a.getContent().getIdentifier(),D=a.args[0].getContent().getIdentifier(),S=a.args[1].getContent().getIdentifier()),v!==null&&(xi[c][b].latexLeftParens===!1&&(g=!1),xi[v][D].latexParens===!1&&(g=!1)),x!==null&&(xi[c][b].latexRightParens===!1&&(y=!1),xi[x][S].latexParens===!1&&(y=!1))}p=[g,y]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=u.map(function(E){var M=$t(E,o,l,a),F=Ap(a,E,o),P=tu(E,o);return M===null?!1:c===M&&f===P&&!F?!0:M<c}));break}if(u.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&l==="hide")for(var A=1;A<p.length;++A)t(u[A],o)&&!p[A-1]&&(o!=="keep"||!cn(u[A-1]))&&(p[A]=!0);return p}class i extends e{constructor(o,l,u,s,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof l!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(u)||!u.every(Dt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=s===!0,this.isPercentage=c===!0,this.op=o,this.fn=l,this.args=u||[]}get type(){return Bp}get isOperatorNode(){return!0}_compile(o,l){if(typeof this.fn!="string"||!$f(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var u=vr(o,this.fn),s=Ln(this.args,function(h){return h._compile(o,l)});if(typeof u=="function"&&u.rawArgs===!0){var c=this.args;return function(d,g,v){return u(c,o,d)}}else if(s.length===1){var f=s[0];return function(d,g,v){return u(f(d,g,v))}}else if(s.length===2){var p=s[0],m=s[1];return function(d,g,v){return u(p(d,g,v),m(d,g,v))}}else return function(d,g,v){return u.apply(null,Ln(s,function(w){return w(d,g,v)}))}}forEach(o){for(var l=0;l<this.args.length;l++)o(this.args[l],"args["+l+"]",this)}map(o){for(var l=[],u=0;u<this.args.length;u++)l[u]=this._ifNode(o(this.args[u],"args["+u+"]",this));return new i(this.op,this.fn,l,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=n(this,l,u,s,!1);if(s.length===1){var f=tu(this,l),p=s[0].toString(o);c[0]&&(p="("+p+")");var m=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(m?" ":"")+p:f==="left"?p+(m?" ":"")+this.op:p+this.op}else if(s.length===2){var h=s[0].toString(o),d=s[1].toString(o);return c[0]&&(h="("+h+")"),c[1]&&(d="("+d+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?h+" "+d:h+" "+this.op+" "+d}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=s.map(function(v,w){return v=v.toString(o),c[w]&&(v="("+v+")"),v});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:Bp,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=n(this,l,u,s,!1);if(s.length===1){var f=tu(this,l),p=s[0].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Gr(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Gr(this.op)+"</span>"}else if(s.length===2){var m=s[0].toHTML(o),h=s[1].toHTML(o);return c[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?m+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+h:m+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Gr(this.op)+"</span>"+h}else{var d=s.map(function(g,v){return g=g.toHTML(o),c[v]&&(g='<span class="math-parenthesis math-round-parenthesis">(</span>'+g+'<span class="math-parenthesis math-round-parenthesis">)</span>'),g});return s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?d.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):d.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Gr(this.op)+"</span>"):'<span class="math-function">'+Gr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+d.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=n(this,l,u,s,!0),f=Vt[this.fn];if(f=typeof f=="undefined"?this.op:f,s.length===1){var p=tu(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],v=g.toTex(o);c[1]&&(v="\\left(".concat(v,"\\right)"));var w;switch(l==="keep"?w=h.getIdentifier():w=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+v+"}";case"OperatorNode:pow":switch(d="{"+d+"}",v="{"+v+"}",w){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&u==="hide")return d+"~"+v}return d+f+v}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var y=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"?y.join("~"):y.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 Ut(i,"name",Bp),i},{isClass:!0,isNode:!0});var Pp="ParenthesisNode",rG=["Node"],wb=N(Pp,rG,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),!Dt(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Pp}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:Pp,content:this.content}}static fromJSON(i){return new t(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':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 Ut(t,"name",Pp),t},{isClass:!0,isNode:!0});var Op="RangeNode",nG=["Node"],_b=N(Op,nG,r=>{var{Node:e}=r;function t(i,a,o){var l=$t(i,a,o),u={},s=$t(i.start,a,o);if(u.start=s!==null&&s<=l||a==="all",i.step){var c=$t(i.step,a,o);u.step=c!==null&&c<=l||a==="all"}var f=$t(i.end,a,o);return u.end=f!==null&&f<=l||a==="all",u}class n extends e{constructor(a,o,l){if(super(),!Dt(a))throw new TypeError("Node expected");if(!Dt(o))throw new TypeError("Node expected");if(l&&!Dt(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 Op}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return tr(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 n(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 n(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:Op,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(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='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u=s,this.step){var c=this.step.toHTML(a);l.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return l.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+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 Ut(n,"name",Op),n},{isClass:!0,isNode:!0});var Rp="RelationalNode",iG=["Node"],Ab=N(Rp,iG,r=>{var{Node:e}=r,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n 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 Rp}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;d<l.conditionals.length;d++){m=h,h=u[d+1](c,f,p);var g=vr(a,l.conditionals[d]);if(!g(m,h))return!1}return!0}}forEach(a){this.params.forEach((o,l)=>a(o,"params["+l+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,l)=>this._ifNode(a(o,"params["+l+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=$t(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=$t(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?"("+f.toString(a)+")":f.toString(a)}),s=u[0],c=0;c<this.conditionals.length;c++)s+=" "+t[this.conditionals[c]],s+=" "+u[c+1];return s}toJSON(){return{mathjs:Rp,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=$t(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=$t(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),s=u[0],c=0;c<this.conditionals.length;c++)s+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Gr(t[this.conditionals[c]])+"</span>"+u[c+1];return s}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=$t(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=$t(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<this.conditionals.length;c++)s+=Vt[this.conditionals[c]]+u[c+1];return s}}return Ut(n,"name",Rp),n},{isClass:!0,isNode:!0});var aG="SymbolNode",oG=["math","?Unit","Node"],Db=N(aG,oG,r=>{var{math:e,Unit:t,Node:n}=r;function i(o){return t?t.isValuelessUnit(o):!1}class a extends n{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 vr(p,s)};if(s in l)return function(f,p,m){return f.has(s)?f.get(s):vr(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=Gr(this.name);return u==="true"||u==="false"?'<span class="math-symbol math-boolean">'+u+"</span>":u==="i"?'<span class="math-symbol math-imaginary-symbol">'+u+"</span>":u==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+u+"</span>":u==="NaN"?'<span class="math-symbol math-nan-symbol">'+u+"</span>":u==="null"?'<span class="math-symbol math-null-symbol">'+u+"</span>":u==="undefined"?'<span class="math-symbol math-undefined-symbol">'+u+"</span>":'<span class="math-symbol">'+u+"</span>"}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=Cp(this.name,u);return s[0]==="\\"?s:" "+s}}return a},{isClass:!0,isNode:!0});function zo(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return typeof r.createSubScope=="function"?Th(r.createSubScope(),...t):Th(Zi(),r,...t)}var kp="FunctionNode",sG=["math","Node","SymbolNode"],Eb=N(kp,sG,r=>{var e,{math:t,Node:n,SymbolNode:i}=r,a=u=>at(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(Dt(d))f+=d.toTex(c);else if(Array.isArray(d))f+=d.map(function(g,v){if(Dt(g))return g.toTex(c);throw new TypeError("Template: "+h[1]+"["+v+"] 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(Dt(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 n{constructor(s,c){if(super(),typeof s=="string"&&(s=new i(s)),!Dt(s))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(Dt))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 kp}get isFunctionNode(){return!0}_compile(s,c){var f=this.args.map(S=>S._compile(s,c));if(tr(this.fn)){var p=this.fn.name;if(c[p]){var v=this.args;return function(A,E,M){var F=vr(E,p);if(typeof F!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(F)));if(F.rawArgs)return F(v,s,zo(A,E));var P=f.map(k=>k(A,E,M));return F.apply(F,P)}}else{var m=p in s?vr(s,p):void 0,h=typeof m=="function"&&m.rawArgs===!0,d=S=>{var A;if(S.has(p))A=S.get(p);else if(p in s)A=vr(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,M){var F=d(A);return F(g,s,zo(A,E))}}else switch(f.length){case 0:return function(A,E,M){var F=d(A);return F()};case 1:return function(A,E,M){var F=d(A),P=f[0];return F(P(A,E,M))};case 2:return function(A,E,M){var F=d(A),P=f[0],k=f[1];return F(P(A,E,M),k(A,E,M))};default:return function(A,E,M){var F=d(A),P=f.map(k=>k(A,E,M));return F(...P)}}}}else if(ri(this.fn)&&di(this.fn.index)&&this.fn.index.isObjectProperty()){var w=this.fn.object._compile(s,c),y=this.fn.index.getObjectProperty(),x=this.args;return function(A,E,M){var F=w(A,E,M),P=xS(F,y);if(P!=null&&P.rawArgs)return P(x,s,zo(A,E));var k=f.map(O=>O(A,E,M));return P.apply(F,k)}}else{var _=this.fn.toString(),b=this.fn._compile(s,c),D=this.args;return function(A,E,M){var F=b(A,E,M);if(typeof F!="function")throw new TypeError("Expression '".concat(_,"' did not evaluate to a function; value is:")+`
`.concat(a(F)));if(F.rawArgs)return F(D,s,zo(A,E));var P=f.map(k=>k(A,E,M));return F.apply(F,P)}}}forEach(s){s(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)s(this.args[c],"args["+c+"]",this)}map(s){for(var c=this._ifNode(s(this.fn,"fn",this)),f=[],p=0;p<this.args.length;p++)f[p]=this._ifNode(s(this.args[p],"args["+p+"]",this));return new l(c,f)}clone(){return new l(this.fn,this.args.slice(0))}toString(s){var c,f=this.fn.toString(s);return s&&typeof s.handler=="object"&&Ze(s.handler,f)&&(c=s.handler[f](this,s)),typeof c!="undefined"?c:super.toString(s)}_toString(s){var c=this.args.map(function(p){return p.toString(s)}),f=Wi(this.fn)?"("+this.fn.toString(s)+")":this.fn.toString(s);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:kp,fn:this.fn,args:this.args}}_toHTML(s){var c=this.args.map(function(f){return f.toHTML(s)});return'<span class="math-function">'+Gr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(s){var c;return s&&typeof s.handler=="object"&&Ze(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;hb[this.name]&&(f=hb[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(uT,this,s)}getIdentifier(){return this.type+":"+this.name}}return e=l,Ut(l,"name",kp),Ut(l,"onUndefinedFunction",function(u){throw new Error("Undefined function "+u)}),Ut(l,"fromJSON",function(u){return new e(u.fn,u.args)}),l},{isClass:!0,isNode:!0});var lT="parse",uG=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],Sb=N(lT,uG,r=>{var{typed:e,numeric:t,config:n,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:v,SymbolNode:w}=r,y=e(lT,{string:function(z){return G(z,{})},"Array | Matrix":function(z){return x(z,{})},"string, Object":function(z,le){var Ee=le.nodes!==void 0?le.nodes:{};return G(z,Ee)},"Array | Matrix, Object":x});function x(C){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le=z.nodes!==void 0?z.nodes:{};return Je(C,function(Ee){if(typeof Ee!="string")throw new TypeError("String expected");return G(Ee,le)})}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},S={true:!0,false:!1,null:null,undefined:void 0},A=["NaN","Infinity"],E={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function M(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:_.NULL,nestingLevel:0,conditionalLevel:null}}function F(C,z){return C.expression.substr(C.index,z)}function P(C){return F(C,1)}function k(C){C.index++}function O(C){return C.expression.charAt(C.index-1)}function I(C){return C.expression.charAt(C.index+1)}function T(C){for(C.tokenType=_.NULL,C.token="",C.comment="";;){if(P(C)==="#")for(;P(C)!==`
`&&P(C)!=="";)C.comment+=P(C),k(C);if(y.isWhitespace(P(C),C.nestingLevel))k(C);else break}if(P(C)===""){C.tokenType=_.DELIMITER;return}if(P(C)===`
`&&!C.nestingLevel){C.tokenType=_.DELIMITER,C.token=P(C),k(C);return}var z=P(C),le=F(C,2),Ee=F(C,3);if(Ee.length===3&&b[Ee]){C.tokenType=_.DELIMITER,C.token=Ee,k(C),k(C),k(C);return}if(le.length===2&&b[le]){C.tokenType=_.DELIMITER,C.token=le,k(C),k(C);return}if(b[z]){C.tokenType=_.DELIMITER,C.token=z,k(C);return}if(y.isDigitDot(z)){C.tokenType=_.NUMBER;var et=F(C,2);if(et==="0b"||et==="0o"||et==="0x"){for(C.token+=P(C),k(C),C.token+=P(C),k(C);y.isHexDigit(P(C));)C.token+=P(C),k(C);if(P(C)===".")for(C.token+=".",k(C);y.isHexDigit(P(C));)C.token+=P(C),k(C);else if(P(C)==="i")for(C.token+="i",k(C);y.isDigit(P(C));)C.token+=P(C),k(C);return}if(P(C)==="."){if(C.token+=P(C),k(C),!y.isDigit(P(C))){C.tokenType=_.DELIMITER;return}}else{for(;y.isDigit(P(C));)C.token+=P(C),k(C);y.isDecimalMark(P(C),I(C))&&(C.token+=P(C),k(C))}for(;y.isDigit(P(C));)C.token+=P(C),k(C);if(P(C)==="E"||P(C)==="e"){if(y.isDigit(I(C))||I(C)==="-"||I(C)==="+"){if(C.token+=P(C),k(C),(P(C)==="+"||P(C)==="-")&&(C.token+=P(C),k(C)),!y.isDigit(P(C)))throw Me(C,'Digit expected, got "'+P(C)+'"');for(;y.isDigit(P(C));)C.token+=P(C),k(C);if(y.isDecimalMark(P(C),I(C)))throw Me(C,'Digit expected, got "'+P(C)+'"')}else if(I(C)===".")throw k(C),Me(C,'Digit expected, got "'+P(C)+'"')}return}if(y.isAlpha(P(C),O(C),I(C))){for(;y.isAlpha(P(C),O(C),I(C))||y.isDigit(P(C));)C.token+=P(C),k(C);Ze(D,C.token)?C.tokenType=_.DELIMITER:C.tokenType=_.SYMBOL;return}for(C.tokenType=_.UNKNOWN;P(C)!=="";)C.token+=P(C),k(C);throw Me(C,'Syntax error in part "'+C.token+'"')}function q(C){do T(C);while(C.token===`
`)}function B(C){C.nestingLevel++}function U(C){C.nestingLevel--}y.isAlpha=function(z,le,Ee){return y.isValidLatinOrGreek(z)||y.isValidMathSymbol(z,Ee)||y.isValidMathSymbol(le,z)},y.isValidLatinOrGreek=function(z){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(z)},y.isValidMathSymbol=function(z,le){return/^[\uD835]$/.test(z)&&/^[\uDC00-\uDFFF]$/.test(le)&&/^[^\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(le)},y.isWhitespace=function(z,le){return z===" "||z===" "||z===`
`&&le>0},y.isDecimalMark=function(z,le){return z==="."&&le!=="/"&&le!=="*"&&le!=="^"},y.isDigitDot=function(z){return z>="0"&&z<="9"||z==="."},y.isDigit=function(z){return z>="0"&&z<="9"},y.isHexDigit=function(z){return z>="0"&&z<="9"||z>="a"&&z<="f"||z>="A"&&z<="F"};function G(C,z){var le=M();gr(le,{expression:C,extraNodes:z}),T(le);var Ee=H(le);if(le.token!=="")throw le.tokenType===_.DELIMITER?Re(le,"Unexpected operator "+le.token):Me(le,'Unexpected part "'+le.token+'"');return Ee}function H(C){var z,le=[],Ee;for(C.token!==""&&C.token!==`
`&&C.token!==";"&&(z=L(C),C.comment&&(z.comment=C.comment));C.token===`
`||C.token===";";)le.length===0&&z&&(Ee=C.token!==";",le.push({node:z,visible:Ee})),T(C),C.token!==`
`&&C.token!==";"&&C.token!==""&&(z=L(C),C.comment&&(z.comment=C.comment),Ee=C.token!==";",le.push({node:z,visible:Ee}));return le.length>0?new l(le):(z||(z=new s(void 0),C.comment&&(z.comment=C.comment)),z)}function L(C){var z,le,Ee,et,ut=ie(C);if(C.token==="="){if(tr(ut))return z=ut.name,q(C),Ee=L(C),new o(new w(z),Ee);if(ri(ut))return q(C),Ee=L(C),new o(ut.object,ut.index,Ee);if(Mn(ut)&&tr(ut.fn)&&(et=!0,le=[],z=ut.name,ut.args.forEach(function(dr,jn){tr(dr)?le[jn]=dr.name:et=!1}),et))return q(C),Ee=L(C),new c(z,le,Ee);throw Me(C,"Invalid left hand side of assignment operator =")}return ut}function ie(C){for(var z=ve(C);C.token==="?";){var le=C.conditionalLevel;C.conditionalLevel=C.nestingLevel,q(C);var Ee=z,et=L(C);if(C.token!==":")throw Me(C,"False part of conditional expression expected");C.conditionalLevel=null,q(C);var ut=L(C);z=new u(Ee,et,ut),C.conditionalLevel=le}return z}function ve(C){for(var z=se(C);C.token==="or";)q(C),z=new h("or","or",[z,se(C)]);return z}function se(C){for(var z=ue(C);C.token==="xor";)q(C),z=new h("xor","xor",[z,ue(C)]);return z}function ue(C){for(var z=he(C);C.token==="and";)q(C),z=new h("and","and",[z,he(C)]);return z}function he(C){for(var z=K(C);C.token==="|";)q(C),z=new h("|","bitOr",[z,K(C)]);return z}function K(C){for(var z=re(C);C.token==="^|";)q(C),z=new h("^|","bitXor",[z,re(C)]);return z}function re(C){for(var z=me(C);C.token==="&";)q(C),z=new h("&","bitAnd",[z,me(C)]);return z}function me(C){for(var z=[de(C)],le=[],Ee={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ze(Ee,C.token);){var et={name:C.token,fn:Ee[C.token]};le.push(et),q(C),z.push(de(C))}return z.length===1?z[0]:z.length===2?new h(le[0].name,le[0].fn,z):new v(le.map(ut=>ut.fn),z)}function de(C){var z,le,Ee,et;z=Pe(C);for(var ut={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ze(ut,C.token);)le=C.token,Ee=ut[le],q(C),et=[z,Pe(C)],z=new h(le,Ee,et);return z}function Pe(C){var z,le,Ee,et;z=we(C);for(var ut={to:"to",in:"to"};Ze(ut,C.token);)le=C.token,Ee=ut[le],q(C),le==="in"&&C.token===""?z=new h("*","multiply",[z,new w("in")],!0):(et=[z,we(C)],z=new h(le,Ee,et));return z}function we(C){var z,le=[];if(C.token===":"?z=new s(1):z=V(C),C.token===":"&&C.conditionalLevel!==C.nestingLevel){for(le.push(z);C.token===":"&&le.length<3;)q(C),C.token===")"||C.token==="]"||C.token===","||C.token===""?le.push(new w("end")):le.push(V(C));le.length===3?z=new g(le[0],le[2],le[1]):z=new g(le[0],le[1])}return z}function V(C){var z,le,Ee,et;z=J(C);for(var ut={"+":"add","-":"subtract"};Ze(ut,C.token);){le=C.token,Ee=ut[le],q(C);var dr=J(C);dr.isPercentage?et=[z,new h("*","multiply",[z,dr])]:et=[z,dr],z=new h(le,Ee,et)}return z}function J(C){var z,le,Ee,et;z=ce(C),le=z;for(var ut={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Ze(ut,C.token);)Ee=C.token,et=ut[Ee],q(C),le=ce(C),z=new h(Ee,et,[z,le]);return z}function ce(C){var z,le;for(z=W(C),le=z;C.tokenType===_.SYMBOL||C.token==="in"&&wt(z)||C.tokenType===_.NUMBER&&!wt(le)&&(!pr(le)||le.op==="!")||C.token==="(";)le=W(C),z=new h("*","multiply",[z,le],!0);return z}function W(C){for(var z=ee(C),le=z,Ee=[];C.token==="/"&&Qu(le);)if(Ee.push(gr({},C)),q(C),C.tokenType===_.NUMBER)if(Ee.push(gr({},C)),q(C),C.tokenType===_.SYMBOL||C.token==="(")gr(C,Ee.pop()),Ee.pop(),le=ee(C),z=new h("/","divide",[z,le]);else{Ee.pop(),gr(C,Ee.pop());break}else{gr(C,Ee.pop());break}return z}function ee(C){var z,le,Ee,et;z=ne(C);for(var ut={"%":"mod",mod:"mod"};Ze(ut,C.token);)le=C.token,Ee=ut[le],q(C),le==="%"&&C.tokenType===_.DELIMITER&&C.token!=="("?z=new h("/","divide",[z,new s(100)],!1,!0):(et=[z,ne(C)],z=new h(le,Ee,et));return z}function ne(C){var z,le,Ee,et={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ze(et,C.token)?(Ee=et[C.token],z=C.token,q(C),le=[ne(C)],new h(z,Ee,le)):ge(C)}function ge(C){var z,le,Ee,et;return z=ye(C),(C.token==="^"||C.token===".^")&&(le=C.token,Ee=le==="^"?"pow":"dotPow",q(C),et=[z,ne(C)],z=new h(le,Ee,et)),z}function ye(C){var z,le,Ee,et;z=Ue(C);for(var ut={"!":"factorial","'":"ctranspose"};Ze(ut,C.token);)le=C.token,Ee=ut[le],T(C),et=[z],z=new h(le,Ee,et),z=ft(C,z);return z}function Ue(C){var z=[];if(C.tokenType===_.SYMBOL&&Ze(C.extraNodes,C.token)){var le=C.extraNodes[C.token];if(T(C),C.token==="("){if(z=[],B(C),T(C),C.token!==")")for(z.push(L(C));C.token===",";)T(C),z.push(L(C));if(C.token!==")")throw Me(C,"Parenthesis ) expected");U(C),T(C)}return new le(z)}return Ae(C)}function Ae(C){var z,le;return C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in D?(le=C.token,T(C),Ze(S,le)?z=new s(S[le]):A.indexOf(le)!==-1?z=new s(t(le,"number")):z=new w(le),z=ft(C,z),z):xt(C)}function ft(C,z,le){for(var Ee;(C.token==="("||C.token==="["||C.token===".")&&(!le||le.indexOf(C.token)!==-1);)if(Ee=[],C.token==="(")if(tr(z)||ri(z)){if(B(C),T(C),C.token!==")")for(Ee.push(L(C));C.token===",";)T(C),Ee.push(L(C));if(C.token!==")")throw Me(C,"Parenthesis ) expected");U(C),T(C),z=new f(z,Ee)}else return z;else if(C.token==="["){if(B(C),T(C),C.token!=="]")for(Ee.push(L(C));C.token===",";)T(C),Ee.push(L(C));if(C.token!=="]")throw Me(C,"Parenthesis ] expected");U(C),T(C),z=new i(z,new p(Ee))}else{T(C);var et=C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in D;if(!et)throw Me(C,"Property name expected after dot");Ee.push(new s(C.token)),T(C);var ut=!0;z=new i(z,new p(Ee,ut))}return z}function xt(C){var z,le;return C.token==='"'||C.token==="'"?(le=zt(C,C.token),z=new s(le),z=ft(C,z),z):Kt(C)}function zt(C,z){for(var le="";P(C)!==""&&P(C)!==z;)if(P(C)==="\\"){k(C);var Ee=P(C),et=E[Ee];if(et!==void 0)le+=et,C.index+=1;else if(Ee==="u"){var ut=C.expression.slice(C.index+1,C.index+5);if(/^[0-9A-Fa-f]{4}$/.test(ut))le+=String.fromCharCode(parseInt(ut,16)),C.index+=5;else throw Me(C,"Invalid unicode character \\u".concat(ut))}else throw Me(C,"Bad escape character \\".concat(Ee))}else le+=P(C),k(C);if(T(C),C.token!==z)throw Me(C,"End of string ".concat(z," expected"));return T(C),le}function Kt(C){var z,le,Ee,et;if(C.token==="["){if(B(C),T(C),C.token!=="]"){var ut=j(C);if(C.token===";"){for(Ee=1,le=[ut];C.token===";";)T(C),le[Ee]=j(C),Ee++;if(C.token!=="]")throw Me(C,"End of matrix ] expected");U(C),T(C),et=le[0].items.length;for(var dr=1;dr<Ee;dr++)if(le[dr].items.length!==et)throw Re(C,"Column dimensions mismatch ("+le[dr].items.length+" !== "+et+")");z=new a(le)}else{if(C.token!=="]")throw Me(C,"End of matrix ] expected");U(C),T(C),z=ut}}else U(C),T(C),z=new a([]);return ft(C,z)}return ae(C)}function j(C){for(var z=[L(C)],le=1;C.token===",";)T(C),z[le]=L(C),le++;return new a(z)}function ae(C){if(C.token==="{"){B(C);var z,le={};do if(T(C),C.token!=="}"){if(C.token==='"'||C.token==="'")z=zt(C,C.token);else if(C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in D)z=C.token,T(C);else throw Me(C,"Symbol or string expected as object key");if(C.token!==":")throw Me(C,"Colon : expected after object key");T(C),le[z]=L(C)}while(C.token===",");if(C.token!=="}")throw Me(C,"Comma , or bracket } expected after object value");U(C),T(C);var Ee=new m(le);return Ee=ft(C,Ee),Ee}return pe(C)}function pe(C){var z;return C.tokenType===_.NUMBER?(z=C.token,T(C),new s(t(z,n.number))):_e(C)}function _e(C){var z;if(C.token==="("){if(B(C),T(C),z=L(C),C.token!==")")throw Me(C,"Parenthesis ) expected");return U(C),T(C),z=new d(z),z=ft(C,z),z}return Te(C)}function Te(C){throw C.token===""?Me(C,"Unexpected end of expression"):Me(C,"Value expected")}function De(C){return C.index-C.token.length+1}function Me(C,z){var le=De(C),Ee=new SyntaxError(z+" (char "+le+")");return Ee.char=le,Ee}function Re(C,z){var le=De(C),Ee=new SyntaxError(z+" (char "+le+")");return Ee.char=le,Ee}return e.addConversion({from:"string",to:"Node",convert:y}),y});var cT="compile",lG=["typed","parse"],Nb=N(cT,lG,r=>{var{typed:e,parse:t}=r;return e(cT,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return Je(i,function(a){return t(a).compile()})}})});var fT="evaluate",cG=["typed","parse"],Cb=N(fT,cG,r=>{var{typed:e,parse:t}=r;return e(fT,{string:function(i){var a=Zi();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=Zi();return Je(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return Je(i,function(o){return t(o).compile().evaluate(a)})}})});var fG="Parser",pG=["evaluate"],Mb=N(fG,pG,r=>{var{evaluate:e}=r;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Zi(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(n){return e(n,this.scope)},t.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},t.prototype.getAll=function(){return _S(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(n,i){return this.scope.set(n,i),i},t.prototype.remove=function(n){this.scope.delete(n)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var pT="parser",mG=["typed","Parser"],Tb=N(pT,mG,r=>{var{typed:e,Parser:t}=r;return e(pT,{"":function(){return new t}})});var mT="lup",dG=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Fb=N(mT,dG,r=>{var{typed:e,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:l,larger:u,equalScalar:s,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=r;return e(mT,{DenseMatrix:function(v){return h(v)},SparseMatrix:function(v){return d(v)},Array:function(v){var w=t(v),y=h(w);return{L:y.L.valueOf(),U:y.U.valueOf(),p:y.p}}});function h(g){var v=g._size[0],w=g._size[1],y=Math.min(v,w),x=Qe(g._data),_=[],b=[v,y],D=[],S=[y,w],A,E,M,F=[];for(A=0;A<v;A++)F[A]=A;for(E=0;E<w;E++){if(E>0)for(A=0;A<v;A++){var P=Math.min(A,E),k=0;for(M=0;M<P;M++)k=i(k,o(x[A][M],x[M][E]));x[A][E]=l(x[A][E],k)}var O=E,I=0,T=0;for(A=E;A<v;A++){var q=x[A][E],B=n(q);u(B,I)&&(O=A,I=B,T=q)}if(E!==O&&(F[E]=[F[O],F[O]=F[E]][0],f._swapRows(E,O,x)),E<v)for(A=E+1;A<v;A++){var U=x[A][E];s(U,0)||(x[A][E]=a(x[A][E],T))}}for(E=0;E<w;E++)for(A=0;A<v;A++){if(E===0&&(A<w&&(D[A]=[]),_[A]=[]),A<E){A<w&&(D[A][E]=x[A][E]),E<v&&(_[A][E]=0);continue}if(A===E){A<w&&(D[A][E]=x[A][E]),E<v&&(_[A][E]=1);continue}A<w&&(D[A][E]=0),E<v&&(_[A][E]=x[A][E])}var G=new f({data:_,size:b}),H=new f({data:D,size:S}),L=[];for(A=0,y=F.length;A<y;A++)L[F[A]]=A;return{L:G,U:H,p:L,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function d(g){var v=g._size[0],w=g._size[1],y=Math.min(v,w),x=g._values,_=g._index,b=g._ptr,D=[],S=[],A=[],E=[v,y],M=[],F=[],P=[],k=[y,w],O,I,T,q=[],B=[];for(O=0;O<v;O++)q[O]=O,B[O]=O;var U=function(L,ie){var ve=B[L],se=B[ie];q[ve]=ie,q[se]=L,B[L]=se,B[ie]=ve},G=function(){var L=new m;I<v&&(A.push(D.length),D.push(1),S.push(I)),P.push(M.length);var ie=b[I],ve=b[I+1];for(T=ie;T<ve;T++)O=_[T],L.set(q[O],x[T]);I>0&&L.forEach(0,I-1,function(K,re){p._forEachRow(K,D,S,A,function(me,de){me>K&&L.accumulate(me,c(o(de,re)))})});var se=I,ue=L.get(I),he=n(ue);L.forEach(I+1,v-1,function(K,re){var me=n(re);u(me,he)&&(se=K,he=me,ue=re)}),I!==se&&(p._swapRows(I,se,E[1],D,S,A),p._swapRows(I,se,k[1],M,F,P),L.swap(I,se),U(I,se)),L.forEach(0,v-1,function(K,re){K<=I?(M.push(re),F.push(K)):(re=a(re,ue),s(re,0)||(D.push(re),S.push(K)))})};for(I=0;I<w;I++)G();return P.push(M.length),A.push(D.length),{L:new p({values:D,index:S,ptr:A,size:E}),U:new p({values:M,index:F,ptr:P,size:k}),p:q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var dT="qr",hG=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],Ib=N(dT,hG,r=>{var{typed:e,matrix:t,zeros:n,identity:i,isZero:a,equal:o,sign:l,sqrt:u,conj:s,unaryMinus:c,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=r;return gr(e(dT,{DenseMatrix:function(x){return v(x)},SparseMatrix:function(x){return w(x)},Array:function(x){var _=t(x),b=v(_);return{Q:b.Q.valueOf(),R:b.R.valueOf()}}}),{_denseQRimpl:g});function g(y){var x=y._size[0],_=y._size[1],b=i([x],"dense"),D=b._data,S=y.clone(),A=S._data,E,M,F,P=n([x],"");for(F=0;F<Math.min(_,x);++F){var k=A[F][F],O=c(o(k,0)?1:l(k)),I=s(O),T=0;for(E=F;E<x;E++)T=f(T,m(A[E][F],s(A[E][F])));var q=m(O,u(T));if(!a(q)){var B=h(k,q);for(P[F]=1,E=F+1;E<x;E++)P[E]=p(A[E][F],B);var U=c(s(p(B,q))),G=void 0;for(M=F;M<_;M++){for(G=0,E=F;E<x;E++)G=f(G,m(s(P[E]),A[E][M]));for(G=m(G,U),E=F;E<x;E++)A[E][M]=m(h(A[E][M],m(P[E],G)),I)}for(E=0;E<x;E++){for(G=0,M=F;M<x;M++)G=f(G,m(D[E][M],P[M]));for(G=m(G,U),M=F;M<x;++M)D[E][M]=p(h(D[E][M],m(G,s(P[M]))),I)}}}return{Q:b,R:S,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function v(y){var x=g(y),_=x.R._data;if(y._data.length>0)for(var b=_[0][0].type==="Complex"?d(0):0,D=0;D<_.length;++D)for(var S=0;S<D&&S<(_[0]||[]).length;++S)_[D][S]=b;return x}function w(y){throw new Error("qr not implemented for sparse matrices yet")}});function hT(r,e,t,n){for(var i=r._values,a=r._index,o=r._ptr,l=r._size,u=r._datatype,s=l[0],c=l[1],f=n&&r._values?[]:null,p=[],m=[],h=0,d=0;d<c;d++){m[d]=h;for(var g=t?t[d]:d,v=o[g],w=o[g+1],y=v;y<w;y++){var x=e?e[a[y]]:a[y];p[h]=x,f&&(f[h]=i[y]),h++}}return m[c]=h,r.createSparseMatrix({values:f,index:p,ptr:m,size:[s,c],datatype:u})}function Lp(r,e,t,n,i,a,o){var l=0;for(t[o]=r;l>=0;){var u=t[o+l],s=t[n+u];s===-1?(l--,a[e++]=u):(t[n+u]=t[i+s],++l,t[o+l]=s)}return e}function gT(r,e){if(!r)return null;var t=0,n,i=[],a=[],o=0,l=e,u=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)r[n]!==-1&&(a[l+n]=a[o+r[n]],a[o+r[n]]=n);for(n=0;n<e;n++)r[n]===-1&&(t=Lp(n,t,a,o,l,i,u));return i}function vT(r,e){if(!r)return null;var t=r._index,n=r._ptr,i=r._size,a=i[0],o=i[1],l=[],u=[],s=0,c=o,f,p;if(e)for(f=0;f<a;f++)u[c+f]=-1;for(var m=0;m<o;m++){l[m]=-1,u[s+m]=-1;for(var h=n[m],d=n[m+1],g=h;g<d;g++){var v=t[g];for(f=e?u[c+v]:v;f!==-1&&f<m;f=p)p=u[s+f],u[s+f]=m,p===-1&&(l[f]=m);e&&(u[c+v]=m)}}return l}function yT(r,e,t){for(var n=r._values,i=r._index,a=r._ptr,o=r._size,l=o[1],u=0,s=0;s<l;s++){var c=a[s];for(a[s]=u;c<a[s+1];c++)e(i[c],s,n?n[c]:1,t)&&(i[u]=i[c],n&&(n[u]=n[c]),u++)}return a[l]=u,i.splice(u,i.length-u),n&&n.splice(u,n.length-u),u}function Oi(r){return-r-2}var gG="csAmd",vG=["add","multiply","transpose"],bT=N(gG,vG,r=>{var{add:e,multiply:t,transpose:n}=r;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 v=i(c,f,m,h,g);yT(v,u,null);for(var w=v._index,y=v._ptr,x=y[h],_=[],b=[],D=0,S=h+1,A=2*(h+1),E=3*(h+1),M=4*(h+1),F=5*(h+1),P=6*(h+1),k=7*(h+1),O=_,I=a(h,y,b,D,E,O,A,k,S,P,M,F),T=o(h,y,b,F,M,P,g,S,E,O,A),q=0,B,U,G,H,L,ie,ve,se,ue,he,K,re,me,de,Pe,we;T<h;){for(G=-1;q<h&&(G=b[E+q])===-1;q++);b[A+G]!==-1&&(O[b[A+G]]=-1),b[E+q]=b[A+G];var V=b[M+G],J=b[S+G];T+=J;var ce=0;b[S+G]=-J;var W=y[G],ee=V===0?W:x,ne=ee;for(H=1;H<=V+1;H++){for(H>V?(ie=G,ve=W,se=b[D+G]-V):(ie=w[W++],ve=y[ie],se=b[D+ie]),L=1;L<=se;L++)B=w[ve++],!((ue=b[S+B])<=0)&&(ce+=ue,b[S+B]=-ue,w[ne++]=B,b[A+B]!==-1&&(O[b[A+B]]=O[B]),O[B]!==-1?b[A+O[B]]=b[A+B]:b[E+b[F+B]]=b[A+B]);ie!==G&&(y[ie]=Oi(G),b[P+ie]=0)}for(V!==0&&(x=ne),b[F+G]=ce,y[G]=ee,b[D+G]=ne-ee,b[M+G]=-2,I=l(I,d,b,P,h),he=ee;he<ne;he++)if(B=w[he],!((K=b[M+B])<=0)){ue=-b[S+B];var ge=I-ue;for(W=y[B],re=y[B]+K-1;W<=re;W++)ie=w[W],b[P+ie]>=I?b[P+ie]-=ue:b[P+ie]!==0&&(b[P+ie]=b[F+ie]+ge)}for(he=ee;he<ne;he++){for(B=w[he],re=y[B],me=re+b[M+B]-1,de=re,Pe=0,we=0,W=re;W<=me;W++)if(ie=w[W],b[P+ie]!==0){var ye=b[P+ie]-I;ye>0?(we+=ye,w[de++]=ie,Pe+=ie):(y[ie]=Oi(G),b[P+ie]=0)}b[M+B]=de-re+1;var Ue=de,Ae=re+b[D+B];for(W=me+1;W<Ae;W++){U=w[W];var ft=b[S+U];ft<=0||(we+=ft,w[de++]=U,Pe+=U)}we===0?(y[B]=Oi(G),ue=-b[S+B],ce-=ue,J+=ue,T+=ue,b[S+B]=0,b[M+B]=-1):(b[F+B]=Math.min(b[F+B],we),w[de]=w[Ue],w[Ue]=w[re],w[re]=G,b[D+B]=de-re+1,Pe=(Pe<0?-Pe:Pe)%h,b[A+B]=b[k+Pe],b[k+Pe]=B,O[B]=Pe)}for(b[F+G]=ce,d=Math.max(d,ce),I=l(I+d,d,b,P,h),he=ee;he<ne;he++)if(B=w[he],!(b[S+B]>=0))for(Pe=O[B],B=b[k+Pe],b[k+Pe]=-1;B!==-1&&b[A+B]!==-1;B=b[A+B],I++){for(se=b[D+B],K=b[M+B],W=y[B]+1;W<=y[B]+se-1;W++)b[P+w[W]]=I;var xt=B;for(U=b[A+B];U!==-1;){var zt=b[D+U]===se&&b[M+U]===K;for(W=y[U]+1;zt&&W<=y[U]+se-1;W++)b[P+w[W]]!==I&&(zt=0);zt?(y[U]=Oi(B),b[S+B]+=b[S+U],b[S+U]=0,b[M+U]=-1,U=b[A+U],b[A+xt]=U):(xt=U,U=b[A+U])}}for(W=ee,he=ee;he<ne;he++)B=w[he],!((ue=-b[S+B])<=0)&&(b[S+B]=ue,we=b[F+B]+ce-ue,we=Math.min(we,h-T-ue),b[E+we]!==-1&&(O[b[E+we]]=B),b[A+B]=b[E+we],O[B]=-1,b[E+we]=B,q=Math.min(q,we),b[F+B]=we,w[W++]=B);b[S+G]=J,(b[D+G]=W-ee)===0&&(y[G]=-1,b[P+G]=0),V!==0&&(x=W)}for(B=0;B<h;B++)y[B]=Oi(y[B]);for(U=0;U<=h;U++)b[E+U]=-1;for(U=h;U>=0;U--)b[S+U]>0||(b[A+U]=b[E+y[U]],b[E+y[U]]=U);for(ie=h;ie>=0;ie--)b[S+ie]<=0||y[ie]!==-1&&(b[A+ie]=b[E+y[ie]],b[E+y[ie]]=ie);for(G=0,B=0;B<=h;B++)y[B]===-1&&(G=Lp(B,G,b,E,A,_,P));return _.splice(_.length-1,1),_};function i(s,c,f,p,m){var h=n(c);if(s===1&&p===f)return e(c,h);if(s===2){for(var d=h._index,g=h._ptr,v=0,w=0;w<f;w++){var y=g[w];if(g[w]=v,!(g[w+1]-y>m))for(var x=g[w+1];y<x;y++)d[v++]=d[y]}return g[f]=v,c=n(h),t(h,c)}return t(h,c)}function a(s,c,f,p,m,h,d,g,v,w,y,x){for(var _=0;_<s;_++)f[p+_]=c[_+1]-c[_];f[p+s]=0;for(var b=0;b<=s;b++)f[m+b]=-1,h[b]=-1,f[d+b]=-1,f[g+b]=-1,f[v+b]=1,f[w+b]=1,f[y+b]=0,f[x+b]=f[p+b];var D=l(0,0,f,w,s);return f[y+s]=-2,c[s]=-1,f[w+s]=0,D}function o(s,c,f,p,m,h,d,g,v,w,y){for(var x=0,_=0;_<s;_++){var b=f[p+_];if(b===0)f[m+_]=-2,x++,c[_]=-1,f[h+_]=0;else if(b>d)f[g+_]=0,f[m+_]=-1,x++,c[_]=Oi(s),f[g+s]++;else{var D=f[v+b];D!==-1&&(w[D]=_),f[y+_]=f[v+b],f[v+b]=_}}return x}function l(s,c,f,p,m){if(s<2||s+c<0){for(var h=0;h<m;h++)f[p+h]!==0&&(f[p+h]=1);s=2}return s}function u(s,c){return s!==c}});function xT(r,e,t,n,i,a,o){var l,u,s=0,c;if(r<=e||t[n+e]<=t[i+r])return-1;t[i+r]=t[n+e];var f=t[a+r];if(t[a+r]=e,f===-1)s=1,c=r;else{for(s=2,c=f;c!==t[o+c];c=t[o+c]);for(l=f;l!==c;l=u)u=t[o+l],t[o+l]=c}return{jleaf:s,q:c}}var yG="csCounts",bG=["transpose"],wT=N(yG,bG,r=>{var{transpose:e}=r;return function(t,n,i,a){if(!t||!n||!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),v=[],w=0,y=u,x=2*u,_=3*u,b=4*u,D=5*u+1;for(f=0;f<g;f++)v[f]=-1;var S=[],A=e(t),E=A._index,M=A._ptr;for(f=0;f<u;f++)for(c=i[f],S[c]=v[_+c]===-1?1:0;c!==-1&&v[_+c]===-1;c=n[c])v[_+c]=f;if(a){for(f=0;f<u;f++)v[i[f]]=f;for(s=0;s<l;s++){for(f=u,h=M[s],d=M[s+1],m=h;m<d;m++)f=Math.min(f,v[E[m]]);v[D+s]=v[b+f],v[b+f]=s}}for(s=0;s<u;s++)v[w+s]=s;for(f=0;f<u;f++){for(c=i[f],n[c]!==-1&&S[n[c]]--,p=a?v[b+f]:c;p!==-1;p=a?v[D+p]:-1)for(m=M[p];m<M[p+1];m++){s=E[m];var F=xT(s,c,v,_,y,x,w);F.jleaf>=1&&S[c]++,F.jleaf===2&&S[F.q]--}n[c]!==-1&&(v[w+c]=n[c])}for(c=0;c<u;c++)n[c]!==-1&&(S[n[c]]+=S[c]);return S}});var xG="csSqr",wG=["add","multiply","transpose"],_T=N(xG,wG,r=>{var{add:e,multiply:t,transpose:n}=r,i=bT({add:e,multiply:t,transpose:n}),a=wT({transpose:n});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?hT(s,null,d.q,0):s;d.parent=vT(g,1);var v=gT(d.parent,m);if(d.cp=a(g,d.parent,v,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,h=0;h<m;h++)d.unz+=d.cp[h]}else d.unz=4*f[m]+m,d.lnz=d.unz;return d};function o(l,u){var s=l._ptr,c=l._index,f=l._size,p=f[0],m=f[1];u.pinv=[],u.leftmost=[];var h=u.parent,d=u.pinv,g=u.leftmost,v=[],w=0,y=p,x=p+m,_=p+2*m,b,D,S,A,E;for(D=0;D<m;D++)v[y+D]=-1,v[x+D]=-1,v[_+D]=0;for(b=0;b<p;b++)g[b]=-1;for(D=m-1;D>=0;D--)for(A=s[D],E=s[D+1],S=A;S<E;S++)g[c[S]]=D;for(b=p-1;b>=0;b--)d[b]=-1,D=g[b],D!==-1&&(v[_+D]++===0&&(v[x+D]=b),v[w+b]=v[y+D],v[y+D]=b);for(u.lnz=0,u.m2=p,D=0;D<m;D++)if(b=v[y+D],u.lnz++,b<0&&(b=u.m2++),d[b]=D,!(--_[D]<=0)){u.lnz+=v[_+D];var M=h[D];M!==-1&&(v[_+M]===0&&(v[x+M]=v[x+D]),v[w+v[x+D]]=v[y+M],v[y+M]=v[w+b],v[_+M]+=v[_+D])}for(b=0;b<p;b++)d[b]<0&&(d[b]=D++);return!0}});function Sl(r,e){return r[e]<0}function Up(r,e){r[e]=Oi(r[e])}function Bb(r){return r<0?Oi(r):r}function AT(r,e,t,n,i){var a=e._index,o=e._ptr,l=e._size,u=l[1],s,c,f,p=0;for(n[0]=r;p>=0;){r=n[p];var m=i?i[r]:r;Sl(o,r)||(Up(o,r),n[u+p]=m<0?0:Bb(o[m]));var h=1;for(c=n[u+p],f=m<0?0:Bb(o[m+1]);c<f;c++)if(s=a[c],!Sl(o,s)){n[u+p]=c,n[++p]=s,h=0;break}h&&(p--,n[--t]=r)}return t}function DT(r,e,t,n,i){var a=r._ptr,o=r._size,l=e._index,u=e._ptr,s=o[1],c,f,p,m=s;for(f=u[t],p=u[t+1],c=f;c<p;c++){var h=l[c];Sl(a,h)||(m=AT(h,r,m,n,i))}for(c=m;c<s;c++)Up(a,n[c]);return m}var _G="csSpsolve",AG=["divideScalar","multiply","subtract"],ET=N(_G,AG,r=>{var{divideScalar:e,multiply:t,subtract:n}=r;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],v=o._values,w=o._index,y=o._ptr,x,_,b,D,S=DT(a,o,l,u,c);for(x=S;x<g;x++)s[u[x]]=0;for(_=y[l],b=y[l+1],x=_;x<b;x++)s[w[x]]=v[x];for(var A=S;A<g;A++){var E=u[A],M=c?c[E]:E;if(!(M<0))for(_=h[M],b=h[M+1],s[E]=e(s[E],p[f?_:b-1]),x=f?_+1:_,D=f?b:b-1;x<D;x++){var F=m[x];s[F]=n(s[F],t(p[x],s[E]))}}return S}});var DG="csLu",EG=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],ST=N(DG,EG,r=>{var{abs:e,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:l}=r,u=ET({divideScalar:t,multiply:n,subtract:i});return function(c,f,p){if(!c)return null;var m=c._size,h=m[1],d,g=100,v=100;f&&(d=f.q,g=f.lnz||g,v=f.unz||v);var w=[],y=[],x=[],_=new l({values:w,index:y,ptr:x,size:[h,h]}),b=[],D=[],S=[],A=new l({values:b,index:D,ptr:S,size:[h,h]}),E=[],M,F,P=[],k=[];for(M=0;M<h;M++)P[M]=0,E[M]=-1,x[M+1]=0;g=0,v=0;for(var O=0;O<h;O++){x[O]=g,S[O]=v;var I=d?d[O]:O,T=u(_,c,I,k,P,E,1),q=-1,B=-1;for(F=T;F<h;F++)if(M=k[F],E[M]<0){var U=e(P[M]);a(U,B)&&(B=U,q=M)}else D[v]=E[M],b[v++]=P[M];if(q===-1||B<=0)return null;E[I]<0&&o(e(P[I]),n(B,p))&&(q=I);var G=P[q];for(D[v]=O,b[v++]=G,E[q]=O,y[g]=q,w[g++]=1,F=T;F<h;F++)M=k[F],E[M]<0&&(y[g]=M,w[g++]=t(P[M],G)),P[M]=0}for(x[h]=g,S[h]=v,F=0;F<g;F++)y[F]=E[y[F]];return w.splice(g,w.length-g),y.splice(g,y.length-g),b.splice(v,b.length-v),D.splice(v,D.length-v),{L:_,U:A,pinv:E}}});var NT="slu",SG=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],Pb=N(NT,SG,r=>{var{typed:e,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:l,larger:u,largerEq:s,SparseMatrix:c}=r,f=_T({add:n,multiply:i,transpose:a}),p=ST({abs:t,divideScalar:o,multiply:i,subtract:l,larger:u,largerEq:s,SparseMatrix:c});return e(NT,{"SparseMatrix, number, number":function(h,d,g){if(!$e(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 v=f(d,h,!1),w=p(h,v,g);return{L:w.L,U:w.U,p:w.pinv,q:v.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function Ob(r,e){var t,n=e.length,i=[];if(r)for(t=0;t<n;t++)i[r[t]]=e[t];else for(t=0;t<n;t++)i[t]=e[t];return i}var CT="lusolve",NG=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],Rb=N(CT,NG,r=>{var{typed:e,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:l}=r,u=Xi({DenseMatrix:l});return e(CT,{"Array, Array | Matrix":function(p,m){p=t(p);var h=n(p),d=c(h.L,h.U,h.p,null,m);return d.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var h=n(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var h=n(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(Ge(f))return f;if(Tt(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=Ob(m,d._data));var g=o(f,d),v=a(p,g);return h&&(v._data=Ob(h,v._data)),v}});var MT="polynomialRoot",CG=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],kb=N(MT,CG,r=>{var{typed:e,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:l,sqrt:u,unaryMinus:s,cbrt:c,typeOf:f,im:p,re:m}=r;return e(MT,{"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[v,w,y]=g,x=o(2,y),_=o(w,w),b=o(4,y,v);if(n(_,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[S,A,E,M]=g,F=s(o(3,M)),P=o(E,E),k=o(3,M,A),O=i(o(2,E,E,E),o(27,M,M,S)),I=o(9,M,E,A);if(n(P,k)&&n(O,I))return[l(E,F)];var T=a(P,k),q=a(O,I),B=i(o(18,M,E,A,S),o(E,E,A,A)),U=i(o(4,E,E,E,S),o(4,M,A,A,A),o(27,M,M,S,S));if(n(B,U))return[l(a(o(4,M,E,A),i(o(9,M,M,S),o(E,E,E))),o(M,T)),l(a(o(9,M,S),o(E,A)),o(2,T))];var G;n(P,k)?G=q:G=l(i(q,u(a(o(q,q),o(4,T,T,T)))),2);var H=!0,L=c(G,H).toArray().map(ie=>l(i(E,ie,l(T,ie)),F));return L.map(ie=>f(ie)==="Complex"&&n(m(ie),m(ie)+p(ie))?m(ie):ie)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var MG="Help",TG=["parse"],Lb=N(MG,TG,r=>{var{parse:e}=r;function t(n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`
`),n.category&&(i+="Category: "+n.category+`
`),n.description&&(i+=`Description:
`+n.description+`
`),n.syntax&&(i+=`Syntax:
`+n.syntax.join(`
`)+`
`),n.examples){i+=`Examples:
`;for(var a={},o=0;o<n.examples.length;o++){var l=n.examples[o];i+=" "+l+`
`;var u=void 0;try{u=e(l).compile().evaluate(a)}catch(s){u=s}u!==void 0&&!If(u)&&(i+=" "+at(u,{precision:14})+`
`)}i+=`
`}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},t.prototype.toJSON=function(){var n=Qe(this.doc);return n.mathjs="Help",n},t.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var FG="Chain",IG=["?on","math","typed"],Ub=N(FG,IG,r=>{var{on:e,math:t,typed:n}=r;function i(s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Bf(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 at(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){jE(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;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(s)){var p=n.resolve(s,c);if(p.params.length===1)throw new Error("chain function "+s.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(s,c))}return new i(s.apply(s,c))}}i.createProxy=function(s,c){if(typeof s=="string")a(s,c);else{var f=function(h){Ze(s,h)&&u[h]===void 0&&o(h,()=>s[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 Vb={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 TT={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var FT={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 IT={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 BT={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var PT={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var OT={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 RT={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 kT={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var LT={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var UT={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 qb={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 VT={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 qT={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var zT={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var $T={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var HT={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var GT={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 WT={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 jT={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 ZT={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 JT={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 YT={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 XT={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 QT={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 KT={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 e2={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 t2={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 r2={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 n2={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 i2={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 a2={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 o2={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 s2={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 u2={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 l2={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 c2={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 f2={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 p2={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 m2={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 d2={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 h2={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 g2={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 v2={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 y2={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 b2={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 x2={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 w2={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 _2={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 A2={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var D2={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 E2={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 S2={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 N2={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 C2={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 M2={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 T2={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 F2={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 I2={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 B2={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 P2={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 O2={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 R2={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 k2={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 L2={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 U2={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 V2={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 q2={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 z2={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 $2={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 H2={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 G2={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 W2={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 j2={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 Z2={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 J2={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 Y2={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 X2={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 Q2={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 K2={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 eF={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 tF={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 rF={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 nF={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 iF={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 aF={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 oF={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 sF={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var uF={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 lF={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 cF={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 fF={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 pF={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 mF={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 dF={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 hF={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 gF={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 vF={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 yF={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 bF={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 xF={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 wF={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 _F={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 AF={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 DF={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 EF={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 SF={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 NF={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 CF={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 MF={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 TF={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 FF={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 IF={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 BF={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 PF={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 OF={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 RF={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 kF={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 LF={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 UF={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 VF={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 qF={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 zF={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 $F={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 HF={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 GF={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 WF={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 jF={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 ZF={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 JF={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 YF={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 XF={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 QF={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 KF={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 eI={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 tI={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 rI={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 nI={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 iI={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 aI={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 oI={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 sI={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 uI={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 lI={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 cI={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 fI={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 pI={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 mI={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 dI={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 hI={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var gI={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var vI={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 yI={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 bI={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 xI={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 wI={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 _I={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 AI={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 DI={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 EI={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 SI={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 NI={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 CI={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 MI={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 TI={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 FI={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 II={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 BI={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 PI={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 OI={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 RI={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 kI={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 LI={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 UI={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 VI={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 qI={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 zI={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 $I={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 HI={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 GI={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 WI={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 jI={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 ZI={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 JI={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 YI={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 XI={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 QI={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 KI={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 eB={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 tB={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 rB={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 nB={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 iB={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 aB={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 oB={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 sB={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 uB={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 lB={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 cB={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 fB={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 pB={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 mB={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 dB={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 hB={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 gB={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 vB={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 yB={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 bB={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var xB={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 wB={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 _B={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 AB={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 DB={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 EB={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 SB={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 NB={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 CB={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 MB={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 TB={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 FB={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 IB={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 BB={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 PB={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var OB={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 RB={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 kB={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 LB={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var UB={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 VB={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 qB={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 zB={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var $B={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 HB={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 GB={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 WB={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 jB={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 ZB={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 JB={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 YB={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 XB={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var QB={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 KB={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 eP={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 tP={bignumber:GT,boolean:WT,complex:jT,createUnit:ZT,fraction:JT,index:YT,matrix:XT,number:QT,sparse:KT,splitUnit:e2,string:t2,unit:r2,e:Vb,E:Vb,false:TT,i:FT,Infinity:IT,LN2:PT,LN10:BT,LOG2E:RT,LOG10E:OT,NaN:kT,null:LT,pi:qb,PI:qb,phi:UT,SQRT1_2:VT,SQRT2:qT,tau:zT,true:$T,version:HT,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:o2,lsolve:u2,lsolveAll:l2,lup:c2,lusolve:f2,leafCount:s2,polynomialRoot:p2,resolve:h2,simplify:g2,simplifyConstant:v2,simplifyCore:y2,symbolicEqual:x2,rationalize:d2,slu:b2,usolve:w2,usolveAll:_2,qr:m2,abs:A2,add:D2,cbrt:E2,ceil:S2,cube:N2,divide:C2,dotDivide:M2,dotMultiply:T2,dotPow:F2,exp:I2,expm:B2,expm1:P2,fix:O2,floor:R2,gcd:k2,hypot:L2,lcm:V2,log:q2,log2:H2,log1p:$2,log10:z2,mod:G2,multiply:W2,norm:j2,nthRoot:Z2,nthRoots:J2,pow:Y2,round:X2,sign:Q2,sqrt:K2,sqrtm:eF,square:iF,subtract:aF,unaryMinus:oF,unaryPlus:sF,xgcd:uF,invmod:U2,bitAnd:lF,bitNot:cF,bitOr:fF,bitXor:pF,leftShift:mF,rightArithShift:dF,rightLogShift:hF,bellNumbers:gF,catalan:vF,composition:yF,stirlingS2:bF,config:n2,import:i2,typed:a2,arg:xF,conj:wF,re:AF,im:_F,evaluate:DF,help:EF,distance:SF,intersect:NF,and:CF,not:MF,or:TF,xor:FF,concat:BF,count:PF,cross:OF,column:IF,ctranspose:RF,det:kF,diag:LF,diff:UF,dot:VF,getMatrixDataType:GF,identity:WF,filter:zF,flatten:$F,forEach:HF,inv:jF,pinv:ZF,eigs:qF,kron:JF,matrixFromFunction:QF,matrixFromRows:KF,matrixFromColumns:XF,map:YF,ones:eI,partitionSelect:tI,range:rI,resize:iI,reshape:nI,rotate:aI,rotationMatrix:oI,row:sI,size:uI,sort:lI,squeeze:cI,subset:fI,trace:pI,transpose:mI,zeros:dI,fft:hI,ifft:gI,sylvester:tF,schur:rF,lyap:nF,solveODE:eP,combinations:vI,combinationsWithRep:yI,factorial:bI,gamma:xI,kldivergence:_I,lgamma:wI,multinomial:AI,permutations:DI,pickRandom:EI,random:SI,randomInt:NI,compare:CI,compareNatural:MI,compareText:TI,deepEqual:FI,equal:II,equalText:BI,larger:PI,largerEq:OI,smaller:RI,smallerEq:kI,unequal:LI,setCartesian:UI,setDifference:VI,setDistinct:qI,setIntersect:zI,setIsSubset:$I,setMultiplicity:HI,setPowerset:GI,setSize:WI,setSymDifference:jI,setUnion:ZI,zpk2tf:JI,freqz:YI,erf:XI,zeta:QI,cumsum:uB,mad:KI,max:eB,mean:tB,median:rB,min:nB,mode:iB,prod:aB,quantileSeq:oB,std:sB,sum:lB,variance:cB,corr:fB,acos:pB,acosh:mB,acot:dB,acoth:hB,acsc:gB,acsch:vB,asec:yB,asech:bB,asin:xB,asinh:wB,atan:_B,atanh:DB,atan2:AB,cos:EB,cosh:SB,cot:NB,coth:CB,csc:MB,csch:TB,sec:FB,sech:IB,sin:BB,sinh:PB,tan:OB,tanh:RB,to:kB,clone:UB,format:VB,bin:LB,oct:XB,hex:zB,isNaN:HB,isInteger:$B,isNegative:GB,isNumeric:WB,hasNumericValue:qB,isPositive:jB,isPrime:ZB,isZero:JB,print:QB,typeOf:KB,numeric:YB};var rP="help",BG=["typed","mathWithTransform","Help"],zb=N(rP,BG,r=>{var{typed:e,mathWithTransform:t,Help:n}=r;return e(rP,{any:function(a){var o,l=a;if(typeof a!="string"){for(o in t)if(Ze(t,o)&&a===t[o]){l=o;break}}var u=vr(tP,l);if(!u){var s=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+s+'"')}return new n(u)}})});var nP="chain",PG=["typed","Chain"],$b=N(nP,PG,r=>{var{typed:e,Chain:t}=r;return e(nP,{"":function(){return new t},any:function(i){return new t(i)}})});var iP="det",OG=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],Hb=N(iP,OG,r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:l}=r;return e(iP,{any:function(c){return Qe(c)},"Array | Matrix":function(c){var f;switch(Ge(c)?f=c.size():Array.isArray(c)?(c=t(c),f=c.size()):f=[],f.length){case 0:return Qe(c);case 1:if(f[0]===1)return Qe(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+at(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: "+at(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(f)+")")}}});function u(s,c,f){if(c===1)return Qe(s[0][0]);if(c===2)return n(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,S)=>S),h=0;h<c;h++){var d=m[h];if(o(s[d][h])){var g=void 0;for(g=h+1;g<c;g++)if(!o(s[m[g]][h])){d=m[g],m[g]=m[h],m[h]=d,p=!p;break}if(g===c)return s[d][h]}for(var v=s[d][h],w=h===0?1:s[m[h-1]][h-1],y=h+1;y<c;y++)for(var x=m[y],_=h+1;_<c;_++)s[x][_]=a(n(i(s[x][_],v),i(s[x][h],s[d][_])),w)}var b=s[m[c-1]][c-1];return p?l(b):b}});var aP="inv",RG=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Gb=N(aP,RG,r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:l,identity:u,abs:s}=r;return e(aP,{"Array | Matrix":function(p){var m=Ge(p)?p.size():tt(p);switch(m.length){case 1:if(m[0]===1)return Ge(p)?t([n(1,p.valueOf()[0])]):[n(1,p[0])];throw new RangeError("Matrix must be square (size: "+at(m)+")");case 2:{var h=m[0],d=m[1];if(h===d)return Ge(p)?t(c(p.valueOf(),h,d),p.storage()):c(p,h,d);throw new RangeError("Matrix must be square (size: "+at(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(m)+")")}},any:function(p){return n(1,p)}});function c(f,p,m){var h,d,g,v,w;if(p===1){if(v=f[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,v)]]}else if(p===2){var y=l(f);if(y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],y),n(o(f[0][1]),y)],[n(o(f[1][0]),y),n(f[0][0],y)]]}else{var x=f.concat();for(h=0;h<p;h++)x[h]=x[h].concat();for(var _=u(p).valueOf(),b=0;b<m;b++){var D=s(x[b][b]),S=b;for(h=b+1;h<p;)s(x[h][b])>D&&(D=s(x[h][b]),S=h),h++;if(D===0)throw Error("Cannot calculate inverse, determinant is zero");h=S,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<p;h++){var M=x[h],F=_[h];if(h!==b){if(M[b]!==0){for(g=n(o(M[b]),A[b]),d=b;d<m;d++)M[d]=i(M[d],a(g,A[d]));for(d=0;d<m;d++)F[d]=i(F[d],a(g,E[d]))}}else{for(g=A[b],d=b;d<m;d++)M[d]=n(M[d],g);for(d=0;d<m;d++)F[d]=n(F[d],g)}}}return _}}});var oP="pinv",kG=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Wb=N(oP,kG,r=>{var{typed:e,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:l,ctranspose:u,divideScalar:s,multiply:c,add:f,Complex:p}=r;return e(oP,{"Array | Matrix":function(y){var x=Ge(y)?y.size():tt(y);switch(x.length){case 1:return v(y)?u(y):x[0]===1?n(y):o(u(y),l(y,y));case 2:{if(v(y))return u(y);var _=x[0],b=x[1];if(_===b)try{return n(y)}catch(D){if(!(D instanceof Error&&D.message.match(/Cannot calculate inverse, determinant is zero/)))throw D}return Ge(y)?t(m(y.valueOf(),_,b),y.storage()):m(y,_,b)}default:throw new RangeError("Matrix must be two dimensional (size: "+at(x)+")")}},any:function(y){return a(y,0)?Qe(y):s(1,y)}});function m(w,y,x){var{C:_,F:b}=d(w,y,x),D=c(n(c(u(_),_)),u(_)),S=c(u(b),n(c(b,u(b))));return c(S,D)}function h(w,y,x){for(var _=Qe(w),b=0,D=0;D<y;D++){if(x<=b)return _;for(var S=D;g(_[S][b]);)if(S++,y===S&&(S=D,b++,x===b))return _;[_[S],_[D]]=[_[D],_[S]];for(var A=_[D][b],E=0;E<x;E++)_[D][E]=o(_[D][E],A);for(var M=0;M<y;M++)if(M!==D){A=_[M][b];for(var F=0;F<x;F++)_[M][F]=f(_[M][F],c(-1,c(A,_[D][F])))}b++}return _}function d(w,y,x){var _=h(w,y,x),b=w.map((S,A)=>S.filter((E,M)=>M<y&&!g(l(_[M],_[M])))),D=_.filter((S,A)=>!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 v(w){return i(f(w,p(1,1)),f(c(w,0),p(1,1)))}});function sP(r){var{addScalar:e,subtract:t,flatten:n,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:v,complex:w,larger:y,smaller:x,matrixFromColumns:_,dot:b}=r;function D(H,L,ie,ve){var se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ue=S(H,L,ie,ve,se);A(H,L,ie,ve,se,ue);var{values:he,C:K}=E(H,L,ie,ve,se);if(se){var re=M(H,L,K,ue,he,ie,ve);return{values:he,eigenvectors:re}}return{values:he}}function S(H,L,ie,ve,se){var ue=ve==="BigNumber",he=ve==="Complex",K=ue?s(0):0,re=ue?s(1):he?w(1):1,me=ue?s(1):1,de=ue?s(10):2,Pe=a(de,de),we;se&&(we=Array(L).fill(re));for(var V=!1;!V;){V=!0;for(var J=0;J<L;J++){for(var ce=K,W=K,ee=0;ee<L;ee++)J!==ee&&(ce=e(ce,u(H[ee][J])),W=e(W,u(H[J][ee])));if(!v(ce,0)&&!v(W,0)){for(var ne=me,ge=ce,ye=o(W,de),Ue=a(W,de);x(ge,ye);)ge=a(ge,Pe),ne=a(ne,de);for(;y(ge,Ue);)ge=o(ge,Pe),ne=o(ne,de);var Ae=x(o(e(ge,W),ne),a(e(ce,W),.95));if(Ae){V=!1;for(var ft=o(1,ne),xt=0;xt<L;xt++)J!==xt&&(H[J][xt]=a(H[J][xt],ft),H[xt][J]=a(H[xt][J],ne));se&&(we[J]=a(we[J],ft))}}}}return se?c(we):null}function A(H,L,ie,ve,se,ue){var he=ve==="BigNumber",K=ve==="Complex",re=he?s(0):K?w(0):0;he&&(ie=s(ie));for(var me=0;me<L-2;me++){for(var de=0,Pe=re,we=me+1;we<L;we++){var V=H[we][me];x(u(Pe),u(V))&&(Pe=V,de=we)}if(!x(u(Pe),ie)){if(de!==me+1){var J=H[de];H[de]=H[me+1],H[me+1]=J;for(var ce=0;ce<L;ce++){var W=H[ce][de];H[ce][de]=H[ce][me+1],H[ce][me+1]=W}if(se){var ee=ue[de];ue[de]=ue[me+1],ue[me+1]=ee}}for(var ne=me+2;ne<L;ne++){var ge=o(H[ne][me],Pe);if(ge!==0){for(var ye=0;ye<L;ye++)H[ne][ye]=t(H[ne][ye],a(ge,H[me+1][ye]));for(var Ue=0;Ue<L;Ue++)H[Ue][me+1]=e(H[Ue][me+1],a(ge,H[Ue][ne]));if(se)for(var Ae=0;Ae<L;Ae++)ue[ne][Ae]=t(ue[ne][Ae],a(ge,ue[me+1][Ae]))}}}}return ue}function E(H,L,ie,ve,se){var ue=ve==="BigNumber",he=ve==="Complex",K=ue?s(1):he?w(1):1;ue&&(ie=s(ie));for(var re=Qe(H),me=[],de=L,Pe=[],we=se?c(Array(L).fill(K)):void 0,V=se?c(Array(de).fill(K)):void 0,J=0;J<=100;){J+=1;for(var ce=re[de-1][de-1],W=0;W<de;W++)re[W][W]=t(re[W][W],ce);var{Q:ee,R:ne}=h(re);re=i(ne,ee);for(var ge=0;ge<de;ge++)re[ge][ge]=e(re[ge][ge],ce);if(se&&(V=i(V,ee)),de===1||x(u(re[de-1][de-2]),ie)){J=0,me.push(re[de-1][de-1]),se&&(Pe.unshift([[1]]),k(V,L),we=i(we,V),de>1&&(V=c(Array(de-1).fill(K)))),de-=1,re.pop();for(var ye=0;ye<de;ye++)re[ye].pop()}else if(de===2||x(u(re[de-2][de-3]),ie)){J=0;var Ue=F(re[de-2][de-2],re[de-2][de-1],re[de-1][de-2],re[de-1][de-1]);me.push(...Ue),se&&(Pe.unshift(P(re[de-2][de-2],re[de-2][de-1],re[de-1][de-2],re[de-1][de-1],Ue[0],Ue[1],ie,ve)),k(V,L),we=i(we,V),de>2&&(V=c(Array(de-2).fill(K)))),de-=2,re.pop(),re.pop();for(var Ae=0;Ae<de;Ae++)re[Ae].pop(),re[Ae].pop()}if(de===0)break}if(me.sort((zt,Kt)=>+t(u(zt),u(Kt))),J>100){var ft=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+me.join(", "));throw ft.values=me,ft.vectors=[],ft}var xt=se?i(we,O(Pe,L)):void 0;return{values:me,C:xt}}function M(H,L,ie,ve,se,ue,he){var K=m(ie),re=i(K,H,ie),me=he==="BigNumber",de=he==="Complex",Pe=me?s(0):de?w(0):0,we=me?s(1):de?w(1):1,V=[],J=[];for(var ce of se){var W=I(V,ce,v);W===-1?(V.push(ce),J.push(1)):J[W]+=1}for(var ee=[],ne=V.length,ge=Array(L).fill(Pe),ye=c(Array(L).fill(we)),Ue=function(){var xt=V[Ae],zt=t(re,i(xt,ye)),Kt=g(zt,ge);for(Kt.shift();Kt.length<J[Ae];){var j=T(zt,L,Kt,ue,he);if(j===null)break;Kt.push(j)}var ae=i(m(ve),ie);Kt=Kt.map(pe=>i(ae,pe)),ee.push(...Kt.map(pe=>({value:xt,vector:n(pe)})))},Ae=0;Ae<ne;Ae++)Ue();return ee}function F(H,L,ie,ve){var se=e(H,ve),ue=t(a(H,ve),a(L,ie)),he=a(se,.5),K=a(l(t(a(se,se),a(4,ue))),.5);return[e(he,K),t(he,K)]}function P(H,L,ie,ve,se,ue,he,K){var re=K==="BigNumber",me=K==="Complex",de=re?s(0):me?w(0):0,Pe=re?s(1):me?w(1):1;if(x(u(ie),he))return[[Pe,de],[de,Pe]];if(y(u(t(se,ue)),he))return[[t(se,ve),t(ue,ve)],[ie,ie]];var we=t(H,se),V=t(ve,se);return x(u(L),he)&&x(u(V),he)?[[we,Pe],[ie,de]]:[[L,de],[V,Pe]]}function k(H,L){for(var ie=0;ie<H.length;ie++)H[ie].push(...Array(L-H[ie].length).fill(0));for(var ve=H.length;ve<L;ve++)H.push(Array(L).fill(0)),H[ve][ve]=1;return H}function O(H,L){for(var ie=[],ve=0;ve<L;ve++)ie[ve]=Array(L).fill(0);var se=0;for(var ue of H){for(var he=ue.length,K=0;K<he;K++)for(var re=0;re<he;re++)ie[se+K][se+re]=ue[K][re];se+=he}return ie}function I(H,L,ie){for(var ve=0;ve<H.length;ve++)if(ie(H[ve],L))return ve;return-1}function T(H,L,ie,ve,se){for(var ue=se==="BigNumber"?s(1e3):1e3,he,K=0;K<5;++K){he=q(L,ie,se);try{he=d(H,he)}catch(me){continue}if(y(U(he),ue))break}if(K>=5)return null;for(K=0;;){var re=d(H,he);if(x(U(B(he,[re])),ve))break;if(++K>=10)return null;he=G(re)}return he}function q(H,L,ie){var ve=ie==="BigNumber",se=ie==="Complex",ue=Array(H).fill(0).map(he=>2*Math.random()-1);return ve&&(ue=ue.map(he=>s(he))),se&&(ue=ue.map(he=>w(he))),ue=B(ue,L),G(ue,ie)}function B(H,L){var ie=f(H);for(var ve of L)ve=p(ve,ie),H=t(H,i(o(b(ve,H),b(ve,ve)),ve));return H}function U(H){return u(l(b(H,H)))}function G(H,L){var ie=L==="BigNumber",ve=L==="Complex",se=ie?s(1):ve?w(1):1;return i(o(se,U(H)),H)}return D}function uP(r){var{config:e,addScalar:t,subtract:n,abs:i,atan:a,cos:o,sin:l,multiplyScalar:u,inv:s,bignumber:c,multiply:f,add:p}=r;function m(A,E){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,F=arguments.length>3?arguments[3]:void 0,P=arguments.length>4?arguments[4]:void 0;if(F==="number")return h(A,M,P);if(F==="BigNumber")return d(A,M,P);throw TypeError("Unsupported data type: "+F)}function h(A,E,M){var F=A.length,P=Math.abs(E/F),k,O;if(M){O=new Array(F);for(var I=0;I<F;I++)O[I]=Array(F).fill(0),O[I][I]=1}for(var T=b(A);Math.abs(T[1])>=Math.abs(P);){var q=T[0][0],B=T[0][1];k=g(A[q][q],A[B][B],A[q][B]),A=_(A,k,q,B),M&&(O=w(O,k,q,B)),T=b(A)}for(var U=Array(F).fill(0),G=0;G<F;G++)U[G]=A[G][G];return S(Qe(U),O,M)}function d(A,E,M){var F=A.length,P=i(E/F),k,O;if(M){O=new Array(F);for(var I=0;I<F;I++)O[I]=Array(F).fill(0),O[I][I]=1}for(var T=D(A);i(T[1])>=i(P);){var q=T[0][0],B=T[0][1];k=v(A[q][q],A[B][B],A[q][B]),A=x(A,k,q,B),M&&(O=y(O,k,q,B)),T=D(A)}for(var U=Array(F).fill(0),G=0;G<F;G++)U[G]=A[G][G];return S(Qe(U),O,M)}function g(A,E,M){var F=E-A;return Math.abs(F)<=e.epsilon?Math.PI/4:.5*Math.atan(2*M/(E-A))}function v(A,E,M){var F=n(E,A);return i(F)<=e.epsilon?c(-1).acos().div(4):u(.5,a(f(2,M,s(F))))}function w(A,E,M,F){for(var P=A.length,k=Math.cos(E),O=Math.sin(E),I=Array(P).fill(0),T=Array(P).fill(0),q=0;q<P;q++)I[q]=k*A[q][M]-O*A[q][F],T[q]=O*A[q][M]+k*A[q][F];for(var B=0;B<P;B++)A[B][M]=I[B],A[B][F]=T[B];return A}function y(A,E,M,F){for(var P=A.length,k=o(E),O=l(E),I=Array(P).fill(c(0)),T=Array(P).fill(c(0)),q=0;q<P;q++)I[q]=n(u(k,A[q][M]),u(O,A[q][F])),T[q]=t(u(O,A[q][M]),u(k,A[q][F]));for(var B=0;B<P;B++)A[B][M]=I[B],A[B][F]=T[B];return A}function x(A,E,M,F){for(var P=A.length,k=c(o(E)),O=c(l(E)),I=u(k,k),T=u(O,O),q=Array(P).fill(c(0)),B=Array(P).fill(c(0)),U=f(c(2),k,O,A[M][F]),G=t(n(u(I,A[M][M]),U),u(T,A[F][F])),H=p(u(T,A[M][M]),U,u(I,A[F][F])),L=0;L<P;L++)q[L]=n(u(k,A[M][L]),u(O,A[F][L])),B[L]=t(u(O,A[M][L]),u(k,A[F][L]));A[M][M]=G,A[F][F]=H,A[M][F]=c(0),A[F][M]=c(0);for(var ie=0;ie<P;ie++)ie!==M&&ie!==F&&(A[M][ie]=q[ie],A[ie][M]=q[ie],A[F][ie]=B[ie],A[ie][F]=B[ie]);return A}function _(A,E,M,F){for(var P=A.length,k=Math.cos(E),O=Math.sin(E),I=k*k,T=O*O,q=Array(P).fill(0),B=Array(P).fill(0),U=I*A[M][M]-2*k*O*A[M][F]+T*A[F][F],G=T*A[M][M]+2*k*O*A[M][F]+I*A[F][F],H=0;H<P;H++)q[H]=k*A[M][H]-O*A[F][H],B[H]=O*A[M][H]+k*A[F][H];A[M][M]=U,A[F][F]=G,A[M][F]=0,A[F][M]=0;for(var L=0;L<P;L++)L!==M&&L!==F&&(A[M][L]=q[L],A[L][M]=q[L],A[F][L]=B[L],A[L][F]=B[L]);return A}function b(A){for(var E=A.length,M=0,F=[0,1],P=0;P<E;P++)for(var k=P+1;k<E;k++)Math.abs(M)<Math.abs(A[P][k])&&(M=Math.abs(A[P][k]),F=[P,k]);return[F,M]}function D(A){for(var E=A.length,M=0,F=[0,1],P=0;P<E;P++)for(var k=P+1;k<E;k++)i(M)<i(A[P][k])&&(M=i(A[P][k]),F=[P,k]);return[F,M]}function S(A,E,M){var F=A.length,P=Array(F),k;if(M){k=Array(F);for(var O=0;O<F;O++)k[O]=Array(F)}for(var I=0;I<F;I++){for(var T=0,q=A[0],B=0;B<A.length;B++)i(A[B])<i(q)&&(T=B,q=A[T]);if(P[I]=A.splice(T,1)[0],M)for(var U=0;U<F;U++)k[I][U]=E[U][T],E[U].splice(T,1)}if(!M)return{values:P};var G=k.map((H,L)=>({value:P[L],vector:H}));return{values:P,eigenvectors:G}}return m}var LG="eigs",UG=["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"],jb=N(LG,UG,r=>{var{config:e,typed:t,matrix:n,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:v,column:w,flatten:y,number:x,complex:_,sqrt:b,diag:D,size:S,reshape:A,qr:E,usolve:M,usolveAll:F,im:P,re:k,smaller:O,matrixFromColumns:I,dot:T}=r,q=uP({config:e,addScalar:i,subtract:a,column:w,flatten:y,equal:o,abs:l,atan:u,cos:s,sin:c,multiplyScalar:f,inv:m,bignumber:h,complex:_,multiply:d,add:g}),B=sP({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:y,divideScalar:p,sqrt:b,abs:l,bignumber:h,diag:D,size:S,reshape:A,qr:E,inv:m,usolve:M,usolveAll:F,equal:o,complex:_,larger:v,smaller:O,matrixFromColumns:I,dot:T});return t("eigs",{Array:function(ue){return U(n(ue))},"Array, number|BigNumber":function(ue,he){return U(n(ue),{precision:he})},"Array, Object"(se,ue){return U(n(se),ue)},Matrix:function(ue){return U(ue,{matricize:!0})},"Matrix, number|BigNumber":function(ue,he){return U(ue,{precision:he,matricize:!0})},"Matrix, Object":function(ue,he){var K={matricize:!0};return gr(K,he),U(ue,K)}});function U(se){var ue,he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K="eigenvectors"in he?he.eigenvectors:!0,re=(ue=he.precision)!==null&&ue!==void 0?ue:e.epsilon,me=G(se,re,K);return he.matricize&&(me.values=n(me.values),K&&(me.eigenvectors=me.eigenvectors.map(de=>{var{value:Pe,vector:we}=de;return{value:Pe,vector:n(we)}}))),K&&Object.defineProperty(me,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),me}function G(se,ue,he){var K=se.toArray(),re=se.size();if(re.length!==2||re[0]!==re[1])throw new RangeError("Matrix must be square (size: ".concat(at(re),")"));var me=re[0];if(L(K,me,ue)&&(ie(K,me),H(K,me,ue))){var de=ve(se,K,me);return q(K,me,ue,de,he)}var Pe=ve(se,K,me);return B(K,me,ue,Pe,he)}function H(se,ue,he){for(var K=0;K<ue;K++)for(var re=K;re<ue;re++)if(v(h(l(a(se[K][re],se[re][K]))),he))return!1;return!0}function L(se,ue,he){for(var K=0;K<ue;K++)for(var re=0;re<ue;re++)if(v(h(l(P(se[K][re]))),he))return!1;return!0}function ie(se,ue){for(var he=0;he<ue;he++)for(var K=0;K<ue;K++)se[he][K]=k(se[he][K])}function ve(se,ue,he){var K=se.datatype();if(K==="number"||K==="BigNumber"||K==="Complex")return K;for(var re=!1,me=!1,de=!1,Pe=0;Pe<he;Pe++)for(var we=0;we<he;we++){var V=ue[Pe][we];if(it(V)||ma(V))re=!0;else if(rt(V))me=!0;else if(Cn(V))de=!0;else throw TypeError("Unsupported type in Matrix: "+Ct(V))}if(me&&de&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),de){for(var J=0;J<he;J++)for(var ce=0;ce<he;ce++)ue[J][ce]=_(ue[J][ce]);return"Complex"}if(me){for(var W=0;W<he;W++)for(var ee=0;ee<he;ee++)ue[W][ee]=h(ue[W][ee]);return"BigNumber"}if(re){for(var ne=0;ne<he;ne++)for(var ge=0;ge<he;ge++)ue[ne][ge]=x(ue[ne][ge]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var lP="expm",VG=["typed","abs","add","identity","inv","multiply"],Zb=N(lP,VG,r=>{var{typed:e,abs:t,add:n,identity:i,inv:a,multiply:o}=r;return e(lP,{Matrix:function(f){var p=f.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+at(p)+")");for(var m=p[0],h=1e-15,d=l(f),g=u(d,h),v=g.q,w=g.j,y=o(f,Math.pow(2,-w)),x=i(m),_=i(m),b=1,D=y,S=-1,A=1;A<=v;A++)A>1&&(D=o(D,y),S=-S),b=b*(v-A+1)/((2*v-A+1)*A),x=n(x,o(b,D)),_=n(_,o(b*S,D));for(var E=o(a(_),x),M=0;M<w;M++)E=o(E,E);return Mi(f)?f.createSparseMatrix(E):E}});function l(c){for(var f=c.size()[0],p=0,m=0;m<f;m++){for(var h=0,d=0;d<f;d++)h+=t(c.get([m,d]));p=Math.max(h,p)}return p}function u(c,f){for(var p=30,m=0;m<p;m++)for(var h=0;h<=m;h++){var d=m-h;if(s(c,h,d)<f)return{q:h,j:d}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function s(c,f,p){for(var m=1,h=2;h<=f;h++)m*=h;for(var d=m,g=f+1;g<=2*f;g++)d*=g;var v=d*(2*f+1);return 8*Math.pow(c/Math.pow(2,p),2*f)*m*m/(d*v)}});var cP="sqrtm",qG=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],Jb=N(cP,qG,r=>{var{typed:e,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:l,inv:u,size:s,max:c,identity:f}=r,p=1e3,m=1e-6;function h(d){var g,v=0,w=d,y=f(s(d));do{var x=w;if(w=i(.5,n(x,u(y))),y=i(.5,n(y,u(x))),g=c(t(l(w,x))),g>m&&++v>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>m);return w}return e(cP,{"Array | Matrix":function(g){var v=Ge(g)?g.size():tt(g);switch(v.length){case 1:if(v[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+at(v)+")");case 2:{var w=v[0],y=v[1];if(w===y)return h(g);throw new RangeError("Matrix must be square (size: "+at(v)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+at(v)+")")}}})});var fP="sylvester",zG=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Yb=N(fP,zG,r=>{var{typed:e,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:l,transpose:u,index:s,subset:c,add:f,subtract:p,identity:m,lusolve:h,abs:d}=r;return e(fP,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(w,y,x){return g(i(w),y,x)},"Array, Array, Matrix":function(w,y,x){return g(i(w),i(y),x)},"Array, Matrix, Array":function(w,y,x){return g(i(w),y,i(x))},"Matrix, Array, Matrix":function(w,y,x){return g(w,i(y),x)},"Matrix, Array, Array":function(w,y,x){return g(w,i(y),i(x))},"Matrix, Matrix, Array":function(w,y,x){return g(w,y,i(x))},"Array, Array, Array":function(w,y,x){return g(i(w),i(y),i(x)).toArray()}});function g(v,w,y){for(var x=w.size()[0],_=v.size()[0],b=t(v),D=b.T,S=b.U,A=t(a(-1,w)),E=A.T,M=A.U,F=a(a(u(S),y),M),P=o(0,_),k=[],O=(de,Pe)=>l(de,Pe,1),I=(de,Pe)=>l(de,Pe,0),T=0;T<x;T++)if(T<x-1&&d(c(E,s(T+1,T)))>1e-5){for(var q=I(c(F,s(P,T)),c(F,s(P,T+1))),B=0;B<T;B++)q=f(q,I(a(k[B],c(E,s(B,T))),a(k[B],c(E,s(B,T+1)))));var U=a(m(_),a(-1,c(E,s(T,T)))),G=a(m(_),a(-1,c(E,s(T+1,T)))),H=a(m(_),a(-1,c(E,s(T,T+1)))),L=a(m(_),a(-1,c(E,s(T+1,T+1)))),ie=I(O(f(D,U),G),O(H,f(D,L))),ve=h(ie,q);k[T]=ve.subset(s(o(0,_),0)),k[T+1]=ve.subset(s(o(_,2*_),0)),T++}else{for(var se=c(F,s(P,T)),ue=0;ue<T;ue++)se=f(se,a(k[ue],c(E,s(ue,T))));var he=c(E,s(T,T)),K=p(D,a(he,m(_)));k[T]=h(K,se)}var re=i(n(...k)),me=a(S,a(re,u(M)));return me}});var pP="schur",$G=["typed","matrix","identity","multiply","qr","norm","subtract"],Xb=N(pP,$G,r=>{var{typed:e,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:l}=r;return e(pP,{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=n(c),m=0,h;do{h=f;var d=a(f),g=d.Q,v=d.R;if(f=i(v,g),p=i(p,g),m++>100)break}while(o(l(f,h))>1e-4);return{U:p,T:f}}});var mP="lyap",HG=["typed","matrix","sylvester","multiply","transpose"],Qb=N(mP,HG,r=>{var{typed:e,matrix:t,sylvester:n,multiply:i,transpose:a}=r;return e(mP,{"Matrix, Matrix":function(l,u){return n(l,a(l),i(-1,u))},"Array, Matrix":function(l,u){return n(t(l),a(t(l)),i(-1,u))},"Matrix, Array":function(l,u){return n(l,a(t(l)),t(i(-1,u)))},"Array, Array":function(l,u){return n(t(l),a(t(l)),t(i(-1,u))).toArray()}})});var GG="divide",WG=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Kb=N(GG,WG,r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=r,l=Wt({typed:e,equalScalar:i}),u=Br({typed:e});return e("divide",Pf({"Array | Matrix, Array | Matrix":function(c,f){return n(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 n(c,o(f))}},a.signatures))});var dP="distance",jG=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],ex=N(dP,jG,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:l,abs:u}=r;return e(dP,{"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 S=n(D[1],b[1]),A=n(b[0],D[0]),E=n(i(D[0],b[1]),i(b[0],D[1]));return g(_[0],_[1],S,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 S=n(D.lineTwoPtY,b.lineOnePtY),A=n(b.lineOnePtX,D.lineTwoPtX),E=n(i(D.lineTwoPtX,b.lineOnePtY),i(b.lineOnePtX,D.lineTwoPtY));return g(_.pointX,_.pointY,S,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 v(_[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 v(_.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 y(_)}});function s(x){return typeof x=="number"||rt(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,S){var A=u(t(t(i(b,x),i(D,_)),S)),E=l(t(i(b,b),i(D,D)));return a(A,E)}function v(x,_,b,D,S,A,E,M,F){var P=[n(i(n(S,_),F),i(n(A,b),M)),n(i(n(A,b),E),i(n(D,x),F)),n(i(n(D,x),M),i(n(S,_),E))];P=l(t(t(i(P[0],P[0]),i(P[1],P[1])),i(P[2],P[2])));var k=l(t(t(i(E,E),i(M,M)),i(F,F)));return a(P,k)}function w(x,_){for(var b=x.length,D=0,S=0,A=0;A<b;A++)S=n(x[A],_[A]),D=t(i(S,S),D);return l(D)}function y(x){for(var _=[],b=[],D=[],S=0;S<x.length-1;S++)for(var A=S+1;A<x.length;A++)x[0].length===2?(b=[x[S][0],x[S][1]],D=[x[A][0],x[A][1]]):x[0].length===3&&(b=[x[S][0],x[S][1],x[S][2]],D=[x[A][0],x[A][1],x[A][2]]),_.push(w(b,D));return _}});var ZG="intersect",JG=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],tx=N(ZG,JG,r=>{var{typed:e,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:l,multiplyScalar:u,divideScalar:s,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=r;return e("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":v,"Matrix, Matrix, Matrix":function(M,F,P){var k=g(M.valueOf(),F.valueOf(),P.valueOf());return k===null?null:o(k)},"Matrix, Matrix, Matrix, Matrix":function(M,F,P,k){var O=v(M.valueOf(),F.valueOf(),P.valueOf(),k.valueOf());return O===null?null:o(O)}});function g(E,M,F){if(E=w(E),M=w(M),F=w(F),!x(E))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!_(F))throw new TypeError("Array with 4 numbers expected as third argument");return A(E[0],E[1],E[2],M[0],M[1],M[2],F[0],F[1],F[2],F[3])}function v(E,M,F,P){if(E=w(E),M=w(M),F=w(F),P=w(P),E.length===2){if(!y(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!y(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!y(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!y(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return b(E,M,F,P)}else if(E.length===3){if(!x(E))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return S(E[0],E[1],E[2],M[0],M[1],M[2],F[0],F[1],F[2],P[0],P[1],P[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(M=>Array.isArray(M)&&M.length===1)?m(E):E}function y(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,M,F,P){var k=E,O=F,I=c(k,M),T=c(O,P),q=c(u(I[0],T[1]),u(T[0],I[1]));if(h(q)||f(n(q),t.epsilon))return null;var B=u(T[0],k[1]),U=u(T[1],k[0]),G=u(T[0],O[1]),H=u(T[1],O[0]),L=s(a(c(c(B,U),G),H),q);return i(l(I,L),k)}function D(E,M,F,P,k,O,I,T,q,B,U,G){var H=u(c(E,M),c(F,P)),L=u(c(k,O),c(I,T)),ie=u(c(q,B),c(U,G));return a(a(H,L),ie)}function S(E,M,F,P,k,O,I,T,q,B,U,G){var H=D(E,I,B,I,M,T,U,T,F,q,G,q),L=D(B,I,P,E,U,T,k,M,G,q,O,F),ie=D(E,I,P,E,M,T,k,M,F,q,O,F),ve=D(B,I,B,I,U,T,U,T,G,q,G,q),se=D(P,E,P,E,k,M,k,M,O,F,O,F),ue=c(u(H,L),u(ie,ve)),he=c(u(se,ve),u(L,L));if(h(he))return null;var K=s(ue,he),re=s(a(H,u(K,L)),ve),me=a(E,u(K,c(P,E))),de=a(M,u(K,c(k,M))),Pe=a(F,u(K,c(O,F))),we=a(I,u(re,c(B,I))),V=a(T,u(re,c(U,T))),J=a(q,u(re,c(G,q)));return p(me,we)&&p(de,V)&&p(Pe,J)?[me,de,Pe]:null}function A(E,M,F,P,k,O,I,T,q,B){var U=u(E,I),G=u(P,I),H=u(M,T),L=u(k,T),ie=u(F,q),ve=u(O,q),se=c(c(c(B,U),H),ie),ue=c(c(c(a(a(G,L),ve),U),H),ie),he=s(se,ue),K=a(E,u(he,c(P,E))),re=a(M,u(he,c(k,M))),me=a(F,u(he,c(O,F)));return[K,re,me]}});var hP="sum",YG=["typed","config","add","numeric"],Nl=N(hP,YG,r=>{var{typed:e,config:t,add:n,numeric:i}=r;return e(hP,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(u){if(gi(u))throw new TypeError("Scalar values expected in function sum");return a(u)}});function a(l){var u;return yn(l,function(s){try{u=u===void 0?s:n(u,s)}catch(c){throw Ar(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=Ya(l,u,n);return s}catch(c){throw Ar(c,"sum")}}});var Vp="cumsum",XG=["typed","add","unaryPlus"],Cl=N(Vp,XG,r=>{var{typed:e,add:t,unaryPlus:n}=r;return e(Vp,{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(gi(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 Ar(s,Vp)}}function a(u){if(u.length===0)return[];for(var s=[n(u[0])],c=1;c<u.length;++c)s.push(t(s[c-1],u[c]));return s}function o(u,s){var c=tt(u);if(s<0||s>=c.length)throw new fn(s,c.length);try{return l(u,s)}catch(f){throw Ar(f,Vp)}}function l(u,s){var c,f,p;if(s<=0){var m=u[0][0];if(Array.isArray(m)){for(p=ep(u),f=[],c=0;c<p.length;c++)f[c]=l(p[c],s-1);return f}else return a(u)}else{for(f=[],c=0;c<u.length;c++)f[c]=l(u[c],s-1);return f}}});var gP="mean",QG=["typed","add","divide"],Ml=N(gP,QG,r=>{var{typed:e,add:t,divide:n}=r;return e(gP,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(l){if(gi(l))throw new TypeError("Scalar values expected in function mean");return a(l)}});function i(o,l){try{var u=Ya(o,l,t),s=Array.isArray(o)?tt(o):o.size();return n(u,s[l])}catch(c){throw Ar(c,"mean")}}function a(o){var l,u=0;if(yn(o,function(s){try{l=l===void 0?s:t(l,s),u++}catch(c){throw Ar(c,"mean",s)}}),u===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,u)}});var vP="median",KG=["typed","add","divide","compare","partitionSelect"],rx=N(vP,KG,r=>{var{typed:e,add:t,divide:n,compare:i,partitionSelect:a}=r;function o(s){try{s=mt(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;h<f;++h)i(s[h],m)>0&&(m=s[h]);return u(m,p)}else{var d=a(s,(c-1)/2);return l(d)}}catch(g){throw Ar(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 n(t(c,f),2)}});return e(vP,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(gi(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var yP="mad",eW=["typed","abs","map","median","subtract"],nx=N(yP,eW,r=>{var{typed:e,abs:t,map:n,median:i,subtract:a}=r;return e(yP,{"Array | Matrix":o,"...":function(u){return o(u)}});function o(l){if(l=mt(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(n(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")):Ar(s,"mad")}}});var ix="unbiased",bP="variance",tW=["typed","add","subtract","multiply","divide","apply","isNaN"],Tl=N(bP,tW,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l}=r;return e(bP,{"Array | Matrix":function(f){return u(f,ix)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(f,p){return s(f,p,ix)},"Array | Matrix, number | BigNumber, string":s,"...":function(f){return u(f,ix)}});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(yn(c,function(g){try{p=p===void 0?g:t(p,g),m++}catch(v){throw Ar(v,"variance",g)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var h=a(p,m);if(p=void 0,yn(c,function(g){var v=n(g,h);p=p===void 0?i(v,v):t(p,i(v,v))}),l(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var d=rt(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 Ar(m,"variance")}}});var xP="quantileSeq",rW=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Fl=N(xP,rW,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=r,m=Vo({typed:e,isInteger:s});return e(xP,{"Array | Matrix, number | BigNumber":(w,y)=>d(w,y,!1),"Array | Matrix, number | BigNumber, number":(w,y,x)=>h(w,y,!1,x,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(w,y,x,_)=>h(w,y,x,_,d),"Array | Matrix, Array | Matrix":(w,y)=>g(w,y,!1),"Array | Matrix, Array | Matrix, number":(w,y,x)=>h(w,y,!1,x,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(w,y,x,_)=>h(w,y,x,_,g)});function h(w,y,x,_,b){return m(w,_,D=>b(D,y,x))}function d(w,y,x){var _,b=w.valueOf();if(c(y,0))throw new Error("N/prob must be non-negative");if(f(y,1))return it(y)?v(b,y,x):t(v(b,y,x));if(p(y,1)){if(!s(y))throw new Error("N must be a positive integer");if(p(y,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=n(y,1);_=[];for(var S=0;c(S,y);S++){var A=a(S+1,D);_.push(v(b,A,x))}return it(y)?_:t(_)}}function g(w,y,x){for(var _=w.valueOf(),b=y.valueOf(),D=[],S=0;S<b.length;++S)D.push(v(_,b[S],x));return D}function v(w,y,x){var _=mt(w),b=_.length;if(b===0)throw new Error("Cannot calculate quantile of an empty sequence");var D=it(y)?y*(b-1):y.times(b-1),S=it(y)?Math.floor(D):D.floor().toNumber(),A=it(y)?D%1:D.minus(S);if(s(D))return x?_[D]:l(_,it(y)?D:D.valueOf());var E,M;if(x)E=_[S],M=_[S+1];else{M=l(_,S+1),E=_[S];for(var F=0;F<S;++F)u(_[F],E)>0&&(E=_[F])}return n(o(E,i(1,A)),o(M,A))}});var wP="std",nW=["typed","map","sqrt","variance"],Il=N(wP,nW,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r;return e(wP,{"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 Er(u)?t(u,n):n(u)}catch(s){throw s instanceof TypeError&&s.message.indexOf(" variance")!==-1?new TypeError(s.message.replace(" variance"," std")):s}}});var _P="corr",iW=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],ax=N(_P,iW,r=>{var{typed:e,matrix:t,sqrt:n,sum:i,add:a,subtract:o,multiply:l,pow:u,divide:s}=r;return e(_P,{"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;d<p.length;d++){if(p[d].length!==m[d].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");h.push(f(p[d],m[d]))}return h}else{if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(p,m)}}function f(p,m){var h=p.length,d=i(p),g=i(m),v=p.reduce((b,D,S)=>a(b,l(D,m[S])),0),w=i(p.map(b=>u(b,2))),y=i(m.map(b=>u(b,2))),x=o(l(h,v),l(d,g)),_=n(l(o(l(h,w),u(d,2)),o(l(h,y),u(g,2))));return s(x,_)}});var AP="combinations",aW=["typed"],ox=N(AP,aW,r=>{var{typed:e}=r;return e(AP,{"number, number":Ag,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,l,u=n.minus(i),s=new a(1);if(!DP(n)||!DP(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))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 DP(r){return r.isInteger()&&r.gte(0)}var EP="combinationsWithRep",oW=["typed"],sx=N(EP,oW,r=>{var{typed:e}=r;return e(EP,{"number, number":function(n,i){if(!$e(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!$e(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<n-1){var a=ni(n,n+i-1);return a/ni(1,i)}var o=ni(i+1,n+i-1);return o/ni(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,l,u=new a(1),s=n.minus(u);if(!SP(n)||!SP(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(u))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=u,i.lt(s))for(l=u;l.lte(s);l=l.plus(u))o=o.times(i.plus(l)).dividedBy(l);else for(l=u;l.lte(i);l=l.plus(u))o=o.times(s.plus(l)).dividedBy(l);return o}})});function SP(r){return r.isInteger()&&r.gte(0)}var NP="gamma",sW=["typed","config","multiplyScalar","pow","BigNumber","Complex"],ux=N(NP,sW,r=>{var{typed:e,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=r;function l(s){if(s.im===0)return ol(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(Uo[0],0),m=1;m<Uo.length;++m){var h=new o(Uo[m],0);p=p.add(h.div(s.add(m)))}var d=new o(s.re+Mg+.5,s.im),g=Math.sqrt(2*Math.PI),v=d.pow(s.add(.5)),w=d.neg().exp();return p.mul(g).mul(v).mul(w)}return e(NP,{number:ol,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 CP="lgamma",uW=["Complex","typed"],lx=N(CP,uW,r=>{var{Complex:e,typed:t}=r,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(CP,{number:sl,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(sl(s.re),0);if(s.re>=n||Math.abs(s.im)>=i)return l(s);if(s.re<=p){var m=sS(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(Tg),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,v=2;v<8;v++){var w=h;h=-g*m+a[v],m=d*m+w}var y=f.mul(p.mul(m).add(h));return c.add(y)}function u(s){var c=0,f=0,p=s;for(s=s.add(1);s.re<=n;){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 MP="factorial",lW=["typed","gamma"],cx=N(MP,lW,r=>{var{typed:e,gamma:t}=r;return e(MP,{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(n=>i=>Je(i,n))})});var TP="kldivergence",cW=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],fx=N(TP,cW,r=>{var{typed:e,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:l,log:u,isNumeric:s}=r;return e(TP,{"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 v=n(f,i(f)),w=n(p,i(p)),y=i(a(v,o(l(v,w),x=>u(x))));return s(y)?y:Number.NaN}});var FP="multinomial",fW=["typed","add","divide","multiply","factorial","isInteger","isPositive"],px=N(FP,fW,r=>{var{typed:e,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:l}=r;return e(FP,{"Array | Matrix":function(s){var c=0,f=1;return yn(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))}),n(a(c),f)}})});var IP="permutations",pW=["typed","factorial"],mx=N(IP,pW,r=>{var{typed:e,factorial:t}=r;return e(IP,{"number | BigNumber":t,"number, number":function(i,a){if(!$e(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!$e(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 ni(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,l;if(!BP(i)||!BP(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 BP(r){return r.isInteger()&&r.gte(0)}var xx=ur(JP(),1),bW=(0,xx.default)(Date.now());function xa(r){var e;function t(i){e=i===null?bW:(0,xx.default)(String(i))}t(r);function n(){return e()}return n}var YP="pickRandom",xW=["typed","config","?on"],wx=N(YP,xW,r=>{var{typed:e,config:t,on:n}=r,i=xa(t.randomSeed);return n&&n("config",function(o,l){o.randomSeed!==l.randomSeed&&(i=xa(o.randomSeed))}),e(YP,{"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=Ge(o)?o.create:Ge(s)?s.create:null;o=o.valueOf(),s&&(s=s.valueOf()),c===!0&&(o=mt(o),s=mt(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;h<d;h++){if(!it(s[h])||s[h]<0)throw new Error("Weights must be an array of positive numbers");m+=s[h]}}for(var g=o.length,v=[],w;v.length<u;){if(typeof s=="undefined")w=o[Math.floor(i()*g)];else for(var y=i()*m,x=0,_=o.length;x<_;x++)if(y-=s[x],y<0){w=o[x];break}v.push(w)}return f?v[0]:p?p(v):v}});function Bl(r,e){var t=[];if(r=r.slice(0),r.length>1)for(var n=0,i=r.shift();n<i;n++)t.push(Bl(r,e));else for(var a=0,o=r.shift();a<o;a++)t.push(e());return t}var XP="random",wW=["typed","config","?on"],_x=N(XP,wW,r=>{var{typed:e,config:t,on:n}=r,i=xa(t.randomSeed);return n&&n("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=xa(l.randomSeed))}),e(XP,{"":()=>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=Bl(l.valueOf(),()=>o(u,s));return Ge(l)?l.create(c):c}function o(l,u){return l+i()*(u-l)}});var QP="randomInt",_W=["typed","config","?on"],Ax=N(QP,_W,r=>{var{typed:e,config:t,on:n}=r,i=xa(t.randomSeed);return n&&n("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=xa(l.randomSeed))}),e(QP,{"":()=>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=Bl(l.valueOf(),()=>o(u,s));return Ge(l)?l.create(c):c}function o(l,u){return Math.floor(l+i()*(u-l))}});var KP="stirlingS2",AW=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Dx=N(KP,AW,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:l,combinations:u,isNegative:s,isInteger:c,number:f,bignumber:p,larger:m}=r,h=[],d=[];return e(KP,{"number | BigNumber, number | BigNumber":function(v,w){if(!c(v)||s(v)||!c(w)||s(w))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(w,v))throw new TypeError("k must be less than or equal to n in function stirlingS2");var y=!(it(v)&&it(w)),x=y?d:h,_=y?p:f,b=f(v),D=f(w);if(x[b]&&x[b].length>D)return x[b][D];for(var S=0;S<=b;++S)if(x[S]||(x[S]=[_(S===0?1:0)]),S!==0)for(var A=x[S],E=x[S-1],M=A.length;M<=S&&M<=D;++M)M===S?A[M]=1:A[M]=t(i(_(M),E[M]),E[M-1]);return x[b][D]}})});var eO="bellNumbers",DW=["typed","addScalar","isNegative","isInteger","stirlingS2"],Ex=N(eO,DW,r=>{var{typed:e,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=r;return e(eO,{"number | BigNumber":function(l){if(!i(l)||n(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 tO="catalan",EW=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Sx=N(tO,EW,r=>{var{typed:e,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:l}=r;return e(tO,{"number | BigNumber":function(s){if(!l(s)||o(s))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(s,2),s),t(s,1))}})});var rO="composition",SW=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Nx=N(rO,SW,r=>{var{typed:e,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:l}=r;return e(rO,{"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 n(t(s,-1),t(c,-1))}})});var nO="leafCount",NW=["parse","typed"],Cx=N(nO,NW,r=>{var{parse:e,typed:t}=r;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return t(nO,{Node:function(a){return n(a)}})});function Mx(r){return wt(r)||pr(r)&&r.isUnary()&&wt(r.args[0])}function Pl(r){return!!(wt(r)||(Mn(r)||pr(r))&&r.args.every(Pl)||cn(r)&&Pl(r.content))}function iO(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Tx(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?iO(Object(t),!0).forEach(function(n){Ut(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):iO(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var CW="simplifyUtil",MW=["FunctionNode","OperatorNode","SymbolNode"],ru=N(CW,MW,r=>{var{FunctionNode:e,OperatorNode:t,SymbolNode:n}=r,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(y,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,b=o;if(typeof y=="string"?b=y:pr(y)?b=y.fn.toString():Mn(y)?b=y.name:cn(y)&&(b="paren"),Ze(_,b)){var D=_[b];if(Ze(D,x))return D[x];if(Ze(l,b))return l[b][x]}if(Ze(_,o)){var S=_[o];return Ze(S,x)?S[x]:l[o][x]}if(Ze(l,b)){var A=l[b];if(Ze(A,x))return A[x]}return l[o][x]}function f(y){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(y,"commutative",x)}function p(y){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(y,"associative",x)}function m(y,x){var _=Tx({},y);for(var b in x)Ze(y,b)?_[b]=Tx(Tx({},x[b]),y[b]):_[b]=x[b];return _}function h(y,x){if(!y.args||y.args.length===0)return y;y.args=d(y,x);for(var _=0;_<y.args.length;_++)h(y.args[_],x)}function d(y,x){var _,b=[],D=function S(A){for(var E=0;E<A.args.length;E++){var M=A.args[E];pr(M)&&_===M.op?S(M):b.push(M)}};return p(y,x)?(_=y.op,D(y),b):y.args}function g(y,x){if(!(!y.args||y.args.length===0)){for(var _=w(y),b=y.args.length,D=0;D<b;D++)g(y.args[D],x);if(b>2&&p(y,x)){for(var S=y.args.pop();y.args.length>0;)S=_([y.args.pop(),S]);y.args=S.args}}}function v(y,x){if(!(!y.args||y.args.length===0)){for(var _=w(y),b=y.args.length,D=0;D<b;D++)v(y.args[D],x);if(b>2&&p(y,x)){for(var S=y.args.shift();y.args.length>0;)S=_([S,y.args.shift()]);y.args=S.args}}}function w(y){return pr(y)?function(x){try{return new t(y.op,y.fn,x,y.implicit)}catch(_){return console.error(_),[]}}:function(x){return new e(new n(y.name),x)}}return{createMakeNodeFunction:w,hasProperty:c,isCommutative:f,isAssociative:p,mergeContext:m,flatten:h,allChildren:d,unflattenr:g,unflattenl:v,defaultContext:l,realContext:u,positiveContext:s}});var TW="simplify",FW=["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"],Fx=N(TW,FW,r=>{var{config:e,typed:t,parse:n,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:v,AccessorNode:w,ArrayNode:y,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:D,OperatorNode:S,ParenthesisNode:A,SymbolNode:E}=r,{hasProperty:M,isCommutative:F,isAssociative:P,mergeContext:k,flatten:O,unflattenr:I,unflattenl:T,createMakeNodeFunction:q,defaultContext:B,realContext:U,positiveContext:G}=ru({FunctionNode:_,OperatorNode:S,SymbolNode:E});t.addConversion({from:"Object",to:"Map",convert:ha});var H=t("simplify",{Node:K,"Node, Map":(W,ee)=>K(W,!1,ee),"Node, Map, Object":(W,ee,ne)=>K(W,!1,ee,ne),"Node, Array":K,"Node, Array, Map":K,"Node, Array, Map, Object":K});t.removeConversion({from:"Object",to:"Map",convert:ha}),H.defaultContext=B,H.realContext=U,H.positiveContext=G;function L(W){return W.transform(function(ee,ne,ge){return cn(ee)?L(ee.content):ee})}var ie={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};H.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(W,ee){var ne={};if(W.s){var ge=W.s.split("->");if(ge.length===2)ne.l=ge[0],ne.r=ge[1];else throw SyntaxError("Could not parse rule: "+W.s)}else ne.l=W.l,ne.r=W.r;ne.l=L(n(ne.l)),ne.r=L(n(ne.r));for(var ye of["imposeContext","repeat","assuming"])ye in W&&(ne[ye]=W[ye]);if(W.evaluate&&(ne.evaluate=n(W.evaluate)),P(ne.l,ee)){var Ue=!F(ne.l,ee),Ae;Ue&&(Ae=he());var ft=q(ne.l),xt=he();ne.expanded={},ne.expanded.l=ft([ne.l,xt]),O(ne.expanded.l,ee),I(ne.expanded.l,ee),ne.expanded.r=ft([ne.r,xt]),Ue&&(ne.expandedNC1={},ne.expandedNC1.l=ft([Ae,ne.l]),ne.expandedNC1.r=ft([Ae,ne.r]),ne.expandedNC2={},ne.expandedNC2.l=ft([Ae,ne.expanded.l]),ne.expandedNC2.r=ft([Ae,ne.expanded.r]))}return ne}function se(W,ee){for(var ne=[],ge=0;ge<W.length;ge++){var ye=W[ge],Ue=void 0,Ae=typeof ye;switch(Ae){case"string":ye={s:ye};case"object":Ue=ve(ye,ee);break;case"function":Ue=ye;break;default:throw TypeError("Unsupported type of rule: "+Ae)}ne.push(Ue)}return ne}var ue=0;function he(){return new E("_p"+ue++)}function K(W,ee){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zi(),ge=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},ye=ge.consoleDebug;ee=se(ee||H.rules,ge.context);var Ue=f(W,ne);Ue=L(Ue);for(var Ae={},ft=Ue.toString({parenthesis:"all"});!Ae[ft];){Ae[ft]=!0,ue=0;var xt=ft;ye&&console.log("Working on: ",ft);for(var zt=0;zt<ee.length;zt++){var Kt="";if(typeof ee[zt]=="function"?(Ue=ee[zt](Ue,ge),ye&&(Kt=ee[zt].name)):(O(Ue,ge.context),Ue=me(Ue,ee[zt],ge.context),ye&&(Kt="".concat(ee[zt].l.toString()," -> ").concat(ee[zt].r.toString()))),ye){var j=Ue.toString({parenthesis:"all"});j!==xt&&(console.log("Applying",Kt,"produced",j),xt=j)}T(Ue,ge.context)}ft=Ue.toString({parenthesis:"all"})}return Ue}function re(W,ee,ne){var ge=W;if(W)for(var ye=0;ye<W.length;++ye){var Ue=me(W[ye],ee,ne);Ue!==W[ye]&&(ge===W&&(ge=W.slice()),ge[ye]=Ue)}return ge}function me(W,ee,ne){if(ee.assuming){for(var ge in ee.assuming)for(var ye in ee.assuming[ge])if(M(ge,ye,ne)!==ee.assuming[ge][ye])return W}var Ue=k(ee.imposeContext,ne),Ae=W;if(Ae instanceof S||Ae instanceof _){var ft=re(Ae.args,ee,ne);ft!==Ae.args&&(Ae=Ae.clone(),Ae.args=ft)}else if(Ae instanceof A){if(Ae.content){var xt=me(Ae.content,ee,ne);xt!==Ae.content&&(Ae=new A(xt))}}else if(Ae instanceof y){var zt=re(Ae.items,ee,ne);zt!==Ae.items&&(Ae=new y(zt))}else if(Ae instanceof w){var Kt=Ae.object;Ae.object&&(Kt=me(Ae.object,ee,ne));var j=Ae.index;Ae.index&&(j=me(Ae.index,ee,ne)),(Kt!==Ae.object||j!==Ae.index)&&(Ae=new w(Kt,j))}else if(Ae instanceof b){var ae=re(Ae.dimensions,ee,ne);ae!==Ae.dimensions&&(Ae=new b(ae))}else if(Ae instanceof D){var pe=!1,_e={};for(var Te in Ae.properties)_e[Te]=me(Ae.properties[Te],ee,ne),_e[Te]!==Ae.properties[Te]&&(pe=!0);pe&&(Ae=new D(_e))}var De=ee.r,Me=J(ee.l,Ae,Ue)[0];if(!Me&&ee.expanded&&(De=ee.expanded.r,Me=J(ee.expanded.l,Ae,Ue)[0]),!Me&&ee.expandedNC1&&(De=ee.expandedNC1.r,Me=J(ee.expandedNC1.l,Ae,Ue)[0],Me||(De=ee.expandedNC2.r,Me=J(ee.expandedNC2.l,Ae,Ue)[0])),Me){var Re=Ae.implicit;Ae=De.clone(),Re&&"implicit"in De&&(Ae.implicit=!0),Ae=Ae.transform(function(C){return C.isSymbolNode&&Ze(Me.placeholders,C.name)?Me.placeholders[C.name].clone():C})}return ee.repeat&&Ae!==W&&(Ae=me(Ae,ee,ne)),Ae}function de(W,ee){var ne=[],ge,ye,Ue=q(W);if(F(W,ee))for(var Ae=0;Ae<W.args.length;Ae++)ye=W.args.slice(0),ye.splice(Ae,1),ge=ye.length===1?ye[0]:Ue(ye),ne.push(Ue([W.args[Ae],ge]));else for(var ft=1;ft<W.args.length;ft++){var xt=W.args[0];ft>1&&(xt=Ue(W.args.slice(0,ft))),ye=W.args.slice(ft),ge=ye.length===1?ye[0]:Ue(ye),ne.push(Ue([xt,ge]))}return ne}function Pe(W,ee){var ne={placeholders:{}};if(!W.placeholders&&!ee.placeholders)return ne;if(W.placeholders){if(!ee.placeholders)return W}else return ee;for(var ge in W.placeholders)if(Ze(W.placeholders,ge)&&(ne.placeholders[ge]=W.placeholders[ge],Ze(ee.placeholders,ge)&&!ce(W.placeholders[ge],ee.placeholders[ge])))return null;for(var ye in ee.placeholders)Ze(ee.placeholders,ye)&&(ne.placeholders[ye]=ee.placeholders[ye]);return ne}function we(W,ee){var ne=[];if(W.length===0||ee.length===0)return ne;for(var ge,ye=0;ye<W.length;ye++)for(var Ue=0;Ue<ee.length;Ue++)ge=Pe(W[ye],ee[Ue]),ge&&ne.push(ge);return ne}function V(W){if(W.length===0)return W;for(var ee=W.reduce(we),ne=[],ge={},ye=0;ye<ee.length;ye++){var Ue=JSON.stringify(ee[ye]);ge[Ue]||(ge[Ue]=!0,ne.push(ee[ye]))}return ne}function J(W,ee,ne,ge){var ye=[{placeholders:{}}];if(W instanceof S&&ee instanceof S||W instanceof _&&ee instanceof _){if(W instanceof S){if(W.op!==ee.op||W.fn!==ee.fn)return[]}else if(W instanceof _&&W.name!==ee.name)return[];if(ee.args.length===1&&W.args.length===1||!P(ee,ne)&&ee.args.length===W.args.length||ge){for(var Ue=[],Ae=0;Ae<W.args.length;Ae++){var ft=J(W.args[Ae],ee.args[Ae],ne);if(ft.length===0)break;Ue.push(ft)}if(Ue.length!==W.args.length){if(!F(ee,ne)||W.args.length===1)return[];if(W.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var xt=J(W.args[0],ee.args[1],ne);if(xt.length===0)return[];var zt=J(W.args[1],ee.args[0],ne);if(zt.length===0)return[];Ue=[xt,zt]}ye=V(Ue)}else if(ee.args.length>=2&&W.args.length===2){for(var Kt=de(ee,ne),j=[],ae=0;ae<Kt.length;ae++){var pe=J(W,Kt[ae],ne,!0);j=j.concat(pe)}return j}else{if(W.args.length>2)throw Error("Unexpected non-binary associative function: "+W.toString());return[]}}else if(W instanceof E){if(W.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(ie[W.name]){if(W.name!==ee.name)return[]}else switch(W.name[1]>="a"&&W.name[1]<="z"?W.name.substring(0,2):W.name[0]){case"n":case"_p":ye[0].placeholders[W.name]=ee;break;case"c":case"cl":if(wt(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"v":if(!wt(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"vl":if(tr(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"cd":if(Mx(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"vd":if(!Mx(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"ce":if(Pl(ee))ye[0].placeholders[W.name]=ee;else return[];break;case"ve":if(!Pl(ee))ye[0].placeholders[W.name]=ee;else return[];break;default:throw new Error("Invalid symbol in rule: "+W.name)}}else if(W instanceof x){if(!c(W.value,ee.value))return[]}else return[];return ye}function ce(W,ee){if(W instanceof x&&ee instanceof x){if(!c(W.value,ee.value))return!1}else if(W instanceof E&&ee instanceof E){if(W.name!==ee.name)return!1}else if(W instanceof S&&ee instanceof S||W instanceof _&&ee instanceof _){if(W instanceof S){if(W.op!==ee.op||W.fn!==ee.fn)return!1}else if(W instanceof _&&W.name!==ee.name)return!1;if(W.args.length!==ee.args.length)return!1;for(var ne=0;ne<W.args.length;ne++)if(!ce(W.args[ne],ee.args[ne]))return!1}else return!1;return!0}return H});var IW="simplifyConstant",BW=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],Ix=N(IW,BW,r=>{var{typed:e,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:l,ArrayNode:u,ConstantNode:s,FunctionNode:c,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=r,{isCommutative:d,isAssociative:g,allChildren:v,createMakeNodeFunction:w}=ru({FunctionNode:c,OperatorNode:m,SymbolNode:h}),y=e("simplifyConstant",{Node:O=>D(k(O,{})),"Node, Object":function(I,T){return D(k(I,T))}});function x(O){return ma(O)?O.valueOf():O instanceof Array?O.map(x):Ge(O)?i(x(O.valueOf())):O}function _(O,I,T){try{return n[O].apply(null,I)}catch(q){return I=I.map(x),A(n[O].apply(null,I),T)}}var b=e({Fraction:M,number:function(I){return I<0?E(new s(-I)):new s(I)},BigNumber:function(I){return I<0?E(new s(-I)):new s(I)},Complex:function(I){throw new Error("Cannot convert Complex number to Node")},string:function(I){return new s(I)},Matrix:function(I){return new u(I.valueOf().map(T=>b(T)))}});function D(O){return Dt(O)?O:b(O)}function S(O,I){var T=I&&I.exactFractions!==!1;if(T&&isFinite(O)&&a){var q=a(O),B=I&&typeof I.fractionsLimit=="number"?I.fractionsLimit:1/0;if(q.valueOf()===O&&q.n<B&&q.d<B)return q}return O}var A=e({"string, Object":function(I,T){if(t.number==="BigNumber")return o===void 0&&Ys(),o(I);if(t.number==="Fraction")return a===void 0&&sp(),a(I);var q=parseFloat(I);return S(q,T)},"Fraction, Object":function(I,T){return I},"BigNumber, Object":function(I,T){return I},"number, Object":function(I,T){return S(I,T)},"Complex, Object":function(I,T){return I.im!==0?I:S(I.re,T)},"Matrix, Object":function(I,T){return i(S(I.valueOf()))},"Array, Object":function(I,T){return I.map(S)}});function E(O){return new m("-","unaryMinus",[O])}function M(O){var I,T=O.s*O.n;return T<0?I=new m("-","unaryMinus",[new s(-T)]):I=new s(T),O.d===1?I:new m("/","divide",[I,new s(O.d)])}function F(O,I,T){if(!di(I))return new l(D(O),D(I));if(ln(O)||Ge(O)){for(var q=Array.from(I.dimensions);q.length>0;)if(wt(q[0])&&typeof q[0].value!="string"){var B=A(q.shift().value,T);ln(O)?O=O.items[B-1]:(O=O.valueOf()[B-1],O instanceof Array&&(O=i(O)))}else if(q.length>1&&wt(q[1])&&typeof q[1].value!="string"){var U=A(q[1].value,T),G=[],H=ln(O)?O.items:O.valueOf();for(var L of H)if(ln(L))G.push(L.items[U-1]);else if(Ge(O))G.push(L[U-1]);else break;if(G.length===H.length)ln(O)?O=new u(G):O=i(G),q.splice(1,1);else break}else break;return q.length===I.dimensions.length?new l(D(O),I):q.length>0?(I=new f(q),new l(D(O),I)):O}if($a(O)&&I.dimensions.length===1&&wt(I.dimensions[0])){var ie=I.dimensions[0].value;return ie in O.properties?O.properties[ie]:new s}return new l(D(O),I)}function P(O,I,T,q){var B=I.shift(),U=I.reduce((G,H)=>{if(!Dt(H)){var L=G.pop();if(Dt(L))return[L,H];try{return G.push(_(O,[L,H],q)),G}catch(ve){G.push(L)}}G.push(D(G.pop()));var ie=G.length===1?G[0]:T(G);return[T([ie,D(H)])]},[B]);return U.length===1?U[0]:T([U[0],b(U[1])])}function k(O,I){switch(O.type){case"SymbolNode":return O;case"ConstantNode":switch(typeof O.value){case"number":return A(O.value,I);case"string":return O.value;default:if(!isNaN(O.value))return A(O.value,I)}return O;case"FunctionNode":if(n[O.name]&&n[O.name].rawArgs)return O;{var T=["add","multiply"];if(T.indexOf(O.name)===-1){var q=O.args.map(me=>k(me,I));if(!q.some(Dt))try{return _(O.name,q,I)}catch(me){}if(O.name==="size"&&q.length===1&&ln(q[0])){for(var B=[],U=q[0];ln(U);)B.push(U.items.length),U=U.items[0];return i(B)}return new c(O.name,q.map(D))}}case"OperatorNode":{var G=O.fn.toString(),H,L,ie=w(O);if(pr(O)&&O.isUnary())H=[k(O.args[0],I)],Dt(H[0])?L=ie(H):L=_(G,H,I);else if(g(O,I.context))if(H=v(O,I.context),H=H.map(me=>k(me,I)),d(G,I.context)){for(var ve=[],se=[],ue=0;ue<H.length;ue++)Dt(H[ue])?se.push(H[ue]):ve.push(H[ue]);ve.length>1?(L=P(G,ve,ie,I),se.unshift(L),L=P(G,se,ie,I)):L=P(G,H,ie,I)}else L=P(G,H,ie,I);else H=O.args.map(me=>k(me,I)),L=P(G,H,ie,I);return L}case"ParenthesisNode":return k(O.content,I);case"AccessorNode":return F(k(O.object,I),k(O.index,I),I);case"ArrayNode":{var he=O.items.map(me=>k(me,I));return he.some(Dt)?new u(he.map(D)):i(he)}case"IndexNode":return new f(O.dimensions.map(me=>y(me,I)));case"ObjectNode":{var K={};for(var re in O.properties)K[re]=y(O.properties[re],I);return new p(K)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(O.type))}}return y});var aO="simplifyCore",PW=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Bx=N(aO,PW,r=>{var{typed:e,parse:t,equal:n,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:v,SymbolNode:w}=r,y=new p(0),x=new p(1),_=new p(!0),b=new p(!1);function D(M){return pr(M)&&["and","not","or"].includes(M.op)}var{hasProperty:S,isCommutative:A}=ru({FunctionNode:m,OperatorNode:g,SymbolNode:w});function E(M){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=F?F.context:void 0;if(S(M,"trivial",P)){if(Mn(M)&&M.args.length===1)return E(M.args[0],F);var k=!1,O=0;if(M.forEach(se=>{++O,O===1&&(k=E(se,F))}),O===1)return k}var I=M;if(Mn(I)){var T=nT(I.name);if(T){if(I.args.length>2&&S(I,"associative",P))for(;I.args.length>2;){var q=I.args.pop(),B=I.args.pop();I.args.push(new g(T,I.name,[q,B]))}I=new g(T,I.name,I.args)}else return new m(E(I.fn),I.args.map(se=>E(se,F)))}if(pr(I)&&I.isUnary()){var U=E(I.args[0],F);if(I.op==="~"&&pr(U)&&U.isUnary()&&U.op==="~"||I.op==="not"&&pr(U)&&U.isUnary()&&U.op==="not"&&D(U.args[0]))return U.args[0];var G=!0;if(I.op==="-"&&pr(U)&&(U.isBinary()&&U.fn==="subtract"&&(I=new g("-","subtract",[U.args[1],U.args[0]]),G=!1),U.isUnary()&&U.op==="-"))return U.args[0];if(G)return new g(I.op,I.fn,[U])}if(pr(I)&&I.isBinary()){var H=E(I.args[0],F),L=E(I.args[1],F);if(I.op==="+"){if(wt(H)&&i(H.value))return L;if(wt(L)&&i(L.value))return H;pr(L)&&L.isUnary()&&L.op==="-"&&(L=L.args[0],I=new g("-","subtract",[H,L]))}if(I.op==="-")return pr(L)&&L.isUnary()&&L.op==="-"?E(new g("+","add",[H,L.args[0]]),F):wt(H)&&i(H.value)?E(new g("-","unaryMinus",[L])):wt(L)&&i(L.value)?H:new g(I.op,I.fn,[H,L]);if(I.op==="*"){if(wt(H)){if(i(H.value))return y;if(n(H.value,1))return L}if(wt(L)){if(i(L.value))return y;if(n(L.value,1))return H;if(A(I,P))return new g(I.op,I.fn,[L,H],I.implicit)}return new g(I.op,I.fn,[H,L],I.implicit)}if(I.op==="/")return wt(H)&&i(H.value)?y:wt(L)&&n(L.value,1)?H:new g(I.op,I.fn,[H,L]);if(I.op==="^"&&wt(L)){if(i(L.value))return x;if(n(L.value,1))return H}if(I.op==="and"){if(wt(H))if(H.value){if(D(L))return L}else return b;if(wt(L))if(L.value){if(D(H))return H}else return b}if(I.op==="or"){if(wt(H)){if(H.value)return _;if(D(L))return L}if(wt(L)){if(L.value)return _;if(D(H))return H}}return new g(I.op,I.fn,[H,L])}if(pr(I))return new g(I.op,I.fn,I.args.map(se=>E(se,F)));if(ln(I))return new f(I.items.map(se=>E(se,F)));if(ri(I))return new c(E(I.object,F),E(I.index,F));if(di(I))return new h(I.dimensions.map(se=>E(se,F)));if($a(I)){var ie={};for(var ve in I.properties)ie[ve]=E(I.properties[ve],F);return new d(ie)}return I}return e(aO,{Node:E,"Node,Object":E})});var OW="resolve",RW=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],Px=N(OW,RW,r=>{var{typed:e,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=r;function l(u,s){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!s)return u;if(tr(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(Dt(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 n(p):u}else if(pr(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(cn(u))return new o(l(u.content,s,c));if(Mn(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,ha(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,ha(c))),"Matrix, Object":e.referTo("Matrix,Map",u=>(s,c)=>u(s,ha(c))),"Array | Matrix, Map":e.referToSelf(u=>(s,c)=>s.map(f=>u(f,c)))})});var oO="symbolicEqual",kW=["parse","simplify","typed","OperatorNode"],Ox=N(oO,kW,r=>{var{parse:e,simplify:t,typed:n,OperatorNode:i}=r;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 wt(c)&&!c.value}return n(oO,{"Node, Node":a,"Node, Node, Object":a})});var sO="derivative",LW=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Rx=N(sO,LW,r=>{var{typed:e,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:l,ConstantNode:u,FunctionNode:s,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=r;function m(y,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},b={};g(b,y,x.name);var D=v(y,b);return _.simplify?i(D):D}e.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=e(sO,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});e.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(y){return d.apply(null,y.args)};var d=e("_derivTex",{"Node, SymbolNode":function(x,_){return wt(x)&&Ct(x.value)==="string"?d(n(x.value).toString(),_.toString(),1):d(x.toTex(),_.toString(),1)},"Node, ConstantNode":function(x,_){if(Ct(_.value)==="string")return d(x,n(_.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),S=1;S<_.args.length;++S)D=g(x,_.args[S],b)&&D;if(D)return x[_]=!0,!0}return!1}}),v=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(v(x.content,_))},"FunctionAssignmentNode, Object":function(x,_){return _[x]!==void 0?w(0):v(x.expr,_)},"FunctionNode, Object":function(x,_){if(_[x]!==void 0)return w(0);var b=x.args[0],D,S=!1,A=!1,E;switch(x.name){case"cbrt":S=!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)S=!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]],v(new c("^","pow",[b,D]),_);break;case"log10":D=w(10);case"log":if(!D&&x.args.length===1)E=b.clone(),S=!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]])]),S=!0;else if(x.args.length===2)return v(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]],v(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":S=!0,E=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"acos":S=!0,A=!0,E=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"atan":S=!0,E=new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)]);break;case"asec":S=!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":S=!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":S=!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":S=!0,E=new s("sqrt",[new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"acosh":S=!0,E=new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"atanh":S=!0,E=new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])]);break;case"asech":S=!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":S=!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":S=!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 M,F;S?(M="/",F="divide"):(M="*",F="multiply");var P=v(b,_);return A&&(P=new c("-","unaryMinus",[P])),new c(M,F,[P,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(O){return v(O,_)}));if(x.op==="-"){if(x.isUnary())return new c(x.op,x.fn,[v(x.args[0],_)]);if(x.isBinary())return new c(x.op,x.fn,[v(x.args[0],_),v(x.args[1],_)])}if(x.op==="*"){var b=x.args.filter(function(O){return _[O]!==void 0});if(b.length>0){var D=x.args.filter(function(O){return _[O]===void 0}),S=D.length===1?D[0]:new c("*","multiply",D),A=b.concat(v(S,_));return new c("*","multiply",A)}return new c("+","add",x.args.map(function(O){return new c("*","multiply",x.args.map(function(I){return I===O?v(I,_):I.clone()}))}))}if(x.op==="/"&&x.isBinary()){var E=x.args[0],M=x.args[1];return _[M]!==void 0?new c("/","divide",[v(E,_),M]):_[E]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[E]),new c("/","divide",[v(M,_),new c("^","pow",[M.clone(),w(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[v(E,_),M.clone()]),new c("*","multiply",[E.clone(),v(M,_)])]),new c("^","pow",[M.clone(),w(2)])])}if(x.op==="^"&&x.isBinary()){var F=x.args[0],P=x.args[1];if(_[F]!==void 0)return wt(F)&&(o(F.value)||a(F.value,1))?w(0):new c("*","multiply",[x,new c("*","multiply",[new s("log",[F.clone()]),v(P.clone(),_)])]);if(_[P]!==void 0){if(wt(P)){if(o(P.value))return w(0);if(a(P.value,1))return v(F,_)}var k=new c("^","pow",[F.clone(),new c("-","subtract",[P,w(1)])]);return new c("*","multiply",[P.clone(),new c("*","multiply",[v(F,_),k])])}return new c("*","multiply",[new c("^","pow",[F.clone(),P.clone()]),new c("+","add",[new c("*","multiply",[v(F,_),new c("/","divide",[P.clone(),F.clone()])]),new c("*","multiply",[v(P,_),new s("log",[F.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(y,x){return new u(l(y,x||t.number))}return h});var uO="rationalize",UW=["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"],kx=N(uO,UW,r=>{var{config:e,typed:t,equal:n,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:v,AccessorNode:w,ArrayNode:y,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:D,OperatorNode:S,SymbolNode:A,ParenthesisNode:E}=r;function M(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,B=P(),U=F(I,T,!0,B.firstRules),G=U.variables.length,H={exactFractions:!1},L={exactFractions:!0};if(I=U.expression,G>=1){I=k(I);var ie,ve,se=!0,ue=!1;I=m(I,B.firstRules,{},H);for(var he;ve=se?B.distrDivRules:B.sucDivRules,I=m(I,ve,{},L),se=!se,he=I.toString(),he!==ie;)ue=!0,ie=he;ue&&(I=m(I,B.firstRulesAgain,{},H)),I=m(I,B.finalRules,{},H)}var K=[],re={};return I.type==="OperatorNode"&&I.isBinary()&&I.op==="/"?(G===1&&(I.args[0]=O(I.args[0],K),I.args[1]=O(I.args[1])),q&&(re.numerator=I.args[0],re.denominator=I.args[1])):(G===1&&(I=O(I,K)),q&&(re.numerator=I,re.denominator=null)),q?(re.coefficients=K,re.variables=U.variables,re.expression=I,re):I}return t(uO,{Node:M,"Node, boolean":(I,T)=>M(I,{},T),"Node, Object":M,"Node, Object, boolean":M});function F(I,T,q,B){var U=[],G=m(I,B,T,{exactFractions:!1});q=!!q;var H="+-*"+(q?"/":"");ie(G);var L={};return L.expression=G,L.variables=U,L;function ie(ve){var se=ve.type;if(se==="FunctionNode")throw new Error("There is an unsolved function call");if(se==="OperatorNode")if(ve.op==="^"){if(ve.args[1].type!=="ConstantNode"||!$e(parseFloat(ve.args[1].value)))throw new Error("There is a non-integer exponent");ie(ve.args[0])}else{if(H.indexOf(ve.op)===-1)throw new Error("Operator "+ve.op+" invalid in polynomial expression");for(var ue=0;ue<ve.args.length;ue++)ie(ve.args[ue])}else if(se==="SymbolNode"){var he=ve.name,K=U.indexOf(he);K===-1&&U.push(he)}else if(se==="ParenthesisNode")ie(ve.content);else if(se!=="ConstantNode")throw new Error("type "+se+" is not allowed in polynomial expression")}}function P(){var I=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],T=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],q=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],B=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],U={};return U.firstRules=I.concat(T,B),U.distrDivRules=q,U.sucDivRules=B,U.firstRulesAgain=I.concat(T),U.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],U}function k(I,T,q){var B=I.type,U=arguments.length>1;if(B==="OperatorNode"&&I.isBinary()){var G=!1,H;if(I.op==="^"&&(I.args[0].type==="ParenthesisNode"||I.args[0].type==="OperatorNode")&&I.args[1].type==="ConstantNode"&&(H=parseFloat(I.args[1].value),G=H>=2&&$e(H)),G){if(H>2){var L=I.args[0],ie=new S("^","pow",[I.args[0].cloneDeep(),new x(H-1)]);I=new S("*","multiply",[L,ie])}else I=new S("*","multiply",[I.args[0],I.args[0].cloneDeep()]);U&&(q==="content"?T.content=I:T.args[q]=I)}}if(B==="ParenthesisNode")k(I.content,I,"content");else if(B!=="ConstantNode"&&B!=="SymbolNode")for(var ve=0;ve<I.args.length;ve++)k(I.args[ve],I,ve);if(!U)return I}function O(I,T){T===void 0&&(T=[]),T[0]=0;var q={};q.cte=1,q.oper="+",q.fire="";var B=0,U="";he(I,null,q),B=T.length-1;for(var G=!0,H,L=B;L>=0;L--)if(T[L]!==0){var ie=new x(G?T[L]:Math.abs(T[L])),ve=T[L]<0?"-":"+";if(L>0){var se=new A(U);if(L>1){var ue=new x(L);se=new S("^","pow",[se,ue])}T[L]===-1&&G?ie=new S("-","unaryMinus",[se]):Math.abs(T[L])===1?ie=se:ie=new S("*","multiply",[ie,se])}G?H=ie:ve==="+"?H=new S("+","add",[H,ie]):H=new S("-","subtract",[H,ie]),G=!1}if(G)return new x(0);return H;function he(K,re,me){var de=K.type;if(de==="FunctionNode")throw new Error("There is an unsolved function call");if(de==="OperatorNode"){if("+-*^".indexOf(K.op)===-1)throw new Error("Operator "+K.op+" invalid");if(re!==null){if((K.fn==="unaryMinus"||K.fn==="pow")&&re.fn!=="add"&&re.fn!=="subtract"&&re.fn!=="multiply")throw new Error("Invalid "+K.op+" placing");if((K.fn==="subtract"||K.fn==="add"||K.fn==="multiply")&&re.fn!=="add"&&re.fn!=="subtract")throw new Error("Invalid "+K.op+" placing");if((K.fn==="subtract"||K.fn==="add"||K.fn==="unaryMinus")&&me.noFil!==0)throw new Error("Invalid "+K.op+" placing")}(K.op==="^"||K.op==="*")&&(me.fire=K.op);for(var Pe=0;Pe<K.args.length;Pe++)K.fn==="unaryMinus"&&(me.oper="-"),(K.op==="+"||K.fn==="subtract")&&(me.fire="",me.cte=1,me.oper=Pe===0?"+":K.op),me.noFil=Pe,he(K.args[Pe],K,me)}else if(de==="SymbolNode"){if(K.name!==U&&U!=="")throw new Error("There is more than one variable");if(U=K.name,re===null){T[1]=1;return}if(re.op==="^"&&me.noFil!==0)throw new Error("In power the variable should be the first parameter");if(re.op==="*"&&me.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(me.fire===""||me.fire==="*")&&(B<1&&(T[1]=0),T[1]+=me.cte*(me.oper==="+"?1:-1),B=Math.max(1,B))}else if(de==="ConstantNode"){var we=parseFloat(K.value);if(re===null){T[0]=we;return}if(re.op==="^"){if(me.noFil!==1)throw new Error("Constant cannot be powered");if(!$e(we)||we<=0)throw new Error("Non-integer exponent is not allowed");for(var V=B+1;V<we;V++)T[V]=0;we>B&&(T[we]=0),T[we]+=me.cte*(me.oper==="+"?1:-1),B=Math.max(we,B);return}me.cte=we,me.fire===""&&(T[0]+=me.cte*(me.oper==="+"?1:-1))}else throw new Error("Type "+de+" is not allowed")}}});var lO="zpk2tf",VW=["typed","add","multiply","Complex","number"],Lx=N(lO,VW,r=>{var{typed:e,add:t,multiply:n,Complex:i,number:a}=r;return e(lO,{"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<u.length;m++){var h=u[m];typeof h=="number"&&(h=i(h,0)),f=l(f,[i(1,0),i(-h.re,-h.im)])}for(var d=0;d<s.length;d++){var g=s[d];typeof g=="number"&&(g=i(g,0)),p=l(p,[i(1,0),i(-g.re,-g.im)])}for(var v=0;v<f.length;v++)f[v]=n(f[v],c);return[f,p]}function l(u,s){for(var c=[],f=0;f<u.length+s.length-1;f++){c[f]=i(0,0);for(var p=0;p<u.length;p++)f-p>=0&&f-p<s.length&&(c[f]=t(c[f],n(u[p],s[f-p])))}return c}});var cO="freqz",qW=["typed","add","multiply","Complex","divide","matrix"],Ux=N(cO,qW,r=>{var{typed:e,add:t,multiply:n,Complex:i,divide:a,matrix:o}=r;return e(cO,{"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<f.length;h++){for(var d=i(0,0),g=i(0,0),v=0;v<s.length;v++)d=t(d,n(s[v],i(Math.cos(-v*f[h]),Math.sin(-v*f[h]))));for(var w=0;w<c.length;w++)g=t(g,n(c[w],i(Math.cos(-w*f[h]),Math.sin(-w*f[h]))));p.push(d),m.push(g)}for(var y=[],x=0;x<p.length;x++)y.push(a(p[x],m[x]));return{h:y,w:f}}function u(s){for(var c=[],f=0;f<s;f++)c.push(f/s*Math.PI);return c}});var zW="reviver",$W=["classes"],Vx=N(zW,$W,r=>{var{classes:e}=r;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var HW="replacer",GW=[],qx=N(HW,GW,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var fO="12.2.1";var zx=N("true",[],()=>!0),$x=N("false",[],()=>!1),Hx=N("null",[],()=>null),Gx=ii("Infinity",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1/0):1/0}),Wx=ii("NaN",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(NaN):NaN}),jx=ii("pi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?El(t):WS}),Zx=ii("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?dM(t):jS}),Jx=ii("e",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?pM(t):ZS}),Yx=ii("phi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?mM(t):JS}),Xx=ii("LN2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),Qx=ii("LN10",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),Kx=ii("LOG2E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),e1=ii("LOG10E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),t1=ii("SQRT1_2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),r1=ii("SQRT2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),n1=ii("i",["Complex"],r=>{var{Complex:e}=r;return e.I});var i1=N("version",[],()=>fO);function ii(r,e,t){return N(r,e,t,{recreateOnConfigChange:!0})}var a1=St("speedOfLight","299792458","m s^-1"),o1=St("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),s1=St("planckConstant","6.62607015e-34","J s"),u1=St("reducedPlanckConstant","1.0545718176461565e-34","J s"),l1=St("magneticConstant","1.25663706212e-6","N A^-2"),c1=St("electricConstant","8.8541878128e-12","F m^-1"),f1=St("vacuumImpedance","376.730313667","ohm"),p1=St("coulomb","8.987551792261171e9","N m^2 C^-2"),m1=St("elementaryCharge","1.602176634e-19","C"),d1=St("bohrMagneton","9.2740100783e-24","J T^-1"),h1=St("conductanceQuantum","7.748091729863649e-5","S"),g1=St("inverseConductanceQuantum","12906.403729652257","ohm"),v1=St("magneticFluxQuantum","2.0678338484619295e-15","Wb"),y1=St("nuclearMagneton","5.0507837461e-27","J T^-1"),b1=St("klitzing","25812.807459304513","ohm");var x1=St("bohrRadius","5.29177210903e-11","m"),w1=St("classicalElectronRadius","2.8179403262e-15","m"),_1=St("electronMass","9.1093837015e-31","kg"),A1=St("fermiCoupling","1.1663787e-5","GeV^-2"),D1=zp("fineStructure",.0072973525693),E1=St("hartreeEnergy","4.3597447222071e-18","J"),S1=St("protonMass","1.67262192369e-27","kg"),N1=St("deuteronMass","3.3435830926e-27","kg"),C1=St("neutronMass","1.6749271613e-27","kg"),M1=St("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),T1=St("rydberg","10973731.568160","m^-1"),F1=St("thomsonCrossSection","6.6524587321e-29","m^2"),I1=zp("weakMixingAngle",.2229),B1=zp("efimovFactor",22.7),P1=St("atomicMass","1.66053906660e-27","kg"),O1=St("avogadro","6.02214076e23","mol^-1"),R1=St("boltzmann","1.380649e-23","J K^-1"),k1=St("faraday","96485.33212331001","C mol^-1"),L1=St("firstRadiation","3.7417718521927573e-16","W m^2"),U1=St("loschmidt","2.686780111798444e25","m^-3"),V1=St("gasConstant","8.31446261815324","J K^-1 mol^-1"),q1=St("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),z1=St("molarVolume","0.022413969545014137","m^3 mol^-1"),$1=zp("sackurTetrode",-1.16487052358),H1=St("secondRadiation","0.014387768775039337","m K"),G1=St("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),W1=St("wienDisplacement","2.897771955e-3","m K"),j1=St("molarMass","0.99999999965e-3","kg mol^-1"),Z1=St("molarMassC12","11.9999999958e-3","kg mol^-1"),J1=St("gravity","9.80665","m s^-2"),Y1=St("planckLength","1.616255e-35","m"),X1=St("planckMass","2.176435e-8","kg"),Q1=St("planckTime","5.391245e-44","s"),K1=St("planckCharge","1.87554603778e-18","C"),ew=St("planckTemperature","1.416785e+32","K");function St(r,e,t){var n=["config","Unit","BigNumber"];return N(r,n,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 zp(r,e){var t=["config","BigNumber"];return N(r,t,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}var WW="apply",jW=["typed","isInteger"],tw=N(WW,jW,r=>{var{typed:e,isInteger:t}=r,n=Vo({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];it(o)?a[1]=o-1:rt(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(l){throw ar(l)}}})},{isTransformFunction:!0});var ZW="column",JW=["typed","Index","matrix","range"],rw=N(ZW,JW,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=hl({typed:e,Index:t,matrix:n,range:i});return e("column",{"...any":function(l){var u=l.length-1,s=l[u];it(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw ar(c)}}})},{isTransformFunction:!0});function nu(r,e,t){var n=r.filter(function(l){return tr(l)&&!(l.name in e)&&!t.has(l.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+r+'"');var i=n.name,a=zo(t),o=r.compile();return function(u){return a.set(i,u),o.evaluate(a)}}var YW="filter",XW=["typed"],nw=N(YW,XW,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(tr(i[1])||Wi(i[1])?u=i[1].compile().evaluate(o):u=nu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("filter",{"Array, function":pO,"Matrix, function":function(a,o){return a.create(pO(a.toArray(),o))},"Array, RegExp":zs,"Matrix, RegExp":function(a,o){return a.create(zs(a.toArray(),o))}});return t},{isTransformFunction:!0});function pO(r,e){return zf(r,function(t,n,i){return yi(e,t,[n+1],i,"filter")})}var QW="forEach",KW=["typed"],iw=N(QW,KW,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(tr(i[1])||Wi(i[1])?u=i[1].compile().evaluate(o):u=nu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("forEach",{"Array | Matrix, function":function(a,o){var l=function u(s,c){if(Array.isArray(s))Ha(s,function(f,p){u(f,c.concat(p+1))});else return yi(o,s,c,a,"forEach")};l(a.valueOf(),[])}});return t},{isTransformFunction:!0});var ej="index",tj=["Index","getMatrixDataType"],aw=N(ej,tj,r=>{var{Index:e,getMatrixDataType:t}=r;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var l=arguments[a];if(Us(l))l.start--,l.end-=l.step>0?0:2;else if(l&&l.isSet===!0)l=l.map(function(s){return s-1});else if(Tt(l)||Ge(l))t(l)!=="boolean"&&(l=l.map(function(s){return s-1}));else if(it(l))l--;else if(rt(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 rj="map",nj=["typed"],ow=N(rj,nj,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(tr(i[1])||Wi(i[1])?u=i[1].compile().evaluate(o):u=nu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("map",{"Array, function":function(a,o){return mO(a,o,a)},"Matrix, function":function(a,o){return a.create(mO(a.valueOf(),o,a))}});return t},{isTransformFunction:!0});function mO(r,e,t){function n(i,a){return Array.isArray(i)?Ln(i,function(o,l){return n(o,a.concat(l+1))}):yi(e,i,a,t,"map")}return n(r,[])}function xn(r){if(r.length===2&&Er(r[0])){r=r.slice();var e=r[1];it(e)?r[1]=e-1:rt(e)&&(r[1]=e.minus(1))}return r}var ij="max",aj=["typed","config","numeric","larger"],sw=N(ij,aj,r=>{var{typed:e,config:t,numeric:n,larger:i}=r,a=Al({typed:e,config:t,numeric:n,larger:i});return e("max",{"...any":function(l){l=xn(l);try{return a.apply(null,l)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var oj="mean",sj=["typed","add","divide"],uw=N(oj,sj,r=>{var{typed:e,add:t,divide:n}=r,i=Ml({typed:e,add:t,divide:n});return e("mean",{"...any":function(o){o=xn(o);try{return i.apply(null,o)}catch(l){throw ar(l)}}})},{isTransformFunction:!0});var uj="min",lj=["typed","config","numeric","smaller"],lw=N(uj,lj,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r,a=Dl({typed:e,config:t,numeric:n,smaller:i});return e("min",{"...any":function(l){l=xn(l);try{return a.apply(null,l)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var cj="range",fj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],cw=N(cj,fj,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=r,f=yl({typed:e,config:t,matrix:n,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 pj="row",mj=["typed","Index","matrix","range"],fw=N(pj,mj,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=bl({typed:e,Index:t,matrix:n,range:i});return e("row",{"...any":function(l){var u=l.length-1,s=l[u];it(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw ar(c)}}})},{isTransformFunction:!0});var dj="subset",hj=["typed","matrix","zeros","add"],pw=N(dj,hj,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=xl({typed:e,matrix:t,zeros:n,add:i});return e("subset",{"...any":function(l){try{return a.apply(null,l)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var gj="concat",vj=["typed","matrix","isInteger"],mw=N(gj,vj,r=>{var{typed:e,matrix:t,isInteger:n}=r,i=dl({typed:e,matrix:t,isInteger:n});return e("concat",{"...any":function(o){var l=o.length-1,u=o[l];it(u)?o[l]=u-1:rt(u)&&(o[l]=u.minus(1));try{return i.apply(null,o)}catch(s){throw ar(s)}}})},{isTransformFunction:!0});var dO="diff",yj=["typed","matrix","subtract","number","bignumber"],dw=N(dO,yj,r=>{var{typed:e,matrix:t,subtract:n,number:i,bignumber:a}=r,o=vl({typed:e,matrix:t,subtract:n,number:i,bignumber:a});return e(dO,{"...any":function(u){u=xn(u);try{return o.apply(null,u)}catch(s){throw ar(s)}}})},{isTransformFunction:!0});var bj="std",xj=["typed","map","sqrt","variance"],hw=N(bj,xj,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r,a=Il({typed:e,map:t,sqrt:n,variance:i});return e("std",{"...any":function(l){l=xn(l);try{return a.apply(null,l)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var hO="sum",wj=["typed","config","add","numeric"],gw=N(hO,wj,r=>{var{typed:e,config:t,add:n,numeric:i}=r,a=Nl({typed:e,config:t,add:n,numeric:i});return e(hO,{"...any":function(l){l=xn(l);try{return a.apply(null,l)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var _j="quantileSeq",Aj=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],vw=N(_j,Aj,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=r,m=Fl({typed:e,bignumber:t,add:n,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,v)=>m(d,g,h(v)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(d,g,v,w)=>m(d,g,v,h(w)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(d,g,v)=>m(d,g,h(v)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(d,g,v,w)=>m(d,g,v,h(w))});function h(d){return xn([[],d])[1]}},{isTransformFunction:!0});var gO="cumsum",Dj=["typed","add","unaryPlus"],yw=N(gO,Dj,r=>{var{typed:e,add:t,unaryPlus:n}=r,i=Cl({typed:e,add:t,unaryPlus:n});return e(gO,{"...any":function(o){if(o.length===2&&Er(o[0])){var l=o[1];it(l)?o[1]=l-1:rt(l)&&(o[1]=l.minus(1))}try{return i.apply(null,o)}catch(u){throw ar(u)}}})},{isTransformFunction:!0});var vO="variance",Ej=["typed","add","subtract","multiply","divide","apply","isNaN"],bw=N(vO,Ej,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l}=r,u=Tl({typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l});return e(vO,{"...any":function(c){c=xn(c);try{return u.apply(null,c)}catch(f){throw ar(f)}}})},{isTransformFunction:!0});var yO="print",Sj=["typed","matrix","zeros","add"],xw=N(yO,Sj,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=wl({typed:e,matrix:t,zeros:n,add:i});return e(yO,{"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(lp,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 Nj="and",Cj=["typed","matrix","zeros","add","equalScalar","not","concat"],ww=N(Nj,Cj,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=_l({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(s,c,f){var p=s[0].compile().evaluate(f);if(!Er(p)&&!l(p,!0))return!1;var m=s[1].compile().evaluate(f);return l(p,m)}return u.rawArgs=!0,u},{isTransformFunction:!0});var Mj="or",Tj=["typed","matrix","equalScalar","DenseMatrix","concat"],_w=N(Mj,Tj,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=ml({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function l(u,s,c){var f=u[0].compile().evaluate(c);if(!Er(f)&&o(f,!1))return!0;var p=u[1].compile().evaluate(c);return o(f,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Fj="bitAnd",Ij=["typed","matrix","zeros","add","equalScalar","not","concat"],Aw=N(Fj,Ij,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=fl({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(s,c,f){var p=s[0].compile().evaluate(f);if(!Er(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=s[1].compile().evaluate(f);return l(p,m)}return u.rawArgs=!0,u},{isTransformFunction:!0});var Bj="bitOr",Pj=["typed","matrix","equalScalar","DenseMatrix","concat"],Dw=N(Bj,Pj,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=pl({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function l(u,s,c){var f=u[0].compile().evaluate(c);if(!Er(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var p=u[1].compile().evaluate(c);return o(f,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var ke=zh({config:be}),or=Hh({}),Ew=Jx({BigNumber:ke,config:be}),bO=$x({}),xO=D1({BigNumber:ke,config:be}),eo=Wh({}),Sw=n1({Complex:or}),wO=Gx({BigNumber:ke,config:be}),_O=Qx({BigNumber:ke,config:be}),AO=e1({BigNumber:ke,config:be}),Ol=Zh({}),DO=Wx({BigNumber:ke,config:be}),EO=Hx({}),SO=Yx({BigNumber:ke,config:be}),NO=jh({}),Nw=Oh({}),CO=t1({BigNumber:ke,config:be}),MO=$1({BigNumber:ke,config:be}),Cw=Zx({BigNumber:ke,config:be}),TO=zx({}),FO=i1({}),Mt=Jh({Matrix:Ol}),IO=B1({BigNumber:ke,config:be}),BO=Xx({BigNumber:ke,config:be}),$p=jx({BigNumber:ke,config:be}),PO=qx({}),OO=r1({BigNumber:ke,config:be}),Y=Ph({BigNumber:ke,Complex:or,DenseMatrix:Mt,Fraction:eo}),Hp=yv({BigNumber:ke,config:be,typed:Y}),RO=I1({BigNumber:ke,config:be}),wn=bv({typed:Y}),kO=x0({Complex:or,config:be,typed:Y}),LO=_0({BigNumber:ke,typed:Y}),UO=D0({BigNumber:ke,Complex:or,config:be,typed:Y}),qr=xv({typed:Y}),VO=Jv({typed:Y}),qO=N0({BigNumber:ke,Complex:or,config:be,typed:Y}),zO=M0({typed:Y}),Mw=T0({typed:Y}),$O=I0({Complex:or,config:be,typed:Y}),zn=lv({BigNumber:ke,typed:Y}),HO=jv({typed:Y}),GO=uv({typed:Y}),WO=Yh({typed:Y}),Rl=ox({typed:Y}),kl=cv({Complex:or,typed:Y}),to=Yv({typed:Y}),Gp=B0({typed:Y}),jO=O0({BigNumber:ke,typed:Y}),ZO=k0({BigNumber:ke,typed:Y}),JO=Ev({typed:Y}),It=iv({config:be,typed:Y}),YO=Sy({typed:Y}),Tw=Sv({typed:Y}),XO=Nv({Complex:or,typed:Y}),QO=iy({typed:Y}),KO=oy({typed:Y}),iu=Ty({typed:Y}),Wp=sy({typed:Y}),eR=By({format:iu,typed:Y}),jp=Xv({typed:Y}),Tn=Qh({typed:Y}),wa=Xg({typed:Y}),ro=ev({typed:Y}),wi=tv({typed:Y}),tR=Kx({BigNumber:ke,config:be}),rR=lx({Complex:or,typed:Y}),nR=Pv({Complex:or,config:be,typed:Y}),Fw=Ov({Complex:or,config:be,typed:Y}),no=cy({typed:Y}),Sr=Rv({typed:Y}),Ll=Kv({typed:Y}),Qi=ov({typed:Y}),iR=Iy({format:iu,typed:Y}),aR=wx({config:be,typed:Y}),oR=wl({typed:Y}),sR=_x({config:be,typed:Y}),Zp=Qv({typed:Y}),uR=U0({BigNumber:ke,typed:Y}),Iw=Uv({BigNumber:ke,Fraction:eo,complex:kl,typed:Y}),Ul=q0({typed:Y}),Ki=av({Matrix:Ol,equalScalar:It,typed:Y}),lR=gv({typed:Y}),cR=qv({typed:Y}),fR=sv({typed:Y}),ai=wv({typed:Y}),pR=$0({typed:Y}),Bw=nv({typed:Y}),mR=w0({Complex:or,config:be,typed:Y}),dR=E0({BigNumber:ke,typed:Y}),Jp=Vo({isInteger:Tn,typed:Y}),hR=S0({BigNumber:ke,Complex:or,config:be,typed:Y}),gR=Fy({format:iu,typed:Y}),vR=sx({typed:Y}),yR=P0({typed:Y}),bR=L0({BigNumber:ke,typed:Y}),au=rv({typed:Y}),xR=Oy({typed:Y}),wR=Ax({config:be,typed:Y}),_R=V0({BigNumber:ke,typed:Y}),AR=z0({typed:Y}),DR=y0({SparseMatrix:Ki,typed:Y}),_i=Vv({Complex:or,config:be,typed:Y}),ER=H0({typed:Y}),Ri=vv({typed:Y}),SR=A0({BigNumber:ke,Complex:or,config:be,typed:Y}),NR=R0({BigNumber:ke,typed:Y}),Ho=fv({Fraction:eo,typed:Y}),io=Qg({typed:Y}),Oe=pv({DenseMatrix:Mt,Matrix:Ol,SparseMatrix:Ki,typed:Y}),CR=mv({isZero:wi,matrix:Oe,typed:Y}),MR=Cy({isNaN:au,isNumeric:io,typed:Y}),Ai=Ry({bignumber:zn,fraction:Ho,number:Qi}),Pw=My({config:be,multiplyScalar:Sr,numeric:Ai,typed:Y}),Ow=py({isInteger:Tn,matrix:Oe,typed:Y}),tn=gy({matrix:Oe,config:be,typed:Y}),TR=vy({matrix:Oe,typed:Y}),ou=yy({matrix:Oe,typed:Y}),Rw=$v({BigNumber:ke,config:be,matrix:Oe,typed:Y}),rn=xy({BigNumber:ke,config:be,matrix:Oe,typed:Y}),FR=C0({Complex:or,config:be,typed:Y}),kw=_v({BigNumber:ke,Complex:or,Fraction:eo,config:be,isNegative:wa,matrix:Oe,typed:Y,unaryMinus:Ri}),qt=dl({isInteger:Tn,matrix:Oe,typed:Y}),IR=ty({prod:Pw,size:tn,typed:Y}),Yp=by({conj:to,transpose:ou,typed:Y}),Lw=ny({DenseMatrix:Mt,SparseMatrix:Ki,matrix:Oe,typed:Y}),br=ky({numeric:Ai,typed:Y}),su=Hy({DenseMatrix:Mt,concat:qt,divideScalar:br,equalScalar:It,matrix:Oe,typed:Y}),oi=t0({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),uu=ay({matrix:Oe,typed:Y}),BR=Kg({isNumeric:io,typed:Y}),_a=uy({BigNumber:ke,DenseMatrix:Mt,SparseMatrix:Ki,config:be,matrix:Oe,typed:Y}),PR=ly({matrix:Oe,multiplyScalar:Sr,typed:Y}),Vl=o0({DenseMatrix:Mt,concat:qt,config:be,matrix:Oe,typed:Y}),OR=Jy({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y,zeros:rn}),Uw=Gy({DenseMatrix:Mt,divideScalar:br,equalScalar:It,matrix:Oe,multiplyScalar:Sr,subtractScalar:ai,typed:Y}),Xp=hv({flatten:uu,matrix:Oe,size:tn,typed:Y}),RR=Lv({BigNumber:ke,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),kR=fy({BigNumber:ke,config:be,matrix:Oe,typed:Y}),Qp=Ib({addScalar:qr,complex:kl,conj:to,divideScalar:br,equal:oi,identity:_a,isZero:wi,matrix:Oe,multiplyScalar:Sr,sign:Iw,sqrt:_i,subtractScalar:ai,typed:Y,unaryMinus:Ri,zeros:rn}),LR=my({config:be,matrix:Oe}),UR=Yy({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y,zeros:rn}),Go=Uy({BigNumber:ke,DenseMatrix:Mt,equalScalar:It,matrix:Oe,typed:Y,zeros:rn}),_n=n0({DenseMatrix:Mt,concat:qt,config:be,matrix:Oe,typed:Y}),Nr=zv({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,subtractScalar:ai,typed:Y,unaryMinus:Ri}),VR=Py({concat:qt,matrix:Oe,typed:Y}),qR=u0({DenseMatrix:Mt,concat:qt,config:be,equalScalar:It,matrix:Oe,typed:Y}),Kp=Wy({DenseMatrix:Mt,divideScalar:br,equalScalar:It,matrix:Oe,multiplyScalar:Sr,subtractScalar:ai,typed:Y}),zR=ey({DenseMatrix:Mt,concat:qt,matrix:Oe,typed:Y}),Rt=tb({DenseMatrix:Mt,SparseMatrix:Ki,addScalar:qr,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),$R=F0({BigNumber:ke,DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),HR=fl({concat:qt,equalScalar:It,matrix:Oe,typed:Y}),GR=pl({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),WR=Zv({DenseMatrix:Mt,concat:qt,matrix:Oe,typed:Y}),jR=Sx({addScalar:qr,combinations:Rl,divideScalar:br,isInteger:Tn,isNegative:wa,multiplyScalar:Sr,typed:Y}),ao=Qy({BigNumber:ke,DenseMatrix:Mt,Fraction:eo,concat:qt,config:be,equalScalar:It,matrix:Oe,typed:Y}),Vw=e0({concat:qt,matrix:Oe,typed:Y}),ZR=Cl({add:Rt,typed:Y,unaryPlus:Hp}),em=s0({equal:oi,typed:Y}),JR=vl({matrix:Oe,number:Qi,subtract:Nr,typed:Y}),YR=ex({abs:wn,addScalar:qr,deepEqual:em,divideScalar:br,multiplyScalar:Sr,sqrt:_i,subtractScalar:ai,typed:Y}),ql=ib({addScalar:qr,conj:to,multiplyScalar:Sr,size:tn,typed:Y}),XR=r0({compareText:Vw,isZero:wi,typed:Y}),qw=ll({DenseMatrix:Mt,config:be,equalScalar:It,matrix:Oe,round:Go,typed:Y,zeros:rn}),QR=Iv({BigNumber:ke,DenseMatrix:Mt,concat:qt,config:be,equalScalar:It,matrix:Oe,round:Go,typed:Y,zeros:rn}),KR=rb({abs:wn,addScalar:qr,divideScalar:br,isPositive:ro,multiplyScalar:Sr,smaller:_n,sqrt:_i,typed:Y}),zw=f0({DenseMatrix:Mt,smaller:_n}),mn=p0({ImmutableDenseMatrix:zw,getMatrixDataType:Wp}),An=a0({DenseMatrix:Mt,concat:qt,config:be,matrix:Oe,typed:Y}),tm=Vy({Complex:or,config:be,divideScalar:br,typed:Y}),e3=jy({DenseMatrix:Mt,divideScalar:br,equalScalar:It,matrix:Oe,multiplyScalar:Sr,subtractScalar:ai,typed:Y}),t3=dv({flatten:uu,matrix:Oe,size:tn,typed:Y}),r3=Dl({config:be,numeric:Ai,smaller:_n,typed:Y}),$w=cl({DenseMatrix:Mt,concat:qt,config:be,equalScalar:It,matrix:Oe,round:Go,typed:Y,zeros:rn}),jt=kv({addScalar:qr,dot:ql,equalScalar:It,matrix:Oe,multiplyScalar:Sr,typed:Y}),n3=zy({Complex:or,config:be,divideScalar:br,typed:Y}),i3=ml({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),zl=l0({compare:ao,isNaN:au,isNumeric:io,typed:Y}),a3=Xy({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y,zeros:rn}),Hw=Pb({SparseMatrix:Ki,abs:wn,add:Rt,divideScalar:br,larger:An,largerEq:Vl,multiply:jt,subtract:Nr,transpose:ou,typed:Y}),$n=xl({add:Rt,matrix:Oe,typed:Y,zeros:rn}),rm=Nl({add:Rt,config:be,numeric:Ai,typed:Y}),o3=ab({add:Rt,matrix:Oe,typed:Y}),Gw=Zy({DenseMatrix:Mt,divideScalar:br,equalScalar:It,matrix:Oe,multiplyScalar:Sr,subtractScalar:ai,typed:Y}),s3=Lx({Complex:or,add:Rt,multiply:jt,number:Qi,typed:Y}),nm=Dv({DenseMatrix:Mt,config:be,equalScalar:It,matrix:Oe,round:Go,typed:Y,zeros:rn}),ki=Ky({compare:ao,typed:Y}),u3=Nx({addScalar:qr,combinations:Rl,isInteger:Tn,isNegative:wa,isPositive:ro,larger:An,typed:Y}),l3=ry({matrix:Oe,multiply:jt,subtract:Nr,typed:Y}),Ww=Hb({divideScalar:br,isZero:wi,matrix:Oe,multiply:jt,subtractScalar:ai,typed:Y,unaryMinus:Ri}),c3=Gv({concat:qt,equalScalar:It,matrix:Oe,multiplyScalar:Sr,typed:Y}),jw=m0({larger:An,smaller:_n}),Zw=Mv({Complex:or,DenseMatrix:Mt,ceil:nm,equalScalar:It,floor:qw,matrix:Oe,typed:Y,zeros:rn}),Jw=ob({Index:mn,typed:Y}),f3=tx({abs:wn,add:Rt,addScalar:qr,config:be,divideScalar:br,equalScalar:It,flatten:uu,isNumeric:io,isZero:wi,matrix:Oe,multiply:jt,multiplyScalar:Sr,smaller:_n,subtract:Nr,typed:Y}),p3=Hv({BigNumber:ke,add:Rt,config:be,equal:oi,isInteger:Tn,mod:$w,smaller:_n,typed:Y,xgcd:Rw}),m3=Bv({concat:qt,equalScalar:It,matrix:Oe,typed:Y}),d3=qy({Complex:or,config:be,divideScalar:br,log:tm,typed:Y}),im=Al({config:be,larger:An,numeric:Ai,typed:Y}),h3=G0({DenseMatrix:Mt,Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),g3=j0({DenseMatrix:Mt,Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),v3=J0({Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),y3=X0({Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),Wo=i0({DenseMatrix:Mt,concat:qt,config:be,matrix:Oe,typed:Y}),b3=c0({compare:ao,compareNatural:ki,matrix:Oe,typed:Y}),x3=_l({concat:qt,equalScalar:It,matrix:Oe,not:Ll,typed:Y,zeros:rn}),jo=yl({bignumber:zn,matrix:Oe,add:Rt,config:be,isPositive:ro,larger:An,largerEq:Vl,smaller:_n,smallerEq:Wo,typed:Y}),w3=bl({Index:mn,matrix:Oe,range:jo,typed:Y}),Yw=W0({DenseMatrix:Mt,Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),_3=Y0({Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),Xw=K0({Index:mn,concat:qt,setDifference:Yw,size:tn,subset:$n,typed:Y}),Qw=d0({FibonacciHeap:jw,addScalar:qr,equalScalar:It}),Kw=hl({Index:mn,matrix:Oe,range:jo,typed:Y}),oo=Gb({abs:wn,addScalar:qr,det:Ww,divideScalar:br,identity:_a,matrix:Oe,multiply:jt,typed:Y,unaryMinus:Ri}),e_=Fb({DenseMatrix:Mt,Spa:Qw,SparseMatrix:Ki,abs:wn,addScalar:qr,divideScalar:br,equalScalar:It,larger:An,matrix:Oe,multiplyScalar:Sr,subtractScalar:ai,typed:Y,unaryMinus:Ri}),A3=Wb({Complex:or,add:Rt,ctranspose:Yp,deepEqual:em,divideScalar:br,dot:ql,dotDivide:su,equal:oi,inv:oo,matrix:Oe,multiply:jt,typed:Y}),si=Ly({Complex:or,config:be,fraction:Ho,identity:_a,inv:oo,matrix:Oe,multiply:jt,number:Qi,typed:Y}),t_=Z0({DenseMatrix:Mt,Index:mn,compareNatural:ki,size:tn,subset:$n,typed:Y}),D3=eb({Index:mn,concat:qt,setIntersect:t_,setSymDifference:Xw,size:tn,subset:$n,typed:Y}),E3=Jb({abs:wn,add:Rt,identity:_a,inv:oo,map:no,max:im,multiply:jt,size:tn,sqrt:_i,subtract:Nr,typed:Y}),ht=g0({BigNumber:ke,Complex:or,Fraction:eo,abs:wn,addScalar:qr,config:be,divideScalar:br,equal:oi,fix:Zw,format:iu,isNumeric:io,multiplyScalar:Sr,number:Qi,pow:si,round:Go,subtractScalar:ai}),S3=f1({BigNumber:ke,Unit:ht,config:be}),N3=W1({BigNumber:ke,Unit:ht,config:be}),C3=P1({BigNumber:ke,Unit:ht,config:be}),M3=d1({BigNumber:ke,Unit:ht,config:be}),T3=R1({BigNumber:ke,Unit:ht,config:be}),F3=h1({BigNumber:ke,Unit:ht,config:be}),I3=p1({BigNumber:ke,Unit:ht,config:be}),B3=N1({BigNumber:ke,Unit:ht,config:be}),P3=$y({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,pow:si,typed:Y}),O3=c1({BigNumber:ke,Unit:ht,config:be}),R3=m1({BigNumber:ke,Unit:ht,config:be}),k3=Zb({abs:wn,add:Rt,identity:_a,inv:oo,multiply:jt,typed:Y}),L3=k1({BigNumber:ke,Unit:ht,config:be}),r_=wy({addScalar:qr,ceil:nm,conj:to,divideScalar:br,dotDivide:su,exp:Tw,i:Sw,log2:Fw,matrix:Oe,multiplyScalar:Sr,pow:si,tau:Cw,typed:Y}),am=ux({BigNumber:ke,Complex:or,config:be,multiplyScalar:Sr,pow:si,typed:Y}),U3=o1({BigNumber:ke,Unit:ht,config:be}),V3=E1({BigNumber:ke,Unit:ht,config:be}),q3=_y({conj:to,dotDivide:su,fft:r_,typed:Y}),z3=b1({BigNumber:ke,Unit:ht,config:be}),$3=U1({BigNumber:ke,Unit:ht,config:be}),H3=l1({BigNumber:ke,Unit:ht,config:be}),G3=j1({BigNumber:ke,Unit:ht,config:be}),W3=q1({BigNumber:ke,Unit:ht,config:be}),j3=C1({BigNumber:ke,Unit:ht,config:be}),Z3=y1({BigNumber:ke,Unit:ht,config:be}),J3=K1({BigNumber:ke,Unit:ht,config:be}),Y3=Y1({BigNumber:ke,Unit:ht,config:be}),X3=ew({BigNumber:ke,Unit:ht,config:be}),Q3=S1({BigNumber:ke,Unit:ht,config:be}),K3=M1({BigNumber:ke,Unit:ht,config:be}),ek=u1({BigNumber:ke,Unit:ht,config:be}),tk=T1({BigNumber:ke,Unit:ht,config:be}),rk=H1({BigNumber:ke,Unit:ht,config:be}),nk=a1({BigNumber:ke,Unit:ht,config:be}),ik=G1({BigNumber:ke,Unit:ht,config:be}),ak=F1({BigNumber:ke,Unit:ht,config:be}),ok=O1({BigNumber:ke,Unit:ht,config:be}),sk=x1({BigNumber:ke,Unit:ht,config:be}),uk=b0({Unit:ht,typed:Y}),jr=Kb({divideScalar:br,equalScalar:It,inv:oo,matrix:Oe,multiply:jt,typed:Y}),lk=_1({BigNumber:ke,Unit:ht,config:be}),lu=cx({gamma:am,typed:Y}),ck=L1({BigNumber:ke,Unit:ht,config:be}),fk=J1({BigNumber:ke,Unit:ht,config:be}),pk=g1({BigNumber:ke,Unit:ht,config:be}),n_=Rb({DenseMatrix:Mt,lsolve:Uw,lup:e_,matrix:Oe,slu:Hw,typed:Y,usolve:Kp}),mk=v1({BigNumber:ke,Unit:ht,config:be}),dk=Z1({BigNumber:ke,Unit:ht,config:be}),hk=px({add:Rt,divide:jr,factorial:lu,isInteger:Tn,isPositive:ro,multiply:jt,typed:Y}),gk=mx({factorial:lu,typed:Y}),vk=X1({BigNumber:ke,Unit:ht,config:be}),yk=kb({add:Rt,cbrt:kw,divide:jr,equalScalar:It,im:jp,isZero:wi,multiply:jt,re:Zp,sqrt:_i,subtract:Nr,typeOf:Bw,typed:Y,unaryMinus:Ri}),bk=Q0({compareNatural:ki,typed:Y}),xk=Ey({abs:wn,add:Rt,bignumber:zn,divide:jr,isNegative:wa,isPositive:ro,larger:An,map:no,matrix:Oe,max:im,multiply:jt,smaller:_n,subtract:Nr,typed:Y,unaryMinus:Ri}),i_=Dx({bignumber:zn,addScalar:qr,combinations:Rl,divideScalar:br,factorial:lu,isInteger:Tn,isNegative:wa,larger:An,multiplyScalar:Sr,number:Qi,pow:si,subtractScalar:ai,typed:Y}),wk=v0({Unit:ht,typed:Y}),_k=Ex({addScalar:qr,isInteger:Tn,isNegative:wa,stirlingS2:i_,typed:Y}),a_=jb({abs:wn,add:Rt,addScalar:qr,atan:Mw,bignumber:zn,column:Kw,complex:kl,config:be,cos:Gp,diag:Lw,divideScalar:br,dot:ql,equal:oi,flatten:uu,im:jp,inv:oo,larger:An,matrix:Oe,matrixFromColumns:Xp,multiply:jt,multiplyScalar:Sr,number:Qi,qr:Qp,re:Zp,reshape:Ow,sin:Ul,size:tn,smaller:_n,sqrt:_i,subtract:Nr,typed:Y,usolve:Kp,usolveAll:Gw}),Ak=A1({BigNumber:ke,Unit:ht,config:be}),Dk=V1({BigNumber:ke,Unit:ht,config:be}),o_=Ml({add:Rt,divide:jr,typed:Y}),Ek=z1({BigNumber:ke,Unit:ht,config:be}),Sk=s1({BigNumber:ke,Unit:ht,config:be}),Nk=Fl({bignumber:zn,add:Rt,compare:ao,divide:jr,isInteger:Tn,larger:An,multiply:jt,partitionSelect:zl,smaller:_n,smallerEq:Wo,subtract:Nr,typed:Y}),om=Tl({add:Rt,apply:Jp,divide:jr,isNaN:au,multiply:jt,subtract:Nr,typed:Y}),Ck=w1({BigNumber:ke,Unit:ht,config:be}),s_=rx({add:Rt,compare:ao,divide:jr,partitionSelect:zl,typed:Y}),Mk=ax({add:Rt,divide:jr,matrix:Oe,mean:o_,multiply:jt,pow:si,sqrt:_i,subtract:Nr,sum:rm,typed:Y}),Tk=Ux({Complex:or,add:Rt,divide:jr,matrix:Oe,multiply:jt,typed:Y}),Fk=nx({abs:wn,map:no,median:s_,subtract:Nr,typed:Y}),Ik=Il({map:no,sqrt:_i,typed:Y,variance:om}),Bk=Ny({BigNumber:ke,Complex:or,add:Rt,config:be,divide:jr,equal:oi,factorial:lu,gamma:am,isNegative:wa,multiply:jt,pi:$p,pow:si,sin:Ul,smallerEq:Wo,subtract:Nr,typed:Y}),sm=nb({abs:wn,add:Rt,conj:to,ctranspose:Yp,eigs:a_,equalScalar:It,larger:An,matrix:Oe,multiply:jt,pow:si,smaller:_n,sqrt:_i,typed:Y}),u_=hy({BigNumber:ke,DenseMatrix:Mt,SparseMatrix:Ki,addScalar:qr,config:be,cos:Gp,matrix:Oe,multiplyScalar:Sr,norm:sm,sin:Ul,typed:Y,unaryMinus:Ri}),Pk=fx({divide:jr,dotDivide:su,isNumeric:io,log:tm,map:no,matrix:Oe,multiply:jt,sum:rm,typed:Y}),Ok=Q1({BigNumber:ke,Unit:ht,config:be}),l_=Xb({identity:_a,matrix:Oe,multiply:jt,norm:sm,qr:Qp,subtract:Nr,typed:Y}),Rk=dy({multiply:jt,rotationMatrix:u_,typed:Y}),c_=Yb({abs:wn,add:Rt,concat:qt,identity:_a,index:Jw,lusolve:n_,matrix:Oe,matrixFromColumns:Xp,multiply:jt,range:jo,schur:l_,subset:$n,subtract:Nr,transpose:ou,typed:Y}),kk=Qb({matrix:Oe,multiply:jt,sylvester:c_,transpose:ou,typed:Y});var cu={},fu={},Lk={},Dn=sb({mathWithTransform:fu}),pu=bb({Node:Dn}),Aa=xb({Node:Dn}),Zo=wb({Node:Dn}),Uk=Ab({Node:Dn}),mu=lb({Node:Dn}),Vk=fb({Node:Dn,ResultSet:Nw}),qk=pb({Node:Dn}),so=gb({Node:Dn}),zk=_b({Node:Dn}),Oj=Vx({classes:Lk}),f_=Ub({math:cu,typed:Y}),$k=vb({Node:Dn,typed:Y}),Rj=$b({Chain:f_,typed:Y}),du=yb({Node:Dn,size:tn}),hu=ub({Node:Dn,subset:$n}),Hk=cb({matrix:Oe,Node:Dn,subset:$n}),uo=Db({Unit:ht,Node:Dn,math:cu}),lo=Eb({Node:Dn,SymbolNode:uo,math:cu}),Li=Sb({AccessorNode:hu,ArrayNode:mu,AssignmentNode:Hk,BlockNode:Vk,ConditionalNode:qk,ConstantNode:so,FunctionAssignmentNode:$k,FunctionNode:lo,IndexNode:du,ObjectNode:pu,OperatorNode:Aa,ParenthesisNode:Zo,RangeNode:zk,RelationalNode:Uk,SymbolNode:uo,config:be,numeric:Ai,typed:Y}),Gk=Px({ConstantNode:so,FunctionNode:lo,OperatorNode:Aa,ParenthesisNode:Zo,parse:Li,typed:Y}),p_=Ix({bignumber:zn,fraction:Ho,AccessorNode:hu,ArrayNode:mu,ConstantNode:so,FunctionNode:lo,IndexNode:du,ObjectNode:pu,OperatorNode:Aa,SymbolNode:uo,config:be,mathWithTransform:fu,matrix:Oe,typed:Y}),m_=Nb({parse:Li,typed:Y}),Wk=Lb({parse:Li}),kj=Cx({parse:Li,typed:Y}),d_=Bx({AccessorNode:hu,ArrayNode:mu,ConstantNode:so,FunctionNode:lo,IndexNode:du,ObjectNode:pu,OperatorNode:Aa,ParenthesisNode:Zo,SymbolNode:uo,add:Rt,divide:jr,equal:oi,isZero:wi,multiply:jt,parse:Li,pow:si,subtract:Nr,typed:Y}),jk=Cb({parse:Li,typed:Y}),Lj=zb({Help:Wk,mathWithTransform:fu,typed:Y}),Zk=Mb({evaluate:jk}),um=Fx({bignumber:zn,fraction:Ho,AccessorNode:hu,ArrayNode:mu,ConstantNode:so,FunctionNode:lo,IndexNode:du,ObjectNode:pu,OperatorNode:Aa,ParenthesisNode:Zo,SymbolNode:uo,add:Rt,config:be,divide:jr,equal:oi,isZero:wi,mathWithTransform:fu,matrix:Oe,multiply:jt,parse:Li,pow:si,resolve:Gk,simplifyConstant:p_,simplifyCore:d_,subtract:Nr,typed:Y}),Uj=Ox({OperatorNode:Aa,parse:Li,simplify:um,typed:Y}),Vj=Tb({Parser:Zk,typed:Y}),qj=kx({bignumber:zn,fraction:Ho,AccessorNode:hu,ArrayNode:mu,ConstantNode:so,FunctionNode:lo,IndexNode:du,ObjectNode:pu,OperatorNode:Aa,ParenthesisNode:Zo,SymbolNode:uo,add:Rt,config:be,divide:jr,equal:oi,isZero:wi,mathWithTransform:fu,matrix:Oe,multiply:jt,parse:Li,pow:si,simplify:um,simplifyConstant:p_,simplifyCore:d_,subtract:Nr,typed:Y}),zj=Rx({ConstantNode:so,FunctionNode:lo,OperatorNode:Aa,ParenthesisNode:Zo,SymbolNode:uo,config:be,equal:oi,isZero:wi,numeric:Ai,parse:Li,simplify:um,typed:Y});gr(cu,{e:Ew,false:bO,fineStructure:xO,i:Sw,Infinity:wO,LN10:_O,LOG10E:AO,NaN:DO,null:EO,phi:SO,SQRT1_2:CO,sackurTetrode:MO,tau:Cw,true:TO,E:Ew,version:FO,efimovFactor:IO,LN2:BO,pi:$p,replacer:PO,reviver:Oj,SQRT2:OO,typed:Y,unaryPlus:Hp,PI:$p,weakMixingAngle:RO,abs:wn,acos:kO,acot:LO,acsc:UO,addScalar:qr,arg:VO,asech:qO,asinh:zO,atan:Mw,atanh:$O,bignumber:zn,bitNot:HO,boolean:GO,clone:WO,combinations:Rl,complex:kl,conj:to,cos:Gp,cot:jO,csc:ZO,cube:JO,equalScalar:It,erf:YO,exp:Tw,expm1:XO,filter:QO,forEach:KO,format:iu,getMatrixDataType:Wp,hex:eR,im:jp,isInteger:Tn,isNegative:wa,isPositive:ro,isZero:wi,LOG2E:tR,lgamma:rR,log10:nR,log2:Fw,map:no,multiplyScalar:Sr,not:Ll,number:Qi,oct:iR,pickRandom:aR,print:oR,random:sR,re:Zp,sec:uR,sign:Iw,sin:Ul,splitUnit:lR,square:cR,string:fR,subtractScalar:ai,tan:pR,typeOf:Bw,acosh:mR,acsch:dR,apply:Jp,asec:hR,bin:gR,chain:Rj,combinationsWithRep:vR,cosh:yR,csch:bR,isNaN:au,isPrime:xR,randomInt:wR,sech:_R,sinh:AR,sparse:DR,sqrt:_i,tanh:ER,unaryMinus:Ri,acoth:SR,coth:NR,fraction:Ho,isNumeric:io,matrix:Oe,matrixFromFunction:CR,mode:MR,numeric:Ai,prod:Pw,reshape:Ow,size:tn,squeeze:TR,transpose:ou,xgcd:Rw,zeros:rn,asin:FR,cbrt:kw,concat:qt,count:IR,ctranspose:Yp,diag:Lw,divideScalar:br,dotDivide:su,equal:oi,flatten:uu,hasNumericValue:BR,identity:_a,kron:PR,largerEq:Vl,leftShift:OR,lsolve:Uw,matrixFromColumns:Xp,nthRoot:RR,ones:kR,qr:Qp,resize:LR,rightArithShift:UR,round:Go,smaller:_n,subtract:Nr,to:VR,unequal:qR,usolve:Kp,xor:zR,add:Rt,atan2:$R,bitAnd:HR,bitOr:GR,bitXor:WR,catalan:jR,compare:ao,compareText:Vw,cumsum:ZR,deepEqual:em,diff:JR,distance:YR,dot:ql,equalText:XR,floor:qw,gcd:QR,hypot:KR,larger:An,log:tm,lsolveAll:e3,matrixFromRows:t3,min:r3,mod:$w,multiply:jt,nthRoots:n3,or:i3,partitionSelect:zl,rightLogShift:a3,slu:Hw,subset:$n,sum:rm,trace:o3,usolveAll:Gw,zpk2tf:s3,ceil:nm,compareNatural:ki,composition:u3,cross:l3,det:Ww,dotMultiply:c3,fix:Zw,index:Jw,intersect:f3,invmod:p3,lcm:m3,log1p:d3,max:im,setCartesian:h3,setDistinct:g3,setIsSubset:v3,setPowerset:y3,smallerEq:Wo,sort:b3,and:x3,range:jo,row:w3,setDifference:Yw,setMultiplicity:_3,setSymDifference:Xw,column:Kw,inv:oo,lup:e_,pinv:A3,pow:si,setIntersect:t_,setUnion:D3,sqrtm:E3,vacuumImpedance:S3,wienDisplacement:N3,atomicMass:C3,bohrMagneton:M3,boltzmann:T3,conductanceQuantum:F3,coulomb:I3,deuteronMass:B3,dotPow:P3,electricConstant:O3,elementaryCharge:R3,expm:k3,faraday:L3,fft:r_,gamma:am,gravitationConstant:U3,hartreeEnergy:V3,ifft:q3,klitzing:z3,loschmidt:$3,magneticConstant:H3,molarMass:G3,molarPlanckConstant:W3,neutronMass:j3,nuclearMagneton:Z3,planckCharge:J3,planckLength:Y3,planckTemperature:X3,protonMass:Q3,quantumOfCirculation:K3,reducedPlanckConstant:ek,rydberg:tk,secondRadiation:rk,speedOfLight:nk,stefanBoltzmann:ik,thomsonCrossSection:ak,avogadro:ok,bohrRadius:sk,createUnit:uk,divide:jr,electronMass:lk,factorial:lu,firstRadiation:ck,gravity:fk,inverseConductanceQuantum:pk,lusolve:n_,magneticFluxQuantum:mk,molarMassC12:dk,multinomial:hk,parse:Li,permutations:gk,planckMass:vk,polynomialRoot:yk,resolve:Gk,setSize:bk,simplifyConstant:p_,solveODE:xk,stirlingS2:i_,unit:wk,bellNumbers:_k,compile:m_,eigs:a_,fermiCoupling:Ak,gasConstant:Dk,leafCount:kj,mean:o_,molarVolume:Ek,planckConstant:Sk,quantileSeq:Nk,simplifyCore:d_,variance:om,classicalElectronRadius:Ck,evaluate:jk,help:Lj,median:s_,simplify:um,symbolicEqual:Uj,corr:Mk,freqz:Tk,mad:Fk,parser:Vj,rationalize:qj,std:Ik,zeta:Bk,derivative:zj,norm:sm,rotationMatrix:u_,kldivergence:Pk,planckTime:Ok,schur:l_,rotate:Rk,sylvester:c_,lyap:kk,config:be});gr(fu,cu,{filter:nw({typed:Y}),forEach:iw({typed:Y}),map:ow({typed:Y}),apply:tw({isInteger:Tn,typed:Y}),or:_w({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),and:ww({add:Rt,concat:qt,equalScalar:It,matrix:Oe,not:Ll,typed:Y,zeros:rn}),concat:mw({isInteger:Tn,matrix:Oe,typed:Y}),max:sw({config:be,larger:An,numeric:Ai,typed:Y}),print:xw({add:Rt,matrix:Oe,typed:Y,zeros:rn}),bitAnd:Aw({add:Rt,concat:qt,equalScalar:It,matrix:Oe,not:Ll,typed:Y,zeros:rn}),diff:dw({bignumber:zn,matrix:Oe,number:Qi,subtract:Nr,typed:Y}),min:lw({config:be,numeric:Ai,smaller:_n,typed:Y}),subset:pw({add:Rt,matrix:Oe,typed:Y,zeros:rn}),bitOr:Dw({DenseMatrix:Mt,concat:qt,equalScalar:It,matrix:Oe,typed:Y}),cumsum:yw({add:Rt,typed:Y,unaryPlus:Hp}),index:aw({Index:mn,getMatrixDataType:Wp}),sum:gw({add:Rt,config:be,numeric:Ai,typed:Y}),range:cw({bignumber:zn,matrix:Oe,add:Rt,config:be,isPositive:ro,larger:An,largerEq:Vl,smaller:_n,smallerEq:Wo,typed:Y}),row:fw({Index:mn,matrix:Oe,range:jo,typed:Y}),column:rw({Index:mn,matrix:Oe,range:jo,typed:Y}),mean:uw({add:Rt,divide:jr,typed:Y}),quantileSeq:vw({add:Rt,bignumber:zn,compare:ao,divide:jr,isInteger:Tn,larger:An,multiply:jt,partitionSelect:zl,smaller:_n,smallerEq:Wo,subtract:Nr,typed:Y}),variance:bw({add:Rt,apply:Jp,divide:jr,isNaN:au,multiply:jt,subtract:Nr,typed:Y}),std:hw({map:no,sqrt:_i,typed:Y,variance:om})});gr(Lk,{BigNumber:ke,Complex:or,Fraction:eo,Matrix:Ol,Node:Dn,ObjectNode:pu,OperatorNode:Aa,ParenthesisNode:Zo,Range:NO,RelationalNode:Uk,ResultSet:Nw,ArrayNode:mu,BlockNode:Vk,ConditionalNode:qk,ConstantNode:so,DenseMatrix:Mt,RangeNode:zk,Chain:f_,FunctionAssignmentNode:$k,SparseMatrix:Ki,IndexNode:du,ImmutableDenseMatrix:zw,Index:mn,AccessorNode:hu,AssignmentNode:Hk,FibonacciHeap:jw,Spa:Qw,Unit:ht,SymbolNode:uo,FunctionNode:lo,Help:Wk,Parser:Zk});f_.createProxy(cu);var lm=class extends qa{constructor(e){super(e),this.hidden=!1,this.hasError=!1}buildVariables(){var t;let e=0;this.expressionStr="",this.variables=[];for(let n of(t=this.base.getDeclaration().templateDeclaration)!=null?t:[])if(typeof n!="string"){let i={bindTargetDeclaration:n,inputSignal:new xr(void 0),uuid:Ht(),contextName:`MB_VAR_${e}`};this.variables.push(i),this.expressionStr+=i.contextName,e+=1}else this.expressionStr+=n;this.expression=m_(this.expressionStr)}buildMathJSContext(){var t,n;let e={};for(let i of(t=this.variables)!=null?t:[])!i.contextName||!i.inputSignal||(e[i.contextName]=(n=i.inputSignal.get())!=null?n:"");return e}computeValue(){var t;if(this.hasError=!1,!this.expression)return this.handleComputeError(new ca({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{return Kn((t=this.expression.evaluate(e))==null?void 0:t.toString())}catch(n){return n instanceof Error?this.handleComputeError(new ca({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:n,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of: unexpected thrown value"))}}onInitialRender(e){}onRerender(e,t){this.hasError?e.addClass("mb-error"):e.removeClass("mb-error"),e.innerText=t}handleComputeError(e){return this.hasError=!0,console.warn(e),e.message}};var cm=class extends qa{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){var t;this.textParts=[];let e=0;this.variables=[];for(let n of(t=this.base.getDeclaration().templateDeclaration)!=null?t:[])if(typeof n!="string"){let i={bindTargetDeclaration:n,inputSignal:new xr(void 0),uuid:Ht(),contextName:`MB_VAR_${e}`};this.variables.push(i),this.textParts.push(e),e+=1}else this.textParts.push(n)}computeValue(){if(!this.textParts)throw new ca({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="number"?Ic(this.variables[e].inputSignal.get(),this.base.plugin.settings.viewFieldDisplayNullAsEmpty):e).join("")}onInitialRender(e){var t,n;this.renderMarkdown=(n=(t=this.base.getArgument("renderMarkdown"))==null?void 0:t.value)!=null?n:!1,this.renderMarkdown&&e.addClass("mb-view-markdown")}async onRerender(e,t){var n;this.renderMarkdown?((n=this.markdownUnloadCallback)==null||n.call(this),this.markdownUnloadCallback=await this.base.plugin.internal.renderMarkdown(t,e,this.base.getFilePath())):e.innerText=t}onunload(){var e;(e=this.markdownUnloadCallback)==null||e.call(this)}};function $j(r){let e,t;return e=new vf({props:{elements:r[0],$$slots:{default:[Wj,({element:n})=>({1:n}),({element:n})=>n?2:0]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.elements=n[0]),i&6&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Hj(r){let e,t;return e=new Va({props:{mdLink:r[0][0]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.mdLink=n[0][0]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Gj(r){let e;return{c(){e=Z("span")},m(t,n){Q(t,e,n)},p:Fe,i:Fe,o:Fe,d(t){t&&X(e)}}}function Wj(r){let e,t;return e=new Va({props:{mdLink:r[1]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&2&&(a.mdLink=n[1]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function jj(r){let e,t,n,i,a=[Gj,Hj,$j],o=[];function l(u,s){return u[0].length===0?0:u[0].length===1?1:2}return e=l(r,-1),t=o[e]=a[e](r),{c(){t.c(),n=lr()},m(u,s){o[e].m(u,s),Q(u,n,s),i=!0},p(u,[s]){let c=e;e=l(u,s),e===c?o[e].p(u,s):(vt(),oe(o[c],1,1,()=>{o[c]=null}),yt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),te(t,1),t.m(n.parentNode,n))},i(u){i||(te(t),i=!0)},o(u){oe(t),i=!1},d(u){u&&X(n),o[e].d(u)}}}function Zj(r,e,t){let{mdLinkList:n}=e;return r.$$set=i=>{"mdLinkList"in i&&t(0,n=i.mdLinkList)},[n]}var h_=class extends Ve{constructor(e){super(),ze(this,e,Zj,jj,qe,{mdLinkList:0})}},g_=h_;var fm=class extends qa{constructor(e){super(e)}buildVariables(){let e=this.base.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new Ou({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new Ou({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});this.variables=[{bindTargetDeclaration:t,inputSignal:new xr(void 0),uuid:Ht(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new ca({errorLevel:"CRITICAL",effect:"failed to evaluate link view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?sn.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>sn.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new g_({target:e,props:{mdLinkList:[]}})}async onRerender(e,t){let n=sn.parseLinkList(t);this.component=new g_({target:e,props:{mdLinkList:n}})}onunmount(){var e;(e=this.component)==null||e.$destroy()}};var pm=class{constructor(e){this.plugin=e}createViewField(e,t){if(e==="math")return new lm(t);if(e==="text")return new cm(t);if(e==="link")return new fm(t)}};var mm=class{constructor(){this.buttons=new Map,this.buttonLoadListeners=new Map}registerButtonLoadListener(e,t,n){let i=this.getButton(e,t);i&&n(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=Ht();return o.set(l,n),()=>this.removeButtonLoadListener(e,t,l)}notifyButtonLoadListeners(e,t){let n=this.getButton(e,t);if(!n)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(n)}removeButtonLoadListener(e,t,n){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(n),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 n=this.buttons.get(e);if(n)return n.get(t)}removeButton(e,t){let n=this.buttons.get(e);n&&(n.delete(t),n.size===0&&this.buttons.delete(e))}};var dm=class{constructor(e){this.plugin=e}async runButtonAction(e,t){try{if(e.action)await this.plugin.api.buttonActionRunner.runAction(e.action,t);else if(e.actions)for(let n of e.actions)await this.plugin.api.buttonActionRunner.runAction(n,t);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(n){console.warn("meta-bind | ButtonMDRC >> error while running action",n),this.plugin.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}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};if(e==="updateMetadata")return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""};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}else if(e.type==="updateMetadata"){await this.runUpdateMetadataAction(e,t);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 n=sn.parseLinkOrUrl(e.link);n.internal?this.plugin.internal.openFile(n.target,t):yc(n.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")}async runUpdateMetadataAction(e,t){let n=this.plugin.api.bindTargetParser.parseAndValidateBindTarget(e.bindTarget,t),i=Ht(),a=new xr(void 0),o=this.plugin.metadataManager.subscribe(i,a,n,()=>{});o.applyUpdate({value:e.value,evaluate:e.evaluate}),o.unsubscribe()}};var gm=require("obsidian"),hm=class extends dm{constructor(e){super(e),this.plugin=e}async runTemplaterCreateNoteAction(e){var a,o;let t=this.plugin.app.plugins.getPlugin("templater-obsidian");if(!t)throw new Error("Templater plugin not found");let n=t.templater,i=this.plugin.app.vault.getAbstractFileByPath(e.templateFile);if(!i||!(i instanceof gm.TFile))throw new Error(`Template file not found: ${e.templateFile}`);if(e.folderPath===void 0)await n.create_new_note_from_template(i,void 0,e.fileName,(a=e.openNote)!=null?a:!0);else{let l=this.plugin.app.vault.getAbstractFileByPath(e.folderPath);if(!l||!(l instanceof gm.TFolder))throw new Error(`Folder not found: ${e.folderPath}`);await n.create_new_note_from_template(i,l,e.fileName,(o=e.openNote)!=null?o:!0)}}};var sL=require("obsidian");function v_(r,e,t,n){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(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})}function Jj(r){Xr(r,"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 Yj(r){let e,t,n,i;return{c(){e=Z("button"),t=Be(r[3]),R(e,"class","mb-button-inner svelte-12xcpmj"),R(e,"aria-label",r[2]),e.disabled=r[0],At(e,"mod-cta",r[1]==="primary"),At(e,"mod-warning",r[1]==="destructive"),At(e,"mod-plain",r[1]==="plain"),At(e,"disabled",r[0]),At(e,"mb-error",r[4])},m(a,o){Q(a,e,o),$(e,t),n||(i=xe(e,"click",r[7]),n=!0)},p(a,[o]){o&8&&nt(t,a[3]),o&4&&R(e,"aria-label",a[2]),o&1&&(e.disabled=a[0]),o&2&&At(e,"mod-cta",a[1]==="primary"),o&2&&At(e,"mod-warning",a[1]==="destructive"),o&2&&At(e,"mod-plain",a[1]==="plain"),o&1&&At(e,"disabled",a[0]),o&16&&At(e,"mb-error",a[4])},i:Fe,o:Fe,d(a){a&&X(e),n=!1,i()}}}function Xj(r,e,t){let{variant:n="default"}=e,{disabled:i=!1}=e,{tooltip:a=""}=e,{label:o=""}=e,{error:l=!1}=e,{onClick:u=()=>v_(void 0,void 0,void 0,function*(){})}=e;function s(){return v_(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 r.$$set=f=>{"variant"in f&&t(1,n=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,n,a,o,l,s,u,c]}var y_=class extends Ve{constructor(e){super(),ze(this,e,Xj,Yj,qe,{variant:1,disabled:0,tooltip:2,label:3,error:4,onClick:6},Jj)}},vm=y_;var Yt;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},r.getValidEnumValues=i=>{let a=r.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(let l of a)o[l]=i[l];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(a){return i[a]}),r.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},r.find=(i,a)=>{for(let o of i)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Yt||(Yt={}));var x_;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(x_||(x_={}));var Xe=Yt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),co=r=>{switch(typeof r){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return isNaN(r)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(r)?Xe.array:r===null?Xe.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Xe.promise:typeof Map!="undefined"&&r instanceof Map?Xe.map:typeof Set!="undefined"&&r instanceof Set?Xe.set:typeof Date!="undefined"&&r instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},He=Yt.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"]),Qj=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),ui=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_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)n._errors.push(t(o));else{let l=n,u=0;for(;u<o.path.length;){let s=o.path[u];u===o.path.length-1?(l[s]=l[s]||{_errors:[]},l[s]._errors.push(t(o))):l[s]=l[s]||{_errors:[]},l=l[s],u++}}};return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];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))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ui.create=r=>new ui(r);var $l=(r,e)=>{let t;switch(r.code){case He.invalid_type:r.received===Xe.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case He.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Yt.jsonStringifyReplacer)}`;break;case He.unrecognized_keys:t=`Unrecognized key(s) in object: ${Yt.joinValues(r.keys,", ")}`;break;case He.invalid_union:t="Invalid input";break;case He.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Yt.joinValues(r.options)}`;break;case He.invalid_enum_value:t=`Invalid enum value. Expected ${Yt.joinValues(r.options)}, received '${r.received}'`;break;case He.invalid_arguments:t="Invalid function arguments";break;case He.invalid_return_type:t="Invalid function return type";break;case He.invalid_date:t="Invalid date";break;case He.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Yt.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case He.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case He.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case He.custom:t="Invalid input";break;case He.invalid_intersection_types:t="Intersection results could not be merged";break;case He.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case He.not_finite:t="Number must be finite";break;default:t=e.defaultError,Yt.assertNever(r)}return{message:t}},Xk=$l;function Kj(r){Xk=r}function bm(){return Xk}var xm=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,a=[...t,...i.path||[]],o={...i,path:a},l="",u=n.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}},eZ=[];function Ke(r,e){let t=xm({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bm(),$l].filter(n=>!!n)});r.common.issues.push(t)}var En=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Ft;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t)n.push({key:await i.key,value:await i.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Ft;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value!="undefined"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Ft=Object.freeze({status:"aborted"}),Qk=r=>({status:"dirty",value:r}),Fn=r=>({status:"valid",value:r}),w_=r=>r.status==="aborted",__=r=>r.status==="dirty",Hl=r=>r.status==="valid",wm=r=>typeof Promise!="undefined"&&r instanceof Promise,pt;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(pt||(pt={}));var Di=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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}},Jk=(r,e)=>{if(Hl(e))return{success:!0,data:e.value};if(!r.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 ui(r.common.issues);return this._error=t,this._error}}};function Bt(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))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:n!=null?n:l.defaultError}:{message:t!=null?t:l.defaultError},description:i}}var Pt=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 co(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:co(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new En,ctx:{common:e.parent.common,data:e.data,parsedType:co(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(wm(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:co(e)},a=this._parseSync({data:e,path:i.path,parent:i});return Jk(i,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={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:co(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(wm(i)?i:Promise.resolve(i));return Jk(n,a)}refine(e,t){let n=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:He.custom,...n(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((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new li({schema:this,typeName:bt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ui.create(this,this._def)}nullable(){return Sa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ea.create(this,this._def)}promise(){return mo.create(this,this._def)}or(e){return ts.create([this,e],this._def)}and(e){return rs.create(this,e,this._def)}transform(e){return new li({...Bt(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ss({...Bt(this._def),innerType:this,defaultValue:t,typeName:bt.ZodDefault})}brand(){return new Em({typeName:bt.ZodBranded,type:this,...Bt(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new wu({...Bt(this._def),innerType:this,catchValue:t,typeName:bt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Gl.create(this,e)}readonly(){return Au.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tZ=/^c[^\s-]{8,}$/i,rZ=/^[a-z][a-z0-9]*$/,nZ=/^[0-9A-HJKMNP-TV-Z]{26}$/,iZ=/^[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,aZ=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",b_,sZ=/^(((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}))$/,uZ=/^(([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})))$/,lZ=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.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$"):r.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 cZ(r,e){return!!((e==="v4"||!e)&&sZ.test(r)||(e==="v6"||!e)&&uZ.test(r))}var fo=class r extends Pt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Xe.string){let a=this._getOrReturnCtx(e);return Ke(a,{code:He.invalid_type,expected:Xe.string,received:a.parsedType}),Ft}let n=new En,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,l=e.data.length<a.value;(o||l)&&(i=this._getOrReturnCtx(e,i),o?Ke(i,{code:He.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&Ke(i,{code:He.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")aZ.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"email",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")b_||(b_=new RegExp(oZ,"u")),b_.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"emoji",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")iZ.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"uuid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")tZ.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"cuid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")rZ.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"cuid2",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")nZ.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"ulid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(o){i=this._getOrReturnCtx(e,i),Ke(i,{validation:"url",code:He.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"regex",code:He.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?lZ(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?cZ(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Ke(i,{validation:"ip",code:He.invalid_string,message:a.message}),n.dirty()):Yt.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:He.invalid_string,...pt.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...pt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...pt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...pt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...pt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...pt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...pt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...pt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...pt.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,...pt.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...pt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...pt.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...pt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...pt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...pt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...pt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...pt.errToObj(t)})}nonempty(e){return this.min(1,pt.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...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<e)&&(e=t.value);return e}};fo.create=r=>{var e;return new fo({checks:[],typeName:bt.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Bt(r)})};function fZ(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var Jo=class r extends Pt{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)!==Xe.number){let a=this._getOrReturnCtx(e);return Ke(a,{code:He.invalid_type,expected:Xe.number,received:a.parsedType}),Ft}let n,i=new En;for(let a of this._def.checks)a.kind==="int"?Yt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?fZ(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.not_finite,message:a.message}),i.dirty()):Yt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,pt.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:pt.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:pt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:pt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:pt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pt.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.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Yt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Jo.create=r=>new Jo({checks:[],typeName:bt.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...Bt(r)});var Yo=class r extends Pt{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)!==Xe.bigint){let a=this._getOrReturnCtx(e);return Ke(a,{code:He.invalid_type,expected:Xe.bigint,received:a.parsedType}),Ft}let n,i=new En;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:He.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Yt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,pt.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:pt.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:pt.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<e)&&(e=t.value);return e}};Yo.create=r=>{var e;return new Yo({checks:[],typeName:bt.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Bt(r)})};var Xo=class extends Pt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Xe.boolean){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.boolean,received:n.parsedType}),Ft}return Fn(e.data)}};Xo.create=r=>new Xo({typeName:bt.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...Bt(r)});var Qo=class r extends Pt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Xe.date){let a=this._getOrReturnCtx(e);return Ke(a,{code:He.invalid_type,expected:Xe.date,received:a.parsedType}),Ft}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return Ke(a,{code:He.invalid_date}),Ft}let n=new En,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:He.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Yt.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:pt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:pt.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.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Qo.create=r=>new Qo({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:bt.ZodDate,...Bt(r)});var vu=class extends Pt{_parse(e){if(this._getType(e)!==Xe.symbol){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.symbol,received:n.parsedType}),Ft}return Fn(e.data)}};vu.create=r=>new vu({typeName:bt.ZodSymbol,...Bt(r)});var Ko=class extends Pt{_parse(e){if(this._getType(e)!==Xe.undefined){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.undefined,received:n.parsedType}),Ft}return Fn(e.data)}};Ko.create=r=>new Ko({typeName:bt.ZodUndefined,...Bt(r)});var es=class extends Pt{_parse(e){if(this._getType(e)!==Xe.null){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.null,received:n.parsedType}),Ft}return Fn(e.data)}};es.create=r=>new es({typeName:bt.ZodNull,...Bt(r)});var po=class extends Pt{constructor(){super(...arguments),this._any=!0}_parse(e){return Fn(e.data)}};po.create=r=>new po({typeName:bt.ZodAny,...Bt(r)});var Da=class extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fn(e.data)}};Da.create=r=>new Da({typeName:bt.ZodUnknown,...Bt(r)});var Vi=class extends Pt{_parse(e){let t=this._getOrReturnCtx(e);return Ke(t,{code:He.invalid_type,expected:Xe.never,received:t.parsedType}),Ft}};Vi.create=r=>new Vi({typeName:bt.ZodNever,...Bt(r)});var yu=class extends Pt{_parse(e){if(this._getType(e)!==Xe.undefined){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.void,received:n.parsedType}),Ft}return Fn(e.data)}};yu.create=r=>new yu({typeName:bt.ZodVoid,...Bt(r)});var Ea=class r extends Pt{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Xe.array)return Ke(t,{code:He.invalid_type,expected:Xe.array,received:t.parsedType}),Ft;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,l=t.data.length<i.exactLength.value;(o||l)&&(Ke(t,{code:o?He.too_big:He.too_small,minimum:l?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Ke(t,{code:He.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Ke(t,{code:He.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>i.type._parseAsync(new Di(t,o,t.path,l)))).then(o=>En.mergeArray(n,o));let a=[...t.data].map((o,l)=>i.type._parseSync(new Di(t,o,t.path,l)));return En.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:pt.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:pt.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:pt.toString(t)}})}nonempty(e){return this.min(1,e)}};Ea.create=(r,e)=>new Ea({type:r,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...Bt(e)});function gu(r){if(r instanceof Hn){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Ui.create(gu(n))}return new Hn({...r._def,shape:()=>e})}else return r instanceof Ea?new Ea({...r._def,type:gu(r.element)}):r instanceof Ui?Ui.create(gu(r.unwrap())):r instanceof Sa?Sa.create(gu(r.unwrap())):r instanceof ea?ea.create(r.items.map(e=>gu(e))):r}var Hn=class r extends Pt{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=Yt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Xe.object){let s=this._getOrReturnCtx(e);return Ke(s,{code:He.invalid_type,expected:Xe.object,received:s.parsedType}),Ft}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Vi&&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 Di(i,f,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof Vi){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&&(Ke(i,{code:He.unrecognized_keys,keys:l}),n.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 Di(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=>En.mergeObjectSync(n,s)):En.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return pt.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,a,o,l;let u=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(l=pt.errToObj(e).message)!==null&&l!==void 0?l:u}:{message:u}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:bt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return Yt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return Yt.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return gu(this)}partial(e){let t={};return Yt.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return Yt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ui;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return Kk(Yt.objectKeys(this.shape))}};Hn.create=(r,e)=>new Hn({shape:()=>r,unknownKeys:"strip",catchall:Vi.create(),typeName:bt.ZodObject,...Bt(e)});Hn.strictCreate=(r,e)=>new Hn({shape:()=>r,unknownKeys:"strict",catchall:Vi.create(),typeName:bt.ZodObject,...Bt(e)});Hn.lazycreate=(r,e)=>new Hn({shape:r,unknownKeys:"strip",catchall:Vi.create(),typeName:bt.ZodObject,...Bt(e)});var ts=class extends Pt{_parse(e){let{ctx:t}=this._processInputParams(e),n=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 ui(l.ctx.common.issues));return Ke(t,{code:He.invalid_union,unionErrors:o}),Ft}if(t.common.async)return Promise.all(n.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 n){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 ui(u));return Ke(t,{code:He.invalid_union,unionErrors:l}),Ft}}get options(){return this._def.options}};ts.create=(r,e)=>new ts({options:r,typeName:bt.ZodUnion,...Bt(e)});var ym=r=>r instanceof ns?ym(r.schema):r instanceof li?ym(r.innerType()):r instanceof is?[r.value]:r instanceof as?r.options:r instanceof os?Object.keys(r.enum):r instanceof ss?ym(r._def.innerType):r instanceof Ko?[void 0]:r instanceof es?[null]:null,_m=class r extends Pt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Xe.object)return Ke(t,{code:He.invalid_type,expected:Xe.object,received:t.parsedType}),Ft;let n=this.discriminator,i=t.data[n],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}):(Ke(t,{code:He.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ft)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let a of t){let o=ym(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 r({typeName:bt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Bt(n)})}};function A_(r,e){let t=co(r),n=co(e);if(r===e)return{valid:!0,data:r};if(t===Xe.object&&n===Xe.object){let i=Yt.objectKeys(e),a=Yt.objectKeys(r).filter(l=>i.indexOf(l)!==-1),o={...r,...e};for(let l of a){let u=A_(r[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===Xe.array&&n===Xe.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<r.length;a++){let o=r[a],l=e[a],u=A_(o,l);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===Xe.date&&n===Xe.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var rs=class extends Pt{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(w_(a)||w_(o))return Ft;let l=A_(a.value,o.value);return l.valid?((__(a)||__(o))&&t.dirty(),{status:t.value,value:l.data}):(Ke(n,{code:He.invalid_intersection_types}),Ft)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};rs.create=(r,e,t)=>new rs({left:r,right:e,typeName:bt.ZodIntersection,...Bt(t)});var ea=class r extends Pt{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.array)return Ke(n,{code:He.invalid_type,expected:Xe.array,received:n.parsedType}),Ft;if(n.data.length<this._def.items.length)return Ke(n,{code:He.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ft;!this._def.rest&&n.data.length>this._def.items.length&&(Ke(n,{code:He.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Di(n,o,n.path,l)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>En.mergeArray(t,o)):En.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};ea.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea({items:r,typeName:bt.ZodTuple,rest:null,...Bt(e)})};var Am=class r extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.object)return Ke(n,{code:He.invalid_type,expected:Xe.object,received:n.parsedType}),Ft;let i=[],a=this._def.keyType,o=this._def.valueType;for(let l in n.data)i.push({key:a._parse(new Di(n,l,n.path,l)),value:o._parse(new Di(n,n.data[l],n.path,l))});return n.common.async?En.mergeObjectAsync(t,i):En.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Pt?new r({keyType:e,valueType:t,typeName:bt.ZodRecord,...Bt(n)}):new r({keyType:fo.create(),valueType:e,typeName:bt.ZodRecord,...Bt(t)})}},bu=class extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.map)return Ke(n,{code:He.invalid_type,expected:Xe.map,received:n.parsedType}),Ft;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([l,u],s)=>({key:i._parse(new Di(n,l,n.path,[s,"key"])),value:a._parse(new Di(n,u,n.path,[s,"value"]))}));if(n.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 Ft;(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 Ft;(s.status==="dirty"||c.status==="dirty")&&t.dirty(),l.set(s.value,c.value)}return{status:t.value,value:l}}}};bu.create=(r,e,t)=>new bu({valueType:e,keyType:r,typeName:bt.ZodMap,...Bt(t)});var xu=class r extends Pt{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.set)return Ke(n,{code:He.invalid_type,expected:Xe.set,received:n.parsedType}),Ft;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ke(n,{code:He.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ke(n,{code:He.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 Ft;c.status==="dirty"&&t.dirty(),s.add(c.value)}return{status:t.value,value:s}}let l=[...n.data.values()].map((u,s)=>a._parse(new Di(n,u,n.path,s)));return n.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new r({...this._def,minSize:{value:e,message:pt.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:pt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};xu.create=(r,e)=>new xu({valueType:r,minSize:null,maxSize:null,typeName:bt.ZodSet,...Bt(e)});var Dm=class r extends Pt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Xe.function)return Ke(t,{code:He.invalid_type,expected:Xe.function,received:t.parsedType}),Ft;function n(l,u){return xm({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bm(),$l].filter(s=>!!s),issueData:{code:He.invalid_arguments,argumentsError:u}})}function i(l,u){return xm({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bm(),$l].filter(s=>!!s),issueData:{code:He.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof mo){let l=this;return Fn(async function(...u){let s=new ui([]),c=await l._def.args.parseAsync(u,a).catch(m=>{throw s.addIssue(n(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 Fn(function(...u){let s=l._def.args.safeParse(u,a);if(!s.success)throw new ui([n(u,s.error)]);let c=Reflect.apply(o,this,s.data),f=l._def.returns.safeParse(c,a);if(!f.success)throw new ui([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:ea.create(e).rest(Da.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||ea.create([]).rest(Da.create()),returns:t||Da.create(),typeName:bt.ZodFunction,...Bt(n)})}},ns=class extends Pt{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})}};ns.create=(r,e)=>new ns({getter:r,typeName:bt.ZodLazy,...Bt(e)});var is=class extends Pt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Ke(t,{received:t.data,code:He.invalid_literal,expected:this._def.value}),Ft}return{status:"valid",value:e.data}}get value(){return this._def.value}};is.create=(r,e)=>new is({value:r,typeName:bt.ZodLiteral,...Bt(e)});function Kk(r,e){return new as({values:r,typeName:bt.ZodEnum,...Bt(e)})}var as=class r extends Pt{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return Ke(t,{expected:Yt.joinValues(n),received:t.parsedType,code:He.invalid_type}),Ft}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return Ke(t,{received:t.data,code:He.invalid_enum_value,options:n}),Ft}return Fn(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 r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};as.create=Kk;var os=class extends Pt{_parse(e){let t=Yt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Xe.string&&n.parsedType!==Xe.number){let i=Yt.objectValues(t);return Ke(n,{expected:Yt.joinValues(i),received:n.parsedType,code:He.invalid_type}),Ft}if(t.indexOf(e.data)===-1){let i=Yt.objectValues(t);return Ke(n,{received:n.data,code:He.invalid_enum_value,options:i}),Ft}return Fn(e.data)}get enum(){return this._def.values}};os.create=(r,e)=>new os({values:r,typeName:bt.ZodNativeEnum,...Bt(e)});var mo=class extends Pt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Xe.promise&&t.common.async===!1)return Ke(t,{code:He.invalid_type,expected:Xe.promise,received:t.parsedType}),Ft;let n=t.parsedType===Xe.promise?t.data:Promise.resolve(t.data);return Fn(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};mo.create=(r,e)=>new mo({type:r,typeName:bt.ZodPromise,...Bt(e)});var li=class extends Pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{Ke(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(o).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}if(i.type==="refinement"){let o=l=>{let u=i.refinement(l,a);if(n.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(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Ft:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Ft:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Hl(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:n.data,path:n.path,parent:n}).then(o=>Hl(o)?Promise.resolve(i.transform(o.value,a)).then(l=>({status:t.value,value:l})):o);Yt.assertNever(i)}};li.create=(r,e,t)=>new li({schema:r,typeName:bt.ZodEffects,effect:e,...Bt(t)});li.createWithPreprocess=(r,e,t)=>new li({schema:e,effect:{type:"preprocess",transform:r},typeName:bt.ZodEffects,...Bt(t)});var Ui=class extends Pt{_parse(e){return this._getType(e)===Xe.undefined?Fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ui.create=(r,e)=>new Ui({innerType:r,typeName:bt.ZodOptional,...Bt(e)});var Sa=class extends Pt{_parse(e){return this._getType(e)===Xe.null?Fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sa.create=(r,e)=>new Sa({innerType:r,typeName:bt.ZodNullable,...Bt(e)});var ss=class extends Pt{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Xe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ss.create=(r,e)=>new ss({innerType:r,typeName:bt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Bt(e)});var wu=class extends Pt{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wm(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ui(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ui(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};wu.create=(r,e)=>new wu({innerType:r,typeName:bt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Bt(e)});var _u=class extends Pt{_parse(e){if(this._getType(e)!==Xe.nan){let n=this._getOrReturnCtx(e);return Ke(n,{code:He.invalid_type,expected:Xe.nan,received:n.parsedType}),Ft}return{status:"valid",value:e.data}}};_u.create=r=>new _u({typeName:bt.ZodNaN,...Bt(r)});var pZ=Symbol("zod_brand"),Em=class extends Pt{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Gl=class r extends Pt{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ft:a.status==="dirty"?(t.dirty(),Qk(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ft:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:bt.ZodPipeline})}},Au=class extends Pt{_parse(e){let t=this._def.innerType._parse(e);return Hl(t)&&(t.value=Object.freeze(t.value)),t}};Au.create=(r,e)=>new Au({innerType:r,typeName:bt.ZodReadonly,...Bt(e)});var eL=(r,e={},t)=>r?po.create().superRefine((n,i)=>{var a,o;if(!r(n)){let l=typeof e=="function"?e(n):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})}}):po.create(),mZ={object:Hn.lazycreate},bt;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(bt||(bt={}));var dZ=(r,e={message:`Input not instance of ${r.name}`})=>eL(t=>t instanceof r,e),tL=fo.create,rL=Jo.create,hZ=_u.create,gZ=Yo.create,nL=Xo.create,vZ=Qo.create,yZ=vu.create,bZ=Ko.create,xZ=es.create,wZ=po.create,_Z=Da.create,AZ=Vi.create,DZ=yu.create,EZ=Ea.create,SZ=Hn.create,NZ=Hn.strictCreate,CZ=ts.create,MZ=_m.create,TZ=rs.create,FZ=ea.create,IZ=Am.create,BZ=bu.create,PZ=xu.create,OZ=Dm.create,RZ=ns.create,kZ=is.create,LZ=as.create,UZ=os.create,VZ=mo.create,Yk=li.create,qZ=Ui.create,zZ=Sa.create,$Z=li.createWithPreprocess,HZ=Gl.create,GZ=()=>tL().optional(),WZ=()=>rL().optional(),jZ=()=>nL().optional(),ZZ={string:r=>fo.create({...r,coerce:!0}),number:r=>Jo.create({...r,coerce:!0}),boolean:r=>Xo.create({...r,coerce:!0}),bigint:r=>Yo.create({...r,coerce:!0}),date:r=>Qo.create({...r,coerce:!0})},JZ=Ft,Le=Object.freeze({__proto__:null,defaultErrorMap:$l,setErrorMap:Kj,getErrorMap:bm,makeIssue:xm,EMPTY_PATH:eZ,addIssueToContext:Ke,ParseStatus:En,INVALID:Ft,DIRTY:Qk,OK:Fn,isAborted:w_,isDirty:__,isValid:Hl,isAsync:wm,get util(){return Yt},get objectUtil(){return x_},ZodParsedType:Xe,getParsedType:co,ZodType:Pt,ZodString:fo,ZodNumber:Jo,ZodBigInt:Yo,ZodBoolean:Xo,ZodDate:Qo,ZodSymbol:vu,ZodUndefined:Ko,ZodNull:es,ZodAny:po,ZodUnknown:Da,ZodNever:Vi,ZodVoid:yu,ZodArray:Ea,ZodObject:Hn,ZodUnion:ts,ZodDiscriminatedUnion:_m,ZodIntersection:rs,ZodTuple:ea,ZodRecord:Am,ZodMap:bu,ZodSet:xu,ZodFunction:Dm,ZodLazy:ns,ZodLiteral:is,ZodEnum:as,ZodNativeEnum:os,ZodPromise:mo,ZodEffects:li,ZodTransformer:li,ZodOptional:Ui,ZodNullable:Sa,ZodDefault:ss,ZodCatch:wu,ZodNaN:_u,BRAND:pZ,ZodBranded:Em,ZodPipeline:Gl,ZodReadonly:Au,custom:eL,Schema:Pt,ZodSchema:Pt,late:mZ,get ZodFirstPartyTypeKind(){return bt},coerce:ZZ,any:wZ,array:EZ,bigint:gZ,boolean:nL,date:vZ,discriminatedUnion:MZ,effect:Yk,enum:LZ,function:OZ,instanceof:dZ,intersection:TZ,lazy:RZ,literal:kZ,map:BZ,nan:hZ,nativeEnum:UZ,never:AZ,null:xZ,nullable:zZ,number:rL,object:SZ,oboolean:jZ,onumber:WZ,optional:qZ,ostring:GZ,pipeline:HZ,preprocess:$Z,promise:VZ,record:IZ,set:PZ,strictObject:NZ,string:tL,symbol:yZ,transformer:Yk,tuple:FZ,undefined:bZ,union:CZ,unknown:_Z,void:DZ,NEVER:JZ,ZodIssueCode:He,quotelessJson:Qj,ZodError:ui});function iL(r,e){return(t,n)=>t[r]===void 0==(t[e]===void 0)?(n.addIssue({code:Le.ZodIssueCode.custom,message:`Either ${r} or ${e} must be filled, but not both`}),!1):!0}function mr(){return function(r){return r}}var YZ=mr()(Le.object({type:Le.literal("command"),command:Le.string()})),XZ=mr()(Le.object({type:Le.literal("js"),file:Le.string()})),QZ=mr()(Le.object({type:Le.literal("open"),link:Le.string()})),KZ=mr()(Le.object({type:Le.literal("input"),str:Le.string()})),eJ=mr()(Le.object({type:Le.literal("sleep"),ms:Le.number()})),tJ=mr()(Le.object({type:Le.literal("templaterCreateNote"),templateFile:Le.string(),folderPath:Le.string().optional(),fileName:Le.string().optional(),openNote:Le.boolean().optional()})),rJ=mr()(Le.object({type:Le.literal("updateMetadata"),bindTarget:Le.coerce.string(),evaluate:Le.boolean(),value:Le.coerce.string()})),aL=mr()(Le.union([YZ,XZ,QZ,KZ,eJ,tJ,rJ])),nJ=Le.nativeEnum(fa),oL=mr()(Le.object({label:Le.string(),style:nJ,class:Le.string().optional(),tooltip:Le.string().optional(),id:Le.string().optional(),hidden:Le.boolean().optional(),action:aL.optional(),actions:aL.array().optional()}).superRefine(iL("action","actions")));var Du=class{constructor(e,t,n,i){this.plugin=e,this.unvalidatedConfig=t,this.filePath=n,this.inline=i,this.config=void 0}renderButton(e){if(this.config===void 0)return;let t=this.config;this.buttonComponent=new vm({target:e,props:{variant:t.style,label:t.label,tooltip:Lu(t.tooltip)?t.tooltip:t.label,onClick:async()=>{await this.plugin.api.buttonActionRunner.runButtonAction(t,this.filePath)}}})}mount(e){e.empty(),e.addClass("mb-button",this.inline?"mb-button-inline":"mb-button-block");let t=oL.safeParse(this.unvalidatedConfig);if(!t.success)throw new dc({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:t.error.message,docs:[_t.linkToButtonConfig()]});this.config=t.data,!(!this.inline&&(this.config.id&&this.plugin.api.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&e.addClass(...this.config.class.split(" ").filter(n=>n!=="")),this.renderButton(e))}unmount(){var e,t;(e=this.buttonComponent)==null||e.$destroy(),this.inline||(t=this.config)!=null&&t.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var ho=class extends hn{constructor(e,t,n,i,a){super(e,"block",n,i,a),this.content=t}onload(){console.log("meta-bind | ButtonMDRC >> onload"),this.plugin.mdrcManager.registerMDRC(this),this.containerEl.className="";let e=(0,sL.parseYaml)(this.content);this.buttonField=new Du(this.plugin,e,this.filePath,!1);try{this.buttonField.mount(this.containerEl)}catch(t){this.errorCollection.add(t),new Yn({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.content}})}}onunload(){var e;console.log("meta-bind | ButtonMDRC >> onunload"),(e=this.buttonField)==null||e.unmount(),this.plugin.mdrcManager.unregisterMDRC(this),fi(this.containerEl,"button"),super.onunload()}};var Wl=ur(Rn());var uL=ur(Xn()),iJ=Wl.P.sequenceMap((r,e)=>e,Wl.P.string("BUTTON"),Wl.P.manyNotOf("[],").separateBy(Wl.P.string(",").trim(uL.P_UTILS.optionalWhitespace())).wrapString("[","]")),Sm=class{static parseString(e){return Ur(iJ,e)}};var Nm=class{constructor(e,t,n){this.cleanupCallbacks=[];this.plugin=e,this.content=t,this.filePath=n,this.cleanupCallbacks=[]}renderInitialButton(e,t){return new vm({target:e,props:{variant:"default",label:"Button ID not Found",tooltip:`No button with id '${t}' found`,error:!0,onClick:async()=>{}}})}mount(e){e.empty(),e.addClass("mb-button-group");let t=Sm.parseString(this.content);for(let n of t){let i=document.createElement("span");e.append(i),i.addClass("mb-button","mb-button-inline");let a=this.renderInitialButton(i,n),o,l=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,n,u=>{a==null||a.$destroy(),o=new Du(this.plugin,u,this.filePath,!0),o.mount(i)});this.cleanupCallbacks.push(()=>{a==null||a.$destroy(),o==null||o.unmount(),l()})}}unmount(){for(let e of this.cleanupCallbacks)e()}};var Cm=class extends hn{constructor(e,t,n,i,a){super(e,"inline",n,i,a),this.content=t}onload(){console.log("meta-bind | InlineButtonMDRC >> onload"),this.plugin.mdrcManager.registerMDRC(this),this.containerEl.className="",this.buttonField=new Nm(this.plugin,this.content,this.filePath);try{this.buttonField.mount(this.containerEl)}catch(e){this.errorCollection.add(e),new Yn({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.content}})}}onunload(){var e;console.log("meta-bind | InlineButtonMDRC >> onunload"),(e=this.buttonField)==null||e.unmount(),this.plugin.mdrcManager.unregisterMDRC(this),fi(this.containerEl,"inline button"),super.onunload()}};var lL=require("@codemirror/view");var jl=class extends lL.WidgetType{constructor(e,t,n,i){super(),this.content=e,this.filePath=t,this.parentComponent=n,this.plugin=i}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement("span");return t.addClass("cm-inline-code"),this.renderChild=this.createRenderChild(t,this.parentComponent),t}destroy(e){var t;(t=this.renderChild)==null||t.unload(),super.destroy(e)}},Mm=class extends jl{createRenderChild(e,t){return In.createInlineInputFieldMDRC(this.content,this.filePath,e,t,this.plugin)}},Tm=class extends jl{createRenderChild(e,t){return In.createInlineViewFieldMDRC(this.content,this.filePath,e,t,this.plugin)}},Fm=class extends jl{createRenderChild(e,t){return In.createInlineButtonMDRC(this.content,this.filePath,e,t,this.plugin)}};var In=class r{static getDeclarationPrefix(e){if(e==="INPUT_FIELD")return"INPUT";if(e==="VIEW_FIELD")return"VIEW";if(e==="BUTTON")return"BUTTON";throw new an({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}static isDeclaration(e,t){let n=r.getDeclarationPrefix(e)+"[";return t.startsWith(n)&&t.endsWith("]")}static isDeclarationAndGetMDRCType(e){if(e.endsWith("]"))for(let t of Object.values(Im)){let n=r.getDeclarationPrefix(t)+"[";if(e.startsWith(n))return t}}static constructMDRCWidget(e,t,n,i,a){if(e==="INPUT_FIELD")return new Mm(t,n,i,a);if(e==="VIEW_FIELD")return new Tm(t,n,i,a);if(e==="BUTTON")return new Fm(t,n,i,a);throw new an({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}static constructMDRC(e,t,n,i,a,o){if(e==="INPUT_FIELD")return r.createInlineInputFieldMDRC(t,n,i,a,o);if(e==="VIEW_FIELD")return r.createInlineViewFieldMDRC(t,n,i,a,o);if(e==="BUTTON")return r.createInlineButtonMDRC(t,n,i,a,o);throw new an({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}static createInlineInputFieldMDRC(e,t,n,i,a){return a.api.createInputFieldFromString(e,"inline",t,n,i)}static createInlineViewFieldMDRC(e,t,n,i,a){return a.api.createViewFieldFromString(e,"inline",t,n,i)}static createInlineButtonMDRC(e,t,n,i,a){return a.api.createInlineButtonFromString(e,t,n,i)}},Im=(n=>(n.INPUT_FIELD="INPUT_FIELD",n.VIEW_FIELD="VIEW_FIELD",n.BUTTON="BUTTON",n))(Im||{});var dL=ur(Xn());var Eu=class{constructor(e,t){this.range=e,this.tokenClass=t}};var D_=ur(Rn());var gt=class r{static sequence(...e){return D_.P.sequenceMap((...t)=>t.flat(2).filter(n=>n!==void 0),...e)}static separateBy(e,t){return r.sequence(e,r.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((n,i)=>[new Eu(i,t)])}static highlightStr(e,t){return r.highlight(D_.P.string(e),t)}};var Na=class{constructor(e,t,n){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=n}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 Eu({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};var Cr=ur(Xn());var E_=ur(Rn());var S_=gt.highlight(Sn,"ident"),Bm=gt.highlight(Sn,"keyword"),N_=gt.highlightStr(",","control"),Pm=gt.highlightStr("(","control"),Om=gt.highlightStr(")","control"),Su=gt.highlightStr("[","control"),Nu=gt.highlightStr("]","control"),oJ=gt.highlight(kd,"string"),sJ=gt.highlight(Ld,"ident"),uJ=E_.P.or(sJ,oJ),lJ=gt.separateBy(uJ,N_.trim(Cr.P_UTILS.optionalWhitespace())),cJ=gt.sequence(Bm,gt.sequence(Pm,lJ.trim(Cr.P_UTILS.optionalWhitespace()),Om).optional()),C_=gt.separateBy(cJ,N_.trim(Cr.P_UTILS.optionalWhitespace())),Cu=gt.sequence(gt.sequence(S_,gt.highlightStr("^","control")).optional(),gt.sequence(gt.highlight(zu,"ident"),gt.highlightStr("#","control")).optional(),gt.highlight(Vd,"ident")),fJ=gt.sequence(Bm.trim(Cr.P_UTILS.optionalWhitespace()),gt.sequence(Pm,C_.trim(Cr.P_UTILS.optionalWhitespace()),Om).trim(Cr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Cr.P_UTILS.optionalWhitespace()),Cu).trim(Cr.P_UTILS.optionalWhitespace()).optional()),pJ=gt.sequence(Bm.trim(Cr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(Pm,C_.trim(Cr.P_UTILS.optionalWhitespace()),Om).trim(Cr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Cr.P_UTILS.optionalWhitespace()),Cu).trim(Cr.P_UTILS.optionalWhitespace()).optional()),fL=E_.P.or(gt.sequence(gt.highlightStr("INPUT","control"),Su,S_.trim(Cr.P_UTILS.optionalWhitespace()),Nu.skip(Cr.P_UTILS.optionalWhitespace()),Su,pJ,Nu),gt.sequence(gt.highlightStr("INPUT","control"),Su,fJ,Nu)),cL=gt.highlight(Rc,"ident"),mJ=gt.sequence(gt.highlightStr("{","string"),Cu,gt.highlightStr("}","string")),dJ=gt.sequence(cL,gt.sequence(mJ,cL).many()),hJ=gt.sequence(Bm.trim(Cr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(Pm,C_.trim(Cr.P_UTILS.optionalWhitespace()).optional(),Om).trim(Cr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Cr.P_UTILS.optionalWhitespace()),Cu).trim(Cr.P_UTILS.optionalWhitespace()).optional()),pL=gt.sequence(gt.highlightStr("VIEW","control"),Su,dJ,Nu,gt.sequence(Su.skip(Cr.P_UTILS.optionalWhitespace()),hJ,Nu).optional()),mL=gt.sequence(gt.highlightStr("BUTTON","control"),Su,gt.separateBy(S_,N_.trim(Cr.P_UTILS.optionalWhitespace())),Nu);var Rm=class{constructor(e){this.plugin=e,this.api=e.api}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,fL)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,pL)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,mL)}highlight(e,t,n){if(t==="INPUT_FIELD")return this.highlightInputFieldDeclaration(e,n);if(t==="VIEW_FIELD")return this.highlightViewFieldDeclaration(e,n);if(t==="BUTTON")return this.highlightInlineButtonDeclaration(e,n);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,Cu)}highlightWithParser(e,t,n){try{return t?new Na(e,Ur(n.trim(dL.P_UTILS.optionalWhitespace()).thenEof(),e)):new Na(e,Ur(n.thenEof(),e))}catch(i){return i instanceof $u?new Na(e,[],i):(console.error(i),new Na(e,[]))}}};var T_=require("obsidian");var ta=mr()(Le.string()),Zl=mr()(Le.nativeEnum(Pn)),vo=mr()(Le.instanceof(HTMLElement)),Bze=mr()(Le.instanceof(T_.Component)),km=mr()(Le.instanceof(Ls)),hL=mr()(Le.object({index:Le.number(),line:Le.number(),column:Le.number()})),gJ=mr()(Le.object({from:hL,to:hL})),go=mr()(Le.object({value:Le.string(),position:gJ.optional()})),gL=mr()(Le.object({name:go,value:go.array()})),vJ=mr()(Le.object({type:Le.nativeEnum(Mo),prop:go})),M_=mr()(Le.object({storageType:go.optional(),storagePath:go.optional(),storageProp:vJ.array(),listenToChildren:Le.boolean()})),F_=mr()(Le.object({fullDeclaration:Le.string(),inputFieldType:go.optional(),templateName:go.optional(),bindTarget:M_.optional(),arguments:gL.array(),errorCollection:Le.instanceof(rr)})),vL=mr()(Le.object({fullDeclaration:Le.string(),templateDeclaration:Le.array(Le.union([Le.string(),M_])),viewFieldType:go.optional(),arguments:gL.array(),writeToBindTarget:M_.optional(),errorCollection:Le.instanceof(rr)})),yL=mr()(Le.object({storageType:Le.nativeEnum(To),storagePath:Le.string(),storageProp:Le.instanceof(Ua),listenToChildren:Le.boolean()})),bL=mr()(Le.instanceof(xr)),xL=mr()(Le.function().args().returns(Le.void())),yo=mr()(Le.object({addChild:Le.function().args(Le.instanceof(T_.Component)).returns(Le.void())}));var Lm=class{constructor(e){this.plugin=e,this.inputField=new lf(this),this.inputFieldParser=new uf(this.plugin),this.viewFieldParser=new qc(this.plugin),this.bindTargetParser=new zc(this.plugin),this.inputFieldFactory=new Ff(this.plugin),this.viewFieldFactory=new pm(this.plugin),this.buttonActionRunner=new hm(this.plugin),this.buttonManager=new mm,this.syntaxHighlighting=new Rm(this.plugin)}createInputField(e,t,n,i,a,o){if(F_.parse(e),Zl.parse(t),ta.parse(n),vo.parse(i),yo.parse(a),km.optional().parse(o),this.plugin.isFilePathExcluded(n))return this.createExcludedField(i,n,a);let l=this.inputFieldParser.validateDeclaration(e,n,o),u=new Fo(i,t,l,this.plugin,n,Ht());return a.addChild(u),u}createInputFieldFromString(e,t,n,i,a,o){if(Le.string().parse(e),Zl.parse(t),ta.parse(n),vo.parse(i),yo.parse(a),km.optional().parse(o),this.plugin.isFilePathExcluded(n))return this.createExcludedField(i,n,a);let l=this.inputFieldParser.parseString(e,n,o),u=new Fo(i,t,l,this.plugin,n,Ht());return a.addChild(u),u}createViewFieldFromString(e,t,n,i,a,o){if(Le.string().parse(e),Zl.parse(t),ta.parse(n),vo.parse(i),yo.parse(a),km.optional().parse(o),this.plugin.isFilePathExcluded(n))return this.createExcludedField(i,n,a);let l=this.viewFieldParser.parseString(e,n,o),u=new Ps(i,t,l,this.plugin,n,Ht());return a.addChild(u),u}createJsViewFieldFromString(e,t,n,i,a){if(Le.string().parse(e),Zl.parse(t),ta.parse(n),vo.parse(i),yo.parse(a),this.plugin.isFilePathExcluded(n))return this.createExcludedField(i,n,a);let o=this.viewFieldParser.parseJsString(e,n),l=new Hc(i,t,o,this.plugin,n,Ht());return a.addChild(l),l}createExcludedField(e,t,n){let i=new cf(e,"inline",this.plugin,t,Ht());return n.addChild(i),i}createSignal(e){return new xr(e)}listenToMetadata(e,t,n,i=!1,a){bL.parse(e),ta.parse(t),Le.array(Le.string()).parse(n),Le.boolean().parse(i),xL.optional().parse(a);let o=Ht(),l=this.plugin.metadataManager.subscribe(o,e,{storageType:"frontmatter",storagePath:t,storageProp:ff(n),listenToChildren:i},a!=null?a:()=>{});return()=>{l.unsubscribe()}}createTable(e,t,n,i,a,o){vo.parse(e),ta.parse(t),yo.parse(n),yL.parse(i),Le.array(Le.string()).parse(a),Le.array(Le.union([F_,vL])).parse(o);let l=new pf(e,"inline",this.plugin,t,Ht(),i,a,o);return n.addChild(l),l}createBindTarget(e,t){return Le.string().parse(e),ta.parse(t),this.bindTargetParser.parseAndValidateBindTarget(e,t)}createButtonFromString(e,t,n,i){if(Le.string().parse(e),ta.parse(t),vo.parse(n),yo.parse(i),this.plugin.isFilePathExcluded(t))return this.createExcludedField(n,t,i);let a=new ho(n,e,this.plugin,t,Ht());return i.addChild(a),a}createInlineButtonFromString(e,t,n,i){if(Le.string().parse(e),ta.parse(t),vo.parse(n),yo.parse(i),this.plugin.isFilePathExcluded(t))return this.createExcludedField(n,t,i);let a=new Cm(n,e,this.plugin,t,Ht());return i.addChild(a),a}};var wL=require("obsidian");var I_=wo[1];function _L(r){I_=r}function B_(r){return K_[r]}function AL(r,e){let t=(0,wL.moment)(new Date(e,r)).daysInMonth(),n=new Array(42).fill(0),i=yJ(new Date(e,r,1));for(let a=0;a<t;a++)n[a+i]=a+1;return n=n[n.length-7]?n:n.slice(0,-7),n=n[n.length-7]?n:n.slice(0,-7),n}function yJ(r){return wd(r.getDay()-I_.index,7)}function DL(){return wo.map(e=>({index:wd(e.index-I_.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function EL(){let r=0;return()=>++r}var ls=require("@codemirror/view"),z_=require("@codemirror/language"),zm=require("obsidian");var SL=require("obsidian");var Ca=class{static checkSelectionOverlap(e,t,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,t,n,i){return e<=i&&n<=t}static getContent(e,t,n){return e.sliceDoc(t,n)}static getCurrentFile(e){return e.state.field(SL.editorInfoField).file}static existsDecorationBetween(e,t,n){let i=!1;return e.between(t,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,n,i){let a=!1;return e.between(n,i,(o,l,u)=>{u.spec.mb_widgetType===t&&(a=!0)}),a}};var Dr=class extends Error{},Jl=class extends Error{};var Mu=function(r){return this instanceof Mu?(this.v=r,this):new Mu(r)},bJ=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[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(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Mu?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])}},qi;(function(r){r[r.SHORTEST=0]="SHORTEST",r[r.LONGEST=1]="LONGEST",r[r.STRICT_EQUAL=2]="STRICT_EQUAL"})(qi||(qi={}));function*P_(r,e,...t){if(t.length===0)return;let n=[];for(let i of t)n.push(NL(i));e:for(;;){let i=ML.map(n,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(r){case qi.SHORTEST:break e;case qi.STRICT_EQUAL:throw new Jl("Iterators must have equal lengths")}if(!l)break;yield a}}function O_(r,e,...t){return bJ(this,arguments,function*(){if(t.length===0)return yield Mu(void 0);let i=[];for(let a of t)i.push(CL(a));e:for(;;){let a=[];for(let s of i){let c=yield Mu(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(r){case qi.SHORTEST:break e;case qi.STRICT_EQUAL:throw new Jl("Iterators must have equal lengths")}if(!u)break;yield yield Mu(o)}})}var TL=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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)}},Ma=function(r){return this instanceof Ma?(this.v=r,this):new Ma(r)},FL=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[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(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Ma?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*IL(...r){for(let e of P_(qi.SHORTEST,void 0,...r))yield e}function BL(...r){return FL(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=TL(O_(qi.SHORTEST,void 0,...r)),u;u=yield Ma(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Ma(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Ma(i.call(l)))}finally{if(n)throw n.error}}})}function*PL(...r){for(let e of P_(qi.STRICT_EQUAL,void 0,...r))yield e}function OL(...r){return FL(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=TL(O_(qi.STRICT_EQUAL,void 0,...r)),u;u=yield Ma(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Ma(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Ma(i.call(l)))}finally{if(n)throw n.error}}})}var RL=function(r,e,t,n){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(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},xJ=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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 wJ(r,e,t){let n=t;for(let i of Xt(r))n=e(n,i);return n}function _J(r,e,t){var n,i,a,o;return RL(this,void 0,void 0,function*(){let l=t;try{for(var u=!0,s=xJ(Qt(r)),c;c=yield s.next(),n=c.done,!n;){o=c.value,u=!1;try{l=yield e(l,o)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l})}function R_(r){switch(!0){case r instanceof Array:return r.length;case ra(r):return r.length;case r instanceof Set:return r.size;case r instanceof Map:return r.size}return wJ(r,e=>e+1,0)}function kL(r){return RL(this,void 0,void 0,function*(){switch(!0){case r instanceof Array:case ra(r):case r instanceof Set:case r instanceof Map:return R_(r)}return yield _J(r,e=>e+1,0)})}var zi=function(r,e,t,n){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(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},Ta=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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(r,e){for(let t of Xt(r))if(!e(t))return!1;return!0}function UL(r,e){var t,n,i,a;return zi(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(Qt(r)),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){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!0})}function VL(r){let e=new Set;for(let t of Xt(r)){if(e.has(t))return!1;e.add(t)}return!0}function qL(r){var e,t,n,i;return zi(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,l=Ta(Qt(r)),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&&(n=l.return)&&(yield n.call(l))}finally{if(t)throw t.error}}return!0})}function zL(r,e){for(let t of Xt(r))if(e(t))return!0;return!1}function $L(r,e){var t,n,i,a;return zi(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(Qt(r)),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){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!1})}function HL(r,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let n=0;for(let i of Xt(r))if(t(i)&&(n++,n>e))return!1;return n===e}function GL(r,e,t){var n,i,a,o;return zi(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=Ta(Qt(r)),c;c=yield s.next(),n=c.done,!n;){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&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l===e})}function WL(r){for(let e of Xt(r))return!1;return!0}function jL(r){var e,t,n,i;return zi(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(Qt(r)),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&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function Gn(r){return r==null?!1:typeof r[Symbol.iterator]=="function"}function Fa(r){return r==null?!1:typeof r[Symbol.asyncIterator]=="function"}function Ei(r){return r==null?!1:r.next!==void 0&&typeof r.next=="function"}function ZL(r){for(let[e,t]of us(Xt(r)))if(e<t)return!1;return!0}function JL(r){var e,t,n,i;return zi(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(Xl(Qt(r))),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&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function YL(r){for(let[e,t]of us(Xt(r)))if(e>t)return!1;return!0}function XL(r){var e,t,n,i;return zi(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(Xl(Qt(r))),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&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function ra(r){return typeof r=="string"||r instanceof String}function QL(r,e){for(let t of Xt(r))if(e(t))return!1;return!0}function KL(r,e){var t,n,i,a;return zi(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(Qt(r)),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){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!0})}function e4(...r){try{for(let e of PL(...r))for(let[t,n]of us(e))if(t!==n)return!1}catch(e){return!1}return!0}function t4(...r){var e,t,n,i;return zi(this,void 0,void 0,function*(){try{try{for(var a=!0,o=Ta(OL(...r)),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let u=i;for(let[s,c]of us(u))if(s!==c)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}}catch(u){return!1}return!0})}function r4(...r){if(r.length<=1)return!0;let e=r.map(t=>R_(t));return new Set(e).size===1}function n4(...r){return zi(this,void 0,void 0,function*(){if(r.length<=1)return!0;let e=yield Um(r,t=>zi(this,void 0,void 0,function*(){return yield kL(t)}));return new Set(yield Yl(e)).size===1})}var AJ=function(r,e,t,n){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(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},na=function(r){return this instanceof na?(this.v=r,this):new na(r)},k_=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[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(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof na?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])}},i4=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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 Xt(r){if(Gn(r))return r;if(Ei(r))return{[Symbol.iterator](){return r}};if(typeof r=="object"&&r!==null)return function*(){for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(yield[e,r[e]])}();throw new Dr("Given collection is not iterable or iterator.")}function Qt(r){if(Fa(r))return r;if(Ei(r))return{[Symbol.asyncIterator](){return k_(this,arguments,function*(){for(;;){let t=yield na(r.next());if(t.done)return yield na(void 0);yield yield na(t.value)}})}};if(typeof r=="object"&&r!==null&&(r=Xt(r)),Gn(r))return{[Symbol.asyncIterator](){return k_(this,arguments,function*(){for(let t of r)yield yield na(t)})}};throw new Dr("Given collection is not async iterable or iterator.")}function NL(r){if(Ei(r))return r;if(Gn(r))return function*(){for(let e of r)yield e}();throw new Dr("Given collection is not iterable or iterator.")}function CL(r){if((Ei(r)||Gn(r))&&(r=Qt(r)),Fa(r))return function(){return k_(this,arguments,function*(){var e,t,n,i;try{for(var a=!0,o=i4(r),l;l=yield na(o.next()),e=l.done,!e;){i=l.value,a=!1;try{yield yield na(i)}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield na(n.call(o)))}finally{if(t)throw t.error}}})}();throw new Dr("Given collection is not iterable or iterator.")}function L_(r){let e=[];for(let t of Xt(r))e.push(t);return e}function Yl(r){var e,t,n,i;return AJ(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,l=i4(Qt(r)),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&&(n=l.return)&&(yield n.call(l))}finally{if(t)throw t.error}}return a})}var bo=function(r){return this instanceof bo?(this.v=r,this):new bo(r)},DJ=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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)}},EJ=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[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(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof bo?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*U_(r,e){let t=new Set;if(r instanceof Map){e===void 0&&(e=n=>n[1]);for(let n of r){let i=e(n);t.has(i)||(yield n,t.add(i))}}else{e===void 0&&(e=n=>n);for(let n of Xt(r)){let i=e(n);t.has(i)||(yield n,t.add(i))}}}function a4(r,e){return EJ(this,arguments,function*(){var n,i,a,o;let l=new Set;if(r instanceof Map)for(let f of U_(r,e))yield yield bo(yield bo(f));else{e===void 0&&(e=f=>f);try{for(var u=!0,s=DJ(Qt(r)),c;c=yield bo(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o,p=e(f);l.has(p)||(yield yield bo(f),l.add(p))}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield bo(a.call(s)))}finally{if(i)throw i.error}}}})}var Rr=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[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)}},We=function(r){return this instanceof We?(this.v=r,this):new We(r)},Zr=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[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(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof We?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*o4(r,e){for(let t of Xt(r))yield e(t)}function Um(r,e){return Zr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Rr(Qt(r)),s;s=yield We(u.next()),n=s.done,!n;){o=s.value,l=!1;try{yield yield We(yield We(e(o)))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield We(a.call(u)))}finally{if(i)throw i.error}}})}function*s4(r,e){for(let[t,n]of IL(r,e))n&&(yield t)}function u4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Rr(BL(r,e)),s;s=yield We(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let[c,f]=o;f&&(yield yield We(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield We(a.call(u)))}finally{if(i)throw i.error}}})}function*l4(r,e){let t=!0;for(let n of Xt(r)){if(t){if(!e(n)){t=!1,yield n;continue}continue}yield n}}function c4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;let l=!0;try{for(var u=!0,s=Rr(Qt(r)),c;c=yield We(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o;if(l){if(!(yield We(e(f)))){l=!1,yield yield We(f);continue}continue}yield yield We(f)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield We(a.call(s)))}finally{if(i)throw i.error}}})}function*f4(r,e){for(let t of Xt(r))if(e(t))yield t;else break}function p4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Rr(Qt(r)),s;s=yield We(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let c=o;if(yield We(e(c)))yield yield We(c);else break}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield We(a.call(u)))}finally{if(i)throw i.error}}})}function*m4(r,e){if(e<0)throw new Dr(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield r}function d4(r,e){return Zr(this,arguments,function*(){if(e<0)throw new Dr(`Number of repetitions cannot be negative: ${e}`);let n=yield We(r);for(let i=e;i>0;--i)yield yield We(n)})}function*h4(r,e){for(let t of Xt(r)){let n=e(t,e);if(Gn(n))for(let i of Xt(n))yield i;else yield n}}function g4(r,e){return Zr(this,arguments,function*(){var n,i,a,o,l,u,s,c;try{for(var f=!0,p=Rr(Qt(r)),m;m=yield We(p.next()),n=m.done,!n;){o=m.value,f=!1;try{let w=yield We(e(o,e));if(Gn(w)||Fa(w))try{for(var h=!0,d=(u=void 0,Rr(Qt(w))),g;g=yield We(d.next()),l=g.done,!l;){c=g.value,h=!1;try{yield yield We(c)}finally{h=!0}}}catch(y){u={error:y}}finally{try{!h&&!l&&(s=d.return)&&(yield We(s.call(d)))}finally{if(u)throw u.error}}else yield yield We(w)}finally{f=!0}}}catch(v){i={error:v}}finally{try{!f&&!n&&(a=p.return)&&(yield We(a.call(p)))}finally{if(i)throw i.error}}})}function*V_(r,e=1/0){if(e<1){for(let t of Xt(r))r instanceof Map&&(t=t[1]),yield t;return}for(let t of Xt(r))if(r instanceof Map&&(t=t[1]),(Gn(t)||Ei(t))&&!ra(t))for(let n of V_(t,e-1))yield n;else yield t}function q_(r,e=1/0){return Zr(this,arguments,function*(){var n,i,a,o,l,u,s,c,f,p,m,h;if(e<1){try{for(var d=!0,g=Rr(Qt(r)),v;v=yield We(g.next()),n=v.done,!n;){o=v.value,d=!1;try{let S=o;r instanceof Map&&(S=S[1]),yield yield We(S)}finally{d=!0}}}catch(S){i={error:S}}finally{try{!d&&!n&&(a=g.return)&&(yield We(a.call(g)))}finally{if(i)throw i.error}}return yield We(void 0)}try{for(var w=!0,y=Rr(Qt(r)),x;x=yield We(y.next()),l=x.done,!l;){c=x.value,w=!1;try{let S=c;if(r instanceof Map&&(S=S[1]),(Fa(S)||Gn(S)||Ei(S))&&!ra(S))try{for(var _=!0,b=(p=void 0,Rr(q_(S,e-1))),D;D=yield We(b.next()),f=D.done,!f;){h=D.value,_=!1;try{yield yield We(h)}finally{_=!0}}}catch(A){p={error:A}}finally{try{!_&&!f&&(m=b.return)&&(yield We(m.call(b)))}finally{if(p)throw p.error}}else yield yield We(S)}finally{w=!0}}}catch(S){u={error:S}}finally{try{!w&&!l&&(s=y.return)&&(yield We(s.call(y)))}finally{if(u)throw u.error}}})}function*v4(r,e){for(let t of Xt(r))e(t)&&(yield t)}function y4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Rr(Qt(r)),s;s=yield We(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let c=o;(yield We(e(c)))&&(yield yield We(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield We(a.call(u)))}finally{if(i)throw i.error}}})}function*Vm(r,e,t,n=!0){if(e<1)throw new Dr(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new Dr("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Xt(r))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&n&&(yield i)}function qm(r,e,t,n=!0){return Zr(this,arguments,function*(){var a,o,l,u;if(e<1)throw new Dr(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new Dr("Overlap size must be less than chunk size");let s=[],c=!1;try{for(var f=!0,p=Rr(Qt(r)),m;m=yield We(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 We(s),s=s.slice(e-t),c=!0)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(l=p.return)&&(yield We(l.call(p)))}finally{if(o)throw o.error}}!c&&s.length>0&&n&&(yield yield We(s))})}function*b4(r,e){for(let t of Vm(r,e,0))yield t}function x4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Rr(qm(r,e,0)),s;s=yield We(u.next()),n=s.done,!n;){o=s.value,l=!1;try{yield yield We(o)}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield We(a.call(u)))}finally{if(i)throw i.error}}})}function*us(r){let e=Vm(r,2,1,!1);for(let t of e)yield t}function Xl(r){return Zr(this,arguments,function*(){var t,n,i,a;let o=qm(r,2,1,!1);try{for(var l=!0,u=Rr(o),s;s=yield We(u.next()),t=s.done,!t;){a=s.value,l=!1;try{yield yield We(a)}finally{l=!0}}}catch(c){n={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield We(i.call(u)))}finally{if(n)throw n.error}}})}function*w4(r,e){if(e<0)throw new Dr(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let n of Xt(r)){if(t>=e)return;yield n,++t}}function _4(r,e){return Zr(this,arguments,function*(){var n,i,a,o;if(e<0)throw new Dr(`Limit must be \u2265 0. Got ${e}`);let l=0;try{for(var u=!0,s=Rr(Qt(r)),c;c=yield We(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o;if(l>=e)return yield We(void 0);yield yield We(f),++l}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield We(a.call(s)))}finally{if(i)throw i.error}}})}function*A4(r){let e=0;for(let t of Xt(r))yield[e++,t]}function D4(r){return Zr(this,arguments,function*(){var t,n,i,a;let o=0;try{for(var l=!0,u=Rr(Qt(r)),s;s=yield We(u.next()),t=s.done,!t;){a=s.value,l=!1;try{let c=a;yield yield We([o++,c])}finally{l=!0}}}catch(c){n={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield We(i.call(u)))}finally{if(n)throw n.error}}})}function*E4(r,e=0,t,n=1){if(e<0)throw new Dr("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new Dr("Parameter 'count' cannot be negative");if(n<=0)throw new Dr("Parameter 'step' must be positive");let i=0,a=0;for(let o of Xt(r))if(!(i++<e||(i-e-1)%n!==0)){if(a++===t&&t!==void 0)break;yield o}}function S4(r,e=0,t,n=1){return Zr(this,arguments,function*(){var a,o,l,u;if(e<0)throw new Dr("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new Dr("Parameter 'count' cannot be negative");if(n<=0)throw new Dr("Parameter 'step' must be positive");let s=0,c=0;try{for(var f=!0,p=Rr(Qt(r)),m;m=yield We(p.next()),a=m.done,!a;){u=m.value,f=!1;try{let h=u;if(s++<e||(s-e-1)%n!==0)continue;if(c++===t&&t!==void 0)break;yield yield We(h)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(l=p.return)&&(yield We(l.call(p)))}finally{if(o)throw o.error}}})}function*N4(r){for(let[e]of Xt(r))yield e}function C4(r){return Zr(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=Rr(Qt(r)),u;u=yield We(l.next()),t=u.done,!t;){a=u.value,o=!1;try{let[s]=a;yield yield We(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield We(i.call(l)))}finally{if(n)throw n.error}}})}function*M4(r,e,t=0){if(e<0||t<0)throw new Dr;let n=-t;for(let i of Xt(r))(n<0||n>=e)&&(yield i),++n}function T4(r,e,t=0){return Zr(this,arguments,function*(){var i,a,o,l;if(e<0||t<0)throw new Dr;let u=-t;try{for(var s=!0,c=Rr(Qt(r)),f;f=yield We(c.next()),i=f.done,!i;){l=f.value,s=!1;try{let p=l;(u<0||u>=e)&&(yield yield We(p)),++u}finally{s=!0}}}catch(p){a={error:p}}finally{try{!s&&!i&&(o=c.return)&&(yield We(o.call(c)))}finally{if(a)throw a.error}}})}function*F4(r){for(let[,e]of Xt(r))yield e}function I4(r){return Zr(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=Rr(Qt(r)),u;u=yield We(l.next()),t=u.done,!t;){a=u.value,o=!1;try{let[,s]=a;yield yield We(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield We(i.call(l)))}finally{if(n)throw n.error}}})}function*B4(r,e,t){let n=new Map,i=a=>{n.has(a)||(t!==void 0?n.set(a,{}):n.set(a,[]))};for(let a of Xt(r)){let o=e(a),l=t!==void 0?t(a):void 0,u=(Gn(o)||Ei(o))&&!ra(o)?o:[o];for(let s of U_(u))i(s),l===void 0?n.get(s).push(a):n.get(s)[l]=a}for(let a of n)yield a}function P4(r,e,t){return Zr(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=Rr(Qt(r)),g;g=yield We(d.next()),i=g.done,!i;){l=g.value,h=!1;try{let x=l,_=yield We(e(x)),b=t!==void 0?yield We(t(x)):void 0,D=(Fa(_)||Gn(_)||Ei(_))&&!ra(_)?_:[_];try{for(var v=!0,w=(s=void 0,Rr(a4(D))),y;y=yield We(w.next()),u=y.done,!u;){f=y.value,v=!1;try{let S=f;m(S),b===void 0?p.get(S).push(x):p.get(S)[b]=x}finally{v=!0}}}catch(S){s={error:S}}finally{try{!v&&!u&&(c=w.return)&&(yield We(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 We(o.call(d)))}finally{if(a)throw a.error}}for(let x of p)yield yield We(x)})}function*O4(r,e){let t=L_(r);e!==void 0?t.sort(e):t.sort();for(let n of t)yield n}function R4(r,e){return Zr(this,arguments,function*(){let n=yield We(Yl(r));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield We(i)})}var ML={chunkwise:b4,chunkwiseOverlap:Vm,compress:s4,dropWhile:l4,enumerate:A4,filter:v4,flatMap:h4,flatten:V_,groupBy:B4,keys:N4,limit:w4,map:o4,pairwise:us,repeat:m4,skip:M4,slice:E4,sort:O4,takeWhile:f4,values:F4,chunkwiseAsync:x4,chunkwiseOverlapAsync:qm,compressAsync:u4,dropWhileAsync:c4,enumerateAsync:D4,filterAsync:y4,flatMapAsync:g4,flattenAsync:q_,groupByAsync:P4,keysAsync:C4,limitAsync:_4,mapAsync:Um,pairwiseAsync:Xl,repeatAsync:d4,skipAsync:T4,sliceAsync:S4,sortAsync:R4,takeWhileAsync:p4,valuesAsync:I4};var k4={allMatch:LL,allUnique:VL,anyMatch:zL,exactlyN:HL,isEmpty:WL,isAsyncIterable:Fa,isIterable:Gn,isIterator:Ei,isReversed:ZL,isSorted:YL,isString:ra,noneMatch:QL,same:e4,sameCount:r4,allMatchAsync:UL,allUniqueAsync:qL,anyMatchAsync:$L,exactlyNAsync:GL,isEmptyAsync:jL,isReversedAsync:JL,isSortedAsync:XL,noneMatchAsync:KL,sameAsync:t4,sameCountAsync:n4};function L4(r){return ls.ViewPlugin.fromClass(class{constructor(e){var t;this.component=new zm.Component,this.component.load(),this.decorations=(t=this.renderWidgets(e))!=null?t:ls.Decoration.none}isLivePreview(e){return e.field(zm.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,n,i)=>{var o,l;return k4.anyMatch(e.visibleRanges,u=>Ca.checkRangeOverlap(t,n,u.from,u.to))?!0:((l=(o=i.spec).mb_unload)==null||l.call(o),!1)}});for(let{from:t,to:n}of e.visibleRanges)(0,z_.syntaxTree)(e.state).iterate({from:t,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,t){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,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,n,i,a){let o=e.from-1,l=e.to+1;if(Ca.existsDecorationOfTypeBetween(this.decorations,n,o,l))return;let u=Ca.getCurrentFile(t);if(!u)return;let s=this.renderWidget(e,a,n,i,u),c=Array.isArray(s)?s:[s];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,t){var i;let n=new Set((i=t.type.name)==null?void 0:i.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let a=e.state.selection,o=Ca.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)&&r.settings.enableSyntaxHighlighting,content:l.content,widgetType:l.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,n){let i=Ca.getContent(e.state,t,n);return{content:i,widgetType:In.isDeclarationAndGetMDRCType(i)}}renderWidgets(e){let t=Ca.getCurrentFile(e);if(!t)return;let n=[];for(let i of e.visibleRanges)(0,z_.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)?n.push(...u):n.push(u))}});return ls.Decoration.set(n,!0)}renderWidget(e,t,n,i,a){if(n==="field"){let o=In.constructMDRCWidget(t,i,a.path,this.component,r);return ls.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 r.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(l=>ls.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 $m=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 U4=require("obsidian");var Hm=class{constructor(e){this.app=e.app,this.plugin=e}getMetadataAndExtraCache(e){var i,a;if(e.bindTarget===void 0)throw new Eo({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 U4.TFile))throw new Eo({errorLevel:"CRITICAL",effect:"can not get metadata and extra cache",cause:"bind target file path does not point to a tFile"});let n=(i=this.plugin.app.metadataCache.getFileCache(t))==null?void 0:i.frontmatter;return{extraCache:{file:t},metadata:(a=structuredClone(n))!=null?a:{}}}setManagerInstance(e){this.manager=e}async updateMetadata(e,t){let n=t.extraCache.file;await this.plugin.app.fileManager.processFrontMatter(n,i=>{t.changed=!1,Object.assign(i,t.metadata)})}load(){this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(e,t,n)=>{var i,a;(a=this.manager)==null||a.updateCacheOnExternalFrontmatterUpdate(e.path,(i=n.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 n;(n=this.manager)==null||n.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 V4=require("obsidian");var $_=8,Ql=class extends hn{constructor(e,t,n,i,a,o){super(e,"block",n,i,a),this.content=t,this.depth=o}async parseContent(){let e=this.content.split(`
`).map(o=>o.trim()).filter(o=>o.length>0);if(e.length===0)return"";if(e.length>1)throw new vs({errorLevel:"ERROR",effect:"can not create embed",cause:"embed may only contain one link"});let t=e[0],n=sn.parseLink(t);if(!n.internal)throw new vs({errorLevel:"ERROR",effect:"can not create embed",cause:"embed link is not an internal link"});let i=this.plugin.app.metadataCache.getFirstLinkpathDest(n.target,this.filePath);if(i===null)throw new vs({errorLevel:"ERROR",effect:"can not create embed",cause:"link target not found"});return(await this.plugin.app.vault.cachedRead(i)).replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`)}async onload(){if(console.log("meta-bind | EmbedMDRC >> unload",this),this.plugin.mdrcManager.registerMDRC(this),this.depth>=$_)this.containerEl.empty(),this.containerEl.addClass("mb-error"),this.containerEl.innerText="Max embed depth reached";else{let e=await this.parseContent();await V4.MarkdownRenderer.render(this.plugin.app,e,this.containerEl,this.filePath,this)}}onunload(){console.log("meta-bind | EmbedMDRC >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),fi(this.containerEl,"embed"),super.onunload()}};var $i=require("obsidian");var Kl=require("obsidian"),Gm=class extends Kl.Modal{constructor(e,t,n,i,a,o,l){super(e),this.value=t,this.title=n,this.subTitle=i,this.description=a,this.onSubmit=o,this.onCancel=l}onOpen(){this.contentEl.empty(),this.contentEl.createEl("h2",{text:this.title});let e=new Kl.Setting(this.contentEl);e.setName(this.subTitle),e.setDesc(this.description),e.addText(n=>{n.setValue(this.value),n.setPlaceholder(this.subTitle),n.onChange(i=>{this.value=i})});let t=new Kl.Setting(this.contentEl);t.addButton(n=>{n.setButtonText("Apply"),n.setCta(),n.onClick(()=>{this.onSubmit(this.value),this.close()})}),t.addButton(n=>{n.setButtonText("Cancel"),n.onClick(()=>{this.onCancel(),this.close()})})}onClose(){super.onClose()}};var z4=require("obsidian");var q4=require("obsidian"),Wm=class extends q4.FuzzySuggestModal{constructor(e,t,n){super(e),this.options=t,this.onSelect=n}getItemText(e){return e.displayValue}getItems(){return this.options}onChooseItem(e,t){this.onSelect(e)}};var xo=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 SJ(r,e,t,n,i){let a=[];for(let o of t)a.push(new xo(o.value,o.name));if(n.length>0){let o;try{o=bD(r)}catch(u){return new z4.Notice("meta-bind | Dataview needs to be installed and enabled to use suggest option queries. Check the console for more information."),console.warn("meta-bind | failed to get dataview api",u),a}let l=Le.object({name:Le.string().min(1),path:Le.string().min(1)});for(let u of n)o.pages(u.value,e).forEach(c=>{try{let f=c.file;if(!l.safeParse(f).success)return;let p=xD(f.path,f.name,i);a.push(new xo(p,`file: ${f.name}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function NJ(r,e){let t=r.base.getArguments("option"),n=r.base.getArguments("optionQuery"),i=r.base.getArgument("useLinks");return SJ(e,r.base.getFilePath(),t,n,i===void 0?"true":i.value)}function $4(r,e,t){new Wm(t.app,NJ(r,t),e).open()}var Wn=require("obsidian");var J4=require("obsidian");function CJ(r){Xr(r,"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 MJ(r){let e,t,n,i,a,o,l,u;return{c(){e=Z("div"),t=Z("img"),i=fe(),a=Z("span"),o=Be(r[0]),R(t,"class","image-card-image svelte-1m4qg39"),fs(t.src,n=Rs(r[0]))||R(t,"src",n),R(t,"alt",r[0]),R(a,"class","image-card-text svelte-1m4qg39"),R(e,"class","image-card svelte-1m4qg39"),R(e,"role","button"),R(e,"tabindex","0")},m(s,c){Q(s,e,c),$(e,t),$(e,i),$(e,a),$(a,o),l||(u=[xe(e,"click",r[3]),xe(e,"keydown",r[4])],l=!0)},p(s,[c]){c&1&&!fs(t.src,n=Rs(s[0]))&&R(t,"src",n),c&1&&R(t,"alt",s[0]),c&1&&nt(o,s[0])},i:Fe,o:Fe,d(s){s&&X(e),l=!1,ot(u)}}}function TJ(r,e,t){let{image:n}=e,{onSelect:i}=e;function a(u,s){u.key===" "&&i(s)}let o=()=>i(n),l=u=>a(u,n);return r.$$set=u=>{"image"in u&&t(0,n=u.image),"onSelect"in u&&t(1,i=u.onSelect)},[n,i,a,o,l]}var H_=class extends Ve{constructor(e){super(),ze(this,e,TJ,MJ,qe,{image:0,onSelect:1},CJ)}},H4=H_;var j4=require("obsidian");function G4(r,e,t){let n=r.slice();return n[6]=e[t],n}function W4(r){let e,t;return e=new H4({props:{image:r[6].value,onSelect:r[0]}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i&4&&(a.image=n[6].value),i&1&&(a.onSelect=n[0]),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function FJ(r){let e,t,n,i,a,o,l,u=je(r[2]),s=[];for(let f=0;f<u.length;f+=1)s[f]=W4(G4(r,u,f));let c=f=>oe(s[f],1,1,()=>{s[f]=null});return{c(){e=Z("div"),t=Z("input"),n=fe(),i=Z("div");for(let f=0;f<s.length;f+=1)s[f].c();R(t,"type","text"),R(t,"placeholder","Search Images..."),R(e,"class","mb-image-search-container"),R(i,"class","mb-image-card-grid")},m(f,p){Q(f,e,p),$(e,t),Ye(t,r[1]),Q(f,n,p),Q(f,i,p);for(let m=0;m<s.length;m+=1)s[m]&&s[m].m(i,null);a=!0,o||(l=xe(t,"input",r[4]),o=!0)},p(f,[p]){if(p&2&&t.value!==f[1]&&Ye(t,f[1]),p&5){u=je(f[2]);let m;for(m=0;m<u.length;m+=1){let h=G4(f,u,m);s[m]?(s[m].p(h,p),te(s[m],1)):(s[m]=W4(h),s[m].c(),te(s[m],1),s[m].m(i,null))}for(vt(),m=u.length;m<s.length;m+=1)c(m);yt()}},i(f){if(!a){for(let p=0;p<u.length;p+=1)te(s[p]);a=!0}},o(f){s=s.filter(Boolean);for(let p=0;p<s.length;p+=1)oe(s[p]);a=!1},d(f){f&&(X(e),X(n),X(i)),Nt(s,f),o=!1,l()}}}function IJ(r,e,t){let{options:n}=e,{onSelect:i}=e,a="",o;function l(s){var c;if(!s){t(2,o=n);return}let f=(0,j4.prepareFuzzySearch)(s),p=[];for(let m of n)((c=f(m.value))===null||c===void 0?void 0:c.score)!==void 0&&p.push(m);t(2,o=p)}function u(){a=this.value,t(1,a)}return r.$$set=s=>{"options"in s&&t(3,n=s.options),"onSelect"in s&&t(0,i=s.onSelect)},r.$$.update=()=>{r.$$.dirty&2&&l(a)},[i,a,o,n,u]}var G_=class extends Ve{constructor(e){super(),ze(this,e,IJ,FJ,qe,{options:3,onSelect:0})}},Z4=G_;var jm=class extends J4.Modal{constructor(e,t,n){super(e),this.options=t,this.onSelect=n}onOpen(){this.modalEl.style.width="100%",new Z4({target:this.contentEl,props:{options:this.options,onSelect:e=>{this.onSelect(e),this.close()}}})}};function Y4(r){let e=[];for(let t of r.children)t instanceof Wn.TFile&&X4(t.extension)&&e.push(new xo(t.path,t.name)),t instanceof Wn.TFolder&&e.push(...Y4(t));return e}function BJ(r,e,t){let n=[];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 er({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 Wn.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 er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof Wn.TFolder)){let l=new er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}n.push(...Y4(o))}for(let i of r){let a=Gu(i.value);if(!a){let l=new er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let l=new er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof Wn.TFile)){let l=new er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!X4(o.extension)){let l=new er({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Wn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}n.push(new xo(o.path,o.name))}return n}function X4(r){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(r)}function PJ(r,e){let t=r.base.getArguments("option"),n=r.base.getArguments("optionQuery");return BJ(t,n,e)}function Q4(r,e,t){new jm(t.app,PJ(r,t),e).open()}var i5=require("obsidian");var t5=require("obsidian");function OJ(r){Xr(r,"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 K4(r,e,t){let n=r.slice();return n[10]=e[t],n}function RJ(r,e,t){let n=r.slice();return n[13]=e[t],n}function kJ(r){let e,t,n;return{c(){e=Z("div"),t=Z("span"),t.textContent=`${r[13]}`,n=fe(),R(t,"class","cell-text svelte-12l82wb"),R(e,"class","cell header-cell svelte-12l82wb")},m(i,a){Q(i,e,a),$(e,t),$(e,n)},p:Fe,d(i){i&&X(e)}}}function e5(r,e){let t,n,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:r,first:null,c(){var f,p,m;t=Z("div"),n=Z("span"),a=Be(i),o=fe(),R(n,"class","cell-text svelte-12l82wb"),R(t,"class","cell svelte-12l82wb"),R(t,"role","button"),R(t,"tabindex","0"),At(t,"highlight",e[10]),At(t,"content-cell",e[10]),At(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){Q(f,t,p),$(t,n),$(n,a),$(t,o),l||(u=[xe(t,"click",s),xe(t,"keydown",c)],l=!0)},p(f,p){var m,h,d;e=f,p&8&&i!==(i=(e[10]||"")+"")&&nt(a,i),p&8&&At(t,"highlight",e[10]),p&8&&At(t,"content-cell",e[10]),p&15&&At(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&&X(t),l=!1,ot(u)}}}function LJ(r){let e,t,n,i,a=[],o=new Map,l=je(DL()),u=[];for(let f=0;f<l.length;f+=1)u[f]=kJ(RJ(r,l,f));let s=je(r[3]),c=f=>EL();for(let f=0;f<s.length;f+=1){let p=K4(r,s,f),m=c(p);o.set(m,a[f]=e5(m,p))}return{c(){e=Z("div"),t=Z("div");for(let f=0;f<u.length;f+=1)u[f].c();n=fe(),i=Z("div");for(let f=0;f<a.length;f+=1)a[f].c();R(t,"class","calendar-header svelte-12l82wb"),R(i,"class","calendar-content svelte-12l82wb"),R(e,"class","calendar svelte-12l82wb")},m(f,p){Q(f,e,p),$(e,t);for(let m=0;m<u.length;m+=1)u[m]&&u[m].m(t,null);$(e,n),$(e,i);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(i,null)},p(f,[p]){p&63&&(s=je(f[3]),a=hs(a,p,c,1,f,s,o,i,fA,e5,null,K4))},i:Fe,o:Fe,d(f){f&&X(e),Nt(u,f);for(let p=0;p<a.length;p+=1)a[p].d()}}}function UJ(r,e,t){let n=Pu(),{selectedDate:i}=e,{month:a}=e,{year:o}=e,l;function u(m){n("dateChange",(0,t5.moment)(new Date(o,a,m)))}function s(m){m&&u(m)}function c(m,h){m.key===" "&&s(h)}let f=m=>s(m),p=(m,h)=>c(h,m);return r.$$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)},r.$$.update=()=>{r.$$.dirty&6&&t(3,l=AL(a,o))},[i,a,o,l,s,c,f,p]}var W_=class extends Ve{constructor(e){super(),ze(this,e,UJ,LJ,qe,{selectedDate:0,month:1,year:2},OJ)}},r5=W_;var j_=require("obsidian");function VJ(r){Xr(r,"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 qJ(r){let e,t,n,i,a,o,l=B_(r[1])+"",u,s,c,f,p,m,h,d,g,v,w,y,x,_;return d=new r5({props:{month:r[1],year:r[2],selectedDate:r[0]}}),d.$on("dateChange",r[6]),{c(){e=Z("div"),t=Z("div"),n=Z("button"),n.textContent="Prev",i=fe(),a=Z("div"),o=Z("span"),u=Be(l),s=fe(),c=Z("input"),p=fe(),m=Z("button"),m.textContent="Next",h=fe(),Ce(d.$$.fragment),g=fe(),v=Z("div"),w=Z("button"),w.textContent="Set no Date",R(n,"class","month-switch-button svelte-berpp6"),R(o,"class","date-picker-header-text-month svelte-berpp6"),R(c,"class","date-picker-header-text-year svelte-berpp6"),R(c,"type","number"),c.value=f=r[2].toString(),R(a,"class","date-picker-header-text svelte-berpp6"),R(m,"class","month-switch-button svelte-berpp6"),R(t,"class","date-picker-header svelte-berpp6"),R(w,"class","none-button svelte-berpp6"),R(v,"class","date-picker-footer svelte-berpp6"),R(e,"class","date-picker svelte-berpp6")},m(b,D){Q(b,e,D),$(e,t),$(t,n),$(t,i),$(t,a),$(a,o),$(o,u),$(a,s),$(a,c),$(t,p),$(t,m),$(e,h),Se(d,e,null),$(e,g),$(e,v),$(v,w),y=!0,x||(_=[xe(n,"click",r[4]),xe(c,"input",r[5]),xe(m,"click",r[3]),xe(w,"click",r[7])],x=!0)},p(b,[D]){(!y||D&2)&&l!==(l=B_(b[1])+"")&&nt(u,l),(!y||D&4&&f!==(f=b[2].toString())&&c.value!==f)&&(c.value=f);let S={};D&2&&(S.month=b[1]),D&4&&(S.year=b[2]),D&1&&(S.selectedDate=b[0]),d.$set(S)},i(b){y||(te(d.$$.fragment,b),y=!0)},o(b){oe(d.$$.fragment,b),y=!1},d(b){b&&X(e),Ne(d),x=!1,ot(_)}}}function zJ(r,e,t){let{selectedDate:n=(0,j_.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,n=p.detail),i(p.detail)}function f(){t(0,n=null),i(null)}return r.$$set=p=>{"selectedDate"in p&&t(0,n=p.selectedDate),"dateChangeCallback"in p&&t(8,i=p.dateChangeCallback)},r.$$.update=()=>{if(r.$$.dirty&1)if(n)t(1,a=n.month()),t(2,o=n.year());else{let p=(0,j_.moment)();t(1,a=p.month()),t(2,o=p.year())}},[n,a,o,l,u,s,c,f,i]}var Z_=class extends Ve{constructor(e){super(),ze(this,e,zJ,qJ,qe,{selectedDate:0,dateChangeCallback:8},VJ)}},n5=Z_;var Zm=class extends i5.Modal{constructor(e,t){super(e),this.datePicker=t}onOpen(){this.datePickerInput=new n5({target:this.contentEl,props:{selectedDate:this.datePicker.getInternalValue(),dateChangeCallback:e=>{this.datePicker.setInternalValue(e),this.close()}}})}onClose(){var e;(e=this.datePickerInput)==null||e.$destroy()}};var Jm=class{constructor(e){this.plugin=e,this.app=e.app}openDatePickerModal(e){new Zm(this.app,e).open()}openImageSuggesterModal(e,t){Q4(e,t,this.plugin)}openSuggesterModal(e,t){$4(e,t,this.plugin)}openTextPromptModal(e,t,n,i,a,o){new Gm(this.app,e,t,n,i,a,o).open()}async renderMarkdown(e,t,n){let i=new $i.Component;return await $i.MarkdownRenderer.render(this.app,e,t,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}async jsEngineRunFile(e,t,n){let i=Io(this.plugin),a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof $i.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new $i.Component;return await i.internal.executeFile(e,{component:l,container:n,context:{metadata:o,file:a,line:0}}),()=>l.unload()}async jsEngineRunCode(e,t,n){let i=Io(this.plugin),a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof $i.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new $i.Component;return await i.internal.execute({code:e,component:l,container:n,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}showNotice(e){new $i.Notice(e)}};var w5=require("obsidian");function $J(r){Xr(r,"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 HJ(r){var d,g;let e,t,n,i=((d=r[0])!=null?d:"")+"",a,o,l,u=((g=r[1])!=null?g:"")+"",s,c,f,p,m=r[5].default,h=ia(m,r,r[4],null);return{c(){e=Z("div"),t=Z("div"),n=Z("div"),a=Be(i),o=fe(),l=Z("div"),s=Be(u),c=fe(),f=Z("div"),h&&h.c(),R(n,"class","setting-item-name"),R(l,"class","setting-item-description"),R(t,"class","setting-item-info"),R(f,"class","setting-item-control svelte-17mpvkc"),At(f,"vertical-control",r[3]),R(e,"class","setting-item svelte-17mpvkc"),At(e,"setting-item-heading",r[2]),At(e,"vertical",r[3])},m(v,w){Q(v,e,w),$(e,t),$(t,n),$(n,a),$(t,o),$(t,l),$(l,s),$(e,c),$(e,f),h&&h.m(f,null),p=!0},p(v,[w]){var y,x;(!p||w&1)&&i!==(i=((y=v[0])!=null?y:"")+"")&&nt(a,i),(!p||w&2)&&u!==(u=((x=v[1])!=null?x:"")+"")&&nt(s,u),h&&h.p&&(!p||w&16)&&oa(h,m,v,v[4],p?aa(m,v[4],w,null):sa(v[4]),null),(!p||w&8)&&At(f,"vertical-control",v[3]),(!p||w&4)&&At(e,"setting-item-heading",v[2]),(!p||w&8)&&At(e,"vertical",v[3])},i(v){p||(te(h,v),p=!0)},o(v){oe(h,v),p=!1},d(v){v&&X(e),h&&h.d(v)}}}function GJ(r,e,t){let{$$slots:n={},$$scope:i}=e,{name:a=void 0}=e,{description:o=void 0}=e,{heading:l=!1}=e,{vertical:u=!1}=e;return r.$$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,n]}var J_=class extends Ve{constructor(e){super(),ze(this,e,GJ,HJ,qe,{name:0,description:1,heading:2,vertical:3},$J)}},Jr=J_;var b5=require("obsidian");var a5=require("obsidian"),Ym=class extends a5.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.commands.listCommands()}getItemText(e){return e.name}onChooseItem(e,t){this.selectCallback(e)}};var Qm=require("obsidian"),Xm=class extends Qm.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Qm.TFolder)}getItemText(e){return e.path}onChooseItem(e,t){this.selectCallback(e)}};var ed=require("obsidian"),Km=class extends ed.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof ed.TFile)}getItemText(e){return e.path}onChooseItem(e,t){this.selectCallback(e)}};function WJ(r){let e,t,n,i;return{c(){e=Z("div"),t=Z("input"),R(t,"type","checkbox"),R(t,"tabindex","-1"),t.checked=r[0],R(e,"class","checkbox-container"),R(e,"role","switch"),R(e,"tabindex","0"),R(e,"aria-checked",r[0]),At(e,"is-enabled",r[0])},m(a,o){Q(a,e,o),$(e,t),n||(i=xe(e,"click",r[1]),n=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&R(e,"aria-checked",a[0]),o&1&&At(e,"is-enabled",a[0])},i:Fe,o:Fe,d(a){a&&X(e),n=!1,i()}}}function jJ(r,e,t){let{checked:n}=e,i=()=>t(0,n=!n);return r.$$set=a=>{"checked"in a&&t(0,n=a.checked)},[n,i]}var Y_=class extends Ve{constructor(e){super(),ze(this,e,jJ,WJ,qe,{checked:0})}},td=Y_;function o5(r,e,t){let n=r.slice();return n[42]=e[t],n[43]=e,n[44]=t,n}function s5(r,e,t){let n=r.slice();return n[45]=e[t],n}function u5(r,e,t){let n=r.slice();return n[45]=e[t],n}function ZJ(r){let e,t,n;return{c(){e=Z("input"),R(e,"type","text")},m(i,a){Q(i,e,a),Ye(e,r[1].label),t||(n=xe(e,"input",r[10]),t=!0)},p(i,a){a[0]&2&&e.value!==i[1].label&&Ye(e,i[1].label)},d(i){i&&X(e),t=!1,n()}}}function l5(r){let e,t=r[45]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[45],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p:Fe,d(a){a&&X(e)}}}function JJ(r){let e,t,n,i=je(Object.values(fa)),a=[];for(let o=0;o<i.length;o+=1)a[o]=l5(u5(r,i,o));return{c(){e=Z("select");for(let o=0;o<a.length;o+=1)a[o].c();R(e,"class","dropdown"),r[1].style===void 0&&Qr(()=>r[11].call(e))},m(o,l){Q(o,e,l);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(e,null);Mr(e,r[1].style,!0),t||(n=xe(e,"change",r[11]),t=!0)},p(o,l){if(l&0){i=je(Object.values(fa));let u;for(u=0;u<i.length;u+=1){let s=u5(o,i,u);a[u]?a[u].p(s,l):(a[u]=l5(s),a[u].c(),a[u].m(e,null))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}l[0]&2&&Mr(e,o[1].style)},d(o){o&&X(e),Nt(a,o),t=!1,n()}}}function YJ(r){let e,t,n;return{c(){e=Z("input"),R(e,"type","text")},m(i,a){Q(i,e,a),Ye(e,r[1].class),t||(n=xe(e,"input",r[12]),t=!0)},p(i,a){a[0]&2&&e.value!==i[1].class&&Ye(e,i[1].class)},d(i){i&&X(e),t=!1,n()}}}function XJ(r){let e,t,n;return{c(){e=Z("input"),R(e,"type","text")},m(i,a){Q(i,e,a),Ye(e,r[1].tooltip),t||(n=xe(e,"input",r[13]),t=!0)},p(i,a){a[0]&2&&e.value!==i[1].tooltip&&Ye(e,i[1].tooltip)},d(i){i&&X(e),t=!1,n()}}}function QJ(r){let e,t,n;return{c(){e=Z("input"),R(e,"type","text")},m(i,a){Q(i,e,a),Ye(e,r[1].id),t||(n=xe(e,"input",r[14]),t=!0)},p(i,a){a[0]&2&&e.value!==i[1].id&&Ye(e,i[1].id)},d(i){i&&X(e),t=!1,n()}}}function KJ(r){let e,t,n;function i(o){r[15](o)}let a={};return r[1].hidden!==void 0&&(a.checked=r[1].hidden),e=new td({props:a}),Tr.push(()=>Pa(e,"checked",i)),{c(){Ce(e.$$.fragment)},m(o,l){Se(e,o,l),n=!0},p(o,l){let u={};!t&&l[0]&2&&(t=!0,u.checked=o[1].hidden,Ba(()=>t=!1)),e.$set(u)},i(o){n||(te(e.$$.fragment,o),n=!0)},o(o){oe(e.$$.fragment,o),n=!1},d(o){Ne(e,o)}}}function c5(r){let e,t=r[45]+"",n,i;return{c(){e=Z("option"),n=Be(t),e.__value=i=r[45],Ye(e,e.__value)},m(a,o){Q(a,e,o),$(e,n)},p:Fe,d(a){a&&X(e)}}}function eY(r){let e;return{c(){e=Be("Add Action")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function f5(r){let e,t;return e=new Jr({props:{name:"Command: "+(r[42].command||"none"),description:"The command to execute when this action runs.",$$slots:{default:[nY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i[0]&2&&(a.name="Command: "+(n[42].command||"none")),i[0]&2|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function tY(r){let e;return{c(){e=Be("Change")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function rY(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function nY(r){let e,t,n,i;function a(){return r[18](r[42])}e=new Lt({props:{variant:"primary",$$slots:{default:[tY]},$$scope:{ctx:r}}}),e.$on("click",a);function o(){return r[19](r[44])}return n=new Lt({props:{variant:"destructive",$$slots:{default:[rY]},$$scope:{ctx:r}}}),n.$on("click",o),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment)},m(l,u){Se(e,l,u),Q(l,t,u),Se(n,l,u),i=!0},p(l,u){r=l;let s={};u[1]&524288&&(s.$$scope={dirty:u,ctx:r}),e.$set(s);let c={};u[1]&524288&&(c.$$scope={dirty:u,ctx:r}),n.$set(c)},i(l){i||(te(e.$$.fragment,l),te(n.$$.fragment,l),i=!0)},o(l){oe(e.$$.fragment,l),oe(n.$$.fragment,l),i=!1},d(l){l&&X(t),Ne(e,l),Ne(n,l)}}}function p5(r){let e,t;return e=new Jr({props:{name:"Link",description:"The link to open.",$$slots:{default:[aY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i[0]&2|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function iY(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function aY(r){let e,t,n,i,a,o;function l(){r[20].call(e,r[43],r[44])}function u(){return r[21](r[44])}return n=new Lt({props:{variant:"destructive",$$slots:{default:[iY]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=fe(),Ce(n.$$.fragment),R(e,"type","text"),R(e,"placeholder","[[Some Note]] or https://www.example.com")},m(s,c){Q(s,e,c),Ye(e,r[42].link),Q(s,t,c),Se(n,s,c),i=!0,a||(o=xe(e,"input",l),a=!0)},p(s,c){r=s,c[0]&2&&e.value!==r[42].link&&Ye(e,r[42].link);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(te(n.$$.fragment,s),i=!0)},o(s){oe(n.$$.fragment,s),i=!1},d(s){s&&(X(e),X(t)),Ne(n,s),a=!1,o()}}}function m5(r){let e,t;return e=new Jr({props:{name:"JS File",description:"The JavaScript file to run.",$$slots:{default:[sY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i[0]&2|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function oY(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function sY(r){let e,t,n,i,a,o;function l(){r[22].call(e,r[43],r[44])}function u(){return r[23](r[44])}return n=new Lt({props:{variant:"destructive",$$slots:{default:[oY]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=fe(),Ce(n.$$.fragment),R(e,"type","text"),R(e,"placeholder","someJsFile.js")},m(s,c){Q(s,e,c),Ye(e,r[42].file),Q(s,t,c),Se(n,s,c),i=!0,a||(o=xe(e,"input",l),a=!0)},p(s,c){r=s,c[0]&2&&e.value!==r[42].file&&Ye(e,r[42].file);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(te(n.$$.fragment,s),i=!0)},o(s){oe(n.$$.fragment,s),i=!1},d(s){s&&(X(e),X(t)),Ne(n,s),a=!1,o()}}}function d5(r){let e,t;return e=new Jr({props:{name:"Text",description:"The text to input at the cursor.",$$slots:{default:[lY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i[0]&2|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function uY(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function lY(r){let e,t,n,i,a,o;function l(){r[24].call(e,r[43],r[44])}function u(){return r[25](r[44])}return n=new Lt({props:{variant:"destructive",$$slots:{default:[uY]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=fe(),Ce(n.$$.fragment),R(e,"type","text"),R(e,"placeholder","some text")},m(s,c){Q(s,e,c),Ye(e,r[42].str),Q(s,t,c),Se(n,s,c),i=!0,a||(o=xe(e,"input",l),a=!0)},p(s,c){r=s,c[0]&2&&e.value!==r[42].str&&Ye(e,r[42].str);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(te(n.$$.fragment,s),i=!0)},o(s){oe(n.$$.fragment,s),i=!1},d(s){s&&(X(e),X(t)),Ne(n,s),a=!1,o()}}}function h5(r){let e,t;return e=new Jr({props:{name:"Sleep Time",description:"The time to sleep in milliseconds.",$$slots:{default:[fY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p(n,i){let a={};i[0]&2|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function cY(r){let e,t;return e=new cr({props:{iconName:"x"}}),{c(){Ce(e.$$.fragment)},m(n,i){Se(e,n,i),t=!0},p:Fe,i(n){t||(te(e.$$.fragment,n),t=!0)},o(n){oe(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function fY(r){let e,t,n,i,a,o;function l(){r[26].call(e,r[43],r[44])}function u(){return r[27](r[44])}return n=new Lt({props:{variant:"destructive",$$slots:{default:[cY]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=fe(),Ce(n.$$.fragment),R(e,"type","number"),R(e,"placeholder","100 ms")},m(s,c){Q(s,e,c),Ye(e,r[42].ms),Q(s,t,c),Se(n,s,c),i=!0,a||(o=xe(e,"input",l),a=!0)},p(s,c){r=s,c[0]&2&&ci(e.value)!==r[42].ms&&Ye(e,r[42].ms);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(te(n.$$.fragment,s),i=!0)},o(s){oe(n.$$.fragment,s),i=!1},d(s){s&&(X(e),X(t)),Ne(n,s),a=!1,o()}}}function g5(r){let e,t,n,i,a,o,l,u,s,c;function f(){return r[28](r[44])}return e=new Lt({props:{variant:"destructive",$$slots:{default:[pY]},$$scope:{ctx:r}}}),e.$on("click",f),n=new Jr({props:{name:"Template File: "+(r[42].templateFile||"none"),description:"The template file to create a new note of.",$$slots:{default:[dY]},$$scope:{ctx:r}}}),a=new Jr({props:{name:"Folder: "+(r[42].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[gY]},$$scope:{ctx:r}}}),l=new Jr({props:{name:"File Name: "+(r[42].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[vY]},$$scope:{ctx:r}}}),s=new Jr({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[yY]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment),i=fe(),Ce(a.$$.fragment),o=fe(),Ce(l.$$.fragment),u=fe(),Ce(s.$$.fragment)},m(p,m){Se(e,p,m),Q(p,t,m),Se(n,p,m),Q(p,i,m),Se(a,p,m),Q(p,o,m),Se(l,p,m),Q(p,u,m),Se(s,p,m),c=!0},p(p,m){r=p;let h={};m[1]&524288&&(h.$$scope={dirty:m,ctx:r}),e.$set(h);let d={};m[0]&2&&(d.name="Template File: "+(r[42].templateFile||"none")),m[0]&2|m[1]&524288&&(d.$$scope={dirty:m,ctx:r}),n.$set(d);let g={};m[0]&2&&(g.name="Folder: "+(r[42].folderPath||"none")),m[0]&2|m[1]&524288&&(g.$$scope={dirty:m,ctx:r}),a.$set(g);let v={};m[0]&2&&(v.name="File Name: "+(r[42].fileName||"default")),m[0]&2|m[1]&524288&&(v.$$scope={dirty:m,ctx:r}),l.$set(v);let w={};m[0]&2|m[1]&524288&&(w.$$scope={dirty:m,ctx:r}),s.$set(w)},i(p){c||(te(e.$$.fragment,p),te(n.$$.fragment,p),te(a.$$.fragment,p),te(l.$$.fragment,p),te(s.$$.fragment,p),c=!0)},o(p){oe(e.$$.fragment,p),oe(n.$$.fragment,p),oe(a.$$.fragment,p),oe(l.$$.fragment,p),oe(s.$$.fragment,p),c=!1},d(p){p&&(X(t),X(i),X(o),X(u)),Ne(e,p),Ne(n,p),Ne(a,p),Ne(l,p),Ne(s,p)}}}function pY(r){let e;return{c(){e=Be("Remove Action")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function mY(r){let e;return{c(){e=Be("Change")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function dY(r){let e,t;function n(){return r[29](r[42])}return e=new Lt({props:{variant:"primary",$$slots:{default:[mY]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){Ce(e.$$.fragment)},m(i,a){Se(e,i,a),t=!0},p(i,a){r=i;let o={};a[1]&524288&&(o.$$scope={dirty:a,ctx:r}),e.$set(o)},i(i){t||(te(e.$$.fragment,i),t=!0)},o(i){oe(e.$$.fragment,i),t=!1},d(i){Ne(e,i)}}}function hY(r){let e;return{c(){e=Be("Change")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function gY(r){let e,t;function n(){return r[30](r[42])}return e=new Lt({props:{variant:"primary",$$slots:{default:[hY]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){Ce(e.$$.fragment)},m(i,a){Se(e,i,a),t=!0},p(i,a){r=i;let o={};a[1]&524288&&(o.$$scope={dirty:a,ctx:r}),e.$set(o)},i(i){t||(te(e.$$.fragment,i),t=!0)},o(i){oe(e.$$.fragment,i),t=!1},d(i){Ne(e,i)}}}function vY(r){let e,t,n;function i(){r[31].call(e,r[43],r[44])}return{c(){e=Z("input"),R(e,"type","text"),R(e,"placeholder","some name")},m(a,o){Q(a,e,o),Ye(e,r[42].fileName),t||(n=xe(e,"input",i),t=!0)},p(a,o){r=a,o[0]&2&&e.value!==r[42].fileName&&Ye(e,r[42].fileName)},d(a){a&&X(e),t=!1,n()}}}function yY(r){let e,t,n;function i(o){r[32](o,r[42])}let a={};return r[42].openNote!==void 0&&(a.checked=r[42].openNote),e=new td({props:a}),Tr.push(()=>Pa(e,"checked",i)),{c(){Ce(e.$$.fragment)},m(o,l){Se(e,o,l),n=!0},p(o,l){r=o;let u={};!t&&l[0]&2&&(t=!0,u.checked=r[42].openNote,Ba(()=>t=!1)),e.$set(u)},i(o){n||(te(e.$$.fragment,o),n=!0)},o(o){oe(e.$$.fragment,o),n=!1},d(o){Ne(e,o)}}}function v5(r){let e,t,n,i,a,o,l,u;function s(){return r[33](r[44])}return e=new Lt({props:{variant:"destructive",$$slots:{default:[bY]},$$scope:{ctx:r}}}),e.$on("click",s),n=new Jr({props:{name:"Metadata Property",description:"The metadata property in form of a bind target.",$$slots:{default:[xY]},$$scope:{ctx:r}}}),a=new Jr({props:{name:"Value",description:"The new value.",$$slots:{default:[wY]},$$scope:{ctx:r}}}),l=new Jr({props:{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",$$slots:{default:[_Y]},$$scope:{ctx:r}}}),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment),i=fe(),Ce(a.$$.fragment),o=fe(),Ce(l.$$.fragment)},m(c,f){Se(e,c,f),Q(c,t,f),Se(n,c,f),Q(c,i,f),Se(a,c,f),Q(c,o,f),Se(l,c,f),u=!0},p(c,f){r=c;let p={};f[1]&524288&&(p.$$scope={dirty:f,ctx:r}),e.$set(p);let m={};f[0]&2|f[1]&524288&&(m.$$scope={dirty:f,ctx:r}),n.$set(m);let h={};f[0]&2|f[1]&524288&&(h.$$scope={dirty:f,ctx:r}),a.$set(h);let d={};f[0]&2|f[1]&524288&&(d.$$scope={dirty:f,ctx:r}),l.$set(d)},i(c){u||(te(e.$$.fragment,c),te(n.$$.fragment,c),te(a.$$.fragment,c),te(l.$$.fragment,c),u=!0)},o(c){oe(e.$$.fragment,c),oe(n.$$.fragment,c),oe(a.$$.fragment,c),oe(l.$$.fragment,c),u=!1},d(c){c&&(X(t),X(i),X(o)),Ne(e,c),Ne(n,c),Ne(a,c),Ne(l,c)}}}function bY(r){let e;return{c(){e=Be("Remove Action")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function xY(r){let e,t,n;function i(){r[34].call(e,r[43],r[44])}return{c(){e=Z("input"),R(e,"type","text"),R(e,"placeholder","some value")},m(a,o){Q(a,e,o),Ye(e,r[42].bindTarget),t||(n=xe(e,"input",i),t=!0)},p(a,o){r=a,o[0]&2&&e.value!==r[42].bindTarget&&Ye(e,r[42].bindTarget)},d(a){a&&X(e),t=!1,n()}}}function wY(r){let e,t,n;function i(){r[35].call(e,r[43],r[44])}return{c(){e=Z("input"),R(e,"type","text"),R(e,"placeholder","some value")},m(a,o){Q(a,e,o),Ye(e,r[42].value),t||(n=xe(e,"input",i),t=!0)},p(a,o){r=a,o[0]&2&&e.value!==r[42].value&&Ye(e,r[42].value)},d(a){a&&X(e),t=!1,n()}}}function _Y(r){let e,t,n;function i(o){r[36](o,r[42])}let a={};return r[42].evaluate!==void 0&&(a.checked=r[42].evaluate),e=new td({props:a}),Tr.push(()=>Pa(e,"checked",i)),{c(){Ce(e.$$.fragment)},m(o,l){Se(e,o,l),n=!0},p(o,l){r=o;let u={};!t&&l[0]&2&&(t=!0,u.checked=r[42].evaluate,Ba(()=>t=!1)),e.$set(u)},i(o){n||(te(e.$$.fragment,o),n=!0)},o(o){oe(e.$$.fragment,o),n=!1},d(o){Ne(e,o)}}}function y5(r,e){let t,n=e[9](e[42].type)+"",i,a,o,l,u,s,c,f,p,m,h=e[42].type==="command"&&f5(e),d=e[42].type==="open"&&p5(e),g=e[42].type==="js"&&m5(e),v=e[42].type==="input"&&d5(e),w=e[42].type==="sleep"&&h5(e),y=e[42].type==="templaterCreateNote"&&g5(e),x=e[42].type==="updateMetadata"&&v5(e);return{key:r,first:null,c(){t=Z("h5"),i=Be(n),a=fe(),h&&h.c(),o=fe(),d&&d.c(),l=fe(),g&&g.c(),u=fe(),v&&v.c(),s=fe(),w&&w.c(),c=fe(),y&&y.c(),f=fe(),x&&x.c(),p=lr(),this.first=t},m(_,b){Q(_,t,b),$(t,i),Q(_,a,b),h&&h.m(_,b),Q(_,o,b),d&&d.m(_,b),Q(_,l,b),g&&g.m(_,b),Q(_,u,b),v&&v.m(_,b),Q(_,s,b),w&&w.m(_,b),Q(_,c,b),y&&y.m(_,b),Q(_,f,b),x&&x.m(_,b),Q(_,p,b),m=!0},p(_,b){e=_,(!m||b[0]&2)&&n!==(n=e[9](e[42].type)+"")&&nt(i,n),e[42].type==="command"?h?(h.p(e,b),b[0]&2&&te(h,1)):(h=f5(e),h.c(),te(h,1),h.m(o.parentNode,o)):h&&(vt(),oe(h,1,1,()=>{h=null}),yt()),e[42].type==="open"?d?(d.p(e,b),b[0]&2&&te(d,1)):(d=p5(e),d.c(),te(d,1),d.m(l.parentNode,l)):d&&(vt(),oe(d,1,1,()=>{d=null}),yt()),e[42].type==="js"?g?(g.p(e,b),b[0]&2&&te(g,1)):(g=m5(e),g.c(),te(g,1),g.m(u.parentNode,u)):g&&(vt(),oe(g,1,1,()=>{g=null}),yt()),e[42].type==="input"?v?(v.p(e,b),b[0]&2&&te(v,1)):(v=d5(e),v.c(),te(v,1),v.m(s.parentNode,s)):v&&(vt(),oe(v,1,1,()=>{v=null}),yt()),e[42].type==="sleep"?w?(w.p(e,b),b[0]&2&&te(w,1)):(w=h5(e),w.c(),te(w,1),w.m(c.parentNode,c)):w&&(vt(),oe(w,1,1,()=>{w=null}),yt()),e[42].type==="templaterCreateNote"?y?(y.p(e,b),b[0]&2&&te(y,1)):(y=g5(e),y.c(),te(y,1),y.m(f.parentNode,f)):y&&(vt(),oe(y,1,1,()=>{y=null}),yt()),e[42].type==="updateMetadata"?x?(x.p(e,b),b[0]&2&&te(x,1)):(x=v5(e),x.c(),te(x,1),x.m(p.parentNode,p)):x&&(vt(),oe(x,1,1,()=>{x=null}),yt())},i(_){m||(te(h),te(d),te(g),te(v),te(w),te(y),te(x),m=!0)},o(_){oe(h),oe(d),oe(g),oe(v),oe(w),oe(y),oe(x),m=!1},d(_){_&&(X(t),X(a),X(o),X(l),X(u),X(s),X(c),X(f),X(p)),h&&h.d(_),d&&d.d(_),g&&g.d(_),v&&v.d(_),w&&w.d(_),y&&y.d(_),x&&x.d(_)}}}function AY(r){let e;return{c(){e=Be("Copy to Clipboard")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function DY(r){let e;return{c(){e=Be("Cancel")},m(t,n){Q(t,e,n)},d(t){t&&X(e)}}}function EY(r){let e,t,n,i;return e=new Lt({props:{variant:"primary",$$slots:{default:[AY]},$$scope:{ctx:r}}}),e.$on("click",r[38]),n=new Lt({props:{variant:"default",$$slots:{default:[DY]},$$scope:{ctx:r}}}),n.$on("click",r[39]),{c(){Ce(e.$$.fragment),t=fe(),Ce(n.$$.fragment)},m(a,o){Se(e,a,o),Q(a,t,o),Se(n,a,o),i=!0},p(a,o){let l={};o[1]&524288&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o[1]&524288&&(u.$$scope={dirty:o,ctx:a}),n.$set(u)},i(a){i||(te(e.$$.fragment,a),te(n.$$.fragment,a),i=!0)},o(a){oe(e.$$.fragment,a),oe(n.$$.fragment,a),i=!1},d(a){a&&X(t),Ne(e,a),Ne(n,a)}}}function SY(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h,d,g,v,w,y,x,_=[],b=new Map,D,S,A,E,M,F,P,k,O;n=new Jr({props:{name:"Label",description:"The label shown on the button.",$$slots:{default:[ZJ]},$$scope:{ctx:r}}}),a=new Jr({props:{name:"Style",description:"The style variant of the button",$$slots:{default:[JJ]},$$scope:{ctx:r}}}),l=new Jr({props:{name:"CSS Classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",$$slots:{default:[YJ]},$$scope:{ctx:r}}}),s=new Jr({props:{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",$$slots:{default:[XJ]},$$scope:{ctx:r}}}),f=new Jr({props:{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",$$slots:{default:[QJ]},$$scope:{ctx:r}}}),m=new Jr({props:{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",$$slots:{default:[KJ]},$$scope:{ctx:r}}});let I=je(Object.values(xs)),T=[];for(let U=0;U<I.length;U+=1)T[U]=c5(s5(r,I,U));y=new Lt({props:{variant:"primary",$$slots:{default:[eY]},$$scope:{ctx:r}}}),y.$on("click",r[17]);let q=je(r[1].actions),B=U=>U[44];for(let U=0;U<q.length;U+=1){let G=o5(r,q,U),H=B(G);b.set(H,_[U]=y5(H,G))}return F=new bs({props:{$$slots:{default:[EY]},$$scope:{ctx:r}}}),{c(){e=Z("h2"),e.textContent="Meta Bind Button Builder",t=fe(),Ce(n.$$.fragment),i=fe(),Ce(a.$$.fragment),o=fe(),Ce(l.$$.fragment),u=fe(),Ce(s.$$.fragment),c=fe(),Ce(f.$$.fragment),p=fe(),Ce(m.$$.fragment),h=fe(),d=Z("h4"),d.textContent="Actions",g=Be(`
Add action of type
`),v=Z("select");for(let U=0;U<T.length;U+=1)T[U].c();w=fe(),Ce(y.$$.fragment),x=fe();for(let U=0;U<_.length;U+=1)_[U].c();D=fe(),S=Z("h4"),S.textContent="Preview",A=fe(),E=Z("div"),M=fe(),Ce(F.$$.fragment),R(v,"class","dropdown"),r[3]===void 0&&Qr(()=>r[16].call(v))},m(U,G){Q(U,e,G),Q(U,t,G),Se(n,U,G),Q(U,i,G),Se(a,U,G),Q(U,o,G),Se(l,U,G),Q(U,u,G),Se(s,U,G),Q(U,c,G),Se(f,U,G),Q(U,p,G),Se(m,U,G),Q(U,h,G),Q(U,d,G),Q(U,g,G),Q(U,v,G);for(let H=0;H<T.length;H+=1)T[H]&&T[H].m(v,null);Mr(v,r[3],!0),Q(U,w,G),Se(y,U,G),Q(U,x,G);for(let H=0;H<_.length;H+=1)_[H]&&_[H].m(U,G);Q(U,D,G),Q(U,S,G),Q(U,A,G),Q(U,E,G),r[37](E),Q(U,M,G),Se(F,U,G),P=!0,k||(O=xe(v,"change",r[16]),k=!0)},p(U,G){let H={};G[0]&2|G[1]&524288&&(H.$$scope={dirty:G,ctx:U}),n.$set(H);let L={};G[0]&2|G[1]&524288&&(L.$$scope={dirty:G,ctx:U}),a.$set(L);let ie={};G[0]&2|G[1]&524288&&(ie.$$scope={dirty:G,ctx:U}),l.$set(ie);let ve={};G[0]&2|G[1]&524288&&(ve.$$scope={dirty:G,ctx:U}),s.$set(ve);let se={};G[0]&2|G[1]&524288&&(se.$$scope={dirty:G,ctx:U}),f.$set(se);let ue={};if(G[0]&2|G[1]&524288&&(ue.$$scope={dirty:G,ctx:U}),m.$set(ue),G&0){I=je(Object.values(xs));let re;for(re=0;re<I.length;re+=1){let me=s5(U,I,re);T[re]?T[re].p(me,G):(T[re]=c5(me),T[re].c(),T[re].m(v,null))}for(;re<T.length;re+=1)T[re].d(1);T.length=I.length}G[0]&8&&Mr(v,U[3]);let he={};G[1]&524288&&(he.$$scope={dirty:G,ctx:U}),y.$set(he),G[0]&994&&(q=je(U[1].actions),vt(),_=hs(_,G,B,1,U,q,b,D.parentNode,mc,y5,D,o5),yt());let K={};G[0]&3|G[1]&524288&&(K.$$scope={dirty:G,ctx:U}),F.$set(K)},i(U){if(!P){te(n.$$.fragment,U),te(a.$$.fragment,U),te(l.$$.fragment,U),te(s.$$.fragment,U),te(f.$$.fragment,U),te(m.$$.fragment,U),te(y.$$.fragment,U);for(let G=0;G<q.length;G+=1)te(_[G]);te(F.$$.fragment,U),P=!0}},o(U){oe(n.$$.fragment,U),oe(a.$$.fragment,U),oe(l.$$.fragment,U),oe(s.$$.fragment,U),oe(f.$$.fragment,U),oe(m.$$.fragment,U),oe(y.$$.fragment,U);for(let G=0;G<_.length;G+=1)oe(_[G]);oe(F.$$.fragment,U),P=!1},d(U){U&&(X(e),X(t),X(i),X(o),X(u),X(c),X(p),X(h),X(d),X(g),X(v),X(w),X(x),X(D),X(S),X(A),X(E),X(M)),Ne(n,U),Ne(a,U),Ne(l,U),Ne(s,U),Ne(f,U),Ne(m,U),Nt(T,U),Ne(y,U);for(let G=0;G<_.length;G+=1)_[G].d(U);r[37](null),Ne(F,U),k=!1,O()}}}function NY(r,e,t){let{modal:n}=e,i={label:"This is a button",hidden:!1,class:"",tooltip:"",id:"",style:"default",actions:[]},a,o,l;_o(()=>{o==null||o.unload()});function u(K,re){o==null||o.unload(),re&&(re.empty(),o=new ho(re,(0,b5.stringifyYaml)(K),n.plugin,"",Ht()),o.load())}function s(){var K;(K=i.actions)===null||K===void 0||K.push(n.plugin.api.buttonActionRunner.createDefaultAction(l)),t(1,i)}function c(K){i.actions.splice(K,1),t(1,i)}function f(K){new Ym(n.plugin,re=>{K.command=re.id,t(1,i)}).open()}function p(K){new Km(n.plugin,re=>{K.templateFile=re.path,t(1,i)}).open()}function m(K){new Xm(n.plugin,re=>{K.folderPath=re.path,t(1,i)}).open()}function h(K){return K==="command"?"Run a Command":K==="open"?"Open a Link":K==="js"?"Run a JavaScript File":K==="input"?"Insert Text at Cursor":K==="sleep"?"Sleep for Some Time":K==="templaterCreateNote"?"Create a New Note Using Templater":K==="updateMetadata"?"Update Metadata":"CHANGE ME"}function d(){i.label=this.value,t(1,i)}function g(){i.style=Jn(this),t(1,i)}function v(){i.class=this.value,t(1,i)}function w(){i.tooltip=this.value,t(1,i)}function y(){i.id=this.value,t(1,i)}function x(K){r.$$.not_equal(i.hidden,K)&&(i.hidden=K,t(1,i))}function _(){l=Jn(this),t(3,l)}let b=()=>s(),D=K=>f(K),S=K=>c(K);function A(K,re){K[re].link=this.value,t(1,i)}let E=K=>c(K);function M(K,re){K[re].file=this.value,t(1,i)}let F=K=>c(K);function P(K,re){K[re].str=this.value,t(1,i)}let k=K=>c(K);function O(K,re){K[re].ms=ci(this.value),t(1,i)}let I=K=>c(K),T=K=>c(K),q=K=>p(K),B=K=>m(K);function U(K,re){K[re].fileName=this.value,t(1,i)}function G(K,re){r.$$.not_equal(re.openNote,K)&&(re.openNote=K,t(1,i))}let H=K=>c(K);function L(K,re){K[re].bindTarget=this.value,t(1,i)}function ie(K,re){K[re].value=this.value,t(1,i)}function ve(K,re){r.$$.not_equal(re.evaluate,K)&&(re.evaluate=K,t(1,i))}function se(K){Tr[K?"unshift":"push"](()=>{a=K,t(2,a)})}let ue=()=>n.okay(i),he=()=>n.cancel();return r.$$set=K=>{"modal"in K&&t(0,n=K.modal)},r.$$.update=()=>{r.$$.dirty[0]&6&&u(i,a)},[n,i,a,l,s,c,f,p,m,h,d,g,v,w,y,x,_,b,D,S,A,E,M,F,P,k,O,I,T,q,B,U,G,H,L,ie,ve,se,ue,he]}var X_=class extends Ve{constructor(e){super(),ze(this,e,NY,SY,qe,{modal:0},null,[-1,-1])}},x5=X_;var rd=class extends w5.Modal{constructor(e,t){super(e.app),this.plugin=e,this.onOkay=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new x5({target:this.contentEl,props:{modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}okay(e){this.close(),this.onOkay(e)}cancel(){this.close()}};var CY=["true","false","on","off","yes","no"],MY=new RegExp("\\b(("+CY.join(")|(")+"))$","i"),ec={name:"yaml",token:function(r,e){var t=r.peek(),n=e.escaped;if(e.escaped=!1,t=="#"&&(r.pos==0||/\s/.test(r.string.charAt(r.pos-1))))return r.skipToEnd(),"comment";if(r.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&r.indentation()>e.keyCol)return r.skipToEnd(),"string";if(e.literal&&(e.literal=!1),r.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,r.match("---")||r.match("..."))return"def";if(r.match(/^\s*-\s+/))return"meta"}if(r.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&t==",")return r.next(),"meta";if(e.inlinePairs>0&&!n&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,r.next(),"meta";if(e.pairStart){if(r.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(r.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&r.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&r.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(r.match(MY))return"keyword"}return!e.pair&&r.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=r.indentation(),"atom"):e.pair&&r.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",r.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function _5(r){if(!r.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>{var i,a;return(a=(i=ec).startState)==null?void 0:a.call(i,4)},blankLine:i=>{var a,o;return(o=(a=ec).blankLine)==null?void 0:o.call(a,i,4)},copyState:i=>{var a,o;return(o=(a=ec).startState)==null?void 0:o.call(a,4)},token:(i,a)=>{var o,l;return`line-HyperMD-codeblock ${(l=(o=ec).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=In.isDeclarationAndGetMDRCType(a.str.trim());f===void 0?a.highlights=new Na(a.str,[]):(a.mdrcType=f,a.highlights=r.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<l.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${l.tokenClass}`)}}))}var tc=ur(Rn()),rc=ur(Xn()),TY=tc.P.sequenceMap((r,e,t,n)=>{let i=parseInt(r),a=parseInt(e),o=parseInt(t);return new Si(i,a,o,n)},rc.P_UTILS.digits().skip(tc.P.string(".")),rc.P_UTILS.digits().skip(tc.P.string(".")),rc.P_UTILS.digits(),tc.P.string("-").then(rc.P_UTILS.remaining()).optional()),Si=class r{constructor(e,t,n,i){this.major=e,this.minor=t,this.patch=n,this.prerelease=i}static fromString(e){return Ur(TY,e)}static lessThan(e,t){return e.major<t.major?!0:e.major>t.major?!1:e.minor<t.minor?!0:e.minor>t.minor?!1:e.patch<t.patch?!0:e.patch>t.patch||e.prerelease===void 0?!1:t.prerelease===void 0?!0:e.prerelease<t.prerelease}static greaterThan(e,t){return r.lessThan(t,e)}static equals(e,t){return e.major===t.major&&e.minor===t.minor&&e.patch===t.patch&&e.prerelease===t.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var nd=class{constructor(e,t){this.plugin=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(n=>n.pluginId===e);if(t===void 0)throw new So({errorLevel:"CRITICAL",effect:"Dependency Violation Detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return t}getPlugin(e){return this.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new So({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,t){if(Si.lessThan(t,e.minVersion))throw new So({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${t}. Please update the plugin.`});if(e.maxVersion!==void 0&&(Si.greaterThan(t,e.maxVersion)||Si.equals(t,e.maxVersion)))throw new So({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${t}. Please downgrade the plugin.`})}checkDependency(e){let t=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Si.fromString(n.manifest.version);return this.checkDependencyVersion(t,i),n}checkDependencyOnStartup(e){let t=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let n=Si.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(t,n)}checkDependenciesOnStartup(){let e=new rr("Dependency Validation");for(let t of this.dependencies)if(t.checkOnStartup)try{this.checkDependencyOnStartup(t.pluginId)}catch(n){e.add(n)}return e.hasErrors()?(new _s(this.plugin.app,{errorCollection:e,text:"The following errors were detected during dependency validation. The plugin won't load until these errors have been resolved. Please install the required plugins and restart Obsidian."}).open(),!0):!1}};var Nd=(n=>(n.DEV="dev",n.CANARY="canary",n.RELEASE="release",n))(Nd||{}),id=class extends ad.Plugin{async onload(){if(console.log("meta-bind | Main >> load"),this.build=this.determineBuild(),await this.loadSettings(),await this.saveSettings(),this.addSettingTab(new wc(this.app,this)),this.dependencyManager=new nd(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Si(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Si(0,1,0)}]),this.dependencyManager.checkDependenciesOnStartup())return;this.api=new Lm(this),this.internal=new Jm(this),this.mdrcManager=new $m;let e=new Hm(this);this.metadataManager=new Oc(e),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(L4(this)),this.addCommands(),_5(this),this.registerView(No,t=>new xc(t,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((e,t)=>{let n=e.querySelectorAll("code");for(let i=0;i<n.length;i++){let a=n.item(i);if(a.hasClass("mb-none"))continue;let o=a.innerText,l=In.isDeclarationAndGetMDRCType(o);l!==void 0&&In.constructMDRC(l,o,t.sourcePath,a,t,this)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,t,n)=>{let i=t,a=e.trim(),o=In.isDeclarationAndGetMDRCType(a);o==="INPUT_FIELD"&&this.api.createInputFieldFromString(a,"block",n.sourcePath,i,n,void 0),o==="VIEW_FIELD"&&this.api.createViewFieldFromString(a,"block",n.sourcePath,i,n),o==="BUTTON"&&this.api.createInlineButtonFromString(a,n.sourcePath,i,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,t,n)=>{this.api.createJsViewFieldFromString(e,"block",n.sourcePath,t,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,t,n)=>{let i=new Ql(t,e,this,n.sourcePath,Ht(),0);n.addChild(i)});for(let e=1;e<=$_;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(t,n,i)=>{let a=new Ql(n,t,this,i.sourcePath,Ht(),e);i.addChild(a)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,t,n)=>{let i=new ho(t,e,this,n.sourcePath,Ht());n.addChild(i)})}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(No)}}),this.addCommand({id:"open-help",name:"Open Meta Bind Help",callback:()=>{this.activateView(No)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{new rd(this,e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,ad.stringifyYaml)(e)}
\`\`\``)}).open()}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.register(()=>e.remove())}if(this.build==="canary"){let e=this.addStatusBarItem();e.setText(`Meta Bind Canary Build (${this.manifest.version})`),e.addClass("mb-error"),this.register(()=>e.remove())}}loadTemplates(){let e=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);e.hasErrors()&&console.warn("meta-bind | failed to parse templates",e)}isFilePathExcluded(e){for(let t of this.settings.excludedFolders)if(e.startsWith(t))return!0;return!1}async loadSettings(){console.log("meta-bind | Main >> settings load");let e=await this.loadData();e=this.applyTemplatesMigration(Object.assign({},Ci,e)),this.settings=e,await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),$r.dateFormat=this.settings.preferredDateFormat,_L(this.settings.firstWeekday),await this.saveData(this.settings)}applyTemplatesMigration(e){return e}async activateView(e){let{workspace:t}=this.app,n,i=t.getLeavesOfType(e);i.length>0?n=i[0]:(n=t.getLeaf("tab"),await n.setViewState({type:e,active:!0})),t.revealLeaf(n)}};
/*! 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 <M8ch88l@gmail.com>
* MIT Licence
*)
*/