WritingSpace/.obsidian/plugins/obsidian-meta-bind-plugin/main.js
2025-07-15 12:58:45 +02:00

178 lines
No EOL
1.1 MiB

/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Wed, 28 May 2025 10:09:10 GMT
Version: 1.4.2
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
-------------------------------------------
Copyright (C) 2025 Moritz Jung
-------------------------------------------
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
"use strict";var g8=Object.create;var Fp=Object.defineProperty;var v8=Object.getOwnPropertyDescriptor;var y8=Object.getOwnPropertyNames;var b8=Object.getPrototypeOf,x8=Object.prototype.hasOwnProperty;var On=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F_=(t,e)=>{for(var r in e)Fp(t,r,{get:e[r],enumerable:!0})},I_=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y8(e))!x8.call(t,i)&&i!==r&&Fp(t,i,{get:()=>e[i],enumerable:!(n=v8(e,i))||n.enumerable});return t};var Tr=(t,e,r)=>(r=t!=null?g8(b8(t)):{},I_(e||!t||!t.__esModule?Fp(r,"default",{value:t,enumerable:!0}):r,t)),w8=t=>I_(Fp({},"__esModule",{value:!0}),t);var Bp=On(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.P_HELPERS=Ui.ParserHelpers=Ui.validateRegexFlags=Ui.validateRange=Ui.getIndex=Ui.arrayUnion=void 0;var Ay=kp();function _8(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;let r=[...t];for(let n of e)r.includes(n)||r.push(n);return r}Ui.arrayUnion=_8;function A8(t){return t===void 0?-1:t.index}Ui.getIndex=A8;function D8(t,e){if(e<t)throw new Error(`Invalid Range: max might not be smaller than min. Received [${t}, ${e}].`);if(t<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${t}, ${e}].`);if(t===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${t}, ${e}].`);if(!Number.isInteger(t)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${t}, ${e}].`)}Ui.validateRange=D8;function S8(t){for(let e of t)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'.`)}Ui.validateRegexFlags=S8;var Ip=class{followedBy(e){return new Ay.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new Ay.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 Ay.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}`)})}};Ui.ParserHelpers=Ip;Ui.P_HELPERS=new Ip});var B_=On(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ParserContext=void 0;var Dy=Bp(),Sy=class t{constructor(e,r){this.input=e,this.position=r}moveToPosition(e){return this.position=e,this}copy(){return new t(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 r=this.position.index;r<e;r++)this.input[r]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,r){return this.succeedAt(this.position.index+e,r)}failOffset(e,r){return this.failAt(this.position.index+e,r)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,r){return this.advanceTo(e),{success:!0,value:r,furthest:void 0,expected:void 0}}failAt(e,r){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(r)?r:[r]}}merge(e,r){if(e===void 0)return r;let n=(0,Dy.getIndex)(e.furthest),i=(0,Dy.getIndex)(r.furthest);if(i>n)return r;let a=i===n?(0,Dy.arrayUnion)(e.expected,r.expected):e.expected;return r.furthest=e.furthest,r.expected=a,r}};Pp.ParserContext=Sy});var qi=On(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.P=void 0;var aa=kp(),$p=Bp(),Ey=class t{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new aa.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let l=e[o].p(n);if(i=n.merge(i,l),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...r){if(r.length===0)throw new Error("sequenceMap must have at least one parser argument");return new aa.Parser(function(i){let a,o=new Array(r.length);for(let s=0;s<r.length;s++){let u=r[s].p(i);if(a=i.merge(a,u),!a.success)return a;o[s]=a.value}return a.value=e(...o),a})}static createLanguage(e){let r={},n={},i={};for(let a in e)i[a]=t.reference(()=>e[a](r,i)),Object.defineProperty(n,a,{get:()=>{if(r[a]!==void 0)return r[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)r[a]=e[a](n,i);return r}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new aa.Parser(function(n){let i;for(let a of e){let o=a,s=n.copy(),l=o.p(s);if(i=n.merge(i,l),i.success)return n.moveToPosition(s.position),i}return i})}static separateBy(e,r){return this.separateByNotEmpty(e,r).or(t.succeed([]))}static separateByNotEmpty(e,r){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,r.then(e).many())}static string(e){let r="'"+e+"'";return new aa.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(r);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,r){(0,$p.validateRegexFlags)(e.flags);let n=e.source;return r!==void 0?new aa.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=r??0;if(l>=0&&l<=s.length){let c=s[0],f=s[l];return a.succeedOffset(c.length,f)}let u="expected valid match group (0 to "+s.length+") in "+n;return a.fail(u)}else return a.fail(n)}):new aa.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=s[0];return a.succeedOffset(l.length,l)}else return a.fail(n)})}static succeed(e){return new aa.Parser(function(n){return n.succeed(e)})}static fail(e){return new aa.Parser(function(n){return n.fail(e)})}static oneOf(e){return $p.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return $p.P_HELPERS.test(function(n){return!e.includes(n)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(r=>this.string(r))).describe(e.map(r=>`'${r}'`).join(" or "))}static manyOf(e){return new aa.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 aa.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 aa.Parser(e)}static range(e,r){let n=e.charCodeAt(0),i=r.charCodeAt(0);return $p.P_HELPERS.test(function(o){let s=o.charCodeAt(0);return n<=s&&s<=i}).describe(`${e}-${r}`)}static takeWhile(e){return new aa.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 aa.Parser(function(n){return e().p(n)})}};Op.P=Ey});var P_=On(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.ParsingError=xl.createParsingErrorMessage=void 0;function k_(t,e,r){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(r){let o=t.split(`
`)[e.furthest.line-1],s=`${e.furthest.line} | `;i+=`
${s}${o}`,i+=`
${" ".repeat(e.furthest.column-1+s.length)}^ (${n})`}return i}xl.createParsingErrorMessage=k_;var Ty=class extends Error{constructor(e,r){super(k_(e,r,!0))}};xl.ParsingError=Ty});var kp=On(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.Parser=void 0;var E8=B_(),Na=qi(),My=Bp(),wl=oa(),T8=P_(),Cy=class t{constructor(e){this.p=e}tryParse(e){return this.p(new E8.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let r=this.tryParse(e);if(r.success)return r.value;throw new T8.ParsingError(e,r)}or(e){return Na.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(Na.P.string(e))}wrap(e,r){let n=this;return new t(function(a){let o=e.p(a);if(!o.success)return o;let s=a.merge(o,n.p(a));if(!s.success)return s;let l=a.merge(s,r.p(a));return l.success?a.merge(l,a.succeed(s.value)):l})}wrapString(e,r){return this.wrap(Na.P.string(e),Na.P.string(r))}then(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success?i.merge(o,i.succeed(a.value)):o})}and(e){return Na.P.sequence(this,e)}many(){let e=this;return new t(function(n){let i,a=n.position.index,o=[];for(;;){let s=n.copy(),l=e.p(s);if(i=n.merge(i,l),i.success){if(s.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(s.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,r){(0,My.validateRange)(e,r);let n=this;return new t(function(a){let o,s,l=[],u=0;for(;u<e;u++)if(o=n.p(a),s=a.merge(s,o),o.success)l.push(o.value);else return s;for(;u<r;u++){let c=a.copy();if(o=n.p(c),s=a.merge(s,o),o.success)a.moveToPosition(c.position),l.push(o.value);else break}return a.merge(s,a.succeed(l))})}atMost(e){return this.repeat(0,e)}atLeast(e){return Na.P.sequenceMap((r,n)=>r.concat(n),this.repeat(e,e),this.many())}separateBy(e){return Na.P.separateBy(this,e)}separateByNotEmpty(e){return Na.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let r=this;return new t(function(i){let a=r.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return Na.P.sequenceMap(function(r,n,i){return{value:n,range:{from:r,to:i}}},wl.P_UTILS.position(),this,wl.P_UTILS.position())}namedMarker(e){return Na.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},wl.P_UTILS.position(),this,wl.P_UTILS.position())}node(e){return Na.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},wl.P_UTILS.position(),this,wl.P_UTILS.position())}followedBy(e){return this.skip(My.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(My.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let r=this;return new t(function(i){let a=r.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let r=this;return new t(function(i){var a;let o=r.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=[`(${(a=o.expected)===null||a===void 0?void 0:a.join(" or ")} as part of ${e})`]),o})}optional(e){return this.or(Na.P.succeed(e))}chain(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let s=e(a.value).p(i);return i.merge(a,s)})}thenEof(){let e=this;return new t(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,r="",n=new Map,i=new Map;return new t(function(o){let s=o.position.index;if(o.input!==r)r=o.input,n.clear(),i.clear();else{let u=n.get(s),c=i.get(s);if(u!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},u)}let l=e.p(o);return n.set(s,Object.assign({},l)),i.set(s,o.getPosition()),l})}};Rp.Parser=Cy});var oa=On(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});Vp.P_UTILS=void 0;var Lp=kp(),Hr=qi(),Ny=class t{static position(){return new Lp.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Lp.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Lp.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Lp.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return Hr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return Hr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return Hr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return Hr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return Hr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return Hr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return Hr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return Hr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return Hr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return Hr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return Hr.P.string("\r")}static lf(){return Hr.P.string(`
`)}static crlf(){return Hr.P.string(`\r
`)}static newline(){return Hr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,r,n){return Hr.P.sequenceMap((i,a)=>i.reduce((o,s)=>n(s,o),a),e.many(),r)}static postfix(e,r,n){return Hr.P.sequenceMap((i,a)=>a.reduce((o,s)=>n(s,o),i),r,e.many())}static binaryRight(e,r,n){return Hr.P.sequenceMap((i,a)=>i.reverse().reduce((o,s)=>{let[l,u]=s;return n(l,u,o)},a),Hr.P.sequence(r,e.trim(this.optionalWhitespace())).many(),r)}static binaryLeft(e,r,n){return Hr.P.sequenceMap((i,a)=>a.reduce((o,s)=>{let[l,u]=s;return n(o,l,u)},i),r,Hr.P.sequence(e.trim(this.optionalWhitespace()),r).many())}static binaryRightRange(e,r,n){return Hr.P.sequenceMap((i,a,o)=>i.reverse().reduce((s,l)=>{let[u,c,f]=l;return n({from:u,to:o},c,f,s)},a),Hr.P.sequence(t.position(),r,e.trim(this.optionalWhitespace())).many(),r,t.position())}static binaryLeftRange(e,r,n){return Hr.P.sequenceMap((i,a,o)=>o.reduce((s,l)=>{let[u,c,f]=l;return n({from:i,to:f},s,u,c)},a),t.position(),r,Hr.P.sequence(e.trim(this.optionalWhitespace()),r,t.position()).many())}static func(e,r,n){let i=typeof e=="string"?Hr.P.string(e):e;return Hr.P.sequenceMap((a,o,s,l,u,c)=>n(a,l),i,Hr.P.string("("),this.optionalWhitespace(),r,this.optionalWhitespace(),Hr.P.string(")"))}};Vp.P_UTILS=Ny});var Bf=On((Ib,Xl)=>{(function(t,e){typeof Ib=="object"&&typeof Xl<"u"?Xl.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Ib,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(g){t=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function i(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function a(g,S){return Object.prototype.hasOwnProperty.call(g,S)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var S;for(S in g)if(a(g,S))return!1;return!0}function s(g){return g===void 0}function l(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function u(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function c(g,S){var B=[],$,H=g.length;for($=0;$<H;++$)B.push(S(g[$],$));return B}function f(g,S){for(var B in S)a(S,B)&&(g[B]=S[B]);return a(S,"toString")&&(g.toString=S.toString),a(S,"valueOf")&&(g.valueOf=S.valueOf),g}function m(g,S,B,$){return u_(g,S,B,$,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function d(g){return g._pf==null&&(g._pf=p()),g._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(g){var S=Object(this),B=S.length>>>0,$;for($=0;$<B;$++)if($ in S&&g.call(this,S[$],$,S))return!0;return!1};function b(g){var S=null,B=!1,$=g._d&&!isNaN(g._d.getTime());if($&&(S=d(g),B=h.call(S.parsedDateParts,function(H){return H!=null}),$=S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&B),g._strict&&($=$&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=$;else return $;return g._isValid}function y(g){var S=m(NaN);return g!=null?f(d(S),g):d(S).userInvalidated=!0,S}var D=e.momentProperties=[],v=!1;function A(g,S){var B,$,H,ae=D.length;if(s(S._isAMomentObject)||(g._isAMomentObject=S._isAMomentObject),s(S._i)||(g._i=S._i),s(S._f)||(g._f=S._f),s(S._l)||(g._l=S._l),s(S._strict)||(g._strict=S._strict),s(S._tzm)||(g._tzm=S._tzm),s(S._isUTC)||(g._isUTC=S._isUTC),s(S._offset)||(g._offset=S._offset),s(S._pf)||(g._pf=d(S)),s(S._locale)||(g._locale=S._locale),ae>0)for(B=0;B<ae;B++)$=D[B],H=S[$],s(H)||(g[$]=H);return g}function w(g){A(this,g),this._d=new Date(g._d!=null?g._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),v===!1&&(v=!0,e.updateOffset(this),v=!1)}function x(g){return g instanceof w||g!=null&&g._isAMomentObject!=null}function E(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function T(g,S){var B=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),B){var $=[],H,ae,Te,mt=arguments.length;for(ae=0;ae<mt;ae++){if(H="",typeof arguments[ae]=="object"){H+=`
[`+ae+"] ";for(Te in arguments[0])a(arguments[0],Te)&&(H+=Te+": "+arguments[0][Te]+", ");H=H.slice(0,-2)}else H=arguments[ae];$.push(H)}E(g+`
Arguments: `+Array.prototype.slice.call($).join("")+`
`+new Error().stack),B=!1}return S.apply(this,arguments)},S)}var _={};function C(g,S){e.deprecationHandler!=null&&e.deprecationHandler(g,S),_[g]||(E(S),_[g]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function N(g){return typeof Function<"u"&&g instanceof Function||Object.prototype.toString.call(g)==="[object Function]"}function I(g){var S,B;for(B in g)a(g,B)&&(S=g[B],N(S)?this[B]=S:this["_"+B]=S);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function R(g,S){var B=f({},g),$;for($ in S)a(S,$)&&(i(g[$])&&i(S[$])?(B[$]={},f(B[$],g[$]),f(B[$],S[$])):S[$]!=null?B[$]=S[$]:delete B[$]);for($ in g)a(g,$)&&!a(S,$)&&i(g[$])&&(B[$]=f({},B[$]));return B}function L(g){g!=null&&this.set(g)}var V;Object.keys?V=Object.keys:V=function(g){var S,B=[];for(S in g)a(g,S)&&B.push(S);return B};var P={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function k(g,S,B){var $=this._calendar[g]||this._calendar.sameElse;return N($)?$.call(S,B):$}function W(g,S,B){var $=""+Math.abs(g),H=S-$.length,ae=g>=0;return(ae?B?"+":"":"-")+Math.pow(10,Math.max(0,H)).toString().substr(1)+$}var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ne={},X={};function U(g,S,B,$){var H=$;typeof $=="string"&&(H=function(){return this[$]()}),g&&(X[g]=H),S&&(X[S[0]]=function(){return W(H.apply(this,arguments),S[1],S[2])}),B&&(X[B]=function(){return this.localeData().ordinal(H.apply(this,arguments),g)})}function fe(g){return g.match(/\[[\s\S]/)?g.replace(/^\[|\]$/g,""):g.replace(/\\/g,"")}function xe(g){var S=g.match(O),B,$;for(B=0,$=S.length;B<$;B++)X[S[B]]?S[B]=X[S[B]]:S[B]=fe(S[B]);return function(H){var ae="",Te;for(Te=0;Te<$;Te++)ae+=N(S[Te])?S[Te].call(H,g):S[Te];return ae}}function oe(g,S){return g.isValid()?(S=be(S,g.localeData()),ne[S]=ne[S]||xe(S),ne[S](g)):g.localeData().invalidDate()}function be(g,S){var B=5;function $(H){return S.longDateFormat(H)||H}for(Q.lastIndex=0;B>=0&&Q.test(g);)g=g.replace(Q,$),Q.lastIndex=0,B-=1;return g}var ee={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Z(g){var S=this._longDateFormat[g],B=this._longDateFormat[g.toUpperCase()];return S||!B?S:(this._longDateFormat[g]=B.match(O).map(function($){return $==="MMMM"||$==="MM"||$==="DD"||$==="dddd"?$.slice(1):$}).join(""),this._longDateFormat[g])}var re="Invalid date";function me(){return this._invalidDate}var ce="%d",Ae=/\d{1,2}/;function we(g){return this._ordinal.replace("%d",g)}var G={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function J(g,S,B,$){var H=this._relativeTime[B];return N(H)?H(g,S,B,$):H.replace(/%d/i,g)}function ge(g,S){var B=this._relativeTime[g>0?"future":"past"];return N(B)?B(S):B.replace(/%s/i,S)}var ye={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function De(g){return typeof g=="string"?ye[g]||ye[g.toLowerCase()]:void 0}function Ie(g){var S={},B,$;for($ in g)a(g,$)&&(B=De($),B&&(S[B]=g[$]));return S}var Oe={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Je(g){var S=[],B;for(B in g)a(g,B)&&S.push({unit:B,priority:Oe[B]});return S.sort(function($,H){return $.priority-H.priority}),S}var wt=/\d/,qe=/\d\d/,rr=/\d{3}/,Wt=/\d{4}/,pr=/[+-]?\d{6}/,Pe=/\d\d?/,j=/\d\d\d\d?/,de=/\d\d\d\d\d\d?/,pe=/\d{1,3}/,Ne=/\d{1,4}/,Be=/[+-]?\d{1,6}/,_e=/\d+/,Ge=/[+-]?\d+/,F=/Z|[+-]\d\d:?\d\d/gi,Y=/Z|[+-]\d\d(?::?\d\d)?/gi,ie=/[+-]?\d+(\.\d{1,3})?/,Me=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Qe=/^[1-9]\d?/,gt=/^([1-9]\d|\d)/,hr;hr={};function Ve(g,S,B){hr[g]=N(S)?S:function($,H){return $&&B?B:S}}function si(g,S){return a(hr,g)?hr[g](S._strict,S._locale):new RegExp(Si(g))}function Si(g){return Xr(g.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(S,B,$,H,ae){return B||$||H||ae}))}function Xr(g){return g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Pn(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function lr(g){var S=+g,B=0;return S!==0&&isFinite(S)&&(B=Pn(S)),B}var Is={};function Nr(g,S){var B,$=S,H;for(typeof g=="string"&&(g=[g]),l(S)&&($=function(ae,Te){Te[S]=lr(ae)}),H=g.length,B=0;B<H;B++)Is[g[B]]=$}function Ri(g,S){Nr(g,function(B,$,H,ae){H._w=H._w||{},S(B,H._w,H,ae)})}function Ca(g,S,B){S!=null&&a(Is,g)&&Is[g](S,B._a,B,g)}function ia(g){return g%4===0&&g%100!==0||g%400===0}var _n=0,$n=1,Li=2,nn=3,Xn=4,An=5,Vi=6,Wc=7,fl=8;U("Y",0,0,function(){var g=this.year();return g<=9999?W(g,4):"+"+g}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),Ve("Y",Ge),Ve("YY",Pe,qe),Ve("YYYY",Ne,Wt),Ve("YYYYY",Be,pr),Ve("YYYYYY",Be,pr),Nr(["YYYYY","YYYYYY"],_n),Nr("YYYY",function(g,S){S[_n]=g.length===2?e.parseTwoDigitYear(g):lr(g)}),Nr("YY",function(g,S){S[_n]=e.parseTwoDigitYear(g)}),Nr("Y",function(g,S){S[_n]=parseInt(g,10)});function Ho(g){return ia(g)?366:365}e.parseTwoDigitYear=function(g){return lr(g)+(lr(g)>68?1900:2e3)};var Go=wo("FullYear",!0);function pl(){return ia(this.year())}function wo(g,S){return function(B){return B!=null?(ml(this,g,B),e.updateOffset(this,S),this):Ka(this,g)}}function Ka(g,S){if(!g.isValid())return NaN;var B=g._d,$=g._isUTC;switch(S){case"Milliseconds":return $?B.getUTCMilliseconds():B.getMilliseconds();case"Seconds":return $?B.getUTCSeconds():B.getSeconds();case"Minutes":return $?B.getUTCMinutes():B.getMinutes();case"Hours":return $?B.getUTCHours():B.getHours();case"Date":return $?B.getUTCDate():B.getDate();case"Day":return $?B.getUTCDay():B.getDay();case"Month":return $?B.getUTCMonth():B.getMonth();case"FullYear":return $?B.getUTCFullYear():B.getFullYear();default:return NaN}}function ml(g,S,B){var $,H,ae,Te,mt;if(!(!g.isValid()||isNaN(B))){switch($=g._d,H=g._isUTC,S){case"Milliseconds":return void(H?$.setUTCMilliseconds(B):$.setMilliseconds(B));case"Seconds":return void(H?$.setUTCSeconds(B):$.setSeconds(B));case"Minutes":return void(H?$.setUTCMinutes(B):$.setMinutes(B));case"Hours":return void(H?$.setUTCHours(B):$.setHours(B));case"Date":return void(H?$.setUTCDate(B):$.setDate(B));case"FullYear":break;default:return}ae=B,Te=g.month(),mt=g.date(),mt=mt===29&&Te===1&&!ia(ae)?28:mt,H?$.setUTCFullYear(ae,Te,mt):$.setFullYear(ae,Te,mt)}}function dl(g){return g=De(g),N(this[g])?this[g]():this}function Yc(g,S){if(typeof g=="object"){g=Ie(g);var B=Je(g),$,H=B.length;for($=0;$<H;$++)this[B[$].unit](g[B[$].unit])}else if(g=De(g),N(this[g]))return this[g](S);return this}function jc(g,S){return(g%S+S)%S}var Qr;Array.prototype.indexOf?Qr=Array.prototype.indexOf:Qr=function(g){var S;for(S=0;S<this.length;++S)if(this[S]===g)return S;return-1};function z(g,S){if(isNaN(g)||isNaN(S))return NaN;var B=jc(S,12);return g+=(S-B)/12,B===1?ia(g)?29:28:31-B%7%2}U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(g){return this.localeData().monthsShort(this,g)}),U("MMMM",0,0,function(g){return this.localeData().months(this,g)}),Ve("M",Pe,Qe),Ve("MM",Pe,qe),Ve("MMM",function(g,S){return S.monthsShortRegex(g)}),Ve("MMMM",function(g,S){return S.monthsRegex(g)}),Nr(["M","MM"],function(g,S){S[$n]=lr(g)-1}),Nr(["MMM","MMMM"],function(g,S,B,$){var H=B._locale.monthsParse(g,$,B._strict);H!=null?S[$n]=H:d(B).invalidMonth=g});var te="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ce="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),je=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ue=Me,Rt=Me;function Fr(g,S){return g?n(this._months)?this._months[g.month()]:this._months[(this._months.isFormat||je).test(S)?"format":"standalone"][g.month()]:n(this._months)?this._months:this._months.standalone}function Mn(g,S){return g?n(this._monthsShort)?this._monthsShort[g.month()]:this._monthsShort[je.test(S)?"format":"standalone"][g.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Cn(g,S,B){var $,H,ae,Te=g.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],$=0;$<12;++$)ae=m([2e3,$]),this._shortMonthsParse[$]=this.monthsShort(ae,"").toLocaleLowerCase(),this._longMonthsParse[$]=this.months(ae,"").toLocaleLowerCase();return B?S==="MMM"?(H=Qr.call(this._shortMonthsParse,Te),H!==-1?H:null):(H=Qr.call(this._longMonthsParse,Te),H!==-1?H:null):S==="MMM"?(H=Qr.call(this._shortMonthsParse,Te),H!==-1?H:(H=Qr.call(this._longMonthsParse,Te),H!==-1?H:null)):(H=Qr.call(this._longMonthsParse,Te),H!==-1?H:(H=Qr.call(this._shortMonthsParse,Te),H!==-1?H:null))}function Wo(g,S,B){var $,H,ae;if(this._monthsParseExact)return Cn.call(this,g,S,B);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),$=0;$<12;$++){if(H=m([2e3,$]),B&&!this._longMonthsParse[$]&&(this._longMonthsParse[$]=new RegExp("^"+this.months(H,"").replace(".","")+"$","i"),this._shortMonthsParse[$]=new RegExp("^"+this.monthsShort(H,"").replace(".","")+"$","i")),!B&&!this._monthsParse[$]&&(ae="^"+this.months(H,"")+"|^"+this.monthsShort(H,""),this._monthsParse[$]=new RegExp(ae.replace(".",""),"i")),B&&S==="MMMM"&&this._longMonthsParse[$].test(g))return $;if(B&&S==="MMM"&&this._shortMonthsParse[$].test(g))return $;if(!B&&this._monthsParse[$].test(g))return $}}function Jw(g,S){if(!g.isValid())return g;if(typeof S=="string"){if(/^\d+$/.test(S))S=lr(S);else if(S=g.localeData().monthsParse(S),!l(S))return g}var B=S,$=g.date();return $=$<29?$:Math.min($,z(g.year(),B)),g._isUTC?g._d.setUTCMonth(B,$):g._d.setMonth(B,$),g}function Xw(g){return g!=null?(Jw(this,g),e.updateOffset(this,!0),this):Ka(this,"Month")}function K4(){return z(this.year(),this.month())}function eV(g){return this._monthsParseExact?(a(this,"_monthsRegex")||Qw.call(this),g?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ue),this._monthsShortStrictRegex&&g?this._monthsShortStrictRegex:this._monthsShortRegex)}function tV(g){return this._monthsParseExact?(a(this,"_monthsRegex")||Qw.call(this),g?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Rt),this._monthsStrictRegex&&g?this._monthsStrictRegex:this._monthsRegex)}function Qw(){function g(Jt,br){return br.length-Jt.length}var S=[],B=[],$=[],H,ae,Te,mt;for(H=0;H<12;H++)ae=m([2e3,H]),Te=Xr(this.monthsShort(ae,"")),mt=Xr(this.months(ae,"")),S.push(Te),B.push(mt),$.push(mt),$.push(Te);S.sort(g),B.sort(g),$.sort(g),this._monthsRegex=new RegExp("^("+$.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+B.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+S.join("|")+")","i")}function rV(g,S,B,$,H,ae,Te){var mt;return g<100&&g>=0?(mt=new Date(g+400,S,B,$,H,ae,Te),isFinite(mt.getFullYear())&&mt.setFullYear(g)):mt=new Date(g,S,B,$,H,ae,Te),mt}function Zc(g){var S,B;return g<100&&g>=0?(B=Array.prototype.slice.call(arguments),B[0]=g+400,S=new Date(Date.UTC.apply(null,B)),isFinite(S.getUTCFullYear())&&S.setUTCFullYear(g)):S=new Date(Date.UTC.apply(null,arguments)),S}function xp(g,S,B){var $=7+S-B,H=(7+Zc(g,0,$).getUTCDay()-S)%7;return-H+$-1}function Kw(g,S,B,$,H){var ae=(7+B-$)%7,Te=xp(g,$,H),mt=1+7*(S-1)+ae+Te,Jt,br;return mt<=0?(Jt=g-1,br=Ho(Jt)+mt):mt>Ho(g)?(Jt=g+1,br=mt-Ho(g)):(Jt=g,br=mt),{year:Jt,dayOfYear:br}}function Jc(g,S,B){var $=xp(g.year(),S,B),H=Math.floor((g.dayOfYear()-$-1)/7)+1,ae,Te;return H<1?(Te=g.year()-1,ae=H+Yo(Te,S,B)):H>Yo(g.year(),S,B)?(ae=H-Yo(g.year(),S,B),Te=g.year()+1):(Te=g.year(),ae=H),{week:ae,year:Te}}function Yo(g,S,B){var $=xp(g,S,B),H=xp(g+1,S,B);return(Ho(g)-$+H)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),Ve("w",Pe,Qe),Ve("ww",Pe,qe),Ve("W",Pe,Qe),Ve("WW",Pe,qe),Ri(["w","ww","W","WW"],function(g,S,B,$){S[$.substr(0,1)]=lr(g)});function nV(g){return Jc(g,this._week.dow,this._week.doy).week}var iV={dow:0,doy:6};function aV(){return this._week.dow}function oV(){return this._week.doy}function sV(g){var S=this.localeData().week(this);return g==null?S:this.add((g-S)*7,"d")}function uV(g){var S=Jc(this,1,4).week;return g==null?S:this.add((g-S)*7,"d")}U("d",0,"do","day"),U("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),U("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),U("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),Ve("d",Pe),Ve("e",Pe),Ve("E",Pe),Ve("dd",function(g,S){return S.weekdaysMinRegex(g)}),Ve("ddd",function(g,S){return S.weekdaysShortRegex(g)}),Ve("dddd",function(g,S){return S.weekdaysRegex(g)}),Ri(["dd","ddd","dddd"],function(g,S,B,$){var H=B._locale.weekdaysParse(g,$,B._strict);H!=null?S.d=H:d(B).invalidWeekday=g}),Ri(["d","e","E"],function(g,S,B,$){S[$]=lr(g)});function lV(g,S){return typeof g!="string"?g:isNaN(g)?(g=S.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function cV(g,S){return typeof g=="string"?S.weekdaysParse(g)%7||7:isNaN(g)?null:g}function oy(g,S){return g.slice(S,7).concat(g.slice(0,S))}var fV="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),e_="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),pV="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),mV=Me,dV=Me,hV=Me;function gV(g,S){var B=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(S)?"format":"standalone"];return g===!0?oy(B,this._week.dow):g?B[g.day()]:B}function vV(g){return g===!0?oy(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function yV(g){return g===!0?oy(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function bV(g,S,B){var $,H,ae,Te=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],$=0;$<7;++$)ae=m([2e3,1]).day($),this._minWeekdaysParse[$]=this.weekdaysMin(ae,"").toLocaleLowerCase(),this._shortWeekdaysParse[$]=this.weekdaysShort(ae,"").toLocaleLowerCase(),this._weekdaysParse[$]=this.weekdays(ae,"").toLocaleLowerCase();return B?S==="dddd"?(H=Qr.call(this._weekdaysParse,Te),H!==-1?H:null):S==="ddd"?(H=Qr.call(this._shortWeekdaysParse,Te),H!==-1?H:null):(H=Qr.call(this._minWeekdaysParse,Te),H!==-1?H:null):S==="dddd"?(H=Qr.call(this._weekdaysParse,Te),H!==-1||(H=Qr.call(this._shortWeekdaysParse,Te),H!==-1)?H:(H=Qr.call(this._minWeekdaysParse,Te),H!==-1?H:null)):S==="ddd"?(H=Qr.call(this._shortWeekdaysParse,Te),H!==-1||(H=Qr.call(this._weekdaysParse,Te),H!==-1)?H:(H=Qr.call(this._minWeekdaysParse,Te),H!==-1?H:null)):(H=Qr.call(this._minWeekdaysParse,Te),H!==-1||(H=Qr.call(this._weekdaysParse,Te),H!==-1)?H:(H=Qr.call(this._shortWeekdaysParse,Te),H!==-1?H:null))}function xV(g,S,B){var $,H,ae;if(this._weekdaysParseExact)return bV.call(this,g,S,B);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),$=0;$<7;$++){if(H=m([2e3,1]).day($),B&&!this._fullWeekdaysParse[$]&&(this._fullWeekdaysParse[$]=new RegExp("^"+this.weekdays(H,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[$]=new RegExp("^"+this.weekdaysShort(H,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[$]=new RegExp("^"+this.weekdaysMin(H,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[$]||(ae="^"+this.weekdays(H,"")+"|^"+this.weekdaysShort(H,"")+"|^"+this.weekdaysMin(H,""),this._weekdaysParse[$]=new RegExp(ae.replace(".",""),"i")),B&&S==="dddd"&&this._fullWeekdaysParse[$].test(g))return $;if(B&&S==="ddd"&&this._shortWeekdaysParse[$].test(g))return $;if(B&&S==="dd"&&this._minWeekdaysParse[$].test(g))return $;if(!B&&this._weekdaysParse[$].test(g))return $}}function wV(g){if(!this.isValid())return g!=null?this:NaN;var S=Ka(this,"Day");return g!=null?(g=lV(g,this.localeData()),this.add(g-S,"d")):S}function _V(g){if(!this.isValid())return g!=null?this:NaN;var S=(this.day()+7-this.localeData()._week.dow)%7;return g==null?S:this.add(g-S,"d")}function AV(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var S=cV(g,this.localeData());return this.day(this.day()%7?S:S-7)}else return this.day()||7}function DV(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||sy.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=mV),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function SV(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||sy.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=dV),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function EV(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||sy.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=hV),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function sy(){function g(Ei,Qo){return Qo.length-Ei.length}var S=[],B=[],$=[],H=[],ae,Te,mt,Jt,br;for(ae=0;ae<7;ae++)Te=m([2e3,1]).day(ae),mt=Xr(this.weekdaysMin(Te,"")),Jt=Xr(this.weekdaysShort(Te,"")),br=Xr(this.weekdays(Te,"")),S.push(mt),B.push(Jt),$.push(br),H.push(mt),H.push(Jt),H.push(br);S.sort(g),B.sort(g),$.sort(g),H.sort(g),this._weekdaysRegex=new RegExp("^("+H.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+$.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+B.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+S.join("|")+")","i")}function uy(){return this.hours()%12||12}function TV(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,uy),U("k",["kk",2],0,TV),U("hmm",0,0,function(){return""+uy.apply(this)+W(this.minutes(),2)}),U("hmmss",0,0,function(){return""+uy.apply(this)+W(this.minutes(),2)+W(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+W(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+W(this.minutes(),2)+W(this.seconds(),2)});function t_(g,S){U(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),S)})}t_("a",!0),t_("A",!1);function r_(g,S){return S._meridiemParse}Ve("a",r_),Ve("A",r_),Ve("H",Pe,gt),Ve("h",Pe,Qe),Ve("k",Pe,Qe),Ve("HH",Pe,qe),Ve("hh",Pe,qe),Ve("kk",Pe,qe),Ve("hmm",j),Ve("hmmss",de),Ve("Hmm",j),Ve("Hmmss",de),Nr(["H","HH"],nn),Nr(["k","kk"],function(g,S,B){var $=lr(g);S[nn]=$===24?0:$}),Nr(["a","A"],function(g,S,B){B._isPm=B._locale.isPM(g),B._meridiem=g}),Nr(["h","hh"],function(g,S,B){S[nn]=lr(g),d(B).bigHour=!0}),Nr("hmm",function(g,S,B){var $=g.length-2;S[nn]=lr(g.substr(0,$)),S[Xn]=lr(g.substr($)),d(B).bigHour=!0}),Nr("hmmss",function(g,S,B){var $=g.length-4,H=g.length-2;S[nn]=lr(g.substr(0,$)),S[Xn]=lr(g.substr($,2)),S[An]=lr(g.substr(H)),d(B).bigHour=!0}),Nr("Hmm",function(g,S,B){var $=g.length-2;S[nn]=lr(g.substr(0,$)),S[Xn]=lr(g.substr($))}),Nr("Hmmss",function(g,S,B){var $=g.length-4,H=g.length-2;S[nn]=lr(g.substr(0,$)),S[Xn]=lr(g.substr($,2)),S[An]=lr(g.substr(H))});function MV(g){return(g+"").toLowerCase().charAt(0)==="p"}var CV=/[ap]\.?m?\.?/i,NV=wo("Hours",!0);function FV(g,S,B){return g>11?B?"pm":"PM":B?"am":"AM"}var n_={calendar:P,longDateFormat:ee,invalidDate:re,ordinal:ce,dayOfMonthOrdinalParse:Ae,relativeTime:G,months:te,monthsShort:Ce,week:iV,weekdays:fV,weekdaysMin:pV,weekdaysShort:e_,meridiemParse:CV},an={},Xc={},Qc;function IV(g,S){var B,$=Math.min(g.length,S.length);for(B=0;B<$;B+=1)if(g[B]!==S[B])return B;return $}function i_(g){return g&&g.toLowerCase().replace("_","-")}function BV(g){for(var S=0,B,$,H,ae;S<g.length;){for(ae=i_(g[S]).split("-"),B=ae.length,$=i_(g[S+1]),$=$?$.split("-"):null;B>0;){if(H=wp(ae.slice(0,B).join("-")),H)return H;if($&&$.length>=B&&IV(ae,$)>=B-1)break;B--}S++}return Qc}function kV(g){return!!(g&&g.match("^[^/\\\\]*$"))}function wp(g){var S=null,B;if(an[g]===void 0&&typeof Xl<"u"&&Xl&&Xl.exports&&kV(g))try{S=Qc._abbr,B=require,B("./locale/"+g),Bs(S)}catch{an[g]=null}return an[g]}function Bs(g,S){var B;return g&&(s(S)?B=jo(g):B=ly(g,S),B?Qc=B:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),Qc._abbr}function ly(g,S){if(S!==null){var B,$=n_;if(S.abbr=g,an[g]!=null)C("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),$=an[g]._config;else if(S.parentLocale!=null)if(an[S.parentLocale]!=null)$=an[S.parentLocale]._config;else if(B=wp(S.parentLocale),B!=null)$=B._config;else return Xc[S.parentLocale]||(Xc[S.parentLocale]=[]),Xc[S.parentLocale].push({name:g,config:S}),null;return an[g]=new L(R($,S)),Xc[g]&&Xc[g].forEach(function(H){ly(H.name,H.config)}),Bs(g),an[g]}else return delete an[g],null}function PV(g,S){if(S!=null){var B,$,H=n_;an[g]!=null&&an[g].parentLocale!=null?an[g].set(R(an[g]._config,S)):($=wp(g),$!=null&&(H=$._config),S=R(H,S),$==null&&(S.abbr=g),B=new L(S),B.parentLocale=an[g],an[g]=B),Bs(g)}else an[g]!=null&&(an[g].parentLocale!=null?(an[g]=an[g].parentLocale,g===Bs()&&Bs(g)):an[g]!=null&&delete an[g]);return an[g]}function jo(g){var S;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return Qc;if(!n(g)){if(S=wp(g),S)return S;g=[g]}return BV(g)}function $V(){return V(an)}function cy(g){var S,B=g._a;return B&&d(g).overflow===-2&&(S=B[$n]<0||B[$n]>11?$n:B[Li]<1||B[Li]>z(B[_n],B[$n])?Li:B[nn]<0||B[nn]>24||B[nn]===24&&(B[Xn]!==0||B[An]!==0||B[Vi]!==0)?nn:B[Xn]<0||B[Xn]>59?Xn:B[An]<0||B[An]>59?An:B[Vi]<0||B[Vi]>999?Vi:-1,d(g)._overflowDayOfYear&&(S<_n||S>Li)&&(S=Li),d(g)._overflowWeeks&&S===-1&&(S=Wc),d(g)._overflowWeekday&&S===-1&&(S=fl),d(g).overflow=S),g}var OV=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,RV=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,LV=/Z|[+-]\d\d(?::?\d\d)?/,_p=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],fy=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],VV=/^\/?Date\((-?\d+)/i,UV=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,qV={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function a_(g){var S,B,$=g._i,H=OV.exec($)||RV.exec($),ae,Te,mt,Jt,br=_p.length,Ei=fy.length;if(H){for(d(g).iso=!0,S=0,B=br;S<B;S++)if(_p[S][1].exec(H[1])){Te=_p[S][0],ae=_p[S][2]!==!1;break}if(Te==null){g._isValid=!1;return}if(H[3]){for(S=0,B=Ei;S<B;S++)if(fy[S][1].exec(H[3])){mt=(H[2]||" ")+fy[S][0];break}if(mt==null){g._isValid=!1;return}}if(!ae&&mt!=null){g._isValid=!1;return}if(H[4])if(LV.exec(H[4]))Jt="Z";else{g._isValid=!1;return}g._f=Te+(mt||"")+(Jt||""),my(g)}else g._isValid=!1}function zV(g,S,B,$,H,ae){var Te=[HV(g),Ce.indexOf(S),parseInt(B,10),parseInt($,10),parseInt(H,10)];return ae&&Te.push(parseInt(ae,10)),Te}function HV(g){var S=parseInt(g,10);return S<=49?2e3+S:S<=999?1900+S:S}function GV(g){return g.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function WV(g,S,B){if(g){var $=e_.indexOf(g),H=new Date(S[0],S[1],S[2]).getDay();if($!==H)return d(B).weekdayMismatch=!0,B._isValid=!1,!1}return!0}function YV(g,S,B){if(g)return qV[g];if(S)return 0;var $=parseInt(B,10),H=$%100,ae=($-H)/100;return ae*60+H}function o_(g){var S=UV.exec(GV(g._i)),B;if(S){if(B=zV(S[4],S[3],S[2],S[5],S[6],S[7]),!WV(S[1],B,g))return;g._a=B,g._tzm=YV(S[8],S[9],S[10]),g._d=Zc.apply(null,g._a),g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),d(g).rfc2822=!0}else g._isValid=!1}function jV(g){var S=VV.exec(g._i);if(S!==null){g._d=new Date(+S[1]);return}if(a_(g),g._isValid===!1)delete g._isValid;else return;if(o_(g),g._isValid===!1)delete g._isValid;else return;g._strict?g._isValid=!1:e.createFromInputFallback(g)}e.createFromInputFallback=T("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(g){g._d=new Date(g._i+(g._useUTC?" UTC":""))});function hl(g,S,B){return g??S??B}function ZV(g){var S=new Date(e.now());return g._useUTC?[S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()]:[S.getFullYear(),S.getMonth(),S.getDate()]}function py(g){var S,B,$=[],H,ae,Te;if(!g._d){for(H=ZV(g),g._w&&g._a[Li]==null&&g._a[$n]==null&&JV(g),g._dayOfYear!=null&&(Te=hl(g._a[_n],H[_n]),(g._dayOfYear>Ho(Te)||g._dayOfYear===0)&&(d(g)._overflowDayOfYear=!0),B=Zc(Te,0,g._dayOfYear),g._a[$n]=B.getUTCMonth(),g._a[Li]=B.getUTCDate()),S=0;S<3&&g._a[S]==null;++S)g._a[S]=$[S]=H[S];for(;S<7;S++)g._a[S]=$[S]=g._a[S]==null?S===2?1:0:g._a[S];g._a[nn]===24&&g._a[Xn]===0&&g._a[An]===0&&g._a[Vi]===0&&(g._nextDay=!0,g._a[nn]=0),g._d=(g._useUTC?Zc:rV).apply(null,$),ae=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[nn]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==ae&&(d(g).weekdayMismatch=!0)}}function JV(g){var S,B,$,H,ae,Te,mt,Jt,br;S=g._w,S.GG!=null||S.W!=null||S.E!=null?(ae=1,Te=4,B=hl(S.GG,g._a[_n],Jc(Kr(),1,4).year),$=hl(S.W,1),H=hl(S.E,1),(H<1||H>7)&&(Jt=!0)):(ae=g._locale._week.dow,Te=g._locale._week.doy,br=Jc(Kr(),ae,Te),B=hl(S.gg,g._a[_n],br.year),$=hl(S.w,br.week),S.d!=null?(H=S.d,(H<0||H>6)&&(Jt=!0)):S.e!=null?(H=S.e+ae,(S.e<0||S.e>6)&&(Jt=!0)):H=ae),$<1||$>Yo(B,ae,Te)?d(g)._overflowWeeks=!0:Jt!=null?d(g)._overflowWeekday=!0:(mt=Kw(B,$,H,ae,Te),g._a[_n]=mt.year,g._dayOfYear=mt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function my(g){if(g._f===e.ISO_8601){a_(g);return}if(g._f===e.RFC_2822){o_(g);return}g._a=[],d(g).empty=!0;var S=""+g._i,B,$,H,ae,Te,mt=S.length,Jt=0,br,Ei;for(H=be(g._f,g._locale).match(O)||[],Ei=H.length,B=0;B<Ei;B++)ae=H[B],$=(S.match(si(ae,g))||[])[0],$&&(Te=S.substr(0,S.indexOf($)),Te.length>0&&d(g).unusedInput.push(Te),S=S.slice(S.indexOf($)+$.length),Jt+=$.length),X[ae]?($?d(g).empty=!1:d(g).unusedTokens.push(ae),Ca(ae,$,g)):g._strict&&!$&&d(g).unusedTokens.push(ae);d(g).charsLeftOver=mt-Jt,S.length>0&&d(g).unusedInput.push(S),g._a[nn]<=12&&d(g).bigHour===!0&&g._a[nn]>0&&(d(g).bigHour=void 0),d(g).parsedDateParts=g._a.slice(0),d(g).meridiem=g._meridiem,g._a[nn]=XV(g._locale,g._a[nn],g._meridiem),br=d(g).era,br!==null&&(g._a[_n]=g._locale.erasConvertYear(br,g._a[_n])),py(g),cy(g)}function XV(g,S,B){var $;return B==null?S:g.meridiemHour!=null?g.meridiemHour(S,B):(g.isPM!=null&&($=g.isPM(B),$&&S<12&&(S+=12),!$&&S===12&&(S=0)),S)}function QV(g){var S,B,$,H,ae,Te,mt=!1,Jt=g._f.length;if(Jt===0){d(g).invalidFormat=!0,g._d=new Date(NaN);return}for(H=0;H<Jt;H++)ae=0,Te=!1,S=A({},g),g._useUTC!=null&&(S._useUTC=g._useUTC),S._f=g._f[H],my(S),b(S)&&(Te=!0),ae+=d(S).charsLeftOver,ae+=d(S).unusedTokens.length*10,d(S).score=ae,mt?ae<$&&($=ae,B=S):($==null||ae<$||Te)&&($=ae,B=S,Te&&(mt=!0));f(g,B||S)}function KV(g){if(!g._d){var S=Ie(g._i),B=S.day===void 0?S.date:S.day;g._a=c([S.year,S.month,B,S.hour,S.minute,S.second,S.millisecond],function($){return $&&parseInt($,10)}),py(g)}}function eU(g){var S=new w(cy(s_(g)));return S._nextDay&&(S.add(1,"d"),S._nextDay=void 0),S}function s_(g){var S=g._i,B=g._f;return g._locale=g._locale||jo(g._l),S===null||B===void 0&&S===""?y({nullInput:!0}):(typeof S=="string"&&(g._i=S=g._locale.preparse(S)),x(S)?new w(cy(S)):(u(S)?g._d=S:n(B)?QV(g):B?my(g):tU(g),b(g)||(g._d=null),g))}function tU(g){var S=g._i;s(S)?g._d=new Date(e.now()):u(S)?g._d=new Date(S.valueOf()):typeof S=="string"?jV(g):n(S)?(g._a=c(S.slice(0),function(B){return parseInt(B,10)}),py(g)):i(S)?KV(g):l(S)?g._d=new Date(S):e.createFromInputFallback(g)}function u_(g,S,B,$,H){var ae={};return(S===!0||S===!1)&&($=S,S=void 0),(B===!0||B===!1)&&($=B,B=void 0),(i(g)&&o(g)||n(g)&&g.length===0)&&(g=void 0),ae._isAMomentObject=!0,ae._useUTC=ae._isUTC=H,ae._l=B,ae._i=g,ae._f=S,ae._strict=$,eU(ae)}function Kr(g,S,B,$){return u_(g,S,B,$,!1)}var rU=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=Kr.apply(null,arguments);return this.isValid()&&g.isValid()?g<this?this:g:y()}),nU=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=Kr.apply(null,arguments);return this.isValid()&&g.isValid()?g>this?this:g:y()});function l_(g,S){var B,$;if(S.length===1&&n(S[0])&&(S=S[0]),!S.length)return Kr();for(B=S[0],$=1;$<S.length;++$)(!S[$].isValid()||S[$][g](B))&&(B=S[$]);return B}function iU(){var g=[].slice.call(arguments,0);return l_("isBefore",g)}function aU(){var g=[].slice.call(arguments,0);return l_("isAfter",g)}var oU=function(){return Date.now?Date.now():+new Date},Kc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function sU(g){var S,B=!1,$,H=Kc.length;for(S in g)if(a(g,S)&&!(Qr.call(Kc,S)!==-1&&(g[S]==null||!isNaN(g[S]))))return!1;for($=0;$<H;++$)if(g[Kc[$]]){if(B)return!1;parseFloat(g[Kc[$]])!==lr(g[Kc[$]])&&(B=!0)}return!0}function uU(){return this._isValid}function lU(){return eo(NaN)}function Ap(g){var S=Ie(g),B=S.year||0,$=S.quarter||0,H=S.month||0,ae=S.week||S.isoWeek||0,Te=S.day||0,mt=S.hour||0,Jt=S.minute||0,br=S.second||0,Ei=S.millisecond||0;this._isValid=sU(S),this._milliseconds=+Ei+br*1e3+Jt*6e4+mt*1e3*60*60,this._days=+Te+ae*7,this._months=+H+$*3+B*12,this._data={},this._locale=jo(),this._bubble()}function Dp(g){return g instanceof Ap}function dy(g){return g<0?Math.round(-1*g)*-1:Math.round(g)}function cU(g,S,B){var $=Math.min(g.length,S.length),H=Math.abs(g.length-S.length),ae=0,Te;for(Te=0;Te<$;Te++)(B&&g[Te]!==S[Te]||!B&&lr(g[Te])!==lr(S[Te]))&&ae++;return ae+H}function c_(g,S){U(g,0,0,function(){var B=this.utcOffset(),$="+";return B<0&&(B=-B,$="-"),$+W(~~(B/60),2)+S+W(~~B%60,2)})}c_("Z",":"),c_("ZZ",""),Ve("Z",Y),Ve("ZZ",Y),Nr(["Z","ZZ"],function(g,S,B){B._useUTC=!0,B._tzm=hy(Y,g)});var fU=/([\+\-]|\d\d)/gi;function hy(g,S){var B=(S||"").match(g),$,H,ae;return B===null?null:($=B[B.length-1]||[],H=($+"").match(fU)||["-",0,0],ae=+(H[1]*60)+lr(H[2]),ae===0?0:H[0]==="+"?ae:-ae)}function gy(g,S){var B,$;return S._isUTC?(B=S.clone(),$=(x(g)||u(g)?g.valueOf():Kr(g).valueOf())-B.valueOf(),B._d.setTime(B._d.valueOf()+$),e.updateOffset(B,!1),B):Kr(g).local()}function vy(g){return-Math.round(g._d.getTimezoneOffset())}e.updateOffset=function(){};function pU(g,S,B){var $=this._offset||0,H;if(!this.isValid())return g!=null?this:NaN;if(g!=null){if(typeof g=="string"){if(g=hy(Y,g),g===null)return this}else Math.abs(g)<16&&!B&&(g=g*60);return!this._isUTC&&S&&(H=vy(this)),this._offset=g,this._isUTC=!0,H!=null&&this.add(H,"m"),$!==g&&(!S||this._changeInProgress?d_(this,eo(g-$,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?$:vy(this)}function mU(g,S){return g!=null?(typeof g!="string"&&(g=-g),this.utcOffset(g,S),this):-this.utcOffset()}function dU(g){return this.utcOffset(0,g)}function hU(g){return this._isUTC&&(this.utcOffset(0,g),this._isUTC=!1,g&&this.subtract(vy(this),"m")),this}function gU(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var g=hy(F,this._i);g!=null?this.utcOffset(g):this.utcOffset(0,!0)}return this}function vU(g){return this.isValid()?(g=g?Kr(g).utcOffset():0,(this.utcOffset()-g)%60===0):!1}function yU(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function bU(){if(!s(this._isDSTShifted))return this._isDSTShifted;var g={},S;return A(g,this),g=s_(g),g._a?(S=g._isUTC?m(g._a):Kr(g._a),this._isDSTShifted=this.isValid()&&cU(g._a,S.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function xU(){return this.isValid()?!this._isUTC:!1}function wU(){return this.isValid()?this._isUTC:!1}function f_(){return this.isValid()?this._isUTC&&this._offset===0:!1}var _U=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,AU=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function eo(g,S){var B=g,$=null,H,ae,Te;return Dp(g)?B={ms:g._milliseconds,d:g._days,M:g._months}:l(g)||!isNaN(+g)?(B={},S?B[S]=+g:B.milliseconds=+g):($=_U.exec(g))?(H=$[1]==="-"?-1:1,B={y:0,d:lr($[Li])*H,h:lr($[nn])*H,m:lr($[Xn])*H,s:lr($[An])*H,ms:lr(dy($[Vi]*1e3))*H}):($=AU.exec(g))?(H=$[1]==="-"?-1:1,B={y:hu($[2],H),M:hu($[3],H),w:hu($[4],H),d:hu($[5],H),h:hu($[6],H),m:hu($[7],H),s:hu($[8],H)}):B==null?B={}:typeof B=="object"&&("from"in B||"to"in B)&&(Te=DU(Kr(B.from),Kr(B.to)),B={},B.ms=Te.milliseconds,B.M=Te.months),ae=new Ap(B),Dp(g)&&a(g,"_locale")&&(ae._locale=g._locale),Dp(g)&&a(g,"_isValid")&&(ae._isValid=g._isValid),ae}eo.fn=Ap.prototype,eo.invalid=lU;function hu(g,S){var B=g&&parseFloat(g.replace(",","."));return(isNaN(B)?0:B)*S}function p_(g,S){var B={};return B.months=S.month()-g.month()+(S.year()-g.year())*12,g.clone().add(B.months,"M").isAfter(S)&&--B.months,B.milliseconds=+S-+g.clone().add(B.months,"M"),B}function DU(g,S){var B;return g.isValid()&&S.isValid()?(S=gy(S,g),g.isBefore(S)?B=p_(g,S):(B=p_(S,g),B.milliseconds=-B.milliseconds,B.months=-B.months),B):{milliseconds:0,months:0}}function m_(g,S){return function(B,$){var H,ae;return $!==null&&!isNaN(+$)&&(C(S,"moment()."+S+"(period, number) is deprecated. Please use moment()."+S+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),ae=B,B=$,$=ae),H=eo(B,$),d_(this,H,g),this}}function d_(g,S,B,$){var H=S._milliseconds,ae=dy(S._days),Te=dy(S._months);g.isValid()&&($=$??!0,Te&&Jw(g,Ka(g,"Month")+Te*B),ae&&ml(g,"Date",Ka(g,"Date")+ae*B),H&&g._d.setTime(g._d.valueOf()+H*B),$&&e.updateOffset(g,ae||Te))}var SU=m_(1,"add"),EU=m_(-1,"subtract");function h_(g){return typeof g=="string"||g instanceof String}function TU(g){return x(g)||u(g)||h_(g)||l(g)||CU(g)||MU(g)||g===null||g===void 0}function MU(g){var S=i(g)&&!o(g),B=!1,$=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],H,ae,Te=$.length;for(H=0;H<Te;H+=1)ae=$[H],B=B||a(g,ae);return S&&B}function CU(g){var S=n(g),B=!1;return S&&(B=g.filter(function($){return!l($)&&h_(g)}).length===0),S&&B}function NU(g){var S=i(g)&&!o(g),B=!1,$=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],H,ae;for(H=0;H<$.length;H+=1)ae=$[H],B=B||a(g,ae);return S&&B}function FU(g,S){var B=g.diff(S,"days",!0);return B<-6?"sameElse":B<-1?"lastWeek":B<0?"lastDay":B<1?"sameDay":B<2?"nextDay":B<7?"nextWeek":"sameElse"}function IU(g,S){arguments.length===1&&(arguments[0]?TU(arguments[0])?(g=arguments[0],S=void 0):NU(arguments[0])&&(S=arguments[0],g=void 0):(g=void 0,S=void 0));var B=g||Kr(),$=gy(B,this).startOf("day"),H=e.calendarFormat(this,$)||"sameElse",ae=S&&(N(S[H])?S[H].call(this,B):S[H]);return this.format(ae||this.localeData().calendar(H,this,Kr(B)))}function BU(){return new w(this)}function kU(g,S){var B=x(g)?g:Kr(g);return this.isValid()&&B.isValid()?(S=De(S)||"millisecond",S==="millisecond"?this.valueOf()>B.valueOf():B.valueOf()<this.clone().startOf(S).valueOf()):!1}function PU(g,S){var B=x(g)?g:Kr(g);return this.isValid()&&B.isValid()?(S=De(S)||"millisecond",S==="millisecond"?this.valueOf()<B.valueOf():this.clone().endOf(S).valueOf()<B.valueOf()):!1}function $U(g,S,B,$){var H=x(g)?g:Kr(g),ae=x(S)?S:Kr(S);return this.isValid()&&H.isValid()&&ae.isValid()?($=$||"()",($[0]==="("?this.isAfter(H,B):!this.isBefore(H,B))&&($[1]===")"?this.isBefore(ae,B):!this.isAfter(ae,B))):!1}function OU(g,S){var B=x(g)?g:Kr(g),$;return this.isValid()&&B.isValid()?(S=De(S)||"millisecond",S==="millisecond"?this.valueOf()===B.valueOf():($=B.valueOf(),this.clone().startOf(S).valueOf()<=$&&$<=this.clone().endOf(S).valueOf())):!1}function RU(g,S){return this.isSame(g,S)||this.isAfter(g,S)}function LU(g,S){return this.isSame(g,S)||this.isBefore(g,S)}function VU(g,S,B){var $,H,ae;if(!this.isValid())return NaN;if($=gy(g,this),!$.isValid())return NaN;switch(H=($.utcOffset()-this.utcOffset())*6e4,S=De(S),S){case"year":ae=Sp(this,$)/12;break;case"month":ae=Sp(this,$);break;case"quarter":ae=Sp(this,$)/3;break;case"second":ae=(this-$)/1e3;break;case"minute":ae=(this-$)/6e4;break;case"hour":ae=(this-$)/36e5;break;case"day":ae=(this-$-H)/864e5;break;case"week":ae=(this-$-H)/6048e5;break;default:ae=this-$}return B?ae:Pn(ae)}function Sp(g,S){if(g.date()<S.date())return-Sp(S,g);var B=(S.year()-g.year())*12+(S.month()-g.month()),$=g.clone().add(B,"months"),H,ae;return S-$<0?(H=g.clone().add(B-1,"months"),ae=(S-$)/($-H)):(H=g.clone().add(B+1,"months"),ae=(S-$)/(H-$)),-(B+ae)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function UU(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function qU(g){if(!this.isValid())return null;var S=g!==!0,B=S?this.clone().utc():this;return B.year()<0||B.year()>9999?oe(B,S?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?S?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",oe(B,"Z")):oe(B,S?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function zU(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",S="",B,$,H,ae;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",S="Z"),B="["+g+'("]',$=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",H="-MM-DD[T]HH:mm:ss.SSS",ae=S+'[")]',this.format(B+$+H+ae)}function HU(g){g||(g=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var S=oe(this,g);return this.localeData().postformat(S)}function GU(g,S){return this.isValid()&&(x(g)&&g.isValid()||Kr(g).isValid())?eo({to:this,from:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function WU(g){return this.from(Kr(),g)}function YU(g,S){return this.isValid()&&(x(g)&&g.isValid()||Kr(g).isValid())?eo({from:this,to:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function jU(g){return this.to(Kr(),g)}function g_(g){var S;return g===void 0?this._locale._abbr:(S=jo(g),S!=null&&(this._locale=S),this)}var v_=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(g){return g===void 0?this.localeData():this.locale(g)});function y_(){return this._locale}var Ep=1e3,gl=60*Ep,Tp=60*gl,b_=(365*400+97)*24*Tp;function vl(g,S){return(g%S+S)%S}function x_(g,S,B){return g<100&&g>=0?new Date(g+400,S,B)-b_:new Date(g,S,B).valueOf()}function w_(g,S,B){return g<100&&g>=0?Date.UTC(g+400,S,B)-b_:Date.UTC(g,S,B)}function ZU(g){var S,B;if(g=De(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(B=this._isUTC?w_:x_,g){case"year":S=B(this.year(),0,1);break;case"quarter":S=B(this.year(),this.month()-this.month()%3,1);break;case"month":S=B(this.year(),this.month(),1);break;case"week":S=B(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":S=B(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":S=B(this.year(),this.month(),this.date());break;case"hour":S=this._d.valueOf(),S-=vl(S+(this._isUTC?0:this.utcOffset()*gl),Tp);break;case"minute":S=this._d.valueOf(),S-=vl(S,gl);break;case"second":S=this._d.valueOf(),S-=vl(S,Ep);break}return this._d.setTime(S),e.updateOffset(this,!0),this}function JU(g){var S,B;if(g=De(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(B=this._isUTC?w_:x_,g){case"year":S=B(this.year()+1,0,1)-1;break;case"quarter":S=B(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":S=B(this.year(),this.month()+1,1)-1;break;case"week":S=B(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":S=B(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":S=B(this.year(),this.month(),this.date()+1)-1;break;case"hour":S=this._d.valueOf(),S+=Tp-vl(S+(this._isUTC?0:this.utcOffset()*gl),Tp)-1;break;case"minute":S=this._d.valueOf(),S+=gl-vl(S,gl)-1;break;case"second":S=this._d.valueOf(),S+=Ep-vl(S,Ep)-1;break}return this._d.setTime(S),e.updateOffset(this,!0),this}function XU(){return this._d.valueOf()-(this._offset||0)*6e4}function QU(){return Math.floor(this.valueOf()/1e3)}function KU(){return new Date(this.valueOf())}function e5(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function t5(){var g=this;return{years:g.year(),months:g.month(),date:g.date(),hours:g.hours(),minutes:g.minutes(),seconds:g.seconds(),milliseconds:g.milliseconds()}}function r5(){return this.isValid()?this.toISOString():null}function n5(){return b(this)}function i5(){return f({},d(this))}function a5(){return d(this).overflow}function o5(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),Ve("N",yy),Ve("NN",yy),Ve("NNN",yy),Ve("NNNN",v5),Ve("NNNNN",y5),Nr(["N","NN","NNN","NNNN","NNNNN"],function(g,S,B,$){var H=B._locale.erasParse(g,$,B._strict);H?d(B).era=H:d(B).invalidEra=g}),Ve("y",_e),Ve("yy",_e),Ve("yyy",_e),Ve("yyyy",_e),Ve("yo",b5),Nr(["y","yy","yyy","yyyy"],_n),Nr(["yo"],function(g,S,B,$){var H;B._locale._eraYearOrdinalRegex&&(H=g.match(B._locale._eraYearOrdinalRegex)),B._locale.eraYearOrdinalParse?S[_n]=B._locale.eraYearOrdinalParse(g,H):S[_n]=parseInt(g,10)});function s5(g,S){var B,$,H,ae=this._eras||jo("en")._eras;for(B=0,$=ae.length;B<$;++B){switch(typeof ae[B].since){case"string":H=e(ae[B].since).startOf("day"),ae[B].since=H.valueOf();break}switch(typeof ae[B].until){case"undefined":ae[B].until=1/0;break;case"string":H=e(ae[B].until).startOf("day").valueOf(),ae[B].until=H.valueOf();break}}return ae}function u5(g,S,B){var $,H,ae=this.eras(),Te,mt,Jt;for(g=g.toUpperCase(),$=0,H=ae.length;$<H;++$)if(Te=ae[$].name.toUpperCase(),mt=ae[$].abbr.toUpperCase(),Jt=ae[$].narrow.toUpperCase(),B)switch(S){case"N":case"NN":case"NNN":if(mt===g)return ae[$];break;case"NNNN":if(Te===g)return ae[$];break;case"NNNNN":if(Jt===g)return ae[$];break}else if([Te,mt,Jt].indexOf(g)>=0)return ae[$]}function l5(g,S){var B=g.since<=g.until?1:-1;return S===void 0?e(g.since).year():e(g.since).year()+(S-g.offset)*B}function c5(){var g,S,B,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(B=this.clone().startOf("day").valueOf(),$[g].since<=B&&B<=$[g].until||$[g].until<=B&&B<=$[g].since)return $[g].name;return""}function f5(){var g,S,B,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(B=this.clone().startOf("day").valueOf(),$[g].since<=B&&B<=$[g].until||$[g].until<=B&&B<=$[g].since)return $[g].narrow;return""}function p5(){var g,S,B,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(B=this.clone().startOf("day").valueOf(),$[g].since<=B&&B<=$[g].until||$[g].until<=B&&B<=$[g].since)return $[g].abbr;return""}function m5(){var g,S,B,$,H=this.localeData().eras();for(g=0,S=H.length;g<S;++g)if(B=H[g].since<=H[g].until?1:-1,$=this.clone().startOf("day").valueOf(),H[g].since<=$&&$<=H[g].until||H[g].until<=$&&$<=H[g].since)return(this.year()-e(H[g].since).year())*B+H[g].offset;return this.year()}function d5(g){return a(this,"_erasNameRegex")||by.call(this),g?this._erasNameRegex:this._erasRegex}function h5(g){return a(this,"_erasAbbrRegex")||by.call(this),g?this._erasAbbrRegex:this._erasRegex}function g5(g){return a(this,"_erasNarrowRegex")||by.call(this),g?this._erasNarrowRegex:this._erasRegex}function yy(g,S){return S.erasAbbrRegex(g)}function v5(g,S){return S.erasNameRegex(g)}function y5(g,S){return S.erasNarrowRegex(g)}function b5(g,S){return S._eraYearOrdinalRegex||_e}function by(){var g=[],S=[],B=[],$=[],H,ae,Te,mt,Jt,br=this.eras();for(H=0,ae=br.length;H<ae;++H)Te=Xr(br[H].name),mt=Xr(br[H].abbr),Jt=Xr(br[H].narrow),S.push(Te),g.push(mt),B.push(Jt),$.push(Te),$.push(mt),$.push(Jt);this._erasRegex=new RegExp("^("+$.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+S.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+g.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+B.join("|")+")","i")}U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Mp(g,S){U(0,[g,g.length],0,S)}Mp("gggg","weekYear"),Mp("ggggg","weekYear"),Mp("GGGG","isoWeekYear"),Mp("GGGGG","isoWeekYear"),Ve("G",Ge),Ve("g",Ge),Ve("GG",Pe,qe),Ve("gg",Pe,qe),Ve("GGGG",Ne,Wt),Ve("gggg",Ne,Wt),Ve("GGGGG",Be,pr),Ve("ggggg",Be,pr),Ri(["gggg","ggggg","GGGG","GGGGG"],function(g,S,B,$){S[$.substr(0,2)]=lr(g)}),Ri(["gg","GG"],function(g,S,B,$){S[$]=e.parseTwoDigitYear(g)});function x5(g){return __.call(this,g,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function w5(g){return __.call(this,g,this.isoWeek(),this.isoWeekday(),1,4)}function _5(){return Yo(this.year(),1,4)}function A5(){return Yo(this.isoWeekYear(),1,4)}function D5(){var g=this.localeData()._week;return Yo(this.year(),g.dow,g.doy)}function S5(){var g=this.localeData()._week;return Yo(this.weekYear(),g.dow,g.doy)}function __(g,S,B,$,H){var ae;return g==null?Jc(this,$,H).year:(ae=Yo(g,$,H),S>ae&&(S=ae),E5.call(this,g,S,B,$,H))}function E5(g,S,B,$,H){var ae=Kw(g,S,B,$,H),Te=Zc(ae.year,0,ae.dayOfYear);return this.year(Te.getUTCFullYear()),this.month(Te.getUTCMonth()),this.date(Te.getUTCDate()),this}U("Q",0,"Qo","quarter"),Ve("Q",wt),Nr("Q",function(g,S){S[$n]=(lr(g)-1)*3});function T5(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),Ve("D",Pe,Qe),Ve("DD",Pe,qe),Ve("Do",function(g,S){return g?S._dayOfMonthOrdinalParse||S._ordinalParse:S._dayOfMonthOrdinalParseLenient}),Nr(["D","DD"],Li),Nr("Do",function(g,S){S[Li]=lr(g.match(Pe)[0])});var A_=wo("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),Ve("DDD",pe),Ve("DDDD",rr),Nr(["DDD","DDDD"],function(g,S,B){B._dayOfYear=lr(g)});function M5(g){var S=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?S:this.add(g-S,"d")}U("m",["mm",2],0,"minute"),Ve("m",Pe,gt),Ve("mm",Pe,qe),Nr(["m","mm"],Xn);var C5=wo("Minutes",!1);U("s",["ss",2],0,"second"),Ve("s",Pe,gt),Ve("ss",Pe,qe),Nr(["s","ss"],An);var N5=wo("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return this.millisecond()*10}),U(0,["SSSSS",5],0,function(){return this.millisecond()*100}),U(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),U(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),U(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),U(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ve("S",pe,wt),Ve("SS",pe,qe),Ve("SSS",pe,rr);var ks,D_;for(ks="SSSS";ks.length<=9;ks+="S")Ve(ks,_e);function F5(g,S){S[Vi]=lr(("0."+g)*1e3)}for(ks="S";ks.length<=9;ks+="S")Nr(ks,F5);D_=wo("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function I5(){return this._isUTC?"UTC":""}function B5(){return this._isUTC?"Coordinated Universal Time":""}var ze=w.prototype;ze.add=SU,ze.calendar=IU,ze.clone=BU,ze.diff=VU,ze.endOf=JU,ze.format=HU,ze.from=GU,ze.fromNow=WU,ze.to=YU,ze.toNow=jU,ze.get=dl,ze.invalidAt=a5,ze.isAfter=kU,ze.isBefore=PU,ze.isBetween=$U,ze.isSame=OU,ze.isSameOrAfter=RU,ze.isSameOrBefore=LU,ze.isValid=n5,ze.lang=v_,ze.locale=g_,ze.localeData=y_,ze.max=nU,ze.min=rU,ze.parsingFlags=i5,ze.set=Yc,ze.startOf=ZU,ze.subtract=EU,ze.toArray=e5,ze.toObject=t5,ze.toDate=KU,ze.toISOString=qU,ze.inspect=zU,typeof Symbol<"u"&&Symbol.for!=null&&(ze[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ze.toJSON=r5,ze.toString=UU,ze.unix=QU,ze.valueOf=XU,ze.creationData=o5,ze.eraName=c5,ze.eraNarrow=f5,ze.eraAbbr=p5,ze.eraYear=m5,ze.year=Go,ze.isLeapYear=pl,ze.weekYear=x5,ze.isoWeekYear=w5,ze.quarter=ze.quarters=T5,ze.month=Xw,ze.daysInMonth=K4,ze.week=ze.weeks=sV,ze.isoWeek=ze.isoWeeks=uV,ze.weeksInYear=D5,ze.weeksInWeekYear=S5,ze.isoWeeksInYear=_5,ze.isoWeeksInISOWeekYear=A5,ze.date=A_,ze.day=ze.days=wV,ze.weekday=_V,ze.isoWeekday=AV,ze.dayOfYear=M5,ze.hour=ze.hours=NV,ze.minute=ze.minutes=C5,ze.second=ze.seconds=N5,ze.millisecond=ze.milliseconds=D_,ze.utcOffset=pU,ze.utc=dU,ze.local=hU,ze.parseZone=gU,ze.hasAlignedHourOffset=vU,ze.isDST=yU,ze.isLocal=xU,ze.isUtcOffset=wU,ze.isUtc=f_,ze.isUTC=f_,ze.zoneAbbr=I5,ze.zoneName=B5,ze.dates=T("dates accessor is deprecated. Use date instead.",A_),ze.months=T("months accessor is deprecated. Use month instead",Xw),ze.years=T("years accessor is deprecated. Use year instead",Go),ze.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",mU),ze.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",bU);function k5(g){return Kr(g*1e3)}function P5(){return Kr.apply(null,arguments).parseZone()}function S_(g){return g}var Ir=L.prototype;Ir.calendar=k,Ir.longDateFormat=Z,Ir.invalidDate=me,Ir.ordinal=we,Ir.preparse=S_,Ir.postformat=S_,Ir.relativeTime=J,Ir.pastFuture=ge,Ir.set=I,Ir.eras=s5,Ir.erasParse=u5,Ir.erasConvertYear=l5,Ir.erasAbbrRegex=h5,Ir.erasNameRegex=d5,Ir.erasNarrowRegex=g5,Ir.months=Fr,Ir.monthsShort=Mn,Ir.monthsParse=Wo,Ir.monthsRegex=tV,Ir.monthsShortRegex=eV,Ir.week=nV,Ir.firstDayOfYear=oV,Ir.firstDayOfWeek=aV,Ir.weekdays=gV,Ir.weekdaysMin=yV,Ir.weekdaysShort=vV,Ir.weekdaysParse=xV,Ir.weekdaysRegex=DV,Ir.weekdaysShortRegex=SV,Ir.weekdaysMinRegex=EV,Ir.isPM=MV,Ir.meridiem=FV;function Cp(g,S,B,$){var H=jo(),ae=m().set($,S);return H[B](ae,g)}function E_(g,S,B){if(l(g)&&(S=g,g=void 0),g=g||"",S!=null)return Cp(g,S,B,"month");var $,H=[];for($=0;$<12;$++)H[$]=Cp(g,$,B,"month");return H}function xy(g,S,B,$){typeof g=="boolean"?(l(S)&&(B=S,S=void 0),S=S||""):(S=g,B=S,g=!1,l(S)&&(B=S,S=void 0),S=S||"");var H=jo(),ae=g?H._week.dow:0,Te,mt=[];if(B!=null)return Cp(S,(B+ae)%7,$,"day");for(Te=0;Te<7;Te++)mt[Te]=Cp(S,(Te+ae)%7,$,"day");return mt}function $5(g,S){return E_(g,S,"months")}function O5(g,S){return E_(g,S,"monthsShort")}function R5(g,S,B){return xy(g,S,B,"weekdays")}function L5(g,S,B){return xy(g,S,B,"weekdaysShort")}function V5(g,S,B){return xy(g,S,B,"weekdaysMin")}Bs("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(g){var S=g%10,B=lr(g%100/10)===1?"th":S===1?"st":S===2?"nd":S===3?"rd":"th";return g+B}}),e.lang=T("moment.lang is deprecated. Use moment.locale instead.",Bs),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",jo);var Zo=Math.abs;function U5(){var g=this._data;return this._milliseconds=Zo(this._milliseconds),this._days=Zo(this._days),this._months=Zo(this._months),g.milliseconds=Zo(g.milliseconds),g.seconds=Zo(g.seconds),g.minutes=Zo(g.minutes),g.hours=Zo(g.hours),g.months=Zo(g.months),g.years=Zo(g.years),this}function T_(g,S,B,$){var H=eo(S,B);return g._milliseconds+=$*H._milliseconds,g._days+=$*H._days,g._months+=$*H._months,g._bubble()}function q5(g,S){return T_(this,g,S,1)}function z5(g,S){return T_(this,g,S,-1)}function M_(g){return g<0?Math.floor(g):Math.ceil(g)}function H5(){var g=this._milliseconds,S=this._days,B=this._months,$=this._data,H,ae,Te,mt,Jt;return g>=0&&S>=0&&B>=0||g<=0&&S<=0&&B<=0||(g+=M_(wy(B)+S)*864e5,S=0,B=0),$.milliseconds=g%1e3,H=Pn(g/1e3),$.seconds=H%60,ae=Pn(H/60),$.minutes=ae%60,Te=Pn(ae/60),$.hours=Te%24,S+=Pn(Te/24),Jt=Pn(C_(S)),B+=Jt,S-=M_(wy(Jt)),mt=Pn(B/12),B%=12,$.days=S,$.months=B,$.years=mt,this}function C_(g){return g*4800/146097}function wy(g){return g*146097/4800}function G5(g){if(!this.isValid())return NaN;var S,B,$=this._milliseconds;if(g=De(g),g==="month"||g==="quarter"||g==="year")switch(S=this._days+$/864e5,B=this._months+C_(S),g){case"month":return B;case"quarter":return B/3;case"year":return B/12}else switch(S=this._days+Math.round(wy(this._months)),g){case"week":return S/7+$/6048e5;case"day":return S+$/864e5;case"hour":return S*24+$/36e5;case"minute":return S*1440+$/6e4;case"second":return S*86400+$/1e3;case"millisecond":return Math.floor(S*864e5)+$;default:throw new Error("Unknown unit "+g)}}function Jo(g){return function(){return this.as(g)}}var N_=Jo("ms"),W5=Jo("s"),Y5=Jo("m"),j5=Jo("h"),Z5=Jo("d"),J5=Jo("w"),X5=Jo("M"),Q5=Jo("Q"),K5=Jo("y"),e8=N_;function t8(){return eo(this)}function r8(g){return g=De(g),this.isValid()?this[g+"s"]():NaN}function gu(g){return function(){return this.isValid()?this._data[g]:NaN}}var n8=gu("milliseconds"),i8=gu("seconds"),a8=gu("minutes"),o8=gu("hours"),s8=gu("days"),u8=gu("months"),l8=gu("years");function c8(){return Pn(this.days()/7)}var Xo=Math.round,yl={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function f8(g,S,B,$,H){return H.relativeTime(S||1,!!B,g,$)}function p8(g,S,B,$){var H=eo(g).abs(),ae=Xo(H.as("s")),Te=Xo(H.as("m")),mt=Xo(H.as("h")),Jt=Xo(H.as("d")),br=Xo(H.as("M")),Ei=Xo(H.as("w")),Qo=Xo(H.as("y")),Ps=ae<=B.ss&&["s",ae]||ae<B.s&&["ss",ae]||Te<=1&&["m"]||Te<B.m&&["mm",Te]||mt<=1&&["h"]||mt<B.h&&["hh",mt]||Jt<=1&&["d"]||Jt<B.d&&["dd",Jt];return B.w!=null&&(Ps=Ps||Ei<=1&&["w"]||Ei<B.w&&["ww",Ei]),Ps=Ps||br<=1&&["M"]||br<B.M&&["MM",br]||Qo<=1&&["y"]||["yy",Qo],Ps[2]=S,Ps[3]=+g>0,Ps[4]=$,f8.apply(null,Ps)}function m8(g){return g===void 0?Xo:typeof g=="function"?(Xo=g,!0):!1}function d8(g,S){return yl[g]===void 0?!1:S===void 0?yl[g]:(yl[g]=S,g==="s"&&(yl.ss=S-1),!0)}function h8(g,S){if(!this.isValid())return this.localeData().invalidDate();var B=!1,$=yl,H,ae;return typeof g=="object"&&(S=g,g=!1),typeof g=="boolean"&&(B=g),typeof S=="object"&&($=Object.assign({},yl,S),S.s!=null&&S.ss==null&&($.ss=S.s-1)),H=this.localeData(),ae=p8(this,!B,$,H),B&&(ae=H.pastFuture(+this,ae)),H.postformat(ae)}var _y=Math.abs;function bl(g){return(g>0)-(g<0)||+g}function Np(){if(!this.isValid())return this.localeData().invalidDate();var g=_y(this._milliseconds)/1e3,S=_y(this._days),B=_y(this._months),$,H,ae,Te,mt=this.asSeconds(),Jt,br,Ei,Qo;return mt?($=Pn(g/60),H=Pn($/60),g%=60,$%=60,ae=Pn(B/12),B%=12,Te=g?g.toFixed(3).replace(/\.?0+$/,""):"",Jt=mt<0?"-":"",br=bl(this._months)!==bl(mt)?"-":"",Ei=bl(this._days)!==bl(mt)?"-":"",Qo=bl(this._milliseconds)!==bl(mt)?"-":"",Jt+"P"+(ae?br+ae+"Y":"")+(B?br+B+"M":"")+(S?Ei+S+"D":"")+(H||$||g?"T":"")+(H?Qo+H+"H":"")+($?Qo+$+"M":"")+(g?Qo+Te+"S":"")):"P0D"}var wr=Ap.prototype;wr.isValid=uU,wr.abs=U5,wr.add=q5,wr.subtract=z5,wr.as=G5,wr.asMilliseconds=N_,wr.asSeconds=W5,wr.asMinutes=Y5,wr.asHours=j5,wr.asDays=Z5,wr.asWeeks=J5,wr.asMonths=X5,wr.asQuarters=Q5,wr.asYears=K5,wr.valueOf=e8,wr._bubble=H5,wr.clone=t8,wr.get=r8,wr.milliseconds=n8,wr.seconds=i8,wr.minutes=a8,wr.hours=o8,wr.days=s8,wr.weeks=c8,wr.months=u8,wr.years=l8,wr.humanize=h8,wr.toISOString=Np,wr.toString=Np,wr.toJSON=Np,wr.locale=g_,wr.localeData=y_,wr.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Np),wr.lang=v_,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Ve("x",Ge),Ve("X",ie),Nr("X",function(g,S,B){B._d=new Date(parseFloat(g)*1e3)}),Nr("x",function(g,S,B){B._d=new Date(lr(g))});return e.version="2.30.1",r(Kr),e.fn=ze,e.min=iU,e.max=aU,e.now=oU,e.utc=m,e.unix=k5,e.months=$5,e.isDate=u,e.locale=Bs,e.invalid=y,e.duration=eo,e.isMoment=x,e.weekdays=R5,e.parseZone=P5,e.localeData=jo,e.isDuration=Dp,e.monthsShort=O5,e.weekdaysMin=V5,e.defineLocale=ly,e.updateLocale=PV,e.locales=$V,e.weekdaysShort=L5,e.normalizeUnits=De,e.relativeTimeRounding=m8,e.relativeTimeThreshold=d8,e.calendarFormat=FU,e.prototype=ze,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var Ih=On((_x,Ax)=>{(function(t,e){typeof _x=="object"&&typeof Ax<"u"?Ax.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t["'typed'"]=e())})(_x,function(){"use strict";function t(){return!0}function e(){return!1}function r(){}let n="Argument is not a typed-function.";function i(){function o(j){return typeof j=="object"&&j!==null&&j.constructor===Object}let s=[{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}}],l={name:"any",test:t,isAny:!0},u,c,f=0,m={createCount:0};function p(j){let de=u.get(j);if(de)return de;let pe='Unknown type "'+j+'"',Ne=j.toLowerCase(),Be;for(Be of c)if(Be.toLowerCase()===Ne){pe+='. Did you mean "'+Be+'" ?';break}throw new TypeError(pe)}function d(j){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",pe=de?p(de).index:c.length,Ne=[];for(let _e=0;_e<j.length;++_e){if(!j[_e]||typeof j[_e].name!="string"||typeof j[_e].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Ge=j[_e].name;if(u.has(Ge))throw new TypeError('Duplicate type name "'+Ge+'"');Ne.push(Ge),u.set(Ge,{name:Ge,test:j[_e].test,isAny:j[_e].isAny,index:pe+_e,conversionsTo:[]})}let Be=c.slice(pe);c=c.slice(0,pe).concat(Ne).concat(Be);for(let _e=pe+Ne.length;_e<c.length;++_e)u.get(c[_e]).index=_e}function h(){u=new Map,c=[],f=0,d([l],!1)}h(),d(s);function b(){let j;for(j of c)u.get(j).conversionsTo=[];f=0}function y(j){let de=c.filter(pe=>{let Ne=u.get(pe);return!Ne.isAny&&Ne.test(j)});return de.length?de:["any"]}function D(j){return j&&typeof j=="function"&&"_typedFunctionData"in j}function v(j,de,pe){if(!D(j))throw new TypeError(n);let Ne=pe&&pe.exact,Be=Array.isArray(de)?de.join(","):de,_e=C(Be),Ge=x(_e);if(!Ne||Ge in j.signatures){let Me=j._typedFunctionData.signatureMap.get(Ge);if(Me)return Me}let F=_e.length,Y;if(Ne){Y=[];let Me;for(Me in j.signatures)Y.push(j._typedFunctionData.signatureMap.get(Me))}else Y=j._typedFunctionData.signatures;for(let Me=0;Me<F;++Me){let Qe=_e[Me],gt=[],hr;for(hr of Y){let Ve=L(hr.params,Me);if(!(!Ve||Qe.restParam&&!Ve.restParam)){if(!Ve.hasAny){let si=_(Ve);if(Qe.types.some(Si=>!si.has(Si.name)))continue}gt.push(hr)}}if(Y=gt,Y.length===0)break}let ie;for(ie of Y)if(ie.params.length<=F)return ie;throw new TypeError("Signature not found (signature: "+(j.name||"unnamed")+"("+x(_e,", ")+"))")}function A(j,de,pe){return v(j,de,pe).implementation}function w(j,de){let pe=p(de);if(pe.test(j))return j;let Ne=pe.conversionsTo;if(Ne.length===0)throw new Error("There are no conversions to "+de+" defined.");for(let Be=0;Be<Ne.length;Be++)if(p(Ne[Be].from).test(j))return Ne[Be].convert(j);throw new Error("Cannot convert "+j+" to "+de)}function x(j){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return j.map(pe=>pe.name).join(de)}function E(j){let de=j.indexOf("...")===0,Ne=(de?j.length>3?j.slice(3):"any":j).split("|").map(F=>p(F.trim())),Be=!1,_e=de?"...":"";return{types:Ne.map(function(F){return Be=F.isAny||Be,_e+=F.name+"|",{name:F.name,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:null,conversionIndex:-1}}),name:_e.slice(0,-1),hasAny:Be,hasConversion:!1,restParam:de}}function T(j){let de=j.types.map(Ge=>Ge.name),pe=U(de),Ne=j.hasAny,Be=j.name,_e=pe.map(function(Ge){let F=p(Ge.from);return Ne=F.isAny||Ne,Be+="|"+Ge.from,{name:Ge.from,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:Ge,conversionIndex:Ge.index}});return{types:j.types.concat(_e),name:Be,hasAny:Ne,hasConversion:_e.length>0,restParam:j.restParam}}function _(j){return j.typeSet||(j.typeSet=new Set,j.types.forEach(de=>j.typeSet.add(de.name))),j.typeSet}function C(j){let de=[];if(typeof j!="string")throw new TypeError("Signatures must be strings");let pe=j.trim();if(pe==="")return de;let Ne=pe.split(",");for(let Be=0;Be<Ne.length;++Be){let _e=E(Ne[Be].trim());if(_e.restParam&&Be!==Ne.length-1)throw new SyntaxError('Unexpected rest parameter "'+Ne[Be]+'": only allowed for the last parameter');if(_e.types.length===0)return null;de.push(_e)}return de}function N(j){let de=G(j);return de?de.restParam:!1}function I(j){if(!j||j.types.length===0)return t;if(j.types.length===1)return p(j.types[0].name).test;if(j.types.length===2){let de=p(j.types[0].name).test,pe=p(j.types[1].name).test;return function(Be){return de(Be)||pe(Be)}}else{let de=j.types.map(function(pe){return p(pe.name).test});return function(Ne){for(let Be=0;Be<de.length;Be++)if(de[Be](Ne))return!0;return!1}}}function R(j){let de,pe,Ne;if(N(j)){de=we(j).map(I);let Be=de.length,_e=I(G(j)),Ge=function(F){for(let Y=Be;Y<F.length;Y++)if(!_e(F[Y]))return!1;return!0};return function(Y){for(let ie=0;ie<de.length;ie++)if(!de[ie](Y[ie]))return!1;return Ge(Y)&&Y.length>=Be+1}}else return j.length===0?function(_e){return _e.length===0}:j.length===1?(pe=I(j[0]),function(_e){return pe(_e[0])&&_e.length===1}):j.length===2?(pe=I(j[0]),Ne=I(j[1]),function(_e){return pe(_e[0])&&Ne(_e[1])&&_e.length===2}):(de=j.map(I),function(_e){for(let Ge=0;Ge<de.length;Ge++)if(!de[Ge](_e[Ge]))return!1;return _e.length===de.length})}function L(j,de){return de<j.length?j[de]:N(j)?G(j):null}function V(j,de){let pe=L(j,de);return pe?_(pe):new Set}function P(j){return j.conversion===null||j.conversion===void 0}function k(j,de){let pe=new Set;return j.forEach(Ne=>{let Be=V(Ne.params,de),_e;for(_e of Be)pe.add(_e)}),pe.has("any")?["any"]:Array.from(pe)}function W(j,de,pe){let Ne,Be,_e=j||"unnamed",Ge=pe,F;for(F=0;F<de.length;F++){let Qe=[];if(Ge.forEach(gt=>{let hr=L(gt.params,F),Ve=I(hr);(F<gt.params.length||N(gt.params))&&Ve(de[F])&&Qe.push(gt)}),Qe.length===0){if(Be=k(Ge,F),Be.length>0){let gt=y(de[F]);return Ne=new TypeError("Unexpected type of argument in function "+_e+" (expected: "+Be.join(" or ")+", actual: "+gt.join(" | ")+", index: "+F+")"),Ne.data={category:"wrongType",fn:_e,index:F,actual:gt,expected:Be},Ne}}else Ge=Qe}let Y=Ge.map(function(Qe){return N(Qe.params)?1/0:Qe.params.length});if(de.length<Math.min.apply(null,Y))return Be=k(Ge,F),Ne=new TypeError("Too few arguments in function "+_e+" (expected: "+Be.join(" or ")+", index: "+de.length+")"),Ne.data={category:"tooFewArgs",fn:_e,index:de.length,expected:Be},Ne;let ie=Math.max.apply(null,Y);if(de.length>ie)return Ne=new TypeError("Too many arguments in function "+_e+" (expected: "+ie+", actual: "+de.length+")"),Ne.data={category:"tooManyArgs",fn:_e,index:de.length,expectedLength:ie},Ne;let Me=[];for(let Qe=0;Qe<de.length;++Qe)Me.push(y(de[Qe]).join("|"));return Ne=new TypeError('Arguments of type "'+Me.join(", ")+'" do not match any of the defined signatures of function '+_e+"."),Ne.data={category:"mismatch",actual:Me},Ne}function O(j){let de=c.length+1;for(let pe=0;pe<j.types.length;pe++)P(j.types[pe])&&(de=Math.min(de,j.types[pe].typeIndex));return de}function Q(j){let de=f+1;for(let pe=0;pe<j.types.length;pe++)P(j.types[pe])||(de=Math.min(de,j.types[pe].conversionIndex));return de}function ne(j,de){if(j.hasAny){if(!de.hasAny)return 1}else if(de.hasAny)return-1;if(j.restParam){if(!de.restParam)return 1}else if(de.restParam)return-1;if(j.hasConversion){if(!de.hasConversion)return 1}else if(de.hasConversion)return-1;let pe=O(j)-O(de);if(pe<0)return-1;if(pe>0)return 1;let Ne=Q(j)-Q(de);return Ne<0?-1:Ne>0?1:0}function X(j,de){let pe=j.params,Ne=de.params,Be=G(pe),_e=G(Ne),Ge=N(pe),F=N(Ne);if(Ge&&Be.hasAny){if(!F||!_e.hasAny)return 1}else if(F&&_e.hasAny)return-1;let Y=0,ie=0,Me;for(Me of pe)Me.hasAny&&++Y,Me.hasConversion&&++ie;let Qe=0,gt=0;for(Me of Ne)Me.hasAny&&++Qe,Me.hasConversion&&++gt;if(Y!==Qe)return Y-Qe;if(Ge&&Be.hasConversion){if(!F||!_e.hasConversion)return 1}else if(F&&_e.hasConversion)return-1;if(ie!==gt)return ie-gt;if(Ge){if(!F)return 1}else if(F)return-1;let hr=(pe.length-Ne.length)*(Ge?-1:1);if(hr!==0)return hr;let Ve=[],si=0;for(let Xr=0;Xr<pe.length;++Xr){let Pn=ne(pe[Xr],Ne[Xr]);Ve.push(Pn),si+=Pn}if(si!==0)return si;let Si;for(Si of Ve)if(Si!==0)return Si;return 0}function U(j){if(j.length===0)return[];let de=j.map(p);j.length>1&&de.sort((Be,_e)=>Be.index-_e.index);let pe=de[0].conversionsTo;if(j.length===1)return pe;pe=pe.concat([]);let Ne=new Set(j);for(let Be=1;Be<de.length;++Be){let _e;for(_e of de[Be].conversionsTo)Ne.has(_e.from)||(pe.push(_e),Ne.add(_e.from))}return pe}function fe(j,de){let pe=de;if(j.some(Be=>Be.hasConversion)){let Be=N(j),_e=j.map(xe);pe=function(){let F=[],Y=Be?arguments.length-1:arguments.length;for(let ie=0;ie<Y;ie++)F[ie]=_e[ie](arguments[ie]);return Be&&(F[Y]=arguments[Y].map(_e[Y])),de.apply(this,F)}}let Ne=pe;if(N(j)){let Be=j.length-1;Ne=function(){return pe.apply(this,J(arguments,0,Be).concat([J(arguments,Be)]))}}return Ne}function xe(j){let de,pe,Ne,Be,_e=[],Ge=[];switch(j.types.forEach(function(F){F.conversion&&(_e.push(p(F.conversion.from).test),Ge.push(F.conversion.convert))}),Ge.length){case 0:return function(Y){return Y};case 1:return de=_e[0],Ne=Ge[0],function(Y){return de(Y)?Ne(Y):Y};case 2:return de=_e[0],pe=_e[1],Ne=Ge[0],Be=Ge[1],function(Y){return de(Y)?Ne(Y):pe(Y)?Be(Y):Y};default:return function(Y){for(let ie=0;ie<Ge.length;ie++)if(_e[ie](Y))return Ge[ie](Y);return Y}}}function oe(j){function de(pe,Ne,Be){if(Ne<pe.length){let _e=pe[Ne],Ge=[];if(_e.restParam){let F=_e.types.filter(P);F.length<_e.types.length&&Ge.push({types:F,name:"..."+F.map(Y=>Y.name).join("|"),hasAny:F.some(Y=>Y.isAny),hasConversion:!1,restParam:!0}),Ge.push(_e)}else Ge=_e.types.map(function(F){return{types:[F],name:F.name,hasAny:F.isAny,hasConversion:F.conversion,restParam:!1}});return ye(Ge,function(F){return de(pe,Ne+1,Be.concat([F]))})}else return[Be]}return de(j,0,[])}function be(j,de){let pe=Math.max(j.length,de.length);for(let F=0;F<pe;F++){let Y=V(j,F),ie=V(de,F),Me=!1,Qe;for(Qe of ie)if(Y.has(Qe)){Me=!0;break}if(!Me)return!1}let Ne=j.length,Be=de.length,_e=N(j),Ge=N(de);return _e?Ge?Ne===Be:Be>=Ne:Ge?Ne>=Be:Ne===Be}function ee(j){return j.map(de=>wt(de)?Oe(de.referToSelf.callback):Je(de)?Ie(de.referTo.references,de.referTo.callback):de)}function Z(j,de,pe){let Ne=[],Be;for(Be of j){let _e=pe[Be];if(typeof _e!="number")throw new TypeError('No definition for referenced signature "'+Be+'"');if(_e=de[_e],typeof _e!="function")return!1;Ne.push(_e)}return Ne}function re(j,de,pe){let Ne=ee(j),Be=new Array(Ne.length).fill(!1),_e=!0;for(;_e;){_e=!1;let Ge=!0;for(let F=0;F<Ne.length;++F){if(Be[F])continue;let Y=Ne[F];if(wt(Y))Ne[F]=Y.referToSelf.callback(pe),Ne[F].referToSelf=Y.referToSelf,Be[F]=!0,Ge=!1;else if(Je(Y)){let ie=Z(Y.referTo.references,Ne,de);ie?(Ne[F]=Y.referTo.callback.apply(this,ie),Ne[F].referTo=Y.referTo,Be[F]=!0,Ge=!1):_e=!0}}if(Ge&&_e)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Ne}function me(j){let de=/\bthis(\(|\.signatures\b)/;Object.keys(j).forEach(pe=>{let Ne=j[pe];if(de.test(Ne.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 ce(j,de){if(m.createCount++,Object.keys(de).length===0)throw new SyntaxError("No signatures provided");m.warnAgainstDeprecatedThis&&me(de);let pe=[],Ne=[],Be={},_e=[],Ge;for(Ge in de){if(!Object.prototype.hasOwnProperty.call(de,Ge))continue;let Ue=C(Ge);if(!Ue)continue;pe.forEach(function(Cn){if(be(Cn,Ue))throw new TypeError('Conflicting signatures "'+x(Cn)+'" and "'+x(Ue)+'".')}),pe.push(Ue);let Rt=Ne.length;Ne.push(de[Ge]);let Fr=Ue.map(T),Mn;for(Mn of oe(Fr)){let Cn=x(Mn);_e.push({params:Mn,name:Cn,fn:Rt}),Mn.every(Wo=>!Wo.hasConversion)&&(Be[Cn]=Rt)}}_e.sort(X);let F=re(Ne,Be,je),Y;for(Y in Be)Object.prototype.hasOwnProperty.call(Be,Y)&&(Be[Y]=F[Be[Y]]);let ie=[],Me=new Map;for(Y of _e)Me.has(Y.name)||(Y.fn=F[Y.fn],ie.push(Y),Me.set(Y.name,Y));let Qe=ie[0]&&ie[0].params.length<=2&&!N(ie[0].params),gt=ie[1]&&ie[1].params.length<=2&&!N(ie[1].params),hr=ie[2]&&ie[2].params.length<=2&&!N(ie[2].params),Ve=ie[3]&&ie[3].params.length<=2&&!N(ie[3].params),si=ie[4]&&ie[4].params.length<=2&&!N(ie[4].params),Si=ie[5]&&ie[5].params.length<=2&&!N(ie[5].params),Xr=Qe&&gt&&hr&&Ve&&si&&Si;for(let Ue=0;Ue<ie.length;++Ue)ie[Ue].test=R(ie[Ue].params);let Pn=Qe?I(ie[0].params[0]):e,lr=gt?I(ie[1].params[0]):e,Is=hr?I(ie[2].params[0]):e,Nr=Ve?I(ie[3].params[0]):e,Ri=si?I(ie[4].params[0]):e,Ca=Si?I(ie[5].params[0]):e,ia=Qe?I(ie[0].params[1]):e,_n=gt?I(ie[1].params[1]):e,$n=hr?I(ie[2].params[1]):e,Li=Ve?I(ie[3].params[1]):e,nn=si?I(ie[4].params[1]):e,Xn=Si?I(ie[5].params[1]):e;for(let Ue=0;Ue<ie.length;++Ue)ie[Ue].implementation=fe(ie[Ue].params,ie[Ue].fn);let An=Qe?ie[0].implementation:r,Vi=gt?ie[1].implementation:r,Wc=hr?ie[2].implementation:r,fl=Ve?ie[3].implementation:r,Ho=si?ie[4].implementation:r,Go=Si?ie[5].implementation:r,pl=Qe?ie[0].params.length:-1,wo=gt?ie[1].params.length:-1,Ka=hr?ie[2].params.length:-1,ml=Ve?ie[3].params.length:-1,dl=si?ie[4].params.length:-1,Yc=Si?ie[5].params.length:-1,jc=Xr?6:0,Qr=ie.length,z=ie.map(Ue=>Ue.test),te=ie.map(Ue=>Ue.implementation),Ce=function(){for(let Rt=jc;Rt<Qr;Rt++)if(z[Rt](arguments))return te[Rt].apply(this,arguments);return m.onMismatch(j,arguments,ie)};function je(Ue,Rt){return arguments.length===pl&&Pn(Ue)&&ia(Rt)?An.apply(this,arguments):arguments.length===wo&&lr(Ue)&&_n(Rt)?Vi.apply(this,arguments):arguments.length===Ka&&Is(Ue)&&$n(Rt)?Wc.apply(this,arguments):arguments.length===ml&&Nr(Ue)&&Li(Rt)?fl.apply(this,arguments):arguments.length===dl&&Ri(Ue)&&nn(Rt)?Ho.apply(this,arguments):arguments.length===Yc&&Ca(Ue)&&Xn(Rt)?Go.apply(this,arguments):Ce.apply(this,arguments)}try{Object.defineProperty(je,"name",{value:j})}catch{}return je.signatures=Be,je._typedFunctionData={signatures:ie,signatureMap:Me},je}function Ae(j,de,pe){throw W(j,de,pe)}function we(j){return J(j,0,j.length-1)}function G(j){return j[j.length-1]}function J(j,de,pe){return Array.prototype.slice.call(j,de,pe)}function ge(j,de){for(let pe=0;pe<j.length;pe++)if(de(j[pe]))return j[pe]}function ye(j,de){return Array.prototype.concat.apply([],j.map(de))}function De(){let j=we(arguments).map(pe=>x(C(pe))),de=G(arguments);if(typeof de!="function")throw new TypeError("Callback function expected as last argument");return Ie(j,de)}function Ie(j,de){return{referTo:{references:j,callback:de}}}function Oe(j){if(typeof j!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:j}}}function Je(j){return j&&typeof j.referTo=="object"&&Array.isArray(j.referTo.references)&&typeof j.referTo.callback=="function"}function wt(j){return j&&typeof j.referToSelf=="object"&&typeof j.referToSelf.callback=="function"}function qe(j,de){if(!j)return de;if(de&&de!==j){let pe=new Error("Function names do not match (expected: "+j+", actual: "+de+")");throw pe.data={actual:de,expected:j},pe}return j}function rr(j){let de;for(let pe in j)Object.prototype.hasOwnProperty.call(j,pe)&&(D(j[pe])||typeof j[pe].signature=="string")&&(de=qe(de,j[pe].name));return de}function Wt(j,de){let pe;for(pe in de)if(Object.prototype.hasOwnProperty.call(de,pe)){if(pe in j&&de[pe]!==j[pe]){let Ne=new Error('Signature "'+pe+'" is defined twice');throw Ne.data={signature:pe,sourceFunction:de[pe],destFunction:j[pe]},Ne}j[pe]=de[pe]}}let pr=m;m=function(j){let de=typeof j=="string",pe=de?1:0,Ne=de?j:"",Be={};for(let _e=pe;_e<arguments.length;++_e){let Ge=arguments[_e],F={},Y;if(typeof Ge=="function"?(Y=Ge.name,typeof Ge.signature=="string"?F[Ge.signature]=Ge:D(Ge)&&(F=Ge.signatures)):o(Ge)&&(F=Ge,de||(Y=rr(Ge))),Object.keys(F).length===0){let ie=new TypeError("Argument to 'typed' at index "+_e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw ie.data={index:_e,argument:Ge},ie}de||(Ne=qe(Ne,Y)),Wt(Be,F)}return ce(Ne||"",Be)},m.create=i,m.createCount=pr.createCount,m.onMismatch=Ae,m.throwMismatchError=Ae,m.createError=W,m.clear=h,m.clearConversions=b,m.addTypes=d,m._findType=p,m.referTo=De,m.referToSelf=Oe,m.convert=w,m.findSignature=v,m.find=A,m.isTypedFunction=D,m.warnAgainstDeprecatedThis=!0,m.addType=function(j,de){let pe="any";de!==!1&&u.has("Object")&&(pe="Object"),m.addTypes([j],pe)};function Pe(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 m.addConversion=function(j){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Pe(j);let pe=p(j.to),Ne=pe.conversionsTo.find(Be=>Be.from===j.from);if(Ne)if(de&&de.override)m.removeConversion({from:Ne.from,to:j.to,convert:Ne.convert});else throw new Error('There is already a conversion from "'+j.from+'" to "'+pe.name+'"');pe.conversionsTo.push({from:j.from,convert:j.convert,index:f++})},m.addConversions=function(j,de){j.forEach(pe=>m.addConversion(pe,de))},m.removeConversion=function(j){Pe(j);let de=p(j.to),pe=ge(de.conversionsTo,Be=>Be.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 Ne=de.conversionsTo.indexOf(pe);de.conversionsTo.splice(Ne,1)},m.resolve=function(j,de){if(!D(j))throw new TypeError(n);let pe=j._typedFunctionData.signatures;for(let Ne=0;Ne<pe.length;++Ne)if(pe[Ne].test(de))return pe[Ne];return null},m}var a=i();return a})});var SN=On((s$e,DN)=>{DN.exports=function t(e,r){"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,s=/^0/,l=function(v){return t.insensitive&&(""+v).toLowerCase()||""+v},u=l(e).replace(i,"")||"",c=l(r).replace(i,"")||"",f=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||f.length!==1&&u.match(a)&&Date.parse(u),d=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,h,b;if(d){if(p<d)return-1;if(p>d)return 1}for(var y=0,D=Math.max(f.length,m.length);y<D;y++){if(h=!(f[y]||"").match(s)&&parseFloat(f[y])||f[y]||0,b=!(m[y]||"").match(s)&&parseFloat(m[y])||m[y]||0,isNaN(h)!==isNaN(b))return isNaN(h)?1:-1;if(typeof h!=typeof b&&(h+="",b+=""),h<b)return-1;if(h>b)return 1}return 0}});var qI=On((C4e,UI)=>{"use strict";var Y0=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},IJ={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},BJ={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},kJ=function(e,r){return Y0({},e,r)};UI.exports=function(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.preserveFormatting,n=r===void 0?!1:r,i=e.escapeMapFn,a=i===void 0?kJ:i,o=String(t),s="",l=a(Y0({},IJ),n?Y0({},BJ):{}),u=Object.keys(l),c=function(){var m=!1;u.forEach(function(p,d){m||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[d]],o=o.slice(p.length,o.length),m=!0)}),m||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s}});var mR=On((pR,tw)=>{(function(t,e,r){function n(s){var l=this,u=o();l.next=function(){var c=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=c-(l.c=c|0)},l.c=1,l.s0=u(" "),l.s1=u(" "),l.s2=u(" "),l.s0-=u(s),l.s0<0&&(l.s0+=1),l.s1-=u(s),l.s1<0&&(l.s1+=1),l.s2-=u(s),l.s2<0&&(l.s2+=1),u=null}function i(s,l){return l.c=s.c,l.s0=s.s0,l.s1=s.s1,l.s2=s.s2,l}function a(s,l){var u=new n(s),c=l&&l.state,f=u.next;return f.int32=function(){return u.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,u),f.state=function(){return i(u,{})}),f}function o(){var s=4022871197,l=function(u){u=String(u);for(var c=0;c<u.length;c++){s+=u.charCodeAt(c);var f=.02519603282416938*s;s=f>>>0,f-=s,f*=s,s=f>>>0,f-=s,s+=f*4294967296}return(s>>>0)*23283064365386963e-26};return l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})(pR,typeof tw=="object"&&tw,typeof define=="function"&&define)});var hR=On((dR,rw)=>{(function(t,e,r){function n(o){var s=this,l="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var c=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^c^c>>>8},o===(o|0)?s.x=o:l+=o;for(var u=0;u<l.length+64;u++)s.x^=l.charCodeAt(u)|0,s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(dR,typeof rw=="object"&&rw,typeof define=="function"&&define)});var vR=On((gR,nw)=>{(function(t,e,r){function n(o){var s=this,l="";s.next=function(){var c=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(c^c<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,o===(o|0)?s.x=o:l+=o;for(var u=0;u<l.length+64;u++)s.x^=l.charCodeAt(u)|0,u==l.length&&(s.d=s.x<<10^s.x>>>4),s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s.v=o.v,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(gR,typeof nw=="object"&&nw,typeof define=="function"&&define)});var bR=On((yR,iw)=>{(function(t,e,r){function n(o){var s=this;s.next=function(){var u=s.x,c=s.i,f,m,p;return f=u[c],f^=f>>>7,m=f^f<<24,f=u[c+1&7],m^=f^f>>>10,f=u[c+3&7],m^=f^f>>>3,f=u[c+4&7],m^=f^f<<7,f=u[c+7&7],f=f^f<<13,m^=f^f<<9,u[c]=m,s.i=c+1&7,m};function l(u,c){var f,m,p=[];if(c===(c|0))m=p[0]=c;else for(c=""+c,f=0;f<c.length;++f)p[f&7]=p[f&7]<<15^c.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?m=p[7]=-1:m=p[f],u.x=p,u.i=0,f=256;f>0;--f)u.next()}l(s,o)}function i(o,s){return s.x=o.x.slice(),s.i=o.i,s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.x&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(yR,typeof iw=="object"&&iw,typeof define=="function"&&define)});var wR=On((xR,aw)=>{(function(t,e,r){function n(o){var s=this;s.next=function(){var u=s.w,c=s.X,f=s.i,m,p;return s.w=u=u+1640531527|0,p=c[f+34&127],m=c[f=f+1&127],p^=p<<13,m^=m<<17,p^=p>>>15,m^=m>>>12,p=c[f]=p^m,s.i=f,p+(u^u>>>16)|0};function l(u,c){var f,m,p,d,h,b=[],y=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,y=Math.max(y,c.length)),p=0,d=-32;d<y;++d)c&&(m^=c.charCodeAt((d+32)%c.length)),d===0&&(h=m),m^=m<<10,m^=m>>>15,m^=m<<4,m^=m>>>13,d>=0&&(h=h+1640531527|0,f=b[d&127]^=m+h,p=f==0?p+1:0);for(p>=128&&(b[(c&&c.length||0)&127]=-1),p=127,d=4*128;d>0;--d)m=b[p+34&127],f=b[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,b[p]=m^f;u.w=h,u.X=b,u.i=p}l(s,o)}function i(o,s){return s.i=o.i,s.w=o.w,s.X=o.X.slice(),s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.X&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(xR,typeof aw=="object"&&aw,typeof define=="function"&&define)});var AR=On((_R,ow)=>{(function(t,e,r){function n(o){var s=this,l="";s.next=function(){var c=s.b,f=s.c,m=s.d,p=s.a;return c=c<<25^c>>>7^f,f=f-m|0,m=m<<24^m>>>8^p,p=p-c|0,s.b=c=c<<20^c>>>12^f,s.c=f=f-m|0,s.d=m<<16^f>>>16^p,s.a=p-c|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,o===Math.floor(o)?(s.a=o/4294967296|0,s.b=o|0):l+=o;for(var u=0;u<l.length+20;u++)s.b^=l.charCodeAt(u)|0,s.next()}function i(o,s){return s.a=o.a,s.b=o.b,s.c=o.c,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(_R,typeof ow=="object"&&ow,typeof define=="function"&&define)});var SR=On((DR,mv)=>{(function(t,e,r){var n=256,i=6,a=52,o="random",s=r.pow(n,i),l=r.pow(2,a),u=l*2,c=n-1,f;function m(v,A,w){var x=[];A=A==!0?{entropy:!0}:A||{};var E=b(h(A.entropy?[v,D(e)]:v??y(),3),x),T=new p(x),_=function(){for(var C=T.g(i),N=s,I=0;C<l;)C=(C+I)*n,N*=n,I=T.g(1);for(;C>=u;)C/=2,N/=2,I>>>=1;return(C+I)/N};return _.int32=function(){return T.g(4)|0},_.quick=function(){return T.g(4)/4294967296},_.double=_,b(D(T.S),e),(A.pass||w||function(C,N,I,R){return R&&(R.S&&d(R,T),C.state=function(){return d(T,{})}),I?(r[o]=C,N):C})(_,E,"global"in A?A.global:this==r,A.state)}function p(v){var A,w=v.length,x=this,E=0,T=x.i=x.j=0,_=x.S=[];for(w||(v=[w++]);E<n;)_[E]=E++;for(E=0;E<n;E++)_[E]=_[T=c&T+v[E%w]+(A=_[E])],_[T]=A;(x.g=function(C){for(var N,I=0,R=x.i,L=x.j,V=x.S;C--;)N=V[R=c&R+1],I=I*n+V[c&(V[R]=V[L=c&L+N])+(V[L]=N)];return x.i=R,x.j=L,I})(n)}function d(v,A){return A.i=v.i,A.j=v.j,A.S=v.S.slice(),A}function h(v,A){var w=[],x=typeof v,E;if(A&&x=="object")for(E in v)try{w.push(h(v[E],A-1))}catch{}return w.length?w:x=="string"?v:v+"\0"}function b(v,A){for(var w=v+"",x,E=0;E<w.length;)A[c&E]=c&(x^=A[c&E]*19)+w.charCodeAt(E++);return D(A)}function y(){try{var v;return f&&(v=f.randomBytes)?v=v(n):(v=new Uint8Array(n),(t.crypto||t.msCrypto).getRandomValues(v)),D(v)}catch{var A=t.navigator,w=A&&A.plugins;return[+new Date,t,w,t.screen,D(e)]}}function D(v){return String.fromCharCode.apply(0,v)}if(b(r.random(),e),typeof mv=="object"&&mv.exports){mv.exports=m;try{f=require("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return m}):r["seed"+o]=m})(typeof self<"u"?self:DR,[],Math)});var TR=On((Kje,ER)=>{var XX=mR(),QX=hR(),KX=vR(),eQ=bR(),tQ=wR(),rQ=AR(),ol=SR();ol.alea=XX;ol.xor128=QX;ol.xorwow=KX;ol.xorshift7=eQ;ol.xor4096=tQ;ol.tychei=rQ;ER.exports=ol});var i4=On((wit,mw)=>{function pw(){}pw.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;for(n;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var a=0,o=n.length;a<o;a++)n[a].fn!==e&&n[a].fn._!==e&&i.push(n[a]);return i.length?r[t]=i:delete r[t],this}};mw.exports=pw;mw.exports.TinyEmitter=pw});var $te={};F_($te,{ObsMetaBind:()=>iy,default:()=>ay});module.exports=w8($te);var zo=require("obsidian");var J_=Tr(oa());var Ti=(r=>(r.INLINE="inline",r.BLOCK="block",r))(Ti||{}),_l=(l=>(l.INPUT="INPUT",l.VIEW="VIEW",l.JS_VIEW="JS_VIEW",l.TABLE="TABLE",l.BUTTON_GROUP="BUTTON_GROUP",l.BUTTON="BUTTON",l.EMBED="EMBED",l.EXCLUDED="EXCLUDED",l))(_l||{}),$s=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function Up(t){return t==="INPUT"||t==="VIEW"||t==="BUTTON_GROUP"}var Rn=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)}},Lt=class extends Rn{getErrorType(){return"MB_INTERNAL"}},to=class extends Rn{getErrorType(){return"MB_PARSING"}},Ko=class extends Rn{getErrorType(){return"MB_VALIDATION"}},qp=class extends Rn{getErrorType(){return"MB_BIND_TARGET"}};var $r=class extends Rn{getErrorType(){return"MB_ARGUMENT"}},ro=class extends Rn{getErrorType(){return"MB_JS"}},vu=class extends Rn{getErrorType(){return"MB_EXPRESSION"}};var ef=class extends Rn{getErrorType(){return"MB_EXAMPLE"}};var es=class extends Rn{getErrorType(){return"MB_BUTTON"}},tf=class extends Rn{getErrorType(){return"MB_DEPENDENCY"}};function on(t,e){let r=t.thenEof().tryParse(e);if(r.success)return r.value;throw new Al("ERROR","parsiNOM parser",e,r)}var Al=class extends Rn{constructor(e,r,n,i){super({errorLevel:e,effect:"Failed to parse. Check that your syntax is correct.",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=n,this.parseFailure=i,this.source=r,this.updateMessage2()}getErrorType(){return"MB_PARSINOM"}updateMessage2(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`;let r=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} | `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let r=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return r+n}},Nn=class extends Rn{constructor(e,r,n,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:n,docs:o}),this.str=i,this.position=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let r=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} | `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length,r.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,r){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:r,a="^".repeat(i-this.position.from.column);return n+a}};var mn=Tr(oa()),Py=Tr(qi());var V_=Tr(oa()),Ci=Tr(qi());var rf=Tr(oa()),sa=Tr(qi()),Ln=sa.P.sequence(sa.P.or(rf.P_UTILS.unicodeLetter(),sa.P.oneOf("_$")),sa.P.or(rf.P_UTILS.unicodeAlphanumeric(),sa.P.oneOf("-_$")).many()).map(t=>t[0]+t[1].join("")).describe("identifier"),$_=sa.P.sequenceMap((t,e)=>t+e.map(r=>r[0]+r[1]).join(""),Ln,sa.P.sequence(rf.P_UTILS.optionalWhitespace(),Ln).many()).describe("identifier with spaces"),M8=sa.P.string("\\").then(rf.P_UTILS.any()).map(t=>t==="'"?"'":t==="\\"?"\\":"\\"+t);function O_(t){return sa.P.or(M8,sa.P.noneOf(t+"\\")).many().map(e=>e.join("")).trim(sa.P.string(t))}var zp=O_("'"),R_=O_('"'),Dl=sa.P.manyNotOf("{}[]#^|:?").box("file path");function Mi(t,e){return{value:t,position:e}}function Fa(t){if(t!==void 0)return typeof t=="string"?{value:t}:t}var bu=(r=>(r.OBJECT="object",r.ARRAY="array",r))(bu||{}),Hp=class{constructor(e,r,n){this.parent=e,this.access=r,this.child=n}};function C8(t,e){return t[e]}function L_(t,e,r){t[e]=r}var yu=class{constructor(e,r){if(this.type=e,this.prop=e==="object"?r:"",this.index=e==="array"?Number(r):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new Hp(e,this,C8(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 Hp(e,this,e[this.index])}}set(e,r){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");L_(e,this.prop,r)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=r}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");L_(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}}toUnvalidatedPropAccess(){return this.type==="object"?{type:this.type,prop:{value:this.prop}}:{type:this.type,prop:{value:this.index.toString()}}}};var U_=Ln.node((t,e)=>({type:"object",prop:Mi(t,e)})),Fy=Ci.P.or(V_.P_UTILS.digits().wrap(Ci.P.string("["),Ci.P.string("]")).node((t,e)=>({type:"array",prop:Mi(t,e)})),R_.wrap(Ci.P.string("["),Ci.P.string("]")).node((t,e)=>({type:"object",prop:Mi(t,e)}))),N8=Ci.P.or(Ci.P.sequenceMap(t=>({storagePath:void 0,listenToChildren:!0,storageProp:t}),Fy.atLeast(1)),Ci.P.sequenceMap((t,e)=>({storagePath:void 0,listenToChildren:!0,storageProp:[t,...e]}),U_,Fy.many())),F8=Ci.P.sequenceMap((t,e)=>[t,...e],U_,Fy.many()),Iy=Ci.P.sequenceMap((t,e)=>(t.storageProp=t.storageProp.concat(e.flat()),t),N8,Ci.P.string(".").then(F8).many()),_o=Ci.P.sequenceMap((t,e,r)=>(r.storageType=t,r.storagePath=e,r),Ln.describe("storage type").node(Mi).skip(Ci.P.string("^").describe('storage type separator "^"')).optional(),Dl.describe("storage path").node(Mi).skip(Ci.P.string("#").describe('storage/file path separator "#"')).optional(),Iy.describe("property path")).box("bind target");var Gp=Tr(oa()),Ao=Tr(qi());var By=Ao.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),I8=Ao.P.or(zp,By).node(Mi),B8=Ao.P.separateBy(I8,Ao.P.string(",").describe('argument value separator ","').trim(Gp.P_UTILS.optionalWhitespace())),k8=Ao.P.sequenceMap((t,e)=>({name:t,value:e}),Ln.node(Mi),B8.trim(Gp.P_UTILS.optionalWhitespace()).wrap(Ao.P.string("(").describe('argument value paren "("'),Ao.P.string(")").describe('argument value paren ")"')).optional([])),nf=Ao.P.separateBy(k8,Ao.P.string(",").describe('argument separator ","').trim(Gp.P_UTILS.optionalWhitespace()));var zi=Tr(oa()),Fn=Tr(qi());var P8=Fn.P.string("\\").then(zi.P_UTILS.any()).map(t=>t==="["?"[":t==="]"?"]":t==="{"?"{":t==="}"?"}":t==="\\"?"\\":"\\"+t),Wp=Fn.P.sequenceMap((t,e)=>t+e.flat().join(""),Fn.P.manyNotOf("{}[]\\"),Fn.P.sequence(P8,Fn.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),$8=Fn.P.sequenceMap((t,e)=>[t,...e.flat()],Wp,Fn.P.sequence(_o.wrapString("{","}"),Wp).many()),O8=Fn.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{viewFieldType:t,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},Ln.node(Mi).trim(zi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),nf.trim(zi.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(zi.P_UTILS.optionalWhitespace()).optional([]),Fn.P.sequence(Fn.P.string(":").trim(zi.P_UTILS.optionalWhitespace()),_o).trim(zi.P_UTILS.optionalWhitespace()).optional()),q_=Fn.P.sequenceMap((t,e,r,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),Fn.P.string("VIEW"),$8.wrapString("[","]"),zi.P_UTILS.optionalWhitespace(),O8.wrapString("[","]").optional(),zi.P_UTILS.eof()),R8=Fn.P.sequenceMap((t,e,r,n)=>(e!==void 0&&(t.listenToChildren=!0),{bindTarget:t,name:n}),_o.wrapString("{","}"),Fn.P.string(" and children").optional(),Fn.P.string(" as "),Ln),z_=Fn.P.sequenceMap((t,e,r,n)=>({bindTargetMappings:t,writeToBindTarget:e,hidden:r!==void 0,code:n}),R8.separateBy(zi.P_UTILS.whitespace()).skip(zi.P_UTILS.whitespace()),Fn.P.string("save to ").then(_o.wrapString("{","}")).skip(zi.P_UTILS.whitespace()).optional(),Fn.P.string("hidden").skip(zi.P_UTILS.whitespace()).optional(),Fn.P.string("---").then(zi.P_UTILS.remaining()));var ky=Tr(qi());var Sl=class{constructor(e,r){this.range=e,this.tokenClass=r}};var $t=class t{static sequence(...e){return ky.P.sequenceMap((...r)=>r.flat(2).filter(n=>n!==void 0),...e)}static separateBy(e,r){return t.sequence(e,t.sequence(r,e).many()).optional([])}static highlight(e,r){return e.node((n,i)=>[new Sl(i,r)])}static highlightStr(e,r){return t.highlight(ky.P.string(e),r)}};var $y=$t.highlight(Ln,"ident"),Yp=$t.highlight(Ln,"keyword"),Oy=$t.highlightStr(",","control"),jp=$t.highlightStr("(","control"),Zp=$t.highlightStr(")","control"),El=$t.highlightStr("[","control"),Tl=$t.highlightStr("]","control"),V8=$t.highlight(zp,"string"),U8=$t.highlight(By,"ident"),q8=Py.P.or(U8,V8),z8=$t.separateBy(q8,Oy.trim(mn.P_UTILS.optionalWhitespace())),H8=$t.sequence(Yp,$t.sequence(jp,z8.trim(mn.P_UTILS.optionalWhitespace()),Zp).optional()),Ry=$t.separateBy(H8,Oy.trim(mn.P_UTILS.optionalWhitespace())),Ml=$t.sequence($t.sequence($y,$t.highlightStr("^","control")).optional(),$t.sequence($t.highlight(Dl,"ident"),$t.highlightStr("#","control")).optional(),$t.highlight(Iy,"ident")),G8=$t.sequence(Yp.trim(mn.P_UTILS.optionalWhitespace()),$t.sequence(jp,Ry.trim(mn.P_UTILS.optionalWhitespace()),Zp).trim(mn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(mn.P_UTILS.optionalWhitespace()),Ml).trim(mn.P_UTILS.optionalWhitespace()).optional()),W8=$t.sequence(Yp.trim(mn.P_UTILS.optionalWhitespace()).optional(),$t.sequence(jp,Ry.trim(mn.P_UTILS.optionalWhitespace()),Zp).trim(mn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(mn.P_UTILS.optionalWhitespace()),Ml).trim(mn.P_UTILS.optionalWhitespace()).optional()),G_=Py.P.or($t.sequence($t.highlightStr("INPUT","control"),El,$y.trim(mn.P_UTILS.optionalWhitespace()),Tl.skip(mn.P_UTILS.optionalWhitespace()),El,W8,Tl),$t.sequence($t.highlightStr("INPUT","control"),El,G8,Tl)),H_=$t.highlight(Wp,"ident"),Y8=$t.sequence($t.highlightStr("{","string"),Ml,$t.highlightStr("}","string")),j8=$t.sequence(H_,$t.sequence(Y8,H_).many()),Z8=$t.sequence(Yp.trim(mn.P_UTILS.optionalWhitespace()).optional(),$t.sequence(jp,Ry.trim(mn.P_UTILS.optionalWhitespace()).optional(),Zp).trim(mn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(mn.P_UTILS.optionalWhitespace()),Ml).trim(mn.P_UTILS.optionalWhitespace()).optional()),W_=$t.sequence($t.highlightStr("VIEW","control"),El,j8,Tl,$t.sequence(El.skip(mn.P_UTILS.optionalWhitespace()),Z8,Tl).optional()),Y_=$t.sequence($t.highlightStr("BUTTON","control"),El,$t.separateBy($y,Oy.trim(mn.P_UTILS.optionalWhitespace())),Tl);var ts=class{constructor(e,r,n){this.str=e,this.highlights=r.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 Sl({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};function af(t,e,r){return Math.min(Math.max(t,e),r)}function Jp(t,e,r){return t!==void 0?Math.min(Math.max(t,e),r):void 0}function Ly(t,e,r,n,i){return(t-e)/(r-e)*(i-n)+n}function Vy(t,e){return(t%e+e)%e}function rs(t,e){if(t===null&&e===null)return!0;if(t===null||e===null||typeof t!=typeof e)return!1;if(typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!rs(t[i],e[i]))return!1;return!0}if(Array.isArray(t)||Array.isArray(e))return!1;let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let i of r)if(!rs(t[i],e[i]))return!1;return!0}return t===e}function Uy(t){return!!t}function qy(t){if(t===void 0)return t;let e=Reflect.ownKeys(t);for(let r of e){let n=t[r];(n&&typeof n=="object"||typeof n=="function")&&qy(n)}return Object.freeze(t)}function _r(){return window.crypto.randomUUID()}function Cl(t){try{return new URL(t),!0}catch{return!1}}function Xp(t){window.open(t,"_blank")}function Z_(t,e,r=", ",n="and"){return t.length===0?"":(t=t.map(e),t.length===1?t[0]:t.length===2?`${t[0]} ${n} ${t[1]}`:`${t.slice(0,-1).join(r)} ${n} ${t.slice(-1)}`)}function ui(t,e){t.innerHTML="",t.className="";let r=document.createElement("span");r.className="mb-warning mb-unloaded",r.innerText=`[MB_UNLOADED] ${e}`,t.appendChild(r)}var lt=class{static createElement(e,r,n){let i=document.createElement(r);return n?.text&&(i.innerText=n.text),n?.class&&(i.className=n.class),e.appendChild(i),i}static addClass(e,r){e.classList.add(...r.split(" "))}static addClasses(e,r){e.classList.add(...r)}static removeClass(e,r){e.classList.remove(...r.split(" "))}static hasClass(e,r){return e.classList.contains(r)}static removeAllClasses(e){e.className=""}static empty(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};function Qp(...t){if(t.length===0)return"/";if(t.length===1)return j_(t[0]);let e=t[0].startsWith("/")?t[0].substring(1):t[0];for(let r=1;r<t.length;r++){if(t[r]===""||t[r]==="/")continue;let n=e.endsWith("/"),i=t[r].startsWith("/");n&&i?e+=t[r].substring(1):!n&&!i?e+="/"+t[r]:e+=t[r]}return j_(e)}function j_(t){return t.startsWith("/")&&(t=t.substring(1)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t===""?"/":t}function Kp(t,e){return e=e.startsWith(".")?e:"."+e,t.endsWith(e)?t:t+e}function em(t){return t===void 0?[]:Array.isArray(t)?t:[t]}var tm=class{constructor(e){this.mb=e}highlightInputFieldDeclaration(e,r){return this.highlightWithParser(e,r,G_)}highlightViewFieldDeclaration(e,r){return this.highlightWithParser(e,r,W_)}highlightInlineButtonDeclaration(e,r){return this.highlightWithParser(e,r,Y_)}highlight(e,r,n){if(r==="INPUT")return this.highlightInputFieldDeclaration(e,n);if(r==="VIEW")return this.highlightViewFieldDeclaration(e,n);if(r==="BUTTON_GROUP")return this.highlightInlineButtonDeclaration(e,n);throw new Error(`Unknown MDRCType ${r}`)}highlightBindTarget(e,r){return this.highlightWithParser(e,r,Ml)}highlightWithParser(e,r,n){try{return r?new ts(e,on(n.trim(J_.P_UTILS.optionalWhitespace()).thenEof(),e)):new ts(e,on(n.thenEof(),e))}catch(i){return i instanceof Al?new ts(e,[],i):(console.error(i),new ts(e,[]))}}};var Wr=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(Wr||{}),Vn=(d=>(d.COMMAND="command",d.JS="js",d.OPEN="open",d.INPUT="input",d.SLEEP="sleep",d.TEMPLATER_CREATE_NOTE="templaterCreateNote",d.RUN_TEMPLATER_FILE="runTemplaterFile",d.UPDATE_METADATA="updateMetadata",d.CREATE_NOTE="createNote",d.REPLACE_IN_NOTE="replaceInNote",d.REGEXP_REPLACE_IN_NOTE="regexpReplaceInNote",d.REPLACE_SELF="replaceSelf",d.INSERT_INTO_NOTE="insertIntoNote",d.INLINE_JS="inlineJS",d))(Vn||{}),of=class t{constructor(e,r,n,i){this.type=e,this.shiftKey=r,this.ctrlKey=n,this.altKey=i}static fromMouseEvent(e,r){return new t(r,e.shiftKey,e.ctrlKey,e.altKey)}openInNewTab(){return this.type==="middle"||this.ctrlKey}};var Lr=class{constructor(e,r){this.actionType=e,this.mb=r}};var nm=class extends Lr{constructor(e){super("command",e)}async run(e,r,n,i,a){this.mb.internal.executeCommandById(r.command)}create(){return{type:"command",command:""}}getActionLabel(){return"Run a command"}};var im=class extends Lr{constructor(e){super("createNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists){let o=Kp(Qp(r.folderPath??"",r.fileName),"md");if(await this.mb.file.exists(o)){await this.mb.file.open(o,"",!1);return}}await this.mb.file.create(r.folderPath??"",r.fileName,"md",r.openNote??!1,a.openInNewTab())}create(){return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note"}};var am=class extends Lr{constructor(e){super("inlineJS",e)}async run(e,r,n,i,a){if(!this.mb.getSettings().enableJs)throw new ro({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.mb.internal.jsEngineRunCode(r.code,n,o))()}create(){return{type:"inlineJS",code:'console.log("Hello world")',args:{}}}getActionLabel(){return"Run JavaScript code"}};var om=class extends Lr{constructor(e){super("input",e)}async run(e,r,n,i,a){let o=document.activeElement;o&&o instanceof HTMLInputElement&&(o.setRangeText(r.str,o.selectionStart,o.selectionEnd,"end"),o.dispatchEvent(new Event("input",{bubbles:!0})))}create(){return{type:"input",str:""}}getActionLabel(){return"Insert text at cursor"}};var Fl=Tr(oa()),ua=Tr(qi());function X_(t){if(t==="+")return"+";if(t==="-")return"-";throw new Error(`Invalid LineNumberOp: ${t}`)}function J8(t){if(t===void 0)return 1;if(t==="+")return 1;if(t==="-")return-1;throw new Error(`Invalid LineNumberOp: ${t}`)}var Nl=class{constructor(e,r,n){this.literal=e,this.op=r,this.number=n}evaluate(e){let r=this.resolveLiteral(e),n=J8(this.op);return r!==void 0&&this.number!==void 0?r+this.number*n:this.number!==void 0?this.number*n:r!==void 0?r:0}resolveLiteral(e){if(this.literal!==void 0&&this.literal in e)return e[this.literal]}};var zy=ua.P.sequenceMap((t,e)=>t===void 0?e:-e,ua.P.string("-").optional(),ua.P.or(ua.P.sequenceMap((t,e,r)=>Number(t+e+r),Fl.P_UTILS.digits(),ua.P.string("."),Fl.P_UTILS.digits()),Fl.P_UTILS.digits().map(t=>Number(t)))).thenEof(),sf=ua.P.sequenceMap((t,e)=>t===void 0?e:-e,ua.P.string("-").optional(),Fl.P_UTILS.digits().map(t=>Number(t))).thenEof(),uf=ua.P.or(ua.P.sequenceMap((t,e,r)=>new Nl(t,X_(e),r),Ln,ua.P.or(ua.P.string("+"),ua.P.string("-")).trim(Fl.P_UTILS.optionalWhitespace()),sf),Ln.map(t=>new Nl(t,void 0,void 0)),sf.map(t=>new Nl(void 0,void 0,t)));var sm=class extends Lr{constructor(e){super("insertIntoNote",e)}async run(e,r,n,i,a){let o=r.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(r.value),n):r.value,s=on(uf,r.line.toString());await this.mb.file.atomicModify(n,l=>{let u=l.split(`
`),c=this.mb.file.createLineNumberContext(l,i.position),f=s.evaluate(c);if(f<1||f>u.length)throw new Error("Line number out of bounds");return u=[...u.slice(0,f-1),o,...u.slice(f-1)],u.join(`
`)})}create(){return{type:"insertIntoNote",line:0,value:"Some text",templater:!1}}getActionLabel(){return"Insert text into the note"}};var um=class extends Lr{constructor(e){super("js",e)}async run(e,r,n,i,a){if(!this.mb.getSettings().enableJs)throw new ro({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.mb.internal.jsEngineRunFile(r.file,n,o))()}create(){return{type:"js",file:"",args:{}}}getActionLabel(){return"Run a JavaScript file"}};var Q_=Tr(oa()),Qn=Tr(qi());var K_=Qn.P.sequence(Dl,Qn.P.or(Qn.P.string("#").then(Qn.P.manyNotOf("[]#|:")),Qn.P.string("#").result(void 0),Qn.P.succeed(void 0)),Qn.P.string("|").then(Qn.P.manyNotOf("[]")).optional()),lm=Qn.P.or(Qn.P.sequenceMap((t,e)=>new xu(t!==void 0,e[0],e[1],e[2],!0),Qn.P.string("!").optional(),K_.wrapString("[[","]]")),Qn.P.sequenceMap((t,e,r)=>{let n=!Cl(r);return new xu(t!==void 0,r,void 0,e,n)},Qn.P.string("!").optional(),Qn.P.manyNotOf("[]").wrapString("[","]"),Qn.P.manyNotOf("()").wrapString("(",")"))),X8=Qn.P.separateBy(lm,Qn.P.string(",").trim(Q_.P_UTILS.optionalWhitespace())),xu=class t{constructor(e,r,n,i,a){this.isEmbed=e,this.target=r,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new t(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,r,n){this.internal?e.file.open(this.fullTarget(),r,n):Xp(this.target)}toString(){let e=this.isEmbed?"!":"";if(this.internal){let r=this.alias?`|${this.alias}`:"";return`${e}[[${this.fullTarget()}${r}]]`}else{let r=this.alias??this.fullTarget();return`${e}[${r}](${this.fullTarget()})`}}},vn=class t{static parseLink(e){return on(lm.thenEof(),e)}static parseLinkList(e){return on(X8.thenEof(),e)}static isLink(e){return lm.thenEof().tryParse(e).success}static urlToLink(e){return xu.fromUrl(e)}static parseLinkOrUrl(e){return Cl(e)?t.urlToLink(new URL(e)):t.parseLink(e)}static interpretAsLink(e){let r=lm.thenEof().tryParse(e);if(r.success)return r.value;let n=K_.thenEof().tryParse(e);if(n.success)return new xu(!1,n.value[0],n.value[1],n.value[2],!0);if(Cl(e)){let i=new URL(e);return xu.fromUrl(i)}}};var cm=class extends Lr{constructor(e){super("open",e)}async run(e,r,n,i,a){let o=a.openInNewTab()||(r.newTab??!1),s=vn.interpretAsLink(r.link);if(!s)throw new Error("Invalid link");s.open(this.mb,n,o)}create(){return{type:"open",link:"",newTab:!0}}getActionLabel(){return"Open a link"}};var fm=class extends Lr{constructor(e){super("regexpReplaceInNote",e)}async run(e,r,n,i,a){if(r.regexp==="")throw new Error("Regexp cannot be empty");await this.mb.file.atomicModify(n,o=>o.replace(new RegExp(r.regexp,r.regexpFlags??"g"),r.replacement))}create(){return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"}}getActionLabel(){return"Replace text in note using regexp"}};var pm=class extends Lr{constructor(e){super("replaceInNote",e)}async run(e,r,n,i,a){let o=r.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(r.replacement),n):r.replacement,s=on(uf,r.fromLine.toString()),l=on(uf,r.toLine.toString());await this.mb.file.atomicModify(n,u=>{let c=u.split(`
`),f=this.mb.file.createLineNumberContext(u,i.position),m=s.evaluate(f),p=l.evaluate(f);if(m>p)throw new Error(`From line (${m}) can't be greater than to line (${p})`);if(m<1)throw new Error(`From line (${m}) can't smaller than 1.`);if(p>c.length)throw new Error(`To line (${p}) can't greater than the file length ${c.length}.`);return c=[...c.slice(0,m-1),o,...c.slice(p)],c.join(`
`)})}create(){return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace text in note"}};var mm=class extends Lr{constructor(e){super("replaceSelf",e)}async run(e,r,n,i,a){if(i.isInline)throw new Error("Replace self action not supported for inline buttons");if(i.position===void 0)throw new Error("Position of the button in the note is unknown");if(i.position.lineStart>i.position.lineEnd)throw new Error("Position of the button in the note is invalid");let o=i.position,s=r.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(r.replacement),n):r.replacement;await this.mb.file.atomicModify(n,l=>{let u=l.split(`
`);if(o.lineStart<0||o.lineEnd>u.length)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,o.lineStart),s,...u.slice(o.lineEnd+1)],u.join(`
`)})}create(){return{type:"replaceSelf",replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace button with text"}};var dm=class extends Lr{constructor(e){super("runTemplaterFile",e)}async run(e,r,n,i,a){let o=this.mb.file.resolveFilePathLike(r.templateFile);await this.mb.internal.evaluateTemplaterTemplate(o,n)}create(){return{type:"runTemplaterFile",templateFile:""}}getActionLabel(){return"Run a templater file"}};var hm=class extends Lr{constructor(e){super("sleep",e)}async run(e,r,n,i,a){await new Promise(o=>setTimeout(o,r.ms))}create(){return{type:"sleep",ms:0}}getActionLabel(){return"Sleep for some time"}};var gm=class extends Lr{constructor(e){super("templaterCreateNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists&&r.fileName){let o=Kp(Qp(r.folderPath??"",r.fileName),"md");if(await this.mb.file.exists(o)){await this.mb.file.open(o,"",!1);return}}await this.mb.internal.createNoteWithTemplater(r.templateFile,r.folderPath,r.fileName,r.openNote,a.openInNewTab())}create(){return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note using Templater"}};function la(t){if(t.toLowerCase()==="null")return null;if(t==="true")return!0;if(t==="false")return!1;{let e=zy.tryParse(t);return e.success?e.value:t}}function dn(t){return t===void 0||t===null?"":typeof t=="string"?t:typeof t=="boolean"?t?"true":"false":t.toString()}function Os(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"}function Ia(t){if(t!=null){if(Os(t))return[t];if(typeof t=="object"&&Array.isArray(t))return t.filter(e=>Os(e))}}function Il(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=zy.tryParse(t);if(e.success)return e.value}}function Do(t){return Os(t)?dn(t):void 0}function Rs(t){return Os(t)?t:void 0}function wu(t,e){return Array.isArray(t)?t.map(r=>Hy(r,e)).filter(r=>r!=="").join(", "):Hy(t,e)}function Hy(t,e){return t==null?e?"":"null":typeof t=="function"?"<function>":typeof t=="object"||Array.isArray(t)?JSON.stringify(t):t.toString()}function t1(t,e){return Array.isArray(t)?t.map(r=>e1(r,e)).filter(r=>r!==""):e1(t,e)}function e1(t,e){return typeof t=="string"?vn.isLink(t)?vn.parseLink(t):Cl(t)?vn.urlToLink(new URL(t)):t:Hy(t,e)}var vm=class extends Lr{constructor(e){super("updateMetadata",e)}async run(e,r,n,i,a){let o=this.mb.bindTargetParser.fromStringAndValidate(r.bindTarget,n);if(r.evaluate){if(!this.mb.getSettings().enableJs)throw new ro({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let s=new Function("x","getMetadata",`return ${r.value};`);this.mb.api.updateMetadata(o,l=>s(l,u=>this.mb.api.getMetadata(this.mb.api.parseBindTarget(u,n))))}else this.mb.api.setMetadata(o,la(r.value))}create(){return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""}}getActionLabel(){return"Update metadata"}};var ym=class{constructor(e){this.mb=e,this.actionContexts={command:new nm(e),open:new cm(e),js:new um(e),input:new om(e),sleep:new hm(e),templaterCreateNote:new gm(e),updateMetadata:new vm(e),createNote:new im(e),replaceInNote:new pm(e),replaceSelf:new mm(e),regexpReplaceInNote:new fm(e),insertIntoNote:new sm(e),inlineJS:new am(e),runTemplaterFile:new dm(e)}}createDefaultButtonConfig(){return{label:"This is a button",icon:"",style:"default",class:"",cssStyle:"",backgroundImage:"",tooltip:"",id:"",hidden:!1,actions:[]}}async runButtonActions(e,r,n,i){try{if(e.action)await this.runAction(e,e.action,r,n,i);else if(e.actions)for(let a of e.actions)await this.runAction(e,a,r,n,i);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(a){console.warn("meta-bind | ButtonMDRC >> error while running action",a),this.mb.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){return this.actionContexts[e].create()}async runAction(e,r,n,i,a){let o=r.type;await this.actionContexts[o].run(e,r,n,i,a)}getActionLabel(e){return this.actionContexts[e].getActionLabel()}};var er=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Rn?this.errors.push(e):this.otherError=e,console.warn(e)):(console.trace(""),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(r=>r.errorLevel==="ERROR"||r.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var bm=class{constructor(e){this.value=e,this.count=1}getValue(){return this.value}increment(){return this.count+=1,this.count}decrement(){return this.count-=1,this.count}getCount(){return this.count}isEmpty(){return this.count===0}};var xm=class{constructor(e){this.mb=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let r=new Set,n=new er("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?n.add(new es({errorLevel:"ERROR",cause:`Button with label "${i.label}" has no id, but button templates must have an id.`,effect:"Button templates could not be saved."})):r.has(i.id)?n.add(new es({errorLevel:"ERROR",cause:`Button id "${i.id}" is not unique. The same id is used by multiple buttons.`,effect:"Button templates could not be saved."})):(r.add(i.id),this.buttonTemplates.set(i.id,i));return n.hasErrors()&&this.buttonTemplates.clear(),n}registerButtonLoadListener(e,r,n){let i=this.getButton(e,r);i&&n(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(r)||a.set(r,new Map);let o=a.get(r),s=_r();return o.set(s,n),()=>this.removeButtonLoadListener(e,r,s)}notifyButtonLoadListeners(e,r){let n=this.getButton(e,r);if(!n)throw new Error(`ButtonManager | button with id ${r} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(r);if(a)for(let[o,s]of a)s(n)}removeButtonLoadListener(e,r,n){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(r);a&&(a.delete(n),a.size===0&&i.delete(r),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,r){if(r.id===void 0||r.id==="")throw new Error("ButtonManager | button id is undefined");if(this.buttonTemplates.has(r.id))throw new Error(`ButtonManager | button with id "${r.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(r.id,new bm(r)),this.notifyButtonLoadListeners(e,r.id)}getButton(e,r){if(this.buttonTemplates.has(r))return this.buttonTemplates.get(r);let n=this.buttons.get(e);if(n)return n.get(r)?.getValue()}removeButton(e,r){let n=this.buttons.get(e);n&&(n.get(r)?.decrement(),n.get(r)?.isEmpty()&&n.delete(r),n.size===0&&this.buttons.delete(e))}};var Ls=(x=>(x.TOGGLE="toggle",x.SLIDER="slider",x.TEXT="text",x.TEXT_AREA="textArea",x.SELECT="select",x.MULTI_SELECT="multiSelect",x.DATE="date",x.TIME="time",x.DATE_PICKER="datePicker",x.NUMBER="number",x.SUGGESTER="suggester",x.EDITOR="editor",x.IMAGE_SUGGESTER="imageSuggester",x.PROGRESS_BAR="progressBar",x.INLINE_SELECT="inlineSelect",x.LIST="list",x.LIST_SUGGESTER="listSuggester",x.INLINE_LIST_SUGGESTER="inlineListSuggester",x.INLINE_LIST="inlineList",x.IMAGE_LIST_SUGGESTER="imageListSuggester",x.DATE_TIME="dateTime",x.INVALID="invalid",x))(Ls||{}),en=(D=>(D.CLASS="class",D.ADD_LABELS="addLabels",D.MIN_VALUE="minValue",D.MAX_VALUE="maxValue",D.STEP_SIZE="stepSize",D.OPTION="option",D.TITLE="title",D.OPTION_QUERY="optionQuery",D.SHOWCASE="showcase",D.ON_VALUE="onValue",D.OFF_VALUE="offValue",D.DEFAULT_VALUE="defaultValue",D.PLACEHOLDER="placeholder",D.USE_LINKS="useLinks",D.LIMIT="limit",D.MULTI_LINE="multiLine",D.ALLOW_OTHER="allowOther",D.INVALID="invalid",D))(en||{}),wm={toggle:{type:"toggle",allowInBlock:!0,allowInline:!0},slider:{type:"slider",allowInBlock:!0,allowInline:!0},text:{type:"text",allowInBlock:!0,allowInline:!0},textArea:{type:"textArea",allowInBlock:!0,allowInline:!0},select:{type:"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},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:!0},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},imageListSuggester:{type:"imageListSuggester",allowInBlock:!0,allowInline:!1},dateTime:{type:"dateTime",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}};var Ar={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","multiSelect","suggester","imageSuggester","inlineSelect","listSuggester","inlineListSuggester","imageListSuggester"],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","imageListSuggester"],values:[[{name:"value",allowed:[],description:"the query for options"}]],allowMultiple:!0},placeholder:{type:"placeholder",allowedFieldTypes:["text","textArea","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},multiLine:{type:"multiLine",allowedFieldTypes:["list"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},allowOther:{type:"allowOther",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},lf=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(lf||{}),_u=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(_u||{}),Bl={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},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},_m=8;var Xe=!1;var Ba=Array.isArray,r1=Array.prototype.indexOf,cf=Array.from,Gy=Object.keys,ni=Object.defineProperty,ka=Object.getOwnPropertyDescriptor,Wy=Object.getOwnPropertyDescriptors,Am=Object.prototype,n1=Array.prototype,Au=Object.getPrototypeOf,Yy=Object.isExtensible;var ca=()=>{};function ff(t){for(var e=0;e<t.length;e++)t[e]()}var Hi=Symbol("$state"),pf=Symbol("legacy props"),i1=Symbol("");function Dm(t){return t===this.v}function Sm(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function kl(t){return!Sm(t,this.v)}function jy(){if(Xe){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function a1(){if(Xe){let t=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function o1(t){if(Xe){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function s1(){if(Xe){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function u1(t){if(Xe){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function l1(){if(Xe){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function c1(){if(Xe){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function f1(){if(Xe){let t=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/invalid_snippet")}function p1(t){if(Xe){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function m1(t){if(Xe){let e=new Error(`props_rest_readonly
Rest element properties of \`$props()\` such as \`${t}\` are readonly
https://svelte.dev/e/props_rest_readonly`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function d1(t){if(Xe){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function h1(){if(Xe){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function g1(){if(Xe){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function v1(){if(Xe){let t=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var ns=!1,So=!1;var Vs="[",Us="[!",Du="]",qs={};var In=Symbol(),no=Symbol("filename"),y1=Symbol("hmr"),b1="http://www.w3.org/1999/xhtml";var K8="font-weight: bold",e6="font-weight: normal";function Zy(t){Xe?console.warn(`%c[svelte] state_snapshot_uncloneable
%c${t?`The following properties cannot be cloned with \`$state.snapshot\` \u2014 the return value contains the originals:
${t}`:"Value cannot be cloned with `$state.snapshot` \u2014 the original value was returned"}
https://svelte.dev/e/state_snapshot_uncloneable`,K8,e6):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var t6=[];function ft(t,e=!1){if(Xe&&!e){let r=[],n=mf(t,new Map,"",r);if(r.length===1&&r[0]==="")Zy();else if(r.length>0){let i=r.length>10?r.slice(0,7):r.slice(0,10),a=r.length-i.length,o=i.map(s=>`- <value>${s}`).join(`
`);a>0&&(o+=`
- ...and ${a} more`),Zy(o)}return n}return mf(t,new Map,"",t6)}function mf(t,e,r,n,i=null){if(typeof t=="object"&&t!==null){var a=e.get(t);if(a!==void 0)return a;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(Ba(t)){var o=Array(t.length);e.set(t,o),i!==null&&e.set(i,o);for(var s=0;s<t.length;s+=1){var l=t[s];s in t&&(o[s]=mf(l,e,Xe?`${r}[${s}]`:r,n))}return o}if(Au(t)===Am){o={},e.set(t,o),i!==null&&e.set(i,o);for(var u in t)o[u]=mf(t[u],e,Xe?`${r}.${u}`:r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return mf(t.toJSON(),e,Xe?`${r}.toJSON()`:r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return Xe&&n.push(r),t}}var df=null;function is(t){let e=Error(),r=e.stack;if(r){let n=r.split(`
`),i=[`
`];for(let a=0;a<n.length;a++){let o=n[a];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;ni(e,"stack",{value:i.join(`
`)}),ni(e,"name",{value:`${t}Error`})}return e}function gf(t){if(Xe){let e=new Error(`lifecycle_outside_component
\`${t}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var gr=null;function vf(t){gr=t}var io=null;function yf(t){io=t}function Se(t,e=!1,r){var n=gr={p:gr,c:null,d:!1,e:null,m:!1,s:t,x:null,l:null};ns&&!e&&(gr.l={s:null,u:null,r1:[],r2:ao(!1)}),Gi(()=>{n.d=!0}),Xe&&(gr.function=r,io=r)}function Ee(t){let e=gr;if(e!==null){t!==void 0&&(e.x=t);let o=e.e;if(o!==null){var r=Xt,n=fr;e.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];ii(a.effect),Un(a.reaction),Fi(a.fn)}}finally{ii(r),Un(n)}}gr=e.p,Xe&&(io=e.p?.function??null),e.m=!0}return t||{}}function Eo(){return!ns||gr!==null&&gr.l===null}function dt(t){if(typeof t!="object"||t===null||Hi in t)return t;let e=Au(t);if(e!==Am&&e!==n1)return t;var r=new Map,n=Ba(t),i=it(0),a=Xe&&So?is("CreatedAt"):null,o=fr,s=l=>{var u=fr;Un(o);var c=l();return Un(u),c};return n&&r.set("length",it(t.length,a)),new Proxy(t,{defineProperty(l,u,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&h1();var f=r.get(u);return f===void 0?(f=s(()=>it(c.value,a)),r.set(u,f)):ke(f,s(()=>dt(c.value))),!0},deleteProperty(l,u){var c=r.get(u);if(c===void 0)u in l&&(r.set(u,s(()=>it(In,a))),Jy(i));else{if(n&&typeof u=="string"){var f=r.get("length"),m=Number(u);Number.isInteger(m)&&m<f.v&&ke(f,m)}ke(c,In),Jy(i)}return!0},get(l,u,c){if(u===Hi)return t;var f=r.get(u),m=u in l;if(f===void 0&&(!m||ka(l,u)?.writable)&&(f=s(()=>it(dt(m?l[u]:In),a)),r.set(u,f)),f!==void 0){var p=q(f);return p===In?void 0:p}return Reflect.get(l,u,c)},getOwnPropertyDescriptor(l,u){var c=Reflect.getOwnPropertyDescriptor(l,u);if(c&&"value"in c){var f=r.get(u);f&&(c.value=q(f))}else if(c===void 0){var m=r.get(u),p=m?.v;if(m!==void 0&&p!==In)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return c},has(l,u){if(u===Hi)return!0;var c=r.get(u),f=c!==void 0&&c.v!==In||Reflect.has(l,u);if(c!==void 0||Xt!==null&&(!f||ka(l,u)?.writable)){c===void 0&&(c=s(()=>it(f?dt(l[u]):In,a)),r.set(u,c));var m=q(c);if(m===In)return!1}return f},set(l,u,c,f){var m=r.get(u),p=u in l;if(n&&u==="length")for(var d=c;d<m.v;d+=1){var h=r.get(d+"");h!==void 0?ke(h,In):d in l&&(h=s(()=>it(In,a)),r.set(d+"",h))}m===void 0?(!p||ka(l,u)?.writable)&&(m=s(()=>it(void 0,a)),ke(m,s(()=>dt(c))),r.set(u,m)):(p=m.v!==In,ke(m,s(()=>dt(c))));var b=Reflect.getOwnPropertyDescriptor(l,u);if(b?.set&&b.set.call(f,c),!p){if(n&&typeof u=="string"){var y=r.get("length"),D=Number(u);Number.isInteger(D)&&D>=y.v&&ke(y,D+1)}Jy(i)}return!0},ownKeys(l){q(i);var u=Reflect.ownKeys(l).filter(m=>{var p=r.get(m);return p===void 0||p.v!==In});for(var[c,f]of r)f.v!==In&&!(c in l)&&u.push(c);return u},setPrototypeOf(){g1()}})}function Jy(t,e=1){ke(t,t.v+e)}function Pl(t){try{if(t!==null&&typeof t=="object"&&Hi in t)return t[Hi]}catch{}return t}function Xy(t,e){return Object.is(Pl(t),Pl(e))}function zs(t){var e=2050,r=fr!==null&&(fr.f&2)!==0?fr:null;Xt===null||r!==null&&(r.f&256)!==0?e|=256:Xt.f|=1048576;let n={ctx:gr,deps:null,effects:null,equals:Dm,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??Xt};return Xe&&So&&(n.created=is("CreatedAt")),n}function cr(t){let e=zs(t);return Mm(e),e}function bf(t){let e=zs(t);return e.equals=kl,e}function Em(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)ci(e[r])}}var Qy=[];function i6(t){for(var e=t.parent;e!==null;){if((e.f&2)===0)return e;e=e.parent}return null}function tb(t){var e,r=Xt;if(ii(i6(t)),Xe){let n=Su;Ky(new Set);try{Qy.includes(t)&&a1(),Qy.push(t),Em(t),e=Tm(t)}finally{ii(r),Ky(n),Qy.pop()}}else try{Em(t),e=Tm(t)}finally{ii(r)}return e}function rb(t){var e=tb(t),r=(as||(t.f&256)!==0)&&t.deps!==null?4096:1024;fi(t,r),t.equals(e)||(t.v=e,t.wv=xf())}var Su=new Set,$l=new Map;function Ky(t){Su=t}function ao(t,e){var r={f:0,v:t,reactions:null,equals:Dm,rv:0,wv:0};return Xe&&So&&(r.created=e??is("CreatedAt"),r.debug=null),r}function it(t,e){let r=ao(t,e);return Mm(r),r}function ss(t,e=!1){let r=ao(t);return e||(r.equals=kl),ns&&gr!==null&&gr.l!==null&&(gr.l.s??=[]).push(r),r}function ke(t,e,r=!1){fr!==null&&!$a&&Eo()&&(fr.f&18)!==0&&!To?.includes(t)&&v1();let n=r?dt(e):e;return Rl(t,n)}function Rl(t,e){if(!t.equals(e)){var r=t.v;if(Eu?$l.set(t,e):$l.set(t,r),t.v=e,Xe&&So&&(t.updated=is("UpdatedAt"),Xt!=null&&(t.trace_need_increase=!0,t.trace_v??=r)),(t.f&2)!==0&&((t.f&2048)!==0&&tb(t),fi(t,(t.f&256)===0?1024:4096)),t.wv=xf(),w1(t,2048),Eo()&&Xt!==null&&(Xt.f&1024)!==0&&(Xt.f&96)===0&&(pa===null?_1([t]):pa.push(t)),Xe&&Su.size>0){let n=Array.from(Su);for(let i of n)(i.f&1024)!==0&&fi(i,4096),Hs(i)&&Ll(i);Su.clear()}}return e}function w1(t,e){var r=t.reactions;if(r!==null)for(var n=Eo(),i=r.length,a=0;a<i;a++){var o=r[a],s=o.f;if((s&2048)===0&&!(!n&&o===Xt)){if(Xe&&(s&262144)!==0){Su.add(o);continue}fi(o,e),(s&1280)!==0&&((s&2)!==0?w1(o,4096):Vl(o))}}}var Cm="font-weight: bold",Nm="font-weight: normal";function A1(t,e,r){Xe?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Cm,Nm):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Ul(t){Xe?console.warn(`%c[svelte] hydration_mismatch
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Cm,Nm):console.warn("https://svelte.dev/e/hydration_mismatch")}function D1(){Xe?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Cm,Nm):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Fm(t){Xe?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Cm,Nm):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var Tt=!1;function pi(t){Tt=t}var jt;function un(t){if(t===null)throw Ul(),qs;return jt=t}function mi(){return un(di(jt))}function le(t){if(Tt){if(di(jt)!==null)throw Ul(),qs;jt=t}}function _t(t=1){if(Tt){for(var e=t,r=jt;e--;)r=di(r);jt=r}}function Tu(){for(var t=0,e=jt;;){if(e.nodeType===8){var r=e.data;if(r===Du){if(t===0)return e;t-=1}else(r===Vs||r===Us)&&(t+=1)}var n=di(e);e.remove(),e=n}}function S1(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,o){let s=r.call(this,a,o);if(s===-1){for(let l=o??0;l<this.length;l+=1)if(Pl(this[l])===a){Fm("array.indexOf(...)");break}}return s},t.lastIndexOf=function(a,o){let s=n.call(this,a,o??this.length-1);if(s===-1){for(let l=0;l<=(o??this.length-1);l+=1)if(Pl(this[l])===a){Fm("array.lastIndexOf(...)");break}}return s},t.includes=function(a,o){let s=i.call(this,a,o);if(!s){for(let l=0;l<this.length;l+=1)if(Pl(this[l])===a){Fm("array.includes(...)");break}}return s},Array.__svelte_cleanup=()=>{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var us,E1,wf,T1,M1;function Im(){if(us===void 0){us=window,E1=document,wf=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;T1=ka(e,"firstChild").get,M1=ka(e,"nextSibling").get,Yy(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Yy(r)&&(r.__t=void 0),Xe&&(t.__svelte_meta=null,S1())}}function Wi(t=""){return document.createTextNode(t)}function yn(t){return T1.call(t)}function di(t){return M1.call(t)}function ve(t,e){if(!Tt)return yn(t);var r=yn(jt);if(r===null)r=jt.appendChild(Wi());else if(e&&r.nodeType!==3){var n=Wi();return r?.before(n),un(n),n}return un(r),r}function We(t,e){if(!Tt){var r=yn(t);return r instanceof Comment&&r.data===""?di(r):r}if(e&&jt?.nodeType!==3){var n=Wi();return jt?.before(n),un(n),n}return jt}function ue(t,e=1,r=!1){let n=Tt?jt:t;for(var i;e--;)i=n,n=di(n);if(!Tt)return n;var a=n?.nodeType;if(r&&a!==3){var o=Wi();return n===null?i?.after(o):n.before(o),un(o),o}return un(n),n}function ql(t){t.textContent=""}function F1(t){Xt===null&&fr===null&&u1(t),fr!==null&&(fr.f&256)!==0&&Xt===null&&s1(),Eu&&o1(t)}function a6(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Mu(t,e,r,n=!0){var i=Xt;if(Xe)for(;i!==null&&(i.f&262144)!==0;)i=i.parent;var a={ctx:gr,deps:null,nodes_start:null,nodes_end:null,f:t|2048,first:null,fn:e,last:null,next:null,parent:i,prev:null,teardown:null,transitions:null,wv:0};if(Xe&&(a.component_function=io),r)try{Ll(a),a.f|=32768}catch(l){throw ci(a),l}else e!==null&&Vl(a);var o=r&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&1048704)===0;if(!o&&n&&(i!==null&&a6(a,i),fr!==null&&(fr.f&2)!==0)){var s=fr;(s.effects??=[]).push(a)}return a}function Gi(t){let e=Mu(8,null,!1);return fi(e,1024),e.teardown=t,e}function Yi(t){F1("$effect");var e=Xt!==null&&(Xt.f&32)!==0&&gr!==null&&!gr.m;if(Xe&&ni(t,"name",{value:"$effect"}),e){var r=gr;(r.e??=[]).push({fn:t,effect:Xt,reaction:fr})}else{var n=Fi(t);return n}}function ob(t){let e=Mu(64,t,!0);return()=>{ci(e)}}function I1(t){let e=Mu(64,t,!0);return(r={})=>new Promise(n=>{r.outro?lo(e,()=>{ci(e),n(void 0)}):(ci(e),n(void 0))})}function Fi(t){return Mu(4,t,!1)}function ma(t){return Mu(8,t,!0)}function Le(t,e=[],r=zs){let n=e.map(r),i=()=>t(...n.map(q));return Xe&&ni(i,"name",{value:"{expression}"}),ji(i)}function ji(t,e=0){return Mu(24|e,t,!0)}function hi(t,e=!0){return Mu(40,t,!0,e)}function sb(t){var e=t.teardown;if(e!==null){let r=Eu,n=fr;ib(!0),Un(null);try{e.call(null)}finally{ib(r),Un(n)}}}function ub(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;(r.f&64)!==0?r.parent=null:ci(r,e),r=n}}function B1(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&ci(e),e=r}}function ci(t,e=!0){var r=!1;(e||(t.f&524288)!==0)&&t.nodes_start!==null&&(k1(t.nodes_start,t.nodes_end),r=!0),ub(t,e&&!r),Af(t,0),fi(t,16384);var n=t.transitions;if(n!==null)for(let a of n)a.stop();sb(t);var i=t.parent;i!==null&&i.first!==null&&lb(t),Xe&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function k1(t,e){for(;t!==null;){var r=t===e?null:di(t);t.remove(),t=r}}function lb(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function lo(t,e){var r=[];km(t,r,!0),cb(r,()=>{ci(t),e&&e()})}function cb(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function km(t,e,r){if((t.f&8192)===0){if(t.f^=8192,t.transitions!==null)for(let o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var i=n.next,a=(n.f&65536)!==0||(n.f&32)!==0;km(n,e,a?r:!1),n=i}}}function Gs(t){P1(t,!0)}function P1(t,e){if((t.f&8192)!==0){t.f^=8192,(t.f&1024)===0&&(t.f^=1024),Hs(t)&&(fi(t,2048),Vl(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;P1(r,i?e:!1),r=n}if(t.transitions!==null)for(let a of t.transitions)(a.is_global||e)&&a.in()}}var o6=typeof requestIdleCallback>"u"?t=>setTimeout(t,1):requestIdleCallback,Df=[],Sf=[];function $1(){var t=Df;Df=[],ff(t)}function O1(){var t=Sf;Sf=[],ff(t)}function Ra(t){Df.length===0&&queueMicrotask($1),Df.push(t)}function R1(t){Sf.length===0&&o6(O1),Sf.push(t)}function L1(){Df.length>0&&$1(),Sf.length>0&&O1()}var V1=new WeakSet,Pm=!1,Hl=!1,Ef=null,Cu=!1,Eu=!1;function ib(t){Eu=t}var Tf=[],Om=[],fr=null,$a=!1;function Un(t){fr=t}var Xt=null;function ii(t){Xt=t}var To=null;function Mm(t){fr!==null&&fr.f&2097152&&(To===null?To=[t]:To.push(t))}var Bi=null,da=0,pa=null;function _1(t){pa=t}var H1=1,Rm=0,as=!1,hf=null;function xf(){return++H1}function Hs(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,o=(e&512)!==0,s=n&&Xt!==null&&!as,l=r.length;if(o||s){var u=t,c=u.parent;for(i=0;i<l;i++)a=r[i],(o||!a?.reactions?.includes(u))&&(a.reactions??=[]).push(u);o&&(u.f^=512),s&&c!==null&&(c.f&256)===0&&(u.f^=256)}for(i=0;i<l;i++)if(a=r[i],Hs(a)&&rb(a),a.wv>t.wv)return!0}(!n||Xt!==null&&!as)&&fi(t,1024)}return!1}function s6(t,e){for(var r=e;r!==null;){if((r.f&128)!==0)try{r.fn(t);return}catch{r.f^=128}r=r.parent}throw Pm=!1,t}function U1(t){return(t.f&16384)===0&&(t.parent===null||(t.parent.f&128)===0)}function Gl(t,e,r,n){if(Pm){if(r===null&&(Pm=!1),U1(e))throw t;return}if(r!==null&&(Pm=!0),Xe&&n!==null&&t instanceof Error&&!V1.has(t)){V1.add(t);let a=[],o=e.fn?.name;o&&a.push(o);let s=n;for(;s!==null;){var i=s.function?.[no];if(i){let c=i.split("/").pop();a.push(c)}s=s.p}let l=wf?" ":" ";ni(t,"message",{value:t.message+`
${a.map(c=>`
${l}in ${c}`).join("")}
`}),ni(t,"component_stack",{value:a});let u=t.stack;if(u){let c=u.split(`
`),f=[];for(let m=0;m<c.length;m++){let p=c[m];p.includes("svelte/src/internal")||f.push(p)}ni(t,"stack",{value:f.join(`
`)})}}if(s6(t,e),U1(e))throw t}function G1(t,e,r=!0){var n=t.reactions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];To?.includes(t)||((a.f&2)!==0?G1(a,e,!1):e===a&&(r?fi(a,2048):(a.f&1024)!==0&&fi(a,4096),Vl(a)))}}function Tm(t){var e=Bi,r=da,n=pa,i=fr,a=as,o=To,s=gr,l=$a,u=t.f;Bi=null,da=0,pa=null,as=(u&256)!==0&&($a||!Cu||fr===null),fr=(u&96)===0?t:null,To=null,vf(t.ctx),$a=!1,Rm++,t.f|=2097152;try{var c=(0,t.fn)(),f=t.deps;if(Bi!==null){var m;if(Af(t,da),f!==null&&da>0)for(f.length=da+Bi.length,m=0;m<Bi.length;m++)f[da+m]=Bi[m];else t.deps=f=Bi;if(!as)for(m=da;m<f.length;m++)(f[m].reactions??=[]).push(t)}else f!==null&&da<f.length&&(Af(t,da),f.length=da);if(Eo()&&pa!==null&&!$a&&f!==null&&(t.f&6146)===0)for(m=0;m<pa.length;m++)G1(pa[m],t);return i!==null&&i!==t&&(Rm++,pa!==null&&(n===null?n=pa:n.push(...pa))),c}finally{Bi=e,da=r,pa=n,fr=i,as=a,To=o,vf(s),$a=l,t.f^=2097152}}function u6(t,e){let r=e.reactions;if(r!==null){var n=r1.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&(e.f&2)!==0&&(Bi===null||!Bi.includes(e))&&(fi(e,4096),(e.f&768)===0&&(e.f^=512),Em(e),Af(e,0))}function Af(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)u6(t,r[n])}function Ll(t){var e=t.f;if((e&16384)===0){fi(t,1024);var r=Xt,n=gr,i=Cu;if(Xt=t,Cu=!0,Xe){var a=io;yf(t.component_function)}try{(e&16)!==0?B1(t):ub(t),sb(t);var o=Tm(t);t.teardown=typeof o=="function"?o:null,t.wv=H1;var s=t.deps;if(Xe&&So&&(t.f&2048)!==0&&s!==null)for(let u=0;u<s.length;u++){var l=s[u];l.trace_need_increase&&(l.wv=xf(),l.trace_need_increase=void 0,l.trace_v=void 0)}Xe&&Om.push(t)}catch(u){Gl(u,t,r,n||t.ctx)}finally{Cu=i,Xt=r,Xe&&yf(a)}}}function q1(){console.error("Last ten effects were: ",Om.slice(-10).map(t=>t.fn)),Om=[]}function l6(){try{l1()}catch(t){if(Xe&&ni(t,"stack",{value:""}),Ef!==null)if(Xe)try{Gl(t,Ef,null,null)}catch(e){throw q1(),e}else Gl(t,Ef,null,null);else throw Xe&&q1(),t}}function pb(){var t=Cu;try{var e=0;for(Cu=!0;Tf.length>0;){e++>1e3&&l6();var r=Tf,n=r.length;Tf=[];for(var i=0;i<n;i++){var a=f6(r[i]);c6(a)}$l.clear()}}finally{Hl=!1,Cu=t,Ef=null,Xe&&(Om=[])}}function c6(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if((n.f&24576)===0)try{Hs(n)&&(Ll(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?lb(n):n.fn=null))}catch(i){Gl(i,n,null,n.ctx)}}}function Vl(t){Hl||(Hl=!0,queueMicrotask(pb));for(var e=Ef=t;e.parent!==null;){e=e.parent;var r=e.f;if((r&96)!==0){if((r&1024)===0)return;e.f^=1024}}Tf.push(e)}function f6(t){for(var e=[],r=t;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0;if(!a&&(n&8192)===0){if((n&4)!==0)e.push(r);else if(i)r.f^=1024;else try{Hs(r)&&Ll(r)}catch(l){Gl(l,r,null,r.ctx)}var o=r.first;if(o!==null){r=o;continue}}var s=r.parent;for(r=r.next;r===null&&s!==null;)r=s.next,s=s.parent}return e}function Mf(t){var e;for(t&&(Hl=!0,pb(),Hl=!0,e=t());;){if(L1(),Tf.length===0)return e;Hl=!0,pb()}}function q(t){var e=t.f,r=(e&2)!==0;if(hf!==null&&hf.add(t),fr!==null&&!$a){if(!To?.includes(t)){var n=fr.deps;t.rv<Rm&&(t.rv=Rm,Bi===null&&n!==null&&n[da]===t?da++:Bi===null?Bi=[t]:(!as||!Bi.includes(t))&&Bi.push(t))}}else if(r&&t.deps===null&&t.effects===null){var i=t,a=i.parent;a!==null&&(a.f&256)===0&&(i.f^=256)}if(r&&(i=t,Hs(i)&&rb(i)),Xe&&So&&df!==null&&fr!==null&&df.reaction===fr){if(t.debug)t.debug();else if(t.created){var o=df.entries.get(t);o===void 0&&(o={read:[]},df.entries.set(t,o)),o.read.push(is("TracedAt"))}}return Eu&&$l.has(t)?$l.get(t):t.v}function sn(t){var e=$a;try{return $a=!0,t()}finally{$a=e}}var p6=-7169;function fi(t,e){t.f=t.f&p6|e}var d6=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Kae=[...d6,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var h6=["touchstart","touchmove"];function W1(t){return h6.includes(t)}function Dn(t){Tt&&yn(t)!==null&&ql(t)}var j1=!1;function Lm(){j1||(j1=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(let e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function Cf(t){var e=fr,r=Xt;Un(null),ii(null);try{return t()}finally{Un(e),ii(r)}}function Vm(t,e,r,n=r){t.addEventListener(e,()=>Cf(r));let i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),Lm()}var mb=new Set,Um=new Set;function Z1(t,e,r,n={}){function i(a){if(n.capture||Wl.call(e,a),!a.cancelBubble)return Cf(()=>r?.call(this,a))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Ra(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function gi(t,e,r,n,i){var a={capture:n,passive:i},o=Z1(t,e,r,a);(e===document.body||e===window||e===document)&&Gi(()=>{e.removeEventListener(t,o,a)})}function Mt(t){for(var e=0;e<t.length;e++)mb.add(t[e]);for(var r of Um)r(t)}function Wl(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],a=i[0]||t.target,o=0,s=t.__root;if(s){var l=i.indexOf(s);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;l<=u&&(o=l)}if(a=i[o]||t.target,a!==e){ni(t,"currentTarget",{configurable:!0,get(){return a||r}});var c=fr,f=Xt;Un(null),ii(null);try{for(var m,p=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var h=a["__"+n];if(h!=null&&(!a.disabled||t.target===a))if(Ba(h)){var[b,...y]=h;b.apply(a,[t,...y])}else h.call(a,t)}catch(D){m?p.push(D):m=D}if(t.cancelBubble||d===e||d===null)break;a=d}if(m){for(let D of p)queueMicrotask(()=>{throw D});throw m}}finally{t.__root=e,delete t.currentTarget,Un(c),ii(f)}}}var g6;function J1(){g6=void 0}function Nf(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function ki(t,e){var r=Xt;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function se(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,a=!t.startsWith("<!>");return()=>{if(Tt)return ki(jt,null),jt;i===void 0&&(i=Nf(a?t:"<!>"+t),r||(i=yn(i)));var o=n||wf?document.importNode(i,!0):i.cloneNode(!0);if(r){var s=yn(o),l=o.lastChild;ki(s,l)}else ki(o,o);return o}}function qm(t,e,r="svg"){var n=!t.startsWith("<!>"),i=(e&1)!==0,a=`<${r}>${n?t:"<!>"+t}</${r}>`,o;return()=>{if(Tt)return ki(jt,null),jt;if(!o){var s=Nf(a),l=yn(s);if(i)for(o=document.createDocumentFragment();yn(l);)o.appendChild(yn(l));else o=yn(l)}var u=o.cloneNode(!0);if(i){var c=yn(u),f=u.lastChild;ki(c,f)}else ki(u,u);return u}}function Vt(t=""){if(!Tt){var e=Wi(t+"");return ki(e,e),e}var r=jt;return r.nodeType!==3&&(r.before(r=Wi()),un(r)),ki(r,r),r}function Gr(){if(Tt)return ki(jt,null),jt;var t=document.createDocumentFragment(),e=document.createComment(""),r=Wi();return t.append(e,r),ki(e,r),t}function K(t,e){if(Tt){Xt.nodes_end=jt,mi();return}t!==null&&t.before(e)}var db=!0;function vt(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function Br(t,e){return Q1(t,e)}function gb(t,e){Im(),e.intro=e.intro??!1;let r=e.target,n=Tt,i=jt;try{for(var a=yn(r);a&&(a.nodeType!==8||a.data!==Vs);)a=di(a);if(!a)throw qs;pi(!0),un(a),mi();let o=Q1(t,{...e,anchor:a});if(jt===null||jt.nodeType!==8||jt.data!==Du)throw Ul(),qs;return pi(!1),o}catch(o){if(o===qs)return e.recover===!1&&c1(),Im(),ql(r),pi(!1),Br(t,e);throw o}finally{pi(n),un(i),J1()}}var Yl=new Map;function Q1(t,{target:e,anchor:r,props:n={},events:i,context:a,intro:o=!0}){Im();var s=new Set,l=f=>{for(var m=0;m<f.length;m++){var p=f[m];if(!s.has(p)){s.add(p);var d=W1(p);e.addEventListener(p,Wl,{passive:d});var h=Yl.get(p);h===void 0?(document.addEventListener(p,Wl,{passive:d}),Yl.set(p,1)):Yl.set(p,h+1)}}};l(cf(mb)),Um.add(l);var u=void 0,c=I1(()=>{var f=r??e.appendChild(Wi());return hi(()=>{if(a){Se({});var m=gr;m.c=a}i&&(n.$$events=i),Tt&&ki(f,null),db=o,u=t(f,n)||{},db=!0,Tt&&(Xt.nodes_end=jt),a&&Ee()}),()=>{for(var m of s){e.removeEventListener(m,Wl);var p=Yl.get(m);--p===0?(document.removeEventListener(m,Wl),Yl.delete(m)):Yl.set(m,p)}Um.delete(l),f!==r&&f.parentNode?.removeChild(f)}});return hb.set(u,c),u}var hb=new WeakMap;function Dr(t,e){let r=hb.get(t);return r?(hb.delete(t),r(e)):(Xe&&D1(),Promise.resolve())}function et(t,e,[r,n]=[0,0]){Tt&&r===0&&mi();var i=t,a=null,o=null,s=In,l=r>0?65536:0,u=!1;let c=(m,p=!0)=>{u=!0,f(p,m)},f=(m,p)=>{if(s===(s=m))return;let d=!1;if(Tt&&n!==-1){if(r===0){let b=i.data;b===Vs?n=0:b===Us?n=1/0:(n=parseInt(b.substring(1)),n!==n&&(n=s?1/0:-1))}let h=n>r;!!s===h&&(i=Tu(),un(i),pi(!1),d=!0,n=-1)}s?(a?Gs(a):p&&(a=hi(()=>p(i))),o&&lo(o,()=>{o=null})):(o?Gs(o):p&&(o=hi(()=>p(i,[r+1,n]))),a&&lo(a,()=>{a=null})),d&&pi(!0)};ji(()=>{u=!1,e(c),u||f(null,null)},l),Tt&&(i=jt)}var Ff=null;function Zt(t,e){return e}function w6(t,e,r,n){for(var i=[],a=e.length,o=0;o<a;o++)km(e[o].e,i,!0);var s=a>0&&i.length===0&&r!==null;if(s){var l=r.parentNode;ql(l),l.append(r),n.clear(),Ws(t,e[0].prev,e[a-1].next)}cb(i,()=>{for(var u=0;u<a;u++){var c=e[u];s||(n.delete(c.k),Ws(t,c.prev,c.next)),ci(c.e,!s)}})}function Ut(t,e,r,n,i,a=null){var o=t,s={flags:e,items:new Map,first:null},l=(e&4)!==0;if(l){var u=t;o=Tt?un(yn(u)):u.appendChild(Wi())}Tt&&mi();var c=null,f=!1,m=bf(()=>{var p=r();return Ba(p)?p:p==null?[]:cf(p)});ji(()=>{var p=q(m),d=p.length;if(f&&d===0)return;f=d===0;let h=!1;if(Tt){var b=o.data===Us;b!==(d===0)&&(o=Tu(),un(o),pi(!1),h=!0)}if(Tt){for(var y=null,D,v=0;v<d;v++){if(jt.nodeType===8&&jt.data===Du){o=jt,h=!0,pi(!1);break}var A=p[v],w=n(A,v);D=tA(jt,s,y,null,A,w,v,i,e,r),s.items.set(w,D),y=D}d>0&&un(Tu())}Tt||_6(p,s,o,i,e,n,r),a!==null&&(d===0?c?Gs(c):c=hi(()=>a(o)):c!==null&&lo(c,()=>{c=null})),h&&pi(!0),q(m)}),Tt&&(o=jt)}function _6(t,e,r,n,i,a,o){var s=(i&8)!==0,l=(i&3)!==0,u=t.length,c=e.items,f=e.first,m=f,p,d=null,h,b=[],y=[],D,v,A,w;if(s)for(w=0;w<u;w+=1)D=t[w],v=a(D,w),A=c.get(v),A!==void 0&&(A.a?.measure(),(h??=new Set).add(A));for(w=0;w<u;w+=1){if(D=t[w],v=a(D,w),A=c.get(v),A===void 0){var x=m?m.e.nodes_start:r;d=tA(x,e,d,d===null?e.first:d.next,D,v,w,n,i,o),c.set(v,d),b=[],y=[],m=d.next;continue}if(l&&A6(A,D,w,i),(A.e.f&8192)!==0&&(Gs(A.e),s&&(A.a?.unfix(),(h??=new Set).delete(A))),A!==m){if(p!==void 0&&p.has(A)){if(b.length<y.length){var E=y[0],T;d=E.prev;var _=b[0],C=b[b.length-1];for(T=0;T<b.length;T+=1)K1(b[T],E,r);for(T=0;T<y.length;T+=1)p.delete(y[T]);Ws(e,_.prev,C.next),Ws(e,d,_),Ws(e,C,E),m=E,d=C,w-=1,b=[],y=[]}else p.delete(A),K1(A,m,r),Ws(e,A.prev,A.next),Ws(e,A,d===null?e.first:d.next),Ws(e,d,A),d=A;continue}for(b=[],y=[];m!==null&&m.k!==v;)(m.e.f&8192)===0&&(p??=new Set).add(m),y.push(m),m=m.next;if(m===null)continue;A=m}b.push(A),d=A,m=A.next}if(m!==null||p!==void 0){for(var N=p===void 0?[]:cf(p);m!==null;)(m.e.f&8192)===0&&N.push(m),m=m.next;var I=N.length;if(I>0){var R=(i&4)!==0&&u===0?r:null;if(s){for(w=0;w<I;w+=1)N[w].a?.measure();for(w=0;w<I;w+=1)N[w].a?.fix()}w6(e,N,R,c)}}s&&Ra(()=>{if(h!==void 0)for(A of h)A.a?.apply()}),Xt.first=e.first&&e.first.e,Xt.last=d&&d.e}function A6(t,e,r,n){(n&1)!==0&&Rl(t.v,e),(n&2)!==0?Rl(t.i,r):t.i=r}function tA(t,e,r,n,i,a,o,s,l,u){var c=Ff,f=(l&1)!==0,m=(l&16)===0,p=f?m?ss(i):ao(i):i,d=(l&2)===0?o:ao(o);Xe&&f&&(p.debug=()=>{var b=typeof d=="number"?o:d.v;u()[b]});var h={i:d,v:p,k:a,a:null,e:null,prev:r,next:n};Ff=h;try{return h.e=hi(()=>s(t,p,d,u),Tt),h.e.prev=r&&r.e,h.e.next=n&&n.e,r===null?e.first=h:(r.next=h,r.e.next=h.e),n!==null&&(n.prev=h,n.e.prev=h.e),h}finally{Ff=c}}function K1(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,i=e?e.e.nodes_start:r,a=t.e.nodes_start;a!==n;){var o=di(a);i.before(a),a=o}}function Ws(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function La(t,e,...r){var n=t,i=ca,a;ji(()=>{i!==(i=e())&&(a&&(ci(a),a=null),Xe&&i==null&&f1(),a=hi(()=>i(n,...r)))},65536),Tt&&(n=jt)}function nA(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=nA(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function iA(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=nA(t))&&(n&&(n+=" "),n+=e);return n}function ls(t){return typeof t=="object"?iA(t):t??""}var aA=[...`
\r\f\xA0\v\uFEFF`];function sA(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i in r)if(r[i])n=n?n+" "+i:i;else if(n.length)for(var a=i.length,o=0;(o=n.indexOf(i,o))>=0;){var s=o+a;(o===0||aA.includes(n[o-1]))&&(s===n.length||aA.includes(n[s]))?n=(o===0?"":n.substring(0,o))+n.substring(s+1):o=s}}return n===""?null:n}function oA(t,e=!1){var r=e?" !important;":";",n="";for(var i in t){var a=t[i];a!=null&&a!==""&&(n+=" "+i+": "+a+r)}return n}function bb(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function uA(t,e){if(e){var r="",n,i;if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var a=!1,o=0,s=!1,l=[];n&&l.push(...Object.keys(n).map(bb)),i&&l.push(...Object.keys(i).map(bb));var u=0,c=-1;let h=t.length;for(var f=0;f<h;f++){var m=t[f];if(s?m==="/"&&t[f-1]==="*"&&(s=!1):a?a===m&&(a=!1):m==="/"&&t[f+1]==="*"?s=!0:m==='"'||m==="'"?a=m:m==="("?o++:m===")"&&o--,!s&&a===!1&&o===0){if(m===":"&&c===-1)c=f;else if(m===";"||f===h-1){if(c!==-1){var p=bb(t.substring(u,c).trim());if(!l.includes(p)){m!==";"&&f++;var d=t.substring(u,f).trim();r+=" "+d+";"}}u=f+1,c=-1}}}}return n&&(r+=oA(n)),i&&(r+=oA(i,!0)),r=r.trim(),r===""?null:r}return t==null?null:String(t)}function Vr(t,e,r,n,i,a){var o=t.__className;if(Tt||o!==r||o===void 0){var s=sA(r,n,a);(!Tt||s!==t.getAttribute("class"))&&(s==null?t.removeAttribute("class"):e?t.className=s:t.setAttribute("class",s)),t.__className=r}else if(a&&i!==a)for(var l in a){var u=!!a[l];(i==null||u!==!!i[l])&&t.classList.toggle(l,u)}return a}function xb(t,e={},r,n){for(var i in r){var a=r[i];e[i]!==a&&(r[i]==null?t.style.removeProperty(i):t.style.setProperty(i,a,n))}}function jl(t,e,r,n){var i=t.__style;if(Tt||i!==e){var a=uA(e,n);(!Tt||a!==t.getAttribute("style"))&&(a==null?t.removeAttribute("style"):t.style.cssText=a),t.__style=e}else n&&(Array.isArray(n)?(xb(t,r?.[0],n[0]),xb(t,r?.[1],n[1],"important")):xb(t,r,n));return n}var C6=Symbol("class"),N6=Symbol("style"),F6=Symbol("is custom element"),I6=Symbol("is html");function At(t){if(Tt){var e=!1,r=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;rt(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;rt(t,"checked",null),t.checked=i}}};t.__on_r=r,R1(r),Lm()}}function _b(t,e){var r=Ab(t);r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e??"")}function cs(t,e){var r=Ab(t);r.checked!==(r.checked=e??void 0)&&(t.checked=e)}function rt(t,e,r,n){var i=Ab(t);if(Tt&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||k6(t,e,r??"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[i1]=r),r==null?t.removeAttribute(e):typeof r!="string"&&B6(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function Ab(t){return t.__attributes??={[F6]:t.nodeName.includes("-"),[I6]:t.namespaceURI===b1}}var lA=new Map;function B6(t){var e=lA.get(t.nodeName);if(e)return e;lA.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=Wy(n);for(var a in r)r[a].set&&e.push(a);n=Au(n)}return e}function k6(t,e,r){Xe&&(e==="srcset"&&P6(t,r)||wb(t.getAttribute(e)??"",r)||A1(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function wb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function cA(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function P6(t,e){var r=cA(t.srcset),n=cA(e);return n.length===r.length&&n.every(([i,a],o)=>a===r[o][1]&&(wb(r[o][0],i)||wb(i,r[o][0])))}function xt(t,e,r=e){var n=Eo();Vm(t,"input",i=>{Xe&&t.type==="checkbox"&&jy();var a=i?t.defaultValue:t.value;if(a=Db(t)?Sb(a):a,r(a),n&&a!==(a=e())){var o=t.selectionStart,s=t.selectionEnd;t.value=a??"",s!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(s,t.value.length))}}),(Tt&&t.defaultValue!==t.value||sn(e)==null&&t.value)&&r(Db(t)?Sb(t.value):t.value),ma(()=>{Xe&&t.type==="checkbox"&&jy();var i=e();Db(t)&&i===Sb(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function Db(t){var e=t.type;return e==="number"||e==="range"}function Sb(t){return t===""?null:+t}function Hm(t,e,r){if(t.multiple)return R6(t,e);for(var n of t.options){var i=If(n);if(Xy(i,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function fA(t,e){let r=!0;Fi(()=>{e&&Hm(t,sn(e),r),r=!1;var n=new MutationObserver(()=>{var i=t.__value;Hm(t,i)});return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function Zl(t,e,r=e){var n=!0;Vm(t,"change",i=>{var a=i?"[selected]":":checked",o;if(t.multiple)o=[].map.call(t.querySelectorAll(a),If);else{var s=t.querySelector(a)??t.querySelector("option:not([disabled])");o=s&&If(s)}r(o)}),Fi(()=>{var i=e();if(Hm(t,i,n),n&&i===void 0){var a=t.querySelector(":checked");a!==null&&(i=If(a),r(i))}t.__value=i,n=!1}),fA(t)}function R6(t,e){for(var r of t.options)r.selected=~e.indexOf(If(r))}function If(t){return"__value"in t?t.__value:t.value}function pA(t,e){return t===e||t?.[Hi]===e}function co(t={},e,r,n){return Fi(()=>{var i,a;return ma(()=>{i=a,a=n?.()||[],sn(()=>{t!==r(...a)&&(e(t,...a),i&&pA(r(...i),t)&&e(null,...i))})}),()=>{Ra(()=>{a&&pA(r(...a),t)&&e(null,...a)})}}),t}var Gm=!1,Bfe=Symbol();function Tb(t){var e=Gm;try{return Gm=!1,[t(),Gm]}finally{Gm=e}}var W6={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return Xe&&m1(`${t.name}.${String(e)}`),!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function tr(t,e,r){return new Proxy(Xe?{props:t,exclude:e,name:r,other:{},to_proxy:[]}:{props:t,exclude:e},W6)}function mA(t){return t.ctx?.d??!1}function at(t,e,r,n){var i=(r&1)!==0,a=!ns||(r&2)!==0,o=(r&8)!==0,s=(r&16)!==0,l=!1,u;o?[u,l]=Tb(()=>t[e]):u=t[e];var c=Hi in t||pf in t,f=o&&(ka(t,e)?.set??(c&&e in t&&(E=>t[e]=E)))||void 0,m=n,p=!0,d=!1,h=()=>(d=!0,p&&(p=!1,s?m=sn(n):m=n),m);u===void 0&&n!==void 0&&(f&&a&&p1(e),u=h(),f&&f(u));var b;if(a)b=()=>{var E=t[e];return E===void 0?h():(p=!0,d=!1,E)};else{var y=(i?zs:bf)(()=>t[e]);y.f|=131072,b=()=>{var E=q(y);return E!==void 0&&(m=void 0),E===void 0?m:E}}if((r&4)===0)return b;if(f){var D=t.$$legacy;return function(E,T){return arguments.length>0?((!a||!T||D||l)&&f(T?b():E),E):b()}}var v=!1,A=!1,w=ss(u),x=zs(()=>{var E=b(),T=q(w);return v?(v=!1,A=!0,T):(A=!1,w.v=E)});return o&&q(x),i||(x.equals=kl),function(E,T){if(hf!==null&&(v=A,b(),q(w)),arguments.length>0){let _=T?q(x):a&&o?dt(E):E;if(!x.equals(_)){if(v=!0,ke(w,_),d&&m!==void 0&&(m=_),mA(x))return E;sn(()=>q(x))}return E}return mA(x)?x.v:q(x)}}function dA(t){return new Mb(t)}var Mb=class{#t;#e;constructor(e){var r=new Map,n=(a,o)=>{var s=ss(o);return r.set(a,s),s};let i=new Proxy({...e.props||{},$$events:{}},{get(a,o){return q(r.get(o)??n(o,Reflect.get(a,o)))},has(a,o){return o===pf?!0:(q(r.get(o)??n(o,Reflect.get(a,o))),Reflect.has(a,o))},set(a,o,s){return ke(r.get(o)??n(o,s),s),Reflect.set(a,o,s)}});this.#e=(e.hydrate?gb:Br)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&Mf(),this.#t=i.$$events;for(let a of Object.keys(this.#e))a==="$set"||a==="$destroy"||a==="$on"||ni(this,a,{get(){return this.#e[a]},set(o){this.#e[a]=o},enumerable:!0});this.#e.$set=a=>{Object.assign(i,a)},this.#e.$destroy=()=>{Dr(this.#e)}}$set(e){this.#e.$set(e)}$on(e,r){this.#t[e]=this.#t[e]||[];let n=(...i)=>r.call(this,...i);return this.#t[e].push(n),()=>{this.#t[e]=this.#t[e].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}};var K6;typeof HTMLElement=="function"&&(K6=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&this.attachShadow({mode:"open"})}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){let n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){let n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return i=>{let a=document.createElement("slot");n!=="default"&&(a.name=n),K(i,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},r=e9(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Cb(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=dA({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=ob(()=>{ma(()=>{this.$$r=!0;for(let n of Gy(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=Cb(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let a=this.$$c.$on(n,i);this.$$l_u.set(i,a)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Cb(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Gy(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Cb(t,e,r,n){let i=r[t]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])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;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}}function e9(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}if(Xe){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;d1(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function Nb(t){gr===null&&gf("onMount"),ns&&gr.l!==null?r9(gr).m.push(t):Yi(()=>{let e=sn(t);if(typeof e=="function")return e})}function Jl(t){gr===null&&gf("onDestroy"),Nb(()=>()=>sn(t))}function r9(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}var Wm=class{constructor(e,r,n){this.mb=e,this.mounted=!1,this.svelteComponent=r,this.onValueChange=n}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,r,n={}){let i=Object.assign({mb:this.mb,value:r,onValueChange:this.onValueChange},n);this.svelteComponentInstance=Br(this.svelteComponent,{target:e,props:i}),this.mounted=!0}unmount(){this.svelteComponentInstance&&Dr(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}};var vi=class{constructor(){this.mounted=!1,this.targetEl=void 0,this.onUnmountCbs=[]}isMounted(){return this.mounted}getTargetEl(){return this.targetEl}mount(e){if(this.mounted||this.targetEl){console.warn("Mountable is already mounted",this);return}if(e===void 0){console.error("Mountable target element is undefined",this);return}this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl){console.warn("Mountable is not mounted",this);return}this.mounted=!1,this.onUnmount(this.targetEl);for(let e of this.onUnmountCbs)e();this.targetEl=void 0}registerUnmountCb(e){this.onUnmountCbs.push(e)}};var Ym=class{constructor(){this.listeners=[]}registerListener(e){let r=e;return r.uuid=_r(),this.listeners.push(r),r}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(r=>r.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let r of this.listeners)try{r.callback(e)}catch(n){let i=n instanceof Error?n:String(n);console.error(new Lt({errorLevel:"ERROR",effect:"error while calling listener callback",cause:i}))}}},hn=class extends Ym{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},jm=class extends Ym{constructor(e,r){super(),this.value=r(e),this.mapFn=r}get(){return this.value}set(e){this.value=this.mapFn(e),this.notifyListeners(this.value)}setDirect(e){this.value=e,this.notifyListeners(e)}};var nr=class extends vi{constructor(e){super(),this.mountable=e,this.mb=e.mb}reverseMapValue(e){let r=this.rawReverseMapValue(e);if(r!==void 0)return r;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.inputSignal?this.inputSignal.get():this.getDefaultValue()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.inputSignal?.setDirect(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.write(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let r=this.filterValue(e.value);return r!==void 0?r:this.mapValue(this.getFallbackDefaultValue())}updateDataAttributes(e){this.mountTarget&&(this.mountTarget.dataset.internalValue=JSON.stringify(e))}getMountArgs(){return{}}onMount(e){this.mountTarget=e,this.svelteWrapper=new Wm(this.mb,this.getSvelteComponent(),n=>{this.updateDataAttributes(n),this.notifySubscription(this.mapValue(n))}),this.inputSignal=new jm(void 0,n=>{let i=this.filterValue(n);return i!==void 0?i:this.getDefaultValue()}),this.inputSignal.registerListener({callback:n=>this.svelteWrapper?.setValue(this.reverseMapValue(n))}),this.inputSignal.registerListener({callback:n=>{this.updateDataAttributes(this.reverseMapValue(n))}}),this.updateDataAttributes(this.getInternalValue());let r=this.mountable.getBindTarget();r&&(this.metadataSubscription=this.mountable.mb.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,r,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.mountTarget=void 0,this.inputSignal?.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper?.unmount()}};var hA="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(hA);var n9=(t,e,r,n)=>r.onValueChange(ft(q(n))),i9=se('<input type="date">');function Fb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(o){ke(n,o,!0)}var a=i9();return At(a),a.__input=[n9,r,e,n],xt(a,()=>q(n),o=>ke(n,o)),K(t,a),Ee({setValue:i})}Mt(["input"]);var Bb=Tr(Bf()),Kn=class t{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,Bb.default)(e,t.dateFormat)}static getDefaultDate(){return(0,Bb.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var Zm=class extends nr{filterValue(e){return Do(e)}getFallbackDefaultValue(){return Kn.stringify(Kn.getDefaultDate())}getSvelteComponent(){return Fb}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var a9=se('<div class="mb-icon-wrapper"></div>');function Or(t,e){Se(e,!0);let r=at(e,"iconName",3,""),n=it(void 0);Yi(()=>q(n)?e.mb.internal.setIcon(q(n),r()):void 0);var i=Gr(),a=We(i);{var o=s=>{var l=a9();co(l,u=>ke(n,u),()=>q(n)),K(s,l)};et(a,s=>{r().length>0&&s(o)})}K(t,i),Ee()}function o9(t,e,r){r.showDatePicker()}function s9(t,e,r){t.key===" "&&r.showDatePicker()}var u9=se('<div class="mb-date-picker-input" role="button" tabindex="0"><span class="mb-date-picker-text"> </span> <!></div>');function kb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(u){ke(n,u,!0)}var a=u9();a.__click=[o9,r,e],a.__keydown=[s9,r,e];var o=ve(a),s=ve(o,!0);le(o);var l=ue(o,2);return Or(l,{get mb(){return e.mb},iconName:"calendar"}),le(a),Le(u=>vt(s,u),[()=>q(n)?q(n).format(e.dateFormat):"none"]),K(t,a),Ee({setValue:i})}Mt(["click","keydown"]);var Jm=class extends nr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!="string")return;let r=Kn.parse(e);if(r.isValid())return Kn.stringify(r)}getFallbackDefaultValue(){return Kn.getDefaultDate()}getSvelteComponent(){return kb}rawMapValue(e){return e===null?null:(console.log("value",e,Kn.stringify(e),Kn.dateFormat),Kn.stringify(e))}rawReverseMapValue(e){if(e===null)return null;let r=Kn.parse(e);if(r.isValid())return r}getMountArgs(){return{dateFormat:this.mountable.mb.getSettings().preferredDateFormat,showDatePicker:()=>{this.mountable.mb.internal.openDatePickerModal(this.getInternalValue(),e=>this.setInternalValue(e))}}}};var l9=(t,e,r,n)=>r.onValueChange(ft(q(n))),c9=se('<input type="datetime-local">');function Pb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(o){ke(n,o,!0)}var a=c9();return At(a),a.__input=[l9,r,e,n],xt(a,()=>q(n),o=>ke(n,o)),K(t,a),Ee({setValue:i})}Mt(["input"]);var Xm=class extends nr{filterValue(e){return Do(e)}getFallbackDefaultValue(){return Kn.stringify(Kn.getDefaultDate())}getSvelteComponent(){return Pb}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var f9=se("<div></div>");function $b(t,e){Se(e,!0);let r,n;Jl(()=>{n?.()});async function i(o){n?.(),lt.empty(r),n=await e.mb.internal.renderMarkdown(o,r,e.filePath)}Yi(()=>void i(e.value));var a=f9();co(a,o=>r=o,()=>r),K(t,a),Ee()}var p9=(t,e)=>e(),m9=(t,e)=>e(),d9=(t,e,r,n)=>r.onValueChange(ft(q(n))),h9=se("<textarea></textarea>"),g9=se('<div class="mb-editor-input card" role="button" tabindex="0"><!></div>');function Ob(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value)),i=it(!1);function a(p){ke(n,p,!0)}function o(){ke(i,!1)}function s(){ke(i,!0)}function l(p){p.key===" "&&s()}var u=g9();u.__click=[p9,s];var c=ve(u);{var f=p=>{var d=h9();Dn(d),d.__focusout=[m9,o],d.__input=[d9,r,e,n],xt(d,()=>q(n),h=>ke(n,h)),K(p,d)},m=p=>{$b(p,{get value(){return q(n)},get mb(){return e.mb},get filePath(){return e.filePath}})};et(c,p=>{q(i)?p(f):p(m,!1)})}return le(u),gi("keypress",u,p=>l(p)),K(t,u),Ee({setValue:a})}Mt(["click","focusout","input"]);var Qm=class extends nr{filterValue(e){return Os(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return Ob}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,r)=>void this.renderInElement(e,r),filePath:this.mountable.getFilePath()}}async renderInElement(e,r){this.mdUnloadCallback?.(),e.innerHTML="",this.mdUnloadCallback=await this.mountable.mb.internal.renderMarkdown(r,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};var v9=se("<button><!></button>");function yt(t,e){Se(e,!0);let r=at(e,"variant",19,()=>"default"),n=at(e,"disabled",3,!1),i=at(e,"tooltip",3,""),a=at(e,"classes",3,""),o=at(e,"onclick",3,()=>{});var s=v9();let l;s.__click=function(...c){o()?.apply(this,c)};var u=ve(s);La(u,()=>e.children),le(s),Le(c=>{l=Vr(s,1,`mb-button-inner ${a()??""}`,null,l,c),rt(s,"aria-label",i()),s.disabled=n()},[()=>({"mod-cta":r()==="primary","mod-warning":r()==="destructive","mod-plain":r()==="plain",disabled:n()})]),K(t,s),Ee()}Mt(["click"]);var y9=se('<div class="mb-image-card" role="listitem"><img class="mb-image-card-image"></div>'),b9=se('<div class="mb-image-card-grid"></div> <div class="mb-list-input"><!></div>',1);function Rb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(m){ke(n,m,!0)}function a(m){q(n).push(m),e.onValueChange(ft(q(n)))}function o(m){q(n).splice(m,1),e.onValueChange(ft(q(n)))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=q(n)[p-1];q(n)[p-1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),p<q(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=q(n)[p+1];q(n)[p+1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),d.push({name:"Copy image path",icon:"copy",onclick:()=>{let h=q(n)[p];navigator.clipboard.writeText(h).then(()=>{e.mb.internal.showNotice("Image path copied to clipboard")}).catch(()=>{e.mb.internal.showNotice("Failed to copy image path to clipboard")})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.mb.internal.createContextMenu(d).showWithEvent(m)}var l=b9(),u=We(l);Ut(u,21,()=>q(n),Zt,(m,p,d)=>{var h=y9();h.__contextmenu=y=>s(y,d);var b=ve(h);le(h),Le((y,D)=>{rt(h,"data-value",y),rt(b,"src",D),rt(b,"alt",q(p)),rt(b,"aria-label",q(p))},[()=>dn(q(p)),()=>e.mb.internal.imagePathToUri(q(p))]),K(m,h)}),le(u);var c=ue(u,2),f=ve(c);return yt(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(m,p)=>{_t();var d=Vt("Add new image");K(m,d)},$$slots:{default:!0}}),le(c),K(t,l),Ee({setValue:i,pushValue:a})}Mt(["contextmenu"]);var Km=class extends nr{filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Rb}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(r=>dn(r)).filter(r=>r!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.mb.internal.openImageSuggesterModal(this,!1,e=>{e!==void 0&&this.svelteWrapper?.getInstance()?.pushValue(e)})}};var x9=(t,e)=>e(t),w9=se('<div class="mb-image-card"><img class="mb-image-card-image"> <!></div>'),_9=se('<div class="mb-image-empty"><!></div>');function Lb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(c){ke(n,c,!0)}function a(c){let f=[];f.push({name:"Edit",icon:"pencil",onclick:()=>{e.showSuggester()}}),f.push({name:"Remove",icon:"x",warning:!0,onclick:()=>e.clear()}),e.mb.internal.createContextMenu(f).showWithEvent(c)}var o=Gr(),s=We(o);{var l=c=>{var f=w9();f.__contextmenu=[x9,a];var m=ve(f),p=ue(m,2);yt(p,{get variant(){return"plain"},onclick:d=>a(d),classes:"mb-image-card-button",children:(d,h)=>{Or(d,{iconName:"ellipsis-vertical",get mb(){return e.mb}})},$$slots:{default:!0}}),le(f),Le(d=>{rt(m,"src",d),rt(m,"alt",q(n)),rt(m,"aria-label",q(n))},[()=>e.mb.internal.imagePathToUri(q(n))]),K(c,f)},u=c=>{var f=_9(),m=ve(f);yt(m,{get variant(){return"plain"},onclick:()=>e.showSuggester(),tooltip:"Select image",children:(p,d)=>{_t();var h=Vt("No image selected. Click to select.");K(p,h)},$$slots:{default:!0}}),le(f),K(c,f)};et(s,c=>{q(n)?c(l):c(u,!1)})}return K(t,o),Ee({setValue:i})}Mt(["contextmenu"]);var ed=class extends nr{filterValue(e){return Os(e)?e:void 0}getFallbackDefaultValue(){}getSvelteComponent(){return Lb}rawMapValue(e){return e}rawReverseMapValue(e){return dn(e)}getMountArgs(){return{showSuggester:()=>this.openModal(),clear:()=>this.setInternalValue(void 0)}}openModal(){this.mountable.mb.internal.openImageSuggesterModal(this,!0,e=>this.setInternalValue(e))}};var A9=se('<a target="_blank" rel="noopener"> </a>'),D9=se('<a target="_blank" rel="noopener"> </a>');function fs(t,e){Se(e,!0);let r=cr(()=>e.mdLink.block?`${e.mdLink.target}#${e.mdLink.block}`:e.mdLink.target),n=cr(()=>e.mdLink.internal?"internal-link":"external-link");var i=Gr(),a=We(i);{var o=l=>{var u=A9(),c=ve(u,!0);le(u),Le(()=>{rt(u,"data-href",q(r)),rt(u,"href",q(r)),Vr(u,1,ls(q(n))),rt(u,"aria-label",q(r)),vt(c,e.mdLink.alias)}),K(l,u)},s=l=>{var u=D9(),c=ve(u,!0);le(u),Le(()=>{rt(u,"data-href",q(r)),rt(u,"href",q(r)),Vr(u,1,ls(q(n))),vt(c,q(r))}),K(l,u)};et(a,l=>{e.mdLink.alias?l(o):l(s,!1)})}K(t,i),Ee()}var S9=se("<!><span>,</span> <span></span>",1),E9=se("<!> <!>",1);function kf(t,e){Se(e,!0);let r=at(e,"elements",19,()=>[]);var n=E9(),i=We(n);Ut(i,17,()=>r().slice(0,r().length-1),Zt,(o,s)=>{var l=S9(),u=We(l);La(u,()=>e.children,()=>q(s)),_t(3),K(o,l)});var a=ue(i,2);La(a,()=>e.children,()=>r()[r().length-1]),K(t,n),Ee()}var T9=se('<span class="mb-whitespace-pre"> </span>'),M9=se("<span> </span>"),C9=se("<span><!></span>"),N9=se("<span><!></span>");function ha(t,e){Se(e,!0);let r=at(e,"value",3,void 0),n=cr(()=>t1(r(),!1));var i=Gr(),a=We(i);{var o=l=>{var u=T9(),c=ve(u,!0);le(u),Le(()=>vt(c,q(n))),K(l,u)},s=(l,u)=>{{var c=m=>{var p=C9(),d=ve(p);kf(d,{get elements(){return q(n)},children:(b,y=ca)=>{var D=Gr(),v=We(D);{var A=x=>{var E=M9(),T=ve(E,!0);le(E),Le(()=>vt(T,y())),K(x,E)},w=x=>{fs(x,{get mdLink(){return y()}})};et(v,x=>{typeof y()=="string"?x(A):x(w,!1)})}K(b,D)},$$slots:{default:!0}}),le(p),K(m,p)},f=m=>{var p=N9(),d=ve(p);fs(d,{get mdLink(){return q(n)}}),le(p),K(m,p)};et(l,m=>{Array.isArray(q(n))?m(c):m(f,!1)},u)}};et(a,l=>{typeof q(n)=="string"?l(o):l(s,!1)})}K(t,i),Ee()}function F9(t,e,r){t.key===" "&&r.showInput()}var I9=se('<div class="mb-inline-list-item" role="listitem"><!></div>'),B9=(t,e,r)=>r.showInput(),k9=se('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function Vb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(m){ke(n,m,!0)}function a(m){q(n).push(m),e.onValueChange(ft(q(n)))}function o(m){q(n).splice(m,1),e.onValueChange(ft(q(n)))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=q(n)[p-1];q(n)[p-1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),p<q(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=q(n)[p+1];q(n)[p+1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),d.push({name:"Edit",icon:"pencil",onclick:()=>{e.mb.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:dn(q(n)[p]),multiline:!1,onSubmit:h=>{q(n)[p]=h,e.onValueChange(ft(q(n)))},onCancel:()=>{}})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.mb.internal.createContextMenu(d).showWithEvent(m)}var l=k9(),u=ve(l);Ut(u,17,()=>q(n),Zt,(m,p,d)=>{var h=I9();h.__contextmenu=y=>s(y,d);var b=ve(h);ha(b,{get value(){return q(p)}}),le(h),Le(y=>rt(h,"data-value",y),[()=>dn(q(p))]),K(m,h)});var c=ue(u,2);c.__click=[B9,r,e],c.__keydown=[F9,r,e];var f=ue(ve(c),2);return Or(f,{get mb(){return e.mb},iconName:"plus"}),le(c),le(l),K(t,l),Ee({setValue:i,pushValue:a})}Mt(["contextmenu","click","keydown"]);var td=class extends nr{filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Vb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.mountable.mb.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}};function P9(t,e,r){if(!r.allowOther){r.showSuggester();return}r.mb.internal.createContextMenu([{name:"From Options",onclick:()=>r.showSuggester()},{name:"From Text",onclick:()=>r.showTextPrompt()}]).showWithEvent(t)}function $9(t,e,r){t.key===" "&&r.showSuggester()}var O9=se('<div class="mb-inline-list-item" role="listitem"><!></div>'),R9=se('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function Ub(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(m){ke(n,m,!0)}function a(m){q(n).push(m),e.onValueChange(ft(q(n)))}function o(m){q(n).splice(m,1),e.onValueChange(ft(q(n)))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=q(n)[p-1];q(n)[p-1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),p<q(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=q(n)[p+1];q(n)[p+1]=q(n)[p],q(n)[p]=h,e.onValueChange(ft(q(n)))}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.mb.internal.createContextMenu(d).showWithEvent(m)}var l=R9(),u=ve(l);Ut(u,17,()=>q(n),Zt,(m,p,d)=>{var h=O9();h.__contextmenu=y=>s(y,d);var b=ve(h);ha(b,{get value(){return q(p)}}),le(h),Le(y=>rt(h,"data-value",y),[()=>dn(q(p))]),K(m,h)});var c=ue(u,2);c.__click=[P9,r,e],c.__keydown=[$9,r,e];var f=ue(ve(c),2);return Or(f,{get mb(){return e.mb},iconName:"plus"}),le(c),le(l),K(t,l),Ee({setValue:i,pushValue:a})}Mt(["contextmenu","click","keydown"]);var rd=class extends nr{filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Ub}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>{this.svelteWrapper?.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}};var L9=(t,e)=>e(),V9=se("<option> </option>"),U9=se('<select class="dropdown"></select>');function qb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(s){ke(n,s,!0)}function a(){e.onValueChange(ft(q(n)))}var o=U9();return o.__change=[L9,a],Ut(o,21,()=>e.options,Zt,(s,l)=>{var u=V9(),c={},f=ve(u,!0);le(u),Le(()=>{c!==(c=q(l).value)&&(u.value=(u.__value=q(l).value)??""),vt(f,q(l).name)}),K(s,u)}),le(o),Zl(o,()=>q(n),s=>ke(n,s)),K(t,o),Ee({setValue:i})}Mt(["change"]);var nd=class extends nr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Rs(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return qb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var q9=se('<div class="mb-list-item" role="listitem"><!></div>'),z9=se('<span class="mb-list-empty">Empty</span>'),H9=se('<textarea tabindex="0"></textarea>'),G9=(t,e,r)=>{t.key==="Enter"&&q(e).length>0&&r()},W9=se('<input type="text" tabindex="0">'),Y9=se("<span> </span>"),j9=se('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!> <!></div>',1);function zb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value)),i=it("");function a(A){ke(n,A,!0)}function o(){q(n).push(q(i)),e.onValueChange(ft(q(n))),ke(i,"")}function s(A){q(n).splice(A,1),e.onValueChange(ft(q(n)))}function l(A,w){let x=w.toString();return`${A.toString().padStart(x.length,"0")}/${x}`}function u(A,w){let x=[];w>0&&x.push({name:"Move up",icon:"arrow-up",onclick:()=>{let E=q(n)[w-1];q(n)[w-1]=q(n)[w],q(n)[w]=E,e.onValueChange(ft(q(n)))}}),w<q(n).length-1&&x.push({name:"Move down",icon:"arrow-down",onclick:()=>{let E=q(n)[w+1];q(n)[w+1]=q(n)[w],q(n)[w]=E,e.onValueChange(ft(q(n)))}}),x.push({name:"Edit",icon:"pencil",onclick:()=>{e.mb.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:dn(q(n)[w]),multiline:e.multiLine,onSubmit:E=>{q(n)[w]=E,e.onValueChange(ft(q(n)))},onCancel:()=>{}})}}),x.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(w)}),e.mb.internal.createContextMenu(x).showWithEvent(A)}var c=j9(),f=We(c);Ut(f,21,()=>q(n),Zt,(A,w,x)=>{var E=q9();E.__contextmenu=_=>u(_,x);var T=ve(E);ha(T,{get value(){return q(w)}}),le(E),Le(_=>rt(E,"data-value",_),[()=>dn(q(w))]),K(A,E)},A=>{var w=z9();K(A,w)}),le(f);var m=ue(f,2),p=ve(m);{var d=A=>{var w=H9();Dn(w),Le(()=>{rt(w,"placeholder",e.placeholder),rt(w,"maxlength",e.limit)}),xt(w,()=>q(i),x=>ke(i,x)),K(A,w)},h=A=>{var w=W9();At(w),w.__keyup=[G9,i,o],Le(()=>{rt(w,"placeholder",e.placeholder),rt(w,"maxlength",e.limit)}),xt(w,()=>q(i),x=>ke(i,x)),K(A,w)};et(p,A=>{e.multiLine?A(d):A(h,!1)})}var b=ue(p,2);{var y=A=>{var w=Y9(),x=ve(w,!0);le(w),Le(E=>{Vr(w,1,`mb-content-limit-indicator ${q(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`),vt(x,E)},[()=>l(q(n).length,e.limit)]),K(A,w)};et(b,A=>{e.limit!==void 0&&A(y)})}var D=ue(b,2);let v=cr(()=>!q(i));return yt(D,{onclick:()=>o(),get disabled(){return q(v)},children:(A,w)=>{Or(A,{get mb(){return e.mb},iconName:"plus"})},$$slots:{default:!0}}),le(m),K(t,c),Ee({setValue:a})}Mt(["contextmenu","keyup"]);var id=class extends nr{filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return zb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"New Entry...",limit:this.mountable.getArgument("limit")?.value,multiLine:this.mountable.getArgument("multiLine")?.value===!0}}};var Z9=se('<div class="mb-list-item" role="listitem"><!></div>'),J9=se('<span class="mb-list-empty">Empty</span>'),X9=se('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!></div>',1);function Hb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(d){ke(n,d,!0)}function a(d){q(n).push(d),e.onValueChange(ft(q(n)))}function o(d){q(n).splice(d,1),e.onValueChange(ft(q(n)))}function s(d,h){let b=[];h>0&&b.push({name:"Move up",icon:"arrow-up",onclick:()=>{let y=q(n)[h-1];q(n)[h-1]=q(n)[h],q(n)[h]=y,e.onValueChange(ft(q(n)))}}),h<q(n).length-1&&b.push({name:"Move down",icon:"arrow-down",onclick:()=>{let y=q(n)[h+1];q(n)[h+1]=q(n)[h],q(n)[h]=y,e.onValueChange(ft(q(n)))}}),b.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(h)}),e.mb.internal.createContextMenu(b).showWithEvent(d)}var l=X9(),u=We(l);Ut(u,21,()=>q(n),Zt,(d,h,b)=>{var y=Z9();y.__contextmenu=v=>s(v,b);var D=ve(y);ha(D,{get value(){return q(h)}}),le(y),Le(v=>rt(y,"data-value",v),[()=>dn(q(h))]),K(d,y)},d=>{var h=J9();K(d,h)}),le(u);var c=ue(u,2),f=ve(c);yt(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(d,h)=>{_t();var b=Vt("Add new item");K(d,b)},$$slots:{default:!0}});var m=ue(f,2);{var p=d=>{yt(d,{get variant(){return"default"},onclick:()=>e.showTextPrompt(),children:(h,b)=>{_t();var y=Vt("Add other item");K(h,y)},$$slots:{default:!0}})};et(m,d=>{e.allowOther&&d(p)})}return le(c),K(t,l),Ee({setValue:i,pushValue:a})}Mt(["contextmenu"]);var ad=class extends nr{filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Hb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>{this.svelteWrapper?.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}};var Q9=(t,e,r)=>{t.target instanceof HTMLInputElement||e(q(r).value)},K9=(t,e,r)=>e(q(r).value),eq=se('<div role="button" tabindex="0"><input type="checkbox"> <!></div>');function Gb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(u){ke(n,u,!0)}function a(u){q(n).includes(u)?ke(n,q(n).filter(c=>c!==u),!0):q(n).push(u),e.onValueChange(ft(q(n)))}function o(u,c){u.key===" "&&a(c)}var s=Gr(),l=We(s);return Ut(l,17,()=>e.options,Zt,(u,c)=>{var f=eq();let m;f.__click=[Q9,a,c];var p=ve(f);At(p),p.__input=[K9,a,c];var d=ue(p,2);ha(d,{get value(){return q(c).name}}),le(f),Le((h,b,y)=>{m=Vr(f,1,"mb-select-input-element mb-mod-multi",null,m,h),rt(f,"data-value",b),cs(p,y)},[()=>({"is-selected":q(n).includes(q(c).value)}),()=>dn(q(c).value),()=>q(n).includes(q(c).value)]),gi("keypress",f,h=>o(h,q(c).value)),K(u,f)}),K(t,s),Ee({setValue:i})}Mt(["click","input"]);var od=class extends nr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Ia(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Gb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var tq=(t,e,r,n)=>r.onValueChange(ft(q(n))),rq=se('<input type="number" tabindex="0">');function Wb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(o){ke(n,o,!0)}var a=rq();return At(a),a.__input=[tq,r,e,n],Le(()=>rt(a,"placeholder",e.placeholder)),xt(a,()=>q(n),o=>ke(n,o)),K(t,a),Ee({setValue:i})}Mt(["input"]);var sd=class extends nr{filterValue(e){return Il(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Wb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Number"}}};function gA(t,e,r){e(),r(t)}var nq=se('<span class="mb-progress-bar-value"> </span> <span class="mb-progress-bar-label-left"> </span> <span class="mb-progress-bar-label-right"> </span>',1),iq=se('<div class="mb-progress-bar-input" tabindex="0" role="button"><div class="mb-progress-bar-progress" role="slider" tabindex="0"></div> <!></div>');function Yb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value)),i=!1,a,o=0,s;function l(w){ke(n,w,!0)}function u(w){ke(n,w,!0),e.onValueChange(w)}function c(w){return w=af(w,e.minValue,e.maxValue),Ly(w,e.minValue,e.maxValue,0,100)}function f(){i=!0}function m(){i=!1}function p(w){if(!i)return;w.stopPropagation&&w.stopPropagation(),w.preventDefault&&w.preventDefault();let x=w instanceof TouchEvent?w.touches[0].clientX:w.clientX;d(x)}function d(w){let x=a.getBoundingClientRect();w=af(w,x.left,x.right);let E=Ly(w,x.left,x.right,e.minValue,e.maxValue);E=h(E,e.stepSize),u(E)}function h(w,x){return Number.parseFloat((Math.round(w/x)*x).toFixed(10))}function b(w){o<50&&(o+=1);let x=Math.ceil(o/5);if(w.key==="ArrowUp"||w.key==="ArrowRight"){let E=af(q(n)+x,e.minValue,e.maxValue);u(E)}if(w.key==="ArrowDown"||w.key==="ArrowLeft"){let E=af(q(n)-x,e.minValue,e.maxValue);u(E)}window.clearTimeout(s),s=window.setTimeout(()=>o=1,100)}var y=iq();gi("touchmove",us,p,void 0,!1),gi("touchcancel",us,m),gi("touchend",us,m),gi("mousemove",us,p),gi("mouseup",us,m),y.__keydown=b,y.__mousedown=[gA,f,p],y.__touchstart=[gA,f,p];var D=ve(y),v=ue(D,2);{var A=w=>{var x=nq(),E=We(x),T=ve(E,!0);le(E);var _=ue(E,2),C=ve(_,!0);le(_);var N=ue(_,2),I=ve(N,!0);le(N),Le(()=>{vt(T,q(n)),vt(C,e.minValue),vt(I,e.maxValue)}),K(w,x)};et(v,w=>{e.addLabels&&w(A)})}return le(y),co(y,w=>a=w,()=>a),Le((w,x)=>{rt(y,"aria-label",w),jl(D,x),rt(D,"aria-valuemin",e.minValue),rt(D,"aria-valuemax",e.maxValue),rt(D,"aria-valuenow",q(n))},[()=>q(n).toString(),()=>`width: ${c(q(n))}%`]),gi("dragstart",D,()=>i=!0),K(t,y),Ee({setValue:l})}Mt(["keydown","mousedown","touchstart"]);var ud=class extends nr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new $r({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Jp(Il(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Yb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:(this.mountable.getArgument("addLabels")?.value??!0)===!0}}};var aq=(t,e,r)=>{t.target instanceof HTMLInputElement||e(q(r).value)},oq=(t,e,r)=>e(q(r).value),sq=se('<div role="button" tabindex="0"><input type="checkbox"> <!></div>');function jb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(u){ke(n,u,!0)}function a(u){q(n)===u?ke(n,null):ke(n,u,!0),e.onValueChange(ft(q(n)))}function o(u,c){u.key===" "&&a(c)}var s=Gr(),l=We(s);return Ut(l,17,()=>e.options,Zt,(u,c)=>{var f=sq();let m;f.__click=[aq,a,c];var p=ve(f);At(p),p.__input=[oq,a,c];var d=ue(p,2);ha(d,{get value(){return q(c).name}}),le(f),Le((h,b)=>{m=Vr(f,1,"mb-select-input-element",null,m,h),rt(f,"data-value",b),cs(p,q(c).value===q(n))},[()=>({"is-selected":q(c).value===q(n)}),()=>dn(q(c).value)]),gi("keypress",f,h=>o(h,q(c).value)),K(u,f)}),K(t,s),Ee({setValue:i})}Mt(["click","input"]);var ld=class extends nr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Rs(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return jb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var uq=se('<span class="mb-slider-input-label"> </span>'),lq=(t,e,r,n)=>r.onValueChange(ft(q(n))),cq=se('<span class="mb-slider-input-label"> </span>'),fq=se('<!> <input class="mb-slider-input slider" type="range" tabindex="0"> <!>',1);function Zb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(f){ke(n,f,!0)}var a=fq(),o=We(a);{var s=f=>{var m=uq(),p=ve(m,!0);le(m),Le(()=>vt(p,e.minValue)),K(f,m)};et(o,f=>{e.addLabels&&f(s)})}var l=ue(o,2);At(l),l.__input=[lq,r,e,n];var u=ue(l,2);{var c=f=>{var m=cq(),p=ve(m,!0);le(m),Le(()=>vt(p,e.maxValue)),K(f,m)};et(u,f=>{e.addLabels&&f(c)})}return Le(f=>{rt(l,"aria-label",f),rt(l,"min",e.minValue),rt(l,"max",e.maxValue),rt(l,"step",e.stepSize)},[()=>q(n).toString()]),xt(l,()=>q(n),f=>ke(n,f)),K(t,a),Ee({setValue:i})}Mt(["input"]);var cd=class extends nr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new $r({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Jp(Il(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Zb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:this.mountable.getArgument("addLabels")?.value===!0}}};var pq=se("<span> </span>"),mq=se('<div class="mb-suggest-input"><div class="mb-suggest-text"><!></div> <!> <!></div>');function Jb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(h){ke(n,h,!0)}let a=cr(()=>q(n)?.toString()??"null"),o=cr(()=>{if(vn.isLink(q(a)))try{return vn.parseLink(q(a))}catch(h){console.warn(h)}});var s=mq(),l=ve(s),u=ve(l);{var c=h=>{fs(h,{get mdLink(){return q(o)}})},f=h=>{var b=pq(),y=ve(b,!0);le(b),Le(()=>vt(y,q(a))),K(h,b)};et(u,h=>{q(o)!==void 0?h(c):h(f,!1)})}le(l);var m=ue(l,2);yt(m,{get variant(){return"plain"},get onclick(){return e.showSuggester},children:(h,b)=>{Or(h,{get mb(){return e.mb},iconName:"list"})},$$slots:{default:!0}});var p=ue(m,2);{var d=h=>{yt(h,{get variant(){return"plain"},get onclick(){return e.showTextPrompt},children:(b,y)=>{Or(b,{get mb(){return e.mb},iconName:"pencil"})},$$slots:{default:!0}})};et(p,h=>{e.allowOther&&h(d)})}return le(s),K(t,s),Ee({setValue:i})}var fd=class extends nr{filterValue(e){return Rs(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Jb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:"Meta Bind Suggester",subTitle:"Set the suggester value.",value:"",multiline:!1,onSubmit:e=>{this.setInternalValue(e)},onCancel:()=>{}})}};var dq=(t,e,r,n)=>r.onValueChange(ft(q(n))),hq=se("<span> </span>"),gq=se('<input type="text" tabindex="0"> <!>',1);function Xb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(c){ke(n,c,!0)}function a(c,f){let m=f.toString();return`${c.toString().padStart(m.length,"0")}/${m}`}var o=gq(),s=We(o);At(s),s.__input=[dq,r,e,n];var l=ue(s,2);{var u=c=>{var f=hq(),m=ve(f,!0);le(f),Le(p=>{Vr(f,1,`mb-content-limit-indicator ${q(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`),vt(m,p)},[()=>a(q(n).length,e.limit)]),K(c,f)};et(l,c=>{e.limit!==void 0&&c(u)})}return Le(()=>{rt(s,"placeholder",e.placeholder),rt(s,"maxlength",e.limit)}),xt(s,()=>q(n),c=>ke(n,c)),K(t,o),Ee({setValue:i})}Mt(["input"]);var pd=class extends nr{filterValue(e){return Do(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return Xb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var vq=(t,e,r,n)=>r.onValueChange(ft(q(n))),yq=se('<textarea class="mb-input-textarea" tabindex="0"></textarea>');function Qb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(o){ke(n,o,!0)}var a=yq();return Dn(a),a.__input=[vq,r,e,n],Le(()=>{rt(a,"placeholder",e.placeholder),rt(a,"maxlength",e.limit)}),xt(a,()=>q(n),o=>ke(n,o)),K(t,a),Ee({setValue:i})}Mt(["input"]);var md=class extends nr{filterValue(e){return Do(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return Qb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var bq=(t,e,r,n)=>r.onValueChange(ft(q(n))),xq=se('<input type="time">');function Kb(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(o){ke(n,o,!0)}var a=xq();return At(a),a.__input=[bq,r,e,n],xt(a,()=>q(n),o=>ke(n,o)),K(t,a),Ee({setValue:i})}Mt(["input"]);var dd=class extends nr{filterValue(e){return Do(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return Kb}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var wq=(t,e)=>e(),_q=(t,e)=>e(t),Aq=se('<div role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function ex(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]),n=it(dt(e.value));function i(c){ke(n,c,!0)}function a(){ke(n,!q(n)),e.onValueChange(ft(q(n)))}function o(c){c.key===" "&&a()}var s=Aq();let l;s.__click=[wq,a],s.__keydown=[_q,o];var u=ve(s);return At(u),le(s),Le(c=>{l=Vr(s,1,"checkbox-container",null,l,c),rt(s,"aria-checked",q(n)),cs(u,q(n))},[()=>({"is-enabled":q(n)})]),K(t,s),Ee({setValue:i})}Mt(["click","keydown"]);var hd=class extends nr{constructor(e){super(e),this.onValue=this.mountable.getArgument("onValue")?.value??!0,this.offValue=this.mountable.getArgument("offValue")?.value??!1}filterValue(e){return e===this.onValue||e===this.offValue?Rs(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return ex}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};var qt=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){Xp(e)}};var gd=class{constructor(e){this.mb=e}createInputField(e){let r=e.declaration.inputFieldType,n=e.renderChildType;if(r!=="invalid"&&this.checkRenderChildTypeAllowed(r,n),r==="toggle")return new hd(e);if(r==="slider")return new cd(e);if(r==="text")return new pd(e);if(r==="textArea")return new md(e);if(r==="select")return new ld(e);if(r==="multiSelect")return new od(e);if(r==="datePicker")return new Jm(e);if(r==="number")return new sd(e);if(r==="suggester")return new fd(e);if(r==="editor")return new Qm(e);if(r==="progressBar")return new ud(e);if(r==="inlineSelect")return new nd(e);if(r==="imageSuggester")return new ed(e);if(r==="list")return new id(e);if(r==="listSuggester")return new ad(e);if(r==="date")return new Zm(e);if(r==="time")return new dd(e);if(r==="inlineListSuggester")return new rd(e);if(r==="inlineList")return new td(e);if(r==="imageListSuggester")return new Km(e);if(r==="dateTime")return new Xm(e);}checkRenderChildTypeAllowed(e,r){if(this.mb.getSettings().ignoreCodeBlockRestrictions)return;let n=wm[e];if(r==="block"&&!n.allowInBlock)throw new to({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[qt.linkToInputField(e)]});if(r==="inline"&&!n.allowInline)throw new to({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[qt.linkToInputField(e)]})}};var Mo=class extends vi{constructor(e){super(),this.mountable=e,this.mb=e.mb,this.variables=[],this.hidden=!1}async initialRender(e){lt.addClass(e,"mb-view-text"),this.hidden=this.mountable.getArgument("hidden")?.value??!1,this.hidden&&lt.addClass(e,"mb-view-hidden"),await this.onInitialRender(e)}async rerender(e,r){this.hidden||await this.onRerender(e,r)}onMount(e){this.buildVariables(),this.initialRender(e),this.metadataSubscription=this.mountable.mb.metadataManager.subscribeDerived(this.mountable.getUuid(),this.mountable.getDeclaration().writeToBindTarget,this.variables.map(r=>r.bindTargetDeclaration),this.variables.map(r=>r.metadataSignal),async()=>{let r=await this.computeValue();return this.rerender(e,r),this.mapValue(r)},()=>this.mountable.unmount())}onUnmount(){this.metadataSubscription?.unsubscribe()}};var Dq=se('<div class="mb-image-card"><img class="mb-image-card-image"></div>');function tx(t,e){Se(e,!0);let r=at(e,"internal",3,!0),n=cr(()=>r()?e.mb.internal.imagePathToUri(e.image):e.image);var i=Dq(),a=ve(i);le(i),Le(()=>{rt(a,"src",q(n)),rt(a,"alt",e.image)}),K(t,i),Ee()}var Sq=se("<span>No images</span>"),Eq=se('<div class="mb-image-card-grid"></div>');function rx(t,e){Se(e,!0);let r=at(e,"images",23,()=>[]);function n(a){r(a)}var i=Eq();return Ut(i,21,r,Zt,(a,o)=>{tx(a,{get mb(){return e.mb},get image(){return q(o).link},get internal(){return q(o).internal}})},a=>{var o=Sq();K(a,o)}),le(i),K(t,i),Ee({updateImages:n})}var vd=class extends Mo{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new Ko({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});let r=e[0];if(typeof r=="string")throw new Ko({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new hn(void 0),uuid:_r(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable)}computeValue(){let e=this.linkVariable.metadataSignal.get();if(typeof e=="string"){let r=vn.interpretAsLink(e);return r===void 0?void 0:[r]}else return Array.isArray(e)?e.filter(r=>typeof r=="string").map(r=>vn.interpretAsLink(r)).filter(r=>r!==void 0):void 0}mapValue(e){return e===void 0?"":Array.isArray(e)?e.map(r=>r.toString()):e.toString()}onInitialRender(e){this.component=Br(rx,{target:e,props:{images:[],mb:this.mountable.mb}})}async onRerender(e,r){this.component?.updateImages(em(r).map(n=>({link:n.target,internal:n.internal})))}onUnmount(){super.onUnmount(),this.component&&Dr(this.component)}};var Tq=se("<span></span>");function nx(t,e){Se(e,!0);let r=at(e,"mdLinkList",7);function n(l){r(l)}var i=Gr(),a=We(i);{var o=l=>{var u=Tq();K(l,u)},s=(l,u)=>{{var c=m=>{fs(m,{get mdLink(){return r()[0]}})},f=m=>{kf(m,{get elements(){return r()},children:(d,h=ca)=>{fs(d,{get mdLink(){return h()}})},$$slots:{default:!0}})};et(l,m=>{r().length===1?m(c):m(f,!1)},u)}};et(a,l=>{r().length===0?l(o):l(s,!1)})}return K(t,i),Ee({updateList:n})}var yd=class extends Mo{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(a=>typeof a=="string"?a:!0);if(e.length!==1&&e.length!==2&&e.length!==3)throw new Ko({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"'});let r=e[0],n=e[1],i=e[2];if(this.variables=[],e.length===1){if(typeof r=="string")throw new Ko({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"'});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new hn(void 0),uuid:_r(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable)}else if(e.length===2||e.length===3){if(typeof r=="string"||typeof n!="string")throw new Ko({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}", "{bindTarget}|alias", or "{bindTarget}|{bindTarget}"'});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new hn(void 0),uuid:_r(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable),e.length===2?this.aliasVariable=n.slice(1):typeof i=="string"?this.aliasVariable=i:(i.listenToChildren=!0,this.aliasVariable={bindTargetDeclaration:i,metadataSignal:new hn(void 0),uuid:_r(),contextName:"MB_VAR_1"},this.variables.push(this.aliasVariable))}else throw new Error("unreachable")}getAlias(){if(this.aliasVariable)return typeof this.aliasVariable=="string"?this.aliasVariable:wu(this.aliasVariable.metadataSignal.get(),this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)}computeValue(){let e=this.linkVariable.metadataSignal.get(),r=this.getAlias();if(typeof e=="string"){let n=vn.interpretAsLink(e);return n===void 0?void 0:(r&&(n.alias=r),[n])}else return Array.isArray(e)?e.filter(n=>typeof n=="string").map(n=>vn.interpretAsLink(n)).filter(n=>n!==void 0):void 0}mapValue(e){return e===void 0?"":Array.isArray(e)?e.map(r=>r.toString()):e.toString()}onInitialRender(e){this.component=Br(nx,{target:e,props:{mdLinkList:[]}})}async onRerender(e,r){this.component?.updateList(em(r))}onUnmount(){super.onUnmount(),this.component&&Dr(this.component)}};var bd=class extends Mo{constructor(e){super(e),this.hidden=!1}buildVariables(){let e=0;this.expressionStr="",this.variables=[];for(let r of this.mountable.getDeclaration().templateDeclaration??[])if(typeof r!="string"){let n={bindTargetDeclaration:r,metadataSignal:new hn(void 0),uuid:_r(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.expressionStr+=n.contextName,e+=1}else this.expressionStr+=r;this.expression=this.mb.math.compile(this.expressionStr)}buildMathJSContext(){let e={};for(let r of this.variables??[])!r.contextName||!r.metadataSignal||(e[r.contextName]=r.metadataSignal.get()??"");return e}computeValue(){if(!this.expression)return this.handleComputeError(new vu({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{let r=`${this.expression.evaluate(e)}`;return{value:la(r),error:!1}}catch(r){return r instanceof Error?this.handleComputeError(new vu({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:r,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of unexpected thrown value"))}}mapValue(e){return e.value}onInitialRender(e){}onRerender(e,r){let n=wu(r?.value,this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)??"";r?.error?lt.addClass(e,"mb-error"):lt.removeClass(e,"mb-error"),e.innerText=n}handleComputeError(e){return console.warn(e),{error:!0,value:e.message}}};var xd=class extends Mo{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let r of this.mountable.getDeclaration().templateDeclaration??[])if(typeof r!="string"){let n={bindTargetDeclaration:r,metadataSignal:new hn(void 0),uuid:_r(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.textParts.push(n),e+=1}else this.textParts.push(r)}computeValue(){if(!this.textParts)throw new vu({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="string"?e:wu(e.metadataSignal.get(),this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)).join("")}mapValue(e){return e}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&lt.addClass(e,"mb-view-markdown")}async onRerender(e,r){let n=wu(r,this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)??"";this.renderMarkdown?(this.markdownUnloadCallback?.(),lt.empty(e),this.markdownUnloadCallback=await this.mountable.mb.internal.renderMarkdown(n,e,this.mountable.getFilePath())):e.innerText=n}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};var wd=class{constructor(e){this.mb=e}createViewField(e){let r=e.declaration.viewFieldType;if(r==="math")return new bd(e);if(r==="text")return new xd(e);if(r==="link")return new yd(e);if(r==="image")return new vd(e);}};var ln=class extends Error{},Pf=class extends Error{};var vA=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},Mq=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function Cq(t,e,r){let n=r;for(let i of kr(t))n=e(n,i);return n}function Nq(t,e,r){return vA(this,void 0,void 0,function*(){var n,i,a,o;let s=r;try{for(var l=!0,u=Mq(Pr(t)),c;c=yield u.next(),n=c.done,!n;l=!0)o=c.value,l=!1,s=yield e(s,o)}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield a.call(u))}finally{if(i)throw i.error}}return s})}function ix(t){switch(!0){case t instanceof Array:return t.length;case Co(t):return t.length;case t instanceof Set:return t.size;case t instanceof Map:return t.size}return Cq(t,e=>e+1,0)}function yA(t){return vA(this,void 0,void 0,function*(){switch(!0){case t instanceof Array:case Co(t):case t instanceof Set:case t instanceof Map:return ix(t)}return yield Nq(t,e=>e+1,0)})}var bA={chunkwise:kA,chunkwiseOverlap:Ad,compress:_A,dropWhile:DA,enumerate:RA,filter:IA,flatMap:NA,flatten:ax,groupBy:jA,keys:qA,limit:$A,map:wA,pairwise:Nu,repeat:MA,skip:HA,slice:VA,sort:JA,takeWhile:EA,values:WA,chunkwiseAsync:PA,chunkwiseOverlapAsync:Dd,compressAsync:AA,dropWhileAsync:SA,enumerateAsync:LA,filterAsync:BA,flatMapAsync:FA,flattenAsync:ox,groupByAsync:ZA,keysAsync:zA,limitAsync:OA,mapAsync:_d,pairwiseAsync:$f,repeatAsync:CA,skipAsync:GA,sliceAsync:UA,sortAsync:XA,takeWhileAsync:TA,valuesAsync:YA};var xA={allMatch:QA,allUnique:eD,anyMatch:rD,exactlyN:iD,isEmpty:oD,isAsyncIterable:ps,isIterable:Zi,isIterator:Va,isReversed:uD,isSorted:cD,isString:Co,noneMatch:pD,same:dD,sameCount:gD,allMatchAsync:KA,allUniqueAsync:tD,anyMatchAsync:nD,exactlyNAsync:aD,isEmptyAsync:sD,isReversedAsync:lD,isSortedAsync:fD,noneMatchAsync:mD,sameAsync:hD,sameCountAsync:vD};var Ql=function(t){return this instanceof Ql?(this.v=t,this):new Ql(t)},Fq=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(b,y){a.push([p,h,b,y])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof Ql?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}},fo;(function(t){t[t.SHORTEST=0]="SHORTEST",t[t.LONGEST=1]="LONGEST",t[t.STRICT_EQUAL=2]="STRICT_EQUAL"})(fo||(fo={}));function*sx(t,e,...r){if(r.length===0)return;let n=[];for(let i of r)n.push(yD(i));e:for(;;){let i=bA.map(n,l=>l.next()),a=[],o=!0,s=!1;for(let l of i){let u;l.done?(o=!1,u=e):(s=!0,u=l.value),a.push(u)}if(!o&&s)switch(t){case fo.SHORTEST:break e;case fo.STRICT_EQUAL:throw new Pf("Iterators must have equal lengths")}if(!s)break;yield a}}function ux(t,e,...r){return Fq(this,arguments,function*(){if(r.length===0)return yield Ql(void 0);let i=[];for(let a of r)i.push(bD(a));e:for(;;){let a=[];for(let u of i){let c=yield Ql(u.next());a.push(c)}let o=[],s=!0,l=!1;for(let u of a){let c;u.done?(s=!1,c=e):(l=!0,c=u.value),o.push(c)}if(!s&&l)switch(t){case fo.SHORTEST:break e;case fo.STRICT_EQUAL:throw new Pf("Iterators must have equal lengths")}if(!l)break;yield yield Ql(o)}})}var Ys=function(t){return this instanceof Ys?(this.v=t,this):new Ys(t)},Iq=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},Bq=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(b,y){a.push([p,h,b,y])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof Ys?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*lx(t,e){let r=new Set;if(t instanceof Map){e===void 0&&(e=n=>n[1]);for(let n of t){let i=e(n);r.has(i)||(yield n,r.add(i))}}else{e===void 0&&(e=n=>n);for(let n of kr(t)){let i=e(n);r.has(i)||(yield n,r.add(i))}}}function xD(t,e){return Bq(this,arguments,function*(){var n,i,a,o;let s=new Set;if(t instanceof Map)for(let f of lx(t,e))yield yield Ys(yield Ys(f));else{e===void 0&&(e=f=>f);try{for(var l=!0,u=Iq(Pr(t)),c;c=yield Ys(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o,m=e(f);s.has(m)||(yield yield Ys(f),s.add(m))}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield Ys(a.call(u)))}finally{if(i)throw i.error}}}})}var Sn=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},tt=function(t){return this instanceof tt?(this.v=t,this):new tt(t)},zn=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(b,y){a.push([p,h,b,y])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof tt?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*wA(t,e){for(let r of kr(t))yield e(r)}function _d(t,e){return zn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=Sn(Pr(t)),u;u=yield tt(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield tt(yield tt(e(o)))}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield tt(a.call(l)))}finally{if(i)throw i.error}}})}function*_A(t,e){for(let[r,n]of Kl(t,e))n&&(yield r)}function AA(t,e){return zn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=Sn(_D(t,e)),u;u=yield tt(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let[c,f]=o;f&&(yield yield tt(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield tt(a.call(l)))}finally{if(i)throw i.error}}})}function*DA(t,e){let r=!0;for(let n of kr(t)){if(r){if(!e(n)){r=!1,yield n;continue}continue}yield n}}function SA(t,e){return zn(this,arguments,function*(){var n,i,a,o;let s=!0;try{for(var l=!0,u=Sn(Pr(t)),c;c=yield tt(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s){if(!(yield tt(e(f)))){s=!1,yield yield tt(f);continue}continue}yield yield tt(f)}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield tt(a.call(u)))}finally{if(i)throw i.error}}})}function*EA(t,e){for(let r of kr(t))if(e(r))yield r;else break}function TA(t,e){return zn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=Sn(Pr(t)),u;u=yield tt(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;if(yield tt(e(c)))yield yield tt(c);else break}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield tt(a.call(l)))}finally{if(i)throw i.error}}})}function*MA(t,e){if(e<0)throw new ln(`Number of repetitions cannot be negative: ${e}`);for(let r=e;r>0;--r)yield t}function CA(t,e){return zn(this,arguments,function*(){if(e<0)throw new ln(`Number of repetitions cannot be negative: ${e}`);let n=yield tt(t);for(let i=e;i>0;--i)yield yield tt(n)})}function*NA(t,e){for(let r of kr(t)){let n=e(r,e);if(Zi(n))for(let i of kr(n))yield i;else yield n}}function FA(t,e){return zn(this,arguments,function*(){var n,i,a,o,s,l,u,c;try{for(var f=!0,m=Sn(Pr(t)),p;p=yield tt(m.next()),n=p.done,!n;f=!0){o=p.value,f=!1;let D=yield tt(e(o,e));if(Zi(D)||ps(D))try{for(var d=!0,h=(l=void 0,Sn(Pr(D))),b;b=yield tt(h.next()),s=b.done,!s;d=!0)c=b.value,d=!1,yield yield tt(c)}catch(v){l={error:v}}finally{try{!d&&!s&&(u=h.return)&&(yield tt(u.call(h)))}finally{if(l)throw l.error}}else yield yield tt(D)}}catch(y){i={error:y}}finally{try{!f&&!n&&(a=m.return)&&(yield tt(a.call(m)))}finally{if(i)throw i.error}}})}function*ax(t,e=1/0){if(e<1){for(let r of kr(t))t instanceof Map&&(r=r[1]),yield r;return}for(let r of kr(t))if(t instanceof Map&&(r=r[1]),(Zi(r)||Va(r))&&!Co(r))for(let n of ax(r,e-1))yield n;else yield r}function ox(t){return zn(this,arguments,function*(r,n=1/0){var i,a,o,s,l,u,c,f,m,p,d,h;if(n<1){try{for(var b=!0,y=Sn(Pr(r)),D;D=yield tt(y.next()),i=D.done,!i;b=!0){s=D.value,b=!1;let _=s;r instanceof Map&&(_=_[1]),yield yield tt(_)}}catch(_){a={error:_}}finally{try{!b&&!i&&(o=y.return)&&(yield tt(o.call(y)))}finally{if(a)throw a.error}}return yield tt(void 0)}try{for(var v=!0,A=Sn(Pr(r)),w;w=yield tt(A.next()),l=w.done,!l;v=!0){f=w.value,v=!1;let _=f;if(r instanceof Map&&(_=_[1]),(ps(_)||Zi(_)||Va(_))&&!Co(_))try{for(var x=!0,E=(p=void 0,Sn(ox(_,n-1))),T;T=yield tt(E.next()),m=T.done,!m;x=!0)h=T.value,x=!1,yield yield tt(h)}catch(C){p={error:C}}finally{try{!x&&!m&&(d=E.return)&&(yield tt(d.call(E)))}finally{if(p)throw p.error}}else yield yield tt(_)}}catch(_){u={error:_}}finally{try{!v&&!l&&(c=A.return)&&(yield tt(c.call(A)))}finally{if(u)throw u.error}}})}function*IA(t,e){for(let r of kr(t))e(r)&&(yield r)}function BA(t,e){return zn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=Sn(Pr(t)),u;u=yield tt(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;(yield tt(e(c)))&&(yield yield tt(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield tt(a.call(l)))}finally{if(i)throw i.error}}})}function*Ad(t,e,r,n=!0){if(e<1)throw new ln(`Chunk size must be \u2265 1. Got ${e}`);if(r>=e)throw new ln("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of kr(t))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-r),a=!0);!a&&i.length>0&&n&&(yield i)}function Dd(t,e,r){return zn(this,arguments,function*(i,a,o,s=!0){var l,u,c,f;if(a<1)throw new ln(`Chunk size must be \u2265 1. Got ${a}`);if(o>=a)throw new ln("Overlap size must be less than chunk size");let m=[],p=!1;try{for(var d=!0,h=Sn(Pr(i)),b;b=yield tt(h.next()),l=b.done,!l;d=!0){f=b.value,d=!1;let y=f;p=!1,m.push(y),m.length===a&&(yield yield tt(m),m=m.slice(a-o),p=!0)}}catch(y){u={error:y}}finally{try{!d&&!l&&(c=h.return)&&(yield tt(c.call(h)))}finally{if(u)throw u.error}}!p&&m.length>0&&s&&(yield yield tt(m))})}function*kA(t,e){for(let r of Ad(t,e,0))yield r}function PA(t,e){return zn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=Sn(Dd(t,e,0)),u;u=yield tt(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield tt(o)}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield tt(a.call(l)))}finally{if(i)throw i.error}}})}function*Nu(t){let e=Ad(t,2,1,!1);for(let r of e)yield r}function $f(t){return zn(this,arguments,function*(){var r,n,i,a;let o=Dd(t,2,1,!1);try{for(var s=!0,l=Sn(o),u;u=yield tt(l.next()),r=u.done,!r;s=!0)a=u.value,s=!1,yield yield tt(a)}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield tt(i.call(l)))}finally{if(n)throw n.error}}})}function*$A(t,e){if(e<0)throw new ln(`Limit must be \u2265 0. Got ${e}`);let r=0;for(let n of kr(t)){if(r>=e)return;yield n,++r}}function OA(t,e){return zn(this,arguments,function*(){var n,i,a,o;if(e<0)throw new ln(`Limit must be \u2265 0. Got ${e}`);let s=0;try{for(var l=!0,u=Sn(Pr(t)),c;c=yield tt(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s>=e)return yield tt(void 0);yield yield tt(f),++s}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield tt(a.call(u)))}finally{if(i)throw i.error}}})}function*RA(t){let e=0;for(let r of kr(t))yield[e++,r]}function LA(t){return zn(this,arguments,function*(){var r,n,i,a;let o=0;try{for(var s=!0,l=Sn(Pr(t)),u;u=yield tt(l.next()),r=u.done,!r;s=!0){a=u.value,s=!1;let c=a;yield yield tt([o++,c])}}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield tt(i.call(l)))}finally{if(n)throw n.error}}})}function*VA(t,e=0,r,n=1){if(e<0)throw new ln("Parameter 'start' cannot be negative");if(r!==void 0&&r<0)throw new ln("Parameter 'count' cannot be negative");if(n<=0)throw new ln("Parameter 'step' must be positive");let i=0,a=0;for(let o of kr(t))if(!(i++<e||(i-e-1)%n!==0)){if(a++===r&&r!==void 0)break;yield o}}function UA(t){return zn(this,arguments,function*(r,n=0,i,a=1){var o,s,l,u;if(n<0)throw new ln("Parameter 'start' cannot be negative");if(i!==void 0&&i<0)throw new ln("Parameter 'count' cannot be negative");if(a<=0)throw new ln("Parameter 'step' must be positive");let c=0,f=0;try{for(var m=!0,p=Sn(Pr(r)),d;d=yield tt(p.next()),o=d.done,!o;m=!0){u=d.value,m=!1;let h=u;if(!(c++<n||(c-n-1)%a!==0)){if(f++===i&&i!==void 0)break;yield yield tt(h)}}}catch(h){s={error:h}}finally{try{!m&&!o&&(l=p.return)&&(yield tt(l.call(p)))}finally{if(s)throw s.error}}})}function*qA(t){for(let[e]of kr(t))yield e}function zA(t){return zn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=Sn(Pr(t)),l;l=yield tt(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[u]=a;yield yield tt(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield tt(i.call(s)))}finally{if(n)throw n.error}}})}function*HA(t,e,r=0){if(e<0||r<0)throw new ln;let n=-r;for(let i of kr(t))(n<0||n>=e)&&(yield i),++n}function GA(t,e){return zn(this,arguments,function*(n,i,a=0){var o,s,l,u;if(i<0||a<0)throw new ln;let c=-a;try{for(var f=!0,m=Sn(Pr(n)),p;p=yield tt(m.next()),o=p.done,!o;f=!0){u=p.value,f=!1;let d=u;(c<0||c>=i)&&(yield yield tt(d)),++c}}catch(d){s={error:d}}finally{try{!f&&!o&&(l=m.return)&&(yield tt(l.call(m)))}finally{if(s)throw s.error}}})}function*WA(t){for(let[,e]of kr(t))yield e}function YA(t){return zn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=Sn(Pr(t)),l;l=yield tt(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[,u]=a;yield yield tt(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield tt(i.call(s)))}finally{if(n)throw n.error}}})}function*jA(t,e,r){let n=new Map,i=a=>{n.has(a)||(r!==void 0?n.set(a,{}):n.set(a,[]))};for(let a of kr(t)){let o=e(a),s=r!==void 0?r(a):void 0,l=(Zi(o)||Va(o))&&!Co(o)?o:[o];for(let u of lx(l))i(u),s===void 0?n.get(u).push(a):n.get(u)[s]=a}for(let a of n)yield a}function ZA(t,e,r){return zn(this,arguments,function*(){var i,a,o,s,l,u,c,f;let m=new Map,p=A=>{m.has(A)||(r!==void 0?m.set(A,{}):m.set(A,[]))};try{for(var d=!0,h=Sn(Pr(t)),b;b=yield tt(h.next()),i=b.done,!i;d=!0){s=b.value,d=!1;let A=s,w=yield tt(e(A)),x=r!==void 0?yield tt(r(A)):void 0,E=(ps(w)||Zi(w)||Va(w))&&!Co(w)?w:[w];try{for(var y=!0,D=(u=void 0,Sn(xD(E))),v;v=yield tt(D.next()),l=v.done,!l;y=!0){f=v.value,y=!1;let T=f;p(T),x===void 0?m.get(T).push(A):m.get(T)[x]=A}}catch(T){u={error:T}}finally{try{!y&&!l&&(c=D.return)&&(yield tt(c.call(D)))}finally{if(u)throw u.error}}}}catch(A){a={error:A}}finally{try{!d&&!i&&(o=h.return)&&(yield tt(o.call(h)))}finally{if(a)throw a.error}}for(let A of m)yield yield tt(A)})}function*JA(t,e){let r=wD(t);e!==void 0?r.sort(e):r.sort();for(let n of r)yield n}function XA(t,e){return zn(this,arguments,function*(){let n=yield tt(Sd(t));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield tt(i)})}var po=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},ms=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function QA(t,e){for(let r of kr(t))if(!e(r))return!1;return!0}function KA(t,e){return po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=ms(Pr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,!(yield e(a)))return!1}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!0})}function eD(t){let e=new Set;for(let r of kr(t)){if(e.has(r))return!1;e.add(r)}return!0}function tD(t){return po(this,void 0,void 0,function*(){var e,r,n,i;let a=new Set;try{for(var o=!0,s=ms(Pr(t)),l;l=yield s.next(),e=l.done,!e;o=!0){i=l.value,o=!1;let u=i;if(a.has(u))return!1;a.add(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return!0})}function rD(t,e){for(let r of kr(t))if(e(r))return!0;return!1}function nD(t,e){return po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=ms(Pr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,yield e(a))return!0}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!1})}function iD(t,e,r){if(e<0)return!1;r===void 0&&(r=i=>!!i);let n=0;for(let i of kr(t))if(r(i)&&(n++,n>e))return!1;return n===e}function aD(t,e,r){return po(this,void 0,void 0,function*(){var n,i,a,o;if(e<0)return!1;r===void 0&&(r=f=>!!f);let s=0;try{for(var l=!0,u=ms(Pr(t)),c;c=yield u.next(),n=c.done,!n;l=!0)if(o=c.value,l=!1,(yield r(o))&&(s++,s>e))return!1}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield a.call(u))}finally{if(i)throw i.error}}return s===e})}function oD(t){for(let e of kr(t))return!1;return!0}function sD(t){return po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=ms(Pr(t)),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let l=i;return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function Zi(t){return t==null?!1:typeof t[Symbol.iterator]=="function"}function ps(t){return t==null?!1:typeof t[Symbol.asyncIterator]=="function"}function Va(t){return t==null?!1:t.next!==void 0&&typeof t.next=="function"}function uD(t){for(let[e,r]of Nu(kr(t)))if(e<r)return!1;return!0}function lD(t){return po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=ms($f(Pr(t))),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let[l,u]=i;if(l<u)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function cD(t){for(let[e,r]of Nu(kr(t)))if(e>r)return!1;return!0}function fD(t){return po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=ms($f(Pr(t))),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let[l,u]=i;if(l>u)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function Co(t){return typeof t=="string"||t instanceof String}function pD(t,e){for(let r of kr(t))if(e(r))return!1;return!0}function mD(t,e){return po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=ms(Pr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,yield e(a))return!1}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!0})}function dD(...t){try{for(let e of AD(...t))for(let[r,n]of Nu(e))if(r!==n)return!1}catch{return!1}return!0}function hD(...t){return po(this,void 0,void 0,function*(){var e,r,n,i;try{try{for(var a=!0,o=ms(DD(...t)),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let l=i;for(let[u,c]of Nu(l))if(u!==c)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}}catch{return!1}return!0})}function gD(...t){if(t.length<=1)return!0;let e=t.map(r=>ix(r));return new Set(e).size===1}function vD(...t){return po(this,void 0,void 0,function*(){if(t.length<=1)return!0;let e=yield _d(t,r=>po(this,void 0,void 0,function*(){return yield yA(r)}));return new Set(yield Sd(e)).size===1})}var kq=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},No=function(t){return this instanceof No?(this.v=t,this):new No(t)},cx=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(b,y){a.push([p,h,b,y])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof No?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}},SD=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function kr(t){if(Zi(t))return t;if(Va(t))return{[Symbol.iterator](){return t}};if(typeof t=="object"&&t!==null)return function*(){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(yield[e,t[e]])}();throw new ln("Given collection is not iterable or iterator.")}function Pr(t){if(ps(t))return t;if(Va(t))return{[Symbol.asyncIterator](){return cx(this,arguments,function*(){for(;;){let r=yield No(t.next());if(r.done)return yield No(void 0);yield yield No(r.value)}})}};if(typeof t=="object"&&t!==null&&(t=kr(t)),Zi(t))return{[Symbol.asyncIterator](){return cx(this,arguments,function*(){for(let r of t)yield yield No(r)})}};throw new ln("Given collection is not async iterable or iterator.")}function yD(t){if(Va(t))return t;if(Zi(t))return function*(){for(let e of t)yield e}();throw new ln("Given collection is not iterable or iterator.")}function bD(t){if((Va(t)||Zi(t))&&(t=Pr(t)),ps(t))return function(){return cx(this,arguments,function*(){var e,r,n,i;try{for(var a=!0,o=SD(t),s;s=yield No(o.next()),e=s.done,!e;a=!0)i=s.value,a=!1,yield yield No(i)}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield No(n.call(o)))}finally{if(r)throw r.error}}})}();throw new ln("Given collection is not iterable or iterator.")}function wD(t){if(Array.isArray(t))return t;let e=[];for(let r of kr(t))e.push(r);return e}function Sd(t){return kq(this,void 0,void 0,function*(){var e,r,n,i;if(Array.isArray(t))return t;let a=[];try{for(var o=!0,s=SD(Pr(t)),l;l=yield s.next(),e=l.done,!e;o=!0){i=l.value,o=!1;let u=i;a.push(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return a})}var ED=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},ds=function(t){return this instanceof ds?(this.v=t,this):new ds(t)},TD=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(b,y){a.push([p,h,b,y])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof ds?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*Kl(...t){for(let e of sx(fo.SHORTEST,void 0,...t))yield e}function _D(...t){return TD(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=ED(ux(fo.SHORTEST,void 0,...t)),l;l=yield ds(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield ds(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield ds(i.call(s)))}finally{if(n)throw n.error}}})}function*AD(...t){for(let e of sx(fo.STRICT_EQUAL,void 0,...t))yield e}function DD(...t){return TD(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=ED(ux(fo.STRICT_EQUAL,void 0,...t)),l;l=yield ds(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield ds(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield ds(i.call(s)))}finally{if(n)throw n.error}}})}var Ed=class{constructor(e,r,n,i,a,o,s){this.uuid=e,this.metadataManager=r,this.bindTarget=n,this.dependencies=i,this.dependencySignals=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=s,this.deleted=!1}init(){for(let[e,r]of Kl(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+_r();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,r,e,()=>this.delete())),r.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){try{let e=await this.computeFunction();if(this.bindTarget){let r=this.metadataManager.readShortLived(this.bindTarget);rs(r,e)||this.metadataManager.write(e,this.bindTarget,this.uuid)}}catch(e){let r=e instanceof Error?e:String(e);console.warn(new Lt({errorLevel:"ERROR",effect:"Failed to run derived metadata computation",cause:r}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){return!1}updatable(){return!1}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Td=class{constructor(e,r,n,i,a,o){this.uuid=e,this.metadataManager=r,this.bindTarget=void 0,this.dependencies=n,this.dependencySignals=i,this.dependencySubscriptions=[],this.effectFunction=a,this.deleted=!1,this.onDelete=o}init(){for(let[e,r]of Kl(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+_r();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,r,e,()=>this.delete())),r.registerListener({callback:()=>void this.runEffect()})}this.runEffect()}async runEffect(){try{await this.effectFunction()}catch(e){let r=e instanceof Error?e:String(e);console.warn(new Lt({errorLevel:"ERROR",effect:"Failed to run metadata effect",cause:r}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){return!1}updatable(){return!1}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Md=class{constructor(e,r,n,i,a){this.uuid=e,this.callbackSignal=r,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1,this.value=void 0}unsubscribe(){this.metadataManager.unsubscribe(this)}write(e){let r=this.metadataManager.readShortLived(this.bindTarget);rs(r,e)||(this.value=e,this.metadataManager.write(e,this.bindTarget,this.uuid))}read(){return this.metadataManager.read(this.bindTarget)}onUpdate(e){try{if(!rs(this.value,e)){let r=structuredClone(e);return this.value=r,this.callbackSignal.set(r),!0}}catch(r){let n=r instanceof Error?r:String(r);console.warn(new Lt({errorLevel:"ERROR",effect:"Failed to notify subscription of updated value in the cache",cause:n}))}return!1}updatable(){return!0}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var mo=class{static get(e,r){return r.get(e).child}static tryGet(e,r){return r.tryGet(e)?.child}static fullGet(e,r){return r.get(e)}static set(e,r,n){r.set(e,n)}static setAndCreate(e,r,n){r.setAndCreate(e,n)}};var Pq=5,$q=5*60;function fx(t,e){return t===void 0||e===void 0||t.storageType!==e.storageType||t.storagePath!==e.storagePath?!1:MD(t.storageProp,e.storageProp,e.listenToChildren)}function MD(t,e,r){let n=t.path,i=e.path;for(let a=0;a<Math.min(n.length,i.length);a++)if(n[a].type!==i[a].type||n[a].prop!==i[a].prop)return!1;return n.length>i.length?r:!0}function Oq(t){return t===void 0?"undefined":`${t.storagePath}#${t.storageProp.toString()}`}var ec=class{constructor(){this.sources=new Map,this.defaultSource="CHANGE_THE_DEFAULT_SOURCE"}registerSource(e){this.sources.set(e.id,e)}setDefaultSource(e){if(this.sources.has(e))this.defaultSource=e;else throw new Lt({errorLevel:"CRITICAL",effect:"can not set default source",cause:`Source "${e}" does not exist`})}unregisterSource(e){this.sources.delete(e.id)}getSource(e){return this.sources.get(e)}iterateSources(){return this.sources.keys()}subscribe(e,r,n,i){let a=new Md(e,r,this,n,i);return this.subscribeSubscription(a),a}subscribeDerived(e,r,n,i,a,o){let s=new Ed(e,this,r,n,i,a,o);return this.checkForLoops(s),s.init(),this.subscribeSubscription(s),s}subscribeEffect(e,r,n,i,a){let o=new Td(e,this,r,n,i,a);return o.init(),this.subscribeSubscription(o),o}unsubscribe(e){if(e.bindTarget===void 0)return;let r=this.getSource(e.bindTarget.storageType);if(r===void 0)throw new Lt({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=r.unsubscribe(e);n.subscriptions.length===0&&(n.cyclesWithoutListeners=0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let r=this.getSource(e.bindTarget.storageType);if(r===void 0)throw new Lt({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=r.subscribe(e);n.cyclesWithoutListeners=0;let i=r.readCacheItem(n,e.bindTarget.storageProp);e.onUpdate(i)}checkForLoops(e){for(let r of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,r])}recCheckForLoops(e){let r=e.at(0),n=e.at(-1);if(!(n===void 0||r===void 0)){if(fx(r.bindTarget,n.bindTarget))throw new qp({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${Oq(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(r=>this.getAllSubscriptionsToBindTarget(r)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let r=this.getCacheItemForBindTarget(e);if(!r)return[];let n=[];for(let i of r.subscriptions)fx(i.bindTarget,e)&&n.push(i);return r.subscriptions.filter(i=>fx(i.bindTarget,e))}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let r=[];for(let n of e.iterateCacheItems()){if(e.onCycle(n),n.dirty){try{e.syncExternal(n)}catch(i){console.warn(`failed to sync changes to external source for ${e.id}`,i)}n.dirty=!1}n.externalWriteLock>0&&(n.externalWriteLock-=1),n.subscriptions.length===0&&(n.cyclesWithoutListeners+=1),n.cyclesWithoutListeners>$q&&e.shouldDelete(n)&&r.push(n)}for(let n of r)e.deleteCache(n)}}write(e,r,n){let i=this.getSource(r.storageType);if(i===void 0)throw new Lt({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${r.storageType}" does not exist`});let a=i.writeCache(structuredClone(e),r);a.dirty=!0,a.externalWriteLock=Pq,this.notifyListeners(r,n)}read(e){let r=this.getSource(e.storageType);if(r===void 0)throw new Lt({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return structuredClone(r.readCache(e))}readShortLived(e){let r=this.getSource(e.storageType);if(r===void 0)throw new Lt({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return r.readCache(e)}isCacheExternalWriteLocked(e){return e.externalWriteLock>0}notifyListeners(e,r){let n=this.getSource(e.storageType);if(n===void 0)throw new Lt({errorLevel:"ERROR",effect:"can notify listeners metadata",cause:`Source "${e.storageType}" does not exist`});let i=n.getCacheItemForStoragePath(e.storagePath);if(i!==void 0){for(let a of i.subscriptions)if(!(r!==void 0&&r===a.uuid||a.bindTarget===void 0||!a.updatable())&&MD(e.storageProp,a.bindTarget.storageProp,a.bindTarget.listenToChildren)){let o=n.readCache(a.bindTarget);a.onUpdate(o)}}}notifyAllListeners(e,r){for(let n of r.subscriptions){if(n.bindTarget===void 0)continue;let i=e.readCache(n.bindTarget);n.onUpdate(i)}}deleteCachesForStoragePath(e){for(let r of this.sources.values()){let n=r.getCacheItemForStoragePath(e);n!==void 0&&(n.subscriptions.forEach(i=>i.delete()),r.deleteCache(n))}}getDefaultCacheItem(){return{subscriptions:[],externalWriteLock:0,dirty:!1,cyclesWithoutListeners:0}}onExternalUpdate(e,r,n){let i=e.getCacheItemForStoragePath(r);if(i===void 0||this.isCacheExternalWriteLocked(i))return;e.writeEntireCache(n,i);let a=0;for(let o of i.subscriptions){if(o.bindTarget===void 0||!o.updatable())continue;let s=mo.tryGet(n,o.bindTarget.storageProp);o.onUpdate(s)&&(a+=1)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,r){this.deleteCachesForStoragePath(e)}};var Cd=class{constructor(){this.activeMountables=new Map}unloadFile(e){for(let r of this.activeMountables.values())r.getFilePath()===e&&r.unmount()}unload(){for(let e of this.activeMountables.values())e.unmount()}registerMountable(e){this.activeMountables.set(e.getUuid(),e)}unregisterMountable(e){this.activeMountables.delete(e.getUuid())}};var js=class t{constructor(e){this.path=e}get(e){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);for(let n of this.path.slice(1))r=n.get(r.child);return r}tryGet(e){try{return this.get(e)}catch{return}}set(e,r){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,r)}setAndCreate(e,r){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,r)),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,r)),n=n.access.get(n.parent));n.access.set(n.parent,r)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,r){let n=this.getNextPathElement(e);return n===void 0?r:n.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new t(this.path.concat(e.path))}compareDiffArray(e){let r=Math.min(this.path.length,e.length);for(let n=0;n<r;n++){let i=this.path[n],a=e[n];if(i.prop!==a.toString())return!1}return!0}};var Nd=class{constructor(e){this.mb=e}fromString(e){return on(_o,e)}fromStringAndValidate(e,r,n){return this.validate(e,this.fromString(e),r,n)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:Fa(e.storageType),storagePath:Fa(e.storagePath),storageProp:e.storageProp.path.map(r=>r.toUnvalidatedPropAccess()),listenToChildren:e.listenToChildren}}validate(e,r,n,i){let a=new js(r.storageProp.map(m=>new yu(m.type,m.prop.value))),o;r.storageType===void 0?o=this.mb.metadataManager.defaultSource:o=this.validateStorageType(r.storageType,e);let s=r.storagePath!==void 0,l=r.storagePath??{value:n},u=this.mb.metadataManager.getSource(o);if(u===void 0)throw new Lt({errorLevel:"CRITICAL",effect:"can not validate bind target",cause:`Source '${o}' not found. But validation was successful. This should not happen.`,context:{fullDeclaration:e,sources:[...this.mb.metadataManager.sources.keys()]}});let c=u.validateStoragePath(l,s,e,this),f={storageType:o,storagePath:c,storageProp:a,listenToChildren:r.listenToChildren};return u.id==="scope"?this.resolveScope(f,i):f}resolveScope(e,r){if(r===void 0)throw new Nn("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return e.storageType=r.scope.storageType,e.storagePath=r.scope.storagePath,e.storageProp=r.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,r){for(let n of this.mb.metadataManager.iterateSources())if(n===e.value)return n;throw new Nn("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,r,e?.position)}validateStoragePathAsFilePath(e,r){let n=e?.value;if(n===void 0)throw new Nn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",r,e?.position);let i=this.mb.file.getPathByName(n);if(i===void 0)throw new Nn("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,r,e?.position);return i}};var JD=Tr(oa()),qf=Tr(qi());var Sr;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.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},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.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)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Sr||(Sr={}));var mx;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(mx||(mx={}));var pt=Sr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gs=t=>{switch(typeof t){case"undefined":return pt.undefined;case"string":return pt.string;case"number":return isNaN(t)?pt.nan:pt.number;case"boolean":return pt.boolean;case"function":return pt.function;case"bigint":return pt.bigint;case"symbol":return pt.symbol;case"object":return Array.isArray(t)?pt.array:t===null?pt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pt.promise:typeof Map<"u"&&t instanceof Map?pt.map:typeof Set<"u"&&t instanceof Set?pt.set:typeof Date<"u"&&t instanceof Date?pt.date:pt.object;default:return pt.unknown}},Re=Sr.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"]),Lq=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ga=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=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(r(o));else{let s=n,l=0;for(;l<o.path.length;){let u=o.path[l];l===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ga.create=t=>new ga(t);var nc=(t,e)=>{let r;switch(t.code){case Re.invalid_type:t.received===pt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Re.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Sr.jsonStringifyReplacer)}`;break;case Re.unrecognized_keys:r=`Unrecognized key(s) in object: ${Sr.joinValues(t.keys,", ")}`;break;case Re.invalid_union:r="Invalid input";break;case Re.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Sr.joinValues(t.options)}`;break;case Re.invalid_enum_value:r=`Invalid enum value. Expected ${Sr.joinValues(t.options)}, received '${t.received}'`;break;case Re.invalid_arguments:r="Invalid function arguments";break;case Re.invalid_return_type:r="Invalid function return type";break;case Re.invalid_date:r="Invalid date";break;case Re.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Sr.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Re.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Re.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Re.custom:r="Invalid input";break;case Re.invalid_intersection_types:r="Intersection results could not be merged";break;case Re.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Re.not_finite:r="Number must be finite";break;default:r=e.defaultError,Sr.assertNever(t)}return{message:r}},ID=nc;function Vq(t){ID=t}function Fd(){return ID}var Id=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(u=>!!u).slice().reverse();for(let u of l)s=u(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},Uq=[];function st(t,e){let r=Fd(),n=Id({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===nc?void 0:nc].filter(i=>!!i)});t.common.issues.push(n)}var yi=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Ht;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Ht;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Ht=Object.freeze({status:"aborted"}),rc=t=>({status:"dirty",value:t}),Pi=t=>({status:"valid",value:t}),dx=t=>t.status==="aborted",hx=t=>t.status==="dirty",Fu=t=>t.status==="valid",Lf=t=>typeof Promise<"u"&&t instanceof Promise;function Bd(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function BD(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var St;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(St||(St={}));var Of,Rf,qa=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,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}},CD=(t,e)=>{if(Fu(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ga(t.common.issues);return this._error=r,this._error}}};function ar(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||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,s)=>{var l,u;let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(l=c??n)!==null&&l!==void 0?l:s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??r)!==null&&u!==void 0?u:s.defaultError}},description:i}}var or=class{get description(){return this._def.description}_getType(e){return gs(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:gs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new yi,ctx:{common:e.parent.common,data:e.data,parsedType:gs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Lf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gs(e)},a=this._parseSync({data:e,path:i.path,parent:i});return CD(i,a)}"~validate"(e){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gs(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:i});return Fu(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>Fu(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gs(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Lf(i)?i:Promise.resolve(i));return CD(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:Re.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new va({schema:this,typeName:zt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ua.create(this,this._def)}nullable(){return Io.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ys.create(this)}promise(){return Xs.create(this,this._def)}or(e){return Ru.create([this,e],this._def)}and(e){return Lu.create(this,e,this._def)}transform(e){return new va({...ar(this._def),schema:this,typeName:zt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Hu({...ar(this._def),innerType:this,defaultValue:r,typeName:zt.ZodDefault})}brand(){return new Vf({typeName:zt.ZodBranded,type:this,...ar(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Gu({...ar(this._def),innerType:this,catchValue:r,typeName:zt.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Uf.create(this,e)}readonly(){return Wu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qq=/^c[^\s-]{8,}$/i,zq=/^[0-9a-z]+$/,Hq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gq=/^[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,Wq=/^[a-z0-9_-]{21}$/i,Yq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jq=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",px,Xq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Kq=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ez=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",nz=new RegExp(`^${kD}$`);function PD(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function iz(t){return new RegExp(`^${PD(t)}$`)}function $D(t){let e=`${kD}T${PD(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function az(t,e){return!!((e==="v4"||!e)&&Xq.test(t)||(e==="v6"||!e)&&Kq.test(t))}function oz(t,e){if(!Yq.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function sz(t,e){return!!((e==="v4"||!e)&&Qq.test(t)||(e==="v6"||!e)&&ez.test(t))}var Zs=class t extends or{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pt.string){let a=this._getOrReturnCtx(e);return st(a,{code:Re.invalid_type,expected:pt.string,received:a.parsedType}),Ht}let n=new yi,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:Re.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),st(i,{code:Re.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,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?st(i,{code:Re.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&st(i,{code:Re.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Zq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"email",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")px||(px=new RegExp(Jq,"u")),px.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"emoji",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Gq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"uuid",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Wq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"nanoid",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")qq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"cuid",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")zq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"cuid2",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Hq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"ulid",code:Re.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),st(i,{validation:"url",code:Re.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),st(i,{validation:"regex",code:Re.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),st(i,{code:Re.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),st(i,{code:Re.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),st(i,{code:Re.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?$D(a).test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:Re.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?nz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:Re.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?iz(a).test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:Re.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jq.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"duration",code:Re.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?az(e.data,a.version)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"ip",code:Re.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?oz(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"jwt",code:Re.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?sz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"cidr",code:Re.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?tz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"base64",code:Re.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"base64url",code:Re.invalid_string,message:a.message}),n.dirty()):Sr.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Re.invalid_string,...St.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...St.errToObj(e)})}url(e){return this._addCheck({kind:"url",...St.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...St.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...St.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...St.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...St.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...St.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...St.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...St.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...St.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...St.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...St.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...St.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...St.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...St.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...St.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...St.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...St.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...St.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...St.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...St.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...St.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...St.errToObj(r)})}nonempty(e){return this.min(1,St.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Zs.create=t=>{var e;return new Zs({checks:[],typeName:zt.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...ar(t)})};function uz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var Iu=class t extends or{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)!==pt.number){let a=this._getOrReturnCtx(e);return st(a,{code:Re.invalid_type,expected:pt.number,received:a.parsedType}),Ht}let n,i=new yi;for(let a of this._def.checks)a.kind==="int"?Sr.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:Re.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),st(n,{code:Re.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),st(n,{code:Re.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?uz(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),st(n,{code:Re.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:Re.not_finite,message:a.message}),i.dirty()):Sr.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,St.toString(r))}gt(e,r){return this.setLimit("min",e,!1,St.toString(r))}lte(e,r){return this.setLimit("max",e,!0,St.toString(r))}lt(e,r){return this.setLimit("max",e,!1,St.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:St.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:St.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:St.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:St.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:St.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:St.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:St.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:St.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:St.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:St.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Sr.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Iu.create=t=>new Iu({checks:[],typeName:zt.ZodNumber,coerce:t?.coerce||!1,...ar(t)});var Bu=class t extends or{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==pt.bigint)return this._getInvalidInput(e);let n,i=new yi;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),st(n,{code:Re.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),st(n,{code:Re.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),st(n,{code:Re.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Sr.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return st(r,{code:Re.invalid_type,expected:pt.bigint,received:r.parsedType}),Ht}gte(e,r){return this.setLimit("min",e,!0,St.toString(r))}gt(e,r){return this.setLimit("min",e,!1,St.toString(r))}lte(e,r){return this.setLimit("max",e,!0,St.toString(r))}lt(e,r){return this.setLimit("max",e,!1,St.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:St.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:St.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:St.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:St.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:St.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:St.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Bu.create=t=>{var e;return new Bu({checks:[],typeName:zt.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...ar(t)})};var ku=class extends or{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pt.boolean){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.boolean,received:n.parsedType}),Ht}return Pi(e.data)}};ku.create=t=>new ku({typeName:zt.ZodBoolean,coerce:t?.coerce||!1,...ar(t)});var Pu=class t extends or{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pt.date){let a=this._getOrReturnCtx(e);return st(a,{code:Re.invalid_type,expected:pt.date,received:a.parsedType}),Ht}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return st(a,{code:Re.invalid_date}),Ht}let n=new yi,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:Re.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),st(i,{code:Re.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Sr.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:St.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:St.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Pu.create=t=>new Pu({checks:[],coerce:t?.coerce||!1,typeName:zt.ZodDate,...ar(t)});var ic=class extends or{_parse(e){if(this._getType(e)!==pt.symbol){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.symbol,received:n.parsedType}),Ht}return Pi(e.data)}};ic.create=t=>new ic({typeName:zt.ZodSymbol,...ar(t)});var $u=class extends or{_parse(e){if(this._getType(e)!==pt.undefined){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.undefined,received:n.parsedType}),Ht}return Pi(e.data)}};$u.create=t=>new $u({typeName:zt.ZodUndefined,...ar(t)});var Ou=class extends or{_parse(e){if(this._getType(e)!==pt.null){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.null,received:n.parsedType}),Ht}return Pi(e.data)}};Ou.create=t=>new Ou({typeName:zt.ZodNull,...ar(t)});var Js=class extends or{constructor(){super(...arguments),this._any=!0}_parse(e){return Pi(e.data)}};Js.create=t=>new Js({typeName:zt.ZodAny,...ar(t)});var vs=class extends or{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Pi(e.data)}};vs.create=t=>new vs({typeName:zt.ZodUnknown,...ar(t)});var ho=class extends or{_parse(e){let r=this._getOrReturnCtx(e);return st(r,{code:Re.invalid_type,expected:pt.never,received:r.parsedType}),Ht}};ho.create=t=>new ho({typeName:zt.ZodNever,...ar(t)});var ac=class extends or{_parse(e){if(this._getType(e)!==pt.undefined){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.void,received:n.parsedType}),Ht}return Pi(e.data)}};ac.create=t=>new ac({typeName:zt.ZodVoid,...ar(t)});var ys=class t extends or{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==pt.array)return st(r,{code:Re.invalid_type,expected:pt.array,received:r.parsedType}),Ht;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(st(r,{code:o?Re.too_big:Re.too_small,minimum:s?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&&r.data.length<i.minLength.value&&(st(r,{code:Re.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(st(r,{code:Re.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new qa(r,o,r.path,s)))).then(o=>yi.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new qa(r,o,r.path,s)));return yi.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:St.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:St.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:St.toString(r)}})}nonempty(e){return this.min(1,e)}};ys.create=(t,e)=>new ys({type:t,minLength:null,maxLength:null,exactLength:null,typeName:zt.ZodArray,...ar(e)});function tc(t){if(t instanceof Ji){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ua.create(tc(n))}return new Ji({...t._def,shape:()=>e})}else return t instanceof ys?new ys({...t._def,type:tc(t.element)}):t instanceof Ua?Ua.create(tc(t.unwrap())):t instanceof Io?Io.create(tc(t.unwrap())):t instanceof Fo?Fo.create(t.items.map(e=>tc(e))):t}var Ji=class t extends or{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(),r=Sr.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==pt.object){let u=this._getOrReturnCtx(e);return st(u,{code:Re.invalid_type,expected:pt.object,received:u.parsedType}),Ht}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ho&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let l=[];for(let u of o){let c=a[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new qa(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ho){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(st(i,{code:Re.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of s){let f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new qa(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let f=await c.key,m=await c.value;u.push({key:f,value:m,alwaysSet:c.alwaysSet})}return u}).then(u=>yi.mergeObjectSync(n,u)):yi.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return St.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,a,o,s;let l=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=St.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:zt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Sr.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Sr.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return tc(this)}partial(e){let r={};return Sr.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Sr.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ua;)a=a._def.innerType;r[n]=a}}),new t({...this._def,shape:()=>r})}keyof(){return OD(Sr.objectKeys(this.shape))}};Ji.create=(t,e)=>new Ji({shape:()=>t,unknownKeys:"strip",catchall:ho.create(),typeName:zt.ZodObject,...ar(e)});Ji.strictCreate=(t,e)=>new Ji({shape:()=>t,unknownKeys:"strict",catchall:ho.create(),typeName:zt.ZodObject,...ar(e)});Ji.lazycreate=(t,e)=>new Ji({shape:t,unknownKeys:"strip",catchall:ho.create(),typeName:zt.ZodObject,...ar(e)});var Ru=class extends or{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new ga(s.ctx.common.issues));return st(r,{code:Re.invalid_union,unionErrors:o}),Ht}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let u={...r,common:{...r.common,issues:[]},parent:null},c=l._parseSync({data:r.data,path:r.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new ga(l));return st(r,{code:Re.invalid_union,unionErrors:s}),Ht}}get options(){return this._def.options}};Ru.create=(t,e)=>new Ru({options:t,typeName:zt.ZodUnion,...ar(e)});var hs=t=>t instanceof Vu?hs(t.schema):t instanceof va?hs(t.innerType()):t instanceof Uu?[t.value]:t instanceof qu?t.options:t instanceof zu?Sr.objectValues(t.enum):t instanceof Hu?hs(t._def.innerType):t instanceof $u?[void 0]:t instanceof Ou?[null]:t instanceof Ua?[void 0,...hs(t.unwrap())]:t instanceof Io?[null,...hs(t.unwrap())]:t instanceof Vf||t instanceof Wu?hs(t.unwrap()):t instanceof Gu?hs(t._def.innerType):[],kd=class t extends or{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pt.object)return st(r,{code:Re.invalid_type,expected:pt.object,received:r.parsedType}),Ht;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(st(r,{code:Re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=hs(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:zt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ar(n)})}};function gx(t,e){let r=gs(t),n=gs(e);if(t===e)return{valid:!0,data:t};if(r===pt.object&&n===pt.object){let i=Sr.objectKeys(e),a=Sr.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=gx(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===pt.array&&n===pt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=gx(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===pt.date&&n===pt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Lu=class extends or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(dx(a)||dx(o))return Ht;let s=gx(a.value,o.value);return s.valid?((hx(a)||hx(o))&&r.dirty(),{status:r.value,value:s.data}):(st(n,{code:Re.invalid_intersection_types}),Ht)};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}))}};Lu.create=(t,e,r)=>new Lu({left:t,right:e,typeName:zt.ZodIntersection,...ar(r)});var Fo=class t extends or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.array)return st(n,{code:Re.invalid_type,expected:pt.array,received:n.parsedType}),Ht;if(n.data.length<this._def.items.length)return st(n,{code:Re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ht;!this._def.rest&&n.data.length>this._def.items.length&&(st(n,{code:Re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new qa(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>yi.mergeArray(r,o)):yi.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Fo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fo({items:t,typeName:zt.ZodTuple,rest:null,...ar(e)})};var Pd=class t extends or{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.object)return st(n,{code:Re.invalid_type,expected:pt.object,received:n.parsedType}),Ht;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new qa(n,s,n.path,s)),value:o._parse(new qa(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?yi.mergeObjectAsync(r,i):yi.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof or?new t({keyType:e,valueType:r,typeName:zt.ZodRecord,...ar(n)}):new t({keyType:Zs.create(),valueType:e,typeName:zt.ZodRecord,...ar(r)})}},oc=class extends or{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.map)return st(n,{code:Re.invalid_type,expected:pt.map,received:n.parsedType}),Ht;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],u)=>({key:i._parse(new qa(n,s,n.path,[u,"key"])),value:a._parse(new qa(n,l,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return Ht;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return Ht;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}}}};oc.create=(t,e,r)=>new oc({valueType:e,keyType:t,typeName:zt.ZodMap,...ar(r)});var sc=class t extends or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.set)return st(n,{code:Re.invalid_type,expected:pt.set,received:n.parsedType}),Ht;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(st(n,{code:Re.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(st(n,{code:Re.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let u=new Set;for(let c of l){if(c.status==="aborted")return Ht;c.status==="dirty"&&r.dirty(),u.add(c.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((l,u)=>a._parse(new qa(n,l,n.path,u)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:St.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:St.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};sc.create=(t,e)=>new sc({valueType:t,minSize:null,maxSize:null,typeName:zt.ZodSet,...ar(e)});var $d=class t extends or{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pt.function)return st(r,{code:Re.invalid_type,expected:pt.function,received:r.parsedType}),Ht;function n(s,l){return Id({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fd(),nc].filter(u=>!!u),issueData:{code:Re.invalid_arguments,argumentsError:l}})}function i(s,l){return Id({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fd(),nc].filter(u=>!!u),issueData:{code:Re.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Xs){let s=this;return Pi(async function(...l){let u=new ga([]),c=await s._def.args.parseAsync(l,a).catch(p=>{throw u.addIssue(n(l,p)),u}),f=await Reflect.apply(o,this,c);return await s._def.returns._def.type.parseAsync(f,a).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{let s=this;return Pi(function(...l){let u=s._def.args.safeParse(l,a);if(!u.success)throw new ga([n(l,u.error)]);let c=Reflect.apply(o,this,u.data),f=s._def.returns.safeParse(c,a);if(!f.success)throw new ga([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Fo.create(e).rest(vs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Fo.create([]).rest(vs.create()),returns:r||vs.create(),typeName:zt.ZodFunction,...ar(n)})}},Vu=class extends or{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Vu.create=(t,e)=>new Vu({getter:t,typeName:zt.ZodLazy,...ar(e)});var Uu=class extends or{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return st(r,{received:r.data,code:Re.invalid_literal,expected:this._def.value}),Ht}return{status:"valid",value:e.data}}get value(){return this._def.value}};Uu.create=(t,e)=>new Uu({value:t,typeName:zt.ZodLiteral,...ar(e)});function OD(t,e){return new qu({values:t,typeName:zt.ZodEnum,...ar(e)})}var qu=class t extends or{constructor(){super(...arguments),Of.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{expected:Sr.joinValues(n),received:r.parsedType,code:Re.invalid_type}),Ht}if(Bd(this,Of,"f")||BD(this,Of,new Set(this._def.values),"f"),!Bd(this,Of,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{received:r.data,code:Re.invalid_enum_value,options:n}),Ht}return Pi(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Of=new WeakMap;qu.create=OD;var zu=class extends or{constructor(){super(...arguments),Rf.set(this,void 0)}_parse(e){let r=Sr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==pt.string&&n.parsedType!==pt.number){let i=Sr.objectValues(r);return st(n,{expected:Sr.joinValues(i),received:n.parsedType,code:Re.invalid_type}),Ht}if(Bd(this,Rf,"f")||BD(this,Rf,new Set(Sr.getValidEnumValues(this._def.values)),"f"),!Bd(this,Rf,"f").has(e.data)){let i=Sr.objectValues(r);return st(n,{received:n.data,code:Re.invalid_enum_value,options:i}),Ht}return Pi(e.data)}get enum(){return this._def.values}};Rf=new WeakMap;zu.create=(t,e)=>new zu({values:t,typeName:zt.ZodNativeEnum,...ar(e)});var Xs=class extends or{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pt.promise&&r.common.async===!1)return st(r,{code:Re.invalid_type,expected:pt.promise,received:r.parsedType}),Ht;let n=r.parsedType===pt.promise?r.data:Promise.resolve(r.data);return Pi(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Xs.create=(t,e)=>new Xs({type:t,typeName:zt.ZodPromise,...ar(e)});var va=class extends or{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{st(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return Ht;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Ht:l.status==="dirty"||r.value==="dirty"?rc(l.value):l});{if(r.value==="aborted")return Ht;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Ht:s.status==="dirty"||r.value==="dirty"?rc(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ht:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Ht:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.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(!Fu(o))return o;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Fu(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):o);Sr.assertNever(i)}};va.create=(t,e,r)=>new va({schema:t,typeName:zt.ZodEffects,effect:e,...ar(r)});va.createWithPreprocess=(t,e,r)=>new va({schema:e,effect:{type:"preprocess",transform:t},typeName:zt.ZodEffects,...ar(r)});var Ua=class extends or{_parse(e){return this._getType(e)===pt.undefined?Pi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ua.create=(t,e)=>new Ua({innerType:t,typeName:zt.ZodOptional,...ar(e)});var Io=class extends or{_parse(e){return this._getType(e)===pt.null?Pi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Io.create=(t,e)=>new Io({innerType:t,typeName:zt.ZodNullable,...ar(e)});var Hu=class extends or{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===pt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Hu.create=(t,e)=>new Hu({innerType:t,typeName:zt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ar(e)});var Gu=class extends or{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Lf(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ga(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ga(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gu.create=(t,e)=>new Gu({innerType:t,typeName:zt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ar(e)});var uc=class extends or{_parse(e){if(this._getType(e)!==pt.nan){let n=this._getOrReturnCtx(e);return st(n,{code:Re.invalid_type,expected:pt.nan,received:n.parsedType}),Ht}return{status:"valid",value:e.data}}};uc.create=t=>new uc({typeName:zt.ZodNaN,...ar(t)});var lz=Symbol("zod_brand"),Vf=class extends or{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Uf=class t extends or{_parse(e){let{status:r,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"?Ht:a.status==="dirty"?(r.dirty(),rc(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"?Ht:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:zt.ZodPipeline})}},Wu=class extends or{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Fu(i)&&(i.value=Object.freeze(i.value)),i);return Lf(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Wu.create=(t,e)=>new Wu({innerType:t,typeName:zt.ZodReadonly,...ar(e)});function ND(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function RD(t,e={},r){return t?Js.create().superRefine((n,i)=>{var a,o;let s=t(n);if(s instanceof Promise)return s.then(l=>{var u,c;if(!l){let f=ND(e,n),m=(c=(u=f.fatal)!==null&&u!==void 0?u:r)!==null&&c!==void 0?c:!0;i.addIssue({code:"custom",...f,fatal:m})}});if(!s){let l=ND(e,n),u=(o=(a=l.fatal)!==null&&a!==void 0?a:r)!==null&&o!==void 0?o:!0;i.addIssue({code:"custom",...l,fatal:u})}}):Js.create()}var cz={object:Ji.lazycreate},zt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(zt||(zt={}));var fz=(t,e={message:`Input not instance of ${t.name}`})=>RD(r=>r instanceof t,e),LD=Zs.create,VD=Iu.create,pz=uc.create,mz=Bu.create,UD=ku.create,dz=Pu.create,hz=ic.create,gz=$u.create,vz=Ou.create,yz=Js.create,bz=vs.create,xz=ho.create,wz=ac.create,_z=ys.create,Az=Ji.create,Dz=Ji.strictCreate,Sz=Ru.create,Ez=kd.create,Tz=Lu.create,Mz=Fo.create,Cz=Pd.create,Nz=oc.create,Fz=sc.create,Iz=$d.create,Bz=Vu.create,kz=Uu.create,Pz=qu.create,$z=zu.create,Oz=Xs.create,FD=va.create,Rz=Ua.create,Lz=Io.create,Vz=va.createWithPreprocess,Uz=Uf.create,qz=()=>LD().optional(),zz=()=>VD().optional(),Hz=()=>UD().optional(),Gz={string:t=>Zs.create({...t,coerce:!0}),number:t=>Iu.create({...t,coerce:!0}),boolean:t=>ku.create({...t,coerce:!0}),bigint:t=>Bu.create({...t,coerce:!0}),date:t=>Pu.create({...t,coerce:!0})},Wz=Ht,he=Object.freeze({__proto__:null,defaultErrorMap:nc,setErrorMap:Vq,getErrorMap:Fd,makeIssue:Id,EMPTY_PATH:Uq,addIssueToContext:st,ParseStatus:yi,INVALID:Ht,DIRTY:rc,OK:Pi,isAborted:dx,isDirty:hx,isValid:Fu,isAsync:Lf,get util(){return Sr},get objectUtil(){return mx},ZodParsedType:pt,getParsedType:gs,ZodType:or,datetimeRegex:$D,ZodString:Zs,ZodNumber:Iu,ZodBigInt:Bu,ZodBoolean:ku,ZodDate:Pu,ZodSymbol:ic,ZodUndefined:$u,ZodNull:Ou,ZodAny:Js,ZodUnknown:vs,ZodNever:ho,ZodVoid:ac,ZodArray:ys,ZodObject:Ji,ZodUnion:Ru,ZodDiscriminatedUnion:kd,ZodIntersection:Lu,ZodTuple:Fo,ZodRecord:Pd,ZodMap:oc,ZodSet:sc,ZodFunction:$d,ZodLazy:Vu,ZodLiteral:Uu,ZodEnum:qu,ZodNativeEnum:zu,ZodPromise:Xs,ZodEffects:va,ZodTransformer:va,ZodOptional:Ua,ZodNullable:Io,ZodDefault:Hu,ZodCatch:Gu,ZodNaN:uc,BRAND:lz,ZodBranded:Vf,ZodPipeline:Uf,ZodReadonly:Wu,custom:RD,Schema:or,ZodSchema:or,late:cz,get ZodFirstPartyTypeKind(){return zt},coerce:Gz,any:yz,array:_z,bigint:mz,boolean:UD,date:dz,discriminatedUnion:Ez,effect:FD,enum:Pz,function:Iz,instanceof:fz,intersection:Tz,lazy:Bz,literal:kz,map:Nz,nan:pz,nativeEnum:$z,never:xz,null:vz,nullable:Lz,number:VD,object:Az,oboolean:Hz,onumber:zz,optional:Rz,ostring:qz,pipeline:Uz,preprocess:Vz,promise:Oz,record:Cz,set:Fz,strictObject:Dz,string:LD,symbol:hz,transformer:FD,tuple:Mz,undefined:gz,union:Sz,unknown:bz,void:wz,NEVER:Wz,ZodIssueCode:Re,quotelessJson:Lq,ZodError:ga});function HD(t,e){return(r,n)=>r[t]===void 0==(r[e]===void 0)?(n.addIssue({code:he.ZodIssueCode.custom,message:`Either ${t} or ${e} must be used, but not both.`}),!1):!0}function Bt(){return function(t){return t}}function tn(t,e){let r=t.safeParse(e);if(!r.success)throw new Lt({errorLevel:"CRITICAL",effect:"Failed to run function due to invalid arguments. Check that the arguments that you are passing to the function match the type definition of the function.",cause:r.error})}function GD(t,e){return t.safeParse(e,{errorMap:Zz})}var qD=["zeroth","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],zD=["twent","thirt","fort","fift","sixt","sevent","eight","ninet"];function jz(t){return t<20?qD[t]:t%10===0?zD[Math.floor(t/10)-2]+"ieth":zD[Math.floor(t/10)-2]+"y-"+qD[t%10]}var Zz=(t,e)=>({message:`At '${t.path.map(n=>typeof n=="string"?n:jz(n+1)+" element").join(" > ")}'. ${e.defaultError}`});function Jz(t,e,r){return he.number({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a number.`})}function ei(t,e,r){return he.string({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`})}function vx(t,e,r){return he.coerce.string({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a string.`})}function bs(t,e,r){return he.boolean({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a boolean.`})}var Xz=Bt()(he.object({type:he.literal("command"),command:ei("command","command","command to run")})),Qz=Bt()(he.object({type:he.literal("js"),file:ei("js","file","file path to the file to run"),args:he.record(he.unknown()).optional()})),Kz=Bt()(he.object({type:he.literal("open"),link:ei("open","link","link to open"),newTab:bs("open","newTab","").optional()})),e7=Bt()(he.object({type:he.literal("input"),str:ei("input","str","value to input")})),t7=Bt()(he.object({type:he.literal("sleep"),ms:Jz("sleep","ms","duration")})),r7=Bt()(he.object({type:he.literal("templaterCreateNote"),templateFile:ei("templaterCreateNote","templateFile","template file path"),folderPath:ei("templaterCreateNote","folderPath","folder path").optional(),fileName:ei("templaterCreateNote","fileName","file name").optional(),openNote:bs("templaterCreateNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:bs("templaterCreateNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),n7=Bt()(he.object({type:he.literal("runTemplaterFile"),templateFile:ei("runTemplaterFile","templateFile","template file path")})),i7=Bt()(he.object({type:he.literal("updateMetadata"),bindTarget:ei("updateMetadata","bindTarget","bind target to the metadata to update"),evaluate:bs("updateMetadata","evaluate","value for whether to evaluate the value as a JavaScript expression"),value:he.coerce.string({required_error:"The updateMetadata action requires a specified value for the update with the 'value' field.",invalid_type_error:"The updateMetadata action requires the value of the 'value' fields to be a string."})})),a7=Bt()(he.object({type:he.literal("createNote"),folderPath:ei("createNote","folderPath","folder path").optional(),fileName:ei("createNote","fileName","file name"),openNote:bs("createNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:bs("createNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),o7=Bt()(he.object({type:he.literal("replaceInNote"),fromLine:vx("replaceInNote","fromLine","line to replace from"),toLine:vx("replaceInNote","toLine","line to replace to"),replacement:ei("replaceInNote","replacement","replacement string"),templater:bs("replaceInNote","templater","value for whether to use Templater").optional()})),s7=Bt()(he.object({type:he.literal("replaceSelf"),replacement:ei("replaceSelf","replacement","replacement string"),templater:bs("replaceSelf","templater","value for whether to use Templater").optional()})),u7=Bt()(he.object({type:he.literal("regexpReplaceInNote"),regexp:ei("regexpReplaceInNote","regexp","search regular expression"),regexpFlags:ei("regexpReplaceInNote","regexpFlags","regular expression flags string").optional(),replacement:ei("regexpReplaceInNote","replacement","replacement string")})),l7=Bt()(he.object({type:he.literal("insertIntoNote"),line:vx("insertIntoNote","line","line to insert at"),value:ei("insertIntoNote","value","string to insert"),templater:bs("insertIntoNote","templater","value for whether to use Templater").optional()})),c7=Bt()(he.object({type:he.literal("inlineJS"),code:ei("inlineJS","code","code string to run"),args:he.record(he.unknown()).optional()})),WD=Bt()(he.discriminatedUnion("type",[Xz,Qz,Kz,e7,t7,r7,i7,a7,o7,s7,u7,l7,c7,n7])),f7=he.nativeEnum(Wr),lc=Bt()(he.object({label:he.string(),icon:he.string().optional(),style:f7,class:he.string().optional(),cssStyle:he.string().optional(),backgroundImage:he.string().optional(),tooltip:he.string().optional(),id:he.string().optional(),hidden:he.boolean().optional(),action:WD.optional(),actions:WD.array().optional()}).superRefine(HD("action","actions")));function bx(t){return t instanceof Error&&t.name==="ZodError"&&"issues"in t&&Array.isArray(t.issues)}var yx=class extends Error{name;details;constructor(t,e){super(t,e),this.name="ZodValidationError",this.details=p7(e)}toString(){return this.message}};function p7(t){if(t){let e=t.cause;if(bx(e))return e.issues}return[]}function YD(t){return t.length!==0}var m7=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function d7(t){return t.length===1?t[0].toString():t.reduce((e,r)=>{if(typeof r=="number")return e+"["+r.toString()+"]";if(r.includes('"'))return e+'["'+h7(r)+'"]';if(!m7.test(r))return e+'["'+r+'"]';let n=e.length===0?"":".";return e+n+r},"")}function h7(t){return t.replace(/"/g,'\\"')}var g7="; ",v7=99,jD="Validation error",y7=": ",b7=", or ";function x7(t={}){let{issueSeparator:e=g7,unionSeparator:r=b7,prefixSeparator:n=y7,prefix:i=jD,includePath:a=!0,maxIssuesInMessage:o=v7}=t;return s=>{let l=s.slice(0,o).map(u=>Od({issue:u,issueSeparator:e,unionSeparator:r,includePath:a})).join(e);return w7(l,i,n)}}function Od(t){let{issue:e,issueSeparator:r,unionSeparator:n,includePath:i}=t;if(e.code===Re.invalid_union)return e.unionErrors.reduce((a,o)=>{let s=o.issues.map(l=>Od({issue:l,issueSeparator:r,unionSeparator:n,includePath:i})).join(r);return a.includes(s)||a.push(s),a},[]).join(n);if(e.code===Re.invalid_arguments)return[e.message,...e.argumentsError.issues.map(a=>Od({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(e.code===Re.invalid_return_type)return[e.message,...e.returnTypeError.issues.map(a=>Od({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(i&&YD(e.path)){if(e.path.length===1){let a=e.path[0];if(typeof a=="number")return`${e.message} at index ${a}`}return`${e.message} at "${d7(e.path)}"`}return e.message}function w7(t,e,r){return e!==null?t.length>0?[e,t].join(r):e:t.length>0?t:jD}function Rd(t,e={}){if(!bx(t))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${D7.name}" method instead?`);return ZD(t,e)}function ZD(t,e={}){let r=t.errors,n;return YD(r)?n=_7(e)(r):n=t.message,new yx(n,{cause:t})}function _7(t){return"messageBuilder"in t?t.messageBuilder:x7(t)}var A7=(t={})=>e=>bx(e)?ZD(e,t):e instanceof Error?new yx(e.message,{cause:e}):new yx("Unknown error");function D7(t,e={}){return A7(e)(t)}var S7=qf.P.sequenceMap((t,e)=>e,qf.P.string("BUTTON"),qf.P.manyNotOf("[],^").separateBy(qf.P.string(",").trim(JD.P_UTILS.optionalWhitespace())).wrapString("[","]")),Ld=class{constructor(e){this.mb=e}fromGroupString(e){let r=new er("ButtonGroup"),n=[];try{n=on(S7,e)}catch(i){r.add(i)}return{declarationString:e,referencedButtonIds:n,errorCollection:r}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new er("ButtonGroup")}}fromString(e){let r=new er("Button"),n;try{let i=this.mb.internal.parseYaml(e);n=this.validateConfig(i)}catch(i){r.add(i)}return{declarationString:e,config:n,errorCollection:r}}validateConfig(e){let r=GD(lc,e);if(!r.success){let n=Rd(r.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new es({errorLevel:"ERROR",effect:"The validation for the button config failed.",cause:"Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.",positionContext:n.message,docs:[qt.linkToButtonConfig()]})}return r.data}validate(e){let r=new er("Button"),n;try{n=this.validateConfig(e)}catch(i){r.add(i)}return{declarationString:void 0,config:n,errorCollection:r}}};var cc=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(en))e[r]=0;for(let r of this.arguments){let n=r.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new $r({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[qt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let r of e.arguments){let n=r.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(r)}return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){let n=r.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new $r({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var Vd=class extends cc{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var fc=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,r){if(r.find(n=>n.length===e.length)===void 0)throw new $r({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${r.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[qt.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 yr=class extends fc{};var Ud=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.addLabels}};var qd=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.allowOther}};var zd=class extends yr{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Ar.class}};var Hd=class extends yr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=la(r[0].value)}getConfig(){return Ar.defaultValue}};var Gd=class extends yr{constructor(){super(...arguments);this.value=void 0}_parseValue(r){if(this.value=Number.parseInt(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.limit}};var Wd=class extends yr{constructor(){super(...arguments);this.value=100}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.maxValue}};var Yd=class extends yr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.minValue}};var jd=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.multiLine}};var Zd=class extends yr{constructor(){super(...arguments);this.value=!1}_parseValue(r){this.value=la(r[0].value)}getConfig(){return Ar.offValue}};var Jd=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=la(r[0].value)}getConfig(){return Ar.onValue}};var Xd=class extends yr{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(r){r.length===1?(this.value=la(r[0].value),this.name=r[0].value):r.length===2&&(this.value=la(r[0].value),this.name=r[1].value)}getConfig(){return Ar.option}};var Qd=class extends yr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Ar.optionQuery}};var Kd=class extends yr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Ar.placeholder}};var eh=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.showcase}};var th=class extends yr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.stepSize}};var rh=class extends yr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Ar.title}};function XD(t,e,r){return r==="true"?`[[${t}|${e}]]`:r==="partial"?`[[${e}]]`:`${e}`}var nh=class extends yr{constructor(){super(...arguments);this.value="true"}_parseValue(r){let n=r[0]?.value.toLowerCase();if(n===void 0){this.value="true";return}if(n==="true"||n==="partial"||n==="false"){this.value=n;return}throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${Z_(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.useLinks}};var QD={class:zd,addLabels:Ud,minValue:Yd,maxValue:Wd,stepSize:th,option:Xd,title:rh,optionQuery:Qd,showcase:eh,offValue:Zd,onValue:Jd,defaultValue:Hd,placeholder:Kd,useLinks:nh,limit:Gd,allowOther:qd,multiLine:jd},ih=class{static createInputFieldArgument(e){if(e in QD){let r=QD[e];if(r)return new r}throw new to({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var ah=class{constructor(e,r,n){this.mb=e,this.unvalidatedDeclaration=r,this.filePath=n,this.errorCollection=new er("input field declaration")}validate(e){let r=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(r),a={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:r,bindTarget:n,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let r of Object.entries(Ls))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Nn("ERROR","Declaration Validator",`Encountered invalid identifier. Expected an input field type but received '${e?.value}'.`,this.unvalidatedDeclaration.declarationString,e?.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.bindTarget!==void 0)try{return this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}catch(r){this.errorCollection.add(r)}}validateArguments(e){let r=new Vd;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=ih.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Nn("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}r.add(a)}try{r.validate()}catch(n){this.errorCollection.add(n)}return r}validateArgumentType(e){for(let r of Object.entries(en))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Nn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var bi=Tr(oa()),Yr=Tr(qi());var T7=Yr.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Ln.node(Mi).trim(bi.P_UTILS.optionalWhitespace()).describe("input field type"),nf.trim(bi.P_UTILS.optionalWhitespace()).wrap(Yr.P.string("(").describe('arguments paren "("'),Yr.P.string(")").describe('arguments paren ")"')).trim(bi.P_UTILS.optionalWhitespace()).optional([]),Yr.P.sequence(Yr.P.string(":").trim(bi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),_o).trim(bi.P_UTILS.optionalWhitespace()).optional()),KD=Yr.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Ln.node(Mi).trim(bi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),nf.trim(bi.P_UTILS.optionalWhitespace()).wrap(Yr.P.string("(").describe('arguments paren "("'),Yr.P.string(")").describe('arguments paren ")"')).trim(bi.P_UTILS.optionalWhitespace()).optional([]),Yr.P.sequence(Yr.P.string(":").trim(bi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),_o).trim(bi.P_UTILS.optionalWhitespace()).optional()),eS=Yr.P.or(Yr.P.sequenceMap((t,e,r)=>(r.templateName=e,r),Yr.P.string("INPUT"),Yr.P.sequenceMap((t,e,r)=>e,Yr.P.string("["),$_.node(Mi).trim(bi.P_UTILS.optionalWhitespace()).describe("template name"),Yr.P.string("]").skip(bi.P_UTILS.optionalWhitespace())),KD.wrap(Yr.P.string("["),Yr.P.string("]")),bi.P_UTILS.eof()),Yr.P.sequenceMap((t,e)=>e,Yr.P.string("INPUT"),T7.wrap(Yr.P.string("["),Yr.P.string("]")),bi.P_UTILS.eof())),tS=Yr.P.sequenceMap((t,e)=>e,Yr.P.string("INPUT"),KD.wrap(Yr.P.string("["),Yr.P.string("]")),bi.P_UTILS.eof());var oh=class{constructor(e){this.mb=e,this.templates=[]}fromString(e){let r=new er("InputField");try{let n=on(eS,e),i=this.partialToFullDeclaration(n,e,r);return i=this.applyTemplate(i),i}catch(n){r.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:r}}fromStringAndValidate(e,r,n){return this.validate(this.fromString(e),r,n)}fromSimpleDeclaration(e){return{declarationString:void 0,inputFieldType:Fa(e.inputFieldType),bindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(r=>({name:Fa(r.name),value:r.value.map(n=>Fa(n))})),errorCollection:new er("InputField")}}fromSimpleDeclarationAndValidate(e,r,n){return this.validate(this.fromSimpleDeclaration(e),r,n)}partialToFullDeclaration(e,r,n){return{...structuredClone(e),declarationString:r,errorCollection:n}}validate(e,r,n){return new ah(this.mb,e,r).validate(n)}merge(e,r){let n;return e.bindTarget===void 0?n=r.bindTarget:(n=e.bindTarget,r.bindTarget?.storagePath!==void 0&&(n.storagePath=r.bindTarget.storagePath),r.bindTarget?.storageProp!==void 0&&(n.storageProp=r.bindTarget.storageProp)),{declarationString:r.declarationString,inputFieldType:r.inputFieldType??e.inputFieldType,bindTarget:n,arguments:r.arguments.concat(e.arguments).reduce((i,a)=>(i.find(o=>o.name===a.name)===void 0&&i.push(a),i),[]),errorCollection:new er("input field declaration").merge(e.errorCollection).merge(r.errorCollection)}}parseTemplateString(e){let r=new er("InputFieldParser");try{let n=on(tS,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:r}}parseTemplates(e){this.templates=[];let r=new er("input field template parser");for(let n of e){let i=this.parseTemplateString(n.declaration);r.merge(i.errorCollection);let a={name:n.name,template:i};this.templates.push(qy(a))}return r}getTemplate(e){return this.templates.find(r=>r.name===e)?.template}applyTemplate(e){if(e.templateName===void 0)return e;let r=this.getTemplate(e.templateName.value);return r===void 0?(e.errorCollection.add(new Nn("WARNING","Input Field Parser",`Invalid template name. Could not find a template with the name '${e.templateName.value}'.`,e.declarationString,e.templateName.position,["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/"])),e):this.merge(r,e)}};var sh=class{constructor(e){this.mb=e}fromString(e){let r=new er("JsViewFieldDeclaration");try{let n=on(z_,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,errorCollection:r,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}fromStringAndValidate(e,r){return this.validate(this.fromString(e),r)}fromSimpleDeclaration(e){let r=new er("JsViewFieldDeclaration");return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(n=>({bindTarget:this.mb.bindTargetParser.fromExistingDeclaration(n.bindTarget),name:n.name})),writeToBindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),hidden:e.hidden??!1,errorCollection:r}}fromSimpleDeclarationAndValidate(e,r){return this.validate(this.fromSimpleDeclaration(e),r)}partialToFullDeclaration(e,r,n){let i=e;return i.declarationString=r,i.errorCollection=n,i.bindTargetMappings=[...i.bindTargetMappings],i}validate(e,r){let n={};n.declarationString=e.declarationString,n.errorCollection=e.errorCollection;try{return n.bindTargetMappings=e.bindTargetMappings.map(i=>({bindTarget:this.mb.bindTargetParser.validate(e.declarationString,i.bindTarget,r),name:i.name})),e.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.mb.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,r)),n.code=e.code,n.hidden=e.hidden,n}catch(i){n.errorCollection.add(i)}return{declarationString:e.declarationString,errorCollection:n.errorCollection,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}};var uh=class extends cc{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Qs=class extends fc{};var lh=class extends Qs{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Bl.class}};var ch=class extends Qs{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Bl.hidden}};var fh=class extends Qs{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Bl.renderMarkdown}};var rS={renderMarkdown:fh,hidden:ch,class:lh},ph=class{static createViewFieldArgument(e){if(e in rS){let r=rS[e];if(r)return new r}throw new to({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var mh=class{constructor(e,r,n){this.unvalidatedDeclaration=e,this.mb=n,this.filePath=r,this.errorCollection=new er("view field declaration")}validate(e){let r=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(r),a=this.validateTemplateDeclaration(e),o={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:r,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 r of Object.entries(lf))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Nn("ERROR","Declaration Validator",`Encountered invalid identifier. Expected a view field type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.writeToBindTarget!==void 0)return this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let r=new uh;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=ph.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Nn("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}r.add(a)}try{r.validate()}catch(n){this.errorCollection.add(n)}return r}validateArgumentType(e){for(let r of Object.entries(_u))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Nn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}validateTemplateDeclaration(e){try{return this.unvalidatedDeclaration.templateDeclaration?.map(r=>typeof r=="string"?r:this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,r,this.filePath,e))??[]}catch(r){return this.errorCollection.add(r),[]}}};var dh=class{constructor(e){this.mb=e}fromString(e){let r=new er("ViewFieldDeclaration");try{let n=on(q_,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,errorCollection:r,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,r,n){return this.validate(this.fromString(e),r,n)}fromSimpleDeclaration(e){let r=new er("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(n=>typeof n=="string"?n:this.mb.bindTargetParser.fromExistingDeclaration(n)),viewFieldType:Fa(e.viewFieldType),arguments:(e.arguments??[]).map(n=>({name:Fa(n.name),value:n.value.map(i=>Fa(i))})),writeToBindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:r}}fromSimpleDeclarationAndValidate(e,r,n){return this.validate(this.fromSimpleDeclaration(e),r,n)}partialToFullDeclaration(e,r,n){return{...structuredClone(e),declarationString:r,errorCollection:n}}validate(e,r,n){return new mh(e,r,this.mb).validate(n)}};var iS=Tr(Bf());var nS=["January","February","March","April","May","June","July","August","September","October","November","December"],Yu=[{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"}],zf={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:Yu[1],syncInterval:200,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"]},hh=50,gh=1e3;var xx=Yu[1];function aS(t){xx=t}function oS(t){return nS[t]}function sS(t,e){let r=(0,iS.default)(new Date(e,t)).daysInMonth(),n=new Array(42).fill(0),i=M7(new Date(e,t,1));for(let a=0;a<r;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 M7(t){return Vy(t.getDay()-xx.index,7)}function uS(){return Yu.map(e=>({index:Vy(e.index-xx.index,7),name:e.name,shortName:e.shortName})).sort((e,r)=>e.index-r.index).map(e=>e.shortName)}function lS(){let t=0;return()=>++t}function bn(){return bn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},bn.apply(null,arguments)}var vh={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function jr(t,e){if(Hf(t,e))return t[e];throw typeof t[e]=="function"&&yh(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Bo(t,e,r){if(Hf(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Hf(t,e){return!C7(t)&&!Array.isArray(t)?!1:Ze(N7,e)?!0:!(e in Object.prototype||e in Function.prototype)}function cS(t,e){if(!yh(t,e))throw new Error('No access to method "'+e+'"');return t[e]}function yh(t,e){return t==null||typeof t[e]!="function"||Ze(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:Ze(F7,e)?!0:!(e in Object.prototype||e in Function.prototype)}function C7(t){return typeof t=="object"&&t&&t.constructor===Object}var N7={length:!0,name:!0},F7={toString:!0,valueOf:!0,toLocaleString:!0};var Ks=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return jr(this.wrappedObject,e)}set(e,r){return Bo(this.wrappedObject,e,r),this}has(e){return Hf(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return fS(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){Hf(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},pc=class{constructor(e,r,n){this.a=e,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return fS(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function fS(t,e){return{next:()=>{var r=t.next();return r.done?r:{value:e(r.value),done:!1}}}}function eu(){return new Map}function xs(t){if(!t)return eu();if(ko(t))return t;if(ya(t))return new Ks(t);throw new Error("createMap can create maps from objects or Maps")}function pS(t){if(t instanceof Ks)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);Bo(e,r,n)}return e}function bt(t){return typeof t=="number"}function ot(t){return!t||typeof t!="object"||typeof t.constructor!="function"?!1:t.isBigNumber===!0&&typeof t.constructor.prototype=="object"&&t.constructor.prototype.isBigNumber===!0||typeof t.constructor.isDecimal=="function"&&t.constructor.isDecimal(t)===!0}function Po(t){return typeof t=="bigint"}function Hn(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function ba(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function En(t){return t&&t.constructor.prototype.isUnit===!0||!1}function Jr(t){return typeof t=="string"}var sr=Array.isArray;function Ye(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function rn(t){return Array.isArray(t)||Ye(t)}function ws(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function xa(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function tu(t){return t&&t.constructor.prototype.isRange===!0||!1}function $o(t){return t&&t.constructor.prototype.isIndex===!0||!1}function bh(t){return typeof t=="boolean"}function xh(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function mc(t){return t&&t.constructor.prototype.isHelp===!0||!1}function wh(t){return typeof t=="function"}function _h(t){return t instanceof Date}function Ah(t){return t instanceof RegExp}function ya(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!Hn(t)&&!ba(t))}function ko(t){return t?t instanceof Map||t instanceof Ks||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function mS(t){return ko(t)&&ko(t.a)&&ko(t.b)}function dS(t){return ko(t)&&ya(t.wrappedObject)}function Dh(t){return t===null}function Sh(t){return t===void 0}function $i(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gn(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function Eh(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Th(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function Mh(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function kt(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gf(t){return kt(t)||Rr(t)&&t.args.length===1&&kt(t.args[0])&&"-+~".includes(t.op)}function za(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function ai(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function Xi(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gt(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function Oo(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function Rr(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function Wn(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ch(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function Nh(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Mr(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function dc(t){return t&&t.constructor.prototype.isChain===!0||!1}function ir(t){var e=typeof t;return e==="object"?t===null?"null":ot(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function ut(t){var e=typeof t;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||t===null||t===void 0)return t;if(typeof t.clone=="function")return t.clone();if(Array.isArray(t))return t.map(function(r){return ut(r)});if(t instanceof Date)return new Date(t.valueOf());if(ot(t))return t;if(ya(t))return I7(t,ut);if(e==="function")return t;throw new TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function I7(t,e){var r={};for(var n in t)Ze(t,n)&&(r[n]=e(t[n]));return r}function Fh(t,e){for(var r in e)Ze(e,r)&&(t[r]=e[r]);return t}function wx(t,e){if(Array.isArray(e))throw new TypeError("Arrays are not supported by deepExtend");for(var r in e)if(Ze(e,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(e[r]&&e[r].constructor===Object)t[r]===void 0&&(t[r]={}),t[r]&&t[r].constructor===Object?wx(t[r],e[r]):t[r]=e[r];else{if(Array.isArray(e[r]))throw new TypeError("Arrays are not supported by deepExtend");t[r]=e[r]}return t}function Qi(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!Qi(t[n],e[n]))return!1;return!0}else{if(typeof t=="function")return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!Qi(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function hS(t){var e={};return gS(t,e),e}function gS(t,e){for(var r in t)if(Ze(t,r)){var n=t[r];typeof n=="object"&&n!==null?gS(n,e):e[r]=n}}function _s(t,e,r){var n=!0,i;Object.defineProperty(t,e,{get:function(){return n&&(i=r(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function Ze(t,e){return t&&Object.hasOwnProperty.call(t,e)}function vS(t){return t&&typeof t.factory=="function"}function yS(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=t[i];a!==void 0&&(r[i]=a)}return r}var bS=["Matrix","Array"],xS=["number","BigNumber","Fraction"];function _S(t,e){function r(n){if(n){if(n.epsilon!==void 0){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');var i=ut(n);return i.relTol=n.epsilon,i.absTol=n.epsilon*.001,delete i.epsilon,r(i)}var a=ut(t);wS(n,"matrix",bS),wS(n,"number",xS),wx(t,n);var o=ut(t),s=ut(n);return e("config",o,a,s),o}else return ut(t)}return r.MATRIX_OPTIONS=bS,r.NUMBER_OPTIONS=xS,Object.keys(vh).forEach(n=>{Object.defineProperty(r,n,{get:()=>t[n],enumerable:!0,configurable:!0})}),r}function wS(t,e,r){t[e]!==void 0&&!r.includes(t[e])&&console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+r.map(n=>JSON.stringify(n)).join(", ")+".")}var cw={};F_(cw,{createAbs:()=>hT,createAccessorNode:()=>kI,createAcos:()=>cF,createAcosh:()=>pF,createAcot:()=>dF,createAcoth:()=>gF,createAcsc:()=>yF,createAcsch:()=>xF,createAdd:()=>AI,createAddScalar:()=>yT,createAnd:()=>Tg,createAndTransform:()=>e4,createArg:()=>yM,createArrayNode:()=>PI,createAsec:()=>_F,createAsech:()=>DF,createAsin:()=>EF,createAsinh:()=>TF,createAssignmentNode:()=>RI,createAtan:()=>MF,createAtan2:()=>NF,createAtanh:()=>IF,createAtomicMass:()=>n3,createAvogadro:()=>i3,createBellNumbers:()=>OR,createBigNumberClass:()=>KS,createBigint:()=>WE,createBignumber:()=>XE,createBin:()=>kC,createBitAnd:()=>fg,createBitAndTransform:()=>r4,createBitNot:()=>mM,createBitOr:()=>pg,createBitOrTransform:()=>n4,createBitXor:()=>gM,createBlockNode:()=>LI,createBohrMagneton:()=>OL,createBohrRadius:()=>zL,createBoltzmann:()=>a3,createBoolean:()=>JE,createCatalan:()=>LR,createCbrt:()=>_T,createCeil:()=>AT,createChain:()=>pO,createChainClass:()=>k2,createClassicalElectronRadius:()=>HL,createClone:()=>xE,createColumn:()=>hg,createColumnTransform:()=>E3,createCombinations:()=>ZO,createCombinationsWithRep:()=>QO,createCompare:()=>AN,createCompareNatural:()=>TN,createCompareText:()=>CN,createCompile:()=>a2,createComplex:()=>QE,createComplexClass:()=>eE,createComposition:()=>UR,createConcat:()=>dg,createConcatTransform:()=>U3,createConditionalNode:()=>VI,createConductanceQuantum:()=>RL,createConj:()=>xM,createConstantNode:()=>WI,createCorr:()=>WO,createCos:()=>kF,createCosh:()=>$F,createCot:()=>RF,createCoth:()=>VF,createCoulomb:()=>PL,createCount:()=>BM,createCreateUnit:()=>uF,createCross:()=>PM,createCsc:()=>qF,createCsch:()=>HF,createCtranspose:()=>mC,createCube:()=>ST,createCumSum:()=>uv,createCumSumTransform:()=>Z3,createDeepEqual:()=>RN,createDenseMatrixClass:()=>yE,createDerivative:()=>KR,createDet:()=>dO,createDeuteronMass:()=>JL,createDiag:()=>OM,createDiff:()=>bg,createDiffTransform:()=>z3,createDistance:()=>kO,createDivide:()=>IO,createDivideScalar:()=>YC,createDot:()=>CI,createDotDivide:()=>sN,createDotMultiply:()=>aM,createDotPow:()=>aN,createE:()=>gL,createEfimovFactor:()=>r3,createEigs:()=>wO,createElectricConstant:()=>BL,createElectronMass:()=>GL,createElementaryCharge:()=>$L,createEqual:()=>NN,createEqualScalar:()=>zE,createEqualText:()=>IN,createErf:()=>DC,createEvaluate:()=>s2,createExp:()=>TT,createExpm:()=>AO,createExpm1:()=>CT,createFactorial:()=>iR,createFalse:()=>cL,createFaraday:()=>o3,createFermiCoupling:()=>WL,createFft:()=>vC,createFibonacciHeapClass:()=>ZN,createFilter:()=>gg,createFilterTransform:()=>C3,createFineStructure:()=>YL,createFirstRadiation:()=>s3,createFix:()=>NT,createFlatten:()=>VM,createFloor:()=>sg,createForEach:()=>vg,createForEachTransform:()=>N3,createFormat:()=>IC,createFraction:()=>KE,createFractionClass:()=>rE,createFreqz:()=>aL,createFunctionAssignmentNode:()=>YI,createFunctionNode:()=>t2,createGamma:()=>eR,createGasConstant:()=>l3,createGcd:()=>PT,createGetMatrixDataType:()=>qM,createGravitationConstant:()=>CL,createGravity:()=>y3,createHartreeEnergy:()=>jL,createHasNumericValue:()=>BE,createHelp:()=>cO,createHelpClass:()=>B2,createHex:()=>RC,createHypot:()=>SI,createI:()=>DL,createIdentity:()=>HM,createIfft:()=>bC,createIm:()=>_M,createImmutableDenseMatrixClass:()=>WN,createIndex:()=>II,createIndexClass:()=>jN,createIndexNode:()=>jI,createIndexTransform:()=>F3,createInfinity:()=>pL,createIntersect:()=>PO,createInv:()=>gO,createInverseConductanceQuantum:()=>LL,createInvmod:()=>nM,createIsInteger:()=>_E,createIsNaN:()=>LE,createIsNegative:()=>CE,createIsNumeric:()=>FE,createIsPositive:()=>PE,createIsPrime:()=>HC,createIsZero:()=>OE,createKldivergence:()=>oR,createKlitzing:()=>qL,createKron:()=>WM,createLN10:()=>bL,createLN2:()=>yL,createLOG10E:()=>wL,createLOG2E:()=>xL,createLarger:()=>PN,createLargerEq:()=>$N,createLcm:()=>OT,createLeafCount:()=>zR,createLeftShift:()=>vN,createLgamma:()=>rR,createLog:()=>KC,createLog10:()=>LT,createLog1p:()=>tN,createLog2:()=>UT,createLoschmidt:()=>u3,createLsolve:()=>lN,createLsolveAll:()=>mN,createLup:()=>p2,createLusolve:()=>N2,createLyap:()=>FO,createMad:()=>UO,createMagneticConstant:()=>IL,createMagneticFluxQuantum:()=>VL,createMap:()=>yg,createMapSlices:()=>ip,createMapSlicesTransform:()=>S3,createMapTransform:()=>I3,createMatrix:()=>tT,createMatrixClass:()=>iE,createMatrixFromColumns:()=>sT,createMatrixFromFunction:()=>nT,createMatrixFromRows:()=>aT,createMax:()=>Pg,createMaxTransform:()=>P3,createMean:()=>lv,createMeanTransform:()=>$3,createMedian:()=>LO,createMin:()=>$g,createMinTransform:()=>O3,createMod:()=>ug,createMode:()=>MC,createMolarMass:()=>g3,createMolarMassC12:()=>v3,createMolarPlanckConstant:()=>c3,createMolarVolume:()=>f3,createMultinomial:()=>uR,createMultiply:()=>HT,createMultiplyScalar:()=>qT,createNaN:()=>mL,createNeutronMass:()=>XL,createNode:()=>BI,createNorm:()=>TI,createNot:()=>EM,createNthRoot:()=>WT,createNthRoots:()=>nN,createNuclearMagneton:()=>UL,createNull:()=>fL,createNumber:()=>GE,createNumeric:()=>GC,createObjectNode:()=>ZI,createOct:()=>$C,createOnes:()=>jM,createOperatorNode:()=>JI,createOr:()=>mg,createOrTransform:()=>t4,createParenthesisNode:()=>XI,createParse:()=>n2,createParser:()=>c2,createParserClass:()=>u2,createPartitionSelect:()=>UN,createPermutations:()=>fR,createPhi:()=>vL,createPi:()=>dL,createPickRandom:()=>CR,createPinv:()=>yO,createPlanckCharge:()=>_3,createPlanckConstant:()=>NL,createPlanckLength:()=>b3,createPlanckMass:()=>x3,createPlanckTemperature:()=>A3,createPlanckTime:()=>w3,createPolynomialRoot:()=>I2,createPow:()=>ZC,createPrint:()=>Eg,createPrintTransform:()=>K3,createProd:()=>NC,createProtonMass:()=>ZL,createQr:()=>d2,createQuantileSeq:()=>fv,createQuantileSeqTransform:()=>Y3,createQuantumOfCirculation:()=>QL,createRandom:()=>FR,createRandomInt:()=>BR,createRange:()=>_g,createRangeClass:()=>nE,createRangeNode:()=>QI,createRangeTransform:()=>R3,createRationalize:()=>tL,createRe:()=>DM,createReducedPlanckConstant:()=>FL,createRelationalNode:()=>KI,createReplacer:()=>sL,createReshape:()=>XM,createResize:()=>QM,createResolve:()=>ZR,createResultSet:()=>RS,createReviver:()=>oL,createRightArithShift:()=>bN,createRightLogShift:()=>wN,createRotate:()=>eC,createRotationMatrix:()=>rC,createRound:()=>XC,createRow:()=>Ag,createRowTransform:()=>L3,createRydberg:()=>KL,createSQRT1_2:()=>_L,createSQRT2:()=>AL,createSackurTetrode:()=>p3,createSchur:()=>CO,createSec:()=>WF,createSech:()=>jF,createSecondRadiation:()=>m3,createSetCartesian:()=>nI,createSetDifference:()=>aI,createSetDistinct:()=>sI,createSetIntersect:()=>lI,createSetIsSubset:()=>fI,createSetMultiplicity:()=>mI,createSetPowerset:()=>hI,createSetSize:()=>vI,createSetSymDifference:()=>bI,createSetUnion:()=>wI,createSign:()=>jT,createSimplify:()=>GR,createSimplifyConstant:()=>WR,createSimplifyCore:()=>jR,createSin:()=>JF,createSinh:()=>QF,createSize:()=>aC,createSlu:()=>M2,createSmaller:()=>BN,createSmallerEq:()=>kN,createSolveODE:()=>AC,createSort:()=>zN,createSpaClass:()=>JN,createSparse:()=>oF,createSparseMatrixClass:()=>HE,createSpeedOfLight:()=>ML,createSplitUnit:()=>lT,createSqrt:()=>ZT,createSqrtm:()=>SO,createSquare:()=>XT,createSqueeze:()=>sC,createStd:()=>pv,createStdTransform:()=>H3,createStefanBoltzmann:()=>d3,createStirlingS2:()=>PR,createString:()=>jE,createSubset:()=>Dg,createSubsetTransform:()=>V3,createSubtract:()=>KT,createSubtractScalar:()=>xT,createSum:()=>ov,createSumTransform:()=>W3,createSylvester:()=>TO,createSymbolNode:()=>e2,createSymbolicEqual:()=>XR,createTan:()=>eI,createTanh:()=>tI,createTau:()=>hL,createThomsonCrossSection:()=>e3,createTo:()=>qC,createTrace:()=>NI,createTranspose:()=>fC,createTrue:()=>lL,createTypeOf:()=>UE,createTyped:()=>OS,createUnaryMinus:()=>fT,createUnaryPlus:()=>mT,createUnequal:()=>LN,createUnitClass:()=>rF,createUnitFunction:()=>iF,createUppercaseE:()=>EL,createUppercasePi:()=>SL,createUsolve:()=>fN,createUsolveAll:()=>hN,createVacuumImpedance:()=>kL,createVariance:()=>cv,createVarianceTransform:()=>X3,createVersion:()=>TL,createWeakMixingAngle:()=>t3,createWienDisplacement:()=>h3,createXgcd:()=>tM,createXor:()=>CM,createZeros:()=>hC,createZeta:()=>EC,createZpk2tf:()=>nL});var Mx=Tr(Ih(),1);function M(t,e,r,n){function i(a){var o=yS(a,e.map(Dx));return B7(t,e,a),r(o)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function ju(t){return typeof t=="function"&&typeof t.fn=="string"&&Array.isArray(t.dependencies)}function B7(t,e,r){var n=e.filter(a=>!k7(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function k7(t){return t&&t[0]==="?"}function Dx(t){return t&&t[0]==="?"?t.slice(1):t}function He(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function xi(t,e){if(e.number==="bigint")try{BigInt(t)}catch{return e.numberFallback}return e.number}var Ha=Math.sign||function(t){return t>0?1:t<0?-1:0},SS=Math.log2||function(e){return Math.log(e)/Math.LN2},ES=Math.log10||function(e){return Math.log(e)/Math.LN10},Bh=Math.log1p||function(t){return Math.log(t+1)},TS=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},MS=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Sx(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!He(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!He(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var o="";return t<0&&(t=-t,o="-"),"".concat(o).concat(i).concat(t.toString(e)).concat(a)}function go(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=Ex(e);switch(r){case"fixed":return Tx(t,n);case"exponential":return CS(t,n);case"engineering":return P7(t,n);case"bin":return Sx(t,2,i);case"oct":return Sx(t,8,i);case"hex":return Sx(t,16,i);case"auto":return $7(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ex(t){var e="auto",r,n;if(t!==void 0)if(bt(t))r=t;else if(ot(t))r=t.toNumber();else if(ya(t))t.precision!==void 0&&(r=AS(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=AS(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function gc(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(s){return i-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function P7(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=gc(t),n=kh(r,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(bt(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var s=Math.abs(i-o)-(a.length-1),l=0;l<s;l++)a.push(0);for(var u=Math.abs(i-o),c=1;u>0;)c++,u--;var f=a.slice(c).join(""),m=bt(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+m+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function Tx(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=gc(t),n=typeof e=="number"?kh(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(hc(o-i.length))),a<0&&(i=hc(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function CS(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=gc(t),n=e?kh(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(hc(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function $7(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=DS(r?.lowerExp,-3),i=DS(r?.upperExp,5),a=gc(t),o=e?kh(a,e):a;if(o.exponent<n||o.exponent>=i)return CS(t,e);var s=o.coefficients,l=o.exponent;s.length<e&&(s=s.concat(hc(e-s.length))),s=s.concat(hc(l-s.length+1+(s.length<e?e-s.length:0))),s=hc(-l).concat(s);var u=l>0?l:0;return u<s.length-1&&s.splice(u+1,0,"."),o.sign+s.join("")}function kh(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.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),r.exponent++,a++),a--,n[a]++}}return r}function hc(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function NS(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}function zr(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(t)||isNaN(e)?!1:!isFinite(t)||!isFinite(e)?t===e:t===e?!0:Math.abs(t-e)<=Math.max(r*Math.max(Math.abs(t),Math.abs(e)),n)}var FS=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},IS=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},BS=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Ph=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},kS=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},$h=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function PS(t,e){var r=t>0?!0:t<0?!1:1/t===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return r^n?-t:t}function AS(t,e){if(bt(t))return t;if(ot(t))return t.toNumber();e()}function DS(t,e){return bt(t)?t:ot(t)?t.toNumber():e}var $S=function(){return $S=Mx.default.create,Mx.default},O7=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],OS=M("typed",O7,function(e){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=e,o=$S();return o.clear(),o.addTypes([{name:"number",test:bt},{name:"Complex",test:Hn},{name:"BigNumber",test:ot},{name:"bigint",test:Po},{name:"Fraction",test:ba},{name:"Unit",test:En},{name:"identifier",test:s=>Jr&&/^(?:[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-\u1C8A\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-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\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\uDDC0-\uDDF3\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\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\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\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\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\uDFC0-\uDFE0]|\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\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\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\uDDD0-\uDDED\uDDF0\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\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\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-\u1C8A\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-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\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\uDDC0-\uDDF3\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\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\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\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\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\uDFC0-\uDFE0]|\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\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\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\uDDD0-\uDDED\uDDF0\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\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:Jr},{name:"Chain",test:dc},{name:"Array",test:sr},{name:"Matrix",test:Ye},{name:"DenseMatrix",test:ws},{name:"SparseMatrix",test:xa},{name:"Range",test:tu},{name:"Index",test:$o},{name:"boolean",test:bh},{name:"ResultSet",test:xh},{name:"Help",test:mc},{name:"function",test:wh},{name:"Date",test:_h},{name:"RegExp",test:Ah},{name:"null",test:Dh},{name:"undefined",test:Sh},{name:"AccessorNode",test:$i},{name:"ArrayNode",test:Gn},{name:"AssignmentNode",test:Eh},{name:"BlockNode",test:Th},{name:"ConditionalNode",test:Mh},{name:"ConstantNode",test:kt},{name:"FunctionNode",test:ai},{name:"FunctionAssignmentNode",test:za},{name:"IndexNode",test:Xi},{name:"Node",test:Gt},{name:"ObjectNode",test:Oo},{name:"OperatorNode",test:Rr},{name:"ParenthesisNode",test:Wn},{name:"RangeNode",test:Ch},{name:"RelationalNode",test:Nh},{name:"SymbolNode",test:Mr},{name:"Map",test:ko},{name:"Object",test:ya}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||Oh(l),NS(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new r(l)}},{from:"number",to:"Complex",convert:function(l){return n||Rh(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||Rh(l),new n(l.toNumber(),0)}},{from:"bigint",to:"number",convert:function(l){if(l>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+l+")");return Number(l)}},{from:"bigint",to:"BigNumber",convert:function(l){return r||Oh(l),new r(l.toString())}},{from:"bigint",to:"Fraction",convert:function(l){return a||Lh(l),new a(l)}},{from:"Fraction",to:"BigNumber",convert:function(l){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(l){return n||Rh(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||Lh(l);var u=new a(l);if(u.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return u}},{from:"string",to:"number",convert:function(l){var u=Number(l);if(isNaN(u))throw new Error('Cannot convert "'+l+'" to a number');return u}},{from:"string",to:"BigNumber",convert:function(l){r||Oh(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(l){try{return BigInt(l)}catch{throw new Error('Cannot convert "'+l+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(l){a||Lh(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||Rh(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return r||Oh(l),new r(+l)}},{from:"boolean",to:"bigint",convert:function(l){return BigInt(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||Lh(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||R7(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&rn(l[0])&&u.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&rn(l[0])&&u.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o});function Oh(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function Rh(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function R7(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Lh(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var L7="ResultSet",V7=[],RS=M(L7,V7,()=>{function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0});var vc=9e15,au=1e9,Cx="0123456789abcdef",qh="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",zh="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Nx={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-vc,maxE:vc,crypto:!1},qS,As,Qt=!0,Gh="[DecimalError] ",iu=Gh+"Invalid argument: ",zS=Gh+"Precision limit exceeded",HS=Gh+"crypto unavailable",GS="[object Decimal]",wi=Math.floor,Yn=Math.pow,U7=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,q7=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,z7=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,WS=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,vo=1e7,Ot=7,H7=9007199254740991,G7=qh.length-1,Fx=zh.length-1,$e={toStringTag:GS};$e.absoluteValue=$e.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ct(t)};$e.ceil=function(){return Ct(new this.constructor(this),this.e+1,2)};$e.clampedTo=$e.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(iu+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};$e.comparedTo=$e.cmp=function(t){var e,r,n,i,a=this,o=a.d,s=(t=new a.constructor(t)).d,l=a.s,u=t.s;if(!o||!s)return!l||!u?NaN:l!==u?l:o===s?0:!o^l<0?1:-1;if(!o[0]||!s[0])return o[0]?l:s[0]?-u:0;if(l!==u)return l;if(a.e!==t.e)return a.e>t.e^l<0?1:-1;for(n=o.length,i=s.length,e=0,r=n<i?n:i;e<r;++e)if(o[e]!==s[e])return o[e]>s[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};$e.cosine=$e.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=W7(n,XS(n,r)),n.precision=t,n.rounding=e,Ct(As==2||As==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};$e.cubeRoot=$e.cbrt=function(){var t,e,r,n,i,a,o,s,l,u,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Qt=!1,a=c.s*Yn(c.s*c,1/3),!a||Math.abs(a)==1/0?(r=oi(c.d),t=c.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=Yn(r,1/3),t=wi((t+1)/3)-(t%3==(t<0?-1:2)),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new f(r),n.s=c.s):n=new f(a.toString()),o=(t=f.precision)+3;;)if(s=n,l=s.times(s).times(s),u=l.plus(c),n=Zr(u.plus(c).times(s),u.plus(l),o+2,1),oi(s.d).slice(0,o)===(r=oi(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ct(s,t+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Ct(n,t+1,1),e=!n.times(n).times(n).eq(c));break}return Qt=!0,Ct(n,t,f.rounding,e)};$e.decimalPlaces=$e.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-wi(this.e/Ot))*Ot,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};$e.dividedBy=$e.div=function(t){return Zr(this,new this.constructor(t))};$e.dividedToIntegerBy=$e.divToInt=function(t){var e=this,r=e.constructor;return Ct(Zr(e,new r(t),0,1,1),r.precision,r.rounding)};$e.equals=$e.eq=function(t){return this.cmp(t)===0};$e.floor=function(){return Ct(new this.constructor(this),this.e+1,3)};$e.greaterThan=$e.gt=function(t){return this.cmp(t)>0};$e.greaterThanOrEqualTo=$e.gte=function(t){var e=this.cmp(t);return e==1||e===0};$e.hyperbolicCosine=$e.cosh=function(){var t,e,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(t=Math.ceil(i/3),e=(1/Yh(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=yc(o,1,a.times(e),new o(1),!0);for(var l,u=t,c=new o(8);u--;)l=a.times(a),a=s.minus(l.times(c.minus(l.times(c))));return Ct(a,o.precision=r,o.rounding=n,!0)};$e.hyperbolicSine=$e.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=yc(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Yh(5,t)),i=yc(a,2,i,i,!0);for(var o,s=new a(5),l=new a(16),u=new a(20);t--;)o=i.times(i),i=i.times(s.plus(o.times(l.times(o).plus(u))))}return a.precision=e,a.rounding=r,Ct(i,e,r,!0)};$e.hyperbolicTangent=$e.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,Zr(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};$e.inverseCosine=$e.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,i=e.rounding;return r!==-1?r===0?t.isNeg()?Ro(e,n,i):new e(0):new e(NaN):t.isZero()?Ro(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,t.times(2))};$e.inverseHyperbolicCosine=$e.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Qt=!1,r=r.times(r).minus(1).sqrt().plus(r),Qt=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};$e.inverseHyperbolicSine=$e.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Qt=!1,r=r.times(r).plus(1).sqrt().plus(r),Qt=!0,n.precision=t,n.rounding=e,r.ln())};$e.inverseHyperbolicTangent=$e.atanh=function(){var t,e,r,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):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Ct(new a(i),t,e,!0):(a.precision=r=n-i.e,i=Zr(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)};$e.inverseSine=$e.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,e!==-1?e===0?(t=Ro(a,r+4,n).times(.5),t.s=i.s,t):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))};$e.inverseTangent=$e.atan=function(){var t,e,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,m=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&f+4<=Fx)return o=Ro(c,f+4,m).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(f+4<=Fx)return o=Ro(c,f+4,m).times(.5),o.s=u.s,o}for(c.precision=s=f+10,c.rounding=1,r=Math.min(28,s/Ot+2|0),t=r;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Qt=!1,e=Math.ceil(s/Ot),n=1,l=u.times(u),o=new c(u),i=u;t!==-1;)if(i=i.times(l),a=o.minus(i.div(n+=2)),i=i.times(l),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(t=e;o.d[t]===a.d[t]&&t--;);return r&&(o=o.times(2<<r-1)),Qt=!0,Ct(o,c.precision=f,c.rounding=m,!0)};$e.isFinite=function(){return!!this.d};$e.isInteger=$e.isInt=function(){return!!this.d&&wi(this.e/Ot)>this.d.length-2};$e.isNaN=function(){return!this.s};$e.isNegative=$e.isNeg=function(){return this.s<0};$e.isPositive=$e.isPos=function(){return this.s>0};$e.isZero=function(){return!!this.d&&this.d[0]===0};$e.lessThan=$e.lt=function(t){return this.cmp(t)<0};$e.lessThanOrEqualTo=$e.lte=function(t){return this.cmp(t)<1};$e.logarithm=$e.log=function(t){var e,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,m=c.rounding,p=5;if(t==null)t=new c(10),e=!0;else{if(t=new c(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(Qt=!1,s=f+p,o=nu(u,s),n=e?Hh(c,s+10):nu(t,s),l=Zr(o,n,s,1),Wf(l.d,i=f,m))do if(s+=10,o=nu(u,s),n=e?Hh(c,s+10):nu(t,s),l=Zr(o,n,s,1),!a){+oi(l.d).slice(i+1,i+15)+1==1e14&&(l=Ct(l,f+1,0));break}while(Wf(l.d,i+=10,m));return Qt=!0,Ct(l,f,m)};$e.minus=$e.sub=function(t){var e,r,n,i,a,o,s,l,u,c,f,m,p=this,d=p.constructor;if(t=new d(t),!p.d||!t.d)return!p.s||!t.s?t=new d(NaN):p.d?t.s=-t.s:t=new d(t.d||p.s!==t.s?p:NaN),t;if(p.s!=t.s)return t.s=-t.s,p.plus(t);if(u=p.d,m=t.d,s=d.precision,l=d.rounding,!u[0]||!m[0]){if(m[0])t.s=-t.s;else if(u[0])t=new d(p);else return new d(l===3?-0:0);return Qt?Ct(t,s,l):t}if(r=wi(t.e/Ot),c=wi(p.e/Ot),u=u.slice(),a=c-r,a){for(f=a<0,f?(e=u,a=-a,o=m.length):(e=m,r=c,o=u.length),n=Math.max(Math.ceil(s/Ot),o)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=u.length,o=m.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=m[n]){f=u[n]<m[n];break}a=0}for(f&&(e=u,u=m,m=e,t.s=-t.s),o=u.length,n=m.length-o;n>0;--n)u[o++]=0;for(n=m.length;n>a;){if(u[--n]<m[n]){for(i=n;i&&u[--i]===0;)u[i]=vo-1;--u[i],u[n]+=vo}u[n]-=m[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(t.d=u,t.e=Wh(u,r),Qt?Ct(t,s,l):t):new d(l===3?-0:0)};$e.modulo=$e.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Ct(new n(r),n.precision,n.rounding):(Qt=!1,n.modulo==9?(e=Zr(r,t.abs(),0,3,1),e.s*=t.s):e=Zr(r,t,0,n.modulo,1),e=e.times(t),Qt=!0,r.minus(e))};$e.naturalExponential=$e.exp=function(){return Ix(this)};$e.naturalLogarithm=$e.ln=function(){return nu(this)};$e.negated=$e.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ct(t)};$e.plus=$e.add=function(t){var e,r,n,i,a,o,s,l,u,c,f=this,m=f.constructor;if(t=new m(t),!f.d||!t.d)return!f.s||!t.s?t=new m(NaN):f.d||(t=new m(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(u=f.d,c=t.d,s=m.precision,l=m.rounding,!u[0]||!c[0])return c[0]||(t=new m(f)),Qt?Ct(t,s,l):t;if(a=wi(f.e/Ot),n=wi(t.e/Ot),u=u.slice(),i=a-n,i){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),a=Math.ceil(s/Ot),o=a>o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=c.length,o-i<0&&(i=o,r=c,c=u,u=r),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/vo|0,u[i]%=vo;for(e&&(u.unshift(e),++n),o=u.length;u[--o]==0;)u.pop();return t.d=u,t.e=Wh(u,n),Qt?Ct(t,s,l):t};$e.precision=$e.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(iu+t);return r.d?(e=YS(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};$e.round=function(){var t=this,e=t.constructor;return Ct(new e(t),t.e+1,e.rounding)};$e.sine=$e.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ot,n.rounding=1,r=j7(n,XS(n,r)),n.precision=t,n.rounding=e,Ct(As>2?r.neg():r,t,e,!0)):new n(NaN)};$e.squareRoot=$e.sqrt=function(){var t,e,r,n,i,a,o=this,s=o.d,l=o.e,u=o.s,c=o.constructor;if(u!==1||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(Qt=!1,u=Math.sqrt(+o),u==0||u==1/0?(e=oi(s),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=wi((l+1)/2)-(l<0||l%2),u==1/0?e="5e"+l:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new c(e)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(a=n,n=a.plus(Zr(o,a,r+2,1)).times(.5),oi(a.d).slice(0,r)===(e=oi(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Ct(a,l+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ct(n,l+1,1),t=!n.times(n).eq(o));break}return Qt=!0,Ct(n,l,c.rounding,t)};$e.tangent=$e.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=Zr(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ct(As==2||As==4?r.neg():r,t,e,!0)):new n(NaN)};$e.times=$e.mul=function(t){var e,r,n,i,a,o,s,l,u,c=this,f=c.constructor,m=c.d,p=(t=new f(t)).d;if(t.s*=c.s,!m||!m[0]||!p||!p[0])return new f(!t.s||m&&!m[0]&&!p||p&&!p[0]&&!m?NaN:!m||!p?t.s/0:t.s*0);for(r=wi(c.e/Ot)+wi(t.e/Ot),l=m.length,u=p.length,l<u&&(a=m,m=p,p=a,o=l,l=u,u=o),a=[],o=l+u,n=o;n--;)a.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)s=a[i]+p[n]*m[i-n-1]+e,a[i--]=s%vo|0,e=s/vo|0;a[i]=(a[i]+e)%vo|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=Wh(a,r),Qt?Ct(t,f.precision,f.rounding):t};$e.toBinary=function(t,e){return Bx(this,2,t,e)};$e.toDecimalPlaces=$e.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Ki(t,0,au),e===void 0?e=n.rounding:Ki(e,0,8),Ct(r,t+r.e+1,e))};$e.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Lo(n,!0):(Ki(t,0,au),e===void 0?e=i.rounding:Ki(e,0,8),n=Ct(new i(n),t+1,e),r=Lo(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};$e.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=Lo(i):(Ki(t,0,au),e===void 0?e=a.rounding:Ki(e,0,8),n=Ct(new a(i),t+i.e+1,e),r=Lo(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};$e.toFraction=function(t){var e,r,n,i,a,o,s,l,u,c,f,m,p=this,d=p.d,h=p.constructor;if(!d)return new h(p);if(u=r=new h(1),n=l=new h(0),e=new h(n),a=e.e=YS(d)-p.e-1,o=a%Ot,e.d[0]=Yn(10,o<0?Ot+o:o),t==null)t=a>0?e:u;else{if(s=new h(t),!s.isInt()||s.lt(u))throw Error(iu+s);t=s.gt(e)?a>0?e:u:s}for(Qt=!1,s=new h(oi(d)),c=h.precision,h.precision=a=d.length*Ot*2;f=Zr(s,e,0,1,1),i=r.plus(f.times(n)),i.cmp(t)!=1;)r=n,n=i,i=u,u=l.plus(f.times(i)),l=i,i=e,e=s.minus(f.times(i)),s=i;return i=Zr(t.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=p.s,m=Zr(u,n,a,1).minus(p).abs().cmp(Zr(l,r,a,1).minus(p).abs())<1?[u,n]:[l,r],h.precision=c,Qt=!0,m};$e.toHexadecimal=$e.toHex=function(t,e){return Bx(this,16,t,e)};$e.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:Ki(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(Qt=!1,r=Zr(r,t,0,e,1).times(t),Qt=!0,Ct(r)):(t.s=r.s,r=t),r};$e.toNumber=function(){return+this};$e.toOctal=function(t,e){return Bx(this,8,t,e)};$e.toPower=$e.pow=function(t){var e,r,n,i,a,o,s=this,l=s.constructor,u=+(t=new l(t));if(!s.d||!t.d||!s.d[0]||!t.d[0])return new l(Yn(+s,u));if(s=new l(s),s.eq(1))return s;if(n=l.precision,a=l.rounding,t.eq(1))return Ct(s,n,a);if(e=wi(t.e/Ot),e>=t.d.length-1&&(r=u<0?-u:u)<=H7)return i=jS(l,s,r,n),t.s<0?new l(1).div(i):Ct(i,n,a);if(o=s.s,o<0){if(e<t.d.length-1)return new l(NaN);if((t.d[e]&1)==0&&(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return r=Yn(+s,u),e=r==0||!isFinite(r)?wi(u*(Math.log("0."+oi(s.d))/Math.LN10+s.e+1)):new l(r+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?o/0:0):(Qt=!1,l.rounding=s.s=1,r=Math.min(12,(e+"").length),i=Ix(t.times(nu(s,n+r)),n),i.d&&(i=Ct(i,n+5,1),Wf(i.d,n,a)&&(e=n+10,i=Ct(Ix(t.times(nu(s,e+r)),e),e+5,1),+oi(i.d).slice(n+1,n+15)+1==1e14&&(i=Ct(i,n+1,0)))),i.s=o,Qt=!0,l.rounding=a,Ct(i,n,a))};$e.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Lo(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ki(t,1,au),e===void 0?e=i.rounding:Ki(e,0,8),n=Ct(new i(n),t,e),r=Lo(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};$e.toSignificantDigits=$e.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Ki(t,1,au),e===void 0?e=n.rounding:Ki(e,0,8)),Ct(new n(r),t,e)};$e.toString=function(){var t=this,e=t.constructor,r=Lo(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};$e.truncated=$e.trunc=function(){return Ct(new this.constructor(this),this.e+1,1)};$e.valueOf=$e.toJSON=function(){var t=this,e=t.constructor,r=Lo(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function oi(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=Ot-n.length,r&&(a+=ru(r)),a+=n;o=t[e],n=o+"",r=Ot-n.length,r&&(a+=ru(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Ki(t,e,r){if(t!==~~t||t<e||t>r)throw Error(iu+t)}function Wf(t,e,r,n){var i,a,o,s;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=Ot,i=0):(i=Math.ceil((e+1)/Ot),e%=Ot),a=Yn(10,Ot-e),s=t[i]%a|0,n==null?e<3?(e==0?s=s/100|0:e==1&&(s=s/10|0),o=r<4&&s==99999||r>3&&s==49999||s==5e4||s==0):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(t[i+1]/a/100|0)==Yn(10,e-2)-1||(s==a/2||s==0)&&(t[i+1]/a/100|0)==0:e<4?(e==0?s=s/1e3|0:e==1?s=s/100|0:e==2&&(s=s/10|0),o=(n||r<4)&&s==9999||!n&&r>3&&s==4999):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(t[i+1]/a/1e3|0)==Yn(10,e-3)-1,o}function Vh(t,e,r){for(var n,i=[0],a,o=0,s=t.length;o<s;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Cx.indexOf(t.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function W7(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Yh(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=yc(t,1,e.times(i),new t(1));for(var a=r;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return t.precision-=r,e}var Zr=function(){function t(n,i,a){var o,s=0,l=n.length;for(n=n.slice();l--;)o=n[l]*i+s,n[l]=o%a|0,s=o/a|0;return s&&n.unshift(s),n}function e(n,i,a,o){var s,l;if(a!=o)l=a>o?1:-1;else for(s=l=0;s<a;s++)if(n[s]!=i[s]){l=n[s]>i[s]?1:-1;break}return l}function r(n,i,a,o){for(var s=0;a--;)n[a]-=s,s=n[a]<i[a]?1:0,n[a]=s*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,s,l){var u,c,f,m,p,d,h,b,y,D,v,A,w,x,E,T,_,C,N,I,R=n.constructor,L=n.s==i.s?1:-1,V=n.d,P=i.d;if(!V||!V[0]||!P||!P[0])return new R(!n.s||!i.s||(V?P&&V[0]==P[0]:!P)?NaN:V&&V[0]==0||!P?L*0:L/0);for(l?(p=1,c=n.e-i.e):(l=vo,p=Ot,c=wi(n.e/p)-wi(i.e/p)),N=P.length,_=V.length,y=new R(L),D=y.d=[],f=0;P[f]==(V[f]||0);f++);if(P[f]>(V[f]||0)&&c--,a==null?(x=a=R.precision,o=R.rounding):s?x=a+(n.e-i.e)+1:x=a,x<0)D.push(1),d=!0;else{if(x=x/p+2|0,f=0,N==1){for(m=0,P=P[0],x++;(f<_||m)&&x--;f++)E=m*l+(V[f]||0),D[f]=E/P|0,m=E%P|0;d=m||f<_}else{for(m=l/(P[0]+1)|0,m>1&&(P=t(P,m,l),V=t(V,m,l),N=P.length,_=V.length),T=N,v=V.slice(0,N),A=v.length;A<N;)v[A++]=0;I=P.slice(),I.unshift(0),C=P[0],P[1]>=l/2&&++C;do m=0,u=e(P,v,N,A),u<0?(w=v[0],N!=A&&(w=w*l+(v[1]||0)),m=w/C|0,m>1?(m>=l&&(m=l-1),h=t(P,m,l),b=h.length,A=v.length,u=e(h,v,b,A),u==1&&(m--,r(h,N<b?I:P,b,l))):(m==0&&(u=m=1),h=P.slice()),b=h.length,b<A&&h.unshift(0),r(v,h,A,l),u==-1&&(A=v.length,u=e(P,v,N,A),u<1&&(m++,r(v,N<A?I:P,A,l))),A=v.length):u===0&&(m++,v=[0]),D[f++]=m,u&&v[0]?v[A++]=V[T]||0:(v=[V[T]],A=1);while((T++<_||v[0]!==void 0)&&x--);d=v[0]!==void 0}D[0]||D.shift()}if(p==1)y.e=c,qS=d;else{for(f=1,m=D[0];m>=10;m/=10)f++;y.e=f+c*p-1,Ct(y,s?a+y.e+1:a,o,d)}return y}}();function Ct(t,e,r,n){var i,a,o,s,l,u,c,f,m,p=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,s=f[0];s>=10;s/=10)i++;if(a=e-i,a<0)a+=Ot,o=e,c=f[m=0],l=c/Yn(10,i-o-1)%10|0;else if(m=Math.ceil((a+1)/Ot),s=f.length,m>=s)if(n){for(;s++<=m;)f.push(0);c=l=0,i=1,a%=Ot,o=a-Ot+1}else break e;else{for(c=s=f[m],i=1;s>=10;s/=10)i++;a%=Ot,o=a-Ot+i,l=o<0?0:c/Yn(10,i-o-1)%10|0}if(n=n||e<0||f[m+1]!==void 0||(o<0?c:c%Yn(10,i-o-1)),u=r<4?(l||n)&&(r==0||r==(t.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(a>0?o>0?c/Yn(10,i-o):0:f[m-1])%10&1||r==(t.s<0?8:7)),e<1||!f[0])return f.length=0,u?(e-=t.e+1,f[0]=Yn(10,(Ot-e%Ot)%Ot),t.e=-e||0):f[0]=t.e=0,t;if(a==0?(f.length=m,s=1,m--):(f.length=m+1,s=Yn(10,Ot-a),f[m]=o>0?(c/Yn(10,i-o)%Yn(10,o)|0)*s:0),u)for(;;)if(m==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(t.e++,f[0]==vo&&(f[0]=1));break}else{if(f[m]+=s,f[m]!=vo)break;f[m--]=0,s=1}for(a=f.length;f[--a]===0;)f.pop()}return Qt&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function Lo(t,e,r){if(!t.isFinite())return JS(t);var n,i=t.e,a=oi(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+ru(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+ru(-i-1)+a,r&&(n=r-o)>0&&(a+=ru(n))):i>=o?(a+=ru(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+ru(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=ru(n))),a}function Wh(t,e){var r=t[0];for(e*=Ot;r>=10;r/=10)e++;return e}function Hh(t,e,r){if(e>G7)throw Qt=!0,r&&(t.precision=r),Error(zS);return Ct(new t(qh),e,1,!0)}function Ro(t,e,r){if(e>Fx)throw Error(zS);return Ct(new t(zh),e,r,!0)}function YS(t){var e=t.length-1,r=e*Ot+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function ru(t){for(var e="";t--;)e+="0";return e}function jS(t,e,r,n){var i,a=new t(1),o=Math.ceil(n/Ot+4);for(Qt=!1;;){if(r%2&&(a=a.times(e),VS(a.d,o)&&(i=!0)),r=wi(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),VS(e.d,o)}return Qt=!0,a}function LS(t){return t.d[t.d.length-1]&1}function ZS(t,e,r){for(var n,i,a=new t(e[0]),o=0;++o<e.length;){if(i=new t(e[o]),!i.s){a=i;break}n=a.cmp(i),(n===r||n===0&&a.s===r)&&(a=i)}return a}function Ix(t,e){var r,n,i,a,o,s,l,u=0,c=0,f=0,m=t.constructor,p=m.rounding,d=m.precision;if(!t.d||!t.d[0]||t.e>17)return new m(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(Qt=!1,l=d):l=e,s=new m(.03125);t.e>-2;)t=t.times(s),f+=5;for(n=Math.log(Yn(2,f))/Math.LN10*2+5|0,l+=n,r=a=o=new m(1),m.precision=l;;){if(a=Ct(a.times(t),l,1),r=r.times(++c),s=o.plus(Zr(a,r,l,1)),oi(s.d).slice(0,l)===oi(o.d).slice(0,l)){for(i=f;i--;)o=Ct(o.times(o),l,1);if(e==null)if(u<3&&Wf(o.d,l-n,p,u))m.precision=l+=10,r=a=s=new m(1),c=0,u++;else return Ct(o,m.precision=d,p,Qt=!0);else return m.precision=d,o}o=s}}function nu(t,e){var r,n,i,a,o,s,l,u,c,f,m,p=1,d=10,h=t,b=h.d,y=h.constructor,D=y.rounding,v=y.precision;if(h.s<0||!b||!b[0]||!h.e&&b[0]==1&&b.length==1)return new y(b&&!b[0]?-1/0:h.s!=1?NaN:b?0:h);if(e==null?(Qt=!1,c=v):c=e,y.precision=c+=d,r=oi(b),n=r.charAt(0),Math.abs(a=h.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(t),r=oi(h.d),n=r.charAt(0),p++;a=h.e,n>1?(h=new y("0."+r),a++):h=new y(n+"."+r.slice(1))}else return u=Hh(y,c+2,v).times(a+""),h=nu(new y(n+"."+r.slice(1)),c-d).plus(u),y.precision=v,e==null?Ct(h,v,D,Qt=!0):h;for(f=h,l=o=h=Zr(h.minus(1),h.plus(1),c,1),m=Ct(h.times(h),c,1),i=3;;){if(o=Ct(o.times(m),c,1),u=l.plus(Zr(o,new y(i),c,1)),oi(u.d).slice(0,c)===oi(l.d).slice(0,c))if(l=l.times(2),a!==0&&(l=l.plus(Hh(y,c+2,v).times(a+""))),l=Zr(l,new y(p),c,1),e==null)if(Wf(l.d,c-d,D,s))y.precision=c+=d,u=o=h=Zr(f.minus(1),f.plus(1),c,1),m=Ct(h.times(h),c,1),i=s=1;else return Ct(l,y.precision=v,D,Qt=!0);else return y.precision=v,l;l=u,i+=2}}function JS(t){return String(t.s*t.s/0)}function Uh(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=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,t.e=r=r-n-1,t.d=[],n=(r+1)%Ot,r<0&&(n+=Ot),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Ot;n<i;)t.d.push(+e.slice(n,n+=Ot));e=e.slice(n),n=Ot-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),Qt&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Y7(t,e){var r,n,i,a,o,s,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),WS.test(e))return Uh(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(q7.test(e))r=16,e=e.toLowerCase();else if(U7.test(e))r=2;else if(z7.test(e))r=8;else throw Error(iu+e);for(a=e.search(/p/i),a>0?(l=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,n=t.constructor,o&&(e=e.replace(".",""),s=e.length,a=s-a,i=jS(n,new n(r),a,a*2)),u=Vh(e,r,vo),c=u.length-1,a=c;u[a]===0;--a)u.pop();return a<0?new n(t.s*0):(t.e=Wh(u,c),t.d=u,Qt=!1,o&&(t=Zr(t,i,s*4)),l&&(t=t.times(Math.abs(l)<54?Yn(2,l):Yf.pow(2,l))),Qt=!0,t)}function j7(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:yc(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Yh(5,r)),e=yc(t,2,e,e);for(var i,a=new t(5),o=new t(16),s=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(s))));return e}function yc(t,e,r,n,i){var a,o,s,l,u=1,c=t.precision,f=Math.ceil(c/Ot);for(Qt=!1,l=r.times(r),s=new t(n);;){if(o=Zr(s.times(l),new t(e++*e++),c,1),s=i?n.plus(o):n.minus(o),n=Zr(o.times(l),new t(e++*e++),c,1),o=s.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=n,n=o,o=a,u++}return Qt=!0,o.d.length=f+1,o}function Yh(t,e){for(var r=t;--e;)r*=t;return r}function XS(t,e){var r,n=e.s<0,i=Ro(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return As=n?4:1,e;if(r=e.divToInt(i),r.isZero())As=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return As=LS(r)?n?2:3:n?4:1,e;As=LS(r)?n?1:4:n?3:2}return e.minus(i).abs()}function Bx(t,e,r,n){var i,a,o,s,l,u,c,f,m,p=t.constructor,d=r!==void 0;if(d?(Ki(r,1,au),n===void 0?n=p.rounding:Ki(n,0,8)):(r=p.precision,n=p.rounding),!t.isFinite())c=JS(t);else{for(c=Lo(t),o=c.indexOf("."),d?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,o>=0&&(c=c.replace(".",""),m=new p(1),m.e=c.length-o,m.d=Vh(Lo(m),10,i),m.e=m.d.length),f=Vh(c,10,i),a=l=f.length;f[--l]==0;)f.pop();if(!f[0])c=d?"0p+0":"0";else{if(o<0?a--:(t=new p(t),t.d=f,t.e=a,t=Zr(t,m,r,n,0,i),f=t.d,a=t.e,u=qS),o=f[r],s=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(t.s<0?3:2)):o>s||o===s&&(n===4||u||n===6&&f[r-1]&1||n===(t.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(l=f.length;!f[l-1];--l);for(o=0,c="";o<l;o++)c+=Cx.charAt(f[o]);if(d){if(l>1)if(e==16||e==8){for(o=e==16?4:3,--l;l%o;l++)c+="0";for(f=Vh(c,i,e),l=f.length;!f[l-1];--l);for(o=1,c="1.";o<l;o++)c+=Cx.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>l)for(a-=l;a--;)c+="0";else a<l&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return t.s<0?"-"+c:c}function VS(t,e){if(t.length>e)return t.length=e,!0}function Z7(t){return new this(t).abs()}function J7(t){return new this(t).acos()}function X7(t){return new this(t).acosh()}function Q7(t,e){return new this(t).plus(e)}function K7(t){return new this(t).asin()}function eH(t){return new this(t).asinh()}function tH(t){return new this(t).atan()}function rH(t){return new this(t).atanh()}function nH(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=Ro(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Ro(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Ro(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(Zr(t,e,a,1)),e=Ro(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(Zr(t,e,a,1)),r}function iH(t){return new this(t).cbrt()}function aH(t){return Ct(t=new this(t),t.e+1,2)}function oH(t,e,r){return new this(t).clamp(e,r)}function sH(t){if(!t||typeof t!="object")throw Error(Gh+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,au,"rounding",0,8,"toExpNeg",-vc,0,"toExpPos",0,vc,"maxE",0,vc,"minE",-vc,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=Nx[r]),(n=t[r])!==void 0)if(wi(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(iu+r+": "+n);if(r="crypto",i&&(this[r]=Nx[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(HS);else this[r]=!1;else throw Error(iu+r+": "+n);return this}function uH(t){return new this(t).cos()}function lH(t){return new this(t).cosh()}function QS(t){var e,r,n;function i(a){var o,s,l,u=this;if(!(u instanceof i))return new i(a);if(u.constructor=i,US(a)){u.s=a.s,Qt?!a.d||a.e>i.maxE?(u.e=NaN,u.d=null):a.e<i.minE?(u.e=0,u.d=[0]):(u.e=a.e,u.d=a.d.slice()):(u.e=a.e,u.d=a.d?a.d.slice():a.d);return}if(l=typeof a,l==="number"){if(a===0){u.s=1/a<0?-1:1,u.e=0,u.d=[0];return}if(a<0?(a=-a,u.s=-1):u.s=1,a===~~a&&a<1e7){for(o=0,s=a;s>=10;s/=10)o++;Qt?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[a]):(u.e=o,u.d=[a]);return}if(a*0!==0){a||(u.s=NaN),u.e=NaN,u.d=null;return}return Uh(u,a.toString())}if(l==="string")return(s=a.charCodeAt(0))===45?(a=a.slice(1),u.s=-1):(s===43&&(a=a.slice(1)),u.s=1),WS.test(a)?Uh(u,a):Y7(u,a);if(l==="bigint")return a<0?(a=-a,u.s=-1):u.s=1,Uh(u,a.toString());throw Error(iu+a)}if(i.prototype=$e,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=sH,i.clone=QS,i.isDecimal=US,i.abs=Z7,i.acos=J7,i.acosh=X7,i.add=Q7,i.asin=K7,i.asinh=eH,i.atan=tH,i.atanh=rH,i.atan2=nH,i.cbrt=iH,i.ceil=aH,i.clamp=oH,i.cos=uH,i.cosh=lH,i.div=cH,i.exp=fH,i.floor=pH,i.hypot=mH,i.ln=dH,i.log=hH,i.log10=vH,i.log2=gH,i.max=yH,i.min=bH,i.mod=xH,i.mul=wH,i.pow=_H,i.random=AH,i.round=DH,i.sign=SH,i.sin=EH,i.sinh=TH,i.sqrt=MH,i.sub=CH,i.sum=NH,i.tan=FH,i.tanh=IH,i.trunc=BH,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function cH(t,e){return new this(t).div(e)}function fH(t){return new this(t).exp()}function pH(t){return Ct(t=new this(t),t.e+1,3)}function mH(){var t,e,r=new this(0);for(Qt=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return Qt=!0,new this(1/0);r=e}return Qt=!0,r.sqrt()}function US(t){return t instanceof Yf||t&&t.toStringTag===GS||!1}function dH(t){return new this(t).ln()}function hH(t,e){return new this(t).log(e)}function gH(t){return new this(t).log(2)}function vH(t){return new this(t).log(10)}function yH(){return ZS(this,arguments,-1)}function bH(){return ZS(this,arguments,1)}function xH(t,e){return new this(t).mod(e)}function wH(t,e){return new this(t).mul(e)}function _H(t,e){return new this(t).pow(e)}function AH(t){var e,r,n,i,a=0,o=new this(1),s=[];if(t===void 0?t=this.precision:Ki(t,1,au),n=Math.ceil(t/Ot),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]:s[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):(s.push(i%1e7),a+=4);a=n/4}else throw Error(HS);else for(;a<n;)s[a++]=Math.random()*1e7|0;for(n=s[--a],t%=Ot,n&&t&&(i=Yn(10,Ot-t),s[a]=(n/i|0)*i);s[a]===0;a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;s[0]===0;r-=Ot)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<Ot&&(r-=Ot-n)}return o.e=r,o.d=s,o}function DH(t){return Ct(t=new this(t),t.e+1,this.rounding)}function SH(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function EH(t){return new this(t).sin()}function TH(t){return new this(t).sinh()}function MH(t){return new this(t).sqrt()}function CH(t,e){return new this(t).sub(e)}function NH(){var t=0,e=arguments,r=new this(e[t]);for(Qt=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return Qt=!0,Ct(r,this.precision,this.rounding)}function FH(t){return new this(t).tan()}function IH(t){return new this(t).tanh()}function BH(t){return Ct(t=new this(t),t.e+1,1)}$e[Symbol.for("nodejs.util.inspect.custom")]=$e.toString;$e[Symbol.toStringTag]="Decimal";var Yf=$e.constructor=QS(Nx);qh=new Yf(qh);zh=new Yf(zh);var Zu=Yf;var kH="BigNumber",PH=["?on","config"],KS=M(kH,PH,t=>{var{on:e,config:r}=t,n=Zu.clone({precision:r.precision,modulo:Zu.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 _i=Math.cosh||function(t){return Math.abs(t)<1e-9?1-t:(Math.exp(t)+Math.exp(-t))*.5},Ga=Math.sinh||function(t){return Math.abs(t)<1e-9?t:(Math.exp(t)-Math.exp(-t))*.5},$H=function(t){let e=Math.PI/4;if(-e>t||t>e)return Math.cos(t)-1;let r=t*t;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},kx=function(t,e){return t=Math.abs(t),e=Math.abs(e),t<e&&([t,e]=[e,t]),t<1e8?Math.sqrt(t*t+e*e):(e/=t,t*Math.sqrt(1+e*e))},bc=function(){throw SyntaxError("Invalid Param")};function Px(t,e){let r=Math.abs(t),n=Math.abs(e);return t===0?Math.log(n):e===0?Math.log(r):r<3e3&&n<3e3?Math.log(t*t+e*e)*.5:(t=t*.5,e=e*.5,.5*Math.log(t*t+e*e)+Math.LN2)}var OH={re:0,im:0},Ju=function(t,e){let r=OH;if(t==null)r.re=r.im=0;else if(e!==void 0)r.re=t,r.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)r.re=t.re,r.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return Fe.INFINITY;r.re=t.abs*Math.cos(t.arg),r.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return Fe.INFINITY;r.re=t.r*Math.cos(t.phi),r.im=t.r*Math.sin(t.phi)}else t.length===2?(r.re=t[0],r.im=t[1]):bc();break;case"string":r.im=r.re=0;let n=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;n===null&&bc();for(let o=0;o<n.length;o++){let s=n[o];s===" "||s===" "||s===`
`||(s==="+"?i++:s==="-"?a++:s==="i"||s==="I"?(i+a===0&&bc(),n[o+1]!==" "&&!isNaN(n[o+1])?(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++):r.im+=parseFloat((a%2?"-":"")+"1"),i=a=0):((i+a===0||isNaN(s))&&bc(),n[o+1]==="i"||n[o+1]==="I"?(r.im+=parseFloat((a%2?"-":"")+s),o++):r.re+=parseFloat((a%2?"-":"")+s),i=a=0))}i+a>0&&bc();break;case"number":r.im=0,r.re=t;break;default:bc()}return isNaN(r.re)||isNaN(r.im),r};function Fe(t,e){if(!(this instanceof Fe))return new Fe(t,e);let r=Ju(t,e);this.re=r.re,this.im=r.im}Fe.prototype={re:0,im:0,sign:function(){let t=kx(this.re,this.im);return new Fe(this.re/t,this.im/t)},add:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Fe.NAN:Fe.INFINITY:new Fe(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Fe.NAN:Fe.INFINITY:new Fe(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;return n&&o||i&&a?Fe.NAN:n||i?Fe.INFINITY:r.im===0&&this.im===0?new Fe(this.re*r.re,0):new Fe(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;if(a&&o||n&&i)return Fe.NAN;if(o||n)return Fe.INFINITY;if(a||i)return Fe.ZERO;if(r.im===0)return new Fe(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,l=r.re*s+r.im;return new Fe((this.re*s+this.im)/l,(this.im*s-this.re)/l)}else{let s=r.im/r.re,l=r.im*s+r.re;return new Fe((this.re+this.im*s)/l,(this.im-this.re*s)/l)}},pow:function(t,e){let r=Ju(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return Fe.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new Fe(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new Fe(Math.pow(this.im,r.re),0);case 1:return new Fe(0,Math.pow(this.im,r.re));case 2:return new Fe(-Math.pow(this.im,r.re),0);case 3:return new Fe(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Fe.ZERO;let a=Math.atan2(this.im,this.re),o=Px(this.re,this.im),s=Math.exp(r.re*o-r.im*a),l=r.im*o+r.re*a;return new Fe(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,e=this.im;if(e===0)return t>=0?new Fe(Math.sqrt(t),0):new Fe(0,Math.sqrt(-t));let r=kx(t,e),n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new Fe(n,e<0?-i:i):new Fe(i,e<0?-n:n)},exp:function(){let t=Math.exp(this.re);return this.im===0?new Fe(t,0):new Fe(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new Fe(Math.expm1(t)*Math.cos(e)+$H(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return e===0&&t>0?new Fe(Math.log(t),0):new Fe(Px(t,e),Math.atan2(e,t))},abs:function(){return kx(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new Fe(Math.sin(t)*_i(e),Math.cos(t)*Ga(e))},cos:function(){let t=this.re,e=this.im;return new Fe(Math.cos(t)*_i(e),-Math.sin(t)*Ga(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+_i(e);return new Fe(Math.sin(t)/r,Ga(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-_i(e);return new Fe(-Math.sin(t)/r,Ga(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*_i(2*e)+.5*Math.cos(2*t);return new Fe(Math.cos(t)*_i(e)/r,Math.sin(t)*Ga(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*_i(2*e)-.5*Math.cos(2*t);return new Fe(Math.sin(t)*_i(e)/r,-Math.cos(t)*Ga(e)/r)},asin:function(){let t=this.re,e=this.im,r=new Fe(e*e-t*t+1,-2*t*e).sqrt(),n=new Fe(r.re-e,r.im+t).log();return new Fe(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new Fe(e*e-t*t+1,-2*t*e).sqrt(),n=new Fe(r.re-e,r.im+t).log();return new Fe(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(t===0){if(e===1)return new Fe(0,1/0);if(e===-1)return new Fe(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new Fe((1-e*e-t*t)/r,-2*t/r).log();return new Fe(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(e===0)return new Fe(Math.atan2(1,t),0);let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).atan():new Fe(t!==0?t/0:0,e!==0?-e/0:0).atan()},asec:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Fe(0,1/0);let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).acos():new Fe(t!==0?t/0:0,e!==0?-e/0:0).acos()},acsc:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Fe(Math.PI/2,1/0);let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).asin():new Fe(t!==0?t/0:0,e!==0?-e/0:0).asin()},sinh:function(){let t=this.re,e=this.im;return new Fe(Ga(t)*Math.cos(e),_i(t)*Math.sin(e))},cosh:function(){let t=this.re,e=this.im;return new Fe(_i(t)*Math.cos(e),Ga(t)*Math.sin(e))},tanh:function(){let t=2*this.re,e=2*this.im,r=_i(t)+Math.cos(e);return new Fe(Ga(t)/r,Math.sin(e)/r)},coth:function(){let t=2*this.re,e=2*this.im,r=_i(t)-Math.cos(e);return new Fe(Ga(t)/r,-Math.sin(e)/r)},csch:function(){let t=this.re,e=this.im,r=Math.cos(2*e)-_i(2*t);return new Fe(-2*Ga(t)*Math.cos(e)/r,2*_i(t)*Math.sin(e)/r)},sech:function(){let t=this.re,e=this.im,r=Math.cos(2*e)+_i(2*t);return new Fe(2*_i(t)*Math.cos(e)/r,-2*Ga(t)*Math.sin(e)/r)},asinh:function(){let t=this.im;this.im=-this.re,this.re=t;let e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){let t=this.acos();if(t.im<=0){let e=t.re;t.re=-t.im,t.im=e}else{let e=t.im;t.im=-t.re,t.re=e}return t},atanh:function(){let t=this.re,e=this.im,r=t>1&&e===0,n=1-t,i=1+t,a=n*n+e*e,o=a!==0?new Fe((i*n-e*e)/a,(e*n+i*e)/a):new Fe(t!==-1?t/0:0,e!==0?e/0:0),s=o.re;return o.re=Px(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,r&&(o.im=-o.im),o},acoth:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Fe(0,Math.PI/2);let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).atanh():new Fe(t!==0?t/0:0,e!==0?-e/0:0).atanh()},acsch:function(){let t=this.re,e=this.im;if(e===0)return new Fe(t!==0?Math.log(t+Math.sqrt(t*t+1)):1/0,0);let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).asinh():new Fe(t!==0?t/0:0,e!==0?-e/0:0).asinh()},asech:function(){let t=this.re,e=this.im;if(this.isZero())return Fe.INFINITY;let r=t*t+e*e;return r!==0?new Fe(t/r,-e/r).acosh():new Fe(t!==0?t/0:0,e!==0?-e/0:0).acosh()},inverse:function(){if(this.isZero())return Fe.INFINITY;if(this.isInfinite())return Fe.ZERO;let t=this.re,e=this.im,r=t*t+e*e;return new Fe(t/r,-e/r)},conjugate:function(){return new Fe(this.re,-this.im)},neg:function(){return new Fe(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new Fe(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new Fe(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new Fe(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){let r=Ju(t,e);return Math.abs(r.re-this.re)<=Fe.EPSILON&&Math.abs(r.im-this.im)<=Fe.EPSILON},clone:function(){return new Fe(this.re,this.im)},toString:function(){let t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<Fe.EPSILON&&(t=0),Math.abs(e)<Fe.EPSILON&&(e=0),e===0?r+t:(t!==0?(r+=t,r+=" ",e<0?(e=-e,r+="-"):r+="+",r+=" "):e<0&&(e=-e,r+="-"),e!==1&&(r+=e),r+"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.isFinite()}};Fe.ZERO=new Fe(0,0);Fe.ONE=new Fe(1,0);Fe.I=new Fe(0,1);Fe.PI=new Fe(Math.PI,0);Fe.E=new Fe(Math.E,0);Fe.INFINITY=new Fe(1/0,1/0);Fe.NAN=new Fe(NaN,NaN);Fe.EPSILON=1e-15;var RH="Complex",LH=[],eE=M(RH,LH,()=>(Object.defineProperty(Fe,"name",{value:"Complex"}),Fe.prototype.constructor=Fe,Fe.prototype.type="Complex",Fe.prototype.isComplex=!0,Fe.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Fe.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Fe.prototype.format=function(t){var e="",r=this.im,n=this.re,i=go(this.re,t),a=go(this.im,t),o=bt(t)?t:t?t.precision:null;if(o!==null){var s=Math.pow(10,-o);Math.abs(n/r)<s&&(n=0),Math.abs(r/n)<s&&(r=0)}return r===0?e=i:n===0?r===1?e="i":r===-1?e="-i":e=a+"i":r<0?r===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":r===1?e=i+" + i":e=i+" + "+a+"i",e},Fe.fromPolar=function(t){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Fe(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var r=arguments[0],n=arguments[1];if(bt(r)){if(En(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),bt(n))return new Fe({r,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")}},Fe.prototype.valueOf=Fe.prototype.toString,Fe.fromJSON=function(t){return new Fe(t)},Fe.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},Fe),{isClass:!0});typeof BigInt>"u"&&(BigInt=function(t){if(isNaN(t))throw new Error("");return t});var Nt=BigInt(0),ur=BigInt(1),jf=BigInt(2),$x=BigInt(5),ea=BigInt(10),VH=2e3,nt={s:ur,n:Nt,d:ur};function Ds(t,e){try{t=BigInt(t)}catch{throw ou()}return t*e}function yo(t){return typeof t=="bigint"?t:Math.floor(t)}function cn(t,e){if(e===Nt)throw Ox();let r=Object.create(wa.prototype);r.s=t<Nt?-ur:ur,t=t<Nt?-t:t;let n=Xu(t,e);return r.n=t/n,r.d=e/n,r}function xc(t){let e={},r=t,n=jf,i=$x-ur;for(;i<=r;){for(;r%n===Nt;)r/=n,e[n]=(e[n]||Nt)+ur;i+=ur+jf*n++}return r!==t?r>1&&(e[r]=(e[r]||Nt)+ur):e[t]=(e[t]||Nt)+ur,e}var ti=function(t,e){let r=Nt,n=ur,i=ur;if(t!=null)if(e!==void 0){if(typeof t=="bigint")r=t;else{if(isNaN(t))throw ou();if(t%1!==0)throw tE();r=BigInt(t)}if(typeof e=="bigint")n=e;else{if(isNaN(e))throw ou();if(e%1!==0)throw tE();n=BigInt(e)}i=r*n}else if(typeof t=="object"){if("d"in t&&"n"in t)r=BigInt(t.n),n=BigInt(t.d),"s"in t&&(r*=BigInt(t.s));else if(0 in t)r=BigInt(t[0]),1 in t&&(n=BigInt(t[1]));else if(typeof t=="bigint")r=t;else throw ou();i=r*n}else if(typeof t=="number"){if(isNaN(t))throw ou();if(t<0&&(i=-ur,t=-t),t%1===0)r=BigInt(t);else if(t>0){let a=1,o=0,s=1,l=1,u=1,c=1e7;for(t>=1&&(a=10**Math.floor(1+Math.log10(t)),t/=a);s<=c&&u<=c;){let f=(o+l)/(s+u);if(t===f){s+u<=c?(r=o+l,n=s+u):u>s?(r=l,n=u):(r=o,n=s);break}else t>f?(o+=l,s+=u):(l+=o,u+=s),s>c?(r=l,n=u):(r=o,n=s)}r=BigInt(r)*BigInt(a),n=BigInt(n)}}else if(typeof t=="string"){let a=0,o=Nt,s=Nt,l=Nt,u=ur,c=ur,f=t.replace(/_/g,"").match(/\d+|./g);if(f===null)throw ou();if(f[a]==="-"?(i=-ur,a++):f[a]==="+"&&a++,f.length===a+1?s=Ds(f[a++],i):f[a+1]==="."||f[a]==="."?(f[a]!=="."&&(o=Ds(f[a++],i)),a++,(a+1===f.length||f[a+1]==="("&&f[a+3]===")"||f[a+1]==="'"&&f[a+3]==="'")&&(s=Ds(f[a],i),u=ea**BigInt(f[a].length),a++),(f[a]==="("&&f[a+2]===")"||f[a]==="'"&&f[a+2]==="'")&&(l=Ds(f[a+1],i),c=ea**BigInt(f[a+1].length)-ur,a+=3)):f[a+1]==="/"||f[a+1]===":"?(s=Ds(f[a],i),u=Ds(f[a+2],ur),a+=3):f[a+3]==="/"&&f[a+1]===" "&&(o=Ds(f[a],i),s=Ds(f[a+2],i),u=Ds(f[a+4],ur),a+=5),f.length<=a)n=u*c,i=r=l+n*o+c*s;else throw ou()}else if(typeof t=="bigint")r=t,i=t,n=ur;else throw ou();if(n===Nt)throw Ox();nt.s=i<Nt?-ur:ur,nt.n=r<Nt?-r:r,nt.d=n<Nt?-n:n};function UH(t,e,r){let n=ur;for(;e>Nt;t=t*t%r,e>>=ur)e&ur&&(n=n*t%r);return n}function qH(t,e){for(;e%jf===Nt;e/=jf);for(;e%$x===Nt;e/=$x);if(e===ur)return Nt;let r=ea%e,n=1;for(;r!==ur;n++)if(r=r*ea%e,n>VH)return Nt;return BigInt(n)}function zH(t,e,r){let n=ur,i=UH(ea,r,e);for(let a=0;a<300;a++){if(n===i)return BigInt(a);n=n*ea%e,i=i*ea%e}return 0}function Xu(t,e){if(!t)return e;if(!e)return t;for(;;){if(t%=e,!t)return e;if(e%=t,!e)return t}}function wa(t,e){if(ti(t,e),this instanceof wa)t=Xu(nt.d,nt.n),this.s=nt.s,this.n=nt.n/t,this.d=nt.d/t;else return cn(nt.s*nt.n,nt.d)}var Ox=function(){return new Error("Division by Zero")},ou=function(){return new Error("Invalid argument")},tE=function(){return new Error("Parameters must be integer")};wa.prototype={s:ur,n:Nt,d:ur,abs:function(){return cn(this.n,this.d)},neg:function(){return cn(-this.s*this.n,this.d)},add:function(t,e){return ti(t,e),cn(this.s*this.n*nt.d+nt.s*this.d*nt.n,this.d*nt.d)},sub:function(t,e){return ti(t,e),cn(this.s*this.n*nt.d-nt.s*this.d*nt.n,this.d*nt.d)},mul:function(t,e){return ti(t,e),cn(this.s*nt.s*this.n*nt.n,this.d*nt.d)},div:function(t,e){return ti(t,e),cn(this.s*nt.s*this.n*nt.d,this.d*nt.n)},clone:function(){return cn(this.s*this.n,this.d)},mod:function(t,e){if(t===void 0)return cn(this.s*this.n%this.d,ur);if(ti(t,e),Nt===nt.n*this.d)throw Ox();return cn(this.s*(nt.d*this.n)%(nt.n*this.d),nt.d*this.d)},gcd:function(t,e){return ti(t,e),cn(Xu(nt.n,this.n)*Xu(nt.d,this.d),nt.d*this.d)},lcm:function(t,e){return ti(t,e),nt.n===Nt&&this.n===Nt?cn(Nt,ur):cn(nt.n*this.n,Xu(nt.n,this.n)*Xu(nt.d,this.d))},inverse:function(){return cn(this.s*this.d,this.n)},pow:function(t,e){if(ti(t,e),nt.d===ur)return nt.s<Nt?cn((this.s*this.d)**nt.n,this.n**nt.n):cn((this.s*this.n)**nt.n,this.d**nt.n);if(this.s<Nt)return null;let r=xc(this.n),n=xc(this.d),i=ur,a=ur;for(let o in r)if(o!=="1"){if(o==="0"){i=Nt;break}if(r[o]*=nt.n,r[o]%nt.d===Nt)r[o]/=nt.d;else return null;i*=BigInt(o)**r[o]}for(let o in n)if(o!=="1"){if(n[o]*=nt.n,n[o]%nt.d===Nt)n[o]/=nt.d;else return null;a*=BigInt(o)**n[o]}return nt.s<Nt?cn(a,i):cn(i,a)},log:function(t,e){if(ti(t,e),this.s<=Nt||nt.s<=Nt)return null;let r={},n=xc(nt.n),i=xc(nt.d),a=xc(this.n),o=xc(this.d);for(let u in i)n[u]=(n[u]||Nt)-i[u];for(let u in o)a[u]=(a[u]||Nt)-o[u];for(let u in n)u!=="1"&&(r[u]=!0);for(let u in a)u!=="1"&&(r[u]=!0);let s=null,l=null;for(let u in r){let c=n[u]||Nt,f=a[u]||Nt;if(c===Nt){if(f!==Nt)return null;continue}let m=f,p=c,d=Xu(m,p);if(m/=d,p/=d,s===null&&l===null)s=m,l=p;else if(m*l!==s*p)return null}return s!==null&&l!==null?cn(s,l):null},equals:function(t,e){return ti(t,e),this.s*this.n*nt.d===nt.s*nt.n*this.d},lt:function(t,e){return ti(t,e),this.s*this.n*nt.d<nt.s*nt.n*this.d},lte:function(t,e){return ti(t,e),this.s*this.n*nt.d<=nt.s*nt.n*this.d},gt:function(t,e){return ti(t,e),this.s*this.n*nt.d>nt.s*nt.n*this.d},gte:function(t,e){return ti(t,e),this.s*this.n*nt.d>=nt.s*nt.n*this.d},compare:function(t,e){ti(t,e);let r=this.s*this.n*nt.d-nt.s*nt.n*this.d;return(Nt<r)-(r<Nt)},ceil:function(t){return t=ea**BigInt(t||0),cn(yo(this.s*t*this.n/this.d)+(t*this.n%this.d>Nt&&this.s>=Nt?ur:Nt),t)},floor:function(t){return t=ea**BigInt(t||0),cn(yo(this.s*t*this.n/this.d)-(t*this.n%this.d>Nt&&this.s<Nt?ur:Nt),t)},round:function(t){return t=ea**BigInt(t||0),cn(yo(this.s*t*this.n/this.d)+this.s*((this.s>=Nt?ur:Nt)+jf*(t*this.n%this.d)>this.d?ur:Nt),t)},roundTo:function(t,e){ti(t,e);let r=this.n*nt.d,n=this.d*nt.n,i=r%n,a=yo(r/n);return i+i>=n&&a++,cn(this.s*a*nt.n,nt.d)},divisible:function(t,e){return ti(t,e),!(!(nt.n*this.d)||this.n*nt.d%(nt.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(t){let e=this.n,r=this.d;t=t||15;let n=qH(e,r),i=zH(e,r,n),a=this.s<Nt?"-":"";if(a+=yo(e/r),e%=r,e*=ea,e&&(a+="."),n){for(let o=i;o--;)a+=yo(e/r),e%=r,e*=ea;a+="(";for(let o=n;o--;)a+=yo(e/r),e%=r,e*=ea;a+=")"}else for(let o=t;e&&o--;)a+=yo(e/r),e%=r,e*=ea;return a},toFraction:function(t){let e=this.n,r=this.d,n=this.s<Nt?"-":"";if(r===ur)n+=e;else{let i=yo(e/r);t&&i>Nt&&(n+=i,n+=" ",e%=r),n+=e,n+="/",n+=r}return n},toLatex:function(t){let e=this.n,r=this.d,n=this.s<Nt?"-":"";if(r===ur)n+=e;else{let i=yo(e/r);t&&i>Nt&&(n+=i,e%=r),n+="\\frac{",n+=e,n+="}{",n+=r,n+="}"}return n},toContinued:function(){let t=this.n,e=this.d,r=[];do{r.push(yo(t/e));let n=t%e;t=e,e=n}while(t!==ur);return r},simplify:function(t){let e=BigInt(1/(t||.001)|0),r=this.abs(),n=r.toContinued();for(let i=1;i<n.length;i++){let a=cn(n[i-1],ur);for(let s=i-2;s>=0;s--)a=a.inverse().add(n[s]);let o=a.sub(r);if(o.n*e<o.d)return a.mul(this.s)}return this}};var HH="Fraction",GH=[],rE=M(HH,GH,()=>(Object.defineProperty(wa,"name",{value:"Fraction"}),wa.prototype.constructor=wa,wa.prototype.type="Fraction",wa.prototype.isFraction=!0,wa.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},wa.fromJSON=function(t){return new wa(t)},wa),{isClass:!0});var WH="Range",YH=[],nE=M(WH,YH,()=>{function t(e,r,n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=r!=null,o=n!=null;if(i){if(ot(e))e=e.toNumber();else if(typeof e!="number"&&!Po(e))throw new TypeError("Parameter start must be a number or bigint")}if(a){if(ot(r))r=r.toNumber();else if(typeof r!="number"&&!Po(r))throw new TypeError("Parameter end must be a number or bigint")}if(o){if(ot(n))n=n.toNumber();else if(typeof n!="number"&&!Po(n))throw new TypeError("Parameter step must be a number or bigint")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return t.prototype.type="Range",t.prototype.isRange=!0,t.parse=function(e){if(typeof e!="string")return null;var r=e.split(":"),n=r.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 t(n[0],n[1]);case 3:return new t(n[0],n[2],n[1]);default:return null}},t.prototype.clone=function(){return new t(this.start,this.end,this.step)},t.prototype.size=function(){var e=0,r=this.start,n=this.step,i=this.end,a=i-r;return Ha(n)===Ha(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},t.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},t.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},t.prototype.forEach=function(e){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;r<i;)e(r,[a],this),r+=n,a++;else if(n<0)for(;r>i;)e(r,[a],this),r+=n,a++},t.prototype.map=function(e){var r=[];return this.forEach(function(n,i,a){r[i[0]]=e(n,i,a)}),r},t.prototype.toArray=function(){var e=[];return this.forEach(function(r,n){e[n[0]]=r}),e},t.prototype.valueOf=function(){return this.toArray()},t.prototype.format=function(e){var r=go(this.start,e);return this.step!==1&&(r+=":"+go(this.step,e)),r+=":"+go(this.end,e),r},t.prototype.toString=function(){return this.format()},t.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},t.fromJSON=function(e){return new t(e.start,e.end,e.step)},t},{isClass:!0});var jH="Matrix",ZH=[],iE=M(jH,ZH,()=>{function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(e,r){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(e,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(e,r,n){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(e,r){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(e,r){throw new Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(e,r){throw new Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0});function Rx(t,e,r){var n=t.constructor,i=new n(2),a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!He(r))throw new Error("size must be an integer");if(t.greaterThan(i.pow(r-1).sub(1))||t.lessThan(i.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t.isInteger())throw new Error("Value must be an integer");t.lessThan(0)&&(t=t.add(i.pow(r))),a="i".concat(r)}switch(e){case 2:return"".concat(t.toBinary()).concat(a);case 8:return"".concat(t.toOctal()).concat(a);case 16:return"".concat(t.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function sE(t,e){if(typeof e=="function")return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var{notation:r,precision:n,wordSize:i}=Ex(e);switch(r){case"fixed":return XH(t,n);case"exponential":return aE(t,n);case"engineering":return JH(t,n);case"bin":return Rx(t,2,i);case"oct":return Rx(t,8,i);case"hex":return Rx(t,16,i);case"auto":{var a=oE(e?.lowerExp,-3),o=oE(e?.upperExp,5);if(t.isZero())return"0";var s,l=t.toSignificantDigits(n),u=l.e;return u>=a&&u<o?s=l.toFixed():s=aE(t,n),s.replace(/((\.\d*?)(0+))($|e)/,function(){var c=arguments[2],f=arguments[4];return c!=="."?c+f:f})}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function JH(t,e){var r=t.e,n=r%3===0?r:r<0?r-3-r%3:r-r%3,i=t.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.includes("e")){var o=t.constructor;a=new o(a).toFixed()}return a+"e"+(r>=0?"+":"")+n.toString()}function aE(t,e){return e!==void 0?t.toExponential(e-1):t.toExponential()}function XH(t,e){return t.toFixed(e)}function oE(t,e){return bt(t)?t:ot(t)?t.toNumber():e}function lE(t,e){var r=t.length-e.length,n=t.length;return t.substring(r,n)===e}function Dt(t,e){var r=QH(t,e);return e&&typeof e=="object"&&"truncate"in e&&r.length>e.truncate?r.substring(0,e.truncate-3)+"...":r}function QH(t,e){if(typeof t=="number")return go(t,e);if(ot(t))return sE(t,e);if(KH(t))return!e||e.fraction!=="decimal"?"".concat(t.s*t.n,"/").concat(t.d):t.toString();if(Array.isArray(t))return cE(t,e);if(Jr(t))return Qu(t);if(typeof t=="function")return t.syntax?String(t.syntax):"function";if(t&&typeof t=="object"){if(typeof t.format=="function")return t.format(e);if(t&&t.toString(e)!=={}.toString())return t.toString(e);var r=Object.keys(t).map(n=>Qu(n)+": "+Dt(t[n],e));return"{"+r.join(", ")+"}"}return String(t)}function Qu(t){for(var e=String(t),r="",n=0;n<e.length;){var i=e.charAt(n);r+=i in uE?uE[i]:i,n++}return'"'+r+'"'}var uE={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function jn(t){var e=String(t);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function cE(t,e){if(Array.isArray(t)){for(var r="[",n=t.length,i=0;i<n;i++)i!==0&&(r+=", "),r+=cE(t[i],e);return r+="]",r}else return Dt(t,e)}function KH(t){return t&&typeof t=="object"&&typeof t.s=="bigint"&&typeof t.n=="bigint"&&typeof t.d=="bigint"||!1}function jh(t,e){if(!Jr(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ir(t)+", index: 0)");if(!Jr(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ir(e)+", index: 1)");return t===e?0:t>e?1:-1}function Et(t,e,r){if(!(this instanceof Et))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Et.prototype=new RangeError;Et.prototype.constructor=RangeError;Et.prototype.name="DimensionError";Et.prototype.isDimensionError=!0;function Zn(t,e,r){if(!(this instanceof Zn))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=r),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}Zn.prototype=new RangeError;Zn.prototype.constructor=RangeError;Zn.prototype.name="IndexError";Zn.prototype.isIndexError=!0;function ct(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function fE(t,e,r){var n,i=t.length;if(i!==e[r])throw new Et(i,e[r]);if(r<e.length-1){var a=r+1;for(n=0;n<i;n++){var o=t[n];if(!Array.isArray(o))throw new Et(e.length-1,e.length,"<");fE(t[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(t[n]))throw new Et(e.length+1,e.length,">")}function Vx(t,e){var r=e.length===0;if(r){if(Array.isArray(t))throw new Et(t.length,0)}else fE(t,e,0)}function Zf(t,e){var r=t.isMatrix?t._size:ct(t),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new Et(i,r[a])})}function Cr(t,e){if(t!==void 0){if(!bt(t)||!He(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||typeof e=="number"&&t>=e)throw new Zn(t,e)}}function Ku(t){for(var e=0;e<t._dimensions.length;++e){var r=t._dimensions[e];if(r._data&&sr(r._data)){if(r._size[0]===0)return!0}else if(r.isRange){if(r.start===r.end)return!0}else if(Jr(r)&&r.length===0)return!0}return!1}function bo(t,e,r){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(!bt(i)||!He(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(e)+")")}),(bt(t)||ot(t))&&(t=[t]);var n=r!==void 0?r:0;return Lx(t,e,0,n),t}function Lx(t,e,r,n){var i,a,o=t.length,s=e[r],l=Math.min(o,s);if(t.length=s,r<e.length-1){var u=r+1;for(i=0;i<l;i++)a=t[i],Array.isArray(a)||(a=[a],t[i]=a),Lx(a,e,u,n);for(i=l;i<s;i++)a=[],t[i]=a,Lx(a,e,u,n)}else{for(i=0;i<l;i++)for(;Array.isArray(t[i]);)t[i]=t[i][0];for(i=l;i<s;i++)t[i]=n}}function Jf(t,e){var r=Pt(t,!0),n=r.length;if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Et(0,n,"!=");e=Xf(e,n);var i=pE(e);if(n!==i)throw new Et(i,n,"!=");try{return eG(r,e)}catch(a){throw a instanceof Et?new Et(i,n,"!="):a}}function Xf(t,e){var r=pE(t),n=t.slice(),i=-1,a=t.indexOf(i),o=t.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var s=a>=0,l=e%r===0;if(s)if(l)n[a]=-e/r;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-r);return n}function pE(t){return t.reduce((e,r)=>e*r,1)}function eG(t,e){for(var r=t,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=r.length/a,s=0;s<o;s++)n.push(r.slice(s*a,(s+1)*a));r=n}return r}function wc(t,e){for(var r=e||ct(t);Array.isArray(t)&&t.length===1;)t=t[0],r.shift();for(var n=r.length;r[n-1]===1;)n--;return n<r.length&&(t=mE(t,n,0),r.length=n),t}function mE(t,e,r){var n,i;if(r<e){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=mE(t[n],e,a)}else for(;Array.isArray(t);)t=t[0];return t}function Zh(t,e,r,n){var i=n||ct(t);if(r)for(var a=0;a<r;a++)t=[t],i.unshift(1);for(t=dE(t,e,0);i.length<e;)i.push(1);return t}function dE(t,e,r){var n,i;if(Array.isArray(t)){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=dE(t[n],e,a)}else for(var o=r;o<e;o++)t=[t];return t}function Pt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!Array.isArray(t))return t;if(typeof e!="boolean")throw new TypeError("Boolean expected for second argument of flatten");var r=[];return e?i(t):n(t),r;function n(a){for(var o=0;o<a.length;o++){var s=a[o];Array.isArray(s)?n(s):r.push(s)}}function i(a){if(Array.isArray(a[0]))for(var o=0;o<a.length;o++)i(a[o]);else for(var s=0;s<a.length;s++)r.push(a[s])}}function Wa(t,e){return Array.prototype.map.call(t,e)}function Jh(t,e){Array.prototype.forEach.call(t,e)}function Ux(t,e){if(ct(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,e)}function qx(t,e){if(ct(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,r=>e.test(r))}function zx(t,e){return Array.prototype.join.call(t,e)}function Ss(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;var e=[],r=0;e[0]={value:t[0],identifier:0};for(var n=1;n<t.length;n++)t[n]===t[n-1]?r++:r=0,e.push({value:t[n],identifier:r});return e}function _c(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;for(var e=[],r=0;r<t.length;r++)e.push(t[r].value);return e}function el(t,e){for(var r,n=0,i=0;i<t.length;i++){var a=t[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var s=o?el(a,e):e(a);if(r===void 0)r=s;else if(r!==s)return"mixed"}return r}function hE(t,e,r,n){if(n<r){if(t.length!==e.length)throw new Et(t.length,e.length);for(var i=[],a=0;a<t.length;a++)i[a]=hE(t[a],e[a],r,n+1);return i}else return t.concat(e)}function Hx(){var t=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(t.length===1)return t[0];if(t.length>1)return t.slice(1).reduce(function(r,n){return hE(r,n,e,0)},t[0]);throw new Error("Wrong number of arguments in function concat")}function Qf(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var n=e.map(m=>m.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var s=e[o],l=n[o],u=0;u<l;u++){var c=i-l+u;s[u]>a[c]&&(a[c]=s[u])}for(var f=0;f<e.length;f++)gE(e[f],a);return a}function gE(t,e){for(var r=e.length,n=t.length,i=0;i<n;i++){var a=r-n+i;if(t[i]<e[a]&&t[i]>1||t[i]>e[a])throw new Error("shape mismatch: mismatch is found in arg with shape (".concat(t,") not possible to broadcast dimension ").concat(n," with size ").concat(t[i]," to size ").concat(e[a]))}}function Vo(t,e){var r=ct(t);if(Qi(r,e))return t;gE(r,e);var n=Qf(r,e),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=rG(t);r.length<i&&(o=Jf(o,a),r=ct(o));for(var s=0;s<i;s++)r[s]<n[s]&&(o=tG(o,n[s],s),r=ct(o));return o}function tG(t,e,r){return Hx(...Array(e).fill(t),r)}function Ac(t,e){if(!Array.isArray(t))throw new Error("Array expected");var r=ct(t);if(e.length!==r.length)throw new Et(e.length,r.length);for(var n=0;n<e.length;n++)Cr(e[n],r[n]);return e.reduce((i,a)=>i[a],t)}function Kf(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(t.length===0)return[];if(r)return a(t);var n=[];return i(t,0);function i(o,s){if(Array.isArray(o)){for(var l=o.length,u=Array(l),c=0;c<l;c++)n[s]=c,u[c]=i(o[c],s+1);return u}else return e(o,n.slice(0,s),t)}function a(o){if(Array.isArray(o)){for(var s=o.length,l=Array(s),u=0;u<s;u++)l[u]=a(o[u]);return l}else return e(o)}}function Xh(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(t.length===0)return;if(r){a(t);return}var n=[];i(t,0);function i(o,s){if(Array.isArray(o))for(var l=o.length,u=0;u<l;u++)n[s]=u,i(o[u],s+1);else e(o,n.slice(0,s),t)}function a(o){if(Array.isArray(o))for(var s=o.length,l=0;l<s;l++)a(o[l]);else e(o)}}function rG(t){return bn([],t)}var Gx=Tr(Ih(),1);function Ya(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(Gx.default.isTypedFunction(t)){var i;if(n)i=1;else{var a=(e.isMatrix?e.size():ct(e)).map(()=>0),o=e.isMatrix?e.get(a):Ac(e,a);i=aG(t,o,a,e)}var s;if(e.isMatrix&&e.dataType!=="mixed"&&e.dataType!==void 0){var l=nG(t,i);s=l!==void 0?l:t}else s=t;return i>=1&&i<=3?{isUnary:i===1,fn:function(){for(var c=arguments.length,f=new Array(c),m=0;m<c;m++)f[m]=arguments[m];return vE(s,f.slice(0,i),r,t.name)}}:{isUnary:!1,fn:function(){for(var c=arguments.length,f=new Array(c),m=0;m<c;m++)f[m]=arguments[m];return vE(s,f,r,t.name)}}}return n===void 0?{isUnary:iG(t),fn:t}:{isUnary:n,fn:t}}function nG(t,e){var r=[];if(Object.entries(t.signatures).forEach(n=>{var[i,a]=n;i.split(",").length===e&&r.push(a)}),r.length===1)return r[0]}function iG(t){if(t.length!==1)return!1;var e=t.toString();if(/arguments/.test(e))return!1;var r=e.match(/\(.*?\)/);return!/\.\.\./.test(r)}function aG(t,e,r,n){for(var i=[e,r,n],a=3;a>0;a--){var o=i.slice(0,a);if(Gx.default.resolve(t,o)!==null)return a}}function vE(t,e,r,n){try{return t(...e)}catch(i){oG(i,e,r,n)}}function oG(t,e,r,n){var i;if(t instanceof TypeError&&((i=t.data)===null||i===void 0?void 0:i.category)==="wrongType"){var a=[];throw a.push("value: ".concat(ir(e[0]))),e.length>=2&&a.push("index: ".concat(ir(e[1]))),e.length>=3&&a.push("array: ".concat(ir(e[2]))),new TypeError("Function ".concat(r," cannot apply callback arguments ")+"".concat(n,"(").concat(a.join(", "),") at index ").concat(JSON.stringify(e[1])))}else throw new TypeError("Function ".concat(r," cannot apply callback arguments ")+"to function ".concat(n,": ").concat(t.message))}var sG="DenseMatrix",uG=["Matrix"],yE=M(sG,uG,t=>{var{Matrix:e}=t;function r(c,f){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!Jr(f))throw new Error("Invalid datatype: "+f);if(Ye(c))c.type==="DenseMatrix"?(this._data=ut(c._data),this._size=ut(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&sr(c.data)&&sr(c.size))this._data=c.data,this._size=c.size,Vx(this._data,this._size),this._datatype=f||c.datatype;else if(sr(c))this._data=u(c),this._size=ct(this._data),Vx(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+ir(c)+")");this._data=[],this._size=[0],this._datatype=f}}r.prototype=new e,r.prototype.createDenseMatrix=function(c,f){return new r(c,f)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return el(this._data,ir)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(c,f){return new r(c,f)},r.prototype.subset=function(c,f,m){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,f,m);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(c){return Ac(this._data,c)},r.prototype.set=function(c,f,m){if(!sr(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Et(c.length,this._size.length,"<");var p,d,h,b=c.map(function(D){return D+1});l(this,b,m);var y=this._data;for(p=0,d=c.length-1;p<d;p++)h=c[p],Cr(h,y.length),y=y[h];return h=c[c.length-1],Cr(h,y.length),y[h]=f,this};function n(c,f){if(!$o(f))throw new TypeError("Invalid index");var m=f.isScalar();if(m)return c.get(f.min());var p=f.size();if(p.length!==c._size.length)throw new Et(p.length,c._size.length);for(var d=f.min(),h=f.max(),b=0,y=c._size.length;b<y;b++)Cr(d[b],c._size[b]),Cr(h[b],c._size[b]);return new r(i(c._data,f,p.length,0),c._datatype)}function i(c,f,m,p){var d=p===m-1,h=f.dimension(p);return d?h.map(function(b){return Cr(b,c.length),c[b]}).valueOf():h.map(function(b){Cr(b,c.length);var y=c[b];return i(y,f,m,p+1)}).valueOf()}function a(c,f,m,p){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var d=f.size(),h=f.isScalar(),b;if(Ye(m)?(b=m.size(),m=m.valueOf()):b=ct(m),h){if(b.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),m,p)}else{if(!Qi(b,d))try{b.length===0?m=Vo([m],d):m=Vo(m,d),b=ct(m)}catch{}if(d.length<c._size.length)throw new Et(d.length,c._size.length,"<");if(b.length<d.length){for(var y=0,D=0;d[y]===1&&b[y]===1;)y++;for(;d[y]===1;)D++,y++;m=Zh(m,d.length,D,b)}if(!Qi(d,b))throw new Et(d,b,">");var v=f.max().map(function(x){return x+1});l(c,v,p);var A=d.length,w=0;o(c._data,f,m,A,w)}return c}function o(c,f,m,p,d){var h=d===p-1,b=f.dimension(d);h?b.forEach(function(y,D){Cr(y),c[y]=m[D[0]]}):b.forEach(function(y,D){Cr(y),o(c[y],f,m[D[0]],p,d+1)})}r.prototype.resize=function(c,f,m){if(!rn(c))throw new TypeError("Array or Matrix expected");var p=c.valueOf().map(h=>Array.isArray(h)&&h.length===1?h[0]:h),d=m?this.clone():this;return s(d,p,f)};function s(c,f,m){if(f.length===0){for(var p=c._data;sr(p);)p=p[0];return p}return c._size=f.slice(0),c._data=bo(c._data,c._size,m),c}r.prototype.reshape=function(c,f){var m=f?this.clone():this;m._data=Jf(m._data,c);var p=m._size.reduce((d,h)=>d*h);return m._size=Xf(c,p),m};function l(c,f,m){for(var p=c._size.slice(0),d=!1;p.length<f.length;)p.push(0),d=!0;for(var h=0,b=f.length;h<b;h++)f[h]>p[h]&&(p[h]=f[h],d=!0);d&&s(c,p,m)}r.prototype.clone=function(){var c=new r({data:ut(this._data),size:ut(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(c){var f=c.length===2,m=this._size.length-1;if(m<0)return;if(f){b(this._data);return}if(m===0){for(var p=0;p<this._data.length;p++)c(this._data,p,[p]);return}var d=new Array(m+1);h(this._data);function h(y){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(D<m)for(var v=0;v<y.length;v++)d[D]=v,h(y[v],D+1);else for(var A=0;A<y.length;A++)d[D]=A,c(y,A,d.slice())}function b(y){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(D<m)for(var v=0;v<y.length;v++)b(y[v],D+1);else for(var A=0;A<y.length;A++)c(y,A)}},r.prototype.map=function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,p=this,d=new r(p),h=Ya(c,p._data,"map",m),b=m||h.isUnary?(y,D)=>{y[D]=h.fn(y[D])}:(y,D,v)=>{y[D]=h.fn(y[D],v,p)};return d._forEach(b),d},r.prototype.forEach=function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,p=this,d=Ya(c,p._data,"map",m),h=m||d.isUnary?(b,y)=>{d.fn(b[y])}:(b,y,D)=>{d.fn(b[y],D,p)};p._forEach(h)},r.prototype[Symbol.iterator]=function*(){var c=this._size.length-1;if(!(c<0)){if(c===0){for(var f=0;f<this._data.length;f++)yield{value:this._data[f],index:[f]};return}var m=[],p=function*(h,b){if(b<c)for(var y=0;y<h.length;y++)m[b]=y,yield*p(h[y],b+1);else for(var D=0;D<h.length;D++)m[b]=D,yield{value:h[D],index:m.slice()}};yield*p(this._data,0)}},r.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 m=this._data;for(var p of m)c.push(new r([p],this._datatype));return c},r.prototype.columns=function(){var c=this,f=[],m=this.size();if(m.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var p=this._data,d=function(y){var D=p.map(v=>[v[y]]);f.push(new r(D,c._datatype))},h=0;h<m[1];h++)d(h);return f},r.prototype.toArray=function(){return ut(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(c){return Dt(this._data,c)},r.prototype.toString=function(){return Dt(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(c){if(c){if(ot(c)&&(c=c.toNumber()),!bt(c)||!He(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var f=c>0?c:0,m=c<0?-c:0,p=this._size[0],d=this._size[1],h=Math.min(p-m,d-f),b=[],y=0;y<h;y++)b[y]=this._data[y+m][y+f];return new r({data:b,size:[h],datatype:this._datatype})},r.diagonal=function(c,f,m,p){if(!sr(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(E){if(ot(E)&&(E=E.toNumber()),!bt(E)||!He(E)||E<1)throw new Error("Size values must be positive integers");return E}),m){if(ot(m)&&(m=m.toNumber()),!bt(m)||!He(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var d=m>0?m:0,h=m<0?-m:0,b=c[0],y=c[1],D=Math.min(b-h,y-d),v;if(sr(f)){if(f.length!==D)throw new Error("Invalid value array length");v=function(T){return f[T]}}else if(Ye(f)){var A=f.size();if(A.length!==1||A[0]!==D)throw new Error("Invalid matrix length");v=function(T){return f.get([T])}}else v=function(){return f};p||(p=ot(v(0))?v(0).mul(0):0);var w=[];if(c.length>0){w=bo(w,c,p);for(var x=0;x<D;x++)w[x+h][x+d]=v(x)}return new r({data:w,size:[b,y]})},r.fromJSON=function(c){return new r(c)},r.prototype.swapRows=function(c,f){if(!bt(c)||!He(c)||!bt(f)||!He(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 Cr(c,this._size[0]),Cr(f,this._size[0]),r._swapRows(c,f,this._data),this},r._swapRows=function(c,f,m){var p=m[c];m[c]=m[f],m[f]=p};function u(c){return Ye(c)?u(c.valueOf()):sr(c)?c.map(u):c}return r},{isClass:!0});var bE="clone",lG=["typed"],xE=M(bE,lG,t=>{var{typed:e}=t;return e(bE,{any:ut})});function Qh(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}function ja(t){for(var e=0;e<t.length;e++)if(rn(t[e]))return!0;return!1}function Oi(t,e){Ye(t)?t.forEach(r=>e(r),!1,!0):Xh(t,e,!0)}function Ke(t,e,r){if(!r)return Ye(t)?t.map(i=>e(i),!1,!0):Kf(t,e,!0);var n=i=>i===0?i:e(i);return Ye(t)?t.map(i=>n(i),!1,!0):Kf(t,n,!0)}function su(t,e,r){var n=Array.isArray(t)?ct(t):t.size();if(e<0||e>=n.length)throw new Zn(e,n.length);return Ye(t)?t.create(Kh(t.valueOf(),e,r),t.datatype()):Kh(t,e,r)}function Kh(t,e,r){var n,i,a,o;if(e<=0)if(Array.isArray(t[0])){for(o=Qh(t),i=[],n=0;n<o.length;n++)i[n]=Kh(o[n],e-1,r);return i}else{for(a=t[0],n=1;n<t.length;n++)a=r(a,t[n]);return a}else{for(i=[],n=0;n<t.length;n++)i[n]=Kh(t[n],e-1,r);return i}}function Wx(t,e,r,n,i,a,o,s,l,u,c){var f=t._values,m=t._index,p=t._ptr,d,h,b,y;if(n)for(h=p[e],b=p[e+1],d=h;d<b;d++)y=m[d],r[y]!==a?(r[y]=a,o.push(y),u?(n[y]=l?s(f[d],c):s(c,f[d]),i[y]=a):n[y]=f[d]):(n[y]=l?s(f[d],n[y]):s(n[y],f[d]),i[y]=a);else for(h=p[e],b=p[e+1],d=h;d<b;d++)y=m[d],r[y]!==a?(r[y]=a,o.push(y)):i[y]=a}var wE="isInteger",cG=["typed"],_E=M(wE,cG,t=>{var{typed:e}=t;return e(wE,{number:He,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1n},"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var ta="number",Es="number, number";function Yx(t){return Math.abs(t)}Yx.signature=ta;function jx(t,e){return t+e}jx.signature=Es;function Zx(t,e){return t-e}Zx.signature=Es;function Jx(t,e){return t*e}Jx.signature=Es;function fG(t,e){return t/e}fG.signature=Es;function Xx(t){return-t}Xx.signature=ta;function Qx(t){return t}Qx.signature=ta;function Dc(t){return TS(t)}Dc.signature=ta;function Kx(t){return t*t*t}Kx.signature=ta;function e0(t){return Math.exp(t)}e0.signature=ta;function t0(t){return MS(t)}t0.signature=ta;function pG(t,e){if(!He(t)||!He(e))throw new Error("Parameters in function gcd must be integer numbers");for(var r;e!==0;)r=t%e,t=e,e=r;return t<0?-t:t}pG.signature=Es;function r0(t,e){if(!He(t)||!He(e))throw new Error("Parameters in function lcm must be integer numbers");if(t===0||e===0)return 0;for(var r,n=t*e;e!==0;)r=e,e=t%r,t=r;return Math.abs(n/t)}r0.signature=Es;function n0(t,e){return e?Math.log(t)/Math.log(e):Math.log(t)}function ep(t){return ES(t)}ep.signature=ta;function eg(t){return SS(t)}eg.signature=ta;function mG(t){return Bh(t)}mG.signature=ta;function dG(t,e){return e===0?t:t-e*Math.floor(t/e)}dG.signature=Es;function i0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=e<0;if(r&&(e=-e),e===0)throw new Error("Root must be non-zero");if(t<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(t===0)return r?1/0:0;if(!isFinite(t))return r?0:t;var n=Math.pow(Math.abs(t),1/e);return n=t<0?-n:n,r?1/n:n}function tg(t){return Ha(t)}tg.signature=ta;function hG(t){return Math.sqrt(t)}hG.signature=ta;function a0(t){return t*t}a0.signature=ta;function o0(t,e){var r,n,i,a=0,o=1,s=1,l=0;if(!He(t)||!He(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(t/e),i=t-n*e,r=a,a=o-n*a,o=r,r=s,s=l-n*s,l=r,t=e,e=i;var u;return t<0?u=[-t,-o,-l]:u=[t,t?o:0,l],u}o0.signature=Es;function s0(t,e){return t*t<1&&e===1/0||t*t>1&&e===-1/0?0:Math.pow(t,e)}s0.signature=Es;function Sc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!He(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(Tx(t,e))}function gG(t){return Math.abs(t)}gG.signature=ta;var vG="number",Ec="number, number";function u0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function bitAnd");return t&e}u0.signature=Ec;function l0(t){if(!He(t))throw new Error("Integer expected in function bitNot");return~t}l0.signature=vG;function c0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function bitOr");return t|e}c0.signature=Ec;function f0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function bitXor");return t^e}f0.signature=Ec;function p0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function leftShift");return t<<e}p0.signature=Ec;function m0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function rightArithShift");return t>>e}m0.signature=Ec;function d0(t,e){if(!He(t)||!He(e))throw new Error("Integers expected in function rightLogShift");return t>>>e}d0.signature=Ec;function _a(t,e){if(e<t)return 1;if(e===t)return e;var r=e+t>>1;return _a(t,r)*_a(r+1,e)}function h0(t,e){if(!He(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!He(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>t)throw new TypeError("k must be less than or equal to n");for(var r=t-e,n=1,i=e<r?r+1:e+1,a=2,o=e<r?e:r,s=i;s<=t;++s)for(n*=s;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=_a(a,o)),n}h0.signature="number, number";var AE=Math.PI,DE=2*Math.PI,SE=Math.E,EE=1.618033988749895;var yG="number",g0="number, number";function v0(t){return!t}v0.signature=yG;function rg(t,e){return!!(t||e)}rg.signature=g0;function ng(t,e){return!!t!=!!e}ng.signature=g0;function ig(t,e){return!!(t&&e)}ig.signature=g0;function tp(t){var e;if(He(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:_a(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*tp(1-t));if(t>=171.35)return 1/0;if(t>85){var r=t*t,n=r*t,i=n*t,a=i*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*t))}--t,e=tl[0];for(var o=1;o<tl.length;++o)e+=tl[o]/(t+o);var s=t+y0+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,t+.5)*Math.exp(-s)*e}tp.signature="number";var y0=4.7421875,tl=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],b0=.9189385332046728,bG=5,xG=7,TE=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function rp(t){if(t<0)return NaN;if(t===0)return 1/0;if(!isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-rp(1-t);t=t-1;for(var e=t+bG+.5,r=TE[0],n=xG-1;n>=1;n--)r+=TE[n]/(t+n);return b0+(t+.5)*Math.log(e)-e+Math.log(r)}rp.signature="number";var fn="number",wG="number, number";function _G(t){return Math.acos(t)}_G.signature=fn;function x0(t){return FS(t)}x0.signature=fn;function w0(t){return Math.atan(1/t)}w0.signature=fn;function _0(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}_0.signature=fn;function A0(t){return Math.asin(1/t)}A0.signature=fn;function D0(t){var e=1/t;return Math.log(e+Math.sqrt(e*e+1))}D0.signature=fn;function S0(t){return Math.acos(1/t)}S0.signature=fn;function E0(t){var e=1/t,r=Math.sqrt(e*e-1);return Math.log(r+e)}E0.signature=fn;function AG(t){return Math.asin(t)}AG.signature=fn;function T0(t){return IS(t)}T0.signature=fn;function DG(t){return Math.atan(t)}DG.signature=fn;function SG(t,e){return Math.atan2(t,e)}SG.signature=wG;function M0(t){return BS(t)}M0.signature=fn;function EG(t){return Math.cos(t)}EG.signature=fn;function TG(t){return Ph(t)}TG.signature=fn;function C0(t){return 1/Math.tan(t)}C0.signature=fn;function N0(t){var e=Math.exp(2*t);return(e+1)/(e-1)}N0.signature=fn;function F0(t){return 1/Math.sin(t)}F0.signature=fn;function I0(t){return t===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*Ha(t)}I0.signature=fn;function B0(t){return 1/Math.cos(t)}B0.signature=fn;function k0(t){return 2/(Math.exp(t)+Math.exp(-t))}k0.signature=fn;function MG(t){return Math.sin(t)}MG.signature=fn;function P0(t){return kS(t)}P0.signature=fn;function CG(t){return Math.tan(t)}CG.signature=fn;function NG(t){return $h(t)}NG.signature=fn;var np="number";function FG(t){return He(t)}FG.signature=np;function $0(t){return t<0}$0.signature=np;function O0(t){return t>0}O0.signature=np;function IG(t){return t===0}IG.signature=np;function R0(t){return Number.isNaN(t)}R0.signature=np;function gn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return t.isNaN()||e.isNaN()?!1:!t.isFinite()||!e.isFinite()?t.eq(e):t.eq(e)?!0:t.minus(e).abs().lte(t.constructor.max(t.constructor.max(t.abs(),e.abs()).mul(r),n))}var ME="isNegative",BG=["typed","config"],CE=M(ME,BG,t=>{var{typed:e,config:r}=t;return e(ME,{number:n=>zr(n,0,r.relTol,r.absTol)?!1:$0(n),BigNumber:n=>gn(n,new n.constructor(0),r.relTol,r.absTol)?!1:n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n<0n,Fraction:n=>n.s<0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var NE="isNumeric",kG=["typed"],FE=M(NE,kG,t=>{var{typed:e}=t;return e(NE,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var IE="hasNumericValue",PG=["typed","isNumeric"],BE=M(IE,PG,t=>{var{typed:e,isNumeric:r}=t;return e(IE,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var kE="isPositive",$G=["typed","config"],PE=M(kE,$G,t=>{var{typed:e,config:r}=t;return e(kE,{number:n=>zr(n,0,r.relTol,r.absTol)?!1:O0(n),BigNumber:n=>gn(n,new n.constructor(0),r.relTol,r.absTol)?!1:!n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n>0n,Fraction:n=>n.s>0n&&n.n>0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var $E="isZero",OG=["typed","equalScalar"],OE=M($E,OG,t=>{var{typed:e,equalScalar:r}=t;return e($E,{"number | BigNumber | Complex | Fraction":n=>r(n,0),bigint:n=>n===0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var RE="isNaN",RG=["typed"],LE=M(RE,RG,t=>{var{typed:e}=t;return e(RE,{number:R0,BigNumber:function(n){return n.isNaN()},bigint:function(n){return!1},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var VE="typeOf",LG=["typed"],UE=M(VE,LG,t=>{var{typed:e}=t;return e(VE,{any:ir})});function qE(t,e,r,n){return zr(t.re,e.re,r,n)&&zr(t.im,e.im,r,n)}var Za=M("compareUnits",["typed"],t=>{var{typed:e}=t;return{"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}});var ag="equalScalar",VG=["typed","config"],zE=M(ag,VG,t=>{var{typed:e,config:r}=t,n=Za({typed:e});return e(ag,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return zr(a,o,r.relTol,r.absTol)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||gn(a,o,r.relTol,r.absTol)},"bigint, bigint":function(a,o){return a===o},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return qE(a,o,r.relTol,r.absTol)}},n)}),SEe=M(ag,["typed","config"],t=>{var{typed:e,config:r}=t;return e(ag,{"number, number":function(i,a){return zr(i,a,r.relTol,r.absTol)}})});var UG="SparseMatrix",qG=["typed","equalScalar","Matrix"],HE=M(UG,qG,t=>{var{typed:e,equalScalar:r,Matrix:n}=t;function i(h,b){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(b&&!Jr(b))throw new Error("Invalid datatype: "+b);if(Ye(h))a(this,h,b);else if(h&&sr(h.index)&&sr(h.ptr)&&sr(h.size))this._values=h.values,this._index=h.index,this._ptr=h.ptr,this._size=h.size,this._datatype=b||h.datatype;else if(sr(h))o(this,h,b);else{if(h)throw new TypeError("Unsupported type of data ("+ir(h)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=b}}function a(h,b,y){b.type==="SparseMatrix"?(h._values=b._values?ut(b._values):void 0,h._index=ut(b._index),h._ptr=ut(b._ptr),h._size=ut(b._size),h._datatype=y||b._datatype):o(h,b.valueOf(),y||b._datatype)}function o(h,b,y){h._values=[],h._index=[],h._ptr=[],h._datatype=y;var D=b.length,v=0,A=r,w=0;if(Jr(y)&&(A=e.find(r,[y,y])||r,w=e.convert(0,y)),D>0){var x=0;do{h._ptr.push(h._index.length);for(var E=0;E<D;E++){var T=b[E];if(sr(T)){if(x===0&&v<T.length&&(v=T.length),x<T.length){var _=T[x];A(_,w)||(h._values.push(_),h._index.push(E))}}else x===0&&v<1&&(v=1),A(T,w)||(h._values.push(T),h._index.push(E))}x++}while(x<v)}h._ptr.push(h._index.length),h._size=[D,v]}i.prototype=new n,i.prototype.createSparseMatrix=function(h,b){return new i(h,b)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return el(this._values,ir)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(h,b){return new i(h,b)},i.prototype.density=function(){var h=this._size[0],b=this._size[1];return h!==0&&b!==0?this._index.length/(h*b):0},i.prototype.subset=function(h,b,y){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return s(this,h);case 2:case 3:return l(this,h,b,y);default:throw new SyntaxError("Wrong number of arguments")}};function s(h,b){if(!$o(b))throw new TypeError("Invalid index");var y=b.isScalar();if(y)return h.get(b.min());var D=b.size();if(D.length!==h._size.length)throw new Et(D.length,h._size.length);var v,A,w,x,E=b.min(),T=b.max();for(v=0,A=h._size.length;v<A;v++)Cr(E[v],h._size[v]),Cr(T[v],h._size[v]);var _=h._values,C=h._index,N=h._ptr,I=b.dimension(0),R=b.dimension(1),L=[],V=[];I.forEach(function(O,Q){V[O]=Q[0],L[O]=!0});var P=_?[]:void 0,k=[],W=[];return R.forEach(function(O){for(W.push(k.length),w=N[O],x=N[O+1];w<x;w++)v=C[w],L[v]===!0&&(k.push(V[v]),P&&P.push(_[w]))}),W.push(k.length),new i({values:P,index:k,ptr:W,size:D,datatype:h._datatype})}function l(h,b,y,D){if(!b||b.isIndex!==!0)throw new TypeError("Invalid index");var v=b.size(),A=b.isScalar(),w;if(Ye(y)?(w=y.size(),y=y.toArray()):w=ct(y),A){if(w.length!==0)throw new TypeError("Scalar expected");h.set(b.min(),y,D)}else{if(v.length!==1&&v.length!==2)throw new Et(v.length,h._size.length,"<");if(w.length<v.length){for(var x=0,E=0;v[x]===1&&w[x]===1;)x++;for(;v[x]===1;)E++,x++;y=Zh(y,v.length,E,w)}if(!Qi(v,w))throw new Et(v,w,">");if(v.length===1){var T=b.dimension(0);T.forEach(function(N,I){Cr(N),h.set([N,0],y[I[0]],D)})}else{var _=b.dimension(0),C=b.dimension(1);_.forEach(function(N,I){Cr(N),C.forEach(function(R,L){Cr(R),h.set([N,R],y[I[0]][L[0]],D)})})}}return h}i.prototype.get=function(h){if(!sr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Et(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var b=h[0],y=h[1];Cr(b,this._size[0]),Cr(y,this._size[1]);var D=u(b,this._ptr[y],this._ptr[y+1],this._index);return D<this._ptr[y+1]&&this._index[D]===b?this._values[D]:0},i.prototype.set=function(h,b,y){if(!sr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Et(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var D=h[0],v=h[1],A=this._size[0],w=this._size[1],x=r,E=0;Jr(this._datatype)&&(x=e.find(r,[this._datatype,this._datatype])||r,E=e.convert(0,this._datatype)),(D>A-1||v>w-1)&&(m(this,Math.max(D+1,A),Math.max(v+1,w),y),A=this._size[0],w=this._size[1]),Cr(D,A),Cr(v,w);var T=u(D,this._ptr[v],this._ptr[v+1],this._index);return T<this._ptr[v+1]&&this._index[T]===D?x(b,E)?c(T,v,this._values,this._index,this._ptr):this._values[T]=b:x(b,E)||f(T,D,v,b,this._values,this._index,this._ptr),this};function u(h,b,y,D){if(y-b===0)return y;for(var v=b;v<y;v++)if(D[v]===h)return v;return b}function c(h,b,y,D,v){y.splice(h,1),D.splice(h,1);for(var A=b+1;A<v.length;A++)v[A]--}function f(h,b,y,D,v,A,w){v.splice(h,0,D),A.splice(h,0,b);for(var x=y+1;x<w.length;x++)w[x]++}i.prototype.resize=function(h,b,y){if(!rn(h))throw new TypeError("Array or Matrix expected");var D=h.valueOf().map(A=>Array.isArray(A)&&A.length===1?A[0]:A);if(D.length!==2)throw new Error("Only two dimensions matrix are supported");D.forEach(function(A){if(!bt(A)||!He(A)||A<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(D)+")")});var v=y?this.clone():this;return m(v,D[0],D[1],b)};function m(h,b,y,D){var v=D||0,A=r,w=0;Jr(h._datatype)&&(A=e.find(r,[h._datatype,h._datatype])||r,w=e.convert(0,h._datatype),v=e.convert(v,h._datatype));var x=!A(v,w),E=h._size[0],T=h._size[1],_,C,N;if(y>T){for(C=T;C<y;C++)if(h._ptr[C]=h._values.length,x)for(_=0;_<E;_++)h._values.push(v),h._index.push(_);h._ptr[y]=h._values.length}else y<T&&(h._ptr.splice(y+1,T-y),h._values.splice(h._ptr[y],h._values.length),h._index.splice(h._ptr[y],h._index.length));if(T=y,b>E){if(x){var I=0;for(C=0;C<T;C++){h._ptr[C]=h._ptr[C]+I,N=h._ptr[C+1]+I;var R=0;for(_=E;_<b;_++,R++)h._values.splice(N+R,0,v),h._index.splice(N+R,0,_),I++}h._ptr[T]=h._values.length}}else if(b<E){var L=0;for(C=0;C<T;C++){h._ptr[C]=h._ptr[C]-L;var V=h._ptr[C],P=h._ptr[C+1]-L;for(N=V;N<P;N++)_=h._index[N],_>b-1&&(h._values.splice(N,1),h._index.splice(N,1),L++)}h._ptr[C]=h._values.length}return h._size[0]=b,h._size[1]=y,h}i.prototype.reshape=function(h,b){if(!sr(h))throw new TypeError("Array expected");if(h.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");h.forEach(function(O){if(!bt(O)||!He(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Dt(h)+")")});var y=this._size[0]*this._size[1];h=Xf(h,y);var D=h[0]*h[1];if(y!==D)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=b?this.clone():this;if(this._size[0]===h[0]&&this._size[1]===h[1])return v;for(var A=[],w=0;w<v._ptr.length;w++)for(var x=0;x<v._ptr[w+1]-v._ptr[w];x++)A.push(w);for(var E=v._values.slice(),T=v._index.slice(),_=0;_<v._index.length;_++){var C=T[_],N=A[_],I=C*v._size[1]+N;A[_]=I%h[1],T[_]=Math.floor(I/h[1])}v._values.length=0,v._index.length=0,v._ptr.length=h[1]+1,v._size=h.slice();for(var R=0;R<v._ptr.length;R++)v._ptr[R]=0;for(var L=0;L<E.length;L++){var V=T[L],P=A[L],k=E[L],W=u(V,v._ptr[P],v._ptr[P+1],v._index);f(W,V,P,k,v._values,v._index,v._ptr)}return v},i.prototype.clone=function(){var h=new i({values:this._values?ut(this._values):void 0,index:ut(this._index),ptr:ut(this._ptr),size:ut(this._size),datatype:this._datatype});return h},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(h,b){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var y=this,D=this._size[0],v=this._size[1],A=Ya(h,y,"map"),w=function(E,T,_){return A.fn(E,[T,_],y)};return p(this,0,D-1,0,v-1,w,b)};function p(h,b,y,D,v,A,w){var x=[],E=[],T=[],_=r,C=0;Jr(h._datatype)&&(_=e.find(r,[h._datatype,h._datatype])||r,C=e.convert(0,h._datatype));for(var N=function(U,fe,xe){var oe=A(U,fe,xe);_(oe,C)||(x.push(oe),E.push(fe))},I=D;I<=v;I++){T.push(x.length);var R=h._ptr[I],L=h._ptr[I+1];if(w)for(var V=R;V<L;V++){var P=h._index[V];P>=b&&P<=y&&N(h._values[V],P-b,I-D)}else{for(var k={},W=R;W<L;W++){var O=h._index[W];k[O]=h._values[W]}for(var Q=b;Q<=y;Q++){var ne=Q in k?k[Q]:0;N(ne,Q-b,I-D)}}}return T.push(x.length),new i({values:x,index:E,ptr:T,size:[y-b+1,v-D+1]})}i.prototype.forEach=function(h,b){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var y=this,D=this._size[0],v=this._size[1],A=Ya(h,y,"forEach"),w=0;w<v;w++){var x=this._ptr[w],E=this._ptr[w+1];if(b)for(var T=x;T<E;T++){var _=this._index[T];A.fn(this._values[T],[_,w],y)}else{for(var C={},N=x;N<E;N++){var I=this._index[N];C[I]=this._values[N]}for(var R=0;R<D;R++){var L=R in C?C[R]:0;A.fn(L,[R,w],y)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var h=this._size[1],b=0;b<h;b++)for(var y=this._ptr[b],D=this._ptr[b+1],v=y;v<D;v++){var A=this._index[v];yield{value:this._values[v],index:[A,b]}}},i.prototype.toArray=function(){return d(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return d(this._values,this._index,this._ptr,this._size,!1)};function d(h,b,y,D,v){var A=D[0],w=D[1],x=[],E,T;for(E=0;E<A;E++)for(x[E]=[],T=0;T<w;T++)x[E][T]=0;for(T=0;T<w;T++)for(var _=y[T],C=y[T+1],N=_;N<C;N++)E=b[N],x[E][T]=h?v?ut(h[N]):h[N]:1;return x}return i.prototype.format=function(h){for(var b=this._size[0],y=this._size[1],D=this.density(),v="Sparse Matrix ["+Dt(b,h)+" x "+Dt(y,h)+"] density: "+Dt(D,h)+`
`,A=0;A<y;A++)for(var w=this._ptr[A],x=this._ptr[A+1],E=w;E<x;E++){var T=this._index[E];v+=`
(`+Dt(T,h)+", "+Dt(A,h)+") ==> "+(this._values?Dt(this._values[E],h):"X")}return v},i.prototype.toString=function(){return Dt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(h){if(h){if(ot(h)&&(h=h.toNumber()),!bt(h)||!He(h))throw new TypeError("The parameter k must be an integer number")}else h=0;var b=h>0?h:0,y=h<0?-h:0,D=this._size[0],v=this._size[1],A=Math.min(D-y,v-b),w=[],x=[],E=[];E[0]=0;for(var T=b;T<v&&w.length<A;T++)for(var _=this._ptr[T],C=this._ptr[T+1],N=_;N<C;N++){var I=this._index[N];if(I===T-b+y){w.push(this._values[N]),x[w.length-1]=I-y;break}}return E.push(w.length),new i({values:w,index:x,ptr:E,size:[A,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,b,y,D,v){if(!sr(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(O){if(ot(O)&&(O=O.toNumber()),!bt(O)||!He(O)||O<1)throw new Error("Size values must be positive integers");return O}),y){if(ot(y)&&(y=y.toNumber()),!bt(y)||!He(y))throw new TypeError("The parameter k must be an integer number")}else y=0;var A=r,w=0;Jr(v)&&(A=e.find(r,[v,v])||r,w=e.convert(0,v));var x=y>0?y:0,E=y<0?-y:0,T=h[0],_=h[1],C=Math.min(T-E,_-x),N;if(sr(b)){if(b.length!==C)throw new Error("Invalid value array length");N=function(Q){return b[Q]}}else if(Ye(b)){var I=b.size();if(I.length!==1||I[0]!==C)throw new Error("Invalid matrix length");N=function(Q){return b.get([Q])}}else N=function(){return b};for(var R=[],L=[],V=[],P=0;P<_;P++){V.push(R.length);var k=P-x;if(k>=0&&k<C){var W=N(k);A(W,w)||(L.push(k+E),R.push(W))}}return V.push(R.length),new i({values:R,index:L,ptr:V,size:[T,_]})},i.prototype.swapRows=function(h,b){if(!bt(h)||!He(h)||!bt(b)||!He(b))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Cr(h,this._size[0]),Cr(b,this._size[0]),i._swapRows(h,b,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(h,b,y,D,v){for(var A=D[h],w=D[h+1],x=A;x<w;x++)v(y[x],b[x])},i._swapRows=function(h,b,y,D,v,A){for(var w=0;w<y;w++){var x=A[w],E=A[w+1],T=u(h,x,E,v),_=u(b,x,E,v);if(T<E&&_<E&&v[T]===h&&v[_]===b){if(D){var C=D[T];D[T]=D[_],D[_]=C}continue}if(T<E&&v[T]===h&&(_>=E||v[_]!==b)){var N=D?D[T]:void 0;v.splice(_,0,b),D&&D.splice(_,0,N),v.splice(_<=T?T+1:T,1),D&&D.splice(_<=T?T+1:T,1);continue}if(_<E&&v[_]===b&&(T>=E||v[T]!==h)){var I=D?D[_]:void 0;v.splice(T,0,h),D&&D.splice(T,0,I),v.splice(T<=_?_+1:_,1),D&&D.splice(T<=_?_+1:_,1)}}},i},{isClass:!0});var zG="number",HG=["typed"];function GG(t){var e=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var r={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:t,radix:r,integerPart:n,fractionalPart:i}}else return null}function WG(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is not a valid number');return a}var GE=M(zG,HG,t=>{var{typed:e}=t,r=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=GG(i);if(a)return WG(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var YG="bigint",jG=["typed"],WE=M(YG,jG,t=>{var{typed:e}=t,r=e("bigint",{"":function(){return 0n},bigint:function(i){return i},number:function(i){return BigInt(i.toFixed())},BigNumber:function(i){return BigInt(i.round().toString())},Fraction:function(i){return BigInt(i.valueOf().toFixed())},"string | boolean":function(i){return BigInt(i)},null:function(i){return 0n},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))});return r.fromJSON=function(n){return BigInt(n.value)},r});var YE="string",ZG=["typed"],jE=M(YE,ZG,t=>{var{typed:e}=t;return e(YE,{"":function(){return""},number:go,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r)),any:function(n){return String(n)}})});var ZE="boolean",JG=["typed"],JE=M(ZE,JG,t=>{var{typed:e}=t;return e(ZE,{"":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(r=>n=>Ke(n,r))})});var XG="bignumber",QG=["typed","BigNumber"],XE=M(XG,QG,t=>{var{typed:e,BigNumber:r}=t;return e("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},bigint:function(i){return new r(i.toString())},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new r(String(i.n)).div(String(i.d)).times(String(i.s))},null:function(i){return new r(0)},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var KG="complex",eW=["typed","Complex"],QE=M(KG,eW,t=>{var{typed:e,Complex:r}=t;return e("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(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=>Ke(i,n))})});var tW="fraction",rW=["typed","Fraction"],KE=M(tW,rW,t=>{var{typed:e,Fraction:r}=t;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},"bigint, bigint":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},bigint:function(i){return new r(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 r(i)},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var eT="matrix",nW=["typed","Matrix","DenseMatrix","SparseMatrix"],tT=M(eT,nW,t=>{var{typed:e,Matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(eT,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}});var rT="matrixFromFunction",iW=["typed","matrix","isZero"],nT=M(rT,iW,t=>{var{typed:e,matrix:r,isZero:n}=t;return e(rT,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,f){var m=o(f);n(m)||u.set(f,m)}),u}});var iT="matrixFromRows",aW=["typed","matrix","flatten","size"],aT=M(iT,aW,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(iT,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var f=o(c);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[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 oT="matrixFromColumns",oW=["typed","matrix","flatten","size"],sT=M(oT,oW,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(oT,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c<l;c++)u[c]=[];for(var f of s){var m=o(f);if(m!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(m|0));for(var p=n(f),d=0;d<l;d++)u[d].push(p[d])}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[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 uT="splitUnit",sW=["typed"],lT=M(uT,sW,t=>{var{typed:e}=t;return e(uT,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var cT="unaryMinus",uW=["typed"],fT=M(cT,uW,t=>{var{typed:e}=t;return e(cT,{number:Xx,"Complex | BigNumber | Fraction":r=>r.neg(),bigint:r=>-r,Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=e.find(r,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r,!0))})});var pT="unaryPlus",lW=["typed","config","numeric"],mT=M(pT,lW,t=>{var{typed:e,config:r,numeric:n}=t;return e(pT,{number:Qx,Complex:function(a){return a},BigNumber:function(a){return a},bigint:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>Ke(a,i,!0)),boolean:function(a){return n(a?1:0,r.number)},string:function(a){return n(a,xi(a,r))}})});var dT="abs",cW=["typed"],hT=M(dT,cW,t=>{var{typed:e}=t;return e(dT,{number:Yx,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),bigint:r=>r<0n?-r:r,"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r,!0))})});var gT="mapSlices",fW=["typed","isInteger"],ip=M(gT,fW,t=>{var{typed:e,isInteger:r}=t;return e(gT,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?ct(i):i.size();if(a<0||a>=s.length)throw new Zn(a,s.length);return Ye(i)?i.create(og(i.valueOf(),a,o),i.datatype()):og(i,a,o)}})},{formerly:"apply"});function og(t,e,r){var n,i,a;if(e<=0)if(Array.isArray(t[0])){for(a=pW(t),i=[],n=0;n<a.length;n++)i[n]=og(a[n],e-1,r);return i}else return r(t);else{for(i=[],n=0;n<t.length;n++)i[n]=og(t[n],e-1,r);return i}}function pW(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}var vT="addScalar",mW=["typed"],yT=M(vT,mW,t=>{var{typed:e}=t;return e(vT,{"number, number":jx,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"bigint, bigint":function(n,i){return n+i},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(r=>(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(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var bT="subtractScalar",dW=["typed"],xT=M(bT,dW,t=>{var{typed:e}=t;return e(bT,{"number, number":Zx,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"bigint, bigint":function(n,i){return n-i},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(r=>(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(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var wT="cbrt",hW=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],_T=M(wT,hW,t=>{var{config:e,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=t;return r(wT,{number:Dc,Complex:u,"Complex, boolean":u,BigNumber:function(m){return m.cbrt()},Unit:c});function u(f,m){var p=f.arg()/3,d=f.abs(),h=new o(Dc(d),0).mul(new o(0,p).exp());if(m){var b=[h,new o(Dc(d),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(Dc(d),0).mul(new o(0,p-Math.PI*2/3).exp())];return e.matrix==="Array"?b:a(b)}else return h}function c(f){if(f.value&&Hn(f.value)){var m=f.clone();return m.value=1,m=m.pow(1/3),m.value=u(f.value),m}else{var p=n(f.value);p&&(f.value=i(f.value));var d;ot(f.value)?d=new s(1).div(3):ba(f.value)?d=new l(1,3):d=1/3;var h=f.pow(d);return p&&(h.value=i(h.value)),h}}});var gW="matAlgo11xS0s",vW=["typed","equalScalar"],Er=M(gW,vW,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,b=r,y=0,D=o;typeof m=="string"&&(h=m,b=e.find(r,[h,h]),y=e.convert(0,h),a=e.convert(a,h),D=e.find(o,[h,h]));for(var v=[],A=[],w=[],x=0;x<d;x++){w[x]=A.length;for(var E=c[x],T=c[x+1],_=E;_<T;_++){var C=u[_],N=s?D(a,l[_]):D(l[_],a);b(N,y)||(A.push(C),v.push(N))}}return w[d]=A.length,i.createSparseMatrix({values:v,index:A,ptr:w,size:[p,d],datatype:h})}});var yW="matAlgo12xSfs",bW=["typed","DenseMatrix"],mr=M(yW,bW,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,b=o;typeof m=="string"&&(h=m,a=e.convert(a,h),b=e.find(o,[h,h]));for(var y=[],D=[],v=[],A=0;A<d;A++){for(var w=A+1,x=c[A],E=c[A+1],T=x;T<E;T++){var _=u[T];D[_]=l[T],v[_]=w}for(var C=0;C<p;C++)A===0&&(y[C]=[]),v[C]===w?y[C][A]=s?b(a,D[C]):b(D[C],a):y[C][A]=s?b(a,0):b(0,a)}return new r({data:y,size:[p,d],datatype:h})}});var xW="matAlgo14xDs",wW=["typed"],xn=M(xW,wW,t=>{var{typed:e}=t;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,f,m=o;typeof c=="string"&&(f=c,a=e.convert(a,f),m=e.find(o,[f,f]));var p=u.length>0?r(m,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:ut(u),datatype:f})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=u?n(l,s[f]):n(s[f],l);else for(var m=0;m<o;m++)c[m]=r(n,i+1,a,a[i+1],s[m],l,u);return c}});var L0="ceil",_W=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],AW=new Zu(10),DW=M(L0,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;function i(a){var o=Math.ceil(a),s=n(a);return o===s?o:zr(a,s,r.relTol,r.absTol)&&!zr(a,o,r.relTol,r.absTol)?s:o}return e(L0,{number:i,"number, number":function(o,s){if(!He(s))throw new RangeError("number of decimals in function ceil must be an integer");if(s<0||s>15)throw new RangeError("number of decimals in ceil number must be in range 0-15");var l=10**s;return i(o*l)/l}})}),AT=M(L0,_W,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Er({typed:e,equalScalar:a}),u=mr({typed:e,DenseMatrix:s}),c=xn({typed:e}),f=DW({typed:e,config:r,round:n});function m(p){var d=(y,D)=>gn(y,D,r.relTol,r.absTol),h=p.ceil(),b=n(p);return h.eq(b)?h:d(p,b)&&!d(p,h)?b:h}return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(d){return d.ceil()},"Complex, number":function(d,h){return d.ceil(h)},"Complex, BigNumber":function(d,h){return d.ceil(h.toNumber())},BigNumber:m,"BigNumber, BigNumber":function(d,h){var b=AW.pow(h);return m(d.mul(b)).div(b)},bigint:p=>p,"bigint, number":(p,d)=>p,"bigint, BigNumber":(p,d)=>p,Fraction:function(d){return d.ceil()},"Fraction, number":function(d,h){return d.ceil(h)},"Fraction, BigNumber":function(d,h){return d.ceil(h.toNumber())},"Unit, number, Unit":e.referToSelf(p=>function(d,h,b){var y=d.toNumeric(b);return b.multiply(p(y,h))}),"Unit, BigNumber, Unit":e.referToSelf(p=>(d,h,b)=>p(d,h.toNumber(),b)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(p=>(d,h,b)=>Ke(d,y=>p(y,h,b),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(p=>(d,h)=>p(d,0,h)),"Array | Matrix":e.referToSelf(p=>d=>Ke(d,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(d,h)=>Ke(d,b=>p(b,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(d,h)=>l(d,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(d,h)=>c(d,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(d,h)=>c(i(h),d,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(d,h)=>a(d,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,d,p,!0):u(h,d,p,!0))})});var DT="cube",SW=["typed"],ST=M(DT,SW,t=>{var{typed:e}=t;return e(DT,{number:Kx,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},bigint:function(n){return n*n*n},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var ET="exp",EW=["typed"],TT=M(ET,EW,t=>{var{typed:e}=t;return e(ET,{number:e0,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var MT="expm1",TW=["typed","Complex"],CT=M(MT,TW,t=>{var{typed:e,Complex:r}=t;return e(MT,{number:t0,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var V0="fix",MW=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],CW=M(V0,["typed","ceil","floor"],t=>{var{typed:e,ceil:r,floor:n}=t;return e(V0,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),NT=M(V0,MW,t=>{var{typed:e,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=t,u=mr({typed:e,DenseMatrix:l}),c=xn({typed:e}),f=CW({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,d){return new r(p.re>0?a(p.re,d):i(p.re,d),p.im>0?a(p.im,d):i(p.im,d))},"Complex, BigNumber":function(p,d){var h=d.toNumber();return new r(p.re>0?a(p.re,h):i(p.re,h),p.im>0?a(p.im,h):i(p.im,h))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,d){return p.isNegative()?i(p,d):a(p,d)},bigint:m=>m,"bigint, number":(m,p)=>m,"bigint, BigNumber":(m,p)=>m,Fraction:function(p){return p.s<0n?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,d){return p.s<0n?i(p,d):a(p,d)},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var b=p.toNumeric(h);return h.multiply(m(b,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>Ke(p,b=>m(b,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>Ke(p,m,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(m=>(p,d)=>Ke(p,h=>m(h,d),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(n(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>o(p,0)?s(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var U0="floor",NW=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],FW=new Zu(10),IW=M(U0,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;function i(a){var o=Math.floor(a),s=n(a);return o===s?o:zr(a,s,r.relTol,r.absTol)&&!zr(a,o,r.relTol,r.absTol)?s:o}return e(U0,{number:i,"number, number":function(o,s){if(!He(s))throw new RangeError("number of decimals in function floor must be an integer");if(s<0||s>15)throw new RangeError("number of decimals in floor number must be in range 0 - 15");var l=10**s;return i(o*l)/l}})}),sg=M(U0,NW,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Er({typed:e,equalScalar:a}),u=mr({typed:e,DenseMatrix:s}),c=xn({typed:e}),f=IW({typed:e,config:r,round:n});function m(p){var d=(y,D)=>gn(y,D,r.relTol,r.absTol),h=p.floor(),b=n(p);return h.eq(b)?h:d(p,b)&&!d(p,h)?b:h}return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(d){return d.floor()},"Complex, number":function(d,h){return d.floor(h)},"Complex, BigNumber":function(d,h){return d.floor(h.toNumber())},BigNumber:m,"BigNumber, BigNumber":function(d,h){var b=FW.pow(h);return m(d.mul(b)).div(b)},bigint:p=>p,"bigint, number":(p,d)=>p,"bigint, BigNumber":(p,d)=>p,Fraction:function(d){return d.floor()},"Fraction, number":function(d,h){return d.floor(h)},"Fraction, BigNumber":function(d,h){return d.floor(h.toNumber())},"Unit, number, Unit":e.referToSelf(p=>function(d,h,b){var y=d.toNumeric(b);return b.multiply(p(y,h))}),"Unit, BigNumber, Unit":e.referToSelf(p=>(d,h,b)=>p(d,h.toNumber(),b)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(p=>(d,h,b)=>Ke(d,y=>p(y,h,b),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(p=>(d,h)=>p(d,0,h)),"Array | Matrix":e.referToSelf(p=>d=>Ke(d,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(d,h)=>Ke(d,b=>p(b,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(d,h)=>l(d,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(d,h)=>c(d,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(d,h)=>c(i(h),d,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(d,h)=>a(d,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,d,p,!0):u(h,d,p,!0))})});var BW="matAlgo02xDS0",kW=["typed","equalScalar"],wn=M(BW,kW,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype||i.getDataType(),f=a._values,m=a._index,p=a._ptr,d=a._size,h=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(u.length!==d.length)throw new Et(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var b=u[0],y=u[1],D,v=r,A=0,w=o;typeof c=="string"&&c===h&&c!=="mixed"&&(D=c,v=e.find(r,[D,D]),A=e.convert(0,D),w=e.find(o,[D,D]));for(var x=[],E=[],T=[],_=0;_<y;_++){T[_]=E.length;for(var C=p[_],N=p[_+1],I=C;I<N;I++){var R=m[I],L=s?w(f[I],l[R][_]):w(l[R][_],f[I]);v(L,A)||(E.push(R),x.push(L))}}return T[y]=E.length,a.createSparseMatrix({values:x,index:E,ptr:T,size:[b,y],datatype:c===i._datatype&&h===a._datatype?D:void 0})}});var PW="matAlgo03xDSf",$W=["typed"],Ur=M(PW,$W,t=>{var{typed:e}=t;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,m=i._ptr,p=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new Et(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=l[0],b=l[1],y,D=0,v=a;typeof u=="string"&&u===d&&u!=="mixed"&&(y=u,D=e.convert(0,y),v=e.find(a,[y,y]));for(var A=[],w=0;w<h;w++)A[w]=[];for(var x=[],E=[],T=0;T<b;T++){for(var _=T+1,C=m[T],N=m[T+1],I=C;I<N;I++){var R=f[I];x[R]=o?v(c[I],s[R][T]):v(s[R][T],c[I]),E[R]=_}for(var L=0;L<h;L++)E[L]===_?A[L][T]=x[L]:A[L][T]=o?v(D,s[L][T]):v(s[L][T],D)}return n.createDenseMatrix({data:A,size:[h,b],datatype:u===n._datatype&&d===i._datatype?y:void 0})}});var OW="matAlgo05xSfSf",RW=["typed","equalScalar"],uu=M(OW,RW,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,b=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Et(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var y=c[0],D=c[1],v,A=r,w=0,x=o;typeof f=="string"&&f===b&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),x=e.find(o,[v,v]));var E=s&&m?[]:void 0,T=[],_=[],C=E?[]:void 0,N=E?[]:void 0,I=[],R=[],L,V,P,k;for(V=0;V<D;V++){_[V]=T.length;var W=V+1;for(P=u[V],k=u[V+1];P<k;P++)L=l[P],T.push(L),I[L]=W,C&&(C[L]=s[P]);for(P=d[V],k=d[V+1];P<k;P++)L=p[P],I[L]!==W&&T.push(L),R[L]=W,N&&(N[L]=m[P]);if(E)for(P=_[V];P<T.length;){L=T[P];var O=I[L],Q=R[L];if(O===W||Q===W){var ne=O===W?C[L]:w,X=Q===W?N[L]:w,U=x(ne,X);A(U,w)?T.splice(P,1):(E.push(U),P++)}}}return _[D]=T.length,i.createSparseMatrix({values:E,index:T,ptr:_,size:[y,D],datatype:f===i._datatype&&b===a._datatype?v:void 0})}});var LW="matAlgo13xDD",VW=["typed"],FT=M(LW,VW,t=>{var{typed:e}=t;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,f=a._size,m=a._datatype,p=[];if(l.length!==f.length)throw new Et(l.length,f.length);for(var d=0;d<l.length;d++){if(l[d]!==f[d])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");p[d]=l[d]}var h,b=o;typeof u=="string"&&u===m&&(h=u,b=e.find(o,[h,h]));var y=p.length>0?r(b,0,p,p[0],s,c):[];return i.createDenseMatrix({data:y,size:p,datatype:h})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c<o;c++)u[c]=n(s[c],l[c]);else for(var f=0;f<o;f++)u[f]=r(n,i+1,a,a[i+1],s[f],l[f]);return u}});function Jn(t,e){if(Qi(t.size(),e.size()))return[t,e];var r=Qf(t.size(),e.size());return[t,e].map(n=>UW(n,r))}function UW(t,e){return Qi(t.size(),e)?t:t.create(Vo(t.valueOf(),e),t.datatype())}var qW="matrixAlgorithmSuite",zW=["typed","matrix"],Ft=M(qW,zW,t=>{var{typed:e,matrix:r}=t,n=FT({typed:e}),i=xn({typed:e});return function(o){var s=o.elop,l=o.SD||o.DS,u;s?(u={"DenseMatrix, DenseMatrix":(p,d)=>n(...Jn(p,d),s),"Array, Array":(p,d)=>n(...Jn(r(p),r(d)),s).valueOf(),"Array, DenseMatrix":(p,d)=>n(...Jn(r(p),d),s),"DenseMatrix, Array":(p,d)=>n(...Jn(p,r(d)),s)},o.SS&&(u["SparseMatrix, SparseMatrix"]=(p,d)=>o.SS(...Jn(p,d),s,!1)),o.DS&&(u["DenseMatrix, SparseMatrix"]=(p,d)=>o.DS(...Jn(p,d),s,!1),u["Array, SparseMatrix"]=(p,d)=>o.DS(...Jn(r(p),d),s,!1)),l&&(u["SparseMatrix, DenseMatrix"]=(p,d)=>l(...Jn(d,p),s,!0),u["SparseMatrix, Array"]=(p,d)=>l(...Jn(r(d),p),s,!0))):(u={"DenseMatrix, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...Jn(d,h),p)),"Array, Array":e.referToSelf(p=>(d,h)=>n(...Jn(r(d),r(h)),p).valueOf()),"Array, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...Jn(r(d),h),p)),"DenseMatrix, Array":e.referToSelf(p=>(d,h)=>n(...Jn(d,r(h)),p))},o.SS&&(u["SparseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.SS(...Jn(d,h),p,!1))),o.DS&&(u["DenseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...Jn(d,h),p,!1)),u["Array, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...Jn(r(d),h),p,!1))),l&&(u["SparseMatrix, DenseMatrix"]=e.referToSelf(p=>(d,h)=>l(...Jn(h,d),p,!0)),u["SparseMatrix, Array"]=e.referToSelf(p=>(d,h)=>l(...Jn(r(h),d),p,!0))));var c=o.scalar||"any",f=o.Ds||o.Ss;f&&(s?(u["DenseMatrix,"+c]=(p,d)=>i(p,d,s,!1),u[c+", DenseMatrix"]=(p,d)=>i(d,p,s,!0),u["Array,"+c]=(p,d)=>i(r(p),d,s,!1).valueOf(),u[c+", Array"]=(p,d)=>i(r(d),p,s,!0).valueOf()):(u["DenseMatrix,"+c]=e.referToSelf(p=>(d,h)=>i(d,h,p,!1)),u[c+", DenseMatrix"]=e.referToSelf(p=>(d,h)=>i(h,d,p,!0)),u["Array,"+c]=e.referToSelf(p=>(d,h)=>i(r(d),h,p,!1).valueOf()),u[c+", Array"]=e.referToSelf(p=>(d,h)=>i(r(h),d,p,!0).valueOf())));var m=o.sS!==void 0?o.sS:o.Ss;return s?(o.Ss&&(u["SparseMatrix,"+c]=(p,d)=>o.Ss(p,d,s,!1)),m&&(u[c+", SparseMatrix"]=(p,d)=>m(d,p,s,!0))):(o.Ss&&(u["SparseMatrix,"+c]=e.referToSelf(p=>(d,h)=>o.Ss(d,h,p,!1))),m&&(u[c+", SparseMatrix"]=e.referToSelf(p=>(d,h)=>m(h,d,p,!0)))),s&&s.signatures&&Fh(u,s.signatures),u}});var IT="mod",HW=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],ug=M(IT,HW,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}=t,u=sg({typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=wn({typed:e,equalScalar:a}),f=Ur({typed:e}),m=uu({typed:e,equalScalar:a}),p=Er({typed:e,equalScalar:a}),d=mr({typed:e,DenseMatrix:s}),h=Ft({typed:e,matrix:i,concat:l});return e(IT,{"number, number":b,"BigNumber, BigNumber":function(D,v){return v.isZero()?D:D.sub(v.mul(u(D.div(v))))},"bigint, bigint":function(D,v){if(v===0n)return D;if(D<0){var A=D%v;return A===0n?A:A+v}return D%v},"Fraction, Fraction":function(D,v){return v.equals(0)?D:D.sub(v.mul(u(D.div(v))))}},h({SS:m,DS:f,SD:c,Ss:p,sS:d}));function b(y,D){return D===0?y:y-D*u(y/D)}});var GW="matAlgo01xDSid",WW=["typed"],Ai=M(GW,WW,t=>{var{typed:e}=t;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,m=i._ptr,p=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new Et(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=l[0],b=l[1],y=typeof u=="string"&&u!=="mixed"&&u===d?u:void 0,D=y?e.find(a,[y,y]):a,v,A,w=[];for(v=0;v<h;v++)w[v]=[];var x=[],E=[];for(A=0;A<b;A++){for(var T=A+1,_=m[A],C=m[A+1],N=_;N<C;N++)v=f[N],x[v]=o?D(c[N],s[v][A]):D(s[v][A],c[N]),E[v]=T;for(v=0;v<h;v++)E[v]===T?w[v][A]=x[v]:w[v][A]=s[v][A]}return n.createDenseMatrix({data:w,size:[h,b],datatype:u===n._datatype&&d===i._datatype?y:void 0})}});var YW="matAlgo04xSidSid",jW=["typed","equalScalar"],Tc=M(YW,jW,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,b=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Et(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var y=c[0],D=c[1],v,A=r,w=0,x=o;typeof f=="string"&&f===b&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),x=e.find(o,[v,v]));var E=s&&m?[]:void 0,T=[],_=[],C=s&&m?[]:void 0,N=s&&m?[]:void 0,I=[],R=[],L,V,P,k,W;for(V=0;V<D;V++){_[V]=T.length;var O=V+1;for(k=u[V],W=u[V+1],P=k;P<W;P++)L=l[P],T.push(L),I[L]=O,C&&(C[L]=s[P]);for(k=d[V],W=d[V+1],P=k;P<W;P++)if(L=p[P],I[L]===O){if(C){var Q=x(C[L],m[P]);A(Q,w)?I[L]=null:C[L]=Q}}else T.push(L),R[L]=O,N&&(N[L]=m[P]);if(C&&N)for(P=_[V];P<T.length;)L=T[P],I[L]===O?(E[P]=C[L],P++):R[L]===O?(E[P]=N[L],P++):T.splice(P,1)}return _[D]=T.length,i.createSparseMatrix({values:E,index:T,ptr:_,size:[y,D],datatype:f===i._datatype&&b===a._datatype?v:void 0})}});var ZW="matAlgo10xSids",JW=["typed","DenseMatrix"],ra=M(ZW,JW,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,b=o;typeof m=="string"&&(h=m,a=e.convert(a,h),b=e.find(o,[h,h]));for(var y=[],D=[],v=[],A=0;A<d;A++){for(var w=A+1,x=c[A],E=c[A+1],T=x;T<E;T++){var _=u[T];D[_]=l[T],v[_]=w}for(var C=0;C<p;C++)A===0&&(y[C]=[]),v[C]===w?y[C][A]=s?b(a,D[C]):b(D[C],a):y[C][A]=a}return new r({data:y,size:[p,d],datatype:h})}});function Aa(t,e,r,n){if(!(this instanceof Aa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+r+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}Aa.prototype=new Error;Aa.prototype.constructor=Error;Aa.prototype.name="ArgumentsError";Aa.prototype.isArgumentsError=!0;var BT="gcd",XW=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],q0="number | BigNumber | Fraction | Matrix | Array",QW="".concat(q0,", ").concat(q0,", ...").concat(q0);function kT(t){return!t.some(e=>Array.isArray(e))}var PT=M(BT,XW,t=>{var{typed:e,matrix:r,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l,concat:u}=t,c=ug({typed:e,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}),f=Ai({typed:e}),m=Tc({typed:e,equalScalar:a}),p=ra({typed:e,DenseMatrix:l}),d=Ft({typed:e,matrix:r,concat:u});return e(BT,{"number, number":h,"BigNumber, BigNumber":b,"Fraction, Fraction":(y,D)=>y.gcd(D)},d({SS:m,DS:f,Ss:p}),{[QW]:e.referToSelf(y=>(D,v,A)=>{for(var w=y(D,v),x=0;x<A.length;x++)w=y(w,A[x]);return w}),Array:e.referToSelf(y=>D=>{if(D.length===1&&Array.isArray(D[0])&&kT(D[0]))return y(...D[0]);if(kT(D))return y(...D);throw new Aa("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(y=>D=>y(D.toArray()))});function h(y,D){if(!He(y)||!He(D))throw new Error("Parameters in function gcd must be integer numbers");for(var v;D!==0;)v=c(y,D),y=D,D=v;return y<0?-y:y}function b(y,D){if(!y.isInt()||!D.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new s(0);!D.isZero();){var A=c(y,D);y=D,D=A}return y.lt(v)?y.neg():y}});var KW="matAlgo06xS0S0",eY=["typed","equalScalar"],lu=M(KW,eY,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==f.length)throw new Et(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");var p=l[0],d=l[1],h,b=r,y=0,D=o;typeof u=="string"&&u===m&&u!=="mixed"&&(h=u,b=e.find(r,[h,h]),y=e.convert(0,h),D=e.find(o,[h,h]));for(var v=s&&c?[]:void 0,A=[],w=[],x=v?[]:void 0,E=[],T=[],_=0;_<d;_++){w[_]=A.length;var C=_+1;if(Wx(i,_,E,x,T,C,A,D),Wx(a,_,E,x,T,C,A,D),x)for(var N=w[_];N<A.length;){var I=A[N];if(T[I]===C){var R=x[I];b(R,y)?A.splice(N,1):(v.push(R),N++)}else A.splice(N,1)}else for(var L=w[_];L<A.length;){var V=A[L];T[V]!==C?A.splice(L,1):L++}}return w[d]=A.length,i.createSparseMatrix({values:v,index:A,ptr:w,size:[p,d],datatype:u===i._datatype&&m===a._datatype?h:void 0})}});var $T="lcm",tY=["typed","matrix","equalScalar","concat"],OT=M($T,tY,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=wn({typed:e,equalScalar:n}),o=lu({typed:e,equalScalar:n}),s=Er({typed:e,equalScalar:n}),l=Ft({typed:e,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=e.referToSelf(m=>(p,d,h)=>{for(var b=m(p,d),y=0;y<h.length;y++)b=m(b,h[y]);return b}),e($T,{"number, number":r0,"BigNumber, BigNumber":f,"Fraction, Fraction":(m,p)=>m.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function f(m,p){if(!m.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(m.isZero())return m;if(p.isZero())return p;for(var d=m.times(p);!p.isZero();){var h=p;p=m.mod(h),m=h}return d.div(m).abs()}});function Mc(t,e,r,n){return function(i){if(i>0||r.predictable){if(i<=0)return NaN;var a=i.toString(16),o=a.substring(0,15);return t*(a.length-o.length)+e(+("0x"+o))}return n(i.toNumber())}}var RT="log10",rY=["typed","config","Complex"],nY=ep(16),LT=M(RT,rY,t=>{var{typed:e,config:r,Complex:n}=t;function i(o){return o.log().div(Math.LN10)}function a(o){return i(new n(o,0))}return e(RT,{number:function(s){return s>=0||r.predictable?ep(s):a(s)},bigint:Mc(nY,ep,r,a),Complex:i,BigNumber:function(s){return!s.isNegative()||r.predictable?s.log():a(s.toNumber())},"Array | Matrix":e.referToSelf(o=>s=>Ke(s,o))})});var VT="log2",iY=["typed","config","Complex"],UT=M(VT,iY,t=>{var{typed:e,config:r,Complex:n}=t;function i(o){return a(new n(o,0))}return e(VT,{number:function(s){return s>=0||r.predictable?eg(s):i(s)},bigint:Mc(4,eg,r,i),Complex:a,BigNumber:function(s){return!s.isNegative()||r.predictable?s.log(2):i(s.toNumber())},"Array | Matrix":e.referToSelf(o=>s=>Ke(s,o))});function a(o){var s=Math.sqrt(o.re*o.re+o.im*o.im);return new n(Math.log2?Math.log2(s):Math.log(s)/Math.LN2,Math.atan2(o.im,o.re)/Math.LN2)}});var aY="multiplyScalar",oY=["typed"],qT=M(aY,oY,t=>{var{typed:e}=t;return e("multiplyScalar",{"number, number":Jx,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"bigint, bigint":function(n,i){return n*i},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})});var zT="multiply",sY=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],HT=M(zT,sY,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=t,s=Er({typed:e,equalScalar:a}),l=xn({typed:e});function u(w,x){switch(w.length){case 1:switch(x.length){case 1:if(w[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;case 2:switch(x.length){case 1:if(w[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+x[0]+")");break;case 2:if(w[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,x,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(w,x)}function f(w,x){if(x.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return m(w,x)}function m(w,x){var E=w._data,T=w._size,_=w._datatype||w.getDataType(),C=x._data,N=x._size,I=x._datatype||x.getDataType(),R=T[0],L=N[1],V,P=n,k=i;_&&I&&_===I&&typeof _=="string"&&_!=="mixed"&&(V=_,P=e.find(n,[V,V]),k=e.find(i,[V,V]));for(var W=[],O=0;O<L;O++){for(var Q=k(E[0],C[0][O]),ne=1;ne<R;ne++)Q=P(Q,k(E[ne],C[ne][O]));W[O]=Q}return w.createDenseMatrix({data:W,size:[L],datatype:_===w._datatype&&I===x._datatype?V:void 0})}var p=e("_multiplyMatrixVector",{"DenseMatrix, any":h,"SparseMatrix, any":D}),d=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":b,"DenseMatrix, SparseMatrix":y,"SparseMatrix, DenseMatrix":v,"SparseMatrix, SparseMatrix":A});function h(w,x){var E=w._data,T=w._size,_=w._datatype||w.getDataType(),C=x._data,N=x._datatype||x.getDataType(),I=T[0],R=T[1],L,V=n,P=i;_&&N&&_===N&&typeof _=="string"&&_!=="mixed"&&(L=_,V=e.find(n,[L,L]),P=e.find(i,[L,L]));for(var k=[],W=0;W<I;W++){for(var O=E[W],Q=P(O[0],C[0]),ne=1;ne<R;ne++)Q=V(Q,P(O[ne],C[ne]));k[W]=Q}return w.createDenseMatrix({data:k,size:[I],datatype:_===w._datatype&&N===x._datatype?L:void 0})}function b(w,x){var E=w._data,T=w._size,_=w._datatype||w.getDataType(),C=x._data,N=x._size,I=x._datatype||x.getDataType(),R=T[0],L=T[1],V=N[1],P,k=n,W=i;_&&I&&_===I&&typeof _=="string"&&_!=="mixed"&&_!=="mixed"&&(P=_,k=e.find(n,[P,P]),W=e.find(i,[P,P]));for(var O=[],Q=0;Q<R;Q++){var ne=E[Q];O[Q]=[];for(var X=0;X<V;X++){for(var U=W(ne[0],C[0][X]),fe=1;fe<L;fe++)U=k(U,W(ne[fe],C[fe][X]));O[Q][X]=U}}return w.createDenseMatrix({data:O,size:[R,V],datatype:_===w._datatype&&I===x._datatype?P:void 0})}function y(w,x){var E=w._data,T=w._size,_=w._datatype||w.getDataType(),C=x._values,N=x._index,I=x._ptr,R=x._size,L=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var V=T[0],P=R[1],k,W=n,O=i,Q=a,ne=0;_&&L&&_===L&&typeof _=="string"&&_!=="mixed"&&(k=_,W=e.find(n,[k,k]),O=e.find(i,[k,k]),Q=e.find(a,[k,k]),ne=e.convert(0,k));for(var X=[],U=[],fe=[],xe=x.createSparseMatrix({values:X,index:U,ptr:fe,size:[V,P],datatype:_===w._datatype&&L===x._datatype?k:void 0}),oe=0;oe<P;oe++){fe[oe]=U.length;var be=I[oe],ee=I[oe+1];if(ee>be)for(var Z=0,re=0;re<V;re++){for(var me=re+1,ce=void 0,Ae=be;Ae<ee;Ae++){var we=N[Ae];Z!==me?(ce=O(E[re][we],C[Ae]),Z=me):ce=W(ce,O(E[re][we],C[Ae]))}Z===me&&!Q(ce,ne)&&(U.push(re),X.push(ce))}}return fe[P]=U.length,xe}function D(w,x){var E=w._values,T=w._index,_=w._ptr,C=w._datatype||w._data===void 0?w._datatype:w.getDataType();if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=x._data,I=x._datatype||x.getDataType(),R=w._size[0],L=x._size[0],V=[],P=[],k=[],W,O=n,Q=i,ne=a,X=0;C&&I&&C===I&&typeof C=="string"&&C!=="mixed"&&(W=C,O=e.find(n,[W,W]),Q=e.find(i,[W,W]),ne=e.find(a,[W,W]),X=e.convert(0,W));var U=[],fe=[];k[0]=0;for(var xe=0;xe<L;xe++){var oe=N[xe];if(!ne(oe,X))for(var be=_[xe],ee=_[xe+1],Z=be;Z<ee;Z++){var re=T[Z];fe[re]?U[re]=O(U[re],Q(oe,E[Z])):(fe[re]=!0,P.push(re),U[re]=Q(oe,E[Z]))}}for(var me=P.length,ce=0;ce<me;ce++){var Ae=P[ce];V[ce]=U[Ae]}return k[1]=P.length,w.createSparseMatrix({values:V,index:P,ptr:k,size:[R,1],datatype:C===w._datatype&&I===x._datatype?W:void 0})}function v(w,x){var E=w._values,T=w._index,_=w._ptr,C=w._datatype||w._data===void 0?w._datatype:w.getDataType();if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=x._data,I=x._datatype||x.getDataType(),R=w._size[0],L=x._size[0],V=x._size[1],P,k=n,W=i,O=a,Q=0;C&&I&&C===I&&typeof C=="string"&&C!=="mixed"&&(P=C,k=e.find(n,[P,P]),W=e.find(i,[P,P]),O=e.find(a,[P,P]),Q=e.convert(0,P));for(var ne=[],X=[],U=[],fe=w.createSparseMatrix({values:ne,index:X,ptr:U,size:[R,V],datatype:C===w._datatype&&I===x._datatype?P:void 0}),xe=[],oe=[],be=0;be<V;be++){U[be]=X.length;for(var ee=be+1,Z=0;Z<L;Z++){var re=N[Z][be];if(!O(re,Q))for(var me=_[Z],ce=_[Z+1],Ae=me;Ae<ce;Ae++){var we=T[Ae];oe[we]!==ee?(oe[we]=ee,X.push(we),xe[we]=W(re,E[Ae])):xe[we]=k(xe[we],W(re,E[Ae]))}}for(var G=U[be],J=X.length,ge=G;ge<J;ge++){var ye=X[ge];ne[ge]=xe[ye]}}return U[V]=X.length,fe}function A(w,x){var E=w._values,T=w._index,_=w._ptr,C=w._datatype||w._data===void 0?w._datatype:w.getDataType(),N=x._values,I=x._index,R=x._ptr,L=x._datatype||x._data===void 0?x._datatype:x.getDataType(),V=w._size[0],P=x._size[1],k=E&&N,W,O=n,Q=i;C&&L&&C===L&&typeof C=="string"&&C!=="mixed"&&(W=C,O=e.find(n,[W,W]),Q=e.find(i,[W,W]));for(var ne=k?[]:void 0,X=[],U=[],fe=w.createSparseMatrix({values:ne,index:X,ptr:U,size:[V,P],datatype:C===w._datatype&&L===x._datatype?W:void 0}),xe=k?[]:void 0,oe=[],be,ee,Z,re,me,ce,Ae,we,G=0;G<P;G++){U[G]=X.length;var J=G+1;for(me=R[G],ce=R[G+1],re=me;re<ce;re++)if(we=I[re],k)for(ee=_[we],Z=_[we+1],be=ee;be<Z;be++)Ae=T[be],oe[Ae]!==J?(oe[Ae]=J,X.push(Ae),xe[Ae]=Q(N[re],E[be])):xe[Ae]=O(xe[Ae],Q(N[re],E[be]));else for(ee=_[we],Z=_[we+1],be=ee;be<Z;be++)Ae=T[be],oe[Ae]!==J&&(oe[Ae]=J,X.push(Ae));if(k)for(var ge=U[G],ye=X.length,De=ge;De<ye;De++){var Ie=X[De];ne[De]=xe[Ie]}}return U[P]=X.length,fe}return e(zT,i,{"Array, Array":e.referTo("Matrix, Matrix",w=>(x,E)=>{u(ct(x),ct(E));var T=w(r(x),r(E));return Ye(T)?T.valueOf():T}),"Matrix, Matrix":function(x,E){var T=x.size(),_=E.size();return u(T,_),T.length===1?_.length===1?c(x,E,T[0]):f(x,E):_.length===1?p(x,E):d(x,E)},"Matrix, Array":e.referTo("Matrix,Matrix",w=>(x,E)=>w(x,r(E))),"Array, Matrix":e.referToSelf(w=>(x,E)=>w(r(x,E.storage()),E)),"SparseMatrix, any":function(x,E){return s(x,E,i,!1)},"DenseMatrix, any":function(x,E){return l(x,E,i,!1)},"any, SparseMatrix":function(x,E){return s(E,x,i,!0)},"any, DenseMatrix":function(x,E){return l(E,x,i,!0)},"Array, any":function(x,E){return l(r(x),E,i,!1).valueOf()},"any, Array":function(x,E){return l(r(E),x,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(w=>(x,E,T)=>{for(var _=w(x,E),C=0;C<T.length;C++)_=w(_,T[C]);return _})})});var GT="nthRoot",uY=["typed","matrix","equalScalar","BigNumber","concat"],WT=M(GT,uY,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,concat:a}=t,o=Ai({typed:e}),s=wn({typed:e,equalScalar:n}),l=lu({typed:e,equalScalar:n}),u=Er({typed:e,equalScalar:n}),c=Ft({typed:e,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(GT,{number:i0,"number, number":i0,BigNumber:p=>m(p,new i(2)),"BigNumber, BigNumber":m,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",p=>d=>p(r(d),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",p=>d=>p(d,2)),SparseMatrix:e.referTo("SparseMatrix,number",p=>d=>p(d,2)),"SparseMatrix, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return l(d,h,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return o(d,h,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",p=>(d,h)=>p(r(d),h)),"number | BigNumber, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return u(h,d,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function m(p,d){var h=i.precision,b=i.clone({precision:h+2}),y=new i(0),D=new b(1),v=d.isNegative();if(v&&(d=d.neg()),d.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!d.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return v?new b(1/0):0;if(!p.isFinite())return v?y:p;var A=p.abs().pow(D.div(d));return A=p.isNeg()?A.neg():A,new i((v?D.div(A):A).toPrecision(h))}});var YT="sign",lY=["typed","BigNumber","Fraction","complex"],jT=M(YT,lY,t=>{var{typed:e,BigNumber:r,complex:n,Fraction:i}=t;return e(YT,{number:tg,Complex:function(o){return o.im===0?n(tg(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},bigint:function(o){return o>0n?1n:o<0n?-1n:0n},Fraction:function(o){return new i(o.s)},"Array | Matrix":e.referToSelf(a=>o=>Ke(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 cY="sqrt",fY=["config","typed","Complex"],ZT=M(cY,fY,t=>{var{config:e,typed:r,Complex:n}=t;return r("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 JT="square",pY=["typed"],XT=M(JT,pY,t=>{var{typed:e}=t;return e(JT,{number:a0,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},bigint:function(n){return n*n},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var QT="subtract",mY=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],KT=M(QT,mY,t=>{var{typed:e,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=t,l=Ai({typed:e}),u=Ur({typed:e}),c=uu({typed:e,equalScalar:n}),f=ra({typed:e,DenseMatrix:o}),m=mr({typed:e,DenseMatrix:o}),p=Ft({typed:e,matrix:r,concat:s});return e(QT,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:m,sS:f}))});var eM="xgcd",dY=["typed","config","matrix","BigNumber"],tM=M(eM,dY,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(eM,{"number, number":function(s,l){var u=o0(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,f=new i(0),m=new i(1),p=f,d=m,h=m,b=f;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=d.minus(u.times(p)),d=l,l=h,h=b.minus(u.times(h)),b=l,o=s,s=c;var y;return o.lt(f)?y=[o.neg(),d.neg(),b.neg()]:y=[o,o.isZero()?0:d,b],r.matrix==="Array"?y:n(y)}});var rM="invmod",hY=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],nM=M(rM,hY,t=>{var{typed:e,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=t;return e(rM,{"number, number":c,"BigNumber, BigNumber":c});function c(f,m){if(!u(f)||!u(m))throw new Error("Parameters in function invmod must be integer numbers");if(f=s(f,m),a(m,0))throw new Error("Divisor must be non zero");var p=i(f,m);p=p.valueOf();var[d,h]=p;return a(d,n(1))?(h=s(h,m),o(h,n(0))&&(h=l(h,m)),h):NaN}});var gY="matAlgo09xS0Sf",vY=["typed","equalScalar"],lg=M(gY,vY,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,b=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Et(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var y=c[0],D=c[1],v,A=r,w=0,x=o;typeof f=="string"&&f===b&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),x=e.find(o,[v,v]));var E=s&&m?[]:void 0,T=[],_=[],C=E?[]:void 0,N=[],I,R,L,V,P;for(R=0;R<D;R++){_[R]=T.length;var k=R+1;if(C)for(V=d[R],P=d[R+1],L=V;L<P;L++)I=p[L],N[I]=k,C[I]=m[L];for(V=u[R],P=u[R+1],L=V;L<P;L++)if(I=l[L],C){var W=N[I]===k?C[I]:w,O=x(s[L],W);A(O,w)||(T.push(I),E.push(O))}else T.push(I)}return _[D]=T.length,i.createSparseMatrix({values:E,index:T,ptr:_,size:[y,D],datatype:f===i._datatype&&b===a._datatype?v:void 0})}});var iM="dotMultiply",yY=["typed","matrix","equalScalar","multiplyScalar","concat"],aM=M(iM,yY,t=>{var{typed:e,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=t,o=wn({typed:e,equalScalar:n}),s=lg({typed:e,equalScalar:n}),l=Er({typed:e,equalScalar:n}),u=Ft({typed:e,matrix:r,concat:a});return e(iM,u({elop:i,SS:s,DS:o,Ss:l}))});function oM(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero()||e.eq(-1)||t.eq(e))return t;if(e.isZero()||t.eq(-1))return e;if(!t.isFinite()||!e.isFinite()){if(!t.isFinite()&&!e.isFinite())return t.isNegative()===e.isNegative()?t:new r(0);if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e;if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t}return z0(t,e,function(n,i){return n&i})}function Cc(t){if(t.isFinite()&&!t.isInteger())throw new Error("Integer expected in function bitNot");var e=t.constructor,r=e.precision;e.config({precision:1e9});var n=t.plus(new e(1));return n.s=-n.s||null,e.config({precision:r}),n}function sM(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);var n=new r(-1);return t.isZero()||e.eq(n)||t.eq(e)?e:e.isZero()||t.eq(n)?t:!t.isFinite()||!e.isFinite()?!t.isFinite()&&!t.isNegative()&&e.isNegative()||t.isNegative()&&!e.isNegative()&&!e.isFinite()?n:t.isNegative()&&e.isNegative()?t.isFinite()?t:e:t.isFinite()?e:t:z0(t,e,function(i,a){return i|a})}function z0(t,e,r){var n=t.constructor,i,a,o=+(t.s<0),s=+(e.s<0);if(o){i=cg(Cc(t));for(var l=0;l<i.length;++l)i[l]^=1}else i=cg(t);if(s){a=cg(Cc(e));for(var u=0;u<a.length;++u)a[u]^=1}else a=cg(e);var c,f,m;i.length<=a.length?(c=i,f=a,m=o):(c=a,f=i,m=s);var p=c.length,d=f.length,h=r(o,s)^1,b=new n(h^1),y=new n(1),D=new n(2),v=n.precision;for(n.config({precision:1e9});p>0;)r(c[--p],f[--d])===h&&(b=b.plus(y)),y=y.times(D);for(;d>0;)r(m,f[--d])===h&&(b=b.plus(y)),y=y.times(D);return n.config({precision:v}),h===0&&(b.s=-b.s),b}function cg(t){for(var e=t.d,r=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;r.charAt(o)==="0";)o--;var s=t.e,l=r.slice(0,o+1||1),u=l.length;if(s>0)if(++s>u)for(s-=u;s--;)l+="0";else s<u&&(l=l.slice(0,s)+"."+l.slice(s));for(var c=[0],f=0;f<l.length;){for(var m=c.length;m--;)c[m]*=10;c[0]+=parseInt(l.charAt(f++));for(var p=0;p<c.length;++p)c[p]>1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function uM(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero())return e;if(e.isZero())return t;if(t.eq(e))return new r(0);var n=new r(-1);return t.eq(n)?Cc(e):e.eq(n)?Cc(t):!t.isFinite()||!e.isFinite()?!t.isFinite()&&!e.isFinite()?n:new r(t.isNegative()===e.isNegative()?1/0:-1/0):z0(t,e,function(i,a){return i^a})}function lM(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:!t.isFinite()&&!e.isFinite()?new r(NaN):e.lt(55)?t.times(Math.pow(2,e.toNumber())+""):t.times(new r(2).pow(e))}function cM(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:e.isFinite()?e.lt(55)?t.div(Math.pow(2,e.toNumber())+"").floor():t.div(new r(2).pow(e)).floor():t.isNegative()?new r(-1):t.isFinite()?new r(0):new r(NaN)}var fM="bitAnd",bY=["typed","matrix","equalScalar","concat"],fg=M(fM,bY,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=wn({typed:e,equalScalar:n}),o=lu({typed:e,equalScalar:n}),s=Er({typed:e,equalScalar:n}),l=Ft({typed:e,matrix:r,concat:i});return e(fM,{"number, number":u0,"BigNumber, BigNumber":oM,"bigint, bigint":(u,c)=>u&c},l({SS:o,DS:a,Ss:s}))});var pM="bitNot",xY=["typed"],mM=M(pM,xY,t=>{var{typed:e}=t;return e(pM,{number:l0,BigNumber:Cc,bigint:r=>~r,"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var dM="bitOr",wY=["typed","matrix","equalScalar","DenseMatrix","concat"],pg=M(dM,wY,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Ai({typed:e}),s=Tc({typed:e,equalScalar:n}),l=ra({typed:e,DenseMatrix:i}),u=Ft({typed:e,matrix:r,concat:a});return e(dM,{"number, number":c0,"BigNumber, BigNumber":sM,"bigint, bigint":(c,f)=>c|f},u({SS:s,DS:o,Ss:l}))});var _Y="matAlgo07xSSf",AY=["typed","SparseMatrix"],Bn=M(_Y,AY,t=>{var{typed:e,SparseMatrix:r}=t;return function(a,o,s){var l=a._size,u=a._datatype||a._data===void 0?a._datatype:a.getDataType(),c=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(l.length!==c.length)throw new Et(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var m=l[0],p=l[1],d,h=0,b=s;typeof u=="string"&&u===f&&u!=="mixed"&&(d=u,h=e.convert(0,d),b=e.find(s,[d,d]));for(var y=[],D=[],v=new Array(p+1).fill(0),A=[],w=[],x=[],E=[],T=0;T<p;T++){var _=T+1,C=0;n(a,T,x,A,_),n(o,T,E,w,_);for(var N=0;N<m;N++){var I=x[N]===_?A[N]:h,R=E[N]===_?w[N]:h,L=b(I,R);L!==0&&L!==!1&&(D.push(N),y.push(L),C++)}v[T+1]=v[T]+C}return new r({values:y,index:D,ptr:v,size:[m,p],datatype:u===a._datatype&&f===o._datatype?d:void 0})};function n(i,a,o,s,l){for(var u=i._values,c=i._index,f=i._ptr,m=f[a],p=f[a+1];m<p;m++){var d=c[m];o[d]=l,s[d]=u[m]}}});var hM="bitXor",DY=["typed","matrix","DenseMatrix","concat","SparseMatrix"],gM=M(hM,DY,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=Ur({typed:e}),s=Bn({typed:e,SparseMatrix:a}),l=mr({typed:e,DenseMatrix:n}),u=Ft({typed:e,matrix:r,concat:i});return e(hM,{"number, number":f0,"BigNumber, BigNumber":uM,"bigint, bigint":(c,f)=>c^f},u({SS:s,DS:o,Ss:l}))});var vM="arg",SY=["typed"],yM=M(vM,SY,t=>{var{typed:e}=t;return e(vM,{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(r=>n=>Ke(n,r))})});var bM="conj",EY=["typed"],xM=M(bM,EY,t=>{var{typed:e}=t;return e(bM,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var wM="im",TY=["typed"],_M=M(wM,TY,t=>{var{typed:e}=t;return e(wM,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var AM="re",MY=["typed"],DM=M(AM,MY,t=>{var{typed:e}=t;return e(AM,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var SM="not",CY=["typed"],EM=M(SM,CY,t=>{var{typed:e}=t;return e(SM,{"null | undefined":()=>!0,number:v0,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},bigint:r=>!r,Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var TM="or",NY=["typed","matrix","equalScalar","DenseMatrix","concat"],mg=M(TM,NY,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Ur({typed:e}),s=uu({typed:e,equalScalar:n}),l=mr({typed:e,DenseMatrix:i}),u=Ft({typed:e,matrix:r,concat:a});return e(TM,{"number, number":rg,"Complex, Complex":function(f,m){return f.re!==0||f.im!==0||m.re!==0||m.im!==0},"BigNumber, BigNumber":function(f,m){return!f.isZero()&&!f.isNaN()||!m.isZero()&&!m.isNaN()},"bigint, bigint":rg,"Unit, Unit":e.referToSelf(c=>(f,m)=>c(f.value||0,m.value||0))},u({SS:s,DS:o,Ss:l}))});var MM="xor",FY=["typed","matrix","DenseMatrix","concat","SparseMatrix"],CM=M(MM,FY,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=Ur({typed:e}),s=Bn({typed:e,SparseMatrix:a}),l=mr({typed:e,DenseMatrix:n}),u=Ft({typed:e,matrix:r,concat:i});return e(MM,{"number, number":ng,"Complex, Complex":function(f,m){return(f.re!==0||f.im!==0)!=(m.re!==0||m.im!==0)},"bigint, bigint":ng,"BigNumber, BigNumber":function(f,m){return(!f.isZero()&&!f.isNaN())!=(!m.isZero()&&!m.isNaN())},"Unit, Unit":e.referToSelf(c=>(f,m)=>c(f.value||0,m.value||0))},u({SS:s,DS:o,Ss:l}))});var NM="concat",IY=["typed","matrix","isInteger"],dg=M(NM,IY,t=>{var{typed:e,matrix:r,isInteger:n}=t;return e(NM,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,f=[];for(o=0;o<s;o++){var m=a[o];if(Ye(m)&&(c=!0),bt(m)||ot(m)){if(o!==s-1)throw new Error("Dimension must be specified as last argument");if(u=l,l=m.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||o>0&&l>u)throw new Zn(l,u+1)}else{var p=ut(m).valueOf(),d=ct(p);if(f[o]=p,u=l,l=d.length-1,o>0&&l!==u)throw new Et(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var h=f.shift();f.length;)h=Hx(h,f.shift(),l);return c?r(h):h},"...string":function(a){return a.join("")}})});var FM="column",BY=["typed","Index","matrix","range"],hg=M(FM,BY,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(FM,{"Matrix, number":a,"Array, number":function(s,l){return a(n(ut(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Cr(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return Ye(c)?c:n([[c]])}});var IM="count",kY=["typed","size","prod"],BM=M(IM,kY,t=>{var{typed:e,size:r,prod:n}=t;return e(IM,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var kM="cross",PY=["typed","matrix","subtract","multiply"],PM=M(kM,PY,t=>{var{typed:e,matrix:r,subtract:n,multiply:i}=t;return e(kM,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(ct(o).length,ct(s).length);o=wc(o),s=wc(s);var u=ct(o),c=ct(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var f=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[f]:f}});var $M="diag",$Y=["typed","matrix","DenseMatrix","SparseMatrix"],OM=M($M,$Y,t=>{var{typed:e,matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e($M,{Array:function(u){return a(u,0,ct(u),null)},"Array, number":function(u,c){return a(u,c,ct(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),ct(u),null)},"Array, string":function(u,c){return a(u,0,ct(u),c)},"Array, number, string":function(u,c,f){return a(u,c,ct(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),ct(u),f)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,f){return a(u,c,u.size(),f)},"Matrix, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),u.size(),f)}});function a(l,u,c,f){if(!He(u))throw new TypeError("Second parameter in function diag must be an integer");var m=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,f,c[0],p,m);case 2:return s(l,u,f,c,p,m)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,f,m,p){var d=[f+m,f+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var h=c==="sparse"?i.diagonal(d,l,u):n.diagonal(d,l,u);return c!==null?h:h.valueOf()}function s(l,u,c,f,m,p){if(Ye(l)){var d=l.diagonal(u);return c!==null?c!==d.storage()?r(d,c):d:d.valueOf()}for(var h=Math.min(f[0]-m,f[1]-p),b=[],y=0;y<h;y++)b[y]=l[y+m][y+p];return c!==null?r(b):b}});var OY="filter",RY=["typed"],gg=M(OY,RY,t=>{var{typed:e}=t;return e("filter",{"Array, function":RM,"Matrix, function":function(n,i){return n.create(RM(n.valueOf(),i),n.datatype())},"Array, RegExp":qx,"Matrix, RegExp":function(n,i){return n.create(qx(n.valueOf(),i),n.datatype())}})});function RM(t,e){var r=Ya(e,t,"filter");return r.isUnary?Ux(t,r.fn):Ux(t,function(n,i,a){return r.fn(n,[i],a)})}var LM="flatten",LY=["typed"],VM=M(LM,LY,t=>{var{typed:e}=t;return e(LM,{Array:function(n){return Pt(n)},Matrix:function(n){return n.create(Pt(n.valueOf(),!0),n.datatype())}})});var H0="forEach",VY=["typed"],vg=M(H0,VY,t=>{var{typed:e}=t;return e(H0,{"Array, function":UY,"Matrix, function":function(n,i){n.forEach(i)}})});function UY(t,e){var r=Ya(e,t,H0);Xh(t,r.fn,r.isUnary)}var UM="getMatrixDataType",qY=["typed"],qM=M(UM,qY,t=>{var{typed:e}=t;return e(UM,{Array:function(n){return el(n,ir)},Matrix:function(n){return n.getDataType()}})});var zM="identity",zY=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],HM=M(zM,zY,t=>{var{typed:e,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=t;return e(zM,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return l(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return l(c,f,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,m){return l(c,f,m)},Array:function(c){return s(c)},"Array, string":function(c,f){return s(c,f)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return s(c.valueOf(),f)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,f){var m=ot(u)||ot(c)?i:null;if(ot(u)&&(u=u.toNumber()),ot(c)&&(c=c.toNumber()),!He(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!He(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=m?new i(1):1,d=m?new m(0):0,h=[u,c];if(f){if(f==="sparse")return o.diagonal(h,p,0,d);if(f==="dense")return a.diagonal(h,p,0,d);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var b=bo([],h,d),y=u<c?u:c,D=0;D<y;D++)b[D][D]=p;return b}});var GM="kron",HY=["typed","matrix","multiplyScalar"],WM=M(GM,HY,t=>{var{typed:e,matrix:r,multiplyScalar:n}=t;return e(GM,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(ct(a).length===1&&(a=[a]),ct(o).length===1&&(o=[o]),ct(a).length>2||ct(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 s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(f){return c.map(function(m){return l.push(n(f,m))})})})})&&s}});var G0="map",GY=["typed"],yg=M(G0,GY,t=>{var{typed:e}=t;return e(G0,{"Array, function":n,"Matrix, function":function(a,o){return a.map(o)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(i,a,o)=>r([i,a,...o.slice(0,o.length-1)],o[o.length-1])});function r(i,a){if(typeof a!="function")throw new Error("Last argument must be a callback function");var o=i[0].isMatrix,s=Qf(...i.map(A=>A.isMatrix?A.size():ct(A))),l=o?(A,w)=>A.get(w):Ac,u=o?i.map(A=>A.isMatrix?A.create(Vo(A.toArray(),s),A.datatype()):i[0].create(Vo(A.valueOf(),s))):i.map(A=>A.isMatrix?Vo(A.toArray(),s):Vo(A,s)),c;if(e.isTypedFunction(a)){var f=s.map(()=>0),m=u.map(A=>l(A,f)),p=v(a,m,f,u);c=y(p)}else{var d=i.length,h=D(a,d);c=y(h)}var b=(A,w)=>c([A,...u.slice(1).map(x=>l(x,w))],w);if(o)return u[0].map(b);return n(u[0],b);function y(A){switch(A){case 0:return w=>a(...w);case 1:return(w,x)=>a(...w,x);case 2:return(w,x)=>a(...w,x,...u)}}function D(A,w){return A.length>w+1?2:A.length===w+1?1:0}function v(A,w,x,E){return e.resolve(A,[...w,x,...E])!==null?2:e.resolve(A,[...w,x])!==null?1:(e.resolve(A,w)!==null,0)}}function n(i,a){var o=Ya(a,i,G0);return Kf(i,o.fn,o.isUnary)}});var YM="diff",WY=["typed","matrix","subtract","number"],bg=M(YM,WY,t=>{var{typed:e,matrix:r,subtract:n,number:i}=t;return e(YM,{"Array | Matrix":function(c){return Ye(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!He(f))throw new RangeError("Dimension must be a whole number");return Ye(c)?r(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",u=>(c,f)=>u(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",u=>(c,f)=>u(c,i(f)))});function a(u,c){if(Ye(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return u.forEach(m=>{f.push(a(m,c-1))}),f}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],f=u.length,m=1;m<f;m++)c.push(s(u[m-1],u[m]));return c}function s(u,c){Ye(u)&&(u=u.toArray()),Ye(c)&&(c=c.toArray());var f=Array.isArray(u),m=Array.isArray(c);if(f&&m)return l(u,c);if(!f&&!m)return n(c,u);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function l(u,c){if(u.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],m=u.length,p=0;p<m;p++)f.push(s(u[p],c[p]));return f}});var YY="ones",jY=["typed","config","matrix","BigNumber"],jM=M(YY,jY,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(1):1;if(s(l),u){var m=n(u);return l.length>0?m.resize(l,f):m}else{var p=[];return l.length>0?bo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ot(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!He(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function Nc(){throw new Error('No "bignumber" implementation available')}function xg(){throw new Error('No "fraction" implementation available')}function wg(){throw new Error('No "matrix" implementation available')}var ZM="range",ZY=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],_g=M(ZM,ZY,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=t;return e(ZM,{string:m,"string, boolean":m,number:function(b){throw new TypeError("Too few arguments to function range(): ".concat(b))},boolean:function(b){throw new TypeError("Unexpected type of argument 1 to function range(): ".concat(b,", number|bigint|BigNumber|Fraction"))},"number, number":function(b,y){return f(p(b,y,1,!1))},"number, number, number":function(b,y,D){return f(p(b,y,D,!1))},"number, number, boolean":function(b,y,D){return f(p(b,y,1,D))},"number, number, number, boolean":function(b,y,D,v){return f(p(b,y,D,v))},"bigint, bigint|number":function(b,y){return f(p(b,y,1n,!1))},"number, bigint":function(b,y){return f(p(BigInt(b),y,1n,!1))},"bigint, bigint|number, bigint|number":function(b,y,D){return f(p(b,y,BigInt(D),!1))},"number, bigint, bigint|number":function(b,y,D){return f(p(BigInt(b),y,BigInt(D),!1))},"bigint, bigint|number, boolean":function(b,y,D){return f(p(b,y,1n,D))},"number, bigint, boolean":function(b,y,D){return f(p(BigInt(b),y,1n,D))},"bigint, bigint|number, bigint|number, boolean":function(b,y,D,v){return f(p(b,y,BigInt(D),v))},"number, bigint, bigint|number, boolean":function(b,y,D,v){return f(p(BigInt(b),y,BigInt(D),v))},"BigNumber, BigNumber":function(b,y){var D=b.constructor;return f(p(b,y,new D(1),!1))},"BigNumber, BigNumber, BigNumber":function(b,y,D){return f(p(b,y,D,!1))},"BigNumber, BigNumber, boolean":function(b,y,D){var v=b.constructor;return f(p(b,y,new v(1),D))},"BigNumber, BigNumber, BigNumber, boolean":function(b,y,D,v){return f(p(b,y,D,v))},"Fraction, Fraction":function(b,y){return f(p(b,y,1,!1))},"Fraction, Fraction, Fraction":function(b,y,D){return f(p(b,y,D,!1))},"Fraction, Fraction, boolean":function(b,y,D){return f(p(b,y,1,D))},"Fraction, Fraction, Fraction, boolean":function(b,y,D,v){return f(p(b,y,D,v))},"Unit, Unit, Unit":function(b,y,D){return f(p(b,y,D,!1))},"Unit, Unit, Unit, boolean":function(b,y,D,v){return f(p(b,y,D,v))}});function f(h){return r.matrix==="Matrix"?n?n(h):wg():h}function m(h,b){var y=d(h);if(!y)throw new SyntaxError('String "'+h+'" is no valid range');return r.number==="BigNumber"?(i===void 0&&Nc(),f(p(i(y.start),i(y.end),i(y.step)),b)):f(p(y.start,y.end,y.step,b))}function p(h,b,y,D){for(var v=[],A=c(y)?D?o:a:D?l:s,w=h;A(w,b);)v.push(w),w=u(w,y);return v}function d(h){var b=h.split(":"),y=b.map(function(v){return Number(v)}),D=y.some(function(v){return isNaN(v)});if(D)return null;switch(y.length){case 2:return{start:y[0],end:y[1],step:1};case 3:return{start:y[0],end:y[2],step:y[1]};default:return null}}});var JM="reshape",JY=["typed","isInteger","matrix"],XM=M(JM,JY,t=>{var{typed:e,isInteger:r}=t;return e(JM,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),Jf(i,a)}})});var XY="resize",QY=["config","matrix"],QM=M(XY,QY,t=>{var{config:e,matrix:r}=t;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new Aa("resize",arguments.length,2,3);if(Ye(o)&&(o=o.valueOf()),ot(o[0])&&(o=o.map(function(c){return ot(c)?c.toNumber():c})),Ye(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return ut(a)}else{Array.isArray(a)||(a=[a]),a=ut(a);var u=bo(a,o,s);return l?r(u):u}};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 Et(a.length,1);var s=a[0];if(typeof s!="number"||!He(s))throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(a)+")");if(i.length>s)return i.substring(0,s);if(i.length<s){for(var l=i,u=0,c=s-i.length;u<c;u++)l+=o;return l}else return i}});var KM="rotate",KY=["typed","multiply","rotationMatrix"],eC=M(KM,KY,t=>{var{typed:e,multiply:r,rotationMatrix:n}=t;return e(KM,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?ct(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var tC="rotationMatrix",ej=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],rC=M(tC,ej,t=>{var{typed:e,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:f,sin:m}=t;return e(tC,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(v){return l(v)},"number | BigNumber | Complex | Unit":function(v){return p(v,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,A){return p(v,A)},"number | BigNumber | Complex | Unit, Array":function(v,A){var w=l(A);return d(w),y(v,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,A){d(A);var w=A.storage()||(r.matrix==="Matrix"?"dense":void 0);return y(v,A,w)},"number | BigNumber | Complex | Unit, Array, string":function(v,A,w){var x=l(A);return d(x),y(v,x,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,A,w){return d(A),y(v,A,w)}});function p(D,v){var A=ot(D),w=A?new s(-1):-1,x=f(D),E=m(D),T=[[x,n(w,E)],[E,x]];return b(T,v)}function d(D){var v=D.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function h(D){return D.reduce((v,A)=>n(v,A))}function b(D,v){if(v){if(v==="sparse")return new c(D);if(v==="dense")return new u(D);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return D}function y(D,v,A){var w=o(v);if(w===0)throw new RangeError("Rotation around zero vector");var x=ot(D)?s:null,E=x?new x(1):1,T=x?new x(-1):-1,_=x?new x(v.get([0])/w):v.get([0])/w,C=x?new x(v.get([1])/w):v.get([1])/w,N=x?new x(v.get([2])/w):v.get([2])/w,I=f(D),R=i(E,a(I)),L=m(D),V=i(I,h([_,_,R])),P=i(h([_,C,R]),h([T,N,L])),k=i(h([_,N,R]),h([C,L])),W=i(h([_,C,R]),h([N,L])),O=i(I,h([C,C,R])),Q=i(h([C,N,R]),h([T,_,L])),ne=i(h([_,N,R]),h([T,C,L])),X=i(h([C,N,R]),h([_,L])),U=i(I,h([N,N,R])),fe=[[V,P,k],[W,O,Q],[ne,X,U]];return b(fe,A)}});var nC="row",tj=["typed","Index","matrix","range"],Ag=M(nC,tj,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(nC,{"Matrix, number":a,"Array, number":function(s,l){return a(n(ut(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Cr(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return Ye(c)?c:n([[c]])}});var iC="size",rj=["typed","config","?matrix"],aC=M(iC,rj,t=>{var{typed:e,config:r,matrix:n}=t;return e(iC,{Matrix:function(a){return a.create(a.size(),"number")},Array:ct,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([],"dense","number"):wg()}})});var oC="squeeze",nj=["typed"],sC=M(oC,nj,t=>{var{typed:e}=t;return e(oC,{Array:function(n){return wc(ut(n))},Matrix:function(n){var i=wc(n.toArray());return Array.isArray(i)?n.create(i,n.datatype()):i},any:function(n){return ut(n)}})});var uC="subset",ij=["typed","matrix","zeros","add"],Dg=M(uC,ij,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t;return e(uC,{"Matrix, Index":function(s,l){return Ku(l)?r():(Zf(s,l),s.subset(l))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(s,l){var u=o(r(s),l);return l.isScalar()?u:u.valueOf()}}),"Object, Index":oj,"string, Index":aj,"Matrix, Index, any, any":function(s,l,u,c){return Ku(l)?s:(Zf(s,l),s.clone().subset(l,a(u,l),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u,c){var f=o(r(s),l,u,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(r(s),l,u,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(s,l,u,void 0)}}),"string, Index, string":lC,"string, Index, string, string":lC,"Object, Index, any":sj});function a(o,s){if(typeof o=="string")throw new Error("can't boradcast a string");if(s._isScalar)return o;var l=s.size();if(l.every(u=>u>0))try{return i(o,n(l))}catch{return o}else return o}});function aj(t,e){if(!$o(e))throw new TypeError("Index expected");if(Ku(e))return"";if(Zf(Array.from(t),e),e.size().length!==1)throw new Et(e.size().length,1);var r=t.length;Cr(e.min()[0],r),Cr(e.max()[0],r);var n=e.dimension(0),i="";return n.forEach(function(a){i+=t.charAt(a)}),i}function lC(t,e,r,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Ku(e))return t;if(Zf(Array.from(t),e),e.size().length!==1)throw new Et(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!==r.length)throw new Et(i.size()[0],r.length);var o=t.length;Cr(e.min()[0]),Cr(e.max()[0]);for(var s=[],l=0;l<o;l++)s[l]=t.charAt(l);if(i.forEach(function(f,m){s[f]=r.charAt(m[0])}),s.length>o)for(var u=o-1,c=s.length;u<c;u++)s[u]||(s[u]=n);return s.join("")}function oj(t,e){if(!Ku(e)){if(e.size().length!==1)throw new Et(e.size(),1);var r=e.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");return jr(t,r)}}function sj(t,e,r){if(Ku(e))return t;if(e.size().length!==1)throw new Et(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=ut(t);return Bo(i,n,r),i}var cC="transpose",uj=["typed","matrix"],fC=M(cC,uj,t=>{var{typed:e,matrix:r}=t;return e(cC,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:ut});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Dt(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Dt(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],f,m=0;m<l;m++){f=c[m]=[];for(var p=0;p<s;p++)f[p]=ut(u[p][m])}return o.createDenseMatrix({data:c,size:[l,s],datatype:o._datatype})}function a(o,s,l){for(var u=o._values,c=o._index,f=o._ptr,m=u?[]:void 0,p=[],d=[],h=[],b=0;b<s;b++)h[b]=0;var y,D,v;for(y=0,D=c.length;y<D;y++)h[c[y]]++;for(var A=0,w=0;w<s;w++)d.push(A),A+=h[w],h[w]=d[w];for(d.push(A),v=0;v<l;v++)for(var x=f[v],E=f[v+1],T=x;T<E;T++){var _=h[c[T]]++;p[_]=v,u&&(m[_]=ut(u[T]))}return o.createSparseMatrix({values:m,index:p,ptr:d,size:[l,s],datatype:o._datatype})}});var pC="ctranspose",lj=["typed","transpose","conj"],mC=M(pC,lj,t=>{var{typed:e,transpose:r,conj:n}=t;return e(pC,{any:function(a){return n(r(a))}})});var dC="zeros",cj=["typed","config","matrix","BigNumber"],hC=M(dC,cj,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(dC,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(0):0;if(s(l),u){var m=n(u);return l.length>0?m.resize(l,f):m}else{var p=[];return l.length>0?bo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ot(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!He(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}});var gC="fft",fj=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],vC=M(gC,fj,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:f,ceil:m,log2:p}=t;return e(gC,{Array:d,Matrix:function(v){return v.create(d(v.valueOf()),v.datatype())}});function d(D){var v=ct(D);return v.length===1?y(D,v[0]):h(D.map(A=>d(A,v.slice(1))),0)}function h(D,v){var A=ct(D);if(v!==0)return new Array(A[0]).fill(0).map((x,E)=>h(D[E],v-1));if(A.length===1)return y(D);function w(x){var E=ct(x);return new Array(E[1]).fill(0).map((T,_)=>new Array(E[0]).fill(0).map((C,N)=>x[N][_]))}return w(h(w(D),1))}function b(D){for(var v=D.length,A=o(a(i(-1,i(l,s)),v)),w=[],x=1-v;x<v;x++)w.push(f(A,a(f(x,2),2)));for(var E=f(2,m(p(v+v-1))),T=[...new Array(v).fill(0).map((P,k)=>i(D[k],w[v-1+k])),...new Array(E-v).fill(0)],_=[...new Array(v+v-1).fill(0).map((P,k)=>a(1,w[k])),...new Array(E-(v+v-1)).fill(0)],C=y(T),N=y(_),I=new Array(E).fill(0).map((P,k)=>i(C[k],N[k])),R=u(c(d(c(I))),E),L=[],V=v-1;V<v+v-1;V++)L.push(i(R[V],w[V]));return L}function y(D){var v=D.length;if(v===1)return[D[0]];if(v%2===0){for(var A=[...y(D.filter((T,_)=>_%2===0),v/2),...y(D.filter((T,_)=>_%2===1),v/2)],w=0;w<v/2;w++){var x=A[w],E=i(A[w+v/2],o(i(i(s,l),a(-w,v))));A[w]=n(x,E),A[w+v/2]=n(x,i(-1,E))}return A}else return b(D)}});var yC="ifft",pj=["typed","fft","dotDivide","conj"],bC=M(yC,pj,t=>{var{typed:e,fft:r,dotDivide:n,conj:i}=t;return e(yC,{"Array | Matrix":function(o){var s=Ye(o)?o.size():ct(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function rl(t){"@babel/helpers - typeof";return rl=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},rl(t)}function xC(t,e){if(rl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(rl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wC(t){var e=xC(t,"string");return rl(e)=="symbol"?e:e+""}function dr(t,e,r){return(e=wC(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function mj(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_C(Object(r),!0).forEach(function(n){dr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_C(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var dj="solveODE",hj=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],AC=M(dj,hj,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,max:o,map:s,abs:l,isPositive:u,isNegative:c,larger:f,smaller:m,matrix:p,bignumber:d,unaryMinus:h}=t;function b(T){return function(_,C,N,I){var R=!(C.length===2&&(C.every(x)||C.every(En)));if(R)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var L=C[0],V=C[1],P=f(V,L),k=I.firstStep;if(k!==void 0&&!u(k))throw new Error('"firstStep" must be positive');var W=I.maxStep;if(W!==void 0&&!u(W))throw new Error('"maxStep" must be positive');var O=I.minStep;if(O&&c(O))throw new Error('"minStep" must be positive or zero');var Q=[L,V,k,O,W].filter(wt=>wt!==void 0);if(!(Q.every(x)||Q.every(En)))throw new Error('Inconsistent type of "t" dependant variables');for(var ne=1,X=I.tol?I.tol:1e-4,U=I.minDelta?I.minDelta:.2,fe=I.maxDelta?I.maxDelta:5,xe=I.maxIter?I.maxIter:1e4,oe=[L,V,...N,W,O].some(ot),[be,ee,Z,re]=oe?[d(T.a),d(T.c),d(T.b),d(T.bp)]:[T.a,T.c,T.b,T.bp],me=k?P?k:h(k):a(n(V,L),ne),ce=[L],Ae=[N],we=n(Z,re),G=0,J=0,ge=A(P),ye=w(P);ge(ce[G],V);){var De=[];me=ye(ce[G],V,me),De.push(_(ce[G],Ae[G]));for(var Ie=1;Ie<ee.length;++Ie)De.push(_(r(ce[G],i(ee[Ie],me)),r(Ae[G],i(me,be[Ie],De))));var Oe=o(l(s(i(we,De),wt=>En(wt)?wt.value:wt)));Oe<X&&X/Oe>1/4&&(ce.push(r(ce[G],me)),Ae.push(r(Ae[G],i(me,Z,De))),G++);var Je=.84*(X/Oe)**(1/5);if(m(Je,U)?Je=U:f(Je,fe)&&(Je=fe),Je=oe?d(Je):Je,me=i(me,Je),W&&f(l(me),W)?me=P?W:h(W):O&&m(l(me),O)&&(me=P?O:h(O)),J++,J>xe)throw new Error("Maximum number of iterations reached, try changing options")}return{t:ce,y:Ae}}}function y(T,_,C,N){var I=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],R=[null,1/2,3/4,1],L=[2/9,1/3,4/9,0],V=[7/24,1/4,1/3,1/8],P={a:I,c:R,b:L,bp:V};return b(P)(T,_,C,N)}function D(T,_,C,N){var I=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],R=[null,1/5,3/10,4/5,8/9,1,1],L=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],V=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],P={a:I,c:R,b:L,bp:V};return b(P)(T,_,C,N)}function v(T,_,C,N){var I=N.method?N.method:"RK45",R={RK23:y,RK45:D};if(I.toUpperCase()in R){var L=mj({},N);return delete L.method,R[I.toUpperCase()](T,_,C,L)}else{var V=Object.keys(R).map(k=>'"'.concat(k,'"')),P="".concat(V.slice(0,-1).join(", ")," and ").concat(V.slice(-1));throw new Error('Unavailable method "'.concat(I,'". Available methods are ').concat(P))}}function A(T){return T?m:f}function w(T){var _=T?f:m;return function(C,N,I){var R=r(C,I);return _(R,N)?n(N,C):I}}function x(T){return ot(T)||bt(T)}function E(T,_,C,N){var I=v(T,_.toArray(),C.toArray(),N);return{t:p(I.t),y:p(I.y)}}return e("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":E,"function, Array, Array":(T,_,C)=>v(T,_,C,{}),"function, Matrix, Matrix":(T,_,C)=>E(T,_,C,{}),"function, Array, number | BigNumber | Unit":(T,_,C)=>{var N=v(T,_,[C],{});return{t:N.t,y:N.y.map(I=>I[0])}},"function, Matrix, number | BigNumber | Unit":(T,_,C)=>{var N=v(T,_.toArray(),[C],{});return{t:p(N.t),y:p(N.y.map(I=>I[0]))}},"function, Array, number | BigNumber | Unit, Object":(T,_,C,N)=>{var I=v(T,_,[C],N);return{t:I.t,y:I.y.map(R=>R[0])}},"function, Matrix, number | BigNumber | Unit, Object":(T,_,C,N)=>{var I=v(T,_.toArray(),[C],N);return{t:p(I.t),y:p(I.y.map(R=>R[0]))}}})});var gj="erf",vj=["typed"],DC=M(gj,vj,t=>{var{typed:e}=t;return e("name",{number:function(o){var s=Math.abs(o);return s>=xj?Ha(o):s<=yj?Ha(o)*r(s):s<=4?Ha(o)*(1-n(s)):Ha(o)*(1-i(s))},"Array | Matrix":e.referToSelf(a=>o=>Ke(o,a))});function r(a){var o=a*a,s=Ts[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+Ts[0][u])*o,l=(l+Fc[0][u])*o;return a*(s+Ts[0][3])/(l+Fc[0][3])}function n(a){var o=Ts[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+Ts[1][l])*a,s=(s+Fc[1][l])*a;var u=(o+Ts[1][7])/(s+Fc[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*u}function i(a){var o=1/(a*a),s=Ts[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+Ts[2][u])*o,l=(l+Fc[2][u])*o;var c=o*(s+Ts[2][4])/(l+Fc[2][4]);c=(bj-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),yj=.46875,bj=.5641895835477563,Ts=[[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]],Fc=[[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]],xj=Math.pow(2,53);var SC="zeta",wj=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],EC=M(SC,wj,t=>{var{typed:e,config:r,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:l,isNegative:u,gamma:c,sin:f,subtract:m,add:p,Complex:d,BigNumber:h,pi:b}=t;return e(SC,{number:x=>y(x,E=>E,()=>20),BigNumber:x=>y(x,E=>new h(E),()=>Math.abs(Math.log10(r.relTol))),Complex:D});function y(x,E,T){return s(x,0)?E(-.5):s(x,1)?E(NaN):isFinite(x)?v(x,E,T,_=>_):u(x)?E(NaN):E(1)}function D(x){return x.re===0&&x.im===0?new d(-.5):x.re===1?new d(NaN,NaN):x.re===1/0&&x.im===0?new d(1):x.im===1/0||x.re===-1/0?new d(NaN,NaN):v(x,E=>E,E=>Math.round(1.3*15+.9*Math.abs(E.im)),E=>E.re)}function v(x,E,T,_){var C=T(x);if(_(x)>-(C-1)/2)return w(x,E(C),E);var N=n(i(2,x),i(E(b),m(x,1)));return N=n(N,f(n(a(E(b),2),x))),N=n(N,c(m(1,x))),n(N,v(m(1,x),E,T,_))}function A(x,E){for(var T=x,_=x;l(_,E);_=p(_,1)){var C=a(n(o(p(E,m(_,1))),i(4,_)),n(o(m(E,_)),o(n(2,_))));T=p(T,C)}return n(E,T)}function w(x,E,T){for(var _=a(1,n(A(T(0),E),m(1,i(2,m(1,x))))),C=T(0),N=T(1);l(N,E);N=p(N,1))C=p(C,a(n((-1)**(N-1),A(N,E)),i(N,x)));return n(_,C)}});var TC="mode",_j=["typed","isNaN","isNumeric"],MC=M(TC,_j,t=>{var{typed:e,isNaN:r,isNumeric:n}=t;return e(TC,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Pt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;c<a.length;c++){var f=a[c];if(n(f)&&r(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in s||(s[f]=0),s[f]++,s[f]===u?l.push(f):s[f]>u&&(u=s[f],l=[f])}return l}});function pn(t,e,r){var n;return String(t).includes("Unexpected type")?(n=arguments.length>2?" (type: "+ir(r)+", value: "+JSON.stringify(r)+")":" (type: "+t.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(t).includes("complex numbers")?(n=arguments.length>2?" (type: "+ir(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):t}var CC="prod",Aj=["typed","config","multiplyScalar","numeric"],NC=M(CC,Aj,t=>{var{typed:e,config:r,multiplyScalar:n,numeric:i}=t;return e(CC,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(Oi(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw pn(u,"prod",l)}}),typeof s=="string"&&(s=i(s,xi(s,r))),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}});var FC="format",Dj=["typed"],IC=M(FC,Dj,t=>{var{typed:e}=t;return e(FC,{any:Dt,"any, Object | function | number | BigNumber":Dt})});var BC="bin",Sj=["typed","format"],kC=M(BC,Sj,t=>{var{typed:e,format:r}=t;return e(BC,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var PC="oct",Ej=["typed","format"],$C=M(PC,Ej,t=>{var{typed:e,format:r}=t;return e(PC,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var OC="hex",Tj=["typed","format"],RC=M(OC,Tj,t=>{var{typed:e,format:r}=t;return e(OC,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var Sg=/\$([\w.]+)/g;var LC="print",Mj=["typed"],Eg=M(LC,Mj,t=>{var{typed:e}=t;return e(LC,{"string, Object | Array":VC,"string, Object | Array, number | Object":VC})});function VC(t,e,r){return t.replace(Sg,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 s=a.shift();o=s?o[s]:o+"."}return o!==void 0?Jr(o)?o:Dt(o,r):n})}var UC="to",Cj=["typed","matrix","concat"],qC=M(UC,Cj,t=>{var{typed:e,matrix:r,concat:n}=t,i=Ft({typed:e,matrix:r,concat:n});return e(UC,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var zC="isPrime",Nj=["typed"],HC=M(zC,Nj,t=>{var{typed:e}=t;return e(zC,{number:function(n){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},bigint:function(n){if(n<=3n)return n>1n;if(n%2n===0n||n%3n===0n)return!1;for(var i=5n;i*i<=n;i+=6n)if(n%i===0n||n%(i+2n)===0n)return!1;return!0},BigNumber:function(n){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(D,v,A){for(var w=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),D=D.mul(D).mod(A)):(v=v.sub(1),w=D.mul(w).mod(A));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(D=>D<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 m=2;m<=f;m+=1)c.push(f)}for(var p=0;p<c.length;p+=1){var d=c[p],h=o(n.sub(n).add(d),u,n);if(!h.eq(1)){for(var b=0,y=h;!y.eq(n.sub(1));b+=1,y=y.mul(y).mod(n))if(b===l-1)return!1}}return!0},"Array | Matrix":e.referToSelf(r=>n=>Ke(n,r))})});var Fj="numeric",Ij=["number","?bignumber","?fraction"],GC=M(Fj,Ij,t=>{var{number:e,bignumber:r,fraction:n}=t,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:r?o=>r(o):Nc,bigint:o=>BigInt(o),Fraction:n?o=>n(o):xg};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=ir(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}});var WC="divideScalar",Bj=["typed","numeric"],YC=M(WC,Bj,t=>{var{typed:e,numeric:r}=t;return e(WC,{"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)},"bigint, bigint":function(i,a){return i/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 jC="pow",kj=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],ZC=M(jC,kj,t=>{var{typed:e,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=t;return e(jC,{"number, number":c,"Complex, Complex":function(d,h){return d.pow(h)},"BigNumber, BigNumber":function(d,h){return h.isInteger()||d>=0||r.predictable?d.pow(h):new u(d.toNumber(),0).pow(h.toNumber(),0)},"bigint, bigint":(p,d)=>p**d,"Fraction, Fraction":function(d,h){var b=d.pow(h);if(b!=null)return b;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(d.valueOf(),h.valueOf())},"Array, number":f,"Array, BigNumber":function(d,h){return f(d,h.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(d,h){return m(d,h.toNumber())},"Unit, number | BigNumber":function(d,h){return d.pow(h)}});function c(p,d){if(r.predictable&&!He(d)&&p<0)try{var h=l(d),b=s(h);if((d===b||Math.abs((d-b)/d)<1e-14)&&h.d%2n===1n)return(h.n%2n===0n?1:-1)*Math.pow(-p,d)}catch{}return r.predictable&&(p<-1&&d===1/0||p>-1&&p<0&&d===-1/0)?NaN:He(d)||p>=0||r.predictable?s0(p,d):p*p<1&&d===1/0||p*p>1&&d===-1/0?0:new u(p,0).pow(d,0)}function f(p,d){if(!He(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var h=ct(p);if(h.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+h.length+" dimensions)");if(h[0]!==h[1])throw new Error("For A^b, A must be square (size is "+h[0]+"x"+h[1]+")");if(d<0)try{return f(o(p),-d)}catch(D){throw D.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 "+d+")"):D}for(var b=n(h[0]).valueOf(),y=p;d>=1;)(d&1)===1&&(b=i(y,b)),d>>=1,y=i(y,y);return b}function m(p,d){return a(f(p.valueOf(),d))}});var Ic="Number of decimals in function round must be an integer",JC="round",Pj=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],XC=M(JC,Pj,t=>{var{typed:e,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=t,l=Er({typed:e,equalScalar:i}),u=mr({typed:e,DenseMatrix:s}),c=xn({typed:e});function f(m){return Math.abs(gc(m).exponent)}return e(JC,{number:function(p){var d=Sc(p,f(r.relTol)),h=zr(p,d,r.relTol,r.absTol)?d:p;return Sc(h)},"number, number":function(p,d){var h=f(r.relTol);if(d>=h)return Sc(p,d);var b=Sc(p,h),y=zr(p,b,r.relTol,r.absTol)?b:p;return Sc(y,d)},"number, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Ic);return new o(p).toDecimalPlaces(d.toNumber())},Complex:function(p){return p.round()},"Complex, number":function(p,d){if(d%1)throw new TypeError(Ic);return p.round(d)},"Complex, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Ic);var h=d.toNumber();return p.round(h)},BigNumber:function(p){var d=new o(p).toDecimalPlaces(f(r.relTol)),h=gn(p,d,r.relTol,r.absTol)?d:p;return h.toDecimalPlaces(0)},"BigNumber, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Ic);var h=f(r.relTol);if(d>=h)return p.toDecimalPlaces(d.toNumber());var b=p.toDecimalPlaces(h),y=gn(p,b,r.relTol,r.absTol)?b:p;return y.toDecimalPlaces(d.toNumber())},bigint:m=>m,"bigint, number":(m,p)=>m,"bigint, BigNumber":(m,p)=>m,Fraction:function(p){return p.round()},"Fraction, number":function(p,d){if(d%1)throw new TypeError(Ic);return p.round(d)},"Fraction, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Ic);return p.round(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var b=p.toNumeric(h);return h.multiply(m(b,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>Ke(p,b=>m(b,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>Ke(p,m,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>l(p,d,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>c(p,d,m,!1)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>c(n(p),d,m,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(m=>(p,d)=>i(p,0)?a(d.size(),d.storage()):u(d,p,m,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(m=>(p,d)=>i(p,0)?a(d.size(),d.storage()):c(d,p,m,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(m=>(p,d)=>c(n(d),p,m,!0).valueOf())})});var QC="log",$j=["config","typed","typeOf","divideScalar","Complex"],Oj=Math.log(16),KC=M(QC,$j,t=>{var{typed:e,typeOf:r,config:n,divideScalar:i,Complex:a}=t;function o(l){return l.log()}function s(l){return o(new a(l,0))}return e(QC,{number:function(u){return u>=0||n.predictable?n0(u):s(u)},bigint:Mc(Oj,n0,n,s),Complex:o,BigNumber:function(u){return!u.isNegative()||n.predictable?u.ln():s(u.toNumber())},"any, any":e.referToSelf(l=>(u,c)=>{if(r(u)==="Fraction"&&r(c)==="Fraction"){var f=u.log(c);if(f!==null)return f}return i(l(u),l(c))})})});var eN="log1p",Rj=["typed","config","divideScalar","log","Complex"],tN=M(eN,Rj,t=>{var{typed:e,config:r,divideScalar:n,log:i,Complex:a}=t;return e(eN,{number:function(l){return l>=-1||r.predictable?Bh(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":e.referToSelf(s=>l=>Ke(l,s)),"any, any":e.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}});var rN="nthRoots",Lj=["config","typed","divideScalar","Complex"],nN=M(rN,Lj,t=>{var{typed:e,config:r,divideScalar:n,Complex:i}=t,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var f=s.arg(),m=s.abs(),p=[],d=Math.pow(m,1/l),h=0;h<l;h++){var b=(c+4*h)/l;if(b===Math.round(b)){p.push(a[b%4](d));continue}p.push(new i({r:d,phi:(f+2*Math.PI*h)/l}))}return p}return e(rN,{Complex:function(l){return o(l,2)},"Complex, number":o})});var iN="dotPow",Vj=["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],aN=M(iN,Vj,t=>{var{typed:e,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Ur({typed:e}),u=Bn({typed:e,SparseMatrix:s}),c=Er({typed:e,equalScalar:r}),f=mr({typed:e,DenseMatrix:a}),m=Ft({typed:e,matrix:n,concat:o}),p={};for(var d in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,d)&&!d.includes("Matrix")&&!d.includes("Array")&&(p[d]=i.signatures[d]);var h=e(p);return e(iN,m({elop:h,SS:u,DS:l,Ss:c,sS:f}))});var oN="dotDivide",Uj=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],sN=M(oN,Uj,t=>{var{typed:e,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=wn({typed:e,equalScalar:n}),u=Ur({typed:e}),c=Bn({typed:e,SparseMatrix:s}),f=Er({typed:e,equalScalar:n}),m=mr({typed:e,DenseMatrix:a}),p=Ft({typed:e,matrix:r,concat:o});return e(oN,p({elop:i,SS:c,DS:u,SD:l,Ss:f,sS:m}))});function Uo(t){var{DenseMatrix:e}=t;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Dt(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+Dt(o)+")");var u=[];if(Ye(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var m=0;m<s;m++)u[m]=[f[m]];return new e({data:u,size:[s,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==s||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(ws(i)){if(a){u=[];for(var p=0;p<s;p++)u[p]=[f[p][0]];return new e({data:u,size:[s,1],datatype:i._datatype})}return i}if(xa(i)){for(var d=0;d<s;d++)u[d]=[0];for(var h=i._values,b=i._index,y=i._ptr,D=y[1],v=y[0];v<D;v++){var A=b[v];u[A][0]=h[v]}return new e({data:u,size:[s,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(sr(i)){var w=ct(i);if(w.length===1){if(w[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var x=0;x<s;x++)u[x]=[i[x]];return new e({data:u,size:[s,1]})}if(w.length===2){if(w[0]!==s||w[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<s;E++)u[E]=[i[E][0]];return new e({data:u,size:[s,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var uN="lsolve",qj=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],lN=M(uN,qj,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=Uo({DenseMatrix:s});return e(uN,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.valueOf()}});function u(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],b=[],y=f._data,D=0;D<h;D++){var v=p[D][0]||0,A=void 0;if(o(v,0))A=0;else{var w=y[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var x=D+1;x<d;x++)p[x]=[a(p[x][0]||0,i(A,y[x][D]))]}b[D]=[A]}return new s({data:b,size:[d,1]})}function c(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],b=f._values,y=f._index,D=f._ptr,v=[],A=0;A<h;A++){var w=p[A][0]||0;if(o(w,0))v[A]=[0];else{for(var x=0,E=[],T=[],_=D[A],C=D[A+1],N=_;N<C;N++){var I=y[N];I===A?x=b[N]:I>A&&(E.push(b[N]),T.push(I))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,x),L=0,V=T.length;L<V;L++){var P=T[L];p[P]=[a(p[P][0]||0,i(R,E[L]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var cN="usolve",zj=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],fN=M(cN,zj,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=Uo({DenseMatrix:s});return e(cN,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.valueOf()}});function u(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],b=[],y=f._data,D=h-1;D>=0;D--){var v=p[D][0]||0,A=void 0;if(o(v,0))A=0;else{var w=y[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var x=D-1;x>=0;x--)p[x]=[a(p[x][0]||0,i(A,y[x][D]))]}b[D]=[A]}return new s({data:b,size:[d,1]})}function c(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],b=f._values,y=f._index,D=f._ptr,v=[],A=h-1;A>=0;A--){var w=p[A][0]||0;if(o(w,0))v[A]=[0];else{for(var x=0,E=[],T=[],_=D[A],C=D[A+1],N=C-1;N>=_;N--){var I=y[N];I===A?x=b[N]:I<A&&(E.push(b[N]),T.push(I))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,x),L=0,V=T.length;L<V;L++){var P=T[L];p[P]=[a(p[P][0],i(R,E[L]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var pN="lsolveAll",Hj=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],mN=M(pN,Hj,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=Uo({DenseMatrix:s});return e(pN,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.map(b=>b.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(T=>T[0])],d=f._data,h=f._size[0],b=f._size[1],y=0;y<b;y++)for(var D=p.length,v=0;v<D;v++){var A=p[v];if(o(d[y][y],0))if(o(A[y],0)){if(v===0){var x=[...A];x[y]=1;for(var E=y+1;E<b;E++)x[E]=a(x[E],d[E][y]);p.push(x)}}else{if(v===0)return[];p.splice(v,1),v-=1,D-=1}else{A[y]=n(A[y],d[y][y]);for(var w=y+1;w<b;w++)A[w]=a(A[w],i(A[y],d[w][y]))}}return p.map(T=>new s({data:T.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ne=>ne[0])],d=f._size[0],h=f._size[1],b=f._values,y=f._index,D=f._ptr,v=0;v<h;v++)for(var A=p.length,w=0;w<A;w++){for(var x=p[w],E=[],T=[],_=D[v],C=D[v+1],N=0,I=_;I<C;I++){var R=y[I];R===v?N=b[I]:R>v&&(E.push(b[I]),T.push(R))}if(o(N,0))if(o(x[v],0)){if(w===0){var k=[...x];k[v]=1;for(var W=0,O=T.length;W<O;W++){var Q=T[W];k[Q]=a(k[Q],E[W])}p.push(k)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{x[v]=n(x[v],N);for(var L=0,V=T.length;L<V;L++){var P=T[L];x[P]=a(x[P],i(x[v],E[L]))}}}return p.map(ne=>new s({data:ne.map(X=>[X]),size:[d,1]}))}});var dN="usolveAll",Gj=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],hN=M(dN,Gj,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=Uo({DenseMatrix:s});return e(dN,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.map(b=>b.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(T=>T[0])],d=f._data,h=f._size[0],b=f._size[1],y=b-1;y>=0;y--)for(var D=p.length,v=0;v<D;v++){var A=p[v];if(o(d[y][y],0))if(o(A[y],0)){if(v===0){var x=[...A];x[y]=1;for(var E=y-1;E>=0;E--)x[E]=a(x[E],d[E][y]);p.push(x)}}else{if(v===0)return[];p.splice(v,1),v-=1,D-=1}else{A[y]=n(A[y],d[y][y]);for(var w=y-1;w>=0;w--)A[w]=a(A[w],i(A[y],d[w][y]))}}return p.map(T=>new s({data:T.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ne=>ne[0])],d=f._size[0],h=f._size[1],b=f._values,y=f._index,D=f._ptr,v=h-1;v>=0;v--)for(var A=p.length,w=0;w<A;w++){for(var x=p[w],E=[],T=[],_=D[v],C=D[v+1],N=0,I=C-1;I>=_;I--){var R=y[I];R===v?N=b[I]:R<v&&(E.push(b[I]),T.push(R))}if(o(N,0))if(o(x[v],0)){if(w===0){var k=[...x];k[v]=1;for(var W=0,O=T.length;W<O;W++){var Q=T[W];k[Q]=a(k[Q],E[W])}p.push(k)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{x[v]=n(x[v],N);for(var L=0,V=T.length;L<V;L++){var P=T[L];x[P]=a(x[P],i(x[v],E[L]))}}}return p.map(ne=>new s({data:ne.map(X=>[X]),size:[d,1]}))}});var Wj="matAlgo08xS0Sid",Yj=["typed","equalScalar"],Bc=M(Wj,Yj,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,b=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Et(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!s||!m)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var y=c[0],D=c[1],v,A=r,w=0,x=o;typeof f=="string"&&f===b&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),x=e.find(o,[v,v]));for(var E=[],T=[],_=[],C=[],N=[],I,R,L,V,P=0;P<D;P++){_[P]=T.length;var k=P+1;for(R=u[P],L=u[P+1],I=R;I<L;I++)V=l[I],N[V]=k,C[V]=s[I],T.push(V);for(R=d[P],L=d[P+1],I=R;I<L;I++)V=p[I],N[V]===k&&(C[V]=x(C[V],m[I]));for(I=_[P];I<T.length;){V=T[I];var W=C[V];A(W,w)?T.splice(I,1):(E.push(W),I++)}}return _[D]=T.length,i.createSparseMatrix({values:E,index:T,ptr:_,size:[y,D],datatype:f===i._datatype&&b===a._datatype?v:void 0})}});var kc=M("useMatrixForArrayScalar",["typed","matrix"],t=>{var{typed:e,matrix:r}=t;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}});var gN="leftShift",jj=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],vN=M(gN,jj,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ai({typed:e}),l=wn({typed:e,equalScalar:n}),u=Bc({typed:e,equalScalar:n}),c=ra({typed:e,DenseMatrix:a}),f=Er({typed:e,equalScalar:n}),m=xn({typed:e}),p=Ft({typed:e,matrix:r,concat:o}),d=kc({typed:e,matrix:r});return e(gN,{"number, number":p0,"BigNumber, BigNumber":lM,"bigint, bigint":(h,b)=>h<<b,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():f(b,y,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():m(b,y,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):c(y,b,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):m(y,b,h,!0))},d,p({SS:u,DS:s,SD:l}))});var yN="rightArithShift",Zj=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],bN=M(yN,Zj,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ai({typed:e}),l=wn({typed:e,equalScalar:n}),u=Bc({typed:e,equalScalar:n}),c=ra({typed:e,DenseMatrix:a}),f=Er({typed:e,equalScalar:n}),m=xn({typed:e}),p=Ft({typed:e,matrix:r,concat:o}),d=kc({typed:e,matrix:r});return e(yN,{"number, number":m0,"BigNumber, BigNumber":cM,"bigint, bigint":(h,b)=>h>>b,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():f(b,y,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():m(b,y,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):c(y,b,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):m(y,b,h,!0))},d,p({SS:u,DS:s,SD:l}))});var xN="rightLogShift",Jj=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],wN=M(xN,Jj,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ai({typed:e}),l=wn({typed:e,equalScalar:n}),u=Bc({typed:e,equalScalar:n}),c=ra({typed:e,DenseMatrix:a}),f=Er({typed:e,equalScalar:n}),m=xn({typed:e}),p=Ft({typed:e,matrix:r,concat:o}),d=kc({typed:e,matrix:r});return e(xN,{"number, number":d0,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():f(b,y,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(b,y)=>n(y,0)?b.clone():m(b,y,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):c(y,b,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(b,y)=>n(b,0)?i(y.size(),y.storage()):m(y,b,h,!0))},d,p({SS:u,DS:s,SD:l}))});var _N="and",Xj=["typed","matrix","equalScalar","zeros","not","concat"],Tg=M(_N,Xj,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=wn({typed:e,equalScalar:n}),l=lu({typed:e,equalScalar:n}),u=Er({typed:e,equalScalar:n}),c=xn({typed:e}),f=Ft({typed:e,matrix:r,concat:o});return e(_N,{"number, number":ig,"Complex, Complex":function(p,d){return(p.re!==0||p.im!==0)&&(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(p,d){return!p.isZero()&&!d.isZero()&&!p.isNaN()&&!d.isNaN()},"bigint, bigint":ig,"Unit, Unit":e.referToSelf(m=>(p,d)=>m(p.value||0,d.value||0)),"SparseMatrix, any":e.referToSelf(m=>(p,d)=>a(d)?i(p.size(),p.storage()):u(p,d,m,!1)),"DenseMatrix, any":e.referToSelf(m=>(p,d)=>a(d)?i(p.size(),p.storage()):c(p,d,m,!1)),"any, SparseMatrix":e.referToSelf(m=>(p,d)=>a(p)?i(p.size(),p.storage()):u(d,p,m,!0)),"any, DenseMatrix":e.referToSelf(m=>(p,d)=>a(p)?i(p.size(),p.storage()):c(d,p,m,!0)),"Array, any":e.referToSelf(m=>(p,d)=>m(r(p),d).valueOf()),"any, Array":e.referToSelf(m=>(p,d)=>m(p,r(d)).valueOf())},f({SS:l,DS:s}))});var Mg="compare",Qj=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],AN=M(Mg,Qj,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=t,u=Ur({typed:e}),c=uu({typed:e,equalScalar:n}),f=mr({typed:e,DenseMatrix:s}),m=Ft({typed:e,matrix:i,concat:l}),p=Za({typed:e});return e(Mg,Kj({typed:e,config:r}),{"boolean, boolean":function(h,b){return h===b?0:h>b?1:-1},"BigNumber, BigNumber":function(h,b){return gn(h,b,r.relTol,r.absTol)?new a(0):new a(h.cmp(b))},"bigint, bigint":function(h,b){return h===b?0n:h>b?1n:-1n},"Fraction, Fraction":function(h,b){return new o(h.compare(b))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,m({SS:c,DS:u,Ss:f}))}),Kj=M(Mg,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Mg,{"number, number":function(i,a){return zr(i,a,r.relTol,r.absTol)?0:i>a?1:-1}})});var nl=Tr(SN(),1);var EN="compareNatural",eZ=["typed","compare"],TN=M(EN,eZ,t=>{var{typed:e,compare:r}=t,n=r.signatures["boolean,boolean"];return e(EN,{"any, any":i});function i(l,u){var c=ir(l),f=ir(u),m;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return m=r(l,u),m.toString()!=="0"?m>0?1:-1:(0,nl.default)(c,f);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(f))return m=a(i,l,u),m!==0?m:(0,nl.default)(c,f);if(c!==f)return(0,nl.default)(c,f);if(c==="Complex")return tZ(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return(0,nl.default)(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return xa(u)&&xa(c)?o(l,u.toJSON().values,c.toJSON().values):xa(u)?a(l,u.toArray(),c):xa(c)?a(l,u,c.toArray()):ws(u)?a(l,u.toJSON().data,c):ws(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var f=0,m=Math.min(u.length,c.length);f<m;f++){var p=l(u[f],c[f]);if(p!==0)return p}return u.length>c.length?1:u.length<c.length?-1:0}function s(l,u,c){var f=Object.keys(u),m=Object.keys(c);f.sort(nl.default),m.sort(nl.default);var p=o(l,f,m);if(p!==0)return p;for(var d=0;d<f.length;d++){var h=l(u[f[d]],c[m[d]]);if(h!==0)return h}return 0}});function tZ(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0}var MN="compareText",rZ=["typed","matrix","concat"];jh.signature="any, any";var CN=M(MN,rZ,t=>{var{typed:e,matrix:r,concat:n}=t,i=Ft({typed:e,matrix:r,concat:n});return e(MN,jh,i({elop:jh,Ds:!0}))});var Cg="equal",nZ=["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],NN=M(Cg,nZ,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Ur({typed:e}),l=Bn({typed:e,SparseMatrix:o}),u=mr({typed:e,DenseMatrix:i}),c=Ft({typed:e,matrix:r,concat:a});return e(Cg,iZ({typed:e,equalScalar:n}),c({elop:n,SS:l,DS:s,Ss:u}))}),iZ=M(Cg,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(Cg,{"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:r(i,a)}})});var FN="equalText",aZ=["typed","compareText","isZero"],IN=M(FN,aZ,t=>{var{typed:e,compareText:r,isZero:n}=t;return e(FN,{"any, any":function(a,o){return n(r(a,o))}})});var Ng="smaller",oZ=["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],BN=M(Ng,oZ,t=>{var{typed:e,config:r,bignumber:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Ur({typed:e}),u=Bn({typed:e,SparseMatrix:s}),c=mr({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:i,concat:o}),m=Za({typed:e});function p(d,h){return d.lt(h)&&!gn(d,h,r.relTol,r.absTol)}return e(Ng,sZ({typed:e,config:r}),{"boolean, boolean":(d,h)=>d<h,"BigNumber, BigNumber":p,"bigint, bigint":(d,h)=>d<h,"Fraction, Fraction":(d,h)=>d.compare(h)===-1,"Fraction, BigNumber":function(h,b){return p(n(h),b)},"BigNumber, Fraction":function(h,b){return p(h,n(b))},"Complex, Complex":function(h,b){throw new TypeError("No ordering relation is defined for complex numbers")}},m,f({SS:u,DS:l,Ss:c}))}),sZ=M(Ng,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Ng,{"number, number":function(i,a){return i<a&&!zr(i,a,r.relTol,r.absTol)}})});var Fg="smallerEq",uZ=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],kN=M(Fg,uZ,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Ur({typed:e}),l=Bn({typed:e,SparseMatrix:o}),u=mr({typed:e,DenseMatrix:i}),c=Ft({typed:e,matrix:n,concat:a}),f=Za({typed:e});return e(Fg,lZ({typed:e,config:r}),{"boolean, boolean":(m,p)=>m<=p,"BigNumber, BigNumber":function(p,d){return p.lte(d)||gn(p,d,r.relTol,r.absTol)},"bigint, bigint":(m,p)=>m<=p,"Fraction, Fraction":(m,p)=>m.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),lZ=M(Fg,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Fg,{"number, number":function(i,a){return i<=a||zr(i,a,r.relTol,r.absTol)}})});var Ig="larger",cZ=["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],PN=M(Ig,cZ,t=>{var{typed:e,config:r,bignumber:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Ur({typed:e}),u=Bn({typed:e,SparseMatrix:s}),c=mr({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:i,concat:o}),m=Za({typed:e});function p(d,h){return d.gt(h)&&!gn(d,h,r.relTol,r.absTol)}return e(Ig,fZ({typed:e,config:r}),{"boolean, boolean":(d,h)=>d>h,"BigNumber, BigNumber":p,"bigint, bigint":(d,h)=>d>h,"Fraction, Fraction":(d,h)=>d.compare(h)===1,"Fraction, BigNumber":function(h,b){return p(n(h),b)},"BigNumber, Fraction":function(h,b){return p(h,n(b))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,f({SS:u,DS:l,Ss:c}))}),fZ=M(Ig,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Ig,{"number, number":function(i,a){return i>a&&!zr(i,a,r.relTol,r.absTol)}})});var Bg="largerEq",pZ=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],$N=M(Bg,pZ,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Ur({typed:e}),l=Bn({typed:e,SparseMatrix:o}),u=mr({typed:e,DenseMatrix:i}),c=Ft({typed:e,matrix:n,concat:a}),f=Za({typed:e});return e(Bg,mZ({typed:e,config:r}),{"boolean, boolean":(m,p)=>m>=p,"BigNumber, BigNumber":function(p,d){return p.gte(d)||gn(p,d,r.relTol,r.absTol)},"bigint, bigint":function(p,d){return p>=d},"Fraction, Fraction":(m,p)=>m.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),mZ=M(Bg,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Bg,{"number, number":function(i,a){return i>=a||zr(i,a,r.relTol,r.absTol)}})});var ON="deepEqual",dZ=["typed","equal"],RN=M(ON,dZ,t=>{var{typed:e,equal:r}=t;return e(ON,{"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 s=0;s<o;s++)if(!n(i[s],a[s]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:r(i,a)}});var kg="unequal",hZ=["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],LN=M(kg,hZ,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Ur({typed:e}),u=Bn({typed:e,SparseMatrix:s}),c=mr({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:i,concat:o});return e(kg,gZ({typed:e,equalScalar:n}),f({elop:m,SS:u,DS:l,Ss:c}));function m(p,d){return!n(p,d)}}),gZ=M(kg,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(kg,{"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:!r(i,a)}})});var VN="partitionSelect",vZ=["typed","isNumeric","isNaN","compare"],UN=M(VN,vZ,t=>{var{typed:e,isNumeric:r,isNaN:n,compare:i}=t,a=i,o=(u,c)=>-i(u,c);return e(VN,{"Array | Matrix, number":function(c,f){return s(c,f,a)},"Array | Matrix, number, string":function(c,f,m){if(m==="asc")return s(c,f,a);if(m==="desc")return s(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,f){if(!He(c)||c<0)throw new Error("k must be a non-negative integer");if(Ye(u)){var m=u.size();if(m.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,f)}if(Array.isArray(u))return l(u,c,f)}function l(u,c,f){if(c>=u.length)throw new Error("k out of bounds");for(var m=0;m<u.length;m++)if(r(u[m])&&n(u[m]))return u[m];for(var p=0,d=u.length-1;p<d;){for(var h=p,b=d,y=u[Math.floor(Math.random()*(d-p+1))+p];h<b;)if(f(u[h],y)>=0){var D=u[b];u[b]=u[h],u[h]=D,--b}else++h;f(u[h],y)>0&&--h,c<=h?d=h:p=h+1}return u[c]}});var qN="sort",yZ=["typed","matrix","compare","compareNatural"],zN=M(qN,yZ,t=>{var{typed:e,matrix:r,compare:n,compareNatural:i}=t,a=n,o=(c,f)=>-n(c,f);return e(qN,{Array:function(f){return l(f),f.sort(a)},Matrix:function(f){return u(f),r(f.toArray().sort(a),f.storage())},"Array, function":function(f,m){return l(f),f.sort(m)},"Matrix, function":function(f,m){return u(f),r(f.toArray().sort(m),f.storage())},"Array, string":function(f,m){return l(f),f.sort(s(m))},"Matrix, string":function(f,m){return u(f),r(f.toArray().sort(s(m)),f.storage())}});function s(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 l(c){if(ct(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var HN="max",bZ=["typed","config","numeric","larger","isNaN"],Pg=M(HN,bZ,t=>{var{typed:e,config:r,numeric:n,larger:i,isNaN:a}=t;return e(HN,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(u,c){return su(u,c.valueOf(),o)},"...":function(u){if(ja(u))throw new TypeError("Scalar values expected in function max");return s(u)}});function o(l,u){try{return i(l,u)?l:u}catch(c){throw pn(c,"max",u)}}function s(l){var u;if(Oi(l,function(c){try{(a(c)||u===void 0||i(c,u))&&(u=c)}catch(f){throw pn(f,"max",c)}}),u===void 0)throw new Error("Cannot calculate max of an empty array");return typeof u=="string"&&(u=n(u,xi(u,r))),u}});var GN="min",xZ=["typed","config","numeric","smaller","isNaN"],$g=M(GN,xZ,t=>{var{typed:e,config:r,numeric:n,smaller:i,isNaN:a}=t;return e(GN,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(u,c){return su(u,c.valueOf(),o)},"...":function(u){if(ja(u))throw new TypeError("Scalar values expected in function min");return s(u)}});function o(l,u){try{return i(l,u)?l:u}catch(c){throw pn(c,"min",u)}}function s(l){var u;if(Oi(l,function(c){try{(a(c)||u===void 0||i(c,u))&&(u=c)}catch(f){throw pn(f,"min",c)}}),u===void 0)throw new Error("Cannot calculate min of an empty array");return typeof u=="string"&&(u=n(u,xi(u,r))),u}});var wZ="ImmutableDenseMatrix",_Z=["smaller","DenseMatrix"],WN=M(wZ,_Z,t=>{var{smaller:e,DenseMatrix:r}=t;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!Jr(a))throw new Error("Invalid datatype: "+a);if(Ye(i)||sr(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&sr(i.data)&&sr(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+ir(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return Ye(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:ut(this._data),size:ut(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 AZ="Index",DZ=["ImmutableDenseMatrix","getMatrixDataType"],jN=M(AZ,DZ,t=>{var{ImmutableDenseMatrix:e,getMatrixDataType:r}=t;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,s=arguments.length;o<s;o++){var l=arguments[o],u=sr(l),c=Ye(l),f=typeof l,m=null;if(tu(l))this._dimensions.push(l),this._isScalar=!1;else if(u||c){var p=void 0;r(l)==="boolean"?(u&&(p=i(YN(l).valueOf())),c&&(p=i(YN(l._data).valueOf())),m=l.valueOf().length):p=i(l.valueOf()),this._dimensions.push(p);var d=p.size();(d.length!==1||d[0]!==1||m!==null)&&(this._isScalar=!1)}else if(f==="number")this._dimensions.push(i([l]));else if(f==="bigint")this._dimensions.push(i([Number(l)]));else if(f==="string")this._dimensions.push(l);else throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");this._sourceSize.push(m)}}n.prototype.type="Index",n.prototype.isIndex=!0;function i(a){for(var o=0,s=a.length;o<s;o++)if(typeof a[o]!="number"||!He(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=ut(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,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?1:l.size()[0]}return a},n.prototype.max=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?l:l.max()}return a},n.prototype.min=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?l:l.min()}return a},n.prototype.forEach=function(a){for(var o=0,s=this._dimensions.length;o<s;o++)a(this._dimensions[o],o,this)},n.prototype.dimension=function(a){return typeof a!="number"?null: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,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a.push(typeof l=="string"?l:l.toArray())}return a},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];typeof l=="string"?a.push(JSON.stringify(l)):a.push(l.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 YN(t){var e=[];return t.forEach((r,n)=>{r&&e.push(n)}),e}var SZ="FibonacciHeap",EZ=["smaller","larger"],ZN=M(SZ,EZ,t=>{var{smaller:e,larger:r}=t,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 m={key:c,value:f,degree:0};if(this._minimum){var p=this._minimum;m.left=p,m.right=p.right,p.right=m,m.right.left=m,e(c,p.key)&&(this._minimum=m)}else m.left=m,m.right=m,this._minimum=m;return this._size++,m},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,m=c.degree,p=c.child;m>0;){var d=p.right;p.left.right=p.right,p.right.left=p.left,p.left=f,p.right=f.right,f.right=p,p.right.left=p,p.parent=null,p=d,m--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=u(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,m){f.key=m;var p=f.parent;return p&&e(f.key,p.key)&&(o(c,f,p),s(c,p)),e(f.key,c.key)&&(c=f),c}function o(c,f,m){f.left.right=f.right,f.right.left=f.left,m.degree--,m.child===f&&(m.child=f.right),m.degree===0&&(m.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function s(c,f){var m=f.parent;m&&(f.mark?(o(c,f,m),s(m)):f.mark=!0)}var l=function(f,m){f.left.right=f.right,f.right.left=f.left,f.parent=m,m.child?(f.left=m.child,f.right=m.child.right,m.child.right=f,f.right.left=f):(m.child=f,f.right=f,f.left=f),m.degree++,f.mark=!1};function u(c,f){var m=Math.floor(Math.log(f)*n)+1,p=new Array(m),d=0,h=c;if(h)for(d++,h=h.right;h!==c;)d++,h=h.right;for(var b;d>0;){for(var y=h.degree,D=h.right;b=p[y],!!b;){if(r(h.key,b.key)){var v=b;b=h,h=v}l(b,h),p[y]=null,y++}p[y]=h,h=D,d--}c=null;for(var A=0;A<m;A++)b=p[A],b&&(c?(b.left.right=b.right,b.right.left=b.left,b.left=c,b.right=c.right,c.right=b,b.right.left=b,e(b.key,c.key)&&(c=b)):c=b);return c}return i},{isClass:!0});var TZ="Spa",MZ=["addScalar","equalScalar","FibonacciHeap"],JN=M(TZ,MZ,t=>{var{addScalar:e,equalScalar:r,FibonacciHeap:n}=t;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 s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=e(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],f=l.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(r(f.value,0)||s(f.key,f.value,this)),f=l.extractMinimum(),f&&c.push(f);for(var m=0;m<c.length;m++){var p=c[m];f=l.insert(p.key,p.value),u[f.key]=f}},i.prototype.swap=function(a,o){var s=this._values[a],l=this._values[o];if(!s&&l)s=this._heap.insert(a,l.value),this._heap.remove(l),this._values[a]=s,this._values[o]=void 0;else if(s&&!l)l=this._heap.insert(o,s.value),this._heap.remove(s),this._values[o]=l,this._values[a]=void 0;else if(s&&l){var u=s.value;s.value=l.value,l.value=u}},i},{isClass:!0});function XN(t){var e=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(l){var u=i[l];if(u&&(delete n[u],delete i[l],--e,r===u)){if(!e){a=0,r=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return t=Math.abs(t),{hit:function(l){var u=i[l],c=++a;if(n[c]=l,i[l]=c,!u)return++e,e<=t?void 0:(l=n[r],o(l),l);if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:o,clear:function(){e=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function il(t){var{hasher:e,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:XN(r||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 s=t.apply(t,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}var QN=il(function(t){return new t(1).exp()},{hasher:Og}),KN=il(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},{hasher:Og}),ap=il(function(t){return t.acos(-1)},{hasher:Og}),eF=il(function(t){return ap(t).times(2)},{hasher:Og});function Og(t){return t[0].precision}function tF(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function W0(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tF(Object(r),!0).forEach(function(n){dr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tF(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var CZ="Unit",NZ=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],rF=M(CZ,NZ,t=>{var{on:e,config:r,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:f,isNumeric:m,format:p,number:d,Complex:h,BigNumber:b,Fraction:y}=t,D=d;function v(G,J){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(G==null||m(G)||Hn(G)))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=W.map(ye=>0);else if(typeof J=="string"){var ge=v.parse(J);this.units=ge.units,this.dimensions=ge.dimensions}else if(En(J)&&J.value===null)this.fixPrefix=J.fixPrefix,this.skipAutomaticSimplification=J.skipAutomaticSimplification,this.dimensions=J.dimensions.slice(0),this.units=J.units.map(ye=>bn({},ye));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(G)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var A,w,x;function E(){for(;x===" "||x===" ";)C()}function T(G){return G>="0"&&G<="9"||G==="."}function _(G){return G>="0"&&G<="9"}function C(){w++,x=A.charAt(w)}function N(G){w=G,x=A.charAt(w)}function I(){var G="",J=w;if(x==="+"?C():x==="-"&&(G+=x,C()),!T(x))return N(J),null;if(x==="."){if(G+=x,C(),!_(x))return N(J),null}else{for(;_(x);)G+=x,C();x==="."&&(G+=x,C())}for(;_(x);)G+=x,C();if(x==="E"||x==="e"){var ge="",ye=w;if(ge+=x,C(),(x==="+"||x==="-")&&(ge+=x,C()),!_(x))return N(ye),G;for(G=G+ge;_(x);)G+=x,C()}return G}function R(){for(var G="";_(x)||v.isValidAlpha(x);)G+=x,C();var J=G.charAt(0);return v.isValidAlpha(J)?G:null}function L(G){return x===G?(C(),G):null}v.parse=function(G,J){if(J=J||{},A=G,w=-1,x="",typeof A!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ge=new v;ge.units=[];var ye=1,De=!1;C(),E();var Ie=I(),Oe=null;if(Ie){if(r.number==="BigNumber")Oe=new b(Ie);else if(r.number==="Fraction")try{Oe=new y(Ie)}catch{Oe=parseFloat(Ie)}else Oe=parseFloat(Ie);E(),L("*")?(ye=1,De=!0):L("/")&&(ye=-1,De=!0)}for(var Je=[],wt=1;;){for(E();x==="(";)Je.push(ye),wt*=ye,ye=1,C(),E();var qe=void 0;if(x){var rr=x;if(qe=R(),qe===null)throw new SyntaxError('Unexpected "'+rr+'" in "'+A+'" at index '+w.toString())}else break;var Wt=V(qe);if(Wt===null)throw new SyntaxError('Unit "'+qe+'" not found.');var pr=ye*wt;if(E(),L("^")){E();var Pe=I();if(Pe===null)throw new SyntaxError('In "'+G+'", "^" must be followed by a floating-point number');pr*=Pe}ge.units.push({unit:Wt.unit,prefix:Wt.prefix,power:pr});for(var j=0;j<W.length;j++)ge.dimensions[j]+=(Wt.unit.dimensions[j]||0)*pr;for(E();x===")";){if(Je.length===0)throw new SyntaxError('Unmatched ")" in "'+A+'" at index '+w.toString());wt/=Je.pop(),C(),E()}if(De=!1,L("*")?(ye=1,De=!0):L("/")?(ye=-1,De=!0):ye=1,Wt.unit.base){var de=Wt.unit.base.key;oe.auto[de]={unit:Wt.unit,prefix:Wt.prefix}}}if(E(),x)throw new SyntaxError('Could not parse: "'+G+'"');if(De)throw new SyntaxError('Trailing characters: "'+G+'"');if(Je.length!==0)throw new SyntaxError('Unmatched "(" in "'+A+'"');if(ge.units.length===0&&!J.allowNoUnits)throw new SyntaxError('"'+G+'" contains no units');return ge.value=Oe!==void 0?ge._normalize(Oe):null,ge},v.prototype.clone=function(){var G=new v;G.fixPrefix=this.fixPrefix,G.skipAutomaticSimplification=this.skipAutomaticSimplification,G.value=ut(this.value),G.dimensions=this.dimensions.slice(0),G.units=[];for(var J=0;J<this.units.length;J++){G.units[J]={};for(var ge in this.units[J])Ze(this.units[J],ge)&&(G.units[J][ge]=this.units[J][ge])}return G},v.prototype.valueType=function(){return ir(this.value)},v.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},v.prototype._normalize=function(G){if(G==null||this.units.length===0)return G;for(var J=G,ge=v._getNumberConverter(ir(G)),ye=0;ye<this.units.length;ye++){var De=ge(this.units[ye].unit.value),Ie=ge(this.units[ye].prefix.value),Oe=ge(this.units[ye].power);J=a(J,s(a(De,Ie),Oe))}return J},v.prototype._denormalize=function(G,J){if(G==null||this.units.length===0)return G;for(var ge=G,ye=v._getNumberConverter(ir(G)),De=0;De<this.units.length;De++){var Ie=ye(this.units[De].unit.value),Oe=ye(this.units[De].prefix.value),Je=ye(this.units[De].power);ge=o(ge,s(a(Ie,Oe),Je))}return ge};var V=il(G=>{if(Ze(U,G)){var J=U[G],ge=J.prefixes[""];return{unit:J,prefix:ge}}for(var ye in U)if(Ze(U,ye)&&lE(G,ye)){var De=U[ye],Ie=G.length-ye.length,Oe=G.substring(0,Ie),Je=Ze(De.prefixes,Oe)?De.prefixes[Oe]:void 0;if(Je!==void 0)return{unit:De,prefix:Je}}return null},{hasher:G=>G[0],limit:100});v.isValuelessUnit=function(G){return V(G)!==null},v.prototype.hasBase=function(G){if(typeof G=="string"&&(G=O[G]),!G)return!1;for(var J=0;J<W.length;J++)if(Math.abs((this.dimensions[J]||0)-(G.dimensions[J]||0))>1e-12)return!1;return!0},v.prototype.equalBase=function(G){for(var J=0;J<W.length;J++)if(Math.abs((this.dimensions[J]||0)-(G.dimensions[J]||0))>1e-12)return!1;return!0},v.prototype.equals=function(G){return this.equalBase(G)&&f(this.value,G.value)},v.prototype.multiply=function(G){for(var J=this.clone(),ge=En(G)?G:new v(G),ye=0;ye<W.length;ye++)J.dimensions[ye]=(this.dimensions[ye]||0)+(ge.dimensions[ye]||0);for(var De=0;De<ge.units.length;De++){var Ie=W0({},ge.units[De]);J.units.push(Ie)}if(this.value!==null||ge.value!==null){var Oe=this.value===null?this._normalize(1):this.value,Je=ge.value===null?ge._normalize(1):ge.value;J.value=a(Oe,Je)}else J.value=null;return En(G)&&(J.skipAutomaticSimplification=!1),P(J)},v.prototype.divideInto=function(G){return new v(G).divide(this)},v.prototype.divide=function(G){for(var J=this.clone(),ge=En(G)?G:new v(G),ye=0;ye<W.length;ye++)J.dimensions[ye]=(this.dimensions[ye]||0)-(ge.dimensions[ye]||0);for(var De=0;De<ge.units.length;De++){var Ie=W0(W0({},ge.units[De]),{},{power:-ge.units[De].power});J.units.push(Ie)}if(this.value!==null||ge.value!==null){var Oe=this.value===null?this._normalize(1):this.value,Je=ge.value===null?ge._normalize(1):ge.value;J.value=o(Oe,Je)}else J.value=null;return En(G)&&(J.skipAutomaticSimplification=!1),P(J)},v.prototype.pow=function(G){for(var J=this.clone(),ge=0;ge<W.length;ge++)J.dimensions[ge]=(this.dimensions[ge]||0)*G;for(var ye=0;ye<J.units.length;ye++)J.units[ye].power*=G;return J.value!==null?J.value=s(J.value,G):J.value=null,J.skipAutomaticSimplification=!1,P(J)};function P(G){return G.equalBase(O.NONE)&&G.value!==null&&!r.predictable?G.value:G}v.prototype.abs=function(){var G=this.clone();if(G.value!==null)if(G._isDerived()||G.units.length===0||G.units[0].unit.offset===0)G.value=l(G.value);else{var J=G._numberConverter(),ge=J(G.units[0].unit.value),ye=J(G.units[0].unit.offset),De=a(ge,ye);G.value=i(l(n(G.value,De)),De)}for(var Ie in G.units)(G.units[Ie].unit.name==="VA"||G.units[Ie].unit.name==="VAR")&&(G.units[Ie].unit=U.W);return G},v.prototype.to=function(G){var J=this.value===null?this._normalize(1):this.value,ge;if(typeof G=="string")ge=v.parse(G);else if(En(G))ge=G.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(ge))throw new Error("Units do not match ('".concat(ge.toString(),"' != '").concat(this.toString(),"')"));if(ge.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||ge.units.length===0||this.units[0].unit.offset===ge.units[0].unit.offset)ge.value=ut(J);else{var ye=v._getNumberConverter(ir(J)),De=this.units[0].unit.value,Ie=this.units[0].unit.offset,Oe=a(De,Ie),Je=ge.units[0].unit.value,wt=ge.units[0].unit.offset,qe=a(Je,wt);ge.value=n(J,ye(i(Oe,qe)))}return ge.fixPrefix=!0,ge.skipAutomaticSimplification=!0,ge},v.prototype.toNumber=function(G){return D(this.toNumeric(G))},v.prototype.toNumeric=function(G){var J;return G?J=this.to(G):J=this.clone(),J._isDerived()||J.units.length===0?J._denormalize(J.value):J._denormalize(J.value,J.units[0].prefix.value)},v.prototype.toString=function(){return this.format()},v.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},v.fromJSON=function(G){var J,ge=new v(G.value,(J=G.unit)!==null&&J!==void 0?J:void 0);return ge.fixPrefix=G.fixPrefix||!1,ge},v.prototype.valueOf=v.prototype.toString,v.prototype.simplify=function(){var G=this.clone(),J=[],ge;for(var ye in be)if(Ze(be,ye)&&G.hasBase(O[ye])){ge=ye;break}if(ge==="NONE")G.units=[];else{var De;if(ge&&Ze(be,ge)&&(De=be[ge]),De)G.units=[{unit:De.unit,prefix:De.prefix,power:1}];else{for(var Ie=!1,Oe=0;Oe<W.length;Oe++){var Je=W[Oe];Math.abs(G.dimensions[Oe]||0)>1e-12&&(Ze(be,Je)?J.push({unit:be[Je].unit,prefix:be[Je].prefix,power:G.dimensions[Oe]||0}):Ie=!0)}J.length<G.units.length&&!Ie&&(G.units=J)}}return G},v.prototype.toSI=function(){for(var G=this.clone(),J=[],ge=0;ge<W.length;ge++){var ye=W[ge];if(Math.abs(G.dimensions[ge]||0)>1e-12)if(Ze(oe.si,ye))J.push({unit:oe.si[ye].unit,prefix:oe.si[ye].prefix,power:G.dimensions[ge]||0});else throw new Error("Cannot express custom unit "+ye+" in SI units")}return G.units=J,G.fixPrefix=!0,G.skipAutomaticSimplification=!0,this.value!==null?(G.value=null,this.to(G)):G},v.prototype.formatUnits=function(){for(var G="",J="",ge=0,ye=0,De=0;De<this.units.length;De++)this.units[De].power>0?(ge++,G+=" "+this.units[De].prefix.name+this.units[De].unit.name,Math.abs(this.units[De].power-1)>1e-15&&(G+="^"+this.units[De].power)):this.units[De].power<0&&ye++;if(ye>0)for(var Ie=0;Ie<this.units.length;Ie++)this.units[Ie].power<0&&(ge>0?(J+=" "+this.units[Ie].prefix.name+this.units[Ie].unit.name,Math.abs(this.units[Ie].power+1)>1e-15&&(J+="^"+-this.units[Ie].power)):(J+=" "+this.units[Ie].prefix.name+this.units[Ie].unit.name,J+="^"+this.units[Ie].power));G=G.substr(1),J=J.substr(1),ge>1&&ye>0&&(G="("+G+")"),ye>1&&ge>0&&(J="("+J+")");var Oe=G;return ge>0&&ye>0&&(Oe+=" / "),Oe+=J,Oe},v.prototype.format=function(G){var J=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ge=!1;typeof J.value<"u"&&J.value!==null&&Hn(J.value)&&(ge=Math.abs(J.value.re)<1e-14);for(var ye in J.units)Ze(J.units,ye)&&J.units[ye].unit&&(J.units[ye].unit.name==="VA"&&ge?J.units[ye].unit=U.VAR:J.units[ye].unit.name==="VAR"&&!ge&&(J.units[ye].unit=U.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 De=J._denormalize(J.value),Ie=J.value!==null?p(De,G||{}):"",Oe=J.formatUnits();return J.value&&Hn(J.value)&&(Ie="("+Ie+")"),Oe.length>0&&Ie.length>0&&(Ie+=" "),Ie+=Oe,Ie},v.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var G=this.value!==null?l(this.value):0,J=l(this.units[0].unit.value),ge=this.units[0].prefix;if(G===0)return ge;var ye=this.units[0].power,De=Math.log(G/Math.pow(ge.value*J,ye))/Math.LN10-1.2;if(De>-2.200001&&De<1.800001)return ge;De=Math.abs(De);var Ie=this.units[0].unit.prefixes;for(var Oe in Ie)if(Ze(Ie,Oe)){var Je=Ie[Oe];if(Je.scientific){var wt=Math.abs(Math.log(G/Math.pow(Je.value*J,ye))/Math.LN10-1.2);(wt<De||wt===De&&Je.name.length<ge.name.length)&&(ge=Je,De=wt)}}return ge},v.prototype.splitUnit=function(G){for(var J=this.clone(),ge=[],ye=0;ye<G.length&&(J=J.to(G[ye]),ye!==G.length-1);ye++){var De=J.toNumeric(),Ie=c(De),Oe=void 0,Je=f(Ie,De);Je?Oe=Ie:Oe=u(J.toNumeric());var wt=new v(Oe,G[ye].toString());ge.push(wt),J=i(J,wt)}for(var qe=0,rr=0;rr<ge.length;rr++)qe=n(qe,ge[rr].value);return f(qe,this.value)&&(J.value=0),ge.push(J),ge};var k={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},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,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},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,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},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,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},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,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},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,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},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,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},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,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},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,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}}};k.SHORTLONG=bn({},k.SHORT,k.LONG),k.BINARY_SHORT=bn({},k.BINARY_SHORT_SI,k.BINARY_SHORT_IEC),k.BINARY_LONG=bn({},k.BINARY_LONG_SI,k.BINARY_LONG_IEC);var W=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],O={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 Q in O)Ze(O,Q)&&(O[Q].key=Q);var ne={},X={name:"",base:ne,value:1,offset:0,dimensions:W.map(G=>0)},U={meter:{name:"meter",base:O.LENGTH,prefixes:k.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:k.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:k.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:k.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:k.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:k.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:k.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:k.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:k.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:k.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:k.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:k.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:k.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:k.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:k.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:k.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:k.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:k.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:k.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:k.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:k.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:k.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:k.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:k.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:k.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:k.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:k.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:k.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:k.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:k.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:k.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:k.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:k.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:k.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:k.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:k.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:k.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:k.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:k.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:k.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:k.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:k.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:k.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:k.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:k.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:k.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:k.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:k.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:k.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:k.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:k.NONE,value:.238480942392,offset:0},g:{name:"g",base:O.MASS,prefixes:k.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:k.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:k.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:k.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:k.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:k.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:k.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:k.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:k.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:k.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:k.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:k.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:k.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:k.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:k.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:k.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:k.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:k.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:k.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:k.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:k.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:k.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:k.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:k.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:k.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:k.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:k.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:k.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:k.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:k.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:k.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:k.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:k.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:k.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:k.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:k.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:k.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:k.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:k.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:k.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:k.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:k.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:k.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:k.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:k.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:k.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:k.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:k.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:k.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:k.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:k.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:k.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:k.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:k.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:k.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:k.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:k.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:k.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:k.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:k.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:k.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:k.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:k.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:k.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:k.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:k.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:k.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:k.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:k.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:k.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:k.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:k.SHORT,value:h.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:k.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:k.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:k.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:k.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:k.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:k.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:k.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:k.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:k.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:k.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:k.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:k.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:k.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:k.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:k.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:k.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:k.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:k.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:k.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:k.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:k.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:k.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:k.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:k.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:k.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:k.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:k.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:k.BINARY_LONG,value:8,offset:0}},fe={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",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",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 xe(G){if(G.number==="BigNumber"){var J=ap(b);U.rad.value=new b(1),U.deg.value=J.div(180),U.grad.value=J.div(200),U.cycle.value=J.times(2),U.arcsec.value=J.div(648e3),U.arcmin.value=J.div(10800)}else U.rad.value=1,U.deg.value=Math.PI/180,U.grad.value=Math.PI/200,U.cycle.value=Math.PI*2,U.arcsec.value=Math.PI/648e3,U.arcmin.value=Math.PI/10800;U.radian.value=U.rad.value,U.degree.value=U.deg.value,U.gradian.value=U.grad.value}xe(r),e&&e("config",function(G,J){G.number!==J.number&&xe(G)});var oe={si:{NONE:{unit:X,prefix:k.NONE[""]},LENGTH:{unit:U.m,prefix:k.SHORT[""]},MASS:{unit:U.g,prefix:k.SHORT.k},TIME:{unit:U.s,prefix:k.SHORT[""]},CURRENT:{unit:U.A,prefix:k.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:k.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:k.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:k.SHORT[""]},ANGLE:{unit:U.rad,prefix:k.SHORT[""]},BIT:{unit:U.bits,prefix:k.SHORT[""]},FORCE:{unit:U.N,prefix:k.SHORT[""]},ENERGY:{unit:U.J,prefix:k.SHORT[""]},POWER:{unit:U.W,prefix:k.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:k.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:k.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:k.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:k.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:k.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:k.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:k.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:k.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:k.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:k.SHORT[""]}}};oe.cgs=JSON.parse(JSON.stringify(oe.si)),oe.cgs.LENGTH={unit:U.m,prefix:k.SHORT.c},oe.cgs.MASS={unit:U.g,prefix:k.SHORT[""]},oe.cgs.FORCE={unit:U.dyn,prefix:k.SHORT[""]},oe.cgs.ENERGY={unit:U.erg,prefix:k.NONE[""]},oe.us=JSON.parse(JSON.stringify(oe.si)),oe.us.LENGTH={unit:U.ft,prefix:k.NONE[""]},oe.us.MASS={unit:U.lbm,prefix:k.NONE[""]},oe.us.TEMPERATURE={unit:U.degF,prefix:k.NONE[""]},oe.us.FORCE={unit:U.lbf,prefix:k.NONE[""]},oe.us.ENERGY={unit:U.BTU,prefix:k.BTU[""]},oe.us.POWER={unit:U.hp,prefix:k.NONE[""]},oe.us.PRESSURE={unit:U.psi,prefix:k.NONE[""]},oe.auto=JSON.parse(JSON.stringify(oe.si));var be=oe.auto;v.setUnitSystem=function(G){if(Ze(oe,G))be=oe[G];else throw new Error("Unit system "+G+" does not exist. Choices are: "+Object.keys(oe).join(", "))},v.getUnitSystem=function(){for(var G in oe)if(Ze(oe,G)&&oe[G]===be)return G},v.typeConverters={BigNumber:function(J){return J!=null&&J.isFraction?new b(String(J.n)).div(String(J.d)).times(String(J.s)):new b(J+"")},Fraction:function(J){return new y(J)},Complex:function(J){return J},number:function(J){return J!=null&&J.isFraction?d(J):J}},v.prototype._numberConverter=function(){var G=v.typeConverters[this.valueType()];if(G)return G;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(G){if(!v.typeConverters[G])throw new TypeError('Unsupported type "'+G+'"');return v.typeConverters[G]};for(var ee in U)if(Ze(U,ee)){var Z=U[ee];Z.dimensions=Z.base.dimensions}for(var re in fe)if(Ze(fe,re)){var me=U[fe[re]],ce={};for(var Ae in me)Ze(me,Ae)&&(ce[Ae]=me[Ae]);ce.name=re,U[re]=ce}v.isValidAlpha=function(J){return/^[a-zA-Z]$/.test(J)};function we(G){for(var J=0;J<G.length;J++){if(x=G.charAt(J),J===0&&!v.isValidAlpha(x))throw new Error('Invalid unit name (must begin with alpha character): "'+G+'"');if(J>0&&!(v.isValidAlpha(x)||_(x)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+G+'"')}}return v.createUnit=function(G,J){if(typeof G!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(J&&J.override){for(var ge in G)if(Ze(G,ge)&&v.deleteUnit(ge),G[ge].aliases)for(var ye=0;ye<G[ge].aliases.length;ye++)v.deleteUnit(G[ge].aliases[ye])}var De;for(var Ie in G)Ze(G,Ie)&&(De=v.createUnitSingle(Ie,G[Ie]));return De},v.createUnitSingle=function(G,J){if((typeof J>"u"||J===null)&&(J={}),typeof G!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Ze(U,G))throw new Error('Cannot create unit "'+G+'": a unit with that name already exists');we(G);var ge=null,ye=[],De=0,Ie,Oe,Je;if(J&&J.type==="Unit")ge=J.clone();else if(typeof J=="string")J!==""&&(Ie=J);else if(typeof J=="object")Ie=J.definition,Oe=J.prefixes,De=J.offset,Je=J.baseName,J.aliases&&(ye=J.aliases.valueOf());else throw new TypeError('Cannot create unit "'+G+'" from "'+J.toString()+'": expecting "string" or "Unit" or "Object"');if(ye){for(var wt=0;wt<ye.length;wt++)if(Ze(U,ye[wt]))throw new Error('Cannot create alias "'+ye[wt]+'": a unit with that name already exists')}if(Ie&&typeof Ie=="string"&&!ge)try{ge=v.parse(Ie,{allowNoUnits:!0})}catch(Y){throw Y.message='Could not create unit "'+G+'" from "'+Ie+'": '+Y.message,Y}else Ie&&Ie.type==="Unit"&&(ge=Ie.clone());ye=ye||[],De=De||0,Oe&&Oe.toUpperCase?Oe=k[Oe.toUpperCase()]||k.NONE:Oe=k.NONE;var qe={};if(ge){qe={name:G,value:ge.value,dimensions:ge.dimensions.slice(0),prefixes:Oe,offset:De};var Pe=!1;for(var j in O)if(Ze(O,j)){for(var de=!0,pe=0;pe<W.length;pe++)if(Math.abs((qe.dimensions[pe]||0)-(O[j].dimensions[pe]||0))>1e-12){de=!1;break}if(de){Pe=!0,qe.base=O[j];break}}if(!Pe){Je=Je||G+"_STUFF";var Ne={dimensions:ge.dimensions.slice(0)};Ne.key=Je,O[Je]=Ne,be[Je]={unit:qe,prefix:k.NONE[""]},qe.base=O[Je]}}else{if(Je=Je||G+"_STUFF",W.indexOf(Je)>=0)throw new Error('Cannot create new base unit "'+G+'": a base unit with that name already exists (and cannot be overridden)');W.push(Je);for(var rr in O)Ze(O,rr)&&(O[rr].dimensions[W.length-1]=0);for(var Wt={dimensions:[]},pr=0;pr<W.length;pr++)Wt.dimensions[pr]=0;Wt.dimensions[W.length-1]=1,Wt.key=Je,O[Je]=Wt,qe={name:G,value:1,dimensions:O[Je].dimensions.slice(0),prefixes:Oe,offset:De,base:O[Je]},be[Je]={unit:qe,prefix:k.NONE[""]}}v.UNITS[G]=qe;for(var Be=0;Be<ye.length;Be++){var _e=ye[Be],Ge={};for(var F in qe)Ze(qe,F)&&(Ge[F]=qe[F]);Ge.name=_e,v.UNITS[_e]=Ge}return delete V.cache,new v(null,G)},v.deleteUnit=function(G){delete v.UNITS[G],delete V.cache},v.PREFIXES=k,v.BASE_DIMENSIONS=W,v.BASE_UNITS=O,v.UNIT_SYSTEMS=oe,v.UNITS=U,v},{isClass:!0});var nF="unit",FZ=["typed","Unit"],iF=M(nF,FZ,t=>{var{typed:e,Unit:r}=t;return e(nF,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var aF="sparse",IZ=["typed","SparseMatrix"],oF=M(aF,IZ,t=>{var{typed:e,SparseMatrix:r}=t;return e(aF,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})});var sF="createUnit",BZ=["typed","Unit"],uF=M(sF,BZ,t=>{var{typed:e,Unit:r}=t;return e(sF,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})});var lF="acos",kZ=["typed","config","Complex"],cF=M(lF,kZ,t=>{var{typed:e,config:r,Complex:n}=t;return e(lF,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var fF="acosh",PZ=["typed","config","Complex"],pF=M(fF,PZ,t=>{var{typed:e,config:r,Complex:n}=t;return e(fF,{number:function(a){return a>=1||r.predictable?x0(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 mF="acot",$Z=["typed","BigNumber"],dF=M(mF,$Z,t=>{var{typed:e,BigNumber:r}=t;return e(mF,{number:w0,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var hF="acoth",OZ=["typed","config","Complex","BigNumber"],gF=M(hF,OZ,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(hF,{number:function(o){return o>=1||o<=-1||r.predictable?_0(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var vF="acsc",RZ=["typed","config","Complex","BigNumber"],yF=M(vF,RZ,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(vF,{number:function(o){return o<=-1||o>=1||r.predictable?A0(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var bF="acsch",LZ=["typed","BigNumber"],xF=M(bF,LZ,t=>{var{typed:e,BigNumber:r}=t;return e(bF,{number:D0,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var wF="asec",VZ=["typed","config","Complex","BigNumber"],_F=M(wF,VZ,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(wF,{number:function(o){return o<=-1||o>=1||r.predictable?S0(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var AF="asech",UZ=["typed","config","Complex","BigNumber"],DF=M(AF,UZ,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(AF,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return E0(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),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 SF="asin",qZ=["typed","config","Complex"],EF=M(SF,qZ,t=>{var{typed:e,config:r,Complex:n}=t;return e(SF,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var zZ="asinh",HZ=["typed"],TF=M(zZ,HZ,t=>{var{typed:e}=t;return e("asinh",{number:T0,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var GZ="atan",WZ=["typed"],MF=M(GZ,WZ,t=>{var{typed:e}=t;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var CF="atan2",YZ=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],NF=M(CF,YZ,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=t,s=wn({typed:e,equalScalar:n}),l=Ur({typed:e}),u=lg({typed:e,equalScalar:n}),c=Er({typed:e,equalScalar:n}),f=mr({typed:e,DenseMatrix:a}),m=Ft({typed:e,matrix:r,concat:o});return e(CF,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,d)=>i.atan2(p,d)},m({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:f}))});var FF="atanh",jZ=["typed","config","Complex"],IF=M(FF,jZ,t=>{var{typed:e,config:r,Complex:n}=t;return e(FF,{number:function(a){return a<=1&&a>=-1||r.predictable?M0(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var Ja=M("trigUnit",["typed"],t=>{var{typed:e}=t;return{Unit:e.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(r,n.valueType())(n.value)})}});var BF="cos",ZZ=["typed"],kF=M(BF,ZZ,t=>{var{typed:e}=t,r=Ja({typed:e});return e(BF,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var PF="cosh",JZ=["typed"],$F=M(PF,JZ,t=>{var{typed:e}=t;return e(PF,{number:Ph,"Complex | BigNumber":r=>r.cosh()})});var OF="cot",XZ=["typed","BigNumber"],RF=M(OF,XZ,t=>{var{typed:e,BigNumber:r}=t,n=Ja({typed:e});return e(OF,{number:C0,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var LF="coth",QZ=["typed","BigNumber"],VF=M(LF,QZ,t=>{var{typed:e,BigNumber:r}=t;return e(LF,{number:N0,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var UF="csc",KZ=["typed","BigNumber"],qF=M(UF,KZ,t=>{var{typed:e,BigNumber:r}=t,n=Ja({typed:e});return e(UF,{number:F0,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var zF="csch",eJ=["typed","BigNumber"],HF=M(zF,eJ,t=>{var{typed:e,BigNumber:r}=t;return e(zF,{number:I0,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var GF="sec",tJ=["typed","BigNumber"],WF=M(GF,tJ,t=>{var{typed:e,BigNumber:r}=t,n=Ja({typed:e});return e(GF,{number:B0,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var YF="sech",rJ=["typed","BigNumber"],jF=M(YF,rJ,t=>{var{typed:e,BigNumber:r}=t;return e(YF,{number:k0,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var ZF="sin",nJ=["typed"],JF=M(ZF,nJ,t=>{var{typed:e}=t,r=Ja({typed:e});return e(ZF,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var XF="sinh",iJ=["typed"],QF=M(XF,iJ,t=>{var{typed:e}=t;return e(XF,{number:P0,"Complex | BigNumber":r=>r.sinh()})});var KF="tan",aJ=["typed"],eI=M(KF,aJ,t=>{var{typed:e}=t,r=Ja({typed:e});return e(KF,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var oJ="tanh",sJ=["typed"],tI=M(oJ,sJ,t=>{var{typed:e}=t;return e("tanh",{number:$h,"Complex | BigNumber":r=>r.tanh()})});var rI="setCartesian",uJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],nI=M(rI,uJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(rI,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var f=Pt(Array.isArray(l)?l:l.toArray()).sort(i),m=Pt(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p<f.length;p++)for(var d=0;d<m.length;d++)c.push([f[p],m[d]])}return Array.isArray(l)&&Array.isArray(u)?c:new o(c)}})});var iI="setDifference",lJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],aI=M(iI,lJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(iI,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return Pt(l.toArray());var f=Ss(Pt(Array.isArray(l)?l:l.toArray()).sort(i)),m=Ss(Pt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,d=0;d<f.length;d++){p=!1;for(var h=0;h<m.length;h++)if(i(f[d].value,m[h].value)===0&&f[d].identifier===m[h].identifier){p=!0;break}p||c.push(f[d])}}return Array.isArray(l)&&Array.isArray(u)?_c(c):new o(_c(c))}})});var oI="setDistinct",cJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],sI=M(oI,cJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(oI,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=Pt(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&u.push(c[f])}return Array.isArray(l)?u:new o(u)}})});var uI="setIntersect",fJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],lI=M(uI,fJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(uI,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var f=Ss(Pt(Array.isArray(l)?l:l.toArray()).sort(i)),m=Ss(Pt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p<f.length;p++)for(var d=0;d<m.length;d++)if(i(f[p].value,m[d].value)===0&&f[p].identifier===m[d].identifier){c.push(f[p]);break}}return Array.isArray(l)&&Array.isArray(u)?_c(c):new o(_c(c))}})});var cI="setIsSubset",pJ=["typed","size","subset","compareNatural","Index"],fI=M(cI,pJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(cI,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=Ss(Pt(Array.isArray(s)?s:s.toArray()).sort(i)),c=Ss(Pt(Array.isArray(l)?l:l.toArray()).sort(i)),f,m=0;m<u.length;m++){f=!1;for(var p=0;p<c.length;p++)if(i(u[m].value,c[p].value)===0&&u[m].identifier===c[p].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var pI="setMultiplicity",mJ=["typed","size","subset","compareNatural","Index"],mI=M(pI,mJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(pI,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=Pt(Array.isArray(l)?l:l.toArray()),c=0,f=0;f<u.length;f++)i(u[f],s)===0&&c++;return c}})});var dI="setPowerset",dJ=["typed","size","subset","compareNatural","Index"],hI=M(dI,dJ,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(dI,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=Pt(Array.isArray(u)?u:u.toArray()).sort(i),f=[],m=0;m.toString(2).length<=c.length;)f.push(o(c,m.toString(2).split("").reverse())),m++;return s(f)}});function o(l,u){for(var c=[],f=0;f<u.length;f++)u[f]==="1"&&c.push(l[f]);return c}function s(l){for(var u=[],c=l.length-1;c>0;c--)for(var f=0;f<c;f++)l[f].length>l[f+1].length&&(u=l[f],l[f]=l[f+1],l[f+1]=u);return l}});var gI="setSize",hJ=["typed","compareNatural"],vI=M(gI,hJ,t=>{var{typed:e,compareNatural:r}=t;return e(gI,{"Array | Matrix":function(i){return Array.isArray(i)?Pt(i).length:Pt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Pt(i).length:Pt(i.toArray()).length;for(var o=Pt(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l<o.length;l++)r(o[l],o[l-1])!==0&&s++;return s}})});var yI="setSymDifference",gJ=["typed","size","concat","subset","setDifference","Index"],bI=M(yI,gJ,t=>{var{typed:e,size:r,concat:n,subset:i,setDifference:a,Index:o}=t;return e(yI,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return Pt(u);if(i(r(u),new o(0))===0)return Pt(l);var c=Pt(l),f=Pt(u);return n(a(c,f),a(f,c))}})});var xI="setUnion",vJ=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],wI=M(xI,vJ,t=>{var{typed:e,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=t;return e(xI,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return Pt(c);if(i(r(c),new s(0))===0)return Pt(u);var f=Pt(u),m=Pt(c);return n(o(f,m),a(f,m))}})});var _I="add",yJ=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],AI=M(_I,yJ,t=>{var{typed:e,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=t,l=Ai({typed:e}),u=Tc({typed:e,equalScalar:i}),c=ra({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:r,concat:s});return e(_I,{"any, any":n,"any, any, ...any":e.referToSelf(m=>(p,d,h)=>{for(var b=m(p,d),y=0;y<h.length;y++)b=m(b,h[y]);return b})},f({elop:n,DS:l,SS:u,Ss:c}))});var DI="hypot",bJ=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],SI=M(DI,bJ,t=>{var{typed:e,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=t;return e(DI,{"... number | BigNumber":u,Array:u,Matrix:c=>u(Pt(c.toArray(),!0))});function u(c){for(var f=0,m=0,p=0;p<c.length;p++){if(Hn(c[p]))throw new TypeError("Unexpected type of argument to hypot");var d=r(c[p]);s(m,d)?(f=a(f,a(i(m,d),i(m,d))),f=n(f,1),m=d):f=n(f,l(d)?a(i(d,m),i(d,m)):d)}return a(m,o(f))}});var EI="norm",xJ=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],TI=M(EI,xJ,t=>{var{typed:e,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:f,ctranspose:m,eigs:p}=t;return e(EI,{number:Math.abs,Complex:function(T){return T.abs()},BigNumber:function(T){return T.abs()},boolean:function(T){return Math.abs(T)},Array:function(T){return x(f(T),2)},Matrix:function(T){return x(T,2)},"Array, number | BigNumber | string":function(T,_){return x(f(T),_)},"Matrix, number | BigNumber | string":function(T,_){return x(T,_)}});function d(E){var T=0;return E.forEach(function(_){var C=r(_);u(C,T)&&(T=C)},!0),T}function h(E){var T;return E.forEach(function(_){var C=r(_);(!T||c(C,T))&&(T=C)},!0),T||0}function b(E,T){if(T===Number.POSITIVE_INFINITY||T==="inf")return d(E);if(T===Number.NEGATIVE_INFINITY||T==="-inf")return h(E);if(T==="fro")return x(E,2);if(typeof T=="number"&&!isNaN(T)){if(!l(T,0)){var _=0;return E.forEach(function(C){_=n(i(r(C),T),_)},!0),i(_,1/T)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function y(E){var T=0;return E.forEach(function(_,C){T=n(T,s(_,a(_)))}),r(o(T))}function D(E){var T=[],_=0;return E.forEach(function(C,N){var I=N[1],R=n(T[I]||0,r(C));u(R,_)&&(_=R),T[I]=R},!0),_}function v(E){var T=E.size();if(T[0]!==T[1])throw new RangeError("Invalid matrix dimensions");var _=m(E),C=s(_,E),N=p(C).values.toArray(),I=N[N.length-1];return r(o(I))}function A(E){var T=[],_=0;return E.forEach(function(C,N){var I=N[0],R=n(T[I]||0,r(C));u(R,_)&&(_=R),T[I]=R},!0),_}function w(E,T){if(T===1)return D(E);if(T===Number.POSITIVE_INFINITY||T==="inf")return A(E);if(T==="fro")return y(E);if(T===2)return v(E);throw new Error("Unsupported parameter value "+T)}function x(E,T){var _=E.size();if(_.length===1)return b(E,T);if(_.length===2){if(_[0]&&_[1])return w(E,T);throw new RangeError("Invalid matrix dimensions")}}});var MI="dot",wJ=["typed","addScalar","multiplyScalar","conj","size"],CI=M(MI,wJ,t=>{var{typed:e,addScalar:r,multiplyScalar:n,conj:i,size:a}=t;return e(MI,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,f){var m=u(c),p=u(f),d,h;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(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(d!==h)throw new RangeError("Vectors must have equal length ("+d+" != "+h+")");if(d===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return d}function s(c,f){var m=o(c,f),p=Ye(c)?c._data:c,d=Ye(c)?c._datatype||c.getDataType():void 0,h=Ye(f)?f._data:f,b=Ye(f)?f._datatype||f.getDataType():void 0,y=u(c).length===2,D=u(f).length===2,v=r,A=n;if(d&&b&&d===b&&typeof d=="string"&&d!=="mixed"){var w=d;v=e.find(r,[w,w]),A=e.find(n,[w,w])}if(!y&&!D){for(var x=A(i(p[0]),h[0]),E=1;E<m;E++)x=v(x,A(i(p[E]),h[E]));return x}if(!y&&D){for(var T=A(i(p[0]),h[0][0]),_=1;_<m;_++)T=v(T,A(i(p[_]),h[_][0]));return T}if(y&&!D){for(var C=A(i(p[0][0]),h[0]),N=1;N<m;N++)C=v(C,A(i(p[N][0]),h[N]));return C}if(y&&D){for(var I=A(i(p[0][0]),h[0][0]),R=1;R<m;R++)I=v(I,A(i(p[R][0]),h[R][0]));return I}}function l(c,f){o(c,f);for(var m=c._index,p=c._values,d=f._index,h=f._values,b=0,y=r,D=n,v=0,A=0;v<m.length&&A<d.length;){var w=m[v],x=d[A];if(w<x){v++;continue}if(w>x){A++;continue}w===x&&(b=y(b,D(p[v],h[A])),v++,A++)}return b}function u(c){return Ye(c)?c.size():a(c)}});var _J="trace",AJ=["typed","matrix","add"],NI=M(_J,AJ,t=>{var{typed:e,matrix:r,add:n}=t;return e("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:ut});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return ut(l[0]);throw new RangeError("Matrix must be square (size: "+Dt(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var f=0,m=0;m<u;m++)f=n(f,l[m][m]);return f}else throw new RangeError("Matrix must be square (size: "+Dt(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(s)+")")}}function a(o){var s=o._values,l=o._index,u=o._ptr,c=o._size,f=c[0],m=c[1];if(f===m){var p=0;if(s.length>0)for(var d=0;d<m;d++)for(var h=u[d],b=u[d+1],y=h;y<b;y++){var D=l[y];if(D===d){p=n(p,s[y]);break}if(D>d)break}return p}throw new RangeError("Matrix must be square (size: "+Dt(c)+")")}});var FI="index",DJ=["typed","Index"],II=M(FI,DJ,t=>{var{typed:e,Index:r}=t;return e(FI,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return ot(s)?s.toNumber():sr(s)||Ye(s)?s.map(function(l){return ot(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})});var Rg=new Set(["end"]);var SJ="Node",EJ=["mathWithTransform"],BI=M(SJ,EJ,t=>{var{mathWithTransform:e}=t;function r(i){for(var a of[...Rg])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={},s=null;function l(u){var c=xs(u);return r(c),a(c,o,s)}return{evaluate:l}}_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(!Gt(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,f){l(u,c,f),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),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&&Qi(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?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<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?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 qr(t){return t&&t.isIndexError?new Zn(t.index+1,t.min+1,t.max!==void 0?t.max+1:void 0):t}function Lg(t){var{subset:e}=t;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 jr(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw qr(a)}}}var Vg="AccessorNode",TJ=["subset","Node"],kI=M(Vg,TJ,t=>{var{subset:e,Node:r}=t,n=Lg({subset:e});function i(o){return!($i(o)||Gn(o)||kt(o)||ai(o)||Oo(o)||Wn(o)||Mr(o))}class a extends r{constructor(s,l){if(super(),!Gt(s))throw new TypeError('Node expected for parameter "object"');if(!Xi(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Vg}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(p,d,h){return jr(u(p,d,h),f)}}else return function(p,d,h){var b=u(p,d,h),y=c(p,d,b);return n(b,y)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}_toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:Vg,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return dr(a,"name",Vg),a},{isClass:!0,isNode:!0});var Ug="ArrayNode",MJ=["Node"],PI=M(Ug,MJ,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(Gt))throw new TypeError("Array containing Nodes expected")}get type(){return Ug}get isArrayNode(){return!0}_compile(i,a){var o=Wa(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,f,m){return l(Wa(o,function(p){return p(c,f,m)}))}}else return function(c,f,m){return Wa(o,function(p){return p(c,f,m)})}}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 r(a)}clone(){return new r(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:Ug,items:this.items}}static fromJSON(i){return new r(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,s){var l=o.some(Gn)&&!o.every(Gn),u=s||l,c=u?"&":"\\\\",f=o.map(function(m){return m.items?a(m.items,!s):m.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return dr(r,"name",Ug),r},{isClass:!0,isNode:!0});function $I(t){var{subset:e,matrix:r}=t;return function(i,a,o){try{if(Array.isArray(i)){var s=r(i).subset(a,o).valueOf();return s.forEach((l,u)=>{i[u]=l}),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 Bo(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(l){throw qr(l)}}}var Xa=[{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 qg(t,e){if(!e||e!=="auto")return t;for(var r=t;Wn(r);)r=r.content;return r}function xr(t,e,r,n){var i=t;e!=="keep"&&(i=t.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<Xa.length;s++)if(a in Xa[s]){o=s;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var l=qg(i.args[0],e);!(kt(l)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Gf(qg(n.args[0],e)))&&!(l.getIdentifier()==="OperatorNode:divide"&&Gf(qg(l.args[0],e))&&kt(qg(l.args[1])))&&(o+=1)}return o}function Pc(t,e){var r=t;e!=="keep"&&(r=t.getContent());var n=r.getIdentifier(),i=xr(r,e);if(i===null)return null;var a=Xa[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 zg(t,e,r){var n=r!=="keep"?t.getContent():t,i=r!=="keep"?t.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),s=xr(n,r);if(s===null)return null;var l=Xa[s][a];if(Ze(l,"associativeWith")&&l.associativeWith instanceof Array){for(var u=0;u<l.associativeWith.length;u++)if(l.associativeWith[u]===o)return!0;return!1}return null}function OI(t){var e="OperatorNode:"+t;for(var r of Xa)if(e in r)return r[e].op;return null}var Hg="AssignmentNode",CJ=["subset","?matrix","Node"],RI=M(Hg,CJ,t=>{var{subset:e,matrix:r,Node:n}=t,i=Lg({subset:e}),a=$I({subset:e,matrix:r});function o(l,u,c){u||(u="keep");var f=xr(l,u,c),m=xr(l.value,u,c);return u==="all"||m!==null&&m<=f}class s extends n{constructor(u,c,f){if(super(),this.object=u,this.index=f?c:null,this.value=f||c,!Mr(u)&&!$i(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Mr(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Xi(this.index))throw new TypeError('IndexNode expected as "index"');if(!Gt(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 Hg}get isAssignmentNode(){return!0}_compile(u,c){var f=this.object._compile(u,c),m=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),d=this.object.name;if(this.index)if(this.index.isObjectProperty()){var h=this.index.getObjectProperty();return function(A,w,x){var E=f(A,w,x),T=p(A,w,x);return Bo(E,h,T),T}}else{if(Mr(this.object))return function(A,w,x){var E=f(A,w,x),T=p(A,w,x),_=m(A,w,E);return A.set(d,a(E,_,T)),T};var b=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var y=this.object.index.getObjectProperty();return function(A,w,x){var E=b(A,w,x),T=jr(E,y),_=m(A,w,T),C=p(A,w,x);return Bo(E,y,a(T,_,C)),C}}else{var D=this.object.index._compile(u,c);return function(A,w,x){var E=b(A,w,x),T=D(A,w,E),_=i(E,T),C=m(A,w,_),N=p(A,w,x);return a(E,T,a(_,C,N)),N}}}else{if(!Mr(this.object))throw new TypeError("SymbolNode expected as object");return function(A,w,x){var E=p(A,w,x);return A.set(d,E),E}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),f=this.index?this._ifNode(u(this.index,"index",this)):null,m=this._ifNode(u(this.value,"value",this));return new s(c,f,m)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),f=this.index?this.index.toString(u):"",m=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m="("+m+")"),c+f+" = "+m}toJSON(){return{mathjs:Hg,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}_toHTML(u){var c=this.object.toHTML(u),f=this.index?this.index.toHTML(u):"",m=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m='<span class="math-paranthesis math-round-parenthesis">(</span>'+m+'<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>'+m}_toTex(u){var c=this.object.toTex(u),f=this.index?this.index.toTex(u):"",m=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m="\\left(".concat(m,"\\right)")),c+f+"="+m}}return dr(s,"name",Hg),s},{isClass:!0,isNode:!0});var Gg="BlockNode",NJ=["ResultSet","Node"],LI=M(Gg,NJ,t=>{var{ResultSet:e,Node:r}=t;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!Gt(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return Gg}get isBlockNode(){return!0}_compile(a,o){var s=Wa(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,f){var m=[];return Jh(s,function(d){var h=d.evaluate(u,c,f);d.visible&&m.push(h)}),new e(m)}}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=[],s=0;s<this.blocks.length;s++){var l=this.blocks[s],u=this._ifNode(a(l.node,"blocks["+s+"].node",this));o[s]={node:u,visible:l.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:Gg,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 dr(n,"name",Gg),n},{isClass:!0,isNode:!0});var Wg="ConditionalNode",FJ=["Node"],VI=M(Wg,FJ,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ot(i))return!i.isZero();if(Hn(i))return!!(i.re||i.im);if(En(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+ir(i)+'"')}class n extends e{constructor(a,o,s){if(super(),!Gt(a))throw new TypeError("Parameter condition must be a Node");if(!Gt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!Gt(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return Wg}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,m,p){return r(s(f,m,p))?l(f,m,p):u(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.condition.toString(a),u=xr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=xr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var m=this.falseExpr.toString(a),p=xr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m="("+m+")"),l+" ? "+c+" : "+m}toJSON(){return{mathjs:Wg,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=xr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=xr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=xr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return dr(n,"name",Wg),n},{isClass:!0,isNode:!0});var HI=Tr(qI(),1);var j0={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{?}"},vr={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"},Z0={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(vr.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(vr.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(vr.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(vr.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(vr.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},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(vr.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(vr.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(vr.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(vr.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(vr.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(vr.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(vr.bitAnd,"${args[1]}\\right)")},bitNot:{1:vr.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(vr.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(vr.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(vr.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(vr.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(vr.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(vr.and,"${args[1]}\\right)")},not:{1:vr.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(vr.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(vr.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(vr.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(vr.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(vr.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(vr.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(vr.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(vr.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(vr.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(vr.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(vr.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(vr.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(vr.to,"${args[1]}\\right)")},numeric:function(e,r){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)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(j0.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)"}},GI="\\mathrm{${name}}\\left(${args}\\right)",zI={deg:"^\\circ"};function Yg(t){return(0,HI.default)(t,{preserveFormatting:!0})}function jg(t,e){return e=typeof e>"u"?!1:e,e?Ze(zI,t)?zI[t]:"\\mathrm{"+Yg(t)+"}":Ze(j0,t)?j0[t]:Yg(t)}var Zg="ConstantNode",PJ=["Node"],WI=M(Zg,PJ,t=>{var{Node:e}=t;class r extends e{constructor(i){super(),this.value=i}get type(){return Zg}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 r(this.value)}_toString(i){return Dt(this.value,i)}_toHTML(i){var a=this._toString(i);switch(ir(this.value)){case"number":case"bigint":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:Zg,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i),o=ir(this.value);switch(o){case"string":return"\\mathtt{"+Yg(a)+"}";case"number":case"BigNumber":{var s=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!s)return this.value.valueOf()<0?"-\\infty":"\\infty";var l=a.toLowerCase().indexOf("e");return l!==-1?a.substring(0,l)+"\\cdot10^{"+a.substring(l+1)+"}":a}case"bigint":return a.toString();case"Fraction":return this.value.toLatex();default:return a}}}return dr(r,"name",Zg),r},{isClass:!0,isNode:!0});var Jg="FunctionAssignmentNode",$J=["typed","Node"],YI=M(Jg,$J,t=>{var{typed:e,Node:r}=t;function n(a,o,s){var l=xr(a,o,s),u=xr(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Gt(l))throw new TypeError('Node expected for parameter "expr"');if(Rg.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var f=typeof c=="string"?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}this.name=o,this.params=s.map(function(m){return m&&m.name||m}),this.types=s.map(function(m){return m&&m.type||"any"}),this.expr=l}get type(){return Jg}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);Jh(this.params,function(d){l[d]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,m=zx(this.types,","),p=c+"("+zx(this.params,", ")+")";return function(h,b,y){var D={};D[m]=function(){for(var A=Object.create(b),w=0;w<f.length;w++)A[f[w]]=arguments[w];return u(h,A,y)};var v=e(c,D);return v.syntax=p,h.set(c,v),v}}forEach(o){o(this.expr,"expr",this)}map(o){var s=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),s)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toString(o);return n(this,s,o&&o.implicit)&&(l="("+l+")"),this.name+"("+this.params.join(", ")+") = "+l}toJSON(){var o=this.types;return{mathjs:Jg,name:this.name,params:this.params.map(function(s,l){return{name:s,type:o[l]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var s=o&&o.parenthesis?o.parenthesis:"keep",l=[],u=0;u<this.params.length;u++)l.push('<span class="math-symbol math-parameter">'+jn(this.params[u])+"</span>");var c=this.expr.toHTML(o);return n(this,s,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">'+jn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+l.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 s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(jg).join(",")+"\\right)="+l}}return dr(i,"name",Jg),i},{isClass:!0,isNode:!0});var Xg="IndexNode",OJ=["Node","size"],jI=M(Xg,OJ,t=>{var{Node:e,size:r}=t;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(Gt))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 Xg}get isIndexNode(){return!0}_compile(a,o){var s=Wa(this.dimensions,function(u,c){var f=u.filter(d=>d.isSymbolNode&&d.name==="end").length>0;if(f){var m=Object.create(o);m.end=!0;var p=u._compile(a,m);return function(h,b,y){if(!Ye(y)&&!sr(y)&&!Jr(y))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+ir(y));var D=r(y).valueOf(),v=Object.create(b);return v.end=D[c],p(h,v,y)}}else return u._compile(a,o)}),l=jr(a,"index");return function(c,f,m){var p=Wa(s,function(d){return d(c,f,m)});return l(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this._ifNode(a(this.dimensions[s],"dimensions["+s+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&kt(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:Xg,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this.dimensions[s].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+jn(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(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return dr(n,"name",Xg),n},{isClass:!0,isNode:!0});var Qg="ObjectNode",RJ=["Node"],ZI=M(Qg,RJ,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return Gt(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Qg}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(Ze(this.properties,s)){var l=Qu(s),u=JSON.parse(l),c=jr(this.properties,s);o[u]=c._compile(i,a)}return function(m,p,d){var h={};for(var b in o)Ze(o,b)&&(h[b]=o[b](m,p,d));return h}}forEach(i){for(var a in this.properties)Ze(this.properties,a)&&i(this.properties[a],"properties["+Qu(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["+Qu(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)Ze(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push(Qu(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Qg,properties:this.properties}}static fromJSON(i){return new r(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push('<span class="math-symbol math-property">'+jn(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 s="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return s}}return dr(r,"name",Qg),r},{isClass:!0,isNode:!0});function al(t,e){return new pc(t,new Ks(e),new Set(Object.keys(e)))}var Kg="OperatorNode",LJ=["Node"],JI=M(Kg,LJ,t=>{var{Node:e}=t;function r(a,o){var s=a;if(o==="auto")for(;Wn(s);)s=s.content;return kt(s)?!0:Rr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=xr(a,o,s),f=Pc(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(C){switch(C.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(l.length){case 0:m=[];break;case 1:{var p=xr(l[0],o,s,a);if(u&&p!==null){var d,h;if(o==="keep"?(d=l[0].getIdentifier(),h=a.getIdentifier()):(d=l[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),Xa[c][h].latexLeftParens===!1){m=[!1];break}if(Xa[p][d].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=c){m=[!0];break}m=[!1]}break;case 2:{var b,y=xr(l[0],o,s,a),D=zg(a,l[0],o);y===null?b=!1:y===c&&f==="right"&&!D||y<c?b=!0:b=!1;var v,A=xr(l[1],o,s,a),w=zg(a,l[1],o);if(A===null?v=!1:A===c&&f==="left"&&!w||A<c?v=!0:v=!1,u){var x,E,T;o==="keep"?(x=a.getIdentifier(),E=a.args[0].getIdentifier(),T=a.args[1].getIdentifier()):(x=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),T=a.args[1].getContent().getIdentifier()),y!==null&&(Xa[c][x].latexLeftParens===!1&&(b=!1),Xa[y][E].latexParens===!1&&(b=!1)),A!==null&&(Xa[c][x].latexRightParens===!1&&(v=!1),Xa[A][T].latexParens===!1&&(v=!1))}m=[b,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=l.map(function(C){var N=xr(C,o,s,a),I=zg(a,C,o),R=Pc(C,o);return N===null?!1:c===N&&f===R&&!I?!0:N<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<m.length;++_)r(l[_],o)&&!m[_-1]&&(o!=="keep"||!Wn(l[_-1]))&&(m[_]=!0);return m}class i extends e{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(Gt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Kg}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!yh(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=jr(o,this.fn),u=Wa(this.args,function(d){return d._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(h,b,y){return l(c,o,al(h,b))}}else if(u.length===1){var f=u[0];return function(h,b,y){return l(f(h,b,y))}}else if(u.length===2){var m=u[0],p=u[1];return function(h,b,y){return l(m(h,b,y),p(h,b,y))}}else return function(h,b,y){return l.apply(null,Wa(u,function(D){return D(h,b,y)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Pc(this,s),m=u[0].toString(o);c[0]&&(m="("+m+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+m:f==="left"?m+(p?" ":"")+this.op:m+this.op}else if(u.length===2){var d=u[0].toString(o),h=u[1].toString(o);return c[0]&&(d="("+d+")"),c[1]&&(h="("+h+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?d+" "+h:d+" "+this.op+" "+h}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var b=u.map(function(y,D){return y=y.toString(o),c[D]&&(y="("+y+")"),y});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?b.join(" "):b.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Kg,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 s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Pc(this,s),m=u[0].toHTML(o);return c[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+jn(this.op)+"</span>"+m:m+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+jn(this.op)+"</span>"}else if(u.length===2){var p=u[0].toHTML(o),d=u[1].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+d:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(this.op)+"</span>"+d}else{var h=u.map(function(b,y){return b=b.toHTML(o),c[y]&&(b='<span class="math-parenthesis math-round-parenthesis">(</span>'+b+'<span class="math-parenthesis math-round-parenthesis">)</span>'),b});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?h.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):h.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(this.op)+"</span>"):'<span class="math-function">'+jn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+h.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),f=vr[this.fn];if(f=typeof f>"u"?this.op:f,u.length===1){var m=Pc(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),m==="right"?f+p:p+f}else if(u.length===2){var d=u[0],h=d.toTex(o);c[0]&&(h="\\left(".concat(h,"\\right)"));var b=u[1],y=b.toTex(o);c[1]&&(y="\\left(".concat(y,"\\right)"));var D;switch(s==="keep"?D=d.getIdentifier():D=d.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+h+"}{"+y+"}";case"OperatorNode:pow":switch(h="{"+h+"}",y="{"+y+"}",D){case"ConditionalNode":case"OperatorNode:divide":h="\\left(".concat(h,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return h+"~"+y}return h+f+y}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=u.map(function(A,w){return A=A.toTex(o),c[w]&&(A="\\left(".concat(A,"\\right)")),A});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(A){return A.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return dr(i,"name",Kg),i},{isClass:!0,isNode:!0});var ev="ParenthesisNode",VJ=["Node"],XI=M(ev,VJ,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),!Gt(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return ev}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 r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:ev,content:this.content}}static fromJSON(i){return new r(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 dr(r,"name",ev),r},{isClass:!0,isNode:!0});var tv="RangeNode",UJ=["Node"],QI=M(tv,UJ,t=>{var{Node:e}=t;function r(i,a,o){var s=xr(i,a,o),l={},u=xr(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=xr(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var f=xr(i.end,a,o);return l.end=f!==null&&f<=s||a==="all",l}class n extends e{constructor(a,o,s){if(super(),!Gt(a))throw new TypeError("Node expected");if(!Gt(o))throw new TypeError("Node expected");if(s&&!Gt(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return tv}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Mr(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(m,p,d){return s(l(m,p,d),u(m,p,d),c(m,p,d))}}else return function(m,p,d){return s(l(m,p,d),u(m,p,d))}}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",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var f=this.end.toString(a);return s.end&&(f="("+f+")"),l+=":"+f,l}toJSON(){return{mathjs:tv,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",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return s.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+f,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return dr(n,"name",tv),n},{isClass:!0,isNode:!0});var rv="RelationalNode",qJ=["Node"],KI=M(rv,qJ,t=>{var{Node:e}=t,r={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 rv}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,f,m){for(var p,d=l[0](c,f,m),h=0;h<s.conditionals.length;h++){p=d,d=l[h+1](c,f,m);var b=jr(a,s.conditionals[h]);if(!b(p,d))return!1}return!0}}forEach(a){this.params.forEach((o,s)=>a(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=xr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+f.toString(a)+")":f.toString(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=" "+r[this.conditionals[c]],u+=" "+l[c+1];return u}toJSON(){return{mathjs:rv,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",s=xr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=xr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=xr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=vr[this.conditionals[c]]+l[c+1];return u}}return dr(n,"name",rv),n},{isClass:!0,isNode:!0});var zJ="SymbolNode",HJ=["math","?Unit","Node"],e2=M(zJ,HJ,t=>{var{math:e,Unit:r,Node:n}=t;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(f,m,p){return jr(m,u)};if(u in s)return function(f,m,p){return f.has(u)?f.get(u):jr(s,u)};var c=i(u);return function(f,m,p){return f.has(u)?f.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}_toHTML(s){var l=jn(this.name);return l==="true"||l==="false"?'<span class="math-symbol math-boolean">'+l+"</span>":l==="i"?'<span class="math-symbol math-imaginary-symbol">'+l+"</span>":l==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+l+"</span>":l==="NaN"?'<span class="math-symbol math-nan-symbol">'+l+"</span>":l==="null"?'<span class="math-symbol math-null-symbol">'+l+"</span>":l==="undefined"?'<span class="math-symbol math-undefined-symbol">'+l+"</span>":'<span class="math-symbol">'+l+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof e[this.name]>"u"&&i(this.name)&&(l=!0);var u=jg(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var nv="FunctionNode",GJ=["math","Node","SymbolNode"],t2=M(nv,GJ,t=>{var e,{math:r,Node:n,SymbolNode:i}=t,a=l=>Dt(l,{truncate:78});function o(l,u,c){for(var f="",m=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,p=0,d;(d=m.exec(l))!==null;)if(f+=l.substring(p,d.index),p=d.index,d[0]==="$$")f+="$",p++;else{p+=d[0].length;var h=u[d[1]];if(!h)throw new ReferenceError("Template: Property "+d[1]+" does not exist.");if(d[2]===void 0)switch(typeof h){case"string":f+=h;break;case"object":if(Gt(h))f+=h.toTex(c);else if(Array.isArray(h))f+=h.map(function(b,y){if(Gt(b))return b.toTex(c);throw new TypeError("Template: "+d[1]+"["+y+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes")}else if(Gt(h[d[2]]&&h[d[2]]))f+=h[d[2]].toTex(c);else throw new TypeError("Template: "+d[1]+"["+d[2]+"] is not a Node.")}return f+=l.slice(p),f}class s extends n{constructor(u,c){if(super(),typeof u=="string"&&(u=new i(u)),!Gt(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(Gt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=c||[]}get name(){return this.fn.name||""}get type(){return nv}get isFunctionNode(){return!0}_compile(u,c){var f=this.args.map(T=>T._compile(u,c));if(Mr(this.fn)){var m=this.fn.name;if(c[m]){var y=this.args;return function(_,C,N){var I=jr(C,m);if(typeof I!="function")throw new TypeError("Argument '".concat(m,"' was not a function; received: ").concat(a(I)));if(I.rawArgs)return I(y,u,al(_,C));var R=f.map(L=>L(_,C,N));return I.apply(I,R)}}else{var p=m in u?jr(u,m):void 0,d=typeof p=="function"&&p.rawArgs===!0,h=T=>{var _;if(T.has(m))_=T.get(m);else if(m in u)_=jr(u,m);else return s.onUndefinedFunction(m);if(typeof _=="function")return _;throw new TypeError("'".concat(m,`' is not a function; its value is:
`).concat(a(_)))};if(d){var b=this.args;return function(_,C,N){var I=h(_);if(I.rawArgs===!0)return I(b,u,al(_,C));var R=f.map(L=>L(_,C,N));return I(...R)}}else switch(f.length){case 0:return function(_,C,N){var I=h(_);return I()};case 1:return function(_,C,N){var I=h(_),R=f[0];return I(R(_,C,N))};case 2:return function(_,C,N){var I=h(_),R=f[0],L=f[1];return I(R(_,C,N),L(_,C,N))};default:return function(_,C,N){var I=h(_),R=f.map(L=>L(_,C,N));return I(...R)}}}}else if($i(this.fn)&&Xi(this.fn.index)&&this.fn.index.isObjectProperty()){var D=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),A=this.args;return function(_,C,N){var I=D(_,C,N),R=cS(I,v);if(R!=null&&R.rawArgs)return R(A,u,al(_,C));var L=f.map(V=>V(_,C,N));return R.apply(I,L)}}else{var w=this.fn.toString(),x=this.fn._compile(u,c),E=this.args;return function(_,C,N){var I=x(_,C,N);if(typeof I!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
`.concat(a(I)));if(I.rawArgs)return I(E,u,al(_,C));var R=f.map(L=>L(_,C,N));return I.apply(I,R)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)u(this.args[c],"args["+c+"]",this)}map(u){for(var c=this._ifNode(u(this.fn,"fn",this)),f=[],m=0;m<this.args.length;m++)f[m]=this._ifNode(u(this.args[m],"args["+m+"]",this));return new s(c,f)}clone(){return new s(this.fn,this.args.slice(0))}toString(u){var c,f=this.fn.toString(u);return u&&typeof u.handler=="object"&&Ze(u.handler,f)&&(c=u.handler[f](this,u)),typeof c<"u"?c:super.toString(u)}_toString(u){var c=this.args.map(function(m){return m.toString(u)}),f=za(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:nv,fn:this.fn,args:this.args}}_toHTML(u){var c=this.args.map(function(f){return f.toHTML(u)});return'<span class="math-function">'+jn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var c;return u&&typeof u.handler=="object"&&Ze(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;Z0[this.name]&&(f=Z0[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var m;switch(typeof f){case"function":m=f(this,u);break;case"string":m=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":m=f[c.length](this,u);break;case"string":m=o(f[c.length],this,u);break}}return typeof m<"u"?m:o(GI,this,u)}getIdentifier(){return this.type+":"+this.name}}return e=s,dr(s,"name",nv),dr(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),dr(s,"fromJSON",function(l){return new e(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var r2="parse",WJ=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],n2=M(r2,WJ,t=>{var{typed:e,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:d,ParenthesisNode:h,RangeNode:b,RelationalNode:y,SymbolNode:D}=t,v=e(r2,{string:function(Y){return ne(Y,{})},"Array | Matrix":function(Y){return A(Y,{})},"string, Object":function(Y,ie){var Me=ie.nodes!==void 0?ie.nodes:{};return ne(Y,Me)},"Array | Matrix, Object":A});function A(F){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=Y.nodes!==void 0?Y.nodes:{};return Ke(F,function(Me){if(typeof Me!="string")throw new TypeError("String expected");return ne(Me,ie)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},x={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},T={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],C={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function I(F,Y){return F.expression.substr(F.index,Y)}function R(F){return I(F,1)}function L(F){F.index++}function V(F){return F.expression.charAt(F.index-1)}function P(F){return F.expression.charAt(F.index+1)}function k(F){for(F.tokenType=w.NULL,F.token="",F.comment="";;){if(R(F)==="#")for(;R(F)!==`
`&&R(F)!=="";)F.comment+=R(F),L(F);if(v.isWhitespace(R(F),F.nestingLevel))L(F);else break}if(R(F)===""){F.tokenType=w.DELIMITER;return}if(R(F)===`
`&&!F.nestingLevel){F.tokenType=w.DELIMITER,F.token=R(F),L(F);return}var Y=R(F),ie=I(F,2),Me=I(F,3);if(Me.length===3&&x[Me]){F.tokenType=w.DELIMITER,F.token=Me,L(F),L(F),L(F);return}if(ie.length===2&&x[ie]){F.tokenType=w.DELIMITER,F.token=ie,L(F),L(F);return}if(x[Y]){F.tokenType=w.DELIMITER,F.token=Y,L(F);return}if(v.isDigitDot(Y)){F.tokenType=w.NUMBER;var Qe=I(F,2);if(Qe==="0b"||Qe==="0o"||Qe==="0x"){for(F.token+=R(F),L(F),F.token+=R(F),L(F);v.isHexDigit(R(F));)F.token+=R(F),L(F);if(R(F)===".")for(F.token+=".",L(F);v.isHexDigit(R(F));)F.token+=R(F),L(F);else if(R(F)==="i")for(F.token+="i",L(F);v.isDigit(R(F));)F.token+=R(F),L(F);return}if(R(F)==="."){if(F.token+=R(F),L(F),!v.isDigit(R(F))){F.tokenType=w.DELIMITER;return}}else{for(;v.isDigit(R(F));)F.token+=R(F),L(F);v.isDecimalMark(R(F),P(F))&&(F.token+=R(F),L(F))}for(;v.isDigit(R(F));)F.token+=R(F),L(F);if(R(F)==="E"||R(F)==="e"){if(v.isDigit(P(F))||P(F)==="-"||P(F)==="+"){if(F.token+=R(F),L(F),(R(F)==="+"||R(F)==="-")&&(F.token+=R(F),L(F)),!v.isDigit(R(F)))throw _e(F,'Digit expected, got "'+R(F)+'"');for(;v.isDigit(R(F));)F.token+=R(F),L(F);if(v.isDecimalMark(R(F),P(F)))throw _e(F,'Digit expected, got "'+R(F)+'"')}else if(v.isDecimalMark(P(F),F.expression.charAt(F.index+2)))throw L(F),_e(F,'Digit expected, got "'+R(F)+'"')}return}if(v.isAlpha(R(F),V(F),P(F))){for(;v.isAlpha(R(F),V(F),P(F))||v.isDigit(R(F));)F.token+=R(F),L(F);Ze(E,F.token)?F.tokenType=w.DELIMITER:F.tokenType=w.SYMBOL;return}for(F.tokenType=w.UNKNOWN;R(F)!=="";)F.token+=R(F),L(F);throw _e(F,'Syntax error in part "'+F.token+'"')}function W(F){do k(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function Q(F){F.nestingLevel--}v.isAlpha=function(Y,ie,Me){return v.isValidLatinOrGreek(Y)||v.isValidMathSymbol(Y,Me)||v.isValidMathSymbol(ie,Y)},v.isValidLatinOrGreek=function(Y){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y)},v.isValidMathSymbol=function(Y,ie){return/^[\uD835]$/.test(Y)&&/^[\uDC00-\uDFFF]$/.test(ie)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(ie)},v.isWhitespace=function(Y,ie){return Y===" "||Y===" "||Y===`
`&&ie>0},v.isDecimalMark=function(Y,ie){return Y==="."&&ie!=="/"&&ie!=="*"&&ie!=="^"},v.isDigitDot=function(Y){return Y>="0"&&Y<="9"||Y==="."},v.isDigit=function(Y){return Y>="0"&&Y<="9"},v.isHexDigit=function(Y){return Y>="0"&&Y<="9"||Y>="a"&&Y<="f"||Y>="A"&&Y<="F"};function ne(F,Y){var ie=N();bn(ie,{expression:F,extraNodes:Y}),k(ie);var Me=X(ie);if(ie.token!=="")throw ie.tokenType===w.DELIMITER?Ge(ie,"Unexpected operator "+ie.token):_e(ie,'Unexpected part "'+ie.token+'"');return Me}function X(F){var Y,ie=[],Me;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(Y=U(F),F.comment&&(Y.comment=F.comment));F.token===`
`||F.token===";";)ie.length===0&&Y&&(Me=F.token!==";",ie.push({node:Y,visible:Me})),k(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(Y=U(F),F.comment&&(Y.comment=F.comment),Me=F.token!==";",ie.push({node:Y,visible:Me}));return ie.length>0?new s(ie):(Y||(Y=new u(void 0),F.comment&&(Y.comment=F.comment)),Y)}function U(F){var Y,ie,Me,Qe,gt=fe(F);if(F.token==="="){if(Mr(gt))return Y=gt.name,W(F),Me=U(F),new o(new D(Y),Me);if($i(gt))return W(F),Me=U(F),new o(gt.object,gt.index,Me);if(ai(gt)&&Mr(gt.fn)&&(Qe=!0,ie=[],Y=gt.name,gt.args.forEach(function(hr,Ve){Mr(hr)?ie[Ve]=hr.name:Qe=!1}),Qe))return W(F),Me=U(F),new c(Y,ie,Me);throw _e(F,"Invalid left hand side of assignment operator =")}return gt}function fe(F){for(var Y=xe(F);F.token==="?";){var ie=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Me=Y,Qe=U(F);if(F.token!==":")throw _e(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var gt=U(F);Y=new l(Me,Qe,gt),F.conditionalLevel=ie}return Y}function xe(F){for(var Y=oe(F);F.token==="or";)W(F),Y=new d("or","or",[Y,oe(F)]);return Y}function oe(F){for(var Y=be(F);F.token==="xor";)W(F),Y=new d("xor","xor",[Y,be(F)]);return Y}function be(F){for(var Y=ee(F);F.token==="and";)W(F),Y=new d("and","and",[Y,ee(F)]);return Y}function ee(F){for(var Y=Z(F);F.token==="|";)W(F),Y=new d("|","bitOr",[Y,Z(F)]);return Y}function Z(F){for(var Y=re(F);F.token==="^|";)W(F),Y=new d("^|","bitXor",[Y,re(F)]);return Y}function re(F){for(var Y=me(F);F.token==="&";)W(F),Y=new d("&","bitAnd",[Y,me(F)]);return Y}function me(F){for(var Y=[ce(F)],ie=[],Me={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ze(Me,F.token);){var Qe={name:F.token,fn:Me[F.token]};ie.push(Qe),W(F),Y.push(ce(F))}return Y.length===1?Y[0]:Y.length===2?new d(ie[0].name,ie[0].fn,Y):new y(ie.map(gt=>gt.fn),Y)}function ce(F){var Y,ie,Me,Qe;Y=Ae(F);for(var gt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ze(gt,F.token);)ie=F.token,Me=gt[ie],W(F),Qe=[Y,Ae(F)],Y=new d(ie,Me,Qe);return Y}function Ae(F){var Y,ie,Me,Qe;Y=we(F);for(var gt={to:"to",in:"to"};Ze(gt,F.token);)ie=F.token,Me=gt[ie],W(F),ie==="in"&&F.token===""?Y=new d("*","multiply",[Y,new D("in")],!0):(Qe=[Y,we(F)],Y=new d(ie,Me,Qe));return Y}function we(F){var Y,ie=[];if(F.token===":"?Y=new u(1):Y=G(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ie.push(Y);F.token===":"&&ie.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ie.push(new D("end")):ie.push(G(F));ie.length===3?Y=new b(ie[0],ie[2],ie[1]):Y=new b(ie[0],ie[1])}return Y}function G(F){var Y,ie,Me,Qe;Y=J(F);for(var gt={"+":"add","-":"subtract"};Ze(gt,F.token);){ie=F.token,Me=gt[ie],W(F);var hr=J(F);hr.isPercentage?Qe=[Y,new d("*","multiply",[Y,hr])]:Qe=[Y,hr],Y=new d(ie,Me,Qe)}return Y}function J(F){var Y,ie,Me,Qe;Y=ge(F),ie=Y;for(var gt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};Ze(gt,F.token);)if(Me=F.token,Qe=gt[Me],W(F),Me==="%"&&F.tokenType===w.DELIMITER&&F.token!=="(")if(F.token!==""&&gt[F.token]){var hr=new d("/","divide",[Y,new u(100)],!1,!0);Me=F.token,Qe=gt[Me],W(F),ie=ge(F),Y=new d(Me,Qe,[hr,ie])}else Y=new d("/","divide",[Y,new u(100)],!1,!0);else ie=ge(F),Y=new d(Me,Qe,[Y,ie]);return Y}function ge(F){var Y,ie;for(Y=ye(F),ie=Y;F.tokenType===w.SYMBOL||F.token==="in"&&kt(Y)||F.token==="in"&&Rr(Y)&&Y.fn==="unaryMinus"&&kt(Y.args[0])||F.tokenType===w.NUMBER&&!kt(ie)&&(!Rr(ie)||ie.op==="!")||F.token==="(";)ie=ye(F),Y=new d("*","multiply",[Y,ie],!0);return Y}function ye(F){for(var Y=De(F),ie=Y,Me=[];F.token==="/"&&Gf(ie);)if(Me.push(bn({},F)),W(F),F.tokenType===w.NUMBER)if(Me.push(bn({},F)),W(F),F.tokenType===w.SYMBOL||F.token==="("||F.token==="in")bn(F,Me.pop()),Me.pop(),ie=De(F),Y=new d("/","divide",[Y,ie]);else{Me.pop(),bn(F,Me.pop());break}else{bn(F,Me.pop());break}return Y}function De(F){var Y,ie,Me,Qe={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ze(Qe,F.token)?(Me=Qe[F.token],Y=F.token,W(F),ie=[De(F)],new d(Y,Me,ie)):Ie(F)}function Ie(F){var Y,ie,Me,Qe;return Y=Oe(F),(F.token==="^"||F.token===".^")&&(ie=F.token,Me=ie==="^"?"pow":"dotPow",W(F),Qe=[Y,De(F)],Y=new d(ie,Me,Qe)),Y}function Oe(F){var Y,ie,Me,Qe;Y=Je(F);for(var gt={"!":"factorial","'":"ctranspose"};Ze(gt,F.token);)ie=F.token,Me=gt[ie],k(F),Qe=[Y],Y=new d(ie,Me,Qe),Y=qe(F,Y);return Y}function Je(F){var Y=[];if(F.tokenType===w.SYMBOL&&Ze(F.extraNodes,F.token)){var ie=F.extraNodes[F.token];if(k(F),F.token==="("){if(Y=[],O(F),k(F),F.token!==")")for(Y.push(U(F));F.token===",";)k(F),Y.push(U(F));if(F.token!==")")throw _e(F,"Parenthesis ) expected");Q(F),k(F)}return new ie(Y)}return wt(F)}function wt(F){var Y,ie;return F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E?(ie=F.token,k(F),Ze(T,ie)?Y=new u(T[ie]):_.includes(ie)?Y=new u(r(ie,"number")):Y=new D(ie),Y=qe(F,Y),Y):rr(F)}function qe(F,Y,ie){for(var Me;(F.token==="("||F.token==="["||F.token===".")&&(!ie||ie.includes(F.token));)if(Me=[],F.token==="(")if(Mr(Y)||$i(Y)){if(O(F),k(F),F.token!==")")for(Me.push(U(F));F.token===",";)k(F),Me.push(U(F));if(F.token!==")")throw _e(F,"Parenthesis ) expected");Q(F),k(F),Y=new f(Y,Me)}else return Y;else if(F.token==="["){if(O(F),k(F),F.token!=="]")for(Me.push(U(F));F.token===",";)k(F),Me.push(U(F));if(F.token!=="]")throw _e(F,"Parenthesis ] expected");Q(F),k(F),Y=new i(Y,new m(Me))}else{k(F);var Qe=F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E;if(!Qe)throw _e(F,"Property name expected after dot");Me.push(new u(F.token)),k(F);var gt=!0;Y=new i(Y,new m(Me,gt))}return Y}function rr(F){var Y,ie;return F.token==='"'||F.token==="'"?(ie=Wt(F,F.token),Y=new u(ie),Y=qe(F,Y),Y):pr(F)}function Wt(F,Y){for(var ie="";R(F)!==""&&R(F)!==Y;)if(R(F)==="\\"){L(F);var Me=R(F),Qe=C[Me];if(Qe!==void 0)ie+=Qe,F.index+=1;else if(Me==="u"){var gt=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(gt))ie+=String.fromCharCode(parseInt(gt,16)),F.index+=5;else throw _e(F,"Invalid unicode character \\u".concat(gt))}else throw _e(F,"Bad escape character \\".concat(Me))}else ie+=R(F),L(F);if(k(F),F.token!==Y)throw _e(F,"End of string ".concat(Y," expected"));return k(F),ie}function pr(F){var Y,ie,Me,Qe;if(F.token==="["){if(O(F),k(F),F.token!=="]"){var gt=Pe(F);if(F.token===";"){for(Me=1,ie=[gt];F.token===";";)k(F),F.token!=="]"&&(ie[Me]=Pe(F),Me++);if(F.token!=="]")throw _e(F,"End of matrix ] expected");Q(F),k(F),Qe=ie[0].items.length;for(var hr=1;hr<Me;hr++)if(ie[hr].items.length!==Qe)throw Ge(F,"Column dimensions mismatch ("+ie[hr].items.length+" !== "+Qe+")");Y=new a(ie)}else{if(F.token!=="]")throw _e(F,"End of matrix ] expected");Q(F),k(F),Y=gt}}else Q(F),k(F),Y=new a([]);return qe(F,Y)}return j(F)}function Pe(F){for(var Y=[U(F)],ie=1;F.token===",";)k(F),F.token!=="]"&&F.token!==";"&&(Y[ie]=U(F),ie++);return new a(Y)}function j(F){if(F.token==="{"){O(F);var Y,ie={};do if(k(F),F.token!=="}"){if(F.token==='"'||F.token==="'")Y=Wt(F,F.token);else if(F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E)Y=F.token,k(F);else throw _e(F,"Symbol or string expected as object key");if(F.token!==":")throw _e(F,"Colon : expected after object key");k(F),ie[Y]=U(F)}while(F.token===",");if(F.token!=="}")throw _e(F,"Comma , or bracket } expected after object value");Q(F),k(F);var Me=new p(ie);return Me=qe(F,Me),Me}return de(F)}function de(F){var Y;if(F.tokenType===w.NUMBER){Y=F.token,k(F);var ie=xi(Y,n),Me=r(Y,ie);return new u(Me)}return pe(F)}function pe(F){var Y;if(F.token==="("){if(O(F),k(F),Y=U(F),F.token!==")")throw _e(F,"Parenthesis ) expected");return Q(F),k(F),Y=new h(Y),Y=qe(F,Y),Y}return Ne(F)}function Ne(F){throw F.token===""?_e(F,"Unexpected end of expression"):_e(F,"Value expected")}function Be(F){return F.index-F.token.length+1}function _e(F,Y){var ie=Be(F),Me=new SyntaxError(Y+" (char "+ie+")");return Me.char=ie,Me}function Ge(F,Y){var ie=Be(F),Me=new SyntaxError(Y+" (char "+ie+")");return Me.char=ie,Me}return e.addConversion({from:"string",to:"Node",convert:v}),v});var i2="compile",YJ=["typed","parse"],a2=M(i2,YJ,t=>{var{typed:e,parse:r}=t;return e(i2,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return Ke(i,function(a){return r(a).compile()})}})});var o2="evaluate",jJ=["typed","parse"],s2=M(o2,jJ,t=>{var{typed:e,parse:r}=t;return e(o2,{string:function(i){var a=eu();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=eu();return Ke(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return Ke(i,function(o){return r(o).compile().evaluate(a)})}})});var ZJ="Parser",JJ=["evaluate","parse"],u2=M(ZJ,JJ,t=>{var{evaluate:e,parse:r}=t;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:eu(),writable:!1})}n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(a){return e(a,this.scope)},n.prototype.get=function(a){if(this.scope.has(a))return this.scope.get(a)},n.prototype.getAll=function(){return pS(this.scope)},n.prototype.getAllAsMap=function(){return this.scope};function i(a){if(a.length===0)return!1;for(var o=0;o<a.length;o++){var s=a.charAt(o-1),l=a.charAt(o),u=a.charAt(o+1),c=r.isAlpha(l,s,u)||o>0&&r.isDigit(l);if(!c)return!1}return!0}return n.prototype.set=function(a,o){if(!i(a))throw new Error("Invalid variable name: '".concat(a,"'. Variable names must follow the specified rules."));return this.scope.set(a,o),o},n.prototype.remove=function(a){this.scope.delete(a)},n.prototype.clear=function(){this.scope.clear()},n},{isClass:!0});var l2="parser",XJ=["typed","Parser"],c2=M(l2,XJ,t=>{var{typed:e,Parser:r}=t;return e(l2,{"":function(){return new r}})});var f2="lup",QJ=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],p2=M(f2,QJ,t=>{var{typed:e,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:f,SparseMatrix:m,Spa:p}=t;return e(f2,{DenseMatrix:function(y){return d(y)},SparseMatrix:function(y){return h(y)},Array:function(y){var D=r(y),v=d(D);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function d(b){var y=b._size[0],D=b._size[1],v=Math.min(y,D),A=ut(b._data),w=[],x=[y,v],E=[],T=[v,D],_,C,N,I=[];for(_=0;_<y;_++)I[_]=_;for(C=0;C<D;C++){if(C>0)for(_=0;_<y;_++){var R=Math.min(_,C),L=0;for(N=0;N<R;N++)L=i(L,o(A[_][N],A[N][C]));A[_][C]=s(A[_][C],L)}var V=C,P=0,k=0;for(_=C;_<y;_++){var W=A[_][C],O=n(W);l(O,P)&&(V=_,P=O,k=W)}if(C!==V&&(I[C]=[I[V],I[V]=I[C]][0],f._swapRows(C,V,A)),C<y)for(_=C+1;_<y;_++){var Q=A[_][C];u(Q,0)||(A[_][C]=a(A[_][C],k))}}for(C=0;C<D;C++)for(_=0;_<y;_++){if(C===0&&(_<D&&(E[_]=[]),w[_]=[]),_<C){_<D&&(E[_][C]=A[_][C]),C<y&&(w[_][C]=0);continue}if(_===C){_<D&&(E[_][C]=A[_][C]),C<y&&(w[_][C]=1);continue}_<D&&(E[_][C]=0),C<y&&(w[_][C]=A[_][C])}var ne=new f({data:w,size:x}),X=new f({data:E,size:T}),U=[];for(_=0,v=I.length;_<v;_++)U[I[_]]=_;return{L:ne,U:X,p:U,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function h(b){var y=b._size[0],D=b._size[1],v=Math.min(y,D),A=b._values,w=b._index,x=b._ptr,E=[],T=[],_=[],C=[y,v],N=[],I=[],R=[],L=[v,D],V,P,k,W=[],O=[];for(V=0;V<y;V++)W[V]=V,O[V]=V;var Q=function(U,fe){var xe=O[U],oe=O[fe];W[xe]=fe,W[oe]=U,O[U]=oe,O[fe]=xe},ne=function(){var U=new p;P<y&&(_.push(E.length),E.push(1),T.push(P)),R.push(N.length);var fe=x[P],xe=x[P+1];for(k=fe;k<xe;k++)V=w[k],U.set(W[V],A[k]);P>0&&U.forEach(0,P-1,function(Z,re){m._forEachRow(Z,E,T,_,function(me,ce){me>Z&&U.accumulate(me,c(o(ce,re)))})});var oe=P,be=U.get(P),ee=n(be);U.forEach(P+1,y-1,function(Z,re){var me=n(re);l(me,ee)&&(oe=Z,ee=me,be=re)}),P!==oe&&(m._swapRows(P,oe,C[1],E,T,_),m._swapRows(P,oe,L[1],N,I,R),U.swap(P,oe),Q(P,oe)),U.forEach(0,y-1,function(Z,re){Z<=P?(N.push(re),I.push(Z)):(re=a(re,be),u(re,0)||(E.push(re),T.push(Z)))})};for(P=0;P<D;P++)ne();return R.push(N.length),_.push(E.length),{L:new m({values:E,index:T,ptr:_,size:C}),U:new m({values:N,index:I,ptr:R,size:L}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var m2="qr",KJ=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],d2=M(m2,KJ,t=>{var{typed:e,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:f,divideScalar:m,multiplyScalar:p,subtractScalar:d,complex:h}=t;return bn(e(m2,{DenseMatrix:function(A){return y(A)},SparseMatrix:function(A){return D(A)},Array:function(A){var w=r(A),x=y(w);return{Q:x.Q.valueOf(),R:x.R.valueOf()}}}),{_denseQRimpl:b});function b(v){var A=v._size[0],w=v._size[1],x=i([A],"dense"),E=x._data,T=v.clone(),_=T._data,C,N,I,R=n([A],"");for(I=0;I<Math.min(w,A);++I){var L=_[I][I],V=c(o(L,0)?1:s(L)),P=u(V),k=0;for(C=I;C<A;C++)k=f(k,p(_[C][I],u(_[C][I])));var W=p(V,l(k));if(!a(W)){var O=d(L,W);for(R[I]=1,C=I+1;C<A;C++)R[C]=m(_[C][I],O);var Q=c(u(m(O,W))),ne=void 0;for(N=I;N<w;N++){for(ne=0,C=I;C<A;C++)ne=f(ne,p(u(R[C]),_[C][N]));for(ne=p(ne,Q),C=I;C<A;C++)_[C][N]=p(d(_[C][N],p(R[C],ne)),P)}for(C=0;C<A;C++){for(ne=0,N=I;N<A;N++)ne=f(ne,p(E[C][N],R[N]));for(ne=p(ne,Q),N=I;N<A;++N)E[C][N]=m(d(E[C][N],p(ne,u(R[N]))),P)}}}return{Q:x,R:T,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function y(v){var A=b(v),w=A.R._data;if(v._data.length>0)for(var x=w[0][0].type==="Complex"?h(0):0,E=0;E<w.length;++E)for(var T=0;T<E&&T<(w[0]||[]).length;++T)w[E][T]=x;return A}function D(v){throw new Error("qr not implemented for sparse matrices yet")}});function h2(t,e,r,n){for(var i=t._values,a=t._index,o=t._ptr,s=t._size,l=t._datatype,u=s[0],c=s[1],f=n&&t._values?[]:null,m=[],p=[],d=0,h=0;h<c;h++){p[h]=d;for(var b=r?r[h]:h,y=o[b],D=o[b+1],v=y;v<D;v++){var A=e?e[a[v]]:a[v];m[d]=A,f&&(f[d]=i[v]),d++}}return p[c]=d,t.createSparseMatrix({values:f,index:m,ptr:p,size:[u,c],datatype:l})}function iv(t,e,r,n,i,a,o){var s=0;for(r[o]=t;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[e++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return e}function g2(t,e){if(!t)return null;var r=0,n,i=[],a=[],o=0,s=e,l=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)t[n]!==-1&&(a[s+n]=a[o+t[n]],a[o+t[n]]=n);for(n=0;n<e;n++)t[n]===-1&&(r=iv(n,r,a,o,s,i,l));return i}function v2(t,e){if(!t)return null;var r=t._index,n=t._ptr,i=t._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,f,m;if(e)for(f=0;f<a;f++)l[c+f]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var d=n[p],h=n[p+1],b=d;b<h;b++){var y=r[b];for(f=e?l[c+y]:y;f!==-1&&f<p;f=m)m=l[u+f],l[u+f]=p,m===-1&&(s[f]=p);e&&(l[c+y]=p)}}return s}function y2(t,e,r){for(var n=t._values,i=t._index,a=t._ptr,o=t._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)e(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function xo(t){return-t-2}var eX="csAmd",tX=["add","multiply","transpose"],b2=M(eX,tX,t=>{var{add:e,multiply:r,transpose:n}=t;return function(c,f){if(!f||c<=0||c>3)return null;var m=f._size,p=m[0],d=m[1],h=0,b=Math.max(16,10*Math.sqrt(d));b=Math.min(d-2,b);var y=i(c,f,p,d,b);y2(y,l,null);for(var D=y._index,v=y._ptr,A=v[d],w=[],x=[],E=0,T=d+1,_=2*(d+1),C=3*(d+1),N=4*(d+1),I=5*(d+1),R=6*(d+1),L=7*(d+1),V=w,P=a(d,v,x,E,C,V,_,L,T,R,N,I),k=o(d,v,x,I,N,R,b,T,C,V,_),W=0,O,Q,ne,X,U,fe,xe,oe,be,ee,Z,re,me,ce,Ae,we;k<d;){for(ne=-1;W<d&&(ne=x[C+W])===-1;W++);x[_+ne]!==-1&&(V[x[_+ne]]=-1),x[C+W]=x[_+ne];var G=x[N+ne],J=x[T+ne];k+=J;var ge=0;x[T+ne]=-J;var ye=v[ne],De=G===0?ye:A,Ie=De;for(X=1;X<=G+1;X++){for(X>G?(fe=ne,xe=ye,oe=x[E+ne]-G):(fe=D[ye++],xe=v[fe],oe=x[E+fe]),U=1;U<=oe;U++)O=D[xe++],!((be=x[T+O])<=0)&&(ge+=be,x[T+O]=-be,D[Ie++]=O,x[_+O]!==-1&&(V[x[_+O]]=V[O]),V[O]!==-1?x[_+V[O]]=x[_+O]:x[C+x[I+O]]=x[_+O]);fe!==ne&&(v[fe]=xo(ne),x[R+fe]=0)}for(G!==0&&(A=Ie),x[I+ne]=ge,v[ne]=De,x[E+ne]=Ie-De,x[N+ne]=-2,P=s(P,h,x,R,d),ee=De;ee<Ie;ee++)if(O=D[ee],!((Z=x[N+O])<=0)){be=-x[T+O];var Oe=P-be;for(ye=v[O],re=v[O]+Z-1;ye<=re;ye++)fe=D[ye],x[R+fe]>=P?x[R+fe]-=be:x[R+fe]!==0&&(x[R+fe]=x[I+fe]+Oe)}for(ee=De;ee<Ie;ee++){for(O=D[ee],re=v[O],me=re+x[N+O]-1,ce=re,Ae=0,we=0,ye=re;ye<=me;ye++)if(fe=D[ye],x[R+fe]!==0){var Je=x[R+fe]-P;Je>0?(we+=Je,D[ce++]=fe,Ae+=fe):(v[fe]=xo(ne),x[R+fe]=0)}x[N+O]=ce-re+1;var wt=ce,qe=re+x[E+O];for(ye=me+1;ye<qe;ye++){Q=D[ye];var rr=x[T+Q];rr<=0||(we+=rr,D[ce++]=Q,Ae+=Q)}we===0?(v[O]=xo(ne),be=-x[T+O],ge-=be,J+=be,k+=be,x[T+O]=0,x[N+O]=-1):(x[I+O]=Math.min(x[I+O],we),D[ce]=D[wt],D[wt]=D[re],D[re]=ne,x[E+O]=ce-re+1,Ae=(Ae<0?-Ae:Ae)%d,x[_+O]=x[L+Ae],x[L+Ae]=O,V[O]=Ae)}for(x[I+ne]=ge,h=Math.max(h,ge),P=s(P+h,h,x,R,d),ee=De;ee<Ie;ee++)if(O=D[ee],!(x[T+O]>=0))for(Ae=V[O],O=x[L+Ae],x[L+Ae]=-1;O!==-1&&x[_+O]!==-1;O=x[_+O],P++){for(oe=x[E+O],Z=x[N+O],ye=v[O]+1;ye<=v[O]+oe-1;ye++)x[R+D[ye]]=P;var Wt=O;for(Q=x[_+O];Q!==-1;){var pr=x[E+Q]===oe&&x[N+Q]===Z;for(ye=v[Q]+1;pr&&ye<=v[Q]+oe-1;ye++)x[R+D[ye]]!==P&&(pr=0);pr?(v[Q]=xo(O),x[T+O]+=x[T+Q],x[T+Q]=0,x[N+Q]=-1,Q=x[_+Q],x[_+Wt]=Q):(Wt=Q,Q=x[_+Q])}}for(ye=De,ee=De;ee<Ie;ee++)O=D[ee],!((be=-x[T+O])<=0)&&(x[T+O]=be,we=x[I+O]+ge-be,we=Math.min(we,d-k-be),x[C+we]!==-1&&(V[x[C+we]]=O),x[_+O]=x[C+we],V[O]=-1,x[C+we]=O,W=Math.min(W,we),x[I+O]=we,D[ye++]=O);x[T+ne]=J,(x[E+ne]=ye-De)===0&&(v[ne]=-1,x[R+ne]=0),G!==0&&(A=ye)}for(O=0;O<d;O++)v[O]=xo(v[O]);for(Q=0;Q<=d;Q++)x[C+Q]=-1;for(Q=d;Q>=0;Q--)x[T+Q]>0||(x[_+Q]=x[C+v[Q]],x[C+v[Q]]=Q);for(fe=d;fe>=0;fe--)x[T+fe]<=0||v[fe]!==-1&&(x[_+fe]=x[C+v[fe]],x[C+v[fe]]=fe);for(ne=0,O=0;O<=d;O++)v[O]===-1&&(ne=iv(O,ne,x,C,_,w,R));return w.splice(w.length-1,1),w};function i(u,c,f,m,p){var d=n(c);if(u===1&&m===f)return e(c,d);if(u===2){for(var h=d._index,b=d._ptr,y=0,D=0;D<f;D++){var v=b[D];if(b[D]=y,!(b[D+1]-v>p))for(var A=b[D+1];v<A;v++)h[y++]=h[v]}return b[f]=y,c=n(d),r(d,c)}return r(d,c)}function a(u,c,f,m,p,d,h,b,y,D,v,A){for(var w=0;w<u;w++)f[m+w]=c[w+1]-c[w];f[m+u]=0;for(var x=0;x<=u;x++)f[p+x]=-1,d[x]=-1,f[h+x]=-1,f[b+x]=-1,f[y+x]=1,f[D+x]=1,f[v+x]=0,f[A+x]=f[m+x];var E=s(0,0,f,D,u);return f[v+u]=-2,c[u]=-1,f[D+u]=0,E}function o(u,c,f,m,p,d,h,b,y,D,v){for(var A=0,w=0;w<u;w++){var x=f[m+w];if(x===0)f[p+w]=-2,A++,c[w]=-1,f[d+w]=0;else if(x>h)f[b+w]=0,f[p+w]=-1,A++,c[w]=xo(u),f[b+u]++;else{var E=f[y+x];E!==-1&&(D[E]=w),f[v+w]=f[y+x],f[y+x]=w}}return A}function s(u,c,f,m,p){if(u<2||u+c<0){for(var d=0;d<p;d++)f[m+d]!==0&&(f[m+d]=1);u=2}return u}function l(u,c){return u!==c}});function x2(t,e,r,n,i,a,o){var s,l,u=0,c;if(t<=e||r[n+e]<=r[i+t])return-1;r[i+t]=r[n+e];var f=r[a+t];if(r[a+t]=e,f===-1)u=1,c=t;else{for(u=2,c=f;c!==r[o+c];c=r[o+c]);for(s=f;s!==c;s=l)l=r[o+s],r[o+s]=c}return{jleaf:u,q:c}}var rX="csCounts",nX=["transpose"],w2=M(rX,nX,t=>{var{transpose:e}=t;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,f,m,p,d,h,b=4*l+(a?l+s+1:0),y=[],D=0,v=l,A=2*l,w=3*l,x=4*l,E=5*l+1;for(f=0;f<b;f++)y[f]=-1;var T=[],_=e(r),C=_._index,N=_._ptr;for(f=0;f<l;f++)for(c=i[f],T[c]=y[w+c]===-1?1:0;c!==-1&&y[w+c]===-1;c=n[c])y[w+c]=f;if(a){for(f=0;f<l;f++)y[i[f]]=f;for(u=0;u<s;u++){for(f=l,d=N[u],h=N[u+1],p=d;p<h;p++)f=Math.min(f,y[C[p]]);y[E+u]=y[x+f],y[x+f]=u}}for(u=0;u<l;u++)y[D+u]=u;for(f=0;f<l;f++){for(c=i[f],n[c]!==-1&&T[n[c]]--,m=a?y[x+f]:c;m!==-1;m=a?y[E+m]:-1)for(p=N[m];p<N[m+1];p++){u=C[p];var I=x2(u,c,y,w,v,A,D);I.jleaf>=1&&T[c]++,I.jleaf===2&&T[I.q]--}n[c]!==-1&&(y[D+c]=n[c])}for(c=0;c<l;c++)n[c]!==-1&&(T[n[c]]+=T[c]);return T}});var iX="csSqr",aX=["add","multiply","transpose"],_2=M(iX,aX,t=>{var{add:e,multiply:r,transpose:n}=t,i=b2({add:e,multiply:r,transpose:n}),a=w2({transpose:n});return function(l,u,c){var f=u._ptr,m=u._size,p=m[1],d,h={};if(h.q=i(l,u),l&&!h.q)return null;if(c){var b=l?h2(u,null,h.q,0):u;h.parent=v2(b,1);var y=g2(h.parent,p);if(h.cp=a(b,h.parent,y,1),b&&h.parent&&h.cp&&o(b,h))for(h.unz=0,d=0;d<p;d++)h.unz+=h.cp[d]}else h.unz=4*f[p]+p,h.lnz=h.unz;return h};function o(s,l){var u=s._ptr,c=s._index,f=s._size,m=f[0],p=f[1];l.pinv=[],l.leftmost=[];var d=l.parent,h=l.pinv,b=l.leftmost,y=[],D=0,v=m,A=m+p,w=m+2*p,x,E,T,_,C;for(E=0;E<p;E++)y[v+E]=-1,y[A+E]=-1,y[w+E]=0;for(x=0;x<m;x++)b[x]=-1;for(E=p-1;E>=0;E--)for(_=u[E],C=u[E+1],T=_;T<C;T++)b[c[T]]=E;for(x=m-1;x>=0;x--)h[x]=-1,E=b[x],E!==-1&&(y[w+E]++===0&&(y[A+E]=x),y[D+x]=y[v+E],y[v+E]=x);for(l.lnz=0,l.m2=m,E=0;E<p;E++)if(x=y[v+E],l.lnz++,x<0&&(x=l.m2++),h[x]=E,!(--w[E]<=0)){l.lnz+=y[w+E];var N=d[E];N!==-1&&(y[w+N]===0&&(y[A+N]=y[A+E]),y[D+y[A+E]]=y[v+N],y[v+N]=y[D+x],y[w+N]+=y[w+E])}for(x=0;x<m;x++)h[x]<0&&(h[x]=E++);return!0}});function op(t,e){return t[e]<0}function av(t,e){t[e]=xo(t[e])}function J0(t){return t<0?xo(t):t}function A2(t,e,r,n,i){var a=e._index,o=e._ptr,s=e._size,l=s[1],u,c,f,m=0;for(n[0]=t;m>=0;){t=n[m];var p=i?i[t]:t;op(o,t)||(av(o,t),n[l+m]=p<0?0:J0(o[p]));var d=1;for(c=n[l+m],f=p<0?0:J0(o[p+1]);c<f;c++)if(u=a[c],!op(o,u)){n[l+m]=c,n[++m]=u,d=0;break}d&&(m--,n[--r]=t)}return r}function D2(t,e,r,n,i){var a=t._ptr,o=t._size,s=e._index,l=e._ptr,u=o[1],c,f,m,p=u;for(f=l[r],m=l[r+1],c=f;c<m;c++){var d=s[c];op(a,d)||(p=A2(d,t,p,n,i))}for(c=p;c<u;c++)av(a,n[c]);return p}var oX="csSpsolve",sX=["divideScalar","multiply","subtract"],S2=M(oX,sX,t=>{var{divideScalar:e,multiply:r,subtract:n}=t;return function(a,o,s,l,u,c,f){var m=a._values,p=a._index,d=a._ptr,h=a._size,b=h[1],y=o._values,D=o._index,v=o._ptr,A,w,x,E,T=D2(a,o,s,l,c);for(A=T;A<b;A++)u[l[A]]=0;for(w=v[s],x=v[s+1],A=w;A<x;A++)u[D[A]]=y[A];for(var _=T;_<b;_++){var C=l[_],N=c?c[C]:C;if(!(N<0))for(w=d[N],x=d[N+1],u[C]=e(u[C],m[f?w:x-1]),A=f?w+1:w,E=f?x:x-1;A<E;A++){var I=p[A];u[I]=n(u[I],r(m[A],u[C]))}}return T}});var uX="csLu",lX=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],E2=M(uX,lX,t=>{var{abs:e,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=t,l=S2({divideScalar:r,multiply:n,subtract:i});return function(c,f,m){if(!c)return null;var p=c._size,d=p[1],h,b=100,y=100;f&&(h=f.q,b=f.lnz||b,y=f.unz||y);var D=[],v=[],A=[],w=new s({values:D,index:v,ptr:A,size:[d,d]}),x=[],E=[],T=[],_=new s({values:x,index:E,ptr:T,size:[d,d]}),C=[],N,I,R=[],L=[];for(N=0;N<d;N++)R[N]=0,C[N]=-1,A[N+1]=0;b=0,y=0;for(var V=0;V<d;V++){A[V]=b,T[V]=y;var P=h?h[V]:V,k=l(w,c,P,L,R,C,1),W=-1,O=-1;for(I=k;I<d;I++)if(N=L[I],C[N]<0){var Q=e(R[N]);a(Q,O)&&(O=Q,W=N)}else E[y]=C[N],x[y++]=R[N];if(W===-1||O<=0)return null;C[P]<0&&o(e(R[P]),n(O,m))&&(W=P);var ne=R[W];for(E[y]=V,x[y++]=ne,C[W]=V,v[b]=W,D[b++]=1,I=k;I<d;I++)N=L[I],C[N]<0&&(v[b]=N,D[b++]=r(R[N],ne)),R[N]=0}for(A[d]=b,T[d]=y,I=0;I<b;I++)v[I]=C[v[I]];return D.splice(b,D.length-b),v.splice(b,v.length-b),x.splice(y,x.length-y),E.splice(y,E.length-y),{L:w,U:_,pinv:C}}});var T2="slu",cX=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],M2=M(T2,cX,t=>{var{typed:e,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=t,f=_2({add:n,multiply:i,transpose:a}),m=E2({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return e(T2,{"SparseMatrix, number, number":function(d,h,b){if(!He(h)||h<0||h>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(b<0||b>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var y=f(h,d,!1),D=m(d,y,b);return{L:D.L,U:D.U,p:D.pinv,q:y.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function X0(t,e){var r,n=e.length,i=[];if(t)for(r=0;r<n;r++)i[t[r]]=e[r];else for(r=0;r<n;r++)i[r]=e[r];return i}var C2="lusolve",fX=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],N2=M(C2,fX,t=>{var{typed:e,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=t,l=Uo({DenseMatrix:s});return e(C2,{"Array, Array | Matrix":function(m,p){m=r(m);var d=n(m),h=c(d.L,d.U,d.p,null,p);return h.valueOf()},"DenseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(m,p,d,h){var b=i(m,d,h);return c(b.L,b.U,b.p,b.q,p)},"Object, Array | Matrix":function(m,p){return c(m.L,m.U,m.p,m.q,p)}});function u(f){if(Ye(f))return f;if(sr(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,m,p,d,h){f=u(f),m=u(m),p&&(h=l(f,h,!0),h._data=X0(p,h._data));var b=o(f,h),y=a(m,b);return d&&(y._data=X0(d,y._data)),y}});var F2="polynomialRoot",pX=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],I2=M(F2,pX,t=>{var{typed:e,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:m,re:p}=t;return e(F2,{"number|Complex, ...number|Complex":(d,h)=>{for(var b=[d,...h];b.length>0&&r(b[b.length-1]);)b.pop();if(b.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(h,"] must have a non-zero non-constant coefficient"));switch(b.length){case 2:return[u(s(b[0],b[1]))];case 3:{var[y,D,v]=b,A=o(2,v),w=o(D,D),x=o(4,v,y);if(n(w,x))return[s(u(D),A)];var E=l(a(w,x));return[s(a(E,D),A),s(a(u(E),D),A)]}case 4:{var[T,_,C,N]=b,I=u(o(3,N)),R=o(C,C),L=o(3,N,_),V=i(o(2,C,C,C),o(27,N,N,T)),P=o(9,N,C,_);if(n(R,L)&&n(V,P))return[s(C,I)];var k=a(R,L),W=a(V,P),O=i(o(18,N,C,_,T),o(C,C,_,_)),Q=i(o(4,C,C,C,T),o(4,N,_,_,_),o(27,N,N,T,T));if(n(O,Q))return[s(a(o(4,N,C,_),i(o(9,N,N,T),o(C,C,C))),o(N,k)),s(a(o(9,N,T),o(C,_)),o(2,k))];var ne;n(R,L)?ne=W:ne=s(i(W,l(a(o(W,W),o(4,k,k,k)))),2);var X=!0,U=c(ne,X).toArray().map(fe=>s(i(C,fe,s(k,fe)),I));return U.map(fe=>f(fe)==="Complex"&&n(p(fe),p(fe)+m(fe))?p(fe):fe)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(b))}}})});var mX="Help",dX=["evaluate"],B2=M(mX,dX,t=>{var{evaluate:e}=t;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`
`),n.category&&(i+="Category: "+n.category+`
`),n.description&&(i+=`Description:
`+n.description+`
`),n.syntax&&(i+=`Syntax:
`+n.syntax.join(`
`)+`
`),n.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),s={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},l=0;l<n.examples.length;l++){var u=n.examples[l];i+=" "+u+`
`;var c=void 0;try{c=e(u,s)}catch(f){c=f}c!==void 0&&!mc(c)&&(i+=" "+Dt(c,{precision:14})+`
`)}i+=`
`,a&&e("config(originalConfig)",{originalConfig:o})}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},r.prototype.toJSON=function(){var n=ut(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var hX="Chain",gX=["?on","math","typed"],k2=M(hX,gX,t=>{var{on:e,math:r,typed:n}=t;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");dc(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Dt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){_s(i.prototype,u,function(){var m=c();if(typeof m=="function")return s(m)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(u)){var m=n.resolve(u,c);if(m.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var f=function(d){Ze(u,d)&&l[d]===void 0&&o(d,()=>u[d])};for(var m in u)f(m)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var Q0={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 P2={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var $2={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 O2={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 R2={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var L2={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var V2={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 U2={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 q2={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var z2={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var H2={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 K0={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 G2={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 W2={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var Y2={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 j2={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var Z2={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var J2={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","bigint","complex","fraction","index","matrix","string","unit"]};var X2={name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]};var Q2={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 K2={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 eB={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 tB={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 rB={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 nB={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 iB={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","bigint","boolean","complex","fraction","index","matrix","string","unit"]};var aB={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 oB={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 sB={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 uB={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 lB={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 cB={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 fB={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 pB={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 mB={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 dB={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 hB={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 gB={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 vB={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 yB={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 bB={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 xB={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 wB={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 _B={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 AB={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 DB={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 SB={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 EB={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 TB={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 MB={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 CB={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var NB={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 FB={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 IB={name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],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)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]};var BB={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 kB={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 PB={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 $B={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 OB={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 RB={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 LB={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 VB={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 UB={name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],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)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]};var qB={name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],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)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]};var zB={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 HB={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var GB={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 WB={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 YB={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 jB={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 ZB={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 JB={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 XB={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 QB={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 KB={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 ek={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 tk={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 rk={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 nk={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 ik={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var ak={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 ok={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 sk={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 uk={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 lk={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 ck={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 fk={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 pk={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 mk={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var dk={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 hk={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 gk={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 vk={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 yk={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 bk={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 xk={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 wk={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 _k={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 Ak={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 Dk={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 Sk={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 Ek={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 Tk={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 Mk={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 Ck={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 Nk={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 Fk={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 Ik={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 Bk={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 kk={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 Pk={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 $k={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 Ok={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 Rk={name:"mapSlices",category:"Matrix",syntax:["mapSlices(A, dim, callback)"],description:"Generate a matrix one dimension less than A by applying callback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, prod)"],seealso:["map","forEach"]};var Lk={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 Vk={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 Uk={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 qk={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 zk={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 Hk={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 Gk={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 Wk={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 indicate 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 Yk={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 jk={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 Zk={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 Jk={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 Xk={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 Qk={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 Kk={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 eP={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 tP={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 rP={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 nP={name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]};var iP={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 aP={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 oP={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 sP={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 uP={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 lP={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 cP={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 fP={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 pP={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 mP={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 dP={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 hP={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 gP={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 vP={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 yP={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 bP={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 xP={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 wP={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 _P={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var AP={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var DP={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 SP={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 EP={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 TP={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 MP={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 CP={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 NP={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 FP={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 IP={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 BP={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 kP={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 PP={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 $P={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 OP={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 RP={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 LP={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 VP={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 UP={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. Comparing a value with NaN returns false.",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 qP={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 zP={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. Comparing a value with NaN returns false.",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 HP={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 GP={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 WP={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 YP={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 jP={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 ZP={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 JP={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 XP={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 QP={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 KP={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 e$={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 t$={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 r$={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 n$={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 i$={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 a$={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var o$={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 s$={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",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 u$={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 l$={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 c$={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",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 f$={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 p$={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 m$={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 probability 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 d$={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 h$={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 g$={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 v$={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 y$={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 b$={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 x$={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 w$={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 _$={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var A$={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 D$={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var S$={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 E$={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var T$={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 M$={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 C$={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 N$={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 F$={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 I$={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 B$={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 k$={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 P$={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 $$={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 O$={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 R$={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 L$={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 V$={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 U$={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var q$={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 z$={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 H$={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 G$={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var W$={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 Y$={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 j$={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 Z$={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var J$={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 X$={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 Q$={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 K$={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 eO={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 tO={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 rO={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 nO={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]};var iO={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var aO={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 oO={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 sO={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 uO={bignumber:J2,bigint:X2,boolean:Q2,complex:K2,createUnit:eB,fraction:tB,index:rB,matrix:nB,number:iB,sparse:aB,splitUnit:oB,string:sB,unit:uB,e:Q0,E:Q0,false:P2,i:$2,Infinity:O2,LN2:L2,LN10:R2,LOG2E:U2,LOG10E:V2,NaN:q2,null:z2,pi:K0,PI:K0,phi:H2,SQRT1_2:G2,SQRT2:W2,tau:Y2,true:j2,version:Z2,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:"Bohr 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:"Bohr 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:pB,lsolve:dB,lsolveAll:hB,lup:gB,lusolve:vB,leafCount:mB,polynomialRoot:yB,resolve:wB,simplify:_B,simplifyConstant:AB,simplifyCore:DB,symbolicEqual:EB,rationalize:xB,slu:SB,usolve:TB,usolveAll:MB,qr:bB,abs:CB,add:NB,cbrt:FB,ceil:IB,cube:BB,divide:kB,dotDivide:PB,dotMultiply:$B,dotPow:OB,exp:RB,expm:LB,expm1:VB,fix:UB,floor:qB,gcd:zB,hypot:HB,lcm:WB,log:YB,log2:JB,log1p:ZB,log10:jB,mod:XB,multiply:QB,norm:KB,nthRoot:ek,nthRoots:tk,pow:rk,round:nk,sign:ik,sqrt:ak,sqrtm:ok,square:ck,subtract:fk,unaryMinus:pk,unaryPlus:mk,xgcd:dk,invmod:GB,bitAnd:hk,bitNot:gk,bitOr:vk,bitXor:yk,leftShift:bk,rightArithShift:xk,rightLogShift:wk,bellNumbers:_k,catalan:Ak,composition:Dk,stirlingS2:Sk,config:lB,import:cB,typed:fB,arg:Ek,conj:Tk,re:Ck,im:Mk,evaluate:Nk,help:Fk,distance:Ik,intersect:Bk,and:kk,not:Pk,or:$k,xor:Ok,mapSlices:Rk,concat:Vk,count:Uk,cross:qk,column:Lk,ctranspose:zk,det:Hk,diag:Gk,diff:Wk,dot:Yk,getMatrixDataType:Qk,identity:Kk,filter:Zk,flatten:Jk,forEach:Xk,inv:eP,pinv:tP,eigs:jk,kron:rP,matrixFromFunction:aP,matrixFromRows:oP,matrixFromColumns:iP,map:nP,ones:sP,partitionSelect:uP,range:lP,resize:fP,reshape:cP,rotate:pP,rotationMatrix:mP,row:dP,size:hP,sort:gP,squeeze:vP,subset:yP,trace:bP,transpose:xP,zeros:wP,fft:_P,ifft:AP,sylvester:sk,schur:uk,lyap:lk,solveODE:sO,combinations:DP,combinationsWithRep:SP,factorial:EP,gamma:TP,kldivergence:CP,lgamma:MP,multinomial:NP,permutations:FP,pickRandom:IP,random:BP,randomInt:kP,compare:PP,compareNatural:$P,compareText:OP,deepEqual:RP,equal:LP,equalText:VP,larger:UP,largerEq:qP,smaller:zP,smallerEq:HP,unequal:GP,setCartesian:WP,setDifference:YP,setDistinct:jP,setIntersect:ZP,setIsSubset:JP,setMultiplicity:XP,setPowerset:QP,setSize:KP,setSymDifference:e$,setUnion:t$,zpk2tf:r$,freqz:n$,erf:i$,zeta:a$,cumsum:h$,mad:o$,max:s$,mean:u$,median:l$,min:c$,mode:f$,prod:p$,quantileSeq:m$,std:d$,sum:g$,variance:v$,corr:y$,acos:b$,acosh:x$,acot:w$,acoth:_$,acsc:A$,acsch:D$,asec:S$,asech:E$,asin:T$,asinh:M$,atan:C$,atanh:F$,atan2:N$,cos:I$,cosh:B$,cot:k$,coth:P$,csc:$$,csch:O$,sec:R$,sech:L$,sin:V$,sinh:U$,tan:q$,tanh:z$,to:H$,clone:W$,format:Y$,bin:G$,oct:iO,hex:Z$,isNaN:X$,isInteger:J$,isNegative:Q$,isNumeric:K$,hasNumericValue:j$,isPositive:eO,isPrime:tO,isZero:rO,print:aO,typeOf:oO,numeric:nO};var lO="help",vX=["typed","mathWithTransform","Help"],cO=M(lO,vX,t=>{var{typed:e,mathWithTransform:r,Help:n}=t;return e(lO,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(Ze(r,o)&&a===r[o]){s=o;break}}var l=jr(uO,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var fO="chain",yX=["typed","Chain"],pO=M(fO,yX,t=>{var{typed:e,Chain:r}=t;return e(fO,{"":function(){return new r},any:function(i){return new r(i)}})});var mO="det",bX=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],dO=M(mO,bX,t=>{var{typed:e,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=t;return e(mO,{any:function(c){return ut(c)},"Array | Matrix":function(c){var f;switch(Ye(c)?f=c.size():Array.isArray(c)?(c=r(c),f=c.size()):f=[],f.length){case 0:return ut(c);case 1:if(f[0]===1)return ut(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Dt(f)+")");case 2:{var m=f[0],p=f[1];if(m===p)return l(c.clone().valueOf(),m,p);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+Dt(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(f)+")")}}});function l(u,c,f){if(c===1)return ut(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var m=!1,p=new Array(c).fill(0).map((E,T)=>T),d=0;d<c;d++){var h=p[d];if(o(u[h][d])){var b=void 0;for(b=d+1;b<c;b++)if(!o(u[p[b]][d])){h=p[b],p[b]=p[d],p[d]=h,m=!m;break}if(b===c)return u[h][d]}for(var y=u[h][d],D=d===0?1:u[p[d-1]][d-1],v=d+1;v<c;v++)for(var A=p[v],w=d+1;w<c;w++)u[A][w]=a(n(i(u[A][w],y),i(u[A][d],u[h][w])),D)}var x=u[p[c-1]][c-1];return m?s(x):x}});var hO="inv",xX=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],gO=M(hO,xX,t=>{var{typed:e,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=t;return e(hO,{"Array | Matrix":function(m){var p=Ye(m)?m.size():ct(m);switch(p.length){case 1:if(p[0]===1)return Ye(m)?r([n(1,m.valueOf()[0])]):[n(1,m[0])];throw new RangeError("Matrix must be square (size: "+Dt(p)+")");case 2:{var d=p[0],h=p[1];if(d===h)return Ye(m)?r(c(m.valueOf(),d,h),m.storage()):c(m,d,h);throw new RangeError("Matrix must be square (size: "+Dt(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(p)+")")}},any:function(m){return n(1,m)}});function c(f,m,p){var d,h,b,y,D;if(m===1){if(y=f[0][0],y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,y)]]}else if(m===2){var v=s(f);if(v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],v),n(o(f[0][1]),v)],[n(o(f[1][0]),v),n(f[0][0],v)]]}else{var A=f.concat();for(d=0;d<m;d++)A[d]=A[d].concat();for(var w=l(m).valueOf(),x=0;x<p;x++){var E=u(A[x][x]),T=x;for(d=x+1;d<m;)u(A[d][x])>E&&(E=u(A[d][x]),T=d),d++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");d=T,d!==x&&(D=A[x],A[x]=A[d],A[d]=D,D=w[x],w[x]=w[d],w[d]=D);var _=A[x],C=w[x];for(d=0;d<m;d++){var N=A[d],I=w[d];if(d!==x){if(N[x]!==0){for(b=n(o(N[x]),_[x]),h=x;h<p;h++)N[h]=i(N[h],a(b,_[h]));for(h=0;h<p;h++)I[h]=i(I[h],a(b,C[h]))}}else{for(b=_[x],h=x;h<p;h++)N[h]=n(N[h],b);for(h=0;h<p;h++)I[h]=n(I[h],b)}}}return w}}});var vO="pinv",wX=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],yO=M(vO,wX,t=>{var{typed:e,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:f,Complex:m}=t;return e(vO,{"Array | Matrix":function(v){var A=Ye(v)?v.size():ct(v);switch(A.length){case 1:return y(v)?l(v):A[0]===1?n(v):o(l(v),s(v,v));case 2:{if(y(v))return l(v);var w=A[0],x=A[1];if(w===x)try{return n(v)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return Ye(v)?r(p(v.valueOf(),w,x),v.storage()):p(v,w,x)}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(A)+")")}},any:function(v){return a(v,0)?ut(v):u(1,v)}});function p(D,v,A){var{C:w,F:x}=h(D,v,A),E=c(n(c(l(w),w)),l(w)),T=c(l(x),n(c(x,l(x))));return c(T,E)}function d(D,v,A){for(var w=ut(D),x=0,E=0;E<v;E++){if(A<=x)return w;for(var T=E;b(w[T][x]);)if(T++,v===T&&(T=E,x++,A===x))return w;[w[T],w[E]]=[w[E],w[T]];for(var _=w[E][x],C=0;C<A;C++)w[E][C]=o(w[E][C],_);for(var N=0;N<v;N++)if(N!==E){_=w[N][x];for(var I=0;I<A;I++)w[N][I]=f(w[N][I],c(-1,c(_,w[E][I])))}x++}return w}function h(D,v,A){var w=d(D,v,A),x=D.map((T,_)=>T.filter((C,N)=>N<v&&!b(s(w[N],w[N])))),E=w.filter((T,_)=>!b(s(w[_],w[_])));return{C:x,F:E}}function b(D){return a(f(D,m(1,1)),f(0,m(1,1)))}function y(D){return i(f(D,m(1,1)),f(c(D,0),m(1,1)))}});function bO(t){var{addScalar:e,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,size:f,reshape:m,inv:p,qr:d,usolve:h,usolveAll:b,equal:y,complex:D,larger:v,smaller:A,matrixFromColumns:w,dot:x}=t;function E(X,U,fe,xe){var oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,be=T(X,U,fe,xe,oe);_(X,U,fe,xe,oe,be);var{values:ee,C:Z}=C(X,U,fe,xe,oe);if(oe){var re=N(X,U,Z,be,ee,fe,xe);return{values:ee,eigenvectors:re}}return{values:ee}}function T(X,U,fe,xe,oe){var be=xe==="BigNumber",ee=xe==="Complex",Z=be?u(0):0,re=be?u(1):ee?D(1):1,me=be?u(1):1,ce=be?u(10):2,Ae=a(ce,ce),we;oe&&(we=Array(U).fill(re));for(var G=!1;!G;){G=!0;for(var J=0;J<U;J++){for(var ge=Z,ye=Z,De=0;De<U;De++)J!==De&&(ge=e(ge,l(X[De][J])),ye=e(ye,l(X[J][De])));if(!y(ge,0)&&!y(ye,0)){for(var Ie=me,Oe=ge,Je=o(ye,ce),wt=a(ye,ce);A(Oe,Je);)Oe=a(Oe,Ae),Ie=a(Ie,ce);for(;v(Oe,wt);)Oe=o(Oe,Ae),Ie=o(Ie,ce);var qe=A(o(e(Oe,ye),Ie),a(e(ge,ye),.95));if(qe){G=!1;for(var rr=o(1,Ie),Wt=0;Wt<U;Wt++)J!==Wt&&(X[J][Wt]=a(X[J][Wt],rr),X[Wt][J]=a(X[Wt][J],Ie));oe&&(we[J]=a(we[J],rr))}}}}return oe?c(we):null}function _(X,U,fe,xe,oe,be){var ee=xe==="BigNumber",Z=xe==="Complex",re=ee?u(0):Z?D(0):0;ee&&(fe=u(fe));for(var me=0;me<U-2;me++){for(var ce=0,Ae=re,we=me+1;we<U;we++){var G=X[we][me];A(l(Ae),l(G))&&(Ae=G,ce=we)}if(!A(l(Ae),fe)){if(ce!==me+1){var J=X[ce];X[ce]=X[me+1],X[me+1]=J;for(var ge=0;ge<U;ge++){var ye=X[ge][ce];X[ge][ce]=X[ge][me+1],X[ge][me+1]=ye}if(oe){var De=be[ce];be[ce]=be[me+1],be[me+1]=De}}for(var Ie=me+2;Ie<U;Ie++){var Oe=o(X[Ie][me],Ae);if(Oe!==0){for(var Je=0;Je<U;Je++)X[Ie][Je]=r(X[Ie][Je],a(Oe,X[me+1][Je]));for(var wt=0;wt<U;wt++)X[wt][me+1]=e(X[wt][me+1],a(Oe,X[wt][Ie]));if(oe)for(var qe=0;qe<U;qe++)be[Ie][qe]=r(be[Ie][qe],a(Oe,be[me+1][qe]))}}}}return be}function C(X,U,fe,xe,oe){var be=xe==="BigNumber",ee=xe==="Complex",Z=be?u(1):ee?D(1):1;be&&(fe=u(fe));for(var re=ut(X),me=[],ce=U,Ae=[],we=oe?c(Array(U).fill(Z)):void 0,G=oe?c(Array(ce).fill(Z)):void 0,J=0;J<=100;){J+=1;for(var ge=re[ce-1][ce-1],ye=0;ye<ce;ye++)re[ye][ye]=r(re[ye][ye],ge);var{Q:De,R:Ie}=d(re);re=i(Ie,De);for(var Oe=0;Oe<ce;Oe++)re[Oe][Oe]=e(re[Oe][Oe],ge);if(oe&&(G=i(G,De)),ce===1||A(l(re[ce-1][ce-2]),fe)){J=0,me.push(re[ce-1][ce-1]),oe&&(Ae.unshift([[1]]),L(G,U),we=i(we,G),ce>1&&(G=c(Array(ce-1).fill(Z)))),ce-=1,re.pop();for(var Je=0;Je<ce;Je++)re[Je].pop()}else if(ce===2||A(l(re[ce-2][ce-3]),fe)){J=0;var wt=I(re[ce-2][ce-2],re[ce-2][ce-1],re[ce-1][ce-2],re[ce-1][ce-1]);me.push(...wt),oe&&(Ae.unshift(R(re[ce-2][ce-2],re[ce-2][ce-1],re[ce-1][ce-2],re[ce-1][ce-1],wt[0],wt[1],fe,xe)),L(G,U),we=i(we,G),ce>2&&(G=c(Array(ce-2).fill(Z)))),ce-=2,re.pop(),re.pop();for(var qe=0;qe<ce;qe++)re[qe].pop(),re[qe].pop()}if(ce===0)break}if(me.sort((pr,Pe)=>+r(l(pr),l(Pe))),J>100){var rr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+me.join(", "));throw rr.values=me,rr.vectors=[],rr}var Wt=oe?i(we,V(Ae,U)):void 0;return{values:me,C:Wt}}function N(X,U,fe,xe,oe,be,ee){var Z=p(fe),re=i(Z,X,fe),me=ee==="BigNumber",ce=ee==="Complex",Ae=me?u(0):ce?D(0):0,we=me?u(1):ce?D(1):1,G=[],J=[];for(var ge of oe){var ye=P(G,ge,y);ye===-1?(G.push(ge),J.push(1)):J[ye]+=1}for(var De=[],Ie=G.length,Oe=Array(U).fill(Ae),Je=c(Array(U).fill(we)),wt=function(){var Wt=G[qe],pr=r(re,i(Wt,Je)),Pe=b(pr,Oe);for(Pe.shift();Pe.length<J[qe];){var j=k(pr,U,Pe,be,ee);if(j===null)break;Pe.push(j)}var de=i(p(xe),fe);Pe=Pe.map(pe=>i(de,pe)),De.push(...Pe.map(pe=>({value:Wt,vector:n(pe)})))},qe=0;qe<Ie;qe++)wt();return De}function I(X,U,fe,xe){var oe=e(X,xe),be=r(a(X,xe),a(U,fe)),ee=a(oe,.5),Z=a(s(r(a(oe,oe),a(4,be))),.5);return[e(ee,Z),r(ee,Z)]}function R(X,U,fe,xe,oe,be,ee,Z){var re=Z==="BigNumber",me=Z==="Complex",ce=re?u(0):me?D(0):0,Ae=re?u(1):me?D(1):1;if(A(l(fe),ee))return[[Ae,ce],[ce,Ae]];if(v(l(r(oe,be)),ee))return[[r(oe,xe),r(be,xe)],[fe,fe]];var we=r(X,oe),G=r(xe,oe);return A(l(U),ee)&&A(l(G),ee)?[[we,Ae],[fe,ce]]:[[U,ce],[G,Ae]]}function L(X,U){for(var fe=0;fe<X.length;fe++)X[fe].push(...Array(U-X[fe].length).fill(0));for(var xe=X.length;xe<U;xe++)X.push(Array(U).fill(0)),X[xe][xe]=1;return X}function V(X,U){for(var fe=[],xe=0;xe<U;xe++)fe[xe]=Array(U).fill(0);var oe=0;for(var be of X){for(var ee=be.length,Z=0;Z<ee;Z++)for(var re=0;re<ee;re++)fe[oe+Z][oe+re]=be[Z][re];oe+=ee}return fe}function P(X,U,fe){for(var xe=0;xe<X.length;xe++)if(fe(X[xe],U))return xe;return-1}function k(X,U,fe,xe,oe){for(var be=oe==="BigNumber"?u(1e3):1e3,ee,Z=0;Z<5;++Z){ee=W(U,fe,oe);try{ee=h(X,ee)}catch{continue}if(v(Q(ee),be))break}if(Z>=5)return null;for(Z=0;;){var re=h(X,ee);if(A(Q(O(ee,[re])),xe))break;if(++Z>=10)return null;ee=ne(re)}return ee}function W(X,U,fe){var xe=fe==="BigNumber",oe=fe==="Complex",be=Array(X).fill(0).map(ee=>2*Math.random()-1);return xe&&(be=be.map(ee=>u(ee))),oe&&(be=be.map(ee=>D(ee))),be=O(be,U),ne(be,fe)}function O(X,U){var fe=f(X);for(var xe of U)xe=m(xe,fe),X=r(X,i(o(x(xe,X),x(xe,xe)),xe));return X}function Q(X){return l(s(x(X,X)))}function ne(X,U){var fe=U==="BigNumber",xe=U==="Complex",oe=fe?u(1):xe?D(1):1;return i(o(oe,Q(X)),X)}return E}function xO(t){var{config:e,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:f,add:m}=t;function p(_,C){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.relTol,I=arguments.length>3?arguments[3]:void 0,R=arguments.length>4?arguments[4]:void 0;if(I==="number")return d(_,N,R);if(I==="BigNumber")return h(_,N,R);throw TypeError("Unsupported data type: "+I)}function d(_,C,N){var I=_.length,R=Math.abs(C/I),L,V;if(N){V=new Array(I);for(var P=0;P<I;P++)V[P]=Array(I).fill(0),V[P][P]=1}for(var k=x(_);Math.abs(k[1])>=Math.abs(R);){var W=k[0][0],O=k[0][1];L=b(_[W][W],_[O][O],_[W][O]),_=w(_,L,W,O),N&&(V=D(V,L,W,O)),k=x(_)}for(var Q=Array(I).fill(0),ne=0;ne<I;ne++)Q[ne]=_[ne][ne];return T(ut(Q),V,N)}function h(_,C,N){var I=_.length,R=i(C/I),L,V;if(N){V=new Array(I);for(var P=0;P<I;P++)V[P]=Array(I).fill(0),V[P][P]=1}for(var k=E(_);i(k[1])>=i(R);){var W=k[0][0],O=k[0][1];L=y(_[W][W],_[O][O],_[W][O]),_=A(_,L,W,O),N&&(V=v(V,L,W,O)),k=E(_)}for(var Q=Array(I).fill(0),ne=0;ne<I;ne++)Q[ne]=_[ne][ne];return T(ut(Q),V,N)}function b(_,C,N){var I=C-_;return Math.abs(I)<=e.relTol?Math.PI/4:.5*Math.atan(2*N/(C-_))}function y(_,C,N){var I=n(C,_);return i(I)<=e.relTol?c(-1).acos().div(4):l(.5,a(f(2,N,u(I))))}function D(_,C,N,I){for(var R=_.length,L=Math.cos(C),V=Math.sin(C),P=Array(R).fill(0),k=Array(R).fill(0),W=0;W<R;W++)P[W]=L*_[W][N]-V*_[W][I],k[W]=V*_[W][N]+L*_[W][I];for(var O=0;O<R;O++)_[O][N]=P[O],_[O][I]=k[O];return _}function v(_,C,N,I){for(var R=_.length,L=o(C),V=s(C),P=Array(R).fill(c(0)),k=Array(R).fill(c(0)),W=0;W<R;W++)P[W]=n(l(L,_[W][N]),l(V,_[W][I])),k[W]=r(l(V,_[W][N]),l(L,_[W][I]));for(var O=0;O<R;O++)_[O][N]=P[O],_[O][I]=k[O];return _}function A(_,C,N,I){for(var R=_.length,L=c(o(C)),V=c(s(C)),P=l(L,L),k=l(V,V),W=Array(R).fill(c(0)),O=Array(R).fill(c(0)),Q=f(c(2),L,V,_[N][I]),ne=r(n(l(P,_[N][N]),Q),l(k,_[I][I])),X=m(l(k,_[N][N]),Q,l(P,_[I][I])),U=0;U<R;U++)W[U]=n(l(L,_[N][U]),l(V,_[I][U])),O[U]=r(l(V,_[N][U]),l(L,_[I][U]));_[N][N]=ne,_[I][I]=X,_[N][I]=c(0),_[I][N]=c(0);for(var fe=0;fe<R;fe++)fe!==N&&fe!==I&&(_[N][fe]=W[fe],_[fe][N]=W[fe],_[I][fe]=O[fe],_[fe][I]=O[fe]);return _}function w(_,C,N,I){for(var R=_.length,L=Math.cos(C),V=Math.sin(C),P=L*L,k=V*V,W=Array(R).fill(0),O=Array(R).fill(0),Q=P*_[N][N]-2*L*V*_[N][I]+k*_[I][I],ne=k*_[N][N]+2*L*V*_[N][I]+P*_[I][I],X=0;X<R;X++)W[X]=L*_[N][X]-V*_[I][X],O[X]=V*_[N][X]+L*_[I][X];_[N][N]=Q,_[I][I]=ne,_[N][I]=0,_[I][N]=0;for(var U=0;U<R;U++)U!==N&&U!==I&&(_[N][U]=W[U],_[U][N]=W[U],_[I][U]=O[U],_[U][I]=O[U]);return _}function x(_){for(var C=_.length,N=0,I=[0,1],R=0;R<C;R++)for(var L=R+1;L<C;L++)Math.abs(N)<Math.abs(_[R][L])&&(N=Math.abs(_[R][L]),I=[R,L]);return[I,N]}function E(_){for(var C=_.length,N=0,I=[0,1],R=0;R<C;R++)for(var L=R+1;L<C;L++)i(N)<i(_[R][L])&&(N=i(_[R][L]),I=[R,L]);return[I,N]}function T(_,C,N){var I=_.length,R=Array(I),L;if(N){L=Array(I);for(var V=0;V<I;V++)L[V]=Array(I)}for(var P=0;P<I;P++){for(var k=0,W=_[0],O=0;O<_.length;O++)i(_[O])<i(W)&&(k=O,W=_[k]);if(R[P]=_.splice(k,1)[0],N)for(var Q=0;Q<I;Q++)L[P][Q]=C[Q][k],C[Q].splice(k,1)}if(!N)return{values:R};var ne=L.map((X,U)=>({value:R[U],vector:X}));return{values:R,eigenvectors:ne}}return p}var _X="eigs",AX=["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"],wO=M(_X,AX,t=>{var{config:e,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,divideScalar:m,inv:p,bignumber:d,multiply:h,add:b,larger:y,column:D,flatten:v,number:A,complex:w,sqrt:x,diag:E,size:T,reshape:_,qr:C,usolve:N,usolveAll:I,im:R,re:L,smaller:V,matrixFromColumns:P,dot:k}=t,W=xO({config:e,addScalar:i,subtract:a,column:D,flatten:v,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,inv:p,bignumber:d,complex:w,multiply:h,add:b}),O=bO({config:e,addScalar:i,subtract:a,multiply:h,multiplyScalar:f,flatten:v,divideScalar:m,sqrt:x,abs:s,bignumber:d,diag:E,size:T,reshape:_,qr:C,inv:p,usolve:N,usolveAll:I,equal:o,complex:w,larger:y,smaller:V,matrixFromColumns:P,dot:k});return r("eigs",{Array:function(be){return Q(n(be))},"Array, number|BigNumber":function(be,ee){return Q(n(be),{precision:ee})},"Array, Object"(oe,be){return Q(n(oe),be)},Matrix:function(be){return Q(be,{matricize:!0})},"Matrix, number|BigNumber":function(be,ee){return Q(be,{precision:ee,matricize:!0})},"Matrix, Object":function(be,ee){var Z={matricize:!0};return bn(Z,ee),Q(be,Z)}});function Q(oe){var be,ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z="eigenvectors"in ee?ee.eigenvectors:!0,re=(be=ee.precision)!==null&&be!==void 0?be:e.relTol,me=ne(oe,re,Z);return ee.matricize&&(me.values=n(me.values),Z&&(me.eigenvectors=me.eigenvectors.map(ce=>{var{value:Ae,vector:we}=ce;return{value:Ae,vector:n(we)}}))),Z&&Object.defineProperty(me,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),me}function ne(oe,be,ee){var Z=oe.toArray(),re=oe.size();if(re.length!==2||re[0]!==re[1])throw new RangeError("Matrix must be square (size: ".concat(Dt(re),")"));var me=re[0];if(U(Z,me,be)&&(fe(Z,me),X(Z,me,be))){var ce=xe(oe,Z,me);return W(Z,me,be,ce,ee)}var Ae=xe(oe,Z,me);return O(Z,me,be,Ae,ee)}function X(oe,be,ee){for(var Z=0;Z<be;Z++)for(var re=Z;re<be;re++)if(y(d(s(a(oe[Z][re],oe[re][Z]))),ee))return!1;return!0}function U(oe,be,ee){for(var Z=0;Z<be;Z++)for(var re=0;re<be;re++)if(y(d(s(R(oe[Z][re]))),ee))return!1;return!0}function fe(oe,be){for(var ee=0;ee<be;ee++)for(var Z=0;Z<be;Z++)oe[ee][Z]=L(oe[ee][Z])}function xe(oe,be,ee){var Z=oe.datatype();if(Z==="number"||Z==="BigNumber"||Z==="Complex")return Z;for(var re=!1,me=!1,ce=!1,Ae=0;Ae<ee;Ae++)for(var we=0;we<ee;we++){var G=be[Ae][we];if(bt(G)||ba(G))re=!0;else if(ot(G))me=!0;else if(Hn(G))ce=!0;else throw TypeError("Unsupported type in Matrix: "+ir(G))}if(me&&ce&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),ce){for(var J=0;J<ee;J++)for(var ge=0;ge<ee;ge++)be[J][ge]=w(be[J][ge]);return"Complex"}if(me){for(var ye=0;ye<ee;ye++)for(var De=0;De<ee;De++)be[ye][De]=d(be[ye][De]);return"BigNumber"}if(re){for(var Ie=0;Ie<ee;Ie++)for(var Oe=0;Oe<ee;Oe++)be[Ie][Oe]=A(be[Ie][Oe]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var _O="expm",DX=["typed","abs","add","identity","inv","multiply"],AO=M(_O,DX,t=>{var{typed:e,abs:r,add:n,identity:i,inv:a,multiply:o}=t;return e(_O,{Matrix:function(f){var m=f.size();if(m.length!==2||m[0]!==m[1])throw new RangeError("Matrix must be square (size: "+Dt(m)+")");for(var p=m[0],d=1e-15,h=s(f),b=l(h,d),y=b.q,D=b.j,v=o(f,Math.pow(2,-D)),A=i(p),w=i(p),x=1,E=v,T=-1,_=1;_<=y;_++)_>1&&(E=o(E,v),T=-T),x=x*(y-_+1)/((2*y-_+1)*_),A=n(A,o(x,E)),w=n(w,o(x*T,E));for(var C=o(a(w),A),N=0;N<D;N++)C=o(C,C);return xa(f)?f.createSparseMatrix(C):C}});function s(c){for(var f=c.size()[0],m=0,p=0;p<f;p++){for(var d=0,h=0;h<f;h++)d+=r(c.get([p,h]));m=Math.max(d,m)}return m}function l(c,f){for(var m=30,p=0;p<m;p++)for(var d=0;d<=p;d++){var h=p-d;if(u(c,d,h)<f)return{q:d,j:h}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function u(c,f,m){for(var p=1,d=2;d<=f;d++)p*=d;for(var h=p,b=f+1;b<=2*f;b++)h*=b;var y=h*(2*f+1);return 8*Math.pow(c/Math.pow(2,m),2*f)*p*p/(h*y)}});var DO="sqrtm",SX=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],SO=M(DO,SX,t=>{var{typed:e,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:f}=t,m=1e3,p=1e-6;function d(h){var b,y=0,D=h,v=f(u(h));do{var A=D;if(D=i(.5,n(A,l(v))),v=i(.5,n(v,l(A))),b=c(r(s(D,A))),b>p&&++y>m)throw new Error("computing square root of matrix: iterative method could not converge")}while(b>p);return D}return e(DO,{"Array | Matrix":function(b){var y=Ye(b)?b.size():ct(b);switch(y.length){case 1:if(y[0]===1)return a(b,o);throw new RangeError("Matrix must be square (size: "+Dt(y)+")");case 2:{var D=y[0],v=y[1];if(D===v)return d(b);throw new RangeError("Matrix must be square (size: "+Dt(y)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Dt(y)+")")}}})});var EO="sylvester",EX=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],TO=M(EO,EX,t=>{var{typed:e,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:f,subtract:m,identity:p,lusolve:d,abs:h}=t;return e(EO,{"Matrix, Matrix, Matrix":b,"Array, Matrix, Matrix":function(D,v,A){return b(i(D),v,A)},"Array, Array, Matrix":function(D,v,A){return b(i(D),i(v),A)},"Array, Matrix, Array":function(D,v,A){return b(i(D),v,i(A))},"Matrix, Array, Matrix":function(D,v,A){return b(D,i(v),A)},"Matrix, Array, Array":function(D,v,A){return b(D,i(v),i(A))},"Matrix, Matrix, Array":function(D,v,A){return b(D,v,i(A))},"Array, Array, Array":function(D,v,A){return b(i(D),i(v),i(A)).toArray()}});function b(y,D,v){for(var A=D.size()[0],w=y.size()[0],x=r(y),E=x.T,T=x.U,_=r(a(-1,D)),C=_.T,N=_.U,I=a(a(l(T),v),N),R=o(0,w),L=[],V=(ce,Ae)=>s(ce,Ae,1),P=(ce,Ae)=>s(ce,Ae,0),k=0;k<A;k++)if(k<A-1&&h(c(C,u(k+1,k)))>1e-5){for(var W=P(c(I,u(R,k)),c(I,u(R,k+1))),O=0;O<k;O++)W=f(W,P(a(L[O],c(C,u(O,k))),a(L[O],c(C,u(O,k+1)))));var Q=a(p(w),a(-1,c(C,u(k,k)))),ne=a(p(w),a(-1,c(C,u(k+1,k)))),X=a(p(w),a(-1,c(C,u(k,k+1)))),U=a(p(w),a(-1,c(C,u(k+1,k+1)))),fe=P(V(f(E,Q),ne),V(X,f(E,U))),xe=d(fe,W);L[k]=xe.subset(u(o(0,w),0)),L[k+1]=xe.subset(u(o(w,2*w),0)),k++}else{for(var oe=c(I,u(R,k)),be=0;be<k;be++)oe=f(oe,a(L[be],c(C,u(be,k))));var ee=c(C,u(k,k)),Z=m(E,a(ee,p(w)));L[k]=d(Z,oe)}var re=i(n(...L)),me=a(T,a(re,l(N)));return me}});var MO="schur",TX=["typed","matrix","identity","multiply","qr","norm","subtract"],CO=M(MO,TX,t=>{var{typed:e,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=t;return e(MO,{Array:function(c){var f=l(r(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],f=u,m=n(c),p=0,d;do{d=f;var h=a(f),b=h.Q,y=h.R;if(f=i(y,b),m=i(m,b),p++>100)break}while(o(s(f,d))>1e-4);return{U:m,T:f}}});var NO="lyap",MX=["typed","matrix","sylvester","multiply","transpose"],FO=M(NO,MX,t=>{var{typed:e,matrix:r,sylvester:n,multiply:i,transpose:a}=t;return e(NO,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})});var CX="divide",NX=["typed","matrix","multiply","equalScalar","divideScalar","inv"],IO=M(CX,NX,t=>{var{typed:e,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=t,s=Er({typed:e,equalScalar:i}),l=xn({typed:e});return e("divide",Fh({"Array | Matrix, Array | Matrix":function(c,f){return n(c,o(f))},"DenseMatrix, any":function(c,f){return l(c,f,a,!1)},"SparseMatrix, any":function(c,f){return s(c,f,a,!1)},"Array, any":function(c,f){return l(r(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return n(c,o(f))}},a.signatures))});var BO="distance",FX=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],kO=M(BO,FX,t=>{var{typed:e,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=t;return e(BO,{"Array, Array, Array":function(w,x,E){if(w.length===2&&x.length===2&&E.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(x,E))throw new TypeError("LinePoint1 should not be same with LinePoint2");var T=n(E[1],x[1]),_=n(x[0],E[0]),C=n(i(E[0],x[1]),i(x[0],E[1]));return b(w[0],w[1],T,_,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,x,E){if(Object.keys(w).length===2&&Object.keys(x).length===2&&Object.keys(E).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(d(x),d(E)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in x&&"lineOnePtY"in x&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var T=n(E.lineTwoPtY,x.lineOnePtY),_=n(x.lineOnePtX,E.lineTwoPtX),C=n(i(E.lineTwoPtX,x.lineOnePtY),i(x.lineOnePtX,E.lineTwoPtY));return b(w.pointX,w.pointY,T,_,C)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,x){if(w.length===2&&x.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return b(w[0],w[1],x[0],x[1],x[2])}else if(w.length===3&&x.length===6){if(!f(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(x))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(w[0],w[1],w[2],x[0],x[1],x[2],x[3],x[4],x[5])}else if(w.length===x.length&&w.length>0){if(!m(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(x))throw new TypeError("All values of an array should be numbers or BigNumbers");return D(w,x)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,x){if(Object.keys(w).length===2&&Object.keys(x).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in x&&"yCoeffLine"in x&&"constant"in x)return b(w.pointX,w.pointY,x.xCoeffLine,x.yCoeffLine,x.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(x).length===6){if(!f(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(x))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in x&&"y0"in x&&"z0"in x&&"a"in x&&"b"in x&&"c"in x)return y(w.pointX,w.pointY,w.pointZ,x.x0,x.y0,x.z0,x.a,x.b,x.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(x).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in x&&"pointTwoY"in x)return D([w.pointOneX,w.pointOneY],[x.pointTwoX,x.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(x).length===3){if(!f(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in x&&"pointTwoY"in x&&"pointTwoZ"in x)return D([w.pointOneX,w.pointOneY,w.pointOneZ],[x.pointTwoX,x.pointTwoY,x.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!h(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(w)}});function u(A){return typeof A=="number"||ot(A)}function c(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])}function f(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])&&u(A[2])}function m(A){return Array.isArray(A)||(A=d(A)),A.every(u)}function p(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])&&u(A[2])&&u(A[3])&&u(A[4])&&u(A[5])}function d(A){for(var w=Object.keys(A),x=[],E=0;E<w.length;E++)x.push(A[w[E]]);return x}function h(A){if(A[0].length===2&&u(A[0][0])&&u(A[0][1])){if(A.some(w=>w.length!==2||!u(w[0])||!u(w[1])))return!1}else if(A[0].length===3&&u(A[0][0])&&u(A[0][1])&&u(A[0][2])){if(A.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function b(A,w,x,E,T){var _=l(r(r(i(x,A),i(E,w)),T)),C=s(r(i(x,x),i(E,E)));return a(_,C)}function y(A,w,x,E,T,_,C,N,I){var R=[n(i(n(T,w),I),i(n(_,x),N)),n(i(n(_,x),C),i(n(E,A),I)),n(i(n(E,A),N),i(n(T,w),C))];R=s(r(r(i(R[0],R[0]),i(R[1],R[1])),i(R[2],R[2])));var L=s(r(r(i(C,C),i(N,N)),i(I,I)));return a(R,L)}function D(A,w){for(var x=A.length,E=0,T=0,_=0;_<x;_++)T=n(A[_],w[_]),E=r(i(T,T),E);return s(E)}function v(A){for(var w=[],x=[],E=[],T=0;T<A.length-1;T++)for(var _=T+1;_<A.length;_++)A[0].length===2?(x=[A[T][0],A[T][1]],E=[A[_][0],A[_][1]]):A[0].length===3&&(x=[A[T][0],A[T][1],A[T][2]],E=[A[_][0],A[_][1],A[_][2]]),w.push(D(x,E));return w}});var IX="intersect",BX=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],PO=M(IX,BX,t=>{var{typed:e,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:f,equalScalar:m,flatten:p,isZero:d,isNumeric:h}=t;return e("intersect",{"Array, Array, Array":b,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(N,I,R){var L=b(N.valueOf(),I.valueOf(),R.valueOf());return L===null?null:o(L)},"Matrix, Matrix, Matrix, Matrix":function(N,I,R,L){var V=y(N.valueOf(),I.valueOf(),R.valueOf(),L.valueOf());return V===null?null:o(V)}});function b(C,N,I){if(C=D(C),N=D(N),I=D(I),!A(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!A(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(I))throw new TypeError("Array with 4 numbers expected as third argument");return _(C[0],C[1],C[2],N[0],N[1],N[2],I[0],I[1],I[2],I[3])}function y(C,N,I,R){if(C=D(C),N=D(N),I=D(I),R=D(R),C.length===2){if(!v(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(I))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return x(C,N,I,R)}else if(C.length===3){if(!A(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!A(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(I))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!A(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return T(C[0],C[1],C[2],N[0],N[1],N[2],I[0],I[1],I[2],R[0],R[1],R[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function D(C){return C.length===1?C[0]:C.length>1&&Array.isArray(C[0])&&C.every(N=>Array.isArray(N)&&N.length===1)?p(C):C}function v(C){return C.length===2&&h(C[0])&&h(C[1])}function A(C){return C.length===3&&h(C[0])&&h(C[1])&&h(C[2])}function w(C){return C.length===4&&h(C[0])&&h(C[1])&&h(C[2])&&h(C[3])}function x(C,N,I,R){var L=C,V=I,P=c(L,N),k=c(V,R),W=c(l(P[0],k[1]),l(k[0],P[1]));if(d(W)||f(n(W),r.relTol))return null;var O=l(k[0],L[1]),Q=l(k[1],L[0]),ne=l(k[0],V[1]),X=l(k[1],V[0]),U=u(a(c(c(O,Q),ne),X),W);return i(s(P,U),L)}function E(C,N,I,R,L,V,P,k,W,O,Q,ne){var X=l(c(C,N),c(I,R)),U=l(c(L,V),c(P,k)),fe=l(c(W,O),c(Q,ne));return a(a(X,U),fe)}function T(C,N,I,R,L,V,P,k,W,O,Q,ne){var X=E(C,P,O,P,N,k,Q,k,I,W,ne,W),U=E(O,P,R,C,Q,k,L,N,ne,W,V,I),fe=E(C,P,R,C,N,k,L,N,I,W,V,I),xe=E(O,P,O,P,Q,k,Q,k,ne,W,ne,W),oe=E(R,C,R,C,L,N,L,N,V,I,V,I),be=c(l(X,U),l(fe,xe)),ee=c(l(oe,xe),l(U,U));if(d(ee))return null;var Z=u(be,ee),re=u(a(X,l(Z,U)),xe),me=a(C,l(Z,c(R,C))),ce=a(N,l(Z,c(L,N))),Ae=a(I,l(Z,c(V,I))),we=a(P,l(re,c(O,P))),G=a(k,l(re,c(Q,k))),J=a(W,l(re,c(ne,W)));return m(me,we)&&m(ce,G)&&m(Ae,J)?[me,ce,Ae]:null}function _(C,N,I,R,L,V,P,k,W,O){var Q=l(C,P),ne=l(R,P),X=l(N,k),U=l(L,k),fe=l(I,W),xe=l(V,W),oe=c(c(c(O,Q),X),fe),be=c(c(c(a(a(ne,U),xe),Q),X),fe),ee=u(oe,be),Z=a(C,l(ee,c(R,C))),re=a(N,l(ee,c(L,N))),me=a(I,l(ee,c(V,I)));return[Z,re,me]}});var $O="sum",kX=["typed","config","add","numeric"],ov=M($O,kX,t=>{var{typed:e,config:r,add:n,numeric:i}=t;return e($O,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(ja(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return Oi(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw pn(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,xi(l,r))),l}function o(s,l){try{var u=su(s,l,n);return u}catch(c){throw pn(c,"sum")}}});var sv="cumsum",PX=["typed","add","unaryPlus"],uv=M(sv,PX,t=>{var{typed:e,add:r,unaryPlus:n}=t;return e(sv,{Array:i,Matrix:function(u){return u.create(i(u.valueOf(),u.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c),u.datatype())},"...":function(u){if(ja(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw pn(u,sv)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c<l.length;++c)u.push(r(u[c-1],l[c]));return u}function o(l,u){var c=ct(l);if(u<0||u>=c.length)throw new Zn(u,c.length);try{return s(l,u)}catch(f){throw pn(f,sv)}}function s(l,u){var c,f,m;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(m=Qh(l),f=[],c=0;c<m.length;c++)f[c]=s(m[c],u-1);return f}else return a(l)}else{for(f=[],c=0;c<l.length;c++)f[c]=s(l[c],u-1);return f}}});var OO="mean",$X=["typed","add","divide"],lv=M(OO,$X,t=>{var{typed:e,add:r,divide:n}=t;return e(OO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(ja(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=su(o,s,r),u=Array.isArray(o)?ct(o):o.size();return n(l,u[s])}catch(c){throw pn(c,"mean")}}function a(o){var s,l=0;if(Oi(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw pn(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}});var RO="median",OX=["typed","add","divide","compare","partitionSelect"],LO=M(RO,OX,t=>{var{typed:e,add:r,divide:n,compare:i,partitionSelect:a}=t;function o(u){try{u=Pt(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,m=a(u,f+1),p=u[f],d=0;d<f;++d)i(u[d],p)>0&&(p=u[d]);return l(p,m)}else{var h=a(u,(c-1)/2);return s(h)}}catch(b){throw pn(b,"median")}}var s=e({"number | BigNumber | Complex | Unit":function(c){return c}}),l=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return n(r(c,f),2)}});return e(RO,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(ja(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var VO="mad",RX=["typed","abs","map","median","subtract"],UO=M(VO,RX,t=>{var{typed:e,abs:r,map:n,median:i,subtract:a}=t;return e(VO,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=Pt(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.includes("median")?new TypeError(u.message.replace("median","mad")):pn(u,"mad")}}});var ew="unbiased",qO="variance",LX=["typed","add","subtract","multiply","divide","mapSlices","isNaN"],cv=M(qO,LX,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s}=t;return e(qO,{"Array | Matrix":function(f){return l(f,ew)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,m){return u(f,m,ew)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,ew)}});function l(c,f){var m,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Oi(c,function(b){try{m=m===void 0?b:r(m,b),p++}catch(y){throw pn(y,"variance",b)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var d=a(m,p);if(m=void 0,Oi(c,function(b){var y=n(b,d);m=m===void 0?i(y,y):r(m,i(y,y))}),s(m))return m;switch(f){case"uncorrected":return a(m,p);case"biased":return a(m,p+1);case"unbiased":{var h=ot(m)?m.mul(0):0;return p===1?h:a(m,p-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,f,m){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,p=>l(p,m))}catch(p){throw pn(p,"variance")}}});var zO="quantileSeq",VX=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],fv=M(zO,VX,t=>{var{typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m,mapSlices:p}=t;return e(zO,{"Array | Matrix, number | BigNumber":(D,v)=>h(D,v,!1),"Array | Matrix, number | BigNumber, number":(D,v,A)=>d(D,v,!1,A,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(D,v,A,w)=>d(D,v,A,w,h),"Array | Matrix, Array | Matrix":(D,v)=>b(D,v,!1),"Array | Matrix, Array | Matrix, number":(D,v,A)=>d(D,v,!1,A,b),"Array | Matrix, Array | Matrix, boolean":b,"Array | Matrix, Array | Matrix, boolean, number":(D,v,A,w)=>d(D,v,A,w,b)});function d(D,v,A,w,x){return p(D,w,E=>x(E,v,A))}function h(D,v,A){var w,x=D.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return bt(v)?y(x,v,A):r(y(x,v,A));if(m(v,1)){if(!u(v))throw new Error("N must be a positive integer");if(m(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var E=n(v,1);w=[];for(var T=0;c(T,v);T++){var _=a(T+1,E);w.push(y(x,_,A))}return bt(v)?w:r(w)}}function b(D,v,A){for(var w=D.valueOf(),x=v.valueOf(),E=[],T=0;T<x.length;++T)E.push(y(w,x[T],A));return E}function y(D,v,A){var w=Pt(D),x=w.length;if(x===0)throw new Error("Cannot calculate quantile of an empty sequence");var E=bt(v)?v*(x-1):v.times(x-1),T=bt(v)?Math.floor(E):E.floor().toNumber(),_=bt(v)?E%1:E.minus(T);if(u(E))return A?w[E]:s(w,bt(v)?E:E.valueOf());var C,N;if(A)C=w[T],N=w[T+1];else{N=s(w,T+1),C=w[T];for(var I=0;I<T;++I)l(w[I],C)>0&&(C=w[I])}return n(o(C,i(1,_)),o(N,_))}});var HO="std",UX=["typed","map","sqrt","variance"],pv=M(HO,UX,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t;return e(HO,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return rn(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.includes(" variance")?new TypeError(u.message.replace(" variance"," std")):u}}});var GO="corr",qX=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],WO=M(GO,qX,t=>{var{typed:e,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=t;return e(GO,{"Array, Array":function(p,d){return c(p,d)},"Matrix, Matrix":function(p,d){var h=c(p.toArray(),d.toArray());return Array.isArray(h)?r(h):h}});function c(m,p){var d=[];if(Array.isArray(m[0])&&Array.isArray(p[0])){if(m.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var h=0;h<m.length;h++){if(m[h].length!==p[h].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");d.push(f(m[h],p[h]))}return d}else{if(m.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(m,p)}}function f(m,p){var d=m.length,h=i(m),b=i(p),y=m.reduce((x,E,T)=>a(x,s(E,p[T])),0),D=i(m.map(x=>l(x,2))),v=i(p.map(x=>l(x,2))),A=o(s(d,y),s(h,b)),w=n(s(o(s(d,D),l(h,2)),o(s(d,v),l(b,2))));return u(A,w)}});var YO="combinations",zX=["typed"],ZO=M(YO,zX,t=>{var{typed:e}=t;return e(YO,{"number, number":h0,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!jO(n)||!jO(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=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function jO(t){return t.isInteger()&&t.gte(0)}var JO="combinationsWithRep",HX=["typed"],QO=M(JO,HX,t=>{var{typed:e}=t;return e(JO,{"number, number":function(n,i){if(!He(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!He(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=_a(n,n+i-1);return a/_a(1,i)}var o=_a(i+1,n+i-1);return o/_a(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=new a(1),u=n.minus(l);if(!XO(n)||!XO(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(l))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=l,i.lt(u))for(s=l;s.lte(u);s=s.plus(l))o=o.times(i.plus(s)).dividedBy(s);else for(s=l;s.lte(i);s=s.plus(l))o=o.times(u.plus(s)).dividedBy(s);return o}})});function XO(t){return t.isInteger()&&t.gte(0)}var KO="gamma",GX=["typed","config","multiplyScalar","pow","BigNumber","Complex"],eR=M(KO,GX,t=>{var{typed:e,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=t;function s(u){if(u.im===0)return tp(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),f=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(f.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var m=new o(tl[0],0),p=1;p<tl.length;++p){var d=new o(tl[p],0);m=m.add(d.div(u.add(p)))}var h=new o(u.re+y0+.5,u.im),b=Math.sqrt(2*Math.PI),y=h.pow(u.add(.5)),D=h.neg().exp();return m.mul(b).mul(y).mul(D)}return e(KO,{number:tp,Complex:s,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):l(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function l(u){if(u<8)return new a([1,1,2,6,24,120,720,5040][u]);var c=r.precision+(Math.log(u.toNumber())|0),f=a.clone({precision:c});if(u%2===1)return u.times(l(new a(u-1)));for(var m=u,p=new f(u),d=u.toNumber();m>2;)m-=2,d+=m,p=p.times(d);return new a(p.toPrecision(a.precision))}});var tR="lgamma",WX=["Complex","typed"],rR=M(tR,WX,t=>{var{Complex:e,typed:r}=t,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(tR,{number:rp,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,f=1.1447298858494002,m=.1;if(u.isNaN())return new e(NaN,NaN);if(u.im===0)return new e(rp(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=m){var p=PS(c,u.im)*Math.floor(.5*u.re+.25),d=u.mul(Math.PI).sin().log(),h=o(new e(1-u.re,-u.im));return new e(f,p).sub(d).sub(h)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(b0),f=new e(1,0).div(u),m=f.div(u),p=a[0],d=a[1],h=2*m.re,b=m.re*m.re+m.im*m.im,y=2;y<8;y++){var D=d;d=-b*p+a[y],p=h*p+D}var v=f.mul(m.mul(p).add(d));return c.add(v)}function l(u){var c=0,f=0,m=u;for(u=u.add(1);u.re<=n;){m=m.mul(u);var p=m.im<0?1:0;p!==0&&f===0&&c++,f=p,u=u.add(1)}return s(u).sub(m.log()).sub(new e(0,c*2*Math.PI*1))}});var nR="factorial",YX=["typed","gamma"],iR=M(nR,YX,t=>{var{typed:e,gamma:r}=t;return e(nR,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))})});var aR="kldivergence",jX=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],oR=M(aR,jX,t=>{var{typed:e,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=t;return e(aR,{"Array, Array":function(m,p){return c(r(m),r(p))},"Matrix, Array":function(m,p){return c(m,r(p))},"Array, Matrix":function(m,p){return c(r(m),p)},"Matrix, Matrix":function(m,p){return c(m,p)}});function c(f,m){var p=m.size().length,d=f.size().length;if(p>1)throw new Error("first object must be one dimensional");if(d>1)throw new Error("second object must be one dimensional");if(p!==d)throw new Error("Length of two vectors must be equal");var h=i(f);if(h===0)throw new Error("Sum of elements in first object must be non zero");var b=i(m);if(b===0)throw new Error("Sum of elements in second object must be non zero");var y=n(f,i(f)),D=n(m,i(m)),v=i(a(y,o(s(y,D),A=>l(A))));return u(v)?v:Number.NaN}});var sR="multinomial",ZX=["typed","add","divide","multiply","factorial","isInteger","isPositive"],uR=M(sR,ZX,t=>{var{typed:e,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=t;return e(sR,{"Array | Matrix":function(u){var c=0,f=1;return Oi(u,function(m){if(!o(m)||!s(m))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,m),f=i(f,a(m))}),n(a(c),f)}})});var lR="permutations",JX=["typed","factorial"],fR=M(lR,JX,t=>{var{typed:e,factorial:r}=t;return e(lR,{"number | BigNumber":r,"number, number":function(i,a){if(!He(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!He(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 _a(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!cR(i)||!cR(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 l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function cR(t){return t.isInteger()&&t.gte(0)}var sw=Tr(TR(),1),nQ=(0,sw.default)(Date.now());function Ms(t){var e;function r(i){e=i===null?nQ:(0,sw.default)(String(i))}r(t);function n(){return e()}return n}var MR="pickRandom",iQ=["typed","config","?on"],CR=M(MR,iQ,t=>{var{typed:e,config:r,on:n}=t,i=Ms(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=Ms(o.randomSeed))}),e(MR,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,f=typeof l>"u";f&&(l=1);var m=Ye(o)?o.create:Ye(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=Pt(o),u=Pt(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var d=0,h=u.length;d<h;d++){if(!bt(u[d])||u[d]<0)throw new Error("Weights must be an array of positive numbers");p+=u[d]}}for(var b=o.length,y=[],D;y.length<l;){if(typeof u>"u")D=o[Math.floor(i()*b)];else for(var v=i()*p,A=0,w=o.length;A<w;A++)if(v-=u[A],v<0){D=o[A];break}y.push(D)}return f?y[0]:m?m(y):y}});function sp(t,e){var r=[];if(t=t.slice(0),t.length>1)for(var n=0,i=t.shift();n<i;n++)r.push(sp(t,e));else for(var a=0,o=t.shift();a<o;a++)r.push(e());return r}var NR="random",aQ=["typed","config","?on"],FR=M(NR,aQ,t=>{var{typed:e,config:r,on:n}=t,i=Ms(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=Ms(s.randomSeed))}),e(NR,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=sp(s.valueOf(),()=>o(l,u));return Ye(s)?s.create(c,"number"):c}function o(s,l){return s+i()*(l-s)}});var IR="randomInt",oQ=["typed","config","log2","?on"],sQ=2n**30n,BR=M(IR,oQ,t=>{var{typed:e,config:r,log2:n,on:i}=t,a=Ms(r.randomSeed);return i&&i("config",function(u,c){u.randomSeed!==c.randomSeed&&(a=Ms(u.randomSeed))}),e(IR,{"":()=>s(0,2),number:u=>s(0,u),"number, number":(u,c)=>s(u,c),bigint:u=>l(0n,u),"bigint, bigint":l,"Array | Matrix":u=>o(u,0,1),"Array | Matrix, number":(u,c)=>o(u,0,c),"Array | Matrix, number, number":(u,c,f)=>o(u,c,f)});function o(u,c,f){var m=sp(u.valueOf(),()=>s(c,f));return Ye(u)?u.create(m,"number"):m}function s(u,c){return Math.floor(u+a()*(c-u))}function l(u,c){var f=c-u;if(f<=sQ)return u+BigInt(s(0,Number(f)));for(var m=n(f),p=f;p>=f;){p=0n;for(var d=0;d<m;++d)p=2n*p+(a()<.5?0n:1n)}return u+p}});var kR="stirlingS2",uQ=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],PR=M(kR,uQ,t=>{var{typed:e,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:f,bignumber:m,larger:p}=t,d=[],h=[];return e(kR,{"number | BigNumber, number | BigNumber":function(y,D){if(!c(y)||u(y)||!c(D)||u(D))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(D,y))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(bt(y)&&bt(D)),A=v?h:d,w=v?m:f,x=f(y),E=f(D);if(A[x]&&A[x].length>E)return A[x][E];for(var T=0;T<=x;++T)if(A[T]||(A[T]=[w(T===0?1:0)]),T!==0)for(var _=A[T],C=A[T-1],N=_.length;N<=T&&N<=E;++N)N===T?_[N]=1:_[N]=r(i(w(N),C[N]),C[N-1]);return A[x][E]}})});var $R="bellNumbers",lQ=["typed","addScalar","isNegative","isInteger","stirlingS2"],OR=M($R,lQ,t=>{var{typed:e,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=t;return e($R,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})});var RR="catalan",cQ=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],LR=M(RR,cQ,t=>{var{typed:e,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=t;return e(RR,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})});var VR="composition",fQ=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],UR=M(VR,fQ,t=>{var{typed:e,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=t;return e(VR,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})});var qR="leafCount",pQ=["parse","typed"],zR=M(qR,pQ,t=>{var{parse:e,typed:r}=t;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(qR,{Node:function(a){return n(a)}})});function uw(t){return kt(t)||Rr(t)&&t.isUnary()&&kt(t.args[0])}function up(t){return!!(kt(t)||(ai(t)||Rr(t))&&t.args.every(up)||Wn(t)&&up(t.content))}function HR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function lw(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HR(Object(r),!0).forEach(function(n){dr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var mQ="simplifyUtil",dQ=["FunctionNode","OperatorNode","SymbolNode"],$c=M(mQ,dQ,t=>{var{FunctionNode:e,OperatorNode:r,SymbolNode:n}=t,i=!0,a=!1,o="defaultF",s={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}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(v,A){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,x=o;if(typeof v=="string"?x=v:Rr(v)?x=v.fn.toString():ai(v)?x=v.name:Wn(v)&&(x="paren"),Ze(w,x)){var E=w[x];if(Ze(E,A))return E[A];if(Ze(s,x))return s[x][A]}if(Ze(w,o)){var T=w[o];return Ze(T,A)?T[A]:s[o][A]}if(Ze(s,x)){var _=s[x];if(Ze(_,A))return _[A]}return s[o][A]}function f(v){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"commutative",A)}function m(v){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"associative",A)}function p(v,A){var w=lw({},v);for(var x in A)Ze(v,x)?w[x]=lw(lw({},A[x]),v[x]):w[x]=A[x];return w}function d(v,A){if(!v.args||v.args.length===0)return v;v.args=h(v,A);for(var w=0;w<v.args.length;w++)d(v.args[w],A)}function h(v,A){var w,x=[],E=function(_){for(var C=0;C<_.args.length;C++){var N=_.args[C];Rr(N)&&w===N.op?E(N):x.push(N)}};return m(v,A)?(w=v.op,E(v),x):v.args}function b(v,A){if(!(!v.args||v.args.length===0)){for(var w=D(v),x=v.args.length,E=0;E<x;E++)b(v.args[E],A);if(x>2&&m(v,A)){for(var T=v.args.pop();v.args.length>0;)T=w([v.args.pop(),T]);v.args=T.args}}}function y(v,A){if(!(!v.args||v.args.length===0)){for(var w=D(v),x=v.args.length,E=0;E<x;E++)y(v.args[E],A);if(x>2&&m(v,A)){for(var T=v.args.shift();v.args.length>0;)T=w([T,v.args.shift()]);v.args=T.args}}}function D(v){return Rr(v)?function(A){try{return new r(v.op,v.fn,A,v.implicit)}catch(w){return console.error(w),[]}}:function(A){return new e(new n(v.name),A)}}return{createMakeNodeFunction:D,hasProperty:c,isCommutative:f,isAssociative:m,mergeContext:p,flatten:d,allChildren:h,unflattenr:b,unflattenl:y,defaultContext:s,realContext:l,positiveContext:u}});var hQ="simplify",gQ=["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],GR=M(hQ,gQ,t=>{var{typed:e,parse:r,equal:n,resolve:i,simplifyConstant:a,simplifyCore:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:m,OperatorNode:p,ParenthesisNode:d,SymbolNode:h,replacer:b}=t,{hasProperty:y,isCommutative:D,isAssociative:v,mergeContext:A,flatten:w,unflattenr:x,unflattenl:E,createMakeNodeFunction:T,defaultContext:_,realContext:C,positiveContext:N}=$c({FunctionNode:c,OperatorNode:p,SymbolNode:h});e.addConversion({from:"Object",to:"Map",convert:xs});var I=e("simplify",{Node:O,"Node, Map":(ee,Z)=>O(ee,!1,Z),"Node, Map, Object":(ee,Z,re)=>O(ee,!1,Z,re),"Node, Array":O,"Node, Array, Map":O,"Node, Array, Map, Object":O});e.removeConversion({from:"Object",to:"Map",convert:xs}),I.defaultContext=_,I.realContext=C,I.positiveContext=N;function R(ee){return ee.transform(function(Z){return Wn(Z)?R(Z.content):Z})}var L={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};I.rules=[o,{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}}},a,{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}}},a,{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 V(ee,Z){var re={};if(ee.s){var me=ee.s.split("->");if(me.length===2)re.l=me[0],re.r=me[1];else throw SyntaxError("Could not parse rule: "+ee.s)}else re.l=ee.l,re.r=ee.r;re.l=R(r(re.l)),re.r=R(r(re.r));for(var ce of["imposeContext","repeat","assuming"])ce in ee&&(re[ce]=ee[ce]);if(ee.evaluate&&(re.evaluate=r(ee.evaluate)),v(re.l,Z)){var Ae=!D(re.l,Z),we;Ae&&(we=W());var G=T(re.l),J=W();re.expanded={},re.expanded.l=G([re.l,J]),w(re.expanded.l,Z),x(re.expanded.l,Z),re.expanded.r=G([re.r,J]),Ae&&(re.expandedNC1={},re.expandedNC1.l=G([we,re.l]),re.expandedNC1.r=G([we,re.r]),re.expandedNC2={},re.expandedNC2.l=G([we,re.expanded.l]),re.expandedNC2.r=G([we,re.expanded.r]))}return re}function P(ee,Z){for(var re=[],me=0;me<ee.length;me++){var ce=ee[me],Ae=void 0,we=typeof ce;switch(we){case"string":ce={s:ce};case"object":Ae=V(ce,Z);break;case"function":Ae=ce;break;default:throw TypeError("Unsupported type of rule: "+we)}re.push(Ae)}return re}var k=0;function W(){return new h("_p"+k++)}function O(ee,Z){var re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:eu(),me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},ce=me.consoleDebug;Z=P(Z||I.rules,me.context);var Ae=i(ee,re);Ae=R(Ae);for(var we={},G=Ae.toString({parenthesis:"all"});!we[G];){we[G]=!0,k=0;var J=G;ce&&console.log("Working on: ",G);for(var ge=0;ge<Z.length;ge++){var ye="";if(typeof Z[ge]=="function"?(Ae=Z[ge](Ae,me),ce&&(ye=Z[ge].name)):(w(Ae,me.context),Ae=ne(Ae,Z[ge],me.context),ce&&(ye="".concat(Z[ge].l.toString()," -> ").concat(Z[ge].r.toString()))),ce){var De=Ae.toString({parenthesis:"all"});De!==J&&(console.log("Applying",ye,"produced",De),J=De)}E(Ae,me.context)}G=Ae.toString({parenthesis:"all"})}return Ae}function Q(ee,Z,re){var me=ee;if(ee)for(var ce=0;ce<ee.length;++ce){var Ae=ne(ee[ce],Z,re);Ae!==ee[ce]&&(me===ee&&(me=ee.slice()),me[ce]=Ae)}return me}function ne(ee,Z,re){if(Z.assuming){for(var me in Z.assuming)for(var ce in Z.assuming[me])if(y(me,ce,re)!==Z.assuming[me][ce])return ee}var Ae=A(Z.imposeContext,re),we=ee;if(we instanceof p||we instanceof c){var G=Q(we.args,Z,re);G!==we.args&&(we=we.clone(),we.args=G)}else if(we instanceof d){if(we.content){var J=ne(we.content,Z,re);J!==we.content&&(we=new d(J))}}else if(we instanceof l){var ge=Q(we.items,Z,re);ge!==we.items&&(we=new l(ge))}else if(we instanceof s){var ye=we.object;we.object&&(ye=ne(we.object,Z,re));var De=we.index;we.index&&(De=ne(we.index,Z,re)),(ye!==we.object||De!==we.index)&&(we=new s(ye,De))}else if(we instanceof f){var Ie=Q(we.dimensions,Z,re);Ie!==we.dimensions&&(we=new f(Ie))}else if(we instanceof m){var Oe=!1,Je={};for(var wt in we.properties)Je[wt]=ne(we.properties[wt],Z,re),Je[wt]!==we.properties[wt]&&(Oe=!0);Oe&&(we=new m(Je))}var qe=Z.r,rr=oe(Z.l,we,Ae)[0];if(!rr&&Z.expanded&&(qe=Z.expanded.r,rr=oe(Z.expanded.l,we,Ae)[0]),!rr&&Z.expandedNC1&&(qe=Z.expandedNC1.r,rr=oe(Z.expandedNC1.l,we,Ae)[0],rr||(qe=Z.expandedNC2.r,rr=oe(Z.expandedNC2.l,we,Ae)[0])),rr){var Wt=we.implicit;we=qe.clone(),Wt&&"implicit"in qe&&(we.implicit=!0),we=we.transform(function(pr){return pr.isSymbolNode&&Ze(rr.placeholders,pr.name)?rr.placeholders[pr.name].clone():pr})}return Z.repeat&&we!==ee&&(we=ne(we,Z,re)),we}function X(ee,Z){var re=[],me,ce,Ae=T(ee);if(D(ee,Z))for(var we=0;we<ee.args.length;we++)ce=ee.args.slice(0),ce.splice(we,1),me=ce.length===1?ce[0]:Ae(ce),re.push(Ae([ee.args[we],me]));else for(var G=1;G<ee.args.length;G++){var J=ee.args[0];G>1&&(J=Ae(ee.args.slice(0,G))),ce=ee.args.slice(G),me=ce.length===1?ce[0]:Ae(ce),re.push(Ae([J,me]))}return re}function U(ee,Z){var re={placeholders:{}};if(!ee.placeholders&&!Z.placeholders)return re;if(ee.placeholders){if(!Z.placeholders)return ee}else return Z;for(var me in ee.placeholders)if(Ze(ee.placeholders,me)&&(re.placeholders[me]=ee.placeholders[me],Ze(Z.placeholders,me)&&!be(ee.placeholders[me],Z.placeholders[me])))return null;for(var ce in Z.placeholders)Ze(Z.placeholders,ce)&&(re.placeholders[ce]=Z.placeholders[ce]);return re}function fe(ee,Z){var re=[];if(ee.length===0||Z.length===0)return re;for(var me,ce=0;ce<ee.length;ce++)for(var Ae=0;Ae<Z.length;Ae++)me=U(ee[ce],Z[Ae]),me&&re.push(me);return re}function xe(ee){if(ee.length===0)return ee;for(var Z=ee.reduce(fe),re=[],me={},ce=0;ce<Z.length;ce++){var Ae=JSON.stringify(Z[ce],b);me[Ae]||(me[Ae]=!0,re.push(Z[ce]))}return re}function oe(ee,Z,re,me){var ce=[{placeholders:{}}];if(ee instanceof p&&Z instanceof p||ee instanceof c&&Z instanceof c){if(ee instanceof p){if(ee.op!==Z.op||ee.fn!==Z.fn)return[]}else if(ee instanceof c&&ee.name!==Z.name)return[];if(Z.args.length===1&&ee.args.length===1||!v(Z,re)&&Z.args.length===ee.args.length||me){for(var Ae=[],we=0;we<ee.args.length;we++){var G=oe(ee.args[we],Z.args[we],re);if(G.length===0)break;Ae.push(G)}if(Ae.length!==ee.args.length){if(!D(Z,re)||ee.args.length===1)return[];if(ee.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var J=oe(ee.args[0],Z.args[1],re);if(J.length===0)return[];var ge=oe(ee.args[1],Z.args[0],re);if(ge.length===0)return[];Ae=[J,ge]}ce=xe(Ae)}else if(Z.args.length>=2&&ee.args.length===2){for(var ye=X(Z,re),De=[],Ie=0;Ie<ye.length;Ie++){var Oe=oe(ee,ye[Ie],re,!0);De=De.concat(Oe)}return De}else{if(ee.args.length>2)throw Error("Unexpected non-binary associative function: "+ee.toString());return[]}}else if(ee instanceof h){if(ee.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(L[ee.name]){if(ee.name!==Z.name)return[]}else switch(ee.name[1]>="a"&&ee.name[1]<="z"?ee.name.substring(0,2):ee.name[0]){case"n":case"_p":ce[0].placeholders[ee.name]=Z;break;case"c":case"cl":if(kt(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"v":if(!kt(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"vl":if(Mr(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"cd":if(uw(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"vd":if(!uw(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"ce":if(up(Z))ce[0].placeholders[ee.name]=Z;else return[];break;case"ve":if(!up(Z))ce[0].placeholders[ee.name]=Z;else return[];break;default:throw new Error("Invalid symbol in rule: "+ee.name)}}else if(ee instanceof u){if(!n(ee.value,Z.value))return[]}else return[];return ce}function be(ee,Z){if(ee instanceof u&&Z instanceof u){if(!n(ee.value,Z.value))return!1}else if(ee instanceof h&&Z instanceof h){if(ee.name!==Z.name)return!1}else if(ee instanceof p&&Z instanceof p||ee instanceof c&&Z instanceof c){if(ee instanceof p){if(ee.op!==Z.op||ee.fn!==Z.fn)return!1}else if(ee instanceof c&&ee.name!==Z.name)return!1;if(ee.args.length!==Z.args.length)return!1;for(var re=0;re<ee.args.length;re++)if(!be(ee.args[re],Z.args[re]))return!1}else return!1;return!0}return I});var vQ="simplifyConstant",yQ=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],WR=M(vQ,yQ,t=>{var{typed:e,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:m,OperatorNode:p,SymbolNode:d}=t,{isCommutative:h,isAssociative:b,allChildren:y,createMakeNodeFunction:D}=$c({FunctionNode:c,OperatorNode:p,SymbolNode:d}),v=e("simplifyConstant",{Node:V=>E(L(V,{})),"Node, Object":function(P,k){return E(L(P,k))}});function A(V){return ba(V)?V.valueOf():V instanceof Array?V.map(A):Ye(V)?i(A(V.valueOf())):V}function w(V,P,k){try{return n[V].apply(null,P)}catch{return P=P.map(A),_(n[V].apply(null,P),k)}}var x=e({Fraction:N,number:function(P){return P<0?C(new u(-P)):new u(P)},BigNumber:function(P){return P<0?C(new u(-P)):new u(P)},bigint:function(P){return P<0n?C(new u(-P)):new u(P)},Complex:function(P){throw new Error("Cannot convert Complex number to Node")},string:function(P){return new u(P)},Matrix:function(P){return new l(P.valueOf().map(k=>x(k)))}});function E(V){return Gt(V)?V:x(V)}function T(V,P){var k=P&&P.exactFractions!==!1;if(k&&isFinite(V)&&a){var W=a(V),O=P&&typeof P.fractionsLimit=="number"?P.fractionsLimit:1/0;if(W.valueOf()===V&&W.n<O&&W.d<O)return W}return V}var _=e({"string, Object":function(P,k){var W=xi(P,r);if(W==="BigNumber")return o===void 0&&Nc(),o(P);if(W==="bigint")return BigInt(P);if(W==="Fraction")return a===void 0&&xg(),a(P);var O=parseFloat(P);return T(O,k)},"Fraction, Object":function(P,k){return P},"BigNumber, Object":function(P,k){return P},"number, Object":function(P,k){return T(P,k)},"bigint, Object":function(P,k){return P},"Complex, Object":function(P,k){return P.im!==0?P:T(P.re,k)},"Matrix, Object":function(P,k){return i(T(P.valueOf()))},"Array, Object":function(P,k){return P.map(T)}});function C(V){return new p("-","unaryMinus",[V])}function N(V){var P=O=>r.number==="BigNumber"&&o?o(O):Number(O),k=V.s*V.n,W=k<0n?new p("-","unaryMinus",[new u(-P(k))]):new u(P(k));return V.d===1n?W:new p("/","divide",[W,new u(P(V.d))])}function I(V,P,k){if(!Xi(P))return new s(E(V),E(P));if(Gn(V)||Ye(V)){for(var W=Array.from(P.dimensions);W.length>0;)if(kt(W[0])&&typeof W[0].value!="string"){var O=_(W.shift().value,k);Gn(V)?V=V.items[O-1]:(V=V.valueOf()[O-1],V instanceof Array&&(V=i(V)))}else if(W.length>1&&kt(W[1])&&typeof W[1].value!="string"){var Q=_(W[1].value,k),ne=[],X=Gn(V)?V.items:V.valueOf();for(var U of X)if(Gn(U))ne.push(U.items[Q-1]);else if(Ye(V))ne.push(U[Q-1]);else break;if(ne.length===X.length)Gn(V)?V=new l(ne):V=i(ne),W.splice(1,1);else break}else break;return W.length===P.dimensions.length?new s(E(V),P):W.length>0?(P=new f(W),new s(E(V),P)):V}if(Oo(V)&&P.dimensions.length===1&&kt(P.dimensions[0])){var fe=P.dimensions[0].value;return fe in V.properties?V.properties[fe]:new u}return new s(E(V),P)}function R(V,P,k,W){var O=P.shift(),Q=P.reduce((ne,X)=>{if(!Gt(X)){var U=ne.pop();if(Gt(U))return[U,X];try{return ne.push(w(V,[U,X],W)),ne}catch{ne.push(U)}}ne.push(E(ne.pop()));var fe=ne.length===1?ne[0]:k(ne);return[k([fe,E(X)])]},[O]);return Q.length===1?Q[0]:k([Q[0],x(Q[1])])}function L(V,P){switch(V.type){case"SymbolNode":return V;case"ConstantNode":switch(typeof V.value){case"number":return _(V.value,P);case"bigint":return _(V.value,P);case"string":return V.value;default:if(!isNaN(V.value))return _(V.value,P)}return V;case"FunctionNode":if(n[V.name]&&n[V.name].rawArgs)return V;{var k=["add","multiply"];if(!k.includes(V.name)){var W=V.args.map(me=>L(me,P));if(!W.some(Gt))try{return w(V.name,W,P)}catch{}if(V.name==="size"&&W.length===1&&Gn(W[0])){for(var O=[],Q=W[0];Gn(Q);)O.push(Q.items.length),Q=Q.items[0];return i(O)}return new c(V.name,W.map(E))}}case"OperatorNode":{var ne=V.fn.toString(),X,U,fe=D(V);if(Rr(V)&&V.isUnary())X=[L(V.args[0],P)],Gt(X[0])?U=fe(X):U=w(ne,X,P);else if(b(V,P.context))if(X=y(V,P.context),X=X.map(me=>L(me,P)),h(ne,P.context)){for(var xe=[],oe=[],be=0;be<X.length;be++)Gt(X[be])?oe.push(X[be]):xe.push(X[be]);xe.length>1?(U=R(ne,xe,fe,P),oe.unshift(U),U=R(ne,oe,fe,P)):U=R(ne,X,fe,P)}else U=R(ne,X,fe,P);else X=V.args.map(me=>L(me,P)),U=R(ne,X,fe,P);return U}case"ParenthesisNode":return L(V.content,P);case"AccessorNode":return I(L(V.object,P),L(V.index,P),P);case"ArrayNode":{var ee=V.items.map(me=>L(me,P));return ee.some(Gt)?new l(ee.map(E)):i(ee)}case"IndexNode":return new f(V.dimensions.map(me=>v(me,P)));case"ObjectNode":{var Z={};for(var re in V.properties)Z[re]=v(V.properties[re],P);return new m(Z)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(V.type))}}return v});var YR="simplifyCore",bQ=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],jR=M(YR,bQ,t=>{var{typed:e,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:f,ConstantNode:m,FunctionNode:p,IndexNode:d,ObjectNode:h,OperatorNode:b,ParenthesisNode:y,SymbolNode:D}=t,v=new m(0),A=new m(1),w=new m(!0),x=new m(!1);function E(N){return Rr(N)&&["and","not","or"].includes(N.op)}var{hasProperty:T,isCommutative:_}=$c({FunctionNode:p,OperatorNode:b,SymbolNode:D});function C(N){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=I?I.context:void 0;if(T(N,"trivial",R)){if(ai(N)&&N.args.length===1)return C(N.args[0],I);var L=!1,V=0;if(N.forEach(oe=>{++V,V===1&&(L=C(oe,I))}),V===1)return L}var P=N;if(ai(P)){var k=OI(P.name);if(k){if(P.args.length>2&&T(P,"associative",R))for(;P.args.length>2;){var W=P.args.pop(),O=P.args.pop();P.args.push(new b(k,P.name,[W,O]))}P=new b(k,P.name,P.args)}else return new p(C(P.fn),P.args.map(oe=>C(oe,I)))}if(Rr(P)&&P.isUnary()){var Q=C(P.args[0],I);if(P.op==="~"&&Rr(Q)&&Q.isUnary()&&Q.op==="~"||P.op==="not"&&Rr(Q)&&Q.isUnary()&&Q.op==="not"&&E(Q.args[0]))return Q.args[0];var ne=!0;if(P.op==="-"&&Rr(Q)&&(Q.isBinary()&&Q.fn==="subtract"&&(P=new b("-","subtract",[Q.args[1],Q.args[0]]),ne=!1),Q.isUnary()&&Q.op==="-"))return Q.args[0];if(ne)return new b(P.op,P.fn,[Q])}if(Rr(P)&&P.isBinary()){var X=C(P.args[0],I),U=C(P.args[1],I);if(P.op==="+"){if(kt(X)&&i(X.value))return U;if(kt(U)&&i(U.value))return X;Rr(U)&&U.isUnary()&&U.op==="-"&&(U=U.args[0],P=new b("-","subtract",[X,U]))}if(P.op==="-")return Rr(U)&&U.isUnary()&&U.op==="-"?C(new b("+","add",[X,U.args[0]]),I):kt(X)&&i(X.value)?C(new b("-","unaryMinus",[U])):kt(U)&&i(U.value)?X:new b(P.op,P.fn,[X,U]);if(P.op==="*"){if(kt(X)){if(i(X.value))return v;if(n(X.value,1))return U}if(kt(U)){if(i(U.value))return v;if(n(U.value,1))return X;if(_(P,R))return new b(P.op,P.fn,[U,X],P.implicit)}return new b(P.op,P.fn,[X,U],P.implicit)}if(P.op==="/")return kt(X)&&i(X.value)?v:kt(U)&&n(U.value,1)?X:new b(P.op,P.fn,[X,U]);if(P.op==="^"&&kt(U)){if(i(U.value))return A;if(n(U.value,1))return X}if(P.op==="and"){if(kt(X))if(X.value){if(E(U))return U;if(kt(U))return U.value?w:x}else return x;if(kt(U))if(U.value){if(E(X))return X}else return x}if(P.op==="or"){if(kt(X)){if(X.value)return w;if(E(U))return U}if(kt(U)){if(U.value)return w;if(E(X))return X}}return new b(P.op,P.fn,[X,U])}if(Rr(P))return new b(P.op,P.fn,P.args.map(oe=>C(oe,I)));if(Gn(P))return new f(P.items.map(oe=>C(oe,I)));if($i(P))return new c(C(P.object,I),C(P.index,I));if(Xi(P))return new d(P.dimensions.map(oe=>C(oe,I)));if(Oo(P)){var fe={};for(var xe in P.properties)fe[xe]=C(P.properties[xe],I);return new h(fe)}return P}return e(YR,{Node:C,"Node,Object":C})});var xQ="resolve",wQ=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],ZR=M(xQ,wQ,t=>{var{typed:e,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=t;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(Mr(l)){if(c.has(l.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var m=u.get(l.name);if(Gt(m)){var p=new Set(c);return p.add(l.name),s(m,u,p)}else return typeof m=="number"?r(String(m)):m!==void 0?new n(m):l}else if(Rr(l)){var d=l.args.map(function(b){return s(b,u,c)});return new a(l.op,l.fn,d,l.implicit)}else{if(Wn(l))return new o(s(l.content,u,c));if(ai(l)){var h=l.args.map(function(b){return s(b,u,c)});return new i(l.name,h)}}return l.map(b=>s(b,u,c))}return e("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,xs(u)),"Array | Matrix":e.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":e.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":e.referTo("Array,Map",l=>(u,c)=>l(u,xs(c))),"Matrix, Object":e.referTo("Matrix,Map",l=>(u,c)=>l(u,xs(c))),"Array | Matrix, Map":e.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var JR="symbolicEqual",_Q=["parse","simplify","typed","OperatorNode"],XR=M(JR,_Q,t=>{var{parse:e,simplify:r,typed:n,OperatorNode:i}=t;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return kt(c)&&!c.value}return n(JR,{"Node, Node":a,"Node, Node, Object":a})});var QR="derivative",AQ=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],KR=M(QR,AQ,t=>{var{typed:e,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:f,SymbolNode:m}=t;function p(A,w){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E=new Map,T=w.name;function _(N){var I=E.get(N);if(I!==void 0)return I;var R=y(_,N,T);return E.set(N,R),R}var C=D(A,_);return x.simplify?i(C):C}function d(A){var w=n(A);if(!w.isSymbolNode)throw new TypeError("Invalid variable. "+"Cannot parse ".concat(JSON.stringify(A)," into a variable in function derivative"));return w}var h=e(QR,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(A,w)=>p(A,d(w)),"Node, string, Object":(A,w,x)=>p(A,d(w),x)});h._simplify=!0,h.toTex=function(A){return b.apply(null,A.args)};var b=e("_derivTex",{"Node, SymbolNode":function(w,x){return kt(w)&&ir(w.value)==="string"?b(n(w.value).toString(),x.toString(),1):b(w.toTex(),x.toString(),1)},"Node, ConstantNode":function(w,x){if(ir(x.value)==="string")return b(w,n(x.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,x,E){return b(w.toString(),x.name,E.value)},"string, string, number":function(w,x,E){var T;return E===1?T="{d\\over d"+x+"}":T="{d^{"+E+"}\\over d"+x+"^{"+E+"}}",T+"\\left[".concat(w,"\\right]")}}),y=e("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(w,x,E){return x.name!==E},"function, ParenthesisNode, string":function(w,x,E){return w(x.content,E)},"function, FunctionAssignmentNode, string":function(w,x,E){return x.params.includes(E)?w(x.expr,E):!0},"function, FunctionNode | OperatorNode, string":function(w,x,E){return x.args.every(T=>w(T,E))}}),D=e("_derivative",{"ConstantNode, function":function(){return v(0)},"SymbolNode, function":function(w,x){return x(w)?v(0):v(1)},"ParenthesisNode, function":function(w,x){return new f(D(w.content,x))},"FunctionAssignmentNode, function":function(w,x){return x(w)?v(0):D(w.expr,x)},"FunctionNode, function":function(w,x){if(x(w))return v(0);var E=w.args[0],T,_=!1,C=!1,N;switch(w.name){case"cbrt":_=!0,N=new c("*","multiply",[v(3),new c("^","pow",[E,new c("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)_=!0,N=new c("*","multiply",[v(2),new u("sqrt",[E])]);else if(w.args.length===2)return T=new c("/","divide",[v(1),w.args[1]]),D(new c("^","pow",[E,T]),x);break;case"log10":T=v(10);case"log":if(!T&&w.args.length===1)N=E.clone(),_=!0;else if(w.args.length===1&&T||w.args.length===2&&x(w.args[1]))N=new c("*","multiply",[E.clone(),new u("log",[T||w.args[1]])]),_=!0;else if(w.args.length===2)return D(new c("/","divide",[new u("log",[E]),new u("log",[w.args[1]])]),x);break;case"pow":if(w.args.length===2)return D(new c("^","pow",[E,w.args[1]]),x);break;case"exp":N=new u("exp",[E.clone()]);break;case"sin":N=new u("cos",[E.clone()]);break;case"cos":N=new c("-","unaryMinus",[new u("sin",[E.clone()])]);break;case"tan":N=new c("^","pow",[new u("sec",[E.clone()]),v(2)]);break;case"sec":N=new c("*","multiply",[w,new u("tan",[E.clone()])]);break;case"csc":C=!0,N=new c("*","multiply",[w,new u("cot",[E.clone()])]);break;case"cot":C=!0,N=new c("^","pow",[new u("csc",[E.clone()]),v(2)]);break;case"asin":_=!0,N=new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])]);break;case"acos":_=!0,C=!0,N=new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])]);break;case"atan":_=!0,N=new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)]);break;case"asec":_=!0,N=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acsc":_=!0,C=!0,N=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acot":_=!0,C=!0,N=new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)]);break;case"sinh":N=new u("cosh",[E.clone()]);break;case"cosh":N=new u("sinh",[E.clone()]);break;case"tanh":N=new c("^","pow",[new u("sech",[E.clone()]),v(2)]);break;case"sech":C=!0,N=new c("*","multiply",[w,new u("tanh",[E.clone()])]);break;case"csch":C=!0,N=new c("*","multiply",[w,new u("coth",[E.clone()])]);break;case"coth":C=!0,N=new c("^","pow",[new u("csch",[E.clone()]),v(2)]);break;case"asinh":_=!0,N=new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"acosh":_=!0,N=new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"atanh":_=!0,N=new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])]);break;case"asech":_=!0,C=!0,N=new c("*","multiply",[E.clone(),new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])])]);break;case"acsch":_=!0,C=!0,N=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acoth":_=!0,C=!0,N=new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])]);break;case"abs":N=new c("/","divide",[new u(new m("abs"),[E.clone()]),E.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+w.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var I,R;_?(I="/",R="divide"):(I="*",R="multiply");var L=D(E,x);return C&&(L=new c("-","unaryMinus",[L])),new c(I,R,[L,N])},"OperatorNode, function":function(w,x){if(x(w))return v(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(P){return D(P,x)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[D(w.args[0],x)]);if(w.isBinary())return new c(w.op,w.fn,[D(w.args[0],x),D(w.args[1],x)])}if(w.op==="*"){var E=w.args.filter(function(P){return x(P)});if(E.length>0){var T=w.args.filter(function(P){return!x(P)}),_=T.length===1?T[0]:new c("*","multiply",T),C=E.concat(D(_,x));return new c("*","multiply",C)}return new c("+","add",w.args.map(function(P){return new c("*","multiply",w.args.map(function(k){return k===P?D(k,x):k.clone()}))}))}if(w.op==="/"&&w.isBinary()){var N=w.args[0],I=w.args[1];return x(I)?new c("/","divide",[D(N,x),I]):x(N)?new c("*","multiply",[new c("-","unaryMinus",[N]),new c("/","divide",[D(I,x),new c("^","pow",[I.clone(),v(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[D(N,x),I.clone()]),new c("*","multiply",[N.clone(),D(I,x)])]),new c("^","pow",[I.clone(),v(2)])])}if(w.op==="^"&&w.isBinary()){var R=w.args[0],L=w.args[1];if(x(R))return kt(R)&&(o(R.value)||a(R.value,1))?v(0):new c("*","multiply",[w,new c("*","multiply",[new u("log",[R.clone()]),D(L.clone(),x)])]);if(x(L)){if(kt(L)){if(o(L.value))return v(0);if(a(L.value,1))return D(R,x)}var V=new c("^","pow",[R.clone(),new c("-","subtract",[L,v(1)])]);return new c("*","multiply",[L.clone(),new c("*","multiply",[D(R,x),V])])}return new c("*","multiply",[new c("^","pow",[R.clone(),L.clone()]),new c("+","add",[new c("*","multiply",[D(R,x),new c("/","divide",[L.clone(),R.clone()])]),new c("*","multiply",[D(L,x),new u("log",[R.clone()])])])])}throw new Error('Cannot process operator "'+w.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function v(A,w){return new l(s(A,w||xi(String(A),r)))}return h});var eL="rationalize",DQ=["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"],tL=M(eL,DQ,t=>{var{config:e,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:f,simplifyCore:m,simplify:p,fraction:d,bignumber:h,mathWithTransform:b,matrix:y,AccessorNode:D,ArrayNode:v,ConstantNode:A,FunctionNode:w,IndexNode:x,ObjectNode:E,OperatorNode:T,SymbolNode:_,ParenthesisNode:C}=t;function N(P){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=R(),Q=I(P,k,!0,O.firstRules),ne=Q.variables.length,X={exactFractions:!1},U={exactFractions:!0};if(P=Q.expression,ne>=1){P=L(P);var fe,xe,oe=!0,be=!1;P=p(P,O.firstRules,{},X);for(var ee;xe=oe?O.distrDivRules:O.sucDivRules,P=p(P,xe,{},U),oe=!oe,ee=P.toString(),ee!==fe;)be=!0,fe=ee;be&&(P=p(P,O.firstRulesAgain,{},X)),P=p(P,O.finalRules,{},X)}var Z=[],re={};return P.type==="OperatorNode"&&P.isBinary()&&P.op==="/"?(ne===1&&(P.args[0]=V(P.args[0],Z),P.args[1]=V(P.args[1])),W&&(re.numerator=P.args[0],re.denominator=P.args[1])):(ne===1&&(P=V(P,Z)),W&&(re.numerator=P,re.denominator=null)),W?(re.coefficients=Z,re.variables=Q.variables,re.expression=P,re):P}return r(eL,{Node:N,"Node, boolean":(P,k)=>N(P,{},k),"Node, Object":N,"Node, Object, boolean":N});function I(P,k,W,O){var Q=[],ne=p(P,O,k,{exactFractions:!1});W=!!W;var X="+-*"+(W?"/":"");fe(ne);var U={};return U.expression=ne,U.variables=Q,U;function fe(xe){var oe=xe.type;if(oe==="FunctionNode")throw new Error("There is an unsolved function call");if(oe==="OperatorNode")if(xe.op==="^"){if(xe.args[1].type!=="ConstantNode"||!He(parseFloat(xe.args[1].value)))throw new Error("There is a non-integer exponent");fe(xe.args[0])}else{if(!X.includes(xe.op))throw new Error("Operator "+xe.op+" invalid in polynomial expression");for(var be=0;be<xe.args.length;be++)fe(xe.args[be])}else if(oe==="SymbolNode"){var ee=xe.name,Z=Q.indexOf(ee);Z===-1&&Q.push(ee)}else if(oe==="ParenthesisNode")fe(xe.content);else if(oe!=="ConstantNode")throw new Error("type "+oe+" is not allowed in polynomial expression")}}function R(){var P=[m,{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"}],k=[{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)"}],W=[{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)"}],O=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],Q={};return Q.firstRules=P.concat(k,O),Q.distrDivRules=W,Q.sucDivRules=O,Q.firstRulesAgain=P.concat(k),Q.finalRules=[m,{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))"}],Q}function L(P,k,W){var O=P.type,Q=arguments.length>1;if(O==="OperatorNode"&&P.isBinary()){var ne=!1,X;if(P.op==="^"&&(P.args[0].type==="ParenthesisNode"||P.args[0].type==="OperatorNode")&&P.args[1].type==="ConstantNode"&&(X=parseFloat(P.args[1].value),ne=X>=2&&He(X)),ne){if(X>2){var U=P.args[0],fe=new T("^","pow",[P.args[0].cloneDeep(),new A(X-1)]);P=new T("*","multiply",[U,fe])}else P=new T("*","multiply",[P.args[0],P.args[0].cloneDeep()]);Q&&(W==="content"?k.content=P:k.args[W]=P)}}if(O==="ParenthesisNode")L(P.content,P,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var xe=0;xe<P.args.length;xe++)L(P.args[xe],P,xe);if(!Q)return P}function V(P,k){k===void 0&&(k=[]),k[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,Q="";ee(P,null,W),O=k.length-1;for(var ne=!0,X,U=O;U>=0;U--)if(k[U]!==0){var fe=new A(ne?k[U]:Math.abs(k[U])),xe=k[U]<0?"-":"+";if(U>0){var oe=new _(Q);if(U>1){var be=new A(U);oe=new T("^","pow",[oe,be])}k[U]===-1&&ne?fe=new T("-","unaryMinus",[oe]):Math.abs(k[U])===1?fe=oe:fe=new T("*","multiply",[fe,oe])}ne?X=fe:xe==="+"?X=new T("+","add",[X,fe]):X=new T("-","subtract",[X,fe]),ne=!1}if(ne)return new A(0);return X;function ee(Z,re,me){var ce=Z.type;if(ce==="FunctionNode")throw new Error("There is an unsolved function call");if(ce==="OperatorNode"){if(!"+-*^".includes(Z.op))throw new Error("Operator "+Z.op+" invalid");if(re!==null){if((Z.fn==="unaryMinus"||Z.fn==="pow")&&re.fn!=="add"&&re.fn!=="subtract"&&re.fn!=="multiply")throw new Error("Invalid "+Z.op+" placing");if((Z.fn==="subtract"||Z.fn==="add"||Z.fn==="multiply")&&re.fn!=="add"&&re.fn!=="subtract")throw new Error("Invalid "+Z.op+" placing");if((Z.fn==="subtract"||Z.fn==="add"||Z.fn==="unaryMinus")&&me.noFil!==0)throw new Error("Invalid "+Z.op+" placing")}(Z.op==="^"||Z.op==="*")&&(me.fire=Z.op);for(var Ae=0;Ae<Z.args.length;Ae++)Z.fn==="unaryMinus"&&(me.oper="-"),(Z.op==="+"||Z.fn==="subtract")&&(me.fire="",me.cte=1,me.oper=Ae===0?"+":Z.op),me.noFil=Ae,ee(Z.args[Ae],Z,me)}else if(ce==="SymbolNode"){if(Z.name!==Q&&Q!=="")throw new Error("There is more than one variable");if(Q=Z.name,re===null){k[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==="*")&&(O<1&&(k[1]=0),k[1]+=me.cte*(me.oper==="+"?1:-1),O=Math.max(1,O))}else if(ce==="ConstantNode"){var we=parseFloat(Z.value);if(re===null){k[0]=we;return}if(re.op==="^"){if(me.noFil!==1)throw new Error("Constant cannot be powered");if(!He(we)||we<=0)throw new Error("Non-integer exponent is not allowed");for(var G=O+1;G<we;G++)k[G]=0;we>O&&(k[we]=0),k[we]+=me.cte*(me.oper==="+"?1:-1),O=Math.max(we,O);return}me.cte=we,me.fire===""&&(k[0]+=me.cte*(me.oper==="+"?1:-1))}else throw new Error("Type "+ce+" is not allowed")}}});var rL="zpk2tf",SQ=["typed","add","multiply","Complex","number"],nL=M(rL,SQ,t=>{var{typed:e,add:r,multiply:n,Complex:i,number:a}=t;return e(rL,{"Array,Array,number":function(u,c,f){return o(u,c,f)},"Array,Array":function(u,c){return o(u,c,1)},"Matrix,Matrix,number":function(u,c,f){return o(u.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(u,c){return o(u.valueOf(),c.valueOf(),1)}});function o(l,u,c){l.some(D=>D.type==="BigNumber")&&(l=l.map(D=>a(D))),u.some(D=>D.type==="BigNumber")&&(u=u.map(D=>a(D)));for(var f=[i(1,0)],m=[i(1,0)],p=0;p<l.length;p++){var d=l[p];typeof d=="number"&&(d=i(d,0)),f=s(f,[i(1,0),i(-d.re,-d.im)])}for(var h=0;h<u.length;h++){var b=u[h];typeof b=="number"&&(b=i(b,0)),m=s(m,[i(1,0),i(-b.re,-b.im)])}for(var y=0;y<f.length;y++)f[y]=n(f[y],c);return[f,m]}function s(l,u){for(var c=[],f=0;f<l.length+u.length-1;f++){c[f]=i(0,0);for(var m=0;m<l.length;m++)f-m>=0&&f-m<u.length&&(c[f]=r(c[f],n(l[m],u[f-m])))}return c}});var iL="freqz",EQ=["typed","add","multiply","Complex","divide","matrix"],aL=M(iL,EQ,t=>{var{typed:e,add:r,multiply:n,Complex:i,divide:a,matrix:o}=t;return e(iL,{"Array, Array":function(c,f){var m=l(512);return s(c,f,m)},"Array, Array, Array":function(c,f,m){return s(c,f,m)},"Array, Array, number":function(c,f,m){if(m<0)throw new Error("w must be a positive number");var p=l(m);return s(c,f,p)},"Matrix, Matrix":function(c,f){var m=l(512),{w:p,h:d}=s(c.valueOf(),f.valueOf(),m);return{w:o(p),h:o(d)}},"Matrix, Matrix, Matrix":function(c,f,m){var{h:p}=s(c.valueOf(),f.valueOf(),m.valueOf());return{h:o(p),w:o(m)}},"Matrix, Matrix, number":function(c,f,m){if(m<0)throw new Error("w must be a positive number");var p=l(m),{h:d}=s(c.valueOf(),f.valueOf(),p);return{h:o(d),w:o(p)}}});function s(u,c,f){for(var m=[],p=[],d=0;d<f.length;d++){for(var h=i(0,0),b=i(0,0),y=0;y<u.length;y++)h=r(h,n(u[y],i(Math.cos(-y*f[d]),Math.sin(-y*f[d]))));for(var D=0;D<c.length;D++)b=r(b,n(c[D],i(Math.cos(-D*f[d]),Math.sin(-D*f[d]))));m.push(h),p.push(b)}for(var v=[],A=0;A<m.length;A++)v.push(a(m[A],p[A]));return{h:v,w:f}}function l(u){for(var c=[],f=0;f<u;f++)c.push(f/u*Math.PI);return c}});var TQ="reviver",MQ=["classes"],oL=M(TQ,MQ,t=>{var{classes:e}=t;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var CQ="replacer",NQ=[],sL=M(CQ,NQ,()=>function(e,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:typeof r=="bigint"?{mathjs:"bigint",value:String(r)}:r});var uL="14.4.0";var lL=M("true",[],()=>!0),cL=M("false",[],()=>!1),fL=M("null",[],()=>null),pL=Da("Infinity",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1/0):1/0}),mL=Da("NaN",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(NaN):NaN}),dL=Da("pi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?ap(r):AE}),hL=Da("tau",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?eF(r):DE}),gL=Da("e",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?QN(r):SE}),vL=Da("phi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?KN(r):EE}),yL=Da("LN2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).ln():Math.LN2}),bL=Da("LN10",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(10).ln():Math.LN10}),xL=Da("LOG2E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),wL=Da("LOG10E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),_L=Da("SQRT1_2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),AL=Da("SQRT2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),DL=Da("i",["Complex"],t=>{var{Complex:e}=t;return e.I}),SL=M("PI",["pi"],t=>{var{pi:e}=t;return e}),EL=M("E",["e"],t=>{var{e}=t;return e}),TL=M("version",[],()=>uL);function Da(t,e,r){return M(t,e,r,{recreateOnConfigChange:!0})}var ML=Kt("speedOfLight","299792458","m s^-1"),CL=Kt("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),NL=Kt("planckConstant","6.62607015e-34","J s"),FL=Kt("reducedPlanckConstant","1.0545718176461565e-34","J s"),IL=Kt("magneticConstant","1.25663706212e-6","N A^-2"),BL=Kt("electricConstant","8.8541878128e-12","F m^-1"),kL=Kt("vacuumImpedance","376.730313667","ohm"),PL=Kt("coulomb","8.987551792261171e9","N m^2 C^-2"),$L=Kt("elementaryCharge","1.602176634e-19","C"),OL=Kt("bohrMagneton","9.2740100783e-24","J T^-1"),RL=Kt("conductanceQuantum","7.748091729863649e-5","S"),LL=Kt("inverseConductanceQuantum","12906.403729652257","ohm"),VL=Kt("magneticFluxQuantum","2.0678338484619295e-15","Wb"),UL=Kt("nuclearMagneton","5.0507837461e-27","J T^-1"),qL=Kt("klitzing","25812.807459304513","ohm");var zL=Kt("bohrRadius","5.29177210903e-11","m"),HL=Kt("classicalElectronRadius","2.8179403262e-15","m"),GL=Kt("electronMass","9.1093837015e-31","kg"),WL=Kt("fermiCoupling","1.1663787e-5","GeV^-2"),YL=dv("fineStructure",.0072973525693),jL=Kt("hartreeEnergy","4.3597447222071e-18","J"),ZL=Kt("protonMass","1.67262192369e-27","kg"),JL=Kt("deuteronMass","3.3435830926e-27","kg"),XL=Kt("neutronMass","1.6749271613e-27","kg"),QL=Kt("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),KL=Kt("rydberg","10973731.568160","m^-1"),e3=Kt("thomsonCrossSection","6.6524587321e-29","m^2"),t3=dv("weakMixingAngle",.2229),r3=dv("efimovFactor",22.7),n3=Kt("atomicMass","1.66053906660e-27","kg"),i3=Kt("avogadro","6.02214076e23","mol^-1"),a3=Kt("boltzmann","1.380649e-23","J K^-1"),o3=Kt("faraday","96485.33212331001","C mol^-1"),s3=Kt("firstRadiation","3.7417718521927573e-16","W m^2"),u3=Kt("loschmidt","2.686780111798444e25","m^-3"),l3=Kt("gasConstant","8.31446261815324","J K^-1 mol^-1"),c3=Kt("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),f3=Kt("molarVolume","0.022413969545014137","m^3 mol^-1"),p3=dv("sackurTetrode",-1.16487052358),m3=Kt("secondRadiation","0.014387768775039337","m K"),d3=Kt("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),h3=Kt("wienDisplacement","2.897771955e-3","m K"),g3=Kt("molarMass","0.99999999965e-3","kg mol^-1"),v3=Kt("molarMassC12","11.9999999958e-3","kg mol^-1"),y3=Kt("gravity","9.80665","m s^-2"),b3=Kt("planckLength","1.616255e-35","m"),x3=Kt("planckMass","2.176435e-8","kg"),w3=Kt("planckTime","5.391245e-44","s"),_3=Kt("planckCharge","1.87554603778e-18","C"),A3=Kt("planckTemperature","1.416785e+32","K");function Kt(t,e,r){var n=["config","Unit","BigNumber"];return M(t,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(e):parseFloat(e),u=new o(l,r);return u.fixPrefix=!0,u})}function dv(t,e){var r=["config","BigNumber"];return M(t,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}function D3(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function FQ(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?D3(Object(r),!0).forEach(function(n){dr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D3(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var IQ="mapSlices",BQ=["typed","isInteger"],S3=M(IQ,BQ,t=>{var{typed:e,isInteger:r}=t,n=ip({typed:e,isInteger:r});return e("mapSlices",{"...any":function(a){var o=a[1];bt(o)?a[1]=o-1:ot(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw qr(s)}}})},FQ({isTransformFunction:!0},ip.meta));var kQ="column",PQ=["typed","Index","matrix","range"],E3=M(kQ,PQ,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=hg({typed:e,Index:r,matrix:n,range:i});return e("column",{"...any":function(s){var l=s.length-1,u=s[l];bt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw qr(c)}}})},{isTransformFunction:!0});function Oc(t,e,r){var n=t.filter(function(l){return Mr(l)&&!(l.name in e)&&!r.has(l.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+t+'"');var i=n.name,a=new Map,o=new pc(r,a,new Set([i])),s=t.compile();return function(u){return a.set(i,u),s.evaluate(o)}}var $Q="transformCallback",OQ=["typed"],Rc=M($Q,OQ,t=>{var{typed:e}=t;return function(n,i){return e.isTypedFunction(n)?r(n,i):T3(n,n.length,i)};function r(n,i){var a=Object.fromEntries(Object.entries(n.signatures).map(o=>{var[s,l]=o,u=s.split(",").length;return e.isTypedFunction(l)?[s,r(l,i)]:[s,T3(l,u,i)]}));return typeof n.name=="string"?e(n.name,a):e(a)}});function T3(t,e,r){return e===r?t:e===r+1?function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.slice(0,r),s=M3(i[r]);return t(...o,s)}:e>r+1?function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.slice(0,r),s=M3(i[r]),l=i.slice(r+1);return t(...o,s,...l)}:t}function M3(t){return t.map(e=>e+1)}var RQ="filter",LQ=["typed"],C3=M(RQ,LQ,t=>{var{typed:e}=t;function r(i,a,o){var s=gg({typed:e}),l=Rc({typed:e});if(i.length===0)return s();var u=i[0];if(i.length===1)return s(u);var c=i.length-1,f=i[c];return u&&(u=n(u,o)),f&&(Mr(f)||za(f)?f=n(f,o):f=Oc(f,a,o)),s(u,l(f,c))}r.rawArgs=!0;function n(i,a){return i.compile().evaluate(a)}return r},{isTransformFunction:!0});var VQ="forEach",UQ=["typed"],N3=M(VQ,UQ,t=>{var{typed:e}=t,r=vg({typed:e}),n=Rc({typed:e});function i(o,s,l){if(o.length===0)return r();var u=o[0];if(o.length===1)return r(u);var c=o.length-1,f=o[c];return u&&(u=a(u,l)),f&&(Mr(f)||za(f)?f=a(f,l):f=Oc(f,s,l)),r(u,n(f,c))}i.rawArgs=!0;function a(o,s){return o.compile().evaluate(s)}return i},{isTransformFunction:!0});var qQ="index",zQ=["Index","getMatrixDataType"],F3=M(qQ,zQ,t=>{var{Index:e,getMatrixDataType:r}=t;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var s=arguments[a];if(tu(s))s.start--,s.end-=s.step>0?0:2;else if(s&&s.isSet===!0)s=s.map(function(u){return u-1});else if(sr(s)||Ye(s))r(s)!=="boolean"&&(s=s.map(function(u){return u-1}));else if(bt(s)||Po(s))s--;else if(ot(s))s=s.toNumber()-1;else if(typeof s!="string")throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");i[a]=s}var l=new e;return e.apply(l,i),l}},{isTransformFunction:!0});var HQ="map",GQ=["typed"],I3=M(HQ,GQ,t=>{var{typed:e}=t,r=yg({typed:e}),n=Rc({typed:e});function i(a,o,s){if(a.length===0)return r();if(a.length===1)return r(a[0]);var l=a.length-1,u=a.slice(0,l),c=a[l];return u=u.map(m=>f(m,s)),c&&(Mr(c)||za(c)?c=f(c,s):c=Oc(c,o,s)),r(...u,n(c,l));function f(m,p){return m.compile().evaluate(p)}}return i.rawArgs=!0,i},{isTransformFunction:!0});function B3(t){return bt(t)?t-1:ot(t)?t.minus(1):t}function k3(t){return bt(t)||ot(t)}function Di(t){if(t.length===2&&rn(t[0])){t=t.slice();var e=t[1];k3(e)&&(t[1]=B3(e))}return t}var WQ="max",YQ=["typed","config","numeric","larger","isNaN"],P3=M(WQ,YQ,t=>{var{typed:e,config:r,numeric:n,larger:i,isNaN:a}=t,o=Pg({typed:e,config:r,numeric:n,larger:i,isNaN:a});return e("max",{"...any":function(l){l=Di(l);try{return o.apply(null,l)}catch(u){throw qr(u)}}})},{isTransformFunction:!0});var jQ="mean",ZQ=["typed","add","divide"],$3=M(jQ,ZQ,t=>{var{typed:e,add:r,divide:n}=t,i=lv({typed:e,add:r,divide:n});return e("mean",{"...any":function(o){o=Di(o);try{return i.apply(null,o)}catch(s){throw qr(s)}}})},{isTransformFunction:!0});var JQ="min",XQ=["typed","config","numeric","smaller","isNaN"],O3=M(JQ,XQ,t=>{var{typed:e,config:r,numeric:n,smaller:i,isNaN:a}=t,o=$g({typed:e,config:r,numeric:n,smaller:i,isNaN:a});return e("min",{"...any":function(l){l=Di(l);try{return o.apply(null,l)}catch(u){throw qr(u)}}})},{isTransformFunction:!0});var QQ="range",KQ=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],R3=M(QQ,KQ,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=t,f=_g({typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c});return e("range",{"...any":function(p){var d=p.length-1,h=p[d];return typeof h!="boolean"&&p.push(!0),f.apply(null,p)}})},{isTransformFunction:!0});var eK="row",tK=["typed","Index","matrix","range"],L3=M(eK,tK,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=Ag({typed:e,Index:r,matrix:n,range:i});return e("row",{"...any":function(s){var l=s.length-1,u=s[l];bt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw qr(c)}}})},{isTransformFunction:!0});var rK="subset",nK=["typed","matrix","zeros","add"],V3=M(rK,nK,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=Dg({typed:e,matrix:r,zeros:n,add:i});return e("subset",{"...any":function(s){try{return a.apply(null,s)}catch(l){throw qr(l)}}})},{isTransformFunction:!0});var iK="concat",aK=["typed","matrix","isInteger"],U3=M(iK,aK,t=>{var{typed:e,matrix:r,isInteger:n}=t,i=dg({typed:e,matrix:r,isInteger:n});return e("concat",{"...any":function(o){var s=o.length-1,l=o[s];bt(l)?o[s]=l-1:ot(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw qr(u)}}})},{isTransformFunction:!0});var q3="diff",oK=["typed","matrix","subtract","number","bignumber"],z3=M(q3,oK,t=>{var{typed:e,matrix:r,subtract:n,number:i,bignumber:a}=t,o=bg({typed:e,matrix:r,subtract:n,number:i,bignumber:a});return e(q3,{"...any":function(l){l=Di(l);try{return o.apply(null,l)}catch(u){throw qr(u)}}})},{isTransformFunction:!0});var sK="std",uK=["typed","map","sqrt","variance"],H3=M(sK,uK,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t,a=pv({typed:e,map:r,sqrt:n,variance:i});return e("std",{"...any":function(s){s=Di(s);try{return a.apply(null,s)}catch(l){throw qr(l)}}})},{isTransformFunction:!0});var G3="sum",lK=["typed","config","add","numeric"],W3=M(G3,lK,t=>{var{typed:e,config:r,add:n,numeric:i}=t,a=ov({typed:e,config:r,add:n,numeric:i});return e(G3,{"...any":function(s){s=Di(s);try{return a.apply(null,s)}catch(l){throw qr(l)}}})},{isTransformFunction:!0});var cK="quantileSeq",fK=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],Y3=M(cK,fK,t=>{var{typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m,mapSlices:p}=t,d=fv({typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m,mapSlices:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":d,"Array | Matrix, number | BigNumber, number":(b,y,D)=>d(b,y,h(D)),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(b,y,D,v)=>d(b,y,D,h(v)),"Array | Matrix, Array | Matrix":d,"Array | Matrix, Array | Matrix, number":(b,y,D)=>d(b,y,h(D)),"Array | Matrix, Array | Matrix, boolean":d,"Array | Matrix, Array | Matrix, boolean, number":(b,y,D,v)=>d(b,y,D,h(v))});function h(b){return Di([[],b])[1]}},{isTransformFunction:!0});var j3="cumsum",pK=["typed","add","unaryPlus"],Z3=M(j3,pK,t=>{var{typed:e,add:r,unaryPlus:n}=t,i=uv({typed:e,add:r,unaryPlus:n});return e(j3,{"...any":function(o){if(o.length===2&&rn(o[0])){var s=o[1];bt(s)?o[1]=s-1:ot(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw qr(l)}}})},{isTransformFunction:!0});var J3="variance",mK=["typed","add","subtract","multiply","divide","mapSlices","isNaN"],X3=M(J3,mK,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s}=t,l=cv({typed:e,add:r,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s});return e(J3,{"...any":function(c){c=Di(c);try{return l.apply(null,c)}catch(f){throw qr(f)}}})},{isTransformFunction:!0});var Q3="print",dK=["typed","matrix","zeros","add"],K3=M(Q3,dK,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=Eg({typed:e,matrix:r,zeros:n,add:i});return e(Q3,{"string, Object | Array":function(l,u){return a(o(l),u)},"string, Object | Array, number | Object":function(l,u,c){return a(o(l),u,c)}});function o(s){return s.replace(Sg,l=>{var u=l.slice(1).split("."),c=u.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var hK="and",gK=["typed","matrix","zeros","add","equalScalar","not","concat"],e4=M(hK,gK,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=Tg({typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var m=u[0].compile().evaluate(f);if(!rn(m)&&!s(m,!0))return!1;var p=u[1].compile().evaluate(f);return s(m,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var vK="or",yK=["typed","matrix","equalScalar","DenseMatrix","concat"],t4=M(vK,yK,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=mg({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!rn(f)&&o(f,!1))return!0;var m=l[1].compile().evaluate(c);return o(f,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var bK="bitAnd",xK=["typed","matrix","zeros","add","equalScalar","not","concat"],r4=M(bK,xK,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=fg({typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var m=u[0].compile().evaluate(f);if(!rn(m)){if(isNaN(m))return NaN;if(m===0||m===!1)return 0}var p=u[1].compile().evaluate(f);return s(m,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var wK="bitOr",_K=["typed","matrix","equalScalar","DenseMatrix","concat"],n4=M(wK,_K,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=pg({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!rn(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var m=l[1].compile().evaluate(c);return o(f,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var fw=cw;var u4=Tr(Ih(),1);var a4=Tr(i4(),1);function o4(t){var e=new a4.default;return t.on=e.on.bind(e),t.off=e.off.bind(e),t.once=e.once.bind(e),t.emit=e.emit.bind(e),t}function s4(t,e,r,n){function i(y,D){var v=arguments.length;if(v!==1&&v!==2)throw new Aa("import",v,1,2);D||(D={});function A(T,_,C){if(Array.isArray(_))_.forEach(R=>A(T,R));else if(ya(_)||f(_))for(var N in _)Ze(_,N)&&A(T,_[N],N);else if(ju(_)||C!==void 0){var I=ju(_)?h(_)?_.fn+".transform":_.fn:C;if(Ze(T,I)&&T[I]!==_&&!D.silent)throw new Error('Cannot import "'+I+'" twice');T[I]=_}else if(!D.silent)throw new TypeError("Factory, Object, or Array expected")}var w={};A(w,y);for(var x in w)if(Ze(w,x)){var E=w[x];if(ju(E))u(E,D);else if(c(E))a(x,E,D);else if(!D.silent)throw new TypeError("Factory, Object, or Array expected")}}function a(y,D,v){var A;if(v.wrap&&typeof D=="function"&&(D=l(D)),m(D)&&(D=t(y,{[D.signature]:D})),t.isTypedFunction(r[y])&&t.isTypedFunction(D)){v.override?D=t(y,D.signatures):D=t(r[y],D),r[y]=D,delete n[y],o(y,D),r.emit("import",y,function(){return D});return}var w=r[y]!==void 0,x=(A=r.Unit)===null||A===void 0?void 0:A.isValuelessUnit(y);if(!w&&!x||v.override){r[y]=D,delete n[y],o(y,D),r.emit("import",y,function(){return D});return}if(!v.silent)throw new Error('Cannot import "'+y+'": already exists')}function o(y,D){D&&typeof D.transform=="function"?(r.expression.transform[y]=D.transform,p(y)&&(r.expression.mathWithTransform[y]=D.transform)):(delete r.expression.transform[y],p(y)&&(r.expression.mathWithTransform[y]=D))}function s(y){delete r.expression.transform[y],p(y)?r.expression.mathWithTransform[y]=r[y]:delete r.expression.mathWithTransform[y]}function l(y){var D=function(){for(var A=[],w=0,x=arguments.length;w<x;w++){var E=arguments[w];A[w]=E&&E.valueOf()}return y.apply(r,A)};return y.transform&&(D.transform=y.transform),D}function u(y,D){var v,A,w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.fn;if(w.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(w));var x=h(y)?r.expression.transform:r,E=w in r.expression.transform,T=Ze(x,w)?x[w]:void 0,_=function(){var L={};y.dependencies.map(Dx).forEach(P=>{if(P.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(P));P==="math"?L.math=r:P==="mathWithTransform"?L.mathWithTransform=r.expression.mathWithTransform:P==="classes"?L.classes=r:L[P]=r[P]});var V=y(L);if(V&&typeof V.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(T===void 0||D.override)return V;if(t.isTypedFunction(T)&&t.isTypedFunction(V))return t(T,V);if(D.silent)return T;throw new Error('Cannot import "'+w+'": already exists')},C=(v=(A=y.meta)===null||A===void 0?void 0:A.formerly)!==null&&v!==void 0?v:"",N=h(y)||d(y),I=r.expression.mathWithTransform;!y.meta||y.meta.lazy!==!1?(_s(x,w,_),C&&_s(x,C,_),T&&E?(s(w),C&&s(C)):N&&(_s(I,w,()=>x[w]),C&&_s(I,C,()=>x[w]))):(x[w]=_(),C&&(x[C]=x[w]),T&&E?(s(w),C&&s(C)):N&&(_s(I,w,()=>x[w]),C&&_s(I,C,()=>x[w]))),n[w]=y,r.emit("import",w,_)}function c(y){return typeof y=="function"||typeof y=="number"||typeof y=="string"||typeof y=="boolean"||y===null||En(y)||Hn(y)||ot(y)||ba(y)||Ye(y)||Array.isArray(y)}function f(y){return typeof y=="object"&&y[Symbol.toStringTag]==="Module"}function m(y){return typeof y=="function"&&typeof y.signature=="string"}function p(y){return!Ze(b,y)}function d(y){return!y.fn.includes(".")&&!Ze(b,y.fn)&&(!y.meta||!y.meta.isClass)}function h(y){return y!==void 0&&y.meta!==void 0&&y.meta.isTransformFunction===!0||!1}var b={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function hv(t,e){var r=bn({},vh,e);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=o4({isNumber:bt,isComplex:Hn,isBigNumber:ot,isBigInt:Po,isFraction:ba,isUnit:En,isString:Jr,isArray:sr,isMatrix:Ye,isCollection:rn,isDenseMatrix:ws,isSparseMatrix:xa,isRange:tu,isIndex:$o,isBoolean:bh,isResultSet:xh,isHelp:mc,isFunction:wh,isDate:_h,isRegExp:Ah,isObject:ya,isMap:ko,isPartitionedMap:mS,isObjectWrappingMap:dS,isNull:Dh,isUndefined:Sh,isAccessorNode:$i,isArrayNode:Gn,isAssignmentNode:Eh,isBlockNode:Th,isConditionalNode:Mh,isConstantNode:kt,isFunctionAssignmentNode:za,isFunctionNode:ai,isIndexNode:Xi,isNode:Gt,isObjectNode:Oo,isOperatorNode:Rr,isParenthesisNode:Wn,isRangeNode:Ch,isRelationalNode:Nh,isSymbolNode:Mr,isChain:dc});n.config=_S(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(ju(c))return c(n);var f=c[Object.keys(c)[0]];if(ju(f))return f(n);if(!vS(c))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",c),new Error("Factory object with properties `type`, `name`, and `factory` expected");var m=i.indexOf(c),p;return m===-1?(c.math===!0?p=c.factory(n.type,r,o,n.typed,n):p=c.factory(n.type,r,o,n.typed),i.push(c),a.push(p)):p=a[m],p}var s={};function l(){for(var c=arguments.length,f=new Array(c),m=0;m<c;m++)f[m]=arguments[m];return n.typed.apply(n.typed,f)}l.isTypedFunction=u4.default.isTypedFunction;var u=s4(l,o,n,s);return n.import=u,n.on("config",()=>{Object.values(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=hv.bind(null,t),n.factory=M,n.import(Object.values(hS(t))),n.ArgumentsError=Aa,n.DimensionError=Et,n.IndexError=Zn,n}function l4(){return hv(fw,{})}var gv=class{constructor(){this.inputFieldParser=new oh(this),this.viewFieldParser=new dh(this),this.jsViewFieldParser=new sh(this),this.buttonParser=new Ld(this),this.bindTargetParser=new Nd(this),this.syntaxHighlighting=new tm(this),this.inputFieldFactory=new gd(this),this.viewFieldFactory=new wd(this),this.buttonActionRunner=new ym(this),this.buttonManager=new xm(this),this.metadataManager=new ec,this.mountableManager=new Cd,this.math=l4(),this.build="1.4.2".includes("canary")?"canary":"release"}setComponents(e){Object.assign(this,e)}setSettings(e){this.updateInternalSettings(e),this.saveSettings(e)}updateSettings(e){let r=this.getSettings();e(r),this.setSettings(r)}loadTemplates(){let e=this.getSettings(),r=this.inputFieldParser.parseTemplates(e.inputFieldTemplates);r.hasErrors()&&console.warn("meta-bind | failed to parse input field templates",r);let n=this.buttonManager.setButtonTemplates(e.buttonTemplates);n.hasErrors()&&console.warn("meta-bind | failed to parse button templates",n)}updateInternalSettings(e){Kn.dateFormat=e.preferredDateFormat,aS(e.firstWeekday),this.loadTemplates()}destroy(){this.mountableManager.unload()}};var Lc=class{constructor(e,r){this.id=e,this.manager=r,this.cache=new Map}validateStoragePath(e,r,n,i){return i.validateStoragePathAsFilePath(e,n)}resolveBindTargetScope(e,r,n){return e}getOrCreateCacheItem(e){let r=this.getCacheItemForStoragePath(e);return r===void 0&&(r=this.getDefaultCacheItem(e),this.cache.set(e,r)),r}subscribe(e){if(e.bindTarget===void 0)throw new Lt({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let r=this.getOrCreateCacheItem(e.bindTarget.storagePath);return r.subscriptions.push(e),r}unsubscribe(e){if(e.bindTarget===void 0)throw new Lt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"subscription bind target undefined"});let r=this.cache.get(e.bindTarget.storagePath);if(r===void 0)throw new Lt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return r.subscriptions=r.subscriptions.filter(n=>n.uuid!==e.uuid),r}getCacheItemForStoragePath(e){return this.cache.get(e)}onCycle(e){}iterateCacheItems(){return this.cache.values()}shouldDelete(e){return!0}deleteCache(e){this.cache.delete(e.storagePath)}writeCache(e,r){let n=this.getOrCreateCacheItem(r.storagePath);return mo.setAndCreate(n.data,r.storageProp,e),n}writeEntireCache(e,r){r.data=e}readCache(e){if(e.storageType!==this.id)throw new Lt({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let r=this.getCacheItemForStoragePath(e.storagePath);return r===void 0?mo.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(r,e.storageProp)}readCacheItem(e,r){return mo.tryGet(e.data,r)}readEntireCacheItem(e){return e.data}};var vv=class extends Lc{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}syncExternal(e){}};var yv=class{constructor(e,r){this.id=e,this.manager=r,this.cache={data:{},...this.manager.getDefaultCacheItem()}}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,r,n,i){if(r)throw new Nn("ERROR","Bind target validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){return this.cache}iterateCacheItems(){return[this.cache][Symbol.iterator]()}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,r){return mo.tryGet(e.data,r)}shouldDelete(e){return!1}subscribe(e){return this.cache.subscriptions.push(e),this.cache}syncExternal(e){}unsubscribe(e){return this.cache.subscriptions=this.cache.subscriptions.filter(r=>r.uuid!==e.uuid),this.cache}writeCache(e,r){return mo.setAndCreate(this.cache.data,r.storageProp,e),this.cache}writeEntireCache(e,r){r.data=e}readEntireCacheItem(e){return e.data}},bv=class{constructor(e,r){this.id=e,this.manager=r}getOrCreateCacheItem(e){throw new Lt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,r,n,i){if(r)throw new Nn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,r){}shouldDelete(e){return!0}subscribe(e){throw new Lt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Lt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,r){throw new Lt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,r){}readEntireCacheItem(e){throw new Lt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};function xv(t){var e=t.statementIndent,r=t.jsonld,n=t.json||r,i=t.typescript,a=t.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function z(Mn){return{type:Mn,style:"keyword"}}var te=z("keyword a"),Ce=z("keyword b"),je=z("keyword c"),Ue=z("keyword d"),Rt=z("operator"),Fr={type:"atom",style:"atom"};return{if:z("if"),while:te,with:te,else:Ce,do:Ce,try:Ce,finally:Ce,return:Ue,break:Ue,continue:Ue,new:z("new"),delete:je,void:je,throw:je,debugger:z("debugger"),var:z("var"),const:z("var"),let:z("var"),function:z("function"),catch:z("catch"),for:z("for"),switch:z("switch"),case:z("case"),default:z("default"),in:Rt,typeof:Rt,instanceof:Rt,true:Fr,false:Fr,null:Fr,undefined:Fr,NaN:Fr,Infinity:Fr,this:z("this"),class:z("class"),super:z("atom"),yield:je,export:z("export"),import:z("import"),extends:je,await:je}}(),s=/[+\-*&%=<>!?|~^@]/,l=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function u(z){for(var te=!1,Ce,je=!1;(Ce=z.next())!=null;){if(!te){if(Ce=="/"&&!je)return;Ce=="["?je=!0:je&&Ce=="]"&&(je=!1)}te=!te&&Ce=="\\"}}var c,f;function m(z,te,Ce){return c=z,f=Ce,te}function p(z,te){var Ce=z.next();if(Ce=='"'||Ce=="'")return te.tokenize=d(Ce),te.tokenize(z,te);if(Ce=="."&&z.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return m("number","number");if(Ce=="."&&z.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ce))return m(Ce);if(Ce=="="&&z.eat(">"))return m("=>","operator");if(Ce=="0"&&z.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return m("number","number");if(/\d/.test(Ce))return z.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),m("number","number");if(Ce=="/")return z.eat("*")?(te.tokenize=h,h(z,te)):z.eat("/")?(z.skipToEnd(),m("comment","comment")):Qr(z,te,1)?(u(z),z.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string.special")):(z.eat("="),m("operator","operator",z.current()));if(Ce=="`")return te.tokenize=b,b(z,te);if(Ce=="#"&&z.peek()=="!")return z.skipToEnd(),m("meta","meta");if(Ce=="#"&&z.eatWhile(a))return m("variable","property");if(Ce=="<"&&z.match("!--")||Ce=="-"&&z.match("->")&&!/\S/.test(z.string.slice(0,z.start)))return z.skipToEnd(),m("comment","comment");if(s.test(Ce))return(Ce!=">"||!te.lexical||te.lexical.type!=">")&&(z.eat("=")?(Ce=="!"||Ce=="=")&&z.eat("="):/[<>*+\-|&?]/.test(Ce)&&(z.eat(Ce),Ce==">"&&z.eat(Ce))),Ce=="?"&&z.eat(".")?m("."):m("operator","operator",z.current());if(a.test(Ce)){z.eatWhile(a);var je=z.current();if(te.lastType!="."){if(o.propertyIsEnumerable(je)){var Ue=o[je];return m(Ue.type,Ue.style,je)}if(je=="async"&&z.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",je)}return m("variable","variable",je)}}function d(z){return function(te,Ce){var je=!1,Ue;if(r&&te.peek()=="@"&&te.match(l))return Ce.tokenize=p,m("jsonld-keyword","meta");for(;(Ue=te.next())!=null&&!(Ue==z&&!je);)je=!je&&Ue=="\\";return je||(Ce.tokenize=p),m("string","string")}}function h(z,te){for(var Ce=!1,je;je=z.next();){if(je=="/"&&Ce){te.tokenize=p;break}Ce=je=="*"}return m("comment","comment")}function b(z,te){for(var Ce=!1,je;(je=z.next())!=null;){if(!Ce&&(je=="`"||je=="$"&&z.eat("{"))){te.tokenize=p;break}Ce=!Ce&&je=="\\"}return m("quasi","string.special",z.current())}var y="([{}])";function D(z,te){te.fatArrowAt&&(te.fatArrowAt=null);var Ce=z.string.indexOf("=>",z.start);if(!(Ce<0)){if(i){var je=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(z.string.slice(z.start,Ce));je&&(Ce=je.index)}for(var Ue=0,Rt=!1,Fr=Ce-1;Fr>=0;--Fr){var Mn=z.string.charAt(Fr),Cn=y.indexOf(Mn);if(Cn>=0&&Cn<3){if(!Ue){++Fr;break}if(--Ue==0){Mn=="("&&(Rt=!0);break}}else if(Cn>=3&&Cn<6)++Ue;else if(a.test(Mn))Rt=!0;else if(/["'\/`]/.test(Mn))for(;;--Fr){if(Fr==0)return;var Wo=z.string.charAt(Fr-1);if(Wo==Mn&&z.string.charAt(Fr-2)!="\\"){Fr--;break}}else if(Rt&&!Ue){++Fr;break}}Rt&&!Ue&&(te.fatArrowAt=Fr)}}var v={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function A(z,te,Ce,je,Ue,Rt){this.indented=z,this.column=te,this.type=Ce,this.prev=Ue,this.info=Rt,je!=null&&(this.align=je)}function w(z,te){for(var Ce=z.localVars;Ce;Ce=Ce.next)if(Ce.name==te)return!0;for(var je=z.context;je;je=je.prev)for(var Ce=je.vars;Ce;Ce=Ce.next)if(Ce.name==te)return!0}function x(z,te,Ce,je,Ue){var Rt=z.cc;for(E.state=z,E.stream=Ue,E.marked=null,E.cc=Rt,E.style=te,z.lexical.hasOwnProperty("align")||(z.lexical.align=!0);;){var Fr=Rt.length?Rt.pop():n?xe:U;if(Fr(Ce,je)){for(;Rt.length&&Rt[Rt.length-1].lex;)Rt.pop()();return E.marked?E.marked:Ce=="variable"&&w(z,je)?"variableName.local":te}}}var E={state:null,column:null,marked:null,cc:null};function T(){for(var z=arguments.length-1;z>=0;z--)E.cc.push(arguments[z])}function _(){return T.apply(null,arguments),!0}function C(z,te){for(var Ce=te;Ce;Ce=Ce.next)if(Ce.name==z)return!0;return!1}function N(z){var te=E.state;if(E.marked="def",te.context){if(te.lexical.info=="var"&&te.context&&te.context.block){var Ce=I(z,te.context);if(Ce!=null){te.context=Ce;return}}else if(!C(z,te.localVars)){te.localVars=new V(z,te.localVars);return}}t.globalVars&&!C(z,te.globalVars)&&(te.globalVars=new V(z,te.globalVars))}function I(z,te){if(te)if(te.block){var Ce=I(z,te.prev);return Ce?Ce==te.prev?te:new L(Ce,te.vars,!0):null}else return C(z,te.vars)?te:new L(te.prev,new V(z,te.vars),!1);else return null}function R(z){return z=="public"||z=="private"||z=="protected"||z=="abstract"||z=="readonly"}function L(z,te,Ce){this.prev=z,this.vars=te,this.block=Ce}function V(z,te){this.name=z,this.next=te}var P=new V("this",new V("arguments",null));function k(){E.state.context=new L(E.state.context,E.state.localVars,!1),E.state.localVars=P}function W(){E.state.context=new L(E.state.context,E.state.localVars,!0),E.state.localVars=null}k.lex=W.lex=!0;function O(){E.state.localVars=E.state.context.vars,E.state.context=E.state.context.prev}O.lex=!0;function Q(z,te){var Ce=function(){var je=E.state,Ue=je.indented;if(je.lexical.type=="stat")Ue=je.lexical.indented;else for(var Rt=je.lexical;Rt&&Rt.type==")"&&Rt.align;Rt=Rt.prev)Ue=Rt.indented;je.lexical=new A(Ue,E.stream.column(),z,null,je.lexical,te)};return Ce.lex=!0,Ce}function ne(){var z=E.state;z.lexical.prev&&(z.lexical.type==")"&&(z.indented=z.lexical.indented),z.lexical=z.lexical.prev)}ne.lex=!0;function X(z){function te(Ce){return Ce==z?_():z==";"||Ce=="}"||Ce==")"||Ce=="]"?T():_(te)}return te}function U(z,te){return z=="var"?_(Q("vardef",te),hr,X(";"),ne):z=="keyword a"?_(Q("form"),be,U,ne):z=="keyword b"?_(Q("form"),U,ne):z=="keyword d"?E.stream.match(/^\s*$/,!1)?_():_(Q("stat"),Z,X(";"),ne):z=="debugger"?_(X(";")):z=="{"?_(Q("}"),W,Wt,ne,O):z==";"?_():z=="if"?(E.state.lexical.info=="else"&&E.state.cc[E.state.cc.length-1]==ne&&E.state.cc.pop()(),_(Q("form"),be,U,ne,lr)):z=="function"?_(Ca):z=="for"?_(Q("form"),W,Is,U,O,ne):z=="class"||i&&te=="interface"?(E.marked="keyword",_(Q("form",z=="class"?z:te),nn,ne)):z=="variable"?i&&te=="declare"?(E.marked="keyword",_(U)):i&&(te=="module"||te=="enum"||te=="type")&&E.stream.match(/^\s*\w/,!1)?(E.marked="keyword",te=="enum"?_(dl):te=="type"?_(_n,X("operator"),pe,X(";")):_(Q("form"),Ve,X("{"),Q("}"),Wt,ne,ne)):i&&te=="namespace"?(E.marked="keyword",_(Q("form"),xe,U,ne)):i&&te=="abstract"?(E.marked="keyword",_(U)):_(Q("stat"),De):z=="switch"?_(Q("form"),be,X("{"),Q("}","switch"),W,Wt,ne,ne,O):z=="case"?_(xe,X(":")):z=="default"?_(X(":")):z=="catch"?_(Q("form"),k,fe,U,ne,O):z=="export"?_(Q("stat"),Wc,ne):z=="import"?_(Q("stat"),Ho,ne):z=="async"?_(U):te=="@"?_(xe,U):T(Q("stat"),xe,X(";"),ne)}function fe(z){if(z=="(")return _($n,X(")"))}function xe(z,te){return ee(z,te,!1)}function oe(z,te){return ee(z,te,!0)}function be(z){return z!="("?T():_(Q(")"),Z,X(")"),ne)}function ee(z,te,Ce){if(E.state.fatArrowAt==E.stream.start){var je=Ce?G:we;if(z=="(")return _(k,Q(")"),qe($n,")"),ne,X("=>"),je,O);if(z=="variable")return T(k,Ve,X("=>"),je,O)}var Ue=Ce?me:re;return v.hasOwnProperty(z)?_(Ue):z=="function"?_(Ca,Ue):z=="class"||i&&te=="interface"?(E.marked="keyword",_(Q("form"),Li,ne)):z=="keyword c"||z=="async"?_(Ce?oe:xe):z=="("?_(Q(")"),Z,X(")"),ne,Ue):z=="operator"||z=="spread"?_(Ce?oe:xe):z=="["?_(Q("]"),ml,ne,Ue):z=="{"?rr(Oe,"}",null,Ue):z=="quasi"?T(ce,Ue):z=="new"?_(J(Ce)):_()}function Z(z){return z.match(/[;\}\)\],]/)?T():T(xe)}function re(z,te){return z==","?_(Z):me(z,te,!1)}function me(z,te,Ce){var je=Ce==!1?re:me,Ue=Ce==!1?xe:oe;if(z=="=>")return _(k,Ce?G:we,O);if(z=="operator")return/\+\+|--/.test(te)||i&&te=="!"?_(je):i&&te=="<"&&E.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?_(Q(">"),qe(pe,">"),ne,je):te=="?"?_(xe,X(":"),Ue):_(Ue);if(z=="quasi")return T(ce,je);if(z!=";"){if(z=="(")return rr(oe,")","call",je);if(z==".")return _(Ie,je);if(z=="[")return _(Q("]"),Z,X("]"),ne,je);if(i&&te=="as")return E.marked="keyword",_(pe,je);if(z=="regexp")return E.state.lastType=E.marked="operator",E.stream.backUp(E.stream.pos-E.stream.start-1),_(Ue)}}function ce(z,te){return z!="quasi"?T():te.slice(te.length-2)!="${"?_(ce):_(Z,Ae)}function Ae(z){if(z=="}")return E.marked="string.special",E.state.tokenize=b,_(ce)}function we(z){return D(E.stream,E.state),T(z=="{"?U:xe)}function G(z){return D(E.stream,E.state),T(z=="{"?U:oe)}function J(z){return function(te){return te=="."?_(z?ye:ge):te=="variable"&&i?_(Me,z?me:re):T(z?oe:xe)}}function ge(z,te){if(te=="target")return E.marked="keyword",_(re)}function ye(z,te){if(te=="target")return E.marked="keyword",_(me)}function De(z){return z==":"?_(ne,U):T(re,X(";"),ne)}function Ie(z){if(z=="variable")return E.marked="property",_()}function Oe(z,te){if(z=="async")return E.marked="property",_(Oe);if(z=="variable"||E.style=="keyword"){if(E.marked="property",te=="get"||te=="set")return _(Je);var Ce;return i&&E.state.fatArrowAt==E.stream.start&&(Ce=E.stream.match(/^\s*:\s*/,!1))&&(E.state.fatArrowAt=E.stream.pos+Ce[0].length),_(wt)}else{if(z=="number"||z=="string")return E.marked=r?"property":E.style+" property",_(wt);if(z=="jsonld-keyword")return _(wt);if(i&&R(te))return E.marked="keyword",_(Oe);if(z=="[")return _(xe,pr,X("]"),wt);if(z=="spread")return _(oe,wt);if(te=="*")return E.marked="keyword",_(Oe);if(z==":")return T(wt)}}function Je(z){return z!="variable"?T(wt):(E.marked="property",_(Ca))}function wt(z){if(z==":")return _(oe);if(z=="(")return T(Ca)}function qe(z,te,Ce){function je(Ue,Rt){if(Ce?Ce.indexOf(Ue)>-1:Ue==","){var Fr=E.state.lexical;return Fr.info=="call"&&(Fr.pos=(Fr.pos||0)+1),_(function(Mn,Cn){return Mn==te||Cn==te?T():T(z)},je)}return Ue==te||Rt==te?_():Ce&&Ce.indexOf(";")>-1?T(z):_(X(te))}return function(Ue,Rt){return Ue==te||Rt==te?_():T(z,je)}}function rr(z,te,Ce){for(var je=3;je<arguments.length;je++)E.cc.push(arguments[je]);return _(Q(te,Ce),qe(z,te),ne)}function Wt(z){return z=="}"?_():T(U,Wt)}function pr(z,te){if(i){if(z==":")return _(pe);if(te=="?")return _(pr)}}function Pe(z,te){if(i&&(z==":"||te=="in"))return _(pe)}function j(z){if(i&&z==":")return E.stream.match(/^\s*\w+\s+is\b/,!1)?_(xe,de,pe):_(pe)}function de(z,te){if(te=="is")return E.marked="keyword",_()}function pe(z,te){if(te=="keyof"||te=="typeof"||te=="infer"||te=="readonly")return E.marked="keyword",_(te=="typeof"?oe:pe);if(z=="variable"||te=="void")return E.marked="type",_(ie);if(te=="|"||te=="&")return _(pe);if(z=="string"||z=="number"||z=="atom")return _(ie);if(z=="[")return _(Q("]"),qe(pe,"]",","),ne,ie);if(z=="{")return _(Q("}"),Be,ne,ie);if(z=="(")return _(qe(Y,")"),Ne,ie);if(z=="<")return _(qe(pe,">"),pe);if(z=="quasi")return T(Ge,ie)}function Ne(z){if(z=="=>")return _(pe)}function Be(z){return z.match(/[\}\)\]]/)?_():z==","||z==";"?_(Be):T(_e,Be)}function _e(z,te){if(z=="variable"||E.style=="keyword")return E.marked="property",_(_e);if(te=="?"||z=="number"||z=="string")return _(_e);if(z==":")return _(pe);if(z=="[")return _(X("variable"),Pe,X("]"),_e);if(z=="(")return T(ia,_e);if(!z.match(/[;\}\)\],]/))return _()}function Ge(z,te){return z!="quasi"?T():te.slice(te.length-2)!="${"?_(Ge):_(pe,F)}function F(z){if(z=="}")return E.marked="string.special",E.state.tokenize=b,_(Ge)}function Y(z,te){return z=="variable"&&E.stream.match(/^\s*[?:]/,!1)||te=="?"?_(Y):z==":"?_(pe):z=="spread"?_(Y):T(pe)}function ie(z,te){if(te=="<")return _(Q(">"),qe(pe,">"),ne,ie);if(te=="|"||z=="."||te=="&")return _(pe);if(z=="[")return _(pe,X("]"),ie);if(te=="extends"||te=="implements")return E.marked="keyword",_(pe);if(te=="?")return _(pe,X(":"),pe)}function Me(z,te){if(te=="<")return _(Q(">"),qe(pe,">"),ne,ie)}function Qe(){return T(pe,gt)}function gt(z,te){if(te=="=")return _(pe)}function hr(z,te){return te=="enum"?(E.marked="keyword",_(dl)):T(Ve,pr,Xr,Pn)}function Ve(z,te){if(i&&R(te))return E.marked="keyword",_(Ve);if(z=="variable")return N(te),_();if(z=="spread")return _(Ve);if(z=="[")return rr(Si,"]");if(z=="{")return rr(si,"}")}function si(z,te){return z=="variable"&&!E.stream.match(/^\s*:/,!1)?(N(te),_(Xr)):(z=="variable"&&(E.marked="property"),z=="spread"?_(Ve):z=="}"?T():z=="["?_(xe,X("]"),X(":"),si):_(X(":"),Ve,Xr))}function Si(){return T(Ve,Xr)}function Xr(z,te){if(te=="=")return _(oe)}function Pn(z){if(z==",")return _(hr)}function lr(z,te){if(z=="keyword b"&&te=="else")return _(Q("form","else"),U,ne)}function Is(z,te){if(te=="await")return _(Is);if(z=="(")return _(Q(")"),Nr,ne)}function Nr(z){return z=="var"?_(hr,Ri):z=="variable"?_(Ri):T(Ri)}function Ri(z,te){return z==")"?_():z==";"?_(Ri):te=="in"||te=="of"?(E.marked="keyword",_(xe,Ri)):T(xe,Ri)}function Ca(z,te){if(te=="*")return E.marked="keyword",_(Ca);if(z=="variable")return N(te),_(Ca);if(z=="(")return _(k,Q(")"),qe($n,")"),ne,j,U,O);if(i&&te=="<")return _(Q(">"),qe(Qe,">"),ne,Ca)}function ia(z,te){if(te=="*")return E.marked="keyword",_(ia);if(z=="variable")return N(te),_(ia);if(z=="(")return _(k,Q(")"),qe($n,")"),ne,j,O);if(i&&te=="<")return _(Q(">"),qe(Qe,">"),ne,ia)}function _n(z,te){if(z=="keyword"||z=="variable")return E.marked="type",_(_n);if(te=="<")return _(Q(">"),qe(Qe,">"),ne)}function $n(z,te){return te=="@"&&_(xe,$n),z=="spread"?_($n):i&&R(te)?(E.marked="keyword",_($n)):i&&z=="this"?_(pr,Xr):T(Ve,pr,Xr)}function Li(z,te){return z=="variable"?nn(z,te):Xn(z,te)}function nn(z,te){if(z=="variable")return N(te),_(Xn)}function Xn(z,te){if(te=="<")return _(Q(">"),qe(Qe,">"),ne,Xn);if(te=="extends"||te=="implements"||i&&z==",")return te=="implements"&&(E.marked="keyword"),_(i?pe:xe,Xn);if(z=="{")return _(Q("}"),An,ne)}function An(z,te){if(z=="async"||z=="variable"&&(te=="static"||te=="get"||te=="set"||i&&R(te))&&E.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return E.marked="keyword",_(An);if(z=="variable"||E.style=="keyword")return E.marked="property",_(Vi,An);if(z=="number"||z=="string")return _(Vi,An);if(z=="[")return _(xe,pr,X("]"),Vi,An);if(te=="*")return E.marked="keyword",_(An);if(i&&z=="(")return T(ia,An);if(z==";"||z==",")return _(An);if(z=="}")return _();if(te=="@")return _(xe,An)}function Vi(z,te){if(te=="!"||te=="?")return _(Vi);if(z==":")return _(pe,Xr);if(te=="=")return _(oe);var Ce=E.state.lexical.prev,je=Ce&&Ce.info=="interface";return T(je?ia:Ca)}function Wc(z,te){return te=="*"?(E.marked="keyword",_(Ka,X(";"))):te=="default"?(E.marked="keyword",_(xe,X(";"))):z=="{"?_(qe(fl,"}"),Ka,X(";")):T(U)}function fl(z,te){if(te=="as")return E.marked="keyword",_(X("variable"));if(z=="variable")return T(oe,fl)}function Ho(z){return z=="string"?_():z=="("?T(xe):z=="."?T(re):T(Go,pl,Ka)}function Go(z,te){return z=="{"?rr(Go,"}"):(z=="variable"&&N(te),te=="*"&&(E.marked="keyword"),_(wo))}function pl(z){if(z==",")return _(Go,pl)}function wo(z,te){if(te=="as")return E.marked="keyword",_(Go)}function Ka(z,te){if(te=="from")return E.marked="keyword",_(xe)}function ml(z){return z=="]"?_():T(qe(oe,"]"))}function dl(){return T(Q("form"),Ve,X("{"),Q("}"),qe(Yc,"}"),ne,ne)}function Yc(){return T(Ve,Xr)}function jc(z,te){return z.lastType=="operator"||z.lastType==","||s.test(te.charAt(0))||/[,.]/.test(te.charAt(0))}function Qr(z,te,Ce){return te.tokenize==p&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(te.lastType)||te.lastType=="quasi"&&/\{\s*$/.test(z.string.slice(0,z.pos-(Ce||0)))}return{name:t.name,startState:function(z){var te={tokenize:p,lastType:"sof",cc:[],lexical:new A(-z,0,"block",!1),localVars:t.localVars,context:t.localVars&&new L(null,null,!1),indented:0};return t.globalVars&&typeof t.globalVars=="object"&&(te.globalVars=t.globalVars),te},token:function(z,te){if(z.sol()&&(te.lexical.hasOwnProperty("align")||(te.lexical.align=!1),te.indented=z.indentation(),D(z,te)),te.tokenize!=h&&z.eatSpace())return null;var Ce=te.tokenize(z,te);return c=="comment"?Ce:(te.lastType=c=="operator"&&(f=="++"||f=="--")?"incdec":c,x(te,Ce,c,f,z))},indent:function(z,te,Ce){if(z.tokenize==h||z.tokenize==b)return null;if(z.tokenize!=p)return 0;var je=te&&te.charAt(0),Ue=z.lexical,Rt;if(!/^\s*else\b/.test(te))for(var Fr=z.cc.length-1;Fr>=0;--Fr){var Mn=z.cc[Fr];if(Mn==ne)Ue=Ue.prev;else if(Mn!=lr&&Mn!=O)break}for(;(Ue.type=="stat"||Ue.type=="form")&&(je=="}"||(Rt=z.cc[z.cc.length-1])&&(Rt==re||Rt==me)&&!/^[,\.=+\-*:?[\(]/.test(te));)Ue=Ue.prev;e&&Ue.type==")"&&Ue.prev.type=="stat"&&(Ue=Ue.prev);var Cn=Ue.type,Wo=je==Cn;return Cn=="vardef"?Ue.indented+(z.lastType=="operator"||z.lastType==","?Ue.info.length+1:0):Cn=="form"&&je=="{"?Ue.indented:Cn=="form"?Ue.indented+Ce.unit:Cn=="stat"?Ue.indented+(jc(z,te)?e||Ce.unit:0):Ue.info=="switch"&&!Wo&&t.doubleIndentSwitch!=!1?Ue.indented+(/^(?:case|default)\b/.test(te)?Ce.unit:2*Ce.unit):Ue.align?Ue.column+(Wo?0:1):Ue.indented+(Wo?0:Ce.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:n?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var lp=xv({name:"javascript"}),vat=xv({name:"json",json:!0}),yat=xv({name:"json",jsonld:!0}),bat=xv({name:"typescript",typescript:!0});var DK=["true","false","on","off","yes","no"],SK=new RegExp("\\b(("+DK.join(")|(")+"))$","i"),cp={name:"yaml",token:function(t,e){var r=t.peek(),n=e.escaped;if(e.escaped=!1,r=="#"&&(t.pos==0||/\s/.test(t.string.charAt(t.pos-1))))return t.skipToEnd(),"comment";if(t.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&t.indentation()>e.keyCol)return t.skipToEnd(),"string";if(e.literal&&(e.literal=!1),t.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,t.match("---")||t.match("..."))return"def";if(t.match(/^\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return r=="{"?e.inlinePairs++:r=="}"?e.inlinePairs--:r=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&r==",")return t.next(),"meta";if(e.inlinePairs>0&&!n&&r==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,t.next(),"meta";if(e.pairStart){if(t.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&t.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(t.match(SK))return"keyword"}return!e.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=t.indentation(),"atom"):e.pair&&t.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=r=="\\",t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function c4(t){if(!t.getSettings().enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",r=>({startState:()=>cp.startState?.(4),blankLine:i=>cp.blankLine?.(i,4),copyState:i=>cp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${cp.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",r=>({startState:()=>lp.startState?.(4),blankLine:i=>lp.blankLine?.(i,4),copyState:i=>lp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${lp.token?.(i,a)}`}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",r=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let l=[i.string],u=1,c=i.lookAhead(u);for(;c!==void 0&&!e.test(c)&&(l.push(c),u+=1,c=i.lookAhead(u),!(u>100)););a.str=l.filter(m=>m.trim()!=="").join(`
`);let f=t.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new ts(a.str,[]):(a.fieldType=f,a.highlights=t.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let s=a.highlights.getHighlights().filter(l=>l.range.from.line===a.line).find(l=>l.range.from.column===i.pos+1);return s===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<s.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${s.tokenClass}`)}}))}var dw=require("@codemirror/language"),sl=require("@codemirror/view");var wv=require("obsidian");var f4=require("obsidian");var Cs=class{static checkSelectionOverlap(e,r,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=r&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,r,n,i){return e<=i&&n<=r}static getContent(e,r,n){return e.sliceDoc(r,n)}static getCurrentFile(e){return e.state.field(f4.editorInfoField).file}static existsDecorationBetween(e,r,n){let i=!1;return e.between(r,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,r,n,i){let a=!1;return e.between(n,i,(o,s,l)=>{l.spec.mb_widgetType===r&&(a=!0)}),a}};function p4(t){return sl.ViewPlugin.fromClass(class{constructor(e){this.component=new wv.Component,this.component.load(),this.decorations=this.renderWidgets(e)??sl.Decoration.none,e.dom.addEventListener("click",r=>this.handleClick(r))}handleClick(e){if(e.target instanceof HTMLElement){let r=e.target;for(;r!==null;){if(r.classList.contains("mb-input")){e.stopPropagation();break}r=r.parentElement}}}isLivePreview(e){return e.field(wv.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(r,n,i)=>xA.anyMatch(e.visibleRanges,o=>Cs.checkRangeOverlap(r,n,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:r,to:n}of e.visibleRanges)(0,dw.syntaxTree)(e.state).iterate({from:r,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,r){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,filterTo:i,filter:(o,s,l)=>{let u=l.spec;return r&&u.mb_widgetType===r?!0:(u.mb_unload?.(),!1)}})})}addDecoration(e,r,n,i,a){let o=e.from-1,s=e.to+1;if(Cs.existsDecorationOfTypeBetween(this.decorations,n,o,s))return;let l=Cs.getCurrentFile(r);if(!l)return;let u=this.renderWidget(e,a,n,i,l),c=Array.isArray(u)?u:[u];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,r){let n=new Set(r.type.name?.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let i=Cs.checkSelectionOverlap(e.state.selection,r.from-1,r.to+1),a=this.readNode(e,r.from,r.to),o=this.isLivePreview(e.state),s=!i&&o;return{shouldRender:s,shouldHighlight:!s&&t.getSettings().enableSyntaxHighlighting,content:a.content,widgetType:a.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,r,n){let i=Cs.getContent(e.state,r,n);return{content:i,widgetType:t.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let r=Cs.getCurrentFile(e);if(!r)return;let n=[];for(let i of e.visibleRanges)(0,dw.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,s=this.getRenderInfo(e,o);if(!s.widgetType||!s.content)return;let l;s.shouldRender&&(l=this.renderWidget(o,s.widgetType,"field",s.content,r)),s.shouldHighlight&&(l=this.renderWidget(o,s.widgetType,"highlight",s.content,r)),l&&(Array.isArray(l)?n.push(...l):n.push(l))}});return sl.Decoration.set(n,!0)}renderWidget(e,r,n,i,a){if(n==="field"){let o=t.api.constructMDRCWidget(r,i,a.path,this.component);return sl.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return t.syntaxHighlighting.highlight(i,r,!1).getHighlights().map(s=>sl.Decoration.mark({class:`mb-highlight-${s.tokenClass}`}).range(e.from+s.range.from.index,e.from+s.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var m4=require("obsidian");var fp=Tr(oa()),pp=Tr(qi());var EK=pp.P.sequenceMap((t,e,r,n)=>{let i=parseInt(t),a=parseInt(e),o=parseInt(r);return new Qa(i,a,o,n)},fp.P_UTILS.digits().skip(pp.P.string(".")),fp.P_UTILS.digits().skip(pp.P.string(".")),fp.P_UTILS.digits(),pp.P.string("-").then(fp.P_UTILS.remaining()).optional()),Qa=class t{constructor(e,r,n,i){this.major=e,this.minor=r,this.patch=n,this.prerelease=i}static fromString(e){return on(EK,e)}static lessThan(e,r){return e.major<r.major?!0:e.major>r.major?!1:e.minor<r.minor?!0:e.minor>r.minor?!1:e.patch<r.patch?!0:e.patch>r.patch||e.prerelease===void 0?!1:r.prerelease===void 0?!0:e.prerelease<r.prerelease}static greaterThan(e,r){return t.lessThan(r,e)}static equals(e,r){return e.major===r.major&&e.minor===r.minor&&e.patch===r.patch&&e.prerelease===r.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var _v=class{constructor(e,r){this.mb=e,this.dependencies=r}getDependency(e){let r=this.dependencies.find(n=>n.pluginId===e);if(r===void 0)throw new tf({errorLevel:"CRITICAL",effect:"Dependency violation detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return r}getPlugin(e){return this.mb.app.plugins.getPlugin(e)}throwPluginNotFound(e){this.throwDependencyError(`Plugin ${e} is required, but not installed. Please install the plugin.`)}throwDependencyError(e){throw new m4.Notice(`meta-bind | Dependency Error: ${e}`,0),new tf({errorLevel:"ERROR",effect:"Dependency violation detected",cause:e})}checkDependencyVersion(e,r){Qa.lessThan(r,e.minVersion)&&this.throwDependencyError(`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${r}. Please update the plugin.`),e.maxVersion!==void 0&&(Qa.greaterThan(r,e.maxVersion)||Qa.equals(r,e.maxVersion))&&this.throwDependencyError(`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${r}. Please downgrade the plugin.`)}checkDependency(e){let r=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Qa.fromString(n.manifest.version);return this.checkDependencyVersion(r,i),n}};var y4=require("obsidian");var d4={date:"date",datePicker:"datePicker",dateTime:"dateTime",editor:"editor",imageSuggester:'imageSuggester(optionQuery(""))',imageListSuggester:'imageListSuggester(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",invalid:""},hw={image:[{title:"Image",declaration:"VIEW[{globalMemory^MB_VF_image_example}][image]",display:"VIEW[{imageExampleProperty}][image]",inputField:'INPUT[imageSuggester(optionQuery("")):globalMemory^MB_VF_image_example]'}],link:[{title:"Link",declaration:"VIEW[{globalMemory^MB_VF_link_example}][link]",display:"VIEW[{linkExampleProperty}][link]",inputField:'INPUT[suggester(optionQuery("")):globalMemory^MB_VF_link_example]'}],math:[{title:"Math",declaration:"VIEW[{globalMemory^MB_VF_math_example} + 2][math]",display:"VIEW[{mathExampleProperty} + 2][math]",inputField:"INPUT[number:globalMemory^MB_VF_math_example]"}],text:[{title:"Text",declaration:"VIEW[some text {globalMemory^MB_VF_text_example}][text]",display:"VIEW[some text {textExampleProperty}][text]",inputField:"INPUT[text:globalMemory^MB_VF_text_example]"},{title:"Markdown",declaration:"VIEW[**some markdown** {globalMemory^MB_VF_text_markdown_example}][text(renderMarkdown)]",display:"VIEW[**some markdown** {markdownExampleProperty}][text(renderMarkdown)]",inputField:"INPUT[text:globalMemory^MB_VF_text_markdown_example]"}],invalid:[]};function h4(t){let e=[];for(let[r,n]of Object.entries(d4)){if(n==="")continue;let i=t.inputFieldParser.fromString(`INPUT[${n}]`),a=t.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[r]}]});i=t.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${n}]`;let o=t.inputFieldParser.validate(i,"",void 0);e.push([r,o])}return e}function g4(t){let e=[];for(let[r,n]of Object.entries(d4)){if(n==="")continue;let i=r,a="";wm[i].allowInline?a=`\`INPUT[${n}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${n}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function v4(t){let e=[];for(let r of Object.values(hw))for(let n of r)e.push([n.title,`\`${n.display}\``]);return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function b4(t,e,r){let n=g4(r),i=v4(r);t.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(s=>{s.setTitle("Input Field");let l=s.setSubmenu();for(let[u,c]of n)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Av(e,c))})}),o.addItem(s=>{s.setTitle("View Field");let l=s.setSubmenu();for(let[u,c]of i)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Av(e,c))})}),o.addItem(s=>{s.setTitle("Inline Button"),s.onClick(()=>{Av(e,"`BUTTON[example-id]`")})}),o.addItem(s=>{s.setTitle("Button"),s.onClick(()=>{r.internal.openButtonBuilderModal({onOkay:l=>{Av(e,`\`\`\`meta-bind-button
${(0,y4.stringifyYaml)(l)}
\`\`\``)},submitText:"Insert"})})})})}function Av(t,e){t.replaceSelection(e)}var L4=require("obsidian");var kn=class extends vi{constructor(e,r,n){super(),this.mb=e,this.filePath=n,this.uuid=r}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.mb.mountableManager.registerMountable(this)}onUnmount(e){this.mb.mountableManager.unregisterMountable(this)}};var Vc=class{constructor(e){this.scope=e}};var Ea=Bt()(he.string()),Uc=Bt()(he.nativeEnum(Ti)),mp=Bt()(he.nativeEnum(_l)),w4=Bt()(he.nativeEnum(Ls)),_4=Bt()(he.instanceof(HTMLElement)),qc=Bt()(he.instanceof(Vc)),rot=Bt()(he.instanceof(hn)),not=Bt()(he.function().args().returns(he.void())),iot=Bt()(he.instanceof(kn)),A4=Bt()(he.instanceof(vi)),D4=Bt()(he.instanceof($s)),x4=Bt()(he.object({index:he.number(),line:he.number(),column:he.number()})),TK=Bt()(he.object({from:x4,to:x4})),cu=Bt()(he.object({value:he.string(),position:TK.optional()})),S4=Bt()(he.object({name:cu,value:cu.array()})),MK=Bt()(he.object({type:he.nativeEnum(bu),prop:cu})),gw=Bt()(he.object({storageType:cu.optional(),storagePath:cu.optional(),storageProp:MK.array(),listenToChildren:he.boolean()})),aot=Bt()(he.object({declarationString:he.string().optional(),inputFieldType:cu.optional(),templateName:cu.optional(),bindTarget:gw.optional(),arguments:S4.array(),errorCollection:he.instanceof(er)})),oot=Bt()(he.object({declarationString:he.string().optional(),templateDeclaration:he.array(he.union([he.string(),gw])).optional(),viewFieldType:cu.optional(),arguments:S4.array(),writeToBindTarget:gw.optional(),errorCollection:he.instanceof(er)})),Sa=Bt()(he.object({storageType:he.string(),storagePath:he.string(),storageProp:he.instanceof(js),listenToChildren:he.boolean()})),E4=Bt()(he.object({name:he.string(),value:he.string().array()})),sot=Bt()(he.object({type:he.nativeEnum(bu),prop:he.string()})),T4=Bt()(he.object({inputFieldType:w4.optional(),templateName:he.string().optional(),bindTarget:Sa.optional(),arguments:E4.array().optional()})),M4=Bt()(he.object({viewFieldType:w4.optional(),templateDeclaration:he.union([he.string(),Sa]).array().optional(),arguments:E4.array().optional(),writeToBindTarget:Sa.optional()})),CK=Bt()(he.object({bindTarget:Sa,name:he.string()})),NK=Bt()(he.object({bindTargetMappings:CK.array(),writeToBindTarget:Sa.optional(),code:he.string()})),FK=Bt()(he.object({referencedButtonIds:he.string().array()})),C4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),T4]),scope:qc.optional()})),N4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),M4]),scope:qc.optional()})),F4=Bt()(he.object({declaration:he.union([he.string(),NK])})),I4=Bt()(he.object({bindTarget:Sa,tableHead:he.string().array(),columns:he.array(he.union([T4,M4,he.string()]))})),B4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),FK]),position:D4.optional()})),k4=Bt()(he.object({declaration:he.union([he.string(),lc]),position:D4.optional(),isPreview:he.boolean()})),P4=Bt()(he.object({depth:he.number(),content:he.string()}));var BK=(t,e)=>e(t,"left"),kK=se("<button><!> </button>");function dp(t,e){Se(e,!0);let r=at(e,"variant",19,()=>"default"),n=at(e,"disabled",7,!1),i=at(e,"tooltip",3,""),a=at(e,"label",3,""),o=at(e,"icon",3,""),s=at(e,"cssStyle",3,""),l=at(e,"backgroundImage",3,""),u=at(e,"error",3,!1),c=at(e,"onclick",3,()=>{}),f=at(e,"onauxclick",3,()=>{});async function m(v,A){if(!n()){n(!0);try{A==="left"?await c()(v):A==="middle"&&await f()(v)}catch(w){console.warn("failed to run button component on click",w)}finally{n(!1)}}}var p=kK();let d,h;p.__click=[BK,m];var b=ve(p);{var y=v=>{Or(v,{get mb(){return e.mb},get iconName(){return o()}})};et(b,v=>{o()&&v(y)})}var D=ue(b);le(p),Le(v=>{d=Vr(p,1,"mb-button-inner",null,d,v),h=jl(p,s(),h,{"background-image":l()?`url("${l()}")`:void 0}),rt(p,"aria-label",i()),p.disabled=n(),vt(D,` ${a()??""}`)},[()=>({"mod-cta":r()==="primary","mod-warning":r()==="destructive","mod-plain":r()==="plain",disabled:n(),"mb-error":u()})]),gi("auxclick",p,v=>m(v,"middle")),K(t,p),Ee()}Mt(["click"]);var fu=class extends vi{constructor(e,r,n,i,a,o,s){super(),this.mb=e,this.config=r,this.filePath=n,this.isInline=i==="inline",this.position=a,this.isInGroup=o,this.isPreview=s}onMount(e){lt.empty(e),lt.removeAllClasses(e),lt.addClasses(e,["mb-button",this.isInline?"mb-button-inline":"mb-button-block"]),!(!this.isInline&&!this.isPreview&&!this.isInGroup&&(this.config.id&&this.mb.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&lt.addClasses(e,this.config.class.split(" ").filter(r=>r!=="")),this.buttonComponent=Br(dp,{target:e,props:{mb:this.mb,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:Uy(this.config.tooltip)?this.config.tooltip:void 0,cssStyle:this.config.cssStyle,backgroundImage:Uy(this.config.backgroundImage)?this.mb.internal.imagePathToUri(this.config.backgroundImage):void 0,onclick:async r=>{await this.mb.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),of.fromMouseEvent(r,"left"))},onauxclick:async r=>{await this.mb.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),of.fromMouseEvent(r,"left"))}}}))}getContext(){return{position:this.position?.getPosition(),isInGroup:this.isInGroup,isInline:this.isInline}}onUnmount(){this.buttonComponent&&Dr(this.buttonComponent),!this.isInline&&!this.isPreview&&this.config?.id&&this.mb.buttonManager.removeButton(this.filePath,this.config.id)}};var Dv=class extends vi{constructor(e,r,n,i,a){super(),this.mb=e,this.referencedIds=r,this.filePath=n,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,r){return lt.removeAllClasses(e),lt.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),Br(dp,{target:e,props:{mb:this.mb,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${r}' found`,error:!0,onclick:async()=>{}}})}onMount(e){lt.empty(e),lt.addClasses(e,["mb-button-group",this.renderChildType==="inline"?"mb-button-group-inline":"mb-button-group-block"]);for(let r of this.referencedIds){let n=lt.createElement(e,"span"),i=this.renderInitialButton(n,r),a,o=this.mb.buttonManager.registerButtonLoadListener(this.filePath,r,s=>{i&&Dr(i),i=void 0,a=new fu(this.mb,s,this.filePath,this.renderChildType,this.notePosition,!0,!1),a.mount(n)});this.registerUnmountCb(()=>{i&&Dr(i),i=void 0,a?.unmount(),o()})}}onUnmount(e){lt.empty(e)}};var Sv=class extends kn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.errorCollection=new er(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(super.onMount(e),lt.removeAllClasses(e),this.declaration.errorCollection.isEmpty())try{this.buttonField=new Dv(this.mb,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}catch(r){this.errorCollection.add(r),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,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:this.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),ui(e,"inline button")}};var Ev=class extends kn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new er(this.getUuid()),this.errorCollection.merge(i.errorCollection)}onMount(e){if(super.onMount(e),lt.removeAllClasses(e),this.declaration.config&&this.declaration.errorCollection.isEmpty())try{this.buttonField=new fu(this.mb,this.declaration.config,this.getFilePath(),"block",this.position,!1,this.isPreview),this.buttonField.mount(e)}catch(r){this.errorCollection.add(r),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,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:this.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),ui(e,"button")}};var Tv=class extends kn{constructor(e,r,n,i,a){super(e,r,n),this.depth=i,this.content=a}async parseContent(){let e=this.content.split(`
`).map(a=>a.trim()).filter(a=>a.length>0);if(e.length===0)return{content:""};if(e.length>1)return{error:"Embed may only contain one link"};let r=e[0],n=vn.parseLink(r);if(!n.internal)return{error:`${r} is not an internal link`};let i=this.mb.file.getPathByName(n.target,this.getFilePath());return i===void 0?{error:`"${n.target}" is not created yet`}:{content:await this.mb.file.read(i)}}exceedsMaxDepth(){return this.depth>_m}createEmbedMessage(e,r){e.createSpan({text:r,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let r=await this.parseContent();if(r.error){this.createEmbedMessage(e,r.error);return}if(r.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=r.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.mb.internal.renderMarkdown(n,e,this.getFilePath())}catch(r){let n=new er("Embed");n.add(r),this.mb.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass("mb-embed"),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass("mb-embed"),this.markdownUnloadCallback?.(),ui(e,"Embed")}};var Mv=class extends kn{constructor(e,r,n){super(e,r,n)}onMount(e){super.onMount(e),lt.empty(e),lt.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){super.onUnmount(e),lt.empty(e),ui(e,"Excluded")}};var zc=class extends kn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new er(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new Lt({errorLevel:"CRITICAL",effect:"can not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getBindTarget(){return this.declaration.bindTarget}shouldAddCardContainer(){let e=this.declaration.inputFieldType==="select"||this.declaration.inputFieldType==="multiSelect"||this.declaration.inputFieldType==="list",r=this.hasArgument("showcase")||this.hasArgument("title");return this.renderChildType==="block"&&(e||r)}createContainer(e){if(this.shouldAddCardContainer()){let r=lt.createElement(e,"div");lt.addClass(r,"mb-card");let n=this.getArgument("title");return n&&lt.createElement(r,"h3",{text:n.value}),r}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let n=lt.createElement(e,"code",{class:"mb-none"}),i=lt.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=qt.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.mb.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new Lt({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,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:this.declarationString})}onMount(e){if(super.onMount(e),lt.empty(e),lt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=this.createContainer(e);this.createErrorIndicator(r);let n=lt.createElement(r,"div",{class:"mb-input-wrapper"});this.inputField?.mount(n);let i=this.getArguments("class");for(let a of i)lt.addClasses(n,a.value);lt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?lt.addClass(e,"mb-input-block"):lt.addClass(e,"mb-input-inline"),this.addShowcase(r)}onUnmount(e){super.onUnmount(e),this.inputField?.unmount(),ui(e,"input field")}};var PK=se("<div></div>");function pu(t,e){Se(e,!0);let r,n;Yi(()=>{n?.unmount(),n=e.mountable,n.mount(r)}),Jl(()=>{n?.unmount()});var i=PK();co(i,a=>r=a,()=>r),K(t,i),Ee()}var $K=se("<th> </th>"),OK=se("<td><!></td>"),RK=se('<td class="meta-bind-error">invalid data</td>'),LK=se('<tr><!><td class="mb-html-table-button-cell"><!></td></tr>'),VK=se('<div class="mb-table-wrapper"><table class="mb-html-table"><thead><tr><!><th class="mb-html-table-button-cell"></th></tr></thead><tbody></tbody></table></div> <!>',1);function vw(t,e){Se(e,!0);let r=at(e,"tableHead",19,()=>[]),n=it(dt([]));function i(p){ke(n,p,!0)}var a=VK(),o=We(a),s=ve(o),l=ve(s),u=ve(l),c=ve(u);Ut(c,17,r,Zt,(p,d)=>{var h=$K(),b=ve(h,!0);le(h),Le(()=>vt(b,q(d))),K(p,h)}),_t(),le(u),le(l);var f=ue(l);Ut(f,21,()=>q(n),p=>p.index,(p,d)=>{var h=LK(),b=ve(h);{var y=w=>{var x=Gr(),E=We(x);Ut(E,17,()=>q(d).cells,Zt,(T,_)=>{var C=OK(),N=ve(C);pu(N,{get mountable(){return q(_)}}),le(C),K(T,C)}),K(w,x)},D=w=>{var x=RK();Le(()=>rt(x,"colspan",r().length)),K(w,x)};et(b,w=>{q(d).isValid?w(y):w(D,!1)})}var v=ue(b),A=ve(v);yt(A,{onclick:()=>e.table.removeColumn(q(d).index),children:(w,x)=>{Or(w,{get mb(){return e.table.mb},iconName:"x"})},$$slots:{default:!0}}),le(v),le(h),K(p,h)}),le(f),le(s),le(o);var m=ue(o,2);return yt(m,{onclick:()=>e.table.addColumn(),children:(p,d)=>{_t();var h=Vt("Add Row");K(p,h)},$$slots:{default:!0}}),K(t,a),Ee({updateTable:i})}function Cv(t){return new js(t.map(e=>sf.tryParse(e).success?new yu("array",e):new yu("object",e)))}var Nv=class extends kn{constructor(e,r,n,i,a,o){super(e,r,n),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new hn(void 0)}registerSelfToMetadataManager(){this.metadataSubscription=this.mb.metadataManager.subscribe(this.getUuid(),this.inputSignal,this.bindTarget,()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataSubscription?.unsubscribe()}updateMetadataManager(e){this.metadataSubscription?.write(e)}getValue(){return this.parseTableData(this.metadataSubscription?.read())}parseTableData(e){return Array.isArray(e)?e:[]}updateDisplayValue(e){e=e??[];let r=[];for(let n=0;n<e.length;n++)if(typeof e[n]=="object"){let i=new Vc({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(Cv([n.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),a=this.columns.map(o=>{if(typeof o=="string")return this.mb.api.createInlineFieldFromString(o,this.getFilePath(),i,"inline");if("inputFieldType"in o)return this.mb.api.createInputFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"});if("viewFieldType"in o)return this.mb.api.createViewFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"});throw new Error(`Unknown column type: ${JSON.stringify(o)}`)});r.push({cells:a,index:n,value:e[n],isValid:!0})}else r.push({cells:[],index:n,value:e[n],isValid:!1});this.tableComponent?.updateTable(r)}removeColumn(e){let r=this.getValue();r.splice(e,1),this.updateDisplayValue(r),this.updateMetadataManager(r)}addColumn(){let e=this.getValue();e.push({}),this.updateDisplayValue(e),this.updateMetadataManager(e)}onMount(e){super.onMount(e),this.tableComponent=Br(vw,{target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:r=>{this.updateDisplayValue(this.parseTableData(r))}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent&&Dr(this.tableComponent),ui(e,"table")}};var Fv=class extends kn{constructor(e,r,n,i){super(e,r,n),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new er(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.variables=[],this.buildVariables()}buildVariables(){if(this.errorCollection.isEmpty())try{for(let e of this.declaration.bindTargetMappings??[])this.variables.push({bindTargetDeclaration:e.bindTarget,metadataSignal:new hn(void 0),uuid:_r(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let r of this.variables??[])!r.contextName||!r.metadataSignal||(e[r.contextName]=r.metadataSignal.get());return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){this.metadataSubscription=this.mb.metadataManager.subscribeDerived(this.getUuid(),this.declaration.writeToBindTarget,this.variables.map(e=>e.bindTargetDeclaration),this.variables.map(e=>e.metadataSignal),async()=>await this.evaluate(),()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataSubscription?.unsubscribe()}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,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:this.declarationString})}onMount(e){if(super.onMount(e),lt.addClass(e,"mb-view"),lt.empty(e),this.mb.internal.isJsEngineAvailable()||this.errorCollection.add(new ro({errorLevel:"ERROR",effect:"can not create js view field",cause:"The JS Engine plugin is not installed and enabled."})),this.mb.getSettings().enableJs||this.errorCollection.add(new ro({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS evaluation is disabled in the plugin settings."})),this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let r=document.createElement("div");lt.addClass(r,"mb-view-wrapper"),this.jsRenderer=this.mb.internal.createJsRenderer(r,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(r)}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),ui(e,"js view field")}};var Iv=class extends kn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new er(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new Lt({errorLevel:"ERROR",effect:"an not retrieve arguments",cause:"viewFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getDeclaration(){return this.declaration}createViewField(){if(!this.errorCollection.hasErrors())try{this.viewField=this.mb.viewFieldFactory.createViewField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new Lt({errorLevel:"CRITICAL",effect:"can't render view field",cause:"view field is undefined"}))}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,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:this.declarationString})}onMount(e){if(super.onMount(e),lt.empty(e),lt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=document.createElement("div");lt.addClass(r,"mb-view-wrapper");try{this.viewField?.mount(r)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(r);let n=this.getArguments("class");for(let i of n)lt.addClasses(r,i.value);lt.addClass(r,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?lt.addClass(e,"mb-view-block"):lt.addClass(e,"mb-view-inline")}onUnmount(e){super.onUnmount(e),this.viewField?.unmount(),ui(e,"view field")}};var Bv=class{constructor(e){this.mb=e}createField(e,r,n,i=!0){if(tn(he.object({type:mp,filePath:Ea,options:he.any(),honorExcludedSetting:he.boolean()}),{type:e,filePath:r,options:n,honorExcludedSetting:i}),this.mb.file.isExcludedFromRendering(r)&&i)return this.createExcludedMountable(r);if(e==="INPUT")return this.createInputFieldMountable(r,n);if(e==="VIEW")return this.createViewFieldMountable(r,n);if(e==="JS_VIEW")return this.createJsViewFieldMountable(r,n);if(e==="TABLE")return this.createTableMountable(r,n);if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(r,n);if(e==="BUTTON")return this.createButtonMountable(r,n);if(e==="EMBED")return this.createEmbedMountable(r,n);if(e==="EXCLUDED")return this.createExcludedMountable(r);throw new Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,r,n,i="inline",a,o=!0){tn(he.object({fieldString:he.string(),filePath:Ea,scope:qc.optional(),renderChildType:Uc,honorExcludedSetting:he.boolean()}),{fieldString:e,filePath:r,scope:n,renderChildType:i,honorExcludedSetting:o});let s=this.isInlineFieldDeclarationAndGetType(e);if(s===void 0)throw new Lt({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${s}"`});return this.createInlineFieldOfTypeFromString(s,e,r,n,i,a,o)}createInlineFieldOfTypeFromString(e,r,n,i,a="inline",o,s=!0){if(tn(he.object({type:mp,declaration:he.string(),filePath:Ea,scope:qc.optional(),renderChildType:Uc,honorExcludedSetting:he.boolean()}),{type:e,declaration:r,filePath:n,scope:i,renderChildType:a,honorExcludedSetting:s}),this.mb.file.isExcludedFromRendering(n)&&s)return this.createExcludedMountable(n);if(e==="INPUT")return this.createInputFieldMountable(n,{renderChildType:a,declaration:r,scope:i});if(e==="VIEW")return this.createViewFieldMountable(n,{renderChildType:a,declaration:r,scope:i});if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(n,{renderChildType:a,declaration:r,position:o});throw new Lt({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,r){tn(he.object({filePath:Ea,options:C4}),{filePath:e,options:r});let n=_r(),i;return typeof r.declaration=="string"?i=this.mb.inputFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.mb.inputFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new zc(this.mb,n,e,r.renderChildType,i)}createViewFieldMountable(e,r){tn(he.object({filePath:Ea,options:N4}),{filePath:e,options:r});let n=_r(),i;return typeof r.declaration=="string"?i=this.mb.viewFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.mb.viewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new Iv(this.mb,n,e,r.renderChildType,i)}createJsViewFieldMountable(e,r){tn(he.object({filePath:Ea,options:F4}),{filePath:e,options:r});let n=_r(),i;return typeof r.declaration=="string"?i=this.mb.jsViewFieldParser.fromStringAndValidate(r.declaration,e):i=this.mb.jsViewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e),new Fv(this.mb,n,e,i)}createTableMountable(e,r){tn(he.object({filePath:Ea,options:I4}),{filePath:e,options:r});let n=_r();return new Nv(this.mb,n,e,r.bindTarget,r.tableHead,r.columns)}createButtonGroupMountable(e,r){tn(he.object({filePath:Ea,options:B4}),{filePath:e,options:r});let n=_r(),i;return typeof r.declaration=="string"?i=this.mb.buttonParser.fromGroupString(r.declaration):i=this.mb.buttonParser.validateGroup(r.declaration),new Sv(this.mb,n,e,i,r.renderChildType,r.position)}createButtonMountable(e,r){tn(he.object({filePath:Ea,options:k4}),{filePath:e,options:r});let n=_r(),i;return typeof r.declaration=="string"?i=this.mb.buttonParser.fromString(r.declaration):i=this.mb.buttonParser.validate(r.declaration),new Ev(this.mb,n,e,i,r.position,r.isPreview)}createEmbedMountable(e,r){tn(he.object({filePath:Ea,options:P4}),{filePath:e,options:r});let n=_r();return new Tv(this.mb,n,e,r.depth,r.content)}createExcludedMountable(e){tn(he.object({filePath:Ea}),{filePath:e});let r=_r();return new Mv(this.mb,r,e)}getInlineFieldDeclarationPrefix(e){if(tn(he.object({fieldType:mp}),{fieldType:e}),e==="INPUT")return"INPUT";if(e==="VIEW")return"VIEW";if(e==="BUTTON_GROUP")return"BUTTON";throw new Lt({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,r){tn(he.object({fieldType:mp,str:he.string()}),{fieldType:e,str:r});let n=this.getInlineFieldDeclarationPrefix(e)+"[";return r.startsWith(n)&&r.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(tn(he.object({str:he.string()}),{str:e}),!!e.endsWith("]"))for(let r of Object.values(_l)){if(!Up(r))continue;let n=this.getInlineFieldDeclarationPrefix(r)+"[";if(e.startsWith(n))return r}}createSignal(e){return new hn(e)}createBindTarget(e,r,n,i=!1){return tn(he.object({storageType:he.string(),storagePath:he.string(),property:he.string().array(),listenToChildren:he.boolean()}),{storageType:e,storagePath:r,property:n,listenToChildren:i}),{storageType:e,storagePath:r,storageProp:Cv(n),listenToChildren:i}}parseBindTarget(e,r,n){return tn(he.object({declarationString:he.string(),filePath:Ea,scope:qc.optional()}),{declarationString:e,filePath:r,scope:n}),this.mb.bindTargetParser.fromStringAndValidate(e,r,n)}setMetadata(e,r){tn(he.object({bindTarget:Sa}),{bindTarget:e}),this.mb.metadataManager.write(r,e)}getMetadata(e){return tn(he.object({bindTarget:Sa}),{bindTarget:e}),this.mb.metadataManager.read(e)}updateMetadata(e,r){tn(he.object({bindTarget:Sa,updateFn:he.function().args(he.any()).returns(he.any())}),{bindTarget:e,updateFn:r});let n=this.mb.metadataManager.read(e),i=r(n);this.mb.metadataManager.write(i,e)}subscribeToMetadata(e,r,n){tn(he.object({bindTarget:Sa,lifecycleHook:this.mb.internal.getLifecycleHookValidator(),callback:he.function().args(he.any()).returns(he.void())}),{bindTarget:e,lifecycleHook:r,callback:n});let i=_r(),a=new hn(void 0);a.registerListener({callback:n});let o=this.mb.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});r.register(()=>{o.unsubscribe()})}createNotePosition(e,r){return tn(he.object({lineStart:he.number(),lineEnd:he.number()}),{lineStart:e,lineEnd:r}),new $s({lineStart:e,lineEnd:r})}mathJSImport(e,r){this.mb.math.import(e,r)}};var $4=require("@codemirror/view"),kv=class extends $4.WidgetType{constructor(e,r,n,i,a){super(),this.type=e,this.content=r,this.filePath=n,this.parentComponent=i,this.mb=a}eq(e){return e.content===this.content}toDOM(e){let r=document.createElement("span");r.addClass("cm-inline-code");let n=this.mb.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.mb.api.wrapInMDRC(n,r,this.parentComponent),r}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var O4=require("obsidian"),Pv=class extends O4.MarkdownRenderChild{constructor(e,r,n){super(n),this.mb=e,this.mountable=r,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function R4(t){return t.dependencyManager.checkDependency("dataview").api}function mu(t){return t.dependencyManager.checkDependency("js-engine").api}function yw(t){return t.dependencyManager.checkDependency("templater-obsidian").templater}var UK=he.object({addChild:he.function().args(he.instanceof(L4.Component)).returns(he.void())}),$v=class extends Bv{constructor(e){super(e),this.omb=e}wrapInMDRC(e,r,n){tn(he.object({field:A4,containerEl:_4,component:UK}),{field:e,containerEl:r,component:n});let i=new Pv(this.omb,e,r);return n.addChild(i),i}constructMDRCWidget(e,r,n,i){if(Up(e))return new kv(e,r,n,i,this.omb);throw new Lt({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,r,n){tn(he.object({bindTargets:Sa.array(),lifecycleHook:this.mb.internal.getLifecycleHookValidator(),callback:he.function()}),{bindTargets:e,lifecycleHook:r,callback:n});let i=mu(this.omb),a=_r(),o=e.map(()=>new hn(void 0)),s=()=>Promise.resolve(),l=this.mb.metadataManager.subscribeEffect(a,e,o,()=>s(),()=>{});r.register(()=>l.unsubscribe());let u=i.reactive(n,...o.map(c=>c.get()));return s=()=>u.refresh(...o.map(c=>c.get())),u}};var ul=require("obsidian");var Ov=class{constructor(e){this.mb=e}getFrontmatterLocation(e){let r=e.split(`
`);if(r.at(0)==="---"){for(let n=1;n<r.length;n++)if(r.at(n)==="---")return{lineStart:1,lineEnd:n+1}}}isExcludedFromRendering(e){for(let r of this.mb.getSettings().excludedFolders)if(e.startsWith(r))return!0;return!1}resolveFilePathLike(e,r){let n=vn.isLink(e)?vn.parseLink(e).target:e,i=this.mb.file.getPathByName(n,r);if(i===void 0)throw new to({errorLevel:"ERROR",cause:`Could not find a file that matches "${e}".`,effect:`Could not resolve path or link "${e}" relative to "${r}".`});return i}createLineNumberContext(e,r){let i=e.split(`
`).length,a=this.mb.file.getFrontmatterLocation(e);return{fileStart:1,fileEnd:i,frontmatterStart:a?a.lineStart:1,frontmatterEnd:a?a.lineEnd:1,contentStart:a?a.lineEnd+1:1,contentEnd:i,selfStart:r?r.lineStart+1:void 0,selfEnd:r?r.lineEnd+1:void 0}}};var Rv=class extends Ov{constructor(e){super(e),this.app=e.app}async read(e){let r=this.app.vault.getAbstractFileByPath(e);if(!r||!(r instanceof ul.TFile))throw new Error(`file not found: ${e}`);return this.app.vault.cachedRead(r)}async write(e,r){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.modify(n,r)}async exists(e){return this.app.vault.getFileByPath(e)!==null}async atomicModify(e,r){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.process(n,i=>r(i))}async create(e,r,n,i=!1,a=!1){let o=this.app.vault.getAvailablePath((0,ul.normalizePath)(e+"/"+r),n),s=await this.app.vault.create(o,"");return i&&await this.openInSourceMode(s,a),s.path}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof ul.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof ul.TFolder).map(e=>e.path)}async open(e,r,n){this.app.workspace.openLinkText(e,r,n)}async openInSourceMode(e,r){let n=this.app.workspace.getLeaf(r?"tab":!1);n&&await n.openFile(e,{state:{mode:"source"}})}getPathByName(e,r=""){return this.app.metadataCache.getFirstLinkpathDest(e,r)?.path}};var Tn=require("obsidian");var Lv=Tr(Bf());var V4=Tr(Bf());var qK=se('<div class="mb-calendar-cell mb-calendar-header-cell"><span class="mb-calendar-cell-text"> </span></div>'),zK=(t,e,r)=>e(q(r)),HK=(t,e,r)=>e(t,q(r)),GK=se('<div role="button" tabindex="0"><span class="mb-calendar-cell-text"> </span></div>'),WK=se('<div class="mb-calendar"><div class="mb-calendar-header"></div> <div class="mb-calendar-content"></div></div>');function bw(t,e){Se(e,!0);let r=cr(()=>sS(e.month,e.year));function n(l){l&&e.dateChange((0,V4.default)(new Date(e.year,e.month,l)))}function i(l,u){l.key===" "&&n(u)}var a=WK(),o=ve(a);Ut(o,21,uS,Zt,(l,u)=>{var c=qK(),f=ve(c),m=ve(f,!0);le(f),le(c),Le(()=>vt(m,q(u))),K(l,c)}),le(o);var s=ue(o,2);Ut(s,21,()=>q(r),l=>lS(),(l,u)=>{var c=GK();let f;c.__click=[zK,n,u],c.__keydown=[HK,i,u];var m=ve(c),p=ve(m,!0);le(m),le(c),Le(d=>{f=Vr(c,1,"mb-calendar-cell",null,f,d),vt(p,q(u)||"")},[()=>({"mb-calendar-highlight":q(u),"mb-calendar-content-cell":q(u),"mb-calendar-selected":e.selectedDate?.year()===e.year&&e.selectedDate?.month()===e.month&&e.selectedDate?.date()===q(u)})]),K(l,c)}),le(s),le(a),K(t,a),Ee()}Mt(["click","keydown"]);function YK(t,e,r){if(q(e)===11){ke(e,0),ke(r,q(r)+1);return}ke(e,q(e)+1)}function jK(t,e,r){if(q(e)===0){ke(e,11),ke(r,q(r)-1);return}ke(e,q(e)-1)}function ZK(t,e){let r=t.target.value,n=Number.parseInt(r);Number.isNaN(n)||ke(e,n,!0)}function JK(t,e,r){e(null),r.dateChangeCallback(null)}function XK(t,e,r){e((0,Lv.default)()),r.dateChangeCallback(e())}var QK=se('<div class="mb-date-picker"><div class="mb-date-picker-header"><button class="mb-date-picker-month-switch-button">Prev</button> <div class="mb-date-picker-header-text"><span class="mb-date-picker-header-text-month"> </span> <input class="mb-date-picker-header-text-year" type="number"></div> <button class="mb-date-picker-month-switch-button">Next</button></div> <!> <div class="mb-date-picker-footer"><button class="mb-date-picker-util-button">Set no Date</button> <button class="mb-date-picker-util-button">Set to Now</button></div></div>');function xw(t,e){Se(e,!0);let r=at(e,"selectedDate",23,Lv.default),n=it(0),i=it(0);Yi(()=>{if(r())ke(n,r().month(),!0),ke(i,r().year(),!0);else{let D=(0,Lv.default)();ke(n,D.month(),!0),ke(i,D.year(),!0)}});function a(D){r(D),e.dateChangeCallback(D)}var o=QK(),s=ve(o),l=ve(s);l.__click=[jK,n,i];var u=ue(l,2),c=ve(u),f=ve(c,!0);le(c);var m=ue(c,2);At(m),m.__input=[ZK,i],le(u);var p=ue(u,2);p.__click=[YK,n,i],le(s);var d=ue(s,2);bw(d,{dateChange:a,get month(){return q(n)},get year(){return q(i)},get selectedDate(){return r()}});var h=ue(d,2),b=ve(h);b.__click=[JK,r,e];var y=ue(b,2);y.__click=[XK,r,e],le(h),le(o),Le((D,v)=>{vt(f,D),_b(m,v)},[()=>oS(q(n)),()=>q(i).toString()]),K(t,o),Ee()}Mt(["click","input"]);var Hc=class extends vi{setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new Lt({errorLevel:"CRITICAL",effect:"Failed to close modal",cause:"Modal reference in ModalContent is undefined"})}};var KK=se('<div><div class="setting-item-info"><div class="setting-item-name"> </div> <div class="setting-item-description"> </div></div> <div><!></div></div>');function It(t,e){let r=at(e,"name",3,""),n=at(e,"description",3,""),i=at(e,"heading",3,!1),a=at(e,"vertical",3,!1);var o=KK();let s;var l=ve(o),u=ve(l),c=ve(u,!0);le(u);var f=ue(u,2),m=ve(f,!0);le(f),le(l);var p=ue(l,2);let d;var h=ve(p);{var b=y=>{var D=Gr(),v=We(D);La(v,()=>e.children),K(y,D)};et(h,y=>{e.children&&y(b)})}le(p),le(o),Le((y,D)=>{s=Vr(o,1,"setting-item",null,s,y),vt(c,r()),vt(m,n()),d=Vr(p,1,"setting-item-control",null,d,D)},[()=>({"setting-item-heading":i(),"mb-vertical":a()}),()=>({"mb-vertical-control":a()})]),K(t,o)}function ww(t,e){Se(e,!0);let r=at(e,"action",15);function n(){e.mb.internal.openCommandSelectModal(a=>{r(r().command=a.id,!0)})}let i=cr(()=>r().command||"none");It(t,{get name(){return`Command: ${q(i)??""}`},description:"The command to execute when this action runs.",children:(a,o)=>{yt(a,{get variant(){return"primary"},onclick:()=>n(),children:(s,l)=>{_t();var u=Vt("Change");K(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ee()}var eee=(t,e,r)=>e(!q(r)),tee=(t,e,r)=>{t.key===" "&&e(!q(r))},ree=se('<div role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function Ta(t,e){Se(e,!0);let r=at(e,"checked",15),n=cr(()=>r()??!1);var i=ree();let a;i.__click=[eee,r,n],i.__keydown=[tee,r,n];var o=ve(i);At(o),le(i),Le(s=>{a=Vr(i,1,"checkbox-container",null,a,s),rt(i,"aria-checked",q(n)),cs(o,q(n))},[()=>({"is-enabled":q(n)})]),K(t,i),Ee()}Mt(["click","keydown"]);var nee=se('<input type="text" placeholder="some name">'),iee=se("<!> <!> <!> <!>",1);function _w(t,e){Se(e,!0);let r=at(e,"action",15);function n(){e.mb.internal.openFolderSelectModal(f=>{r(r().folderPath=f,!0)})}var i=iee(),a=We(i);let o=cr(()=>r().folderPath||"none");It(a,{get name(){return`Folder: ${q(o)??""}`},description:"The folder to create a new note in.",children:(f,m)=>{yt(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(p,d)=>{_t();var h=Vt("Change");K(p,h)},$$slots:{default:!0}})},$$slots:{default:!0}});var s=ue(a,2);let l=cr(()=>r().fileName||"default");It(s,{get name(){return`File name: ${q(l)??""}`},description:"The file name of the new note.",children:(f,m)=>{var p=nee();At(p),xt(p,()=>r().fileName,d=>r(r().fileName=d,!0)),K(f,p)},$$slots:{default:!0}});var u=ue(s,2);It(u,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(f,m)=>{Ta(f,{get checked(){return r().openNote},set checked(p){r(r().openNote=p,!0)}})},$$slots:{default:!0}});var c=ue(u,2);It(c,{name:"Open if note already exists",description:"Whether to open the note instead of creating a new one if the note already exists.",children:(f,m)=>{Ta(f,{get checked(){return r().openIfAlreadyExists},set checked(p){r(r().openIfAlreadyExists=p,!0)}})},$$slots:{default:!0}}),K(t,i),Ee()}function Aw(t,e){Se(e,!0);let r=at(e,"action",15);function n(){e.mb.internal.openMarkdownFileSelectModal(a=>{r(r().templateFile=a,!0)})}let i=cr(()=>r().templateFile||"default");It(t,{get name(){return`File path: ${q(i)??""}`},description:"The path to the templater file, relative to the vault root.",children:(a,o)=>{yt(a,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(s,l)=>{_t();var u=Vt("Change");K(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ee()}var aee=se('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function Dw(t,e){Se(e,!0);let r=at(e,"action",15);var n=aee(),i=We(n);It(i,{name:"JS code",description:"The JavaScript code to run."});var a=ue(i,2),o=ve(a);Dn(o),le(a),xt(o,()=>r().code,s=>r(r().code=s,!0)),K(t,n),Ee()}var oee=se('<input type="text" placeholder="some text">');function Sw(t,e){Se(e,!0);let r=at(e,"action",15);It(t,{name:"Text",description:"The text to input at the cursor.",children:(n,i)=>{var a=oee();At(a),xt(a,()=>r().str,o=>r(r().str=o,!0)),K(n,a)},$$slots:{default:!0}}),Ee()}var see=se('<input type="number" placeholder="0">'),uee=se('<!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function Ew(t,e){Se(e,!0);let r=at(e,"action",15);var n=uee(),i=We(n);It(i,{name:"Line",description:"The line number to insert at.",children:(l,u)=>{var c=see();At(c),xt(c,()=>r().line,f=>r(r().line=f,!0)),K(l,c)},$$slots:{default:!0}});var a=ue(i,2);It(a,{name:"Text to insert",description:"The text to insert into the note."});var o=ue(a,2),s=ve(o);Dn(s),le(o),xt(s,()=>r().value,l=>r(r().value=l,!0)),K(t,n),Ee()}function Tw(t,e){Se(e,!0);let r=at(e,"action",15);function n(){e.mb.internal.openFilteredFileSelectModal(i=>{r(r().file=i,!0)},i=>i.endsWith(".js"))}It(t,{name:"JS file",description:"The JavaScript file to run.",children:(i,a)=>{yt(i,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(o,s)=>{_t();var l=Vt("Change");K(o,l)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ee()}var lee=se('<input type="text" placeholder="[[Some Note]] or https://www.example.com"> <!>',1),cee=se("<!> <!>",1);function Mw(t,e){Se(e,!0);let r=at(e,"action",15);function n(){e.mb.internal.openMarkdownFileSelectModal(s=>{r(r().link=s,!0)})}var i=cee(),a=We(i);It(a,{name:"Link",description:"The link to open.",children:(s,l)=>{var u=lee(),c=We(u);At(c);var f=ue(c,2);yt(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(m,p)=>{Or(m,{iconName:"list",get mb(){return e.mb}})},$$slots:{default:!0}}),xt(c,()=>r().link,m=>r(r().link=m,!0)),K(s,u)},$$slots:{default:!0}});var o=ue(a,2);It(o,{name:"New tab",description:"Whether to open the link in a new tab.",children:(s,l)=>{Ta(s,{get checked(){return r().newTab},set checked(u){r(r().newTab=u,!0)}})},$$slots:{default:!0}}),K(t,i),Ee()}var fee=se('<input type="text">'),pee=se('<input type="text" placeholder="g">'),mee=se('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function Cw(t,e){Se(e,!0);let r=at(e,"action",15);var n=mee(),i=We(n);It(i,{name:"Regexp",description:"The regexp to find replacements.",children:(u,c)=>{var f=fee();At(f),xt(f,()=>r().regexp,m=>r(r().regexp=m,!0)),K(u,f)},$$slots:{default:!0}});var a=ue(i,2);It(a,{name:"Regexp flags",description:"The regexp flags for this regexp.",children:(u,c)=>{var f=pee();At(f),xt(f,()=>r().regexpFlags,m=>r(r().regexpFlags=m,!0)),K(u,f)},$$slots:{default:!0}});var o=ue(a,2);It(o,{name:"Replacement text",description:"The text to replace the button with."});var s=ue(o,2),l=ve(s);Dn(l),le(s),xt(l,()=>r().replacement,u=>r(r().replacement=u,!0)),K(t,n),Ee()}var dee=se('<input type="number" placeholder="0">'),hee=se('<input type="number" placeholder="0">'),gee=se('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function Nw(t,e){Se(e,!0);let r=at(e,"action",15);var n=gee(),i=We(n);It(i,{name:"Line from",description:"The line that marks the start of the area to replace.",children:(u,c)=>{var f=dee();At(f),xt(f,()=>r().fromLine,m=>r(r().fromLine=m,!0)),K(u,f)},$$slots:{default:!0}});var a=ue(i,2);It(a,{name:"Line to",description:"The line that marks the end of the area to replace.",children:(u,c)=>{var f=hee();At(f),xt(f,()=>r().toLine,m=>r(r().toLine=m,!0)),K(u,f)},$$slots:{default:!0}});var o=ue(a,2);It(o,{name:"Replacement text",description:"The text to replace the note section."});var s=ue(o,2),l=ve(s);Dn(l),le(s),xt(l,()=>r().replacement,u=>r(r().replacement=u,!0)),K(t,n),Ee()}var vee=se('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function Fw(t,e){Se(e,!0);let r=at(e,"action",15);var n=vee(),i=We(n);It(i,{name:"Replacement text",description:"The text to replace the match with."});var a=ue(i,2),o=ve(a);Dn(o),le(a),xt(o,()=>r().replacement,s=>r(r().replacement=s,!0)),K(t,n),Ee()}var yee=se('<input type="number" placeholder="100 ms">');function Iw(t,e){Se(e,!0);let r=at(e,"action",15);It(t,{name:"Sleep time",description:"The time to sleep in milliseconds.",children:(n,i)=>{var a=yee();At(a),xt(a,()=>r().ms,o=>r(r().ms=o,!0)),K(n,a)},$$slots:{default:!0}}),Ee()}var bee=se('<input type="text" placeholder="some name">'),xee=se("<!> <!> <!> <!> <!>",1);function Bw(t,e){Se(e,!0);let r=at(e,"action",15);function n(d){e.mb.internal.openFileSelectModal(h=>{d.templateFile=h})}function i(d){e.mb.internal.openFolderSelectModal(h=>{d.folderPath=h})}var a=xee(),o=We(a);let s=cr(()=>r().templateFile||"none");It(o,{get name(){return`Template file: ${q(s)??""}`},description:"The template file to create a new note of.",children:(d,h)=>{yt(d,{get variant(){return"primary"},onclick:()=>n(r()),tooltip:"Select from vault",children:(b,y)=>{_t();var D=Vt("Change");K(b,D)},$$slots:{default:!0}})},$$slots:{default:!0}});var l=ue(o,2);let u=cr(()=>r().folderPath||"none");It(l,{get name(){return`Folder: ${q(u)??""}`},description:"The folder to create a new note in.",children:(d,h)=>{yt(d,{get variant(){return"primary"},onclick:()=>i(r()),tooltip:"Select from vault",children:(b,y)=>{_t();var D=Vt("Change");K(b,D)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=ue(l,2);let f=cr(()=>r().fileName||"default");It(c,{get name(){return`File name: ${q(f)??""}`},description:"The file name of the new note.",children:(d,h)=>{var b=bee();At(b),xt(b,()=>r().fileName,y=>r(r().fileName=y,!0)),K(d,b)},$$slots:{default:!0}});var m=ue(c,2);It(m,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(d,h)=>{Ta(d,{get checked(){return r().openNote},set checked(b){r(r().openNote=b,!0)}})},$$slots:{default:!0}});var p=ue(m,2);It(p,{name:"Open if note already exists",description:"Whether to open the note instead of creating a new one if the note already exists.",children:(d,h)=>{Ta(d,{get checked(){return r().openIfAlreadyExists},set checked(b){r(r().openIfAlreadyExists=b,!0)}})},$$slots:{default:!0}}),K(t,a),Ee()}var wee=se('<input type="text" placeholder="some value">'),_ee=se('<input type="text" placeholder="some value">'),Aee=se("<!> <!> <!>",1);function kw(t,e){Se(e,!0);let r=at(e,"action",15);var n=Aee(),i=We(n);It(i,{name:"Metadata property",description:"The metadata property in form of a bind target.",children:(s,l)=>{var u=wee();At(u),xt(u,()=>r().bindTarget,c=>r(r().bindTarget=c,!0)),K(s,u)},$$slots:{default:!0}});var a=ue(i,2);It(a,{name:"Value",description:"The new value.",children:(s,l)=>{var u=_ee();At(u),xt(u,()=>r().value,c=>r(r().value=c,!0)),K(s,u)},$$slots:{default:!0}});var o=ue(a,2);It(o,{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",children:(s,l)=>{Ta(s,{get checked(){return r().evaluate},set checked(u){r(r().evaluate=u,!0)}})},$$slots:{default:!0}}),K(t,n),Ee()}var Dee=se("<div><!></div>");function Ns(t,e){Se(e,!0);let r=at(e,"reverse",3,!1),n=at(e,"stretchChildren",3,!1),i=cr(()=>[r()?"mb-flex-row-reverse":"mb-flex-row",n()?"mb-flex-row-stretch":""].join(" "));var a=Dee(),o=ve(a);La(o,()=>e.children),le(a),Le(()=>Vr(a,1,ls(q(i)))),K(t,a),Ee()}var See=se('<div class="modal-button-container"><!></div>');function Ma(t,e){var r=See(),n=ve(r);La(n,()=>e.children),le(r),K(t,r)}var Eee=se('<input type="text">'),Tee=se('<input type="text">'),Mee=se("<option> </option>"),Cee=se('<select class="dropdown"></select>'),Nee=se('<input type="text">'),Fee=se('<input type="text">'),Iee=se('<span style="word-break: break-word"> </span> <!> <!>',1),Bee=se('<input type="text">'),kee=se('<input type="text">'),Pee=se("<option> </option>"),$ee=se("<h5> </h5> <!>",1),Oee=se("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),Ree=se("<!> <!>",1),Lee=se('<!> <!> <!> <!> <!> <!> <!> <!> <!> <h4>Actions</h4> Add action of type <select class="dropdown"></select> <!> <!> <h4>Preview</h4> <div></div> <!>',1);function Pw(t,e){Se(e,!0);let r=dt(e.buttonConfig),n,i,a=it(dt("command"));Jl(()=>{i?.unmount()}),Yi(()=>{i?.unmount(),n&&(lt.empty(n),i=new fu(e.mb,ft(r),"","block",void 0,!1,!0),i.mount(n))});function o(){r.actions?.push(e.mb.buttonActionRunner.createDefaultAction(q(a)))}function s(I){r.actions?.splice(I,1)}function l(I){return e.mb.buttonActionRunner.getActionLabel(I)}function u(I,R){if(r.actions===void 0)return;let L=[];I>0&&L.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[I-1];r.actions[I-1]=r.actions[I],r.actions[I]=V}}),I<r.actions.length-1&&L.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[I+1];r.actions[I+1]=r.actions[I],r.actions[I]=V}}),L.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(I)}),e.mb.internal.createContextMenu(L).showWithEvent(R)}function c(){e.mb.internal.openImageFileSelectModal(I=>{r.backgroundImage=I})}function f(){r.backgroundImage=void 0}var m=Lee(),p=We(m);It(p,{name:"Label",description:"The label shown on the button.",children:(I,R)=>{var L=Eee();At(L),xt(L,()=>r.label,V=>r.label=V),K(I,L)},$$slots:{default:!0}});var d=ue(p,2);It(d,{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",children:(I,R)=>{var L=Tee();At(L),xt(L,()=>r.icon,V=>r.icon=V),K(I,L)},$$slots:{default:!0}});var h=ue(d,2);It(h,{name:"Style",description:"The style variant of the button",children:(I,R)=>{var L=Cee();Ut(L,21,()=>Object.values(Wr),Zt,(V,P)=>{var k=Mee(),W={},O=ve(k,!0);le(k),Le(()=>{W!==(W=q(P))&&(k.value=(k.__value=q(P))??""),vt(O,q(P))}),K(V,k)}),le(L),Zl(L,()=>r.style,V=>r.style=V),K(I,L)},$$slots:{default:!0}});var b=ue(h,2);It(b,{name:"CSS classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",children:(I,R)=>{var L=Nee();At(L),xt(L,()=>r.class,V=>r.class=V),K(I,L)},$$slots:{default:!0}});var y=ue(b,2);It(y,{name:"CSS styles",description:"CSS styles to directly apply to the button.",children:(I,R)=>{var L=Fee();At(L),xt(L,()=>r.cssStyle,V=>r.cssStyle=V),K(I,L)},$$slots:{default:!0}});var D=ue(y,2);It(D,{name:"Background image",description:"A background image to use in the button.",children:(I,R)=>{var L=Iee(),V=We(L),P=ve(V,!0);le(V);var k=ue(V,2);yt(k,{get variant(){return"primary"},onclick:()=>c(),tooltip:"Select from vault",children:(O,Q)=>{_t();var ne=Vt("Change");K(O,ne)},$$slots:{default:!0}});var W=ue(k,2);yt(W,{get variant(){return"default"},onclick:()=>f(),tooltip:"Reset to none",children:(O,Q)=>{Or(O,{get mb(){return e.mb},iconName:"x"})},$$slots:{default:!0}}),Le(()=>vt(P,r.backgroundImage||"none")),K(I,L)},$$slots:{default:!0}});var v=ue(D,2);It(v,{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",children:(I,R)=>{var L=Bee();At(L),xt(L,()=>r.tooltip,V=>r.tooltip=V),K(I,L)},$$slots:{default:!0}});var A=ue(v,2);It(A,{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",children:(I,R)=>{var L=kee();At(L),xt(L,()=>r.id,V=>r.id=V),K(I,L)},$$slots:{default:!0}});var w=ue(A,2);It(w,{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",children:(I,R)=>{Ta(I,{get checked(){return r.hidden},set checked(L){r.hidden=L}})},$$slots:{default:!0}});var x=ue(w,4);Ut(x,21,()=>Object.values(Vn),Zt,(I,R)=>{var L=Pee(),V={},P=ve(L,!0);le(L),Le(()=>{V!==(V=q(R))&&(L.value=(L.__value=q(R))??""),vt(P,q(R))}),K(I,L)}),le(x);var E=ue(x,2);yt(E,{get variant(){return"primary"},onclick:()=>o(),children:(I,R)=>{_t();var L=Vt("Add Action");K(I,L)},$$slots:{default:!0}});var T=ue(E,2);{var _=I=>{var R=Gr(),L=We(R);Ut(L,17,()=>r.actions??[],Zt,(V,P,k)=>{var W=Oee(),O=We(W);Ns(O,{children:(Pe,j)=>{var de=$ee(),pe=We(de),Ne=ve(pe,!0);le(pe);var Be=ue(pe,2);yt(Be,{get variant(){return"plain"},onclick:_e=>u(k,_e),children:(_e,Ge)=>{Or(_e,{iconName:"more-vertical",get mb(){return e.mb}})},$$slots:{default:!0}}),Le(_e=>vt(Ne,_e),[()=>l(q(P).type)]),K(Pe,de)},$$slots:{default:!0}});var Q=ue(O,2);{var ne=Pe=>{ww(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(Q,Pe=>{q(P).type==="command"&&Pe(ne)})}var X=ue(Q,2);{var U=Pe=>{Mw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(X,Pe=>{q(P).type==="open"&&Pe(U)})}var fe=ue(X,2);{var xe=Pe=>{Tw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(fe,Pe=>{q(P).type==="js"&&Pe(xe)})}var oe=ue(fe,2);{var be=Pe=>{Sw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(oe,Pe=>{q(P).type==="input"&&Pe(be)})}var ee=ue(oe,2);{var Z=Pe=>{Iw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(ee,Pe=>{q(P).type==="sleep"&&Pe(Z)})}var re=ue(ee,2);{var me=Pe=>{Bw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(re,Pe=>{q(P).type==="templaterCreateNote"&&Pe(me)})}var ce=ue(re,2);{var Ae=Pe=>{kw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(ce,Pe=>{q(P).type==="updateMetadata"&&Pe(Ae)})}var we=ue(ce,2);{var G=Pe=>{_w(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(we,Pe=>{q(P).type==="createNote"&&Pe(G)})}var J=ue(we,2);{var ge=Pe=>{Aw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(J,Pe=>{q(P).type==="runTemplaterFile"&&Pe(ge)})}var ye=ue(J,2);{var De=Pe=>{Nw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(ye,Pe=>{q(P).type==="replaceInNote"&&Pe(De)})}var Ie=ue(ye,2);{var Oe=Pe=>{Cw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(Ie,Pe=>{q(P).type==="regexpReplaceInNote"&&Pe(Oe)})}var Je=ue(Ie,2);{var wt=Pe=>{Fw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(Je,Pe=>{q(P).type==="replaceSelf"&&Pe(wt)})}var qe=ue(Je,2);{var rr=Pe=>{Ew(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(qe,Pe=>{q(P).type==="insertIntoNote"&&Pe(rr)})}var Wt=ue(qe,2);{var pr=Pe=>{Dw(Pe,{get mb(){return e.mb},get action(){return r.actions[k]},set action(j){r.actions[k]=j}})};et(Wt,Pe=>{q(P).type==="inlineJS"&&Pe(pr)})}K(V,W)}),K(I,R)};et(T,I=>{r.actions&&I(_)})}var C=ue(T,4);co(C,I=>n=I,()=>n);var N=ue(C,2);Ma(N,{children:(I,R)=>{var L=Ree(),V=We(L);yt(V,{get variant(){return"primary"},onclick:()=>e.modal.okay(ft(r)),children:(k,W)=>{_t();var O=Vt();Le(()=>vt(O,e.modal.options.submitText)),K(k,O)},$$slots:{default:!0}});var P=ue(V,2);yt(P,{get variant(){return"default"},onclick:()=>e.modal.cancel(),children:(k,W)=>{_t();var O=Vt("Cancel");K(k,O)},$$slots:{default:!0}}),K(I,L)},$$slots:{default:!0}}),Zl(x,()=>q(a),I=>ke(a,I)),K(t,m),Ee()}var Vv=class extends Hc{constructor(e,r){super(),this.mb=e,this.options=r}onMount(e){lt.empty(e),this.component&&Dr(this.component),this.component=Br(Pw,{target:e,props:{mb:this.mb,modal:this,buttonConfig:this.options.config??this.mb.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){lt.empty(e),this.component&&Dr(this.component)}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var Vee=(t,e,r)=>r.onSelect(r.image),Uee=(t,e,r,n)=>e(t,n.image),qee=se('<div class="mb-image-card" role="button" tabindex="0"><img class="mb-image-card-image"> <div class="mb-image-card-footer"><span> </span></div></div>');function $w(t,e){Se(e,!0);let r=tr(e,["$$slots","$$events","$$legacy"]);function n(u,c){u.key===" "&&e.onSelect(c)}var i=qee();i.__click=[Vee,r,e],i.__keydown=[Uee,n,r,e];var a=ve(i),o=ue(a,2),s=ve(o),l=ve(s,!0);le(s),le(o),le(i),Le(u=>{rt(a,"src",u),rt(a,"alt",e.image),vt(l,e.image)},[()=>e.mb.internal.imagePathToUri(e.image)]),K(t,i),Ee()}Mt(["click","keydown"]);var zee=se("<!> <!>",1),Hee=se('<div class="mb-image-modal-header"><input type="text" placeholder="Search images..."></div> <div class="mb-image-card-grid"></div> <!>',1);function Ow(t,e){Se(e,!0);let r=it(""),n=e.mb.internal.createFuzzySearch(),i=cr(()=>q(r)?(n.setSearch(q(r)),n.filterItems(e.options,c=>c.value)):e.options);var a=Hee(),o=We(a),s=ve(o);At(s),le(o);var l=ue(o,2);Ut(l,21,()=>q(i),Zt,(c,f)=>{$w(c,{get mb(){return e.mb},get image(){return q(f).value},get onSelect(){return e.onSelect}})}),le(l);var u=ue(l,2);Ma(u,{children:(c,f)=>{var m=zee(),p=We(m);{var d=b=>{yt(b,{get variant(){return"primary"},onclick:()=>e.onSelect(void 0),children:(y,D)=>{_t();var v=Vt("Select none");K(y,v)},$$slots:{default:!0}})};et(p,b=>{e.canSelectNone&&b(d)})}var h=ue(p,2);yt(h,{onclick:()=>e.onCancel(),children:(b,y)=>{_t();var D=Vt("Cancel");K(b,D)},$$slots:{default:!0}}),K(c,m)},$$slots:{default:!0}}),xt(s,()=>q(r),c=>ke(r,c)),K(t,a),Ee()}var ll=class extends Hc{constructor(e){super(),this.createComponent=e}onMount(e){lt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component&&Dr(this.component),lt.empty(e)}};var Gee=se("<textarea></textarea>"),Wee=se('<input type="text">'),Yee=se("<!> <!>",1),jee=se('<p> </p> <div class="mb-full-width-text-input"><!></div> <!>',1);function Rw(t,e){Se(e,!0);let r=it(dt(e.options.value));var n=jee(),i=We(n),a=ve(i,!0);le(i);var o=ue(i,2),s=ve(o);{var l=f=>{var m=Gee();Dn(m),xt(m,()=>q(r),p=>ke(r,p)),K(f,m)},u=f=>{var m=Wee();At(m),xt(m,()=>q(r),p=>ke(r,p)),K(f,m)};et(s,f=>{e.options.multiline?f(l):f(u,!1)})}le(o);var c=ue(o,2);Ma(c,{children:(f,m)=>{var p=Yee(),d=We(p);yt(d,{get variant(){return"primary"},onclick:()=>e.options.onSubmit(ft(q(r))),children:(b,y)=>{_t();var D=Vt("OK");K(b,D)},$$slots:{default:!0}});var h=ue(d,2);yt(h,{onclick:()=>e.options.onCancel(),children:(b,y)=>{_t();var D=Vt("Cancel");K(b,D)},$$slots:{default:!0}}),K(f,p)},$$slots:{default:!0}}),Le(()=>vt(a,e.options.subTitle)),K(t,n),Ee()}var qo=class{constructor(e,r){this.mb=e,this.selectCallback=r}onSelected(e){this.selectCallback(e)}};var Uv=class extends qo{getItemText(e){return e.name}getItemDescription(e){}getItems(){return this.mb.internal.getAllCommands()}};var hp=class extends qo{constructor(e,r,n){super(e,r),this.filterFunction=n}getItemText(e){return e}getItemDescription(e){}getItems(){return this.filterFunction!==void 0?this.mb.file.getAllFiles().filter(e=>this.filterFunction(e)):this.mb.file.getAllFiles()}};var qv=class extends qo{getItemText(e){return e}getItemDescription(e){}getItems(){return this.mb.file.getAllFolders()}};var zv=class extends qo{constructor(e,r,n){super(e,r),this.ipf=n}getItemText(e){return e.displayValue}getItemDescription(e){return e.displayDescription}getItems(){return this.mb.internal.getSuggesterOptions(this.ipf)}};var Zee=se('<pre class="mb-pre"><code class="language-none mb-none"> </code></pre>'),Jee=se("<tr><td>Tip</td><td> </td></tr>"),Xee=se("<a> </a><br>",1),Qee=se("<tr><td>Docs</td><td></td></tr>"),Kee=se('<tr><td>Context</td><td><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></td></tr>'),ete=se('<div class="mb-card mb-card-full-width markdown-rendered"><h6><span> </span> </h6> <!> <table><tbody><tr><td>Cause</td><td> </td></tr><tr><td>Effect</td><td> </td></tr><!><!><!></tbody></table></div>'),tte=se('<div class="mb-card"><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></div>');function Hv(t,e){Se(e,!0);var r=Gr(),n=We(r);{var i=o=>{var s=ete(),l=ve(s),u=ve(l),c=ve(u);le(u);var f=ue(u);le(l);var m=ue(l,2);{var p=I=>{var R=Zee(),L=ve(R),V=ve(L,!0);le(L),le(R),Le(()=>vt(V,e.error.positionContext)),K(I,R)};et(m,I=>{e.error.positionContext&&I(p)})}var d=ue(m,2),h=ve(d),b=ve(h),y=ue(ve(b)),D=ve(y,!0);le(y),le(b);var v=ue(b),A=ue(ve(v)),w=ve(A,!0);le(A),le(v);var x=ue(v);{var E=I=>{var R=Jee(),L=ue(ve(R)),V=ve(L,!0);le(L),le(R),Le(()=>vt(V,e.error.tip)),K(I,R)};et(x,I=>{e.error.tip&&I(E)})}var T=ue(x);{var _=I=>{var R=Qee(),L=ue(ve(R));Ut(L,21,()=>e.error.docs,Zt,(V,P)=>{var k=Xee(),W=We(k),O=ve(W,!0);le(W),_t(),Le(()=>{rt(W,"href",q(P)),vt(O,q(P))}),K(V,k)}),le(L),le(R),K(I,R)};et(T,I=>{e.error.docs&&I(_)})}var C=ue(T);{var N=I=>{var R=Kee(),L=ue(ve(R)),V=ve(L),P=ve(V),k=ve(P,!0);le(P),le(V),le(L),le(R),Le(W=>vt(k,W),[()=>JSON.stringify(e.error.context,null,4)]),K(I,R)};et(C,I=>{e.error.context&&I(N)})}le(h),le(d),le(s),Le(I=>{Vr(u,1,ls(e.error.errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")),vt(c,`${e.error.errorLevel??""}
[${I??""}]`),vt(f,` - ${e.error.effect??""}`),vt(D,e.error.cause),vt(w,e.error.effect)},[()=>e.error.getErrorType()]),K(o,s)},a=o=>{var s=tte(),l=ve(s),u=ve(l),c=ve(u,!0);le(u),le(l),le(s),Le(()=>vt(c,e.error.stack)),K(o,s)};et(n,o=>{e.error instanceof Rn?o(i):o(a,!1)})}K(t,r),Ee()}var rte=se("<p> </p>"),nte=se('<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>'),ite=se("<p> </p>"),ate=se("<h6>Errors</h6> <!> <!>",1),ote=se("<p> </p>"),ste=se("<h6>Warnings</h6> <!> <!>",1),ute=se("<!> <!> <!> <!>",1);function Fs(t,e){Se(e,!0);var r=ute(),n=We(r);{var i=f=>{var m=rte(),p=ve(m,!0);le(m),Le(()=>vt(p,e.settings.text)),K(f,m)};et(n,f=>{e.settings.text&&f(i)})}var a=ue(n,2);{var o=f=>{var m=nte(),p=ve(m),d=ve(p,!0);le(p),le(m),Le(()=>vt(d,e.settings.code)),K(f,m)};et(a,f=>{e.settings.code&&f(o)})}var s=ue(a,2);{var l=f=>{var m=ate(),p=ue(We(m),2);{var d=b=>{var y=ite(),D=ve(y,!0);le(y),Le(()=>vt(D,e.settings.errorText)),K(b,y)};et(p,b=>{e.settings.errorText&&b(d)})}var h=ue(p,2);Ut(h,17,()=>e.settings.errorCollection.getErrors(),Zt,(b,y)=>{Hv(b,{get error(){return q(y)}})}),K(f,m)};et(s,f=>{e.settings.errorCollection.hasErrors()&&f(l)})}var u=ue(s,2);{var c=f=>{var m=ste(),p=ue(We(m),2);{var d=b=>{var y=ote(),D=ve(y,!0);le(y),Le(()=>vt(D,e.settings.warningText)),K(b,y)};et(p,b=>{e.settings.warningText&&b(d)})}var h=ue(p,2);Ut(h,17,()=>e.settings.errorCollection.getWarnings(),Zt,(b,y)=>{Hv(b,{get error(){return q(y)}})}),K(f,m)};et(u,f=>{e.settings.errorCollection.hasWarnings()&&f(c)})}K(t,r),Ee()}var lte=(t,e)=>e(),cte=(t,e)=>{t.key===" "&&e()},fte=se('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" x2="12" y1="8" y2="12"></line><line x1="12" x2="12.01" y1="16" y2="16"></line></svg> <span class="mb-error">[META_BIND_ERROR]</span>',1),pte=qm('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-triangle"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><line x1="12" x2="12" y1="9" y2="13"></line><line x1="12" x2="12.01" y1="17" y2="17"></line></svg>'),mte=qm('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>'),dte=se('<div class="mb-error-collection" role="button" tabindex="0" aria-label="Click to view errors and warnings"><!></div>');function Gc(t,e){Se(e,!0);function r(){e.mb.internal.openErrorCollectionViewModal(e.settings)}var n=Gr(),i=We(n);{var a=o=>{var s=dte();s.__click=[lte,r],s.__keydown=[cte,r];var l=ve(s);{var u=f=>{var m=fte();_t(2),K(f,m)},c=(f,m)=>{{var p=h=>{var b=pte();K(h,b)},d=h=>{var b=mte();K(h,b)};et(f,h=>{e.settings.errorCollection.hasWarnings()?h(p):h(d,!1)},m)}};et(l,f=>{e.settings.errorCollection.hasErrors()?f(u):f(c,!1)})}le(s),K(o,s)};et(i,o=>{e.settings.errorCollection.isEmpty()||o(a)})}K(t,n),Ee()}Mt(["click","keydown"]);var Lw=["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"],hte=Lw.map(t=>`.${t}`),Gv=class{constructor(e){this.mb=e}openCommandSelectModal(e){this.createSearchModal(new Uv(this.mb,e)).open()}openFileSelectModal(e){this.createSearchModal(new hp(this.mb,e)).open()}openFilteredFileSelectModal(e,r){this.createSearchModal(new hp(this.mb,e,r)).open()}openMarkdownFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>r.endsWith(".md"))}openImageFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>hte.some(n=>r.endsWith(n)))}openFolderSelectModal(e){this.createSearchModal(new qv(this.mb,e)).open()}openButtonBuilderModal(e){this.createModal(new Vv(this.mb,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,r){this.createSearchModal(new zv(this.mb,r,e)).open()}openImageSuggesterModal(e,r,n){this.createModal(new ll((i,a)=>Br(Ow,{target:a,props:{mb:this.mb,options:this.getImageSuggesterOptions(e),canSelectNone:r,onSelect:o=>{n(o),i.closeModal()},onCancel:()=>{i.closeModal()}}})),{title:"Select an image from your Vault",classes:["mb-image-suggester-modal"]}).open()}openDatePickerModal(e,r){this.createModal(new ll((n,i)=>Br(xw,{target:i,props:{selectedDate:e,dateChangeCallback:a=>{r(a),n.closeModal()}}})),{title:"Meta Bind date picker"}).open()}openTextPromptModal(e){this.createModal(new ll((r,n)=>Br(Rw,{target:n,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),r.closeModal()},onCancel:()=>{e.onCancel(),r.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new ll((r,n)=>Br(Fs,{target:n,props:{settings:e}})),{title:"Meta Bind error overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,r){let n=Br(Gc,{target:e,props:{mb:this.mb,settings:r}});return()=>{Dr(n)}}};var U4=require("obsidian"),Wv=class{constructor(){}setSearch(e){this.preparedSearch=(0,U4.prepareFuzzySearch)(e)}filterItems(e,r){return this.preparedSearch?e.filter(n=>this.preparedSearch?.(r(n))?.score!=null):e}};var na=require("obsidian");var du=class{constructor(e,r,n){this.value=e,this.displayValue=r,this.displayDescription=n}valueAsString(){return this.value?.toString()??"null"}};function q4(t){let e=[];for(let r of t.children)r instanceof na.TFile&&z4(r.extension)&&e.push(new du(r.path,r.name)),r instanceof na.TFolder&&e.push(...q4(r));return e}function gte(t,e,r){let n=[];for(let i of r){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let s=new $r({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 na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof na.TFolder)){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(...q4(o))}for(let i of e){let a=dn(i.value);if(!a){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof na.TFile)){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!z4(o.extension)){let s=new $r({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new na.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(new du(o.path,o.name))}return n}function z4(t){return Lw.contains(t)}function H4(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery");return gte(t,r,n)}var G4=require("obsidian");var Yv=class extends G4.Modal{constructor(e,r,n){super(e.app),this.options=n,this.content=r,r.setModal(this)}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&lt.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}};var gp=require("obsidian"),jv=class extends gp.FuzzySuggestModal{constructor(e,r){super(e.app),this.content=r}renderSuggestion(e,r){(0,gp.renderResults)(r.createDiv(),this.content.getItemText(e.item),e.match);let n=this.content.getItemDescription(e.item);n&&(0,gp.renderResults)(r.createEl("small",{cls:"mb-search-modal-element-description"}),n,{score:0,matches:[]})}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,r){this.content.onSelected(e)}};var W4=require("obsidian");function vte(t,e,r,n,i){let a=[];for(let o of r)a.push(new du(o.value,o.name,"option"));if(n.length>0){let o;try{o=R4(t)}catch(l){return new W4.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",l),a}let s=he.object({name:he.string().min(1),path:he.string().min(1)});for(let l of n)o.pages(l.value,e).forEach(c=>{try{let f=c.file;if(!s.safeParse(f).success)return;let m=XD(f.path,f.name,i);a.push(new du(m,f.name,`file: ${f.path}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function Y4(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return vte(t,e.mountable.getFilePath(),r,n,i===void 0?"true":i.value)}var j4=require("obsidian"),Zv=class{constructor(){this.menu=new j4.Menu}setItems(e){for(let r of e)this.menu.addItem(n=>{n.setTitle(r.name),r.icon&&n.setIcon(r.icon),r.warning&&n.setWarning(r.warning),n.onClick(r.onclick)})}show(e,r){this.menu.showAtPosition({x:e,y:r},document)}showWithEvent(e){this.menu.showAtMouseEvent(e),e.stopImmediatePropagation(),e.preventDefault()}};var Vw=require("obsidian");var Jv=class{constructor(e,r,n,i,a){this.mb=e,this.containerEl=r,this.filePath=n,this.code=i,this.hidden=a,this.jsEngine=mu(this.mb),this.renderComponent=new Vw.Component}async evaluateCode(e){let r=await this.jsEngine.internal.getContextForMarkdownOther(this.filePath);return this.jsEngine.internal.execute({code:this.code,context:r,container:this.containerEl,component:this.renderComponent,contextOverrides:e})}async evaluate(e){try{lt.empty(this.containerEl),lt.removeClass(this.containerEl,"mb-error"),this.renderComponent.unload(),this.renderComponent=new Vw.Component,this.renderComponent.load();let r=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.filePath,this.renderComponent);return this.hidden||await n.render(r.result),n.convertToSimpleObject(r.result)}catch(r){r instanceof Error&&(this.containerEl.innerText=r.message,lt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var Xv=class extends Gv{constructor(e){super(e),this.omb=e,this.app=e.app}getLifecycleHookValidator(){return he.instanceof(Tn.Component)}getImageSuggesterOptions(e){return H4(this.omb,e)}getSuggesterOptions(e){return Y4(this.omb,e)}async renderMarkdown(e,r,n){let i=new Tn.Component;return i.load(),await Tn.MarkdownRenderer.render(this.app,e,r,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return mu(this.omb),!0}catch{return!1}}async jsEngineRunFile(e,r,n,i){let a=mu(this.omb),o=await a.internal.getContextForMarkdownCallingJSFile(r,e),s=new Tn.Component;return await a.internal.executeFile(e,{component:s,container:i,context:o,contextOverrides:n}),()=>s.unload()}async jsEngineRunCode(e,r,n,i){let a=mu(this.omb),o=await a.internal.getContextForMarkdownOther(r),s=new Tn.Component;return await a.internal.execute({code:e,component:s,container:i,context:o,contextOverrides:n}),()=>s.unload()}createJsRenderer(e,r,n,i){return new Jv(this.omb,e,r,n,i)}showNotice(e){new Tn.Notice(e)}parseYaml(e){return(0,Tn.parseYaml)(e)}stringifyYaml(e){return(0,Tn.stringifyYaml)(e)}setIcon(e,r){(0,Tn.setIcon)(e,r)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,r){return new Yv(this.omb,e,r)}createSearchModal(e){return new jv(this.omb,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}createFuzzySearch(){return new Wv}createContextMenu(e){let r=new Zv;return r.setItems(e),r}async evaluateTemplaterTemplate(e,r){let n=yw(this.omb),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof Tn.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(r);if(!a||!(a instanceof Tn.TFile))throw new Error(`Target file not found: ${r}`);let o=n.create_running_config(i,a,4);return await n.read_and_parse_template(o)}async createNoteWithTemplater(e,r,n,i=!1,a=!1){let o=yw(this.omb),s=this.app.vault.getAbstractFileByPath(e);if(!s||!(s instanceof Tn.TFile))throw new Error(`Template file not found: ${e}`);let l;if(r!==void 0){let c=this.app.vault.getAbstractFileByPath(r);if(!c||!(c instanceof Tn.TFolder))throw new Error(`Folder not found: ${r}`);l=c}let u=await o.create_new_note_from_template(s,l,n,!1);return i&&u&&await this.mb.file.openInSourceMode(u,a),u?.path}};var Uw=require("obsidian");var Qv=class extends Lc{constructor(e,r,n){super(r,n),this.mb=e,this.mb.plugin.registerEvent(this.mb.app.metadataCache.on("changed",(i,a,o)=>{this.manager.onExternalUpdate(this,i.path,structuredClone(o.frontmatter)??{})}))}readExternal(e){let r=this.mb.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof Uw.TFile))throw new Lt({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let n=this.mb.app.metadataCache.getFileCache(r)?.frontmatter;return structuredClone(n)??{}}getDefaultCacheItem(e){let r=this.mb.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof Uw.TFile))throw new Lt({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let n=this.mb.app.metadataCache.getFileCache(r)?.frontmatter;return{data:structuredClone(n)??{},storagePath:e,file:r,...this.manager.getDefaultCacheItem()}}syncExternal(e){this.mb.app.fileManager.processFrontMatter(e.file,r=>{Object.assign(r,e.data)})}};var vp=class extends $s{constructor(e,r){super(void 0),this.ctx=e,this.element=r}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};var Z4=require("obsidian");function qw(t,e){Se(e,!0);let r=new zc(e.mb,_r(),"","block",e.declaration);pu(t,{mountable:r}),Ee()}var yte=se('<div class="mb-card"><h3> </h3> <!> <!> <code> </code></div>');function zw(t,e){Se(e,!0);let r=e.mb.api.createInlineFieldFromString(e.declaration.inputField,"",void 0,"block"),n=e.mb.api.createInlineFieldFromString(e.declaration.declaration,"",void 0,"block");var i=yte(),a=ve(i),o=ve(a,!0);le(a);var s=ue(a,2);pu(s,{mountable:r});var l=ue(s,2);pu(l,{mountable:n});var u=ue(l,2),c=ve(u,!0);le(u),le(i),Le(()=>{vt(o,e.declaration.title),vt(c,e.declaration.display)}),K(t,i),Ee()}var bte=se("<h1>Meta Bind Playground</h1> <span><!> <!> <!></span>",1),xte=se(`<div class="mb-faq-view markdown-rendered"><!> <h2>Quick Reference</h2> <h3>Error Messages</h3> <p>When creating <a>Input Fields</a> or <a>View Fields</a> <strong>warnings</strong> ( <!> ) and <strong>errors</strong> ( <!> ) can occur. These are <strong>clickable</strong> and will show a modal with detailed information about the error
when clicked.</p> <h3>Unloaded Message</h3> <p>A message like this <span class="mb-warning">[MB_UNLOADED] ...</span> means that Obsidian told Meta Bind to unload
the field that was once displayed there. This usually happens when Meta Bind was disabled, such as after a plugin
update, or when another plugin is interfering with Meta Bind.</p> <p>Usually reopening the note or restarting Obsidian causes the field to display normally again.</p> <h3>Bind Targets</h3> <p><a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a> let the plugin know what frontmatter properties to bind <a>Input Fields</a> and <a>View Fields</a> to.</p> <h2>Playground</h2> <h3>Input Fields</h3> <p><a>Input Fields</a> let you change the frontmatter of your notes from inside
of notes.</p> <!> <h3>View Fields</h3> <p><a>View Fields</a> let you view and perform calculations using the frontmatter
of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
fields and as fast as obsidian allows it for changes from other sources.</p> <!></div>`);function Hw(t,e){Se(e,!0);let r="INPUT[someInputFieldDeclaration]",n=dt(new er("exampleWarningErrorCollection")),i="INPUT[someInputFieldDeclaration]",a=dt(new er("exampleErrorErrorCollection"));Nb(()=>{n.add(new ef({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),a.add(new ef({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"}))});var o=xte(),s=ve(o);Ns(s,{children:(T,_)=>{var C=bte(),N=ue(We(C),2),I=ve(N);yt(I,{get variant(){return"primary"},onclick:()=>{qt.open(qt.linkToHome())},children:(V,P)=>{_t();var k=Vt("Docs");K(V,k)},$$slots:{default:!0}});var R=ue(I,2);yt(R,{onclick:()=>{qt.open(qt.linkToGithub())},children:(V,P)=>{_t();var k=Vt("GitHub");K(V,k)},$$slots:{default:!0}});var L=ue(R,2);yt(L,{onclick:()=>{qt.open(qt.linkToIssues())},children:(V,P)=>{_t();var k=Vt("Report Issue");K(V,k)},$$slots:{default:!0}}),le(N),K(T,C)},$$slots:{default:!0}});var l=ue(s,6),u=ue(ve(l)),c=ue(u,2),f=ue(c,4);let m=cr(()=>({errorCollection:n,code:r}));Gc(f,{get mb(){return e.mb},get settings(){return q(m)}});var p=ue(f,4);let d=cr(()=>({errorCollection:a,code:i}));Gc(p,{get mb(){return e.mb},get settings(){return q(d)}}),_t(3),le(l);var h=ue(l,10),b=ue(ve(h),2),y=ue(b,2);_t(),le(h);var D=ue(h,6),v=ve(D);_t(),le(D);var A=ue(D,2);Ut(A,17,()=>h4(e.mb),Zt,(T,_)=>{qw(T,{get declaration(){return q(_)[1]},get mb(){return e.mb}})});var w=ue(A,4),x=ve(w);_t(),le(w);var E=ue(w,2);Ut(E,17,()=>Object.values(hw),Zt,(T,_)=>{var C=Gr(),N=We(C);Ut(N,17,()=>q(_),Zt,(I,R)=>{zw(I,{get declaration(){return q(R)},get mb(){return e.mb}})}),K(T,C)}),le(o),Le((T,_,C,N,I,R)=>{rt(u,"href",T),rt(c,"href",_),rt(b,"href",C),rt(y,"href",N),rt(v,"href",I),rt(x,"href",R)},[()=>qt.linkToInputFields(),()=>qt.linkToViewFields(),()=>qt.linkToInputFields(),()=>qt.linkToViewFields(),()=>qt.linkToInputFields(),()=>qt.linkToViewFields()]),K(t,o),Ee()}var cl="mb-playground-view-type",Kv=class extends Z4.ItemView{constructor(e,r){super(e),this.mb=r}getViewType(){return cl}getDisplayText(){return"Meta Bind playground"}async onOpen(){this.contentEl.empty(),this.component=Br(Hw,{target:this.contentEl,props:{mb:this.mb}})}async onClose(){this.component&&Dr(this.component)}};var ri=require("obsidian");var J4=require("obsidian");var bp=require("obsidian");var yp=require("obsidian");var wte=se("<span> </span> <!> <!> <!>",1),_te=se('<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>');function Gw(t,e){Se(e,!0);let r=at(e,"template",15);function n(){e.mb.internal.openButtonBuilderModal({submitText:"Submit",config:ft(r()),onOkay:c=>{r(c)}})}function i(){let c=(0,yp.stringifyYaml)(ft(r()));navigator.clipboard.writeText(c),new yp.Notice("meta-bind | Copied to clipboard")}var a=_te(),o=ve(a);Ns(o,{stretchChildren:!0,children:(c,f)=>{var m=wte(),p=We(m),d=ve(p,!0);le(p);var h=ue(p,2);yt(h,{onclick:()=>n(),get variant(){return"primary"},tooltip:"Edit",children:(D,v)=>{Or(D,{get mb(){return e.mb},iconName:"pen-line"})},$$slots:{default:!0}});var b=ue(h,2);yt(b,{onclick:()=>i(),get variant(){return"default"},tooltip:"Copy",children:(D,v)=>{Or(D,{get mb(){return e.mb},iconName:"copy"})},$$slots:{default:!0}});var y=ue(b,2);yt(y,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete",children:(D,v)=>{Or(D,{get mb(){return e.mb},iconName:"x"})},$$slots:{default:!0}}),Le(()=>vt(d,r().id)),K(c,m)},$$slots:{default:!0}});var s=ue(o,2),l=ve(s),u=ve(l,!0);le(l),le(s),le(a),Le(c=>vt(u,c),[()=>(0,yp.stringifyYaml)(r())]),K(t,a),Ee()}var Ate=se('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),Dte=se("<!> <!>",1),Ste=se("<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>");function Ww(t,e){Se(e,!0);let r=it(void 0),n=it(dt(e.buttonConfigs));function i(b){ke(n,q(n).filter(y=>y!==b),!0)}function a(){q(n).push(e.modal.mb.buttonActionRunner.createDefaultButtonConfig())}async function o(){let b;try{b=(0,bp.parseYaml)(await navigator.clipboard.readText())}catch(D){console.warn(D),new bp.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let y=lc.safeParse(b);if(!y.success){let D=Rd(y.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new es({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:D.message,docs:[qt.linkToButtonConfig()]})),console.warn(D),new bp.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}q(n).push(b)}function s(){ke(r,e.modal.save(ft(q(n))),!0),q(r)===void 0&&e.modal.close()}function l(){e.modal.close()}var u=Ste(),c=ue(ve(u),2);Ut(c,17,()=>q(n),Zt,(b,y,D)=>{Gw(b,{get mb(){return e.modal.mb},onDelete:i,get template(){return q(n)[D]},set template(v){q(n)[D]=v}})});var f=ue(c,2);yt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(b,y)=>{_t();var D=Vt("Add Template");K(b,D)},$$slots:{default:!0}});var m=ue(f,2);yt(m,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(b,y)=>{_t();var D=Vt("Add Template from Clipboard");K(b,D)},$$slots:{default:!0}});var p=ue(m,2);{var d=b=>{var y=Ate(),D=ue(ve(y),2);let v=cr(()=>({errorCollection:q(r)}));Fs(D,{get settings(){return q(v)}}),le(y),K(b,y)};et(p,b=>{q(r)&&b(d)})}var h=ue(p,2);Ma(h,{children:(b,y)=>{var D=Dte(),v=We(D);yt(v,{onclick:()=>s(),get variant(){return"primary"},tooltip:"Save changes",children:(w,x)=>{_t();var E=Vt("Save");K(w,E)},$$slots:{default:!0}});var A=ue(v,2);yt(A,{onclick:()=>l(),tooltip:"Revert changes",children:(w,x)=>{_t();var E=Vt("Cancel");K(w,E)},$$slots:{default:!0}}),K(b,D)},$$slots:{default:!0}}),le(u),K(t,u),Ee()}var ey=class extends J4.Modal{constructor(e,r){super(e),this.mb=r}onOpen(){this.contentEl.empty(),this.component&&Dr(this.component),this.component=Br(Ww,{target:this.contentEl,props:{buttonConfigs:structuredClone(this.mb.getSettings().buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Dr(this.component)}save(e){let r=this.mb.buttonManager.setButtonTemplates(e);if(r.hasErrors())return r;this.mb.updateSettings(n=>{n.buttonTemplates=e})}};var X4=require("obsidian");var Ete=se('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),Tte=se('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),Mte=se("<!> <!>",1),Cte=se('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function Yw(t,e){Se(e,!0);let r=it(void 0),n=it(dt(e.excludedFolders));function i(h){ke(n,q(n).filter(b=>b!==h),!0)}function a(){q(n).push("")}function o(){ke(r,e.modal.save(ft(q(n))),!0),q(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=Cte(),u=ve(l),c=ue(ve(u));Ut(c,21,()=>q(n),Zt,(h,b,y)=>{var D=Ete(),v=ve(D),A=ve(v);At(A),le(v);var w=ue(v),x=ve(w);yt(x,{onclick:()=>i(q(b)),tooltip:"Delete",children:(E,T)=>{Or(E,{get mb(){return e.mb},iconName:"x"})},$$slots:{default:!0}}),le(w),le(D),xt(A,()=>q(n)[y],E=>q(n)[y]=E),K(h,D)}),le(c),le(u);var f=ue(u,2);yt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(h,b)=>{_t();var y=Vt("Add folder");K(h,y)},$$slots:{default:!0}});var m=ue(f,2);{var p=h=>{var b=Tte(),y=ue(ve(b),2);let D=cr(()=>({errorCollection:q(r)}));Fs(y,{get settings(){return q(D)}}),le(b),K(h,b)};et(m,h=>{q(r)&&h(p)})}var d=ue(m,2);Ma(d,{children:(h,b)=>{var y=Mte(),D=We(y);yt(D,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(A,w)=>{_t();var x=Vt("Save");K(A,x)},$$slots:{default:!0}});var v=ue(D,2);yt(v,{onclick:()=>s(),tooltip:"Revert changes",children:(A,w)=>{_t();var x=Vt("Cancel");K(A,x)},$$slots:{default:!0}}),K(h,y)},$$slots:{default:!0}}),le(l),K(t,l),Ee()}var ty=class extends X4.Modal{constructor(e,r){super(e),this.mb=r}onOpen(){this.contentEl.empty(),this.component&&Dr(this.component),this.component=Br(Yw,{target:this.contentEl,props:{excludedFolders:structuredClone(this.mb.getSettings().excludedFolders),modal:this,mb:this.mb}})}onClose(){this.contentEl.empty(),this.component&&Dr(this.component)}save(e){for(let r of e)if(r===""){let n=new er("Excluded folders");return n.add(new Error(`Invalid Folder Path '${r}'. Folder path may not be empty.`)),n}this.mb.updateSettings(r=>{r.excludedFolders=e})}};var Q4=require("obsidian");var Nte=se('<input type="text" placeholder="template-name"> <!>',1),Fte=se('<div class="mb-card"><!> <textarea placeholder="INPUT[slider(addLabels)]" class="mb-textarea"></textarea></div>');function jw(t,e){Se(e,!0);let r=at(e,"template",15);var n=Fte(),i=ve(n);Ns(i,{children:(o,s)=>{var l=Nte(),u=We(l);At(u);var c=ue(u,2);yt(c,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete Template",children:(f,m)=>{Or(f,{get mb(){return e.mb},iconName:"x"})},$$slots:{default:!0}}),xt(u,()=>r().name,f=>r(r().name=f,!0)),K(o,l)},$$slots:{default:!0}});var a=ue(i,2);Dn(a),le(n),xt(a,()=>r().declaration,o=>r(r().declaration=o,!0)),K(t,n),Ee()}var Ite=se('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),Bte=se("<!> <!>",1),kte=se("<div><h2>Meta Bind Input Field Templates</h2> <!> <!> <!> <!></div>");function Zw(t,e){Se(e,!0);let r=it(void 0),n=it(dt(e.inputFieldTemplates));function i(d){ke(n,q(n).filter(h=>h!==d),!0)}function a(){q(n).push({name:"",declaration:""})}function o(){ke(r,e.modal.save(ft(q(n))),!0),q(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=kte(),u=ue(ve(l),2);Ut(u,17,()=>q(n),Zt,(d,h)=>{jw(d,{get mb(){return e.modal.mb},get template(){return q(h)},onDelete:i})});var c=ue(u,2);yt(c,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create New Template",children:(d,h)=>{_t();var b=Vt("Add Template");K(d,b)},$$slots:{default:!0}});var f=ue(c,2);{var m=d=>{var h=Ite(),b=ue(ve(h),2);let y=cr(()=>({errorCollection:q(r)}));Fs(b,{get settings(){return q(y)}}),le(h),K(d,h)};et(f,d=>{q(r)&&d(m)})}var p=ue(f,2);Ma(p,{children:(d,h)=>{var b=Bte(),y=We(b);yt(y,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save Changes",children:(v,A)=>{_t();var w=Vt("Save");K(v,w)},$$slots:{default:!0}});var D=ue(y,2);yt(D,{onclick:()=>s(),tooltip:"Revert Changes",children:(v,A)=>{_t();var w=Vt("Cancel");K(v,w)},$$slots:{default:!0}}),K(d,b)},$$slots:{default:!0}}),le(l),K(t,l),Ee()}var ry=class extends Q4.Modal{constructor(e,r){super(e),this.mb=r}onOpen(){this.contentEl.empty(),this.component&&Dr(this.component),this.component=Br(Zw,{target:this.contentEl,props:{inputFieldTemplates:structuredClone(this.mb.getSettings().inputFieldTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Dr(this.component)}save(e){let r=this.mb.inputFieldParser.parseTemplates(e);if(r.hasErrors())return r;this.mb.updateSettings(n=>{n.inputFieldTemplates=e})}};var ny=class extends ri.PluginSettingTab{constructor(e,r){super(e,r.plugin),this.mb=r}display(){let{containerEl:e}=this;if(e.empty(),this.mb.build==="dev"||this.mb.build==="canary"){e.createEl("p",{text:`You are using a ${this.mb.build} build (1.4.2). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let r=new ri.ButtonComponent(e);r.setButtonText("Learn About Canary Builds"),r.setCta(),r.onClick(()=>{qt.open(qt.linkToCanaryBuilds())})}new ri.Setting(e).setName("Quick access").addButton(r=>{r.setCta(),r.setButtonText("Docs"),r.onClick(()=>{qt.open(qt.linkToHome())})}).addButton(r=>{r.setButtonText("Open FAQ"),r.onClick(()=>{this.mb.activateView(cl)})}).addButton(r=>{r.setButtonText("GitHub"),r.onClick(()=>{qt.open(qt.linkToGithub())})}).addButton(r=>{r.setButtonText("Report issue"),r.onClick(()=>{qt.open(qt.linkToIssues())})}),new ri.Setting(e).setName("Enable syntax highlighting").setDesc("Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.mb.getSettings().enableSyntaxHighlighting),r.onChange(n=>{this.mb.updateSettings(i=>{i.enableSyntaxHighlighting=n})})}),new ri.Setting(e).setName("Enable editor right-click menu").setDesc("Enable a meta bind menu section in the editor right-click menu. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.mb.getSettings().enableEditorRightClickMenu),r.onChange(n=>{this.mb.updateSettings(i=>{i.enableEditorRightClickMenu=n})})}),new ri.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(r=>{r.setButtonText("Edit templates"),r.onClick(()=>{new ry(this.app,this.mb).open()})}),new ri.Setting(e).setName("Button templates").setDesc("You can specify button field templates here, and access them in inline buttons.").addButton(r=>{r.setButtonText("Edit templates"),r.onClick(()=>{new ey(this.app,this.mb).open()})}),new ri.Setting(e).setName("Excluded folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(r=>{r.setButtonText("Edit excluded folders"),r.onClick(()=>{new ty(this.app,this.mb).open()})}),new ri.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(r=>{r.setValue(this.mb.getSettings().viewFieldDisplayNullAsEmpty),r.onChange(n=>{this.mb.updateSettings(i=>{i.viewFieldDisplayNullAsEmpty=n})})}),new ri.Setting(e).setName("Enable JavaScript").setDesc("Enable features that run user written JavaScript. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.mb.getSettings().enableJs),r.onChange(n=>{this.mb.updateSettings(i=>{i.enableJs=n})})}),e.createEl("h2",{text:"Date and time settings"}),new ri.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(r=>{r.setValue(this.mb.getSettings().preferredDateFormat),r.onChange(n=>{this.mb.updateSettings(i=>{i.preferredDateFormat=n})})}),new ri.Setting(e).setName("First weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(r=>{for(let n of Yu)r.addOption(n.name,n.name);r.setValue(this.mb.getSettings().firstWeekday.name),r.onChange(n=>{this.mb.updateSettings(i=>{i.firstWeekday=Yu.find(a=>a.name===n)})})}),e.createEl("h2",{text:"Advanced settings"}),new ri.Setting(e).setName("Dev mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(r=>{r.setValue(this.mb.getSettings().devMode),r.onChange(n=>{this.mb.updateSettings(i=>{i.devMode=n})})}),new ri.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(r=>{r.setValue(this.mb.getSettings().ignoreCodeBlockRestrictions),r.onChange(n=>{this.mb.updateSettings(i=>{i.ignoreCodeBlockRestrictions=n})})}),new ri.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: ${zf.syncInterval}; Minimum: ${hh}; Maximum: ${gh}`).addText(r=>{r.setValue(this.mb.getSettings().syncInterval.toString()),r.onChange(n=>{this.mb.updateSettings(i=>{i.syncInterval=Number.parseInt(n),Number.isNaN(i.syncInterval)&&(i.syncInterval=zf.syncInterval),i.syncInterval<hh&&(i.syncInterval=hh),i.syncInterval>gh&&(i.syncInterval=gh)})})})}};var iy=class extends gv{constructor(e){super(),this.app=e.app,this.plugin=e,this.setComponents({api:new $v(this),internal:new Xv(this),file:new Rv(this)}),this.plugin.addSettingTab(new ny(this.app,this)),this.dependencyManager=new _v(this,[]),this.setUpDependencies(),this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.plugin.registerEditorExtension(p4(this)),this.addCommands(),c4(this),this.plugin.registerView(cl,r=>new Kv(r,this)),this.addStatusBarBuildIndicator(),this.getSettings().enableEditorRightClickMenu&&this.plugin.registerEvent(this.app.workspace.on("editor-menu",(r,n)=>{b4(r,n,this)}))}setUpDependencies(){this.dependencyManager.dependencies=[{name:"Dataview",pluginId:"dataview",minVersion:new Qa(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Qa(0,3,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new Qa(2,2,3)}]}setUpMetadataManager(){this.metadataManager=new ec,this.metadataManager.registerSource(new Qv(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new vv("memory",this.metadataManager)),this.metadataManager.registerSource(new yv("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new bv("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.plugin.registerEvent(this.app.vault.on("rename",(e,r)=>{this.mountableManager.unloadFile(r),this.metadataManager.onStoragePathRenamed(r,e.path)})),this.plugin.registerEvent(this.app.vault.on("delete",e=>{this.mountableManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.plugin.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.getSettings().syncInterval))}addPostProcessors(){this.plugin.registerMarkdownPostProcessor((e,r)=>{let n=e.querySelectorAll("code"),i=r.sourcePath;for(let a=0;a<n.length;a++){let o=n.item(a);if(o.hasClass("mb-none"))continue;let s=o.innerText,l=this.api.isInlineFieldDeclarationAndGetType(s);if(l===void 0)continue;let u=this.api.createInlineFieldOfTypeFromString(l,s,i,void 0);this.api.wrapInMDRC(u,o,r)}},1),this.plugin.registerMarkdownCodeBlockProcessor("meta-bind",async(e,r,n)=>{await(0,zo.loadPrism)();let i=r,a=e.trim(),o=n.sourcePath,s=this.api.isInlineFieldDeclarationAndGetType(a);if(s===void 0)return;let l=this.api.createInlineFieldOfTypeFromString(s,a,o,void 0,"block",new vp(n,r));this.api.wrapInMDRC(l,i,n)}),this.plugin.registerMarkdownCodeBlockProcessor("meta-bind-js-view",async(e,r,n)=>{await(0,zo.loadPrism)();let i=this.api.createJsViewFieldMountable(n.sourcePath,{declaration:e});this.api.wrapInMDRC(i,r,n)}),this.plugin.registerMarkdownCodeBlockProcessor("meta-bind-embed",async(e,r,n)=>{await(0,zo.loadPrism)();let i=this.api.createEmbedMountable(n.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,r,n)});for(let e=1;e<=_m;e++)this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,async(r,n,i)=>{await(0,zo.loadPrism)();let a=this.api.createEmbedMountable(i.sourcePath,{content:r,depth:e});this.api.wrapInMDRC(a,n,i)});this.plugin.registerMarkdownCodeBlockProcessor("meta-bind-button",async(e,r,n)=>{await(0,zo.loadPrism)();let i=this.api.createButtonMountable(n.sourcePath,{declaration:e,isPreview:!1,position:new vp(n,r)});this.api.wrapInMDRC(i,r,n)})}addCommands(){this.plugin.addCommand({id:"open-docs",name:"Open docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.plugin.addCommand({id:"open-playground",name:"Open playground",callback:()=>{this.activateView(cl)}}),this.plugin.addCommand({id:"open-help",name:"Open Help",callback:()=>{this.activateView(cl)}}),this.plugin.addCommand({id:"open-button-builder",name:"Open button builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,zo.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.plugin.addCommand({id:"copy-command-id",name:"Select and copy command id",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.plugin.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.plugin.register(()=>e.remove())}if(this.build==="canary"){let e=this.plugin.addStatusBarItem();e.setText("Meta Bind Canary Build (1.4.2)"),e.addClass("mb-error"),this.plugin.register(()=>e.remove())}}async activateView(e){let{workspace:r}=this.app,n,i=r.getLeavesOfType(e);i.length>0?n=i[0]:(n=r.getLeaf("tab"),await n.setViewState({type:e,active:!0})),await r.revealLeaf(n)}getSettings(){return this.plugin.settings}saveSettings(e){this.plugin.settings=e,this.plugin.saveSettings()}},ay=class extends zo.Plugin{async onload(){console.log("meta-bind | Main >> loading"),console.time("meta-bind | Main >> load-time"),await this.loadSettings(),this.mb=new iy(this),this.api=this.mb.api,this.mb.updateInternalSettings(this.settings),console.timeEnd("meta-bind | Main >> load-time")}onunload(){this.mb.destroy(),console.log("meta-bind | Main >> unload")}async loadSettings(){console.log("meta-bind | Main >> loading settings");let e=await this.loadData()??{};typeof e=="object"&&e!=null&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},zf,e),rs(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),await this.saveData(this.settings)}async onExternalSettingsChange(){await this.loadSettings(),this.mb.updateInternalSettings(this.settings)}};
/*! Bundled license information:
moment/moment.js:
(*! moment.js *)
(*! version : 2.30.1 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
decimal.js/decimal.mjs:
(*!
* decimal.js v10.5.0
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*)
*/
/* nosourcemap */